Increasing Linux Ring Buffer Size

This doesn’t work on all drivers, but on the bnx2x and other it does.   In particular, if you are seeing packet drops this can help.

 

Use ethtool –g <interface> to see the buffer settings.

# ethtool -g eth0

Ring parameters for eth0:

Pre-set maximums:

RX:             4078

RX Mini:        0

RX Jumbo:       0

TX:             4078

Current hardware settings:

RX:             254

RX Mini:        0

RX Jumbo:       0

TX:             4078

 

You see the RX in the “Current hardware settings” is set lower than the “Pre-set maximums”.

 

This script will set all eth* interface to the “Pre-set maximums”

 

for i in $( /sbin/ifconfig -a|grep “^eth”|awk ‘{print $1}’); do

/sbin/ethtool -G $i rx $(ethtool -g $i|sed -n -e “/Pre-set maximums/,/Current hardware settings/p”|grep “^RX:” |awk ‘{print $NF}’)

done

 

 

After running the script:

# ethtool -g eth0

Ring parameters for eth0:

Pre-set maximums:

RX:             4078

RX Mini:        0

RX Jumbo:       0

TX:             4078

Current hardware settings:

RX:             4078

RX Mini:        0

RX Jumbo:       0

TX:             4078

Leave a Reply