History

RDMA/mlx5: Return ECE DC support

The DC QPs are many-to-one QP types that means that first connection will establish ECE options that coming connections should follow. Due to this property, the ECE code was removed between first [1] and second [2] ECE submissions. This patch returns the dropped code, because ECE is a property of a connection and like any other connection users are needed to manage this data. Allow them to set ECE parameter for DC too and avoid need of having compatibility flag for the DC ECE. [1] https://lore.kernel.org/linux-rdma/20200523132243.817936-1-leon@kernel.org/ [2] https://lore.kernel.org/linux-rdma/20200525174401.71152-1-leon@kernel.org/

Leon Romanovsky committed 6 years ago

Commit a645a891 parent 92cd6672 files · +34 −16Browse files

Unified · Split

2 files
  1. drivers/infiniband/hw/mlx5/qp.c +31 −14
  2. include/linux/mlx5/mlx5_ifc.h +3 −2
drivers/infiniband/hw/mlx5/qp.c+31−14
@@ -2404,7 +2404,8 @@ static void destroy_qp_common(struct mlx5_ib_dev *dev, struct mlx5_ib_qp *qp, · 2403 unmodified lines
2404 destroy_qp(dev, qp, base, udata);2404 destroy_qp(dev, qp, base, udata);
2405}2405}
2406 2406
2407static int create_dct(struct ib_pd *pd, struct mlx5_ib_qp *qp,2407static int create_dct(struct mlx5_ib_dev *dev, struct ib_pd *pd,
2408 struct mlx5_ib_qp *qp,
2408 struct mlx5_create_qp_params *params)2409 struct mlx5_create_qp_params *params)
2409{2410{
2410 struct ib_qp_init_attr *attr = params->attr;2411 struct ib_qp_init_attr *attr = params->attr;
@@ -2423,6 +2424,8 @@ static int create_dct(struct ib_pd *pd, struct mlx5_ib_qp *qp, · 12 unmodified lines
2423 MLX5_SET(dctc, dctc, cqn, to_mcq(attr->recv_cq)->mcq.cqn);2424 MLX5_SET(dctc, dctc, cqn, to_mcq(attr->recv_cq)->mcq.cqn);
2424 MLX5_SET64(dctc, dctc, dc_access_key, ucmd->access_key);2425 MLX5_SET64(dctc, dctc, dc_access_key, ucmd->access_key);
2425 MLX5_SET(dctc, dctc, user_index, uidx);2426 MLX5_SET(dctc, dctc, user_index, uidx);
2427 if (MLX5_CAP_GEN(dev->mdev, ece_support))
2428 MLX5_SET(dctc, dctc, ece, ucmd->ece_options);
2426 2429
2427 if (qp->flags_en & MLX5_QP_FLAG_SCATTER_CQE) {2430 if (qp->flags_en & MLX5_QP_FLAG_SCATTER_CQE) {
2428 int rcqe_sz = mlx5_ib_get_cqe_size(attr->recv_cq);2431 int rcqe_sz = mlx5_ib_get_cqe_size(attr->recv_cq);
@@ -2768,7 +2771,7 @@ static int create_qp(struct mlx5_ib_dev *dev, struct ib_pd *pd, · 339 unmodified lines
2768 }2771 }
2769 2772
2770 if (qp->type == MLX5_IB_QPT_DCT) {2773 if (qp->type == MLX5_IB_QPT_DCT) {
2771 err = create_dct(pd, qp, params);2774 err = create_dct(dev, pd, qp, params);
2772 goto out;2775 goto out;
2773 }2776 }
2774 2777
@@ -2882,9 +2885,8 @@ static int check_ucmd_data(struct mlx5_ib_dev *dev, · 107 unmodified lines
2882 */2885 */
2883 last = sizeof(struct mlx5_ib_create_qp_rss);2886 last = sizeof(struct mlx5_ib_create_qp_rss);
2884 else2887 else
2885 /* IB_QPT_RAW_PACKET and IB_QPT_DRIVER don't have ECE data */2888 /* IB_QPT_RAW_PACKET doesn't have ECE data */
2886 switch (attr->qp_type) {2889 switch (attr->qp_type) {
2887 case IB_QPT_DRIVER:
2888 case IB_QPT_RAW_PACKET:2890 case IB_QPT_RAW_PACKET:
2889 last = offsetof(struct mlx5_ib_create_qp, ece_options);2891 last = offsetof(struct mlx5_ib_create_qp, ece_options);
2890 break;2892 break;
@@ -4095,7 +4097,8 @@ static bool modify_dci_qp_is_ok(enum ib_qp_state cur_state, enum ib_qp_state new · 1204 unmodified lines
4095 * Other transitions and attributes are illegal4097 * Other transitions and attributes are illegal
4096 */4098 */
4097static int mlx5_ib_modify_dct(struct ib_qp *ibqp, struct ib_qp_attr *attr,4099static int mlx5_ib_modify_dct(struct ib_qp *ibqp, struct ib_qp_attr *attr,
4098 int attr_mask, struct ib_udata *udata)4100 int attr_mask, struct mlx5_ib_modify_qp *ucmd,
4101 struct ib_udata *udata)
4099{4102{
4100 struct mlx5_ib_qp *qp = to_mqp(ibqp);4103 struct mlx5_ib_qp *qp = to_mqp(ibqp);
4101 struct mlx5_ib_dev *dev = to_mdev(ibqp->device);4104 struct mlx5_ib_dev *dev = to_mdev(ibqp->device);
@@ -4111,6 +4114,15 @@ static int mlx5_ib_modify_dct(struct ib_qp *ibqp, struct ib_qp_attr *attr, · 9 unmodified lines
4111 new_state = attr->qp_state;4114 new_state = attr->qp_state;
4112 4115
4113 dctc = MLX5_ADDR_OF(create_dct_in, qp->dct.in, dct_context_entry);4116 dctc = MLX5_ADDR_OF(create_dct_in, qp->dct.in, dct_context_entry);
4117 if (MLX5_CAP_GEN(dev->mdev, ece_support) && ucmd->ece_options)
4118 /*
4119 * DCT doesn't initialize QP till modify command is executed,
4120 * so we need to overwrite previously set ECE field if user
4121 * provided any value except zero, which means not set/not
4122 * valid.
4123 */
4124 MLX5_SET(dctc, dctc, ece, ucmd->ece_options);
4125
4114 if (cur_state == IB_QPS_RESET && new_state == IB_QPS_INIT) {4126 if (cur_state == IB_QPS_RESET && new_state == IB_QPS_INIT) {
4115 u16 set_id;4127 u16 set_id;
4116 4128
@@ -4145,14 +4157,21 @@ static int mlx5_ib_modify_dct(struct ib_qp *ibqp, struct ib_qp_attr *attr, · 28 unmodified lines
4145 MLX5_SET(dctc, dctc, counter_set_id, set_id);4157 MLX5_SET(dctc, dctc, counter_set_id, set_id);
4146 } else if (cur_state == IB_QPS_INIT && new_state == IB_QPS_RTR) {4158 } else if (cur_state == IB_QPS_INIT && new_state == IB_QPS_RTR) {
4147 struct mlx5_ib_modify_qp_resp resp = {};4159 struct mlx5_ib_modify_qp_resp resp = {};
4148 u32 out[MLX5_ST_SZ_DW(create_dct_out)] = {0};4160 u32 out[MLX5_ST_SZ_DW(create_dct_out)] = {};
4149 u32 min_resp_len = offsetof(typeof(resp), dctn) +4161 u32 min_resp_len = offsetofend(typeof(resp), dctn);
4150 sizeof(resp.dctn);
4151 4162
4152 if (udata->outlen < min_resp_len)4163 if (udata->outlen < min_resp_len)
4153 return -EINVAL;4164 return -EINVAL;
4154 resp.response_length = min_resp_len;4165 resp.response_length = min_resp_len;
4155 4166
4167 /*
4168 * If we don't have enough space for the ECE options,
4169 * simply indicate it with resp.response_length.
4170 */
4171 resp.response_length = (udata->outlen < sizeof(resp)) ?
4172 min_resp_len :
4173 sizeof(resp);
4174
4156 required |= IB_QP_MIN_RNR_TIMER | IB_QP_AV | IB_QP_PATH_MTU;4175 required |= IB_QP_MIN_RNR_TIMER | IB_QP_AV | IB_QP_PATH_MTU;
4157 if (!is_valid_mask(attr_mask, required, 0))4176 if (!is_valid_mask(attr_mask, required, 0))
4158 return -EINVAL;4177 return -EINVAL;
@@ -4169,6 +4188,8 @@ static int mlx5_ib_modify_dct(struct ib_qp *ibqp, struct ib_qp_attr *attr, · 10 unmodified lines
4169 if (err)4188 if (err)
4170 return err;4189 return err;
4171 resp.dctn = qp->dct.mdct.mqp.qpn;4190 resp.dctn = qp->dct.mdct.mqp.qpn;
4191 if (MLX5_CAP_GEN(dev->mdev, ece_support))
4192 resp.ece_options = MLX5_GET(create_dct_out, out, ece);
4172 err = ib_copy_to_udata(udata, &resp, resp.response_length);4193 err = ib_copy_to_udata(udata, &resp, resp.response_length);
4173 if (err) {4194 if (err) {
4174 mlx5_core_destroy_dct(dev, &qp->dct.mdct);4195 mlx5_core_destroy_dct(dev, &qp->dct.mdct);
@@ -4226,12 +4247,8 @@ int mlx5_ib_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, · 51 unmodified lines
4226 qp_type = (unlikely(ibqp->qp_type == MLX5_IB_QPT_HW_GSI)) ? IB_QPT_GSI :4247 qp_type = (unlikely(ibqp->qp_type == MLX5_IB_QPT_HW_GSI)) ? IB_QPT_GSI :
4227 qp->type;4248 qp->type;
4228 4249
4229 if (qp_type == MLX5_IB_QPT_DCT) {4250 if (qp_type == MLX5_IB_QPT_DCT)
4230 if (memchr_inv(&ucmd.ece_options, 0, sizeof(ucmd.ece_options)))4251 return mlx5_ib_modify_dct(ibqp, attr, attr_mask, &ucmd, udata);
4231 return -EOPNOTSUPP;
4232
4233 return mlx5_ib_modify_dct(ibqp, attr, attr_mask, udata);
4234 }
4235 4252
4236 mutex_lock(&qp->mutex);4253 mutex_lock(&qp->mutex);
4237 4254
include/linux/mlx5/mlx5_ifc.h+3−2
@@ -3690,7 +3690,8 @@ struct mlx5_ifc_dctc_bits { · 3689 unmodified lines
3690 u8 ecn[0x2];3690 u8 ecn[0x2];
3691 u8 dscp[0x6];3691 u8 dscp[0x6];
3692 3692
3693 u8 reserved_at_1c0[0x40];3693 u8 reserved_at_1c0[0x20];
3694 u8 ece[0x20];
3694};3695};
3695 3696
3696enum {3697enum {
@@ -7940,7 +7941,7 @@ struct mlx5_ifc_create_dct_out_bits { · 4243 unmodified lines
7940 u8 reserved_at_40[0x8];7941 u8 reserved_at_40[0x8];
7941 u8 dctn[0x18];7942 u8 dctn[0x18];
7942 7943
7943 u8 reserved_at_60[0x20];7944 u8 ece[0x20];
7944};7945};
7945 7946
7946struct mlx5_ifc_create_dct_in_bits {7947struct mlx5_ifc_create_dct_in_bits {