DOCA Management workflows
Where to start: The verbs run install → configure → build → modify → run → test → debug → use. Skip ahead only when the user
is already past a verb. The ## modify verb is HIGH STAKES
because the management plane writes device-level state; the
agent walks the apply-with-rollback workflow there even when the
write looks trivial. The ## test verb is an iterative loop
(symbol-presence → cap-supported → pre-state capture → write →
re-query → loop back if the diff is unexpected), not a one-shot
pass — see the eval-loop overlay in ## test below.
Read this file when the loader sent you here from
SKILL.md. For the underlying object model, version
compatibility, error taxonomy, observability surface, and safety
policy that these workflows assume, see
CAPABILITIES.md. For where to find docs, the
installed DOCA layout, or release notes, route through
doca-public-knowledge-map.
Each verb below describes the shape of the workflow, not a copy-paste recipe. The agent's job is to walk the user through the steps in order, verifying preconditions before recommending the next call.
install
Goal: confirm the user's installed DOCA actually ships
doca-mgmt and the host kernel exposes the underlying fwctl
path before any management-plane work begins.
This skill does not own DOCA installation; that path lives
in doca-setup. The
management-specific preconditions the agent verifies after a
DOCA install:
doca-mgmt.pcfile is present.pkg-config --modversion doca-mgmtresolves and reports a semver matchingdoca_caps --version. If it does not resolve, the installed DOCA package set does not include doca-mgmt; the user needs to install the matching package (the exact package name is platform-specific and looked up viadoca-public-knowledge-map ## Layout of an installed DOCA package).- Supporting
.pcfiles are present. doca-mgmt requiresdoca-common. Bothpkg-config --modversionresults must agree on the same DOCA semver per the four-way match indoca-version CAPABILITIES.md ## Version compatibility. - Installed headers expose the symbols. Check the public
header set (
doca_mgmt.h,doca_mgmt_device_caps_general.h,doca_mgmt_cc_global_status.h,doca_mgmt_diagnostics_data.h,doca_mgmt_icm_quota.h) resolves under the installed DOCA infrastructure include tree. If the.pcresolves but the headers are missing, the install is partial. fwctlis available on the host kernel. doca-mgmt's raw-command path issuesfwctlioctls; the host kernel must expose the matching character device. The agent does not name a specific kernel version from memory; route todoca-setup TASKS.md ## debuglayer 5 (driver) forfwctl-side checks. ADOCA_ERROR_OPERATING_SYSTEMfromdoca_mgmt_raw_cmdon a freshly-installed system is almost always this gate.- User privileges. Most management-plane operations
require root or an equivalent device-administration
capability. Confirm the user can either run as root or has
been granted the necessary
cap_*capabilities on the binary before any write is attempted.
If any precondition fails, stop and route to
doca-setup for the install /
kernel side or to the operator's privilege-management process
for the privilege side; a doca-mgmt-layer diagnosis against a
half-installed system wastes the user's time.
configure
Goal: bring up the management context (and optionally a representor context) and reach the state where capability queries and / or sub-domain operations can run.
Steps the agent should walk the user through:
- Confirm the installed DOCA version. Use the procedure in
doca-version CAPABILITIES.md ## Version compatibility. Quote the version observed (pkg-config --modversion doca-mgmt, thendoca_caps --version); do not assume "latest". Surface that everydoca_mgmt_*symbol the agent recommends isEXPERIMENTALperCAPABILITIES.md ## Version compatibility. - Open the device. Use the standard
doca_devdiscovery path (looked up viadoca-public-knowledge-mapwhen the user is unfamiliar with it) to obtain adoca_dev*for the target BlueField / ConnectX. - Create the management device context. Call
doca_mgmt_dev_ctx_create(dev, &dev_ctx). The lifetime ofdev_ctxis bound to the lifetime ofdev; destroydev_ctxfirst, then close the device. - (Optional) Create the representor context. If the user
wants to operate on a VF / function-level surface, obtain a
doca_dev_rep*and calldoca_mgmt_dev_rep_ctx_create(dev_ctx, rep, &rep_ctx). If the VF's kernel-side representor is not exposed but the PCI address is known, usedoca_mgmt_dev_rep_ctx_create_by_pci_addr(dev_ctx, "0000:3a:00.2", &rep_ctx)with the documented HEXDomain:Bus:Device.Functionformat. - Probe sub-domain support. Before any sub-domain
_setor_modify, call the sub-domain's capability gate:doca_mgmt_cap_icm_quota_is_supported(dev_ctx)for icm-quota;doca_mgmt_cap_diagnostics_data_multi_domain_is_supported(dev_ctx)for the multi-domain diagnostics data; for caps-general and cc-global-status, attempt a_getagainst a transient handle and treatDOCA_ERROR_NOT_SUPPORTEDas the not-supported signal. - Sanity check before any write. Confirm with the user: which device, which representor (if any), which sub-domain, which fields. If any of those are unclear, stop and ask — do not invent.
If any step fails with a DOCA_ERROR_*, route through the
error taxonomy in
CAPABILITIES.md ## Error taxonomy
before retrying.
build
Goal: produce a binary that links DOCA Management against the user's installed DOCA, using the canonical cross-library build pattern.
The build pattern for any DOCA C/C++ consumer is identical
across libraries — pkg-config for include + link flags, meson
or CMake as the build system — and is fully documented in
doca-programming-guide TASKS.md ## build.
This skill carries only the mgmt-specific overlay:
| Slot | Value for doca-mgmt | Why it matters |
|---|---|---|
pkg-config module name |
doca-mgmt |
The library's .pc file installed by the DOCA host packages |
| Co-required modules | doca-common |
doca-mgmt depends on Core / Common |
| Header check | The public mgmt header set (doca_mgmt.h plus the sub-domain headers) resolvable under the installed DOCA infrastructure include tree (path via doca-public-knowledge-map) |
If pkg-config --cflags doca-mgmt resolves but the headers are missing, the install is partial |
| Minimum required DOCA version | Query with pkg-config --modversion doca-mgmt; never hardcode in build files |
The EXPERIMENTAL tag means a version pin from agent memory is wrong by construction |
| Runtime privilege model | The built binary will need root or an equivalent capability set to issue management operations; ensure the deployment plan accounts for this | A binary that compiles but cannot exercise its primary surface in deployment is a productivity sink |
For non-C consumers (Rust, Go, Python), the link surface is the
same *.so files; FFI wrappers are out of scope for this skill.
modify
Goal: change device-level state through doca-mgmt — toggle a caps-general field, change a cc-global-status setting, modify diagnostics-data, set an ICM quota, or issue a raw command — in a way that preserves the operator's ability to roll back.
This verb is HIGH STAKES. The agent NEVER recommends a
doca-mgmt write without walking the apply-with-rollback workflow
below, even when the write looks trivial. The workflow is the
doca-hardware-safety change-application discipline
applied at the API surface.
Apply-with-rollback workflow (every modify pattern):
- Pre-flight inventory. Run the bundle-wide pre-flight
inventory per
doca-hardware-safety TASKS.md ## configureFIRST. The doca-mgmt-specific addendum is the sub-domain handle pre-state: create the sub-domain handle, call the matching_get/_queryagainst the target context, and record every field the upcoming_setwill touch. - Confirm capability support. Re-run the sub-domain's
capability gate from
## configurestep 5 against the actual target context. The gate may differ between device context and representor context. - Identify the scope. If the operation is a
raw_cmd, pick the narrowestenum doca_mgmt_cmd_scopeper the ladder inCAPABILITIES.md ## Capabilities and modes. If a dedicated sub-domain wrapper exists, prefer it overraw_cmd. - Name the rollback path. Before writing, write down (and
read back to the user) the exact
_set/raw_cmdcall that would revert to the captured pre-state. If the pre-state cannot be reproduced by the same surface, the change has no rollback and the agent refuses to apply it perdoca-hardware-safety ## Safety policy. - Maintenance window + OOB precondition. For any write
that could affect link state or hardware traffic — most
notably
cc_global_statusenable/disable,raw_cmdCONFIGURATIONorDEBUG_WRITE_FULLagainst a port- affecting opcode, and any change applied during live traffic — confirm with the operator the maintenance window and OOB-access classes perdoca-hardware-safety ## Capabilities and modes. - Apply on replica first. Per
doca-hardware-safety ## Capabilities and modesreplica-first rule, apply on a non-prod replica that matches the production hardware class first; run the post-write re-query gate (step 8 below) on the replica. After the intended forward diff is proven, apply the recorded rollback values to restore the replica's captured pre-state and re-run the same_get/_query. Production remains blocked until this second re-query proves the replica is back at the recorded baseline. - Apply the write. Call the sub-domain's
_set/_modify/_set_limit/raw_cmdon the target context. Quotedoca_error_get_descr()verbatim if the call returns an error; do not paraphrase. - Post-write re-query. Immediately re-run the matching
_get/_queryand diff against the pre-state. The diff should be exactly the change the user intended. Any unexpected delta is a regression; trigger the rollback path from step 4. Re-query after rollback and require an exact match to the recorded pre-state. If the rollback call fails or the re-query still differs, fail closed: stop all further writes, preserve the target identity plus pre-state, intended forward diff, post-write state, rollback call/result, and post-rollback state, then escalate to the operator's change-control / hardware-recovery path. - Hold the rollback path ready for the duration of the change window. The user does not declare the change "done" until either (a) the workload has resumed and the device's observability surface is healthy, or (b) the rollback has been applied and the re-query proves the pre-state was restored. A failed or unproven rollback is an incident, not a reason to retry or continue production rollout.
The agent emits the intent description + the apply-with-
rollback workflow filled out for the user's specific call; the
actual unified diff against any sample code the user is
modifying is produced line-by-line via the universal modify-a-
sample workflow in
doca-programming-guide TASKS.md ## modify.
run
Goal: actually execute the built binary against the user's installed DOCA on a host with a BlueField / ConnectX device, with appropriate privileges.
Steps the agent should walk the user through:
- Privilege check. Confirm the binary will run with the
privileges its management operations require (root or
equivalent
cap_*capabilities). ADOCA_ERROR_OPERATING_SYSTEMfromdoca_mgmt_raw_cmdon a non-root invocation is almost always a privilege gate. - Capture the structured log. Set
DOCA_LOG_LEVEL=tracefor the first run (seedoca-debug CAPABILITIES.md ## Observability). The doca-mgmt surface is small and quiet; the trace log is the cheapest way to see lifecycle transitions. - Run read-only operations first. Before any write, run
the binary's read-only path
(
doca_mgmt_device_caps_general_get,doca_mgmt_cc_global_status_get,doca_mgmt_diagnostics_data_query_for_dev,doca_mgmt_icm_quota_query, ordoca_mgmt_raw_cmdwithDEBUG_READ_ONLY) against the target device. The output is the baseline. - Confirm the baseline matches the operator's mental model. If the device's reported pre-state diverges from what the operator expected, stop — the discrepancy is a bug to investigate before any write. Writing onto an unexpected pre-state compounds the bug.
- Only then run writes, following the apply-with-rollback
workflow from
## modify.
test
Goal: prove the configured management surface actually returns correct data and applies writes the device honors, without disturbing live state any more than necessary.
This is a loop, not a one-shot pass. Each iteration narrows either the symbol set, the cap-supported result, the pre-state capture, the write outcome, or the post-write re-query diff. The loop terminates when either (a) the user's intended management operation flows end-to-end with the expected device-side state change, or (b) the agent has narrowed the failure cause to a layer outside doca-mgmt itself (fwctl, firmware, driver) and escalated to the matching skill.
Iteration shape:
- Symbol-presence check. Confirm every
doca_mgmt_*symbol the user's code references is exported by the installedlibdoca_mgmt.soand matched in the installed headers. Afunction not foundat link time is almost always a partial install or a wrong-version pairing perdoca-version TASKS.md ## debuglayer 2. - Capability-supported check. Re-run the sub-domain's
_is_supportedagainst the active context. If false → that's the answer; the user's device or DOCA version does not support the sub-domain. - Pre-state capture. Run the
_get/_queryfor every field the upcoming write will touch. The result is the rollback baseline. - Apply the write on a replica. Per the
doca-hardware-safetyreplica-first rule, the test environment is the replica; never the production device. Apply the write. - Post-write re-query. Run the
_get/_queryagain and diff against step 3. The diff should match the user's intent exactly. - Restore and prove the replica pre-state. Apply the
rollback values captured in step 3, then run the same
_get/_queryagain. Do not authorize production unless this re-query exactly matches the captured pre-state. On a rollback error or residual diff, stop, preserve the full forward/rollback evidence set from## modifystep 8, and escalate for operator intervention. - Negative test. Construct one deliberately invalid
call (e.g. an ICM-quota limit above
_cap_get_max_limit, or a_seton a context whose_is_supportedreturned failure) and confirm the API returnsDOCA_ERROR_INVALID_VALUE/DOCA_ERROR_NOT_SUPPORTEDas expected. This validates the agent's capability-discovery understanding is itself correct on this DOCA version. If the invalid operation unexpectedly succeeds, stop immediately: capture the exact target, sub-domain, parameters, capability result, return value, and post-operation_get/_querystate; restore the captured pre-state using the prepared rollback; re-query; and escalate the unexpected firmware/library behavior. Do not continue negative testing or promote the operation.
Eval-loop overlay — why this is a loop, not a one-shot pass:
| Iteration trigger | What it looks like | What changes next iteration |
|---|---|---|
DOCA_ERROR_NOT_SUPPORTED on a sub-domain we expected to ship |
The user's code references a sub-domain the installed DOCA does not expose | Re-confirm via the sub-domain's capability gate; the EXPERIMENTAL tag means sub-domains can be added / renamed between releases |
DOCA_ERROR_BAD_CONFIG from _set |
The handle was not populated with all required fields before _set |
Re-walk the sub-domain handle's field accessors; every field the surface requires must be set or _clear-ed before _set |
DOCA_ERROR_IN_USE on a representor _set |
The representor context is already initialized for this surface | Destroy and re-create the representor context, then retry; some surfaces are not field-mutable in place |
DOCA_ERROR_OPERATING_SYSTEM on raw_cmd |
The host-side fwctl ioctl path is not reachable |
Confirm the host kernel exposes the fwctl interface; route to doca-setup TASKS.md ## debug layer 5 |
DOCA_ERROR_IO_FAILED on raw_cmd |
The firmware rejected the command | Re-confirm the four-way version match; re-confirm the opcode against the vendor docs; if both check out, the device state is the gate — route to doca-hardware-safety TASKS.md ## debug |
| Post-write re-query diff doesn't match intent | The _set returned success; the _get shows unexpected state |
The write landed but with side effects the agent did not anticipate; rollback per ## modify step 4, then re-investigate |
Loop identity is the same error family on the same sub-domain,
target device/representor, operation, inputs, and captured
pre-state, with unchanged return descriptions, capability
results, trace logs, and post-operation query evidence. Stop
after two consecutive iterations with that identity produce no
evidence change — that means the cause is below doca-mgmt.
Escalate to
doca-debug TASKS.md ## debug
with the captured layer-1-through-5 evidence.
debug
Goal: when a DOCA Management call returns a DOCA_ERROR_*
(or a write lands but the device state diverges from the
operator's intent), narrow the cause to a specific layer and
act on it.
The cross-library debug ladder lives in
doca-debug TASKS.md ## debug.
Walk through it in order — install → version → build → link →
runtime → program → driver — before recommending
doca-mgmt-specific fixes. This skill's overlay names the
management-specific manifestation at layers 5 (runtime), 6
(program), and at the hardware-state-investigation cross-link:
Layer 5 (runtime) — doca-mgmt overlay.
- Confirm the management contexts were created in the right
order: device context first, then representor context (the
representor context's
_createrequires an existingdev_ctx). Out-of-order returnsDOCA_ERROR_INVALID_VALUE. - Confirm the user-side privilege model. A
DOCA_ERROR_OPERATING_SYSTEMis almost always either missing root or a missingcap_*set; check the binary's privileges before deeper investigation. - Confirm the
fwctlioctl path is reachable. The kernel-side check forfwctlis owned bydoca-setup; route there.
Layer 6 (program) — doca-mgmt overlay.
- Sub-domain field discipline: every
_setrequires its fields to be populated via the matching_set_<field>accessor before the apply call.DOCA_ERROR_BAD_CONFIGis the signal for an unset field. - Handle re-use: a sub-domain handle is transient; it can
be re-used across multiple operations via
_clear, but cannot be shared across threads without external synchronization. - PCI address format for
_create_by_pci_addr: the documented format is HEXDomain:Bus:Device.Function(e.g."0000:3a:00.2"). A malformed string returnsDOCA_ERROR_INVALID_VALUE.
Hardware-state investigation cross-link. When a write
returned success but the device's reported state diverges from
the intended value, OR when raw_cmd returns
DOCA_ERROR_IO_FAILED after the four-way version match and
opcode check both pass, the cause is at the
hardware/firmware layer — route to
doca-hardware-safety TASKS.md ## debug
for the change-application incident discipline. doca-mgmt's
debug overlay does NOT include the firmware-state recovery
ladder; that's the meta-policy's job.
Once the layer is identified, route to the matching debug verb
on the matching skill: install / build / link / driver to
doca-setup TASKS.md ## debug;
cross-cutting runtime to
doca-debug TASKS.md ## debug;
device-state recovery to
doca-hardware-safety TASKS.md ## debug;
program-layer Core-context patterns to
doca-programming-guide TASKS.md ## debug.
use
Goal: integrate a working doca-mgmt component into a fleet- management agent, an orchestration plugin, or a device- administration tool — and operate it against many devices over time without surprise.
The integration shape this skill teaches:
- Per-application init order. Open the device → create
doca_mgmt_dev_ctx→ optionally createdoca_mgmt_dev_rep_ctxfor representor-targeted operations → run the sub-domain capability gates → cache the result for the session. The cached cap snapshot is the baseline every future operation in the same session compares against. - Per-application teardown order. Destroy representor contexts before the device context; destroy sub-domain handles before the context they were used against; close the device last. Out-of-order destroy is the canonical leak.
- Bulk operation discipline. When the fleet agent walks
many devices, each device gets its own
doca_mgmt_dev_ctx; do NOT share a context across devices. The library is not documented as cross-device-safe and the agent does not assume it. - Per-release re-verification. Because the API surface
is EXPERIMENTAL, every DOCA upgrade requires re-running
## testend-to-end against the new install. A sub-domain that worked on DOCA X may be reshaped on DOCA Y; the agent does not assume the fleet tool survives a version bump without re-testing. - Operational handoff. Production deployment uses the
bundle's hardware-safety meta-policy
(
doca-hardware-safety) for every write. The fleet tool's change-control runbook names the maintenance window, the OOB access class, the replica-first stage, the rollback path, and the observability gate per the meta-policy. raw_cmdoperator discipline. The raw-command path is the escape valve for vendor-documented opcodes without a dedicated wrapper. The agent treats everyraw_cmdcall site as a change to the device's firmware-control surface: opcode + scope + payload reviewed; pre-state captured; rollback documented; the operation runs inside the same change-control discipline asmlxconfigwrites.
Deferred task verbs
The following verbs are out of scope for this skill but are commonly asked in the same conversations. Route them as follows so the agent does not invent guidance:
- install (of DOCA itself). Installing DOCA, choosing
packages, post-install verification,
pkg-configwiring — defer todoca-setupand to the install-tree layout indoca-public-knowledge-map ## Layout of an installed DOCA package. This skill's## installverb assumes DOCA is already installed and only checks the mgmt-specific preconditions. - deploy. Deploying fleet-management agents at scale across
many hosts and BlueFields, Kubernetes operator workflows,
multi-tenant isolation — out of scope and reserved for a
future platform skill. For single-host first-run testing,
the right verb is
## run. - rollback (fleet-wide). Coordinated rollback of
doca-mgmt-applied changes across many devices is fleet-tool
operator workflow, not a doca-mgmt API concern; the API
surface for per-device rollback is the same
_set/_modify/raw_cmdused for the original write, called with the pre-state captured per## modify. The cross-cuttingdoca-hardware-safetymeta-policy owns the discipline. - mlxconfig direct operation. Some configuration spaces are
reachable both via doca-mgmt and via
mlxconfig; the latter is outside this skill's surface and routes throughdoca-hardware-safetyfor the change-application discipline. - Firmware burn / BFB reflash. Out of scope. Route to
doca-hardware-safetyfor the meta-policy and to the public firmware-tooling documentation reachable throughdoca-public-knowledge-map.
Command appendix
Every command below is cross-cutting on DOCA Management — it answers a recurring class of question that comes up in the verbs above. The agent should treat the class as load-bearing; the worked example is a single instance.
Infra-aware preamble (every row below). Per the bundle's
detect → prefer → fall back → report contract documented in
doca-structured-tools-contract ## The agent behavior contract,
the agent probes for the matching structured helper FIRST
(doca-env --json for version + devices + libraries +
drivers; doca-capability-snapshot for per-device capability
flags; version-matrix.json for "available since" lookups).
If the probe succeeds, the structured tool's output is the
authoritative answer. If the probe fails, fall back to the
manual command in the row.
| Command (worked example) | Owning step | Class of question it answers | What healthy output looks like |
|---|---|---|---|
pkg-config --modversion doca-mgmt |
## install step 1; ## configure step 1 |
What is the build-time DOCA Management version? | A semver matching doca_caps --version. Disagreement = partial install; route to doca-version TASKS.md ## debug layer 2 |
pkg-config --modversion doca-common doca-mgmt |
## install step 2 |
Do both .pc files agree on the same DOCA semver? |
A single semver repeated twice. Any disagreement is the partial-install pattern |
pkg-config --cflags --libs doca-mgmt |
## build |
What include + link flags does the linker need? | Includes resolve under whichever include directory pkg-config --cflags reports on this install (do not hardcode the path); libs include -ldoca_mgmt -ldoca_common |
doca_caps --list-devs |
## configure step 2 |
Which devices on this host can be used as a doca_dev for management operations? |
One row per visible device with PCIe address and capability flags |
doca_caps --version |
## install step 1 |
What is the runtime DOCA version on this host? | A semver matching pkg-config --modversion doca-mgmt |
cat /opt/mellanox/doca/applications/VERSION |
## install step 1; ## debug layer 1 |
What does the install tree itself claim its version is? | A semver matching the other version sources |
id -u and getcap <binary> |
## run step 1 |
Does the user / binary have the privileges management operations require? | 0 for root invocation, or a capability set that includes the device-administration cap_* the operation requires |
ls /dev/fwctl* |
## install step 4 |
Is the host kernel exposing the fwctl character device doca-mgmt's raw command path uses? |
One or more /dev/fwctl* character devices visible to root |
DOCA_LOG_LEVEL=trace ./<binary> |
## run step 2 |
What did the structured DOCA logger emit for the first failing call? | A trace-level line on every lifecycle transition and every management-plane call |
| `dmesg | tail -n 40` (sudo) | ## debug layer 7 |
What did the kernel / driver / firmware log around the last mgmt call? |
| `mlxconfig -d <pcie> q | head -n 40` (sudo) | ## debug layer 7 |
What firmware-stored config does the NIC / DPU report? |
For commands shared across libraries (pkg-config --modversion,
doca_caps, cat /opt/mellanox/doca/applications/VERSION,
DOCA_LOG_LEVEL) the cross-library overlay is in
doca-debug TASKS.md ## Command appendix;
this table adds the mgmt-specific rows on top.