Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp173939pxu; Tue, 6 Oct 2020 23:15:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzh1YfqCgqkqOHfVt9U5M+AKUifJoiBOVZJRF54us6hbdvozDd5yOhK/qM2NiyjZRGmUJU2 X-Received: by 2002:aa7:c9c3:: with SMTP id i3mr1904829edt.236.1602051345780; Tue, 06 Oct 2020 23:15:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602051345; cv=none; d=google.com; s=arc-20160816; b=wXXOCsyxfzFEF+dFqsl6CothTQr+nK/Ua16QOVApavEbhMJS3veD2Hpd16GAL2tG6H QMbC7uRHNVITgoP1xXWnh2qF6YBOcxciejbsz2SWmXjnrW1GTO6lMz7VAlmlFcZUdxwk 28Ioc/1Xkz7cKfDzxf6QBL7xxft3L2c8UeJnXRM3iEt98eUzcADD91WHP5Nwa/E7rH/N cJFU/b6L2CKuC6YqnjZNYqJnRWTyaZPnnWPgVyskbgEYz2L0Kj4gOhHwxarN/0iXO+2y 5E9yyYrG2b0O7Z12g89GHQlGn+9mwZsENVr8V3egC0lvQfxCmH9Z1B0jVcMr+aU/yrM3 hYgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=eusLv0GQZX04cpudZTAs+tZYCkisKDTH4fo905CEgaY=; b=YgmNBEF3kIswff/xO2UTAGbDC5OguWJt3vfFOImB86tM/Iblpep/heV3o5IAEdAkDW QwD1XI3m93HIf644zb+JkBMFIhFA2Z4gusV4jQykKujBDdA92TtYqMU1+EWsvan3KZDD o02GMV6GfVvl6kGIfP0Wf37ILWzzIryrPx03iIt7M22pAP7kJgilCUwCU4cTKOTpHcYs hYKliDfqe/W7JOxp7dUAR5PaRSKyjPB6WBsDFz0xYOsbtWM8/XaILLn6oympgzoPz6x9 VWO+ONrIsxdv1+wsjKc88NMErRfj4vkSEgTWepf8Q2Y7phySslXfWKS9TulHPJk/6afB 3nfg== 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 pg3si982886ejb.138.2020.10.06.23.15.20; Tue, 06 Oct 2020 23:15:45 -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 S1727376AbgJGGON (ORCPT + 99 others); Wed, 7 Oct 2020 02:14:13 -0400 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:37581 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725970AbgJGGOM (ORCPT ); Wed, 7 Oct 2020 02:14:12 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from moshe@mellanox.com) with SMTP; 7 Oct 2020 09:14:08 +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 09761IOc018888; Wed, 7 Oct 2020 09:01:18 +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 09761I3D021794; Wed, 7 Oct 2020 09:01:18 +0300 Received: (from moshe@localhost) by dev-l-vrt-136.mtl.labs.mlnx (8.14.7/8.14.7/Submit) id 09761I13021793; Wed, 7 Oct 2020 09:01:18 +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 v2 15/16] net/mlx5: Add support for devlink reload limit no reset Date: Wed, 7 Oct 2020 09:00:56 +0300 Message-Id: <1602050457-21700-16-git-send-email-moshe@mellanox.com> X-Mailer: git-send-email 1.8.4.3 In-Reply-To: <1602050457-21700-1-git-send-email-moshe@mellanox.com> References: <1602050457-21700-1-git-send-email-moshe@mellanox.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add support for devlink reload action fw_activate with reload limit no_reset which does firmware live patching, updating the firmware image without reset, no downtime and no configuration lose. 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 Reviewed-by: Saeed Mahameed --- v1 ->v2: - Shorten return flow in mlx5_devlink_trigger_fw_live_patch() RFCv5 -> v1: - Renamed reload_action_limit_level to reload_limit RFCv3 -> RFCv4: - Have action fw_activate with limit level no_reset instead of action fw_activate_no_reset RFCv2 -> RFCv3: - Replace fw_live_patch action by fw_activate_no_reset RFCv1 -> RFCv2: - Have fw_live_patch action instead of level --- .../net/ethernet/mellanox/mlx5/core/devlink.c | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/devlink.c b/drivers/net/ethernet/mellanox/mlx5/core/devlink.c index cbfb84d1cac2..a28f95df2901 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/devlink.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/devlink.c @@ -111,6 +111,25 @@ 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_fw_reset_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; + } + + return mlx5_fw_reset_set_live_patch(dev); +} + static int mlx5_devlink_reload_down(struct devlink *devlink, bool netns_change, enum devlink_reload_action action, enum devlink_reload_limit limit, @@ -123,6 +142,8 @@ static int mlx5_devlink_reload_down(struct devlink *devlink, bool netns_change, mlx5_unload_one(dev, false); return 0; case DEVLINK_RELOAD_ACTION_FW_ACTIVATE: + if (limit == DEVLINK_RELOAD_LIMIT_NO_RESET) + return mlx5_devlink_trigger_fw_live_patch(devlink, extack); return mlx5_devlink_reload_fw_activate(devlink, extack); default: /* Unsupported action should not get to this function */ @@ -140,7 +161,10 @@ static int mlx5_devlink_reload_up(struct devlink *devlink, enum devlink_reload_a *actions_performed = BIT(action); switch (action) { case DEVLINK_RELOAD_ACTION_DRIVER_REINIT: + return mlx5_load_one(dev, false); case DEVLINK_RELOAD_ACTION_FW_ACTIVATE: + if (limit == DEVLINK_RELOAD_LIMIT_NO_RESET) + break; /* On fw_activate action, also driver is reloaded and reinit performed */ *actions_performed |= BIT(DEVLINK_RELOAD_ACTION_DRIVER_REINIT); return mlx5_load_one(dev, false); @@ -168,6 +192,7 @@ static const struct devlink_ops mlx5_devlink_ops = { .info_get = mlx5_devlink_info_get, .reload_actions = BIT(DEVLINK_RELOAD_ACTION_DRIVER_REINIT) | BIT(DEVLINK_RELOAD_ACTION_FW_ACTIVATE), + .reload_limits = BIT(DEVLINK_RELOAD_LIMIT_NO_RESET), .reload_down = mlx5_devlink_reload_down, .reload_up = mlx5_devlink_reload_up, }; -- 2.18.2