mbox series

[net-next,v2,00/16] Add devlink reload action and limit options

Message ID 1602050457-21700-1-git-send-email-moshe@mellanox.com
Headers show
Series Add devlink reload action and limit options | expand

Message

Moshe Shemesh Oct. 7, 2020, 6 a.m. UTC
Introduce new options on devlink reload API to enable the user to select
the reload action required and constrains limits on these actions that he
may want to ensure. Complete support for reload actions in mlx5.
The following reload actions are supported:
  driver_reinit: driver entities re-initialization, applying devlink-param
                 and devlink-resource values.
  fw_activate: firmware activate.

The uAPI is backward compatible, if the reload action option is omitted
from the reload command, the driver reinit action will be used.
Note that when required to do firmware activation some drivers may need
to reload the driver. On the other hand some drivers may need to reset
the firmware to reinitialize the driver entities. Therefore, the devlink
reload command returns the actions which were actually performed.

By default reload actions are not limited and driver implementation may
include reset or downtime as needed to perform the actions.
However, if reload limit is selected, the driver should perform only if
it can do it while keeping the limit constraints.
Reload limit added:
  no_reset: No reset allowed, no down time allowed, no link flap and no
            configuration is lost.

Each driver which supports devlink reload command should expose the
reload actions and limits supported.

Add reload stats to hold the history per reload action per limit.
For example, the number of times fw_activate has been done on this
device since the driver module was added or if the firmware activation
was done with or without reset.

Patch 1 changes devlink_reload_supported() param type to enable using
        it before allocating devlink.
Patch 2-3 add the new API reload action and reload limit options to
          devlink reload.
Patch 4-5 add reload stats and remote reload stats. These stats are
          exposed through devlink dev get.
Patches 6-11 add support on mlx5 for devlink reload action fw_activate
            and handle the firmware reset events.
Patches 12-13 add devlink enable remote dev reset parameter and use it
             in mlx5.
Patches 14-15 mlx5 add devlink reload limit no_reset support for
              fw_activate reload action.
Patch 16 adds documentation file devlink-reload.rst 


Moshe Shemesh (16):
  devlink: Change devlink_reload_supported() param type
  devlink: Add reload action option to devlink reload command
  devlink: Add devlink reload limit option
  devlink: Add reload stats
  devlink: Add remote reload stats
  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 action fw activate
  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 limit no reset
  devlink: Add Documentation/networking/devlink/devlink-reload.rst

 .../networking/devlink/devlink-params.rst     |   6 +
 .../networking/devlink/devlink-reload.rst     |  81 +++
 Documentation/networking/devlink/index.rst    |   1 +
 drivers/net/ethernet/mellanox/mlx4/main.c     |   7 +-
 .../net/ethernet/mellanox/mlx5/core/Makefile  |   2 +-
 .../net/ethernet/mellanox/mlx5/core/devlink.c | 108 +++-
 .../mellanox/mlx5/core/diag/fw_tracer.c       |  52 ++
 .../mellanox/mlx5/core/diag/fw_tracer.h       |   1 +
 .../ethernet/mellanox/mlx5/core/fw_reset.c    | 463 ++++++++++++++++++
 .../ethernet/mellanox/mlx5/core/fw_reset.h    |  21 +
 .../net/ethernet/mellanox/mlx5/core/health.c  |  35 +-
 .../net/ethernet/mellanox/mlx5/core/main.c    |  16 +
 .../ethernet/mellanox/mlx5/core/mlx5_core.h   |   2 +
 drivers/net/ethernet/mellanox/mlxsw/core.c    |  10 +-
 drivers/net/netdevsim/dev.c                   |   6 +-
 include/linux/mlx5/device.h                   |   1 +
 include/linux/mlx5/driver.h                   |   2 +
 include/net/devlink.h                         |  23 +-
 include/uapi/linux/devlink.h                  |  34 ++
 net/core/devlink.c                            | 337 ++++++++++++-
 20 files changed, 1169 insertions(+), 39 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

Comments

Jiri Pirko Oct. 7, 2020, 3:46 p.m. UTC | #1
Wed, Oct 07, 2020 at 08:00:45AM CEST, moshe@mellanox.com wrote:
>Add reload stats to hold the history per reload action type and limit.
>
>For example, the number of times fw_activate has been performed on this
>device since the driver module was added or if the firmware activation
>was performed with or without reset.
>
>Add devlink notification on stats update.
>
>Expose devlink reload stats to the user through devlink dev get command.
>
>Examples:
>$ devlink dev show
>pci/0000:82:00.0:
>  stats:
>      reload:
>        driver_reinit 2 fw_activate 1 fw_activate_no_reset 0
>pci/0000:82:00.1:
>  stats:
>      reload:
>        driver_reinit 1 fw_activate 0 fw_activate_no_reset 0
>
>$ devlink dev show -jp
>{
>    "dev": {
>        "pci/0000:82:00.0": {
>            "stats": {
>                "reload": {
>                    "driver_reinit": 2,
>                    "fw_activate": 1,
>                    "fw_activate_no_reset": 0
>                }
>            }
>        },
>        "pci/0000:82:00.1": {
>            "stats": {
>                "reload": {
>                    "driver_reinit": 1,
>                    "fw_activate": 0,
>                    "fw_activate_no_reset": 0
>                }
>            }
>        }
>    }
>}
>
>Signed-off-by: Moshe Shemesh <moshe@mellanox.com>

Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Jiri Pirko Oct. 7, 2020, 4:01 p.m. UTC | #2
Wed, Oct 07, 2020 at 08:00:46AM CEST, moshe@mellanox.com wrote:
>Add remote reload stats to hold the history of actions performed due
>devlink reload commands initiated by remote host. For example, in case
>firmware activation with reset finished successfully but was initiated
>by remote host.
>
>The function devlink_remote_reload_actions_performed() is exported to
>enable drivers update on remote reload actions performed as it was not
>initiated by their own devlink instance.
>
>Expose devlink remote reload stats to the user through devlink dev get
>command.
>
>Examples:
>$ devlink dev show
>pci/0000:82:00.0:
>  stats:
>      reload:
>        driver_reinit 2 fw_activate 1 fw_activate_no_reset 0
>      remote_reload:
>        driver_reinit 0 fw_activate 0 fw_activate_no_reset 0
>pci/0000:82:00.1:
>  stats:
>      reload:
>        driver_reinit 1 fw_activate 0 fw_activate_no_reset 0
>      remote_reload:
>        driver_reinit 1 fw_activate 1 fw_activate_no_reset 0
>
>$ devlink dev show -jp
>{
>    "dev": {
>        "pci/0000:82:00.0": {
>            "stats": {
>                "reload": {
>                    "driver_reinit": 2,
>                    "fw_activate": 1,
>                    "fw_activate_no_reset": 0
>                },
>                "remote_reload": {
>                    "driver_reinit": 0,
>                    "fw_activate": 0,
>                    "fw_activate_no_reset": 0
>                }
>            }
>        },
>        "pci/0000:82:00.1": {
>            "stats": {
>                "reload": {
>                    "driver_reinit": 1,
>                    "fw_activate": 0,
>                    "fw_activate_no_reset": 0
>                },
>                "remote_reload": {
>                    "driver_reinit": 1,
>                    "fw_activate": 1,
>                    "fw_activate_no_reset": 0
>                }
>            }
>        }
>    }
>}
>
>Signed-off-by: Moshe Shemesh <moshe@mellanox.com>
>Reviewed-by: Jakub Kicinski <kuba@kernel.org>

Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Jakub Kicinski Oct. 9, 2020, 7:10 p.m. UTC | #3
On Wed,  7 Oct 2020 09:00:41 +0300 Moshe Shemesh wrote:
> Introduce new options on devlink reload API to enable the user to select
> the reload action required and constrains limits on these actions that he
> may want to ensure. Complete support for reload actions in mlx5.
> The following reload actions are supported:
>   driver_reinit: driver entities re-initialization, applying devlink-param
>                  and devlink-resource values.
>   fw_activate: firmware activate.

Applied, thanks everyone!