]> git.baikalelectronics.ru Git - kernel.git/commit
devlink: check flash_update parameter support in net core
authorJacob Keller <jacob.e.keller@intel.com>
Fri, 25 Sep 2020 20:46:05 +0000 (13:46 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sat, 26 Sep 2020 00:20:57 +0000 (17:20 -0700)
commitcf04068e761cca721be798b11b676a45666a58a5
treea7c44209404f8e2692712fce2600ab041264c7a9
parent2ad5467c5d787f7a88ffa1232380a1b7a571312a
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 <jacob.e.keller@intel.com>
Reviewed-by: Jakub Kicinski <kuba@kernel.org>
Cc: Jiri Pirko <jiri@mellanox.com>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Michael Chan <michael.chan@broadcom.com>
Cc: Bin Luo <luobin9@huawei.com>
Cc: Saeed Mahameed <saeedm@mellanox.com>
Cc: Leon Romanovsky <leon@kernel.org>
Cc: Ido Schimmel <idosch@mellanox.com>
Cc: Danielle Ratson <danieller@mellanox.com>
Cc: Shannon Nelson <snelson@pensando.io>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c
drivers/net/ethernet/huawei/hinic/hinic_devlink.c
drivers/net/ethernet/intel/ice/ice_devlink.c
drivers/net/ethernet/mellanox/mlx5/core/devlink.c
drivers/net/ethernet/mellanox/mlxsw/core.c
drivers/net/ethernet/netronome/nfp/nfp_devlink.c
drivers/net/ethernet/pensando/ionic/ionic_devlink.c
drivers/net/netdevsim/dev.c
include/net/devlink.h
net/core/devlink.c