DPDK patches and discussions
 help / color / mirror / Atom feed
From: David Marchand <david.marchand@redhat.com>
To: Ferruh Yigit <ferruh.yigit@amd.com>
Cc: Thomas Monjalon <thomas@monjalon.net>, Ori Kam <orika@nvidia.com>,
	 Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>,
	Kiran Kumar K <kirankumark@marvell.com>,
	dev@dpdk.org
Subject: Re: [PATCH] ethdev: fix Tx queue mask endianness
Date: Fri, 30 Jun 2023 09:13:34 +0200	[thread overview]
Message-ID: <CAJFAV8x08SYZ3DuJGg9XD5b9+CidW=8ZmSCqeWpJQKs4_xBD+Q@mail.gmail.com> (raw)
In-Reply-To: <CAJFAV8xcsJKMG9+h7=x6wYWJzA-zdXZZ9iRPKhHx6tErBRAppQ@mail.gmail.com>

On Fri, Jun 30, 2023 at 9:00 AM David Marchand
<david.marchand@redhat.com> wrote:
>
> On Thu, Jun 29, 2023 at 6:14 PM Ferruh Yigit <ferruh.yigit@amd.com> wrote:
> >
> > On 6/29/2023 4:42 PM, Thomas Monjalon wrote:
> > > 29/06/2023 17:40, David Marchand:
> > >> On Thu, Jun 29, 2023 at 5:31 PM Thomas Monjalon <thomas@monjalon.net> wrote:
> > >>> 29/06/2023 15:58, David Marchand:
> > >>>> -     .tx_queue = RTE_BE16(0xffff),
> > >>>> +     .tx_queue = 0xffff,
> > >>>
> > >>> As I said in an earlier comment about the same issue,
> > >>> UINT16_MAX would be better.
> > >>
> > >> I don't mind updating (or maybe Ferruh can squash this directly ?) but
> > >> there are lots of uint16_t fields initialised with 0xffff in this same
> > >> file.
> > >
> > > It can be made in a separate patch for all occurences.
> > > First I would like to get some comments, what do you prefer
> > > between 0xffff and UINT16_MAX?
> > >
> >
> > Both works, no strong opinion, I am OK with 0xffff,
> >
> > The variable we are setting is '*_mask', and main point of the value
> > used is to have all bits set, and 0xff.. usage highlights it.
> >
> > Not for UINT16_MAX, but for wider variables, it is easier to make
> > mistake and put wrong number of 'f', using 'UINTxx_MAX' macro can
> > prevent this mistake, this is a benefit.
> >
> >
> > And I think consistency matters more, so if you prefer 'UINTxx_MAX',
> > lets stick to it.
> >
> > I can update above in next-net, but as far as I understand we can have a
> > patch to fix all occurrences.
>
> Given that we are considering unsigned integers, is there something
> wrong with using (typeof(var)) -1 ?

Or maybe get inspiration from what the Linux kernel does :-)
Like GENMASK().


-- 
David Marchand


      reply	other threads:[~2023-06-30  7:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-29 13:58 David Marchand
2023-06-29 14:48 ` Ferruh Yigit
2023-06-29 15:31 ` Thomas Monjalon
2023-06-29 15:40   ` David Marchand
2023-06-29 15:42     ` Thomas Monjalon
2023-06-29 16:14       ` Ferruh Yigit
2023-06-30  7:00         ` David Marchand
2023-06-30  7:13           ` David Marchand [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='CAJFAV8x08SYZ3DuJGg9XD5b9+CidW=8ZmSCqeWpJQKs4_xBD+Q@mail.gmail.com' \
    --to=david.marchand@redhat.com \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@amd.com \
    --cc=kirankumark@marvell.com \
    --cc=orika@nvidia.com \
    --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).