aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOr Gerlitz <ogerlitz@mellanox.com>2011-12-11 16:45:40 +0200
committerRoland Dreier <roland@purestorage.com>2012-03-23 14:44:34 -0700
commit92884a0a1b5ce6991fa4322187d8df05ed4f0704 (patch)
treea57b4e03f2e80e037db3619c00e1053135774e19
parent39d3d19b4f0f01f3fe173c0f777e7a078f5c3dc6 (diff)
downloadlibmlx4-92884a0a1b5ce6991fa4322187d8df05ed4f0704.tar.gz
Fix IBoE SL -> 802.1Q priority-bits mapping
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 decodes/encodes the four-bit SL field in various constructs such as QPC / UD WQE / CQE as PPP0 and not as 0PPP. This matches the fact that within the VLAN tag the pbits are located in bits 15-13 and not 12-14. The current code was buggy around this: - The encoding into the address handle was wrong which resulted in wrong priority-bits for datagram WQEs. - Decoding from the CQE was wrong, which resulted in wrong input into an AH built up from a completion, eg consumers of ibv_init_ah_from_wc(). This is fixed by using PPP0 where appropriate. Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com> Signed-off-by: Roland Dreier <roland@purestorage.com>
-rw-r--r--src/cq.c5
-rw-r--r--src/verbs.c5
2 files changed, 7 insertions, 3 deletions
diff --git a/src/cq.c b/src/cq.c
index 873c1a2..8f7a8cc 100644
--- a/src/cq.c
+++ b/src/cq.c
@@ -317,12 +317,15 @@ static int mlx4_poll_one(struct mlx4_cq *cq,
}
wc->slid = ntohs(cqe->rlid);
- wc->sl = ntohs(cqe->sl_vid) >> 12;
g_mlpath_rqpn = ntohl(cqe->g_mlpath_rqpn);
wc->src_qp = g_mlpath_rqpn & 0xffffff;
wc->dlid_path_bits = (g_mlpath_rqpn >> 24) & 0x7f;
wc->wc_flags |= g_mlpath_rqpn & 0x80000000 ? IBV_WC_GRH : 0;
wc->pkey_index = ntohl(cqe->immed_rss_invalid) & 0x7f;
+ if ((*cur_qp)->link_layer == IBV_LINK_LAYER_ETHERNET)
+ wc->sl = ntohs(cqe->sl_vid) >> 13;
+ else
+ wc->sl = ntohs(cqe->sl_vid) >> 12;
}
return CQ_OK;
diff --git a/src/verbs.c b/src/verbs.c
index f5f870d..18ec4f1 100644
--- a/src/verbs.c
+++ b/src/verbs.c
@@ -677,13 +677,14 @@ struct ibv_ah *mlx4_create_ah(struct ibv_pd *pd, struct ibv_ah_attr *attr)
if (port_attr.link_layer != IBV_LINK_LAYER_ETHERNET) {
ah->av.g_slid = attr->src_path_bits;
ah->av.dlid = htons(attr->dlid);
- }
+ ah->av.sl_tclass_flowlabel = htonl(attr->sl << 28);
+ } else
+ ah->av.sl_tclass_flowlabel = htonl(attr->sl << 29);
if (attr->static_rate) {
ah->av.stat_rate = attr->static_rate + MLX4_STAT_RATE_OFFSET;
/* XXX check rate cap? */
}
- ah->av.sl_tclass_flowlabel = htonl(attr->sl << 28);
if (attr->is_global) {
ah->av.g_slid |= 0x80;
ah->av.gid_index = attr->grh.sgid_index;