TCP Packet size


 
Thread Tools Search this Thread
Special Forums IP Networking TCP Packet size
# 1  
Old 05-17-2011
Question [solved] TCP Packet size

Hi!

I'm writing an application (using BSD sockets on a Linux host) which communicates over TCP/IP with an embedded device. This embedded device has an old and real slow integrated circuit (Epson S1S6000) which handles all of the TCP/IP communication for it.

Problem is, this circuit (S1S6000) advertises a TCP window size of 536 bytes and while analyzing the traffic with wireshark I can see that my application (or the Linux TCP stack) only transmits packets of half that size. This results in a lot of unnecessary transmission overhead which slows down the communication quite a bit.

Do you know how to change this behavior? Maybe some socket option, or TCP stack setting?

The host is running a Linux 2.6.38 kernel.

Thanks in advance!

/Olle

Last edited by olle; 05-25-2011 at 01:14 PM..
# 2  
Old 05-17-2011
The frame size, or MTU, can be changed with ipconfig. However with ancient hardware I do not know what you'll get.

Is there anyway to 'go around' the ancient chip? Use nul modem for a poor choice example?
# 3  
Old 05-17-2011
It sounds like you turned off the nyquist algorythm stesockopt TCP level TCP_NODELAY, which is good, so it does not hold data in the buffer for a bit speculating there might be more. Your problem is that you are writing or sending small parts, and need to send the whole message at once, perhaps using a fdopen FILE* and fflush().

Note that by making full packets, you are creating delay. If the first small packet overhead is so great, the packets should be full from that point on. I hope you set the setsockopt SO_SNDBUF big, so it can accumulate enough to keep sending full packets.

Of course, if you could increase the window even just to 2920 ( 2 x ( 1500 - 40 )), that would be grand, allowing you to send two full ethernet packets before blocking.
# 4  
Old 05-18-2011
mcnamara: No, there is unfortunately no way to get around using another chip.
And I should have mentioned that the MSS given from this device/chip is at 536 bytes. And this communication takes place at a local network. And there are no ICMP messages indicating that this MSS is set too high.

From a Windows application, which too communicates with this device, the packet size used is 536 bytes (well, only when needed of course). The chip is terrible slow anyway, but doing all this extra ACK'ing is making it much worse.

I'm passing buffers to send() which, some of them, are quite a lot bigger than 536 bytes and still the biggest TCP packet seen has a data length of 268 bytes. And as said the window size announced is always at 536 bytes from the chip. Still I fail to see how this makes any sense.

DGPickett: I can see that send() is swallowing chunks bigger than 268 bytes. I have tried playing around with TCP options like NODELAY, and changing socket buffer sizes. And have tried to change some of the settings found at /proc/sys/net related to TCP, but still nothing have changed this behavior.

Thank you for helping, and more tips are welcome Smilie
# 5  
Old 05-19-2011
Maybe it has an MTU of less. Obsolete IP option 12 can send this during connect without the ICMP of PATH MTU Discovery. IP, Internet Protocol

The MSS is the total remote buffer, the MTU is the packet max. Disregarding the chance of TCP options, a packet header is 20 IP + 20 TCP, so a packet sends MTU - 40, and the number of packets sent before ack is MSS/(MTU-40) including any partial. Since this is local, the ack round trip should be very short, so packets should not be MSS trimmed unless there is blocking downstream.
# 6  
Old 05-20-2011
Quote:
Originally Posted by DGPickett
Maybe it has an MTU of less. Obsolete IP option 12 can send this during connect without the ICMP of PATH MTU Discovery.

The MSS is the total remote buffer, the MTU is the packet max. Disregarding the chance of TCP options, a packet header is 20 IP + 20 TCP, so a packet sends MTU - 40, and the number of packets sent before ack is MSS/(MTU-40) including any partial. Since this is local, the ack round trip should be very short, so packets should not be MSS trimmed unless there is blocking downstream.
Thanks for your support.

Well, I don't find anything in the IP header(s) which looks like IP option 12. Have attached a small wireshark dump, if you would like to have look though.

If it is to any help, the MTU of the interface at my host machine is set to 1500. And regarding the chip, I know it can handle a MTU of 536 + headers, as I can see the Windows application send it packets of this size (from the same machine too).
# 7  
Old 05-25-2011
Verified that the same behavior exists under Debian (with a 2.6.35 kernel). And under Arch Linux (with a 2.6.34 kernel).
And verified that the same application executed under a windows host (well, cygwin) does send TCP packets of 536 bytes when needed.

---------- Post updated at 06:12 PM ---------- Previous update was at 02:34 PM ----------

If anyone is interested...
Found the reason of the behavior after digging around in the TCP code of Linux. Found this function which limits the mss to half the window size (tcp_bound_to_half_wnd()). Well, it actually avoid this limiting if the max window size is less than 512, unfortunately my window is a tiny bit bigger than that so it doesn't apply to this rule.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

WakeOnLan, tcp packet

I'd like to use SPARC Solaris10 to 'wake up' an old PC on same LAN. what is the simplest way of doing it? (preferably without installing new software) thanks. (14 Replies)
Discussion started by: orange47
14 Replies

2. Solaris

Too much TCP retransmitted and TCP duplicate on server Oracle Solaris 10

I have problem with oracle solaris 10 running on oracle sparc T4-2 server. Os information: 5.10 Generic_150400-03 sun4v sparc sun4v Output from tcpstat.d script TCP bytes: out outRetrans in inDup inUnorder 6833763 7300 98884 0... (2 Replies)
Discussion started by: insatiable1610
2 Replies

3. AIX

Packet loss coming with big packet size ping

(5 Replies)
Discussion started by: Vishal_dba
5 Replies

4. Solaris

Need help with configuring large packet size on Solaris 7 / e6500

Greetings, I'm stuck in a time warp using ancient machines from the prehistoric era that should be rightfully displayed in the Smithsonian. We're running Solaris 7 on FDDI n/w on an E6500 host and wish to use MTU (packet size) > 1500, more like 3072 bytes to begin with and possibly up to 4096... (9 Replies)
Discussion started by: sharique
9 Replies

5. UNIX for Advanced & Expert Users

Need help with configuring large packet size on Solaris 7 / e6500

We're running Solaris 7 on FDDI n/w on an E6500 host and wish to use MTU (packet size) > 1500, more like 3072 bytes to begin with and possibly up to 4096 bytes. Linux has /etc/network/interfaces. Does ANYONE remember the equivalent in Unix? When I do ifconfig eth0 mtu 4000, I get the error... (0 Replies)
Discussion started by: sharique
0 Replies

6. Programming

Changing source port number of a TCP client packet

Hi all, I need to change the source port number of an outgoing TCP packet. First I have to bind the socket to a particular port(suppose 9001) but when I send the TCP packet I want to change the source port number lets say to 9002 still letting the socket to be bound to the same old port (9001).... (0 Replies)
Discussion started by: anuragrai134
0 Replies

7. IP Networking

TCP packet with RST flag not carrying DSCP

Hello, I'm having an issue with TCP sockets. When the TCP connection is terminated on one end, TCP packet with RST flag set is being sent to the sender. All the packets sent so far were carrying the DSCP 'AF21' set by me. But packet with RST flag is carrying DSCP '0'. Is this expected or... (0 Replies)
Discussion started by: Solace
0 Replies

8. HP-UX

how to get network packet size

how to get network packet size I would like get network output rate(kb/sec) I type command "netstat -i" Ipkts Ierrs Opkts Oerrs 653387 0 678202 0 but i didn't know what is it packet size , how could i get it? (1 Reply)
Discussion started by: alert0919
1 Replies

9. UNIX for Advanced & Expert Users

0821-077 ping: illegal packet size.

Hi, When i try this command ping ukblx151.ukhx.astrazeneca.net -n 3 | grep icmp it gives following error :mad:: 0821-077 ping: illegal packet size. But when i give command ping ukblx151.ukhx.astrazeneca.net It returns correct output.:D Could you please help? (2 Replies)
Discussion started by: vishal_ranjan
2 Replies

10. IP Networking

Seeing IP packet

Hi, Is there any way that i can directly take out the IP packet and see its contents. Waiting for your answer .............. Bye (4 Replies)
Discussion started by: manjunath
4 Replies
Login or Register to Ask a Question