From patchwork Mon May 18 08:27:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasundhara Volam X-Patchwork-Id: 219074 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.9 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 21D0CC433DF for ; Mon, 18 May 2020 08:29:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EF19820674 for ; Mon, 18 May 2020 08:29:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="RHN0gPka" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726624AbgERI3v (ORCPT ); Mon, 18 May 2020 04:29:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726466AbgERI3u (ORCPT ); Mon, 18 May 2020 04:29:50 -0400 Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56DB8C061A0C for ; Mon, 18 May 2020 01:29:50 -0700 (PDT) Received: by mail-wr1-x444.google.com with SMTP id e1so10738568wrt.5 for ; Mon, 18 May 2020 01:29:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=U5liFecwyBrLmBSIzEkq/w2j7Xj0bza48kc+Bx/i2kw=; b=RHN0gPkabPGCjfcSF/35B+Y+X7rN7NY0uKz9iFzvXnBaThSaOdt0dF6U08T57PfsXY UT0DxngusWbkNJXfqagJUvfXNxSZuVM61S5I1b0gjR/UZS4GG8MRcMAFNHF892HKq1H+ hn0Zps2CpjuX0H6+3dQwvoTQdTGbJPi1frXg4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=U5liFecwyBrLmBSIzEkq/w2j7Xj0bza48kc+Bx/i2kw=; b=Mv8vdMkyomXvR9JG5pN0otxy1+llo8YJrM/u2JoM8ijXk5Ln0OcaMXEPAD8jveTCLB ocluX27DGX+OW6hCXqinegdTUqB36y2+CzMEY73Knp8vbNJreqrNIDlWBv4Mf35/b/ow 04mcc+pxgPARLaFzR/8wMEHv53gBSIZ5h5qOwXuPbmMhYemWMmgwFWuPgHHgzYJL+CRc c1BXzMsIlyVVjaDg4ROH6Eo+b9yHch3EMrX/upEaPtmDZlEVIk/p6r/JM498MNdTwtyF 2VhFNfk71raorcYlTRyEZ8gzHKcm5/LbRDWey8ddvKqFp3mN5J5qmFPWtL7ldsJu6oBt WxrA== X-Gm-Message-State: AOAM533u/JGzUvmyvwDSs3kWNmCRv4FK1kcLL8l7BnJhpbs6TGs9bry0 sLKeXQ91Lp/LaPCXacsqivfemyJfkvc= X-Google-Smtp-Source: ABdhPJzbLpKMBlz/IMX1xT/h8zF6acG4+m40mL8OSOsRKmfqWf1XadCk7T2WBOyfMNymes+Q4TFAiQ== X-Received: by 2002:adf:dc86:: with SMTP id r6mr17830857wrj.45.1589790588954; Mon, 18 May 2020 01:29:48 -0700 (PDT) Received: from lxpurley1.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id m7sm15350144wmc.40.2020.05.18.01.29.46 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 May 2020 01:29:48 -0700 (PDT) From: Vasundhara Volam To: davem@davemloft.net Cc: netdev@vger.kernel.org, Vasundhara Volam , Jiri Pirko , Michael Chan Subject: [PATCH net-next 1/4] devlink: Add new "enable_hot_fw_reset" generic device parameter. Date: Mon, 18 May 2020 13:57:16 +0530 Message-Id: <1589790439-10487-2-git-send-email-vasundhara-v.volam@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1589790439-10487-1-git-send-email-vasundhara-v.volam@broadcom.com> References: <1589790439-10487-1-git-send-email-vasundhara-v.volam@broadcom.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Add a new "enable_hot_fw_reset" generic device parameter to enable or disable hot firmware reset capability on the device. Cc: Jiri Pirko Cc: Michael Chan Signed-off-by: Vasundhara Volam Reviewed-by: Edwin Peer --- Documentation/networking/devlink/devlink-params.rst | 6 ++++++ include/net/devlink.h | 4 ++++ net/core/devlink.c | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/Documentation/networking/devlink/devlink-params.rst b/Documentation/networking/devlink/devlink-params.rst index d075fd0..ba75437 100644 --- a/Documentation/networking/devlink/devlink-params.rst +++ b/Documentation/networking/devlink/devlink-params.rst @@ -108,3 +108,9 @@ own name. * - ``region_snapshot_enable`` - Boolean - Enable capture of ``devlink-region`` snapshots. + * - ``enable_hot_fw_reset`` + - Boolean + - Enable hot firmware reset on the device. When enabled, device supports + hot firmware reset capability which will be able to reset the running + firmware or upgrade/downgrade of flashed firmware without a driver + reload. diff --git a/include/net/devlink.h b/include/net/devlink.h index 8ffc1b5c..57377bf 100644 --- a/include/net/devlink.h +++ b/include/net/devlink.h @@ -406,6 +406,7 @@ enum devlink_param_generic_id { DEVLINK_PARAM_GENERIC_ID_FW_LOAD_POLICY, DEVLINK_PARAM_GENERIC_ID_RESET_DEV_ON_DRV_PROBE, DEVLINK_PARAM_GENERIC_ID_ENABLE_ROCE, + DEVLINK_PARAM_GENERIC_ID_ENABLE_HOT_FW_RESET, /* add new param generic ids above here*/ __DEVLINK_PARAM_GENERIC_ID_MAX, @@ -443,6 +444,9 @@ enum devlink_param_generic_id { #define DEVLINK_PARAM_GENERIC_ENABLE_ROCE_NAME "enable_roce" #define DEVLINK_PARAM_GENERIC_ENABLE_ROCE_TYPE DEVLINK_PARAM_TYPE_BOOL +#define DEVLINK_PARAM_GENERIC_ENABLE_HOT_FW_RESET_NAME "enable_hot_fw_reset" +#define DEVLINK_PARAM_GENERIC_ENABLE_HOT_FW_RESET_TYPE DEVLINK_PARAM_TYPE_BOOL + #define DEVLINK_PARAM_GENERIC(_id, _cmodes, _get, _set, _validate) \ { \ .id = DEVLINK_PARAM_GENERIC_ID_##_id, \ diff --git a/net/core/devlink.c b/net/core/devlink.c index 7b76e5f..32fb8e6 100644 --- a/net/core/devlink.c +++ b/net/core/devlink.c @@ -3011,6 +3011,11 @@ static int devlink_nl_cmd_flash_update(struct sk_buff *skb, .name = DEVLINK_PARAM_GENERIC_ENABLE_ROCE_NAME, .type = DEVLINK_PARAM_GENERIC_ENABLE_ROCE_TYPE, }, + { + .id = DEVLINK_PARAM_GENERIC_ID_ENABLE_HOT_FW_RESET, + .name = DEVLINK_PARAM_GENERIC_ENABLE_HOT_FW_RESET_NAME, + .type = DEVLINK_PARAM_GENERIC_ENABLE_HOT_FW_RESET_TYPE, + }, }; static int devlink_param_generic_verify(const struct devlink_param *param) From patchwork Mon May 18 08:27:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasundhara Volam X-Patchwork-Id: 219073 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.9 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 071C5C433DF for ; Mon, 18 May 2020 08:30:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C829720674 for ; Mon, 18 May 2020 08:30:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="KgjgQRxG" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726932AbgERIaE (ORCPT ); Mon, 18 May 2020 04:30:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726800AbgERIaD (ORCPT ); Mon, 18 May 2020 04:30:03 -0400 Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 13DFEC061A0C for ; Mon, 18 May 2020 01:30:03 -0700 (PDT) Received: by mail-wr1-x444.google.com with SMTP id h17so10705357wrc.8 for ; Mon, 18 May 2020 01:30:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=JSeHNQh3YXbQnjfpYLZf1waobdc3QloYou2esB8sNvE=; b=KgjgQRxGkNhrC8znOTZMFwX7oxxpvm2p1xYeV7zFpEz/ucgL9z2CLfeoAlw/gGuqYd 2jRvQp+CWZ+3VJK4AFkszI5HeETUro7Kf8U2a29zzOHsF8lYWVEyvhGx5xPOPRBybJWA pgyVkwpV9si9xzq01idER/VtjRf0SIheQobwQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=JSeHNQh3YXbQnjfpYLZf1waobdc3QloYou2esB8sNvE=; b=OJUQI1BaV48L/Q7Ruw1Wtjh27IuaIhzm3eWp+N73yZXdXSXvV9+uU9YisqKK2sAWjS 6jXhND2/kbWbNfbjIFTAuSgLUgOnwyekrJVKkqKKWhrhW29vrI9Pyeu/BW/32Fe404sm 6DwljbMlOY3DVGwZftQT7vhYKNJKTdk+1kCBZNKF+flltm9b04VhnX7UPcCFcFtJXsPt yGw8pysFcEGkYt9dZJPZ+krfkf90E4/AF7JcEcdgGbTlEoJqG0inQ+uqNoh7jCHTBtyG nxlcYMFl4WHR10xuRq9H4ecrcgpFa2oQW6rvDn5Ylh0OaVCWKtVeHlA2q4jMjL47wizA Ippw== X-Gm-Message-State: AOAM531fw18ctRGa2q3Wd6AiIgOTPLppv6GGbKp0cbPlfz2cdHAwBSn1 i0mgdfUxV5gjoW+Ax73RwR2LVg== X-Google-Smtp-Source: ABdhPJwW9lgyCamRO6n9jKYmXZvKvUEz1glxkGEtlQylO9nBRhPo78sjlVH+C+v6U1MDMj9EOAq/SA== X-Received: by 2002:a5d:6087:: with SMTP id w7mr20147962wrt.158.1589790601590; Mon, 18 May 2020 01:30:01 -0700 (PDT) Received: from lxpurley1.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id m7sm15350144wmc.40.2020.05.18.01.29.59 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 May 2020 01:30:00 -0700 (PDT) From: Vasundhara Volam To: davem@davemloft.net Cc: netdev@vger.kernel.org, Vasundhara Volam , Michael Chan Subject: [PATCH net-next 3/4] bnxt_en: Use enable_hot_fw_reset generic devlink parameter Date: Mon, 18 May 2020 13:57:18 +0530 Message-Id: <1589790439-10487-4-git-send-email-vasundhara-v.volam@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1589790439-10487-1-git-send-email-vasundhara-v.volam@broadcom.com> References: <1589790439-10487-1-git-send-email-vasundhara-v.volam@broadcom.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org enable_hot_fw_reset parameter supports both permanent and runtime configuration modes. This parameter enables or disables the hot firmware reset capability of the device which either resets the currently running firmware or upgrades/downgrades flashed firmware. For the runtime parameter to be true, all the loaded host driver interfaces must support hot firmware reset. If any driver's interface capability is set to false by the user, the device cannot support hot firmware reset. To re-enable the capability, all the driver interfaces have to set the value to true. Cc: Michael Chan Signed-off-by: Vasundhara Volam Reviewed-by: Edwin Peer --- Documentation/networking/devlink/bnxt.rst | 6 +++ drivers/net/ethernet/broadcom/bnxt/bnxt.c | 28 ++++++++++- drivers/net/ethernet/broadcom/bnxt/bnxt.h | 2 + drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c | 61 +++++++++++++++++++++++ drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.h | 1 + 5 files changed, 97 insertions(+), 1 deletion(-) diff --git a/Documentation/networking/devlink/bnxt.rst b/Documentation/networking/devlink/bnxt.rst index 3dfd84c..69393d3 100644 --- a/Documentation/networking/devlink/bnxt.rst +++ b/Documentation/networking/devlink/bnxt.rst @@ -14,6 +14,7 @@ Parameters * - Name - Mode + - Description * - ``enable_sriov`` - Permanent * - ``ignore_ari`` @@ -22,6 +23,11 @@ Parameters - Permanent * - ``msix_vec_per_pf_min`` - Permanent + * - ``enable_hot_fw_reset`` + - Permanent, runtime + - For the runtime parameter to be true, all the loaded host driver + interfaces must support hot firmware reset. To re-enable the + capability, all the driver interfaces have to set the value to true. The ``bnxt`` driver also implements the following driver-specific parameters. diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index f86b621..535fe8f 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -6955,7 +6955,7 @@ static int __bnxt_hwrm_func_qcaps(struct bnxt *bp) struct hwrm_func_qcaps_input req = {0}; struct hwrm_func_qcaps_output *resp = bp->hwrm_cmd_resp_addr; struct bnxt_hw_resc *hw_resc = &bp->hw_resc; - u32 flags; + u32 flags, flags_ext; bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_FUNC_QCAPS, -1, -1); req.fid = cpu_to_le16(0xffff); @@ -6985,6 +6985,10 @@ static int __bnxt_hwrm_func_qcaps(struct bnxt *bp) if (flags & FUNC_QCAPS_RESP_FLAGS_PUSH_MODE_SUPPORTED) bp->tx_push_thresh = BNXT_TX_PUSH_THRESH; + flags_ext = le32_to_cpu(resp->flags_ext); + if (flags_ext & FUNC_QCAPS_RESP_FLAGS_EXT_HOT_RESET_IF_SUPPORT) + bp->fw_cap |= BNXT_FW_CAP_HOT_RESET_IF_SUPPORT; + hw_resc->max_rsscos_ctxs = le16_to_cpu(resp->max_rsscos_ctx); hw_resc->max_cp_rings = le16_to_cpu(resp->max_cmpl_rings); hw_resc->max_tx_rings = le16_to_cpu(resp->max_tx_rings); @@ -8773,6 +8777,28 @@ static int bnxt_hwrm_shutdown_link(struct bnxt *bp) static int bnxt_fw_init_one(struct bnxt *bp); +int bnxt_hwrm_get_hot_reset(struct bnxt *bp, bool *hot_reset_allowed) +{ + struct hwrm_func_qcfg_output *resp = bp->hwrm_cmd_resp_addr; + struct hwrm_func_qcfg_input req = {0}; + int rc; + + if (!(bp->fw_cap & BNXT_FW_CAP_HOT_RESET_IF_SUPPORT)) { + *hot_reset_allowed = !!(bp->fw_cap & BNXT_FW_CAP_HOT_RESET); + return 0; + } + + bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_FUNC_QCFG, -1, -1); + req.fid = cpu_to_le16(0xffff); + mutex_lock(&bp->hwrm_cmd_lock); + rc = _hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT); + if (!rc) + *hot_reset_allowed = !!(le16_to_cpu(resp->flags) & + FUNC_QCFG_RESP_FLAGS_HOT_RESET_ALLOWED); + mutex_unlock(&bp->hwrm_cmd_lock); + return rc; +} + static int bnxt_hwrm_if_change(struct bnxt *bp, bool up) { struct hwrm_func_drv_if_change_output *resp = bp->hwrm_cmd_resp_addr; diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethernet/broadcom/bnxt/bnxt.h index c04ac4a..fd6592e 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h @@ -1710,6 +1710,7 @@ struct bnxt { #define BNXT_FW_CAP_ERR_RECOVER_RELOAD 0x00100000 #define BNXT_FW_CAP_HOT_RESET 0x00200000 #define BNXT_FW_CAP_SHARED_PORT_CFG 0x00400000 + #define BNXT_FW_CAP_HOT_RESET_IF_SUPPORT 0x08000000 #define BNXT_NEW_RM(bp) ((bp)->fw_cap & BNXT_FW_CAP_NEW_RM) u32 hwrm_spec_code; @@ -2062,5 +2063,6 @@ int bnxt_get_port_parent_id(struct net_device *dev, struct netdev_phys_item_id *ppid); void bnxt_dim_work(struct work_struct *work); int bnxt_hwrm_set_ring_coal(struct bnxt *bp, struct bnxt_napi *bnapi); +int bnxt_hwrm_get_hot_reset(struct bnxt *bp, bool *hot_reset_allowed); #endif diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c index a812beb..61bf630 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c @@ -314,6 +314,8 @@ enum bnxt_dl_param_id { NVM_OFF_MSIX_VEC_PER_PF_MIN, BNXT_NVM_SHARED_CFG, 7, 4}, {BNXT_DEVLINK_PARAM_ID_GRE_VER_CHECK, NVM_OFF_DIS_GRE_VER_CHECK, BNXT_NVM_SHARED_CFG, 1, 1}, + {DEVLINK_PARAM_GENERIC_ID_ENABLE_HOT_FW_RESET, + NVM_OFF_LIVE_FW_UPGRADE, BNXT_NVM_SHARED_CFG, 1, 1}, }; union bnxt_nvm_data { @@ -618,6 +620,61 @@ static int bnxt_dl_msix_validate(struct devlink *dl, u32 id, return 0; } +static int bnxt_dl_param_get(struct devlink *dl, u32 id, + struct devlink_param_gset_ctx *ctx) +{ + struct bnxt *bp = bnxt_get_bp_from_dl(dl); + + if (ctx->cmode == DEVLINK_PARAM_CMODE_PERMANENT) + return bnxt_dl_nvm_param_get(dl, id, ctx); + else if (ctx->cmode == DEVLINK_PARAM_CMODE_RUNTIME) + return bnxt_hwrm_get_hot_reset(bp, &ctx->val.vbool); + + return -EOPNOTSUPP; +} + +static int bnxt_hwrm_set_hot_reset(struct bnxt *bp, bool hot_reset_if_support) +{ + struct hwrm_func_cfg_input req = {0}; + bool hot_reset_allowed; + int rc; + + if (!(bp->fw_cap & BNXT_FW_CAP_HOT_RESET_IF_SUPPORT)) + return -EOPNOTSUPP; + + bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_FUNC_CFG, -1, -1); + req.fid = cpu_to_le16(0xffff); + req.enables = cpu_to_le32(FUNC_CFG_REQ_ENABLES_HOT_RESET_IF_SUPPORT); + if (hot_reset_if_support) + req.flags = cpu_to_le32(FUNC_CFG_REQ_FLAGS_HOT_RESET_IF_EN_DIS); + + rc = hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT); + if (rc) + return rc; + + rc = bnxt_hwrm_get_hot_reset(bp, &hot_reset_allowed); + if (rc) + return rc; + + if (hot_reset_if_support && !hot_reset_allowed) + netdev_info(bp->dev, "Hot FW Reset enabled, but is disallowed as it is disabled on other interface(s) of this device.\n"); + + return 0; +} + +static int bnxt_dl_param_set(struct devlink *dl, u32 id, + struct devlink_param_gset_ctx *ctx) +{ + struct bnxt *bp = bnxt_get_bp_from_dl(dl); + + if (ctx->cmode == DEVLINK_PARAM_CMODE_PERMANENT) + return bnxt_dl_nvm_param_set(dl, id, ctx); + else if (ctx->cmode == DEVLINK_PARAM_CMODE_RUNTIME) + return bnxt_hwrm_set_hot_reset(bp, ctx->val.vbool); + + return -EOPNOTSUPP; +} + static const struct devlink_param bnxt_dl_params[] = { DEVLINK_PARAM_GENERIC(ENABLE_SRIOV, BIT(DEVLINK_PARAM_CMODE_PERMANENT), @@ -640,6 +697,10 @@ static int bnxt_dl_msix_validate(struct devlink *dl, u32 id, BIT(DEVLINK_PARAM_CMODE_PERMANENT), bnxt_dl_nvm_param_get, bnxt_dl_nvm_param_set, NULL), + DEVLINK_PARAM_GENERIC(ENABLE_HOT_FW_RESET, + BIT(DEVLINK_PARAM_CMODE_PERMANENT) | + BIT(DEVLINK_PARAM_CMODE_RUNTIME), + bnxt_dl_param_get, bnxt_dl_param_set, NULL), }; static const struct devlink_param bnxt_dl_port_params[] = { diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.h b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.h index d5c8bd4..0a5efff 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.h +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.h @@ -39,6 +39,7 @@ static inline void bnxt_link_bp_to_dl(struct bnxt *bp, struct devlink *dl) #define NVM_OFF_DIS_GRE_VER_CHECK 171 #define NVM_OFF_ENABLE_SRIOV 401 #define NVM_OFF_NVM_CFG_VER 602 +#define NVM_OFF_LIVE_FW_UPGRADE 917 #define BNXT_NVM_CFG_VER_BITS 24 #define BNXT_NVM_CFG_VER_BYTES 4