#!/bin/bash
# Because of some igb driver(eg: 4.0.17) won't open RSS default,
# so we need to manually open it.
# Attention: Some igb driver won't have parm (eg:IntMode,RSS). So
# this functions is needed to check current kernel's igb dirver if
# support this param or not.

MODPATH=$1

parm_count=$(modinfo $MODPATH | grep -cE 'RSS:|IntMode:')

if [ $parm_count -eq 2 ];then
        echo 'install igb /sbin/modprobe --ignore-install igb RSS=0,0,0,0 IntMode=2,2,2,2 || /sbin/modprobe --ignore-install igb' > /etc/modprobe.d/igb.conf
else
        [ -f /etc/modprobe.d/igb.conf ] && rm -f /etc/modprobe.d/igb.conf 
fi
