From patchwork Mon Sep 21 01:08: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: 260521 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=-14.4 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, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, 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 558F2C43463 for ; Mon, 21 Sep 2020 01:09:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 13840207EA for ; Mon, 21 Sep 2020 01:09:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="PoA65iQM" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726427AbgIUBJZ (ORCPT ); Sun, 20 Sep 2020 21:09:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726406AbgIUBJW (ORCPT ); Sun, 20 Sep 2020 21:09:22 -0400 Received: from mail-pj1-x1042.google.com (mail-pj1-x1042.google.com [IPv6:2607:f8b0:4864:20::1042]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C206C061755 for ; Sun, 20 Sep 2020 18:09:22 -0700 (PDT) Received: by mail-pj1-x1042.google.com with SMTP id q4so6525170pjh.5 for ; Sun, 20 Sep 2020 18:09: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=rUPXZxRAsOrdjtI8FJ/7PvDPSOQH23Sj2mLwzIQCB9E=; b=PoA65iQM3R5AhGSjf3x/1AGi3xqOhrHX+tVFv11GNAksr51yeCTXYaYeOykn0lMfQT KACkZhhdVn1BRp3Sx0S5lDMZTm+EMvaMRo21aaLVBrBxBe05N4mhd1Ic2WdOh5bams49 dvdzpTTzi5JVTY8vQDrQHUWVyhs1Vx68g7TiU= 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=rUPXZxRAsOrdjtI8FJ/7PvDPSOQH23Sj2mLwzIQCB9E=; b=fVMvyQrxG9mJ5dJdkptqrYG3M3mdADs54KM/occ0YZ5fOSY5JI7+j1IcbV/O1ASx+K CmvXOY6SZcpGkIfCimhqwTbwpMo2ksEUYoeYAWKfJ/F35b7nkmo/IVgK6notMWOhWc3A /XjRKoHtS2JR9kltGWC2sQwDPwAsti7wr7g8VFbnkHQ6Hqzej9UKdpKBuMUtea/OOKYZ cUqpOFbyTqJkMxKvi2YA3yTw5fipkeK3mISHKiFCuYo+zrzPrLL25luXOXL7NuXjPSC/ o3AaJcFJFDtFgt0zMdbrkTM5wnzj0bvh25l+BFTy0iiALR6/c3RnduBvp8g980OeffwX gI/Q== X-Gm-Message-State: AOAM5328uAqUInl0MZsWeQV2t2dHydcDKAXpN42NCesYDShIqQe29dZk Ma35Z5vP+R+bw25VstOO2w/ZLg== X-Google-Smtp-Source: ABdhPJwqnx7eYoqe1bY+/SwJ1EqSorVD9AN/XzlRa19OsCAjTDjjTyymdEzwBLM4rTMdfSdiLA1X+Q== X-Received: by 2002:a17:90a:ee0d:: with SMTP id e13mr23878138pjy.227.1600650561366; Sun, 20 Sep 2020 18:09:21 -0700 (PDT) Received: from localhost.swdvt.lab.broadcom.com ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id bt13sm9098095pjb.23.2020.09.20.18.09.20 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 20 Sep 2020 18:09:20 -0700 (PDT) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, kuba@kernel.org, Edwin Peer Subject: [PATCH net 2/6] bnxt_en: return proper error codes in bnxt_show_temp Date: Sun, 20 Sep 2020 21:08:55 -0400 Message-Id: <1600650539-19967-3-git-send-email-michael.chan@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1600650539-19967-1-git-send-email-michael.chan@broadcom.com> References: <1600650539-19967-1-git-send-email-michael.chan@broadcom.com> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Edwin Peer Returning "unknown" as a temperature value violates the hwmon interface rules. Appropriate error codes should be returned via device_attribute show instead. These will ultimately be propagated to the user via the file system interface. In addition to the corrected error handling, it is an even better idea to not present the sensor in sysfs at all if it is known that the read will definitely fail. Given that temp1_input is currently the only sensor reported, ensure no hwmon registration if TEMP_MONITOR_QUERY is not supported or if it will fail due to access permissions. Something smarter may be needed if and when other sensors are added. Fixes: 12cce90b934b ("bnxt_en: fix HWRM error when querying VF temperature") Signed-off-by: Edwin Peer Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 4af42b1..2865e24 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -9311,18 +9311,16 @@ static ssize_t bnxt_show_temp(struct device *dev, struct hwrm_temp_monitor_query_output *resp; struct bnxt *bp = dev_get_drvdata(dev); u32 len = 0; + int rc; resp = bp->hwrm_cmd_resp_addr; bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_TEMP_MONITOR_QUERY, -1, -1); mutex_lock(&bp->hwrm_cmd_lock); - if (!_hwrm_send_message_silent(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT)) + rc = _hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT); + if (!rc) len = sprintf(buf, "%u\n", resp->temp * 1000); /* display millidegree */ mutex_unlock(&bp->hwrm_cmd_lock); - - if (len) - return len; - - return sprintf(buf, "unknown\n"); + return rc ?: len; } static SENSOR_DEVICE_ATTR(temp1_input, 0444, bnxt_show_temp, NULL, 0); @@ -9342,7 +9340,16 @@ static void bnxt_hwmon_close(struct bnxt *bp) static void bnxt_hwmon_open(struct bnxt *bp) { + struct hwrm_temp_monitor_query_input req = {0}; struct pci_dev *pdev = bp->pdev; + int rc; + + bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_TEMP_MONITOR_QUERY, -1, -1); + rc = hwrm_send_message_silent(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT); + if (rc == -EACCES || rc == -EOPNOTSUPP) { + bnxt_hwmon_close(bp); + return; + } if (bp->hwmon_dev) return; From patchwork Mon Sep 21 01:08: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: 260519 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=-14.4 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, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, 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 86714C43463 for ; Mon, 21 Sep 2020 01:09:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4BDFD20866 for ; Mon, 21 Sep 2020 01:09:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="dh39rSBe" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726457AbgIUBJc (ORCPT ); Sun, 20 Sep 2020 21:09:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726417AbgIUBJY (ORCPT ); Sun, 20 Sep 2020 21:09:24 -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 33929C061755 for ; Sun, 20 Sep 2020 18:09:24 -0700 (PDT) Received: by mail-pg1-x543.google.com with SMTP id 34so7505284pgo.13 for ; Sun, 20 Sep 2020 18:09: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=Ifa1kfCGMDEbztGkaaw8oAQMP2MNzCYZiuiTMyKsoSw=; b=dh39rSBeBciCJRw8lsnAll4FAJokxDJt6Vpj1Wm1sFTQEKNcqvmp7cE3IOsu29b7Xv OPVXlft+PBebx2EQVz2Yv39bnoGT8H6I27t3tgysC3ugcLLy6qeJK67LoVoUifxFRbFe Uw5uXb6QhjUcF0fIkDKdeD+Hxjk1OrtDlM49w= 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=Ifa1kfCGMDEbztGkaaw8oAQMP2MNzCYZiuiTMyKsoSw=; b=JhYj6N8btTbQErtf+8/ORzyeWfQ6/g4nO1dU5dTsfyVaT7NKguvkDlxb3C4o2JTkT7 lYVQ3qn+CEUJW4QZH3aQPBQda2m6yeZgNEDvZBm6KdGoN0xYw7SwervIdfakTOjk6e+2 JxLlbNEl3HvOZk6o9REFHv6t4lrfn6huS9VE4M5H+veZHury1EVVuqddR41vDr6UEpqD 7n8A/PU3FI0LaZsghXi/zAZHT2tP0HU204oGC7ik7O4CYsHOhaObX4oWEwK1S8q5nvmd h2ayoviUVbcP359CqSpFVT5mn8uiJBDzmAfKroR+FfzDNaz5C0Lh+pLtLBB59VlR1GXi J/+w== X-Gm-Message-State: AOAM531MkwtAnrexd0AJmi6cY9EmnnrSJLR2kaBRUD6lBQ3W2xXcltu8 rN3Nnv0dbkac6a+oKHfJGnzeqw== X-Google-Smtp-Source: ABdhPJxkGJnP2mTpxQraOZKtXGqYY/WFYCggDXy34hThi+5miwK5S2ftKHJVpRiSe3lj77TGnP5Sfg== X-Received: by 2002:aa7:908b:0:b029:142:2501:34ee with SMTP id i11-20020aa7908b0000b0290142250134eemr25148088pfa.71.1600650563609; Sun, 20 Sep 2020 18:09:23 -0700 (PDT) Received: from localhost.swdvt.lab.broadcom.com ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id bt13sm9098095pjb.23.2020.09.20.18.09.22 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 20 Sep 2020 18:09:22 -0700 (PDT) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, kuba@kernel.org, Vasundhara Volam Subject: [PATCH net 4/6] bnxt_en: Return -EOPNOTSUPP for ETHTOOL_GREGS on VFs. Date: Sun, 20 Sep 2020 21:08:57 -0400 Message-Id: <1600650539-19967-5-git-send-email-michael.chan@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1600650539-19967-1-git-send-email-michael.chan@broadcom.com> References: <1600650539-19967-1-git-send-email-michael.chan@broadcom.com> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Vasundhara Volam Debug firmware commands are not supported on VFs to read registers. This patch avoids logging unnecessary access_denied error on VFs when user calls ETHTOOL_GREGS. By returning error in get_regs_len() method on the VF, the get_regs() method will not be called. Fixes: b5d600b027eb ("bnxt_en: Add support for 'ethtool -d'") Signed-off-by: Vasundhara Volam Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c index 6c75101..fecdfd8 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c @@ -1322,6 +1322,9 @@ static int bnxt_get_regs_len(struct net_device *dev) struct bnxt *bp = netdev_priv(dev); int reg_len; + if (!BNXT_PF(bp)) + return -EOPNOTSUPP; + reg_len = BNXT_PXP_REG_LEN; if (bp->fw_cap & BNXT_FW_CAP_PCIE_STATS_SUPPORTED) From patchwork Mon Sep 21 01:08: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: 260520 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=-14.4 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, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, 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 4DC83C43463 for ; Mon, 21 Sep 2020 01:09:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F176920866 for ; Mon, 21 Sep 2020 01:09:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="IRJWcYiH" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726445AbgIUBJ3 (ORCPT ); Sun, 20 Sep 2020 21:09:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726430AbgIUBJZ (ORCPT ); Sun, 20 Sep 2020 21:09:25 -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 74C86C0613CE for ; Sun, 20 Sep 2020 18:09:25 -0700 (PDT) Received: by mail-pg1-x544.google.com with SMTP id u13so7539481pgh.1 for ; Sun, 20 Sep 2020 18:09: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=NpE1OCsFU+Vtyk8DXmhKbmxeWvTYioTM7yOEKEB1nu4=; b=IRJWcYiH22HGWVpaWUcruOJ32PprMeMo4s8USWWowzaJ1HKeaCgGtjDwYabB8p8Dd0 x94HYDaCJJwcyko6Zd/ixzxQw42S+H7Jh3XOzGkntT9EuuI7raerIAOvpEFVyuujHnQC /pEarhH5xw99mKIgBci0EBPHqniErKdm5L8vA= 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=NpE1OCsFU+Vtyk8DXmhKbmxeWvTYioTM7yOEKEB1nu4=; b=ozefKT0PLl+F840ulvrn1n8e3ZP9jxEXf2vMd0ItkUnrtB9JQOGJkAXC5F4Ct12I2I qV8U8hjsCUACuXzQJ2N7EXgxNZ2VmCKTjQX1F1XrewBAdH0x3VWTcWEfQZ5cHFw3uzH6 i/y+LhI9TIjh8ssaxEtTUoe9zjVdojee24CleUB1tBVRFbNWTB1tv6yhiis4sFqEGLrD qlERqXsXuLzcBtJOIw+30QZ1tMRlXUYRG8OYElBoQ01qdclBbpObD536g78ikBgWjtCb fMpMb2sDhDkbSIlsVobCBo0MDNbHrpLCWM6cbeK5aQX3ZSkZFcpd+sH9RrxlXXG499Iy hHRw== X-Gm-Message-State: AOAM532ZqU05l8M63BqYwk9AzTh2LSE951aPqqL64lggSqQ+AGPf1tMA wdRsF5Ae9pSwVtcYY5pxEaJ58Fjy9KTskg== X-Google-Smtp-Source: ABdhPJzaFNg/GhDPHiyJI6PDHDZUbaYhUnbVPDwgC38iHEq3O/J6Ctl+EYUKCb1XpiYIdYdDvBLrhg== X-Received: by 2002:aa7:9583:0:b029:142:2501:396a with SMTP id z3-20020aa795830000b02901422501396amr25345538pfj.47.1600650564807; Sun, 20 Sep 2020 18:09:24 -0700 (PDT) Received: from localhost.swdvt.lab.broadcom.com ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id bt13sm9098095pjb.23.2020.09.20.18.09.23 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 20 Sep 2020 18:09:24 -0700 (PDT) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, kuba@kernel.org Subject: [PATCH net 5/6] bnxt_en: Fix HWRM_FUNC_QSTATS_EXT firmware call. Date: Sun, 20 Sep 2020 21:08:58 -0400 Message-Id: <1600650539-19967-6-git-send-email-michael.chan@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1600650539-19967-1-git-send-email-michael.chan@broadcom.com> References: <1600650539-19967-1-git-send-email-michael.chan@broadcom.com> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Fix it to set the required fid input parameter. The firmware call fails without this patch. Fixes: d752d0536c97 ("bnxt_en: Retrieve hardware counter masks from firmware if available.") Reviewed-by: Edwin Peer Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 2865e24..d527c9c 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -3782,6 +3782,7 @@ static int bnxt_hwrm_func_qstat_ext(struct bnxt *bp, return -EOPNOTSUPP; bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_FUNC_QSTATS_EXT, -1, -1); + req.fid = cpu_to_le16(0xffff); req.flags = FUNC_QSTATS_EXT_REQ_FLAGS_COUNTER_MASK; mutex_lock(&bp->hwrm_cmd_lock); rc = _hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);