• David Ahern's avatar
    netdevsim: Add extack error message for devlink reload · 7fa76d77
    David Ahern authored
    devlink reset command can fail if a FIB resource limit is set to a value
    lower than the current occupancy. Return a proper message indicating the
    reason for the failure.
    
    $ devlink resource sh netdevsim/netdevsim0
    netdevsim/netdevsim0:
      name IPv4 size unlimited unit entry size_min 0 size_max unlimited size_gran 1 dpipe_tables none
        resources:
          name fib size unlimited occ 43 unit entry size_min 0 size_max unlimited size_gran 1 dpipe_tables none
          name fib-rules size unlimited occ 4 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 54 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
    
    $ devlink resource set netdevsim/netdevsim0 path /IPv4/fib size 40
    
    $ devlink dev  reload netdevsim/netdevsim0
    Error: netdevsim: New size is less than current occupancy.
    devlink answers: Invalid argument
    Signed-off-by: default avatarDavid Ahern <dsahern@gmail.com>
    Acked-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    7fa76d77
netdevsim.h 3.52 KB