/etc/rc.localに下記を設定し、起動時にすべてのNICに対して下記パラメータを設定できるようにしてみました。
- NICオフロードの無効化
パケット分解処理(tso)とスキャッタギャザー機能(gro)及びチェックサム(rx,tx)を無効化
-
バッファサイズの変更
設定可能な上限よりも大きい値を指定すると反映されないので
先にethtool -gで上限を確認した後、ethtool -Gで設定しています。 -
送信キューのサイズを変更
ifconfigのtxqueuelenオプションで指定しています。
/etc/rc.local
OFFLOADPARAM="tso gro rx tx"
function setofflod() { for param in ${OFFLOADPARAM}; do ethtool -K $1 $param off ; done }
function getmaxbuf() { param=`echo $2 | tr "[:lower:]" "[:upper:]"`; ethtool -g $1 | gawk '$1 ~ /^'"${param}"':/ {print $2}' | head -1; }
function setcurbuf() { for param in tx rx; do max=`getmaxbuf $1 $param` ; ethtool -G $1 $param $max ; done }
function settxqlen() { ifconfig $1 txqueuelen 10000 ; }
function setnicparam() { setofflod $1;setcurbuf $1;settxqlen $1 ;}
for nic in `ip link | gawk -F': ' '$1 ~ /^[0-9]/&&$2 ~ /^eth/ {print $2}'`; do { setnicparam $nic ;} ; done
unset setofflod
unset getmaxbuf
unset setcurbuf
unset settxqlen
unset setnicparam
EOF