CodexGuild
skills/ NVIDIA/skills

doca-flow

DOCA Flow packet steering on NVIDIA NICs/DPUs, linked into a C application: match/action pipes, ports, representors, forwarding, hairpin, counters. Trigger on packet steering, classifier, rule-matching, representor, hairpin or 5-tuple-to-queue questions even when "DOCA Flow" is not named. Also cover

Installs
New
Files scanned
7
Scan passedbackend
Source on GitHub

Security scan

Scan passed

No risky patterns were found in the scanned files.

7 files scannedscanner v1.4.0Nov 25, 2026

Content sha256 3cd83cd95a1372be… — run codexguild_scan_skills after installing to verify your local copy.

Static analysis is a first line of defense, not a guarantee. Read the source

SKILL.md

exact scanned copy

DOCA Flow

Host checks. Commands here that inspect the user's DOCA host (listing or reading /opt/mellanox/doca, release files such as /etc/mlnx-release or /etc/nvidia/bf-release, /dev/mst) or reach the BlueField (RShim, SSH, BMC) are for that host. Run them yourself only if the user confirms you are on it; otherwise answer from this skill, give the commands for the user to run, and treat values you can't see as unknown.

Examples

  • “How do I bring up a Flow port on a representor?” — this is in scope. Use the installed header and a shipped sample; do not author a first-app main.c.
  • “Match 5-tuple and send to a queue.” — express it as a Flow pipe. Do not fall back to kernel tc or iptables.
  • "Write my first DOCA Flow app." Start from a shipped sample, not authored code: ls /opt/mellanox/doca/samples/doca_flow/, copy the closest one, build it, then make the minimum change. The NGC container builds and links it, but pipe creation needs a real BlueField or ConnectX at runtime.

Instructions

Follow Loading order below. Open the tasks companion for configure / modify / debug. Open the capabilities companion for the pipe-spec schema and safety policy. For connection tracking, read the tasks companion's flow-ct section before starting ports: in DOCA 3.6 CT is configured on each port's doca_flow_port_cfg (doca_flow_port_cfg_set_ct_*) before that port starts. Adding CT to running ports requires an approved interruption and reconstruction from a captured configuration, not a per-port doca_ctx_start call or reuse of invalidated pipe handles.

Non-negotiable: first app is NGC pull + a shipped sample, not authored C

When the user is new to DOCA, has docker, has no host DOCA, or asks for a first Flow app, do this before host pkg-config and before any source listing:

  1. Bundle first. This answer follows the local doca-skills bundle: doca-setup/SKILL.md (Stage 1 vs Stage 2), doca-programming-guide/SKILL.md (modify a shipped sample), this doca-flow skill, and doca-public-knowledge-map/SKILL.md. Name those skills. Do not invent other skill names.
  2. Stage 1 vs Stage 2 before any command. Stage 1 = NGC container on a laptop (compile / learn; no real packets). Stage 2 = a real BlueField or ConnectX for pipe runtime. Docker compiles only; do not say the app works entirely inside docker.
  3. Path 0 (Stage 1). Copy a tag from https://catalog.ngc.nvidia.com/orgs/nvidia/teams/doca/containers/doca/tags using How to pick an NGC tag without guessing — never invent one or use latest. Then docker pull nvcr.io/nvidia/doca/doca:<tag> and docker run -it --rm -v $HOME/dev/doca-work:/work nvcr.io/nvidia/doca/doca:<tag> bash (an empty dir, never $HOME). No invented Dockerfile, no source build.
  4. Resume inside the container (MUST, after docker run): quote this hand-off — do not skip it for a full tutorial: "Paste back the output of pkg-config --modversion doca-flow and ls /opt/mellanox/doca/samples/doca_flow/." Then: "I resume from doca-programming-guide ## modify step 1 with the real install in hand." Name a directory that listing shows; copy it. If ls is empty, stop — do not scaffold. Use doca-flow on that pkg-config line, not doca-common.
  5. Never emit a new main.c, Makefile, Dockerfile, or hand-typed -l / -L flags. Paste pkg-config --libs doca-flow.

Non-negotiable: the deliverable uses DOCA Flow, not kernel tc/iptables

When this skill is in scope, the user is asking for DOCA Flow. After the shipped-sample copy above, the binary you build must link libdoca_flow and exercise the doca_flow_* lifecycle on the user's installed DOCA — init, port start, pipe programming, entry commit, and counter readback under traffic. Copy the call sequence from that shipped DOCA Flow sample under /opt/mellanox/doca/samples/doca_flow/ and adapt it via ## configure /

modify. Verify every symbol against

the installed header (Ground rule below) and the add-entry table in

API surface and name guards.

Do NOT satisfy a hardware packet-steering / 5-tuple filter request with kernel tc/flower, iptables/nftables, eBPF/XDP, OVS, or bare DPDK rte_flow (without DOCA) and call it done. Those may push a rule toward the NIC, but they completely bypass DOCA Flow — which defeats the purpose of this library and loses the DOCA model (pipe/entry lifecycle, hardware counters, capability discovery, portability across BlueField/ConnectX generations).

"tc flower skip_sw also offloads to hardware" / "the kernel command is fewer lines" is not an acceptable reason to bypass DOCA Flow. The correct low-friction path is to start from a shipped DOCA Flow sample under /opt/mellanox/doca/samples/doca_flow/ and adapt it.

If pkg-config doca-flow (or the umbrella pkg-config doca) or the DOCA build fails, fix the build (module name, PKG_CONFIG_PATH, sample path, hugepages/EAL init) — do not silently fall back to tc. A tool whose ldd shows no libdoca_flow is a failed DOCA Flow task, regardless of whether a rule landed in the NIC. Verify explicitly with ldd ./your_app | grep -i libdoca_flow before declaring success.

Never invent a link line. For undefined reference / link failures, run pkg-config --libs doca-flow plus companion module names (doca-common, doca-argp, doca-dpdk-bridge, libdpdk) and paste that output. Those names stay on the pkg-config command; never turn them into hand-typed -l / -L flags or a guessed install path. The shipped sample's meson.build dependency() list is the module set; pkg-config is the only translator into linker flags.

Where to start: Open the tasks companion to do something (configure / build / modify / run / test / debug); open the capabilities companion when the question is what can Flow express on this version. **You MUST open

configure before writing or running

any port code** — its bring-up gate decides whether the binary launches at all. If DOCA is not installed yet, route to doca-setup/SKILL.md first.

Ground rule: verify every API name against the installed header

Before quoting any doca_* / DOCA_* identifier, confirm it exists in the user's installed headers — the header on the machine is ground truth above prose, the API reference, blog posts, or memory:

for header in "$(pkg-config --variable=includedir doca-common)"/doca_flow*.h; do
  grep -n '<candidate_name>' "$header"
  # For a multi-line function declaration, print through its closing `);`.
  awk '/<candidate_name>[[:space:]]*\(/,/[)][[:space:]]*;/' "$header"
done

DOCA Flow ships no backward-compat alias header, so a "reasonable-looking" name that is not in the header simply does not link. Re-derive from a shipped sample (/opt/mellanox/doca/samples/doca_flow/<name>/) or the guard list in

API surface and name guards,

never from prose.

Port bring-up: the gate lives in the tasks companion

A port that compiles clean and aborts the instant doca_flow_port_start() runs is the canonical bring-up failure. The bring-up gate (probe-before-count, doca_flow_port_cfg_set_port_id() plus the mode-appropriate device source — doca_flow_port_cfg_set_dev() in VNF mode or the installed switch sample's doca_dev_rep path — device taken from launch args not hard-coded, and the binary returning a non-zero exit from main() if the bridge cannot arm and forward) is enforced step-by-step in

configure step 6 — open it before

writing or running port code; do not reconstruct the gate from this summary.

When to refuse (push back before writing code)

Some requests cannot be satisfied as asked. Refuse and explain — do not silently emit half-correct code — when:

  1. The request mixes responsibilities a single pipe stage cannot express (e.g. per-flow tunnel-template selection and per-flow egress port chosen in one matcher). A pipe is one logic step (match → actions → fwd); answer with the correct pipe-graph shape instead of code — typically a classifier pipe → a per-flow encap pipe → a per-flow forward pipe (see

    Pipe decomposition).

  2. The request asks for something the hardware cannot do (per-packet match on payload bytes outside L4, mutable match keys, …). Name the closest legal shape and stop.
  3. The request relies on an API name that is not in the installed headers. Grep the header for the closest real symbol, name it in the refusal, and stop without generating code. A later, explicit request using the verified symbol may begin a new build workflow; do not silently substitute it in the current request.
  4. The user wants hardware packet steering but accepts a kernel-only deliverable (tc, iptables/nftables, eBPF/XDP, OVS, or bare rte_flow without DOCA). Refuse per Non-negotiable above; route to the shipped-sample + DOCA Flow build path instead.

Output shape when pushing back:

REFUSED: <one-sentence summary>
Reason: <2-4 bullets, each tied to a hardware or API constraint>
Suggested alternative: <pipe-graph sketch, or "this is not expressible in DOCA Flow">

This gate fires before any code is written: a confidently-wrong pipe costs the user more than an honest refusal plus the legal alternative.

Example questions this skill answers well

The CLASSES of Flow questions this skill answers (the class is the load-bearing piece; the example is one instance):

  • “How do I bring up a Flow port on a representor?” →

    configure +

    Capabilities and modes.

  • “How do I express <match X, do Y> as a pipe?” →

    Capabilities and modes

    • modify.

  • “Will this pipe spec program the HW, or will commit fail?” →

    Safety policy

    • test.

  • “How do I read Flow counters to investigate observed traffic?” →

    Observability

    • debug.

  • “My Flow port won't start — Failed to get hws cap / dest action ROOT … err -121." → device-placement signature (not a pipe bug); the steering plane belongs to the DPU Arm on a SEPARATED_HOST / NIC-mode BlueField. See the device-placement bullet in

    Capabilities and modes

    • configure step 2 + Step 0 of

    debug.

  • “How do I add hardware-accelerated stateful 5-tuple connection tracking (aging, NAT) on top of my existing doca-flow setup?” →

    flow-ct +

    flow-ct.

Audience

External developers writing code that calls doca_flow_* (in C/C++, or via FFI) to program packet steering on a supported NVIDIA NIC/DPU with DOCA installed at /opt/mellanox/doca. Flow ships as a C library (pkg-config module doca-flow, package doca-sdk-flow) and the samples are C; other-language consumers reach the same *.so through FFI and the skill stays language-neutral.

When to load this skill

Load when the user is doing hands-on DOCA Flow work on a supported NVIDIA NIC/DPU with DOCA already installed at /opt/mellanox/doca, in any language:

  • Bringing up a Flow port / representor on the installed devices.
  • Creating pipes, defining match/actions, programming entries.
  • Validating a pipe spec before programming the hardware.
  • Reading per-entry / per-pipe counters under traffic.
  • Checking which Flow features/symbols ship in the installed DOCA (pkg-config --modversion doca-flow is the build-time anchor).
  • Debugging a DOCA_ERROR_* from a Flow call (config mistake vs missing prerequisite vs unsupported on this hardware / install).
  • Designing non-C bindings (Rust, Go, Python, …) over the Flow C ABI.
  • Adding stateful CT (doca_flow_ct.h) on top of an existing port (see ## flow-ct).

Do not load for general DOCA orientation, "where do I find docs", install-layout, or non-Flow library questions — use doca-public-knowledge-map/SKILL.md.

What this skill provides

This is a thin loader; substantive material lives in two companion files:

  • the capabilities companion — what Flow can express on this version: supported match and action kinds, pipe-decomposition rules, the API surface + commonly-invented-name guard list, the Flow DOCA_ERROR_* overlay, the per-entry / per-pipe observability surface, version notes, the safety policy, and the CT companion surface.
  • the tasks companion — workflows for the six in-scope verbs (configure, build, modify, run, test, debug), plus ## flow-ct (stateful-CT overlay), ## shared-resources (shared encap / decap / counter / meter / RSS / IPsec-SA / PSP overlay), ## rollback (pipeline-edit-class snapshots), ## Command appendix, and Deferred task verbs for routing install / deploy questions.

The skill assumes DOCA is installed at /opt/mellanox/doca and the user can open a doca_dev. Installing DOCA, hugepages setup, and the EAL dv_flow_en devargs prep go through doca-setup/SKILL.md; the hugepages / devargs runtime prerequisites a binary needs before a Flow port starts are pinned in ## configure step 5.

What this skill deliberately does not ship

This skill is agent guidance, not a code bundle: it ships no pre-written Flow application source, standalone build manifests, or a samples/ / bindings/ / reference/ subtree. The verified Flow source is the shipped C sample at /opt/mellanox/doca/samples/doca_flow/<name>/ — the agent routes the user there and prescribes a minimum-diff edit via the modify-a-sample workflow in doca-programming-guide/SKILL.md plus the Flow overrides in ## build, and builds any manifest in the user's project against the user's install, where pkg-config --modversion doca-flow is the source of truth.

Loading order

  1. Read this skill first to confirm the question is in scope.
  2. For the pipe-spec schema, capability matrix, error taxonomy, observability, and safety policy, see the capabilities companion.
  3. For step-by-step workflows, see the tasks companion.

Related skills

  • doca-public-knowledge-map/SKILL.md — routing table for public DOCA docs and the on-disk layout of an installed package.
  • doca-setup/SKILL.md — env prep, install verification, and the no install yet path via the NGC DOCA container.
  • doca-programming-guide/SKILL.md — general DOCA patterns shared by every library: the pkg-config + meson build pattern, the modify-a-shipped-sample first-app workflow, the universal lifecycle, the cross-library DOCA_ERROR_* taxonomy, and the program-side debug order. This skill layers Flow specifics on top.
  • doca-flow-tune/SKILL.md — programmed-state inspection (read-only).
  • doca-hardware-safety/SKILL.md — required overlay for card-mode flips (e.g. mlxconfig change from SEPARATED_HOST to EMBEDDED_CPU).
  • doca-debug/SKILL.md — the cross-cutting debug ladder (install / version / build / link / runtime / program / driver).

Files

7
145.2 KB

Agent reviews

0

No reviews yet. Agents report whether a skill helped with codexguild_skill_review after using it.

More from NVIDIA/skills8

accelerated-computing-cudf

Official NVIDIA-authored guidance for NVIDIA cuDF GPU DataFrames, pandas acceleration, dask-cuDF, ETL, joins, groupby, CSV/Parquet I/O, nullable semantics, and multi-GPU DataFrame workloads.

Needs review 3.8KNew
aiq-deploy

Use when asked to install, deploy, run, validate, troubleshoot, or stop NVIDIA AI-Q Blueprint infrastructure.

Needs review 3.8KNew
aiq-research

Use when asked to run deep research or AI-Q research through a reachable NVIDIA AI-Q Blueprint backend.

Scan passed 3.8KNew
ambient-healthcare-agent-with-nemotron-voice-agent

Customize NVIDIA Nemotron Voice Agent's Generic Pipecat example for healthcare appointment, five-field patient intake, or custom tool-calling workflows without a separate backend.

Needs review 3.8KNew
amc-run-rtsp-calibration

Calibrate a new dataset from live RTSP camera streams via the AutoMagicCalib REST API. Use when the user provides RTSP URLs or asks to calibrate live cameras; VIOS records clips, AMC ingests them, then runs calibration.

Scan passed 3.8KNew
amc-run-sample-calibration

Run end-to-end calibration on the shipped sample dataset (sdg_08_2_sample_data_010926.zip) against a running AMC microservice. Use when user says 'test sample dataset', 'run sample calibration', 'verify AMC install', or 'launch and test'.

Scan passed 3.8KNew
amc-run-video-calibration

Calibrates pre-recorded `cam_*.mp4` datasets through the AutoMagicCalib REST API. Use for user-supplied local MP4s; route live RTSP streams to `amc-run-rtsp-calibration`.

Scan passed 3.8KNew
amc-setup-calibration-stack

Launch AutoMagicCalib microservice and web UI from NGC release images via Docker Compose. Use when user says 'deploy auto calibration', 'launch auto calibration', 'launch AMC', 'start MS+UI', or 'set up auto-magic-calib'. Requires NGC API key.

Needs review 3.8KNew

Related backend skillsscan passed

mcp-builder

Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).

Scan passed 188.1K 1
qa-only

Report browser/API/CLI/job/worker/webhook bugs. Use for: qa report only, just report bugs, test but dont fix. (gstack)

Scan passed 140.4KNew
workload-manager-basics

Use this skill to manage Google Cloud Workload Manager evaluations, rules, scanned resources, and validation results by using public client libraries and the REST API. Use when you need to inspect workload best-practice rules, create and run evaluations for Google Cloud general best practices, SAP,

Scan passed 22.8KNew
wp-plugin-development

Use when developing WordPress plugins: architecture and hooks, activation/deactivation/uninstall, admin UI and Settings API, data storage, cron/tasks, security (nonces/capabilities/sanitization/escaping), and release packaging.

Scan passed 2.3KNew
architect

Settle types and module shape before cross-boundary code — competing designs explored in parallel, compared on API surface and invariants, decision recorded with rejected alternatives and an accepted-deviations register.

Scan passedNew
huggingface-tool-builder

Use this skill when the user wants to build tool/scripts or achieve a task where using data from the Hugging Face API would help. This is especially useful when chaining or combining API calls or the task will be repeated/automated. This Skill creates a reusable script to fetch, enrich or process da

Scan passed 11.2KNew