From patchwork Mon Oct 12 09:10:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 270093 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 AB4D5C433E7 for ; Mon, 12 Oct 2020 09:11:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 56EC32145D for ; Mon, 12 Oct 2020 09:11:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="LFTuaRK7" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729249AbgJLJLS (ORCPT ); Mon, 12 Oct 2020 05:11:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729014AbgJLJLQ (ORCPT ); Mon, 12 Oct 2020 05:11:16 -0400 Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 11237C0613CE for ; Mon, 12 Oct 2020 02:11:16 -0700 (PDT) Received: by mail-pf1-x444.google.com with SMTP id w21so12924401pfc.7 for ; Mon, 12 Oct 2020 02:11:16 -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=48xDogQ+yVA231K9iKicWj7mmIKN7NZJhrv5CyAja4k=; b=LFTuaRK7B73pZLNXAsJmltXzAIgRQXdyYVg6s8n5k47xaIlM9umubisb8Zv8Mjja4N R2YyCMoSjXKprNv3wUChDvR0Q7xZUoWyAt6FJLPePC/1dOpozWsPU9oGR4ihL1w0LH6p +TIp8IWxd/xQzDCFp3MVUuyeI4KqX0WrrKQ9A= 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=48xDogQ+yVA231K9iKicWj7mmIKN7NZJhrv5CyAja4k=; b=p3FY/NtdtK/C9hjHlbcYLnPkiBvoKeYudT7jzfbSPzEdhVM7yArm2Q7ceLLOq97BP3 EWH3Kyx7lG+kuGGikfO7s/Ig4Je7ieJm0xmBPcwy/i2YA+o9sGYKCgbDLA/qI9tGB3ku JYRGUhGLlpDTxnYh1eqw72uqtrSkrxk4eO2rtEAAiPu/u/s2IGYTCawX7WP+9Vd/E5Gm BPEBXtBahDA9rM11SWIJwmXhUPC9gzePfgIoLN6BZh60qFMKEsmGYUc3tAACKnV7/3wL YEzLfq/LOwVQglO9hWcMXMjAL91FzYAST/u3if3NM6aqqeqUm5LKawxgmXlmST1GcUnQ AqQw== X-Gm-Message-State: AOAM531WsGQpvBzdIxlVo94m2jpxc1UQZ+23opeluuIpAKrMcEIcZwsZ RooRoGhuDazajym5PmR5n7PkroOouS46iw== X-Google-Smtp-Source: ABdhPJzlArkiEwVBkUPduqB0zRF4H28ldEDyGFfifgXSP8ADIPpxPAaO5tmuq/n6HZ+lfEugWY5Mww== X-Received: by 2002:a62:aa10:0:b029:152:b36e:b052 with SMTP id e16-20020a62aa100000b0290152b36eb052mr22019563pff.27.1602493875433; Mon, 12 Oct 2020 02:11:15 -0700 (PDT) Received: from localhost.swdvt.lab.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id jy19sm1275932pjb.9.2020.10.12.02.11.13 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Oct 2020 02:11:14 -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 v2 1/9] bnxt_en: Return -EROFS to user space, if NVM writes are not permitted. Date: Mon, 12 Oct 2020 05:10:46 -0400 Message-Id: <1602493854-29283-2-git-send-email-michael.chan@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1602493854-29283-1-git-send-email-michael.chan@broadcom.com> References: <1602493854-29283-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 Mon Oct 12 09:10:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 270095 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 DCE3AC433DF for ; Mon, 12 Oct 2020 09:11:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 86DB42145D for ; Mon, 12 Oct 2020 09:11:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="PQNpIrIA" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729264AbgJLJLS (ORCPT ); Mon, 12 Oct 2020 05:11:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729075AbgJLJLR (ORCPT ); Mon, 12 Oct 2020 05:11:17 -0400 Received: from mail-pf1-x443.google.com (mail-pf1-x443.google.com [IPv6:2607:f8b0:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53631C0613D0 for ; Mon, 12 Oct 2020 02:11:17 -0700 (PDT) Received: by mail-pf1-x443.google.com with SMTP id e10so12941904pfj.1 for ; Mon, 12 Oct 2020 02:11:17 -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=oHtz6W3fJN30D9Y2QS+JEp+DqO/4kmAxy22G4WX1KA0=; b=PQNpIrIA2IAYi3vfRS2rZ9Tt9GTcIMTyu2IwiykGyMn/F47qayK1tl5etVzk+HBa7n 62XpXJBxFrz+ldmncFCj0tWuTMcf/6tyKPjoEgJTIyf9aXF00ToAygS2Myfwy7Ht70Y8 WC9xO7DeLumG+ffctZvX7hEj2Nrsk1vlxBJ3I= 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=oHtz6W3fJN30D9Y2QS+JEp+DqO/4kmAxy22G4WX1KA0=; b=YAU4T2HI08TPQI/WvORiIDi5V1sIfBcuaepG/sqIzzBQlACMCY5skcWLPOrmXqx3qW mOSomZkdGW7yhRJ1LfKBebLwoYLqz1+Gs403iajk8u14uI3R3TyzP4I50VWWDN3iZqWj bYvkiopBRK+6mP+iyCZ8XC/M18jr8kp2gUmmitCOvtdrAzP3dofPXVhvcfEK0l91k0cr DR8srI2tiaXVDUGijrEFJKGHswb9mSu8O043Zp4EHEuO0ebnifY9gLNrW9KBUOgQUCBO s0j+k3i8bFgSrMrH8odMaD6ZLmM0Rn+z2Hmlg1HloXHYnVu3hn6LVs05F+MFW4xq0yI2 qkkQ== X-Gm-Message-State: AOAM5321u/1JS73FMhIBM367lgw9KwfEVTFVYuwi9GfbjOEC+1BeVbzO QbvC/+MNDDSIM3PNrI6ykb29Aw== X-Google-Smtp-Source: ABdhPJwbyw81fajEzX9rTC1a1orU9ssqNX3VIkn4qxFUm60HWFy0PFt9X4zBBc6tTBwxL76k8fFSgg== X-Received: by 2002:a17:90b:490:: with SMTP id bh16mr18373700pjb.214.1602493876773; Mon, 12 Oct 2020 02:11:16 -0700 (PDT) Received: from localhost.swdvt.lab.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id jy19sm1275932pjb.9.2020.10.12.02.11.15 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Oct 2020 02:11:15 -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 v2 2/9] bnxt_en: Enable online self tests for multi-host/NPAR mode. Date: Mon, 12 Oct 2020 05:10:47 -0400 Message-Id: <1602493854-29283-3-git-send-email-michael.chan@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1602493854-29283-1-git-send-email-michael.chan@broadcom.com> References: <1602493854-29283-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 Mon Oct 12 09:10:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 288565 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 87C9DC43457 for ; Mon, 12 Oct 2020 09:11:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 300FA2076D for ; Mon, 12 Oct 2020 09:11:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="e2qPQeSy" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729286AbgJLJLU (ORCPT ); Mon, 12 Oct 2020 05:11:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729259AbgJLJLS (ORCPT ); Mon, 12 Oct 2020 05:11:18 -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 88E73C0613CE for ; Mon, 12 Oct 2020 02:11:18 -0700 (PDT) Received: by mail-pg1-x541.google.com with SMTP id n9so200565pgt.8 for ; Mon, 12 Oct 2020 02:11:18 -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=nXlPfikK8eog6RN7v2pmBeQAfT23cQtLP0EZqe7O05I=; b=e2qPQeSybGdmeCZ7HYcVarmR8oSDqCcIMwtp2YSoRVEdCXqfyiWdD4o9lq95KQJ0lh oNw4qY5aDS6UG82KJSSxoi4MsNS2AnHNVq2fVsQ0fQ77wkq5omwXe6QU4r5M41Gd+2b0 46Uhh+Dn2OXuv8HF5JH8wFJEQJuqydOTDfzEY= 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=nXlPfikK8eog6RN7v2pmBeQAfT23cQtLP0EZqe7O05I=; b=CK+fjLcSyNEBLKIyGxZXd1AtfIPM4R378Y6Q6wBQHkY8+VoRntVxOv6b4K6UTj5vcf zTFsN8AGTTWboO+NDLbh9HoWhI0qoRr77KSwVhMaB5JABjt6ZBOD4KsoKUEgKJ3WZT50 IYA83JJGi7P3+IEL1kt8mfwR+avnWQwPhwtj0cQJU5jCAxQrJEReu3qqf+65HMEonO4a YJugTLUMS9w5zmW90rJmF/noVJyGqOSVUD7cmIJiZJBLBCUKjuQ3dJz84+Z3su8dp5YZ gUanKHEcK6ohv1HdNXqO57EwNo1rNp5hBmNQyImO0aSUDCFI+k7uZlTTAqIjNeulXrk1 e+GQ== X-Gm-Message-State: AOAM530NyXp+8LSwQ7PIZh1lsfgQImqxCFlBjIw+0iJxe0oMPofj0/ML GzLZ6XDsSV3o0u2+zVGzitk3zmGYpdeRoA== X-Google-Smtp-Source: ABdhPJy8KI+r5Vu/VcJvtSMZ20Oo5grZLgkHVITTGYcGU5oE+Xl8Lu6YpTcKWcgV84fT6x0HWUkq3A== X-Received: by 2002:a17:90b:90c:: with SMTP id bo12mr18372195pjb.7.1602493877964; Mon, 12 Oct 2020 02:11:17 -0700 (PDT) Received: from localhost.swdvt.lab.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id jy19sm1275932pjb.9.2020.10.12.02.11.16 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Oct 2020 02:11:17 -0700 (PDT) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, kuba@kernel.org, gospo@broadcom.com Subject: [PATCH net-next v2 3/9] bnxt_en: Set driver default message level. Date: Mon, 12 Oct 2020 05:10:48 -0400 Message-Id: <1602493854-29283-4-git-send-email-michael.chan@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1602493854-29283-1-git-send-email-michael.chan@broadcom.com> References: <1602493854-29283-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. v2: Change the fall back bnxt_reset_task() inside bnxt_rx_ring_reset() to silent mode. With older fw, we would take the fall back path and it would be very noisy. Reviewed-by: Edwin Peer Reviewed-by: Vasundhara Volam Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index d4402a2cd07f..bac1b713786c 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"); @@ -10753,7 +10754,7 @@ static void bnxt_rx_ring_reset(struct bnxt *bp) else netdev_warn(bp->dev, "RX ring reset failed, rc = %d, falling back to global reset\n", rc); - bnxt_reset_task(bp, false); + bnxt_reset_task(bp, true); break; } bnxt_free_one_rx_ring_skbs(bp, i); @@ -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 Mon Oct 12 09:10:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 270094 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 62B1BC433E7 for ; Mon, 12 Oct 2020 09:11:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1D1AF214D8 for ; Mon, 12 Oct 2020 09:11:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="OmQqaV3H" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729292AbgJLJLV (ORCPT ); Mon, 12 Oct 2020 05:11:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729273AbgJLJLU (ORCPT ); Mon, 12 Oct 2020 05:11:20 -0400 Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB539C0613D0 for ; Mon, 12 Oct 2020 02:11:19 -0700 (PDT) Received: by mail-pf1-x442.google.com with SMTP id b26so12944234pff.3 for ; Mon, 12 Oct 2020 02:11:19 -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=cR27gV077Qe43s3jKK+9o+jLch3DBwZ/pJ5X76wDrf0=; b=OmQqaV3H2sk3BM6+EITQm8DJY+YTsGDQshkioUWF88z+971YouTnFrUwWg03CxZQl8 ONAUzRVWVTvvvUuzrtqOWEot3nPHMCMj2HJY6Hc886ZLo2ftjvFnAyBdXriqiP4XZkKG JNZiEuB6GjTTJpX9Uwacz7Cw3npKAhe6XTVAk= 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=cR27gV077Qe43s3jKK+9o+jLch3DBwZ/pJ5X76wDrf0=; b=q8yKKU+dpncvQXnmJ6RZJUR5mGwuAdhO7/IFk0gbAh7oIz3Tmt2xTJAvt4aWvhWRCn EU9cnCh5YOItURe0nHt1YI8a/VS+CwrfVSmVEgBzKHf5WtjK/uGeGJDKMptxGPDSpTTA JYuYiJ+pxFWeWTE82yH5H8vM4abxr7GQ8Hez6JYeXlh/f61AEv2Se8mrMJLLAgFYgerY EOB1peMAJHzoFHih3fBdHm/nDqdxvbHebKhmAe2TUTVQoElJWB1kGfwnIo7WHdWvSRan zrfArzAkXZRXYNu9+HECb4JLPogWeImi0FQu7+hXu/rWpFkx539bD/r6M0Cb3mn7MPCN m1gQ== X-Gm-Message-State: AOAM532KBvkYSEkFmN/EW7L9627MKAMGeQe58jNtbJdrEvYFu/8nAgmu y5oHmowenHQSupTElYrCXy+3fA== X-Google-Smtp-Source: ABdhPJxJmpB9wsoiG9y4nx6RLhiHcaUe7N/XgUtDtoSx7/w+135D2/bJqpFQp5mX96+OUBsOSurkCQ== X-Received: by 2002:a17:90a:1b45:: with SMTP id q63mr18283436pjq.21.1602493879265; Mon, 12 Oct 2020 02:11:19 -0700 (PDT) Received: from localhost.swdvt.lab.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id jy19sm1275932pjb.9.2020.10.12.02.11.18 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Oct 2020 02:11:18 -0700 (PDT) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, kuba@kernel.org, gospo@broadcom.com Subject: [PATCH net-next v2 4/9] bnxt_en: Simplify bnxt_async_event_process(). Date: Mon, 12 Oct 2020 05:10:49 -0400 Message-Id: <1602493854-29283-5-git-send-email-michael.chan@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1602493854-29283-1-git-send-email-michael.chan@broadcom.com> References: <1602493854-29283-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 bac1b713786c..293af0d48028 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 Mon Oct 12 09:10:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 288564 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 E0D41C433DF for ; Mon, 12 Oct 2020 09:11:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 83DED20E65 for ; Mon, 12 Oct 2020 09:11:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="KlC9TOFP" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729308AbgJLJLX (ORCPT ); Mon, 12 Oct 2020 05:11:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729223AbgJLJLV (ORCPT ); Mon, 12 Oct 2020 05:11:21 -0400 Received: from mail-pf1-x42b.google.com (mail-pf1-x42b.google.com [IPv6:2607:f8b0:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7ADFAC0613CE for ; Mon, 12 Oct 2020 02:11:21 -0700 (PDT) Received: by mail-pf1-x42b.google.com with SMTP id w21so12924571pfc.7 for ; Mon, 12 Oct 2020 02:11: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=51Z5NBF4chpnkHRNT6LoiowC5yr3V2WfPcKwftONxbE=; b=KlC9TOFPvLjEUhCv+f5e6MBI52rGgf2cd+HxKYSpKUi1T21DrFieVDCy9yUoulO7ZO 3s2U+QrLZIP88P3tPE5I2EH7MhQCFAMTuRo/EDQBm/fE9jpVUT7bo2V5laKlHM4YBgOU ux4e591B8HhaXurJnEHNnjd2WSwisAVATbQ5I= 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=51Z5NBF4chpnkHRNT6LoiowC5yr3V2WfPcKwftONxbE=; b=rDXpZYZNS2nc817CzTTRrIAq70PhNTngBmenFL5k1buJqoNRDDZQ48aYjIks6g8HiV OndIMQPu3pNU6h+l14tefNVj4PBkhaZGdsUFMgY1cOjGG5A1FMk10sWA5q7p7VhfPHY0 FZ3Q3+UZD9Pkmm+Wdv938zai1jLt0Vs4d0TSFsZBNEKXfSdokouLrryTg1Ois0issV1k +ibVv7K13CokkFK2npnq6wMtqKoBN8UJ14djHfy6MUkb8MW6cLCGhKfjXjMzjuOhZeAh s6Rw9pei9ZpjiVJrbsSsgu2vlkL5/ddcm8GPZFTHu/gFAAgZBtEoJNBHl99Xf8YIXaYI PdoA== X-Gm-Message-State: AOAM5300SxEmukncdiNrYT4cr63TNQhkCURBOTDQgIan7TpCDKj+/qA3 G3E/RyFIEiSJ3mUDxb5ToLDD1Q== X-Google-Smtp-Source: ABdhPJxY0DQf8iXUP3d9aIp2E5OlUHrDcELXTUNR5Jl3lz7M5Bt+LBV7qREMpcObnEt40ujvIQpfDw== X-Received: by 2002:a17:90a:f3d3:: with SMTP id ha19mr19091277pjb.58.1602493880858; Mon, 12 Oct 2020 02:11:20 -0700 (PDT) Received: from localhost.swdvt.lab.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id jy19sm1275932pjb.9.2020.10.12.02.11.19 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Oct 2020 02:11:19 -0700 (PDT) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, kuba@kernel.org, gospo@broadcom.com Subject: [PATCH net-next v2 5/9] bnxt_en: Log event_data1 and event_data2 when handling RESET_NOTIFY event. Date: Mon, 12 Oct 2020 05:10:50 -0400 Message-Id: <1602493854-29283-6-git-send-email-michael.chan@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1602493854-29283-1-git-send-email-michael.chan@broadcom.com> References: <1602493854-29283-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 293af0d48028..877efaf302ad 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 Mon Oct 12 09:10:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 270091 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 EA9C7C433E7 for ; Mon, 12 Oct 2020 09:11:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9C31A208D5 for ; Mon, 12 Oct 2020 09:11:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="SL1sRvgW" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729353AbgJLJLf (ORCPT ); Mon, 12 Oct 2020 05:11:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729307AbgJLJLX (ORCPT ); Mon, 12 Oct 2020 05:11:23 -0400 Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E5C82C0613CE for ; Mon, 12 Oct 2020 02:11:22 -0700 (PDT) Received: by mail-pf1-x442.google.com with SMTP id 10so3408338pfp.5 for ; Mon, 12 Oct 2020 02:11: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=UU/g7YEFTk/ndn0PxJ17rq21QQR5DSWFBRCbBKIsEpA=; b=SL1sRvgWa6+s1iwq8JZXsmpZWspTsy/w7AwjL2U6+Jjc1AKFHcUfem9BSRA2NkXg7n bYr83RLxE5MGAf6gU9o8q5FJopp8Y7laW944SJ/4Doal6/htDkixl2Cv6ixpylu14B74 VabHjDiPJmbL8TyXGgKi8IgfBCLbM6ChR3BRI= 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=UU/g7YEFTk/ndn0PxJ17rq21QQR5DSWFBRCbBKIsEpA=; b=Kzr3LZvaiQQ+NPnMJTwaWARNgIZo5lierBxURa6pNkn1k+fWdNZ1L5JmkHh/3gjGWA Ma6WEu1RXE5tRoWWaC2tYd1/087icY5sUtbt4sQKiZGILvqIuwHVFxudxGVhUZqTYWmb 9i3ydjRvCjBsmTbir6P8/l8R6Xg71/fGt70za8ro2ssdSfbUodlyvFqKZ0spNKAMpfkt BAI5r8YYq3doIn3yLXOB65F5F1Al+5FW6e6wnrV7ztsPju/1Y6AxGLLyHjgaZk7hetI0 Sm5kxa8Sx4zQTLtg6wqdwMbTjooQ6yrd7PztfORz8D9DzV92nzg/rYDoK8rgwKp+Y+dc bVwg== X-Gm-Message-State: AOAM531i7XB8pmIuMrg1g3e7iucbhokLW5vHpoou3UmVuKS5cNOfZn5H dZI46z12nNVZd7m3T17fItJgqw== X-Google-Smtp-Source: ABdhPJw9ee3vg3kFOCf3w0N0sURIH8onF01wgwfsaPI9bcZBgbu911kyrp30KBRqUcoeGFU3nd3zjQ== X-Received: by 2002:a63:5446:: with SMTP id e6mr12365348pgm.415.1602493882314; Mon, 12 Oct 2020 02:11:22 -0700 (PDT) Received: from localhost.swdvt.lab.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id jy19sm1275932pjb.9.2020.10.12.02.11.20 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Oct 2020 02:11:21 -0700 (PDT) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, kuba@kernel.org, gospo@broadcom.com Subject: [PATCH net-next v2 6/9] bnxt_en: Log unknown link speed appropriately. Date: Mon, 12 Oct 2020 05:10:51 -0400 Message-Id: <1602493854-29283-7-git-send-email-michael.chan@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1602493854-29283-1-git-send-email-michael.chan@broadcom.com> References: <1602493854-29283-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 877efaf302ad..78bf636e623b 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 Mon Oct 12 09:10:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 288563 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 8BE4FC433E7 for ; Mon, 12 Oct 2020 09:11:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3D81720790 for ; Mon, 12 Oct 2020 09:11:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="QfWOtDHP" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729361AbgJLJLf (ORCPT ); Mon, 12 Oct 2020 05:11:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729223AbgJLJLY (ORCPT ); Mon, 12 Oct 2020 05:11:24 -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 6EA85C0613D0 for ; Mon, 12 Oct 2020 02:11:24 -0700 (PDT) Received: by mail-pg1-x541.google.com with SMTP id b193so12751828pga.6 for ; Mon, 12 Oct 2020 02:11: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=w/l6UjjGVDjvMkYct8wvf/TQlsuPRHwH57knBcEPQhU=; b=QfWOtDHPHg1Yu11TRiCiHQvXs0E+3aSkV+8kaP2nRUhnljk9qdg6As9n2zIrjQyPxC 3bZGiSOcgZ/O9Xh7H0xRlPXPh4syQ33f530i+5092ZBnaeq1EuNADUCv4gpmsrhA5WzE 9A8JkJNbGwPpocTzVLjYRLMiXcrJfeX2F4D4s= 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=w/l6UjjGVDjvMkYct8wvf/TQlsuPRHwH57knBcEPQhU=; b=MJpo8qTknW3Zl4yFFDRDfhg74GuP1vpD5OG/jw2eI/YqmsRXzS1QlwV6ZULnGUDhz9 BrXqXKGr9U3M/u2CjLnOcum1LFQM+cVDELmuhP6roKpJKo1t+cjMv6CHHYwN2suOFtrE 23aopJ3uRvnSMFgJULAl9UYKBLJSwQ1eGXwBGoHhYj94m5eXVqQRuWi1t+sw9wu3gT1d cRDDk5f2gwWJfwBP1V/MDdgJmq06geXpjheFpXE16l7EtMzkrI0JYtDMFA6yeJ3JPVQq G/Ryb+slJPMOXAUjmaLFp905d9F8JLSnHG2NME449RwbKOy45KpXnH5aM0AgV/tmuICc 0P2g== X-Gm-Message-State: AOAM530potykS/p/nvV9AzhPLOT2RBk+hbuduOlm0IrMqXHqzOzXWC4u zbs2RsLQualQS6ANOScbqDPw+w== X-Google-Smtp-Source: ABdhPJyF4bz3CIdRbR4xh1k6c1/V+r75RK64yGSzziuKo+YAHYBvDVMVkWOncAGDIIL50UPib/BEDg== X-Received: by 2002:a17:90a:a111:: with SMTP id s17mr19333783pjp.28.1602493883739; Mon, 12 Oct 2020 02:11:23 -0700 (PDT) Received: from localhost.swdvt.lab.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id jy19sm1275932pjb.9.2020.10.12.02.11.22 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Oct 2020 02:11:22 -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 v2 7/9] bnxt_en: Add bnxt_hwrm_nvm_get_dev_info() to query NVM info. Date: Mon, 12 Oct 2020 05:10:52 -0400 Message-Id: <1602493854-29283-8-git-send-email-michael.chan@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1602493854-29283-1-git-send-email-michael.chan@broadcom.com> References: <1602493854-29283-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 78bf636e623b..fa147865e33f 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 Mon Oct 12 09:10: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: 270092 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 536C9C43457 for ; Mon, 12 Oct 2020 09:11:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DF6D420790 for ; Mon, 12 Oct 2020 09:11:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="JVoNzoBB" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729370AbgJLJLg (ORCPT ); Mon, 12 Oct 2020 05:11:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45946 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729311AbgJLJL0 (ORCPT ); Mon, 12 Oct 2020 05:11:26 -0400 Received: from mail-pg1-x534.google.com (mail-pg1-x534.google.com [IPv6:2607:f8b0:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2EE4C0613D1 for ; Mon, 12 Oct 2020 02:11:25 -0700 (PDT) Received: by mail-pg1-x534.google.com with SMTP id i2so13635700pgh.7 for ; Mon, 12 Oct 2020 02:11: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=FdEWMIe9FxulTEz8KTBM9K8ZPg7S8FPQP/yLDE/IWSk=; b=JVoNzoBBkgMuSlnMuWjGyuwc2+iqK4hAUeC5QpY3BALgRbNh0pcziaLiSdAU0Gc4Lp 6YQiipSq4KgmBUvZXoZnq9xteIG270gL5xbEkLPXecRsJeV9JpvA0SVfCd6KjowM2JC+ JVs1uS0i0vT2xDTO3O2u4OSKYwPvL1HhWZ+Zk= 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=FdEWMIe9FxulTEz8KTBM9K8ZPg7S8FPQP/yLDE/IWSk=; b=jdJJY1X3IAyinyqMrH+cnWVXq04EkKdmf6t4e2yh0NHlfF56KSxc3yLJc+CkQDVjHK Z77rCcAkQsPVwt0wpHzgScLsKfdLT30U4K2Af9oXiEW6wTWqj5di6pWjiYU5KJ/rndC+ +BBkntezig6wPzRQmqzvlfYvP3WG5p21PzKb89gUWjPBYGlBd1vNatCIqHzDSoQV8CM7 kaswpvDj9RgFeW2RRfMrK7bHeyhdTXy0+Wr24YnlNp/Il1stv4isI5ZuP6rM3fcO8X9e BKFnoBL/B9aZpH8eO/NXadvhopSK/KuQNbZUc1JMZpOK0Gkxm8FeBDE0v5d0UGriFl7w QHLg== X-Gm-Message-State: AOAM5323bff1wVSHM6cY5BGqqZU7Utuir+KVIVKdWHmGdZfxS2/eUpIM 7Z1gTCZMcVBoNcs0ARaIc2OVtQ== X-Google-Smtp-Source: ABdhPJyOaTFNJrszymJisRletgWPa4MoZJevd1bXoPwzi/95e9KHeQgNfhDN0p/a50BbRs+WV3XuOA== X-Received: by 2002:a17:90a:6d26:: with SMTP id z35mr18552519pjj.41.1602493885187; Mon, 12 Oct 2020 02:11:25 -0700 (PDT) Received: from localhost.swdvt.lab.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id jy19sm1275932pjb.9.2020.10.12.02.11.23 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Oct 2020 02:11:24 -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 v2 8/9] bnxt_en: Refactor bnxt_dl_info_get(). Date: Mon, 12 Oct 2020 05:10:53 -0400 Message-Id: <1602493854-29283-9-git-send-email-michael.chan@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1602493854-29283-1-git-send-email-michael.chan@broadcom.com> References: <1602493854-29283-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. v2: Ensure active_pkg_name string is NULL terminated when copied to devlink. Return directly from the last call to bnxt_dl_info_put(). 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 | 113 ++++++++++-------- .../net/ethernet/broadcom/bnxt/bnxt_devlink.h | 6 + 2 files changed, 71 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..0be9b46baaca 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c @@ -382,6 +382,31 @@ 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; +} + +#define HWRM_FW_VER_STR_LEN 16 + static int bnxt_dl_info_get(struct devlink *dl, struct devlink_info_req *req, struct netlink_ext_ack *extack) { @@ -390,7 +415,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 +423,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 +438,50 @@ 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; - } + buf[0] = 0; + strncat(buf, ver_resp->active_pkg_name, HWRM_FW_VER_STR_LEN); + rc = bnxt_dl_info_put(bp, req, BNXT_VERSION_RUNNING, + DEVLINK_INFO_VERSION_GENERIC_FW, buf); + 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 +489,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 +501,24 @@ 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; + return bnxt_dl_info_put(bp, req, BNXT_VERSION_RUNNING, + DEVLINK_INFO_VERSION_GENERIC_FW_ROCE, roce_ver); } 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 Mon Oct 12 09:10: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: 288562 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 76074C43467 for ; Mon, 12 Oct 2020 09:11:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1A16420790 for ; Mon, 12 Oct 2020 09:11:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="gmsr73QM" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729379AbgJLJLh (ORCPT ); Mon, 12 Oct 2020 05:11:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729343AbgJLJL1 (ORCPT ); Mon, 12 Oct 2020 05:11:27 -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 2F07FC0613D2 for ; Mon, 12 Oct 2020 02:11:27 -0700 (PDT) Received: by mail-pg1-x543.google.com with SMTP id n9so13637262pgf.9 for ; Mon, 12 Oct 2020 02:11: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=wKVcZbh83k6X/F14A+ztOkjMdocn7bFn38YmFQmh5vQ=; b=gmsr73QMhy44nj2bUAT5Nu2x64BPwQjJKIgVIdVt0t+0Puc+DBwhg+nUVlg7ejQVeQ oHj9vPjQ2uneN1RI8kymY9G+B/7tpXU1NxarTKjif82tj9rQRL/S2lmetE8Lxg8O68Qr ezRpzMOYDMxZX22wG/jfMbGN4zBQVHXeZx3BU= 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=wKVcZbh83k6X/F14A+ztOkjMdocn7bFn38YmFQmh5vQ=; b=E+AyX7mFuk5aI7aWRr6VHKI9iIFymoVLxWQcc2ws2VMqA2FE63mOGO0Byc8HzU/gc1 Vi34FByUMjH25s2o6XcEmm4MA/pMNY9I6ov2G9cj6RAUKeS/A7VuI71tNnH8bgq5pidw AmVap5B+eCMh7lM/hAYZjNE0jQMR6Ez8mmUuSMSBtW9+Qa/Sh1ZleDRXNzWU3D1bjQtS 81p1bRh1631nPGlhz8ATzZuKB4iwfjNc5IWcO42yctGa7Ykz6ldI2Rb4grNUrgxlB16m Wez4jcYxBUS5ZY6/0nsZYuD7fyzLV9Ocir4pJNMYJuWD33Lk2QhQPuVjagy3HYYnY5eP 3ilg== X-Gm-Message-State: AOAM532sz0rrdUStVf9UHiI8AHZXGSVgXsuHNHbOqR4SXX0dpXMekgPt 2to28uLWm38CtbLcsG2+oXbl/5LgDShkdQ== X-Google-Smtp-Source: ABdhPJy978tl0KNWJ9glZaS9pIMPXOl7V5IExBq5LgvETfdBAkg/9gextptUIFj05UF6ckNwpuwCjw== X-Received: by 2002:a62:ab0e:0:b029:156:1dfe:ae74 with SMTP id p14-20020a62ab0e0000b02901561dfeae74mr3729906pff.7.1602493886539; Mon, 12 Oct 2020 02:11:26 -0700 (PDT) Received: from localhost.swdvt.lab.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id jy19sm1275932pjb.9.2020.10.12.02.11.25 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Oct 2020 02:11:25 -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 v2 9/9] bnxt_en: Add stored FW version info to devlink info_get cb. Date: Mon, 12 Oct 2020 05:10:54 -0400 Message-Id: <1602493854-29283-10-git-send-email-michael.chan@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1602493854-29283-1-git-send-email-michael.chan@broadcom.com> References: <1602493854-29283-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. v2: Ensure stored pkg_name string is NULL terminated when copied to devlink. Return directly from the last call to bnxt_dl_info_put(). If the FW call to get stored version fails for any reason, return success immediately to devlink without the stored versions. Reviewed-by: Andy Gospodarek Signed-off-by: Vasundhara Volam Signed-off-by: Michael Chan --- .../net/ethernet/broadcom/bnxt/bnxt_devlink.c | 47 ++++++++++++++++++- 1 file changed, 45 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c index 0be9b46baaca..184b6d0513b2 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c @@ -410,6 +410,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; @@ -457,6 +458,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; + buf[0] = 0; strncat(buf, ver_resp->active_pkg_name, HWRM_FW_VER_STR_LEN); rc = bnxt_dl_info_put(bp, req, BNXT_VERSION_RUNNING, @@ -469,7 +476,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) @@ -517,7 +524,43 @@ static int bnxt_dl_info_get(struct devlink *dl, struct devlink_info_req *req, if (rc) return rc; - return bnxt_dl_info_put(bp, req, BNXT_VERSION_RUNNING, + 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 || + !(nvm_dev_info.flags & NVM_GET_DEV_INFO_RESP_FLAGS_FW_VER_VALID)) + return 0; + + buf[0] = 0; + strncat(buf, nvm_dev_info.pkg_name, HWRM_FW_VER_STR_LEN); + rc = bnxt_dl_info_put(bp, req, BNXT_VERSION_STORED, + DEVLINK_INFO_VERSION_GENERIC_FW, buf); + 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); + return bnxt_dl_info_put(bp, req, BNXT_VERSION_STORED, DEVLINK_INFO_VERSION_GENERIC_FW_ROCE, roce_ver); }