Ido Schimmel f2b24087e1 devlink: Fix resource show output
When the user asks to show device resources, devlink first queries the
device's dpipe tables so that it will be able to show the association
between resources and dpipe tables.

In this flow, 'ctx->resources' is always NULL as resources have yet to
be retrieved. As a result, the dpipe tables are not associated with a
resource identifier and the resource show command does not show any
dpipe tables:

$ devlink resource show pci/0000:03:00.0
pci/0000:03:00.0:
  name kvd size 258048 unit entry dpipe_tables none
    resources:
      name linear size 98304 occ 1 unit entry size_min 0 size_max 159744 size_gran 128 dpipe_tables none
        resources:
          name singles size 16384 occ 1 unit entry size_min 0 size_max 159744 size_gran 1 dpipe_tables none
          name chunks size 49152 occ 0 unit entry size_min 0 size_max 159744 size_gran 32 dpipe_tables none
          name large_chunks size 32768 occ 0 unit entry size_min 0 size_max 159744 size_gran 512 dpipe_tables none
      name hash_double size 65408 unit entry size_min 32768 size_max 192512 size_gran 128 dpipe_tables none
      name hash_single size 94336 unit entry size_min 65536 size_max 225280 size_gran 128 dpipe_tables none
  name span_agents size 3 occ 0 unit entry dpipe_tables none
  name counters size 32766 occ 4 unit entry dpipe_tables none
    resources:
      name rif size 8192 occ 0 unit entry dpipe_tables none
      name flow size 24574 occ 4 unit entry dpipe_tables none
  name global_policers size 1000 unit entry dpipe_tables none
    resources:
      name single_rate_policers size 968 occ 0 unit entry dpipe_tables none
  name rif_mac_profiles size 1 occ 0 unit entry dpipe_tables none
  name rifs size 1000 occ 1 unit entry dpipe_tables none
  name port_range_registers size 16 occ 0 unit entry dpipe_tables none
  name physical_ports size 64 occ 32 unit entry dpipe_tables none

Fix by moving the check against 'ctx->resources' to the place where it
is actually used. Output after the fix:

$ devlink resource show pci/0000:03:00.0
pci/0000:03:00.0:
  name kvd size 258048 unit entry dpipe_tables none
    resources:
      name linear size 98304 occ 1 unit entry size_min 0 size_max 159744 size_gran 128
        dpipe_tables:
          table_name mlxsw_adj
        resources:
          name singles size 16384 occ 1 unit entry size_min 0 size_max 159744 size_gran 1 dpipe_tables none
          name chunks size 49152 occ 0 unit entry size_min 0 size_max 159744 size_gran 32 dpipe_tables none
          name large_chunks size 32768 occ 0 unit entry size_min 0 size_max 159744 size_gran 512 dpipe_tables none
      name hash_double size 65408 unit entry size_min 32768 size_max 192512 size_gran 128
        dpipe_tables:
          table_name mlxsw_host6
      name hash_single size 94336 unit entry size_min 65536 size_max 225280 size_gran 128
        dpipe_tables:
          table_name mlxsw_host4
  name span_agents size 3 occ 0 unit entry dpipe_tables none
  name counters size 32766 occ 4 unit entry dpipe_tables none
    resources:
      name rif size 8192 occ 0 unit entry dpipe_tables none
      name flow size 24574 occ 4 unit entry dpipe_tables none
  name global_policers size 1000 unit entry dpipe_tables none
    resources:
      name single_rate_policers size 968 occ 0 unit entry dpipe_tables none
  name rif_mac_profiles size 1 occ 0 unit entry dpipe_tables none
  name rifs size 1000 occ 1 unit entry dpipe_tables none
  name port_range_registers size 16 occ 0 unit entry dpipe_tables none
  name physical_ports size 64 occ 32 unit entry dpipe_tables none

Fixes: 0e7e1819453c ("devlink: relax dpipe table show dependency on resources")
Reviewed-by: Petr Machata <petrm@nvidia.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2026-01-20 15:27:47 -08:00
2025-11-21 09:11:48 -07:00
2025-10-21 15:06:14 -07:00
2026-01-20 15:27:47 -08:00
2025-11-21 09:11:48 -07:00
2025-03-04 20:41:10 +00:00
2024-01-25 16:49:10 -08:00
2025-11-21 09:16:04 -07:00
2025-12-01 19:27:48 -07:00
2023-01-14 09:00:34 -08:00
2025-11-08 10:24:39 -08:00
2026-01-14 10:51:30 -08:00
2023-10-30 11:35:32 -07:00
2024-09-12 10:12:21 -07:00
2025-10-21 15:06:02 -07:00
2025-09-26 10:51:15 -07:00
2008-03-08 13:31:03 -08:00
2023-05-13 19:25:04 -07:00
2025-12-01 19:27:23 -07:00
2025-11-21 09:11:48 -07:00
2025-09-26 10:51:15 -07:00
2023-09-29 16:06:42 -07:00

This is a set of utilities for Linux networking.

Information:
    https://wiki.linuxfoundation.org/networking/iproute2

Download:
    http://www.kernel.org/pub/linux/utils/net/iproute2/

Stable version repository:
    git://git.kernel.org/pub/scm/network/iproute2/iproute2.git

Development repository:
    git://git.kernel.org/pub/scm/network/iproute2/iproute2-next.git

Compatibility
-------------
A new release of iproute2 is done with each kernel version, but
there is a wide range of compatibility. Newer versions of iproute2
will still work with older kernels, but there are some limitations.

If an iproute2 command with a new feature is used with an older
kernel, the kernel may report an error or silently ignore the new
attribute. Likewise if older iproute2 is used with an newer kernel,
it is not possible to use or see new features. The range of
compatibility extends back as far as the oldest supported Long Term
Support (LTS) kernel version.

How to compile this.
--------------------
1. libdbm

arpd needs to have the berkeleydb development libraries. For Debian
users this is the package with a name like libdbX.X-dev.
DBM_INCLUDE points to the directory with db_185.h which
is the include file used by arpd to get to the old format Berkeley
database routines.  Often this is in the db-devel package.

2. make

The makefile will automatically build a config.mk file which
contains definitions of libraries that may or may not be available
on the system such as: ATM, ELF, MNL, and SELINUX.

3. include/uapi

This package includes matching sanitized kernel headers because
the build environment may not have up to date versions. See Makefile
if you have special requirements and need to point at different
kernel include files.

Stephen Hemminger
stephen@networkplumber.org

David Ahern
dsahern@kernel.org
Description
No description provided
Readme 9.5 MiB
Languages
C 97.1%
Shell 2.1%
Makefile 0.5%
Yacc 0.2%