[Xorp-hackers] Question on fea's use of sendmsg

Pavlin Radoslavov pavlin at ICSI.Berkeley.EDU
Mon Mar 10 17:12:37 PDT 2008


> >> Also, I noticed that the sender socket had a large amount of packets
> >> in it's rx buffer because nothing ever reads it.  I added code to set
> >> it's rx buflen to only 8k, and I'm now adding logic to read & discard
> >> those packets in case they are somehow jamming up the system due to
> >> consuming too many kernel buffers.
> > 
> > FYI, there was a bug in the I/O code in the FEA: the size of the rx
> > buflen was increased instead of the tx buflen for sockets used for
> > transmission. The bug is now fixed in CVS.
> 
> Sounds good.  Did you also set the rx side to be very small?  I
> have been setting it to 4000, though something smaller might work
> as well.  Setting it to zero failed for reasons I never pursued.

That's odd. What kernel version are you using?
A quick check in linux-2.6.19 reveals that if you try to set the
rcvbuf size to a very small value the kernel will automatically
adjust it up (also confirmed by the socket(7) manual page).

E.g., the linux/net/core.c kernel file has the following code:

                        if ((val * 2) < SOCK_MIN_RCVBUF)
                                sk->sk_rcvbuf = SOCK_MIN_RCVBUF;
                        else
                                sk->sk_rcvbuf = val * 2;

where SOCK_MIN_RCVBUF is defined as 256.
There is similar code for the sndbuf size which is automatically set
to be at least 2048.
Of course those values are Linux specific, so I'd rather use size 0
for SO_SNDBUF and SO_RCVBUF and let the kernel deal with it.

Pavlin



More information about the Xorp-hackers mailing list