From: Nicolai Buchwitz <nb@tipi-net.de>
To: "Théo Lebrun" <theo.lebrun@bootlin.com>
Cc: Jakub Kicinski <kuba@kernel.org>,
nicolas.ferre@microchip.com, claudiu.beznea@tuxon.dev,
andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
pabeni@redhat.com, netdev@vger.kernel.org
Subject: Re: [PATCH net-next] net: macb: allow MTU changes while the interface is running
Date: Wed, 18 Mar 2026 12:25:58 +0100 [thread overview]
Message-ID: <46380e79a62bfca31a551cfd872e34ab@tipi-net.de> (raw)
In-Reply-To: <DH5TETVK34CG.V7P9P9Z1AAKL@bootlin.com>
On 18.3.2026 10:53, Théo Lebrun wrote:
> [...]
>>
>> Hm, not really. Take a look at fbnic_set_ringparam()
>> You need some struct that's config + pointers to all the resources.
>> And make all allocation helpers operate on that without touching the
>> HW.
>> Then you can just allocate a new struct, give it whatever config you
>> need, call all the alloc helpers with it. Now you have a fully
>> populated struct and haven't touched the HW yet at all. Stop HW,
>> swap the resources, start HW.
>>
>> I did something similar for the nfp driver but that code has been
>> slightly adulterated since I left Netronome so fbnic is clearer :)
>
> Do you feel we should (1) clone the full `struct macb` as done by fbnic
> or, (2) just partially, with the few interesting fields. Something like
> `struct stmmac_dma_conf`.
>
> stmmac is not the greatest example. They have this struct that carries
> their buffers but they still "close -> update -> open" on operations
> versus the optimal "alloc -> reconfigure_hw -> free".
>
> With #2 we could use an unnamed structure field.
> https://gcc.gnu.org/onlinedocs/gcc/Unnamed-Fields.html
> See commit c4781dc3d1cf ("Kbuild: enable -fms-extensions").
>
> struct macb_buffers {
> struct macb_queue queues[N];
> ...
> };
>
> struct macb {
> struct macb_buffers;
> ...
> };
>
> Goal is to keep `bp->queues` & co as before, to minimise the diff.
The unnamed struct idea is nice for keeping the diff small, but I'm not
sure it works cleanly for the per-queue case. The macb_queue_ring fields
would be embedded anonymously in macb_queue, but the alloc helpers need
to write into a separate clone. The swap then becomes memcpy/cast tricks
between the anonymous portion of each queue and the clone's qring[q].
Embedding the full queues[] array in the swappable struct would be
simpler for the swap, but then NAPI, IRQs, spinlocks etc. travel
along, which we don't want.
For struct macb itself (rx_buffer_size, ring sizes, tieoff) the unnamed
struct works fine and saves a lot of churn. It's really the per-queue
ring fields where it gets awkward.
>
> Thanks,
>
> --
> Théo Lebrun, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com
Cheers
Nicolai
next prev parent reply other threads:[~2026-03-18 11:26 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-16 9:27 [PATCH net-next] net: macb: allow MTU changes while the interface is running Nicolai Buchwitz
2026-03-17 17:00 ` Théo Lebrun
2026-03-17 19:31 ` Nicolai Buchwitz
2026-03-17 22:23 ` Jakub Kicinski
2026-03-17 22:58 ` Nicolai Buchwitz
2026-03-17 23:23 ` Jakub Kicinski
2026-03-18 9:53 ` Théo Lebrun
2026-03-18 11:25 ` Nicolai Buchwitz [this message]
2026-03-18 14:33 ` Théo Lebrun
2026-03-18 22:13 ` Jakub Kicinski
2026-03-17 19:42 ` Breno Leitao
2026-03-17 19:47 ` Breno Leitao
2026-03-17 20:11 ` Nicolai Buchwitz
2026-03-17 20:04 ` Nicolai Buchwitz
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=46380e79a62bfca31a551cfd872e34ab@tipi-net.de \
--to=nb@tipi-net.de \
--cc=andrew+netdev@lunn.ch \
--cc=claudiu.beznea@tuxon.dev \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=nicolas.ferre@microchip.com \
--cc=pabeni@redhat.com \
--cc=theo.lebrun@bootlin.com \
/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