[PATCH net-next v3 0/2] net: macb: implement ethtool set channels count operation
From: Théo Lebrun
Date: Fri Mar 13 2026 - 11:24:46 EST
Add support for changing the active number of queues. Tested on Mobileye
EyeQ5. The first patch is as expected. However the second one might be
more surprising:
GEM has per-queue Tx SRAM segmentation. If we do not touch SRAM
distribution then we'll only be able to exploit a portion of it when a
smaller queue count is configured. It also is beneficial if bootloader
stages write to the register and we don't reset it but attempt to use
all queues (the default).
The operation is only hidden behind MACB_CAPS_QUEUE_DISABLE, we do not
introduce yet another feature flag.
Have a nice day,
Thanks,
Théo
Signed-off-by: Théo Lebrun <theo.lebrun@xxxxxxxxxxx>
---
Changes in v3:
- Makefile: fix compilation of kunit tests. This bug was hidden before
because everything was builtin so it ended up linked together anyway.
Now macb.o is the amalgation of macb_{main,ptp,utils}.o and
macb_test.o is the amalgation of macb_{kunit,utils}.o.
- Kconfig CONFIG_MACB_KUNIT_TEST entry:
- Turn into tristate; no good reason to restrict to bool.
- Drop "depends on MACB". We do not need to compile the full MACB
driver to test gem_sram_distribute_segments().
- Add usual MODULE_*() macros to macb_kunit.c.
- Drop unused init value of `ret` in macb_set_channels().
- Rebase to latest net-next; nothing to report.
- Link to v2: https://patch.msgid.link/20260311-macb-set-channels-v2-0-982693a1f5fc@xxxxxxxxxxx
Changes in v2:
- Move gem_sram_distribute_segments() from macb_main.c to macb_utils.c
and kunit tests from macb_main.c to macb_kunit.c.
- macb_set_channels():
- Add comment about MACB_CAPS_QUEUE_DISABLE.
- Refuse operation if netif_running(), with code comment.
- Drop useless sanity checks on ch->{combined,rx,tx}_count.
- Add help text to CONFIG_MACB_KUNIT_TEST.
- Fix `checkpatch --max-line-length=80` warnings.
- Rebase onto latest net-next; nothing to report.
- Link to v1: https://lore.kernel.org/r/20260305-macb-set-channels-v1-0-28e3a96a3dc3@xxxxxxxxxxx
---
Théo Lebrun (2):
net: macb: implement ethtool_ops.get|set_channels()
net: macb: distribute evenly Tx SRAM segments
drivers/net/ethernet/cadence/Kconfig | 12 +++
drivers/net/ethernet/cadence/Makefile | 5 +-
drivers/net/ethernet/cadence/macb.h | 9 +++
drivers/net/ethernet/cadence/macb_kunit.c | 77 +++++++++++++++++++
drivers/net/ethernet/cadence/macb_main.c | 118 ++++++++++++++++++++++++++----
drivers/net/ethernet/cadence/macb_utils.c | 56 ++++++++++++++
6 files changed, 260 insertions(+), 17 deletions(-)
---
base-commit: 5d27b84e6c4f6305765505188d1de27ebfd78e38
change-id: 20260305-macb-set-channels-5bf6e07f3270
Best regards,
--
Théo Lebrun <theo.lebrun@xxxxxxxxxxx>