From patchwork Sun Oct 11 10:22:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 288614 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=-12.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MIME_HEADER_CTYPE_ONLY, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, T_TVD_MIME_NO_HEADERS, 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 BFC84C433E7 for ; Sun, 11 Oct 2020 10:23:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 84986208C7 for ; Sun, 11 Oct 2020 10:23:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="H36Sp+3m" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729532AbgJKKXY (ORCPT ); Sun, 11 Oct 2020 06:23:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727035AbgJKKXV (ORCPT ); Sun, 11 Oct 2020 06:23:21 -0400 Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50174C0613CE for ; Sun, 11 Oct 2020 03:23:21 -0700 (PDT) Received: by mail-pg1-x542.google.com with SMTP id b193so10342204pga.6 for ; Sun, 11 Oct 2020 03:23:21 -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=Ii91hCS5hplljo/KuXwb4U+ptiWrjws631O9Fdy9F4s=; b=H36Sp+3mVVyog2SJabrPqTTeyfaGQ7jNirwLyhY5zBcYT8sIshKkKes+OlAXynp3J4 foy/WIggrgMs6Vm8z3BHWcg4UhWA+iy/+aeQFSzC06nplvfH/nb1A/x/l6JSnDkvDDGR Z+6pcTUeo3V6PrVzn2e2LFEPmHjTaSjdKgPn0= 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=Ii91hCS5hplljo/KuXwb4U+ptiWrjws631O9Fdy9F4s=; b=W7XSAX33M740xNIlaaKLeADGTFV7LaYSPv4D9Wq/AjVmnFlP1vXFwbIRGOh+wYGpw9 KqNEL2vayirM3QZLTZ2BW0zgaHklq3hJjLIMS0QSD6qUd5PFkQdOVbu8F4R8y2LVe1pS H9/TVB5P2xGsvW25D12tCK86ohdgpqE8KL2aMI/r7eHOtAROufddGaHJ0TbTH/m6LsjL /k1/OvMqEhWImTzESGYDXkRkwx8PrFovXYk7/n5wBUZAiFJmc497g5BXXvqFvf0E/x1h qY5o0pKi3RnO/twN1Og565eWX2YNsWnSliwFvqoQgindojyLM+AHE4Ssgw4Edz1rMLAO En1g== X-Gm-Message-State: AOAM5331/Ho70KQ2oBD1fRt82Viw+Pu/W4rTI1rjUI3SoqF+/lRY66Eo EUVGdjEay6CeaeG6/0e1tVrJ8A== X-Google-Smtp-Source: ABdhPJy5Ojgal9YndRoMq9VHmmlyWArk/vkiVvQp0uacuZSd0JXL/4d/P7IFo+feQP5VuymnfBELdw== X-Received: by 2002:a62:5bc2:0:b029:13e:d13d:a090 with SMTP id p185-20020a625bc20000b029013ed13da090mr19041749pfb.39.1602411800731; Sun, 11 Oct 2020 03:23:20 -0700 (PDT) Received: from localhost.swdvt.lab.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id i1sm20155057pjh.52.2020.10.11.03.23.19 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 11 Oct 2020 03:23:19 -0700 (PDT) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, kuba@kernel.org, gospo@broadcom.com, Vasundhara Volam Subject: [PATCH net-next 1/9] bnxt_en: Return -EROFS to user space, if NVM writes are not permitted. Date: Sun, 11 Oct 2020 06:22:53 -0400 Message-Id: <1602411781-6012-2-git-send-email-michael.chan@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1602411781-6012-1-git-send-email-michael.chan@broadcom.com> References: <1602411781-6012-1-git-send-email-michael.chan@broadcom.com> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Vasundhara Volam If NVRAM resources are locked, NVM writes are not permitted. In such scenarios, firmware returns HWRM_ERR_CODE_RESOURCE_LOCKED error to firmware commands. Reviewed-by: Edwin Peer Signed-off-by: Vasundhara Volam Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 5e4b7fbeef06..d4402a2cd07f 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -4325,6 +4325,8 @@ static int bnxt_hwrm_to_stderr(u32 hwrm_err) switch (hwrm_err) { case HWRM_ERR_CODE_SUCCESS: return 0; + case HWRM_ERR_CODE_RESOURCE_LOCKED: + return -EROFS; case HWRM_ERR_CODE_RESOURCE_ACCESS_DENIED: return -EACCES; case HWRM_ERR_CODE_RESOURCE_ALLOC_ERROR: From patchwork Sun Oct 11 10:22:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 288613 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=-12.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MIME_HEADER_CTYPE_ONLY, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, T_TVD_MIME_NO_HEADERS, URIBL_BLOCKED, 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 13916C433DF for ; Sun, 11 Oct 2020 10:23:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C0B08207F7 for ; Sun, 11 Oct 2020 10:23:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="eC+RW0Wp" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729639AbgJKKX3 (ORCPT ); Sun, 11 Oct 2020 06:23:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729173AbgJKKXX (ORCPT ); Sun, 11 Oct 2020 06:23:23 -0400 Received: from mail-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A93DCC0613D0 for ; Sun, 11 Oct 2020 03:23:22 -0700 (PDT) Received: by mail-pg1-x544.google.com with SMTP id x16so11249945pgj.3 for ; Sun, 11 Oct 2020 03:23:22 -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=czSQteC+aSKObBiN/Iuimr/HumGMamHufzyKfeyiMrs=; b=eC+RW0WpSCPSd/HowETmut7zWw6Ejs2DfPs0QtkVUC1zBmy0SjEBY5mOPiWfbDUxXE TJQ0R41VpSkHLwh4Mytd8Bw8VZxDy4Hl0FRovkgY64IL0CiVikZm5tcgchOv1cp6Ifd9 Zo2IiqhU+GevDKPMaZhx2qQIh3wCh3/fnWeIQ= 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=czSQteC+aSKObBiN/Iuimr/HumGMamHufzyKfeyiMrs=; b=fHXiLxwikMS8kqemc/5PK9mBlBnpLmDrWOipUg6mgEUFzigXIMHhC4cHVmpYN8fEeL v+Yo+S/iunx+7+1Blm1EHysJZiIu4bLAdzNaDaRXuce74XGkvF0CnkJ0qznA9evYdJxT UbvXAQB66fwDpkZ/KAaI2fxy8OxFs9vGZhYCpTlGtHhC9Ugi729k/bBf7PX3A0nJc0ru NuuTuJhmQoIpBGj/Nf3aELkZlIfzHq73UegRQkq/jNNShVkhJws+Rsqd7D/76ztlYViK h/0ArV1bFh/FHPNEwN6RhTRFECZ3FI/ZRnHmPfzRxGUb7xPclXTykXKYIKXDi2IIIGID jOzw== X-Gm-Message-State: AOAM532Nfkvw8ToxrmAvDeD2sCWRPFv0l1h5JTBxi/SlisFvIgPFMbfL 79iBWMCl7KmPE93KlfKPWuaRk1Q7nX4Y0Q== X-Google-Smtp-Source: ABdhPJxtFe7ls8zvQKEwVdMNAQTKABitto1shq0FZvWPzYGc2cE+Hv7LuPItGKXXBUxUuUGI6bAkmg== X-Received: by 2002:a62:520e:0:b029:142:2501:3979 with SMTP id g14-20020a62520e0000b029014225013979mr19636417pfb.62.1602411802007; Sun, 11 Oct 2020 03:23:22 -0700 (PDT) Received: from localhost.swdvt.lab.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id i1sm20155057pjh.52.2020.10.11.03.23.20 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 11 Oct 2020 03:23:21 -0700 (PDT) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, kuba@kernel.org, gospo@broadcom.com, Vasundhara Volam Subject: [PATCH net-next 2/9] bnxt_en: Enable online self tests for multi-host/NPAR mode. Date: Sun, 11 Oct 2020 06:22:54 -0400 Message-Id: <1602411781-6012-3-git-send-email-michael.chan@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1602411781-6012-1-git-send-email-michael.chan@broadcom.com> References: <1602411781-6012-1-git-send-email-michael.chan@broadcom.com> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Vasundhara Volam Online self tests are not disruptive and can be run in NPAR mode and in multi-host NIC as well. Reviewed-by: Edwin Peer Signed-off-by: Vasundhara Volam Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c index 52b4ea6ef8c9..dcbb7b70d60a 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c @@ -3298,7 +3298,7 @@ static void bnxt_self_test(struct net_device *dev, struct ethtool_test *etest, u8 test_mask = 0; int rc = 0, i; - if (!bp->num_tests || !BNXT_SINGLE_PF(bp)) + if (!bp->num_tests || !BNXT_PF(bp)) return; memset(buf, 0, sizeof(u64) * bp->num_tests); if (!netif_running(dev)) { @@ -3311,9 +3311,9 @@ static void bnxt_self_test(struct net_device *dev, struct ethtool_test *etest, do_ext_lpbk = true; if (etest->flags & ETH_TEST_FL_OFFLINE) { - if (bp->pf.active_vfs) { + if (bp->pf.active_vfs || !BNXT_SINGLE_PF(bp)) { etest->flags |= ETH_TEST_FL_FAILED; - netdev_warn(dev, "Offline tests cannot be run with active VFs\n"); + netdev_warn(dev, "Offline tests cannot be run with active VFs or on shared PF\n"); return; } offline = true; @@ -3829,7 +3829,7 @@ void bnxt_ethtool_init(struct bnxt *bp) bnxt_get_pkgver(dev); bp->num_tests = 0; - if (bp->hwrm_spec_code < 0x10704 || !BNXT_SINGLE_PF(bp)) + if (bp->hwrm_spec_code < 0x10704 || !BNXT_PF(bp)) return; bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_SELFTEST_QLIST, -1, -1); From patchwork Sun Oct 11 10:22:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 270140 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=-12.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MIME_HEADER_CTYPE_ONLY, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, T_TVD_MIME_NO_HEADERS, URIBL_BLOCKED, 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 2F274C433DF for ; Sun, 11 Oct 2020 10:23:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E31F3207F7 for ; Sun, 11 Oct 2020 10:23:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="XtivgyGA" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729599AbgJKKX0 (ORCPT ); Sun, 11 Oct 2020 06:23:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729379AbgJKKXX (ORCPT ); Sun, 11 Oct 2020 06:23:23 -0400 Received: from mail-pg1-x541.google.com (mail-pg1-x541.google.com [IPv6:2607:f8b0:4864:20::541]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8BC2BC0613CE for ; Sun, 11 Oct 2020 03:23:23 -0700 (PDT) Received: by mail-pg1-x541.google.com with SMTP id y14so11208797pgf.12 for ; Sun, 11 Oct 2020 03:23:23 -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=XKCo2C5uFX/aBMpqXZi2XLFPbj1ykwoPeJiS3sWb/LE=; b=XtivgyGA/xH9CPMgn0Ue1SdOPx1g1/wxJtOyGo886rKN6CYOCDRCf3U+p4yHOSWr/T xIsZtkR4xavX6UJkaTEAcmX8Pf+be7S1kWAzpIP3suqPSpp1hcXc26GXzDzOe9nsIHQE ZIlwjF3nnNZurGdTFuNHFsv3l9aNwPqy6NEpc= 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=XKCo2C5uFX/aBMpqXZi2XLFPbj1ykwoPeJiS3sWb/LE=; b=toHOwFShu69uPVCEQbYaHVlk8f/776Uouq1+R8ybGkFGBARGT8CEfVt14AbFyUe1zn 5oiu2H6zUuEVBYV4xl0i/gJZxXXCBunFh7LaFmCmcJRIfAce3dZXFTaDi8vKAxPZGeMA fZckvy1l0pdyNtz8wNXLF9j6PksJMjTtXIX5FqozWbBro66ZHM2PWE64a/BgIGqqFY7v TvuPPq+yuPbyufzHXJFD+jr6pwFLlllClGQ0FePR+Vz0YjS717MhHEkaQXFoUAlcKRaH LK27wBUF0TelMhpY89doSWDqHVo1sLJhXMws1BRj3XHkz+cilgjVgBZHxPpKqQcdatfB vN6w== X-Gm-Message-State: AOAM531MwBMKEWXJoM0GraH/YU6XX5CYZn5kBBmq5NnYMEnprLspOH+/ jPkprNTr+PwmG2w2LJsZUSffBg== X-Google-Smtp-Source: ABdhPJxS+Pj3swXd7Fv3yPtwdpusPwiJL7uVR+8E1eEQWCzW6uymNp3Vcpt8EhV2NMq7nJUUcfkuAQ== X-Received: by 2002:a17:90a:fb92:: with SMTP id cp18mr14835209pjb.228.1602411803013; Sun, 11 Oct 2020 03:23:23 -0700 (PDT) Received: from localhost.swdvt.lab.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id i1sm20155057pjh.52.2020.10.11.03.23.22 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 11 Oct 2020 03:23:22 -0700 (PDT) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, kuba@kernel.org, gospo@broadcom.com Subject: [PATCH net-next 3/9] bnxt_en: Set driver default message level. Date: Sun, 11 Oct 2020 06:22:55 -0400 Message-Id: <1602411781-6012-4-git-send-email-michael.chan@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1602411781-6012-1-git-send-email-michael.chan@broadcom.com> References: <1602411781-6012-1-git-send-email-michael.chan@broadcom.com> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Currently, bp->msg_enable has default value of 0. It is more useful to have the commonly used NETIF_MSG_DRV and NETIF_MSG_HW enabled by default. Reviewed-by: Edwin Peer Reviewed-by: Vasundhara Volam Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index d4402a2cd07f..0da6a1138eee 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -69,6 +69,7 @@ #include "bnxt_debugfs.h" #define BNXT_TX_TIMEOUT (5 * HZ) +#define BNXT_DEF_MSG_ENABLE (NETIF_MSG_DRV | NETIF_MSG_HW) MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("Broadcom BCM573xx network driver"); @@ -12510,6 +12511,7 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) return -ENOMEM; bp = netdev_priv(dev); + bp->msg_enable = BNXT_DEF_MSG_ENABLE; bnxt_set_max_func_irqs(bp, max_irqs); if (bnxt_vf_pciid(ent->driver_data)) From patchwork Sun Oct 11 10:22:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 270139 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=-12.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MIME_HEADER_CTYPE_ONLY, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, T_TVD_MIME_NO_HEADERS, URIBL_BLOCKED, 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 7AB37C433E7 for ; Sun, 11 Oct 2020 10:23:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3ECC8207F7 for ; Sun, 11 Oct 2020 10:23:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="RGZqynOG" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729634AbgJKKXc (ORCPT ); Sun, 11 Oct 2020 06:23:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727035AbgJKKXY (ORCPT ); Sun, 11 Oct 2020 06:23:24 -0400 Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D472DC0613CE for ; Sun, 11 Oct 2020 03:23:24 -0700 (PDT) Received: by mail-pf1-x441.google.com with SMTP id y14so10775428pfp.13 for ; Sun, 11 Oct 2020 03:23:24 -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=vQHU9KUdCZPZvEoGfzhG2OU6JJPjcM31kFff1Y+vDik=; b=RGZqynOGO4U8Jl3imscm1CpcRmCrWKRTlDriteRcieTkBVnwxwoIZ76S+eWb0IXR69 eAxeG86Dwcx3zdbaVIqR7Xb1TZ+uowKHC16SH2eep3CbjVGmX3aQU4lCHKapFAZ4jy19 urPpSvTklsejZiyf/tQNktORxR4WzYe+ZxX/c= 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=vQHU9KUdCZPZvEoGfzhG2OU6JJPjcM31kFff1Y+vDik=; b=VFXZcPOylxtkDbB3hZT1dOh0hIdNYlyxMEUah54ZdCyO1TiMJNzX5pfjgaP/TZyWw+ bnQVqOmVjilXoFbrK/buksE8YwAW96SFmbg5LMGcBK+FnnLIbOEMeCsnQ/fnxTFpFKvB dzjKgpN08G60jebQEB7PECVskFO4uDGQpSzSh1yp3iUKlDJ1s29Hm3tjfAN5Avq1zaJA +pNzWWHnPLDVu7SfgLLo3Us8zgrUdp99ErrPtVOGshzATwD1/mpYVk0f0/H5ipf+5+BW 9BV9u0ChmmcYDDVhsETxVmi0g7ZuV3f+F4oVek6/aO4W6dV4TRohFM1ExhT7I0aSHMR7 1Zrg== X-Gm-Message-State: AOAM5301TteBzQqCwbBADtbwg7zTFdkJ1c1CpNA4VBYoYETO9XiuzdpH nOrUFEsR53oWH5uzCkC+wS4Eaw== X-Google-Smtp-Source: ABdhPJxjIR3yy8YjDMiQqAnLj6j1d/sRDJ34JRZfiD7XGesqjb/oUsmUzRCn70JWS+sUdG8V2zWiVQ== X-Received: by 2002:a17:90b:1215:: with SMTP id gl21mr12342423pjb.132.1602411804098; Sun, 11 Oct 2020 03:23:24 -0700 (PDT) Received: from localhost.swdvt.lab.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id i1sm20155057pjh.52.2020.10.11.03.23.23 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 11 Oct 2020 03:23:23 -0700 (PDT) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, kuba@kernel.org, gospo@broadcom.com Subject: [PATCH net-next 4/9] bnxt_en: Simplify bnxt_async_event_process(). Date: Sun, 11 Oct 2020 06:22:56 -0400 Message-Id: <1602411781-6012-5-git-send-email-michael.chan@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1602411781-6012-1-git-send-email-michael.chan@broadcom.com> References: <1602411781-6012-1-git-send-email-michael.chan@broadcom.com> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org event_data1 and event_data2 are used when processing most events. Store these in local variables at the beginning of the function to simplify many of the case statements. Reviewed-by: Edwin Peer Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 0da6a1138eee..f093cdd61426 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -1980,11 +1980,12 @@ static int bnxt_async_event_process(struct bnxt *bp, struct hwrm_async_event_cmpl *cmpl) { u16 event_id = le16_to_cpu(cmpl->event_id); + u32 data1 = le32_to_cpu(cmpl->event_data1); + u32 data2 = le32_to_cpu(cmpl->event_data2); /* TODO CHIMP_FW: Define event id's for link change, error etc */ switch (event_id) { case ASYNC_EVENT_CMPL_EVENT_ID_LINK_SPEED_CFG_CHANGE: { - u32 data1 = le32_to_cpu(cmpl->event_data1); struct bnxt_link_info *link_info = &bp->link_info; if (BNXT_VF(bp)) @@ -2014,7 +2015,6 @@ static int bnxt_async_event_process(struct bnxt *bp, set_bit(BNXT_HWRM_PF_UNLOAD_SP_EVENT, &bp->sp_event); break; case ASYNC_EVENT_CMPL_EVENT_ID_PORT_CONN_NOT_ALLOWED: { - u32 data1 = le32_to_cpu(cmpl->event_data1); u16 port_id = BNXT_GET_EVENT_PORT(data1); if (BNXT_VF(bp)) @@ -2031,9 +2031,7 @@ static int bnxt_async_event_process(struct bnxt *bp, goto async_event_process_exit; set_bit(BNXT_RESET_TASK_SILENT_SP_EVENT, &bp->sp_event); break; - case ASYNC_EVENT_CMPL_EVENT_ID_RESET_NOTIFY: { - u32 data1 = le32_to_cpu(cmpl->event_data1); - + case ASYNC_EVENT_CMPL_EVENT_ID_RESET_NOTIFY: if (!bp->fw_health) goto async_event_process_exit; @@ -2053,10 +2051,8 @@ static int bnxt_async_event_process(struct bnxt *bp, } set_bit(BNXT_FW_RESET_NOTIFY_SP_EVENT, &bp->sp_event); break; - } case ASYNC_EVENT_CMPL_EVENT_ID_ERROR_RECOVERY: { struct bnxt_fw_health *fw_health = bp->fw_health; - u32 data1 = le32_to_cpu(cmpl->event_data1); if (!fw_health) goto async_event_process_exit; @@ -2084,8 +2080,6 @@ static int bnxt_async_event_process(struct bnxt *bp, goto async_event_process_exit; } case ASYNC_EVENT_CMPL_EVENT_ID_RING_MONITOR_MSG: { - u32 data1 = le32_to_cpu(cmpl->event_data1); - u32 data2 = le32_to_cpu(cmpl->event_data2); struct bnxt_rx_ring_info *rxr; u16 grp_idx; From patchwork Sun Oct 11 10:22:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 288612 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=-12.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MIME_HEADER_CTYPE_ONLY, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, T_TVD_MIME_NO_HEADERS, URIBL_BLOCKED, 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 8DE20C43457 for ; Sun, 11 Oct 2020 10:23:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4D093207F7 for ; Sun, 11 Oct 2020 10:23:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="LKmkE8IY" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729660AbgJKKXf (ORCPT ); Sun, 11 Oct 2020 06:23:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729598AbgJKKX0 (ORCPT ); Sun, 11 Oct 2020 06:23:26 -0400 Received: from mail-pg1-x52c.google.com (mail-pg1-x52c.google.com [IPv6:2607:f8b0:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 03FC5C0613CE for ; Sun, 11 Oct 2020 03:23:26 -0700 (PDT) Received: by mail-pg1-x52c.google.com with SMTP id n9so11230785pgf.9 for ; Sun, 11 Oct 2020 03:23:25 -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=7CnM4DrIL4JNOakYia0tlCVDMKCZuSBYMvS5joIVh0I=; b=LKmkE8IY8CRMYvD1chIhahsEOjueBkYqqdSHHGyLZoLMM/AXA3t3V09hwaXP9QNOrY ytrdssafeDVyBmBSLqjYbVKW2IGOdjkhTkd8XHNZ4YYtbY3ezCjJya894jjKHNb15t/q CW3I7f3C86B1/QO+FYW+PuMVqVSQiBzHksfEQ= 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=7CnM4DrIL4JNOakYia0tlCVDMKCZuSBYMvS5joIVh0I=; b=CRfHxaZce1OEjDzGnKS3/N5SQ6msRDTU9nLjW6Ky++Rdlpl0T1/GUHmh+3gXyu6z9a 6lResxMuyFfVeFOA0vMI8H/BkGaKPPBu/SyXISSo0lU52xAgMGgvoxmQRSPTq7a6SLcQ XAc6oooVOOQjDhOgViM6miihCry0MMtvSZw8j/7kCaN2lHfQDlBH7yWnNCoLrWbEnlPS 2LiC8VkQNzZyE3eY8Zsxx9NeFCQ7j8qx/IGmB86LSKcMBsQGQA8yh0X/IV49hjMKcJKN qP0q3vvTDRXjzgLgr/Xy1S9oZJjmTk/2s0p23IwINXyalvcvTKlL0yjNwGyVR4HChgIT K0pw== X-Gm-Message-State: AOAM5327Kcjd0JsUtAXufx+d36I7zxv2K3++91rggA6qxL0Q2GRbZCbd lLdB1wjzBzSJVgbDYBjvNW3TcQ== X-Google-Smtp-Source: ABdhPJz3ZGN/IbYSlKZQhIFnOhPXtfKKXKAgwjDHZt8PXLLk9dBMcKcEAeqyBfHRuK8xBBlIGkhD8A== X-Received: by 2002:a17:90b:3882:: with SMTP id mu2mr14769880pjb.29.1602411805441; Sun, 11 Oct 2020 03:23:25 -0700 (PDT) Received: from localhost.swdvt.lab.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id i1sm20155057pjh.52.2020.10.11.03.23.24 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 11 Oct 2020 03:23:24 -0700 (PDT) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, kuba@kernel.org, gospo@broadcom.com Subject: [PATCH net-next 5/9] bnxt_en: Log event_data1 and event_data2 when handling RESET_NOTIFY event. Date: Sun, 11 Oct 2020 06:22:57 -0400 Message-Id: <1602411781-6012-6-git-send-email-michael.chan@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1602411781-6012-1-git-send-email-michael.chan@broadcom.com> References: <1602411781-6012-1-git-send-email-michael.chan@broadcom.com> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Log these values that contain useful firmware state information. Reviewed-by: Edwin Peer Reviewed-by: Vasundhara Volam Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index f093cdd61426..ca35ec06abf0 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -2032,6 +2032,9 @@ static int bnxt_async_event_process(struct bnxt *bp, set_bit(BNXT_RESET_TASK_SILENT_SP_EVENT, &bp->sp_event); break; case ASYNC_EVENT_CMPL_EVENT_ID_RESET_NOTIFY: + if (netif_msg_hw(bp)) + netdev_warn(bp->dev, "Received RESET_NOTIFY event, data1: 0x%x, data2: 0x%x\n", + data1, data2); if (!bp->fw_health) goto async_event_process_exit; From patchwork Sun Oct 11 10:22:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 270137 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=-12.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MIME_HEADER_CTYPE_ONLY, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, T_TVD_MIME_NO_HEADERS, 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 977B1C433DF for ; Sun, 11 Oct 2020 10:23:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 55C782083B for ; Sun, 11 Oct 2020 10:23:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="AGzF91p1" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729694AbgJKKXl (ORCPT ); Sun, 11 Oct 2020 06:23:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729603AbgJKKX1 (ORCPT ); Sun, 11 Oct 2020 06:23:27 -0400 Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4DACDC0613D0 for ; Sun, 11 Oct 2020 03:23:27 -0700 (PDT) Received: by mail-pg1-x542.google.com with SMTP id i2so11229845pgh.7 for ; Sun, 11 Oct 2020 03:23:27 -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=QzE1gJt/wGeixc0XjP/HJf9f2erN/pdWNJtrGZoxo5g=; b=AGzF91p1c7ZJ0BxeLa27Ct8SO1sUt02knkOlRdAvJvwn07TCCC4rrCbO8BJWKOckcD 0hPh0JfbPA41BWN9oiINpPpzKygDLDfdjCECyJXdA46QMA1jy7ZQr/IBALjg0d0n27S9 ejt0N8EdoMwOD5YVzK/SPmWKU2PEseEw1vqIw= 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=QzE1gJt/wGeixc0XjP/HJf9f2erN/pdWNJtrGZoxo5g=; b=KB+n2vqwIh8yStaBa7BIbYjgblTSfUoUvEhVAeFN4pjn4ctml+8ut8hc3+lX2I+fV+ 4Tf/V40m7C7clc7S/lTQpHdjiGGVwh8XUOajv0LboMMbCzSBxnUzf6Urjck7k9qd4TOY etA4XYxfQGvpzgoWcmqJXVyVxGV7MehbB+tIFZlUKDJwU5pWC/RiLfTJvrc33GrPOjHh 3PVatQQMtjN+LXkqQpwfIzxO6bu9s6qHx8TmUrV93EPCKG+UrK7hiLKc7v5pkZUvKdAA xHPM5m22lksxIHEcKMK0Bd07fLV+NUs4yONxsqRKmkBTjGjf1sUb/kKG2/NUIAn93Vll DkXw== X-Gm-Message-State: AOAM532SQsQbYkAKFpg5LxrHnUuCM680XwgPGfFGuzzQhJhBvv59z0+C n0WcZs+4sKg5a3fJYwKYIY1TBA== X-Google-Smtp-Source: ABdhPJyzK0VXUmJ4nTO3JX67+yL/xo7k/bsPRdLixx90/SHTMXFp8r+pmHtIddBfEcDJCtjWhl740A== X-Received: by 2002:a17:90a:7f8c:: with SMTP id m12mr15047385pjl.22.1602411806723; Sun, 11 Oct 2020 03:23:26 -0700 (PDT) Received: from localhost.swdvt.lab.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id i1sm20155057pjh.52.2020.10.11.03.23.25 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 11 Oct 2020 03:23:25 -0700 (PDT) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, kuba@kernel.org, gospo@broadcom.com Subject: [PATCH net-next 6/9] bnxt_en: Log unknown link speed appropriately. Date: Sun, 11 Oct 2020 06:22:58 -0400 Message-Id: <1602411781-6012-7-git-send-email-michael.chan@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1602411781-6012-1-git-send-email-michael.chan@broadcom.com> References: <1602411781-6012-1-git-send-email-michael.chan@broadcom.com> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org If the VF virtual link is set to always enabled, the speed may be unknown when the physical link is down. The driver currently logs the link speed as 4294967295 Mbps which is SPEED_UNKNOWN. Modify the link up log message as "speed unknown" which makes more sense. Reviewed-by: Vasundhara Volam Reviewed-by: Edwin Peer Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index ca35ec06abf0..2d6ecf1adbc5 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -8902,6 +8902,11 @@ static void bnxt_report_link(struct bnxt *bp) u16 fec; netif_carrier_on(bp->dev); + speed = bnxt_fw_to_ethtool_speed(bp->link_info.link_speed); + if (speed == SPEED_UNKNOWN) { + netdev_info(bp->dev, "NIC Link is Up, speed unknown\n"); + return; + } if (bp->link_info.duplex == BNXT_LINK_DUPLEX_FULL) duplex = "full"; else @@ -8914,7 +8919,6 @@ static void bnxt_report_link(struct bnxt *bp) flow_ctrl = "ON - receive"; else flow_ctrl = "none"; - speed = bnxt_fw_to_ethtool_speed(bp->link_info.link_speed); netdev_info(bp->dev, "NIC Link is Up, %u Mbps %s duplex, Flow control: %s\n", speed, duplex, flow_ctrl); if (bp->flags & BNXT_FLAG_EEE_CAP) From patchwork Sun Oct 11 10:22:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 288611 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=-12.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MIME_HEADER_CTYPE_ONLY, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, T_TVD_MIME_NO_HEADERS, 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 6C3CFC433DF for ; Sun, 11 Oct 2020 10:23:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 31668207F7 for ; Sun, 11 Oct 2020 10:23:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="UMLbOUmY" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729671AbgJKKXg (ORCPT ); Sun, 11 Oct 2020 06:23:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729631AbgJKKX3 (ORCPT ); Sun, 11 Oct 2020 06:23:29 -0400 Received: from mail-pg1-x543.google.com (mail-pg1-x543.google.com [IPv6:2607:f8b0:4864:20::543]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7F53C0613D2 for ; Sun, 11 Oct 2020 03:23:28 -0700 (PDT) Received: by mail-pg1-x543.google.com with SMTP id o3so1229497pgr.11 for ; Sun, 11 Oct 2020 03:23:28 -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=9mj0libdtn4DjGlhqdg+VrW4jvFWBMOCt7yJVWC7hWQ=; b=UMLbOUmYZwVGPv0n8OrcFLTfHWWpcuGzurh323vgvWd9uJAV/strtsr/OUwHVY6PVL be+QQRisMWTUd7AHRQjjFFW3m/OkaNovv+OYLdvHgVNcceP+uYrvgORRIRxGUGqu7zE+ OmyuFzq14+eLFNAUbSRjcyBWIdNMalWQ4veOU= 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=9mj0libdtn4DjGlhqdg+VrW4jvFWBMOCt7yJVWC7hWQ=; b=qmh9CUKnPfvzRzAtAFH4PcgO0vlb1a+NmvHhGmiwvExgO3ErtTtZZyFs38EPpgsBCW ayANoefRzeaPhKk0qM8PnJcgKLk2mr9dDqWfHiywvncFDYJhIANLm5Ktu8lp6/PZF32j OpEgq3BXXoHZ9jqaBfoVeXTbz3MLu8eJ2+mXk8AnygtoC8WLXZ9wUap99aFbJCUNlNm/ D6ohJOYXIvF76ml6drsy96s63no/zjlOPjFxttmwKw7DSE9etJG5BZbEuGwXW1nMnWeg KtKA84XkID58KzY48i8wAAVO2gMG7KwZwYC9IAHzyRmp20Dw6QorUipwp2f+SkIyRUGE lqbQ== X-Gm-Message-State: AOAM533DjzX1ebsrR9FSLupcT7voWsivIrYhcE0DejiAxjkXTCL5Md2T O6dupDhgS/rEcDtXP3OpogbUJwokIB7NNA== X-Google-Smtp-Source: ABdhPJxyJo2ErydNA0f7gBbmiVybMM+us27YTsjFicIKXW+VCWJi4qkjAR2YqOmfJiP7OsbsgCTWxg== X-Received: by 2002:aa7:9f0f:0:b029:155:ef07:6ae0 with SMTP id g15-20020aa79f0f0000b0290155ef076ae0mr2710348pfr.70.1602411808089; Sun, 11 Oct 2020 03:23:28 -0700 (PDT) Received: from localhost.swdvt.lab.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id i1sm20155057pjh.52.2020.10.11.03.23.26 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 11 Oct 2020 03:23:27 -0700 (PDT) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, kuba@kernel.org, gospo@broadcom.com, Vasundhara Volam Subject: [PATCH net-next 7/9] bnxt_en: Add bnxt_hwrm_nvm_get_dev_info() to query NVM info. Date: Sun, 11 Oct 2020 06:22:59 -0400 Message-Id: <1602411781-6012-8-git-send-email-michael.chan@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1602411781-6012-1-git-send-email-michael.chan@broadcom.com> References: <1602411781-6012-1-git-send-email-michael.chan@broadcom.com> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Vasundhara Volam Add a new bnxt_hwrm_nvm_get_dev_info() to query firmware version information via NVM_GET_DEV_INFO firmware command. Use it to get the running version of the NVM configuration information. This new function will also be used in subsequent patches to get the stored firmware versions. Reviewed-by: Andy Gospodarek Signed-off-by: Vasundhara Volam Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 12 ++++++++++++ drivers/net/ethernet/broadcom/bnxt/bnxt.h | 1 + .../net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 16 ++++++++++++++++ .../net/ethernet/broadcom/bnxt/bnxt_ethtool.h | 2 ++ 4 files changed, 31 insertions(+) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 2d6ecf1adbc5..55d96e3a69da 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -7562,6 +7562,16 @@ static int bnxt_hwrm_func_reset(struct bnxt *bp) return hwrm_send_message(bp, &req, sizeof(req), HWRM_RESET_TIMEOUT); } +static void bnxt_nvm_cfg_ver_get(struct bnxt *bp) +{ + struct hwrm_nvm_get_dev_info_output nvm_info; + + if (!bnxt_hwrm_nvm_get_dev_info(bp, &nvm_info)) + snprintf(bp->nvm_cfg_ver, FW_VER_STR_LEN, "%d.%d.%d", + nvm_info.nvm_cfg_ver_maj, nvm_info.nvm_cfg_ver_min, + nvm_info.nvm_cfg_ver_upd); +} + static int bnxt_hwrm_queue_qportcfg(struct bnxt *bp) { int rc = 0; @@ -11223,6 +11233,8 @@ static int bnxt_fw_init_one_p1(struct bnxt *bp) if (rc) return rc; } + bnxt_nvm_cfg_ver_get(bp); + rc = bnxt_hwrm_func_reset(bp); if (rc) return -ENODEV; diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethernet/broadcom/bnxt/bnxt.h index b208ff7c5d14..21ef1c21f602 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h @@ -1856,6 +1856,7 @@ struct bnxt { #define PHY_VER_STR_LEN (FW_VER_STR_LEN - BC_HWRM_STR_LEN) char fw_ver_str[FW_VER_STR_LEN]; char hwrm_ver_supp[FW_VER_STR_LEN]; + char nvm_cfg_ver[FW_VER_STR_LEN]; u64 fw_ver_code; #define BNXT_FW_VER_CODE(maj, min, bld, rsv) \ ((u64)(maj) << 48 | (u64)(min) << 32 | (u64)(bld) << 16 | (rsv)) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c index dcbb7b70d60a..53687bc7fcf5 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c @@ -2072,6 +2072,22 @@ static u32 bnxt_get_link(struct net_device *dev) return bp->link_info.link_up; } +int bnxt_hwrm_nvm_get_dev_info(struct bnxt *bp, + struct hwrm_nvm_get_dev_info_output *nvm_dev_info) +{ + struct hwrm_nvm_get_dev_info_output *resp = bp->hwrm_cmd_resp_addr; + struct hwrm_nvm_get_dev_info_input req = {0}; + int rc; + + bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_NVM_GET_DEV_INFO, -1, -1); + mutex_lock(&bp->hwrm_cmd_lock); + rc = _hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT); + if (!rc) + memcpy(nvm_dev_info, resp, sizeof(*resp)); + mutex_unlock(&bp->hwrm_cmd_lock); + return rc; +} + static void bnxt_print_admin_err(struct bnxt *bp) { netdev_info(bp->dev, "PF does not have admin privileges to flash or reset the device\n"); diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.h b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.h index 34f44ddfad79..fa6fbde52bea 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.h +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.h @@ -92,6 +92,8 @@ u32 bnxt_get_rxfh_indir_size(struct net_device *dev); u32 _bnxt_fw_to_ethtool_adv_spds(u16, u8); u32 bnxt_fw_to_ethtool_speed(u16); u16 bnxt_get_fw_auto_link_speeds(u32); +int bnxt_hwrm_nvm_get_dev_info(struct bnxt *bp, + struct hwrm_nvm_get_dev_info_output *nvm_dev_info); int bnxt_flash_package_from_file(struct net_device *dev, const char *filename, u32 install_type); void bnxt_ethtool_init(struct bnxt *bp); From patchwork Sun Oct 11 10:23:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 270138 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=-12.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MIME_HEADER_CTYPE_ONLY, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, T_TVD_MIME_NO_HEADERS, 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 99E03C433E7 for ; Sun, 11 Oct 2020 10:23:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 57E7A2083B for ; Sun, 11 Oct 2020 10:23:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="SNTedbf3" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729682AbgJKKXh (ORCPT ); Sun, 11 Oct 2020 06:23:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729644AbgJKKXa (ORCPT ); Sun, 11 Oct 2020 06:23:30 -0400 Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CBA87C0613D5 for ; Sun, 11 Oct 2020 03:23:29 -0700 (PDT) Received: by mail-pf1-x42f.google.com with SMTP id w21so10787087pfc.7 for ; Sun, 11 Oct 2020 03:23:29 -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=r2BHCJHlWVuv0GsFJ5mqbEK4wFFnjhnFJcE2N7Qz3NY=; b=SNTedbf37W59tovTVUP19ukRakP/o1Bxy8duMN8yMhzvSPqpoxMfye++tvpoqVFirW Nbk46L8aHRBrIQycm328iD/D6F0h0ErvKQtfLdOCDVzp7jHQwBi2yus5N6tQxYSkx4J4 3b/jh7ekdOJmrA0ZHvhJ6mIGOFlKoHseTpoMY= 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=r2BHCJHlWVuv0GsFJ5mqbEK4wFFnjhnFJcE2N7Qz3NY=; b=l6rkI90tDRA9OSZ1eFBQP8H/G7RJyeIHWfCsCBjQg4YZX/4nv725ZXyTBvV+5ZrtHg 2Ym6m6gO36Nh0LY0uKiW32Jne8ERXdKEM+t7jBIc8VQtO7UnbEK5E+efZZuCA2RxZ7a6 SATxuc1iQhF3zIrn/nkhc98S7BYNZIMVGSEfn93L1J6/WdcRnsBG0+2zVmKNm3SjRywV c0MDCWmfdw7O8IKjzd8YFqZlgmyrEgJ7FiOdBJRZXm5yCCexLfLR++xtpbBq1kWNhpyS mVrcaUJFrzbpF2sf3q/wu+jVzxlM8oFG9nGwH1aoPw7XXaF2AED/akpqq+L/jvf1dmrt ys4g== X-Gm-Message-State: AOAM533mzdaxEno2YiDd8Kf3hrmxaw05sHQXHVgqQCZX5QG7e2nlFfvU kEc3+5W62IhocIfxikTUkORjCyLtbnj2Dg== X-Google-Smtp-Source: ABdhPJzDzLGn9iw0d5228Fj6AJdklLPwvJZlOBt0yYg/EOj+Ovdem+c68EDtiVL0gVJG2PulKn8ODg== X-Received: by 2002:a63:5043:: with SMTP id q3mr9543278pgl.293.1602411809159; Sun, 11 Oct 2020 03:23:29 -0700 (PDT) Received: from localhost.swdvt.lab.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id i1sm20155057pjh.52.2020.10.11.03.23.28 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 11 Oct 2020 03:23:28 -0700 (PDT) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, kuba@kernel.org, gospo@broadcom.com, Vasundhara Volam Subject: [PATCH net-next 8/9] bnxt_en: Refactor bnxt_dl_info_get(). Date: Sun, 11 Oct 2020 06:23:00 -0400 Message-Id: <1602411781-6012-9-git-send-email-michael.chan@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1602411781-6012-1-git-send-email-michael.chan@broadcom.com> References: <1602411781-6012-1-git-send-email-michael.chan@broadcom.com> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Vasundhara Volam Add a new function bnxt_dl_info_put() to simplify the code, as there are more stored firmware version fields to be added in the next patch. Also, rename fw_ver variable name to ncsi_ver for better naming while copying to devlink info_get cb. Reviewed-by: Pavan Chebbi Reviewed-by: Andy Gospodarek Signed-off-by: Vasundhara Volam Signed-off-by: Michael Chan --- .../net/ethernet/broadcom/bnxt/bnxt_devlink.c | 112 ++++++++++-------- .../net/ethernet/broadcom/bnxt/bnxt_devlink.h | 6 + 2 files changed, 70 insertions(+), 48 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c index d436134bdc40..65e8da1f7a01 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c @@ -382,6 +382,29 @@ static int bnxt_hwrm_get_nvm_cfg_ver(struct bnxt *bp, return rc; } +static int bnxt_dl_info_put(struct bnxt *bp, struct devlink_info_req *req, + enum bnxt_dl_version_type type, const char *key, + char *buf) +{ + if (!strlen(buf)) + return 0; + + if ((bp->flags & BNXT_FLAG_CHIP_P5) && + (!strcmp(key, DEVLINK_INFO_VERSION_GENERIC_FW_NCSI) || + !strcmp(key, DEVLINK_INFO_VERSION_GENERIC_FW_ROCE))) + return 0; + + switch (type) { + case BNXT_VERSION_FIXED: + return devlink_info_version_fixed_put(req, key, buf); + case BNXT_VERSION_RUNNING: + return devlink_info_version_running_put(req, key, buf); + case BNXT_VERSION_STORED: + return devlink_info_version_stored_put(req, key, buf); + } + return 0; +} + static int bnxt_dl_info_get(struct devlink *dl, struct devlink_info_req *req, struct netlink_ext_ack *extack) { @@ -390,7 +413,7 @@ static int bnxt_dl_info_get(struct devlink *dl, struct devlink_info_req *req, struct hwrm_ver_get_output *ver_resp; char mgmt_ver[FW_VER_STR_LEN]; char roce_ver[FW_VER_STR_LEN]; - char fw_ver[FW_VER_STR_LEN]; + char ncsi_ver[FW_VER_STR_LEN]; char buf[32]; int rc; @@ -398,10 +421,11 @@ static int bnxt_dl_info_get(struct devlink *dl, struct devlink_info_req *req, if (rc) return rc; - if (strlen(bp->board_partno)) { - rc = devlink_info_version_fixed_put(req, - DEVLINK_INFO_VERSION_GENERIC_BOARD_ID, - bp->board_partno); + if (BNXT_PF(bp) && (bp->flags & BNXT_FLAG_DSN_VALID)) { + sprintf(buf, "%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X", + bp->dsn[7], bp->dsn[6], bp->dsn[5], bp->dsn[4], + bp->dsn[3], bp->dsn[2], bp->dsn[1], bp->dsn[0]); + rc = devlink_info_serial_number_put(req, buf); if (rc) return rc; } @@ -412,54 +436,49 @@ static int bnxt_dl_info_get(struct devlink *dl, struct devlink_info_req *req, return rc; } + rc = bnxt_dl_info_put(bp, req, BNXT_VERSION_FIXED, + DEVLINK_INFO_VERSION_GENERIC_BOARD_ID, + bp->board_partno); + if (rc) + return rc; + sprintf(buf, "%X", bp->chip_num); - rc = devlink_info_version_fixed_put(req, - DEVLINK_INFO_VERSION_GENERIC_ASIC_ID, buf); + rc = bnxt_dl_info_put(bp, req, BNXT_VERSION_FIXED, + DEVLINK_INFO_VERSION_GENERIC_ASIC_ID, buf); if (rc) return rc; ver_resp = &bp->ver_resp; sprintf(buf, "%X", ver_resp->chip_rev); - rc = devlink_info_version_fixed_put(req, - DEVLINK_INFO_VERSION_GENERIC_ASIC_REV, buf); + rc = bnxt_dl_info_put(bp, req, BNXT_VERSION_FIXED, + DEVLINK_INFO_VERSION_GENERIC_ASIC_REV, buf); if (rc) return rc; - if (BNXT_PF(bp)) { - sprintf(buf, "%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X", - bp->dsn[7], bp->dsn[6], bp->dsn[5], bp->dsn[4], - bp->dsn[3], bp->dsn[2], bp->dsn[1], bp->dsn[0]); - rc = devlink_info_serial_number_put(req, buf); - if (rc) - return rc; - } - - if (strlen(ver_resp->active_pkg_name)) { - rc = - devlink_info_version_running_put(req, - DEVLINK_INFO_VERSION_GENERIC_FW, - ver_resp->active_pkg_name); - if (rc) - return rc; - } + rc = bnxt_dl_info_put(bp, req, BNXT_VERSION_RUNNING, + DEVLINK_INFO_VERSION_GENERIC_FW, + ver_resp->active_pkg_name); + if (rc) + return rc; if (BNXT_PF(bp) && !bnxt_hwrm_get_nvm_cfg_ver(bp, &nvm_cfg_ver)) { u32 ver = nvm_cfg_ver.vu32; sprintf(buf, "%X.%X.%X", (ver >> 16) & 0xF, (ver >> 8) & 0xF, ver & 0xF); - rc = devlink_info_version_running_put(req, - DEVLINK_INFO_VERSION_GENERIC_FW_PSID, buf); + rc = bnxt_dl_info_put(bp, req, BNXT_VERSION_RUNNING, + DEVLINK_INFO_VERSION_GENERIC_FW_PSID, + buf); if (rc) return rc; } if (ver_resp->flags & VER_GET_RESP_FLAGS_EXT_VER_AVAIL) { - snprintf(fw_ver, FW_VER_STR_LEN, "%d.%d.%d.%d", + snprintf(mgmt_ver, FW_VER_STR_LEN, "%d.%d.%d.%d", ver_resp->hwrm_fw_major, ver_resp->hwrm_fw_minor, ver_resp->hwrm_fw_build, ver_resp->hwrm_fw_patch); - snprintf(mgmt_ver, FW_VER_STR_LEN, "%d.%d.%d.%d", + snprintf(ncsi_ver, FW_VER_STR_LEN, "%d.%d.%d.%d", ver_resp->mgmt_fw_major, ver_resp->mgmt_fw_minor, ver_resp->mgmt_fw_build, ver_resp->mgmt_fw_patch); @@ -467,11 +486,11 @@ static int bnxt_dl_info_get(struct devlink *dl, struct devlink_info_req *req, ver_resp->roce_fw_major, ver_resp->roce_fw_minor, ver_resp->roce_fw_build, ver_resp->roce_fw_patch); } else { - snprintf(fw_ver, FW_VER_STR_LEN, "%d.%d.%d.%d", + snprintf(mgmt_ver, FW_VER_STR_LEN, "%d.%d.%d.%d", ver_resp->hwrm_fw_maj_8b, ver_resp->hwrm_fw_min_8b, ver_resp->hwrm_fw_bld_8b, ver_resp->hwrm_fw_rsvd_8b); - snprintf(mgmt_ver, FW_VER_STR_LEN, "%d.%d.%d.%d", + snprintf(ncsi_ver, FW_VER_STR_LEN, "%d.%d.%d.%d", ver_resp->mgmt_fw_maj_8b, ver_resp->mgmt_fw_min_8b, ver_resp->mgmt_fw_bld_8b, ver_resp->mgmt_fw_rsvd_8b); @@ -479,29 +498,26 @@ static int bnxt_dl_info_get(struct devlink *dl, struct devlink_info_req *req, ver_resp->roce_fw_maj_8b, ver_resp->roce_fw_min_8b, ver_resp->roce_fw_bld_8b, ver_resp->roce_fw_rsvd_8b); } - rc = devlink_info_version_running_put(req, - DEVLINK_INFO_VERSION_GENERIC_FW_MGMT, fw_ver); + rc = bnxt_dl_info_put(bp, req, BNXT_VERSION_RUNNING, + DEVLINK_INFO_VERSION_GENERIC_FW_MGMT, mgmt_ver); if (rc) return rc; - rc = devlink_info_version_running_put(req, - DEVLINK_INFO_VERSION_GENERIC_FW_MGMT_API, - bp->hwrm_ver_supp); + rc = bnxt_dl_info_put(bp, req, BNXT_VERSION_RUNNING, + DEVLINK_INFO_VERSION_GENERIC_FW_MGMT_API, + bp->hwrm_ver_supp); if (rc) return rc; - if (!(bp->flags & BNXT_FLAG_CHIP_P5)) { - rc = devlink_info_version_running_put(req, - DEVLINK_INFO_VERSION_GENERIC_FW_NCSI, mgmt_ver); - if (rc) - return rc; + rc = bnxt_dl_info_put(bp, req, BNXT_VERSION_RUNNING, + DEVLINK_INFO_VERSION_GENERIC_FW_NCSI, ncsi_ver); + if (rc) + return rc; - rc = devlink_info_version_running_put(req, - DEVLINK_INFO_VERSION_GENERIC_FW_ROCE, roce_ver); - if (rc) - return rc; - } - return 0; + rc = bnxt_dl_info_put(bp, req, BNXT_VERSION_RUNNING, + DEVLINK_INFO_VERSION_GENERIC_FW_ROCE, roce_ver); + + return rc; } static int bnxt_hwrm_nvm_req(struct bnxt *bp, u32 param_id, void *msg, diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.h b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.h index d5c8bd49383a..d22cab5d6856 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.h +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.h @@ -60,6 +60,12 @@ struct bnxt_dl_nvm_param { u8 dl_num_bytes; }; +enum bnxt_dl_version_type { + BNXT_VERSION_FIXED, + BNXT_VERSION_RUNNING, + BNXT_VERSION_STORED, +}; + void bnxt_devlink_health_report(struct bnxt *bp, unsigned long event); void bnxt_dl_health_status_update(struct bnxt *bp, bool healthy); void bnxt_dl_health_recovery_done(struct bnxt *bp); From patchwork Sun Oct 11 10:23:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 288610 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=-12.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MIME_HEADER_CTYPE_ONLY, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, T_TVD_MIME_NO_HEADERS, URIBL_BLOCKED, 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 184E7C433E7 for ; Sun, 11 Oct 2020 10:23:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C8CD5207F7 for ; Sun, 11 Oct 2020 10:23:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="BblzkU0i" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729704AbgJKKXn (ORCPT ); Sun, 11 Oct 2020 06:23:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729649AbgJKKXc (ORCPT ); Sun, 11 Oct 2020 06:23:32 -0400 Received: from mail-pg1-x541.google.com (mail-pg1-x541.google.com [IPv6:2607:f8b0:4864:20::541]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 459F7C0613D6 for ; Sun, 11 Oct 2020 03:23:31 -0700 (PDT) Received: by mail-pg1-x541.google.com with SMTP id i2so11229916pgh.7 for ; Sun, 11 Oct 2020 03:23:31 -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=NytSwevh7wbHFx2ANtUbe15026p0VcH4xRVPkKzUPuo=; b=BblzkU0iQ5/p6l1rB2BBXR36dgnG1jnE8ETkuRYJh9PVBL62nI3Kbf5NsKJc2KhaJj RAP+tXpEdwFlD7mGKTdCJMWO/hisjknsIiIwuF1mOzbv8cjlvft6x/SCLMkgDjvhphnD 5xnZB+Uhuwv0HYNtRnjj1vdU+9z+2CHlCHeDY= 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=NytSwevh7wbHFx2ANtUbe15026p0VcH4xRVPkKzUPuo=; b=EE0bPWwdpszfTHXmk4qZXdy7TOtrqn5l6Kbui9v1sTtITboq8Q0KW70+Piy0K7RlSV Oh5jMbT+huxFrv+1v96buwpOmsGsoaVnMuZQRF5izCTyBmYN6b6JshVJLekxfwtOGQac FRFIcM/NUkLjsFYVroBwQNsqx/GlWRNp6yZBiLiDrk16BBSnWTzqCXakk2ahBWR7NlqL LMJemKDUeuYaD4eC1MFtoIIl9BCMS9sUnruaHgYYYIQCASreaCm7vCu5L+TLBQNIvzZB 4T2NogjGIHCzZY9m//7UupGmGRPP0VfRO63CgO9UyfzQcfMmq3V8zUBQ+CFLIY5OogXn Czag== X-Gm-Message-State: AOAM530a0dopYsYZ+kZLSeXtNF/0ulUL/jalc4QlHpyJckYN5kTtSUuN ryD+4bLlrvE5PSJzPUJannz/pNWDa+TXqQ== X-Google-Smtp-Source: ABdhPJwU+gZCUvagSjgSSBrK75ElZJrWEP3FF+K6zs4Q2LmKqxf3/CiLg63iwtnroDZ/6S/5aTA5NQ== X-Received: by 2002:a63:fd0a:: with SMTP id d10mr9406624pgh.273.1602411810661; Sun, 11 Oct 2020 03:23:30 -0700 (PDT) Received: from localhost.swdvt.lab.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id i1sm20155057pjh.52.2020.10.11.03.23.29 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 11 Oct 2020 03:23:29 -0700 (PDT) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, kuba@kernel.org, gospo@broadcom.com, Vasundhara Volam Subject: [PATCH net-next 9/9] bnxt_en: Add stored FW version info to devlink info_get cb. Date: Sun, 11 Oct 2020 06:23:01 -0400 Message-Id: <1602411781-6012-10-git-send-email-michael.chan@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1602411781-6012-1-git-send-email-michael.chan@broadcom.com> References: <1602411781-6012-1-git-send-email-michael.chan@broadcom.com> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Vasundhara Volam This patch adds FW versions stored in the flash to devlink info_get callback. Return the correct fw.psid running version using the newly added bp->nvm_cfg_ver. Reviewed-by: Andy Gospodarek Signed-off-by: Vasundhara Volam Signed-off-by: Michael Chan --- .../net/ethernet/broadcom/bnxt/bnxt_devlink.c | 45 ++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c index 65e8da1f7a01..7631c2d4c19e 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c @@ -408,6 +408,7 @@ static int bnxt_dl_info_put(struct bnxt *bp, struct devlink_info_req *req, static int bnxt_dl_info_get(struct devlink *dl, struct devlink_info_req *req, struct netlink_ext_ack *extack) { + struct hwrm_nvm_get_dev_info_output nvm_dev_info; struct bnxt *bp = bnxt_get_bp_from_dl(dl); union devlink_param_value nvm_cfg_ver; struct hwrm_ver_get_output *ver_resp; @@ -455,6 +456,12 @@ static int bnxt_dl_info_get(struct devlink *dl, struct devlink_info_req *req, if (rc) return rc; + rc = bnxt_dl_info_put(bp, req, BNXT_VERSION_RUNNING, + DEVLINK_INFO_VERSION_GENERIC_FW_PSID, + bp->nvm_cfg_ver); + if (rc) + return rc; + rc = bnxt_dl_info_put(bp, req, BNXT_VERSION_RUNNING, DEVLINK_INFO_VERSION_GENERIC_FW, ver_resp->active_pkg_name); @@ -466,7 +473,7 @@ static int bnxt_dl_info_get(struct devlink *dl, struct devlink_info_req *req, sprintf(buf, "%X.%X.%X", (ver >> 16) & 0xF, (ver >> 8) & 0xF, ver & 0xF); - rc = bnxt_dl_info_put(bp, req, BNXT_VERSION_RUNNING, + rc = bnxt_dl_info_put(bp, req, BNXT_VERSION_STORED, DEVLINK_INFO_VERSION_GENERIC_FW_PSID, buf); if (rc) @@ -516,7 +523,43 @@ static int bnxt_dl_info_get(struct devlink *dl, struct devlink_info_req *req, rc = bnxt_dl_info_put(bp, req, BNXT_VERSION_RUNNING, DEVLINK_INFO_VERSION_GENERIC_FW_ROCE, roce_ver); + if (rc) + return rc; + + rc = bnxt_hwrm_nvm_get_dev_info(bp, &nvm_dev_info); + if (rc) + return rc; + + if (!(nvm_dev_info.flags & NVM_GET_DEV_INFO_RESP_FLAGS_FW_VER_VALID)) + return 0; + + rc = bnxt_dl_info_put(bp, req, BNXT_VERSION_STORED, + DEVLINK_INFO_VERSION_GENERIC_FW, + nvm_dev_info.pkg_name); + if (rc) + return rc; + + snprintf(mgmt_ver, FW_VER_STR_LEN, "%d.%d.%d.%d", + nvm_dev_info.hwrm_fw_major, nvm_dev_info.hwrm_fw_minor, + nvm_dev_info.hwrm_fw_build, nvm_dev_info.hwrm_fw_patch); + rc = bnxt_dl_info_put(bp, req, BNXT_VERSION_STORED, + DEVLINK_INFO_VERSION_GENERIC_FW_MGMT, mgmt_ver); + if (rc) + return rc; + + snprintf(ncsi_ver, FW_VER_STR_LEN, "%d.%d.%d.%d", + nvm_dev_info.mgmt_fw_major, nvm_dev_info.mgmt_fw_minor, + nvm_dev_info.mgmt_fw_build, nvm_dev_info.mgmt_fw_patch); + rc = bnxt_dl_info_put(bp, req, BNXT_VERSION_STORED, + DEVLINK_INFO_VERSION_GENERIC_FW_NCSI, ncsi_ver); + if (rc) + return rc; + snprintf(roce_ver, FW_VER_STR_LEN, "%d.%d.%d.%d", + nvm_dev_info.roce_fw_major, nvm_dev_info.roce_fw_minor, + nvm_dev_info.roce_fw_build, nvm_dev_info.roce_fw_patch); + rc = bnxt_dl_info_put(bp, req, BNXT_VERSION_STORED, + DEVLINK_INFO_VERSION_GENERIC_FW_ROCE, roce_ver); return rc; }