All of lore.kernel.org
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: "Hefty, Sean" <sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: Jason Gunthorpe
	<jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>,
	"Dalessandro,
	Dennis"
	<dennis.dalessandro-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	"dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org"
	<dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	"linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"Hiatt, Don" <don.hiatt-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	"Marciniszyn,
	Mike" <mike.marciniszyn-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Subject: Re: [PATCH for-next 5/8] IB/core: Use __be32 for LIDs in opa_is_extended_lid
Date: Tue, 3 Oct 2017 21:07:35 +0300	[thread overview]
Message-ID: <20171003180735.GE25829@mtr-leonro.local> (raw)
In-Reply-To: <1828884A29C6694DAF28B7E6B8A82373AB19A6C6-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 946 bytes --]

On Tue, Oct 03, 2017 at 05:05:06PM +0000, Hefty, Sean wrote:
> > > > >  	if ((be32_to_cpu(dlid) >=
> > > > >  	     be16_to_cpu(IB_MULTICAST_LID_BASE)) ||
> > > > >  	    (be32_to_cpu(slid) >=
> > > > >  	     be16_to_cpu(IB_MULTICAST_LID_BASE)))
> > > >
> > > > You can drop be32_to_cpu and be16_to_cpu now.
> > > > The dlid is __be32 and IB_MULTICAST_LID_BASE is __be16. The direct
> > > > comparison will work.
> > >
> > > It won't order properly for >=, the swap is still needed...
> >
> > Jason,
> > Do you have reference for that?
> >
> > I tried to find any information about comparison of values from one
> > endianess on machine with another endianess and didn't find anything
> > relevant.
>
> The bytes are out of order, so the comparisons won't work.

I understand it for the "manual" comparison (C-like arrays), but does it apply
for the compiler-aware comparison? Both these variables are marked as
__be32 for the compiler.

Thanks

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  parent reply	other threads:[~2017-10-03 18:07 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-02 18:03 [PATCH for-next 0/8] IB/hfi1, core, rdmavt: Driver fixes for 10/2/2017 Dennis Dalessandro
2017-10-02 18:03 ` Dennis Dalessandro
2017-10-02 18:04 ` [PATCH for-next 3/8] IB/hfi1: Fix incorrect available receive user context count Dennis Dalessandro
     [not found] ` <20171002180204.31117.12254.stgit-9QXIwq+3FY+1XWohqUldA0EOCMrvLtNR@public.gmane.org>
2017-10-02 18:04   ` [PATCH for-next 1/8] IB/hfi1: Add parsing for platform configuration format version 4 Dennis Dalessandro
2017-10-02 18:04   ` [PATCH for-next 2/8] IB/hfi1: Fix output trace issues from 16B change Dennis Dalessandro
2017-10-02 18:04   ` [PATCH for-next 4/8] IB/hfi1: Prevent LNI out of sync by resetting host interface version Dennis Dalessandro
2017-10-02 18:04   ` [PATCH for-next 5/8] IB/core: Use __be32 for LIDs in opa_is_extended_lid Dennis Dalessandro
     [not found]     ` <20171002180431.31117.33069.stgit-9QXIwq+3FY+1XWohqUldA0EOCMrvLtNR@public.gmane.org>
2017-10-03  6:16       ` Leon Romanovsky
     [not found]         ` <20171003061657.GA13648-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2017-10-03 16:00           ` Jason Gunthorpe
     [not found]             ` <20171003160059.GB30753-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-10-03 17:01               ` Leon Romanovsky
     [not found]                 ` <20171003170140.GD25829-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2017-10-03 17:05                   ` Hefty, Sean
     [not found]                     ` <1828884A29C6694DAF28B7E6B8A82373AB19A6C6-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2017-10-03 18:07                       ` Leon Romanovsky [this message]
     [not found]                         ` <20171003180735.GE25829-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2017-10-04 17:23                           ` Leon Romanovsky
2017-10-02 18:04   ` [PATCH for-next 6/8] IB/rdmavt: Correct issues with read-mostly and send size cache lines Dennis Dalessandro
2017-10-02 18:04   ` [PATCH for-next 7/8] IB/core: Do not warn on lid conversions for OPA Dennis Dalessandro
     [not found]     ` <20171002180446.31117.56786.stgit-9QXIwq+3FY+1XWohqUldA0EOCMrvLtNR@public.gmane.org>
2017-10-03  6:24       ` Leon Romanovsky
2017-10-02 18:04   ` [PATCH for-next 8/8] IB/hfi1: " Dennis Dalessandro
     [not found]     ` <20171002180453.31117.53379.stgit-9QXIwq+3FY+1XWohqUldA0EOCMrvLtNR@public.gmane.org>
2017-10-03  6:25       ` Leon Romanovsky
2017-10-04 19:44   ` [PATCH for-next 0/8] IB/hfi1, core, rdmavt: Driver fixes for 10/2/2017 Doug Ledford
2017-10-04 19:44     ` Doug Ledford
     [not found]     ` <1507146261.46071.8.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2017-10-05  1:22       ` Dennis Dalessandro
2017-10-05  1:22         ` Dennis Dalessandro
2017-10-05  7:04         ` Leon Romanovsky
2017-10-05 10:44           ` Dennis Dalessandro
     [not found]             ` <8601bdaa-53cc-e41f-95e6-483af90848b7-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2017-10-05 13:22               ` Doug Ledford
2017-10-05 13:22                 ` Doug Ledford

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171003180735.GE25829@mtr-leonro.local \
    --to=leon-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
    --cc=dennis.dalessandro-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=don.hiatt-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mike.marciniszyn-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.