How to modify the transmit queue length (buffer) of the network interface

Solution 1:

To set the default transmit queue: (e.g to 150 packets):

sysctl -w net.link.generic.system.sndq_maxlen=150

and default receive queue: (e.g to 260 packets)

sysctl -w net.link.generic.system.rcvq_maxlen=260

To check the system defaults queue sizes for send and receive (current defaults on MacOSX10.4 are 128 (send) and 256 (recv) respectively):

sysctl net.link.generic.system.sndq_maxlen
sysctl net.link.generic.system.rcvq_maxlen

It's unclear if it is possible to set a per interface queue length. The output queue length's default is set in the [xnu] kernel: bsd/net/if.h:#define IFQ_MAXLEN 128

On older kernels (OSX10.7) you could to set the maximum input queue length on OSX as follows (e.g. to 100 packets) - which can be useful for tuning performance with incoming packets flows - it's the internal queue that packets are put when they come off the incoming interface:

sysctl -w net.inet.ip.intr_queue_maxlen=100