DOCA Bifurcated Driver Model Reference Application
This page provides an example of a Bifurcated Driver Model implementation using a multi-port eSwitch on top of the NVIDIA® BlueField® DPU.
The Bifurcated Driver Model leverages hardware capabilities to split incoming network traffic based on flow type. This application specifically uses the DOCA Flow library to demonstrate efficient traffic forwarding between Physical Ports (wire) and Linux Ports (kernel).
Port 0 ↔ Port 1 (Data Plane): High-volume traffic matching defined DOCA Flow rules are forwarded directly between Physical Port 0 and Physical Port 1. This bypasses the kernel network stack, remaining in the data plane for fast processing.
Port[0-1]↔ Kernel Pipeline (Control Plane): External traffic coming from Physical Port 0 or Physical Port 1 that is not TCP/UDP (e.g., ARP, ICMPv6, or specific control protocols) is missed and steered to the Linux Driver.
Kernel Port ↔ Kernel Port (Messaging): Internal Messaging traffic from the Linux Port is matched and steered to the Linux Representor Port, utilizing RSS for efficient kernel-space application processing.
The Bifurcated Driver Model Reference Application consists of core logic that manages the DOCA Flow pipes and entries to implement traffic bifurcation.
Initialization: The application initializes DPDK and DOCA Flow resources, including ports and queues.
DOCA Flow Switch Configuration: setting DOCA Flow in a switch mode.
Port Setup: Creating DOCA Flow switch ports corresponding to the physical and Linux representor ports.
Default miss behavior: Unmatched packets are forwarded to the kernel, ensuring control plane protocols receive proper kernel processing.
Pipe Creation: Creates two pipes to implement the bifurcation logic:
Egress Pipe (EGRESS domain): Matches on packet metadata (pkt_meta) and forwards packets to the corresponding port. Contains three entries:
Ingress Classifier Pipe (DEFAULT domain): Routes traffic based on source port_id and outer L4 protocol type, sets packet metadata, and forwards to either the egress pipe or RSS queues. Contains nine entries:
Monitoring Configuration: Each pipe entry is configured with a non-shared counter resource to track packet statistics. The ingress root classifier pipe also enables a miss counter to monitor packets forwarded to the kernel.
Entry Processing: All flow entries are processed and offloaded to hardware.
Packet Processing: The main application loop demonstrates Linux port packet handling by receiving packets from queue 0, setting appropriate metadata, and transmitting them back through the switch port.
Statistics Collection: Upon completion, the application queries and displays per-entry packet counters for both ingress and egress pipes, along with the ingress miss counter, providing visibility into traffic patterns.
This application leverages the following DOCA library:
DOCA Flow – The core library used to program the hardware eSwitch to create the flow rules for traffic steering and bifurcation.
Refer to the respective programming guide for more information.
Please refer to the DOCA Installation Guide for Linux for details on how to install BlueField-related software.
The installation of DOCA's reference applications contains the sources of the applications, alongside the matching compilation instructions. This allows for compiling the applications "as-is" and provides the ability to modify the sources, then compile a new version of the application.
For more information about the applications as well as development and compilation tips, refer to the DOCA Reference Applications page.
The sources of the application can be found under the application's directory: /opt/mellanox/doca/applications/bifurcated_driver_model/.
Compiling All Applications
To build all DOCA applications together, run:
cd /opt/mellanox/doca/applications/
meson /tmp/build
ninja -C /tmp/build
doca_bifurcated_driver_model is created under /tmp/build/applications/bifurcated_driver_model/.
Recompiling Only the Current Application
To directly build only the Bifurcated Driver Model application:
cd /opt/mellanox/doca/applications/
meson /tmp/build -Denable_all_applications=false -Denable_bifurcated_driver_model=true
ninja -C /tmp/build
doca_bifurcated_driver_model is created under /tmp/build/applications/bifurcated_driver_model/.
The application is based on DOCA Flow and DPDK. Therefore, the user is required to allocate huge pages.
$ echo '1024' | sudo tee -a /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages
$ sudo mkdir /mnt/huge
$ sudo mount -t hugetlbfs -o pagesize=2M nodev /mnt/huge
Application Execution
Application usage instructions:
InfoThe application is provided in source form, requiring compilation before execution.
Usage: doca_bifurcated_driver_model [DPDK Flags] -- [DOCA Flags] [Program Flags] DOCA Flags: -h, --help Print a help synopsis -v, --version Print program version information -l, --log-level Set the (numeric) log level
forthe program <10=DISABLE,20=CRITICAL,30=ERROR,40=WARNING,50=INFO,60=DEBUG,70=TRACE> --sdk-log-level Set the SDK (numeric) log levelforthe program <10=DISABLE,20=CRITICAL,30=ERROR,40=WARNING,50=INFO,60=DEBUG,70=TRACE> -j, --json <path> Parse command line flags from an input json file Program Flags: -a, --device device -r, --rep device representor -exp, --expert-mode set expert modeThis usage printout can be printed to the command line using the -h (or --help) options:
./doca_bifurcated_driver_model -- -h
InfoFor additional information, refer to section "Command Line Flags".
CLI example for running the application on BlueField:
cd /opt/mellanox/doca/applications/ ./bifurcated_driver_model/doca_bifurcated_driver_model -- -l
60-a pci/08:00.0-r pci/08:00.0,pf0sf0 -r pci/08:00.1InfoSFs must be enabled according to the BlueField Scalable Function User Guide.
Before creating SFs on a specific physical port, it is important to verify the encap mode on the respective PF FDB. The default mode is basic. To check the encap mode, run:
cat /sys/
class/net/p0/compat/devlink/encapIn this case, disable encap on the PF FDB before creating the SFs by running:
/opt/mellanox/iproute2/sbin/devlink dev eswitch set pci/
0000:03:00.0mode legacy /opt/mellanox/iproute2/sbin/devlink dev eswitch set pci/0000:03:00.1mode legacy echo none > /sys/class/net/p0/compat/devlink/encap echo none > /sys/class/net/p1/compat/devlink/encap /opt/mellanox/iproute2/sbin/devlink dev eswitch set pci/0000:03:00.0mode switchdev /opt/mellanox/iproute2/sbin/devlink dev eswitch set pci/0000:03:00.1mode switchdevNoteIf the encap mode is set to
basicthen the application fails upon initialization.The flag
-a pci/08:00.0with representors-r pci/08:00.0,pf0sf0 -r pci/08:00.1is mandatory for proper usage of the application.Modifying this flag will result in an unexpected behavior as only 2 ports are supported.
The SF number is arbitrary and configurable.
The SF numbers must match the desired SF devices.
The device identifiers must match the desired network devices.
For additional information regarding the command line syntax of the device and device representor identifiers, refer to the matching section in the DOCA Arg Parser.
For more information, refer to section "Running DOCA Application on Host" in DOCA Virtual Functions User Guide.
Command Line Flags
Flag Type | Short Flag | Long Flag | Description |
General flags |
|
| Prints a help synopsis |
|
| Prints program version information | |
|
| Set the log level for the application:
| |
N/A |
| Sets the log level for the program:
| |
|
| Parse command line flags from an input JSON file as well as from the CLI (if provided) | |
Program flags |
|
| Device identifier |
|
| Device representor identifiers | |
|
| set expert mode |
Refer to DOCA Arg Parser for more information regarding the supported flags and execution modes..
Troubleshooting
Refer to the NVIDIA BlueField Platform Software Troubleshooting Guide for any issue encountered with the installation or execution of the DOCA applications.
The application initializes resources, sets up the flow pipes, and enters a processing loop.
Initialize logging:
doca_log_backend_create_standard();doca_log_backend_create_with_file_sdk();doca_log_backend_set_sdk_level();
Argument Parsing Initialization:
doca_argp_init(): Initialize arg parser.register_doca_flow_switch_params(): Register switch applications parameters.
Parse all command line arguments.
doca_argp_start();
DOCA Flow devices initialization:
init_doca_flow_devs();
DPDK & Port Initialization:
dpdk_queues_and_ports_init();
DOCA Flow & Application Setup:
bifurcated_driver_model_init():Initializes DOCA Flow:
init_doca_flow();
Creates DOCA ports for all physical and Linux representor ports:
init_doca_flow_switch_ports();
Set default miss behavior:
doca_flow_port_update_default_miss();
Creates all necessary pipes: Ingress, and Egress pipes, defining the flow structure:
create_egress_pipe();add_egress_pipe_entries();create_ingress_classifier_pipe();add_ingress_classifier_entries();Data Plane (P0 ↔ P1): 4 entries for TCP/UDP forwarding
Control Plane (Linux → RSS): 5 entries for various protocols
Process flow entries:
doca_flow_entries_process();
Main processing loop
handle_rx_tx_pkts()
Statistics collection:
print_flow_statistics();doca_flow_resource_query_entry(): Query and display ingress entry counters.doca_flow_resource_query_pipe_miss(): Query and display ingress miss counter.
Cleanup and destroy:
stop_doca_flow_ports()doca_flow_destroy()dpdk_queues_and_ports_fini()dpdk_fini()destroy_doca_flow_devs()doca_argp_destroy()