Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp473270pxk; Thu, 1 Oct 2020 07:03:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzjTi242yXzBjaxPl3PDZXNiZYS6COVHRT0+J7IihAAqYfTbB+XWBi0oA22uBvlx+bRUIlc X-Received: by 2002:a17:906:fcd4:: with SMTP id qx20mr3303590ejb.255.1601561009226; Thu, 01 Oct 2020 07:03:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601561009; cv=none; d=google.com; s=arc-20160816; b=MeTcs3v1NJLwyt/RABqa05p1iL9FdG9wZXerHRgyVbfR2RLkMNqCN6KAiLIr1TOyMZ hscfgIdCMCRScHke6TTiH1ze2xSAR9ndKdPuqTGZa/KU7oPk6G3sX+6ahYBnRpQcXftA oSmPoDM7MGG8MPXZA1Wj4PUdCRLvkbjX2y7FRm+GYdd3IcQchBMbcNq2n4dPkcHIdgwk yqZ8m5L32l4PI1HAaVhui7QsSH4fhfX9+Tyk/UfLRDk2I4lLLYvnffncaCt3XR/ASnoP 2l1zMG3qmHHj371qCRLr/KjdYr58b8jcBR1D0LU6pD2SRKsPjuoXzDxsLN1YLWZk3LUD Ppig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=DWHJcJLZA3ix1MEsW2CN2Is9M2vRuL0c+dEEgXs0dZ8=; b=OJa96ArDpoS8vnFQbmxSRx1DQu1PhXUtfUg/orqyqf4c1OOtCHN5LhTiVK7BFGq7H8 whhz5b/SNo42E/LgADtfCVHZdkO/rbb9Xn+SXCdoqos7U0JAHRn0j0LGCDEy+ckSVN2g +sK7BPSJLjNS3DRL7gUrxl7iLvIxqPTUCiAJikEQri2eZsQ1kV2Fn9ky9zPK8DsNLNo2 nSIUeKhkVeNAm62Ox9NncyXKpb4z9NfhJkM0ez4GN1g3fXD8VQNTir8bZq6EzZCKrXjN ia2ye91NxCql34RNtVZJLAldCdn2jJbs1veLSUTp+EpYn+2NMkUoNCFgbLuSakGg+TCW vNzQ== 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 rk14si1079086ejb.56.2020.10.01.07.03.04; Thu, 01 Oct 2020 07:03:29 -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 S1732483AbgJAOAb (ORCPT + 99 others); Thu, 1 Oct 2020 10:00:31 -0400 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:36623 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1732431AbgJAOA3 (ORCPT ); Thu, 1 Oct 2020 10:00:29 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from moshe@mellanox.com) with SMTP; 1 Oct 2020 17:00:23 +0300 Received: from dev-l-vrt-136.mtl.labs.mlnx (dev-l-vrt-136.mtl.labs.mlnx [10.234.136.1]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 091E0Nsh001671; Thu, 1 Oct 2020 17:00:23 +0300 Received: from dev-l-vrt-136.mtl.labs.mlnx (localhost [127.0.0.1]) by dev-l-vrt-136.mtl.labs.mlnx (8.14.7/8.14.7) with ESMTP id 091E0NMa011159; Thu, 1 Oct 2020 17:00:23 +0300 Received: (from moshe@localhost) by dev-l-vrt-136.mtl.labs.mlnx (8.14.7/8.14.7/Submit) id 091E0Lit011158; Thu, 1 Oct 2020 17:00:21 +0300 From: Moshe Shemesh To: "David S. Miller" , Jakub Kicinski , Jiri Pirko Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Moshe Shemesh Subject: [PATCH net-next 00/16] Add devlink reload action and limit options Date: Thu, 1 Oct 2020 16:59:03 +0300 Message-Id: <1601560759-11030-1-git-send-email-moshe@mellanox.com> X-Mailer: git-send-email 1.8.4.3 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 constrains. 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. Change log: Preceding to this version were 5 RFC versions. The changes applied according to comments mainly from Jakub and Jiri on RFC API patches are listed in each patch. 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 | 9 +- .../net/ethernet/mellanox/mlx5/core/Makefile | 2 +- .../net/ethernet/mellanox/mlx5/core/devlink.c | 114 ++++- .../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 | 13 +- drivers/net/netdevsim/dev.c | 8 +- include/linux/mlx5/device.h | 1 + include/linux/mlx5/driver.h | 2 + include/net/devlink.h | 21 +- include/uapi/linux/devlink.h | 42 ++ net/core/devlink.c | 318 +++++++++++- 20 files changed, 1164 insertions(+), 44 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.18.2