From patchwork Tue Dec 17 18:26:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 13912400 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8F8BE1F8930 for ; Tue, 17 Dec 2024 18:27:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734460025; cv=none; b=LcA1/V1Z3k+HzzFu2XfyJgrbmLRMoEkXpsO9mctYxpgA+DuwE9DPIThJmBgbH1qB1RAXoOhRyQ42vcuSDHtnJK+UF28i+tXcYx4XQPblqQS5yOT3XLq1mQUftIg1tK+5hmyidf89fmtFF+ShaO8JjucSPPYQ5HW9ILn0MwHmbYQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734460025; c=relaxed/simple; bh=ZTSBeoNYM5iuQnBZrcSyHM59ujLcUngYFpbh0rRDZ3E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JH+8ajsGI5i8NZqyt9pf8cVPBB5oAp3M89HbwZ72wCIv8heTfsdShG55cKi6LIMKBwkdkb0bUgT8B/hd9onhUKFz01jp1HMoud8bX+vfp5LRs2EelPtNkxCbnZmMbtX2O+fWjohTBVNbRO9E3JtBD1PdpKBsdWHnU3LiBr4lYOQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com; spf=fail smtp.mailfrom=broadcom.com; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b=HCxAshJD; arc=none smtp.client-ip=209.85.214.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="HCxAshJD" Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-216281bc30fso59068515ad.0 for ; Tue, 17 Dec 2024 10:27:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1734460023; x=1735064823; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=JnrFzAMZ8v5VlMMYSKXe6yf+DpgsVC5sU2V1pw3sIL4=; b=HCxAshJDMdJNhH8pv5sDxO1EViaRCT9OFmORi4bYBSdN90YC6vbkrKzZG642QeoUTQ 6ycsexcrhaqxGo16u4lWXjQIFUNF1C2MatmgZJequxN0W+utDjaonET0Jbe94HrkmPWZ NdsppEvwc7g696vtqvdHyH0L2MIwk4zM3+75s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734460023; x=1735064823; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JnrFzAMZ8v5VlMMYSKXe6yf+DpgsVC5sU2V1pw3sIL4=; b=Du/8aUUBGcZiRS35Jhe/86+uXKgp8AsD4fzJwVSxgGbZW25h4QK8c5TcGiE+SHskxS n37swfpxIpeRIHGIgF1IWFUpzO5VDSjq1BTyQpGAXLxKgHsxhqlcqfD7IFmylqjoAL5q ufxDDBke1AqGZHu8WI74Vd66lWt5+Nzwz7P2+DwI16et7FYDYzGuYhwcxukeiTwxFhhH 73uvQgbKpL7r640QucFFUYIoZge+NVYcY7sXYYDtu8HP2iy9FxVvZCUu9r5aADeIN+io WNUGDITzjtouSGiAsBr25NN0oi915DLLr02si8WvyYOYZRlOO2tHEK7SmuKDzD4drpgN 7nfw== X-Gm-Message-State: AOJu0YyyC32oeCDH9R4u5DsDlKOQiX58hTyoNs52ZSRlU3nfknoVhNuA NAGsTUtW32NhF/898Zyou2iyrn4HizQGt5IgmmayiPqopv50B1uS75637Kkt4Q== X-Gm-Gg: ASbGnctEVlVGhuRAkb+lXpCYKeHIzqZcq1B7iGBNss0o0c3MWRSNuo5QYNGAEDakRHV 2ySMGVCwmGM9FQDmgHS0KcaZUu7Jabz4VR7ufh6y0k2t8iAWBXM5XZx1nPgPkT/iGy/aUb53IZI k4+VoJn33TwpVX50jLOKgNqqH7ra/si9UnZoEU3HemSoSUIOjRjIvV5gTiBp6bysWZXGFS6qvFS avNFS6zkxZ8RhVNTaaDdBsPKMbzX6E+YeBKuvQ+Dd6i6VT64sWnVQCXJc9OXVdKjZqS0+OXmpTx U0x94TbWtEQFFpJzf3k6B0jPzRSoThXh X-Google-Smtp-Source: AGHT+IH13FX+qr3yJHpQSF9362IRYBQCjHgFaRJkL/QM4ZfFDWU+ap9nOfeMwu654FCidEGrrWILgQ== X-Received: by 2002:a17:902:c40e:b0:215:a18f:88a8 with SMTP id d9443c01a7336-218d52d0775mr7485245ad.51.1734460022745; Tue, 17 Dec 2024 10:27:02 -0800 (PST) Received: from lvnvda3289.lvn.broadcom.net ([192.19.161.250]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-218a1e63af1sm62496595ad.226.2024.12.17.10.27.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Dec 2024 10:27:02 -0800 (PST) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, andrew+netdev@lunn.ch, pavan.chebbi@broadcom.com, andrew.gospodarek@broadcom.com, Hongguang Gao , Damodharam Ammepalli , Kalesh AP , Selvin Xavier Subject: [PATCH net-next v2 1/6] bnxt_en: Use FW defined resource limits for RoCE Date: Tue, 17 Dec 2024 10:26:15 -0800 Message-ID: <20241217182620.2454075-2-michael.chan@broadcom.com> X-Mailer: git-send-email 2.43.4 In-Reply-To: <20241217182620.2454075-1-michael.chan@broadcom.com> References: <20241217182620.2454075-1-michael.chan@broadcom.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org From: Hongguang Gao If FW supports setting resource limits for RoCE, then just use the FW limits instead of using some fixed values in the driver. These limits will be used to allocate context memory for QP, SRQ, AH, and MR resources for RoCE. Reviewed-by: Damodharam Ammepalli Reviewed-by: Kalesh AP Signed-off-by: Hongguang Gao Signed-off-by: Selvin Xavier Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 41 +++++++++++++------ drivers/net/ethernet/broadcom/bnxt/bnxt.h | 3 ++ drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c | 2 + drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.h | 2 + 4 files changed, 36 insertions(+), 12 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index b86f980fa7ea..469352ac1f7e 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -9117,10 +9117,18 @@ static int bnxt_alloc_ctx_mem(struct bnxt *bp) ena = 0; if ((bp->flags & BNXT_FLAG_ROCE_CAP) && !is_kdump_kernel()) { pg_lvl = 2; - extra_qps = min_t(u32, 65536, max_qps - l2_qps - qp1_qps); - /* allocate extra qps if fw supports RoCE fast qp destroy feature */ - extra_qps += fast_qpmd_qps; - extra_srqs = min_t(u32, 8192, max_srqs - srqs); + if (BNXT_SW_RES_LMT(bp)) { + extra_qps = max_qps - l2_qps - qp1_qps; + extra_srqs = max_srqs - srqs; + } else { + extra_qps = min_t(u32, 65536, + max_qps - l2_qps - qp1_qps); + /* allocate extra qps if fw supports RoCE fast qp + * destroy feature + */ + extra_qps += fast_qpmd_qps; + extra_srqs = min_t(u32, 8192, max_srqs - srqs); + } if (fast_qpmd_qps) ena |= FUNC_BACKING_STORE_CFG_REQ_ENABLES_QP_FAST_QPMD; } @@ -9156,14 +9164,20 @@ static int bnxt_alloc_ctx_mem(struct bnxt *bp) goto skip_rdma; ctxm = &ctx->ctx_arr[BNXT_CTX_MRAV]; - /* 128K extra is needed to accommodate static AH context - * allocation by f/w. - */ - num_mr = min_t(u32, ctxm->max_entries / 2, 1024 * 256); - num_ah = min_t(u32, num_mr, 1024 * 128); - ctxm->split_entry_cnt = BNXT_CTX_MRAV_AV_SPLIT_ENTRY + 1; - if (!ctxm->mrav_av_entries || ctxm->mrav_av_entries > num_ah) - ctxm->mrav_av_entries = num_ah; + if (BNXT_SW_RES_LMT(bp) && + ctxm->split_entry_cnt == BNXT_CTX_MRAV_AV_SPLIT_ENTRY + 1) { + num_ah = ctxm->mrav_av_entries; + num_mr = ctxm->max_entries - num_ah; + } else { + /* 128K extra is needed to accommodate static AH context + * allocation by f/w. + */ + num_mr = min_t(u32, ctxm->max_entries / 2, 1024 * 256); + num_ah = min_t(u32, num_mr, 1024 * 128); + ctxm->split_entry_cnt = BNXT_CTX_MRAV_AV_SPLIT_ENTRY + 1; + if (!ctxm->mrav_av_entries || ctxm->mrav_av_entries > num_ah) + ctxm->mrav_av_entries = num_ah; + } rc = bnxt_setup_ctxm_pg_tbls(bp, ctxm, num_mr + num_ah, 2); if (rc) @@ -9470,6 +9484,9 @@ static int __bnxt_hwrm_func_qcaps(struct bnxt *bp) bp->flags |= BNXT_FLAG_UDP_GSO_CAP; if (flags_ext2 & FUNC_QCAPS_RESP_FLAGS_EXT2_TX_PKT_TS_CMPL_SUPPORTED) bp->fw_cap |= BNXT_FW_CAP_TX_TS_CMP; + if (flags_ext2 & + FUNC_QCAPS_RESP_FLAGS_EXT2_SW_MAX_RESOURCE_LIMITS_SUPPORTED) + bp->fw_cap |= BNXT_FW_CAP_SW_MAX_RESOURCE_LIMITS; if (BNXT_PF(bp) && (flags_ext2 & FUNC_QCAPS_RESP_FLAGS_EXT2_ROCE_VF_RESOURCE_MGMT_SUPPORTED)) bp->fw_cap |= BNXT_FW_CAP_ROCE_VF_RESC_MGMT_SUPPORTED; diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethernet/broadcom/bnxt/bnxt.h index 7df7a2233307..3e20d200da62 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h @@ -2482,6 +2482,7 @@ struct bnxt { #define BNXT_FW_CAP_CFA_NTUPLE_RX_EXT_IP_PROTO BIT_ULL(38) #define BNXT_FW_CAP_CFA_RFS_RING_TBL_IDX_V3 BIT_ULL(39) #define BNXT_FW_CAP_VNIC_RE_FLUSH BIT_ULL(40) + #define BNXT_FW_CAP_SW_MAX_RESOURCE_LIMITS BIT_ULL(41) u32 fw_dbg_cap; @@ -2501,6 +2502,8 @@ struct bnxt { ((bp)->fw_cap & BNXT_FW_CAP_ENABLE_RDMA_SRIOV) #define BNXT_ROCE_VF_RESC_CAP(bp) \ ((bp)->fw_cap & BNXT_FW_CAP_ROCE_VF_RESC_MGMT_SUPPORTED) +#define BNXT_SW_RES_LMT(bp) \ + ((bp)->fw_cap & BNXT_FW_CAP_SW_MAX_RESOURCE_LIMITS) u32 hwrm_spec_code; u16 hwrm_cmd_seq; diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c index b771c84cdd89..94c6a0928ca0 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c @@ -416,6 +416,8 @@ static void bnxt_set_edev_info(struct bnxt_en_dev *edev, struct bnxt *bp) edev->flags |= BNXT_EN_FLAG_VF; if (BNXT_ROCE_VF_RESC_CAP(bp)) edev->flags |= BNXT_EN_FLAG_ROCE_VF_RES_MGMT; + if (BNXT_SW_RES_LMT(bp)) + edev->flags |= BNXT_EN_FLAG_SW_RES_LMT; edev->chip_num = bp->chip_num; edev->hw_ring_stats_size = bp->hw_ring_stats_size; diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.h b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.h index 5d6aac60f236..54ad9f8273d7 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.h +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.h @@ -65,6 +65,8 @@ struct bnxt_en_dev { #define BNXT_EN_FLAG_VF 0x10 #define BNXT_EN_VF(edev) ((edev)->flags & BNXT_EN_FLAG_VF) #define BNXT_EN_FLAG_ROCE_VF_RES_MGMT 0x20 + #define BNXT_EN_FLAG_SW_RES_LMT 0x40 +#define BNXT_EN_SW_RES_LMT(edev) ((edev)->flags & BNXT_EN_FLAG_SW_RES_LMT) struct bnxt_ulp *ulp_tbl; int l2_db_size; /* Doorbell BAR size in From patchwork Tue Dec 17 18:26:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 13912401 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C235F1F8AC5 for ; Tue, 17 Dec 2024 18:27:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734460026; cv=none; b=Bu83VRhq53y/T7gHhyUvt8VjnDEdlfULCdjJdZG4tV6O8CM2F+m9BKX1h2feZrcPLJ2E5hzB/YbAYwt2L2SCrNooAxVByS7sJtUExZLow4EC3ORj/cH1bLcf1fw9b9hRyM2LZSxe6Z18fgPzNQfmBsUrRgH9EhC5w8wZz8dK7q4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734460026; c=relaxed/simple; bh=ZweGCXd1EW/GWmNtMTzljVNuUYIEcIpE8pHAdMMLNNA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TjpgkUEFYcIvrRUVYV3Ro+XqMU0IBv/hzBVc4mt8TMY3I2+IC4WI9fsXb74FgiojFIxaOolvhEBUTqzul3RnwLj8EB4ttcEIr66SeFGgUkQk0D8ypLqtPMfDyhJf6yn3PAZg9i321v/6qHvi639dWqU13ZU5l/iXuw9+J4Ar+Wg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com; spf=fail smtp.mailfrom=broadcom.com; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b=faOryjcK; arc=none smtp.client-ip=209.85.214.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="faOryjcK" Received: by mail-pl1-f176.google.com with SMTP id d9443c01a7336-21636268e43so68820895ad.2 for ; Tue, 17 Dec 2024 10:27:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1734460024; x=1735064824; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=fs8h2SRGuE94I7/xtRIDkh4BWKrr3OhS0L8bXxaxNvk=; b=faOryjcKUgL5+1sR+orYQDLucRZOZDu56X1kEzCGSLYbTgkh7H/QgOODBrSzu0Hnz0 TJ0TVEV2UH7/d5Km1SzgZQ+Q8hX1P7XspUcPDOik9Cjn2Gnl9z1LN6COri2DOs2c6EtU +NI90FxXq/fqoKTe0A/By9zmKVoeQd7D/y+Hs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734460024; x=1735064824; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fs8h2SRGuE94I7/xtRIDkh4BWKrr3OhS0L8bXxaxNvk=; b=Y67UkwZnTPtxMW3GNyHh+v22a14rP+E8Xbs47O5zCY83RJa111+GVdDr3r5WtGC+dr LiDRWHj5bueElTXk/V0B+1AKVOJFLHpU1/6IeQfTLCSOQWZ+hwsX25QtgKNn/N8GJXsO Sgeuz6hX6muRpniGgNaEUMaCOL02V0pLaSf8F327s9+LmxK0aZQINe736KYkB/aHgf77 ysbwzfzgRUNEsg6DKD1MnJP396hZmRCi4vHVRifUJviJeVc/o0QlFEerlYN8icnfoyE+ yGb3DqQUe8AC3u24ZWoLe/IRC/aFw8mhplOeQhWv0yPVrFl1S88V6zJ9BXAQj9tcj3qO PsaA== X-Gm-Message-State: AOJu0Yw8kXiOHHubaV19xFBdePLiq+FmShzmXbJl+Vo5gXyx061P3opv 1B+DfxeKP1JwDAQaPtAh6cJt4vhR6XpUXNvgIWZFrk7ABJKafIPseLOmDMcU0w== X-Gm-Gg: ASbGnctKKRZ0PJnO4qHAmAz8bWSwNDCMguPxou9Hnkp0ZLnkrMfrKtw40NGjXzrgtpX fvrRRvf1Xtt3RIZUabjBIbL4xkJ+Fe+eDut1/XZirWKyMUWz7fVj5if30XvQCo6CZONTuSGO3Ye bOCUS/of5kR5dCAvwwu4jnH8mtb2hh1QO7v6WtMTMEzTWlLh4JrnezP3kJtLuRUlOSd33ssudIi JXbKF1l5ElcYEn75+IE/tpy9Vt1wAHdhrhVxLkANPlJJTr/CwrGTxRwrEAh3gmuprw1AfjPoZPk /tj3RxB1DLqD1OApHS5niMPblQCfr+EK X-Google-Smtp-Source: AGHT+IHuk7tQnXeI4AfH0FCV530BwwXzNYSR97SnritcqEB7Ur7Pr13WIZYPmSXu1a0igmZnZnpFYg== X-Received: by 2002:a17:902:e5c2:b0:216:2d42:2e05 with SMTP id d9443c01a7336-218929c34a2mr274988145ad.22.1734460023931; Tue, 17 Dec 2024 10:27:03 -0800 (PST) Received: from lvnvda3289.lvn.broadcom.net ([192.19.161.250]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-218a1e63af1sm62496595ad.226.2024.12.17.10.27.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Dec 2024 10:27:03 -0800 (PST) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, andrew+netdev@lunn.ch, pavan.chebbi@broadcom.com, andrew.gospodarek@broadcom.com, Kalesh AP , Ido Schimmel Subject: [PATCH net-next v2 2/6] bnxt_en: Do not allow ethtool -m on an untrusted VF Date: Tue, 17 Dec 2024 10:26:16 -0800 Message-ID: <20241217182620.2454075-3-michael.chan@broadcom.com> X-Mailer: git-send-email 2.43.4 In-Reply-To: <20241217182620.2454075-1-michael.chan@broadcom.com> References: <20241217182620.2454075-1-michael.chan@broadcom.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Block all ethtool module operations on an untrusted VF. The firmware won't allow it and will return error. Reviewed-by: Kalesh AP Reviewed-by: Pavan Chebbi Signed-off-by: Michael Chan --- v2: Use extack for bnxt_get_module_eeprom_by_page() Fix uninitialized variable Cc: Ido Schimmel --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 6 +++++- drivers/net/ethernet/broadcom/bnxt/bnxt.h | 5 +++++ drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 12 ++++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 469352ac1f7e..c0728d5ff8bc 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -8279,16 +8279,20 @@ static int bnxt_hwrm_func_qcfg(struct bnxt *bp) if (rc) goto func_qcfg_exit; + flags = le16_to_cpu(resp->flags); #ifdef CONFIG_BNXT_SRIOV if (BNXT_VF(bp)) { struct bnxt_vf_info *vf = &bp->vf; vf->vlan = le16_to_cpu(resp->vlan) & VLAN_VID_MASK; + if (flags & FUNC_QCFG_RESP_FLAGS_TRUSTED_VF) + vf->flags |= BNXT_VF_TRUST; + else + vf->flags &= ~BNXT_VF_TRUST; } else { bp->pf.registered_vfs = le16_to_cpu(resp->registered_vfs); } #endif - flags = le16_to_cpu(resp->flags); if (flags & (FUNC_QCFG_RESP_FLAGS_FW_DCBX_AGENT_ENABLED | FUNC_QCFG_RESP_FLAGS_FW_LLDP_AGENT_ENABLED)) { bp->fw_cap |= BNXT_FW_CAP_LLDP_AGENT; diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethernet/broadcom/bnxt/bnxt.h index 3e20d200da62..d5e81e008ab5 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h @@ -2270,6 +2270,11 @@ struct bnxt { #define BNXT_PF(bp) (!((bp)->flags & BNXT_FLAG_VF)) #define BNXT_VF(bp) ((bp)->flags & BNXT_FLAG_VF) +#ifdef CONFIG_BNXT_SRIOV +#define BNXT_VF_IS_TRUSTED(bp) ((bp)->vf.flags & BNXT_VF_TRUST) +#else +#define BNXT_VF_IS_TRUSTED(bp) 0 +#endif #define BNXT_NPAR(bp) ((bp)->port_partition_type) #define BNXT_MH(bp) ((bp)->flags & BNXT_FLAG_MULTI_HOST) #define BNXT_SINGLE_PF(bp) (BNXT_PF(bp) && !BNXT_NPAR(bp) && !BNXT_MH(bp)) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c index d87681d71106..28f2c471652c 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c @@ -4375,6 +4375,9 @@ static int bnxt_get_module_info(struct net_device *dev, struct bnxt *bp = netdev_priv(dev); int rc; + if (BNXT_VF(bp) && !BNXT_VF_IS_TRUSTED(bp)) + return -EPERM; + /* No point in going further if phy status indicates * module is not inserted or if it is powered down or * if it is of type 10GBase-T @@ -4426,6 +4429,9 @@ static int bnxt_get_module_eeprom(struct net_device *dev, u16 start = eeprom->offset, length = eeprom->len; int rc = 0; + if (BNXT_VF(bp) && !BNXT_VF_IS_TRUSTED(bp)) + return -EPERM; + memset(data, 0, eeprom->len); /* Read A0 portion of the EEPROM */ @@ -4480,6 +4486,12 @@ static int bnxt_get_module_eeprom_by_page(struct net_device *dev, struct bnxt *bp = netdev_priv(dev); int rc; + if (BNXT_VF(bp) && !BNXT_VF_IS_TRUSTED(bp)) { + NL_SET_ERR_MSG_MOD(extack, + "Module read not permitted on untrusted VF"); + return -EPERM; + } + rc = bnxt_get_module_status(bp, extack); if (rc) return rc; From patchwork Tue Dec 17 18:26:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 13912402 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D92701F8AD6 for ; Tue, 17 Dec 2024 18:27:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734460027; cv=none; b=BB2n54X4vVTetDU9MlALMENa9tpxEMdfS0QwFgJEboI80OY1u2Y1LR62aUIazVPjjWtpTKSyxfCf/VyAQ81ylU7GyiInT4M70DMZHZ0+/j0b3Lr8EJt14Q3EP0zq6dEFqpbUzHICCWrqoEFxaFQWYUZwJZMAagMQxFThZScPOKk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734460027; c=relaxed/simple; bh=/SbxjZE0CWBdnUK4Eh/KtWKwbEFu2G0/SWFxFkbgbXw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uI6Ta6MREJd0JKcx5hCJCOBB1xCilBqzE5BSbSL0L+VlX+ZV9YzyojtpM525Cld8IWbc7VaL9+fi5i9P2WGgqwx6Owgwlpbd2qBV2BttWnTP1gjxwIQLiyoR7mm+O5H9RrZ35zX7Q5O+DyYfMdVDwrcEtZdDuwuqxODpj8TWDEc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com; spf=fail smtp.mailfrom=broadcom.com; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b=UY8vUV32; arc=none smtp.client-ip=209.85.214.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="UY8vUV32" Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-216401de828so45395015ad.3 for ; Tue, 17 Dec 2024 10:27:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1734460025; x=1735064825; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Izj0krEbHBgNpHKjiv2l6E2w5v2uO+MXE0kMsqnNseQ=; b=UY8vUV32Go3M4lXujP88PC8N8Gg9Rvn2e+h6IOT7xRi09iOJjiEPAhbleKIQ4/eJB6 9I8UNSQ4/TT4eUqjA9NGdEbJ/N/aLuNcHi0qU75DEaV+mblSorrcqy0AvqOBcn7fmwP2 0KR0kTaeYwnI47I9kTOuArbVsXTXUGmhZriyo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734460025; x=1735064825; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Izj0krEbHBgNpHKjiv2l6E2w5v2uO+MXE0kMsqnNseQ=; b=G3w6Nc9odfHQ/26yp74MmDiyzEM92RsHHCYeCnwQkJa4D+O3BZebnJkm8Cznwln3qo ErOJRkc6pDz1HJFKFaa6ikNrXejo2dspkhqHg81HM6zdL0L0kxnII2OXQMyKFgfTcpKb wGfox8L6Ucq5lBz1VTQDeSFFHLHqCkSM015v6wBEDbpucppDAxjEIQ3OCwIq/jmFoqXb Qb34xSjOVC1YfAFxrXLlgYCDXBtzaDg62Rrar3ATyT6e7K4y8TgpypyrpF5yVBNiwKFU FYinpvKBNeqftnnTOt8ipz4FiudSCC2hqEpia7W0SbCT3O03NKYKibq17flPvgFg7eP0 MDLQ== X-Gm-Message-State: AOJu0YxyUoYvoNfCuwHWt0SxZGSGAVNvY9RAj4qtfngDPtEHHALXzRAe 3VgsmBxUPgkyhy2ojksqevKEh/bNfuxX6Iu9sHkvUM8UAte+HuyVb7JEQX+ZyA== X-Gm-Gg: ASbGnct7xs5ZEhk0Lb8p6bqmz2RgyqSjGbc+N2H+DYTBs5oACKwH2DznW3mGcAiVmA1 QtoAKZlC0538M7bqGNqTnjIkjZebBi7FNbqOaCzOTDvryEPZMIHhX2L9UmfgS0RGf3rZoLQpTXK llQO02e56wfhK46RBXuZH03auXAHiH7yTGtSck3Zu3gNGs3mDsBweSh49mi4/t1Ds++0EETXgt/ VEsBCIpoLS6SicbxJIFQt62wluY3kB2j2xGBxRjODfN+C5scGksAkF9AeRmyJRNfcWeHA05InvH 5K2QSelfu3Y/WtT1fxsNhaaleYdKppZr X-Google-Smtp-Source: AGHT+IFoEjqZZW9tC8sonBMG+kLXKB0pvo6SQ4YyPRAgubZy6S82t1D9mnoaVXnqAPSMb5y/5EZ+tw== X-Received: by 2002:a17:902:e545:b0:216:30f9:93d4 with SMTP id d9443c01a7336-2189298bbf7mr257125165ad.8.1734460025155; Tue, 17 Dec 2024 10:27:05 -0800 (PST) Received: from lvnvda3289.lvn.broadcom.net ([192.19.161.250]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-218a1e63af1sm62496595ad.226.2024.12.17.10.27.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Dec 2024 10:27:04 -0800 (PST) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, andrew+netdev@lunn.ch, pavan.chebbi@broadcom.com, andrew.gospodarek@broadcom.com, Kalesh AP Subject: [PATCH net-next v2 3/6] bnxt_en: Skip PHY loopback ethtool selftest if unsupported by FW Date: Tue, 17 Dec 2024 10:26:17 -0800 Message-ID: <20241217182620.2454075-4-michael.chan@broadcom.com> X-Mailer: git-send-email 2.43.4 In-Reply-To: <20241217182620.2454075-1-michael.chan@broadcom.com> References: <20241217182620.2454075-1-michael.chan@broadcom.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Skip PHY loopback selftest if firmware advertises that it is unsupported in the HWRM_PORT_PHY_QCAPS call. Only show PHY loopback test result to be 0 if the test has run and passes. Do the same for external loopback to be consistent. Reviewed-by: Pavan Chebbi Reviewed-by: Kalesh AP Signed-off-by: Michael Chan --- .../net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c index 28f2c471652c..8001849af879 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c @@ -4914,20 +4914,26 @@ static void bnxt_self_test(struct net_device *dev, struct ethtool_test *etest, buf[BNXT_MACLPBK_TEST_IDX] = 0; bnxt_hwrm_mac_loopback(bp, false); + buf[BNXT_PHYLPBK_TEST_IDX] = 1; + if (bp->phy_flags & BNXT_PHY_FL_NO_PHY_LPBK) + goto skip_phy_loopback; + bnxt_hwrm_phy_loopback(bp, true, false); msleep(1000); - if (bnxt_run_loopback(bp)) { - buf[BNXT_PHYLPBK_TEST_IDX] = 1; + if (bnxt_run_loopback(bp)) etest->flags |= ETH_TEST_FL_FAILED; - } + else + buf[BNXT_PHYLPBK_TEST_IDX] = 0; +skip_phy_loopback: + buf[BNXT_EXTLPBK_TEST_IDX] = 1; if (do_ext_lpbk) { etest->flags |= ETH_TEST_FL_EXTERNAL_LB_DONE; bnxt_hwrm_phy_loopback(bp, true, true); msleep(1000); - if (bnxt_run_loopback(bp)) { - buf[BNXT_EXTLPBK_TEST_IDX] = 1; + if (bnxt_run_loopback(bp)) etest->flags |= ETH_TEST_FL_FAILED; - } + else + buf[BNXT_EXTLPBK_TEST_IDX] = 0; } bnxt_hwrm_phy_loopback(bp, false, false); bnxt_half_close_nic(bp); From patchwork Tue Dec 17 18:26:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 13912403 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 79E361F8AFE for ; Tue, 17 Dec 2024 18:27:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734460029; cv=none; b=XkPLtEsElaIHBe/Oj6UcLo/9aP78M0Qeq8xrc43Kdotuokoo/xrKK05QA9Sxe2KkqWCvIF08nrJusXidnA2B0kqtrajAru65uooSISjaSiHAER+pc9HWL9NjuIPfvajyGY4DvZ7KDLf10yan+O5ZaCXq+JZZb2dNhTi6OtMPHLg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734460029; c=relaxed/simple; bh=zpTK0PNQOhNC5kD2LgIhbrQ1a3eBbCrVDI9javzEoDA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SPDvaLp1G48B52ofwWFzgsnERdF5GTRBf1VC6e0veA2jmBgs+ieJdaDTo43iXJwd6E85GBLaAH96lTC2p40oL8BdrSTvH1VrKE2YR9vsXc+AF5j6bvOJgLM9iipTtrlHNisAtpdr+i0vwyOZz6OQJVN/HvdpdnCUIqZBN0h2EKw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com; spf=fail smtp.mailfrom=broadcom.com; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b=PZHf7nzI; arc=none smtp.client-ip=209.85.214.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="PZHf7nzI" Received: by mail-pl1-f176.google.com with SMTP id d9443c01a7336-216634dd574so32906195ad.2 for ; Tue, 17 Dec 2024 10:27:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1734460027; x=1735064827; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=T/U74kSzGU82WaF3YwiwK5Dsre8yynJCW2nmO8At+rU=; b=PZHf7nzIFyxkD+2bwc0vC2OB8powjSYDfOYb+9oT4exnzFfFok3ZiyTueeZoUoN2am n8iqDDtkgK1dKmj2ASFEbI21zBph44iER03XHf4eMQvQ5TmxSQzIImebaLTkbGvSbmGa gSd7Lw/fROYbRtlg0Z9Z20sPGypVm/Wbj6QXk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734460027; x=1735064827; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=T/U74kSzGU82WaF3YwiwK5Dsre8yynJCW2nmO8At+rU=; b=kT1NKtkVRPuwL+LVRgcnxMyFFscTLr5CCISnZZ91EXuuNNJz9duz3b2PK2MAOj0QRc 8sWKiwZ4LJwXYTquVMxRYdv/PqJix9FtYSDL5NDUK6++juOr8Gkiz/Zi2nbZmF8NC5AD wFfKTHQ8QLo6MLWl8ruDnejVrXrEXyCiuGAw8nEQyH9CY5doqoyr51qTT3Elw+2OOLVj Xtk4WdEYd2GTUJmEKZxEWTbP8NAjnV6xHrBLXVjPsIyCzE/EeHCsA8bntLi2EaVZDNou /bjWgwTopJIus2RHuPsMztexOS6yVb/lkXkEMosI5W89UkCdofUyy3wDD8Cf0KLeGTAU msiQ== X-Gm-Message-State: AOJu0YzEfzaXUBM6DcNmb4K/MjRM0YDpvURg6+d3AHG7kjhi6B7gE4Ws DXqOPtxd4cTxZwm36tvDm6PZQc66igEOuXcNCdVbwpbQvozMvYK1zEJQnyko2Q== X-Gm-Gg: ASbGncumrv15Pk7tIiCSSwQzAzsjenhEFjbGCaI+S0ATY2cM1/Zq2TyhGl0/21ozTvq VJxcGBar4xETXpwoWHgRP2L3tKPNdoG+53SNd1bU0vsG0nL3w72xva10/q9OCNVjMZljlleQfTa /WxOL6WfGcHBizGjrXHCoAa0diT3PCWGXTQmVb7LTLxMCuDoCNSYv2LNUAi70klTX/IhQ/mbWl3 FfqC2NY24sAoguucwx/xhJQmWFdemp1kU3ZqBR8tdaAW7+e+4uvXsjLT/Qupjf94cEXGTohZ5z1 p7HcnyEDPei+d44ExvearZV55tyCh8s+ X-Google-Smtp-Source: AGHT+IEPpk6Urr1+CMvIklP4UBiB/F9Q8tjd6vrHKHA/uvKNQzzjqCoymUkwAOGPBqShreKzxQZEew== X-Received: by 2002:a17:902:ce85:b0:216:7cbf:951f with SMTP id d9443c01a7336-218929c72b5mr205986485ad.21.1734460026696; Tue, 17 Dec 2024 10:27:06 -0800 (PST) Received: from lvnvda3289.lvn.broadcom.net ([192.19.161.250]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-218a1e63af1sm62496595ad.226.2024.12.17.10.27.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Dec 2024 10:27:05 -0800 (PST) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, andrew+netdev@lunn.ch, pavan.chebbi@broadcom.com, andrew.gospodarek@broadcom.com, Kalesh AP , Michal Swiatkowski Subject: [PATCH net-next v2 4/6] bnxt_en: Skip MAC loopback selftest if it is unsupported by FW Date: Tue, 17 Dec 2024 10:26:18 -0800 Message-ID: <20241217182620.2454075-5-michael.chan@broadcom.com> X-Mailer: git-send-email 2.43.4 In-Reply-To: <20241217182620.2454075-1-michael.chan@broadcom.com> References: <20241217182620.2454075-1-michael.chan@broadcom.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Call the new HWRM_PORT_MAC_QCAPS to check if mac loopback is supported. Skip the MAC loopback ethtool self test if it is not supported. Reviewed-by: Kalesh AP Reviewed-by: Pavan Chebbi Reviewed-by: Andy Gospodarek Signed-off-by: Michael Chan --- v2: Change bnxt_hwrm_mac_qcaps() to void Cc: Michal Swiatkowski --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 24 +++++++++++++++++++ drivers/net/ethernet/broadcom/bnxt/bnxt.h | 5 ++++ .../net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 11 +++++---- 3 files changed, 36 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index c0728d5ff8bc..46edea75e062 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -11551,6 +11551,26 @@ static int bnxt_hwrm_phy_qcaps(struct bnxt *bp) return rc; } +static void bnxt_hwrm_mac_qcaps(struct bnxt *bp) +{ + struct hwrm_port_mac_qcaps_output *resp; + struct hwrm_port_mac_qcaps_input *req; + int rc; + + if (bp->hwrm_spec_code < 0x10a03) + return; + + rc = hwrm_req_init(bp, req, HWRM_PORT_MAC_QCAPS); + if (rc) + return; + + resp = hwrm_req_hold(bp, req); + rc = hwrm_req_send_silent(bp, req); + if (!rc) + bp->mac_flags = resp->flags; + hwrm_req_drop(bp, req); +} + static bool bnxt_support_dropped(u16 advertising, u16 supported) { u16 diff = advertising ^ supported; @@ -15679,6 +15699,10 @@ static int bnxt_probe_phy(struct bnxt *bp, bool fw_dflt) bp->dev->priv_flags |= IFF_SUPP_NOFCS; else bp->dev->priv_flags &= ~IFF_SUPP_NOFCS; + + bp->mac_flags = 0; + bnxt_hwrm_mac_qcaps(bp); + if (!fw_dflt) return 0; diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethernet/broadcom/bnxt/bnxt.h index d5e81e008ab5..094c9e95b463 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h @@ -2668,6 +2668,11 @@ struct bnxt { #define BNXT_PHY_FL_BANK_SEL (PORT_PHY_QCAPS_RESP_FLAGS2_BANK_ADDR_SUPPORTED << 8) #define BNXT_PHY_FL_SPEEDS2 (PORT_PHY_QCAPS_RESP_FLAGS2_SPEEDS2_SUPPORTED << 8) + /* copied from flags in hwrm_port_mac_qcaps_output */ + u8 mac_flags; +#define BNXT_MAC_FL_NO_MAC_LPBK \ + PORT_MAC_QCAPS_RESP_FLAGS_LOCAL_LPBK_NOT_SUPPORTED + u8 num_tests; struct bnxt_test_info *test_info; diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c index 8001849af879..c094abfa1ebc 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c @@ -4899,21 +4899,24 @@ static void bnxt_self_test(struct net_device *dev, struct ethtool_test *etest, bnxt_close_nic(bp, true, false); bnxt_run_fw_tests(bp, test_mask, &test_results); - buf[BNXT_MACLPBK_TEST_IDX] = 1; - bnxt_hwrm_mac_loopback(bp, true); - msleep(250); rc = bnxt_half_open_nic(bp); if (rc) { - bnxt_hwrm_mac_loopback(bp, false); etest->flags |= ETH_TEST_FL_FAILED; return; } + buf[BNXT_MACLPBK_TEST_IDX] = 1; + if (bp->mac_flags & BNXT_MAC_FL_NO_MAC_LPBK) + goto skip_mac_loopback; + + bnxt_hwrm_mac_loopback(bp, true); + msleep(250); if (bnxt_run_loopback(bp)) etest->flags |= ETH_TEST_FL_FAILED; else buf[BNXT_MACLPBK_TEST_IDX] = 0; bnxt_hwrm_mac_loopback(bp, false); +skip_mac_loopback: buf[BNXT_PHYLPBK_TEST_IDX] = 1; if (bp->phy_flags & BNXT_PHY_FL_NO_PHY_LPBK) goto skip_phy_loopback; From patchwork Tue Dec 17 18:26:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 13912404 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B69131F892B for ; Tue, 17 Dec 2024 18:27:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734460030; cv=none; b=JnGpn5hgn+GeVonc5ZD/HOSer7FIbxy1TVH5WMRV4FKrRUA8AhVLb8XnIoV4AYoaiKx3AtNIBVp77U0mJIzqX4tm6U1M2iuvR4lWNI3hcA5+s5BWeFaW1M0W93D9CUjk+HAfH1PXGTXzv16fPGrF+jC7f49QUZtlMNo0hZMxgao= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734460030; c=relaxed/simple; bh=2/2D6SYyrfBeV3rR6vMTI1duBJixL/23ePkZ4eexaZ0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UHNMGAXbmylVhEA+Q7bxzZf9Nri0OpGweT7NAh7CXhV4uCVC1zsguh6ti3gnpxhAJ/nFzAmwHXzY2hCQ0eAIPDstv4BkfvYsbVBSx+f73j53y+/xLQsgjrFoLELJlXrE6V0bK0g8rDVb2DNT5OoWB/sz7cW4Pcp98U+iFe3/80I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com; spf=fail smtp.mailfrom=broadcom.com; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b=RBrmzJqv; arc=none smtp.client-ip=209.85.214.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="RBrmzJqv" Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-21644e6140cso53535855ad.1 for ; Tue, 17 Dec 2024 10:27:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1734460028; x=1735064828; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=elwQOCg8tZXlgYKyqP8AcNa3TLlHrfV7/DBuEBwpCF4=; b=RBrmzJqvg5CaeUCqcbXKdltQ2MENqYmsYBoeNXKf8Rjoj4G8Aq2PjciPLLO4tTssFE 53I20ckmaTeAcEKUsS4CWRmzuPZOmvlHFDJOMV/xbJoJziXulwKxbrm3TNE+kpt0jp6+ Vnjpb/MZSjSHKwtH/d7Txa5QEUBC6+mWaR/OE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734460028; x=1735064828; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=elwQOCg8tZXlgYKyqP8AcNa3TLlHrfV7/DBuEBwpCF4=; b=cjQGhfEsv/J+T+NBDPluFe2lXcIAKMuFQrRpxhrtZgwCaEsRva/a70rbn+mny+F2xn /OanDC1xx+B8O18mrOB8ZSi94Mffi7KcRM/HalTuaSMRXqThvKVkLHUTpbY8bw6KBLse mY53aQ/SbRjrnGwcVrUJvH6DV9sWYpw7qj7rkpPrsN4T0rJmdPXkH59viJZ6Bc4ojVh1 CGGUHPJkQMtPpeWKPn+ynu+dTG9SC4IewjjcPlRQ2z2bI2KLCggrFJ/Iz/uN150fusMy yvQ/BA4LwXiw/Y1aNUdvnkCuD8XjwgGscXjgzzkDgRUIJQG71gWqbm3N8oMHYen4nk0f /hVQ== X-Gm-Message-State: AOJu0YzG8wCHoKF5G5pRyNRQ80e7Ztb7TfNxjkpmDQ3SH/j3tfSn0gy1 ZCSqUEHdGaafLuXPvGbE+u/GlAsGlh4cJ86SKWSFdpnNGqIPRKCl3vlVixW7bQ== X-Gm-Gg: ASbGnctciUbTofSzL6QoW/Mr/s8ETvp7RsKhvrrfvwqEwAkZoTX7YCWjvZXmaELJ4XT nwT73Wo1wY4s7d5hDJ+17Cd3OtqWw9ByxfGUOFI3QsyDgLccvLoD5aC7muIzblbvb97CS0+092N XxVaygtY768eeYliJU1z3KSJjuM5QksqwZAH9EFdBWcaXSQnhBTht0ANeTnfJcoJDvk7fxrXOaf SQvokBk9UJoJFuVzajCgfGVlmguVqg/yJsRvIoZaNV54iFjzgKjmcUKuzBuRuj5/eT66kI+uTan nYt7aQsFMvsvLWiRPkT3FMERlHlb3o+k X-Google-Smtp-Source: AGHT+IHMXId/otyMXvNUNa9cT3TCAQyKK4fwK8hxUvpN7vL0wu6Kpbuh6YRbGqGZOJNtxO98wTDnSg== X-Received: by 2002:a17:902:d481:b0:216:5854:1062 with SMTP id d9443c01a7336-218d52d28cbmr5825715ad.57.1734460028030; Tue, 17 Dec 2024 10:27:08 -0800 (PST) Received: from lvnvda3289.lvn.broadcom.net ([192.19.161.250]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-218a1e63af1sm62496595ad.226.2024.12.17.10.27.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Dec 2024 10:27:07 -0800 (PST) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, andrew+netdev@lunn.ch, pavan.chebbi@broadcom.com, andrew.gospodarek@broadcom.com, Ajit Khaparde , Kalesh AP , Somnath Kotur Subject: [PATCH net-next v2 5/6] bnxt_en: Skip reading PXP registers during ethtool -d if unsupported Date: Tue, 17 Dec 2024 10:26:19 -0800 Message-ID: <20241217182620.2454075-6-michael.chan@broadcom.com> X-Mailer: git-send-email 2.43.4 In-Reply-To: <20241217182620.2454075-1-michael.chan@broadcom.com> References: <20241217182620.2454075-1-michael.chan@broadcom.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Newer firmware does not allow reading the PXP registers during ethtool -d, so skip the firmware call in that case. Userspace (bnxt.c) always expects the register block to be populated so zeroes will be returned instead. Reviewed-by: Ajit Khaparde Reviewed-by: Kalesh AP Reviewed-by: Somnath Kotur Reviewed-by: Pavan Chebbi Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c index c094abfa1ebc..75a59dd72bce 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c @@ -2050,7 +2050,8 @@ static void bnxt_get_regs(struct net_device *dev, struct ethtool_regs *regs, int rc; regs->version = 0; - bnxt_dbg_hwrm_rd_reg(bp, 0, BNXT_PXP_REG_LEN / 4, _p); + if (!(bp->fw_dbg_cap & DBG_QCAPS_RESP_FLAGS_REG_ACCESS_RESTRICTED)) + bnxt_dbg_hwrm_rd_reg(bp, 0, BNXT_PXP_REG_LEN / 4, _p); if (!(bp->fw_cap & BNXT_FW_CAP_PCIE_STATS_SUPPORTED)) return; From patchwork Tue Dec 17 18:26:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 13912405 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5298B1F9412 for ; Tue, 17 Dec 2024 18:27:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734460031; cv=none; b=Qm5UL/2iD+uT3tCbK/s63Yfnrb6EghSIruJAEFmKZffDWni6qUqjq6Rx+cxV8/0w24yjKatBzFDTE/stmGPSs8C0KOlM5G8gq2ItO941j9qUd3PJoEMNZprFL6EUHO8mPXwptdZkci4y7tFFvde01LLyMZx7z3SiZtoASl/qR0s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734460031; c=relaxed/simple; bh=3CBZBlfh+56QfJJs99uRlQZjombPvTGum3x0MjVt7pY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TAHYAwfeFxVPuco0C5SoW9QtXyujBzen7vmCRc1Qy2oYA+AxOr4R9JLtqKdBY9A1UvMuBi46jz+HJ/e9rgjKWmPXPjRi7bnmsCKiGVZKToy7wShEVeIi35WMIHocNcUdfZo/uYXezCImw+Shu8lZoop9/aotI4qIAULR4nhdP80= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com; spf=fail smtp.mailfrom=broadcom.com; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b=XrHtESlu; arc=none smtp.client-ip=209.85.214.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="XrHtESlu" Received: by mail-pl1-f173.google.com with SMTP id d9443c01a7336-21644aca3a0so67034495ad.3 for ; Tue, 17 Dec 2024 10:27:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1734460029; x=1735064829; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=P0XQDitWKVq4eNGE0XYTq4nsJajScvFqTYG5pnFykTI=; b=XrHtESlugAu096WZCraxIpoQNV/xSUM5s+kishlkacrZNrWS8z0stPx5dQaC0gQz2Y pgkYAqsVK8b7G90AJzdQszR1KT096tLBbMcM+kySJihgjIHC2QDc6jwu/rqOoNZjDC5b UG/21vkIJ+bKz+kXJVZ3bwv36/C29d6sZJuv0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734460029; x=1735064829; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=P0XQDitWKVq4eNGE0XYTq4nsJajScvFqTYG5pnFykTI=; b=Nyg/6m8YUtSeKNQPzbS5YPAp0Rag5oFYjHu9NecPJuWoWe9gbdTsF0G0yw4pJ38P+5 AXYuXJ0qCaPANvY64warfbW06fZWn30UWXyun6cNuPkLlAlg+GD8M6IGN63Nqe0UZ5LM eWfl6e9pt+86Z7eTJPxElLxqChwYzdH8gXLbJvGQg7bOlegsiMKogfzEf58eceTIKMfF VQURa8sA2c39OKieA35lteZh/FCxpmf8zE8gTgjxBLAxt6B/SUqdshBYOsFMEckriQTe NcbfCt4sk2W0Pkve/w9+NJ9hWIbgF+7tcrhHC2gQ2GDwZ8k+rqwP9EDFou9pW2ij3nLa CcvQ== X-Gm-Message-State: AOJu0YxKYoLtsa4WL/ynuvgECb87ICru2L7CStB2jJB4Kp9IlmqkeXC1 WBx693DpruJq3Pi00hsGYhOwWeUN3nr0RWIvRrCUToMN51Q1mLF1s1i2rRzxzA== X-Gm-Gg: ASbGnctWEOTnFxu/zAbE3dEHcXmhXQr39f29pAmYVu1EUIhKg9p8xKJo94ZDMKdUIGB f+J0S2DWgjO34wz4HEQ6e7xUNUqPq72rDdcpdJahAj+b/VoesDQ9t8lFselFHNxbTrGrNRe7wEw oq0L7KnkiecbGof+vzBDafeQSDXXG5wJpPgMdwB/NyireAh9pJr0vWBRLmil1bMX7pnaY5JYViN 6EpfLx89rI0kPgwUQxFqRMVjM9uoyM2mYkyWpKK8SGsi/adAld21oFxUA2ohdOEOvBtuWeNYVdc BJ3L4Pn9G1KvoDhNN4UCdrC8+htElvCW X-Google-Smtp-Source: AGHT+IGMHNMKEjPlhVfqnJibVGP2lWKCoF0Rj8LBqRvc8ZfXWQnxW5kq7PG8A5ahiFwJR6zz4xz8vQ== X-Received: by 2002:a17:902:f64b:b0:216:55a1:35a with SMTP id d9443c01a7336-218929ee63cmr259088285ad.30.1734460029557; Tue, 17 Dec 2024 10:27:09 -0800 (PST) Received: from lvnvda3289.lvn.broadcom.net ([192.19.161.250]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-218a1e63af1sm62496595ad.226.2024.12.17.10.27.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Dec 2024 10:27:08 -0800 (PST) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, andrew+netdev@lunn.ch, pavan.chebbi@broadcom.com, andrew.gospodarek@broadcom.com Subject: [PATCH net-next v2 6/6] MAINTAINERS: bnxt_en: Add Pavan Chebbi as co-maintainer Date: Tue, 17 Dec 2024 10:26:20 -0800 Message-ID: <20241217182620.2454075-7-michael.chan@broadcom.com> X-Mailer: git-send-email 2.43.4 In-Reply-To: <20241217182620.2454075-1-michael.chan@broadcom.com> References: <20241217182620.2454075-1-michael.chan@broadcom.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Reviewed-by: Pavan Chebbi Signed-off-by: Michael Chan --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index 6cced90772fc..2c73a3aacafb 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -4611,6 +4611,7 @@ F: drivers/net/ethernet/broadcom/bnx2x/ BROADCOM BNXT_EN 50 GIGABIT ETHERNET DRIVER M: Michael Chan +M: Pavan Chebbi L: netdev@vger.kernel.org S: Supported F: drivers/firmware/broadcom/tee_bnxt_fw.c