Skip to contentSkip to conversation

doc/howto: rework section on virtio-user as exception path

PATCH Superseded Bruce Richardson 6 participants 26 messages May 27, 2022 – Jul 11, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 doc/howto: rework section on virtio-user as exception path

This patch extensively reworks the howto guide on using virtio-user for exception packets. Changes include:

* rename "exceptional path" to "exception path"
* remove references to uio and just reference vfio-pci
* simplify testpmd command-lines, giving a basic usage example first before adding on detail about checksum or TSO parameters
* give a complete working example showing traffic flowing through the whole system from a testpmd loopback using the created TAP netdev
* replace use of "ifconfig" with Linux standard "ip" command
* other general rewording.

---
 .../howto/virtio_user_as_exceptional_path.rst | 159 +++++++++++-------
 1 file changed, 100 insertions(+), 59 deletions(-)
doc/guides/howto/virtio_user_as_exceptional_path.rst +100 -59
index ec021af399..0709eeff10 100644
@@ -3,116 +3,157 @@
 
 .. _virtio_user_as_exceptional_path:
 
-Virtio_user as Exceptional Path
-===============================
+Virtio_user as Exception Path
+=============================
 
-The virtual device, virtio-user, was originally introduced with vhost-user
-backend, as a high performance solution for IPC (Inter-Process Communication)
+.. note::
+
+   This solution is only applicable to Linux systems.
+
+The virtual device, virtio-user, was originally introduced with the vhost-user
+backend as a high performance solution for IPC (Inter-Process Communication)
 and user space container networking.
 
-Virtio_user with vhost-kernel backend is a solution for exceptional path,
-such as KNI which exchanges packets with kernel networking stack. This
-solution is very promising in:
+Beyond this originally intended use, virtio-user can be used in conjunction with the vhost-kernel
+backend as a solution for dealing with exception path packets which need to be injected into the
+Linux kernel for processing there.
+In this regard, virtio-user and vhost in kernel space are an alternative to DPDK KNI for
+transferring packets between a DPDK packet processing application and the kernel stack.
+
+This solution has a number of advantages over alternatives such as KNI:
 
 *   Maintenance
 
     All kernel modules needed by this solution, vhost and vhost-net (kernel),
-    are upstreamed and extensively used kernel module.
+    are upstreamed and extensively used.
 
 *   Features
 
-    vhost-net is born to be a networking solution, which has lots of networking
-    related features, like multi queue, tso, multi-seg mbuf, etc.
+    vhost-net is designed to be a networking solution, and, as such, has lots of networking
+    related features, such as multi queue support, TSO, multi-segment buffer support, etc.
 
 *   Performance
 
-    similar to KNI, this solution would use one or more kthreads to
-    send/receive packets to/from user space DPDK applications, which has little
-    impact on user space polling thread (except that it might enter into kernel
-    space to wake up those kthreads if necessary).
+    similar to KNI, this solution would uses one or more kthreads to
+    send/receive packets to/from user space DPDK applications, which minimises the impact
+    on the polling DPDK threads.
 
-The overview of an application using virtio-user as exceptional path is shown
+The overview of an application using virtio-user as exception path is shown
 in :numref:`figure_virtio_user_as_exceptional_path`.
 
 .. _figure_virtio_user_as_exceptional_path:
 
 .. figure:: img/virtio_user_as_exceptional_path.*
 
-   Overview of a DPDK app using virtio-user as exceptional path
+   Overview of a DPDK app using virtio-user as exception path
+
 
+Example Usage With Testpmd
+---------------------------
 
-Sample Usage
-------------
+.. note::
+
+   These instruction assume that the vhost/vhost-net kernel modules are available and have already
+   been loaded into the running kernel.
+   It also assumes that the DPDK virtio driver has not been disabled in the DPDK build.
 
-As a prerequisite, the vhost/vhost-net kernel CONFIG should be chosen before
-compiling the kernel and those kernel modules should be inserted.
+To run a simple test of virtio-user as exception path using testpmd:
 
-#.  Compile DPDK and bind a physical NIC to igb_uio/uio_pci_generic/vfio-pci.
+#.  Compile DPDK and bind a NIC to vfio-pci as documented in :ref:`linux_gsg_linux_drivers`.
 
-    This physical NIC is for communicating with outside.
+    This physical NIC is for communicating with the outside world,
+    and serves as a packet source in this example.
 
-#.  Run testpmd.
+#.  Run testpmd to forward packets from NIC to kernel,
+    passing in a suitable list of logical cores to run on  (``-l``.parameter),
+    and optionally the PCI address of the physical NIC to use (``-a`` parameter).
+    The virtio-user device for interfacing to the kernel is specified via a ``-vdev`` argument,
+    taking the parameters described below.
 
     .. code-block:: console
 
-        $(testpmd) -l 2-3 -n 4 \
-		--vdev=virtio_user0,path=/dev/vhost-net,queue_size=1024 \
-		-- -i --tx-offloads=0x0000002c --enable-lro \
-		--txd=1024 --rxd=1024
+        /path/to/dpdk-testpmd -l <cores> -a <pci BDF> \
+            --vdev=virtio_user0,path=/dev/vhost-net,queues=1,queue_size=1024
 
-    This command runs testpmd with two ports, one physical NIC to communicate
-    with outside, and one virtio-user to communicate with kernel.
+    * ``path``
 
-* ``--enable-lro``
+       The path to the kernel vhost-net device.
 
-    This is used to negotiate VIRTIO_NET_F_GUEST_TSO4 and
-    VIRTIO_NET_F_GUEST_TSO6 feature so that large packets from kernel can be
-    transmitted to DPDK application and further TSOed by physical NIC.
+    * ``queue_size``
 
-* ``queue_size``
+       256 by default. To avoid shortage of descriptors, we can increase it to 1024.
 
-    256 by default. To avoid shortage of descriptors, we can increase it to 1024.
+    * ``queues``
 
-* ``queues``
+       Number of virt-queues. Each queue will be served by a kthread.
 
-    Number of multi-queues. Each queue will be served by a kthread. For example:
+#. Once testpmd is running, a new network interface - called ``tap0`` by default -
+   will be present on the system.
+   This should be configured with an IP address and then enabled for use:
 
     .. code-block:: console
 
-        $(testpmd) -l 2-3 -n 4 \
-		--vdev=virtio_user0,path=/dev/vhost-net,queues=2,queue_size=1024 \
-		-- -i --tx-offloads=0x0000002c --enable-lro \
-		--txq=2 --rxq=2 --txd=1024 --rxd=1024
+        ip addr add 192.168.1.1/24 dev tap0
+        ip link set dev tap0 up
 
-#. Enable Rx checksum offloads in testpmd:
+#. To observe packet forwarding through the kernel,
+   a second testpmd instance can be run on the system,
+   taking packets from the kernel using an ``af_packet`` socket on the ``tap0`` interface.
 
-    .. code-block:: console
+   .. code-block:: console
 
-        (testpmd) port stop 0
-        (testpmd) port config 0 rx_offload tcp_cksum on
-        (testpmd) port config 0 rx_offload udp_cksum on
-        (testpmd) port start 0
+       /path/to/dpdk-testpmd -l <cores> --vdev=net_af_packet0,iface=tap0 --in-memory --no-pci
 
-#. Start testpmd:
+   When running this instance,
+   we can use ``--in-memory`` flag to avoid hugepage naming conflicts with the previous instance,
+   and we also use ``--no-pci`` flag to only use the ``af_packet`` interface for all traffic forwarding.
 
-    .. code-block:: console
+#. Running traffic into the system through the NIC should see that traffic returned back again,
+   having been forwarded through both testpmd instances.
+   This can be confirmed by checking the testpmd statistics on testpmd exit.
 
-        (testpmd) start
+For more advanced use of virtio-user with testpmd in this scenario,
+some other more advanced options may also be used.
+For example:
 
-#.  Configure IP address and start tap:
+* ``--tx-offloads=0x02c``
+
+    This testpmd option enables TX offloads for UDP and TCP checksum on transmit,
+    as well as TCP TSO support.
+    The list of the offload flag values can be seen in header `rte_ethdev.h
+    <http://doc.dpdk.org/api/rte__ethdev_8h.html>`_.
+
+* ``--enable-lro``
+
+    This testpmd option is used to negotiate VIRTIO_NET_F_GUEST_TSO4 and
+    VIRTIO_NET_F_GUEST_TSO6 feature so that large packets from the kernel can be
+    transmitted to the DPDK application and further TSOed by physical NIC.
+    If unsupported by the physical NIC, errors may be reported by testpmd with this option.
+
+
+* Enabling Rx checksum offloads for physical port:
+
+   Within testpmd, you can enable and disable offloads on a per-port basis,
+   rather than enabling them for both ports.
+   For the physical NIC, it may be desirable to enable checksum offload on packet RX.
+   This may be done as below, if testpmd is run with ``-i`` flag for interactive mode.
 
     .. code-block:: console
 
-        ifconfig tap0 1.1.1.1/24 up
+        testpmd> port stop 0
+        testpmd> port config 0 rx_offload tcp_cksum on
+        testpmd> port config 0 rx_offload udp_cksum on
+        testpmd> port start 0
 
-.. note::
+* Multiple queue support
 
-    The tap device will be named tap0, tap1, etc, by kernel.
+    Better performance may be achived by using multiple queues,
+    so that multiple kernel threads are handling the traffic on the kernel side.
+    For example, to use 2 queues on both NIC and virtio ports,
+    while also enabling TX offloads and LRO support:
 
-Then, all traffic from physical NIC can be forwarded into kernel stack, and all
-traffic on the tap0 can be sent out from physical NIC.
+    .. code-block:: console
 
-Limitations
------------
+        /path/to/dpdk-testpmd --vdev=virtio_user0,path=/dev/vhost-net,queues=2,queue_size=1024 -- \
+            -i --tx-offloads=0x002c --enable-lro --txq=2 --rxq=2 --txd=1024 --rxd=1024
 
-This solution is only available on Linux systems.
Signature · 1 line
2.34.1
#1 lore raw

PATCH 2/2 doc/howto: add code example to virtio-user exception path doc

The HOWTO guide for using virtio-user as an exception path to the kernel only provided an example of how testpmd may be used for that purpose. However, a real application wanting to use virtio-user as exception path would likely want to create such devices from code within the app itself. Therefore, we update the doc with instructions and a code snippet showing how this may be done.

---
 .../howto/virtio_user_as_exceptional_path.rst | 55 +++++++++++++++++++
 1 file changed, 55 insertions(+)
doc/guides/howto/virtio_user_as_exceptional_path.rst +55 -0
index 0709eeff10..f4bd909458 100644
@@ -157,3 +157,58 @@ For example:
         /path/to/dpdk-testpmd --vdev=virtio_user0,path=/dev/vhost-net,queues=2,queue_size=1024 -- \
             -i --tx-offloads=0x002c --enable-lro --txq=2 --rxq=2 --txd=1024 --rxd=1024
 
+
+Creating Virtio-User Ports within an Application
+------------------------------------------------
+
+To use virtio-user ports within an application,
+it is not necessary to explicitly initialize those ports using EAL arguments at startup.
+Instead, one can use the generic EAL API
+`rte_eal_hotplug_add <http://doc.dpdk.org/api/rte__dev_8h.html#ad32e8eebf1f81ef9f290cb296b0c90bb>`_
+function to create a new instance at startup.
+For example, to create a basic virtio-user port, the following code could be used:
+
+.. code-block:: C
+
+   rte_eal_hotplug_add("vdev", "virtio_user0", "path=/dev/vhost-net");
+
+A fuller code example is shown below, where a virtio-user port, and hence kernel netdev,
+is created for each NIC port discovered by DPDK.
+Each virtio-user port is given the MAC address of its matching physical port
+(assuming app was run without vdev args on commandline, so all ports auto-discovered are HW ones).
+These new virtio-user netdevs will appear in the kernel port listings as ``virtio_user0``,
+``virtio_user1``, etc.,
+based on the names passed in as ``iface=`` via the ``portargs`` parameter.
+
+.. code-block:: C
+
+    nb_ports = rte_eth_dev_count_avail();
+
+    /* Create a vhost_user port for each physical port */
+    unsigned port_count = 0;
+    RTE_ETH_FOREACH_DEV(portid) {
+        char portname[32];
+        char portargs[256];
+        struct rte_ether_addr addr = {0};
+
+        /* don't create virtio_user ports for other virtio_user ports */
+        if (++port_count > nb_ports)
+            break;
+
+        /* get mac address of physical port to use as mac of virtio_user port */
+        rte_eth_macaddr_get(portid, &addr);
+
+        /* set the name and arguments */
+        snprintf(portname, sizeof(portname), "virtio_user%u", portid);
+        snprintf(portargs, sizeof(portargs),
+                "path=/dev/vhost-net,queues=1,queue_size=%u,iface=%s,mac=" RTE_ETHER_ADDR_PRT_FMT,
+                RX_RING_SIZE, portname, RTE_ETHER_ADDR_BYTES(&addr));
+
+        /* add the vdev for virtio_user */
+        if (rte_eal_hotplug_add("vdev", portname, portargs) < 0)
+            rte_exit(EXIT_FAILURE, "Cannot create paired port for port %u\n", portid);
+
+    }
+
+Once these virtio-user ports have been created in the loop, all ports, both physical and virtual,
+may be initialized and used as normal in the application.
Signature · 1 line
2.34.1
#2 lore raw

PATCH v2 1/2 doc/howto: rework section on virtio-user as exception path

In reply to Bruce Richardson

This patch extensively reworks the howto guide on using virtio-user for exception packets. Changes include:

* rename "exceptional path" to "exception path"
* remove references to uio and just reference vfio-pci
* simplify testpmd command-lines, giving a basic usage example first before adding on detail about checksum or TSO parameters
* give a complete working example showing traffic flowing through the whole system from a testpmd loopback using the created TAP netdev
* replace use of "ifconfig" with Linux standard "ip" command
* other general rewording.

---
v2: fix checkpatch warnings

---
 .../howto/virtio_user_as_exceptional_path.rst | 159 +++++++++++-------
 1 file changed, 100 insertions(+), 59 deletions(-)
doc/guides/howto/virtio_user_as_exceptional_path.rst +100 -59
index ec021af399..100376c32d 100644
@@ -3,116 +3,157 @@
 
 .. _virtio_user_as_exceptional_path:
 
-Virtio_user as Exceptional Path
-===============================
+Virtio_user as Exception Path
+=============================
 
-The virtual device, virtio-user, was originally introduced with vhost-user
-backend, as a high performance solution for IPC (Inter-Process Communication)
+.. note::
+
+   This solution is only applicable to Linux systems.
+
+The virtual device, virtio-user, was originally introduced with the vhost-user
+backend as a high performance solution for IPC (Inter-Process Communication)
 and user space container networking.
 
-Virtio_user with vhost-kernel backend is a solution for exceptional path,
-such as KNI which exchanges packets with kernel networking stack. This
-solution is very promising in:
+Beyond this originally intended use, virtio-user can be used in conjunction with the vhost-kernel
+backend as a solution for dealing with exception path packets which need to be injected into the
+Linux kernel for processing there.
+In this regard, virtio-user and vhost in kernel space are an alternative to DPDK KNI for
+transferring packets between a DPDK packet processing application and the kernel stack.
+
+This solution has a number of advantages over alternatives such as KNI:
 
 *   Maintenance
 
     All kernel modules needed by this solution, vhost and vhost-net (kernel),
-    are upstreamed and extensively used kernel module.
+    are upstreamed and extensively used.
 
 *   Features
 
-    vhost-net is born to be a networking solution, which has lots of networking
-    related features, like multi queue, tso, multi-seg mbuf, etc.
+    vhost-net is designed to be a networking solution, and, as such, has lots of networking
+    related features, such as multi queue support, TSO, multi-segment buffer support, etc.
 
 *   Performance
 
-    similar to KNI, this solution would use one or more kthreads to
-    send/receive packets to/from user space DPDK applications, which has little
-    impact on user space polling thread (except that it might enter into kernel
-    space to wake up those kthreads if necessary).
+    similar to KNI, this solution would uses one or more kthreads to
+    send/receive packets to/from user space DPDK applications, which minimises the impact
+    on the polling DPDK threads.
 
-The overview of an application using virtio-user as exceptional path is shown
+The overview of an application using virtio-user as exception path is shown
 in :numref:`figure_virtio_user_as_exceptional_path`.
 
 .. _figure_virtio_user_as_exceptional_path:
 
 .. figure:: img/virtio_user_as_exceptional_path.*
 
-   Overview of a DPDK app using virtio-user as exceptional path
+   Overview of a DPDK app using virtio-user as exception path
+
 
+Example Usage With Testpmd
+---------------------------
 
-Sample Usage
-------------
+.. note::
+
+   These instruction assume that the vhost/vhost-net kernel modules are available and have already
+   been loaded into the running kernel.
+   It also assumes that the DPDK virtio driver has not been disabled in the DPDK build.
 
-As a prerequisite, the vhost/vhost-net kernel CONFIG should be chosen before
-compiling the kernel and those kernel modules should be inserted.
+To run a simple test of virtio-user as exception path using testpmd:
 
-#.  Compile DPDK and bind a physical NIC to igb_uio/uio_pci_generic/vfio-pci.
+#.  Compile DPDK and bind a NIC to vfio-pci as documented in :ref:`linux_gsg_linux_drivers`.
 
-    This physical NIC is for communicating with outside.
+    This physical NIC is for communicating with the outside world,
+    and serves as a packet source in this example.
 
-#.  Run testpmd.
+#.  Run testpmd to forward packets from NIC to kernel,
+    passing in a suitable list of logical cores to run on  (``-l``.parameter),
+    and optionally the PCI address of the physical NIC to use (``-a`` parameter).
+    The virtio-user device for interfacing to the kernel is specified via a ``-vdev`` argument,
+    taking the parameters described below.
 
     .. code-block:: console
 
-        $(testpmd) -l 2-3 -n 4 \
-		--vdev=virtio_user0,path=/dev/vhost-net,queue_size=1024 \
-		-- -i --tx-offloads=0x0000002c --enable-lro \
-		--txd=1024 --rxd=1024
+        /path/to/dpdk-testpmd -l <cores> -a <pci BDF> \
+            --vdev=virtio_user0,path=/dev/vhost-net,queues=1,queue_size=1024
 
-    This command runs testpmd with two ports, one physical NIC to communicate
-    with outside, and one virtio-user to communicate with kernel.
+    * ``path``
 
-* ``--enable-lro``
+       The path to the kernel vhost-net device.
 
-    This is used to negotiate VIRTIO_NET_F_GUEST_TSO4 and
-    VIRTIO_NET_F_GUEST_TSO6 feature so that large packets from kernel can be
-    transmitted to DPDK application and further TSOed by physical NIC.
+    * ``queue_size``
 
-* ``queue_size``
+       256 by default. To avoid shortage of descriptors, we can increase it to 1024.
 
-    256 by default. To avoid shortage of descriptors, we can increase it to 1024.
+    * ``queues``
 
-* ``queues``
+       Number of virt-queues. Each queue will be served by a kthread.
 
-    Number of multi-queues. Each queue will be served by a kthread. For example:
+#. Once testpmd is running, a new network interface - called ``tap0`` by default -
+   will be present on the system.
+   This should be configured with an IP address and then enabled for use:
 
     .. code-block:: console
 
-        $(testpmd) -l 2-3 -n 4 \
-		--vdev=virtio_user0,path=/dev/vhost-net,queues=2,queue_size=1024 \
-		-- -i --tx-offloads=0x0000002c --enable-lro \
-		--txq=2 --rxq=2 --txd=1024 --rxd=1024
+        ip addr add 192.168.1.1/24 dev tap0
+        ip link set dev tap0 up
 
-#. Enable Rx checksum offloads in testpmd:
+#. To observe packet forwarding through the kernel,
+   a second testpmd instance can be run on the system,
+   taking packets from the kernel using an ``af_packet`` socket on the ``tap0`` interface.
 
-    .. code-block:: console
+   .. code-block:: console
 
-        (testpmd) port stop 0
-        (testpmd) port config 0 rx_offload tcp_cksum on
-        (testpmd) port config 0 rx_offload udp_cksum on
-        (testpmd) port start 0
+       /path/to/dpdk-testpmd -l <cores> --vdev=net_af_packet0,iface=tap0 --in-memory --no-pci
 
-#. Start testpmd:
+   When running this instance,
+   we can use ``--in-memory`` flag to avoid hugepage naming conflicts with the previous instance,
+   and we also use ``--no-pci`` flag to only use the ``af_packet`` interface for all traffic forwarding.
 
-    .. code-block:: console
+#. Running traffic into the system through the NIC should see that traffic returned back again,
+   having been forwarded through both testpmd instances.
+   This can be confirmed by checking the testpmd statistics on testpmd exit.
 
-        (testpmd) start
+For more advanced use of virtio-user with testpmd in this scenario,
+some other more advanced options may also be used.
+For example:
 
-#.  Configure IP address and start tap:
+* ``--tx-offloads=0x02c``
+
+    This testpmd option enables TX offloads for UDP and TCP checksum on transmit,
+    as well as TCP TSO support.
+    The list of the offload flag values can be seen in header `rte_ethdev.h
+    <https://doc.dpdk.org/api/rte__ethdev_8h.html>`_.
+
+* ``--enable-lro``
+
+    This testpmd option is used to negotiate VIRTIO_NET_F_GUEST_TSO4 and
+    VIRTIO_NET_F_GUEST_TSO6 feature so that large packets from the kernel can be
+    transmitted to the DPDK application and further TSOed by physical NIC.
+    If unsupported by the physical NIC, errors may be reported by testpmd with this option.
+
+
+* Enabling Rx checksum offloads for physical port:
+
+   Within testpmd, you can enable and disable offloads on a per-port basis,
+   rather than enabling them for both ports.
+   For the physical NIC, it may be desirable to enable checksum offload on packet RX.
+   This may be done as below, if testpmd is run with ``-i`` flag for interactive mode.
 
     .. code-block:: console
 
-        ifconfig tap0 1.1.1.1/24 up
+        testpmd> port stop 0
+        testpmd> port config 0 rx_offload tcp_cksum on
+        testpmd> port config 0 rx_offload udp_cksum on
+        testpmd> port start 0
 
-.. note::
+* Multiple queue support
 
-    The tap device will be named tap0, tap1, etc, by kernel.
+    Better performance may be achieved by using multiple queues,
+    so that multiple kernel threads are handling the traffic on the kernel side.
+    For example, to use 2 queues on both NIC and virtio ports,
+    while also enabling TX offloads and LRO support:
 
-Then, all traffic from physical NIC can be forwarded into kernel stack, and all
-traffic on the tap0 can be sent out from physical NIC.
+    .. code-block:: console
 
-Limitations
------------
+        /path/to/dpdk-testpmd --vdev=virtio_user0,path=/dev/vhost-net,queues=2,queue_size=1024 -- \
+            -i --tx-offloads=0x002c --enable-lro --txq=2 --rxq=2 --txd=1024 --rxd=1024
 
-This solution is only available on Linux systems.

--
2.34.1

#3 lore raw

PATCH v2 2/2 doc/howto: add code example to virtio-user exception path doc

The HOWTO guide for using virtio-user as an exception path to the kernel only provided an example of how testpmd may be used for that purpose. However, a real application wanting to use virtio-user as exception path would likely want to create such devices from code within the app itself. Therefore, we update the doc with instructions and a code snippet showing how this may be done.

---

v2: fix http link to https

---
 .../howto/virtio_user_as_exceptional_path.rst | 55 +++++++++++++++++++
 1 file changed, 55 insertions(+)
doc/guides/howto/virtio_user_as_exceptional_path.rst +55 -0
index 100376c32d..45d4ebd284 100644
@@ -157,3 +157,58 @@ For example:
         /path/to/dpdk-testpmd --vdev=virtio_user0,path=/dev/vhost-net,queues=2,queue_size=1024 -- \
             -i --tx-offloads=0x002c --enable-lro --txq=2 --rxq=2 --txd=1024 --rxd=1024
 
+
+Creating Virtio-User Ports within an Application
+------------------------------------------------
+
+To use virtio-user ports within an application,
+it is not necessary to explicitly initialize those ports using EAL arguments at startup.
+Instead, one can use the generic EAL API
+`rte_eal_hotplug_add <https://doc.dpdk.org/api/rte__dev_8h.html#ad32e8eebf1f81ef9f290cb296b0c90bb>`_
+function to create a new instance at startup.
+For example, to create a basic virtio-user port, the following code could be used:
+
+.. code-block:: C
+
+   rte_eal_hotplug_add("vdev", "virtio_user0", "path=/dev/vhost-net");
+
+A fuller code example is shown below, where a virtio-user port, and hence kernel netdev,
+is created for each NIC port discovered by DPDK.
+Each virtio-user port is given the MAC address of its matching physical port
+(assuming app was run without vdev args on commandline, so all ports auto-discovered are HW ones).
+These new virtio-user netdevs will appear in the kernel port listings as ``virtio_user0``,
+``virtio_user1``, etc.,
+based on the names passed in as ``iface=`` via the ``portargs`` parameter.
+
+.. code-block:: C
+
+    nb_ports = rte_eth_dev_count_avail();
+
+    /* Create a vhost_user port for each physical port */
+    unsigned port_count = 0;
+    RTE_ETH_FOREACH_DEV(portid) {
+        char portname[32];
+        char portargs[256];
+        struct rte_ether_addr addr = {0};
+
+        /* don't create virtio_user ports for other virtio_user ports */
+        if (++port_count > nb_ports)
+            break;
+
+        /* get mac address of physical port to use as mac of virtio_user port */
+        rte_eth_macaddr_get(portid, &addr);
+
+        /* set the name and arguments */
+        snprintf(portname, sizeof(portname), "virtio_user%u", portid);
+        snprintf(portargs, sizeof(portargs),
+                "path=/dev/vhost-net,queues=1,queue_size=%u,iface=%s,mac=" RTE_ETHER_ADDR_PRT_FMT,
+                RX_RING_SIZE, portname, RTE_ETHER_ADDR_BYTES(&addr));
+
+        /* add the vdev for virtio_user */
+        if (rte_eal_hotplug_add("vdev", portname, portargs) < 0)
+            rte_exit(EXIT_FAILURE, "Cannot create paired port for port %u\n", portid);
+
+    }
+
+Once these virtio-user ports have been created in the loop, all ports, both physical and virtual,
+may be initialized and used as normal in the application.
Signature · 1 line
2.34.1
Acked-by on v2 2/2
#4 lore raw

Re: [PATCH v2 2/2] doc/howto: add code example to virtio-user exception path doc

Quoted 8 lines · On Fri, 27 May 2022 17:36:43 +0100 Bruce Richardson…

The HOWTO guide for using virtio-user as an exception path to the kernel only provided an example of how testpmd may be used for that purpose. However, a real application wanting to use virtio-user as exception path would likely want to create such devices from code within the app itself. Therefore, we update the doc with instructions and a code snippet showing how this may be done.

#5 lore raw

RE: [PATCH v2 2/2] doc/howto: add code example to virtio-user exception path doc

In reply to Bruce Richardson
Quoted 59 lines

-----Original Message-----
From: Richardson, Bruce <[email protected]>
Sent: Saturday, May 28, 2022 12:37 AM
To: [email protected]
Cc: Maxime Coquelin <[email protected]>; Xia, Chenbo <[email protected]>; Richardson, Bruce <[email protected]>
Subject: [PATCH v2 2/2] doc/howto: add code example to virtio-user exception path doc

The HOWTO guide for using virtio-user as an exception path to the kernel only provided an example of how testpmd may be used for that purpose. However, a real application wanting to use virtio-user as exception path would likely want to create such devices from code within the app itself. Therefore, we update the doc with instructions and a code snippet showing how this may be done.

---

v2: fix http link to https

---
 .../howto/virtio_user_as_exceptional_path.rst | 55 +++++++++++++++++++
 1 file changed, 55 insertions(+)
doc/guides/howto/virtio_user_as_exceptional_path.rst +0 -0
index 100376c32d..45d4ebd284 100644
@@ -157,3 +157,58 @@ For example:
         /path/to/dpdk-testpmd --vdev=virtio_user0,path=/dev/vhost-
 net,queues=2,queue_size=1024 -- \
             -i --tx-offloads=0x002c --enable-lro --txq=2 --rxq=2 --

txd=1024 --rxd=1024

doc/guides/howto/virtio_user_as_exceptional_path.rst +6 -0
+
+Creating Virtio-User Ports within an Application
+------------------------------------------------
+
+To use virtio-user ports within an application,
+it is not necessary to explicitly initialize those ports using EAL

arguments at startup.
+Instead, one can use the generic EAL API
+`rte_eal_hotplug_add
<https://doc.dpdk.org/api/rte__dev_8h.html#ad32e8eebf1f81ef9f290cb296b0c90
bb>`_

doc/guides/howto/virtio_user_as_exceptional_path.rst +2 -0
+function to create a new instance at startup.
+For example, to create a basic virtio-user port, the following code could

be used:

doc/guides/howto/virtio_user_as_exceptional_path.rst +6 -0
+
+.. code-block:: C
+
+   rte_eal_hotplug_add("vdev", "virtio_user0", "path=/dev/vhost-net");
+
+A fuller code example is shown below, where a virtio-user port, and hence

kernel netdev,

doc/guides/howto/virtio_user_as_exceptional_path.rst +2 -0
+is created for each NIC port discovered by DPDK.
+Each virtio-user port is given the MAC address of its matching physical
Quoted 5 lines

port
+(assuming app was run without vdev args on commandline, so all ports auto-discovered are HW ones).
+These new virtio-user netdevs will appear in the kernel port listings as ``virtio_user0``,

You mean vhost_tap netdev here? Or?

Thanks,
Chenbo

Quoted 41 lines

+``virtio_user1``, etc.,

doc/guides/howto/virtio_user_as_exceptional_path.rst +18 -0
+based on the names passed in as ``iface=`` via the ``portargs`` parameter.
+
+.. code-block:: C
+
+    nb_ports = rte_eth_dev_count_avail();
+
+    /* Create a vhost_user port for each physical port */
+    unsigned port_count = 0;
+    RTE_ETH_FOREACH_DEV(portid) {
+        char portname[32];
+        char portargs[256];
+        struct rte_ether_addr addr = {0};
+
+        /* don't create virtio_user ports for other virtio_user ports */
+        if (++port_count > nb_ports)
+            break;
+
+        /* get mac address of physical port to use as mac of virtio_user

port */

doc/guides/howto/virtio_user_as_exceptional_path.rst +6 -0
+        rte_eth_macaddr_get(portid, &addr);
+
+        /* set the name and arguments */
+        snprintf(portname, sizeof(portname), "virtio_user%u", portid);
+        snprintf(portargs, sizeof(portargs),
+                "path=/dev/vhost-

net,queues=1,queue_size=%u,iface=%s,mac=" RTE_ETHER_ADDR_PRT_FMT,

doc/guides/howto/virtio_user_as_exceptional_path.rst +5 -0
+                RX_RING_SIZE, portname, RTE_ETHER_ADDR_BYTES(&addr));
+
+        /* add the vdev for virtio_user */
+        if (rte_eal_hotplug_add("vdev", portname, portargs) < 0)
+            rte_exit(EXIT_FAILURE, "Cannot create paired port for

port %u\n", portid);

doc/guides/howto/virtio_user_as_exceptional_path.rst +4 -0
+
+    }
+
+Once these virtio-user ports have been created in the loop, all ports,

both physical and virtual,
+may be initialized and used as normal in the application. --
2.34.1

#6 lore raw

Re: [PATCH v2 2/2] doc/howto: add code example to virtio-user exception path doc

Quoted 58 lines · Chenbo
Quoted 58 lines

-----Original Message-----
From: Richardson, Bruce <[email protected]>
Sent: Saturday, May 28, 2022 12:37 AM
To: [email protected]
Cc: Maxime Coquelin <[email protected]>; Xia, Chenbo <[email protected]>; Richardson, Bruce <[email protected]>
Subject: [PATCH v2 2/2] doc/howto: add code example to virtio-user exception path doc

The HOWTO guide for using virtio-user as an exception path to the kernel only provided an example of how testpmd may be used for that purpose. However, a real application wanting to use virtio-user as exception path would likely want to create such devices from code within the app itself. Therefore, we update the doc with instructions and a code snippet showing how this may be done.

---

v2: fix http link to https

---
 .../howto/virtio_user_as_exceptional_path.rst | 55 +++++++++++++++++++
 1 file changed, 55 insertions(+)
doc/guides/howto/virtio_user_as_exceptional_path.rst +0 -0
index 100376c32d..45d4ebd284 100644
@@ -157,3 +157,58 @@ For example:
         /path/to/dpdk-testpmd --vdev=virtio_user0,path=/dev/vhost-
 net,queues=2,queue_size=1024 -- \
             -i --tx-offloads=0x002c --enable-lro --txq=2 --rxq=2 --

txd=1024 --rxd=1024

doc/guides/howto/virtio_user_as_exceptional_path.rst +6 -0
+
+Creating Virtio-User Ports within an Application
+------------------------------------------------
+
+To use virtio-user ports within an application,
+it is not necessary to explicitly initialize those ports using EAL

arguments at startup.
+Instead, one can use the generic EAL API
+`rte_eal_hotplug_add
<https://doc.dpdk.org/api/rte__dev_8h.html#ad32e8eebf1f81ef9f290cb296b0c90
bb>`_

doc/guides/howto/virtio_user_as_exceptional_path.rst +2 -0
+function to create a new instance at startup.
+For example, to create a basic virtio-user port, the following code could

be used:

doc/guides/howto/virtio_user_as_exceptional_path.rst +6 -0
+
+.. code-block:: C
+
+   rte_eal_hotplug_add("vdev", "virtio_user0", "path=/dev/vhost-net");
+
+A fuller code example is shown below, where a virtio-user port, and hence

kernel netdev,
+is created for each NIC port discovered by DPDK.

Quoted 9 lines
Quoted 6 lines

+Each virtio-user port is given the MAC address of its matching physical port
+(assuming app was run without vdev args on commandline, so all ports auto-discovered are HW ones).
+These new virtio-user netdevs will appear in the kernel port listings as ``virtio_user0``,

You mean vhost_tap netdev here? Or?

Yes, I am referring to the vhost tap port. If you look at the code below, the parameters provide the name of the kernel netdev to be the same as the name of the vdev created, meaning any ports will appear as "vhost_user0", "vhost_user1" etc. in your ip-link/ifconfig listings.

/Bruce

Quoted 43 lines
Quoted 42 lines

+``virtio_user1``, etc.,

doc/guides/howto/virtio_user_as_exceptional_path.rst +18 -0
+based on the names passed in as ``iface=`` via the ``portargs`` parameter.
+
+.. code-block:: C
+
+    nb_ports = rte_eth_dev_count_avail();
+
+    /* Create a vhost_user port for each physical port */
+    unsigned port_count = 0;
+    RTE_ETH_FOREACH_DEV(portid) {
+        char portname[32];
+        char portargs[256];
+        struct rte_ether_addr addr = {0};
+
+        /* don't create virtio_user ports for other virtio_user ports */
+        if (++port_count > nb_ports)
+            break;
+
+        /* get mac address of physical port to use as mac of virtio_user

port */

doc/guides/howto/virtio_user_as_exceptional_path.rst +6 -0
+        rte_eth_macaddr_get(portid, &addr);
+
+        /* set the name and arguments */
+        snprintf(portname, sizeof(portname), "virtio_user%u", portid);
+        snprintf(portargs, sizeof(portargs),
+                "path=/dev/vhost-

net,queues=1,queue_size=%u,iface=%s,mac=" RTE_ETHER_ADDR_PRT_FMT,

doc/guides/howto/virtio_user_as_exceptional_path.rst +5 -0
+                RX_RING_SIZE, portname, RTE_ETHER_ADDR_BYTES(&addr));
+
+        /* add the vdev for virtio_user */
+        if (rte_eal_hotplug_add("vdev", portname, portargs) < 0)
+            rte_exit(EXIT_FAILURE, "Cannot create paired port for

port %u\n", portid);

doc/guides/howto/virtio_user_as_exceptional_path.rst +4 -0
+
+    }
+
+Once these virtio-user ports have been created in the loop, all ports,

both physical and virtual,
+may be initialized and used as normal in the application. --
2.34.1

#7 lore raw
In reply to Bruce Richardson

Hi Bruce,

Quoted 21 lines

-----Original Message-----
From: Richardson, Bruce <[email protected]>
Sent: Saturday, May 28, 2022 12:37 AM
To: [email protected]
Cc: Maxime Coquelin <[email protected]>; Xia, Chenbo <[email protected]>; Richardson, Bruce <[email protected]>
Subject: [PATCH v2 1/2] doc/howto: rework section on virtio-user as exception path

This patch extensively reworks the howto guide on using virtio-user for exception packets. Changes include:

* rename "exceptional path" to "exception path"
* remove references to uio and just reference vfio-pci
* simplify testpmd command-lines, giving a basic usage example first before adding on detail about checksum or TSO parameters
* give a complete working example showing traffic flowing through the whole system from a testpmd loopback using the created TAP netdev
* replace use of "ifconfig" with Linux standard "ip" command
* other general rewording.

Quoted 6 lines

---
v2: fix checkpatch warnings

---
 .../howto/virtio_user_as_exceptional_path.rst | 159 +++++++++++-------

I agree with the renaming. And should we rename this file, and if possible, the attached img too.

Quoted 119 lines
 1 file changed, 100 insertions(+), 59 deletions(-)
doc/guides/howto/virtio_user_as_exceptional_path.rst +2 -3
index ec021af399..100376c32d 100644
@@ -3,116 +3,157 @@
 
 .. _virtio_user_as_exceptional_path:
 
-Virtio_user as Exceptional Path
-===============================
+Virtio_user as Exception Path
+=============================
 
-The virtual device, virtio-user, was originally introduced with vhost-

user
-backend, as a high performance solution for IPC (Inter-Process Communication)
+.. note::

doc/guides/howto/virtio_user_as_exceptional_path.rst +4 -0
+
+   This solution is only applicable to Linux systems.
+
+The virtual device, virtio-user, was originally introduced with the

vhost-user
+backend as a high performance solution for IPC (Inter-Process Communication)
and user space container networking.

doc/guides/howto/virtio_user_as_exceptional_path.rst +1 -3
-Virtio_user with vhost-kernel backend is a solution for exceptional path,
-such as KNI which exchanges packets with kernel networking stack. This
-solution is very promising in:
+Beyond this originally intended use, virtio-user can be used in

conjunction with the vhost-kernel
+backend as a solution for dealing with exception path packets which need to be injected into the

doc/guides/howto/virtio_user_as_exceptional_path.rst +2 -0
+Linux kernel for processing there.
+In this regard, virtio-user and vhost in kernel space are an alternative

to DPDK KNI for
+transferring packets between a DPDK packet processing application and the kernel stack.

doc/guides/howto/virtio_user_as_exceptional_path.rst +2 -0
+
+This solution has a number of advantages over alternatives such as KNI:
 
 *   Maintenance
 
     All kernel modules needed by this solution, vhost and vhost-net

(kernel),

doc/guides/howto/virtio_user_as_exceptional_path.rst +1 -2
-    are upstreamed and extensively used kernel module.
+    are upstreamed and extensively used.
 
 *   Features
 
-    vhost-net is born to be a networking solution, which has lots of

networking

doc/guides/howto/virtio_user_as_exceptional_path.rst +1 -1
-    related features, like multi queue, tso, multi-seg mbuf, etc.
+    vhost-net is designed to be a networking solution, and, as such, has

lots of networking
+ related features, such as multi queue support, TSO, multi-segment
buffer support, etc.

* Performance

doc/guides/howto/virtio_user_as_exceptional_path.rst +0 -2
-    similar to KNI, this solution would use one or more kthreads to
-    send/receive packets to/from user space DPDK applications, which has

little
- impact on user space polling thread (except that it might enter into
kernel

doc/guides/howto/virtio_user_as_exceptional_path.rst +2 -1
-    space to wake up those kthreads if necessary).
+    similar to KNI, this solution would uses one or more kthreads to
+    send/receive packets to/from user space DPDK applications, which

minimises the impact

doc/guides/howto/virtio_user_as_exceptional_path.rst +1 -1
+    on the polling DPDK threads.
 
-The overview of an application using virtio-user as exceptional path is

shown
+The overview of an application using virtio-user as exception path is shown
in :numref:figure_virtio_user_as_exceptional_path.

.. _figure_virtio_user_as_exceptional_path:

.. figure:: img/virtio_user_as_exceptional_path.*

doc/guides/howto/virtio_user_as_exceptional_path.rst +7 -3
-   Overview of a DPDK app using virtio-user as exceptional path
+   Overview of a DPDK app using virtio-user as exception path
+
 
+Example Usage With Testpmd
+---------------------------
 
-Sample Usage
-------------
+.. note::
+
+   These instruction assume that the vhost/vhost-net kernel modules are

available and have already

doc/guides/howto/virtio_user_as_exceptional_path.rst +2 -0
+   been loaded into the running kernel.
+   It also assumes that the DPDK virtio driver has not been disabled in

the DPDK build.

-As a prerequisite, the vhost/vhost-net kernel CONFIG should be chosen before

doc/guides/howto/virtio_user_as_exceptional_path.rst +1 -2
-compiling the kernel and those kernel modules should be inserted.
+To run a simple test of virtio-user as exception path using testpmd:
 
-#.  Compile DPDK and bind a physical NIC to igb_uio/uio_pci_generic/vfio-

pci.
+#. Compile DPDK and bind a NIC to vfio-pci as documented in :ref:linux_gsg_linux_drivers.

doc/guides/howto/virtio_user_as_exceptional_path.rst +4 -2
-    This physical NIC is for communicating with outside.
+    This physical NIC is for communicating with the outside world,
+    and serves as a packet source in this example.
 
-#.  Run testpmd.
+#.  Run testpmd to forward packets from NIC to kernel,
+    passing in a suitable list of logical cores to run on  (``-
Quoted 1 line

l``.parameter),

This '.' should be a space?

Overall, the changes LGTM.

Thanks!
Chenbo

Quoted 156 lines

+ and optionally the PCI address of the physical NIC to use (``-a``
parameter).
+ The virtio-user device for interfacing to the kernel is specified via
a ``-vdev`` argument,

doc/guides/howto/virtio_user_as_exceptional_path.rst +3 -4
+    taking the parameters described below.
 
     .. code-block:: console
 
-        $(testpmd) -l 2-3 -n 4 \
-		--vdev=virtio_user0,path=/dev/vhost-net,queue_size=1024 \
-		-- -i --tx-offloads=0x0000002c --enable-lro \
-		--txd=1024 --rxd=1024
+        /path/to/dpdk-testpmd -l <cores> -a <pci BDF> \
+            --vdev=virtio_user0,path=/dev/vhost-

net,queues=1,queue_size=1024

- This command runs testpmd with two ports, one physical NIC to
communicate

doc/guides/howto/virtio_user_as_exceptional_path.rst +2 -4
-    with outside, and one virtio-user to communicate with kernel.
+    * ``path``
 
-* ``--enable-lro``
+       The path to the kernel vhost-net device.
 
-    This is used to negotiate VIRTIO_NET_F_GUEST_TSO4 and
-    VIRTIO_NET_F_GUEST_TSO6 feature so that large packets from kernel can

be

doc/guides/howto/virtio_user_as_exceptional_path.rst +2 -2
-    transmitted to DPDK application and further TSOed by physical NIC.
+    * ``queue_size``
 
-* ``queue_size``
+       256 by default. To avoid shortage of descriptors, we can increase

it to 1024.

- 256 by default. To avoid shortage of descriptors, we can increase it
to 1024.

doc/guides/howto/virtio_user_as_exceptional_path.rst +2 -2
+    * ``queues``
 
-* ``queues``
+       Number of virt-queues. Each queue will be served by a kthread.
 
-    Number of multi-queues. Each queue will be served by a kthread. For

example:
+#. Once testpmd is running, a new network interface - called ``tap0`` by default -

doc/guides/howto/virtio_user_as_exceptional_path.rst +2 -2
+   will be present on the system.
+   This should be configured with an IP address and then enabled for use:
 
     .. code-block:: console
 
-        $(testpmd) -l 2-3 -n 4 \
-		--vdev=virtio_user0,path=/dev/vhost-

net,queues=2,queue_size=1024 \

doc/guides/howto/virtio_user_as_exceptional_path.rst +5 -3
-		-- -i --tx-offloads=0x0000002c --enable-lro \
-		--txq=2 --rxq=2 --txd=1024 --rxd=1024
+        ip addr add 192.168.1.1/24 dev tap0
+        ip link set dev tap0 up
 
-#. Enable Rx checksum offloads in testpmd:
+#. To observe packet forwarding through the kernel,
+   a second testpmd instance can be run on the system,
+   taking packets from the kernel using an ``af_packet`` socket on the

``tap0`` interface.

doc/guides/howto/virtio_user_as_exceptional_path.rst +4 -7
-    .. code-block:: console
+   .. code-block:: console
 
-        (testpmd) port stop 0
-        (testpmd) port config 0 rx_offload tcp_cksum on
-        (testpmd) port config 0 rx_offload udp_cksum on
-        (testpmd) port start 0
+       /path/to/dpdk-testpmd -l <cores> --vdev=net_af_packet0,iface=tap0
--in-memory --no-pci
 
-#. Start testpmd:
+   When running this instance,
+   we can use ``--in-memory`` flag to avoid hugepage naming conflicts

with the previous instance,
+ and we also use ``--no-pci`` flag to only use the ``af_packet``
interface for all traffic forwarding.

doc/guides/howto/virtio_user_as_exceptional_path.rst +1 -1
-    .. code-block:: console
+#. Running traffic into the system through the NIC should see that

traffic returned back again,

doc/guides/howto/virtio_user_as_exceptional_path.rst +2 -0
+   having been forwarded through both testpmd instances.
+   This can be confirmed by checking the testpmd statistics on testpmd

exit.

doc/guides/howto/virtio_user_as_exceptional_path.rst +6 -2
-        (testpmd) start
+For more advanced use of virtio-user with testpmd in this scenario,
+some other more advanced options may also be used.
+For example:
 
-#.  Configure IP address and start tap:
+* ``--tx-offloads=0x02c``
+
+    This testpmd option enables TX offloads for UDP and TCP checksum on

transmit,

doc/guides/howto/virtio_user_as_exceptional_path.rst +2 -0
+    as well as TCP TSO support.
+    The list of the offload flag values can be seen in header

`rte_ethdev.h

doc/guides/howto/virtio_user_as_exceptional_path.rst +6 -0
+    <https://doc.dpdk.org/api/rte__ethdev_8h.html>`_.
+
+* ``--enable-lro``
+
+    This testpmd option is used to negotiate VIRTIO_NET_F_GUEST_TSO4 and
+    VIRTIO_NET_F_GUEST_TSO6 feature so that large packets from the kernel

can be

doc/guides/howto/virtio_user_as_exceptional_path.rst +2 -0
+    transmitted to the DPDK application and further TSOed by physical NIC.
+    If unsupported by the physical NIC, errors may be reported by testpmd

with this option.

doc/guides/howto/virtio_user_as_exceptional_path.rst +5 -0
+
+
+* Enabling Rx checksum offloads for physical port:
+
+   Within testpmd, you can enable and disable offloads on a per-port

basis,

doc/guides/howto/virtio_user_as_exceptional_path.rst +2 -0
+   rather than enabling them for both ports.
+   For the physical NIC, it may be desirable to enable checksum offload

on packet RX.
+ This may be done as below, if testpmd is run with ``-i`` flag for
interactive mode.

.. code-block:: console

doc/guides/howto/virtio_user_as_exceptional_path.rst +7 -3
-        ifconfig tap0 1.1.1.1/24 up
+        testpmd> port stop 0
+        testpmd> port config 0 rx_offload tcp_cksum on
+        testpmd> port config 0 rx_offload udp_cksum on
+        testpmd> port start 0
 
-.. note::
+* Multiple queue support
 
-    The tap device will be named tap0, tap1, etc, by kernel.
+    Better performance may be achieved by using multiple queues,
+    so that multiple kernel threads are handling the traffic on the

kernel side.

doc/guides/howto/virtio_user_as_exceptional_path.rst +2 -1
+    For example, to use 2 queues on both NIC and virtio ports,
+    while also enabling TX offloads and LRO support:
 
-Then, all traffic from physical NIC can be forwarded into kernel stack,

and all

doc/guides/howto/virtio_user_as_exceptional_path.rst +2 -3
-traffic on the tap0 can be sent out from physical NIC.
+    .. code-block:: console
 
-Limitations
------------
+        /path/to/dpdk-testpmd --vdev=virtio_user0,path=/dev/vhost-

net,queues=2,queue_size=1024 -- \
+ -i --tx-offloads=0x002c --enable-lro --txq=2 --rxq=2 --
txd=1024 --rxd=1024

-This solution is only available on Linux systems. --
2.34.1

#8 lore raw
Quoted 25 lines · Chenbo

Hi Bruce,

Quoted 23 lines

-----Original Message-----
From: Richardson, Bruce <[email protected]>
Sent: Saturday, May 28, 2022 12:37 AM
To: [email protected]
Cc: Maxime Coquelin <[email protected]>; Xia, Chenbo <[email protected]>; Richardson, Bruce <[email protected]>
Subject: [PATCH v2 1/2] doc/howto: rework section on virtio-user as exception path

This patch extensively reworks the howto guide on using virtio-user for exception packets. Changes include:

* rename "exceptional path" to "exception path"
* remove references to uio and just reference vfio-pci
* simplify testpmd command-lines, giving a basic usage example first before adding on detail about checksum or TSO parameters
* give a complete working example showing traffic flowing through the whole system from a testpmd loopback using the created TAP netdev
* replace use of "ifconfig" with Linux standard "ip" command
* other general rewording.

Quoted 8 lines
Quoted 4 lines

---
v2: fix checkpatch warnings

---
 .../howto/virtio_user_as_exceptional_path.rst | 159 +++++++++++-------

I agree with the renaming. And should we rename this file, and if possible, the attached img too.

I wasn't sure of the value of doing such a rename - afraid it might clobber up the git history. I'll add it as a separate patch in a v3.

Quoted 116 lines
Quoted 116 lines
 1 file changed, 100 insertions(+), 59 deletions(-)
doc/guides/howto/virtio_user_as_exceptional_path.rst +2 -3
index ec021af399..100376c32d 100644
@@ -3,116 +3,157 @@
 
 .. _virtio_user_as_exceptional_path:
 
-Virtio_user as Exceptional Path
-===============================
+Virtio_user as Exception Path
+=============================
 
-The virtual device, virtio-user, was originally introduced with vhost-

user
-backend, as a high performance solution for IPC (Inter-Process Communication)
+.. note::

doc/guides/howto/virtio_user_as_exceptional_path.rst +4 -0
+
+   This solution is only applicable to Linux systems.
+
+The virtual device, virtio-user, was originally introduced with the

vhost-user
+backend as a high performance solution for IPC (Inter-Process Communication)
and user space container networking.

doc/guides/howto/virtio_user_as_exceptional_path.rst +1 -3
-Virtio_user with vhost-kernel backend is a solution for exceptional path,
-such as KNI which exchanges packets with kernel networking stack. This
-solution is very promising in:
+Beyond this originally intended use, virtio-user can be used in

conjunction with the vhost-kernel
+backend as a solution for dealing with exception path packets which need to be injected into the

doc/guides/howto/virtio_user_as_exceptional_path.rst +2 -0
+Linux kernel for processing there.
+In this regard, virtio-user and vhost in kernel space are an alternative

to DPDK KNI for
+transferring packets between a DPDK packet processing application and the kernel stack.

doc/guides/howto/virtio_user_as_exceptional_path.rst +2 -0
+
+This solution has a number of advantages over alternatives such as KNI:
 
 *   Maintenance
 
     All kernel modules needed by this solution, vhost and vhost-net

(kernel),

doc/guides/howto/virtio_user_as_exceptional_path.rst +1 -2
-    are upstreamed and extensively used kernel module.
+    are upstreamed and extensively used.
 
 *   Features
 
-    vhost-net is born to be a networking solution, which has lots of

networking

doc/guides/howto/virtio_user_as_exceptional_path.rst +1 -1
-    related features, like multi queue, tso, multi-seg mbuf, etc.
+    vhost-net is designed to be a networking solution, and, as such, has

lots of networking
+ related features, such as multi queue support, TSO, multi-segment
buffer support, etc.

* Performance

doc/guides/howto/virtio_user_as_exceptional_path.rst +0 -2
-    similar to KNI, this solution would use one or more kthreads to
-    send/receive packets to/from user space DPDK applications, which has

little
- impact on user space polling thread (except that it might enter into
kernel

doc/guides/howto/virtio_user_as_exceptional_path.rst +2 -1
-    space to wake up those kthreads if necessary).
+    similar to KNI, this solution would uses one or more kthreads to
+    send/receive packets to/from user space DPDK applications, which

minimises the impact

doc/guides/howto/virtio_user_as_exceptional_path.rst +1 -1
+    on the polling DPDK threads.
 
-The overview of an application using virtio-user as exceptional path is

shown
+The overview of an application using virtio-user as exception path is shown
in :numref:figure_virtio_user_as_exceptional_path.

.. _figure_virtio_user_as_exceptional_path:

.. figure:: img/virtio_user_as_exceptional_path.*

doc/guides/howto/virtio_user_as_exceptional_path.rst +7 -3
-   Overview of a DPDK app using virtio-user as exceptional path
+   Overview of a DPDK app using virtio-user as exception path
+
 
+Example Usage With Testpmd
+---------------------------
 
-Sample Usage
-------------
+.. note::
+
+   These instruction assume that the vhost/vhost-net kernel modules are

available and have already

doc/guides/howto/virtio_user_as_exceptional_path.rst +2 -0
+   been loaded into the running kernel.
+   It also assumes that the DPDK virtio driver has not been disabled in

the DPDK build.

-As a prerequisite, the vhost/vhost-net kernel CONFIG should be chosen before

doc/guides/howto/virtio_user_as_exceptional_path.rst +1 -2
-compiling the kernel and those kernel modules should be inserted.
+To run a simple test of virtio-user as exception path using testpmd:
 
-#.  Compile DPDK and bind a physical NIC to igb_uio/uio_pci_generic/vfio-

pci.
+#. Compile DPDK and bind a NIC to vfio-pci as documented in :ref:linux_gsg_linux_drivers.

doc/guides/howto/virtio_user_as_exceptional_path.rst +2 -1
-    This physical NIC is for communicating with outside.
+    This physical NIC is for communicating with the outside world,
+    and serves as a packet source in this example.
Quoted 7 lines
Quoted 4 lines
doc/guides/howto/virtio_user_as_exceptional_path.rst +2 -1
-#.  Run testpmd.
+#.  Run testpmd to forward packets from NIC to kernel,
+    passing in a suitable list of logical cores to run on  (``-

l``.parameter),

This '.' should be a space?

Thanks, good catch.

#9 lore raw

v3 cover Enhance docs on virtio-user as KNI replacement

In reply to Bruce Richardson

Since use of KNI is no longer advised (due to known issues and the fact it's an out-of-tree module), virtio-user is recommended for new developments. To help encourage this, we improve the doc HOWTO section on using virtio-user and add a link to that document from the main KNI section in the programmers guide.

v3:
* Added two extra patches:
- rename document files to match new section name
- add note to KNI programmers guide section
* minor updates to patch 2, and added stable on CC for that patch

Bruce Richardson (4):
doc/howto: rework section on virtio-user as exception path doc/howto: rename files to match new content name doc/howto: add code example to virtio-user exception path doc doc/prog_guide: add reference to virtio-user from KNI doc

 ....svg => virtio_user_as_exception_path.svg} |   0
 doc/guides/howto/index.rst                    |   2 +-
 .../howto/virtio_user_as_exception_path.rst   | 214 ++++++++++++++++++
 .../howto/virtio_user_as_exceptional_path.rst | 118 ----------
 .../prog_guide/kernel_nic_interface.rst       |   6 +
 5 files changed, 221 insertions(+), 119 deletions(-)
 rename doc/guides/howto/img/{virtio_user_as_exceptional_path.svg => virtio_user_as_exception_path.svg} (100%)
 create mode 100644 doc/guides/howto/virtio_user_as_exception_path.rst
 delete mode 100644 doc/guides/howto/virtio_user_as_exceptional_path.rst

--
2.34.1

#10 lore raw

PATCH v3 1/4 doc/howto: rework section on virtio-user as exception path

This patch extensively reworks the howto guide on using virtio-user for exception packets. Changes include:

* rename "exceptional path" to "exception path"
* remove references to uio and just reference vfio-pci
* simplify testpmd command-lines, giving a basic usage example first before adding on detail about checksum or TSO parameters
* give a complete working example showing traffic flowing through the whole system from a testpmd loopback using the created TAP netdev
* replace use of "ifconfig" with Linux standard "ip" command
* other general rewording.

---
V3:
* fix error reported by Chenbo on review.
* add stable on CC, since this rework could be applicable for older releases too, if desired for backport.

---
 .../howto/virtio_user_as_exceptional_path.rst | 159 +++++++++++-------
 1 file changed, 100 insertions(+), 59 deletions(-)
doc/guides/howto/virtio_user_as_exceptional_path.rst +100 -59
index ec021af399..3d3d1b1219 100644
@@ -3,116 +3,157 @@
 
 .. _virtio_user_as_exceptional_path:
 
-Virtio_user as Exceptional Path
-===============================
+Virtio_user as Exception Path
+=============================
 
-The virtual device, virtio-user, was originally introduced with vhost-user
-backend, as a high performance solution for IPC (Inter-Process Communication)
+.. note::
+
+   This solution is only applicable to Linux systems.
+
+The virtual device, virtio-user, was originally introduced with the vhost-user
+backend as a high performance solution for IPC (Inter-Process Communication)
 and user space container networking.
 
-Virtio_user with vhost-kernel backend is a solution for exceptional path,
-such as KNI which exchanges packets with kernel networking stack. This
-solution is very promising in:
+Beyond this originally intended use, virtio-user can be used in conjunction with the vhost-kernel
+backend as a solution for dealing with exception path packets which need to be injected into the
+Linux kernel for processing there.
+In this regard, virtio-user and vhost in kernel space are an alternative to DPDK KNI for
+transferring packets between a DPDK packet processing application and the kernel stack.
+
+This solution has a number of advantages over alternatives such as KNI:
 
 *   Maintenance
 
     All kernel modules needed by this solution, vhost and vhost-net (kernel),
-    are upstreamed and extensively used kernel module.
+    are upstreamed and extensively used.
 
 *   Features
 
-    vhost-net is born to be a networking solution, which has lots of networking
-    related features, like multi queue, tso, multi-seg mbuf, etc.
+    vhost-net is designed to be a networking solution, and, as such, has lots of networking
+    related features, such as multi queue support, TSO, multi-segment buffer support, etc.
 
 *   Performance
 
-    similar to KNI, this solution would use one or more kthreads to
-    send/receive packets to/from user space DPDK applications, which has little
-    impact on user space polling thread (except that it might enter into kernel
-    space to wake up those kthreads if necessary).
+    similar to KNI, this solution would uses one or more kthreads to
+    send/receive packets to/from user space DPDK applications, which minimises the impact
+    on the polling DPDK threads.
 
-The overview of an application using virtio-user as exceptional path is shown
+The overview of an application using virtio-user as exception path is shown
 in :numref:`figure_virtio_user_as_exceptional_path`.
 
 .. _figure_virtio_user_as_exceptional_path:
 
 .. figure:: img/virtio_user_as_exceptional_path.*
 
-   Overview of a DPDK app using virtio-user as exceptional path
+   Overview of a DPDK app using virtio-user as exception path
+
 
+Example Usage With Testpmd
+---------------------------
 
-Sample Usage
-------------
+.. note::
+
+   These instruction assume that the vhost/vhost-net kernel modules are available and have already
+   been loaded into the running kernel.
+   It also assumes that the DPDK virtio driver has not been disabled in the DPDK build.
 
-As a prerequisite, the vhost/vhost-net kernel CONFIG should be chosen before
-compiling the kernel and those kernel modules should be inserted.
+To run a simple test of virtio-user as exception path using testpmd:
 
-#.  Compile DPDK and bind a physical NIC to igb_uio/uio_pci_generic/vfio-pci.
+#.  Compile DPDK and bind a NIC to vfio-pci as documented in :ref:`linux_gsg_linux_drivers`.
 
-    This physical NIC is for communicating with outside.
+    This physical NIC is for communicating with the outside world,
+    and serves as a packet source in this example.
 
-#.  Run testpmd.
+#.  Run testpmd to forward packets from NIC to kernel,
+    passing in a suitable list of logical cores to run on  (``-l`` parameter),
+    and optionally the PCI address of the physical NIC to use (``-a`` parameter).
+    The virtio-user device for interfacing to the kernel is specified via a ``-vdev`` argument,
+    taking the parameters described below.
 
     .. code-block:: console
 
-        $(testpmd) -l 2-3 -n 4 \
-		--vdev=virtio_user0,path=/dev/vhost-net,queue_size=1024 \
-		-- -i --tx-offloads=0x0000002c --enable-lro \
-		--txd=1024 --rxd=1024
+        /path/to/dpdk-testpmd -l <cores> -a <pci BDF> \
+            --vdev=virtio_user0,path=/dev/vhost-net,queues=1,queue_size=1024
 
-    This command runs testpmd with two ports, one physical NIC to communicate
-    with outside, and one virtio-user to communicate with kernel.
+    * ``path``
 
-* ``--enable-lro``
+       The path to the kernel vhost-net device.
 
-    This is used to negotiate VIRTIO_NET_F_GUEST_TSO4 and
-    VIRTIO_NET_F_GUEST_TSO6 feature so that large packets from kernel can be
-    transmitted to DPDK application and further TSOed by physical NIC.
+    * ``queue_size``
 
-* ``queue_size``
+       256 by default. To avoid shortage of descriptors, we can increase it to 1024.
 
-    256 by default. To avoid shortage of descriptors, we can increase it to 1024.
+    * ``queues``
 
-* ``queues``
+       Number of virt-queues. Each queue will be served by a kthread.
 
-    Number of multi-queues. Each queue will be served by a kthread. For example:
+#. Once testpmd is running, a new network interface - called ``tap0`` by default -
+   will be present on the system.
+   This should be configured with an IP address and then enabled for use:
 
     .. code-block:: console
 
-        $(testpmd) -l 2-3 -n 4 \
-		--vdev=virtio_user0,path=/dev/vhost-net,queues=2,queue_size=1024 \
-		-- -i --tx-offloads=0x0000002c --enable-lro \
-		--txq=2 --rxq=2 --txd=1024 --rxd=1024
+        ip addr add 192.168.1.1/24 dev tap0
+        ip link set dev tap0 up
 
-#. Enable Rx checksum offloads in testpmd:
+#. To observe packet forwarding through the kernel,
+   a second testpmd instance can be run on the system,
+   taking packets from the kernel using an ``af_packet`` socket on the ``tap0`` interface.
 
-    .. code-block:: console
+   .. code-block:: console
 
-        (testpmd) port stop 0
-        (testpmd) port config 0 rx_offload tcp_cksum on
-        (testpmd) port config 0 rx_offload udp_cksum on
-        (testpmd) port start 0
+       /path/to/dpdk-testpmd -l <cores> --vdev=net_af_packet0,iface=tap0 --in-memory --no-pci
 
-#. Start testpmd:
+   When running this instance,
+   we can use ``--in-memory`` flag to avoid hugepage naming conflicts with the previous instance,
+   and we also use ``--no-pci`` flag to only use the ``af_packet`` interface for all traffic forwarding.
 
-    .. code-block:: console
+#. Running traffic into the system through the NIC should see that traffic returned back again,
+   having been forwarded through both testpmd instances.
+   This can be confirmed by checking the testpmd statistics on testpmd exit.
 
-        (testpmd) start
+For more advanced use of virtio-user with testpmd in this scenario,
+some other more advanced options may also be used.
+For example:
 
-#.  Configure IP address and start tap:
+* ``--tx-offloads=0x02c``
+
+    This testpmd option enables TX offloads for UDP and TCP checksum on transmit,
+    as well as TCP TSO support.
+    The list of the offload flag values can be seen in header `rte_ethdev.h
+    <https://doc.dpdk.org/api/rte__ethdev_8h.html>`_.
+
+* ``--enable-lro``
+
+    This testpmd option is used to negotiate VIRTIO_NET_F_GUEST_TSO4 and
+    VIRTIO_NET_F_GUEST_TSO6 feature so that large packets from the kernel can be
+    transmitted to the DPDK application and further TSOed by physical NIC.
+    If unsupported by the physical NIC, errors may be reported by testpmd with this option.
+
+
+* Enabling Rx checksum offloads for physical port:
+
+   Within testpmd, you can enable and disable offloads on a per-port basis,
+   rather than enabling them for both ports.
+   For the physical NIC, it may be desirable to enable checksum offload on packet RX.
+   This may be done as below, if testpmd is run with ``-i`` flag for interactive mode.
 
     .. code-block:: console
 
-        ifconfig tap0 1.1.1.1/24 up
+        testpmd> port stop 0
+        testpmd> port config 0 rx_offload tcp_cksum on
+        testpmd> port config 0 rx_offload udp_cksum on
+        testpmd> port start 0
 
-.. note::
+* Multiple queue support
 
-    The tap device will be named tap0, tap1, etc, by kernel.
+    Better performance may be achieved by using multiple queues,
+    so that multiple kernel threads are handling the traffic on the kernel side.
+    For example, to use 2 queues on both NIC and virtio ports,
+    while also enabling TX offloads and LRO support:
 
-Then, all traffic from physical NIC can be forwarded into kernel stack, and all
-traffic on the tap0 can be sent out from physical NIC.
+    .. code-block:: console
 
-Limitations
------------
+        /path/to/dpdk-testpmd --vdev=virtio_user0,path=/dev/vhost-net,queues=2,queue_size=1024 -- \
+            -i --tx-offloads=0x002c --enable-lro --txq=2 --rxq=2 --txd=1024 --rxd=1024
 
-This solution is only available on Linux systems.

--
2.34.1

Acked-by on v3 1/4
#11 lore raw

Hi Bruce,

Quoted 22 lines

-----Original Message-----
From: Richardson, Bruce <[email protected]>
Sent: Friday, June 10, 2022 11:36 PM
To: [email protected]
Cc: Maxime Coquelin <[email protected]>; Xia, Chenbo <[email protected]>; Richardson, Bruce <[email protected]>; [email protected]
Subject: [PATCH v3 1/4] doc/howto: rework section on virtio-user as exception path

This patch extensively reworks the howto guide on using virtio-user for exception packets. Changes include:

* rename "exceptional path" to "exception path"
* remove references to uio and just reference vfio-pci
* simplify testpmd command-lines, giving a basic usage example first before adding on detail about checksum or TSO parameters
* give a complete working example showing traffic flowing through the whole system from a testpmd loopback using the created TAP netdev
* replace use of "ifconfig" with Linux standard "ip" command
* other general rewording.

Quoted 1 line

Not sure you want to backport or not as there's no fixes tag.

For this patch:

Quoted 286 lines

---
V3:
* fix error reported by Chenbo on review.
* add stable on CC, since this rework could be applicable for older releases too, if desired for backport.

---
 .../howto/virtio_user_as_exceptional_path.rst | 159 +++++++++++-------
 1 file changed, 100 insertions(+), 59 deletions(-)
doc/guides/howto/virtio_user_as_exceptional_path.rst +2 -3
index ec021af399..3d3d1b1219 100644
@@ -3,116 +3,157 @@
 
 .. _virtio_user_as_exceptional_path:
 
-Virtio_user as Exceptional Path
-===============================
+Virtio_user as Exception Path
+=============================
 
-The virtual device, virtio-user, was originally introduced with vhost-

user
-backend, as a high performance solution for IPC (Inter-Process Communication)
+.. note::

doc/guides/howto/virtio_user_as_exceptional_path.rst +4 -0
+
+   This solution is only applicable to Linux systems.
+
+The virtual device, virtio-user, was originally introduced with the

vhost-user
+backend as a high performance solution for IPC (Inter-Process Communication)
and user space container networking.

doc/guides/howto/virtio_user_as_exceptional_path.rst +1 -3
-Virtio_user with vhost-kernel backend is a solution for exceptional path,
-such as KNI which exchanges packets with kernel networking stack. This
-solution is very promising in:
+Beyond this originally intended use, virtio-user can be used in

conjunction with the vhost-kernel
+backend as a solution for dealing with exception path packets which need to be injected into the

doc/guides/howto/virtio_user_as_exceptional_path.rst +2 -0
+Linux kernel for processing there.
+In this regard, virtio-user and vhost in kernel space are an alternative

to DPDK KNI for
+transferring packets between a DPDK packet processing application and the kernel stack.

doc/guides/howto/virtio_user_as_exceptional_path.rst +2 -0
+
+This solution has a number of advantages over alternatives such as KNI:
 
 *   Maintenance
 
     All kernel modules needed by this solution, vhost and vhost-net

(kernel),

doc/guides/howto/virtio_user_as_exceptional_path.rst +1 -2
-    are upstreamed and extensively used kernel module.
+    are upstreamed and extensively used.
 
 *   Features
 
-    vhost-net is born to be a networking solution, which has lots of

networking

doc/guides/howto/virtio_user_as_exceptional_path.rst +1 -1
-    related features, like multi queue, tso, multi-seg mbuf, etc.
+    vhost-net is designed to be a networking solution, and, as such, has

lots of networking
+ related features, such as multi queue support, TSO, multi-segment
buffer support, etc.

* Performance

doc/guides/howto/virtio_user_as_exceptional_path.rst +0 -2
-    similar to KNI, this solution would use one or more kthreads to
-    send/receive packets to/from user space DPDK applications, which has

little
- impact on user space polling thread (except that it might enter into
kernel

doc/guides/howto/virtio_user_as_exceptional_path.rst +2 -1
-    space to wake up those kthreads if necessary).
+    similar to KNI, this solution would uses one or more kthreads to
+    send/receive packets to/from user space DPDK applications, which

minimises the impact

doc/guides/howto/virtio_user_as_exceptional_path.rst +1 -1
+    on the polling DPDK threads.
 
-The overview of an application using virtio-user as exceptional path is

shown
+The overview of an application using virtio-user as exception path is shown
in :numref:figure_virtio_user_as_exceptional_path.

.. _figure_virtio_user_as_exceptional_path:

.. figure:: img/virtio_user_as_exceptional_path.*

doc/guides/howto/virtio_user_as_exceptional_path.rst +7 -3
-   Overview of a DPDK app using virtio-user as exceptional path
+   Overview of a DPDK app using virtio-user as exception path
+
 
+Example Usage With Testpmd
+---------------------------
 
-Sample Usage
-------------
+.. note::
+
+   These instruction assume that the vhost/vhost-net kernel modules are

available and have already

doc/guides/howto/virtio_user_as_exceptional_path.rst +2 -0
+   been loaded into the running kernel.
+   It also assumes that the DPDK virtio driver has not been disabled in

the DPDK build.

-As a prerequisite, the vhost/vhost-net kernel CONFIG should be chosen before

doc/guides/howto/virtio_user_as_exceptional_path.rst +1 -2
-compiling the kernel and those kernel modules should be inserted.
+To run a simple test of virtio-user as exception path using testpmd:
 
-#.  Compile DPDK and bind a physical NIC to igb_uio/uio_pci_generic/vfio-

pci.
+#. Compile DPDK and bind a NIC to vfio-pci as documented in :ref:linux_gsg_linux_drivers.

doc/guides/howto/virtio_user_as_exceptional_path.rst +4 -2
-    This physical NIC is for communicating with outside.
+    This physical NIC is for communicating with the outside world,
+    and serves as a packet source in this example.
 
-#.  Run testpmd.
+#.  Run testpmd to forward packets from NIC to kernel,
+    passing in a suitable list of logical cores to run on  (``-l``

parameter),
+ and optionally the PCI address of the physical NIC to use (``-a``
parameter).
+ The virtio-user device for interfacing to the kernel is specified via
a ``-vdev`` argument,

doc/guides/howto/virtio_user_as_exceptional_path.rst +3 -4
+    taking the parameters described below.
 
     .. code-block:: console
 
-        $(testpmd) -l 2-3 -n 4 \
-		--vdev=virtio_user0,path=/dev/vhost-net,queue_size=1024 \
-		-- -i --tx-offloads=0x0000002c --enable-lro \
-		--txd=1024 --rxd=1024
+        /path/to/dpdk-testpmd -l <cores> -a <pci BDF> \
+            --vdev=virtio_user0,path=/dev/vhost-

net,queues=1,queue_size=1024

- This command runs testpmd with two ports, one physical NIC to
communicate

doc/guides/howto/virtio_user_as_exceptional_path.rst +2 -4
-    with outside, and one virtio-user to communicate with kernel.
+    * ``path``
 
-* ``--enable-lro``
+       The path to the kernel vhost-net device.
 
-    This is used to negotiate VIRTIO_NET_F_GUEST_TSO4 and
-    VIRTIO_NET_F_GUEST_TSO6 feature so that large packets from kernel can

be

doc/guides/howto/virtio_user_as_exceptional_path.rst +2 -2
-    transmitted to DPDK application and further TSOed by physical NIC.
+    * ``queue_size``
 
-* ``queue_size``
+       256 by default. To avoid shortage of descriptors, we can increase

it to 1024.

- 256 by default. To avoid shortage of descriptors, we can increase it
to 1024.

doc/guides/howto/virtio_user_as_exceptional_path.rst +2 -2
+    * ``queues``
 
-* ``queues``
+       Number of virt-queues. Each queue will be served by a kthread.
 
-    Number of multi-queues. Each queue will be served by a kthread. For

example:
+#. Once testpmd is running, a new network interface - called ``tap0`` by default -

doc/guides/howto/virtio_user_as_exceptional_path.rst +2 -2
+   will be present on the system.
+   This should be configured with an IP address and then enabled for use:
 
     .. code-block:: console
 
-        $(testpmd) -l 2-3 -n 4 \
-		--vdev=virtio_user0,path=/dev/vhost-

net,queues=2,queue_size=1024 \

doc/guides/howto/virtio_user_as_exceptional_path.rst +5 -3
-		-- -i --tx-offloads=0x0000002c --enable-lro \
-		--txq=2 --rxq=2 --txd=1024 --rxd=1024
+        ip addr add 192.168.1.1/24 dev tap0
+        ip link set dev tap0 up
 
-#. Enable Rx checksum offloads in testpmd:
+#. To observe packet forwarding through the kernel,
+   a second testpmd instance can be run on the system,
+   taking packets from the kernel using an ``af_packet`` socket on the

``tap0`` interface.

doc/guides/howto/virtio_user_as_exceptional_path.rst +4 -7
-    .. code-block:: console
+   .. code-block:: console
 
-        (testpmd) port stop 0
-        (testpmd) port config 0 rx_offload tcp_cksum on
-        (testpmd) port config 0 rx_offload udp_cksum on
-        (testpmd) port start 0
+       /path/to/dpdk-testpmd -l <cores> --vdev=net_af_packet0,iface=tap0
--in-memory --no-pci
 
-#. Start testpmd:
+   When running this instance,
+   we can use ``--in-memory`` flag to avoid hugepage naming conflicts

with the previous instance,
+ and we also use ``--no-pci`` flag to only use the ``af_packet``
interface for all traffic forwarding.

doc/guides/howto/virtio_user_as_exceptional_path.rst +1 -1
-    .. code-block:: console
+#. Running traffic into the system through the NIC should see that

traffic returned back again,

doc/guides/howto/virtio_user_as_exceptional_path.rst +2 -0
+   having been forwarded through both testpmd instances.
+   This can be confirmed by checking the testpmd statistics on testpmd

exit.

doc/guides/howto/virtio_user_as_exceptional_path.rst +6 -2
-        (testpmd) start
+For more advanced use of virtio-user with testpmd in this scenario,
+some other more advanced options may also be used.
+For example:
 
-#.  Configure IP address and start tap:
+* ``--tx-offloads=0x02c``
+
+    This testpmd option enables TX offloads for UDP and TCP checksum on

transmit,

doc/guides/howto/virtio_user_as_exceptional_path.rst +2 -0
+    as well as TCP TSO support.
+    The list of the offload flag values can be seen in header

`rte_ethdev.h

doc/guides/howto/virtio_user_as_exceptional_path.rst +6 -0
+    <https://doc.dpdk.org/api/rte__ethdev_8h.html>`_.
+
+* ``--enable-lro``
+
+    This testpmd option is used to negotiate VIRTIO_NET_F_GUEST_TSO4 and
+    VIRTIO_NET_F_GUEST_TSO6 feature so that large packets from the kernel

can be

doc/guides/howto/virtio_user_as_exceptional_path.rst +2 -0
+    transmitted to the DPDK application and further TSOed by physical NIC.
+    If unsupported by the physical NIC, errors may be reported by testpmd

with this option.

doc/guides/howto/virtio_user_as_exceptional_path.rst +5 -0
+
+
+* Enabling Rx checksum offloads for physical port:
+
+   Within testpmd, you can enable and disable offloads on a per-port

basis,

doc/guides/howto/virtio_user_as_exceptional_path.rst +2 -0
+   rather than enabling them for both ports.
+   For the physical NIC, it may be desirable to enable checksum offload

on packet RX.
+ This may be done as below, if testpmd is run with ``-i`` flag for
interactive mode.

.. code-block:: console

doc/guides/howto/virtio_user_as_exceptional_path.rst +7 -3
-        ifconfig tap0 1.1.1.1/24 up
+        testpmd> port stop 0
+        testpmd> port config 0 rx_offload tcp_cksum on
+        testpmd> port config 0 rx_offload udp_cksum on
+        testpmd> port start 0
 
-.. note::
+* Multiple queue support
 
-    The tap device will be named tap0, tap1, etc, by kernel.
+    Better performance may be achieved by using multiple queues,
+    so that multiple kernel threads are handling the traffic on the

kernel side.

doc/guides/howto/virtio_user_as_exceptional_path.rst +2 -1
+    For example, to use 2 queues on both NIC and virtio ports,
+    while also enabling TX offloads and LRO support:
 
-Then, all traffic from physical NIC can be forwarded into kernel stack,

and all

doc/guides/howto/virtio_user_as_exceptional_path.rst +2 -3
-traffic on the tap0 can be sent out from physical NIC.
+    .. code-block:: console
 
-Limitations
------------
+        /path/to/dpdk-testpmd --vdev=virtio_user0,path=/dev/vhost-

net,queues=2,queue_size=1024 -- \
+ -i --tx-offloads=0x002c --enable-lro --txq=2 --rxq=2 --
txd=1024 --rxd=1024

-This solution is only available on Linux systems. --
2.34.1

Reviewed-by on v3 1/4
#12 lore raw
In reply to Bruce Richardson
Quoted 16 lines · Bruce Richardson

This patch extensively reworks the howto guide on using virtio-user for exception packets. Changes include:

* rename "exceptional path" to "exception path"
* remove references to uio and just reference vfio-pci
* simplify testpmd command-lines, giving a basic usage example first before adding on detail about checksum or TSO parameters
* give a complete working example showing traffic flowing through the whole system from a testpmd loopback using the created TAP netdev
* replace use of "ifconfig" with Linux standard "ip" command
* other general rewording.

Quoted 9 lines

---
V3:
* fix error reported by Chenbo on review.
* add stable on CC, since this rework could be applicable for older releases too, if desired for backport.

---
  .../howto/virtio_user_as_exceptional_path.rst | 159 +++++++++++-------
  1 file changed, 100 insertions(+), 59 deletions(-)

Thanks,
Maxime

#13 lore raw
In reply to Bruce Richardson

10/06/2022 17:35, Bruce Richardson:

Quoted 12 lines

This patch extensively reworks the howto guide on using virtio-user for exception packets. Changes include:

* rename "exceptional path" to "exception path"
* remove references to uio and just reference vfio-pci
* simplify testpmd command-lines, giving a basic usage example first before adding on detail about checksum or TSO parameters
* give a complete working example showing traffic flowing through the whole system from a testpmd loopback using the created TAP netdev
* replace use of "ifconfig" with Linux standard "ip" command
* other general rewording.

Quoted 1 line

I don't think we should keep this for backport.
This is an enhancement.
Anyway new developments are probably not looking in old branches.

#14 lore raw
Quoted 13 lines · Thomas Monjalon

10/06/2022 17:35, Bruce Richardson:

Quoted 12 lines

This patch extensively reworks the howto guide on using virtio-user for exception packets. Changes include:

* rename "exceptional path" to "exception path"
* remove references to uio and just reference vfio-pci
* simplify testpmd command-lines, giving a basic usage example first before adding on detail about checksum or TSO parameters
* give a complete working example showing traffic flowing through the whole system from a testpmd loopback using the created TAP netdev
* replace use of "ifconfig" with Linux standard "ip" command
* other general rewording.

Quoted 6 lines
Quoted 1 line

I don't think we should keep this for backport.
This is an enhancement.
Anyway new developments are probably not looking in old branches.

Sure, that's fine with me.

#15 lore raw

PATCH v3 2/4 doc/howto: rename files to match new content name

In reply to Bruce Richardson

Since the section in the "howto" has been renamed from "exceptional path" to "exception path", we can rename the relevant files to match this new name too.

---
 ...ptional_path.svg => virtio_user_as_exception_path.svg} | 0
 doc/guides/howto/index.rst                                | 2 +-
 ...ptional_path.rst => virtio_user_as_exception_path.rst} | 8 ++++----
 3 files changed, 5 insertions(+), 5 deletions(-)
 rename doc/guides/howto/img/{virtio_user_as_exceptional_path.svg => virtio_user_as_exception_path.svg} (100%)
 rename doc/guides/howto/{virtio_user_as_exceptional_path.rst => virtio_user_as_exception_path.rst} (96%)
doc/guides/howto/img/virtio_user_as_exception_path.svg renamed from doc/guides/howto/img/virtio_user_as_exceptional_path.svg +0 -0
similarity index 100%
rename from doc/guides/howto/img/virtio_user_as_exceptional_path.svg
rename to doc/guides/howto/img/virtio_user_as_exception_path.svg
doc/guides/howto/index.rst +1 -1
index c2a2c60ddb..bf6337d021 100644
@@ -15,7 +15,7 @@ HowTo Guides
     pvp_reference_benchmark
     vfd
     virtio_user_for_container_networking
-    virtio_user_as_exceptional_path
+    virtio_user_as_exception_path
     packet_capture_framework
     telemetry
     debug_troubleshoot
doc/guides/howto/virtio_user_as_exception_path.rst renamed from doc/guides/howto/virtio_user_as_exceptional_path.rst +4 -4
similarity index 96%
rename from doc/guides/howto/virtio_user_as_exceptional_path.rst
rename to doc/guides/howto/virtio_user_as_exception_path.rst
index 3d3d1b1219..a7f0d366fe 100644
@@ -1,7 +1,7 @@
 ..  SPDX-License-Identifier: BSD-3-Clause
     Copyright(c) 2016 Intel Corporation.
 
-.. _virtio_user_as_exceptional_path:
+.. _virtio_user_as_exception_path:
 
 Virtio_user as Exception Path
 =============================
@@ -39,11 +39,11 @@ This solution has a number of advantages over alternatives such as KNI:
     on the polling DPDK threads.
 
 The overview of an application using virtio-user as exception path is shown
-in :numref:`figure_virtio_user_as_exceptional_path`.
+in :numref:`figure_virtio_user_as_exception_path`.
 
-.. _figure_virtio_user_as_exceptional_path:
+.. _figure_virtio_user_as_exception_path:
 
-.. figure:: img/virtio_user_as_exceptional_path.*
+.. figure:: img/virtio_user_as_exception_path.*
 
    Overview of a DPDK app using virtio-user as exception path
 
Signature · 1 line
2.34.1
Acked-by on v3 2/4
#16 lore raw

RE: [PATCH v3 2/4] doc/howto: rename files to match new content name

Quoted 76 lines

-----Original Message-----
From: Richardson, Bruce <[email protected]>
Sent: Friday, June 10, 2022 11:36 PM
To: [email protected]
Cc: Maxime Coquelin <[email protected]>; Xia, Chenbo <[email protected]>; Richardson, Bruce <[email protected]>
Subject: [PATCH v3 2/4] doc/howto: rename files to match new content name

Since the section in the "howto" has been renamed from "exceptional path" to "exception path", we can rename the relevant files to match this new name too.

---
 ...ptional_path.svg => virtio_user_as_exception_path.svg} | 0
 doc/guides/howto/index.rst                                | 2 +-
 ...ptional_path.rst => virtio_user_as_exception_path.rst} | 8 ++++----
 3 files changed, 5 insertions(+), 5 deletions(-)
 rename doc/guides/howto/img/{virtio_user_as_exceptional_path.svg =>
virtio_user_as_exception_path.svg} (100%)
 rename doc/guides/howto/{virtio_user_as_exceptional_path.rst =>

virtio_user_as_exception_path.rst} (96%)

doc/guides/howto/img/virtio_user_as_exception_path.svg renamed from doc/guides/howto/img/virtio_user_as_exceptional_path.svg +0 -0
similarity index 100%
rename from doc/guides/howto/img/virtio_user_as_exceptional_path.svg
rename to doc/guides/howto/img/virtio_user_as_exception_path.svg
doc/guides/howto/index.rst +1 -1
index c2a2c60ddb..bf6337d021 100644
@@ -15,7 +15,7 @@ HowTo Guides
     pvp_reference_benchmark
     vfd
     virtio_user_for_container_networking
-    virtio_user_as_exceptional_path
+    virtio_user_as_exception_path
     packet_capture_framework
     telemetry
     debug_troubleshoot
doc/guides/howto/virtio_user_as_exception_path.rst renamed from doc/guides/howto/virtio_user_as_exceptional_path.rst +1 -1
similarity index 96%
rename from doc/guides/howto/virtio_user_as_exceptional_path.rst
rename to doc/guides/howto/virtio_user_as_exception_path.rst
index 3d3d1b1219..a7f0d366fe 100644
@@ -1,7 +1,7 @@
 ..  SPDX-License-Identifier: BSD-3-Clause
     Copyright(c) 2016 Intel Corporation.
 
-.. _virtio_user_as_exceptional_path:
+.. _virtio_user_as_exception_path:
 
 Virtio_user as Exception Path
 =============================
@@ -39,11 +39,11 @@ This solution has a number of advantages over

alternatives such as KNI:
on the polling DPDK threads.

The overview of an application using virtio-user as exception path is
shown

doc/guides/howto/virtio_user_as_exception_path.rst renamed from doc/guides/howto/virtio_user_as_exceptional_path.rst +3 -4
-in :numref:`figure_virtio_user_as_exceptional_path`.
+in :numref:`figure_virtio_user_as_exception_path`.
 
-.. _figure_virtio_user_as_exceptional_path:
+.. _figure_virtio_user_as_exception_path:
 
-.. figure:: img/virtio_user_as_exceptional_path.*
+.. figure:: img/virtio_user_as_exception_path.*
 
    Overview of a DPDK app using virtio-user as exception path
 
--
Quoted 1 line

2.34.1

Reviewed-by on v3 2/4
#17 lore raw

Re: [PATCH v3 2/4] doc/howto: rename files to match new content name

In reply to Bruce Richardson
Quoted 4 lines · Bruce Richardson

Since the section in the "howto" has been renamed from "exceptional path" to "exception path", we can rename the relevant files to match this new name too.

Quoted 9 lines
---
  ...ptional_path.svg => virtio_user_as_exception_path.svg} | 0
  doc/guides/howto/index.rst                                | 2 +-
  ...ptional_path.rst => virtio_user_as_exception_path.rst} | 8 ++++----
  3 files changed, 5 insertions(+), 5 deletions(-)

rename doc/guides/howto/img/{virtio_user_as_exceptional_path.svg => virtio_user_as_exception_path.svg} (100%) rename doc/guides/howto/{virtio_user_as_exceptional_path.rst => virtio_user_as_exception_path.rst} (96%)

Thanks,
Maxime

#18 lore raw

PATCH v3 3/4 doc/howto: add code example to virtio-user exception path doc

In reply to Bruce Richardson

The HOWTO guide for using virtio-user as an exception path to the kernel only provided an example of how testpmd may be used for that purpose. However, a real application wanting to use virtio-user as exception path would likely want to create such devices from code within the app itself. Therefore, we update the doc with instructions and a code snippet showing how this may be done.

---
 .../howto/virtio_user_as_exception_path.rst   | 55 +++++++++++++++++++
 1 file changed, 55 insertions(+)
doc/guides/howto/virtio_user_as_exception_path.rst +55 -0
index a7f0d366fe..2af1778578 100644
@@ -157,3 +157,58 @@ For example:
         /path/to/dpdk-testpmd --vdev=virtio_user0,path=/dev/vhost-net,queues=2,queue_size=1024 -- \
             -i --tx-offloads=0x002c --enable-lro --txq=2 --rxq=2 --txd=1024 --rxd=1024
 
+
+Creating Virtio-User Ports within an Application
+------------------------------------------------
+
+To use virtio-user ports within an application,
+it is not necessary to explicitly initialize those ports using EAL arguments at startup.
+Instead, one can use the generic EAL API
+`rte_eal_hotplug_add <https://doc.dpdk.org/api/rte__dev_8h.html#ad32e8eebf1f81ef9f290cb296b0c90bb>`_
+function to create a new instance at startup.
+For example, to create a basic virtio-user port, the following code could be used:
+
+.. code-block:: C
+
+   rte_eal_hotplug_add("vdev", "virtio_user0", "path=/dev/vhost-net");
+
+A fuller code example is shown below, where a virtio-user port, and hence kernel netdev,
+is created for each NIC port discovered by DPDK.
+Each virtio-user port is given the MAC address of its matching physical port
+(assuming app was run without vdev args on commandline, so all ports auto-discovered are HW ones).
+These new virtio-user netdevs will appear in the kernel port listings as ``virtio_user0``,
+``virtio_user1``, etc.,
+based on the names passed in as ``iface=`` via the ``portargs`` parameter.
+
+.. code-block:: C
+
+    nb_ports = rte_eth_dev_count_avail();
+
+    /* Create a vhost_user port for each physical port */
+    unsigned port_count = 0;
+    RTE_ETH_FOREACH_DEV(portid) {
+        char portname[32];
+        char portargs[256];
+        struct rte_ether_addr addr = {0};
+
+        /* don't create virtio_user ports for other virtio_user ports */
+        if (++port_count > nb_ports)
+            break;
+
+        /* get mac address of physical port to use as mac of virtio_user port */
+        rte_eth_macaddr_get(portid, &addr);
+
+        /* set the name and arguments */
+        snprintf(portname, sizeof(portname), "virtio_user%u", portid);
+        snprintf(portargs, sizeof(portargs),
+                "path=/dev/vhost-net,queues=1,queue_size=%u,iface=%s,mac=" RTE_ETHER_ADDR_PRT_FMT,
+                RX_RING_SIZE, portname, RTE_ETHER_ADDR_BYTES(&addr));
+
+        /* add the vdev for virtio_user */
+        if (rte_eal_hotplug_add("vdev", portname, portargs) < 0)
+            rte_exit(EXIT_FAILURE, "Cannot create paired port for port %u\n", portid);
+
+    }
+
+Once these virtio-user ports have been created in the loop, all ports, both physical and virtual,
+may be initialized and used as normal in the application.

--
2.34.1

Acked-by on v3 3/4
#19 lore raw

RE: [PATCH v3 3/4] doc/howto: add code example to virtio-user exception path doc

Quoted 99 lines

-----Original Message-----
From: Richardson, Bruce <[email protected]>
Sent: Friday, June 10, 2022 11:36 PM
To: [email protected]
Cc: Maxime Coquelin <[email protected]>; Xia, Chenbo <[email protected]>; Richardson, Bruce <[email protected]>; Stephen Hemminger <[email protected]>
Subject: [PATCH v3 3/4] doc/howto: add code example to virtio-user exception path doc

The HOWTO guide for using virtio-user as an exception path to the kernel only provided an example of how testpmd may be used for that purpose. However, a real application wanting to use virtio-user as exception path would likely want to create such devices from code within the app itself. Therefore, we update the doc with instructions and a code snippet showing how this may be done.

---
 .../howto/virtio_user_as_exception_path.rst   | 55 +++++++++++++++++++
 1 file changed, 55 insertions(+)
doc/guides/howto/virtio_user_as_exception_path.rst +0 -0
index a7f0d366fe..2af1778578 100644
@@ -157,3 +157,58 @@ For example:
         /path/to/dpdk-testpmd --vdev=virtio_user0,path=/dev/vhost-
 net,queues=2,queue_size=1024 -- \
             -i --tx-offloads=0x002c --enable-lro --txq=2 --rxq=2 --

txd=1024 --rxd=1024

doc/guides/howto/virtio_user_as_exception_path.rst +6 -0
+
+Creating Virtio-User Ports within an Application
+------------------------------------------------
+
+To use virtio-user ports within an application,
+it is not necessary to explicitly initialize those ports using EAL

arguments at startup.
+Instead, one can use the generic EAL API
+`rte_eal_hotplug_add
<https://doc.dpdk.org/api/rte__dev_8h.html#ad32e8eebf1f81ef9f290cb296b0c90
bb>`_

doc/guides/howto/virtio_user_as_exception_path.rst +2 -0
+function to create a new instance at startup.
+For example, to create a basic virtio-user port, the following code could

be used:

doc/guides/howto/virtio_user_as_exception_path.rst +6 -0
+
+.. code-block:: C
+
+   rte_eal_hotplug_add("vdev", "virtio_user0", "path=/dev/vhost-net");
+
+A fuller code example is shown below, where a virtio-user port, and hence

kernel netdev,

doc/guides/howto/virtio_user_as_exception_path.rst +2 -0
+is created for each NIC port discovered by DPDK.
+Each virtio-user port is given the MAC address of its matching physical

port
+(assuming app was run without vdev args on commandline, so all ports auto-discovered are HW ones).
+These new virtio-user netdevs will appear in the kernel port listings as ``virtio_user0``,
+``virtio_user1``, etc.,

doc/guides/howto/virtio_user_as_exception_path.rst +18 -0
+based on the names passed in as ``iface=`` via the ``portargs`` parameter.
+
+.. code-block:: C
+
+    nb_ports = rte_eth_dev_count_avail();
+
+    /* Create a vhost_user port for each physical port */
+    unsigned port_count = 0;
+    RTE_ETH_FOREACH_DEV(portid) {
+        char portname[32];
+        char portargs[256];
+        struct rte_ether_addr addr = {0};
+
+        /* don't create virtio_user ports for other virtio_user ports */
+        if (++port_count > nb_ports)
+            break;
+
+        /* get mac address of physical port to use as mac of virtio_user

port */

doc/guides/howto/virtio_user_as_exception_path.rst +6 -0
+        rte_eth_macaddr_get(portid, &addr);
+
+        /* set the name and arguments */
+        snprintf(portname, sizeof(portname), "virtio_user%u", portid);
+        snprintf(portargs, sizeof(portargs),
+                "path=/dev/vhost-

net,queues=1,queue_size=%u,iface=%s,mac=" RTE_ETHER_ADDR_PRT_FMT,

doc/guides/howto/virtio_user_as_exception_path.rst +5 -0
+                RX_RING_SIZE, portname, RTE_ETHER_ADDR_BYTES(&addr));
+
+        /* add the vdev for virtio_user */
+        if (rte_eal_hotplug_add("vdev", portname, portargs) < 0)
+            rte_exit(EXIT_FAILURE, "Cannot create paired port for

port %u\n", portid);

doc/guides/howto/virtio_user_as_exception_path.rst +4 -0
+
+    }
+
+Once these virtio-user ports have been created in the loop, all ports,
Quoted 4 lines

both physical and virtual,
+may be initialized and used as normal in the application. --
2.34.1

Reviewed-by on v3 3/4
#20 lore raw

Re: [PATCH v3 3/4] doc/howto: add code example to virtio-user exception path doc

In reply to Bruce Richardson
Quoted 7 lines · Bruce Richardson

The HOWTO guide for using virtio-user as an exception path to the kernel only provided an example of how testpmd may be used for that purpose. However, a real application wanting to use virtio-user as exception path would likely want to create such devices from code within the app itself. Therefore, we update the doc with instructions and a code snippet showing how this may be done.

Quoted 6 lines
---
  .../howto/virtio_user_as_exception_path.rst   | 55 +++++++++++++++++++
  1 file changed, 55 insertions(+)

Nice addition!

Thanks,
Maxime

#21 lore raw

PATCH v3 4/4 doc/prog_guide: add reference to virtio-user from KNI doc

In reply to Bruce Richardson

To help encourage use of virtio-user in place of KNI, put a reference to the relevant howto section at the top of the KNI doc.

---
 doc/guides/prog_guide/kernel_nic_interface.rst | 6 ++++++
 1 file changed, 6 insertions(+)
doc/guides/prog_guide/kernel_nic_interface.rst +6 -0
index 5248f9622b..e021cc69b6 100644
@@ -6,6 +6,12 @@
 Kernel NIC Interface
 ====================
 
+.. note::
+
+   For an alternative to KNI, that does not require any out-of-tree Linux kernel modules,
+   or a custom library, see :ref:`virtio_user_as_exception_path`.
+
+
 The DPDK Kernel NIC Interface (KNI) allows userspace applications access to the Linux* control plane.
 
 The benefits of using the DPDK KNI are:
Signature · 1 line
2.34.1
Acked-by on v3 4/4
#22 lore raw

RE: [PATCH v3 4/4] doc/prog_guide: add reference to virtio-user from KNI doc

Quoted 36 lines

-----Original Message-----
From: Richardson, Bruce <[email protected]>
Sent: Friday, June 10, 2022 11:36 PM
To: [email protected]
Cc: Maxime Coquelin <[email protected]>; Xia, Chenbo <[email protected]>; Richardson, Bruce <[email protected]>
Subject: [PATCH v3 4/4] doc/prog_guide: add reference to virtio-user from KNI doc

To help encourage use of virtio-user in place of KNI, put a reference to the relevant howto section at the top of the KNI doc.

---
 doc/guides/prog_guide/kernel_nic_interface.rst | 6 ++++++
 1 file changed, 6 insertions(+)
doc/guides/prog_guide/kernel_nic_interface.rst +6 -0
index 5248f9622b..e021cc69b6 100644
@@ -6,6 +6,12 @@
 Kernel NIC Interface
 ====================
 
+.. note::
+
+   For an alternative to KNI, that does not require any out-of-tree Linux
 kernel modules,
+   or a custom library, see :ref:`virtio_user_as_exception_path`.
+
+
 The DPDK Kernel NIC Interface (KNI) allows userspace applications access

to the Linux* control plane.

Quoted 3 lines

The benefits of using the DPDK KNI are:
--
2.34.1

Reviewed-by on v3 4/4
#23 lore raw

Re: [PATCH v3 4/4] doc/prog_guide: add reference to virtio-user from KNI doc

In reply to Bruce Richardson
Quoted 15 lines · Bruce Richardson

To help encourage use of virtio-user in place of KNI, put a reference to the relevant howto section at the top of the KNI doc.

---
  doc/guides/prog_guide/kernel_nic_interface.rst | 6 ++++++
  1 file changed, 6 insertions(+)
doc/guides/prog_guide/kernel_nic_interface.rst +0 -0
index 5248f9622b..e021cc69b6 100644
@@ -6,6 +6,12 @@
  Kernel NIC Interface
  ====================

doc/guides/prog_guide/kernel_nic_interface.rst line 17

Quoted 10 lines
doc/guides/prog_guide/kernel_nic_interface.rst +6 -0
 
+.. note::
+
+   For an alternative to KNI, that does not require any out-of-tree Linux kernel modules,
+   or a custom library, see :ref:`virtio_user_as_exception_path`.
+
+
  The DPDK Kernel NIC Interface (KNI) allows userspace applications access to the Linux* control plane.
 
  The benefits of using the DPDK KNI are:

Thanks,
Maxime

#24 lore raw

RE: [PATCH v3 0/4] Enhance docs on virtio-user as KNI replacement

In reply to Bruce Richardson
Quoted 31 lines

From: Bruce Richardson [mailto:[email protected]]
Sent: Friday, 10 June 2022 17.36

Since use of KNI is no longer advised (due to known issues and the fact it's an out-of-tree module), virtio-user is recommended for new developments. To help encourage this, we improve the doc HOWTO section on using virtio-user and add a link to that document from the main KNI section in the programmers guide.

v3:
* Added two extra patches:
- rename document files to match new section name
- add note to KNI programmers guide section
* minor updates to patch 2, and added stable on CC for that patch

Bruce Richardson (4):
doc/howto: rework section on virtio-user as exception path doc/howto: rename files to match new content name doc/howto: add code example to virtio-user exception path doc doc/prog_guide: add reference to virtio-user from KNI doc

 ....svg => virtio_user_as_exception_path.svg} |   0
 doc/guides/howto/index.rst                    |   2 +-
 .../howto/virtio_user_as_exception_path.rst   | 214 ++++++++++++++++++
 .../howto/virtio_user_as_exceptional_path.rst | 118 ----------
 .../prog_guide/kernel_nic_interface.rst       |   6 +
 5 files changed, 221 insertions(+), 119 deletions(-)
 rename doc/guides/howto/img/{virtio_user_as_exceptional_path.svg =>
virtio_user_as_exception_path.svg} (100%)
 create mode 100644 doc/guides/howto/virtio_user_as_exception_path.rst
 delete mode 100644
Quoted 5 lines

doc/guides/howto/virtio_user_as_exceptional_path.rst

--
2.34.1

Yes.

#25 lore raw

Re: [PATCH v3 0/4] Enhance docs on virtio-user as KNI replacement

In reply to Bruce Richardson
Quoted 24 lines · Bruce Richardson

Since use of KNI is no longer advised (due to known issues and the fact it's an out-of-tree module), virtio-user is recommended for new developments. To help encourage this, we improve the doc HOWTO section on using virtio-user and add a link to that document from the main KNI section in the programmers guide.

v3:
* Added two extra patches:
- rename document files to match new section name
- add note to KNI programmers guide section
* minor updates to patch 2, and added stable on CC for that patch

Bruce Richardson (4):
doc/howto: rework section on virtio-user as exception path doc/howto: rename files to match new content name doc/howto: add code example to virtio-user exception path doc doc/prog_guide: add reference to virtio-user from KNI doc

  ....svg => virtio_user_as_exception_path.svg} |   0
  doc/guides/howto/index.rst                    |   2 +-
  .../howto/virtio_user_as_exception_path.rst   | 214 ++++++++++++++++++
  .../howto/virtio_user_as_exceptional_path.rst | 118 ----------
  .../prog_guide/kernel_nic_interface.rst       |   6 +
  5 files changed, 221 insertions(+), 119 deletions(-)
Quoted 7 lines

rename doc/guides/howto/img/{virtio_user_as_exceptional_path.svg => virtio_user_as_exception_path.svg} (100%) create mode 100644 doc/guides/howto/virtio_user_as_exception_path.rst
delete mode 100644 doc/guides/howto/virtio_user_as_exceptional_path.rst

--
2.34.1

Applied to dpdk-next-virtio/main.

Thanks,
Maxime