linux-yocto/tools
Carolina Jubran 1bbdb81a98 devlink: Fix excessive stack usage in rate TC bandwidth parsing
The devlink_nl_rate_tc_bw_parse function uses a large stack array for
devlink attributes, which triggers a warning about excessive stack
usage:

net/devlink/rate.c: In function 'devlink_nl_rate_tc_bw_parse':
net/devlink/rate.c:382:1: error: the frame size of 1648 bytes is larger than 1536 bytes [-Werror=frame-larger-than=]

Introduce a separate attribute set specifically for rate TC bandwidth
parsing that only contains the two attributes actually used: index
and bandwidth. This reduces the stack array from DEVLINK_ATTR_MAX
entries to just 2 entries, solving the stack usage issue.

Update devlink selftest to use the new 'index' and 'bw' attribute names
consistent with the YAML spec.

Example usage with ynl with the new spec:

    ./tools/net/ynl/cli.py --spec Documentation/netlink/specs/devlink.yaml \
      --do rate-set --json '{
      "bus-name": "pci",
      "dev-name": "0000:08:00.0",
      "port-index": 1,
      "rate-tc-bws": [
        {"index": 0, "bw": 50},
        {"index": 1, "bw": 50},
        {"index": 2, "bw": 0},
        {"index": 3, "bw": 0},
        {"index": 4, "bw": 0},
        {"index": 5, "bw": 0},
        {"index": 6, "bw": 0},
        {"index": 7, "bw": 0}
      ]
    }'

    ./tools/net/ynl/cli.py --spec Documentation/netlink/specs/devlink.yaml \
      --do rate-get --json '{
      "bus-name": "pci",
      "dev-name": "0000:08:00.0",
      "port-index": 1
    }'

    output for rate-get:
    {'bus-name': 'pci',
     'dev-name': '0000:08:00.0',
     'port-index': 1,
     'rate-tc-bws': [{'bw': 50, 'index': 0},
                     {'bw': 50, 'index': 1},
                     {'bw': 0, 'index': 2},
                     {'bw': 0, 'index': 3},
                     {'bw': 0, 'index': 4},
                     {'bw': 0, 'index': 5},
                     {'bw': 0, 'index': 6},
                     {'bw': 0, 'index': 7}],
     'rate-tx-max': 0,
     'rate-tx-priority': 0,
     'rate-tx-share': 0,
     'rate-tx-weight': 0,
     'rate-type': 'leaf'}

Fixes: 566e8f108f ("devlink: Extend devlink rate API with traffic classes bandwidth management")
Reported-by: Arnd Bergmann <arnd@arndb.de>
Closes: https://lore.kernel.org/netdev/20250708160652.1810573-1-arnd@kernel.org/
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202507171943.W7DJcs6Y-lkp@intel.com/
Suggested-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Carolina Jubran <cjubran@nvidia.com>
Tested-by: Carolina Jubran <cjubran@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Link: https://patch.msgid.link/1753175609-330621-1-git-send-email-tariqt@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2025-07-23 17:07:35 -07:00
..
accounting
arch x86/rdrand: Disable RDSEED on AMD Cyan Skillfish 2025-07-08 21:33:26 +02:00
bootconfig tools/bootconfig: specify LDFLAGS as an argument to CC 2025-05-16 11:22:54 +09:00
bpf tools/resolve_btfids: Fix build when cross compiling kernel with clang. 2025-06-10 09:09:27 -07:00
build
certs
cgroup
counter
crypto
debugging
firewire
firmware
gpio
hv tools: hv: Enable debug logs for hv_kvp_daemon 2025-05-23 16:30:55 +00:00
iio iio: normalize array sentinel style 2025-04-22 19:10:04 +01:00
include Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2025-07-17 11:00:33 -07:00
kvm/kvm_stat
laptop
leds
lib libbpf: Fix possible use-after-free for externs 2025-06-25 12:28:58 -07:00
memory-model tools/memory-model/Documentation: Fix SRCU section in explanation.txt 2025-04-23 12:17:04 -07:00
mm
net tools: ynl: support packing binary arrays of scalars 2025-07-17 16:13:58 -07:00
objtool objtool: Add missing endian conversion to read_annotate() 2025-07-01 15:02:04 +02:00
pcmcia
perf perf bench futex: Fix prctl include in musl libc 2025-06-17 18:29:42 -03:00
power cpupower: split unitdir from libdir in Makefile 2025-06-09 10:17:46 -06:00
rcu
sched_ext sched_ext: change the variable name for slice refill event 2025-04-18 17:25:39 -10:00
scripts tools headers: Update the syscall table with the kernel sources 2025-04-10 09:28:24 -07:00
sound
spi
testing devlink: Fix excessive stack usage in rate TC bandwidth parsing 2025-07-23 17:07:35 -07:00
thermal
time
tracing tracing tools updates for v6.16: 2025-05-29 20:59:52 -07:00
usb
verification
virtio
wmi
workqueue
writeback
Makefile tools/Makefile: Add ynl target 2025-04-28 17:18:48 -07:00