Skip to contentSkip to conversation

Remove Kernel Network Interface (KNI)

RFC In review Stephen Hemminger 3 participants 6 messages Jan 13, 2023 – Jan 14, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

RFC 1/1 Remove Kernel Network Interface (KNI)

The Linux special network driver for kernel networking has been a long term problem for DPDK. The performance benefits of KNI are available via virtio-user and XDP, and the simpler kernel interface via TAP is also available.

This driver has required lots of effort to keep up with the kernel API changes. And the overall architecture of the driver is fundamentally insecure and has unfixable locking and data race problems. No developer has been willing to do extensive tests or be the maintainer.

In short, the time has come to do some early spring cleaning and remove KNI from DPDK 23.03.

This patch builds and runs basic tests, please give review feedback that can help fix any collatral damage caused.

---
 MAINTAINERS                                   |   6 -
 app/test/meson.build                          |   2 -
 app/test/test_kni.c                           | 740 ---------------
 doc/guides/howto/flow_bifurcation.rst         |   2 +-
 doc/guides/nics/index.rst                     |   1 -
 doc/guides/nics/kni.rst                       | 170 ----
 .../prog_guide/kernel_nic_interface.rst       | 423 ---------
 doc/guides/rel_notes/release_23_03.rst        |  12 +-
 doc/guides/sample_app_ug/ip_pipeline.rst      |   9 -
 drivers/net/kni/meson.build                   |  11 -
 drivers/net/kni/rte_eth_kni.c                 | 524 -----------
 drivers/net/meson.build                       |   1 -
 examples/ip_pipeline/Makefile                 |   1 -
 examples/ip_pipeline/cli.c                    |  95 --
 examples/ip_pipeline/kni.c                    | 168 ----
 examples/ip_pipeline/kni.h                    |  46 -
 examples/ip_pipeline/main.c                   |  10 -
 examples/ip_pipeline/meson.build              |   1 -
 examples/ip_pipeline/pipeline.c               |  58 --
 kernel/linux/kni/Kbuild                       |   6 -
 kernel/linux/kni/compat.h                     | 153 ---
 kernel/linux/kni/kni_dev.h                    | 135 ---
 kernel/linux/kni/kni_fifo.h                   |  87 --
 kernel/linux/kni/kni_misc.c                   | 719 --------------
 kernel/linux/kni/kni_net.c                    | 878 ------------------
 kernel/linux/kni/meson.build                  |  41 -
 kernel/linux/meson.build                      | 103 --
 lib/eal/linux/eal.c                           |  19 -
 lib/kni/meson.build                           |  16 -
 lib/kni/rte_kni.c                             | 843 -----------------
 lib/kni/rte_kni.h                             | 269 ------
 lib/kni/rte_kni_common.h                      | 147 ---
 lib/kni/rte_kni_fifo.h                        | 117 ---
 lib/kni/version.map                           |  24 -
 lib/meson.build                               |   6 -
 lib/port/meson.build                          |   6 -
 lib/port/rte_port_kni.c                       | 515 ----------
 lib/port/rte_port_kni.h                       |  65 --
 lib/port/version.map                          |   3 -
 meson_options.txt                             |   2 +-
 40 files changed, 6 insertions(+), 6428 deletions(-)
 delete mode 100644 app/test/test_kni.c
 delete mode 100644 doc/guides/nics/kni.rst
 delete mode 100644 doc/guides/prog_guide/kernel_nic_interface.rst
 delete mode 100644 drivers/net/kni/meson.build
 delete mode 100644 drivers/net/kni/rte_eth_kni.c
 delete mode 100644 examples/ip_pipeline/kni.c
 delete mode 100644 examples/ip_pipeline/kni.h
 delete mode 100644 kernel/linux/kni/Kbuild
 delete mode 100644 kernel/linux/kni/compat.h
 delete mode 100644 kernel/linux/kni/kni_dev.h
 delete mode 100644 kernel/linux/kni/kni_fifo.h
 delete mode 100644 kernel/linux/kni/kni_misc.c
 delete mode 100644 kernel/linux/kni/kni_net.c
 delete mode 100644 kernel/linux/kni/meson.build
 delete mode 100644 kernel/linux/meson.build
 delete mode 100644 lib/kni/meson.build
 delete mode 100644 lib/kni/rte_kni.c
 delete mode 100644 lib/kni/rte_kni.h
 delete mode 100644 lib/kni/rte_kni_common.h
 delete mode 100644 lib/kni/rte_kni_fifo.h
 delete mode 100644 lib/kni/version.map
 delete mode 100644 lib/port/rte_port_kni.c
 delete mode 100644 lib/port/rte_port_kni.h
MAINTAINERS +0 -6
index 9a0f416d2e5d..931a5e57946c 100644
@@ -600,12 +600,6 @@ F: doc/guides/prog_guide/link_bonding_poll_mode_drv_lib.rst
 F: app/test/test_link_bonding*
 F: examples/bond/
 
-Linux KNI
-F: kernel/linux/kni/
-F: lib/kni/
-F: doc/guides/prog_guide/kernel_nic_interface.rst
-F: app/test/test_kni.c
-
 Linux AF_PACKET
 M: John W. Linville <[email protected]>
 F: drivers/net/af_packet/
app/test/meson.build +0 -2
index f34d19e3c3cb..7348c78bb448 100644
@@ -73,7 +73,6 @@ test_sources = files(
         'test_ipsec.c',
         'test_ipsec_sad.c',
         'test_ipsec_perf.c',
-        'test_kni.c',
         'test_kvargs.c',
         'test_lcores.c',
         'test_logs.c',
@@ -236,7 +235,6 @@ fast_tests = [
         ['fbarray_autotest', true, true],
         ['hash_readwrite_func_autotest', false, true],
         ['ipsec_autotest', true, true],
-        ['kni_autotest', false, true],
         ['kvargs_autotest', true, true],
         ['member_autotest', true, true],
         ['power_cpufreq_autotest', false, true],
app/test/test_kni.c deleted +0 -740

740 lines not on this page · raw message

doc/guides/howto/flow_bifurcation.rst +1 -1
index 838eb2a4cc89..009eec96cce0 100644
@@ -7,7 +7,7 @@ Flow Bifurcation How-to Guide
 Flow Bifurcation is a mechanism which uses hardware capable Ethernet devices
 to split traffic between Linux user space and kernel space. Since it is a
 hardware assisted feature this approach can provide line rate processing
-capability. Other than :ref:`KNI <kni>`, the software is just required to
+capability. The software is just required to
 enable device configuration, there is no need to take care of the packet
 movement during the traffic split. This can yield better performance with
 less CPU overhead.
doc/guides/nics/index.rst +0 -1
index df58a237ca73..93c1e7167fa9 100644
@@ -42,7 +42,6 @@ Network Interface Controller Drivers
     ionic
     ipn3ke
     ixgbe
-    kni
     liquidio
     mana
     memif
doc/guides/nics/kni.rst deleted +0 -170

170 lines not on this page · raw message

doc/guides/prog_guide/kernel_nic_interface.rst deleted +0 -423

423 lines not on this page · raw message

doc/guides/rel_notes/release_23_03.rst +4 -8
index b8c5b68d6caf..fe76147b5a30 100644
@@ -59,14 +59,10 @@ New Features
 Removed Items
 -------------
 
-.. This section should contain removed items in this release. Sample format:
-
-   * Add a short 1-2 sentence description of the removed item
-     in the past tense.
-
-   This section is a comment. Do not overwrite or remove it.
-   Also, make sure to start the actual text at the margin.
-   =======================================================
+* kni: Support for Linux Kernel Network Interface (KNI)
+  is now removed. It has been unmaintained, buggy, and required
+  an out of tree kernel driver. All users should convert to TAP
+  or Virtio-user device.
 
 
 API Changes
doc/guides/sample_app_ug/ip_pipeline.rst +0 -9
index b521d3b8be20..aa2aaec0ba9e 100644
@@ -164,15 +164,6 @@ Examples
    |                       |                      |                | 8. Pipeline table rule add default |
    |                       |                      |                | 9. Pipeline table rule add         |
    +-----------------------+----------------------+----------------+------------------------------------+
-   | KNI                   | Stub                 | Forward        | 1. Mempool create                  |
-   |                       |                      |                | 2. Link create                     |
-   |                       |                      |                | 3. Pipeline create                 |
-   |                       |                      |                | 4. Pipeline port in/out            |
-   |                       |                      |                | 5. Pipeline table                  |
-   |                       |                      |                | 6. Pipeline port in table          |
-   |                       |                      |                | 7. Pipeline enable                 |
-   |                       |                      |                | 8. Pipeline table rule add         |
-   +-----------------------+----------------------+----------------+------------------------------------+
    | Firewall              | ACL                  | Allow/Drop     | 1. Mempool create                  |
    |                       |                      |                | 2. Link create                     |
    |                       | * Key = n-tuple      |                | 3. Pipeline create                 |
drivers/net/kni/meson.build deleted +0 -11
deleted file mode 100644
index 2acc98969426..000000000000
@@ -1,11 +0,0 @@
-# SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2018 Intel Corporation
-
-if is_windows
-    build = false
-    reason = 'not supported on Windows'
-    subdir_done()
-endif
-
-deps += 'kni'
-sources = files('rte_eth_kni.c')
drivers/net/kni/rte_eth_kni.c deleted +0 -524

524 lines not on this page · raw message

drivers/net/meson.build +0 -1
index 6470bf36361f..def3f8510779 100644
@@ -34,7 +34,6 @@ drivers = [
         'ionic',
         'ipn3ke',
         'ixgbe',
-        'kni',
         'liquidio',
         'memif',
         'mlx4',
examples/ip_pipeline/Makefile +0 -1
index 785c7ee38ce5..bc5e0a9f1800 100644
@@ -8,7 +8,6 @@ APP = ip_pipeline
 SRCS-y := action.c
 SRCS-y += cli.c
 SRCS-y += conn.c
-SRCS-y += kni.c
 SRCS-y += link.c
 SRCS-y += main.c
 SRCS-y += mempool.c
examples/ip_pipeline/cli.c +0 -95

149 lines not on this page · raw message

examples/ip_pipeline/kni.c deleted +0 -168

168 lines not on this page · raw message

examples/ip_pipeline/kni.h deleted +0 -46

46 lines not on this page · raw message

examples/ip_pipeline/main.c +0 -10
index e35d9bce3984..663f538f024a 100644
@@ -14,7 +14,6 @@
 
 #include "cli.h"
 #include "conn.h"
-#include "kni.h"
 #include "cryptodev.h"
 #include "link.h"
 #include "mempool.h"
@@ -205,13 +204,6 @@ main(int argc, char **argv)
 		return status;
 	}
 
-	/* KNI */
-	status = kni_init();
-	if (status) {
-		printf("Error: KNI initialization failed (%d)\n", status);
-		return status;
-	}
-
 	/* Sym Crypto */
 	status = cryptodev_init();
 	if (status) {
@@ -264,7 +256,5 @@ main(int argc, char **argv)
 		conn_poll_for_conn(conn);
 
 		conn_poll_for_msg(conn);
-
-		kni_handle_request();
 	}
 }
examples/ip_pipeline/meson.build +0 -1
index 57f522c24cf9..68049157e429 100644
@@ -18,7 +18,6 @@ sources = files(
         'cli.c',
         'conn.c',
         'cryptodev.c',
-        'kni.c',
         'link.c',
         'main.c',
         'mempool.c',
examples/ip_pipeline/pipeline.c +0 -58

100 lines not on this page · raw message

kernel/linux/kni/Kbuild deleted +0 -6
deleted file mode 100644
index e5452d6c00db..000000000000
@@ -1,6 +0,0 @@
-# SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2018 Luca Boccassi <[email protected]>
-
-ccflags-y := $(MODULE_CFLAGS)
-obj-m := rte_kni.o
-rte_kni-y := $(patsubst $(src)/%.c,%.o,$(wildcard $(src)/*.c))
kernel/linux/kni/compat.h deleted +0 -153

153 lines not on this page · raw message

kernel/linux/kni/kni_dev.h deleted +0 -135

135 lines not on this page · raw message

kernel/linux/kni/kni_fifo.h deleted +0 -87

87 lines not on this page · raw message

kernel/linux/kni/kni_misc.c deleted +0 -719

166 lines not on this page · raw message

kernel/linux/kni/kni_net.c deleted +0 -878

878 lines not on this page · raw message

kernel/linux/kni/meson.build deleted +0 -41

41 lines not on this page · raw message

kernel/linux/meson.build deleted +0 -103

103 lines not on this page · raw message

lib/eal/linux/eal.c +0 -19
index 8c118d0d9f81..ff3cff7b79f5 100644

Lines of this file are not shown. View the raw message.

lib/kni/meson.build deleted +0 -16
deleted file mode 100644
index 8a71d8ba6f65..000000000000

Lines of this file are not shown. View the raw message.

lib/kni/rte_kni.c deleted +0 -843

843 lines not on this page · raw message

lib/kni/rte_kni.h deleted +0 -269

269 lines not on this page · raw message

lib/kni/rte_kni_common.h deleted +0 -147

147 lines not on this page · raw message

lib/kni/rte_kni_fifo.h deleted +0 -117

117 lines not on this page · raw message

lib/kni/version.map deleted +0 -24
deleted file mode 100644
index 83bbbe880f43..000000000000

Lines of this file are not shown. View the raw message.

lib/meson.build +0 -6
index a90fee31b7c8..73485494ff85 100644

Lines of this file are not shown. View the raw message.

lib/port/meson.build +0 -6
index 3ab37e2cb4b7..b0af2b185b39 100644

Lines of this file are not shown. View the raw message.

lib/port/rte_port_kni.c deleted +0 -515

515 lines not on this page · raw message

lib/port/rte_port_kni.h deleted +0 -65

65 lines not on this page · raw message

lib/port/version.map +0 -3
index af6cf696fd54..d67a03650d8b 100644

Lines of this file are not shown. View the raw message.

meson_options.txt +1 -1
index 08528492f717..2db41aff6a72 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.39.0

Part of the diff is not shown here. View the raw message.

#1 lore raw

13/01/2023 06:03, Stephen Hemminger:

Quoted 5 lines

The Linux special network driver for kernel networking has been a long term problem for DPDK. The performance benefits of KNI are available via virtio-user and XDP, and the simpler kernel interface via TAP is also available.

Quoted 8 lines

This driver has required lots of effort to keep up with the kernel API changes. And the overall architecture of the driver is fundamentally insecure and has unfixable locking and data race problems. No developer has been willing to do extensive tests or be the maintainer.

In short, the time has come to do some early spring cleaning and remove KNI from DPDK 23.03.

In doc/guides/rel_notes/deprecation.rst it is announced to be removed in 23.11. Let's keep this RFC for later :)

#2 lore raw
Quoted 12 lines · On Fri, 13 Jan 2023 09:12:16 +0100 Thomas Monjalon <[email protected]> wrote:

13/01/2023 06:03, Stephen Hemminger:

Quoted 11 lines

The Linux special network driver for kernel networking has been a long term problem for DPDK. The performance benefits of KNI are available via virtio-user and XDP, and the simpler kernel interface via TAP is also available.

This driver has required lots of effort to keep up with the kernel API changes. And the overall architecture of the driver is fundamentally insecure and has unfixable locking and data race problems. No developer has been willing to do extensive tests or be the maintainer.

Quoted 7 lines
Quoted 2 lines

In short, the time has come to do some early spring cleaning and remove KNI from DPDK 23.03.

In doc/guides/rel_notes/deprecation.rst it is announced to be removed in 23.11. Let's keep this RFC for later :)

For 23.03 could we add a deprecation log message when library is used and when kernel module is loaded.

#3 lore raw

13/01/2023 18:13, Stephen Hemminger:

Quoted 18 lines
Quoted 15 lines · On Fri, 13 Jan 2023 09:12:16 +0100 Thomas Monjalon <[email protected]> wrote:

13/01/2023 06:03, Stephen Hemminger:

Quoted 13 lines

The Linux special network driver for kernel networking has been a long term problem for DPDK. The performance benefits of KNI are available via virtio-user and XDP, and the simpler kernel interface via TAP is also available.

This driver has required lots of effort to keep up with the kernel API changes. And the overall architecture of the driver is fundamentally insecure and has unfixable locking and data race problems. No developer has been willing to do extensive tests or be the maintainer.

In short, the time has come to do some early spring cleaning and remove KNI from DPDK 23.03.

Quoted 7 lines
Quoted 4 lines

In doc/guides/rel_notes/deprecation.rst it is announced to be removed in 23.11. Let's keep this RFC for later :)

For 23.03 could we add a deprecation log message when library is used and when kernel module is loaded.

We already have a message in the lib:

int
rte_kni_init(unsigned int max_kni_ifaces __rte_unused)

{
	RTE_LOG(WARNING, KNI, "WARNING: KNI is deprecated and will be removed in DPDK 23.11\n");

It is a good idea to add a message in the kernel module loading.

#4 lore raw
Quoted 27 lines · On Fri, 13 Jan 2023 19:34:24 +0100 Thomas Monjalon <[email protected]> wrote:

13/01/2023 18:13, Stephen Hemminger:

Quoted 18 lines
Quoted 15 lines · On Fri, 13 Jan 2023 09:12:16 +0100 Thomas Monjalon <[email protected]> wrote:

13/01/2023 06:03, Stephen Hemminger:

Quoted 13 lines

The Linux special network driver for kernel networking has been a long term problem for DPDK. The performance benefits of KNI are available via virtio-user and XDP, and the simpler kernel interface via TAP is also available.

This driver has required lots of effort to keep up with the kernel API changes. And the overall architecture of the driver is fundamentally insecure and has unfixable locking and data race problems. No developer has been willing to do extensive tests or be the maintainer.

In short, the time has come to do some early spring cleaning and remove KNI from DPDK 23.03.

Quoted 7 lines
Quoted 4 lines

In doc/guides/rel_notes/deprecation.rst it is announced to be removed in 23.11. Let's keep this RFC for later :)

For 23.03 could we add a deprecation log message when library is used and when kernel module is loaded.

Quoted 12 lines

We already have a message in the lib:

int
rte_kni_init(unsigned int max_kni_ifaces __rte_unused)

{
	RTE_LOG(WARNING, KNI, "WARNING: KNI is deprecated and will be removed in DPDK 23.11\n");

It is a good idea to add a message in the kernel module loading.

No matter how much we tell users, guarantee someone will still miss it and complain :-)

#5 lore raw
Quoted 37 lines · Stephen Hemminger
Quoted 34 lines · On Fri, 13 Jan 2023 19:34:24 +0100 Thomas Monjalon <[email protected]> wrote:

13/01/2023 18:13, Stephen Hemminger:

Quoted 18 lines
Quoted 15 lines · On Fri, 13 Jan 2023 09:12:16 +0100 Thomas Monjalon <[email protected]> wrote:

13/01/2023 06:03, Stephen Hemminger:

Quoted 13 lines

The Linux special network driver for kernel networking has been a long term problem for DPDK. The performance benefits of KNI are available via virtio-user and XDP, and the simpler kernel interface via TAP is also available.

This driver has required lots of effort to keep up with the kernel API changes. And the overall architecture of the driver is fundamentally insecure and has unfixable locking and data race problems. No developer has been willing to do extensive tests or be the maintainer.

In short, the time has come to do some early spring cleaning and remove KNI from DPDK 23.03.

Quoted 7 lines
Quoted 4 lines

In doc/guides/rel_notes/deprecation.rst it is announced to be removed in 23.11. Let's keep this RFC for later :)

For 23.03 could we add a deprecation log message when library is used and when kernel module is loaded.

We already have a message in the lib:

int
rte_kni_init(unsigned int max_kni_ifaces __rte_unused)

{
	RTE_LOG(WARNING, KNI, "WARNING: KNI is deprecated and will be removed in DPDK 23.11\n");
Quoted 7 lines
Quoted 5 lines

It is a good idea to add a message in the kernel module loading.

No matter how much we tell users, guarantee someone will still miss it and complain :-)

one of the techniques we use is to remove the headers in advance of removing the ABI. the warning becomes a lot more clear when you can't compile anymore but your existing binaries continue to run.