在Debian系的Linux中编译并安装ixgbe驱动的教程
Intel的10G网卡(比如,82598、82599、x540)由ixgbe驱动支持。现代的Linux发行版已经带有了ixgbe驱动,通过可加载模块的方式使用。然而,有些情况你希望在你机器上的自己编译安装ixgbe驱动,比如,你想要体验ixbge驱动的最新特性时。同样,内核默认自带的ixgbe驱动中的一个问题是不允许你自定义驱动的参数。如果你想要一个完全定制的ixgbe驱动(比如RSS、多队列、中断阈值等等),你需要手动从源码编译ixgbe驱动。
这里是如何在Ubuntu、Debian或者它们的衍生版中下载安装ixgbe驱动的教程。
第一步:安装前提
安装之前,需要安装匹配的内核头文件和开发工具包。
$sudoapt-getinstalllinux-headers-$(uname-r) $sudoapt-getinstallgccmake
第二步:编译Ixgbe驱动
从最新的ixgbe驱动中下载源码。
$wgethttp://sourceforge.net/projects/e1000/files/ixgbe%20stable/3.23.2/ixgbe-3.23.2.tar.gz
如下编译ixgbe驱动。
$tarxvfvzixgbe-3.23.2.tar.gz $cdixgbe-3.23.2/src $make
第三步:检查Ixgbe驱动
编译之后,你会看到在ixgbe-3.23.2/src目录下创建了ixgbe.ko。这就是会加载到内核之中的ixgbe驱动。
用modinfo命令检查内核模块的信息。注意你需要指定模块文件的绝对路径(比如./ixgbe.ko或者/home/xmodulo/ixgbe/ixgbe-3.23.2/src/ixgbe.ko)。输出中会显示ixgbe内核的版本。
$modinfo./ixgbe.ko
filename:/home/xmodulo/ixgbe/ixgbe-3.23.2/src/ixgbe.ko version:3.23.2 license:GPL description:Intel(R)10GigabitPCIExpressNetworkDriver author:IntelCorporation, srcversion:2ADA5E537923E983FA9DAE2 alias:pci:v00008086d00001560sv*sd*bc*sc*i* alias:pci:v00008086d00001558sv*sd*bc*sc*i* alias:pci:v00008086d0000154Asv*sd*bc*sc*i* alias:pci:v00008086d00001557sv*sd*bc*sc*i* alias:pci:v00008086d0000154Fsv*sd*bc*sc*i* alias:pci:v00008086d0000154Dsv*sd*bc*sc*i* alias:pci:v00008086d00001528sv*sd*bc*sc*i* alias:pci:v00008086d000010F8sv*sd*bc*sc*i* alias:pci:v00008086d0000151Csv*sd*bc*sc*i* alias:pci:v00008086d00001529sv*sd*bc*sc*i* alias:pci:v00008086d0000152Asv*sd*bc*sc*i* alias:pci:v00008086d000010F9sv*sd*bc*sc*i* alias:pci:v00008086d00001514sv*sd*bc*sc*i* alias:pci:v00008086d00001507sv*sd*bc*sc*i* alias:pci:v00008086d000010FBsv*sd*bc*sc*i* alias:pci:v00008086d00001517sv*sd*bc*sc*i* alias:pci:v00008086d000010FCsv*sd*bc*sc*i* alias:pci:v00008086d000010F7sv*sd*bc*sc*i* alias:pci:v00008086d00001508sv*sd*bc*sc*i* alias:pci:v00008086d000010DBsv*sd*bc*sc*i* alias:pci:v00008086d000010F4sv*sd*bc*sc*i* alias:pci:v00008086d000010E1sv*sd*bc*sc*i* alias:pci:v00008086d000010F1sv*sd*bc*sc*i* alias:pci:v00008086d000010ECsv*sd*bc*sc*i* alias:pci:v00008086d000010DDsv*sd*bc*sc*i* alias:pci:v00008086d0000150Bsv*sd*bc*sc*i* alias:pci:v00008086d000010C8sv*sd*bc*sc*i* alias:pci:v00008086d000010C7sv*sd*bc*sc*i* alias:pci:v00008086d000010C6sv*sd*bc*sc*i* alias:pci:v00008086d000010B6sv*sd*bc*sc*i* depends:ptp,dca vermagic:3.11.0-19-genericSMPmod_unloadmodversions parm:InterruptType:ChangeInterruptMode(0=Legacy,1=MSI,2=MSI-X),defaultIntMode(deprecated)(arrayofint) parm:IntMode:ChangeInterruptMode(0=Legacy,1=MSI,2=MSI-X),default2(arrayofint) parm:MQ:DisableorenableMultipleQueues,default1(arrayofint) parm:DCA:DisableorenableDirectCacheAccess,0=disabled,1=descriptoronly,2=descriptoranddata(arrayofint) parm:RSS:NumberofReceive-SideScalingDescriptorQueues,default0=numberofcpus(arrayofint) parm:VMDQ:NumberofVirtualMachineDeviceQueues:0/1=disable,2-16enable(default=8)(arrayofint) parm:max_vfs:NumberofVirtualFunctions:0=disable(default),1-63=enablethismanyVFs(arrayofint) parm:VEPA:VEPABridgeMode:0=VEB(default),1=VEPA(arrayofint) parm:InterruptThrottleRate:Maximuminterruptspersecond,pervector,(0,1,956-488281),default1(arrayofint) parm:LLIPort:LowLatencyInterruptTCPPort(0-65535)(arrayofint) parm:LLIPush:LowLatencyInterruptonTCPPushflag(0,1)(arrayofint) parm:LLISize:LowLatencyInterruptonPacketSize(0-1500)(arrayofint) parm:LLIEType:LowLatencyInterruptEthernetProtocolType(arrayofint) parm:LLIVLANP:LowLatencyInterruptonVLANprioritythreshold(arrayofint) parm:FdirPballoc:FlowDirectorpacketbufferallocationlevel: 1=8khashfiltersor2kperfectfilters 2=16khashfiltersor4kperfectfilters 3=32khashfiltersor8kperfectfilters(arrayofint) parm:AtrSampleRate:SoftwareATRTxpacketsamplerate(arrayofint) parm:FCoE:DisableorenableFCoEOffload,default1(arrayofint) parm:LRO:LargeReceiveOffload(0,1),default1=on(arrayofint) parm:allow_unsupported_sfp:AllowunsupportedanduntestedSFP+moduleson82599basedadapters,default0=Disable(arrayofint)
第四步:测试Ixgbe驱动
在测试新的模块之前,如果你内核中已存在旧版本ixgbe模块的话你需要先移除它。
$sudormmodixgbe
接着使用insmod命令插入新编译的ixgbe模块。确保指定一个模块的绝对路径。
$sudoinsmod./ixgbe.ko
如果上面的命令成功运行,就不会显示任何的信息。
如果你需要,你可以尝试加入额外的参数。比如,设置RSS的队列数量为16:
$sudoinsmod./ixgbe.koRSS=16
检查/var/log/kern.log来查看ixgbe驱动是否成功激活。查看日志中的“Intel(R)10GigabitPCIExpressNetworkDriver”。ixgbe的版本信息应该和之前的modinfo的显示应该相同。
Sep1814:48:52spongebobkernel:[684717.906254]Intel(R)10GigabitPCIExpressNetworkDriver-version3.22.3
第五步:安装Ixgbe驱动
一旦你验证新的ixgbe驱动可以成功加载,最后一步是在你的系统中安装驱动。
$sudomakeinstall
ixgbe.ko会安装在/lib/modules//kernel/drivers/net/ethernet/intel/ixgbe下。
从这一步起,你可以用下面的modprobe命令加载ixgbe驱动了。注意你不必再指定绝对路径。
$sudomodprobeixgbe
如果你希望在启动时加载ixgbe驱动,你可以在/etc/modules的最后加入“ixgbe”。