netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Leon Romanovsky <leonro@mellanox.com>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: David Ahern <dsahern@gmail.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: [iproute] rdma broken on 32 bit
Date: Tue, 11 Dec 2018 17:33:19 +0000	[thread overview]
Message-ID: <20181211173315.GF3933@mtr-leonro.mtl.com> (raw)
In-Reply-To: <20181210141020.535f042a@xeon-e3>

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

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.

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

  reply	other threads:[~2018-12-11 17:34 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 [this message]
2018-12-13 21:15   ` Stephen Hemminger

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=20181211173315.GF3933@mtr-leonro.mtl.com \
    --to=leonro@mellanox.com \
    --cc=dsahern@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.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).