From: Paolo Abeni <pabeni@redhat.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: davem@davemloft.net, netdev@vger.kernel.org, edumazet@google.com,
michael.chan@broadcom.com
Subject: Re: [PATCH net-next 3/3] eth: bnxt: handle invalid Tx completions more gracefully
Date: Wed, 12 Jul 2023 08:50:06 +0200 [thread overview]
Message-ID: <5b722084c6031009f845e6af8b438d49b9ea7dc1.camel@redhat.com> (raw)
In-Reply-To: <20230711181919.50f27180@kernel.org>
On Tue, 2023-07-11 at 18:19 -0700, Jakub Kicinski wrote:
> On Tue, 11 Jul 2023 12:10:28 +0200 Paolo Abeni wrote:
> > On Mon, 2023-07-10 at 13:56 -0700, Jakub Kicinski wrote:
> > > diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethernet/broadcom/bnxt/bnxt.h
> > > index 080e73496066..08ce9046bfd2 100644
> > > --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h
> > > +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h
> > > @@ -1008,6 +1008,7 @@ struct bnxt_napi {
> > > int);
> > > int tx_pkts;
> > > u8 events;
> > > + u8 tx_fault:1;
> >
> > Since there are still a few holes avail, I would use a plain u8 (or
> > bool) to help the compiler emit better code.
>
> Is that still true or was it only true for old compilers?
> With gcc version 13.1.1 20230614 :
>
> $ cat /tmp/t.c
> #include <strings.h>
>
> struct some {
> void (*f)(void);
> unsigned char b;
> #ifdef BLA
> _Bool a;
> #else
> unsigned char a:1;
> #endif
> };
>
> int bla(struct some *s)
> {
> if (s->a)
> s->f();
> return 0;
> }
>
> $ gcc -W -Wall -O2 /tmp/t.c -o /tmp/t -c
> $ objdump -S /tmp/t > /tmp/a
> $ gcc -DBLA -W -Wall -O2 /tmp/t.c -o /tmp/t -c
> $ objdump -S /tmp/t > /tmp/b
> $ diff /tmp/a /tmp/b
> 8c8
> < 0: f6 47 09 01 testb $0x1,0x9(%rdi)
> ---
> > 0: 80 7f 09 00 cmpb $0x0,0x9(%rdi)
>
> $ gcc -V
>
> Shouldn't matter, right?
Surely not a big deal. But some users (possibly most of them!) have
older compiler. Including an assignment in the test code, I get this
additional difference:
- c: 80 4b 09 01 orb $0x1,0x9(%rbx)
+ c: c6 43 09 01 movb $0x1,0x9(%rbx)
with the bitfield using the 'or' operation. Not a big deal, but the
other option is slightly better ;)
Cheers,
Paolo
next prev parent reply other threads:[~2023-07-12 6:50 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-10 20:56 [PATCH net-next 0/3] eth: bnxt: handle invalid Tx completions more gracefully Jakub Kicinski
2023-07-10 20:56 ` [PATCH net-next 1/3] eth: bnxt: move and rename reset helpers Jakub Kicinski
2023-07-10 20:56 ` [PATCH net-next 2/3] eth: bnxt: take the bit to set as argument of bnxt_queue_sp_work() Jakub Kicinski
2023-07-10 20:56 ` [PATCH net-next 3/3] eth: bnxt: handle invalid Tx completions more gracefully Jakub Kicinski
2023-07-11 8:00 ` Michael Chan
2023-07-12 0:01 ` Michael Chan
2023-07-12 1:09 ` Jakub Kicinski
2023-07-12 4:11 ` Michael Chan
2023-07-12 4:24 ` Jakub Kicinski
2023-07-12 4:50 ` Michael Chan
2023-07-12 16:35 ` Jakub Kicinski
2023-07-11 10:10 ` Paolo Abeni
2023-07-12 1:19 ` Jakub Kicinski
2023-07-12 6:50 ` Paolo Abeni [this message]
2023-07-12 16:34 ` Jakub Kicinski
2023-07-12 20:31 ` Paolo Abeni
2023-07-12 20:50 ` Jakub Kicinski
2023-07-10 21:44 ` [PATCH net-next 0/3] " Michael Chan
2023-07-11 0:38 ` Jakub Kicinski
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=5b722084c6031009f845e6af8b438d49b9ea7dc1.camel@redhat.com \
--to=pabeni@redhat.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=michael.chan@broadcom.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).