Skip to contentSkip to conversation

DevX fixes

PATCH Applied Leon Romanovsky 3 participants 5 messages May 14, 2019 – May 15, 2019

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

cover DevX fixes

From: Leon Romanovsky <[email protected]>

Hi,

There are two very short but important fixes to DevX flows.

Thanks

Yishai Hadas (2):
IB/mlx5: Verify DEVX general object type correctly net/mlx5: Set completion EQs as shared resources

 drivers/infiniband/hw/mlx5/devx.c            | 13 ++++++++++---
 drivers/net/ethernet/mellanox/mlx5/core/eq.c |  3 +++
 include/linux/mlx5/mlx5_ifc.h                |  2 +-
 3 files changed, 14 insertions(+), 4 deletions(-)
#1 lore raw

PATCH 1/2 IB/mlx5: Verify DEVX general object type correctly

From: Yishai Hadas <[email protected]>

As the obj_id in the firmware is not globally unique in general_object, the object type must be considered upon checking for a valid object id.

Fixes 2351776e87a1 ("IB/mlx5: Verify DEVX object type")
---
 drivers/infiniband/hw/mlx5/devx.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/infiniband/hw/mlx5/devx.c +10 -3
index 169ffffcf5ed..80b42d069328 100644
@@ -154,7 +154,7 @@ bool mlx5_ib_devx_is_flow_counter(void *obj, u32 *counter_id)
  * must be considered upon checking for a valid object id.
  * For that the opcode of the creator command is encoded as part of the obj_id.
  */
-static u64 get_enc_obj_id(u16 opcode, u32 obj_id)
+static u64 get_enc_obj_id(u32 opcode, u32 obj_id)
 {
 	return ((u64)opcode << 32) | obj_id;
 }
@@ -167,7 +167,9 @@ static u64 devx_get_obj_id(const void *in)
 	switch (opcode) {
 	case MLX5_CMD_OP_MODIFY_GENERAL_OBJECT:
 	case MLX5_CMD_OP_QUERY_GENERAL_OBJECT:
-		obj_id = get_enc_obj_id(MLX5_CMD_OP_CREATE_GENERAL_OBJECT,
+		obj_id = get_enc_obj_id(MLX5_CMD_OP_CREATE_GENERAL_OBJECT |
+					MLX5_GET(general_obj_in_cmd_hdr, in,
+						 obj_type) << 16,
 					MLX5_GET(general_obj_in_cmd_hdr, in,
 						 obj_id));
 		break;
@@ -1171,6 +1173,7 @@ static int UVERBS_HANDLER(MLX5_IB_METHOD_DEVX_OBJ_CREATE)(
 	struct mlx5_ib_dev *dev = to_mdev(c->ibucontext.device);
 	u32 out[MLX5_ST_SZ_DW(general_obj_out_cmd_hdr)];
 	struct devx_obj *obj;
+	u16 obj_type = 0;
 	int err;
 	int uid;
 	u32 obj_id;
@@ -1230,7 +1233,11 @@ static int UVERBS_HANDLER(MLX5_IB_METHOD_DEVX_OBJ_CREATE)(
 	if (err)
 		goto err_copy;
 
-	obj->obj_id = get_enc_obj_id(opcode, obj_id);
+	if (opcode == MLX5_CMD_OP_CREATE_GENERAL_OBJECT)
+		obj_type = MLX5_GET(general_obj_in_cmd_hdr, cmd_in, obj_type);
+
+	obj->obj_id = get_enc_obj_id(opcode | obj_type << 16, obj_id);
+
 	return 0;
 
 err_copy:
Signature · 1 line
2.20.1
#2 lore raw

PATCH 2/2 net/mlx5: Set completion EQs as shared resources

In reply to Leon Romanovsky

From: Yishai Hadas <[email protected]>

Mark completion EQs as shared resources so that they can be used by CQs with uid != 0.

Fixes 7efce3691d33 ("IB/mlx5: Add obj create and destroy functionality")
---
 drivers/net/ethernet/mellanox/mlx5/core/eq.c | 3 +++
 include/linux/mlx5/mlx5_ifc.h                | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/eq.c +3 -0
index 5aac97847721..23883d1fa22f 100644
@@ -291,6 +291,9 @@ create_map_eq(struct mlx5_core_dev *dev, struct mlx5_eq *eq, const char *name,
 	mlx5_fill_page_array(&eq->buf, pas);
 
 	MLX5_SET(create_eq_in, in, opcode, MLX5_CMD_OP_CREATE_EQ);
+	if (!param->mask && MLX5_CAP_GEN(dev, log_max_uctx))
+		MLX5_SET(create_eq_in, in, uid, MLX5_SHARED_RESOURCE_UID);
+
 	MLX5_SET64(create_eq_in, in, event_bitmask, param->mask);
 
 	eqc = MLX5_ADDR_OF(create_eq_in, in, eq_context_entry);
include/linux/mlx5/mlx5_ifc.h +1 -1
index 9be13e2c5a20..9c9979cf0fd5 100644
@@ -7346,7 +7346,7 @@ struct mlx5_ifc_create_eq_out_bits {
 
 struct mlx5_ifc_create_eq_in_bits {
 	u8         opcode[0x10];
-	u8         reserved_at_10[0x10];
+	u8         uid[0x10];
 
 	u8         reserved_at_20[0x10];
 	u8         op_mod[0x10];
Signature · 1 line
2.20.1
#3 lore raw

Re: [PATCH mlx5-next 2/2] net/mlx5: Set completion EQs as shared resources

Quoted 6 lines · Leon Romanovsky

From: Yishai Hadas <[email protected]>

Mark completion EQs as shared resources so that they can be used by CQs with uid != 0.

Quoted 9 lines
Fixes 7efce3691d33 ("IB/mlx5: Add obj create and destroy functionality")
---
 drivers/net/ethernet/mellanox/mlx5/core/eq.c | 3 +++
 include/linux/mlx5/mlx5_ifc.h                | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

Hi leon,

I see the patch is marked for mlx5-next,
As we spoke earlier, let's push this directly to rdma-next and skip mlx5-next, we will need to reset the branch soon, so let's keep it clean.

Thanks,
Saeed