net/mlx5: create advanced RxQ table via DevX
Implement function mlx5_devx_cmd_create_rqt() to create RQT object using DevX API. Add related structs in mlx5.h and mlx5_prm.h. Signed-off-by: Dekel Peled <dekelp@mellanox.com> Acked-by: Matan Azrad <matan@mellanox.com> Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
This commit is contained in:
parent
c3aea272ee
commit
718d166e55
@ -344,6 +344,13 @@ struct mlx5_devx_tir_attr {
|
||||
struct mlx5_rx_hash_field_select rx_hash_field_selector_inner;
|
||||
};
|
||||
|
||||
/* RQT attributes structure, used by RQT operations. */
|
||||
struct mlx5_devx_rqt_attr {
|
||||
uint32_t rqt_max_size:16;
|
||||
uint32_t rqt_actual_size:16;
|
||||
uint32_t rq_list[];
|
||||
};
|
||||
|
||||
/**
|
||||
* Type of object being allocated.
|
||||
*/
|
||||
@ -831,5 +838,7 @@ int mlx5_devx_cmd_modify_rq(struct mlx5_devx_obj *rq,
|
||||
struct mlx5_devx_modify_rq_attr *rq_attr);
|
||||
struct mlx5_devx_obj *mlx5_devx_cmd_create_tir(struct ibv_context *ctx,
|
||||
struct mlx5_devx_tir_attr *tir_attr);
|
||||
struct mlx5_devx_obj *mlx5_devx_cmd_create_rqt(struct ibv_context *ctx,
|
||||
struct mlx5_devx_rqt_attr *rqt_attr);
|
||||
|
||||
#endif /* RTE_PMD_MLX5_H_ */
|
||||
|
@ -648,3 +648,57 @@ mlx5_devx_cmd_create_tir(struct ibv_context *ctx,
|
||||
tir->id = MLX5_GET(create_tir_out, out, tirn);
|
||||
return tir;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create RQT using DevX API.
|
||||
*
|
||||
* @param[in] ctx
|
||||
* ibv_context returned from mlx5dv_open_device.
|
||||
* @param [in] rqt_attr
|
||||
* Pointer to RQT attributes structure.
|
||||
*
|
||||
* @return
|
||||
* The DevX object created, NULL otherwise and rte_errno is set.
|
||||
*/
|
||||
struct mlx5_devx_obj *
|
||||
mlx5_devx_cmd_create_rqt(struct ibv_context *ctx,
|
||||
struct mlx5_devx_rqt_attr *rqt_attr)
|
||||
{
|
||||
uint32_t *in = NULL;
|
||||
uint32_t inlen = MLX5_ST_SZ_BYTES(create_rqt_in) +
|
||||
rqt_attr->rqt_actual_size * sizeof(uint32_t);
|
||||
uint32_t out[MLX5_ST_SZ_DW(create_rqt_out)] = {0};
|
||||
void *rqt_ctx;
|
||||
struct mlx5_devx_obj *rqt = NULL;
|
||||
int i;
|
||||
|
||||
in = rte_calloc(__func__, 1, inlen, 0);
|
||||
if (!in) {
|
||||
DRV_LOG(ERR, "Failed to allocate RQT IN data");
|
||||
rte_errno = ENOMEM;
|
||||
return NULL;
|
||||
}
|
||||
rqt = rte_calloc(__func__, 1, sizeof(*rqt), 0);
|
||||
if (!rqt) {
|
||||
DRV_LOG(ERR, "Failed to allocate RQT data");
|
||||
rte_errno = ENOMEM;
|
||||
rte_free(in);
|
||||
return NULL;
|
||||
}
|
||||
MLX5_SET(create_rqt_in, in, opcode, MLX5_CMD_OP_CREATE_RQT);
|
||||
rqt_ctx = MLX5_ADDR_OF(create_rqt_in, in, rqt_context);
|
||||
MLX5_SET(rqtc, rqt_ctx, rqt_max_size, rqt_attr->rqt_max_size);
|
||||
MLX5_SET(rqtc, rqt_ctx, rqt_actual_size, rqt_attr->rqt_actual_size);
|
||||
for (i = 0; i < rqt_attr->rqt_actual_size; i++)
|
||||
MLX5_SET(rqtc, rqt_ctx, rq_num[i], rqt_attr->rq_list[i]);
|
||||
rqt->obj = mlx5_glue->devx_obj_create(ctx, in, inlen, out, sizeof(out));
|
||||
rte_free(in);
|
||||
if (!rqt->obj) {
|
||||
DRV_LOG(ERR, "Failed to create RQT using DevX");
|
||||
rte_errno = errno;
|
||||
rte_free(rqt);
|
||||
return NULL;
|
||||
}
|
||||
rqt->id = MLX5_GET(create_rqt_out, out, rqtn);
|
||||
return rqt;
|
||||
}
|
||||
|
@ -631,6 +631,7 @@ enum {
|
||||
MLX5_CMD_OP_CREATE_RQ = 0x908,
|
||||
MLX5_CMD_OP_MODIFY_RQ = 0x909,
|
||||
MLX5_CMD_OP_QUERY_TIS = 0x915,
|
||||
MLX5_CMD_OP_CREATE_RQT = 0x916,
|
||||
MLX5_CMD_OP_ALLOC_FLOW_COUNTER = 0x939,
|
||||
MLX5_CMD_OP_QUERY_FLOW_COUNTER = 0x93b,
|
||||
};
|
||||
@ -1488,6 +1489,45 @@ struct mlx5_ifc_create_tir_in_bits {
|
||||
struct mlx5_ifc_tirc_bits ctx;
|
||||
};
|
||||
|
||||
struct mlx5_ifc_rq_num_bits {
|
||||
u8 reserved_at_0[0x8];
|
||||
u8 rq_num[0x18];
|
||||
};
|
||||
|
||||
struct mlx5_ifc_rqtc_bits {
|
||||
u8 reserved_at_0[0xa0];
|
||||
u8 reserved_at_a0[0x10];
|
||||
u8 rqt_max_size[0x10];
|
||||
u8 reserved_at_c0[0x10];
|
||||
u8 rqt_actual_size[0x10];
|
||||
u8 reserved_at_e0[0x6a0];
|
||||
struct mlx5_ifc_rq_num_bits rq_num[];
|
||||
};
|
||||
|
||||
struct mlx5_ifc_create_rqt_out_bits {
|
||||
u8 status[0x8];
|
||||
u8 reserved_at_8[0x18];
|
||||
u8 syndrome[0x20];
|
||||
u8 reserved_at_40[0x8];
|
||||
u8 rqtn[0x18];
|
||||
u8 reserved_at_60[0x20];
|
||||
};
|
||||
|
||||
#ifdef PEDANTIC
|
||||
#pragma GCC diagnostic ignored "-Wpedantic"
|
||||
#endif
|
||||
struct mlx5_ifc_create_rqt_in_bits {
|
||||
u8 opcode[0x10];
|
||||
u8 uid[0x10];
|
||||
u8 reserved_at_20[0x10];
|
||||
u8 op_mod[0x10];
|
||||
u8 reserved_at_40[0xc0];
|
||||
struct mlx5_ifc_rqtc_bits rqt_context;
|
||||
};
|
||||
#ifdef PEDANTIC
|
||||
#pragma GCC diagnostic error "-Wpedantic"
|
||||
#endif
|
||||
|
||||
/* CQE format mask. */
|
||||
#define MLX5E_CQE_FORMAT_MASK 0xc
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user