• Ido Schimmel's avatar
    netdevsim: Add devlink resource for nexthops · 35266255
    Ido Schimmel authored
    The Spectrum ASIC has a dedicated table where nexthops (i.e., adjacency
    entries) are populated. The size of this table can be controlled via
    devlink-resource.
    
    Add such a resource to netdevsim so that its occupancy will reflect the
    number of nexthop objects currently programmed to the device.
    
    By limiting the size of the resource, error paths could be exercised and
    tested.
    
    Example output:
    
    # devlink resource show netdevsim/netdevsim10
    netdevsim/netdevsim10:
      name IPv4 size unlimited unit entry size_min 0 size_max unlimited size_gran 1 dpipe_tables none
        resources:
          name fib size unlimited occ 4 unit entry size_min 0 size_max unlimited size_gran 1 dpipe_tables none
          name fib-rules size unlimited occ 3 unit entry size_min 0 size_max unlimited size_gran 1 dpipe_tables none
      name IPv6 size unlimited unit entry size_min 0 size_max unlimited size_gran 1 dpipe_tables none
        resources:
          name fib size unlimited occ 1 unit entry size_min 0 size_max unlimited size_gran 1 dpipe_tables none
          name fib-rules size unlimited occ 2 unit entry size_min 0 size_max unlimited size_gran 1 dpipe_tables none
      name nexthops size unlimited occ 0 unit entry size_min 0 size_max unlimited size_gran 1 dpipe_tables none
    Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
    Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
    35266255
fib.c 23.5 KB