|
|
96ca5f |
From d962bef7ac575c971f5792fc83dbccd17eb23989 Mon Sep 17 00:00:00 2001
|
|
|
96ca5f |
From: Alaa Hleihel <ahleihel@redhat.com>
|
|
|
96ca5f |
Date: Thu, 21 Nov 2019 16:25:34 -0500
|
|
|
96ca5f |
Subject: [PATCH rdma-core 5/5] mlx5: Support scatter to CQE over DCT QP
|
|
|
96ca5f |
|
|
|
96ca5f |
Bugzilla: http://bugzilla.redhat.com/BZNUM
|
|
|
96ca5f |
Upstream: origin/master
|
|
|
96ca5f |
Conflicts:
|
|
|
96ca5f |
- providers/mlx5/verbs.c
|
|
|
96ca5f |
Had small context diff and dropped an hunk that is not relevant due to
|
|
|
96ca5f |
missing patches.
|
|
|
96ca5f |
|
|
|
96ca5f |
commit cd231947e19d5f40d55b8a493aa8c069b88df9e9
|
|
|
96ca5f |
Author: Guy Levi <guyle@mellanox.com>
|
|
|
96ca5f |
Date: Tue Mar 26 09:40:17 2019 +0200
|
|
|
96ca5f |
|
|
|
96ca5f |
mlx5: Support scatter to CQE over DCT QP
|
|
|
96ca5f |
|
|
|
96ca5f |
Scatter to CQE which is a performance feature has never been enabled on
|
|
|
96ca5f |
DCT QP.
|
|
|
96ca5f |
|
|
|
96ca5f |
A new capability which allows to enable the feature on DCT QP is
|
|
|
96ca5f |
reported in query device related verb. Correspondingly, this patch
|
|
|
96ca5f |
enables the feature functionality so it is aligned with other QPs and
|
|
|
96ca5f |
the man page. It will be controlled by the legacy environment variable
|
|
|
96ca5f |
and can be override by the DV creation flags.
|
|
|
96ca5f |
|
|
|
96ca5f |
Fixes: b9967a9d722a ("mlx5: Create DC transport QPs")
|
|
|
96ca5f |
Signed-off-by: Guy Levi <guyle@mellanox.com>
|
|
|
96ca5f |
Signed-off-by: Yishai Hadas <yishaih@mellanox.com>
|
|
|
96ca5f |
|
|
|
96ca5f |
Signed-off-by: Jarod Wilson <jarod@redhat.com>
|
|
|
96ca5f |
---
|
|
|
96ca5f |
providers/mlx5/mlx5.h | 1 +
|
|
|
96ca5f |
providers/mlx5/verbs.c | 37 +++++++++++++++++++++++++++----------
|
|
|
96ca5f |
2 files changed, 28 insertions(+), 10 deletions(-)
|
|
|
96ca5f |
|
|
|
96ca5f |
diff --git a/providers/mlx5/mlx5.h b/providers/mlx5/mlx5.h
|
|
|
96ca5f |
index 75d599ad..4b6d903a 100644
|
|
|
96ca5f |
--- a/providers/mlx5/mlx5.h
|
|
|
96ca5f |
+++ b/providers/mlx5/mlx5.h
|
|
|
96ca5f |
@@ -186,6 +186,7 @@ enum mlx5_vendor_cap_flags {
|
|
|
96ca5f |
MLX5_VENDOR_CAP_FLAGS_CQE_128B_COMP = 1 << 3,
|
|
|
96ca5f |
MLX5_VENDOR_CAP_FLAGS_CQE_128B_PAD = 1 << 4,
|
|
|
96ca5f |
MLX5_VENDOR_CAP_FLAGS_PACKET_BASED_CREDIT_MODE = 1 << 5,
|
|
|
96ca5f |
+ MLX5_VENDOR_CAP_FLAGS_SCAT2CQE_DCT = 1 << 6,
|
|
|
96ca5f |
};
|
|
|
96ca5f |
|
|
|
96ca5f |
enum {
|
|
|
96ca5f |
diff --git a/providers/mlx5/verbs.c b/providers/mlx5/verbs.c
|
|
|
96ca5f |
index 890ed980..dad20c4f 100644
|
|
|
96ca5f |
--- a/providers/mlx5/verbs.c
|
|
|
96ca5f |
+++ b/providers/mlx5/verbs.c
|
|
|
96ca5f |
@@ -1642,7 +1642,7 @@ enum {
|
|
|
96ca5f |
static int create_dct(struct ibv_context *context,
|
|
|
96ca5f |
struct ibv_qp_init_attr_ex *attr,
|
|
|
96ca5f |
struct mlx5dv_qp_init_attr *mlx5_qp_attr,
|
|
|
96ca5f |
- struct mlx5_qp *qp)
|
|
|
96ca5f |
+ struct mlx5_qp *qp, uint32_t mlx5_create_flags)
|
|
|
96ca5f |
{
|
|
|
96ca5f |
struct mlx5_create_qp cmd = {};
|
|
|
96ca5f |
struct mlx5_create_qp_resp resp = {};
|
|
|
96ca5f |
@@ -1658,14 +1658,26 @@ static int create_dct(struct ibv_context *context,
|
|
|
96ca5f |
return errno;
|
|
|
96ca5f |
}
|
|
|
96ca5f |
|
|
|
96ca5f |
- if (!check_comp_mask(mlx5_qp_attr->comp_mask, MLX5DV_QP_INIT_ATTR_MASK_DC)) {
|
|
|
96ca5f |
+ if (!check_comp_mask(mlx5_qp_attr->comp_mask,
|
|
|
96ca5f |
+ MLX5DV_QP_INIT_ATTR_MASK_DC |
|
|
|
96ca5f |
+ MLX5DV_QP_INIT_ATTR_MASK_QP_CREATE_FLAGS)) {
|
|
|
96ca5f |
mlx5_dbg(fp, MLX5_DBG_QP,
|
|
|
96ca5f |
"Unsupported vendor comp_mask for %s\n", __func__);
|
|
|
96ca5f |
errno = EINVAL;
|
|
|
96ca5f |
return errno;
|
|
|
96ca5f |
}
|
|
|
96ca5f |
|
|
|
96ca5f |
- cmd.flags = MLX5_QP_FLAG_TYPE_DCT;
|
|
|
96ca5f |
+ if (!check_comp_mask(mlx5_create_flags, MLX5_QP_FLAG_SCATTER_CQE)) {
|
|
|
96ca5f |
+ mlx5_dbg(fp, MLX5_DBG_QP,
|
|
|
96ca5f |
+ "Unsupported creation flags requested for DCT QP\n");
|
|
|
96ca5f |
+ errno = EINVAL;
|
|
|
96ca5f |
+ return errno;
|
|
|
96ca5f |
+ }
|
|
|
96ca5f |
+
|
|
|
96ca5f |
+ if (!(ctx->vendor_cap_flags & MLX5_VENDOR_CAP_FLAGS_SCAT2CQE_DCT))
|
|
|
96ca5f |
+ mlx5_create_flags &= ~MLX5_QP_FLAG_SCATTER_CQE;
|
|
|
96ca5f |
+
|
|
|
96ca5f |
+ cmd.flags = MLX5_QP_FLAG_TYPE_DCT | mlx5_create_flags;
|
|
|
96ca5f |
cmd.access_key = mlx5_qp_attr->dc_init_attr.dct_access_key;
|
|
|
96ca5f |
|
|
|
96ca5f |
if (ctx->cqe_version) {
|
|
|
96ca5f |
@@ -1709,7 +1721,6 @@ static struct ibv_qp *create_qp(struct ibv_context *context,
|
|
|
96ca5f |
int32_t usr_idx = 0;
|
|
|
96ca5f |
uint32_t mlx5_create_flags = 0;
|
|
|
96ca5f |
struct mlx5_bf *bf = NULL;
|
|
|
96ca5f |
- bool scatter_to_cqe_configured = false;
|
|
|
96ca5f |
FILE *fp = ctx->dbg_fp;
|
|
|
96ca5f |
struct mlx5_parent_domain *mparent_domain;
|
|
|
96ca5f |
struct mlx5_ib_create_qp_resp *resp_drv;
|
|
|
96ca5f |
@@ -1745,6 +1756,9 @@ static struct ibv_qp *create_qp(struct ibv_context *context,
|
|
|
96ca5f |
memset(&resp, 0, sizeof(resp));
|
|
|
96ca5f |
memset(&resp_ex, 0, sizeof(resp_ex));
|
|
|
96ca5f |
|
|
|
96ca5f |
+ if (use_scatter_to_cqe())
|
|
|
96ca5f |
+ mlx5_create_flags |= MLX5_QP_FLAG_SCATTER_CQE;
|
|
|
96ca5f |
+
|
|
|
96ca5f |
if (mlx5_qp_attr) {
|
|
|
96ca5f |
if (!check_comp_mask(mlx5_qp_attr->comp_mask,
|
|
|
96ca5f |
MLX5_DV_CREATE_QP_SUP_COMP_MASK)) {
|
|
|
96ca5f |
@@ -1792,14 +1806,13 @@ static struct ibv_qp *create_qp(struct ibv_context *context,
|
|
|
96ca5f |
errno = EINVAL;
|
|
|
96ca5f |
goto err;
|
|
|
96ca5f |
}
|
|
|
96ca5f |
- scatter_to_cqe_configured = true;
|
|
|
96ca5f |
+ mlx5_create_flags &= ~MLX5_QP_FLAG_SCATTER_CQE;
|
|
|
96ca5f |
}
|
|
|
96ca5f |
if (mlx5_qp_attr->create_flags &
|
|
|
96ca5f |
MLX5DV_QP_CREATE_ALLOW_SCATTER_TO_CQE) {
|
|
|
96ca5f |
mlx5_create_flags |=
|
|
|
96ca5f |
(MLX5_QP_FLAG_ALLOW_SCATTER_CQE |
|
|
|
96ca5f |
MLX5_QP_FLAG_SCATTER_CQE);
|
|
|
96ca5f |
- scatter_to_cqe_configured = true;
|
|
|
96ca5f |
}
|
|
|
96ca5f |
if (mlx5_qp_attr->create_flags &
|
|
|
96ca5f |
MLX5DV_QP_CREATE_PACKET_BASED_CREDIT_MODE)
|
|
|
96ca5f |
@@ -1810,7 +1823,8 @@ static struct ibv_qp *create_qp(struct ibv_context *context,
|
|
|
96ca5f |
if (attr->qp_type == IBV_QPT_DRIVER) {
|
|
|
96ca5f |
if (mlx5_qp_attr->comp_mask & MLX5DV_QP_INIT_ATTR_MASK_DC) {
|
|
|
96ca5f |
if (mlx5_qp_attr->dc_init_attr.dc_type == MLX5DV_DCTYPE_DCT) {
|
|
|
96ca5f |
- ret = create_dct(context, attr, mlx5_qp_attr, qp);
|
|
|
96ca5f |
+ ret = create_dct(context, attr, mlx5_qp_attr,
|
|
|
96ca5f |
+ qp, mlx5_create_flags);
|
|
|
96ca5f |
if (ret)
|
|
|
96ca5f |
goto err;
|
|
|
96ca5f |
return ibqp;
|
|
|
96ca5f |
@@ -1833,6 +1847,9 @@ static struct ibv_qp *create_qp(struct ibv_context *context,
|
|
|
96ca5f |
}
|
|
|
96ca5f |
|
|
|
96ca5f |
if (attr->comp_mask & IBV_QP_INIT_ATTR_RX_HASH) {
|
|
|
96ca5f |
+ /* Scatter2CQE is unsupported for RSS QP */
|
|
|
96ca5f |
+ mlx5_create_flags &= ~MLX5_QP_FLAG_SCATTER_CQE;
|
|
|
96ca5f |
+
|
|
|
96ca5f |
ret = mlx5_cmd_create_rss_qp(context, attr, qp,
|
|
|
96ca5f |
mlx5_create_flags);
|
|
|
96ca5f |
if (ret)
|
|
|
96ca5f |
@@ -1846,9 +1863,6 @@ static struct ibv_qp *create_qp(struct ibv_context *context,
|
|
|
96ca5f |
if (qp->wq_sig)
|
|
|
96ca5f |
cmd.flags |= MLX5_QP_FLAG_SIGNATURE;
|
|
|
96ca5f |
|
|
|
96ca5f |
- if (!scatter_to_cqe_configured && use_scatter_to_cqe())
|
|
|
96ca5f |
- cmd.flags |= MLX5_QP_FLAG_SCATTER_CQE;
|
|
|
96ca5f |
-
|
|
|
96ca5f |
ret = mlx5_calc_wq_size(ctx, attr, qp);
|
|
|
96ca5f |
if (ret < 0) {
|
|
|
96ca5f |
errno = -ret;
|
|
|
96ca5f |
@@ -2887,6 +2901,9 @@ int mlx5_query_device_ex(struct ibv_context *context,
|
|
|
96ca5f |
if (resp.flags & MLX5_IB_QUERY_DEV_RESP_PACKET_BASED_CREDIT_MODE)
|
|
|
96ca5f |
mctx->vendor_cap_flags |= MLX5_VENDOR_CAP_FLAGS_PACKET_BASED_CREDIT_MODE;
|
|
|
96ca5f |
|
|
|
96ca5f |
+ if (resp.flags & MLX5_IB_QUERY_DEV_RESP_FLAGS_SCAT2CQE_DCT)
|
|
|
96ca5f |
+ mctx->vendor_cap_flags |= MLX5_VENDOR_CAP_FLAGS_SCAT2CQE_DCT;
|
|
|
96ca5f |
+
|
|
|
96ca5f |
major = (raw_fw_ver >> 32) & 0xffff;
|
|
|
96ca5f |
minor = (raw_fw_ver >> 16) & 0xffff;
|
|
|
96ca5f |
sub_minor = raw_fw_ver & 0xffff;
|
|
|
96ca5f |
--
|
|
|
96ca5f |
2.20.1
|
|
|
96ca5f |
|