运维百科

Linux内核更新_更新网卡驱动

kernel: eth0: igb_reset_task: Reset adapter解决方法

1、 LVS集群web项目,运行大概一个月左右出现访问慢的情况,查询mysql服务器时/var/log/message日志文件,发现以下内容:

Dec  6 04:15:29 localhost kernel: igb 0000:01:00.1: eth1: Reset adapter

Dec  6 04:15:29 localhost kernel: igb 0000:01:00.0: eth0: Reset adapter

Dec  6 04:15:31 localhost kernel: igb: eth0 NIC Link is Up 100 Mbps Full Duplex, Flow Control: RX

Dec  6 04:15:31 localhost kernel: igb: eth1 NIC Link is Up 100 Mbps Full Duplex, Flow Control: RX

Dec  6 04:24:01 localhost kernel: igb 0000:01:00.1: eth1: Reset adapter

Dec  6 04:24:01 localhost kernel: igb 0000:01:00.0: eth0: Reset adapter

Dec  6 04:24:03 localhost kernel: igb: eth0 NIC Link is Up 100 Mbps Full Duplex, Flow Control: RX

Dec  6 04:24:03 localhost kernel: igb: eth1 NIC Link is Up 100 Mbps Full Duplex, Flow Control: RX

解决办法:

根据各位同仁建议,是升级网卡驱动,根据各自服务器使用的网卡到官网下载。

http://www.intel.cn/content/www/cn/zh/homepage.html  Intel官网,下载中心

wget https://downloadmirror.intel.com/13663/eng/igb-5.3.2.tar.gz

https://downloadcenter.intel.com/zh-cn/download/13663/-82575-6-82580-I350-I210-211-Linux-

1.png

 

2、 将当前内核(2.6.32-358.el6.x86_64)升级到目标内核(2.6.32-573.8.1.el6.x86_64),但是编译的目标内核(2.6.32-573.8.1.el6.x86_64)的对应驱动程序并不一定支持当前系统的对应设备。本篇将详细讲述目标内核驱动无法支持当前网卡设备的处理步骤。

01
、更新内核 
CentOS release 6.4 (Final)
对应的kernel默认为2.6.32-358.el6.x86_64

# uname -r

2.6.32-358.el6.x86_64

安装增强功能需要kernel-devel包,必须保证kernel-devel和kernel版本的一致。查看软件源中kernel-devel的版本:

# yum info kernel-devel

当前的kernel-devel版本是2.6.32-573.8.1.el6.x86_64。因此,必须升级kernel:

# yum update kernel

升级完后必须重启系统,新的kernel才能被使用。

 

  02、安装kernel-devel和gcc

  # yum install kernel-devel gcc gcc-c++


03、显示所有网卡 
由于一个系统可以支持多张网卡,可通过如下命显示当前系统的所有网卡及其基本信息:

[root@localhostsrc]# ifconfig -a

eth0      Link encap:EthernetHWaddr 0C:C4:7A:15:E3:58 

inet addr:192.168.1.120  Bcast:192.168.1.255  Mask:255.255.255.0

inet6addr: fe80::ec4:7aff:fe15:e358/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:33988 errors:0 dropped:0 overruns:0 frame:0

          TX packets:8164 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

          RX bytes:2939087 (2.8 MiB)  TX bytes:1024040 (1000.0 KiB)

 

eth1      Link encap:EthernetHWaddr 0C:C4:7A:15:E3:59 

inet addr:192.168.10.5  Bcast:192.168.10.255  Mask:255.255.255.0

inet6addr: fe80::ec4:7aff:fe15:e359/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:19780 errors:0 dropped:0 overruns:0 frame:0

          TX packets:22025 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

          RX bytes:2411611 (2.2 MiB)  TX bytes:13824852 (13.1 MiB)

 

lo        Link encap:Local Loopback 

inet addr:127.0.0.1  Mask:255.0.0.0

inet6addr: ::1/128 Scope:Host

          UP LOOPBACK RUNNING  MTU:65536  Metric:1

          RX packets:2803 errors:0 dropped:0 overruns:0 frame:0

          TX packets:2803 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:0

          RX bytes:430259 (420.1 KiB)  TX bytes:430259 (420.1 KiB)

04
、查看网卡所需驱动

使用ethtool命令可以查看指定网卡所以来的网卡驱动信息:

[root@localhostsrc]# ethtool -i eth0

driver: igb - 网卡em3依赖igb驱动

version: 4.0.1-k

firmware-version: 3.29, 0x023b8000

bus-info: 0000:01:00.0

supports-statistics: yes

supports-test: yes

supports-eeprom-access: yes

supports-register-dump: yes

supports-priv-flags: no

注:igb 驱动程序支持所有基于 82575 、 82576 、 82580 和 I350 的千兆位网络连接。

错误信息:

    [root@localhost ~]# lspci

    -bash: lspci: command not found

    问题原因:

    这是因为没有安装pciutils包造成的。

    解决办法:

    #yum install pciutils

 

05、查看网卡型号

通过③我们已经知道了网卡所依赖的驱动,但是还不知具体的网卡驱动型号,此时可通过如下命令查询:

[root@localhost ~]# lspci -nn | grep "Eth"

01:00.0 Ethernet controller [0200]: Intel Corporation I350 Gigabit Network Connection [8086:1521] (rev 01)

01:00.1 Ethernet controller [0200]: Intel Corporation I350 Gigabit Network Connection [8086:1521] (rev 01)

注:Gigabit为千兆 10-Gigabit为万兆

 

由④的操作可知当前内核(2.6.32-220.el6.x86_64)千兆网络驱动igb支持网卡型号[8086:1521],因此必须要求目标内核(2.6.33-110.el6.x86_64)对该型号网卡[8086:1521]的支持。

 

06、查看目标内核的网卡驱动是否支持当前型号网卡

可以通过modinfo命令查看*.ko对哪种设备型号的支持,目标内核(2.6.33-110.el6.x86_64)的相关驱动可在/lib/modules/2.6.33-110.el6.x86_64的目录想找到,如下所示:

#modinfo /lib/modules/2.6.32-358.el6.x86_64/kernel/drivers/net/igb/igb.ko

filename:       /lib/modules/2.6.32-358.el6.x86_64/kernel/drivers/net/igb/igb.ko

version:        4.0.1-k

license:        GPL

description:    Intel(R) Gigabit Ethernet Network Driver

author:         Intel Corporation, <e1000-devel@lists.sourceforge.net>

srcversion:     04D309663B138858B8AF619

alias:          pci:v00008086d000010D6sv*sd*bc*sc*i*

alias:          pci:v00008086d000010A9sv*sd*bc*sc*i*

alias:          pci:v00008086d000010A7sv*sd*bc*sc*i*

alias:          pci:v00008086d000010E8sv*sd*bc*sc*i*

alias:          pci:v00008086d00001526sv*sd*bc*sc*i*

alias:          pci:v00008086d0000150Dsv*sd*bc*sc*i*

alias:          pci:v00008086d000010E7sv*sd*bc*sc*i*

alias:          pci:v00008086d000010E6sv*sd*bc*sc*i*

alias:          pci:v00008086d00001518sv*sd*bc*sc*i*

alias:          pci:v00008086d0000150Asv*sd*bc*sc*i*

alias:          pci:v00008086d000010C9sv*sd*bc*sc*i*

alias:          pci:v00008086d00000440sv*sd*bc*sc*i*

alias:          pci:v00008086d0000043Csv*sd*bc*sc*i*

alias:          pci:v00008086d0000043Asv*sd*bc*sc*i*

alias:          pci:v00008086d00000438sv*sd*bc*sc*i*

alias:          pci:v00008086d00001516sv*sd*bc*sc*i*

alias:          pci:v00008086d00001511sv*sd*bc*sc*i*

alias:          pci:v00008086d00001510sv*sd*bc*sc*i*

alias:          pci:v00008086d00001527sv*sd*bc*sc*i*

alias:          pci:v00008086d0000150Fsv*sd*bc*sc*i*

alias:          pci:v00008086d0000150Esv*sd*bc*sc*i*

alias:          pci:v00008086d00001524sv*sd*bc*sc*i*

alias:          pci:v00008086d00001523sv*sd*bc*sc*i*

alias:          pci:v00008086d00001522sv*sd*bc*sc*i*

alias:          pci:v00008086d00001521sv*sd*bc*sc*i*

alias:          pci:v00008086d00001538sv*sd*bc*sc*i*

alias:          pci:v00008086d00001537sv*sd*bc*sc*i*

alias:          pci:v00008086d00001536sv*sd*bc*sc*i*

alias:          pci:v00008086d00001533sv*sd*bc*sc*i*

alias:          pci:v00008086d00001539sv*sd*bc*sc*i*

depends:        ptp,dca

vermagic:       2.6.32-358.el6.x86_64 SMP mod_unload modversions

parm:           max_vfs:Maximum number of virtual functions to allocate per physical function (uint)

parm:           debug:Debug level (0=none,...,16=all) (int)

从以上信息中找不到[8086:1521]的信息,因此,目标内核(2.6.32-358.el6.x86_64)网卡驱动不支持当前网卡!

07
、到官网下载网卡驱动
既然已经明确了目标内核的网卡驱动并不支持当前的网卡设备,也就是说一旦启用新的内核,将导致系统无法正常使用网络功能。如果是英特尔的网卡设备,则可到:http://www.intel.cn/content/www/cn/zh/homepage.html 下载所需的驱动源码到本地。

08
、编译网卡驱动 
解压驱动源码后,按照以下命令格式编译驱动源码:

#cd igb-5.3.2/src

#make BUILD_KERNEL=2.6.32-573.12.1.el6.x86_64

说明:2.6.32-573.12.1.el6.x86_64 为内核版本,请根据自己的服务器内核版本输入;

以上命令将会生成网卡驱动igb.ko。其中BUILD_KERNEL指明需要为哪个内核编译驱动,默认是给当前正在运行的内核编译,在此我们设定为目标内核(2.6.32-573.12.1.el6.x86_64)。那么又该如何查看新生成的网卡驱动igb.ko是否支持当前的网卡设备呢?

09
、检查网卡驱动是否支持当前网卡
步骤⑦将会生成网卡驱动igb.ko,这时可通过modinfo命令验证该驱动是否支持网卡设备[8086:1521],如下所示:

[root@localhost src]# modinfo igb.ko

filename:       igb.ko

version:        5.3.2

license:        GPL

description:    Intel(R) Gigabit Ethernet Network Driver

author:         Intel Corporation, <e1000-devel@lists.sourceforge.net>

srcversion:     B821C1F6B2F95B48EC6DFDA

alias:          pci:v00008086d000010D6sv*sd*bc*sc*i*

alias:          pci:v00008086d000010A9sv*sd*bc*sc*i*

alias:          pci:v00008086d000010A7sv*sd*bc*sc*i*

alias:          pci:v00008086d000010E8sv*sd*bc*sc*i*

alias:          pci:v00008086d00001526sv*sd*bc*sc*i*

alias:          pci:v00008086d0000150Dsv*sd*bc*sc*i*

alias:          pci:v00008086d000010E7sv*sd*bc*sc*i*

alias:          pci:v00008086d000010E6sv*sd*bc*sc*i*

alias:          pci:v00008086d00001518sv*sd*bc*sc*i*

alias:          pci:v00008086d0000150Asv*sd*bc*sc*i*

alias:          pci:v00008086d000010C9sv*sd*bc*sc*i*

alias:          pci:v00008086d00000440sv*sd*bc*sc*i*

alias:          pci:v00008086d0000043Csv*sd*bc*sc*i*

alias:          pci:v00008086d0000043Asv*sd*bc*sc*i*

alias:          pci:v00008086d00000438sv*sd*bc*sc*i*

alias:          pci:v00008086d00001516sv*sd*bc*sc*i*

alias:          pci:v00008086d00001511sv*sd*bc*sc*i*

alias:          pci:v00008086d00001510sv*sd*bc*sc*i*

alias:          pci:v00008086d00001527sv*sd*bc*sc*i*

alias:          pci:v00008086d0000150Fsv*sd*bc*sc*i*

alias:          pci:v00008086d0000150Esv*sd*bc*sc*i*

alias:          pci:v00008086d00001524sv*sd*bc*sc*i*

alias:          pci:v00008086d00001523sv*sd*bc*sc*i*

alias:          pci:v00008086d00001522sv*sd*bc*sc*i*

alias:          pci:v00008086d00001521sv*sd*bc*sc*i*

alias:          pci:v00008086d00001539sv*sd*bc*sc*i*

alias:          pci:v00008086d0000157Csv*sd*bc*sc*i*

alias:          pci:v00008086d0000157Bsv*sd*bc*sc*i*

alias:          pci:v00008086d00001538sv*sd*bc*sc*i*

alias:          pci:v00008086d00001537sv*sd*bc*sc*i*

alias:          pci:v00008086d00001536sv*sd*bc*sc*i*

alias:          pci:v00008086d00001533sv*sd*bc*sc*i*

alias:          pci:v00008086d00001F45sv*sd*bc*sc*i*

alias:          pci:v00008086d00001F41sv*sd*bc*sc*i*

alias:          pci:v00008086d00001F40sv*sd*bc*sc*i*

depends:        i2c-core,ptp,dca,i2c-algo-bit

vermagic:       2.6.32-573.8.1.el6.x86_64 SMP mod_unload modversions

parm:           InterruptThrottleRate:Maximum interrupts per second, per vector, (max 100000), default 3=adaptive (array of int)

parm:           IntMode:Change Interrupt Mode (0=Legacy, 1=MSI, 2=MSI-X), default 2 (array of int)

parm:           Node:set the starting node to allocate memory on, default -1 (array of int)

parm:           LLIPort:Low Latency Interrupt TCP Port (0-65535), default 0=off (array of int)

parm:           LLIPush:Low Latency Interrupt on TCP Push flag (0,1), default 0=off (array of int)

parm:           LLISize:Low Latency Interrupt on Packet Size (0-1500), default 0=off (array of int)

parm:           RSS:Number of Receive-Side Scaling Descriptor Queues (0-8), default 1, 0=number of cpus (array of int)

parm:           VMDQ:Number of Virtual Machine Device Queues: 0-1 = disable, 2-8 enable, default 0 (array of int)

parm:           max_vfs:Number of Virtual Functions: 0 = disable, 1-7 enable, default 0 (array of int)

parm:           MDD:Malicious Driver Detection (0/1), default 1 = enabled. Only available when max_vfs is greater than 0 (array of int)

parm:           QueuePairs:Enable Tx/Rx queue pairs for interrupt handling (0,1), default 1=on (array of int)

parm:           EEE:Enable/disable on parts that support the feature (array of int)

parm:           DMAC:Disable or set latency for DMA Coalescing ((0=off, 1000-10000(msec), 250, 500 (usec)) (array of int)

parm:           LRO:Large Receive Offload (0,1), default 0=off (array of int)

parm:           debug:Debug level (0=none, ..., 16=all) (int)

 

终于在显示的信息中找到了[8086:1521]信息,说明新生成的驱动文件能够支持当前网卡型号。那么如何让目标内核(2.6.32-573.8.1.el6.x86_64)能够载入新驱动呢?

09
、更新目标内核驱动

# cd /usr/local/src/igb-5.3.2/src

# make install

# rmmod igb; modprobe igb

 

对于120秒超时问题在/etc/sysctl.conf文件里面添加

vm.dirty_background_ratio=5

vm.dirty_ratio=10


10
、以上工作完成后,可以重启系统了!

[root@localhost src]# ethtool -i eth0

driver: igb

version: 5.3.2

firmware-version: 1.52, 0x800007ae

bus-info: 0000:01:00.0

supports-statistics: yes

supports-test: yes

supports-eeprom-access: yes

supports-register-dump: yes

supports-priv-flags: no


本站部分资源收集于网络,纯个人收藏,无商业用途,如有侵权请及时告知!

3
分享到:

评论 0

取消
  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址