* [PATCH rdma-next 0/2] DevX fixes
@ 2019-05-14 11:44 ` Leon Romanovsky
0 siblings, 0 replies; 6+ messages in thread
From: Leon Romanovsky @ 2019-05-14 11:44 UTC (permalink / raw)
To: Doug Ledford, Jason Gunthorpe
Cc: Leon Romanovsky, RDMA mailing list, Saeed Mahameed, Yishai Hadas,
linux-netdev
From: Leon Romanovsky <leonro@mellanox.com>
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(-)
--
2.20.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH rdma-next 1/2] IB/mlx5: Verify DEVX general object type correctly
2019-05-14 11:44 ` Leon Romanovsky
(?)
@ 2019-05-14 11:44 ` Leon Romanovsky
-1 siblings, 0 replies; 6+ messages in thread
From: Leon Romanovsky @ 2019-05-14 11:44 UTC (permalink / raw)
To: Doug Ledford, Jason Gunthorpe
Cc: Leon Romanovsky, RDMA mailing list, Saeed Mahameed, Yishai Hadas,
linux-netdev
From: Yishai Hadas <yishaih@mellanox.com>
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")
Signed-off-by: Yishai Hadas <yishaih@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
drivers/infiniband/hw/mlx5/devx.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/drivers/infiniband/hw/mlx5/devx.c b/drivers/infiniband/hw/mlx5/devx.c
index 169ffffcf5ed..80b42d069328 100644
--- a/drivers/infiniband/hw/mlx5/devx.c
+++ b/drivers/infiniband/hw/mlx5/devx.c
@@ -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:
--
2.20.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH mlx5-next 2/2] net/mlx5: Set completion EQs as shared resources
2019-05-14 11:44 ` Leon Romanovsky
(?)
(?)
@ 2019-05-14 11:44 ` Leon Romanovsky
2019-05-14 20:14 ` Saeed Mahameed
-1 siblings, 1 reply; 6+ messages in thread
From: Leon Romanovsky @ 2019-05-14 11:44 UTC (permalink / raw)
To: Doug Ledford, Jason Gunthorpe
Cc: Leon Romanovsky, RDMA mailing list, Saeed Mahameed, Yishai Hadas,
linux-netdev
From: Yishai Hadas <yishaih@mellanox.com>
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")
Signed-off-by: Yishai Hadas <yishaih@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
drivers/net/ethernet/mellanox/mlx5/core/eq.c | 3 +++
include/linux/mlx5/mlx5_ifc.h | 2 +-
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eq.c b/drivers/net/ethernet/mellanox/mlx5/core/eq.c
index 5aac97847721..23883d1fa22f 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eq.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eq.c
@@ -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);
diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h
index 9be13e2c5a20..9c9979cf0fd5 100644
--- a/include/linux/mlx5/mlx5_ifc.h
+++ b/include/linux/mlx5/mlx5_ifc.h
@@ -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];
--
2.20.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH mlx5-next 2/2] net/mlx5: Set completion EQs as shared resources
2019-05-14 11:44 ` [PATCH mlx5-next 2/2] net/mlx5: Set completion EQs as shared resources Leon Romanovsky
@ 2019-05-14 20:14 ` Saeed Mahameed
0 siblings, 0 replies; 6+ messages in thread
From: Saeed Mahameed @ 2019-05-14 20:14 UTC (permalink / raw)
To: Leon Romanovsky
Cc: Doug Ledford, Jason Gunthorpe, Leon Romanovsky,
RDMA mailing list, Saeed Mahameed, Yishai Hadas, linux-netdev
On Tue, May 14, 2019 at 4:44 AM Leon Romanovsky <leon@kernel.org> wrote:
>
> From: Yishai Hadas <yishaih@mellanox.com>
>
> 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")
> Signed-off-by: Yishai Hadas <yishaih@mellanox.com>
> Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
> Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
> ---
> 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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH rdma-next 0/2] DevX fixes
2019-05-14 11:44 ` Leon Romanovsky
` (2 preceding siblings ...)
(?)
@ 2019-05-15 0:36 ` Jason Gunthorpe
-1 siblings, 0 replies; 6+ messages in thread
From: Jason Gunthorpe @ 2019-05-15 0:36 UTC (permalink / raw)
To: Leon Romanovsky
Cc: Doug Ledford, Leon Romanovsky, RDMA mailing list, Saeed Mahameed,
Yishai Hadas, linux-netdev
On Tue, May 14, 2019 at 02:44:10PM +0300, Leon Romanovsky wrote:
> From: Leon Romanovsky <leonro@mellanox.com>
>
> Hi,
>
> There are two very short but important fixes to DevX flows.
applied to for-next
Jason
^ permalink raw reply [flat|nested] 6+ messages in thread