API Reference

Contents

API Reference#

This page documents the rocm-ernic C API, extracted from annotated source headers by Doxygen and rendered via Breathe.

Userspace Server API#

Device Structure#

Typedefs

typedef struct rocm_ernic_dev rocm_ernic_dev_t#
struct rocm_ernic_dev#
#include <rocm_ernic_internal.h>

rocm_ernic_dev - Main device structure

This structure contains both the libvfio-user context and a handle to the RDMA device implementation. The actual device structures are hidden behind the opaque pvrdma_handle_t. The BAR layout is in ionic/ionic_bar.h.

Public Members

char *backend_type_str#
void *bar0_mem#
bool client_lost#
struct ionic_fault_set *faults#
struct ionic_device *ionic#
uint8_t mac_addr[6]#
bool mac_addr_set#
struct ionic_profile profile#
pvrdma_handle_t pvrdma_handle#
struct ernic_stats *stats#
char *stats_file_path#
bool verbose#
vfu_ctx_t *vfu_ctx#

Compatibility Bridge#

Defines

ERNIC_GID_LEN#

Typedefs

typedef struct PVRDMADev *pvrdma_handle_t#

Functions

const char *pvrdma_backend_name(const char *backend_type_str)#

pvrdma_backend_name - Name the backend a –backend string selects

The name is everything before the first ‘:’, and must match exactly.

Returns: “none”, “loopback”, “tcp”, “nvmeof” or “s3”, or NULL if the name is none of them

Parameters:

backend_type_str – e.g. “loopback” or “nvmeof:size=1G” (may be NULL, meaning “none”)

pvrdma_handle_t pvrdma_device_create(const rocm_ernic_dev_t *dev, const char *backend_type_str)#

pvrdma_device_create - Create and initialize RDMA device

Returns: Opaque handle to RDMA device, or NULL on failure, including an unknown backend

Parameters:
  • dev – Parent rocm_ernic device structure

  • backend_type_str – Backend and its config, as pvrdma_backend_name() takes

void pvrdma_device_destroy(pvrdma_handle_t handle)#

pvrdma_device_destroy - Clean up and destroy PVRDMA device

Parameters:

handle – Device handle from pvrdma_device_create()

int pvrdma_device_realize(pvrdma_handle_t handle)#

pvrdma_device_realize - Complete device initialization

Initializes RDMA backend, loads device attributes, etc. Returns: 0 on success, -errno on failure

Parameters:

handle – Device handle

Resource Manager#

Functions

int ernic_rm_alloc_cq(pvrdma_handle_t handle, uint32_t cqe, uint32_t *cq_handle)#

ernic_rm_alloc_cq - Allocate a completion queue via rdma_rm

Parameters:
  • handle – pvrdma device handle (must be realized)

  • cqe – number of CQ entries

  • cq_handle – output: allocated CQ handle

int ernic_rm_alloc_mr(pvrdma_handle_t handle, uint32_t pd_handle, uint32_t access_flags, uint32_t *mr_handle)#

ernic_rm_alloc_mr - Allocate a memory region

Parameters:
  • handle – pvrdma device handle

  • pd_handle – protection domain

  • access_flags – MR access flags

  • mr_handle – output handle

int ernic_rm_alloc_pd(pvrdma_handle_t handle, uint32_t *pd_handle)#

ernic_rm_alloc_pd - Allocate a protection domain

int ernic_rm_alloc_qp(pvrdma_handle_t handle, uint32_t pd_handle, uint8_t qp_type, uint32_t max_send_wr, uint32_t max_recv_wr, uint32_t send_cq_handle, uint32_t recv_cq_handle, uint32_t *qpn)#

ernic_rm_alloc_qp - Allocate a queue pair

Parameters:
  • handle – pvrdma device handle

  • pd_handle – protection domain handle

  • qp_type – QP type (enum ibv_qp_type, or ERNIC_IB_QPT_GSI)

  • max_send_wr – max send work requests

  • max_recv_wr – max recv work requests

  • send_cq_handle – CQ handle for send completions

  • recv_cq_handle – CQ handle for recv completions

  • qpn – output: QP number assigned

int ernic_rm_alloc_srq(pvrdma_handle_t handle, uint32_t pd_handle, uint32_t max_wr, uint32_t max_sge, uint32_t srq_limit, uint32_t *srq_handle)#

ernic_rm_alloc_srq - Allocate a shared receive queue

Parameters:
  • handle – pvrdma device handle (must be realized)

  • pd_handle – protection domain the SRQ belongs to

  • max_wr – max receive work requests

  • max_sge – max scatter/gather entries per work request

  • srq_limit – low-watermark at which the device raises an SRQ_LIMIT event

  • srq_handle – output: allocated SRQ handle

void ernic_rm_dealloc_cq(pvrdma_handle_t handle, uint32_t cq_handle)#

ernic_rm_dealloc_cq - Free a completion queue

void ernic_rm_dealloc_mr(pvrdma_handle_t handle, uint32_t mr_handle)#

ernic_rm_dealloc_mr - Free a memory region

void ernic_rm_dealloc_pd(pvrdma_handle_t handle, uint32_t pd_handle)#

ernic_rm_dealloc_pd - Free a protection domain, once nothing uses it

void ernic_rm_dealloc_qp(pvrdma_handle_t handle, uint32_t qpn)#

ernic_rm_dealloc_qp - Free a queue pair

void ernic_rm_dealloc_srq(pvrdma_handle_t handle, uint32_t srq_handle)#

ernic_rm_dealloc_srq - Free a shared receive queue

int ernic_rm_modify_qp(pvrdma_handle_t handle, uint32_t qpn, uint32_t attr_mask, uint8_t type_state, uint32_t sq_psn, uint32_t rq_psn, uint32_t qkey_dest_qpn, const uint8_t *dest_gid_16bytes)#

ernic_rm_modify_qp - Modify a queue pair’s state

Parameters:
  • handle – pvrdma device handle

  • qpn – QP number (handle)

  • attr_mask – IB attr mask (big-endian u32 from WQE, we convert)

  • type_state – ionic type_state byte: bits[3:0]=to_state, bits[7:4]=from_state

  • sq_psn – SQ starting PSN

  • rq_psn – RQ starting PSN

  • qkey_dest_qpn – Q-Key / destination QPN (combined le32)

  • dest_gid_16bytes – 16-byte destination GID (raw bytes, zeroed if not RC)

int ernic_rm_modify_srq(pvrdma_handle_t handle, uint32_t srq_handle, uint32_t srq_limit)#

ernic_rm_modify_srq - Change an SRQ’s low-watermark

int ernic_rm_query_qp(pvrdma_handle_t handle, uint32_t qpn, uint8_t *state, uint8_t *path_mtu, uint32_t *dest_qpn, uint32_t *access_flags, uint32_t *rq_psn, uint32_t *sq_psn)#

ernic_rm_query_qp - Read a queue pair’s attributes back out of rdma_rm

Any out parameter may be NULL. Returns 0 on success, -errno on failure.

Parameters:
  • handle – pvrdma device handle

  • qpn – QP number (handle)

  • state – ibv_qp_state the device holds for the QP

  • path_mtu – ibv_mtu enum

  • dest_qpn – peer QPN, 0 when the backend tracks none

  • access_flags – ibv_access_flags bitmask

  • rq_psn – receive PSN the guest last set, 0 if it never set one

  • sq_psn – send PSN the guest last set, 0 if it never set one

int ernic_rm_query_srq(pvrdma_handle_t handle, uint32_t srq_handle, uint32_t *max_wr, uint32_t *max_sge, uint32_t *srq_limit)#

ernic_rm_query_srq - Read back an SRQ’s attributes

Mesh#

Defines

ERNIC_MESH_MAX_MSG#
ERNIC_MESH_REPLY_BUDGET#

Typedefs

typedef bool (*ernic_mesh_recv_fn)(void *opaque, uint32_t src_node, void *buf, size_t len)#

Functions

void ernic_mesh_cancel(pvrdma_handle_t handle, uint64_t tag, uint64_t mask)#
int ernic_mesh_claim_gid(pvrdma_handle_t handle, const uint8_t *gid_16bytes, bool add)#
bool ernic_mesh_has_room(pvrdma_handle_t handle, uint32_t dst_node, size_t len)#
uint32_t ernic_mesh_local_node(pvrdma_handle_t handle)#
uint32_t ernic_mesh_node_from_gid(pvrdma_handle_t handle, const uint8_t *dest_gid_16bytes)#
int ernic_mesh_sendv(pvrdma_handle_t handle, uint32_t dst_node, const void *hdr, size_t hdr_len, const void *body, size_t body_len, uint64_t tag, bool reply)#
void ernic_mesh_set_recv_cb(pvrdma_handle_t handle, ernic_mesh_recv_fn fn, void *opaque)#

Statistics#

Defines

ERNIC_STAT_NO_QP#

Typedefs

typedef void (*ernic_stats_section_fn)(FILE *fp, void *opaque)#

Enums

enum ernic_stat_op#

Values:

enumerator ERNIC_STAT_SEND#
enumerator ERNIC_STAT_RECV#
enumerator ERNIC_STAT_RDMA_READ#
enumerator ERNIC_STAT_RDMA_WRITE#
enum ernic_stat_wr#

Values:

enumerator ERNIC_STAT_WR_RDMA_WRITE#
enumerator ERNIC_STAT_WR_RDMA_WRITE_WITH_IMM#
enumerator ERNIC_STAT_WR_SEND#
enumerator ERNIC_STAT_WR_SEND_WITH_IMM#
enumerator ERNIC_STAT_WR_RDMA_READ#
enumerator ERNIC_STAT_WR_ATOMIC_CMP_AND_SWP#
enumerator ERNIC_STAT_WR_ATOMIC_FETCH_AND_ADD#
enumerator ERNIC_STAT_WR_LSO#
enumerator ERNIC_STAT_WR_SEND_WITH_INV#
enumerator ERNIC_STAT_WR_RDMA_READ_WITH_INV#
enumerator ERNIC_STAT_WR_LOCAL_INV#
enumerator ERNIC_STAT_WR_FAST_REG_MR#
enumerator ERNIC_STAT_WR_MASKED_ATOMIC_CMP_SWP#
enumerator ERNIC_STAT_WR_MASKED_ATOMIC_FETCH#
enumerator ERNIC_STAT_WR_BIND_MW#
enumerator ERNIC_STAT_WR_REG_SIG_MR#
enumerator ERNIC_STAT_WR_ERROR#
enumerator ERNIC_STAT_WR_SEND_DC#
enumerator ERNIC_STAT_WR_COUNT#

Functions

void ernic_stats_bar0_access(struct ernic_stats *st, bool is_write)#

ernic_stats_bar0_access - Count one BAR0 (registers and MSI-X) access

Parameters:
  • st – Statistics

  • is_write – true for a write, false for a read

void ernic_stats_command(struct ernic_stats *st)#

ernic_stats_command - Count one executed admin queue command

Parameters:

st – Statistics

struct ernic_stats *ernic_stats_create(void)#

ernic_stats_create - Create the counters, all zero, with no stats file

Returns: the counters, or NULL when out of memory

void ernic_stats_destroy(struct ernic_stats *st)#

ernic_stats_destroy - Free the counters

Parameters:

st – from ernic_stats_create(), or NULL

int ernic_stats_dev_counters(const struct ernic_stats *st, struct ernic_dev_counters *out)#

ernic_stats_dev_counters - Snapshot the device totals

Returns: 0, or -EINVAL for a NULL

st or out

Parameters:
  • st – Statistics

  • out – Filled on success, zeroed on failure

void ernic_stats_device_reset(struct ernic_stats *st)#

ernic_stats_device_reset - Count one device reset or PCI FLR

Parameters:

st – Statistics

void ernic_stats_doorbell_access(struct ernic_stats *st, bool is_write)#

ernic_stats_doorbell_access - Count one BAR2 (doorbell page) access

The stats file calls these uar_reads and uar_writes, after the PVRDMA UAR they used to count.

Parameters:
  • st – Statistics

  • is_write – true for a write, false for a read

void ernic_stats_eth_bytes(struct ernic_stats *st, uint64_t bytes, bool is_tx)#

ernic_stats_eth_bytes - Count guest Ethernet bytes moved

Parameters:
  • st – Statistics

  • bytes – Frame length

  • is_tx – true for guest-to-host, false for host-to-guest

void ernic_stats_irq(struct ernic_stats *st)#

ernic_stats_irq - Count one delivered MSI-X interrupt

Parameters:

st – Statistics

int ernic_stats_qp_counters(const struct ernic_stats *st, uint32_t qp_id, struct ernic_qp_counters *out)#

ernic_stats_qp_counters - Snapshot one QP’s counters

A QP with nothing counted yet reads as all zeros.

Returns: 0, or -EINVAL for a NULL st or out

Parameters:
  • st – Statistics

  • qp_id – QP to read

  • out – Filled on success, zeroed on failure

void ernic_stats_qp_cqe(struct ernic_stats *st, uint32_t qp_id)#

ernic_stats_qp_cqe - Count one completion posted for a QP

Parameters:
  • st – Statistics

  • qp_id – QP the completion belongs to

void ernic_stats_qp_doorbell(struct ernic_stats *st, uint32_t qp_id, bool is_send)#

ernic_stats_qp_doorbell - Count one doorbell ring against a QP

One per ring, however many WQEs the ring makes ready.

Parameters:
  • st – Statistics

  • qp_id – QP the doorbell targets

  • is_send – true for the send queue, false for the receive queue

void ernic_stats_qp_forget(struct ernic_stats *st, uint32_t qp_id)#

ernic_stats_qp_forget - Drop a destroyed QP’s counters

The stats file then stops listing it, and a new QP with the same id starts from zero.

Parameters:
  • st – Statistics

  • qp_id – QP being destroyed

void ernic_stats_qp_wqe(struct ernic_stats *st, uint32_t qp_id, unsigned int wr)#

ernic_stats_qp_wqe - Count one processed send WQE against a QP

Parameters:
  • st – Statistics

  • qp_id – QP that owns the WQE

  • wr – enum ernic_stat_wr, or ERNIC_STAT_WR_COUNT or more to count the WQE in the QP’s total only

void ernic_stats_rdma_bytes(struct ernic_stats *st, uint32_t qp_id, uint64_t bytes, enum ernic_stat_op stat_op)#

ernic_stats_rdma_bytes - Count RDMA bytes against the device and a QP

Parameters:
  • st – Statistics

  • qp_id – QP to attribute the bytes to, or ERNIC_STAT_NO_QP for the totals only

  • bytes – Number of bytes actually moved

  • stat_op – Operation class

void ernic_stats_set_connection(struct ernic_stats *st, const char *state)#

ernic_stats_set_connection - Set the connection state the file shows

ernic-exporter reports any state starting “connected” as up.

Parameters:
  • st – Statistics

  • state – e.g. “connected” or “disconnected (lost connection)”, or NULL to show “(not set)”. Not copied: pass a string literal.

int ernic_stats_set_file(struct ernic_stats *st, const char *path)#

ernic_stats_set_file - Set the path ernic_stats_write()

writes to

Returns: 0, or -ENOMEM, leaving no file set

Parameters:
  • st – Statistics

  • path – Path, copied, or NULL for no file

int ernic_stats_set_instance(struct ernic_stats *st, const struct ernic_stats_instance *inst)#

ernic_stats_set_instance - Set the stats file’s “Instance” block

Returns: 0, or -ENOMEM, leaving the block as it was

Parameters:
  • st – Statistics

  • inst – What to show; its strings are copied

void ernic_stats_set_section(struct ernic_stats *st, ernic_stats_section_fn write_fn, void *opaque)#

ernic_stats_set_section - Add a section to the stats file

There is one section, which the ionic device sets for its LIF and port counters.

Parameters:
  • st – Statistics

  • write_fn – Writes the section, after “Device Statistics”; NULL removes it

  • opaque – Passed to write_fn

bool ernic_stats_write(struct ernic_stats *st)#

ernic_stats_write - Replace the stats file with the counters as they are

A reader sees the old file or the new one, whole, never part of one; a write that fails leaves the old file, and logs why.

Returns: true if a new file replaced the old one; false if it didn’t, or there is no file

Parameters:

st – Statistics

struct ernic_dev_counters#
#include <ernic_stats.h>

Public Members

uint64_t commands#
uint64_t total_bytes_rdma_read#
uint64_t total_bytes_rdma_write#
uint64_t total_bytes_received#
uint64_t total_bytes_sent#
struct ernic_qp_counters#
#include <ernic_stats.h>

Public Members

uint64_t bytes_rdma_read#
uint64_t bytes_rdma_write#
uint64_t bytes_received#
uint64_t bytes_sent#
uint64_t cqes_posted#
uint64_t doorbell_recv#
uint64_t doorbell_send#
uint64_t wqes_processed#
struct ernic_stats_instance#
#include <ernic_stats.h>

Public Members

const char *backend#
uint8_t mac[6]#
const char *nic_profile#
uint16_t pci_did#
uint16_t pci_vid#
const char *socket_path#

ionic Emulation#

BAR Layout#

Defines

IONIC_BAR0_DEV_CMD_REGS_OFFSET#
IONIC_BAR0_DEV_INFO_REGS_OFFSET#
IONIC_BAR0_INTR_CTRL_OFFSET#
IONIC_BAR0_INTR_STATUS_OFFSET#
IONIC_BAR0_MSIX_PBA#
IONIC_BAR0_MSIX_TABLE#
IONIC_BAR0_REGS_SIZE#
IONIC_BAR0_TOTAL_SIZE#
IONIC_BAR2_DB_SIZE#
IONIC_DB_PAGE_SIZE#
IONIC_KERN_PID#
IONIC_MSIX_MAX_VECTORS#

Device#

Functions

struct ionic_device *ionic_device_create(const struct ionic_device_cfg *cfg, char *err, size_t errlen)#
struct ionic_datapath *ionic_device_datapath(const struct ionic_device *dev)#
void ionic_device_destroy(struct ionic_device *dev)#
struct ionic_eth_emu *ionic_device_eth_emu(const struct ionic_device *dev)#
bool ionic_device_has_work(struct ionic_device *dev)#
void ionic_device_poll(struct ionic_device *dev)#
struct ionic_rdma_devcmd_state *ionic_device_rdma_devcmd(const struct ionic_device *dev)#
bool ionic_device_target_check(const char *backend, char *err, size_t errlen)#
struct ionic_device_cfg#
#include <ionic_device.h>

Public Members

const char *backend#
struct ionic_fault_set *faults#
const uint8_t *mac#
uint64_t (*now_ms)(void)#
const struct ionic_profile *profile#
pvrdma_handle_t pvrdma#
struct ernic_stats *stats#
vfu_ctx_t *vfu_ctx#

Ethernet Emulator#

Defines

IONIC_DEVCMD_CMD_LEN#
IONIC_DEVCMD_COMP_LEN#

Typedefs

typedef bool (*ionic_eth_rx_filter_fn)(void *ctx, const void *frame, size_t len)#
typedef bool (*ionic_eth_tx_filter_fn)(void *ctx, const void *frame, size_t len)#
typedef void (*ionic_rdma_devcmd_fn_t)(void *opaque, const uint8_t *cmd, uint8_t *comp)#

Functions

int ionic_eth_emu_attach_tap(struct ionic_eth_emu *emu, const char *ifname, char *out_ifname, size_t out_ifname_len)#
ssize_t ionic_eth_emu_bar0_access(struct ionic_eth_emu *emu, char *buf, size_t count, loff_t offset, bool is_write)#
ssize_t ionic_eth_emu_bar2_access(struct ionic_eth_emu *emu, char *buf, size_t count, loff_t offset, bool is_write)#
void ionic_eth_emu_count_rdma(struct ionic_eth_emu *emu, uint64_t bytes, bool is_tx)#
struct ionic_eth_emu *ionic_eth_emu_create(vfu_ctx_t *vfu_ctx, size_t bar2_size)#
void ionic_eth_emu_destroy(struct ionic_eth_emu *emu)#
const struct ionic_emu_stats *ionic_eth_emu_get_stats(struct ionic_eth_emu *emu)#
void ionic_eth_emu_get_tx_filter(const struct ionic_eth_emu *emu, ionic_eth_tx_filter_fn *fn, void **ctx)#
void ionic_eth_emu_poll_rx(struct ionic_eth_emu *emu)#
void ionic_eth_emu_publish_stats(struct ionic_eth_emu *emu, uint64_t now_ms)#
int ionic_eth_emu_queue_rx_frame(struct ionic_eth_emu *emu, const void *frame, size_t len)#
void ionic_eth_emu_register_adminq(struct ionic_eth_emu *emu, struct ionic_adminq_ctx *adminq)#
void ionic_eth_emu_register_datapath(struct ionic_eth_emu *emu, struct ionic_datapath *dp)#
void ionic_eth_emu_register_p4_handler(struct ionic_eth_emu *emu, ionic_rdma_devcmd_fn_t fn, void *opaque)#
void ionic_eth_emu_register_rdma_handler(struct ionic_eth_emu *emu, ionic_rdma_devcmd_fn_t fn, void *opaque)#
void ionic_eth_emu_register_rx_filter(struct ionic_eth_emu *emu, ionic_eth_rx_filter_fn fn, void *ctx)#
void ionic_eth_emu_register_tx_filter(struct ionic_eth_emu *emu, ionic_eth_tx_filter_fn fn, void *ctx)#
int ionic_eth_emu_send_to_net(const struct ionic_eth_emu *emu, const void *frame, size_t len)#
void ionic_eth_emu_set_faults(struct ionic_eth_emu *emu, const struct ionic_fault_set *faults)#
void ionic_eth_emu_set_mac(struct ionic_eth_emu *emu, const uint8_t mac[6])#
void ionic_eth_emu_set_profile(struct ionic_eth_emu *emu, const struct ionic_profile *profile)#
void ionic_eth_emu_set_stats(struct ionic_eth_emu *emu, struct ernic_stats *stats)#
int ionic_eth_emu_trigger_irq(struct ionic_eth_emu *emu, int vec)#
void ionic_eth_emu_write_stats(FILE *fp, void *opaque)#

RDMA devcmd Handler#

Defines

IONIC_CMD_RDMA_CREATE_ADMINQ#
IONIC_CMD_RDMA_CREATE_CQ#
IONIC_CMD_RDMA_CREATE_EQ#
IONIC_CMD_RDMA_RESET_LIF#

Typedefs

typedef int (*ionic_irq_trigger_fn_t)(void *opaque, int vec)#

Functions

struct ionic_rdma_devcmd_state *ionic_rdma_devcmd_create(vfu_ctx_t *vfu_ctx)#
void ionic_rdma_devcmd_destroy(struct ionic_rdma_devcmd_state *s)#
void ionic_rdma_devcmd_dispatch(void *opaque, const uint8_t *cmd, uint8_t *comp)#
struct ionic_adminq_ctx *ionic_rdma_devcmd_get_adminq_ctx(struct ionic_rdma_devcmd_state *s)#
int ionic_rdma_devcmd_post_cq_event(struct ionic_rdma_devcmd_state *s, uint32_t eq_id, uint32_t cq_id)#
void ionic_rdma_devcmd_set_datapath(struct ionic_rdma_devcmd_state *s, struct ionic_datapath *dp)#
void ionic_rdma_devcmd_set_eth_emu(struct ionic_rdma_devcmd_state *s, struct ionic_eth_emu *eth_emu)#
void ionic_rdma_devcmd_set_faults(struct ionic_rdma_devcmd_state *s, struct ionic_fault_set *faults)#
void ionic_rdma_devcmd_set_pvrdma(struct ionic_rdma_devcmd_state *s, pvrdma_handle_t handle)#
void ionic_rdma_devcmd_set_stats(struct ionic_rdma_devcmd_state *s, struct ernic_stats *stats)#

Admin Queue#

Defines

IONIC_ADMINQ_MAX_DEPTH_LOG2#

Typedefs

typedef void (*ionic_adminq_cq_event_fn_t)(void *opaque, uint32_t eq_id, uint32_t cq_id)#

Functions

struct ionic_adminq_ctx *ionic_adminq_create(vfu_ctx_t *vfu_ctx)#
void ionic_adminq_destroy(struct ionic_adminq_ctx *ctx)#
void ionic_adminq_poll(struct ionic_adminq_ctx *ctx, vfu_ctx_t *vfu_ctx)#
bool ionic_adminq_register_queue(struct ionic_adminq_ctx *ctx, int aq_idx, uint64_t aq_dma, uint8_t aq_depth_log2, uint64_t cq_dma, uint8_t cq_depth_log2, uint32_t cq_id, uint32_t eq_id)#
void ionic_adminq_release_all(struct ionic_adminq_ctx *ctx)#
void ionic_adminq_set_cq_event_cb(struct ionic_adminq_ctx *ctx, ionic_adminq_cq_event_fn_t fn, void *opaque)#
void ionic_adminq_set_datapath(struct ionic_adminq_ctx *ctx, struct ionic_datapath *dp)#
void ionic_adminq_set_faults(struct ionic_adminq_ctx *ctx, struct ionic_fault_set *faults)#
void ionic_adminq_set_pvrdma(struct ionic_adminq_ctx *ctx, pvrdma_handle_t handle)#
void ionic_adminq_set_stats(struct ionic_adminq_ctx *ctx, struct ernic_stats *stats)#
void ionic_adminq_update_prod(struct ionic_adminq_ctx *ctx, int aq_idx, uint16_t p_index)#

Datapath#

Defines

IONIC_CQ_MIN_STRIDE_LOG2#
IONIC_DP_DEVICE#
IONIC_DP_RDMA_COUNTERS(X)#
IONIC_DP_RDMA_ENUM(id, name)#
IONIC_RING_MAX_DEPTH_LOG2#
IONIC_RING_MAX_STRIDE_LOG2#
IONIC_SRQ_MAX_DEPTH_LOG2#
IONIC_SRQ_MAX_STRIDE_LOG2#
IONIC_SRQ_MIN_STRIDE_LOG2#
IONIC_SRQ_QID_BASE#
IONIC_WQE_MAX_STRIDE_LOG2#
IONIC_WQE_MIN_STRIDE_LOG2#

Typedefs

typedef void (*ionic_dp_cq_event_fn_t)(void *opaque, uint32_t eq_id, uint32_t cq_id)#

Enums

enum ionic_dp_rdma_counter#

Values:

enumerator IONIC_DP_REQ_RX_PKT_SEQ_ERR#
enumerator IONIC_DP_REQ_RX_RNR_RETRY_ERR#
enumerator IONIC_DP_REQ_RX_REMOTE_ACCESS_ERR#
enumerator IONIC_DP_REQ_RX_REMOTE_INV_REQ_ERR#
enumerator IONIC_DP_REQ_RX_REMOTE_OPER_ERR#
enumerator IONIC_DP_REQ_RX_IMPLIED_NAK_SEQ_ERR#
enumerator IONIC_DP_REQ_RX_CQE_ERR#
enumerator IONIC_DP_REQ_RX_CQE_FLUSH_ERR#
enumerator IONIC_DP_REQ_RX_DUP_RESPONSES#
enumerator IONIC_DP_REQ_RX_INVALID_PACKETS#
enumerator IONIC_DP_REQ_TX_LOCAL_ACCESS_ERR#
enumerator IONIC_DP_REQ_TX_LOCAL_OPER_ERR#
enumerator IONIC_DP_REQ_TX_MEMORY_MGMT_ERR#
enumerator IONIC_DP_RESP_RX_DUP_REQUESTS#
enumerator IONIC_DP_RESP_RX_OUT_OF_BUFFER#
enumerator IONIC_DP_RESP_RX_OUT_OF_SEQ_PKTS#
enumerator IONIC_DP_RESP_RX_CQE_ERR#
enumerator IONIC_DP_RESP_RX_CQE_FLUSH_ERR#
enumerator IONIC_DP_RESP_RX_LOCAL_LEN_ERR#
enumerator IONIC_DP_RESP_RX_INV_REQUEST_ERR#
enumerator IONIC_DP_RESP_RX_LOCAL_QP_OPER_ERR#
enumerator IONIC_DP_RESP_RX_OUT_OF_ATOMIC_RES#
enumerator IONIC_DP_RESP_TX_PKT_SEQ_ERR#
enumerator IONIC_DP_RESP_TX_REMOTE_INV_REQ_ERR#
enumerator IONIC_DP_RESP_TX_REMOTE_ACCESS_ERR#
enumerator IONIC_DP_RESP_TX_REMOTE_OPER_ERR#
enumerator IONIC_DP_RESP_TX_RNR_RETRY_ERR#
enumerator IONIC_DP_TX_CNP_PKTS#
enumerator IONIC_DP_RX_CNP_PKTS#
enumerator IONIC_DP_RX_ECN_PKTS#
enumerator IONIC_DP_RDMA_COUNT#

Functions

void ionic_datapath_bind_qp_srq(struct ionic_datapath *dp, uint32_t qp_id, uint32_t srq_id)#
struct ionic_datapath *ionic_datapath_create(vfu_ctx_t *vfu_ctx, struct ionic_eth_emu *eth_emu)#
void ionic_datapath_destroy(struct ionic_datapath *dp)#
void ionic_datapath_doorbell(struct ionic_datapath *dp, int qtype, uint64_t doorbell_val)#
void ionic_datapath_flush_qp(struct ionic_datapath *dp, uint32_t qp_id)#
bool ionic_datapath_has_work(struct ionic_datapath *dp)#
void ionic_datapath_poll(struct ionic_datapath *dp)#
void ionic_datapath_rdma_counters(const struct ionic_datapath *dp, uint32_t qp_id, uint64_t out[IONIC_DP_RDMA_COUNT])#
void ionic_datapath_register_ah(struct ionic_datapath *dp, uint32_t ah_id, const uint8_t dgid[ERNIC_GID_LEN], const uint8_t sgid[ERNIC_GID_LEN], const uint8_t dmac[6], uint32_t dest_node_id)#
int ionic_datapath_register_cq(struct ionic_datapath *dp, uint32_t cq_id, uint32_t eq_id, const struct ionic_dp_ring_desc *ring)#
int ionic_datapath_register_mr(struct ionic_datapath *dp, uint32_t lkey, uint64_t va, uint64_t length, const struct ionic_dp_buf_desc *buf)#
int ionic_datapath_register_qp(struct ionic_datapath *dp, uint32_t qp_id, uint8_t ib_qp_type, uint32_t sq_cq_id, const struct ionic_dp_ring_desc *sq, uint32_t rq_cq_id, const struct ionic_dp_ring_desc *rq)#
int ionic_datapath_register_srq(struct ionic_datapath *dp, uint32_t srq_id, const struct ionic_dp_ring_desc *rq)#
void ionic_datapath_reset_rdma(struct ionic_datapath *dp)#
void ionic_datapath_reset_rdma_counters(struct ionic_datapath *dp)#
void ionic_datapath_set_cq_event_cb(struct ionic_datapath *dp, ionic_dp_cq_event_fn_t fn, void *opaque)#
void ionic_datapath_set_dest(struct ionic_datapath *dp, uint32_t qp_id, uint32_t dest_qp_id, uint32_t dest_node_id)#
void ionic_datapath_set_pvrdma(struct ionic_datapath *dp, pvrdma_handle_t handle)#
void ionic_datapath_set_qkey(struct ionic_datapath *dp, uint32_t qp_id, uint32_t qkey)#
void ionic_datapath_set_stats(struct ionic_datapath *dp, struct ernic_stats *stats)#
void ionic_datapath_unregister_ah(struct ionic_datapath *dp, uint32_t ah_id)#
void ionic_datapath_unregister_cq(struct ionic_datapath *dp, uint32_t cq_id)#
void ionic_datapath_unregister_mr(struct ionic_datapath *dp, uint32_t lkey)#
void ionic_datapath_unregister_qp(struct ionic_datapath *dp, uint32_t qp_id)#
void ionic_datapath_unregister_srq(struct ionic_datapath *dp, uint32_t srq_id)#
static inline uint8_t ionic_dp_cq_stride_log2(const struct ionic_dp_ring_desc *ring)#
uint32_t ionic_dp_local_node(const struct ionic_datapath *dp)#
uint32_t ionic_dp_node_from_gid(const struct ionic_datapath *dp, const uint8_t *dgid)#
static inline bool ionic_dp_ring_geometry_ok(uint8_t depth_log2, uint8_t stride_log2, uint8_t min_stride_log2, uint8_t max_stride_log2)#
struct ionic_dp_buf_desc#
#include <ionic_datapath.h>

Public Members

uint64_t dma_addr#
uint32_t map_count#
uint8_t page_size_log2#
struct ionic_dp_ring_desc#
#include <ionic_datapath.h>

Public Members

struct ionic_dp_buf_desc buf#
uint8_t depth_log2#
uint8_t stride_log2#

Datapath Targets#

Defines

IONIC_MAX_MR_QUEUES#
IONIC_MR_PER_QUEUE#

Functions

bool ionic_datapath_attach_nvmeof(struct ionic_datapath *dp, const struct nvmeof_target_cfg *cfg, char *err, size_t errlen)#
bool ionic_datapath_nvmeof_cfg_check(const struct nvmeof_target_cfg *cfg, char *err, size_t errlen)#

Functions

bool ionic_datapath_attach_s3(struct ionic_datapath *dp, const struct s3_target_cfg *cfg, char *err, size_t errlen)#

P4 Attachment#

Built only with ERNIC_BUILD_P4.

Defines

IONIC_FP8_MAP_MAX#

Functions

int ionic_datapath_fmt_convert(struct ionic_datapath *dp, uint8_t src_fmt, uint8_t dst_fmt, uint32_t a_lkey, uint64_t a_va, uint32_t in_len, uint32_t c_rkey, uint64_t c_va)#
int ionic_datapath_fp8_map(struct ionic_datapath *dp, uint8_t op, uint32_t a_lkey, uint64_t a_va, uint32_t b_lkey, uint64_t b_va, uint32_t len, uint32_t c_rkey, uint64_t c_va)#
void ionic_datapath_set_p4_engine(struct ionic_datapath *dp, struct p4_engine *eng)#

Functions

struct ionic_eth_p4 *ionic_eth_p4_attach(struct ionic_eth_emu *emu, struct p4_engine *eng, const struct ionic_eth_p4_upstream *upstream)#
void ionic_eth_p4_detach(struct ionic_eth_p4 *ep)#
void ionic_eth_p4_get_stats(const struct ionic_eth_p4 *ep, struct ionic_eth_p4_stats *out)#
struct ionic_eth_p4_stats#
#include <ionic_eth_p4.h>

Public Members

uint64_t egress_errors#
uint64_t to_guest#
uint64_t to_net#
uint64_t to_upstream#
struct ionic_eth_p4_upstream#
#include <ionic_eth_p4.h>

Public Members

void *ctx#
bool (*fn)(void *ctx, const void *frame, size_t len)#