Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp421895pxk; Sun, 30 Aug 2020 08:34:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwVrDaGZt8wpy62UvRuTOM6/qFwLM7hTC7CpUExoMB5340JslJc0cO0nvJ1JXF9zVomKQ6X X-Received: by 2002:a17:906:fcc8:: with SMTP id qx8mr7871594ejb.13.1598801690125; Sun, 30 Aug 2020 08:34:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598801690; cv=none; d=google.com; s=arc-20160816; b=jaWTmSimFcWyJv1bVRmq8iUAECKso7WTOy7d6H2lvLar1RkZ9k+dDS2veugMnXrVpk 7U8Qq4WD4xFVRzvrB30F+BuVFhcwdMzX4ldnxaa5hPqkZ7JFcUaH+HkDNez26TVIJJoG zESbdxzjsYuax5yI4TcjqaskYlwJZeKfCKuQxZioRkYpprdEZwzm65uO1cTTCaPJgpQQ CemQ4+8+Efyn/IMpd1pyt9ywqwqoeydLBJwSdUIqpyrDj0Z3ylQJXtr1auwT3g9Ik0a9 FwS4l3sVVMr50hMQToKeRU7WEtjQWonZ9ziyIiLEE+A7yl5Rvki+y388pHfR/JUjB5gm +Qiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=kBi1klnEekRgbL0T8rsbV0Vw8mDoutK8dbVT3Mi1dGY=; b=MmsqfFD06mGbZHW0jc6Wh6hhqWu1Wzu9fmrYCy5yhbu55JfZkEg9pOxkNdOrZuXXc8 DmoGCDFxtBk9m8yEBrGAo9dDJnoaE9sMSQyaeJcD66dPD4Q5p2PhXjwhDvVevHsJ7yQz nB7xlDq6xD037XKaY5SPka1XDaS9ZOygG2EqboYkVcutuHwdcXYjzOSCsho8DGe5m8hN MlOqr97e/cUEs1aHTN0ht19urTCKM6+r1E8zERf2K7Io3C/mVw5OaNcC8z+Vmo4YYNI0 /JkRq4dNLOYGCJn0gIxe4EHBpwEeFUDhPMHgMBxX9kTU5tIJs7LMsmNu9OlF6E1QT3AJ jitA== 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 w22si3768995ejk.590.2020.08.30.08.34.27; Sun, 30 Aug 2020 08:34:50 -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 S1726858AbgH3PdJ (ORCPT + 99 others); Sun, 30 Aug 2020 11:33:09 -0400 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:42776 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726804AbgH3P2B (ORCPT ); Sun, 30 Aug 2020 11:28:01 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from moshe@mellanox.com) with SMTP; 30 Aug 2020 18:27:57 +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 07UFRvwB029676; Sun, 30 Aug 2020 18:27:57 +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 07UFRv3Q027855; Sun, 30 Aug 2020 18:27:57 +0300 Received: (from moshe@localhost) by dev-l-vrt-135.mtl.labs.mlnx (8.15.2/8.15.2/Submit) id 07UFRvUp027854; Sun, 30 Aug 2020 18:27:57 +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 13/14] net/mlx5: Add support for devlink reload action fw activate no reset Date: Sun, 30 Aug 2020 18:27:33 +0300 Message-Id: <1598801254-27764-14-git-send-email-moshe@mellanox.com> X-Mailer: git-send-email 1.8.4.3 In-Reply-To: <1598801254-27764-1-git-send-email-moshe@mellanox.com> References: <1598801254-27764-1-git-send-email-moshe@mellanox.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add support for devlink reload action fw_activation_no_reset which does firmware live patching, updating the firmware image without reset. The driver checks if the firmware is capable of handling the pending firmware changes as a live patch. If it is then it triggers firmware live patching flow. Signed-off-by: Moshe Shemesh --- v2 -> v3: - Replace fw_live_patch action by fw_activate_no_reset v1 -> v2: - Have fw_live_patch action instead of level --- .../net/ethernet/mellanox/mlx5/core/devlink.c | 32 ++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/devlink.c b/drivers/net/ethernet/mellanox/mlx5/core/devlink.c index ea759bb2a120..bfdd3499f428 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/devlink.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/devlink.c @@ -115,6 +115,29 @@ static int mlx5_devlink_reload_fw_activate(struct devlink *devlink, struct netli return err; } +static int mlx5_devlink_trigger_fw_live_patch(struct devlink *devlink, + struct netlink_ext_ack *extack) +{ + struct mlx5_core_dev *dev = devlink_priv(devlink); + u8 reset_level; + int err; + + err = mlx5_reg_mfrl_query(dev, &reset_level, NULL); + if (err) + return err; + if (!(reset_level & MLX5_MFRL_REG_RESET_LEVEL0)) { + NL_SET_ERR_MSG_MOD(extack, + "FW upgrade to the stored FW can't be done by FW live patching"); + return -EINVAL; + } + + err = mlx5_fw_set_live_patch(dev); + if (err) + return err; + + return 0; +} + static int mlx5_devlink_reload_down(struct devlink *devlink, bool netns_change, enum devlink_reload_action action, struct netlink_ext_ack *extack) @@ -127,6 +150,8 @@ static int mlx5_devlink_reload_down(struct devlink *devlink, bool netns_change, return 0; case DEVLINK_RELOAD_ACTION_FW_ACTIVATE: return mlx5_devlink_reload_fw_activate(devlink, extack); + case DEVLINK_RELOAD_ACTION_FW_ACTIVATE_NO_RESET: + return mlx5_devlink_trigger_fw_live_patch(devlink, extack); default: /* Unsupported action should not get to this function */ WARN_ON(1); @@ -150,6 +175,10 @@ static int mlx5_devlink_reload_up(struct devlink *devlink, enum devlink_reload_a if (actions_done) *actions_done = BIT(action) | BIT(DEVLINK_RELOAD_ACTION_DRIVER_REINIT); break; + case DEVLINK_RELOAD_ACTION_FW_ACTIVATE_NO_RESET: + if (actions_done) + *actions_done = BIT(action); + break; default: /* Unsupported action should not get to this function */ WARN_ON(1); @@ -173,7 +202,8 @@ static const struct devlink_ops mlx5_devlink_ops = { .flash_update = mlx5_devlink_flash_update, .info_get = mlx5_devlink_info_get, .supported_reload_actions = BIT(DEVLINK_RELOAD_ACTION_DRIVER_REINIT) | - BIT(DEVLINK_RELOAD_ACTION_FW_ACTIVATE), + BIT(DEVLINK_RELOAD_ACTION_FW_ACTIVATE) | + BIT(DEVLINK_RELOAD_ACTION_FW_ACTIVATE_NO_RESET), .reload_down = mlx5_devlink_reload_down, .reload_up = mlx5_devlink_reload_up, }; -- 2.17.1