Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp420285pxk; Sun, 30 Aug 2020 08:31:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxdB8TOV9iB5uuKcYQivyiZVtT5/GQNBjBa4O0chGIOslkKGdd/+qUnizs0w2Zd8Ye/U2Ob X-Received: by 2002:a05:6402:1151:: with SMTP id g17mr7844448edw.227.1598801474684; Sun, 30 Aug 2020 08:31:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598801474; cv=none; d=google.com; s=arc-20160816; b=WXlwXFloR8OB33VOI3yVwavCz7e0QzTdbfC+oM0tNNzupIjLxlkdgE2Qt6VYMhf8N7 K7iU4yHdsimooKSfHKfk2SNeJ1MXiPDzeEda//kwJR2eJA8pJT+FJL34+iqyoF1B7Qpa /9HO6X7KfjOMCaYNDSG7Sg7nqjay68yenSXHL1XLW0Mkpr2PETS4i8rfEBQc3xT3zYsU BCtUdnMq9MjKtGvUlRYGxXHjAmaANjvNmn44AUDXmgeWGT2DcVYiP6uIfp3JPe0iT41A fsUH6/7dBqWKIKkDx9q+BR0DgZQKuEqWvqSOGUS6cmKSRwYLBM2H4oXHzCWKX9NE0vxw rsRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=VPFv5U2I6wdufxCTlck2ew+Eh9/quIDaRYw+mXGiZlI=; b=H/2/IsrdcYa8ga2GNJbzgsUXHnGKDrDXLcovMC+9mcj22pxuF0fkqc9mKAVsbwtrmJ iR49k8x0O9zDQ4j/7GYkCAEfCbZzpuQ2De3RygsaST8jHFDKKiyY+cLSEPTrAjxiINT1 7XcSzJsCjZe2ut/1Jc6zsTz6m1d8wygD/r2oiXdyorVFgfnT7KmffMf44gt/8aqoXiVb qNTiVtEVSHNKrwjY8qU/enQm5V/Gb3e7vTFgSU4LI8eudiN+uTqnE6WSEHSQJAnjUO2f lj60WIaTsow+2nfqYtl72gpBtFCTdV9mVkf9TSAGiCf1nYj1fCc5COy9mZjTN6I8+YXD B1iA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mellanox.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f5si3100419eja.658.2020.08.30.08.30.52; Sun, 30 Aug 2020 08:31:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mellanox.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726143AbgH3P17 (ORCPT + 99 others); Sun, 30 Aug 2020 11:27:59 -0400 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:42674 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725993AbgH3P15 (ORCPT ); Sun, 30 Aug 2020 11:27:57 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from moshe@mellanox.com) with SMTP; 30 Aug 2020 18:27:54 +0300 Received: from dev-l-vrt-135.mtl.labs.mlnx (dev-l-vrt-135.mtl.labs.mlnx [10.234.135.1]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 07UFRsRX029615; Sun, 30 Aug 2020 18:27:54 +0300 Received: from dev-l-vrt-135.mtl.labs.mlnx (localhost [127.0.0.1]) by dev-l-vrt-135.mtl.labs.mlnx (8.15.2/8.15.2/Debian-10) with ESMTP id 07UFRsBe027826; Sun, 30 Aug 2020 18:27:54 +0300 Received: (from moshe@localhost) by dev-l-vrt-135.mtl.labs.mlnx (8.15.2/8.15.2/Submit) id 07UFRpAE027823; Sun, 30 Aug 2020 18:27:51 +0300 From: Moshe Shemesh To: "David S. Miller" , Jakub Kicinski Cc: Jiri Pirko , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Moshe Shemesh Subject: [PATCH net-next RFC v3 00/14] Add devlink reload action option Date: Sun, 30 Aug 2020 18:27:20 +0300 Message-Id: <1598801254-27764-1-git-send-email-moshe@mellanox.com> X-Mailer: git-send-email 1.8.4.3 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Introduce new option on devlink reload API to enable the user to select the reload action required. Complete support for all 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. fw_activate_no_reset: Activate new firmware image without any reset. (also known as: firmware live patching). Each driver which support this command should expose the reload actions supported. 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 done. Add reload actions counters to hold the history per reload action type. 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 adds the new API reload action option to devlink. Patch 2 adds reload actions counters. Patch 3 exposes the reload actions counters on devlink dev get. Patches 4-9 add support on mlx5 for devlink reload action fw_activate and handle the firmware reset events. Patches 10-11 add devlink enable remote dev reset parameter and use it in mlx5. Patches 12-13 mlx5 add devlink reload action fw_activate_no_reset support and event handling. Patch 14 adds documentation file devlink-reload.rst command examples: $devlink dev reload pci/0000:82:00.0 action driver_reinit reload_actions_done: driver_reinit $devlink dev reload pci/0000:82:00.0 action fw_activate reload_actions_done: driver_reinit fw_activate $ devlink dev reload pci/0000:82:00.0 action fw_activate no_reset reload_actions_done: fw_activate_no_reset v2 -> v3: - Replace fw_live_patch action by fw_activate_no_reset - Devlink reload returns the actions done over netlink reply - Add reload actions counters v1 -> v2: - Instead of reload levels driver,fw_reset,fw_live_patch have reload actions driver_reinit,fw_activate,fw_live_patch - Remove driver default level, the action driver_reinit is the default action for all drivers Moshe Shemesh (14): devlink: Add reload action option to devlink reload command devlink: Add reload actions counters devlink: Add reload actions counters 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 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 action fw activate no reset devlink: Add Documentation/networking/devlink/devlink-reload.rst .../networking/devlink/devlink-params.rst | 6 + .../networking/devlink/devlink-reload.rst | 68 +++ Documentation/networking/devlink/index.rst | 1 + drivers/net/ethernet/mellanox/mlx4/main.c | 14 +- .../net/ethernet/mellanox/mlx5/core/Makefile | 2 +- .../net/ethernet/mellanox/mlx5/core/devlink.c | 117 ++++- .../mellanox/mlx5/core/diag/fw_tracer.c | 31 ++ .../mellanox/mlx5/core/diag/fw_tracer.h | 1 + .../ethernet/mellanox/mlx5/core/fw_reset.c | 453 ++++++++++++++++++ .../ethernet/mellanox/mlx5/core/fw_reset.h | 19 + .../net/ethernet/mellanox/mlx5/core/health.c | 35 +- .../net/ethernet/mellanox/mlx5/core/main.c | 13 + .../ethernet/mellanox/mlx5/core/mlx5_core.h | 2 + drivers/net/ethernet/mellanox/mlxsw/core.c | 24 +- drivers/net/netdevsim/dev.c | 16 +- include/linux/mlx5/device.h | 1 + include/linux/mlx5/driver.h | 4 + include/net/devlink.h | 13 +- include/uapi/linux/devlink.h | 24 + net/core/devlink.c | 174 ++++++- 20 files changed, 967 insertions(+), 51 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