diff options
| author | Jacob Keller <[email protected]> | 2020-09-25 13:46:05 -0700 |
|---|---|---|
| committer | David S. Miller <[email protected]> | 2020-09-25 17:20:57 -0700 |
| commit | 22ec3d232f8511b21355fcdb6fb2a4eced3decd8 (patch) | |
| tree | a7c44209404f8e2692712fce2600ab041264c7a9 /drivers/net/netdevsim | |
| parent | 6fba737a9320758f076aa7c2eaddd3764d643e5c (diff) | |
devlink: check flash_update parameter support in net core
When implementing .flash_update, drivers which do not support
per-component update are manually checking the component parameter to
verify that it is NULL. Without this check, the driver might accept an
update request with a component specified even though it will not honor
such a request.
Instead of having each driver check this, move the logic into
net/core/devlink.c, and use a new `supported_flash_update_params` field
in the devlink_ops. Drivers which will support per-component update must
now specify this by setting DEVLINK_SUPPORT_FLASH_UPDATE_COMPONENT in
the supported_flash_update_params in their devlink_ops.
This helps ensure that drivers do not forget to check for a NULL
component if they do not support per-component update. This also enables
a slightly better error message by enabling the core stack to set the
netlink bad attribute message to indicate precisely the unsupported
attribute in the message.
Going forward, any new additional parameter to flash update will require
a bit in the supported_flash_update_params bitfield.
Signed-off-by: Jacob Keller <[email protected]>
Reviewed-by: Jakub Kicinski <[email protected]>
Cc: Jiri Pirko <[email protected]>
Cc: Jonathan Corbet <[email protected]>
Cc: Michael Chan <[email protected]>
Cc: Bin Luo <[email protected]>
Cc: Saeed Mahameed <[email protected]>
Cc: Leon Romanovsky <[email protected]>
Cc: Ido Schimmel <[email protected]>
Cc: Danielle Ratson <[email protected]>
Cc: Shannon Nelson <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Diffstat (limited to 'drivers/net/netdevsim')
| -rw-r--r-- | drivers/net/netdevsim/dev.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/net/netdevsim/dev.c b/drivers/net/netdevsim/dev.c index e665efd760f8..424bdab8e888 100644 --- a/drivers/net/netdevsim/dev.c +++ b/drivers/net/netdevsim/dev.c @@ -879,6 +879,7 @@ nsim_dev_devlink_trap_policer_counter_get(struct devlink *devlink, } static const struct devlink_ops nsim_dev_devlink_ops = { + .supported_flash_update_params = DEVLINK_SUPPORT_FLASH_UPDATE_COMPONENT, .reload_down = nsim_dev_reload_down, .reload_up = nsim_dev_reload_up, .info_get = nsim_dev_info_get, |