aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNoa Osherovich <noaos@mellanox.com>2016-06-04 08:15:36 -0400
committerDoug Ledford <dledford@redhat.com>2016-06-07 10:03:50 -0400
commitd3ae2bdeba9bad8cb95301451aeaf03ce31e82f0 (patch)
tree76022086bc87b3e3d224275c0b7b0b6a60f6f1f6
parent3c4c37746c919c983e439ac6a7328cd2d48c10ed (diff)
IB/mlx5: Fix pkey_index length in the QP path record
Pkey index fields in the QP context path record are extended to 16 bits, as required by IB spec (version 1.3). This change affects all QP commands which include path records. To enable this change, moved the free adaptive routing flag bit (free_ar) to the most significant byte of the QP path record. Fixes: e126ba97dba9e ('mlx5: Add driver for Mellanox Connect-IB ...') 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>
-rw-r--r--drivers/infiniband/hw/mlx5/qp.c15
-rw-r--r--include/linux/mlx5/qp.h5
2 files changed, 10 insertions, 10 deletions
diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c
index 43c1441b6fb8..6b90bfdea830 100644
--- a/drivers/infiniband/hw/mlx5/qp.c
+++ b/drivers/infiniband/hw/mlx5/qp.c
@@ -1859,7 +1859,7 @@ static int mlx5_set_path(struct mlx5_ib_dev *dev, struct mlx5_ib_qp *qp,
1859 int err; 1859 int err;
1860 1860
1861 if (attr_mask & IB_QP_PKEY_INDEX) 1861 if (attr_mask & IB_QP_PKEY_INDEX)
1862 path->pkey_index = attr->pkey_index; 1862 path->pkey_index = cpu_to_be16(attr->pkey_index);
1863 1863
1864 if (ah->ah_flags & IB_AH_GRH) { 1864 if (ah->ah_flags & IB_AH_GRH) {
1865 if (ah->grh.sgid_index >= 1865 if (ah->grh.sgid_index >=
@@ -1879,9 +1879,9 @@ static int mlx5_set_path(struct mlx5_ib_dev *dev, struct mlx5_ib_qp *qp,
1879 ah->grh.sgid_index); 1879 ah->grh.sgid_index);
1880 path->dci_cfi_prio_sl = (ah->sl & 0x7) << 4; 1880 path->dci_cfi_prio_sl = (ah->sl & 0x7) << 4;
1881 } else { 1881 } else {
1882 path->fl = (path_flags & MLX5_PATH_FLAG_FL) ? 0x80 : 0; 1882 path->fl_free_ar = (path_flags & MLX5_PATH_FLAG_FL) ? 0x80 : 0;
1883 path->free_ar = (path_flags & MLX5_PATH_FLAG_FREE_AR) ? 0x80 : 1883 path->fl_free_ar |=
1884 0; 1884 (path_flags & MLX5_PATH_FLAG_FREE_AR) ? 0x40 : 0;
1885 path->rlid = cpu_to_be16(ah->dlid); 1885 path->rlid = cpu_to_be16(ah->dlid);
1886 path->grh_mlid = ah->src_path_bits & 0x7f; 1886 path->grh_mlid = ah->src_path_bits & 0x7f;
1887 if (ah->ah_flags & IB_AH_GRH) 1887 if (ah->ah_flags & IB_AH_GRH)
@@ -2266,7 +2266,7 @@ static int __mlx5_ib_modify_qp(struct ib_qp *ibqp,
2266 context->log_pg_sz_remote_qpn = cpu_to_be32(attr->dest_qp_num); 2266 context->log_pg_sz_remote_qpn = cpu_to_be32(attr->dest_qp_num);
2267 2267
2268 if (attr_mask & IB_QP_PKEY_INDEX) 2268 if (attr_mask & IB_QP_PKEY_INDEX)
2269 context->pri_path.pkey_index = attr->pkey_index; 2269 context->pri_path.pkey_index = cpu_to_be16(attr->pkey_index);
2270 2270
2271 /* todo implement counter_index functionality */ 2271 /* todo implement counter_index functionality */
2272 2272
@@ -4015,11 +4015,12 @@ static int query_qp_attr(struct mlx5_ib_dev *dev, struct mlx5_ib_qp *qp,
4015 if (qp->ibqp.qp_type == IB_QPT_RC || qp->ibqp.qp_type == IB_QPT_UC) { 4015 if (qp->ibqp.qp_type == IB_QPT_RC || qp->ibqp.qp_type == IB_QPT_UC) {
4016 to_ib_ah_attr(dev, &qp_attr->ah_attr, &context->pri_path); 4016 to_ib_ah_attr(dev, &qp_attr->ah_attr, &context->pri_path);
4017 to_ib_ah_attr(dev, &qp_attr->alt_ah_attr, &context->alt_path); 4017 to_ib_ah_attr(dev, &qp_attr->alt_ah_attr, &context->alt_path);
4018 qp_attr->alt_pkey_index = context->alt_path.pkey_index & 0x7f; 4018 qp_attr->alt_pkey_index =
4019 be16_to_cpu(context->alt_path.pkey_index);
4019 qp_attr->alt_port_num = qp_attr->alt_ah_attr.port_num; 4020 qp_attr->alt_port_num = qp_attr->alt_ah_attr.port_num;
4020 } 4021 }
4021 4022
4022 qp_attr->pkey_index = context->pri_path.pkey_index & 0x7f; 4023 qp_attr->pkey_index = be16_to_cpu(context->pri_path.pkey_index);
4023 qp_attr->port_num = context->pri_path.port; 4024 qp_attr->port_num = context->pri_path.port;
4024 4025
4025 /* qp_attr->en_sqd_async_notify is only applicable in modify qp */ 4026 /* qp_attr->en_sqd_async_notify is only applicable in modify qp */
diff --git a/include/linux/mlx5/qp.h b/include/linux/mlx5/qp.h
index 64221027bf1f..e4e29882fdfd 100644
--- a/include/linux/mlx5/qp.h
+++ b/include/linux/mlx5/qp.h
@@ -460,10 +460,9 @@ struct mlx5_core_qp {
460}; 460};
461 461
462struct mlx5_qp_path { 462struct mlx5_qp_path {
463 u8 fl; 463 u8 fl_free_ar;
464 u8 rsvd3; 464 u8 rsvd3;
465 u8 free_ar; 465 __be16 pkey_index;
466 u8 pkey_index;
467 u8 rsvd0; 466 u8 rsvd0;
468 u8 grh_mlid; 467 u8 grh_mlid;
469 __be16 rlid; 468 __be16 rlid;