diff options
Diffstat (limited to 'drivers/infiniband/hw/mlx5/qp.c')
-rw-r--r-- | drivers/infiniband/hw/mlx5/qp.c | 41 |
1 files changed, 25 insertions, 16 deletions
diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c index 504117657d41..ce434228a5ea 100644 --- a/drivers/infiniband/hw/mlx5/qp.c +++ b/drivers/infiniband/hw/mlx5/qp.c | |||
@@ -235,6 +235,8 @@ static int set_rq_size(struct mlx5_ib_dev *dev, struct ib_qp_cap *cap, | |||
235 | qp->rq.max_gs = 0; | 235 | qp->rq.max_gs = 0; |
236 | qp->rq.wqe_cnt = 0; | 236 | qp->rq.wqe_cnt = 0; |
237 | qp->rq.wqe_shift = 0; | 237 | qp->rq.wqe_shift = 0; |
238 | cap->max_recv_wr = 0; | ||
239 | cap->max_recv_sge = 0; | ||
238 | } else { | 240 | } else { |
239 | if (ucmd) { | 241 | if (ucmd) { |
240 | qp->rq.wqe_cnt = ucmd->rq_wqe_count; | 242 | qp->rq.wqe_cnt = ucmd->rq_wqe_count; |
@@ -1851,13 +1853,15 @@ static int modify_raw_packet_eth_prio(struct mlx5_core_dev *dev, | |||
1851 | static int mlx5_set_path(struct mlx5_ib_dev *dev, struct mlx5_ib_qp *qp, | 1853 | static int mlx5_set_path(struct mlx5_ib_dev *dev, struct mlx5_ib_qp *qp, |
1852 | const struct ib_ah_attr *ah, | 1854 | const struct ib_ah_attr *ah, |
1853 | struct mlx5_qp_path *path, u8 port, int attr_mask, | 1855 | struct mlx5_qp_path *path, u8 port, int attr_mask, |
1854 | u32 path_flags, const struct ib_qp_attr *attr) | 1856 | u32 path_flags, const struct ib_qp_attr *attr, |
1857 | bool alt) | ||
1855 | { | 1858 | { |
1856 | enum rdma_link_layer ll = rdma_port_get_link_layer(&dev->ib_dev, port); | 1859 | enum rdma_link_layer ll = rdma_port_get_link_layer(&dev->ib_dev, port); |
1857 | int err; | 1860 | int err; |
1858 | 1861 | ||
1859 | if (attr_mask & IB_QP_PKEY_INDEX) | 1862 | if (attr_mask & IB_QP_PKEY_INDEX) |
1860 | path->pkey_index = attr->pkey_index; | 1863 | path->pkey_index = cpu_to_be16(alt ? attr->alt_pkey_index : |
1864 | attr->pkey_index); | ||
1861 | 1865 | ||
1862 | if (ah->ah_flags & IB_AH_GRH) { | 1866 | if (ah->ah_flags & IB_AH_GRH) { |
1863 | if (ah->grh.sgid_index >= | 1867 | if (ah->grh.sgid_index >= |
@@ -1877,9 +1881,9 @@ static int mlx5_set_path(struct mlx5_ib_dev *dev, struct mlx5_ib_qp *qp, | |||
1877 | ah->grh.sgid_index); | 1881 | ah->grh.sgid_index); |
1878 | path->dci_cfi_prio_sl = (ah->sl & 0x7) << 4; | 1882 | path->dci_cfi_prio_sl = (ah->sl & 0x7) << 4; |
1879 | } else { | 1883 | } else { |
1880 | path->fl = (path_flags & MLX5_PATH_FLAG_FL) ? 0x80 : 0; | 1884 | path->fl_free_ar = (path_flags & MLX5_PATH_FLAG_FL) ? 0x80 : 0; |
1881 | path->free_ar = (path_flags & MLX5_PATH_FLAG_FREE_AR) ? 0x80 : | 1885 | path->fl_free_ar |= |
1882 | 0; | 1886 | (path_flags & MLX5_PATH_FLAG_FREE_AR) ? 0x40 : 0; |
1883 | path->rlid = cpu_to_be16(ah->dlid); | 1887 | path->rlid = cpu_to_be16(ah->dlid); |
1884 | path->grh_mlid = ah->src_path_bits & 0x7f; | 1888 | path->grh_mlid = ah->src_path_bits & 0x7f; |
1885 | if (ah->ah_flags & IB_AH_GRH) | 1889 | if (ah->ah_flags & IB_AH_GRH) |
@@ -1903,7 +1907,7 @@ static int mlx5_set_path(struct mlx5_ib_dev *dev, struct mlx5_ib_qp *qp, | |||
1903 | path->port = port; | 1907 | path->port = port; |
1904 | 1908 | ||
1905 | if (attr_mask & IB_QP_TIMEOUT) | 1909 | if (attr_mask & IB_QP_TIMEOUT) |
1906 | path->ackto_lt = attr->timeout << 3; | 1910 | path->ackto_lt = (alt ? attr->alt_timeout : attr->timeout) << 3; |
1907 | 1911 | ||
1908 | if ((qp->ibqp.qp_type == IB_QPT_RAW_PACKET) && qp->sq.wqe_cnt) | 1912 | if ((qp->ibqp.qp_type == IB_QPT_RAW_PACKET) && qp->sq.wqe_cnt) |
1909 | return modify_raw_packet_eth_prio(dev->mdev, | 1913 | return modify_raw_packet_eth_prio(dev->mdev, |
@@ -2264,7 +2268,7 @@ static int __mlx5_ib_modify_qp(struct ib_qp *ibqp, | |||
2264 | context->log_pg_sz_remote_qpn = cpu_to_be32(attr->dest_qp_num); | 2268 | context->log_pg_sz_remote_qpn = cpu_to_be32(attr->dest_qp_num); |
2265 | 2269 | ||
2266 | if (attr_mask & IB_QP_PKEY_INDEX) | 2270 | if (attr_mask & IB_QP_PKEY_INDEX) |
2267 | context->pri_path.pkey_index = attr->pkey_index; | 2271 | context->pri_path.pkey_index = cpu_to_be16(attr->pkey_index); |
2268 | 2272 | ||
2269 | /* todo implement counter_index functionality */ | 2273 | /* todo implement counter_index functionality */ |
2270 | 2274 | ||
@@ -2277,7 +2281,7 @@ static int __mlx5_ib_modify_qp(struct ib_qp *ibqp, | |||
2277 | if (attr_mask & IB_QP_AV) { | 2281 | if (attr_mask & IB_QP_AV) { |
2278 | err = mlx5_set_path(dev, qp, &attr->ah_attr, &context->pri_path, | 2282 | err = mlx5_set_path(dev, qp, &attr->ah_attr, &context->pri_path, |
2279 | attr_mask & IB_QP_PORT ? attr->port_num : qp->port, | 2283 | attr_mask & IB_QP_PORT ? attr->port_num : qp->port, |
2280 | attr_mask, 0, attr); | 2284 | attr_mask, 0, attr, false); |
2281 | if (err) | 2285 | if (err) |
2282 | goto out; | 2286 | goto out; |
2283 | } | 2287 | } |
@@ -2288,7 +2292,9 @@ static int __mlx5_ib_modify_qp(struct ib_qp *ibqp, | |||
2288 | if (attr_mask & IB_QP_ALT_PATH) { | 2292 | if (attr_mask & IB_QP_ALT_PATH) { |
2289 | err = mlx5_set_path(dev, qp, &attr->alt_ah_attr, | 2293 | err = mlx5_set_path(dev, qp, &attr->alt_ah_attr, |
2290 | &context->alt_path, | 2294 | &context->alt_path, |
2291 | attr->alt_port_num, attr_mask, 0, attr); | 2295 | attr->alt_port_num, |
2296 | attr_mask | IB_QP_PKEY_INDEX | IB_QP_TIMEOUT, | ||
2297 | 0, attr, true); | ||
2292 | if (err) | 2298 | if (err) |
2293 | goto out; | 2299 | goto out; |
2294 | } | 2300 | } |
@@ -4013,11 +4019,12 @@ static int query_qp_attr(struct mlx5_ib_dev *dev, struct mlx5_ib_qp *qp, | |||
4013 | if (qp->ibqp.qp_type == IB_QPT_RC || qp->ibqp.qp_type == IB_QPT_UC) { | 4019 | if (qp->ibqp.qp_type == IB_QPT_RC || qp->ibqp.qp_type == IB_QPT_UC) { |
4014 | to_ib_ah_attr(dev, &qp_attr->ah_attr, &context->pri_path); | 4020 | to_ib_ah_attr(dev, &qp_attr->ah_attr, &context->pri_path); |
4015 | to_ib_ah_attr(dev, &qp_attr->alt_ah_attr, &context->alt_path); | 4021 | to_ib_ah_attr(dev, &qp_attr->alt_ah_attr, &context->alt_path); |
4016 | qp_attr->alt_pkey_index = context->alt_path.pkey_index & 0x7f; | 4022 | qp_attr->alt_pkey_index = |
4023 | be16_to_cpu(context->alt_path.pkey_index); | ||
4017 | qp_attr->alt_port_num = qp_attr->alt_ah_attr.port_num; | 4024 | qp_attr->alt_port_num = qp_attr->alt_ah_attr.port_num; |
4018 | } | 4025 | } |
4019 | 4026 | ||
4020 | qp_attr->pkey_index = context->pri_path.pkey_index & 0x7f; | 4027 | qp_attr->pkey_index = be16_to_cpu(context->pri_path.pkey_index); |
4021 | qp_attr->port_num = context->pri_path.port; | 4028 | qp_attr->port_num = context->pri_path.port; |
4022 | 4029 | ||
4023 | /* qp_attr->en_sqd_async_notify is only applicable in modify qp */ | 4030 | /* qp_attr->en_sqd_async_notify is only applicable in modify qp */ |
@@ -4079,17 +4086,19 @@ int mlx5_ib_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *qp_attr, | |||
4079 | qp_attr->cap.max_recv_sge = qp->rq.max_gs; | 4086 | qp_attr->cap.max_recv_sge = qp->rq.max_gs; |
4080 | 4087 | ||
4081 | if (!ibqp->uobject) { | 4088 | if (!ibqp->uobject) { |
4082 | qp_attr->cap.max_send_wr = qp->sq.wqe_cnt; | 4089 | qp_attr->cap.max_send_wr = qp->sq.max_post; |
4083 | qp_attr->cap.max_send_sge = qp->sq.max_gs; | 4090 | qp_attr->cap.max_send_sge = qp->sq.max_gs; |
4091 | qp_init_attr->qp_context = ibqp->qp_context; | ||
4084 | } else { | 4092 | } else { |
4085 | qp_attr->cap.max_send_wr = 0; | 4093 | qp_attr->cap.max_send_wr = 0; |
4086 | qp_attr->cap.max_send_sge = 0; | 4094 | qp_attr->cap.max_send_sge = 0; |
4087 | } | 4095 | } |
4088 | 4096 | ||
4089 | /* We don't support inline sends for kernel QPs (yet), and we | 4097 | qp_init_attr->qp_type = ibqp->qp_type; |
4090 | * don't know what userspace's value should be. | 4098 | qp_init_attr->recv_cq = ibqp->recv_cq; |
4091 | */ | 4099 | qp_init_attr->send_cq = ibqp->send_cq; |
4092 | qp_attr->cap.max_inline_data = 0; | 4100 | qp_init_attr->srq = ibqp->srq; |
4101 | qp_attr->cap.max_inline_data = qp->max_inline_data; | ||
4093 | 4102 | ||
4094 | qp_init_attr->cap = qp_attr->cap; | 4103 | qp_init_attr->cap = qp_attr->cap; |
4095 | 4104 | ||