]> git.ipfire.org Git - people/ms/linux.git/commitdiff
mlx5: Fix incorrect wc pkey_index assignment for GSI messages
authorSagi Grimberg <sagig@mellanox.com>
Wed, 2 Sep 2015 19:23:04 +0000 (22:23 +0300)
committerDoug Ledford <dledford@redhat.com>
Thu, 3 Sep 2015 18:50:06 +0000 (14:50 -0400)
Since patch series "Demux IB CM requests in the rdma_cm module" the
P_Key index is taken from the work completion rather than the message
itself.

The HCA provides us with the message P_Key. In order to provide the
P_Key index, we need to look it up. Given that this is relevant only
for GSI messages (session establishments) which is less performance critical,
micro-optimize against the GSI (is_qp1) branch.

Fixes: 4c21b5bcef73 ("IB/cma: Add net_dev and private data checks to
RDMA CM")
Signed-off-by: Sagi Grimberg <sagig@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/hw/mlx5/cq.c
drivers/infiniband/hw/mlx5/mlx5_ib.h
drivers/infiniband/hw/mlx5/qp.c

index 5c9eeea628054db99df2c987478b6bd713dbcf16..2d0dbbf38ceb9f6277bc9c86e726b97a6e33f17d 100644 (file)
@@ -33,6 +33,7 @@
 #include <linux/kref.h>
 #include <rdma/ib_umem.h>
 #include <rdma/ib_user_verbs.h>
+#include <rdma/ib_cache.h>
 #include "mlx5_ib.h"
 #include "user.h"
 
@@ -227,7 +228,14 @@ static void handle_responder(struct ib_wc *wc, struct mlx5_cqe64 *cqe,
        wc->dlid_path_bits = cqe->ml_path;
        g = (be32_to_cpu(cqe->flags_rqpn) >> 28) & 3;
        wc->wc_flags |= g ? IB_WC_GRH : 0;
-       wc->pkey_index     = be32_to_cpu(cqe->imm_inval_pkey) & 0xffff;
+       if (unlikely(is_qp1(qp->ibqp.qp_type))) {
+               u16 pkey = be32_to_cpu(cqe->imm_inval_pkey) & 0xffff;
+
+               ib_find_cached_pkey(&dev->ib_dev, qp->port, pkey,
+                                   &wc->pkey_index);
+       } else {
+               wc->pkey_index = 0;
+       }
 }
 
 static void dump_cqe(struct mlx5_ib_dev *dev, struct mlx5_err_cqe *cqe)
index a5fa0b9c7580295146037408a247c13b273ec6d5..bb8cda79e8812cf1122feaa70a3f113958858d77 100644 (file)
@@ -680,6 +680,11 @@ static inline u8 convert_access(int acc)
               MLX5_PERM_LOCAL_READ;
 }
 
+static inline int is_qp1(enum ib_qp_type qp_type)
+{
+       return qp_type == IB_QPT_GSI;
+}
+
 #define MLX5_MAX_UMR_SHIFT 16
 #define MLX5_MAX_UMR_PAGES (1 << MLX5_MAX_UMR_SHIFT)
 
index 203c8a45e095560b146859e464eb0a33933c474a..c745c6c5e10da0b296fd19ef6ee01d7650af44ff 100644 (file)
@@ -76,11 +76,6 @@ static int is_qp0(enum ib_qp_type qp_type)
        return qp_type == IB_QPT_SMI;
 }
 
-static int is_qp1(enum ib_qp_type qp_type)
-{
-       return qp_type == IB_QPT_GSI;
-}
-
 static int is_sqp(enum ib_qp_type qp_type)
 {
        return is_qp0(qp_type) || is_qp1(qp_type);