Skip to contentSkip to conversation

common/mlx5: add provider query port support to glue library

PATCH Superseded Viacheslav Ovsiienko 2 participants 2 messages Jun 7, 2021 – Jun 9, 2021

Subsystems (2)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 common/mlx5: add provider query port support to glue library

The rdma-core mlx5 provider introduced the port attributes query API since version v35.0. The patch adds the conditional support of this API to the glue library. The transitional OFED rdma-core versions provide both APIs for compatibility, the new API has a priority for the case.

The compile time configuration key HAVE_MLX5DV_DR_DEVX_PORT was used to choose the destination E-Switch port action creation routine. This dependency should be removed and new dedicated key HAVE_MLX5DV_DR_CREATE_DEST_IB_PORT is introduced.

---
 drivers/common/mlx5/linux/meson.build |  4 ++
 drivers/common/mlx5/linux/mlx5_glue.c | 57 ++++++++++++++++++++-----
 drivers/common/mlx5/linux/mlx5_glue.h | 16 ++++++-
 drivers/net/mlx5/linux/mlx5_os.c      | 60 ++++++++++++---------------
 drivers/net/mlx5/mlx5_flow_dv.c       |  2 +-
 5 files changed, 93 insertions(+), 46 deletions(-)
drivers/common/mlx5/linux/meson.build +4 -0
index 007834a49b..5cea1b44d7 100644
@@ -93,6 +93,10 @@ has_sym_args = [
             'IBV_WQ_FLAG_RX_END_PADDING' ],
         [ 'HAVE_MLX5DV_DR_DEVX_PORT', 'infiniband/mlx5dv.h',
             'mlx5dv_query_devx_port' ],
+	[ 'HAVE_MLX5DV_DR_DEVX_PORT_V35', 'infiniband/mlx5dv.h',
+	    'mlx5dv_query_port' ],
+	[ 'HAVE_MLX5DV_DR_CREATE_DEST_IB_PORT', 'infiniband/mlx5dv.h',
+	    'mlx5dv_dr_action_create_dest_ib_port' ],
         [ 'HAVE_IBV_DEVX_OBJ', 'infiniband/mlx5dv.h',
             'mlx5dv_devx_obj_create' ],
         [ 'HAVE_IBV_FLOW_DEVX_COUNTERS', 'infiniband/mlx5dv.h',
drivers/common/mlx5/linux/mlx5_glue.c +47 -10

71 lines not on this page · raw message

drivers/common/mlx5/linux/mlx5_glue.h +15 -1
index 97462e9ab8..840d8cf57f 100644
@@ -84,6 +84,20 @@ struct mlx5dv_dr_action;
 struct mlx5dv_devx_port;
 #endif
 
+#ifndef HAVE_MLX5DV_DR_DEVX_PORT_V35
+struct mlx5dv_port;
+#endif
+
+#define MLX5_PORT_QUERY_VPORT (1u << 0)
+#define MLX5_PORT_QUERY_REG_C0 (1u << 1)
+
+struct mlx5_port_info {
+	uint16_t query_flags;
+	uint16_t vport_id; /* Associated VF vport index (if any). */
+	uint32_t vport_meta_tag; /* Used for vport index match ove VF LAG. */
+	uint32_t vport_meta_mask; /* Used for vport index field match mask. */
+};
+
 #ifndef HAVE_MLX5_DR_CREATE_ACTION_FLOW_METER
 struct mlx5dv_dr_flow_meter_attr;
 #endif
@@ -311,7 +325,7 @@ struct mlx5_glue {
 			     void *out, size_t outlen);
 	int (*devx_port_query)(struct ibv_context *ctx,
 			       uint32_t port_num,
-			       struct mlx5dv_devx_port *mlx5_devx_port);
+			       struct mlx5_port_info *info);
 	int (*dr_dump_domain)(FILE *file, void *domain);
 	int (*dr_dump_rule)(FILE *file, void *rule);
 	int (*devx_query_eqn)(struct ibv_context *context, uint32_t cpus,
drivers/net/mlx5/linux/mlx5_os.c +26 -34

97 lines not on this page · raw message

drivers/net/mlx5/mlx5_flow_dv.c +1 -1
index f009689cff..114457f899 100644
@@ -10330,7 +10330,7 @@ flow_dv_translate_action_port_id(struct rte_eth_dev *dev,
 					  RTE_FLOW_ERROR_TYPE_ACTION,
 					  NULL,
 					  "No eswitch info was found for port");
-#ifdef HAVE_MLX5DV_DR_DEVX_PORT
+#ifdef HAVE_MLX5DV_DR_CREATE_DEST_IB_PORT
 	/*
 	 * This parameter is transferred to
 	 * mlx5dv_dr_action_create_dest_ib_port().
Signature · 1 line
2.18.1
#1 lore raw

Hi,

Quoted 21 lines

-----Original Message-----
From: Slava Ovsiienko <[email protected]>
Sent: Monday, June 7, 2021 12:37 PM
To: [email protected]
Cc: Raslan Darawsheh <[email protected]>; Matan Azrad <[email protected]>; [email protected]
Subject: [PATCH] common/mlx5: add provider query port support to glue library

The rdma-core mlx5 provider introduced the port attributes query API since version v35.0. The patch adds the conditional support of this API to the glue library. The transitional OFED rdma-core versions provide both APIs for compatibility, the new API has a priority for the case.

The compile time configuration key HAVE_MLX5DV_DR_DEVX_PORT was used to choose the destination E-Switch port action creation routine. This dependency should be removed and new dedicated key HAVE_MLX5DV_DR_CREATE_DEST_IB_PORT is introduced.

Quoted 4 lines

Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh