Skip to content

Commit cfcab3b

Browse files
Michael Chandavem330
authored andcommitted
bnxt_en: Fix occasional ethtool -t loopback test failures
In the current code, we setup the port to PHY or MAC loopback mode and then transmit a test broadcast packet for the loopback test. This scheme fails sometime if the port is shared with management firmware that can also send packets. The driver may receive the management firmware's packet and the test will fail when the contents don't match the test packet. Change the test packet to use it's own MAC address as the destination and setup the port to only receive it's own MAC address. This should filter out other packets sent by management firmware. Fixes: 91725d8 ("bnxt_en: Add PHY loopback to ethtool self-test.") Reviewed-by: Pavan Chebbi <pavan.chebbi@broadcom.com> Reviewed-by: Edwin Peer <edwin.peer@broadcom.com> Reviewed-by: Andy Gospodarek <gospo@broadcom.com> Signed-off-by: Michael Chan <michael.chan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 6758f93 commit cfcab3b

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8639,6 +8639,9 @@ static int bnxt_init_chip(struct bnxt *bp, bool irq_re_init)
86398639
vnic->uc_filter_count = 1;
86408640

86418641
vnic->rx_mask = 0;
8642+
if (test_bit(BNXT_STATE_HALF_OPEN, &bp->state))
8643+
goto skip_rx_mask;
8644+
86428645
if (bp->dev->flags & IFF_BROADCAST)
86438646
vnic->rx_mask |= CFA_L2_SET_RX_MASK_REQ_MASK_BCAST;
86448647

@@ -8659,6 +8662,7 @@ static int bnxt_init_chip(struct bnxt *bp, bool irq_re_init)
86598662
if (rc)
86608663
goto err_out;
86618664

8665+
skip_rx_mask:
86628666
rc = bnxt_hwrm_set_coal(bp);
86638667
if (rc)
86648668
netdev_warn(bp->dev, "HWRM set coalescing failure rc: %x\n",
@@ -10335,8 +10339,10 @@ int bnxt_half_open_nic(struct bnxt *bp)
1033510339
netdev_err(bp->dev, "bnxt_alloc_mem err: %x\n", rc);
1033610340
goto half_open_err;
1033710341
}
10342+
set_bit(BNXT_STATE_HALF_OPEN, &bp->state);
1033810343
rc = bnxt_init_nic(bp, true);
1033910344
if (rc) {
10345+
clear_bit(BNXT_STATE_HALF_OPEN, &bp->state);
1034010346
netdev_err(bp->dev, "bnxt_init_nic err: %x\n", rc);
1034110347
goto half_open_err;
1034210348
}
@@ -10357,6 +10363,7 @@ void bnxt_half_close_nic(struct bnxt *bp)
1035710363
bnxt_hwrm_resource_free(bp, false, true);
1035810364
bnxt_free_skbs(bp);
1035910365
bnxt_free_mem(bp, true);
10366+
clear_bit(BNXT_STATE_HALF_OPEN, &bp->state);
1036010367
}
1036110368

1036210369
void bnxt_reenable_sriov(struct bnxt *bp)

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1921,6 +1921,7 @@ struct bnxt {
19211921
#define BNXT_STATE_RECOVER 12
19221922
#define BNXT_STATE_FW_NON_FATAL_COND 13
19231923
#define BNXT_STATE_FW_ACTIVATE_RESET 14
1924+
#define BNXT_STATE_HALF_OPEN 15 /* For offline ethtool tests */
19241925

19251926
#define BNXT_NO_FW_ACCESS(bp) \
19261927
(test_bit(BNXT_STATE_FW_FATAL_COND, &(bp)->state) || \

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3458,7 +3458,7 @@ static int bnxt_run_loopback(struct bnxt *bp)
34583458
if (!skb)
34593459
return -ENOMEM;
34603460
data = skb_put(skb, pkt_size);
3461-
eth_broadcast_addr(data);
3461+
ether_addr_copy(&data[i], bp->dev->dev_addr);
34623462
i += ETH_ALEN;
34633463
ether_addr_copy(&data[i], bp->dev->dev_addr);
34643464
i += ETH_ALEN;

0 commit comments

Comments
 (0)