DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jerin Jacob <jerin.jacob@caviumnetworks.com>
To: Thomas Monjalon <thomas@monjalon.net>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
	"Jacob,  Jerin" <Jerin.JacobKollanukkaran@cavium.com>,
	"stable@dpdk.org" <stable@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH] eal: fix build issue
Date: Tue, 6 Nov 2018 13:31:34 +0000	[thread overview]
Message-ID: <20181106133127.GA29301@jerin> (raw)
In-Reply-To: <3520386.84pXejHKmD@xps>

-----Original Message-----
> Date: Tue, 06 Nov 2018 13:29:19 +0100
> From: Thomas Monjalon <thomas@monjalon.net>
> To: Jerin Jacob <jerin.jacob@caviumnetworks.com>
> Cc: "dev@dpdk.org" <dev@dpdk.org>, "Jacob, Jerin"
>  <Jerin.JacobKollanukkaran@cavium.com>, "stable@dpdk.org" <stable@dpdk.org>
> Subject: Re: [dpdk-dev] [PATCH] eal: fix build issue
> 
> 
> 06/11/2018 12:45, Jerin Jacob:
> > Some toolchain has fls() definition in string.h as argument type int,
> > which is conflicting uint32_t argument type.
> >
> > /export/dpdk.org/lib/librte_eal/common/rte_reciprocal.c:47:19:
> > error: conflicting types for ‘fls’
> >  static inline int fls(uint32_t x)
> >                   ^~~
> >
> > /opt/marvell-tools-201/aarch64-marvell-elf/include/strings.h:59:6:
> > note: previous declaration of ‘fls’ was here
> >  int  fls(int) __pure2;
> >
> > FreeBSD string.h also has fls() with argument as int type.
> > https://www.freebsd.org/cgi/man.cgi?query=fls&sektion=3
> >
> > Fixing the conflict by renaming internal function as __fls
> 
> Why not rte_fls? Would it be more future proof?

Agreed. There are two instance of fls in dpdk code base now,

1) lib/librte_eal/common/rte_reciprocal.c takes uint32_t
2) drivers/net/fm10k/fm10k_ethdev.c has macro, used with uint16_t as
argument.

Should we make it as macro or follow libc prototype where argument is
int.

Something like below,

static inline int
rte_fls(int x)
{
	return (x == 0) ? 0 : sizeof(x) * 8 - __builtin_clz(x);
}


 

> 
> 

  reply	other threads:[~2018-11-06 13:31 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-06 11:45 Jerin Jacob
2018-11-06 12:29 ` Thomas Monjalon
2018-11-06 13:31   ` Jerin Jacob [this message]
2018-11-06 20:27     ` Thomas Monjalon
2018-11-07  6:59 ` [dpdk-dev] [PATCH v2 1/2] eal: introduce rte version of fls Jerin Jacob
2018-11-07  6:59   ` [dpdk-dev] [PATCH v2 2/2] eal: fix build issue Jerin Jacob
2018-11-12  1:37     ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon
2018-11-12  4:50       ` Jerin Jacob
2018-11-12  9:01         ` Ferruh Yigit
2018-11-12  9:17           ` Thomas Monjalon
2018-11-12 12:28     ` Thomas Monjalon

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=20181106133127.GA29301@jerin \
    --to=jerin.jacob@caviumnetworks.com \
    --cc=Jerin.JacobKollanukkaran@cavium.com \
    --cc=dev@dpdk.org \
    --cc=stable@dpdk.org \
    --cc=thomas@monjalon.net \
    /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).