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>
2 files changed