From: Ophir Munk <ophirmu@mellanox.com>
To: dev@dpdk.org, David Marchand <david.marchand@redhat.com>
Cc: Ray Kinsella <mdr@ashroe.eu>, Matan Azrad <matan@mellanox.com>,
Raslan Darawsheh <rasland@mellanox.com>,
Thomas Monjalon <homas@monjalon.net>,
Ophir Munk <ophirmu@mellanox.com>
Subject: [dpdk-dev] [PATCH v2 2/2] common/mlx5: remove devx dependency on ibv and DV
Date: Thu, 7 May 2020 07:37:02 +0000 [thread overview]
Message-ID: <20200507073702.4047-3-ophirmu@mellanox.com> (raw)
In-Reply-To: <20200507073702.4047-1-ophirmu@mellanox.com>
File mlx5_devx_cmds.c should contain pure DevX calls. It must be OS
agnostic and not include any references to ibv or dv structs (defined in
ibverbs and rdma-core linux libraries). This commit replaces all ibv
and dv references with 'void *'. Specifically, the following struct
were replaced:
1. struct ibv_context *
2. struct ibv_qp *
3. struct mlx5dv_devx_cmd_comp *
Signed-off-by: Ophir Munk <ophirmu@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
---
drivers/common/mlx5/mlx5_devx_cmds.c | 59 ++++++++++++++++++------------------
drivers/common/mlx5/mlx5_devx_cmds.h | 30 +++++++++---------
2 files changed, 44 insertions(+), 45 deletions(-)
diff --git a/drivers/common/mlx5/mlx5_devx_cmds.c b/drivers/common/mlx5/mlx5_devx_cmds.c
index 67c8a8c..230ac58 100644
--- a/drivers/common/mlx5/mlx5_devx_cmds.c
+++ b/drivers/common/mlx5/mlx5_devx_cmds.c
@@ -15,7 +15,7 @@
* Allocate flow counters via devx interface.
*
* @param[in] ctx
- * ibv contexts returned from mlx5dv_open_device.
+ * Context returned from mlx5 open_device() glue function.
* @param dcs
* Pointer to counters properties structure to be filled by the routine.
* @param bulk_n_128
@@ -26,7 +26,7 @@
* rte_errno is set.
*/
struct mlx5_devx_obj *
-mlx5_devx_cmd_flow_counter_alloc(struct ibv_context *ctx, uint32_t bulk_n_128)
+mlx5_devx_cmd_flow_counter_alloc(void *ctx, uint32_t bulk_n_128)
{
struct mlx5_devx_obj *dcs = rte_zmalloc("dcs", sizeof(*dcs), 0);
uint32_t in[MLX5_ST_SZ_DW(alloc_flow_counter_in)] = {0};
@@ -81,7 +81,7 @@ mlx5_devx_cmd_flow_counter_query(struct mlx5_devx_obj *dcs,
int clear, uint32_t n_counters,
uint64_t *pkts, uint64_t *bytes,
uint32_t mkey, void *addr,
- struct mlx5dv_devx_cmd_comp *cmd_comp,
+ void *cmd_comp,
uint64_t async_id)
{
int out_len = MLX5_ST_SZ_BYTES(query_flow_counter_out) +
@@ -130,7 +130,7 @@ mlx5_devx_cmd_flow_counter_query(struct mlx5_devx_obj *dcs,
* Create a new mkey.
*
* @param[in] ctx
- * ibv contexts returned from mlx5dv_open_device.
+ * Context returned from mlx5 open_device() glue function.
* @param[in] attr
* Attributes of the requested mkey.
*
@@ -139,7 +139,7 @@ mlx5_devx_cmd_flow_counter_query(struct mlx5_devx_obj *dcs,
* is set.
*/
struct mlx5_devx_obj *
-mlx5_devx_cmd_mkey_create(struct ibv_context *ctx,
+mlx5_devx_cmd_mkey_create(void *ctx,
struct mlx5_devx_mkey_attr *attr)
{
struct mlx5_klm *klm_array = attr->klm_array;
@@ -279,7 +279,7 @@ mlx5_devx_cmd_destroy(struct mlx5_devx_obj *obj)
* 0 on success, a negative value otherwise.
*/
static int
-mlx5_devx_cmd_query_nic_vport_context(struct ibv_context *ctx,
+mlx5_devx_cmd_query_nic_vport_context(void *ctx,
unsigned int vport,
struct mlx5_hca_attr *attr)
{
@@ -321,12 +321,12 @@ mlx5_devx_cmd_query_nic_vport_context(struct ibv_context *ctx,
* Query NIC vDPA attributes.
*
* @param[in] ctx
- * ibv contexts returned from mlx5dv_open_device.
+ * Context returned from mlx5 open_device() glue function.
* @param[out] vdpa_attr
* vDPA Attributes structure to fill.
*/
static void
-mlx5_devx_cmd_query_hca_vdpa_attr(struct ibv_context *ctx,
+mlx5_devx_cmd_query_hca_vdpa_attr(void *ctx,
struct mlx5_hca_vdpa_attr *vdpa_attr)
{
uint32_t in[MLX5_ST_SZ_DW(query_hca_cap_in)] = {0};
@@ -402,7 +402,7 @@ mlx5_devx_cmd_query_hca_vdpa_attr(struct ibv_context *ctx,
* is having the required capabilities.
*
* @param[in] ctx
- * ibv contexts returned from mlx5dv_open_device.
+ * Context returned from mlx5 open_device() glue function.
* @param[out] attr
* Attributes device values.
*
@@ -410,7 +410,7 @@ mlx5_devx_cmd_query_hca_vdpa_attr(struct ibv_context *ctx,
* 0 on success, a negative value otherwise.
*/
int
-mlx5_devx_cmd_query_hca_attr(struct ibv_context *ctx,
+mlx5_devx_cmd_query_hca_attr(void *ctx,
struct mlx5_hca_attr *attr)
{
uint32_t in[MLX5_ST_SZ_DW(query_hca_cap_in)] = {0};
@@ -570,7 +570,7 @@ mlx5_devx_cmd_query_hca_attr(struct ibv_context *ctx,
* 0 on success, a negative value otherwise.
*/
int
-mlx5_devx_cmd_qp_query_tis_td(struct ibv_qp *qp, uint32_t tis_num,
+mlx5_devx_cmd_qp_query_tis_td(void *qp, uint32_t tis_num,
uint32_t *tis_td)
{
uint32_t in[MLX5_ST_SZ_DW(query_tis_in)] = {0};
@@ -637,7 +637,7 @@ devx_cmd_fill_wq_data(void *wq_ctx, struct mlx5_devx_wq_attr *wq_attr)
* Create RQ using DevX API.
*
* @param[in] ctx
- * ibv_context returned from mlx5dv_open_device.
+ * Context returned from mlx5 open_device() glue function.
* @param [in] rq_attr
* Pointer to create RQ attributes structure.
* @param [in] socket
@@ -647,7 +647,7 @@ devx_cmd_fill_wq_data(void *wq_ctx, struct mlx5_devx_wq_attr *wq_attr)
* The DevX object created, NULL otherwise and rte_errno is set.
*/
struct mlx5_devx_obj *
-mlx5_devx_cmd_create_rq(struct ibv_context *ctx,
+mlx5_devx_cmd_create_rq(void *ctx,
struct mlx5_devx_create_rq_attr *rq_attr,
int socket)
{
@@ -746,7 +746,7 @@ mlx5_devx_cmd_modify_rq(struct mlx5_devx_obj *rq,
* Create TIR using DevX API.
*
* @param[in] ctx
- * ibv_context returned from mlx5dv_open_device.
+ * Context returned from mlx5 open_device() glue function.
* @param [in] tir_attr
* Pointer to TIR attributes structure.
*
@@ -754,7 +754,7 @@ mlx5_devx_cmd_modify_rq(struct mlx5_devx_obj *rq,
* The DevX object created, NULL otherwise and rte_errno is set.
*/
struct mlx5_devx_obj *
-mlx5_devx_cmd_create_tir(struct ibv_context *ctx,
+mlx5_devx_cmd_create_tir(void *ctx,
struct mlx5_devx_tir_attr *tir_attr)
{
uint32_t in[MLX5_ST_SZ_DW(create_tir_in)] = {0};
@@ -815,7 +815,7 @@ mlx5_devx_cmd_create_tir(struct ibv_context *ctx,
* Create RQT using DevX API.
*
* @param[in] ctx
- * ibv_context returned from mlx5dv_open_device.
+ * Context returned from mlx5 open_device() glue function.
* @param [in] rqt_attr
* Pointer to RQT attributes structure.
*
@@ -823,7 +823,7 @@ mlx5_devx_cmd_create_tir(struct ibv_context *ctx,
* The DevX object created, NULL otherwise and rte_errno is set.
*/
struct mlx5_devx_obj *
-mlx5_devx_cmd_create_rqt(struct ibv_context *ctx,
+mlx5_devx_cmd_create_rqt(void *ctx,
struct mlx5_devx_rqt_attr *rqt_attr)
{
uint32_t *in = NULL;
@@ -917,7 +917,7 @@ mlx5_devx_cmd_modify_rqt(struct mlx5_devx_obj *rqt,
* Create SQ using DevX API.
*
* @param[in] ctx
- * ibv_context returned from mlx5dv_open_device.
+ * Context returned from mlx5 open_device() glue function.
* @param [in] sq_attr
* Pointer to SQ attributes structure.
* @param [in] socket
@@ -927,7 +927,7 @@ mlx5_devx_cmd_modify_rqt(struct mlx5_devx_obj *rqt,
* The DevX object created, NULL otherwise and rte_errno is set.
**/
struct mlx5_devx_obj *
-mlx5_devx_cmd_create_sq(struct ibv_context *ctx,
+mlx5_devx_cmd_create_sq(void *ctx,
struct mlx5_devx_create_sq_attr *sq_attr)
{
uint32_t in[MLX5_ST_SZ_DW(create_sq_in)] = {0};
@@ -1019,7 +1019,7 @@ mlx5_devx_cmd_modify_sq(struct mlx5_devx_obj *sq,
* Create TIS using DevX API.
*
* @param[in] ctx
- * ibv_context returned from mlx5dv_open_device.
+ * Context returned from mlx5 open_device() glue function.
* @param [in] tis_attr
* Pointer to TIS attributes structure.
*
@@ -1027,7 +1027,7 @@ mlx5_devx_cmd_modify_sq(struct mlx5_devx_obj *sq,
* The DevX object created, NULL otherwise and rte_errno is set.
*/
struct mlx5_devx_obj *
-mlx5_devx_cmd_create_tis(struct ibv_context *ctx,
+mlx5_devx_cmd_create_tis(void *ctx,
struct mlx5_devx_tis_attr *tis_attr)
{
uint32_t in[MLX5_ST_SZ_DW(create_tis_in)] = {0};
@@ -1066,13 +1066,12 @@ mlx5_devx_cmd_create_tis(struct ibv_context *ctx,
* Create transport domain using DevX API.
*
* @param[in] ctx
- * ibv_context returned from mlx5dv_open_device.
- *
+ * Context returned from mlx5 open_device() glue function.
* @return
* The DevX object created, NULL otherwise and rte_errno is set.
*/
struct mlx5_devx_obj *
-mlx5_devx_cmd_create_td(struct ibv_context *ctx)
+mlx5_devx_cmd_create_td(void *ctx)
{
uint32_t in[MLX5_ST_SZ_DW(alloc_transport_domain_in)] = {0};
uint32_t out[MLX5_ST_SZ_DW(alloc_transport_domain_out)] = {0};
@@ -1143,7 +1142,7 @@ mlx5_devx_cmd_flow_dump(void *fdb_domain __rte_unused,
* Create CQ using DevX API.
*
* @param[in] ctx
- * ibv_context returned from mlx5dv_open_device.
+ * Context returned from mlx5 open_device() glue function.
* @param [in] attr
* Pointer to CQ attributes structure.
*
@@ -1151,7 +1150,7 @@ mlx5_devx_cmd_flow_dump(void *fdb_domain __rte_unused,
* The DevX object created, NULL otherwise and rte_errno is set.
*/
struct mlx5_devx_obj *
-mlx5_devx_cmd_create_cq(struct ibv_context *ctx, struct mlx5_devx_cq_attr *attr)
+mlx5_devx_cmd_create_cq(void *ctx, struct mlx5_devx_cq_attr *attr)
{
uint32_t in[MLX5_ST_SZ_DW(create_cq_in)] = {0};
uint32_t out[MLX5_ST_SZ_DW(create_cq_out)] = {0};
@@ -1201,7 +1200,7 @@ mlx5_devx_cmd_create_cq(struct ibv_context *ctx, struct mlx5_devx_cq_attr *attr)
* Create VIRTQ using DevX API.
*
* @param[in] ctx
- * ibv_context returned from mlx5dv_open_device.
+ * Context returned from mlx5 open_device() glue function.
* @param [in] attr
* Pointer to VIRTQ attributes structure.
*
@@ -1209,7 +1208,7 @@ mlx5_devx_cmd_create_cq(struct ibv_context *ctx, struct mlx5_devx_cq_attr *attr)
* The DevX object created, NULL otherwise and rte_errno is set.
*/
struct mlx5_devx_obj *
-mlx5_devx_cmd_create_virtq(struct ibv_context *ctx,
+mlx5_devx_cmd_create_virtq(void *ctx,
struct mlx5_devx_virtq_attr *attr)
{
uint32_t in[MLX5_ST_SZ_DW(create_virtq_in)] = {0};
@@ -1370,7 +1369,7 @@ mlx5_devx_cmd_query_virtq(struct mlx5_devx_obj *virtq_obj,
* Create QP using DevX API.
*
* @param[in] ctx
- * ibv_context returned from mlx5dv_open_device.
+ * Context returned from mlx5 open_device() glue function.
* @param [in] attr
* Pointer to QP attributes structure.
*
@@ -1378,7 +1377,7 @@ mlx5_devx_cmd_query_virtq(struct mlx5_devx_obj *virtq_obj,
* The DevX object created, NULL otherwise and rte_errno is set.
*/
struct mlx5_devx_obj *
-mlx5_devx_cmd_create_qp(struct ibv_context *ctx,
+mlx5_devx_cmd_create_qp(void *ctx,
struct mlx5_devx_qp_attr *attr)
{
uint32_t in[MLX5_ST_SZ_DW(create_qp_in)] = {0};
diff --git a/drivers/common/mlx5/mlx5_devx_cmds.h b/drivers/common/mlx5/mlx5_devx_cmds.h
index 6dc27da..ac10687 100644
--- a/drivers/common/mlx5/mlx5_devx_cmds.h
+++ b/drivers/common/mlx5/mlx5_devx_cmds.h
@@ -11,7 +11,7 @@
/* devX creation object */
struct mlx5_devx_obj {
- struct mlx5dv_devx_obj *obj; /* The DV object. */
+ void *obj; /* The DV object. */
int id; /* The object ID. */
};
@@ -301,7 +301,7 @@ struct mlx5_devx_qp_attr {
/* mlx5_devx_cmds.c */
__rte_internal
-struct mlx5_devx_obj *mlx5_devx_cmd_flow_counter_alloc(struct ibv_context *ctx,
+struct mlx5_devx_obj *mlx5_devx_cmd_flow_counter_alloc(void *ctx,
uint32_t bulk_sz);
__rte_internal
int mlx5_devx_cmd_destroy(struct mlx5_devx_obj *obj);
@@ -310,51 +310,51 @@ int mlx5_devx_cmd_flow_counter_query(struct mlx5_devx_obj *dcs,
int clear, uint32_t n_counters,
uint64_t *pkts, uint64_t *bytes,
uint32_t mkey, void *addr,
- struct mlx5dv_devx_cmd_comp *cmd_comp,
+ void *cmd_comp,
uint64_t async_id);
__rte_internal
-int mlx5_devx_cmd_query_hca_attr(struct ibv_context *ctx,
+int mlx5_devx_cmd_query_hca_attr(void *ctx,
struct mlx5_hca_attr *attr);
__rte_internal
-struct mlx5_devx_obj *mlx5_devx_cmd_mkey_create(struct ibv_context *ctx,
+struct mlx5_devx_obj *mlx5_devx_cmd_mkey_create(void *ctx,
struct mlx5_devx_mkey_attr *attr);
__rte_internal
int mlx5_devx_get_out_command_status(void *out);
__rte_internal
-int mlx5_devx_cmd_qp_query_tis_td(struct ibv_qp *qp, uint32_t tis_num,
+int mlx5_devx_cmd_qp_query_tis_td(void *qp, uint32_t tis_num,
uint32_t *tis_td);
__rte_internal
-struct mlx5_devx_obj *mlx5_devx_cmd_create_rq(struct ibv_context *ctx,
+struct mlx5_devx_obj *mlx5_devx_cmd_create_rq(void *ctx,
struct mlx5_devx_create_rq_attr *rq_attr,
int socket);
__rte_internal
int mlx5_devx_cmd_modify_rq(struct mlx5_devx_obj *rq,
struct mlx5_devx_modify_rq_attr *rq_attr);
__rte_internal
-struct mlx5_devx_obj *mlx5_devx_cmd_create_tir(struct ibv_context *ctx,
+struct mlx5_devx_obj *mlx5_devx_cmd_create_tir(void *ctx,
struct mlx5_devx_tir_attr *tir_attr);
__rte_internal
-struct mlx5_devx_obj *mlx5_devx_cmd_create_rqt(struct ibv_context *ctx,
+struct mlx5_devx_obj *mlx5_devx_cmd_create_rqt(void *ctx,
struct mlx5_devx_rqt_attr *rqt_attr);
__rte_internal
-struct mlx5_devx_obj *mlx5_devx_cmd_create_sq(struct ibv_context *ctx,
+struct mlx5_devx_obj *mlx5_devx_cmd_create_sq(void *ctx,
struct mlx5_devx_create_sq_attr *sq_attr);
__rte_internal
int mlx5_devx_cmd_modify_sq(struct mlx5_devx_obj *sq,
struct mlx5_devx_modify_sq_attr *sq_attr);
__rte_internal
-struct mlx5_devx_obj *mlx5_devx_cmd_create_tis(struct ibv_context *ctx,
+struct mlx5_devx_obj *mlx5_devx_cmd_create_tis(void *ctx,
struct mlx5_devx_tis_attr *tis_attr);
__rte_internal
-struct mlx5_devx_obj *mlx5_devx_cmd_create_td(struct ibv_context *ctx);
+struct mlx5_devx_obj *mlx5_devx_cmd_create_td(void *ctx);
__rte_internal
int mlx5_devx_cmd_flow_dump(void *fdb_domain, void *rx_domain, void *tx_domain,
FILE *file);
__rte_internal
-struct mlx5_devx_obj *mlx5_devx_cmd_create_cq(struct ibv_context *ctx,
+struct mlx5_devx_obj *mlx5_devx_cmd_create_cq(void *ctx,
struct mlx5_devx_cq_attr *attr);
__rte_internal
-struct mlx5_devx_obj *mlx5_devx_cmd_create_virtq(struct ibv_context *ctx,
+struct mlx5_devx_obj *mlx5_devx_cmd_create_virtq(void *ctx,
struct mlx5_devx_virtq_attr *attr);
__rte_internal
int mlx5_devx_cmd_modify_virtq(struct mlx5_devx_obj *virtq_obj,
@@ -363,7 +363,7 @@ __rte_internal
int mlx5_devx_cmd_query_virtq(struct mlx5_devx_obj *virtq_obj,
struct mlx5_devx_virtq_attr *attr);
__rte_internal
-struct mlx5_devx_obj *mlx5_devx_cmd_create_qp(struct ibv_context *ctx,
+struct mlx5_devx_obj *mlx5_devx_cmd_create_qp(void *ctx,
struct mlx5_devx_qp_attr *attr);
__rte_internal
int mlx5_devx_cmd_modify_qp_state(struct mlx5_devx_obj *qp,
--
2.8.4
prev parent reply other threads:[~2020-05-07 7:37 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-05 11:20 [dpdk-dev] [PATCH v1 1/3] devtools: create internal ignore file for libabigail Ophir Munk
2020-05-05 11:20 ` [dpdk-dev] [PATCH v1 2/3] common/mlx5: add rte internal tag Ophir Munk
2020-05-05 11:46 ` Matan Azrad
2020-05-05 11:20 ` [dpdk-dev] [PATCH v1 3/3] common/mlx5: remove devx dependency on ibv and DV Ophir Munk
2020-05-05 11:45 ` [dpdk-dev] [PATCH v1 1/3] devtools: create internal ignore file for libabigail Matan Azrad
2020-05-05 14:53 ` David Marchand
2020-05-05 15:02 ` Ray Kinsella
2020-05-06 12:27 ` Thomas Monjalon
2020-05-06 12:42 ` David Marchand
2020-05-06 12:52 ` Thomas Monjalon
2020-05-06 14:15 ` Ray Kinsella
2020-05-06 14:22 ` Thomas Monjalon
2020-05-07 7:48 ` Ophir Munk
2020-05-07 7:37 ` [dpdk-dev] [PATCH v2 0/2] add INTERNAL tags and avoid comparison Ophir Munk
2020-05-07 7:37 ` [dpdk-dev] [PATCH v2 1/2] common/mlx5: add rte internal tag " Ophir Munk
2020-05-07 7:44 ` Matan Azrad
2020-05-07 7:56 ` Ray Kinsella
2020-05-07 9:03 ` Ophir Munk
2020-05-07 8:56 ` [dpdk-dev] [PATCH v3 " Ophir Munk
2020-05-07 8:56 ` [dpdk-dev] [PATCH v3 2/2] common/mlx5: remove devx dependency on ibv and DV Ophir Munk
2020-05-07 10:23 ` [dpdk-dev] [PATCH v3 1/2] common/mlx5: add rte internal tag and avoid comparison Thomas Monjalon
2020-05-07 11:41 ` Ophir Munk
2020-05-07 20:08 ` Thomas Monjalon
2020-05-10 8:14 ` Ophir Munk
2020-05-07 11:31 ` [dpdk-dev] [PATCH v4 " Ophir Munk
2020-05-07 11:31 ` [dpdk-dev] [PATCH v4 2/2] common/mlx5: remove devx dependency on ibv and DV Ophir Munk
2020-05-12 10:52 ` [dpdk-dev] [PATCH v4 1/2] common/mlx5: add rte internal tag and avoid comparison Raslan Darawsheh
2020-05-19 9:08 ` Thomas Monjalon
2020-05-07 7:37 ` Ophir Munk [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200507073702.4047-3-ophirmu@mellanox.com \
--to=ophirmu@mellanox.com \
--cc=david.marchand@redhat.com \
--cc=dev@dpdk.org \
--cc=homas@monjalon.net \
--cc=matan@mellanox.com \
--cc=mdr@ashroe.eu \
--cc=rasland@mellanox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).