diff options
author | Or Gerlitz <ogerlitz@mellanox.com> | 2011-12-11 09:40:05 -0500 |
---|---|---|
committer | Roland Dreier <roland@purestorage.com> | 2012-01-04 00:00:02 -0500 |
commit | 9106c410697427363517ca6b4f463698aebc5f25 (patch) | |
tree | ddf079aeac48c40b479bb782f7e3de49153fca03 /drivers/infiniband | |
parent | 5f0a6e2d503896062f641639dacfe5055c2f593b (diff) |
IB/mlx4: Fix SL to 802.1Q priority-bits mapping for IBoE
For IBoE, SLs 0-7 are mapped to Ethernet 802.1Q user priority bits
(pbits) which are part of the VLAN tag, SLs 8-15 are reserved.
Under Ethernet, the ConnectX firmware treats (decode/encode) the four
bit SL field in various constructs such as QPC / UD WQE / CQE as PPP0
and not as 0PPP. This correlates well to the fact that within the
vlan tag the pbits are located in bits 15-13 and not 12-14.
The current code wasn't consistent around that area - the
encoding was correct for the IBoE QPC.path.schedule_queue field,
but was wrong for IBoE CQEs and when MLX header was built.
These inconsistencies resulted in wrong SL <--> wire 802.1Q pbits
mapping, which is fixed by using SL <--> PPP0 all around the place.
Signed-off-by: Oren Duer <oren@mellanox.co.il>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r-- | drivers/infiniband/hw/mlx4/ah.c | 2 | ||||
-rw-r--r-- | drivers/infiniband/hw/mlx4/cq.c | 6 | ||||
-rw-r--r-- | drivers/infiniband/hw/mlx4/qp.c | 4 |
3 files changed, 8 insertions, 4 deletions
diff --git a/drivers/infiniband/hw/mlx4/ah.c b/drivers/infiniband/hw/mlx4/ah.c index 4b8f9c49397e..a251becdaa98 100644 --- a/drivers/infiniband/hw/mlx4/ah.c +++ b/drivers/infiniband/hw/mlx4/ah.c | |||
@@ -126,7 +126,7 @@ static struct ib_ah *create_iboe_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr | |||
126 | ah->av.ib.dlid = cpu_to_be16(0xc000); | 126 | ah->av.ib.dlid = cpu_to_be16(0xc000); |
127 | 127 | ||
128 | memcpy(ah->av.eth.dgid, ah_attr->grh.dgid.raw, 16); | 128 | memcpy(ah->av.eth.dgid, ah_attr->grh.dgid.raw, 16); |
129 | ah->av.eth.sl_tclass_flowlabel = cpu_to_be32(ah_attr->sl << 28); | 129 | ah->av.eth.sl_tclass_flowlabel = cpu_to_be32(ah_attr->sl << 29); |
130 | 130 | ||
131 | return &ah->ibah; | 131 | return &ah->ibah; |
132 | } | 132 | } |
diff --git a/drivers/infiniband/hw/mlx4/cq.c b/drivers/infiniband/hw/mlx4/cq.c index e8df155bc3b0..5ecf38d97269 100644 --- a/drivers/infiniband/hw/mlx4/cq.c +++ b/drivers/infiniband/hw/mlx4/cq.c | |||
@@ -715,13 +715,17 @@ repoll: | |||
715 | } | 715 | } |
716 | 716 | ||
717 | wc->slid = be16_to_cpu(cqe->rlid); | 717 | wc->slid = be16_to_cpu(cqe->rlid); |
718 | wc->sl = be16_to_cpu(cqe->sl_vid) >> 12; | ||
719 | g_mlpath_rqpn = be32_to_cpu(cqe->g_mlpath_rqpn); | 718 | g_mlpath_rqpn = be32_to_cpu(cqe->g_mlpath_rqpn); |
720 | wc->src_qp = g_mlpath_rqpn & 0xffffff; | 719 | wc->src_qp = g_mlpath_rqpn & 0xffffff; |
721 | wc->dlid_path_bits = (g_mlpath_rqpn >> 24) & 0x7f; | 720 | wc->dlid_path_bits = (g_mlpath_rqpn >> 24) & 0x7f; |
722 | wc->wc_flags |= g_mlpath_rqpn & 0x80000000 ? IB_WC_GRH : 0; | 721 | wc->wc_flags |= g_mlpath_rqpn & 0x80000000 ? IB_WC_GRH : 0; |
723 | wc->pkey_index = be32_to_cpu(cqe->immed_rss_invalid) & 0x7f; | 722 | wc->pkey_index = be32_to_cpu(cqe->immed_rss_invalid) & 0x7f; |
724 | wc->csum_ok = mlx4_ib_ipoib_csum_ok(cqe->status, cqe->checksum); | 723 | wc->csum_ok = mlx4_ib_ipoib_csum_ok(cqe->status, cqe->checksum); |
724 | if (rdma_port_get_link_layer(wc->qp->device, | ||
725 | (*cur_qp)->port) == IB_LINK_LAYER_ETHERNET) | ||
726 | wc->sl = be16_to_cpu(cqe->sl_vid) >> 13; | ||
727 | else | ||
728 | wc->sl = be16_to_cpu(cqe->sl_vid) >> 12; | ||
725 | } | 729 | } |
726 | 730 | ||
727 | return 0; | 731 | return 0; |
diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c index a16f0c8e6f3f..aa2aefa4236c 100644 --- a/drivers/infiniband/hw/mlx4/qp.c +++ b/drivers/infiniband/hw/mlx4/qp.c | |||
@@ -962,7 +962,7 @@ static int mlx4_set_path(struct mlx4_ib_dev *dev, const struct ib_ah_attr *ah, | |||
962 | 962 | ||
963 | if (is_eth) { | 963 | if (is_eth) { |
964 | path->sched_queue = MLX4_IB_DEFAULT_SCHED_QUEUE | | 964 | path->sched_queue = MLX4_IB_DEFAULT_SCHED_QUEUE | |
965 | ((port - 1) << 6) | ((ah->sl & 7) << 3) | ((ah->sl & 8) >> 1); | 965 | ((port - 1) << 6) | ((ah->sl & 7) << 3); |
966 | 966 | ||
967 | if (!(ah->ah_flags & IB_AH_GRH)) | 967 | if (!(ah->ah_flags & IB_AH_GRH)) |
968 | return -1; | 968 | return -1; |
@@ -1437,7 +1437,7 @@ static int build_mlx_header(struct mlx4_ib_sqp *sqp, struct ib_send_wr *wr, | |||
1437 | u16 pcp; | 1437 | u16 pcp; |
1438 | 1438 | ||
1439 | sqp->ud_header.vlan.type = cpu_to_be16(MLX4_IB_IBOE_ETHERTYPE); | 1439 | sqp->ud_header.vlan.type = cpu_to_be16(MLX4_IB_IBOE_ETHERTYPE); |
1440 | pcp = (be32_to_cpu(ah->av.ib.sl_tclass_flowlabel) >> 27 & 3) << 13; | 1440 | pcp = (be32_to_cpu(ah->av.ib.sl_tclass_flowlabel) >> 29) << 13; |
1441 | sqp->ud_header.vlan.tag = cpu_to_be16(vlan | pcp); | 1441 | sqp->ud_header.vlan.tag = cpu_to_be16(vlan | pcp); |
1442 | } | 1442 | } |
1443 | } else { | 1443 | } else { |