Networking DOCA SDK Documentation

DOCA Memos Initiator

Introduction

The NVIDIA DOCA™ Memos Initiator provides the initiator-side C API of the DOCA Memos stack. Memos Initiator and Memos Target are delivered and used as paired components. Applications connect to Memos Targets, discover Memos namespaces, compose logical Memos volumes, and submit asynchronous STORE, RETRIEVE, and EXIST tasks. For an overview of the DOCA Memos libraries and how they work together, see DOCA Memos.

This guide describes the supported Memos Initiator–Memos Target configuration. It does not describe a generic Key/Value client, and interoperability with arbitrary third-party Key/Value targets is not supported.

The public interfaces are marked DOCA_EXPERIMENTAL. Use the headers and programming guide that match the installed SDK. For library quality levels, see DOCA Libraries.

Prerequisites

Before using this library, understand the execution model, devices, progress engines, tasks, buffers, and memory maps described in DOCA Core. Install the SDK development packages for the intended release; see DOCA Installation Guide for Linux.

You need the following:

  • A DOCA device that the Memos Initiator capability queries report as supported.

  • A reachable Memos Target from a compatible Memos release that exposes the namespaces your application uses.

  • A management thread for each logical Initiator device and an execution arrangement that continuously progresses all configured I/O contexts.

  • Application-managed DOCA buffers and memory maps suitable for the registered data-path devices. Buffer registration, access permissions, and lifetime must remain valid throughout outstanding operations.

  • Matching tenant configuration and, when encryption is enabled, securely provisioned encryption keys.

For exhaustive signatures and return values, see DOCA API References.

Environment

The DPU integration runs on NVIDIA® BlueField®. Select data-path devices through DOCA device discovery and check support before initializing the library. Do not infer support from a PCI address or a platform name alone. Service container versions, BlueField bootstream (BFB) and firmware requirements, hugepage reservations, and qualified platform combinations are specified by the applicable deployment documentation, not by this library API.

Device Support

Query

Purpose

doca_memos_initiator_cap_is_supported()

Check whether a device can support Initiator operation.

doca_memos_initiator_cap_is_adrfam_supported()

Check address-family support. Memos Initiator supports IPv4 and IPv6.

doca_memos_initiator_cap_is_volume_ek_size_supported()

Check an encryption-key size for each data-path device before creating an encrypted volume.

Check both the query return code and the returned support flag. Capability support is not a substitute for release-specific end-to-end validation.

Architecture and Programming Model

This section describes the Memos Initiator objects and their threading and concurrency rules.

Objects

Object

Role

Ownership and Scope

doca_dev

Opened hardware (data-path) device registered with the library.

Application-owned; keep open until library resources using it have been torn down and it is deregistered.

doca_memos_initiator_dev

Logical management context for targets, namespace views, and volumes.

DOCA context; managed by one application thread.

doca_memos_initiator_dev_io

Submits Key/Value tasks against volumes belonging to its logical device.

DOCA context; one owner thread per context.

doca_memos_initiator_dev_target

A connection to a Memos Target, including its configured endpoint and Memos connection identities.

Belongs to one logical device; has its own connection state, not a separate DOCA context.

doca_memos_initiator_dev_ns_info

Snapshot of discovered namespace attributes.

Created as a list; copy required information and destroy the list with the matching API.

doca_memos_initiator_dev_target_ns

Local namespace handle created from a target and a discovery snapshot.

Can be attached to only one volume; preserve until asynchronous operations have completed.

doca_memos_initiator_dev_volume

Logical Key/Value destination composed of compatible namespaces.

Belongs to one device; created from a copied attributes object.

doca_memos_initiator_dev_io_task_store, doca_memos_initiator_dev_io_task_retrieve, and doca_memos_initiator_dev_io_task_exist

Typed asynchronous Key/Value operation.

Application-owned before successful submission and after completion; context-owned while in flight.

A logical Initiator device is not the same object as an opened hardware doca_dev. Its volumes can contain namespaces reached through multiple targets. The I/O path selects a namespace using the volume's key-placement mapping. Changing the namespace set changes that mapping.

Threading and Concurrency

  • Serialize management calls with progress on the logical device's progress engine. Perform target, namespace, volume, and statistics management on that device's owner thread.

  • Each I/O context is thread-unsafe. Allocate, configure, submit, inspect, and release its tasks on its owning thread. Independently owned I/O contexts can progress in parallel.

  • Connect the device and I/O contexts to their progress engines using their *_as_ctx() conversion APIs and doca_pe_connect_ctx(). Keep progressing both management and every I/O context during connection, namespace changes, statistics operations, and teardown.

  • Do not call doca_pe_progress() recursively from a completion or event handler. Keep handlers short; schedule longer application work without blocking the progress loop.

  • A namespace operation can wait for acknowledgements or outstanding work on I/O contexts. If you stop progressing the I/O contexts while you wait for a management callback, the namespace operation might never complete.

Initialization and Configuration

This section describes the initialization sequence and the configuration of logical devices, I/O contexts, targets, and volumes.

Initialization Flow

  1. Discover supported DOCA devices, open them, and register each with doca_memos_initiator_add_dev(). At least one registered device is required. Finish the registration set before doca_memos_initiator_init().

  2. Call doca_memos_initiator_init() once for the process-level library instance.

  3. Create a logical device using doca_memos_initiator_dev_create(), configure its I/O-context count N with doca_memos_initiator_dev_set_num_io_ctxs(), and connect its DOCA context to the management progress engine.

  4. While the device is Idle, register the target-state and namespace-information handlers; the namespace attach, detach, and modify completion handlers; and the volume-statistics collect and reset handlers. Register both statistics handlers even when collecting statistics is not an immediate application requirement.

  5. Start the device with doca_ctx_start(). It enters Starting and waits for its configured I/O contexts; do not wait for device Running before creating them.

  6. While the device is Starting, create N I/O contexts with doca_memos_initiator_dev_io_create(). For each, configure a nonzero task count, register success and error callbacks for all three task types, and connect it to its progress engine.

  7. Start and progress the I/O contexts and the device until all I/O contexts and the device are Running. Check state changes and start failures rather than assuming that an accepted start call means Running.

  8. Create and connect targets as described in Targets and Reconnection. Then discover namespaces and compose volumes as described in Execution Flow.

Device and I/O Context Configuration

Object

Required Before Start

Notes

Logical device

doca_memos_initiator_dev_set_num_io_ctxs(N); event and completion registrations; progress-engine connection.

Device reaches Running only when the configured I/O contexts have started. Global registration cannot be changed after library initialization.

I/O context

doca_memos_initiator_dev_io_set_num_tasks() and success and error callback registration for STORE, RETRIEVE, and EXIST.

All six task callbacks are checked at I/O-context start, even if the application intends to submit only one task type.

Statistics

doca_memos_initiator_dev_event_volume_collect_stats_register() and doca_memos_initiator_dev_event_volume_reset_stats_register().

Both registrations are required by the public device-start contract.

Target Creation Attributes

Allocate attributes with doca_memos_initiator_dev_target_create_attr_create(), configure them, create the target and destroy the attributes object. The target copies the configured values.

Attribute

Setter Suffix After doca_memos_initiator_dev_target_create_attr_

Configuration

Address family

set_adrfam()

IPv4 by default; IPv6 is also supported by the capability implementation.

Address and service

set_traddr(), set_trsvcid()

Set the Memos Target address and service or port as strings, matching the target configuration.

Memos Target and Initiator identity

set_subnqn(), set_hostnqn()

Set the Memos Target subsystem identity and Initiator host identity to match the paired Memos deployment.

Reconnect delay

set_reconnect_delay()

Seconds between reconnect attempts. Default: 5 seconds. This is not a finite first-connect timeout.

Volume Creation Attributes

Allocate attributes with doca_memos_initiator_dev_volume_create_attr_create(), configure them, and call doca_memos_initiator_dev_volume_create() only while the device is Running. Creation copies the attributes. There is no separate public volume-start or volume-stop operation in this API.

Attribute

Setter Suffix After doca_memos_initiator_dev_volume_create_attr_

Requirement

Maximum key length

set_max_key_len()

Required and nonzero. Memos keys are up to 16 bytes and must not exceed the limit reported by any attached Memos namespace.

Maximum value length

set_max_value_len()

Required and nonzero; must not exceed each attached namespace's discovered maximum.

Maximum attached namespaces

set_max_attached_ns()

Required and nonzero. This is a namespace-count limit, not volume capacity.

Tenant identifier

set_tenant_id()

Defaults to zero. Configure the tenant identity expected by the remote namespaces.

Encryption keys

set_dek(), set_tek()

Optional; both unconfigured or both configured with the same supported key size.

The three required limit fields initially contain zero; there is no implicit 8 MiB/default namespace count supplied by the volume-attributes constructor. Do not copy an example service's RPC defaults into the SDK contract.

Encryption Configuration

Memos Initiator uses AES-XTS with a Data Encryption Key (DEK) and Tweak Encryption Key (TEK). The application supplies and manages both keys; these APIs do not choose keys, integrate a key-management service, or provide an automatic key-exchange protocol.

  1. Choose a key size supported by every registered data-path device using doca_memos_initiator_cap_is_volume_ek_size_supported(). Encrypted volume creation rejects a registered device set that lacks crypto support.

  2. Provision a DEK and TEK through the application's trusted key-management mechanism. Use the same key material for accesses that must decrypt previously stored data; coordinate key lifecycle with the deployment's data lifecycle.

  3. Call doca_memos_initiator_dev_volume_create_attr_set_dek() and doca_memos_initiator_dev_volume_create_attr_set_tek() with raw byte buffers. DOCA_MEMOS_INITIATOR_VOLUME_EK_SIZE_128 means 16 bytes per key; DOCA_MEMOS_INITIATOR_VOLUME_EK_SIZE_256 means 32 bytes per key. Do not pass a printable hexadecimal string as if it were the raw key.

  4. Use equal DEK and TEK sizes. To disable volume encryption, leave both at DOCA_MEMOS_INITIATOR_VOLUME_EK_SIZE_NONE. Setting only one key, or different sizes, is invalid.

  5. The setters copy the key bytes, and volume creation copies the attributes. Destroy the attributes after creation and clear application-owned temporary key buffers using the application's secure-erasure policy. Never log key bytes.

The exposed encryption-key setters are creation attributes, not an in-place key-rotation API. Do not assume that creating a replacement volume with new keys preserves access to existing encrypted values. Tenant ID is not a key and does not replace key provisioning.

Key distribution, secure storage, and key rotation are application responsibilities.

Execution Flow

This section describes namespace discovery, namespace attachment and detachment, Key/Value task submission, and management events.

Namespace Discovery and Dynamic Changes

  1. Obtain a snapshot using doca_memos_initiator_dev_target_create_ns_info_list() for one connected target, or doca_memos_initiator_dev_create_ns_info_list() for the device's active view.

  2. Inspect target identity, namespace ID (NSID), namespace globally unique identifier (NGUID), reported size, maximum key length, and maximum value length with doca_memos_initiator_dev_ns_info_get_*(). NGUID is 16 bytes; do not treat an NSID as a globally stable identity across targets or reconnections.

  3. Create local handles with doca_memos_initiator_dev_target_ns_create() using a snapshot belonging to the same target. Destroy snapshot lists with doca_memos_initiator_dev_destroy_ns_info_list() when no longer needed.

  4. Register doca_memos_initiator_dev_event_target_ns_info_changed_register() to be notified of namespace additions, removals, or attribute changes. Rebuild and compare snapshots to determine the actual delta.

  5. For a changed attached namespace, use doca_memos_initiator_dev_volume_modify_ns() with an updated snapshot from the same target and NGUID. At least one relevant attribute must change; unchanged snapshots are rejected synchronously. The call copies required data, so its snapshot can be released after the call returns.

  6. If modification fails, handle the mismatch explicitly: either correct the snapshot and retry, or detach, destroy, re-create, and reattach the namespace handle. Do not leave the topology mismatch unresolved.

Preserve namespace identity consistently across discovery and topology updates. For an integration that exposes these namespaces to a host, assign unique NGUIDs as required by that integration. Do not confuse a host-visible emulated namespace with the remote namespace handle managed by this library.

Handle namespace-information change notifications by rediscovering the current namespace view, comparing it with the application's view, and reconciling volume membership as appropriate. A namespace disappearing from a Memos Target is distinct from an application-requested detach; a discovery notification is not completion of a detach request.

Attach and Detach Namespaces

Create an empty volume, create compatible namespace handles, and call doca_memos_initiator_dev_volume_attach_ns(). All attached handles must belong to the same logical Initiator device as the volume. A namespace handle cannot belong to two volumes, and its maximum key and value lengths must accommodate the volume's configured limits.

Attach, detach, and modify are asynchronous. A successful return means the request was accepted, not that every I/O context has installed the new mapping. Wait for the registered completion before freeing handles, announcing readiness, or issuing dependent topology changes. Detach is called with the namespace handle; the volume is derived from that handle.

Do not overlap detach or modify operations on the same namespace or reuse an attach-in-progress handle. Operations on different namespaces can be in flight where the API allows it. Statistics collection and reset are serialized against namespace changes for the same volume. Keep all I/O contexts progressing; detachment waits for outstanding namespace I/O.

Check the return value of attach and modify calls: incompatible discovered namespace limits or attributes can cause immediate rejection. Handle that error before waiting for an asynchronous completion.

Namespace membership changes do not migrate or replicate existing data. Any required data migration must be managed by the application.

Key/Value Task Flow

  1. Allocate a typed task from a Running I/O context using doca_memos_initiator_dev_io_task_store_alloc_init(), doca_memos_initiator_dev_io_task_retrieve_alloc_init(), or doca_memos_initiator_dev_io_task_exist_alloc_init(). The volume and I/O context must belong to the same logical device.

  2. Configure STORE and RETRIEVE with their *_set_key_value_conf() functions, or EXIST with *_set_key_conf(). Match buffer-list count and aggregate byte lengths; respect the configured volume limits.

  3. Convert with the task's *_as_task() function and call doca_task_submit(). Check its return code. A synchronous failure leaves task ownership with the application and does not promise an asynchronous completion.

  4. After successful submission, keep task-related memory valid and do not modify or free the task or release its value buffers while in flight. Progress the owning engine until its success or error callback returns task ownership.

  5. In the callback, read doca_task_get_status() and applicable result getters before freeing or reusing the task. Reclaim completed tasks with doca_task_free() when the application no longer needs them.

Task

Value-buffer Direction

Completion Handling

STORE

Application data sent to the target.

Successful completion means this operation completed; handle any returned error before declaring the data stored.

RETRIEVE

Target data written into application buffers.

Compare the returned full stored length with the supplied buffer size. A successful command can return truncated data; reissue with a larger buffer if needed.

EXIST

No value buffer.

A missing key invokes the error callback with DOCA_ERROR_NOT_FOUND, not a successful callback containing a Boolean false.

A successful EXIST is not a reservation or guarantee that a subsequent RETRIEVE succeeds. Applications must handle retrieval failure and their own cache and data-lifecycle policy.

Management Events

Event

Registration and Output

Handling

Target state change

doca_memos_initiator_dev_event_target_state_change_register(); target and registered user data.

Query the current target state. See the target-state table for transitions that do and do not notify.

Namespace information changed

doca_memos_initiator_dev_event_target_ns_info_changed_register(); target and registered user data.

Rediscover and reconcile, rather than treating the notification as an updated namespace handle.

Volume namespace attach, detach, and modify

doca_memos_initiator_dev_event_volume_ns_attach_register(), doca_memos_initiator_dev_event_volume_ns_detach_register(), doca_memos_initiator_dev_event_volume_ns_modify_register(); volume, namespace, and registered user data.

Register both success and error handlers. Check the initiating call for synchronous rejection and wait for accepted operations to complete.

Volume statistics collect and reset

doca_memos_initiator_dev_event_volume_collect_stats_register() and doca_memos_initiator_dev_event_volume_reset_stats_register(); volume, registered data, operation data, and status.

Check callback status. Read and copy the collected counters only inside the successful collect completion handler.

The attach, detach, and modify completion paths invoke success handlers after accepted requests. Validation and allocation failures are returned synchronously. Register both handlers as required by the public interface, but do not wait for an error callback after a synchronously rejected call.

Error Handling and Reconnection

This section describes target connection and reconnection, and how Memos task results are reported.

Targets and Reconnection

  1. Create a target on a Running device and call doca_memos_initiator_dev_target_connect(). The call initiates connection; use the target state and asynchronous state handler to determine readiness.

  2. After the target reaches CONNECTED, discover the target's current namespaces before creating namespace handles or submitting application I/O.

  3. On a connection loss, observe the transition back to CONNECT_IN_PROGRESS. The library retries reconnection indefinitely at the configured delay. It does not issue one state-change callback per failed retry.

  4. If you need to abandon a permanently unreachable target, implement an application timeout or watchdog. Detach its namespaces from volumes, wait for completion, and then call doca_memos_initiator_dev_target_disconnect() to cancel connection or reconnection.

  5. After reconnection, rediscover namespace attributes and reconcile the application's volume topology. Do not assume that the old namespace view remains valid.

The intended reconnect flow does not guarantee recovery from every outage in every delivered integration. See Known Issues for the 1.0.0 service-reported reconnect failure.

Memos Task Results

Use doca_task_get_status() to obtain the Memos task result in its completion callback. Distinguish a task-allocation or submission failure from an asynchronously completed task error. Inspect results before freeing or reusing the task; do not infer success from an unset result field.

Condition

Reported Result and Handling

Memos task success

DOCA_SUCCESS; successful task callback.

Key not found on RETRIEVE or EXIST

DOCA_ERROR_NOT_FOUND; error callback.

Invalid key or value size reported on task completion

DOCA_ERROR_INVALID_VALUE.

Namespace not ready reported on task completion

DOCA_ERROR_BAD_STATE.

Other Memos command errors

DOCA_ERROR_IO_FAILED.

Connection failure without a completed Memos operation

DOCA_ERROR_IO_FAILED, or preserved DOCA_ERROR_CONNECTION_INPROGRESS where reported by the underlying reconnect path.

The public header describes broader error possibilities for some tasks; do not infer the exact mapping from a status name alone. A reconnect-related failure does not establish whether a previously submitted write reached the target; application retry policy must account for that uncertainty.

Memos-specific failures can include tenant mismatch and data-protection failure. Treat these as Memos operation failures and preserve their meaning in the application's diagnostics. For low-level diagnostic getter signatures, see DOCA API References.

Telemetry and Statistics

  1. Register collect and reset completion handlers before starting the device. Query supported counter, task, and status combinations with doca_memos_initiator_cap_is_volume_get_stats_*_supported().

  2. While no namespace change or other statistics operation is in flight for a volume, initiate doca_memos_initiator_dev_volume_collect_stats(). Continue progressing the management context and every I/O context.

  3. Only inside its successful completion handler, call doca_memos_initiator_dev_volume_get_stats_ns_*() for attached namespaces and copy the values needed by the application. Calling these getters outside that handler has undefined behavior under the public contract.

  4. Export the copied values through the application's selected monitoring system. The library APIs do not themselves define a DOCA Telemetry Service (DTS) deployment, Prometheus endpoint, collector configuration, or exporter process.

  5. Use doca_memos_initiator_dev_volume_reset_stats() to asynchronously zero accumulated counters when needed. Wait for its completion and do not overlap it with collection or namespace changes.

Available counter families include completed operations by task and status, successfully transferred value bytes, and the mean and standard deviation of in-flight tasks. Capability-check the requested combination. For a truncated successful RETRIEVE, the byte counter counts transferred bytes, not the full stored value length.

Maintain application-owned snapshots when calculating rates or publishing metrics. Coordinate collection and reset so exported samples are interpreted consistently. Counters describe library operations; they are not a service-health, persistence, or data-availability guarantee. Container helper paths, local telemetry consumption and DTS bring-up belong in the service user manual.

Lifecycle and Shutdown

This section describes the teardown sequence and the lifecycle states of logical devices, I/O contexts, targets, volumes, and namespace handles.

Teardown Flow

  1. Stop accepting new application I/O. Continue progressing all contexts, collect task completions, and release application-owned task objects and buffer references.

  2. Wait for pending namespace and statistics operations. Detach every namespace from its volume and wait for detach completion before destroying its namespace handle.

  3. Destroy volumes after all attached namespaces and outstanding volume operations are gone.

  4. Disconnect targets, wait for DISCONNECTED, and destroy them. Unattached namespace handles must also be destroyed before their target.

  5. Request device stop using doca_ctx_stop() on doca_memos_initiator_dev_as_ctx(). The device must no longer own volumes, namespace handles, or targets.

  6. While the device is Stopping, request stop on each I/O context. Continue progressing all engines until the I/O contexts and device are Idle. Do not destroy a context that still owns tasks.

  7. Destroy the Idle I/O contexts and then the Idle device. Release their progress-engine resources according to the DOCA Core lifecycle.

  8. Call doca_memos_initiator_teardown(), deregister hardware devices with doca_memos_initiator_rm_dev(), and close them when no other library uses them.

Initiator Device and I/O Context States

State

Logical Device

I/O Context

Idle

Configure count and handlers, connect progress engine, and start or destroy when dependencies permit.

Configure task count and callbacks and connect its engine; starting requires its parent device to be Starting.

Starting

Progress; create and start the configured N I/O contexts. No target or volume creation yet.

Progress startup. Device readiness depends on all configured I/O contexts.

Running

Manage targets, volumes, and namespace topology; progress events and statistics.

Allocate and submit tasks, and process completions. Submit application work only after the parent device is also ready.

Stopping

No new application work; keep progressing teardown and coordinate I/O stop.

Request stop only during parent Stopping, keep progressing and draining, and reclaim tasks until Idle.

Target Connection States

State / Transition

Allowed Action / Notification

DISCONNECTED

Connect or destroy, subject to namespace-handle dependencies.

DISCONNECTED → CONNECT_IN_PROGRESS

Explicit connect enters this state without invoking the target-state handler for this immediate transition.

CONNECT_IN_PROGRESS → CONNECTED

State handler notifies that connection completed. Discover current namespaces.

CONNECTED → CONNECT_IN_PROGRESS

Connection loss notifies once; reconnect attempts continue indefinitely without one callback per retry.

CONNECTED or CONNECT_IN_PROGRESS → DISCONNECT_IN_PROGRESS

Explicit disconnect or cancellation after all target namespaces have been detached; immediate transition does not notify.

DISCONNECT_IN_PROGRESS

Wait and progress. Do not reconnect, disconnect again, or destroy.

DISCONNECT_IN_PROGRESS → DISCONNECTED

State handler reports completion. Target can be reconnected or destroyed after dependencies are removed.

Volume and Namespace Lifetime

Volumes and namespace handles are not independent DOCA contexts. A namespace moves from created and unattached through attach-in-progress to attached, and through detach-in-progress back to unattached. Modify updates an attached handle. Do not use attachment flags as a substitute for an operation-completion notification; destruction requires the handle to be detached and no operation to still reference it.

Known Issues

  • Data path might not reconnect after a link outage: Following a Memos Target path outage, the data path might remain in reconnect progress and I/O might stall.

  • Namespace removal during active I/O: Removing a namespace while I/O is active might drop in-flight requests or cause I/O timeouts. Quiesce I/O before removing the namespace.

  • Status-counter capability might over-report support: doca_memos_initiator_cap_is_volume_get_stats_ns_num_completed_with_status_supported() might report task and status combinations as supported even though they are not counted. Counters for these combinations remain zero.

API Reference

The public headers are doca_memos_initiator.h, doca_memos_initiator_dev.h, and doca_memos_initiator_dev_io.h. Use generated documentation for the SDK version that supplies these headers.

For the generated API documentation, see:

API References

Reference Application

For a reference application that uses this library, see:

DOCA Memos Initiator Application

Last updated: