IB/mlx4: Fix QP1 P_Key processing in the Primary Physical Function (PPF)
authorJack Morgenstein <jackm@dev.mellanox.co.il>
Wed, 17 Oct 2012 16:42:58 +0000 (16:42 +0000)
committerRoland Dreier <roland@purestorage.com>
Thu, 18 Oct 2012 17:29:02 +0000 (10:29 -0700)
commit2c75d2ccb6e5ffb96ce8624ef4c1f7ba5bd96499
tree35d6655b068bf79a7c5acebf6b7b715738bed238
parent8a095030f7551d07860fd54890d1bcdc77630c29
IB/mlx4: Fix QP1 P_Key processing in the Primary Physical Function (PPF)

In the MAD paravirtualization code, one of the checks performed when
forwarding QP1 (GSI) packets from wire to slave was a P_Key check: the
P_Key received in the MAD must be present in the guest's paravirtualized
P_Key table, and at least one of the (packet P_Key, guest P_Key) must
be a full-membership P_Key.

However, if everyone involved has only limited membership in the
default P_Key, then packets sent by full-member remote hosts arrive at
the PPF but are not passed on to the VFs with the current P_Key1 check.

Fix this as follows:

1. Don't care if P_Key received over wire is full or not. If it
   successfully passed HW checks on the real QP1, then simply pass it
   to guest regardless of whether the guest has full or limited
   membership in its P_Key table.

2. If the guest (including paravirtualized master) has both full and
   limited P_Key forms in its table, preferentially pass the
   paravirtualized P_Key index of the full P_Key form in the tunnel
   header.

3. In the multicast join flow (mlx4/mcg.c), use the index for the
   default P_Key (wherever it is located) in replies generated from
   within the mcg module (previously, P_Key index 0 was used in all
   cases).

Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Signed-off-by: Roland Dreier <roland@purestorage.com>
drivers/infiniband/hw/mlx4/mad.c
drivers/infiniband/hw/mlx4/mcg.c