return ((struct ibv_context *)ctx)->device->ibdev_path;
}
+/**
+ * Get umem id. Given a pointer to umem object of type
+ * 'struct mlx5dv_devx_umem *' - return its id.
+ *
+ * @param[in] umem
+ * Pointer to umem object.
+ *
+ * @return
+ * The umem id if umem is valid, 0 otherwise.
+ */
+uint32_t
+mlx5_os_get_umem_id(void *umem)
+{
+ if (!umem)
+ return 0;
+ return ((struct mlx5dv_devx_umem *)umem)->umem_id;
+}
+
/**
* Get mlx5 device attributes. The glue function query_device_ex() is called
* with out parameter of type 'struct ibv_device_attr_ex *'. Then fill in mlx5
LIST_FOREACH(page, &priv->dbrpgs, next)
/* Find the page this address belongs to. */
- if (page->umem->umem_id == umem_id)
+ if (mlx5_os_get_umem_id(page->umem) == umem_id)
break;
if (!page)
return -EINVAL;
LIST_ENTRY(mlx5_counter_stats_mem_mng) next;
struct mlx5_counter_stats_raw *raws;
struct mlx5_devx_obj *dm;
- struct mlx5dv_devx_umem *umem;
+ void *umem;
};
/* Raw memory structure for the counter statistics values of a pool. */
/* Door-bell records, must be first member in structure. */
uint8_t dbrs[MLX5_DBR_PAGE_SIZE];
LIST_ENTRY(mlx5_devx_dbr_page) next; /* Pointer to the next element. */
- struct mlx5dv_devx_umem *umem;
+ void *umem;
uint32_t dbr_count; /* Number of door-bell records in use. */
/* 1 bit marks matching door-bell is in use. */
uint64_t dbr_bitmap[MLX5_DBR_BITMAP_SIZE];
/* mlx5_os.c */
const char *mlx5_os_get_ctx_device_name(void *ctx);
const char *mlx5_os_get_ctx_device_path(void *ctx);
+uint32_t mlx5_os_get_umem_id(void *umem);
int mlx5_os_get_dev_attr(void *ctx, struct mlx5_dev_attr *dev_attr);
#endif /* RTE_PMD_MLX5_H_ */
}
mkey_attr.addr = (uintptr_t)mem;
mkey_attr.size = size;
- mkey_attr.umem_id = mem_mng->umem->umem_id;
+ mkey_attr.umem_id = mlx5_os_get_umem_id(mem_mng->umem);
mkey_attr.pd = sh->pdn;
mkey_attr.log_entity_size = 0;
mkey_attr.pg_access = 0;
if (dbr_offset < 0)
goto error;
rxq_ctrl->dbr_offset = dbr_offset;
- rxq_ctrl->dbr_umem_id = dbr_page->umem->umem_id;
+ rxq_ctrl->dbr_umem_id = mlx5_os_get_umem_id(dbr_page->umem);
rxq_ctrl->dbr_umem_id_valid = 1;
rxq_data->rq_db = (uint32_t *)((uintptr_t)dbr_page->dbrs +
(uintptr_t)rxq_ctrl->dbr_offset);