diff options
author | Ido Schimmel <idosch@nvidia.com> | 2020-11-04 14:30:37 +0100 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2020-11-06 20:28:50 +0100 |
commit | 35266255d61c777abd69c2faaa44c92b5a0483c2 (patch) | |
tree | c1eb170266544bf8e1ad472bf3f971fa1f0473ff /drivers/net/netdevsim/dev.c | |
parent | nexthop: Remove in-kernel route notifications when nexthop changes (diff) | |
download | linux-35266255d61c777abd69c2faaa44c92b5a0483c2.tar.xz linux-35266255d61c777abd69c2faaa44c92b5a0483c2.zip |
netdevsim: Add devlink resource for nexthops
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: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'drivers/net/netdevsim/dev.c')
-rw-r--r-- | drivers/net/netdevsim/dev.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/net/netdevsim/dev.c b/drivers/net/netdevsim/dev.c index d07061417675..49cc1fea9e02 100644 --- a/drivers/net/netdevsim/dev.c +++ b/drivers/net/netdevsim/dev.c @@ -324,6 +324,12 @@ static int nsim_dev_resources_register(struct devlink *devlink) return err; } + /* Resources for nexthops */ + err = devlink_resource_register(devlink, "nexthops", (u64)-1, + NSIM_RESOURCE_NEXTHOPS, + DEVLINK_RESOURCE_ID_PARENT_TOP, + ¶ms); + out: return err; } |