### Example BFB Installation Output Source: https://docs.nvidia.com/doca/sdk/BF-Bundle%2BInstallation%2Band%2BUpgrade Sample output showing the progress and status of an Ubuntu BFB bundle installation. ```bash host# sudo bfb-install --rshim rshim0 --bfb bf-bundle-2.7.0_24.04_ubuntu-22.04_prod.bfb --config bf.cfg Pushing bfb 1.41GiB 0:02:02 [11.7MiB/s] [ <=> ] Collecting BlueField booting status. Press Ctrl+C to stop INFO[PSC]: PSC BL1 START INFO[BL2]: start INFO[BL2]: boot mode (rshim) INFO[BL2]: VDDQ: 1120 mV INFO[BL2]: DDR POST passed INFO[BL2]: UEFI loaded INFO[BL31]: start INFO[BL31]: lifecycle GA Secured INFO[BL31]: VDD: 850 mV INFO[BL31]: runtime INFO[BL31]: MB ping success INFO[UEFI]: eMMC init INFO[UEFI]: eMMC probed INFO[UEFI]: UPVS valid INFO[UEFI]: PMI: updates started INFO[UEFI]: PMI: total updates: 1 INFO[UEFI]: PMI: updates completed, status 0 INFO[UEFI]: PCIe enum start INFO[UEFI]: PCIe enum end INFO[UEFI]: UEFI Secure Boot INFO[UEFI]: PK configured INFO[UEFI]: Redfish enabled INFO[UEFI]: exit Boot Service INFO[MISC]: Found bf.cfg INFO[MISC]: Ubuntu installation started INFO[MISC]: Installing OS image INFO[MISC]: Changing the default password for user ubuntu INFO[MISC]: Ubuntu installation completed INFO[MISC]: Updating NIC firmware... INFO[MISC]: NIC firmware update done INFO[MISC]: Installation finished ``` -------------------------------- ### Full QoS Policy File Example with All Options Source: https://docs.nvidia.com/doca/sdk/NVIDIA%2BSM This example demonstrates all possible keywords and syntax within a QoS policy file, including port groups, QoS setup, QoS levels, and matching rules. Use this as a reference for complex configurations. ```policy # # See the comments in the following example. # They explain different keywords and their meaning. # port-groups port-group # using port GUIDs name: Storage # "use" is just a description that is used for logging # Other than that, it is just a comment use: SRP Targets port-guid: 0x10000000000001, 0x10000000000005-0x1000000000FFFA port-guid: 0x1000000000FFFF end-port-group port-group name: Virtual Servers # The syntax of the port name is as follows: # "node_description/Pnum". # node_description is compared to the NodeDescription of the node, # and "Pnum" is a port number on that node. port-name: “vs1 HCA-1/P1, vs2 HCA-1/P1” end-port-group # using partitions defined in the partition policy port-group name: Partitions partition: Part1 pkey: 0x1234 end-port-group # using node types: CA, ROUTER, SWITCH, SELF (for node that runs SM) # or ALL (for all the nodes in the fabric) port-group name: CAs and SM node-type: CA, SELF end-port-group end-port-groups qos-setup # This section of the policy file describes how to set up SL2VL and VL # Arbitration tables on various nodes in the fabric. # However, this is not supported in OFED - the section is parsed # and ignored. SL2VL and VLArb tables should be configured in the # OpenSM options file (by default - /var/cache/opensm/opensm.opts). end-qos-setup qos-levels # Having a QoS Level named "DEFAULT" is a must - it is applied to # PR/MPR requests that didn't match any of the matching rules. qos-level name: DEFAULT use: default QoS Level sl: 0 end-qos-level # the whole set: SL, MTU-Limit, Rate-Limit, PKey, Packet Lifetime qos-level name: WholeSet sl: 1 mtu-limit: 4 rate-limit: 5 pkey: 0x1234 packet-life: 8 end-qos-level end-qos-levels # Match rules are scanned in order of their appearance in the policy file. # First matched rule takes precedence. qos-match-rules # matching by single criteria: QoS class qos-match-rule use: by QoS class qos-class: 7-9,11 # Name of qos-level to apply to the matching PR/MPR qos-level-name: WholeSet end-qos-match-rule # show matching by destination group and service id qos-match-rule use: Storage targets destination: Storage service-id: 0x10000000000001, 0x10000000000008-0x10000000000FFF qos-level-name: WholeSet end-qos-match-rule qos-match-rule source: Storage use: match by source group only qos-level-name: DEFAULT end-qos-match-rule qos-match-rule use: match by all parameters qos-class: 7-9,11 source: Virtual Servers destination: Storage service-id: 0x0000000000010000-0x000000000001FFFF pkey: 0x0F00-0x0FFF qos-level-name: WholeSet end-qos-match-rule end-qos-match-rules ``` -------------------------------- ### List DOCA Library Availability Output Source: https://docs.nvidia.com/doca/sdk/DOCA%2BCapabilities%2BPrint%2BTool Example output showing the installation status of various DOCA libraries. ```text /opt/mellanox/doca/tools/doca_caps --list-libs common installed aes_gcm installed apsh installed argp installed cc installed comm_channel installed compress installed dma installed dpa installed dpdk_bridge installed erasure_coding installed eth installed ipsec installed flow installed flow_ct installed pcc installed rdma installed sha installed telemetry installed ``` -------------------------------- ### Install SNAP Sources Source: https://docs.nvidia.com/doca/sdk/SNAP-4%2BService%2BDeployment Install the compiled binaries and files to the system. ```bash meson install -C /tmp/build ``` -------------------------------- ### Comprehensive Simple QoS Policy Example Source: https://docs.nvidia.com/doca/sdk/NVIDIA%2BSM This example demonstrates a comprehensive simple QoS policy file, including rules for various ULPs like SDP, RDS, IPoIB, SRP, and general 'any' matches. It specifies SLs based on port numbers, PKeys, service IDs, and target port GUIDs. ```qos qos-ulps default :0 # default SL sdp, port-num 30000 :0 # SL for application running on # top of SDP when a destination # TCP/IPport is 30000 sdp, port-num 10000-20000 : 0 sdp :1 # default SL for any other # application running on top of SDP rds :2 # SL for RDS traffic ipoib, pkey 0x0001 :0 # SL for IPoIB on partition with # pkey 0x0001 ipoib :4 # default IPoIB partition, # pkey=0x7FFF any, service-id 0x6234:6 # match any PR/MPR query with a # specific Service ID any, pkey 0x0ABC :6 # match any PR/MPR query with a # specific PKey srp, target-port-guid 0x1234 : 5 # SRP when SRP Target is located # on a specified IB port GUID any, target-port-guid 0x0ABC-0xFFFFF : 6 # match any PR/MPR query # with a specific target port GUID end-qos-ulps ``` -------------------------------- ### Install BFB Bundle Source: https://docs.nvidia.com/doca/sdk/BF-Bundle%2BInstallation%2Band%2BUpgrade Execute the installation command using the specified configuration file. ```bash host# sudo bfb-install --rshim rshim --bfb --config bf.cfg ``` -------------------------------- ### Example Topology Configuration Source: https://docs.nvidia.com/doca/sdk/NVIDIA%2BSM A practical example showing a 2D 4x5 torus configuration. ```text # Look for a 2D (since x radix is one) 4x5 torus. torus 1 4 5 # y is radix-4 torus dimension, need both ``` -------------------------------- ### Install QEMU on Fedora Source: https://docs.nvidia.com/doca/sdk/DOCA%2BDeveloper%2BGuide Install QEMU system packages for Fedora. ```bash sudo yum install qemu-system-aarch64 ``` -------------------------------- ### Build and Install SPDK Source: https://docs.nvidia.com/doca/sdk/SNAP-4%2BService%2BAppendixes Compile SPDK and copy the resulting libraries and headers to the installation directory. ```bash [spdk.git] make && make install [spdk.git] cp dpdk/build/lib/* /opt/mellanox/spdk/lib/ [spdk.git] cp dpdk/build/include/* /opt/mellanox/spdk/include/ ``` -------------------------------- ### Example: Run DHCP Server Source: https://docs.nvidia.com/doca/sdk/IP%2BOver%2BInfiniBand Example of running the DHCP server with the 'ib0' interface. ```shell host1# dhcpd ib0 -d ``` -------------------------------- ### Get Virtio-FS Device Statistics Response Source: https://docs.nvidia.com/doca/sdk/DOCA%2BSNAP%2BVirtio-fs%2BService%2BGuide Example JSON response for device statistics. Statistics are only valid when the device is in the 'started' state. ```json { jsonrpc": "2.0", "id": 1, "result": { "devices": [ { "name": "vfsdev0", "fsdev": "aio0", "state": "running", "transport_name": "DOCA", "transport_specific": { "queues": [ { "queue_id": 0, "queue_enabled": 1, "queue_depth": 256, "queue_inflights": 0, "hw_available_index": 8, "driver_available_index": 8, "hw_used_index": 8, "driver_used_index": 8 }, { "queue_id": 1, "queue_enabled": 1, "queue_depth": 256, "queue_inflights": 0, "hw_available_index": 104, "driver_available_index": 104, "hw_used_index": 104, "driver_used_index": 104 } ] } } ] } } ``` -------------------------------- ### Install SDK Packages Source: https://docs.nvidia.com/doca/sdk/DPL%2BRuntime%2BController%2BSDK Command to install DPL Runtime Controller packages on host systems. ```bash 1 sudo apt install dpl-rt-controller dpl-rt-controller-dev dpl-p4rt-controller dpl-p4rt-controller-dev dpl-rt-controller-samples ``` -------------------------------- ### Install mlnx-nvme on SLES Source: https://docs.nvidia.com/doca/sdk/DOCA-Host%2BInstallation%2Band%2BUpgrade Example of installing the mlnx-nvme package on SLES. First, search for the package, then install it. ```bash # zypper search mlnx-nvme # zypper install mlnx-nvme-kmp-default ``` -------------------------------- ### Partition Configuration Examples Source: https://docs.nvidia.com/doca/sdk/NVIDIA%2BSM Examples demonstrating various partition configurations including default settings and custom partitions. ```text Default=0x7fff : ALL, SELF=full ; Default=0x7fff : ALL, ALL_SWITCHES=full, SELF=full ; NewPartition , ipoib : 0x123456=full, 0x3456789034=limi, 0x2134af2306 ; YetAnotherOne = 0x300 : SELF=full ; ``` -------------------------------- ### Get Request JSON Response Source: https://docs.nvidia.com/doca/sdk/DOCA%2BManagement%2BService%2BGuide Example output format for a successful Get request. ```json [ { "source": "localhost:9339", "timestamp": 1712485149723248511, "time": "2024-04-07T10:19:09.723248511Z", "updates": [ { "Path": "interfaces/interface[name=p0]/config/mtu", "values": { "interfaces/interface/config/mtu": "1500" } } ] } ] ``` -------------------------------- ### Example Firmware Query Output Source: https://docs.nvidia.com/doca/sdk/SNAP-4%2BService%2BDeployment Sample output showing configuration columns including default, current, and next boot values. ```text mlxconfig -d /dev/mst/mt41692_pciconf0 -e query | grep NVME Configurations: Default Current Next Boot * NVME_EMULATION_ENABLE False(0) True(1) True(1) * NVME_EMULATION_NUM_VF 0 125 125 * NVME_EMULATION_NUM_PF 1 2 2 NVME_EMULATION_VENDOR_ID 5555 5555 5555 NVME_EMULATION_DEVICE_ID 24577 24577 24577 NVME_EMULATION_CLASS_CODE 67586 67586 67586 NVME_EMULATION_REVISION_ID 0 0 0 NVME_EMULATION_SUBSYSTEM_VENDOR_ID 0 0 0 * NVME_EMULATION_NUM_MSIX 0 2 2 * NVME_EMULATION_NUM_VF_MSIX 0 2 2 * NVME_EMULATION_MAX_QUEUE_DEPTH 0 12 12 ``` -------------------------------- ### Example Server CLI Command Source: https://docs.nvidia.com/doca/sdk/DOCA%2BDPU%2BGPU%2BRemote%2BOffload%2BApplication%2BGuide This example demonstrates how to run the server application with specific device IDs, a listen port, message limits, and CPU assignments. Ensure the provided device and representor IDs match your system. ```bash ./doca_dpu_gpu_remote_offload_server --device-id 03:00.0 --representor-id d8:00.0 \ -p 12345 --max-concurrent-messages 128 --cpu 1 --cpu 2 ``` -------------------------------- ### Monitor BFB Installation Status Source: https://docs.nvidia.com/doca/sdk/Known%2BIssues Example output from the RShim console indicating the progress of a BFB installation. ```text [13:58:39] INFO: Installation finished ... [14:01:53] INFO: Rebooting... ``` -------------------------------- ### Install mlnx-nvme and mlnx-nfsrdma on Debian-based systems Source: https://docs.nvidia.com/doca/sdk/DOCA-Host%2BInstallation%2Band%2BUpgrade Example of installing mlnx-nvme and mlnx-nfsrdma packages on Debian-based systems. This involves searching for the packages and then installing the DKMS versions. ```bash # apt search mlnx-nvme # apt search mlnx-nfsrdma # apt install mlnx-nvme-dkms # apt install mlnx-nfsrdma-dkms ``` -------------------------------- ### Build a DOCA Sample Source: https://docs.nvidia.com/doca/sdk/DOCA%2BSHA Navigate to the sample directory and use Meson and Ninja to build the sample. The binary will be created in `/tmp/build/`. ```bash cd /opt/mellanox/doca/samples/doca_sha/ meson/tmp/build ninja -C/tmp/build ``` -------------------------------- ### Example: Set and Apply Number of VFs Source: https://docs.nvidia.com/doca/sdk/DOCA%2BVirtual%2BFunctions%2BUser%2BGuide An example demonstrating how to set the number of VFs to 2, reboot the system, and then apply the setting to a specific network interface. ```bash sudo mlxconfig -y -d /dev/mst/mt41686_pciconf0 s NUM_OF_VFS=2 host $ reboot host $ echo 2 > /sys/class/net/ens1f0/device/sriov_numvfs ``` -------------------------------- ### Example: Uninstall Specific strongSwan Packages Source: https://docs.nvidia.com/doca/sdk/DOCA%2BEast-West%2BOverlay%2BEncryption%2BApplication Provides an example of specific strongSwan and charon packages to uninstall before installing a new version. ```bash sudo dpkg -P --force-depends libstrongswan libstrongswan-standard-plugins strongswan strongswan-charon strongswan-libcharon strongswan-starter libcharon-extauth-plugins ``` -------------------------------- ### Example DPL RT Service Configuration Source: https://docs.nvidia.com/doca/sdk/DPL%2BService%2BConfiguration This is an example of a DPL RT Service GENERAL configuration file, demonstrating the setup for logging. ```ini # Example of a possible DPL RT Service GENERAL configuration file [LOGGING] # Path to the dpl_rtd log file. log_file_path=/var/log/doca/dpl_rt_service/dpl_rtd.log # Log level for the DPL RT Service. # Possible log_level values (case insensitive): # DISABLE # CRITICAL # ERROR # WARNING # INFO # DEBUG ``` -------------------------------- ### Prepare System for DPL Runtime Service (DPU Mode) Source: https://docs.nvidia.com/doca/sdk/DPL%2BContainer%2BDeployment Navigates to the DPL Runtime Service directory, makes the setup script executable, and runs it with sudo privileges. Restarts kubelet and containerd services to apply configuration changes, especially for hugepages. ```bash cd dpl_rt_service_va.b.c-docax.y.z chmod +x ./scripts/dpl_system_setup.sh sudo ./scripts/dpl_system_setup.sh sudo systemctl restart kubelet.service sudo systemctl restart containerd.service ``` -------------------------------- ### Get Stateful Region Start Address from Event Source: https://docs.nvidia.com/doca/sdk/DOCA%2BDevEmu%2BPCI%2BGeneric Retrieve the start address of the stateful region within the BAR that was written to by the host driver. ```c doca_devemu_pci_dev_event_bar_stateful_region_driver_write_get_bar_region_start_addr ``` -------------------------------- ### Example: Run DHCP Client with Configuration Source: https://docs.nvidia.com/doca/sdk/IP%2BOver%2BInfiniBand Example command to run the DHCP client using a specified configuration file and interface. ```shell host1# dhclient –cf dhclient.conf ib1 ``` -------------------------------- ### Hello World Example - Prepare Kernels Code Source: https://docs.nvidia.com/doca/sdk/DOCA%2BDPA This snippet shows the DPA device code for the 'Hello World' example, including logging and synchronization mechanisms. ```APIDOC ## Hello World Example - Prepare Kernels Code ### Description This section details the DPA kernel code required for the 'Hello World' example. It includes a kernel function (`hello_world_thread_kernel`) that logs a message and signals completion, and an RPC function (`hello_world_thread_notify_rpc`) to notify the DPA thread. ### Method N/A (Device code compilation) ### Endpoint N/A (Device code compilation) ### Parameters N/A ### Request Example N/A ### Response N/A ### Code Snippet ```c #include "doca_dpa_dev.h" #include "doca_dpa_dev_sync_event.h" __dpa_global__ void hello_world_thread_kernel(uint64_t arg) { DOCA_DPA_DEV_LOG_INFO("Hello World From DPA Thread!\n"); doca_dpa_dev_sync_event_update_set(arg, 1); doca_dpa_dev_thread_finish(); } __dpa_rpc__ uint64_t hello_world_thread_notify_rpc(doca_dpa_dev_notification_completion_t comp_handle) { DOCA_DPA_DEV_LOG_INFO("Notifying DPA Thread From RPC\n"); doca_dpa_dev_thread_notify(comp_handle); return 0; } ``` ``` -------------------------------- ### Cset Filtering Syntax Example Source: https://docs.nvidia.com/doca/sdk/DOCA%2BTelemetry%2BService%2BGuide Provides examples of syntax for writing cset files to filter counter data. It shows how to match names based on start, end, exact match, and combinations of tokens. ```text # Put tokens on separate lines # Tokens are the actual name 'fragments' to be matched # port$ # match names ending with token "port" # ^port # match names starting with token "port" # ^port$ # include name that is exact token "port # port+xmit # match names that contain both tokens "port" and "xmit" # port-support # match names that contain the token "port" and do not match the "-" token "support" # # Tip: To disable counter export put a single token line that fits nothing ``` -------------------------------- ### Prepare System for DPL Runtime Service (Host Mode) Source: https://docs.nvidia.com/doca/sdk/DPL%2BContainer%2BDeployment Changes to the DPL Runtime Service directory, makes the setup script executable, and runs it with sudo privileges, specifying the ConnectX device(s) to be configured for DPL use via the --dev option. ```bash cd dpl_rt_service_va.b.c-docax.y.z chmod +x ./scripts/dpl_system_setup.sh sudo ./scripts/dpl_system_setup.sh --dev 0000:08:00.0 ``` -------------------------------- ### Install T-Rex Packet Generator Source: https://docs.nvidia.com/doca/sdk/DOCA%2BGPU%2BPacket%2BProcessing%2BApplication%2BGuide Commands to download, extract, and perform initial setup for the T-Rex traffic generator. ```bash wget https://trex-tgn.cisco.com/trex/release/v3.08.tar.gz --no-check-certificate tar -xvf v3.08.tar.gz cd v3.08 # Only first time sudo ./dpdk_setup_ports.py -i ``` -------------------------------- ### Host-side Thread Activation Example Source: https://docs.nvidia.com/doca/sdk/DOCA%2BDPA Pseudo-code demonstrating the sequence for creating, configuring, and starting a DPA thread with notification completion. ```C extern doca_dpa_func_t hello_kernel; // create DPA thread doca_dpa_thread_create(&dpa_thread); // set thread kernel doca_dpa_thread_set_func_arg(dpa_thread, &hello_kernel, func_arg); // start thread doca_dpa_thread_start(dpa_thread); // create and start DPA notification completion doca_dpa_notification_completion_create(dpa, dpa_thread, ¬ify_comp); doca_dpa_notification_completion_start(notify_comp); // get its DPA handle doca_dpa_notification_completion_get_dpa_handle(notify_comp, ¬ify_comp_handle); // run thread only after both thread is started and attached notification completion is started doca_dpa_thread_run(dpa_thread); ``` -------------------------------- ### Build and Run DOCA STA Offload Sample Source: https://docs.nvidia.com/doca/sdk/DOCA%2BSTA Navigate to the application directory, set up the build environment using meson, compile with ninja, and run the sta_offload application with specified parameters. Ensure DOCA is installed and configured. ```bash cd /opt/mellanox/doca/applications meson setup /tmp/build ninja -C /tmp/build tmp/build/sta_offload/doca_sta_offload --doca_lib_lvl 50 --doca_app_lvl 40 --sf_dev mlx5_0 ``` -------------------------------- ### PPCC Register Access Source: https://docs.nvidia.com/doca/sdk/DOCA%2BPCC%2BApplication%2BGuide Examples of how to get and set the PPCC register for algorithm operations. Ensure to set the `cmd_type` and appropriate indexes. ```APIDOC ## GET PPCC Register ### Description Retrieves information about the PPCC register, such as algorithm details. ### Method GET ### Endpoint `/dev/mst/mt41692_pciconf0` ### Parameters #### Query Parameters - **-d** (string) - Required - Device path (e.g., `/dev/mst/mt41692_pciconf0`) - **-y** (boolean) - Required - Use the device - **--get** (boolean) - Required - Operation to get data - **--op** (string) - Required - Operation details, e.g., `"cmd_type=0"` - **--reg_name** (string) - Required - Register name, e.g., `PPCC` - **--indexes** (string) - Required - Index parameters, e.g., `"local_port=1,pnat=0,lp_msb=0,algo_slot=0,algo_param_index=0,target_app=0"` ### Request Example ```bash sudo mlxreg -d /dev/mst/mt41692_pciconf0 -y --get --op "cmd_type=0" --reg_name PPCC --indexes "local_port=1,pnat=0,lp_msb=0,algo_slot=0,algo_param_index=0,target_app=0" ``` ## SET PPCC Register ### Description Sets values for the PPCC register, such as enabling algorithms. ### Method SET ### Endpoint `/dev/mst/mt41692_pciconf0` ### Parameters #### Query Parameters - **-d** (string) - Required - Device path (e.g., `/dev/mst/mt41692_pciconf0`) - **-y** (boolean) - Required - Use the device - **--set** (string) - Required - Set operation details, e.g., `"cmd_type=1"` - **--reg_name** (string) - Required - Register name, e.g., `PPCC` - **--indexes** (string) - Required - Index parameters, e.g., `"local_port=1,pnat=0,lp_msb=0,algo_slot=0,algo_param_index=0,target_app=0"` ### Request Example ```bash sudo mlxreg -d /dev/mst/mt41692_pciconf0 -y --set "cmd_type=1" --reg_name PPCC --indexes "local_port=1,pnat=0,lp_msb=0,algo_slot=0,algo_param_index=0,target_app=0" ``` ``` -------------------------------- ### Configure network devices and namespaces Source: https://docs.nvidia.com/doca/sdk/IPsec%2BPacket%2BOffload Sets up PF/VF/REP netdevices and moves a VF into a network namespace. ```bash ifconfig $PF $LOCAL_TUN/16 up ip l set dev $PF mtu 2000 ifconfig $REP up ip netns add ns0 ip link set dev $VF netns ns0 ip netns exec ns0 ifconfig $VF $IP/16 up ``` -------------------------------- ### Example configuration file structure Source: https://docs.nvidia.com/doca/sdk/DOCA%2BFlow%2BTune%2BTool Shows the structure for defining output directories and network settings in the configuration file. ```json { ... "outputs_directory": "/tmp/flow_tune/", ... "network": { "server_uds": "/tmp/tune_server.sock", "uds_directory": "/var/run/doca/flow_tune/" }, ... } ``` -------------------------------- ### Example Output of Device Capabilities Source: https://docs.nvidia.com/doca/sdk/DOCA%2BBench This output details the capabilities of the doca_compress library, including its support status, installed status, and specific task types like deflate and lz4. ```text doca_compress: Capable: yes Installed: yes Tasks: compress::deflate: Supported: no compress::lz4: Supported: no compress::lz4_stream: Supported: no decompress::deflate: Supported: yes Max buffer length: 134217728 decompress::lz4: Supported: yes Max buffer length: 134217728 decompress::lz4_stream: Supported: yes Max buffer length: 134217728 ``` -------------------------------- ### Install QEMU and binfmt-support on Ubuntu Source: https://docs.nvidia.com/doca/sdk/DOCA%2BDeveloper%2BGuide Install necessary QEMU packages and configure binfmt for multi-architecture container execution on Ubuntu hosts. ```bash sudo apt-get install qemu binfmt-support qemu-user-static sudo docker run --rm --privileged multiarch/qemu-user-static --reset -p yes ``` -------------------------------- ### Virtio-blk Two-step PCIe Hotplug/Unplug Example Source: https://docs.nvidia.com/doca/sdk/SNAP-4%2BService%2BRPC%2BCommands This example demonstrates the bringup and cleanup process for virtio-blk controllers using SPDK and SNAP RPCs. It includes attaching an NVMe controller, creating and hotplugging a virtio-blk controller, and then cleaning up by hotunplugging and destroying the controller. ```bash spdk_rpc.py bdev_nvme_attach_controller -b nvme0 -t rdma -a 1.1.1.1 -f ipv4 -s 4420 -n nqn.2022-10.io.nvda.nvme:swx-storage snap_rpc.py virtio_blk_function_create snap_rpc.py virtio_blk_controller_create --vuid MT2114X12200VBLKS1D0F0 --bdev nvme0n1 snap_rpc.py virtio_blk_controller_hotplug -c VblkCtrl1 --wait_for_done # Cleanup snap_rpc.py virtio_blk_controller_hotunplug -c VblkCtrl1 --wait_for_done snap_rpc.py virtio_blk_controller_destroy -c VblkCtrl1 snap_rpc.py virtio_blk_function_destroy --vuid MT2114X12200VBLKS1D0F0 spdk_rpc.py bdev_nvme_detach_controller nvme0 ``` -------------------------------- ### DPE Configuration File Example Source: https://docs.nvidia.com/doca/sdk/DOCA%2BTelemetry%2BService%2BGuide Example configuration file defining server socket, allowed commands, and regex macros. ```ini [server] socket=/tmp/dpe.sock [commands] hostname cat /etc/os-release [commands_regex] crictl inspect $HEXA # resolved as "crictl inspect [a-f0-9]+" lspci $BDF # resolved as "lspci ([0-9a-f]{4}\:|)[0-9a-f]{2}\:[0-9a-f]{2}\.[0-9a-f]" [regex_macros] HEXA=[a-f0-9]+ BDF=([0-9a-f]{4}\:|)[0-9a-f]{2}\:[0-9a-f]{2}\.[0-9a-f] ``` -------------------------------- ### DPL Example for Packet Processing Logic Source: https://docs.nvidia.com/doca/sdk/Add%2Bon%2BMiss This DPL code orchestrates packet processing, including IPv6 header verification, flow lookup, dynamic rule installation on miss, and forwarding. ```p4 /* * SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. * SPDX-License-Identifier: LicenseRef-NvidiaProprietary * * NVIDIA CORPORATION, its affiliates and licensors retain all intellectual * property and proprietary rights in and to this material, related * documentation and any modifications thereto. Any use, reproduction, * disclosure or distribution of this material and related documentation * without an express license agreement from NVIDIA CORPORATION or * its affiliates is strictly prohibited. */ #include #include #include #include // Pipeline section control c( inout nv_headers_t headers, in nv_standard_metadata_t std_meta, inout nv_empty_metadata_t user_meta, inout nv_empty_metadata_t pkt_out_meta ) { NvDirectCounter(NvCounterType.PACKETS_AND_BYTES) v6tableDirectCounter; action count_v6_hit(nv_logical_port_t port) { v6tableDirectCounter.count(); nv_send_to_port(port); } table fiveTupleTable_v6 { key = { headers.ipv6.src_addr : exact; headers.ipv6.dst_addr : exact; headers.ipv6.next_header : exact; headers.tcp.src_port : exact; headers.tcp.dst_port : exact; } actions = { count_v6_hit; NoAction; } default_action = NoAction; direct_counter = v6tableDirectCounter; nv_support_add_entry = true; nv_support_timeout = true; nv_delayed_counter_stats = true; } apply { if (headers.ipv6.isValid() && headers.tcp.isValid()) { if (fiveTupleTable_v6.apply().miss) { nv_add_entry( "fiveTupleTable_v6", { headers.ipv6.src_addr, headers.ipv6.dst_addr, NV_TCP_PROTOCOL, headers.tcp.src_port, headers.tcp.dst_port }, "count_v6_hit", { 32w1 }, 1000 ); } } nv_send_to_port(1); } } // Instantiate the top-level DPU pipeline package NvDocaPipeline( nv_fixed_parser(), c() ) main; ``` -------------------------------- ### DPA Completion Context Management Source: https://docs.nvidia.com/doca/sdk/DOCA%2BDPA APIs for creating, destroying, getting queue size, attaching/detaching DPA Threads, starting, stopping, and retrieving the DPA handle for DPA Completion Contexts. ```APIDOC ## DPA Completion Context Management ### Description APIs for managing the DPA Completion Context, which integrates user applications with the DPA's event-driven scheduling model. ### Create DPA Completion Context ```c doca_error_t doca_dpa_completion_create(struct doca_dpa *dpa, unsigned int queue_size, struct doca_dpa_completion **dpa_comp) ``` ### Destroy DPA Completion Context ```c doca_error_t doca_dpa_completion_destroy(struct doca_dpa_completion *dpa_comp) ``` ### Get Queue Size ```c doca_error_t doca_dpa_completion_get_queue_size(struct doca_dpa_completion *dpa_comp, unsigned int *size) ``` ### Attach to DPA Thread ```c doca_error_t doca_dpa_completion_set_thread(struct doca_dpa_completion *dpa_comp, struct doca_dpa_thread *thread) ``` ### Get Attached DPA Thread ```c doca_error_t doca_dpa_completion_get_thread(struct doca_dpa_completion *dpa_comp, struct doca_dpa_thread **thread) ``` ### Start DPA Completion Context ```c doca_error_t doca_dpa_completion_start(struct doca_dpa_completion *dpa_comp) ``` ### Stop DPA Completion Context ```c doca_error_t doca_dpa_completion_stop(struct doca_dpa_completion *dpa_comp) ``` ### Get DPA Handle ```c doca_error_t doca_dpa_completion_get_dpa_handle(struct doca_dpa_completion *dpa_comp, doca_dpa_dev_completion_t *handle) ``` ### Parameters #### `doca_dpa_completion_create` - **dpa** (struct doca_dpa *) - Pointer to the DPA device. - **queue_size** (unsigned int) - The size of the completion queue. - **dpa_comp** (struct doca_dpa_completion **) - Output parameter for the created completion context. #### `doca_dpa_completion_destroy` - **dpa_comp** (struct doca_dpa_completion *) - Pointer to the completion context to destroy. #### `doca_dpa_completion_get_queue_size` - **dpa_comp** (struct doca_dpa_completion *) - Pointer to the completion context. - **size** (unsigned int *) - Output parameter for the queue size. #### `doca_dpa_completion_set_thread` - **dpa_comp** (struct doca_dpa_completion *) - Pointer to the completion context. - **thread** (struct doca_dpa_thread *) - Pointer to the DPA Thread to attach. #### `doca_dpa_completion_get_thread` - **dpa_comp** (struct doca_dpa_completion *) - Pointer to the completion context. - **thread** (struct doca_dpa_thread **) - Output parameter for the attached DPA Thread. #### `doca_dpa_completion_start` - **dpa_comp** (struct doca_dpa_completion *) - Pointer to the completion context to start. #### `doca_dpa_completion_stop` - **dpa_comp** (struct doca_dpa_completion *) - Pointer to the completion context to stop. #### `doca_dpa_completion_get_dpa_handle` - **dpa_comp** (struct doca_dpa_completion *) - Pointer to the completion context. - **handle** (doca_dpa_dev_completion_t *) - Output parameter for the DPA handle. ### Notes - Attaching to a thread is only required if the user wants triggering of the thread when a completion arrives at the completion context. - The `handle` obtained from `doca_dpa_completion_get_dpa_handle` can be used in thread kernels. ``` -------------------------------- ### Configure Load Balancer Exporter for OTLP Source: https://docs.nvidia.com/doca/sdk/DOCA%2BTelemetry%2BService%2BGuide Example configuration for enabling a load balancer to run two OTLP exporter instances. Ensure required variables are present for the load balancer to start. ```ini loadbalancer-exporter-name=open_telemetry loadbalancer-mode=replication loadbalancer-0-open-telemetry-receiver=http://10.141.160.210:9502/v1/metrics loadbalancer-1-open-telemetry-receiver=http://10.141.160.211:9502/v1/metrics ``` -------------------------------- ### Build DOCA GPUNetIO Simple Receive Sample Source: https://docs.nvidia.com/doca/sdk/GPUNetIO%2BSample%2BGuide Build the DOCA GPUNetIO simple receive sample application using Meson and Ninja. Ensure the DOCA installation is available in the pkgconfig environment variable. ```bash cd /opt/mellanox/doca/samples/doca_gpunetio/gpunetio_simple_receive meson build ninja -C build ``` -------------------------------- ### Initialize Application Instance Source: https://docs.nvidia.com/doca/sdk/DOCA%2BStorage%2BComch%2Bto%2BRDMA%2BZero%2BCopy%2BApplication%2BGuide Create the application instance using parsed CLI arguments. ```cpp zero_copy_app app{parse_cli_args(argc, argv)}; ``` -------------------------------- ### DPA Notification Completion Management Source: https://docs.nvidia.com/doca/sdk/DOCA%2BDPA APIs for creating, destroying, getting the attached DPA Thread, starting, stopping, and retrieving the DPA handle for DPA Notification Completions, used for thread activation. ```APIDOC ## DPA Notification Completion Management ### Description APIs for managing DPA Notification Completions, a mechanism for one DPA thread to trigger another DPA Thread without receiving a completion. ### Create DPA Notification Completion ```c doca_error_t doca_dpa_notification_completion_create(struct doca_dpa *dpa, struct doca_dpa_thread *dpa_thread, struct doca_dpa_notification_completion **notify_comp) ``` ### Destroy DPA Notification Completion ```c doca_error_t doca_dpa_notification_completion_destroy(struct doca_dpa_notification_completion *notify_comp) ``` ### Get Attached DPA Thread ```c doca_error_t doca_dpa_notification_completion_get_thread(struct doca_dpa_notification_completion *notify_comp, struct doca_dpa_thread **dpa_thread) ``` ### Start DPA Notification Completion ```c doca_error_t doca_dpa_notification_completion_start(struct doca_dpa_notification_completion *notify_comp) ``` ### Stop DPA Notification Completion ```c doca_error_t doca_dpa_notification_completion_stop(struct doca_dpa_notification_completion *notify_comp) ``` ### Get DPA Handle ```c doca_error_t doca_dpa_notify_completion_get_dpa_handle(struct doca_dpa_notification_completion *notify_comp, doca_dpa_dev_notification_completion_t *comp_handle) ``` ### Parameters #### `doca_dpa_notification_completion_create` - **dpa** (struct doca_dpa *) - Pointer to the DPA device. - **dpa_thread** (struct doca_dpa_thread *) - Pointer to the DPA Thread to attach the notification completion to. - **notify_comp** (struct doca_dpa_notification_completion **) - Output parameter for the created notification completion object. #### `doca_dpa_notification_completion_destroy` - **notify_comp** (struct doca_dpa_notification_completion *) - Pointer to the notification completion object to destroy. #### `doca_dpa_notification_completion_get_thread` - **notify_comp** (struct doca_dpa_notification_completion *) - Pointer to the notification completion object. - **dpa_thread** (struct doca_dpa_thread **) - Output parameter for the attached DPA Thread. #### `doca_dpa_notification_completion_start` - **notify_comp** (struct doca_dpa_notification_completion *) - Pointer to the notification completion object to start. #### `doca_dpa_notification_completion_stop` - **notify_comp** (struct doca_dpa_notification_completion *) - Pointer to the notification completion object to stop. #### `doca_dpa_notify_completion_get_dpa_handle` - **notify_comp** (struct doca_dpa_notification_completion *) - Pointer to the notification completion object. - **comp_handle** (doca_dpa_dev_notification_completion_t *) - Output parameter for the DPA handle. ### Notes - Attaching DPA Notification Completion to a DPA Thread is done using the `dpa_thread` parameter during creation. - The `comp_handle` obtained from `doca_dpa_notify_completion_get_dpa_handle` can be used in thread kernels. ### Example (Host-side Pseudo Code) ```c extern doca_dpa_func_t hello_kernel; // create DPA thread doc a_dpa_thread_create(&dpa_thread); // set thread kernel doc a_dpa_thread_set_func_arg(dpa_thread, &hello_kernel, func_arg); // start thread doc a_dpa_thread_start(dpa_thread); // create and start DPA notification completion doc a_dpa_notification_completion_create(dpa, dpa_thread, ¬ify_comp); doc a_dpa_notification_completion_start(notify_comp); // get its DPA handle doc a_dpa_notification_completion_get_dpa_handle(notify_comp, ¬ify_comp_handle); // run thread only after both thread is started and attached notification completion is started doc a_dpa_thread_run(dpa_thread); ``` ``` -------------------------------- ### Retrieve QoS Configuration Source: https://docs.nvidia.com/doca/sdk/Ethernet%2BQoS Example output showing the current QoS settings for a specified interface. ```bash ofed_scripts/utils/mlnx_qos -i ens1f0 ``` -------------------------------- ### Dockerfile Example for Virtio-fs Source: https://docs.nvidia.com/doca/sdk/DOCA%2BSNAP%2BVirtio-fs%2BService%2BGuide This Dockerfile defines the build environment for Virtio-fs, including installing dependencies, copying SPDK sources, and building the fsdev passthru module. It then sets up the final image with the necessary libraries and environment variables. ```dockerfile FROM nvcr.io/nvstaging/doca/doca_vfs:1.2.0-2-doca2.10.0 as builder RUN apt-get update && apt-get install -y autoconf libtool python3-pyelftools libaio-dev libncurses-dev libfuse3-dev patchelf libcmocka-dev make COPY spdk/test/external_code /external_code WORKDIR /external_code ENV SPDK_HEADER_DIR=/opt/nvidia/spdk-subsystem/virtiofs/include ENV SPDK_LIB_DIR=/opt/nvidia/spdk-subsystem/virtiofs/lib ENV DPDK_LIB_DIR=/opt/nvidia/spdk-subsystem/virtiofs/include RUN make fsdev_passthru_shared FROM nvcr.io/nvstaging/doca/doca_vfs:1.2.0-2-doca2.10.0 COPY --from=builder /external_code/fsdev_passthru/libfsdev_passthru_external.so /opt/nvidia/spdk-subsystem/virtiofs/lib/ ENV VIRTIOFS_LD_PRELOAD=/opt/nvidia/spdk-subsystem/virtiofs/lib/libfsdev_passthru_external.so COPY --from=builder /external_code/fsdev_passthru/fsdev_passthru.py /usr/lib/python3/dist-packages/spdk/rpc/ ENV SPDK_RPC_PLUGIN="spdk.rpc.rpc_virtio_fs_tgt:spdk.rpc.fsdev_passthru" ``` -------------------------------- ### Retrieve DOCA Telemetry PCI Management Information Source: https://docs.nvidia.com/doca/sdk/DOCA%2BTelemetry%2BPCI This example shows how to create, start, read, and clean up a DOCA Telemetry PCI context to retrieve management information. Ensure the device supports the capability and check sub-capabilities if specific fields are required. ```c doca_error_t result; // Check for Ability to read management info result = doca_telemetry_pci_cap_management_info_is_supported(devinfo); if(result != DOCA_SUCCESS) // Capability is not supported or an error occoured, stop // Check any sub capabilities if you require those fields // Create PCI telemetry struct doca_telemetry_pci *pci_telem; result = doca_telemetry_pci_create(dev, &pci_telem); if(result != DOCA_SUCCESS) // Handle failure to create telemetry instance // Start PCI telemetry result = doca_telemetry_pci_start(pci_telem); if(result != DOCA_SUCCESS) // Handle failure to start telemetry instance // Read management info struct doca_telemetry_pci_dpn dpn = {0, 0, 0}; struct doca_telemetry_pci_management_info management_info = {}; result = doca_telemetry_pci_read_management_info(pci_telem, dpn, &management_info); if(result != DOCA_SUCCESS) // Handle failure to read data // Use the data // Cleanup doca_telemetry_pci_stop(pci_telem); doca_telemetry_pci_destroy(pci_telem); ``` -------------------------------- ### Build and Install SNAP Sources Source: https://docs.nvidia.com/doca/sdk/SNAP-4%2BService%2BDeployment Commands to navigate to the source directory, configure the build, compile, and install the SNAP binaries. ```bash cd /opt/nvidia/nvda_snap/src/ ``` ```bash meson setup /tmp/build -Denable-spdk-compat=true ``` ```bash meson compile -C /tmp/build ``` ```bash meson install -C /tmp/build ```