无法在 Ubuntu 14.04 上编译 INTEL 82599 驱动程序

无法在 Ubuntu 14.04 上编译 INTEL 82599 驱动程序

我正在尝试在我的计算机上编译驱动程序,但出现以下错误:

~/ixgbe-3.21.2/src$ make install
make -C /lib/modules/3.13.0-46-generic/build SUBDIRS=/home/nandan/ixgbe-3.21.2/src modules
make[1]: Entering directory `/usr/src/linux-headers-3.13.0-46-generic'
  CC [M]  /home/nandan/ixgbe-3.21.2/src/ixgbe_main.o
In file included from /home/nandan/ixgbe-3.21.2/src/ixgbe_osdep.h:37:0,
                 from /home/nandan/ixgbe-3.21.2/src/ixgbe_type.h:65,
                 from /home/nandan/ixgbe-3.21.2/src/ixgbe_dcb.h:28,
                 from /home/nandan/ixgbe-3.21.2/src/ixgbe.h:47,
                 from /home/nandan/ixgbe-3.21.2/src/ixgbe_main.c:50:
/home/nandan/ixgbe-3.21.2/src/kcompat.h:4055:6: error: nested redefinition of ‘enum pkt_hash_types’
 enum pkt_hash_types {
      ^
/home/nandan/ixgbe-3.21.2/src/kcompat.h:4055:6: error: redeclaration of ‘enum pkt_hash_types’
In file included from include/linux/if_ether.h:23:0,
                 from include/uapi/linux/ethtool.h:17,
                 from include/linux/ethtool.h:16,
                 from include/linux/netdevice.h:42,
                 from /home/nandan/ixgbe-3.21.2/src/ixgbe_main.c:30:
include/linux/skbuff.h:728:6: note: originally defined here
 enum pkt_hash_types {
      ^
In file included from /home/nandan/ixgbe-3.21.2/src/ixgbe_osdep.h:37:0,
                 from /home/nandan/ixgbe-3.21.2/src/ixgbe_type.h:65,
                 from /home/nandan/ixgbe-3.21.2/src/ixgbe_dcb.h:28,
                 from /home/nandan/ixgbe-3.21.2/src/ixgbe.h:47,
                 from /home/nandan/ixgbe-3.21.2/src/ixgbe_main.c:50:
/home/nandan/ixgbe-3.21.2/src/kcompat.h:4056:2: error: redeclaration of enumerator ‘PKT_HASH_TYPE_NONE’
  PKT_HASH_TYPE_NONE,
  ^
In file included from include/linux/if_ether.h:23:0,
                 from include/uapi/linux/ethtool.h:17,
                 from include/linux/ethtool.h:16,
                 from include/linux/netdevice.h:42,
                 from /home/nandan/ixgbe-3.21.2/src/ixgbe_main.c:30:
include/linux/skbuff.h:729:2: note: previous definition of ‘PKT_HASH_TYPE_NONE’ was here
  PKT_HASH_TYPE_NONE, /* Undefined type */
  ^
In file included from /home/nandan/ixgbe-3.21.2/src/ixgbe_osdep.h:37:0,
                 from /home/nandan/ixgbe-3.21.2/src/ixgbe_type.h:65,
                 from /home/nandan/ixgbe-3.21.2/src/ixgbe_dcb.h:28,
                 from /home/nandan/ixgbe-3.21.2/src/ixgbe.h:47,
                 from /home/nandan/ixgbe-3.21.2/src/ixgbe_main.c:50:
/home/nandan/ixgbe-3.21.2/src/kcompat.h:4057:2: error: redeclaration of enumerator ‘PKT_HASH_TYPE_L2’
  PKT_HASH_TYPE_L2,
  ^
In file included from include/linux/if_ether.h:23:0,
                 from include/uapi/linux/ethtool.h:17,
                 from include/linux/ethtool.h:16,
                 from include/linux/netdevice.h:42,
                 from /home/nandan/ixgbe-3.21.2/src/ixgbe_main.c:30:
include/linux/skbuff.h:730:2: note: previous definition of ‘PKT_HASH_TYPE_L2’ was here
  PKT_HASH_TYPE_L2, /* Input: src_MAC, dest_MAC */
  ^
In file included from /home/nandan/ixgbe-3.21.2/src/ixgbe_osdep.h:37:0,
                 from /home/nandan/ixgbe-3.21.2/src/ixgbe_type.h:65,
                 from /home/nandan/ixgbe-3.21.2/src/ixgbe_dcb.h:28,
                 from /home/nandan/ixgbe-3.21.2/src/ixgbe.h:47,
                 from /home/nandan/ixgbe-3.21.2/src/ixgbe_main.c:50:
/home/nandan/ixgbe-3.21.2/src/kcompat.h:4058:2: error: redeclaration of enumerator ‘PKT_HASH_TYPE_L3’
  PKT_HASH_TYPE_L3,
  ^
In file included from include/linux/if_ether.h:23:0,
                 from include/uapi/linux/ethtool.h:17,
                 from include/linux/ethtool.h:16,
                 from include/linux/netdevice.h:42,
                 from /home/nandan/ixgbe-3.21.2/src/ixgbe_main.c:30:
include/linux/skbuff.h:731:2: note: previous definition of ‘PKT_HASH_TYPE_L3’ was here
  PKT_HASH_TYPE_L3, /* Input: src_IP, dst_IP */
  ^
In file included from /home/nandan/ixgbe-3.21.2/src/ixgbe_osdep.h:37:0,
                 from /home/nandan/ixgbe-3.21.2/src/ixgbe_type.h:65,
                 from /home/nandan/ixgbe-3.21.2/src/ixgbe_dcb.h:28,
                 from /home/nandan/ixgbe-3.21.2/src/ixgbe.h:47,
                 from /home/nandan/ixgbe-3.21.2/src/ixgbe_main.c:50:
/home/nandan/ixgbe-3.21.2/src/kcompat.h:4059:2: error: redeclaration of enumerator ‘PKT_HASH_TYPE_L4’
  PKT_HASH_TYPE_L4,
  ^
In file included from include/linux/if_ether.h:23:0,
                 from include/uapi/linux/ethtool.h:17,
                 from include/linux/ethtool.h:16,
                 from include/linux/netdevice.h:42,
                 from /home/nandan/ixgbe-3.21.2/src/ixgbe_main.c:30:
include/linux/skbuff.h:732:2: note: previous definition of ‘PKT_HASH_TYPE_L4’ was here
  PKT_HASH_TYPE_L4, /* Input: src_IP, dst_IP, src_port, dst_port */
  ^
/home/nandan/ixgbe-3.21.2/src/ixgbe_main.c: In function ‘ixgbe_get_stats64’:
/home/nandan/ixgbe-3.21.2/src/ixgbe_main.c:6673:5: error: implicit declaration of function ‘u64_stats_fetch_begin_bh’ [-Werror=implicit-function-declaration]
     start = u64_stats_fetch_begin_bh(&ring->syncp);
     ^
/home/nandan/ixgbe-3.21.2/src/ixgbe_main.c:6676:4: error: implicit declaration of function ‘u64_stats_fetch_retry_bh’ [-Werror=implicit-function-declaration]
    } while (u64_stats_fetch_retry_bh(&ring->syncp, start));
    ^
/home/nandan/ixgbe-3.21.2/src/ixgbe_main.c: In function ‘ixgbe_select_queue’:
/home/nandan/ixgbe-3.21.2/src/ixgbe_main.c:8084:3: error: implicit declaration of function ‘__netdev_pick_tx’ [-Werror=implicit-function-declaration]
   return __netdev_pick_tx(dev, skb);
   ^
/home/nandan/ixgbe-3.21.2/src/ixgbe_main.c: At top level:
/home/nandan/ixgbe-3.21.2/src/ixgbe_main.c:8887:2: warning: initialization from incompatible pointer type [enabled by default]
  .ndo_select_queue = ixgbe_select_queue,
  ^
/home/nandan/ixgbe-3.21.2/src/ixgbe_main.c:8887:2: warning: (near initialization for ‘ixgbe_netdev_ops.ndo_select_queue’) [enabled by default]
cc1: some warnings being treated as errors
make[2]: *** [/home/nandan/ixgbe-3.21.2/src/ixgbe_main.o] Error 1
make[1]: *** [_module_/home/nandan/ixgbe-3.21.2/src] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-3.13.0-46-generic'
make: *** [default] Error 2

有人可以帮我解决这个问题吗?

答案1

我遇到了同样的问题(但使用的是 3.23.1 驱动程序),并且将内核更新到 LTS Utopic 解决了这个问题:

# uname -a
Linux 3.13.0-46-generic #77-Ubuntu SMP Mon Mar 2 18:23:39 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
# apt-get install linux-generic-lts-utopic
# reboot
# uname -a
Linux 3.16.0-31-generic #41~14.04.1-Ubuntu SMP Wed Feb 11 19:30:13 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

~/ixgbe-3.23.2.1/src# make install
make -C /lib/modules/3.16.0-31-generic/build SUBDIRS=/root/ixgbe-3.23.2.1/src modules
make[1]: Entering directory `/usr/src/linux-headers-3.16.0-31-generic'
  CC [M]  /root/ixgbe-3.23.2.1/src/ixgbe_main.o
  CC [M]  /root/ixgbe-3.23.2.1/src/ixgbe_common.o
  CC [M]  /root/ixgbe-3.23.2.1/src/ixgbe_api.o
  CC [M]  /root/ixgbe-3.23.2.1/src/ixgbe_param.o
  CC [M]  /root/ixgbe-3.23.2.1/src/ixgbe_lib.o
  CC [M]  /root/ixgbe-3.23.2.1/src/ixgbe_ethtool.o
  CC [M]  /root/ixgbe-3.23.2.1/src/kcompat.o
  CC [M]  /root/ixgbe-3.23.2.1/src/ixgbe_82598.o
  CC [M]  /root/ixgbe-3.23.2.1/src/ixgbe_82599.o
  CC [M]  /root/ixgbe-3.23.2.1/src/ixgbe_x540.o
  CC [M]  /root/ixgbe-3.23.2.1/src/ixgbe_sriov.o
  CC [M]  /root/ixgbe-3.23.2.1/src/ixgbe_mbx.o
  CC [M]  /root/ixgbe-3.23.2.1/src/ixgbe_dcb.o
  CC [M]  /root/ixgbe-3.23.2.1/src/ixgbe_dcb_82598.o
  CC [M]  /root/ixgbe-3.23.2.1/src/ixgbe_dcb_82599.o
  CC [M]  /root/ixgbe-3.23.2.1/src/ixgbe_sysfs.o
  CC [M]  /root/ixgbe-3.23.2.1/src/ixgbe_procfs.o
  CC [M]  /root/ixgbe-3.23.2.1/src/ixgbe_phy.o
  CC [M]  /root/ixgbe-3.23.2.1/src/ixgbe_dcb_nl.o
  CC [M]  /root/ixgbe-3.23.2.1/src/ixgbe_fcoe.o
  CC [M]  /root/ixgbe-3.23.2.1/src/ixgbe_debugfs.o
  CC [M]  /root/ixgbe-3.23.2.1/src/ixgbe_ptp.o
  LD [M]  /root/ixgbe-3.23.2.1/src/ixgbe.o
  Building modules, stage 2.
  MODPOST 1 modules
  CC      /root/ixgbe-3.23.2.1/src/ixgbe.mod.o
  LD [M]  /root/ixgbe-3.23.2.1/src/ixgbe.ko
make[1]: Leaving directory `/usr/src/linux-headers-3.16.0-31-generic'
gzip -c ../ixgbe.7 > ixgbe.7.gz
# remove all old versions of the driver
find /lib/modules/3.16.0-31-generic -name ixgbe.ko -exec rm -f {} \; || true
find /lib/modules/3.16.0-31-generic -name ixgbe.ko.gz -exec rm -f {} \; || true
install -D -m 644 ixgbe.ko /lib/modules/3.16.0-31-generic/kernel/drivers/net/ethernet/intel/ixgbe/ixgbe.ko
/sbin/depmod -a 3.16.0-31-generic || true
install -D -m 644 ixgbe.7.gz /usr/share/man/man7/ixgbe.7.gz
man -c -P'cat > /dev/null' ixgbe || true
ixgbe.

我假设您也需要 ixgbevf 2.16.1 的补丁 - 我还没有检查 lts utopic 内核是否需要它们:

来源
https://www.mail-archive.com/[电子邮件保护]/msg10334.html https://gist.github.com/mchv/e66a2a4117143aa3b92e

相关内容