51工具盒子

依楼听风雨
笑看云卷云舒,淡观潮起潮落

Centos6 编译e1000e网卡驱动时报错:'dev' undeclared

概述

由于服务器e1000e网卡驱动不兼容,需要升级e1000e网卡驱动。在编译时遇到如下错误:

[root@94 src]# make
make[1]: Entering directory `/usr/src/kernels/2.6.32-573.el6.x86_64'
  CC [M]  /root/e1000e-3.8.4/src/netdev.o
/root/e1000e-3.8.4/src/netdev.c: In function 'e1000e_pm_resume':
/root/e1000e-3.8.4/src/netdev.c:7788: error: 'dev' undeclared (first use in this function)
/root/e1000e-3.8.4/src/netdev.c:7788: error: (Each undeclared identifier is reported only once
/root/e1000e-3.8.4/src/netdev.c:7788: error: for each function it appears in.)
make[2]: *** [/root/e1000e-3.8.4/src/netdev.o] Error 1
make[1]: *** [_module_/root/e1000e-3.8.4/src] Error 2
make[1]: Leaving directory `/usr/src/kernels/2.6.32-573.el6.x86_64'
make: *** [default] Error 2

处理办法

编辑netdev.c文件第7788行内容

struct net_device *netdev = pci_get_drvdata(to_pci_dev(dev));

修改为

struct net_device *netdev = pci_get_drvdata(to_pci_dev(pdev));

其他

# 查看驱动文件路径
[root@94 ~]# modinfo -F filename e1000e
/lib/modules/2.6.32-754.el6.x86_64/kernel/drivers/net/e1000e/e1000e.ko
# 查看驱动版本
[root@94 ~]# modinfo -F version e1000e
3.2.6-k
赞(0)
未经允许不得转载:工具盒子 » Centos6 编译e1000e网卡驱动时报错:'dev' undeclared