Skip to contentSkip to conversation

ODP support for mlx5 DC QPs

PATCH Superseded Leon Romanovsky 2 participants 6 messages Aug 6, 2019

Subsystems (5)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover ODP support for mlx5 DC QPs

From: Leon Romanovsky <[email protected]>

Changelog
v2:
* Fixed reserved_* field wrong name (Saeed M.)
* Split first patch to two patches, one for mlx5-next and one for rdma-next. (Saeed M.) v1:
* Fixed alignment to u64 in mlx5-abi.h (Gal P.)
* https://lore.kernel.org/linux-rdma/[email protected]
v0:
* https://lore.kernel.org/linux-rdma/[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 (4):
net/mlx5: Set ODP capabilities for DC transport 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                  |  3 +++
 6 files changed, 45 insertions(+), 2 deletions(-)

--
2.20.1

#1 lore raw

PATCH v2 1/4 net/mlx5: Set ODP capabilities for DC transport

From: Michael Guralnik <[email protected]>

Query ODP capabilities for DC transport from FW.

---
 drivers/net/ethernet/mellanox/mlx5/core/main.c | 6 ++++++
 include/linux/mlx5/mlx5_ifc.h                  | 4 +++-
 2 files changed, 9 insertions(+), 1 deletion(-)
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..b96d5c37f70f 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_120[0x6E0];
 };
 
 struct mlx5_ifc_calc_op {
Signature · 1 line
2.20.1
#2 lore raw

PATCH v2 2/4 IB/mlx5: Query ODP capabilities for DC

In reply to Leon Romanovsky

From: Michael Guralnik <[email protected]>

Cache current ODP capabilities for DC in mlx5_ib device.

---
 drivers/infiniband/hw/mlx5/mlx5_ib.h |  1 +
 drivers/infiniband/hw/mlx5/odp.c     | 18 ++++++++++++++++++
 2 files changed, 19 insertions(+)
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))
Signature · 1 line
2.20.1
#4 lore raw

PATCH v2 4/4 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
#3 lore raw

PATCH v2 3/4 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      | 3 +++
 2 files changed, 9 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 +3 -0
index 624f5b53eb1f..7cab806d7fa7 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,8 @@ struct mlx5_ib_alloc_ucontext_resp {
 	__u32	num_uars_per_page;
 	__u32	num_dyn_bfregs;
 	__u32	dump_fill_mkey;
+	__u32	dc_odp_caps;
+	__u32   reserved;
 };
 
 struct mlx5_ib_alloc_pd_resp {
Signature · 1 line
2.20.1
#5 lore raw
In reply to Leon Romanovsky
Quoted 19 lines · Leon Romanovsky

From: Leon Romanovsky <[email protected]>

Changelog
v2:
* Fixed reserved_* field wrong name (Saeed M.)
* Split first patch to two patches, one for mlx5-next and one for rdma-next. (Saeed M.) v1:
* Fixed alignment to u64 in mlx5-abi.h (Gal P.)
* https://lore.kernel.org/linux-rdma/[email protected]
v0:
* https://lore.kernel.org/linux-rdma/[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

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

Please drop this series, we will reevaluate it.

Thanks

Quoted 18 lines

Michael Guralnik (4):
net/mlx5: Set ODP capabilities for DC transport 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                  |  3 +++
 6 files changed, 45 insertions(+), 2 deletions(-)

--
2.20.1