netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Leon Romanovsky <leonro@mellanox.com>
Cc: David Ahern <dsahern@gmail.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: [iproute] rdma broken on 32 bit
Date: Thu, 13 Dec 2018 13:15:02 -0800	[thread overview]
Message-ID: <20181213131502.74be6f80@xeon-e3> (raw)
In-Reply-To: <20181211173315.GF3933@mtr-leonro.mtl.com>

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

On Tue, 11 Dec 2018 17:33:19 +0000
Leon Romanovsky <leonro@mellanox.com> wrote:

> On Mon, Dec 10, 2018 at 02:10:20PM -0800, Stephen Hemminger wrote:
> > It appears that RDMA is broken on 32 bit platforms.
> > Sure you don't run on 32bit, but iproute2 needs to build everywhere.
> >
> > The issue is that  you are assuming a C enum can hold 64 bits.
> > The standard says enum only has to hold "int" values.
> > So it breaks on 32bit.
> >
> > The issue is deeper than just a trivial fix. Please either change iproute
> > config script to not build RDMA if sizeof(enum) < 64 or fix the code to
> > use a safe value like uint64_t.
> >
> > rdma
> >     CC       rdma.o
> >     CC       utils.o
> >     CC       dev.o
> >     CC       link.o
> > In file included from rdma.h:26:0,
> >                  from dev.c:12:
> > dev.c: In function ‘dev_caps_to_str’:
> > ../include/utils.h:269:38: warning: left shift count >= width of type [-Wshift-count-overflow]
> >  #define BIT(nr)                 (1UL << (nr))
> >                                       ^
> > rdma.h:32:61: note: in expansion of macro ‘BIT’
> >  #define RDMA_BITMAP_ENUM(name, bit_no) RDMA_BITMAP_##name = BIT(bit_no),
> >                                                              ^~~
> > If you wade through the macro swamp:
> > dev.c
> > #define RDMA_DEV_FLAGS(x) \
> >
> > 	x(SG_GAPS_REG, 32) \
> >
> > 	enum { RDMA_DEV_FLAGS(RDMA_BITMAP_ENUM) };
> >
> > Expands to:
> > 	enum {
> > 		RDMA_BITMAP_SG_GAPS_REG = (1UL << (32)),
> > 	};
> >  
> 
> Thanks for the report, I reproduced and will do my best to send patches tomorrow.

Thanks for fixing it so fast. Applied your fix

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

      reply	other threads:[~2018-12-13 21:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-10 22:10 [iproute] rdma broken on 32 bit Stephen Hemminger
2018-12-11 17:33 ` Leon Romanovsky
2018-12-13 21:15   ` Stephen Hemminger [this message]

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=20181213131502.74be6f80@xeon-e3 \
    --to=stephen@networkplumber.org \
    --cc=dsahern@gmail.com \
    --cc=leonro@mellanox.com \
    --cc=netdev@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).