Introduce new option on devlink reload API to enable the user to select the reload level required. Complete support for all levels in mlx5. The following reload levels are supported: driver: Driver entities re-instantiation only. fw_reset: Firmware reset and driver entities re-instantiation. fw_live_patch: Firmware live patching only.
Each driver which support this command should expose the reload levels supported and the driver's default reload level. The uAPI is backward compatible, if the reload level option is omitted from the reload command, the driver's default reload level will be used. Patch 1 adds the new API reload level option to devlink. Patch 2 exposes the supported reload levels and default level on devlink dev get. Patches 3-8 add support on mlx5 for devlink reload level fw-reset and handle the firmware reset events. Patches 9-10 add devlink enable remote dev reset parameter and use it in mlx5. Patches 11-12 mlx5 add devlink reload live patch support and event handling. Patch 13 adds documentation file devlink-reload.rst Command examples: # Run reload command with fw-reset reload level: $ devlink dev reload pci/0000:82:00.0 level fw-reset # Run reload command with driver reload level: $ devlink dev reload pci/0000:82:00.0 level driver # Run reload command with driver's default level (backward compatible): $ devlink dev reload pci/0000:82:00.0 Moshe Shemesh (13): devlink: Add reload level option to devlink reload command devlink: Add reload levels data to dev get net/mlx5: Add functions to set/query MFRL register net/mlx5: Set cap for pci sync for fw update event net/mlx5: Handle sync reset request event net/mlx5: Handle sync reset now event net/mlx5: Handle sync reset abort event net/mlx5: Add support for devlink reload level fw reset devlink: Add enable_remote_dev_reset generic parameter net/mlx5: Add devlink param enable_remote_dev_reset support net/mlx5: Add support for fw live patch event net/mlx5: Add support for devlink reload level live patch devlink: Add Documentation/networking/devlink/devlink-reload.rst .../networking/devlink/devlink-params.rst | 6 + .../networking/devlink/devlink-reload.rst | 56 +++ Documentation/networking/devlink/index.rst | 1 + drivers/net/ethernet/mellanox/mlx4/main.c | 6 +- .../net/ethernet/mellanox/mlx5/core/Makefile | 2 +- .../net/ethernet/mellanox/mlx5/core/devlink.c | 114 +++++- .../mellanox/mlx5/core/diag/fw_tracer.c | 31 ++ .../mellanox/mlx5/core/diag/fw_tracer.h | 1 + .../ethernet/mellanox/mlx5/core/fw_reset.c | 328 ++++++++++++++++++ .../ethernet/mellanox/mlx5/core/fw_reset.h | 17 + .../net/ethernet/mellanox/mlx5/core/health.c | 74 +++- .../net/ethernet/mellanox/mlx5/core/main.c | 13 + drivers/net/ethernet/mellanox/mlxsw/core.c | 6 +- drivers/net/netdevsim/dev.c | 6 +- include/linux/mlx5/device.h | 1 + include/linux/mlx5/driver.h | 12 + include/net/devlink.h | 10 +- include/uapi/linux/devlink.h | 22 ++ net/core/devlink.c | 95 ++++- 19 files changed, 764 insertions(+), 37 deletions(-) create mode 100644 Documentation/networking/devlink/devlink-reload.rst create mode 100644 drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c create mode 100644 drivers/net/ethernet/mellanox/mlx5/core/fw_reset.h -- 2.17.1