15630257fSFerruh Yigit.. SPDX-License-Identifier: BSD-3-Clause 25630257fSFerruh Yigit Copyright(c) 2016 Intel Corporation. 37123fa5aSJingjing Wu 47123fa5aSJingjing WuFlow Bifurcation How-to Guide 57123fa5aSJingjing Wu============================= 67123fa5aSJingjing Wu 77123fa5aSJingjing WuFlow Bifurcation is a mechanism which uses hardware capable Ethernet devices 87123fa5aSJingjing Wuto split traffic between Linux user space and kernel space. Since it is a 97123fa5aSJingjing Wuhardware assisted feature this approach can provide line rate processing 10f78c100bSStephen Hemmingercapability. There is no need to take care of the packet 117123fa5aSJingjing Wumovement during the traffic split. This can yield better performance with 127123fa5aSJingjing Wuless CPU overhead. 137123fa5aSJingjing Wu 147123fa5aSJingjing WuThe Flow Bifurcation splits the incoming data traffic to user space 157123fa5aSJingjing Wuapplications (such as DPDK applications) and/or kernel space programs (such as 167123fa5aSJingjing Wuthe Linux kernel stack). It can direct some traffic, for example data plane 177123fa5aSJingjing Wutraffic, to DPDK, while directing some other traffic, for example control 187123fa5aSJingjing Wuplane traffic, to the traditional Linux networking stack. 197123fa5aSJingjing Wu 207123fa5aSJingjing WuThere are a number of technical options to achieve this. A typical example is 217123fa5aSJingjing Wuto combine the technology of SR-IOV and packet classification filtering. 227123fa5aSJingjing Wu 237123fa5aSJingjing WuSR-IOV is a PCI standard that allows the same physical adapter to be split as 247123fa5aSJingjing Wumultiple virtual functions. Each virtual function (VF) has separated queues 257123fa5aSJingjing Wuwith physical functions (PF). The network adapter will direct traffic to a 267123fa5aSJingjing Wuvirtual function with a matching destination MAC address. In a sense, SR-IOV 277123fa5aSJingjing Wuhas the capability for queue division. 287123fa5aSJingjing Wu 297123fa5aSJingjing WuPacket classification filtering is a hardware capability available on most 307123fa5aSJingjing Wunetwork adapters. Filters can be configured to direct specific flows to a 317123fa5aSJingjing Wugiven receive queue by hardware. Different NICs may have different filter 327123fa5aSJingjing Wutypes to direct flows to a Virtual Function or a queue that belong to it. 337123fa5aSJingjing Wu 347123fa5aSJingjing WuIn this way the Linux networking stack can receive specific traffic through 357123fa5aSJingjing Wuthe kernel driver while a DPDK application can receive specific traffic 367123fa5aSJingjing Wubypassing the Linux kernel by using drivers like VFIO or the DPDK ``igb_uio`` 377123fa5aSJingjing Wumodule. 387123fa5aSJingjing Wu 397123fa5aSJingjing Wu.. _figure_flow_bifurcation_overview: 407123fa5aSJingjing Wu 417123fa5aSJingjing Wu.. figure:: img/flow_bifurcation_overview.* 427123fa5aSJingjing Wu 437123fa5aSJingjing Wu Flow Bifurcation Overview 447123fa5aSJingjing Wu 457123fa5aSJingjing Wu 460f91f952SThomas MonjalonUsing Flow Bifurcation on NVIDIA ConnectX 470f91f952SThomas Monjalon----------------------------------------- 4820789d4dSThomas Monjalon 490f91f952SThomas MonjalonThe NVIDIA devices are :ref:`natively bifurcated <bifurcated_driver>`, 5020789d4dSThomas Monjalonso there is no need to split into SR-IOV PF/VF 5120789d4dSThomas Monjalonin order to get the flow bifurcation mechanism. 5220789d4dSThomas MonjalonThe full device is already shared with the kernel driver. 5320789d4dSThomas Monjalon 5420789d4dSThomas MonjalonThe DPDK application can setup some flow steering rules, 5520789d4dSThomas Monjalonand let the rest go to the kernel stack. 5620789d4dSThomas MonjalonIn order to define the filters strictly with flow rules, 5704cf171cSThomas Monjalonthe :ref:`flow_isolated_mode` must be configured, 5804cf171cSThomas Monjalonso there is no default rule routing traffic to userspace. 5920789d4dSThomas Monjalon 6020789d4dSThomas MonjalonThere is no specific instructions to follow. 61*41dd9a6bSDavid YoungThe recommended reading is the :doc:`../prog_guide/ethdev/flow_offload` guide. 6220789d4dSThomas MonjalonBelow is an example of testpmd commands 6320789d4dSThomas Monjalonfor receiving VXLAN 42 in 4 queues of the DPDK port 0, 6420789d4dSThomas Monjalonwhile all other packets go to the kernel: 6520789d4dSThomas Monjalon 6620789d4dSThomas Monjalon.. code-block:: console 6720789d4dSThomas Monjalon 6820789d4dSThomas Monjalon testpmd> flow isolate 0 true 6920789d4dSThomas Monjalon testpmd> flow create 0 ingress pattern eth / ipv4 / udp / vxlan vni is 42 / end \ 7020789d4dSThomas Monjalon actions rss queues 0 1 2 3 end / end 71