DOCA SDK Documentation

DPA Application Security Attributes to Blob

Overview

dpa-app-attributes2blob is a tool for converting between FlexIO attributes YAML files and binary blob files, and vice versa. It is typically used to generate binary configuration blobs from human-readable YAML attributes, or to reverse the process for inspection and debugging.


Features

  • Converts attributes YAML files to binary blobs (default mode)

  • Converts binary blobs back to attributes YAML files

  • Supports a nested Feature_list structure

  • Validates input files and provides clear error messages

  • Sets default values to false for unspecified fields

  • Provides detailed feature descriptions in generated YAML files

  • Supports error modes for blob-to-YAML conversion

  • Configurable blob size for YAML-to-binary conversion

  • Comprehensive bit validation in binary blobs

Usage 

dpa-app-attributes2blob [--help] [--version] [mode] [error_mode] [blob_size] <input-file> <output-file>

Option

Description

Notes

--yaml2bin

Convert an attributes YAML file to a binary blob

Default

--bin2yaml

Convert a binary blob to an attributes YAML file

 N/A

--restrictive

Treat invalid bits in a binary blob as errors

  • Default

  • bin2yaml only

--notification

Treat invalid bits in a binary blob as warnings

bin2yaml only

--blob-size <size>

Specify the output size of the blob in bytes. The size must be a multiple of 4 and less than 1024.

  • 8 bytes by default

  • yaml2bin only

Examples

  • Convert YAML to binary blob:

    dpa-app-attributes2blob --yaml2bin config.yaml output.bin

  • Simple convert YAML to binary blob:

    dpa-app-attributes2blob config.yaml output.bin

  • Convert YAML to binary blob with custom size:

    dpa-app-attributes2blob --yaml2bin --blob-size 16 config.yaml output.bin

  • Convert binary blob to YAML:

    dpa-app-attributes2blob --bin2yaml output.bin config.yaml

  • Convert binary blob to YAML with warning mode:

    dpa-app-attributes2blob --bin2yaml --notification output.bin config.yaml

Attributes YAML Format

  • The attributes must have a top-level mapping containing only a Feature_list key.

  • The Feature_list value must be a mapping containing feature flags.

  • Field values must be boolean (true/false, yes/no, on/off).

  • Fields not explicitly set default to false.

  • Supported fields:

    • Congestion_Control_Flow_Context_Access: Enables the application to access the Congestion Control Flow Context.

    • Programmable_Congestion_Control: Enables the application to serve Programmable Congestion Control events.

    • Generating_Empty_CQE: Enables the application to generate an Empty CQE on a given CQ (e.g., for triggering other software entries).

    • Device_Emulation: Enables the application to emulate a PCIe device.

Example Attributes YAML

YAML
Feature_list:
  Congestion_Control_Flow_Context_Access: true
  Programmable_Congestion_Control: false
  Generating_Empty_CQE: true
  Device_Emulation: true

Generated YAML Output

When converting from binary to YAML, the tool generates descriptive comments:

YAML
# This file was generated by dpa-app-attributes2blob
# A dictionary of features enabled/disabled for the application
Feature_list:
  # Enables application to access Congestion Control Flow Context
  Congestion_Control_Flow_Context_Access: true
  # Disables application to serve Programmable Congestion Control events
  Programmable_Congestion_Control: false
  # Enables application to generate Empty CQE on a given CQ, e.g. for triggering other SW entries
  Generating_Empty_CQE: true
  # Enables application to emulate a PCI device
  Device_Emulation: true

Error Handling

  • The tool checks for duplicate fields, unknown fields, invalid boolean values, and malformed YAML structure.

  • Only one document and the specified nested structure are allowed in the YAML.

  • Sequences and aliases/anchors are not supported.

  • In blob-to-YAML mode, the tool validates that only valid feature bits are set in the binary blob.

  • Invalid bits can be treated as errors (default) or warnings (using --notification).

  • The tool provides detailed error messages showing which specific bits are invalid in the binary blob.

  • Command-line validation ensures error modes are only used with --bin2yaml and size options are only used with --yaml2bin.

Binary Blob Format

  • The binary blob is stored in big-endian byte order.

  • Custom blob sizes can be specified using the --blob-size option.

  • The blob size must be a multiple of 4 bytes and cannot exceed 1024 bytes.

  • Only the bits corresponding to defined features are validated; other bits are checked to ensure they are not set to 1.

Last updated: