* [PATCH] mlx5: Fix incorrect wc pkey_index assignment for GSI messages
@ 2015-08-31 15:24 Sagi Grimberg
[not found] ` <1441034670-27778-1-git-send-email-sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Sagi Grimberg @ 2015-08-31 15:24 UTC (permalink / raw)
To: linux-rdma-u79uwXL29TY76Z2rM5mHXA; +Cc: Eli Cohen, Haggai Eran
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 (see http://www.spinics.net/lists/netdev/msg335599.html).
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.
Signed-off-by: Sagi Grimberg <sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Cc: Haggai Eran <haggaie-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
drivers/infiniband/hw/mlx5/cq.c | 10 +++++++++-
drivers/infiniband/hw/mlx5/mlx5_ib.h | 5 +++++
drivers/infiniband/hw/mlx5/qp.c | 5 -----
3 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/drivers/infiniband/hw/mlx5/cq.c b/drivers/infiniband/hw/mlx5/cq.c
index 640c54e..3dfd287 100644
--- a/drivers/infiniband/hw/mlx5/cq.c
+++ b/drivers/infiniband/hw/mlx5/cq.c
@@ -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)
diff --git a/drivers/infiniband/hw/mlx5/mlx5_ib.h b/drivers/infiniband/hw/mlx5/mlx5_ib.h
index fc987fe..a4ef6a7 100644
--- a/drivers/infiniband/hw/mlx5/mlx5_ib.h
+++ b/drivers/infiniband/hw/mlx5/mlx5_ib.h
@@ -656,6 +656,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)
diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c
index 9380d2d..8c51ea3 100644
--- a/drivers/infiniband/hw/mlx5/qp.c
+++ b/drivers/infiniband/hw/mlx5/qp.c
@@ -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);
--
1.7.1
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 4+ messages in thread[parent not found: <1441034670-27778-1-git-send-email-sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>]
* Re: [PATCH] mlx5: Fix incorrect wc pkey_index assignment for GSI messages [not found] ` <1441034670-27778-1-git-send-email-sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org> @ 2015-08-31 20:18 ` Or Gerlitz [not found] ` <CAJ3xEMgfibE3VsyvLmuaFnzbo8HgwZ+qtrt0G24Dy54RLjPGWA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 0 siblings, 1 reply; 4+ messages in thread From: Or Gerlitz @ 2015-08-31 20:18 UTC (permalink / raw) To: Sagi Grimberg, Haggai Eran Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Eli Cohen On Mon, Aug 31, 2015 at 6:24 PM, Sagi Grimberg <sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org> wrote: > 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 so prior to this series nobody in the IB core (and maybe across the whole upstream kernel) uses ib_wc->pkey_index?! > (see http://www.spinics.net/lists/netdev/msg335599.html). better to have pointer here to upstream commit and not to an archive URL which is possibly gonna die some day > 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. > > Signed-off-by: Sagi Grimberg <sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org> > Cc: Haggai Eran <haggaie-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org> > --- > drivers/infiniband/hw/mlx5/cq.c | 10 +++++++++- > drivers/infiniband/hw/mlx5/mlx5_ib.h | 5 +++++ > drivers/infiniband/hw/mlx5/qp.c | 5 ----- > 3 files changed, 14 insertions(+), 6 deletions(-) > > diff --git a/drivers/infiniband/hw/mlx5/cq.c b/drivers/infiniband/hw/mlx5/cq.c > index 640c54e..3dfd287 100644 > --- a/drivers/infiniband/hw/mlx5/cq.c > +++ b/drivers/infiniband/hw/mlx5/cq.c > @@ -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) > diff --git a/drivers/infiniband/hw/mlx5/mlx5_ib.h b/drivers/infiniband/hw/mlx5/mlx5_ib.h > index fc987fe..a4ef6a7 100644 > --- a/drivers/infiniband/hw/mlx5/mlx5_ib.h > +++ b/drivers/infiniband/hw/mlx5/mlx5_ib.h > @@ -656,6 +656,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) > > diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c > index 9380d2d..8c51ea3 100644 > --- a/drivers/infiniband/hw/mlx5/qp.c > +++ b/drivers/infiniband/hw/mlx5/qp.c > @@ -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); > -- > 1.7.1 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-rdma" in > the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <CAJ3xEMgfibE3VsyvLmuaFnzbo8HgwZ+qtrt0G24Dy54RLjPGWA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: [PATCH] mlx5: Fix incorrect wc pkey_index assignment for GSI messages [not found] ` <CAJ3xEMgfibE3VsyvLmuaFnzbo8HgwZ+qtrt0G24Dy54RLjPGWA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2015-09-01 8:08 ` Sagi Grimberg [not found] ` <55E55CF1.4010803-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org> 0 siblings, 1 reply; 4+ messages in thread From: Sagi Grimberg @ 2015-09-01 8:08 UTC (permalink / raw) To: Or Gerlitz, Sagi Grimberg, Haggai Eran Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Eli Cohen On 8/31/2015 11:18 PM, Or Gerlitz wrote: > On Mon, Aug 31, 2015 at 6:24 PM, Sagi Grimberg <sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org> wrote: >> 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 > > so prior to this series nobody in the IB core (and maybe across the > whole upstream kernel) uses ib_wc->pkey_index?! I guess so... > >> (see http://www.spinics.net/lists/netdev/msg335599.html). > > better to have pointer here to upstream commit and not to an archive > URL which is possibly gonna die some day This commit is not upstream yet. -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <55E55CF1.4010803-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>]
* Re: [PATCH] mlx5: Fix incorrect wc pkey_index assignment for GSI messages [not found] ` <55E55CF1.4010803-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org> @ 2015-09-01 8:36 ` Or Gerlitz 0 siblings, 0 replies; 4+ messages in thread From: Or Gerlitz @ 2015-09-01 8:36 UTC (permalink / raw) To: Sagi Grimberg, Or Gerlitz, Sagi Grimberg, Haggai Eran Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Eli Cohen On 9/1/2015 11:08 AM, Sagi Grimberg wrote: > >> >>> (see http://www.spinics.net/lists/netdev/msg335599.html). >> >> better to have pointer here to upstream commit and not to an archive >> URL which is possibly gonna die some day > > This commit is not upstream yet. I know, but but under the way the net/net-next and now also Doug's tree are set, the ID remains the same also when Linus picks the offending patch, so you can give their ID now, just make sure you take it from the correct branch -- see Doug's responses to my email on the list in the last 1-2 days Or. -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-09-01 8:36 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-31 15:24 [PATCH] mlx5: Fix incorrect wc pkey_index assignment for GSI messages Sagi Grimberg
[not found] ` <1441034670-27778-1-git-send-email-sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2015-08-31 20:18 ` Or Gerlitz
[not found] ` <CAJ3xEMgfibE3VsyvLmuaFnzbo8HgwZ+qtrt0G24Dy54RLjPGWA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-09-01 8:08 ` Sagi Grimberg
[not found] ` <55E55CF1.4010803-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2015-09-01 8:36 ` Or Gerlitz
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.