[v2,1/2] doc: note KNI alternatives

Message ID 20211123120839.1740537-1-ferruh.yigit@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series [v2,1/2] doc: note KNI alternatives |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Ferruh Yigit Nov. 23, 2021, 12:08 p.m. UTC
  Add more information on alternatives of KNI and the cons of KNI against
these alternatives.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
Cc: Olivier Matz <olivier.matz@6wind.com>
Cc: David Marchand <david.marchand@redhat.com>
Cc: Stephen Hemminger <stephen@networkplumber.org>
Cc: Elad Nachman <eladv6@gmail.com>
Cc: Igor Ryzhov <iryzhov@nfware.com>
Cc: Dan Gora <dg@adax.com>
---
 doc/guides/nics/tap.rst                       |  2 ++
 .../prog_guide/kernel_nic_interface.rst       | 34 +++++++++++++++++--
 2 files changed, 33 insertions(+), 3 deletions(-)
  

Comments

Thomas Monjalon Nov. 24, 2021, 1:58 p.m. UTC | #1
23/11/2021 13:08, Ferruh Yigit:
> --- a/doc/guides/nics/tap.rst
> +++ b/doc/guides/nics/tap.rst
> @@ -1,6 +1,8 @@
>  ..  SPDX-License-Identifier: BSD-3-Clause
>      Copyright(c) 2016 Intel Corporation.
>  
> +.. _TunTap_PMD:

No need for such anchor at the beginning of a doc.
You can reference a document with :doc:

[...]
> +There are other alternatives to KNI, all are available in the upstream Linux:
> +
> +#. :ref:`virtio_user_as_exceptional_path`
> +
> +#. :ref:`TunTap_PMD` as wrapper to `Linux tun/tap
> +   <https://www.kernel.org/doc/Documentation/networking/tuntap.txt>`_

What about pcap, AF_PACKET and AF_XDP PMDs?
  
Ferruh Yigit Nov. 24, 2021, 2:19 p.m. UTC | #2
On 11/24/2021 1:58 PM, Thomas Monjalon wrote:
> 23/11/2021 13:08, Ferruh Yigit:
>> --- a/doc/guides/nics/tap.rst
>> +++ b/doc/guides/nics/tap.rst
>> @@ -1,6 +1,8 @@
>>   ..  SPDX-License-Identifier: BSD-3-Clause
>>       Copyright(c) 2016 Intel Corporation.
>>   
>> +.. _TunTap_PMD:
> 
> No need for such anchor at the beginning of a doc.
> You can reference a document with :doc:
> 

ack

> [...]
>> +There are other alternatives to KNI, all are available in the upstream Linux:
>> +
>> +#. :ref:`virtio_user_as_exceptional_path`
>> +
>> +#. :ref:`TunTap_PMD` as wrapper to `Linux tun/tap
>> +   <https://www.kernel.org/doc/Documentation/networking/tuntap.txt>`_
> 
> What about pcap, AF_PACKET and AF_XDP PMDs?
> 
> 

They are different, not exactly KNI alternative.

pcap, af_packet & af_xdp are on top of sockets for specific interface,
KNI & virtio-user enables injecting packets to Linux networking stack
without being tied to any existing interface.
  

Patch

diff --git a/doc/guides/nics/tap.rst b/doc/guides/nics/tap.rst
index 681010d9ed7d..2ba98893d564 100644
--- a/doc/guides/nics/tap.rst
+++ b/doc/guides/nics/tap.rst
@@ -1,6 +1,8 @@ 
 ..  SPDX-License-Identifier: BSD-3-Clause
     Copyright(c) 2016 Intel Corporation.
 
+.. _TunTap_PMD:
+
 Tun|Tap Poll Mode Driver
 ========================
 
diff --git a/doc/guides/prog_guide/kernel_nic_interface.rst b/doc/guides/prog_guide/kernel_nic_interface.rst
index 1ce03ec1a374..70e92687d711 100644
--- a/doc/guides/prog_guide/kernel_nic_interface.rst
+++ b/doc/guides/prog_guide/kernel_nic_interface.rst
@@ -6,16 +6,44 @@ 
 Kernel NIC Interface
 ====================
 
+.. Note::
+
+   :ref:`virtio_user_as_exceptional_path` alternative is the preferred way for
+   interfacing with the Linux network stack as it is an in-kernel solution and
+   has similar performance expectations.
+
 The DPDK Kernel NIC Interface (KNI) allows userspace applications access to the Linux* control plane.
 
-The benefits of using the DPDK KNI are:
+KNI provides an interface with the kernel network stack and allows management of
+DPDK ports using standard Linux net tools such as ``ethtool``, ``ifconfig`` and
+``tcpdump``.
+
+The main use case of KNI is to get/receive exception packets from/to Linux network
+stack while main datapath IO is done bypassing the networking stack.
+
+There are other alternatives to KNI, all are available in the upstream Linux:
+
+#. :ref:`virtio_user_as_exceptional_path`
+
+#. :ref:`TunTap_PMD` as wrapper to `Linux tun/tap
+   <https://www.kernel.org/doc/Documentation/networking/tuntap.txt>`_
+
+The benefits of using the KNI against alternatives are:
 
 *   Faster than existing Linux TUN/TAP interfaces
     (by eliminating system calls and copy_to_user()/copy_from_user() operations.
 
-*   Allows management of DPDK ports using standard Linux net tools such as ethtool, ifconfig and tcpdump.
+The cons of the KNI are:
+
+* It is out-of-tree Linux kernel module and it can't be distributed as binary as
+  part of operating system vendor DPDK packages. This makes it harder to
+  consume, although it is always possible to compile it from the source code.
+
+* As it shares memory between userspace and kernelspace, and kernel part
+  directly uses input provided by userspace, it is not safe. This makes hard to
+  upstream the module.
 
-*   Allows an interface with the kernel network stack.
+* Only a subset of net devices control commands are supported by KNI.
 
 The components of an application using the DPDK Kernel NIC Interface are shown in :numref:`figure_kernel_nic_intf`.