Skip to contentSkip to conversation

ODP support for mlx5 DC QPs

PATCH In review Leon Romanovsky 3 participants 10 messages Aug 1, 2019

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

cover ODP support for mlx5 DC QPs

From: Leon Romanovsky <[email protected]>

From Michael,

The series adds support for on-demand paging for DC transport. Adding handling of DC WQE parsing upon page faults and exposing capabilities.

As DC is mlx-only transport, the capabilities are exposed to the user using the direct-verbs mechanism. Namely through the mlx5dv_query_device.

Thanks

Michael Guralnik (3):
IB/mlx5: Query ODP capabilities for DC IB/mlx5: Expose ODP for DC capabilities to user IB/mlx5: Add page fault handler for DC initiator WQE

 drivers/infiniband/hw/mlx5/main.c             |  6 +++++
 drivers/infiniband/hw/mlx5/mlx5_ib.h          |  1 +
 drivers/infiniband/hw/mlx5/odp.c              | 27 ++++++++++++++++++-
 .../net/ethernet/mellanox/mlx5/core/main.c    |  6 +++++
 include/linux/mlx5/mlx5_ifc.h                 |  4 ++-
 include/uapi/rdma/mlx5-abi.h                  |  2 ++
 6 files changed, 44 insertions(+), 2 deletions(-)

--
2.20.1

#1 lore raw

PATCH 1/3 IB/mlx5: Query ODP capabilities for DC

From: Michael Guralnik <[email protected]>

Set current capabilities of ODP for DC to max capabilities and cache them in mlx5_ib.

---
 drivers/infiniband/hw/mlx5/mlx5_ib.h           |  1 +
 drivers/infiniband/hw/mlx5/odp.c               | 18 ++++++++++++++++++
 drivers/net/ethernet/mellanox/mlx5/core/main.c |  6 ++++++
 include/linux/mlx5/mlx5_ifc.h                  |  4 +++-
 4 files changed, 28 insertions(+), 1 deletion(-)
drivers/infiniband/hw/mlx5/mlx5_ib.h +1 -0
index cb41a7e6255a..f99c71b3c876 100644
@@ -967,6 +967,7 @@ struct mlx5_ib_dev {
 	struct mutex			slow_path_mutex;
 	int				fill_delay;
 	struct ib_odp_caps	odp_caps;
+	uint32_t		dc_odp_caps;
 	u64			odp_max_size;
 	struct mlx5_ib_pf_eq	odp_pf_eq;
 
drivers/infiniband/hw/mlx5/odp.c +18 -0
index b0c5de39d186..5e87a5e25574 100644
@@ -353,6 +353,24 @@ void mlx5_ib_internal_fill_odp_caps(struct mlx5_ib_dev *dev)
 	if (MLX5_CAP_ODP(dev->mdev, xrc_odp_caps.srq_receive))
 		caps->per_transport_caps.xrc_odp_caps |= IB_ODP_SUPPORT_SRQ_RECV;
 
+	if (MLX5_CAP_ODP(dev->mdev, dc_odp_caps.send))
+		dev->dc_odp_caps |= IB_ODP_SUPPORT_SEND;
+
+	if (MLX5_CAP_ODP(dev->mdev, dc_odp_caps.receive))
+		dev->dc_odp_caps |= IB_ODP_SUPPORT_RECV;
+
+	if (MLX5_CAP_ODP(dev->mdev, dc_odp_caps.write))
+		dev->dc_odp_caps |= IB_ODP_SUPPORT_WRITE;
+
+	if (MLX5_CAP_ODP(dev->mdev, dc_odp_caps.read))
+		dev->dc_odp_caps |= IB_ODP_SUPPORT_READ;
+
+	if (MLX5_CAP_ODP(dev->mdev, dc_odp_caps.atomic))
+		dev->dc_odp_caps |= IB_ODP_SUPPORT_ATOMIC;
+
+	if (MLX5_CAP_ODP(dev->mdev, dc_odp_caps.srq_receive))
+		dev->dc_odp_caps |= IB_ODP_SUPPORT_SRQ_RECV;
+
 	if (MLX5_CAP_GEN(dev->mdev, fixed_buffer_size) &&
 	    MLX5_CAP_GEN(dev->mdev, null_mkey) &&
 	    MLX5_CAP_GEN(dev->mdev, umr_extended_translation_offset))
drivers/net/ethernet/mellanox/mlx5/core/main.c +6 -0
index b15b27a497fc..3995fc6d4d34 100644
@@ -495,6 +495,12 @@ static int handle_hca_cap_odp(struct mlx5_core_dev *dev)
 	ODP_CAP_SET_MAX(dev, xrc_odp_caps.write);
 	ODP_CAP_SET_MAX(dev, xrc_odp_caps.read);
 	ODP_CAP_SET_MAX(dev, xrc_odp_caps.atomic);
+	ODP_CAP_SET_MAX(dev, dc_odp_caps.srq_receive);
+	ODP_CAP_SET_MAX(dev, dc_odp_caps.send);
+	ODP_CAP_SET_MAX(dev, dc_odp_caps.receive);
+	ODP_CAP_SET_MAX(dev, dc_odp_caps.write);
+	ODP_CAP_SET_MAX(dev, dc_odp_caps.read);
+	ODP_CAP_SET_MAX(dev, dc_odp_caps.atomic);
 
 	if (do_set)
 		err = set_caps(dev, set_ctx, set_sz,
include/linux/mlx5/mlx5_ifc.h +3 -1
index ec571fd7fcf8..5eae8d734435 100644
@@ -944,7 +944,9 @@ struct mlx5_ifc_odp_cap_bits {
 
 	struct mlx5_ifc_odp_per_transport_service_cap_bits xrc_odp_caps;
 
-	u8         reserved_at_100[0x700];
+	struct mlx5_ifc_odp_per_transport_service_cap_bits dc_odp_caps;
+
+	u8         reserved_at_100[0x6E0];
 };
 
 struct mlx5_ifc_calc_op {
Signature · 1 line
2.20.1
#4 lore raw

PATCH 2/3 IB/mlx5: Expose ODP for DC capabilities to user

In reply to Leon Romanovsky

From: Michael Guralnik <[email protected]>

Return ODP capabilities for DC to user in alloc_context.

---
 drivers/infiniband/hw/mlx5/main.c | 6 ++++++
 include/uapi/rdma/mlx5-abi.h      | 2 ++
 2 files changed, 8 insertions(+)
drivers/infiniband/hw/mlx5/main.c +6 -0
index 4a3d700cd783..a53e0dc7c17f 100644
@@ -1954,6 +1954,12 @@ static int mlx5_ib_alloc_ucontext(struct ib_ucontext *uctx,
 		resp.response_length += sizeof(resp.dump_fill_mkey);
 	}
 
+	if (field_avail(typeof(resp), dc_odp_caps, udata->outlen)) {
+		resp.dc_odp_caps = dev->dc_odp_caps;
+		resp.comp_mask |= MLX5_IB_ALLOC_UCONTEXT_RESP_MASK_DC_ODP_CAPS;
+		resp.response_length += sizeof(resp.dc_odp_caps);
+	}
+
 	err = ib_copy_to_udata(udata, &resp, resp.response_length);
 	if (err)
 		goto out_mdev;
include/uapi/rdma/mlx5-abi.h +2 -0
index 624f5b53eb1f..12abc585f2ac 100644
@@ -98,6 +98,7 @@ struct mlx5_ib_alloc_ucontext_req_v2 {
 enum mlx5_ib_alloc_ucontext_resp_mask {
 	MLX5_IB_ALLOC_UCONTEXT_RESP_MASK_CORE_CLOCK_OFFSET = 1UL << 0,
 	MLX5_IB_ALLOC_UCONTEXT_RESP_MASK_DUMP_FILL_MKEY    = 1UL << 1,
+	MLX5_IB_ALLOC_UCONTEXT_RESP_MASK_DC_ODP_CAPS	   = 1UL << 2,
 };
 
 enum mlx5_user_cmds_supp_uhw {
@@ -147,6 +148,7 @@ struct mlx5_ib_alloc_ucontext_resp {
 	__u32	num_uars_per_page;
 	__u32	num_dyn_bfregs;
 	__u32	dump_fill_mkey;
+	__u32	dc_odp_caps;
 };
 
 struct mlx5_ib_alloc_pd_resp {
Signature · 1 line
2.20.1
#7 lore raw

PATCH 3/3 IB/mlx5: Add page fault handler for DC initiator WQE

In reply to Leon Romanovsky

From: Michael Guralnik <[email protected]>

Parsing DC initiator WQEs upon page fault requires skipping an address vector segment, as in UD WQEs.

---
 drivers/infiniband/hw/mlx5/odp.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/infiniband/hw/mlx5/odp.c +8 -1
index 5e87a5e25574..6f1de5edbe8e 100644
@@ -1065,6 +1065,12 @@ static int mlx5_ib_mr_initiator_pfault_handler(
 	case IB_QPT_UD:
 		transport_caps = dev->odp_caps.per_transport_caps.ud_odp_caps;
 		break;
+	case IB_QPT_DRIVER:
+		if (qp->qp_sub_type == MLX5_IB_QPT_DCI) {
+			transport_caps = dev->dc_odp_caps;
+			break;
+		}
+		/* fall through */
 	default:
 		mlx5_ib_err(dev, "ODP fault on QP of an unsupported transport 0x%x\n",
 			    qp->ibqp.qp_type);
@@ -1078,7 +1084,8 @@ static int mlx5_ib_mr_initiator_pfault_handler(
 		return -EFAULT;
 	}
 
-	if (qp->ibqp.qp_type == IB_QPT_UD) {
+	if (qp->ibqp.qp_type == IB_QPT_UD ||
+	    qp->qp_sub_type == MLX5_IB_QPT_DCI) {
 		av = *wqe;
 		if (av->dqp_dct & cpu_to_be32(MLX5_EXTENDED_UD_AV))
 			*wqe += sizeof(struct mlx5_av);
Signature · 1 line
2.20.1
#5 lore raw

Re: [PATCH rdma-next 2/3] IB/mlx5: Expose ODP for DC capabilities to user

In reply to Leon Romanovsky

include/uapi/rdma/mlx5-abi.h struct mlx5_ib_alloc_ucontext_resp { · line 151

Quoted 6 lines · Leon Romanovsky

enum mlx5_user_cmds_supp_uhw {

include/uapi/rdma/mlx5-abi.h +1 -0
@@ -147,6 +148,7 @@ struct mlx5_ib_alloc_ucontext_resp {
 	__u32	num_uars_per_page;
 	__u32	num_dyn_bfregs;
 	__u32	dump_fill_mkey;
+	__u32	dc_odp_caps;

This should be padded to 64 bits.

Quoted 4 lines
include/uapi/rdma/mlx5-abi.h +0 -0
 };
 
 struct mlx5_ib_alloc_pd_resp {
#6 lore raw

Re: [PATCH rdma-next 2/3] IB/mlx5: Expose ODP for DC capabilities to user

Quoted 9 lines · Gal Pressman

include/uapi/rdma/mlx5-abi.h struct mlx5_ib_alloc_ucontext_resp { · line 151

Quoted 6 lines · Leon Romanovsky

enum mlx5_user_cmds_supp_uhw {

include/uapi/rdma/mlx5-abi.h +1 -0
@@ -147,6 +148,7 @@ struct mlx5_ib_alloc_ucontext_resp {
 	__u32	num_uars_per_page;
 	__u32	num_dyn_bfregs;
 	__u32	dump_fill_mkey;
+	__u32	dc_odp_caps;

This should be padded to 64 bits.

Thanks a lot, I fixed it locally.

Quoted 5 lines
Quoted 5 lines
include/uapi/rdma/mlx5-abi.h +0 -0
 };
 
 struct mlx5_ib_alloc_pd_resp {
#8 lore raw
In reply to Leon Romanovsky
Quoted 10 lines · Leon Romanovsky

From: Leon Romanovsky <[email protected]>

From Michael,

The series adds support for on-demand paging for DC transport. Adding handling of DC WQE parsing upon page faults and exposing capabilities.

As DC is mlx-only transport, the capabilities are exposed to the user using the direct-verbs mechanism. Namely through the mlx5dv_query_device.

The cover letter should like to the RDMA core PR that uses the new API...

Jason

#2 lore raw

Re: [PATCH mlx5-next 1/3] IB/mlx5: Query ODP capabilities for DC

In reply to Leon Romanovsky

include/linux/mlx5/mlx5_ifc.h struct mlx5_ifc_odp_cap_bits { · line 950

Quoted 12 lines · Leon Romanovsky
include/linux/mlx5/mlx5_ifc.h +4 -1
index ec571fd7fcf8..5eae8d734435 100644
+++ b/include/linux/mlx5/mlx5_ifc.h
@@ -944,7 +944,9 @@ struct mlx5_ifc_odp_cap_bits {
 
 	struct mlx5_ifc_odp_per_transport_service_cap_bits xrc_odp_caps;
 
-	u8         reserved_at_100[0x700];
+	struct mlx5_ifc_odp_per_transport_service_cap_bits dc_odp_caps;
+
+	u8         reserved_at_100[0x6E0];
 };

Not splitting this to mlx5-next?

Jason

#3 lore raw

Re: [PATCH mlx5-next 1/3] IB/mlx5: Query ODP capabilities for DC

Quoted 9 lines · Jason Gunthorpe
Quoted 7 lines · Leon Romanovsky
include/linux/mlx5/mlx5_ifc.h +1 -0
index ec571fd7fcf8..5eae8d734435 100644
+++ b/include/linux/mlx5/mlx5_ifc.h
@@ -944,7 +944,9 @@ struct mlx5_ifc_odp_cap_bits {
 
 	struct mlx5_ifc_odp_per_transport_service_cap_bits xrc_odp_caps;
 
Quoted 7 lines

include/linux/mlx5/mlx5_ifc.h struct mlx5_ifc_odp_cap_bits { · line 950

Quoted 5 lines
include/linux/mlx5/mlx5_ifc.h +3 -1
-	u8         reserved_at_100[0x700];
+	struct mlx5_ifc_odp_per_transport_service_cap_bits dc_odp_caps;
+
+	u8         reserved_at_100[0x6E0];
 };

Not splitting this to mlx5-next?

This whole patch goes to mlx5-next, because it touches drivers/net/ethernet/mellanox/mlx5/core/main.c too and splitting to ifc specific patch won't change anything.

Thanks

Quoted 2 lines

Jason

#9 lore raw
In reply to Jason Gunthorpe
Quoted 9 lines · Jason Gunthorpe
Quoted 8 lines · Leon Romanovsky

From: Leon Romanovsky <[email protected]>

From Michael,

The series adds support for on-demand paging for DC transport. Adding handling of DC WQE parsing upon page faults and exposing capabilities.

Quoted 5 lines
Quoted 2 lines

As DC is mlx-only transport, the capabilities are exposed to the user using the direct-verbs mechanism. Namely through the mlx5dv_query_device.

The cover letter should like to the RDMA core PR that uses the new API...

PR will be send in near future by Yishai. I don't have PR links at the submission stage yet.

Thanks

Quoted 2 lines

Jason