From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4673BA0526; Mon, 20 Jan 2020 18:07:48 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D58D61C069; Mon, 20 Jan 2020 18:04:01 +0100 (CET) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id A172A1BFAB for ; Mon, 20 Jan 2020 18:03:14 +0100 (CET) Received: from Internal Mail-Server by MTLPINE1 (envelope-from asafp@mellanox.com) with ESMTPS (AES256-SHA encrypted); 20 Jan 2020 19:03:13 +0200 Received: from pegasus07.mtr.labs.mlnx (pegasus07.mtr.labs.mlnx [10.210.16.112]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 00KH3BGj024424; Mon, 20 Jan 2020 19:03:13 +0200 From: Matan Azrad To: dev@dpdk.org Cc: Maxime Coquelin , Thomas Monjalon Date: Mon, 20 Jan 2020 17:02:58 +0000 Message-Id: <1579539790-3882-27-git-send-email-matan@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1579539790-3882-1-git-send-email-matan@mellanox.com> References: <1579539790-3882-1-git-send-email-matan@mellanox.com> Subject: [dpdk-dev] [PATCH v1 26/38] common/mlx5: add DevX command to modify RQT X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" RQ table can be changed to support different list of queues. Add DevX command to modify DevX RQT object to point on new RQ list. Signed-off-by: Matan Azrad --- drivers/common/mlx5/mlx5_devx_cmds.c | 47 +++++++++++++++++++++++++ drivers/common/mlx5/mlx5_devx_cmds.h | 2 ++ drivers/common/mlx5/mlx5_prm.h | 21 +++++++++++ drivers/common/mlx5/rte_common_mlx5_version.map | 1 + 4 files changed, 71 insertions(+) diff --git a/drivers/common/mlx5/mlx5_devx_cmds.c b/drivers/common/mlx5/mlx5_devx_cmds.c index 3b0d7bd..badd51e 100644 --- a/drivers/common/mlx5/mlx5_devx_cmds.c +++ b/drivers/common/mlx5/mlx5_devx_cmds.c @@ -862,6 +862,53 @@ struct mlx5_devx_obj * } /** + * Modify RQT using DevX API. + * + * @param[in] rqt + * Pointer to RQT DevX object structure. + * @param [in] rqt_attr + * Pointer to RQT attributes structure. + * + * @return + * 0 on success, a negative errno value otherwise and rte_errno is set. + */ +int +mlx5_devx_cmd_modify_rqt(struct mlx5_devx_obj *rqt, + struct mlx5_devx_rqt_attr *rqt_attr) +{ + uint32_t inlen = MLX5_ST_SZ_BYTES(modify_rqt_in) + + rqt_attr->rqt_actual_size * sizeof(uint32_t); + uint32_t out[MLX5_ST_SZ_DW(modify_rqt_out)] = {0}; + uint32_t *in = rte_calloc(__func__, 1, inlen, 0); + void *rqt_ctx; + int i; + int ret; + + if (!in) { + DRV_LOG(ERR, "Failed to allocate RQT modify IN data."); + rte_errno = ENOMEM; + return -ENOMEM; + } + MLX5_SET(modify_rqt_in, in, opcode, MLX5_CMD_OP_MODIFY_RQT); + MLX5_SET(modify_rqt_in, in, rqtn, rqt->id); + MLX5_SET64(modify_rqt_in, in, modify_bitmask, 0x1); + rqt_ctx = MLX5_ADDR_OF(modify_rqt_in, in, rqt_context); + MLX5_SET(rqtc, rqt_ctx, list_q_type, rqt_attr->rq_type); + 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]); + ret = mlx5_glue->devx_obj_modify(rqt->obj, in, inlen, out, sizeof(out)); + rte_free(in); + if (ret) { + DRV_LOG(ERR, "Failed to modify RQT using DevX."); + rte_errno = errno; + return -rte_errno; + } + return ret; +} + +/** * Create SQ using DevX API. * * @param[in] ctx diff --git a/drivers/common/mlx5/mlx5_devx_cmds.h b/drivers/common/mlx5/mlx5_devx_cmds.h index 065b02a..1f635bb 100644 --- a/drivers/common/mlx5/mlx5_devx_cmds.h +++ b/drivers/common/mlx5/mlx5_devx_cmds.h @@ -315,5 +315,7 @@ int mlx5_devx_cmd_modify_virtq(struct mlx5_devx_obj *virtq_obj, struct mlx5_devx_virtq_attr *attr); int mlx5_devx_cmd_query_virtq(struct mlx5_devx_obj *virtq_obj, struct mlx5_devx_virtq_attr *attr); +int mlx5_devx_cmd_modify_rqt(struct mlx5_devx_obj *rqt, + struct mlx5_devx_rqt_attr *rqt_attr); #endif /* RTE_PMD_MLX5_DEVX_CMDS_H_ */ diff --git a/drivers/common/mlx5/mlx5_prm.h b/drivers/common/mlx5/mlx5_prm.h index f45383d..8984b8c 100644 --- a/drivers/common/mlx5/mlx5_prm.h +++ b/drivers/common/mlx5/mlx5_prm.h @@ -738,6 +738,7 @@ enum { MLX5_CMD_OP_CREATE_TIS = 0x912, MLX5_CMD_OP_QUERY_TIS = 0x915, MLX5_CMD_OP_CREATE_RQT = 0x916, + MLX5_CMD_OP_MODIFY_RQT = 0x917, MLX5_CMD_OP_ALLOC_FLOW_COUNTER = 0x939, MLX5_CMD_OP_QUERY_FLOW_COUNTER = 0x93b, MLX5_CMD_OP_CREATE_GENERAL_OBJECT = 0xa00, @@ -1760,10 +1761,30 @@ struct mlx5_ifc_create_rqt_in_bits { u8 reserved_at_40[0xc0]; struct mlx5_ifc_rqtc_bits rqt_context; }; + +struct mlx5_ifc_modify_rqt_in_bits { + u8 opcode[0x10]; + u8 uid[0x10]; + u8 reserved_at_20[0x10]; + u8 op_mod[0x10]; + u8 reserved_at_40[0x8]; + u8 rqtn[0x18]; + u8 reserved_at_60[0x20]; + u8 modify_bitmask[0x40]; + u8 reserved_at_c0[0x40]; + struct mlx5_ifc_rqtc_bits rqt_context; +}; #ifdef PEDANTIC #pragma GCC diagnostic error "-Wpedantic" #endif +struct mlx5_ifc_modify_rqt_out_bits { + u8 status[0x8]; + u8 reserved_at_8[0x18]; + u8 syndrome[0x20]; + u8 reserved_at_40[0x40]; +}; + enum { MLX5_SQC_STATE_RST = 0x0, MLX5_SQC_STATE_RDY = 0x1, diff --git a/drivers/common/mlx5/rte_common_mlx5_version.map b/drivers/common/mlx5/rte_common_mlx5_version.map index f3082ce..37a6902 100644 --- a/drivers/common/mlx5/rte_common_mlx5_version.map +++ b/drivers/common/mlx5/rte_common_mlx5_version.map @@ -15,6 +15,7 @@ DPDK_20.02 { mlx5_devx_cmd_flow_dump; mlx5_devx_cmd_mkey_create; mlx5_devx_cmd_modify_rq; + mlx5_devx_cmd_modify_rqt; mlx5_devx_cmd_modify_sq; mlx5_devx_cmd_modify_virtq; mlx5_devx_cmd_qp_query_tis_td; -- 1.8.3.1