FreeBSD 13 has changed the definition of vm_page_replace so we need
to have slightly different code paths around this function depending on
the BSD version.
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
All global variables in kernel should be prefixed by the same
to avoid any symbol conflics. Rename dflt_carrier to kni_default_carrier.
Fixes: 89397a01ce ("kni: set default carrier state of interface")
Cc: stable@dpdk.org
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
Since kni no longer includes the ethtool code and so is faster to build, we
no longer need the console parameter to have incremental screen updates as
it builds. Therefore, we drop the keyword which removes the warning.
Fixes: b78f32cff9 ("kni: support meson build")
Cc: stable@dpdk.org
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Aaron Conole <aconole@redhat.com>
Acked-by: Luca Boccassi <bluca@debian.org>
The 'get_user_pages_remote()' API is updated in kernel 4.10.0 [1],
but the check added as > 4.9.0,
this logic is broken for kernels 4.9.x, because they justify
> 4.9.0 check but have the old API.
Fixing the check as >= 4.10.0
[1]
commit 5b56d49fc31d ("mm: add locked parameter to get_user_pages_remote()")
Fixes: d965af9e8a ("kni: increase kernel version requirement for VA")
Reported-by: Andrew Rybchenko <arybchenko@solarflare.com>
Suggested-by: David Marchand <david.marchand@redhat.com>
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Tested-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
A build error reported related to the selected 'get_user_pages_remote()'
kernel API:
.../kernel/linux/kni/kni_dev.h:113:8:
error: too few arguments to function ‘get_user_pages_remote’
ret = get_user_pages_remote(tsk, tsk->mm, iova, 1
^~~~~~~~~~~~~~~~~~~~~
Currently there are three versions of the 'get_user_pages_remote()'
supported, based on kernel version < 4.9, = 4.9, > 4.9.
These version based checks are not working fine with the distro kernels
which is the cause of reported build error. The error reported by the
kernel version 4.8, but it is using API defined in > 4.9.
To be able to take control of this, and possible more, related build
error, increasing the minimum supported kernel version for iova=va with
KNI to kernel version 4.9.
This leaves us with single version of the kernel API and more manageable.
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
Clang is the system compiler for FreeBSD and kernel module builds can fail
when built with gcc, e.g. when testing with test-meson-builds.sh.
Therefore, it's safer to always use clang to build the kmods since the
actual flags used are outside of DPDK's control and cannot be guaranteed to
work with all compilers.
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Luca Boccassi <bluca@debian.org>
Set the install path for the kernel modules as /boot/modules. This may
ease the integration with the official FreeBSD ports system as all
components should be correctly located in the staging directory after
running "ninja install"
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Luca Boccassi <bluca@debian.org>
Patch adds support for kernel module to work in IOVA = VA mode by
providing address translation routines to convert userspace VA to
kernel VA.
KNI performance using PA is not changed by this patch.
But comparing KNI using PA to KNI using VA, the latter will have lower
performance due to the cost of the added translation.
This translation is implemented only with kernel versions starting 4.6.0.
Signed-off-by: Vamsi Attunuru <vattunuru@marvell.com>
Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
Reviewed-by: Jerin Jacob <jerinj@marvell.com>
Starting with kernel version 4.10, there are new min/max MTU values in
net_device structure, which are set to ETH_MIN_MTU and ETH_DATA_LEN by
default. We should be able to change these values to allow MTU more than
1500 to be set on KNI.
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
This patch adds support to allow users enable/disable allmulticast mode for
kni interface.
This requirement comes from bugzilla 312, more details can refer to:
https://bugs.dpdk.org/show_bug.cgi?id=312
Bugzilla ID: 312
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
build error:
kernel/linux/igb_uio/igb_uio.c:
In function ‘igbuio_pci_enable_interrupts’:
kernel/linux/igb_uio/igb_uio.c:230:6:
error: this statement may fall through
[-Werror=implicit-fallthrough=]
230 | if (pci_alloc_irq_vectors(udev->pdev, 1, 1, ....
kernel/linux/igb_uio/igb_uio.c:240:2: note: here
240 | case RTE_INTR_MODE_MSI:
| ^~~~
The build error is caused by Linux kernel commit in 5.3 that enables the
"-Wimplicit-fallthrough=3" gcc flag.
Commit a035d552a93b ("Makefile: Globally enable fall-through warning")
To fix the error, either a gcc attribute can be provided [1] or a code
comment with some defined syntax need to be provided [2], since there is
already comments, updated them slightly to match the required syntax to
fix the build error.
[1]
"__attribute__ ((fallthrough));"
[2]
[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?
fall(s | |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?
Cc: stable@dpdk.org
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
'kni_net_rx_lo_fifo()' can get segmented buffers, using 'pkt_len' for
that case will be wrong and some values can cause buffer overflow
in destination mbuf data.
Fixes: d89a58dfe9 ("kni: support chained mbufs")
Cc: stable@dpdk.org
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
va2pa depends on the physical address and virtual address offset of
current mbuf. It may get the wrong physical address of next mbuf which
allocated in another hugepage segment.
In rte_mempool_populate_default(), trying to allocate whole block of
contiguous memory could be failed. Then, it would reserve memory in
several memzones that have different physical address and virtual address
offsets. The rte_mempool_populate_default() is used by
rte_pktmbuf_pool_create().
Fixes: 8451269e6d ("kni: remove continuous memory restriction")
Cc: stable@dpdk.org
Signed-off-by: Yangchao Zhou <zhouyates@gmail.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
Some applications use ethtool so add the minimum ethtool ops.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
rte_kni does not follow standard style rules.
Noticed some extra \ line continuation etc.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
The correct thing to return if user gives a bad data
is to return -EFAULT. Logging is also discouraged because
it could be used as a DoS attack.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
Using void * instead of proper type is unsafe practice.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
Several fields were either totally unused or set and never used.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
Since kernel 2.6.28 the network subsystem has provided
dev->stats for devices to use statistics handling and is the
default if no ndo_get_stats is provided.
This allow allows for 64 bit (rather than just 32 bit)
statistics with KNI.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
netdev_alloc_skb is optimized to any alignment or setup
of skb->dev that is required. The kernel has chosen to not pad
packets on x86 (for many years), because it is faster.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
The netdev subsystem already handles case where
network sevice does not support ioctl.
If device has no rx_mode hook it is not called.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
Currently kernel modules are installed into /usr/src instead of
/lib/modules when meson build system is used. This patch fixes that.
Cc: stable@dpdk.org
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Internal changes in the freebsd kernel have meant that additional includes
are now necessary to build the kernel modules for DPDK. Tested with latest
bsd HEAD revision.
Bugzilla ID: 282
Cc: stable@dpdk.org
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
As there is no ethtool support in KNI anymore,
PCI related information is no longer needed.
Fixes: ea6b39b5b8 ("kni: remove ethtool support")
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
The local variables for the error message aren't needed, since the messages
aren't used more than once, and the indent levels are now such that the
lines printing the message are not much longer than the lines defining the
variables to hold the messages themselves. Therefore the use of the
variables is pointless.
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
Acked-by: Luca Boccassi <bluca@debian.org>
Since meson 0.46, meson has supported the subdir_done() function, which
allows us to abort processing of a file early. Using this we can reduce the
indentation in our files by eliminating unnecessary else blocks.
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
Acked-by: Luca Boccassi <bluca@debian.org>
The check for meson version 0.44 is redundant since the minimum
supported version for the project as a whole is 0.47.
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
Acked-by: Luca Boccassi <bluca@debian.org>
Current design requires kernel drivers and they need to be probed by
Linux up to some level so that they can be usable by DPDK for ethtool
support, this requires maintaining the Linux drivers in DPDK.
Also ethtool support is limited and hard, if not impossible, to expand
to other PMDs.
Since KNI ethtool support is not used commonly, if not used at all,
removing the support for the sake of simplicity and maintenance.
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
The type for MAC address should be unsigned.
Fixes: 1cfe212ed1 ("kni: support MAC address change")
Cc: stable@dpdk.org
Signed-off-by: Jie Pan <panjie5@jd.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
Reviewed-by: Rami Rosen <ramirose@gmail.com>
It allows applications running packet sockets over KNI interfaces to get
source Ethernet addresses of packets received using recvfrom function.
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
Build error seen with Linux kernel 5.1 and
when CONFIG_RTE_KNI_KMOD_ETHTOOL is enabled.
Build error:
kernel/linux/kni/igb_main.c:2352:18:
error: initialization of ... from incompatible pointer type ...
[-Werror=incompatible-pointer-types]
.ndo_fdb_add = igb_ndo_fdb_add,
^~~~~~~~~~~~~~~
ndo_fdb_add() is changed in Linux kernel version 5.1 and now requires
a new parameter, 'struct netlink_ext_ack *extack':
Linux Commit 87b0984ebfab ("net: Add extack argument to ndo_fdb_add()")
ndo_fdb_add() parameter updated with compile time Linux kernel version
check.
Cc: stable@dpdk.org
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Tested-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Rami Rosen <ramirose@gmail.com>
Define variables for "is_linux", "is_freebsd" and "is_windows"
to make the code shorter for comparisons and more readable.
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
Acked-by: Luca Boccassi <bluca@debian.org>
Added initial stub source files and required meson changes
for Windows support.
kernel/windows/meson is a stub file added to support
Windows specific source in future releases.
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
Acked-by: Harini Ramakrishnan <harini.ramakrishnan@microsoft.com>
Only one header file (rte_kni_common.h) was in the sub-directory
include/exec-env/
This file was installed in a sub-directory of the same name
in the makefile-based build.
Source and install directories are moved as below:
lib/librte_eal/linux/eal/include/exec-env/
-> lib/librte_eal/linux/eal/include/
build/include/exec-env/
-> build/include/
The consequence is to have a file hierarchy a bit more flat.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: David Marchand <david.marchand@redhat.com>
Tested-by: David Marchand <david.marchand@redhat.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
- 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 <lironh@marvell.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
Rename the macro and all instances in DPDK code, but keep a copy of
the old macro defined for legacy code linking against DPDK
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Rename the macro to make things shorter and more comprehensible. For
both meson and make builds, keep the old macro around for backward
compatibility.
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
The term "linuxapp" is a legacy one, but just calling the subdirectory
"linux" is just clearer for all concerned.
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
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 <bluca@debian.org>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
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 <ferruh.yigit@intel.com>
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 <ferruh.yigit@intel.com>
'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: stable@dpdk.org
Signed-off-by: Xiao Liang <xiliang@redhat.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
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: 711859cd0d ("kni: fix kernel FIFO synchronization")
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
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 <dg@adax.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
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: 3fc5ca2f63 ("kni: initial import")
Cc: stable@dpdk.org
Signed-off-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Reviewed-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
A Kbuild is also included to allow users to use DKMS natively without
additional code.
Signed-off-by: Luca Boccassi <bluca@debian.org>
Tested-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
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 <ferruh.yigit@intel.com>
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 <jia.guo@intel.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
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: 19685d5aa7 ("igb_uio: allow multi-process access")
Cc: stable@dpdk.org
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>