Skip to content

Commit 6758f93

Browse files
Michael Chandavem330
authored andcommitted
bnxt_en: Fix offline ethtool selftest with RDMA enabled
For offline (destructive) self tests, we need to stop the RDMA driver first. Otherwise, the RDMA driver will run into unrecoverable errors when destructive firmware tests are being performed. The irq_re_init parameter used in the half close and half open sequence when preparing the NIC for offline tests should be set to true because the RDMA driver will free all IRQs before the offline tests begin. Fixes: 55fd0cf ("bnxt_en: Add external loopback test to ethtool selftest.") Reviewed-by: Edwin Peer <edwin.peer@broadcom.com> Reviewed-by: Ben Li <ben.li@broadcom.com> Signed-off-by: Michael Chan <michael.chan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 84d3c83 commit 6758f93

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10330,12 +10330,12 @@ int bnxt_half_open_nic(struct bnxt *bp)
1033010330
goto half_open_err;
1033110331
}
1033210332

10333-
rc = bnxt_alloc_mem(bp, false);
10333+
rc = bnxt_alloc_mem(bp, true);
1033410334
if (rc) {
1033510335
netdev_err(bp->dev, "bnxt_alloc_mem err: %x\n", rc);
1033610336
goto half_open_err;
1033710337
}
10338-
rc = bnxt_init_nic(bp, false);
10338+
rc = bnxt_init_nic(bp, true);
1033910339
if (rc) {
1034010340
netdev_err(bp->dev, "bnxt_init_nic err: %x\n", rc);
1034110341
goto half_open_err;
@@ -10344,7 +10344,7 @@ int bnxt_half_open_nic(struct bnxt *bp)
1034410344

1034510345
half_open_err:
1034610346
bnxt_free_skbs(bp);
10347-
bnxt_free_mem(bp, false);
10347+
bnxt_free_mem(bp, true);
1034810348
dev_close(bp->dev);
1034910349
return rc;
1035010350
}
@@ -10354,9 +10354,9 @@ int bnxt_half_open_nic(struct bnxt *bp)
1035410354
*/
1035510355
void bnxt_half_close_nic(struct bnxt *bp)
1035610356
{
10357-
bnxt_hwrm_resource_free(bp, false, false);
10357+
bnxt_hwrm_resource_free(bp, false, true);
1035810358
bnxt_free_skbs(bp);
10359-
bnxt_free_mem(bp, false);
10359+
bnxt_free_mem(bp, true);
1036010360
}
1036110361

1036210362
void bnxt_reenable_sriov(struct bnxt *bp)

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include "bnxt_hsi.h"
2626
#include "bnxt.h"
2727
#include "bnxt_hwrm.h"
28+
#include "bnxt_ulp.h"
2829
#include "bnxt_xdp.h"
2930
#include "bnxt_ptp.h"
3031
#include "bnxt_ethtool.h"
@@ -3551,9 +3552,12 @@ static void bnxt_self_test(struct net_device *dev, struct ethtool_test *etest,
35513552
if (!offline) {
35523553
bnxt_run_fw_tests(bp, test_mask, &test_results);
35533554
} else {
3554-
rc = bnxt_close_nic(bp, false, false);
3555-
if (rc)
3555+
bnxt_ulp_stop(bp);
3556+
rc = bnxt_close_nic(bp, true, false);
3557+
if (rc) {
3558+
bnxt_ulp_start(bp, rc);
35563559
return;
3560+
}
35573561
bnxt_run_fw_tests(bp, test_mask, &test_results);
35583562

35593563
buf[BNXT_MACLPBK_TEST_IDX] = 1;
@@ -3563,6 +3567,7 @@ static void bnxt_self_test(struct net_device *dev, struct ethtool_test *etest,
35633567
if (rc) {
35643568
bnxt_hwrm_mac_loopback(bp, false);
35653569
etest->flags |= ETH_TEST_FL_FAILED;
3570+
bnxt_ulp_start(bp, rc);
35663571
return;
35673572
}
35683573
if (bnxt_run_loopback(bp))
@@ -3588,7 +3593,8 @@ static void bnxt_self_test(struct net_device *dev, struct ethtool_test *etest,
35883593
}
35893594
bnxt_hwrm_phy_loopback(bp, false, false);
35903595
bnxt_half_close_nic(bp);
3591-
rc = bnxt_open_nic(bp, false, true);
3596+
rc = bnxt_open_nic(bp, true, true);
3597+
bnxt_ulp_start(bp, rc);
35923598
}
35933599
if (rc || bnxt_test_irq(bp)) {
35943600
buf[BNXT_IRQ_TEST_IDX] = 1;

0 commit comments

Comments
 (0)