diff options
author | Achiad Shochat <achiad@mellanox.com> | 2016-06-04 08:15:37 -0400 |
---|---|---|
committer | Doug Ledford <dledford@redhat.com> | 2016-06-07 10:03:50 -0400 |
commit | f879ee8d900fc78b5bc5d840edd9ecb57d02ab7e (patch) | |
tree | 8885a27e863cca17cf83ae054233600363ba7642 /drivers/infiniband | |
parent | d3ae2bdeba9bad8cb95301451aeaf03ce31e82f0 (diff) |
IB/mlx5: Fix alternate path code
Userspace flag IBV_QP_ALT_PATH is supposed to set the alternate path
including fields alt_pkey_index and alt_timeout.
Added IB_QP_PKEY_INDEX and IB_QP_TIMEOUT to the attribute mask when
calling mlx5_set_path for the alternate path to force setting the
alt_pkey_index and alt_timeout values.
Fixes: bf24481a3a7c4 ('IB/mlx5: Consider alternate path in pkey ...')
Signed-off-by: Achiad Shochat <achiad@mellanox.com>
Signed-off-by: Noa Osherovich <noaos@mellanox.com>
Reviewed-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r-- | drivers/infiniband/hw/mlx5/qp.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c index 6b90bfdea830..ce434228a5ea 100644 --- a/drivers/infiniband/hw/mlx5/qp.c +++ b/drivers/infiniband/hw/mlx5/qp.c | |||
@@ -1853,13 +1853,15 @@ static int modify_raw_packet_eth_prio(struct mlx5_core_dev *dev, | |||
1853 | 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, |
1854 | const struct ib_ah_attr *ah, | 1854 | const struct ib_ah_attr *ah, |
1855 | struct mlx5_qp_path *path, u8 port, int attr_mask, | 1855 | struct mlx5_qp_path *path, u8 port, int attr_mask, |
1856 | u32 path_flags, const struct ib_qp_attr *attr) | 1856 | u32 path_flags, const struct ib_qp_attr *attr, |
1857 | bool alt) | ||
1857 | { | 1858 | { |
1858 | 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); |
1859 | int err; | 1860 | int err; |
1860 | 1861 | ||
1861 | if (attr_mask & IB_QP_PKEY_INDEX) | 1862 | if (attr_mask & IB_QP_PKEY_INDEX) |
1862 | path->pkey_index = cpu_to_be16(attr->pkey_index); | 1863 | path->pkey_index = cpu_to_be16(alt ? attr->alt_pkey_index : |
1864 | attr->pkey_index); | ||
1863 | 1865 | ||
1864 | if (ah->ah_flags & IB_AH_GRH) { | 1866 | if (ah->ah_flags & IB_AH_GRH) { |
1865 | if (ah->grh.sgid_index >= | 1867 | if (ah->grh.sgid_index >= |
@@ -1905,7 +1907,7 @@ static int mlx5_set_path(struct mlx5_ib_dev *dev, struct mlx5_ib_qp *qp, | |||
1905 | path->port = port; | 1907 | path->port = port; |
1906 | 1908 | ||
1907 | if (attr_mask & IB_QP_TIMEOUT) | 1909 | if (attr_mask & IB_QP_TIMEOUT) |
1908 | path->ackto_lt = attr->timeout << 3; | 1910 | path->ackto_lt = (alt ? attr->alt_timeout : attr->timeout) << 3; |
1909 | 1911 | ||
1910 | 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) |
1911 | return modify_raw_packet_eth_prio(dev->mdev, | 1913 | return modify_raw_packet_eth_prio(dev->mdev, |
@@ -2279,7 +2281,7 @@ static int __mlx5_ib_modify_qp(struct ib_qp *ibqp, | |||
2279 | if (attr_mask & IB_QP_AV) { | 2281 | if (attr_mask & IB_QP_AV) { |
2280 | 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, |
2281 | attr_mask & IB_QP_PORT ? attr->port_num : qp->port, | 2283 | attr_mask & IB_QP_PORT ? attr->port_num : qp->port, |
2282 | attr_mask, 0, attr); | 2284 | attr_mask, 0, attr, false); |
2283 | if (err) | 2285 | if (err) |
2284 | goto out; | 2286 | goto out; |
2285 | } | 2287 | } |
@@ -2290,7 +2292,9 @@ static int __mlx5_ib_modify_qp(struct ib_qp *ibqp, | |||
2290 | if (attr_mask & IB_QP_ALT_PATH) { | 2292 | if (attr_mask & IB_QP_ALT_PATH) { |
2291 | err = mlx5_set_path(dev, qp, &attr->alt_ah_attr, | 2293 | err = mlx5_set_path(dev, qp, &attr->alt_ah_attr, |
2292 | &context->alt_path, | 2294 | &context->alt_path, |
2293 | 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); | ||
2294 | if (err) | 2298 | if (err) |
2295 | goto out; | 2299 | goto out; |
2296 | } | 2300 | } |