public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH/libmlx4] Fix generation of IBV_WC_GRH
@ 2011-03-05  2:45 Jason Gunthorpe
       [not found] ` <20110305024546.GA29147-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Jason Gunthorpe @ 2011-03-05  2:45 UTC (permalink / raw)
  To: Roland Dreier, linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org

Byte swap was erroneously using short not long, so the test always
returns false as 0x80000000 is greater than 16 bits.

Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
---
 src/cq.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Found and tested on a MT25418

Looks like this is a cut and paste error from libmthca which has a
similar line.

Also confirmed that the kernel has a correct version.

diff --git a/src/cq.c b/src/cq.c
index 2d04883..bc53f9b 100644
--- a/src/cq.c
+++ b/src/cq.c
@@ -317,7 +317,7 @@ static int mlx4_poll_one(struct mlx4_cq *cq,
 		wc->src_qp	   = ntohl(cqe->g_mlpath_rqpn) & 0xffffff;
 		wc->dlid_path_bits = (ntohl(cqe->g_mlpath_rqpn) >> 24) & 0x7f;
 		wc->pkey_index     = ntohl(cqe->immed_rss_invalid) >> 16;
-		wc->wc_flags      |= ntohs(cqe->g_mlpath_rqpn) & 0x80000000 ?
+		wc->wc_flags      |= ntohl(cqe->g_mlpath_rqpn) & 0x80000000 ?
 			IBV_WC_GRH : 0;
 	}
 
-- 
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] 6+ messages in thread

* Re: [PATCH/libmlx4] Fix generation of IBV_WC_GRH
       [not found] ` <20110305024546.GA29147-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
@ 2011-03-08 18:04   ` Roland Dreier
       [not found]     ` <AANLkTimu6dGc1NcsgP60iPqNmzGR+cmtwGHjsU_c=LWz-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Roland Dreier @ 2011-03-08 18:04 UTC (permalink / raw)
  To: Jason Gunthorpe; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org

On Fri, Mar 4, 2011 at 6:45 PM, Jason Gunthorpe
<jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org> wrote:
> Byte swap was erroneously using short not long, so the test always
> returns false as 0x80000000 is greater than 16 bits.

This was fixed in libmlx4 1.0.1 a while ago.  I guess I really need
to get that version into Debian/Ubuntu.

 - R.
--
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] 6+ messages in thread

* Re: [PATCH/libmlx4] Fix generation of IBV_WC_GRH
       [not found]     ` <AANLkTimu6dGc1NcsgP60iPqNmzGR+cmtwGHjsU_c=LWz-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2011-03-08 18:32       ` Jason Gunthorpe
  2011-03-09  7:48       ` Or Gerlitz
  1 sibling, 0 replies; 6+ messages in thread
From: Jason Gunthorpe @ 2011-03-08 18:32 UTC (permalink / raw)
  To: Roland Dreier; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org

On Tue, Mar 08, 2011 at 10:04:11AM -0800, Roland Dreier wrote:
> On Fri, Mar 4, 2011 at 6:45 PM, Jason Gunthorpe
> <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org> wrote:
> > Byte swap was erroneously using short not long, so the test always
> > returns false as 0x80000000 is greater than 16 bits.
> 
> This was fixed in libmlx4 1.0.1 a while ago.  I guess I really need
> to get that version into Debian/Ubuntu.

Hurm. OFED needs to pick up 1.0.1.. I've been using your 1.0 with an
upstream kernel because that is what OFED has labeled their
1.5.1/1.5.2 versions of libmlx4. Looks like it is actually 1.0.1
anyhow. Sigh.

Jason
--
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] 6+ messages in thread

* Re: [PATCH/libmlx4] Fix generation of IBV_WC_GRH
       [not found]     ` <AANLkTimu6dGc1NcsgP60iPqNmzGR+cmtwGHjsU_c=LWz-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  2011-03-08 18:32       ` Jason Gunthorpe
@ 2011-03-09  7:48       ` Or Gerlitz
       [not found]         ` <4D7730C4.2000109-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
  1 sibling, 1 reply; 6+ messages in thread
From: Or Gerlitz @ 2011-03-09  7:48 UTC (permalink / raw)
  To: Roland Dreier, Jack Morgenstein
  Cc: Jason Gunthorpe,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org

Roland Dreier wrote:
> This was fixed in libmlx4 1.0.1 a while ago.  I guess I really need
> to get that version into Debian/Ubuntu.

Roland,

I see now that the below commit of yours dropped the ntohl around the 
GRH flag setting which was added by jack in commit 
b2b26f8a73108f971ade988fac3eb9d0446bbbb6

Or.

> commit e6a3ccdffb36f94ee72b2bc97944a50777ff72e0
> Author: Roland Dreier <rolandd-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org>
> Date:   Thu Jan 3 19:59:05 2008 -0800
> 
>     Micro-optimize mlx4_poll_one()
> 
>     Rather than byte-swapping cqe->g_mlpath_rqpn each time we extract a
>     field from it, byte-swap it once into a temporary variable.  This
>     results in smaller, better code.
> 
>     Signed-off-by: Roland Dreier <rolandd-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org>
> 
> diff --git a/src/cq.c b/src/cq.c
> index bc53f9b..06ae9e2 100644
> --- a/src/cq.c
> +++ b/src/cq.c
> @@ -196,6 +196,7 @@ static int mlx4_poll_one(struct mlx4_cq *cq,
>         struct mlx4_cqe *cqe;
>         struct mlx4_srq *srq;
>         uint32_t qpn;
> +       uint32_t g_mlpath_rqpn;
>         uint16_t wqe_index;
>         int is_error;
>         int is_send;
> @@ -314,11 +315,11 @@ static int mlx4_poll_one(struct mlx4_cq *cq,
> 
>                 wc->slid           = ntohs(cqe->rlid);
>                 wc->sl             = cqe->sl >> 4;
> -               wc->src_qp         = ntohl(cqe->g_mlpath_rqpn) & 0xffffff;
> -               wc->dlid_path_bits = (ntohl(cqe->g_mlpath_rqpn) >> 24) & 0x7f;
> +               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) >> 16;
> -               wc->wc_flags      |= ntohl(cqe->g_mlpath_rqpn) & 0x80000000 ?
> -                       IBV_WC_GRH : 0;
>         }
> 
>         return CQ_OK;
--
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] 6+ messages in thread

* Re: [PATCH/libmlx4] Fix generation of IBV_WC_GRH
       [not found]         ` <4D7730C4.2000109-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
@ 2011-03-09  7:51           ` Or Gerlitz
  2011-03-09  7:51           ` Roland Dreier
  1 sibling, 0 replies; 6+ messages in thread
From: Or Gerlitz @ 2011-03-09  7:51 UTC (permalink / raw)
  To: Roland Dreier, Jack Morgenstein
  Cc: Jason Gunthorpe,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org

Or Gerlitz wrote:
> I see now that the below commit of yours dropped the ntohl around the 
> GRH flag setting which was added by jack in commit 
> b2b26f8a73108f971ade988fac3eb9d0446bbbb6

my mistake, sorry for the spam

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] 6+ messages in thread

* Re: [PATCH/libmlx4] Fix generation of IBV_WC_GRH
       [not found]         ` <4D7730C4.2000109-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
  2011-03-09  7:51           ` Or Gerlitz
@ 2011-03-09  7:51           ` Roland Dreier
  1 sibling, 0 replies; 6+ messages in thread
From: Roland Dreier @ 2011-03-09  7:51 UTC (permalink / raw)
  To: Or Gerlitz
  Cc: Jack Morgenstein, Jason Gunthorpe,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org

On Tue, Mar 8, 2011 at 11:48 PM, Or Gerlitz <ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org> wrote:
> I see now that the below commit of yours dropped the ntohl around the GRH
> flag setting which was added by jack in commit
> b2b26f8a73108f971ade988fac3eb9d0446bbbb6

I think the changelog, which you quoted, explains what is going
on with the byte-swapping perfectly:

>> commit e6a3ccdffb36f94ee72b2bc97944a50777ff72e0
>> Author: Roland Dreier <rolandd-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org>
>> Date:   Thu Jan 3 19:59:05 2008 -0800
>>
>>    Micro-optimize mlx4_poll_one()
>>
>>    Rather than byte-swapping cqe->g_mlpath_rqpn each time we extract a
>>    field from it, byte-swap it once into a temporary variable.  This
>>    results in smaller, better code.
--
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] 6+ messages in thread

end of thread, other threads:[~2011-03-09  7:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-05  2:45 [PATCH/libmlx4] Fix generation of IBV_WC_GRH Jason Gunthorpe
     [not found] ` <20110305024546.GA29147-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2011-03-08 18:04   ` Roland Dreier
     [not found]     ` <AANLkTimu6dGc1NcsgP60iPqNmzGR+cmtwGHjsU_c=LWz-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-03-08 18:32       ` Jason Gunthorpe
2011-03-09  7:48       ` Or Gerlitz
     [not found]         ` <4D7730C4.2000109-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2011-03-09  7:51           ` Or Gerlitz
2011-03-09  7:51           ` Roland Dreier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox