path: root/kernel/linux
AgeCommit message (Collapse)Author
2019-03-30kni: calculate MTU from mbuf sizeLiron Himi
- mbuf_size and mtu are now being calculated according to the given mb-pool. - max_mtu is now being set according to the given mtu the above two changes provide the ability to work with jumbo frames Signed-off-by: Liron Himi <> Acked-by: Ferruh Yigit <>
2019-03-12eal/linux: rename linuxapp to linuxBruce Richardson
The term "linuxapp" is a legacy one, but just calling the subdirectory "linux" is just clearer for all concerned. Signed-off-by: Bruce Richardson <>
2019-02-27build: bump minimum Meson version to 0.47.1Luca Boccassi
Meson 0.47.1 fixed a bug that is difficult to work around, which causes the linker flag of dependencies to be repeated dozens of times, which causes issues especially when using the built-in dependency() API. Bump the minimum version and remove obsolete version checks. Signed-off-by: Luca Boccassi <> Acked-by: Bruce Richardson <>
2019-01-23kni: fix build for igb_ndo_bridge_setlink in Linux 5.0Ferruh Yigit
Build error seen with Linux kernel 5.0 and when CONFIG_RTE_KNI_KMOD_ETHTOOL is enabled. build error: .../build/build/kernel/linux/kni/igb_main.c:2348:24: error: initialization of ‘int (*)(struct net_device *, struct nlmsghdr *, u16, struct netlink_ext_ack *)’ {aka ‘int (*)(struct net_device *, struct nlmsghdr *, short unsigned int, struct netlink_ext_ack *)’} from incompatible pointer type ‘int (*)(struct net_device *, struct nlmsghdr *, u16)’ {aka ‘int (*)(struct net_device *, struct nlmsghdr *, short unsigned int)’} [-Werror=incompatible-pointer-types] .ndo_bridge_setlink = igb_ndo_bridge_setlink, ^~~~~~~~~~~~~~~~~~~~~~ .../build/build/kernel/linux/kni/igb_main.c:2348:24: note: (near initialization for ‘igb_netdev_ops.ndo_bridge_setlink’) igb_ndo_bridge_setlink() is changed in Linux kernel version 5.0 and now requires a new parameter, 'struct netlink_ext_ack *extack'. Fixed by adding a new parameter with a kernel version check. Signed-off-by: Ferruh Yigit <>
2019-01-23kni: fix build for dev_open in Linux 5.0Ferruh Yigit
Build error seen with Linux kernel 5.0 and when CONFIG_RTE_KNI_KMOD_ETHTOOL is enabled. build error: .../build/build/kernel/linux/kni/ixgbe_ethtool.c:1746:4: error: too few arguments to function ‘dev_open’ dev_open(netdev); ^~~~~~~~ In file included from .../build/kernel/linux/kni/ixgbe_ethtool.c:18: .../linux/linux/include/linux/netdevice.h:2620:5: note: declared here int dev_open(struct net_device *dev, struct netlink_ext_ack *extack); ^~~~~~~~ .../build/build/kernel/linux/kni/igb_ethtool.c:1812:4: error: too few arguments to function ‘dev_open’ dev_open(netdev); ^~~~~~~~ In file included from .../build/build/kernel/linux/kni/igb_ethtool.c:15: .../linux/linux/include/linux/netdevice.h:2620:5: note: declared here int dev_open(struct net_device *dev, struct netlink_ext_ack *extack); ^~~~~~~~ dev_open() is changed in Linux kernel version 5.0 and now requires a new parameter, 'struct netlink_ext_ack *extack'. Fixed by defining dev_open as macro when kernel version >= 5.0 Signed-off-by: Ferruh Yigit <>
2019-01-14kni: fix build on RHEL8 for arm and Power9David Zeng
Signed-off-by: David Zeng <> Acked-by: Ferruh Yigit <>
2019-01-14kni: fix build on RHEL 8Xiao Liang
'ndo_change_mtu_rh74' was changed to 'ndo_change_mtu' in RHEL8. Build error log: /home/dpdk-18.11/kernel/linux/kni/compat.h:107:24: error: ‘const struct net_device_ops’ has no member named ‘ndo_change_mtu_rh74’; did you mean ‘ndo_change_mtu’? #define ndo_change_mtu ndo_change_mtu_rh74 ^~~~~~~~~~~~~~~~~~~ Cc: Signed-off-by: Xiao Liang <> Acked-by: Ferruh Yigit <>
2018-10-27kni: fix build on Linux < 3.14Thomas Monjalon
The atomic functions smp_load_acquire() and smp_store_release() were introduced in Linux 3.14. Older kernels miss the functions: kni_fifo.h:19:2: error: implicit declaration of function ‘smp_load_acquire’ kni_fifo.h:30:2: error: implicit declaration of function ‘smp_store_release’ The fallback is to drop the atomic barrier, as it was before the commit below. Fixes: 711859cd0d07 ("kni: fix kernel FIFO synchronization") Signed-off-by: Thomas Monjalon <>
2018-10-26kni: set default carrier state of interfaceDan Gora
Add module parameter 'carrier='on|off' to set the default carrier state for linux network interfaces created by the KNI module. The default carrier state is 'off'. For KNI interfaces which need to reflect the carrier state of a physical Ethernet port controlled by the DPDK application, the default carrier state should be left set to 'off'. The application can set the carrier state of the KNI interface to reflect the state of the physical Ethernet port using rte_kni_update_link(). For KNI interfaces which are purely virtual, the default carrier state can be set to 'on'. This enables the KNI interface to be used without having to explicity set the carrier state to 'on' using rte_kni_update_link(). Signed-off-by: Dan Gora <> Acked-by: Ferruh Yigit <>
2018-10-26kni: fix kernel FIFO synchronizationPhil Yang
Adding memory barrier to make sure the values being synced before updating fifo_write in kni_fifo_put and fifo_read in kni_fifo_get. Fixes: 3fc5ca2f6352 ("kni: initial import") Cc: Signed-off-by: Phil Yang <> Reviewed-by: Honnappa Nagarahalli <> Reviewed-by: Gavin Hu <> Reviewed-by: Ferruh Yigit <>
2018-10-26kni: support meson buildLuca Boccassi
A Kbuild is also included to allow users to use DKMS natively without additional code. Signed-off-by: Luca Boccassi <> Tested-by: Bruce Richardson <> Acked-by: Bruce Richardson <>
2018-10-26kni: fix build on Linux 4.19Ferruh Yigit
The build error observed with Linux kernel 4.19 when KNI ethtool support enabled (CONFIG_RTE_KNI_KMOD_ETHTOOL=y) .../build/build/kernel/linux/kni/kni_ethtool.c:193:3: error: ‘struct ethtool_ops’ has no member named ‘get_settings’; .get_settings = kni_get_settings, ^~~~~~~~~~~~ .../build/build/kernel/linux/kni/kni_ethtool.c:194:3: error: ‘struct ethtool_ops’ has no member named ‘set_settings’; .set_settings = kni_set_settings, ^~~~~~~~~~~~ With kernel 4.19 ethtool_ops `get_settings` & `set_settings` are replaced with `get_link_ksettings` & `set_link_ksettings` Commit 9b3004953503 ("ethtool: drop get_settings and set_settings callbacks") This fix practically removes `get_settings` & `set_settings` support for the kernel versions that have the new ethtool_ops without implementing the new ones. Signed-off-by: Ferruh Yigit <>
2018-10-25igb_uio: fix unexpected removal for hot-unplugJeff Guo
When a device is hot-unplugged, pci_remove will be invoked unexpectedly before pci_release, it will caused kernel hung issue which will throw the error info of "Trying to free already-free IRQ XXX". And on the other hand, if pci_remove before pci_release, the interrupt will not got chance to be disabled. So this patch aim to fix this issue by adding pci_release call in pci_remove, it will gurranty that all pci clean up will be done before pci removal. Signed-off-by: Jeff Guo <> Acked-by: Ferruh Yigit <>
2018-10-11igb_uio: fix refcount if open returns errorStephen Hemminger
This fixes the problem of reference count leak if igbuio_pci_enable_interrupts fails. Also, replace mutex and integer with a kernel atomic counter. This is standard pattern for kernel devices. Fixes: 19685d5aa79c ("igb_uio: allow multi-process access") Cc: Signed-off-by: Stephen Hemminger <> Acked-by: Ferruh Yigit <>
2018-10-02kni: return failure for all ioctlsDan Gora
Modify kni_net_ioctl() to return -EOPNOTSUPP for all ioctls instead of 0. This is necessary because the Wicked (and possibly other) network interface managers will perform the SIOCGIWNAME ioctl to check if the interface is a wireless interface. If the KNI module returns success, Wicked will incorrectly interpret the interface as a wireless interface. Signed-off-by: Dan Gora <> Acked-by: Ferruh Yigit <>
2018-09-17igb_uio: install module when building with mesonLuca Boccassi
Install in $kerneldir/../extra/dpdk. Usually $kerneldir should something like: /lib/modules/$kver/build, so this directory will match the default one used by legacy makefiles. Fixes: a52f4574f798 ("igb_uio: build with meson") Cc: Signed-off-by: Luca Boccassi <> Acked-by: Bruce Richardson <>
2018-08-09kni: fix build on RHEL 7.5Drocula Lambda
This patch fixes compilation errors on Centos 7.5 when CONFIG_RTE_KNI_KMOD_ETHTOOL is set to 'y'. On RHEL75 ndo_change_mtu has changed to ndo_change_mtu_rh74. See commit 37d477b6863e5c06 ("kni: fix build on RHEL 7.5") Signed-off-by: Drocula Lambda <> Acked-by: Ferruh Yigit <>
2018-07-11igb_uio: fix build with lock down checksDavid Marchand
Caught on ubuntu-16.04 with hwe kernel for aarch64: $ uname -a Linux ubuntu1604arm64es 4.13.0-43-generic #48~16.04.1-Ubuntu SMP Thu May 17 13:08:01 UTC 2018 aarch64 aarch64 aarch64 GNU/Linux == Build kernel/linux/igb_uio CC [M] .../kernel/linux/igb_uio/igb_uio.o In file included from .../kernel/linux/igb_uio/igb_uio.c:20:0: .../igb_uio/compat.h: In function ‘igbuio_kernel_is_locked_down’: .../igb_uio/compat.h:146:7: error: "CONFIG_EFI_SECURE_BOOT_LOCK_DOWN" is not defined [-Werror=undef] #elif CONFIG_EFI_SECURE_BOOT_LOCK_DOWN ^ cc1: all warnings being treated as errors Fixes: d67014c3d38b ("igb_uio: fail and log if kernel lock down is enabled") Signed-off-by: David Marchand <> Acked-by: Ferruh Yigit <>
2018-06-30igb_uio: add write combining optionRafal Kozik
Write combining (WC) increases NIC performance by making better utilization of PCI bus, but cannot be use by all PMD. To get internal_addr memory need to be mapped. But as memory could not be mapped twice: with and without WC it should be skipped for WC. [1] To do not spoil other drivers that potentially could use internal_addr, parameter wc_activate adds possibility to skip it for those PMDs, that do not use it. [1] section 5.3 and 5.4 Signed-off-by: Rafal Kozik <> Acked-by: Bruce Richardson <> Acked-by: Ferruh Yigit <>
2018-06-27igb_uio: fail and log if kernel lock down is enabledFerruh Yigit
When EFI secure boot is enabled, it is possible to lock down kernel and prevent accessing device BARs and this makes igb_uio unusable. Lock down patches are not part of the vanilla kernel but they are applied and used by some distros already [1]. It is not possible to fix this issue, but intention of this patch is to detect and log if kernel lock down enabled and don't insert the module for that case. The challenge is since this feature enabled by distros, they have different config options and APIs for it. This patch is done based on Fedora and Ubuntu kernel source, may needs to add more distro specific support. [1] And a few more patches too. Signed-off-by: Ferruh Yigit <> Acked-by: Luca Boccassi <>
2018-06-27kni: fix build with gcc 8.1Ferruh Yigit
Error observed when CONFIG_RTE_KNI_KMOD_ETHTOOL config option is enabled. build error: In function ‘strncpy’, inlined from ‘igb_get_drvinfo’ at kernel/linux/kni/igb_ethtool.c:814:2: include/linux/string.h:246:9: error: ‘__builtin_strncpy’ output may be truncated copying 31 bytes from a string of length 42 [-Werror=stringop-truncation] return __builtin_strncpy(p, q, size); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Fixed by using strlcpy instead of strncpy. adapter->fw_version size kept same because of c3698192940c ("kni: fix build with gcc 7.1") Also next line strncpy usage replaced with strlcpy while arround. Fixes: c3698192940c ("kni: fix build with gcc 7.1") Cc: Signed-off-by: Ferruh Yigit <> Acked-by: Pablo de Lara <>
2018-05-25kernel: add missing SPDX license identifiersHemant Agrawal
Signed-off-by: Hemant Agrawal <>
2018-05-22kni: fix build on CentOS 7.4Dan Gora
Fix compilation errors on Centos 7.4 when CONFIG_RTE_KNI_KMOD_ETHTOOL is set to 'y'. Centos 7.4 needs HAVE_NDO_BRIDGE_GETLINK_FILTER_MASK_VLAN_FILL: igb_main.c: In function ‘igb_ndo_bridge_getlink’: igb_main.c:2289:2: error: too few arguments to function ‘ndo_dflt_bridge_getlink’ return ndo_dflt_bridge_getlink(skb, pid, seq, dev, mode, 0, 0, nlflags); ^ Centos 7.4 needs HAVE_VF_VLAN_PROTO and needs to redefine ndo_set_vf_vlan to .extended.ndo_set_vf_vlan: igb_main.c:2318:2: error: unknown field ‘ndo_set_vf_vlan’ specified in initializer .ndo_set_vf_vlan = igb_ndo_set_vf_vlan, ^ Signed-off-by: Dan Gora <> Acked-by: Ferruh Yigit <>
2018-05-13kni: fix possible mbuf leaks and speed up port releaseYangchao Zhou
rx_q fifo can only be released by kernel thread. There may be mbuf leaks in rx_q because kernel threads are randomly stopped. When the kni is released and netdev is unregisterd, convert the physical address mbufs in rx_q to the virtual address in free_q. By the way, alloc_q can be processed together to speed up the release rate in userspace. In my test, it is improved from 300-500ms with a mempool that has 131072 mbufs to 10ms(regardless of the specifications). Suggested-by: Ferruh Yigit <> Signed-off-by: Yangchao Zhou <> Acked-by: Ferruh Yigit <>
2018-05-08kernel: fix cross-build of Linux modules with mesonBruce Richardson
When cross-compiling, if no kernel_dir was specified, then the kernel modules were still being compiled for the build machine. Fix this by only building modules on cross-compile when we have a kernel_dir value set. Print out a message indicating why we are skipping kernel compilation, and in case that the headers for kernel compile are not found, print a warning instead of erroring out. Fixes: a52f4574f798 ("igb_uio: build with meson") Signed-off-by: Bruce Richardson <> Acked-by: Luca Boccassi <>
2018-05-01igb_uio: pass MODULE_CFLAGS in KbuildLuca Boccassi
With the legacy build system MODULE_CFLAGS can be set to pass compiler flags specific for the kernel modules builds. This is used currently by Ubuntu and Debian. Set ccflags-y in the Kbuild to achieve the same result with Meson, and to keep backward compatbility with older scripts. Fixes regression in Ubuntu/Debian when the Kbuild is included in the DKMS source package, as DKMS will pick it up silently by default if present, causing the MODULE_CFLAGS to be ignored. Fixes: a52f4574f798 ("igb_uio: build with meson") Cc: Signed-off-by: Luca Boccassi <> Acked-by: Bruce Richardson <>
2018-04-17build: clean up building kernel modules using mesonBruce Richardson
The files for building the kernel modules directory could be improved now that it is extracted from the EAL. For example, no global processing is necessary inside the kernel folder, just need to subdir to the appropriate bsd or linux folder to do the actual work. To avoid potential race conditions with the BSD module builds when the kernel build system is creating the dev_if.h and other files, we serialize the kernel module builds (all 2 of them!) by setting up each module to depend on all the previous. Signed-off-by: Bruce Richardson <> Tested-by: Hemant Agrawal <>
2018-04-20igb_uio: fix build on Linux < 3.16Scott Branden
Starting from Linux v3.16 pci_is_bridge() is in linux/pci.h, in previous versions it is in drivers/pci/pci.h which is private header. Fix build error when calling pci_is_bridge by not calling/supporting pci_is_bridge with kernel versions before 3.16. Fixes: 6f0841b7701b ("igb_uio: bind error if PCIe bridge") Reported-by: Ferruh Yigit <> Signed-off-by: Scott Branden <> Signed-off-by: Ajit Khaparde <> Acked-by: Bernard Iremonger <> Acked-by: Ferruh Yigit <>
2018-04-11igb_uio: bind error if PCIe bridgeDarren Edamura
Probe function should exit immediately if pcie bridge detected Signed-off-by: Darren Edamura <> Signed-off-by: Rahul Gupta <> Signed-off-by: Scott Branden <> Signed-off-by: Ajit Khaparde <> Acked-by: Ferruh Yigit <>
2018-03-28kni: fix build on RHEL 7.5Lee Roberts
Signed-off-by: Lee Roberts <> Acked-by: Ferruh Yigit <>
2018-03-21move kernel modules directoriesHemant Agrawal
This patch moves the kernel modules code from EAL to a common place. - Separate the kernel module code from user space code. Signed-off-by: Hemant Agrawal <> Tested-by: Bruce Richardson <>