Skip to content

Commit 7fa7cc7

Browse files
committed
bnxt_en: Skip MAC loopback selftest if it is unsupported by FW
jira LE-3822 Rebuild_History Non-Buildable kernel-6.12.0-55.27.1.el10_0 commit-author Michael Chan <michael.chan@broadcom.com> commit b45a850 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 <kalesh-anakkur.purayil@broadcom.com> Reviewed-by: Pavan Chebbi <pavan.chebbi@broadcom.com> Reviewed-by: Andy Gospodarek <andrew.gospodarek@broadcom.com> Signed-off-by: Michael Chan <michael.chan@broadcom.com> Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com> Link: https://patch.msgid.link/20241217182620.2454075-5-michael.chan@broadcom.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> (cherry picked from commit b45a850) Signed-off-by: Jonathan Maple <jmaple@ciq.com>
1 parent 3460eb7 commit 7fa7cc7

File tree

3 files changed

+36
-4
lines changed

3 files changed

+36
-4
lines changed

drivers/net/ethernet/broadcom/bnxt/bnxt.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11267,6 +11267,26 @@ static int bnxt_hwrm_phy_qcaps(struct bnxt *bp)
1126711267
return rc;
1126811268
}
1126911269

11270+
static void bnxt_hwrm_mac_qcaps(struct bnxt *bp)
11271+
{
11272+
struct hwrm_port_mac_qcaps_output *resp;
11273+
struct hwrm_port_mac_qcaps_input *req;
11274+
int rc;
11275+
11276+
if (bp->hwrm_spec_code < 0x10a03)
11277+
return;
11278+
11279+
rc = hwrm_req_init(bp, req, HWRM_PORT_MAC_QCAPS);
11280+
if (rc)
11281+
return;
11282+
11283+
resp = hwrm_req_hold(bp, req);
11284+
rc = hwrm_req_send_silent(bp, req);
11285+
if (!rc)
11286+
bp->mac_flags = resp->flags;
11287+
hwrm_req_drop(bp, req);
11288+
}
11289+
1127011290
static bool bnxt_support_dropped(u16 advertising, u16 supported)
1127111291
{
1127211292
u16 diff = advertising ^ supported;
@@ -15389,6 +15409,10 @@ static int bnxt_probe_phy(struct bnxt *bp, bool fw_dflt)
1538915409
bp->dev->priv_flags |= IFF_SUPP_NOFCS;
1539015410
else
1539115411
bp->dev->priv_flags &= ~IFF_SUPP_NOFCS;
15412+
15413+
bp->mac_flags = 0;
15414+
bnxt_hwrm_mac_qcaps(bp);
15415+
1539215416
if (!fw_dflt)
1539315417
return 0;
1539415418

drivers/net/ethernet/broadcom/bnxt/bnxt.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2614,6 +2614,11 @@ struct bnxt {
26142614
#define BNXT_PHY_FL_BANK_SEL (PORT_PHY_QCAPS_RESP_FLAGS2_BANK_ADDR_SUPPORTED << 8)
26152615
#define BNXT_PHY_FL_SPEEDS2 (PORT_PHY_QCAPS_RESP_FLAGS2_SPEEDS2_SUPPORTED << 8)
26162616

2617+
/* copied from flags in hwrm_port_mac_qcaps_output */
2618+
u8 mac_flags;
2619+
#define BNXT_MAC_FL_NO_MAC_LPBK \
2620+
PORT_MAC_QCAPS_RESP_FLAGS_LOCAL_LPBK_NOT_SUPPORTED
2621+
26172622
u8 num_tests;
26182623
struct bnxt_test_info *test_info;
26192624

drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4894,21 +4894,24 @@ static void bnxt_self_test(struct net_device *dev, struct ethtool_test *etest,
48944894
bnxt_close_nic(bp, true, false);
48954895
bnxt_run_fw_tests(bp, test_mask, &test_results);
48964896

4897-
buf[BNXT_MACLPBK_TEST_IDX] = 1;
4898-
bnxt_hwrm_mac_loopback(bp, true);
4899-
msleep(250);
49004897
rc = bnxt_half_open_nic(bp);
49014898
if (rc) {
4902-
bnxt_hwrm_mac_loopback(bp, false);
49034899
etest->flags |= ETH_TEST_FL_FAILED;
49044900
return;
49054901
}
4902+
buf[BNXT_MACLPBK_TEST_IDX] = 1;
4903+
if (bp->mac_flags & BNXT_MAC_FL_NO_MAC_LPBK)
4904+
goto skip_mac_loopback;
4905+
4906+
bnxt_hwrm_mac_loopback(bp, true);
4907+
msleep(250);
49064908
if (bnxt_run_loopback(bp))
49074909
etest->flags |= ETH_TEST_FL_FAILED;
49084910
else
49094911
buf[BNXT_MACLPBK_TEST_IDX] = 0;
49104912

49114913
bnxt_hwrm_mac_loopback(bp, false);
4914+
skip_mac_loopback:
49124915
buf[BNXT_PHYLPBK_TEST_IDX] = 1;
49134916
if (bp->phy_flags & BNXT_PHY_FL_NO_PHY_LPBK)
49144917
goto skip_phy_loopback;

0 commit comments

Comments
 (0)