Skip to content

F-Stack's DPDK cannot be compiled in CentOS 7 #238

Closed

Description

@comfyneet

Try to build F-Stack's DPDK 17.11.2 LTS in CentOS 7.5.

$ uname -a
Linux localhost.localdomain 3.10.0-862.3.3.el7.x86_64 #1 SMP Fri Jun 15 04:15:27 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

$ make config T=x86_64-native-linuxapp-gcc

$ make

[...]

  CC [M]  /home/phucnm/workspace/f-stack/dpdk/build/build/lib/librte_eal/linuxapp/kni/kni_net.o
/home/phucnm/workspace/f-stack/dpdk/build/build/lib/librte_eal/linuxapp/kni/kni_net.c:704:2: error: unknown field ‘ndo_change_mtu’ specified in initializer
  .ndo_change_mtu = kni_net_change_mtu,
  ^
/home/phucnm/workspace/f-stack/dpdk/build/build/lib/librte_eal/linuxapp/kni/kni_net.c:704:2: warning: missing braces around initializer [-Wmissing-braces]
/home/phucnm/workspace/f-stack/dpdk/build/build/lib/librte_eal/linuxapp/kni/kni_net.c:704:2: warning: (near initialization for ‘kni_net_netdev_ops.<anonymous>’) [-Wmissing-braces]
/home/phucnm/workspace/f-stack/dpdk/build/build/lib/librte_eal/linuxapp/kni/kni_net.c:704:2: warning: initialization from incompatible pointer type [enabled by default]
/home/phucnm/workspace/f-stack/dpdk/build/build/lib/librte_eal/linuxapp/kni/kni_net.c:704:2: warning: (near initialization for ‘kni_net_netdev_ops.<anonymous>.ndo_select_queue’) [enabled by default]
make[8]: *** [/home/phucnm/workspace/f-stack/dpdk/build/build/lib/librte_eal/linuxapp/kni/kni_net.o] Error 1
make[7]: *** [_module_/home/phucnm/workspace/f-stack/dpdk/build/build/lib/librte_eal/linuxapp/kni] Error 2
make[6]: *** [sub-make] Error 2
make[5]: *** [rte_kni.ko] Error 2
make[4]: *** [kni] Error 2
make[3]: *** [linuxapp] Error 2
make[2]: *** [librte_eal] Error 2
make[1]: *** [lib] Error 2
make: *** [all] Error 2

Upgrading to DPDK 18.05 fixes this issue. However, I still want to use the current F-Stack sdk, so I want to downgrade my CentOS's kernel. I want to ask which kernel was used in the Quick Start and AWS guides?

Activity

  1. whl739 commented on Jun 27, 2018

    @whl739
    Member

    Actually, we tested kernel 3.10 ~ 4.15, but we hadn't test all the distributions, and Centos 7.2, Redhat7.3, Ubuntu 14.04 ~ 18.04 worked fine.
    This error is caused by kni compiling, you can just disable kni.

  2. yingfeng commented on Jun 28, 2018

    @yingfeng

    @whl739 I've met the same error. How to disable kni manually?
    Additionally, it seems kni has been disabled in this commit but the same error still appears

  3. whl739 commented on Jun 28, 2018

    @whl739
    Member

    Edit dpdk/x86_64-native-linuxapp-gcc/.config, change the value of KNI related section from 'y' to 'n'.

  4. yingfeng commented on Jun 28, 2018

    @yingfeng

    thank you, it works now

  5. Smiledarshu commented on Apr 24, 2019

    @Smiledarshu

    Hi @whl739
    i can't able to find .config file inside dpdk/x86_64-native-linuxapp-gcc/ after compiling.

    Any help would be appreciated.
    Thanks

  6. gitusermavux commented on Apr 28, 2019

    @gitusermavux

    There is another solution, modify "dpdk/config/common_linuxapp". Search for KNI and change all "YES" to "NO".

  7. wyao51 commented on Oct 8, 2019

    @wyao51

    用find / -name netdevice.h 查找内核中的头文件,找到struct net_device_ops 中的 ndo_change_mtu,

    会看到ndo_change_mtu被替换成对应版本的ndo_change_mtu_rhXX,比如 ndo_change_mtu_rh75 将 /kni_net.c:704:2 中 ndo_change_mtu 用 ndo_change_mtu_rh75 替换试试?

  8. wyao51 commented on Oct 8, 2019

    @wyao51

    [root@localhost dpdk-17.11]# vim ./lib/librte_eal/linuxapp/kni/kni_net.c
    [root@localhost dpdk-17.11]# vim /usr/src/kernels/3.10.0-57.10.1.el7.x86_64/include/linux/netdevice.h
    两边不一样,kni_net.c改成netdevice.h中定义可以解决

  9. Pingmin commented on Apr 12, 2021

    @Pingmin

    @wyao511 :

    用find / -name netdevice.h 查找内核中的头文件,找到struct net_device_ops 中的 ndo_change_mtu,

    会看到ndo_change_mtu被替换成对应版本的ndo_change_mtu_rhXX,比如 ndo_change_mtu_rh75 将 /kni_net.c:704:2 中 ndo_change_mtu 用 ndo_change_mtu_rh75 替换试试?

    [root@localhost dpdk-17.11]# vim ./lib/librte_eal/linuxapp/kni/kni_net.c
    [root@localhost dpdk-17.11]# vim /usr/src/kernels/3.10.0-57.10.1.el7.x86_64/include/linux/netdevice.h
    两边不一样,kni_net.c改成netdevice.h中定义可以解决

    今天(20210412)在 CentOS 7.9.2009 上编译一个 USB 转 RJ45 网卡设备 的 驱动 (src tar ball)时,也遇到了这个 unknown field ‘ndo_change_mtu’ 错误:

    [pingmin@f*-node2 AX88179_178A_Linux_Driver_v1.20.0_source]$ make
    make -C /lib/modules/3.10.0-1160.15.2.el7.x86_64/build M=/data/software/ugreen-and-asix/AX88179_178A_Linux_Driver_v1.20.0_source modules
    make[1]: Entering directory `/usr/src/kernels/3.10.0-1160.15.2.el7.x86_64'
      CC [M]  /data/software/ugreen-and-asix/AX88179_178A_Linux_Driver_v1.20.0_source/ax88179_178a.o
    /data/software/ugreen-and-asix/AX88179_178A_Linux_Driver_v1.20.0_source/ax88179_178a.c:1017:2: error: unknown field ‘ndo_change_mtu’ specified in initializer
      .ndo_change_mtu  = ax88179_change_mtu,
      ^
    /data/software/ugreen-and-asix/AX88179_178A_Linux_Driver_v1.20.0_source/ax88179_178a.c:1017:2: warning: missing braces around initializer [-Wmissing-braces]
    /data/software/ugreen-and-asix/AX88179_178A_Linux_Driver_v1.20.0_source/ax88179_178a.c:1017:2: warning: (near initialization for ‘ax88179_netdev_ops.<anonymous>’) [-Wmissing-braces]
    /data/software/ugreen-and-asix/AX88179_178A_Linux_Driver_v1.20.0_source/ax88179_178a.c:1017:2: warning: initialization from incompatible pointer type [enabled by default]
    /data/software/ugreen-and-asix/AX88179_178A_Linux_Driver_v1.20.0_source/ax88179_178a.c:1017:2: warning: (near initialization for ‘ax88179_netdev_ops.<anonymous>.ndo_get_stats64’) [enabled by default]
    make[2]: *** [/data/software/ugreen-and-asix/AX88179_178A_Linux_Driver_v1.20.0_source/ax88179_178a.o] Error 1
    make[1]: *** [_module_/data/software/ugreen-and-asix/AX88179_178A_Linux_Driver_v1.20.0_source] Error 2
    make[1]: Leaving directory `/usr/src/kernels/3.10.0-1160.15.2.el7.x86_64'
    make: *** [default] Error 2

    然后,按照你说的方法,将 ax88179_178a.c 中的初始化成员名改成了与 /usr/src/kernels/3.10.0-1160.15.2.el7.x86_64/include/linux/netdevice.h 中定义一样的 ndo_change_mtu_rh74,就可以编译了。

    20210413 更新:

    根据网上一些资料,是因为 RHEL/CentOS 从 7.4 开始,ndo_change_mtu 被改成了 ndo_change_mtu_rh74,故针对 RHEL/CentOS 7.4+,可以添加一个如下 define 宏定义便可(其他保持不变):

    /* ax88179_178a.c */
    
    #if (defined(RHEL_RELEASE_CODE) && \
    	(RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(7, 4)))
    #define ndo_change_mtu  ndo_change_mtu_rh74
    #endif
    
    static const struct net_device_ops ax88179_netdev_ops = {
    	...
    	.ndo_change_mtu         = ax88179_change_mtu,
    	...
    };

    谢谢!

  10. jfb8856606 commented on Mar 20, 2026

    @jfb8856606
    Contributor

    This issue is caused by an incompatibility between DPDK 17.11.2 (bundled with an older F-Stack) and Linux kernel 3.10 (CentOS 7). Specifically, the ndo_change_mtu field was removed from struct net_device_ops in kernels 4.15+ and some RHEL/CentOS backport kernels use a renamed variant (e.g., ndo_change_mtu_rh75).

    This is a known upstream DPDK issue that has long been fixed:

    • DPDK 18.05+ resolves the ndo_change_mtu incompatibility.
    • Current F-Stack ships with DPDK 22.11 LTS, which no longer uses the old KNI module (rte_kni.ko) at all — KNI has been replaced by virtio_user + vhost-net (see commit b6692e644, 2025-11-03).

    As a result, this specific issue is completely obsolete in the current codebase. There is no longer a kni_net.c with ndo_change_mtu to worry about.

    Closing as obsolete — fixed by DPDK/F-Stack upgrade. Please use the latest F-Stack release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions