Skip to content

Commit 5a34497

Browse files
committed
Merge branch 'bnxt_en-fixes'
Michael Chan says: ==================== bnxt_en: Bug fixes This series contains bug fixes for FEC reporting, ethtool self test, multicast setup, devlink health reporting and live patching, and a firmware response timeout. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 8940e6b + 1278d17 commit 5a34497

File tree

6 files changed

+90
-28
lines changed

6 files changed

+90
-28
lines changed

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

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4747,8 +4747,10 @@ static int bnxt_hwrm_cfa_l2_set_rx_mask(struct bnxt *bp, u16 vnic_id)
47474747
return rc;
47484748

47494749
req->vnic_id = cpu_to_le32(vnic->fw_vnic_id);
4750-
req->num_mc_entries = cpu_to_le32(vnic->mc_list_count);
4751-
req->mc_tbl_addr = cpu_to_le64(vnic->mc_list_mapping);
4750+
if (vnic->rx_mask & CFA_L2_SET_RX_MASK_REQ_MASK_MCAST) {
4751+
req->num_mc_entries = cpu_to_le32(vnic->mc_list_count);
4752+
req->mc_tbl_addr = cpu_to_le64(vnic->mc_list_mapping);
4753+
}
47524754
req->mask = cpu_to_le32(vnic->rx_mask);
47534755
return hwrm_req_send_silent(bp, req);
47544756
}
@@ -7787,6 +7789,19 @@ static int bnxt_map_fw_health_regs(struct bnxt *bp)
77877789
return 0;
77887790
}
77897791

7792+
static void bnxt_remap_fw_health_regs(struct bnxt *bp)
7793+
{
7794+
if (!bp->fw_health)
7795+
return;
7796+
7797+
if (bp->fw_cap & BNXT_FW_CAP_ERROR_RECOVERY) {
7798+
bp->fw_health->status_reliable = true;
7799+
bp->fw_health->resets_reliable = true;
7800+
} else {
7801+
bnxt_try_map_fw_health_reg(bp);
7802+
}
7803+
}
7804+
77907805
static int bnxt_hwrm_error_recovery_qcfg(struct bnxt *bp)
77917806
{
77927807
struct bnxt_fw_health *fw_health = bp->fw_health;
@@ -8639,6 +8654,9 @@ static int bnxt_init_chip(struct bnxt *bp, bool irq_re_init)
86398654
vnic->uc_filter_count = 1;
86408655

86418656
vnic->rx_mask = 0;
8657+
if (test_bit(BNXT_STATE_HALF_OPEN, &bp->state))
8658+
goto skip_rx_mask;
8659+
86428660
if (bp->dev->flags & IFF_BROADCAST)
86438661
vnic->rx_mask |= CFA_L2_SET_RX_MASK_REQ_MASK_BCAST;
86448662

@@ -8648,7 +8666,7 @@ static int bnxt_init_chip(struct bnxt *bp, bool irq_re_init)
86488666
if (bp->dev->flags & IFF_ALLMULTI) {
86498667
vnic->rx_mask |= CFA_L2_SET_RX_MASK_REQ_MASK_ALL_MCAST;
86508668
vnic->mc_list_count = 0;
8651-
} else {
8669+
} else if (bp->dev->flags & IFF_MULTICAST) {
86528670
u32 mask = 0;
86538671

86548672
bnxt_mc_list_updated(bp, &mask);
@@ -8659,6 +8677,7 @@ static int bnxt_init_chip(struct bnxt *bp, bool irq_re_init)
86598677
if (rc)
86608678
goto err_out;
86618679

8680+
skip_rx_mask:
86628681
rc = bnxt_hwrm_set_coal(bp);
86638682
if (rc)
86648683
netdev_warn(bp->dev, "HWRM set coalescing failure rc: %x\n",
@@ -9850,8 +9869,8 @@ static int bnxt_hwrm_if_change(struct bnxt *bp, bool up)
98509869
resc_reinit = true;
98519870
if (flags & FUNC_DRV_IF_CHANGE_RESP_FLAGS_HOT_FW_RESET_DONE)
98529871
fw_reset = true;
9853-
else if (bp->fw_health && !bp->fw_health->status_reliable)
9854-
bnxt_try_map_fw_health_reg(bp);
9872+
else
9873+
bnxt_remap_fw_health_regs(bp);
98559874

98569875
if (test_bit(BNXT_STATE_IN_FW_RESET, &bp->state) && !fw_reset) {
98579876
netdev_err(bp->dev, "RESET_DONE not set during FW reset.\n");
@@ -10330,21 +10349,23 @@ int bnxt_half_open_nic(struct bnxt *bp)
1033010349
goto half_open_err;
1033110350
}
1033210351

10333-
rc = bnxt_alloc_mem(bp, false);
10352+
rc = bnxt_alloc_mem(bp, true);
1033410353
if (rc) {
1033510354
netdev_err(bp->dev, "bnxt_alloc_mem err: %x\n", rc);
1033610355
goto half_open_err;
1033710356
}
10338-
rc = bnxt_init_nic(bp, false);
10357+
set_bit(BNXT_STATE_HALF_OPEN, &bp->state);
10358+
rc = bnxt_init_nic(bp, true);
1033910359
if (rc) {
10360+
clear_bit(BNXT_STATE_HALF_OPEN, &bp->state);
1034010361
netdev_err(bp->dev, "bnxt_init_nic err: %x\n", rc);
1034110362
goto half_open_err;
1034210363
}
1034310364
return 0;
1034410365

1034510366
half_open_err:
1034610367
bnxt_free_skbs(bp);
10347-
bnxt_free_mem(bp, false);
10368+
bnxt_free_mem(bp, true);
1034810369
dev_close(bp->dev);
1034910370
return rc;
1035010371
}
@@ -10354,9 +10375,10 @@ int bnxt_half_open_nic(struct bnxt *bp)
1035410375
*/
1035510376
void bnxt_half_close_nic(struct bnxt *bp)
1035610377
{
10357-
bnxt_hwrm_resource_free(bp, false, false);
10378+
bnxt_hwrm_resource_free(bp, false, true);
1035810379
bnxt_free_skbs(bp);
10359-
bnxt_free_mem(bp, false);
10380+
bnxt_free_mem(bp, true);
10381+
clear_bit(BNXT_STATE_HALF_OPEN, &bp->state);
1036010382
}
1036110383

1036210384
void bnxt_reenable_sriov(struct bnxt *bp)
@@ -10772,7 +10794,7 @@ static void bnxt_set_rx_mode(struct net_device *dev)
1077210794
if (dev->flags & IFF_ALLMULTI) {
1077310795
mask |= CFA_L2_SET_RX_MASK_REQ_MASK_ALL_MCAST;
1077410796
vnic->mc_list_count = 0;
10775-
} else {
10797+
} else if (dev->flags & IFF_MULTICAST) {
1077610798
mc_update = bnxt_mc_list_updated(bp, &mask);
1077710799
}
1077810800

@@ -10849,9 +10871,10 @@ static int bnxt_cfg_rx_mode(struct bnxt *bp)
1084910871
!bnxt_promisc_ok(bp))
1085010872
vnic->rx_mask &= ~CFA_L2_SET_RX_MASK_REQ_MASK_PROMISCUOUS;
1085110873
rc = bnxt_hwrm_cfa_l2_set_rx_mask(bp, 0);
10852-
if (rc && vnic->mc_list_count) {
10874+
if (rc && (vnic->rx_mask & CFA_L2_SET_RX_MASK_REQ_MASK_MCAST)) {
1085310875
netdev_info(bp->dev, "Failed setting MC filters rc: %d, turning on ALL_MCAST mode\n",
1085410876
rc);
10877+
vnic->rx_mask &= ~CFA_L2_SET_RX_MASK_REQ_MASK_MCAST;
1085510878
vnic->rx_mask |= CFA_L2_SET_RX_MASK_REQ_MASK_ALL_MCAST;
1085610879
vnic->mc_list_count = 0;
1085710880
rc = bnxt_hwrm_cfa_l2_set_rx_mask(bp, 0);

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_devlink.c

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -367,15 +367,26 @@ bnxt_dl_livepatch_report_err(struct bnxt *bp, struct netlink_ext_ack *extack,
367367
}
368368
}
369369

370+
/* Live patch status in NVM */
371+
#define BNXT_LIVEPATCH_NOT_INSTALLED 0
372+
#define BNXT_LIVEPATCH_INSTALLED FW_LIVEPATCH_QUERY_RESP_STATUS_FLAGS_INSTALL
373+
#define BNXT_LIVEPATCH_REMOVED FW_LIVEPATCH_QUERY_RESP_STATUS_FLAGS_ACTIVE
374+
#define BNXT_LIVEPATCH_MASK (FW_LIVEPATCH_QUERY_RESP_STATUS_FLAGS_INSTALL | \
375+
FW_LIVEPATCH_QUERY_RESP_STATUS_FLAGS_ACTIVE)
376+
#define BNXT_LIVEPATCH_ACTIVATED BNXT_LIVEPATCH_MASK
377+
378+
#define BNXT_LIVEPATCH_STATE(flags) ((flags) & BNXT_LIVEPATCH_MASK)
379+
370380
static int
371381
bnxt_dl_livepatch_activate(struct bnxt *bp, struct netlink_ext_ack *extack)
372382
{
373383
struct hwrm_fw_livepatch_query_output *query_resp;
374384
struct hwrm_fw_livepatch_query_input *query_req;
375385
struct hwrm_fw_livepatch_output *patch_resp;
376386
struct hwrm_fw_livepatch_input *patch_req;
387+
u16 flags, live_patch_state;
388+
bool activated = false;
377389
u32 installed = 0;
378-
u16 flags;
379390
u8 target;
380391
int rc;
381392

@@ -394,7 +405,6 @@ bnxt_dl_livepatch_activate(struct bnxt *bp, struct netlink_ext_ack *extack)
394405
hwrm_req_drop(bp, query_req);
395406
return rc;
396407
}
397-
patch_req->opcode = FW_LIVEPATCH_REQ_OPCODE_ACTIVATE;
398408
patch_req->loadtype = FW_LIVEPATCH_REQ_LOADTYPE_NVM_INSTALL;
399409
patch_resp = hwrm_req_hold(bp, patch_req);
400410

@@ -407,12 +417,20 @@ bnxt_dl_livepatch_activate(struct bnxt *bp, struct netlink_ext_ack *extack)
407417
}
408418

409419
flags = le16_to_cpu(query_resp->status_flags);
410-
if (~flags & FW_LIVEPATCH_QUERY_RESP_STATUS_FLAGS_INSTALL)
420+
live_patch_state = BNXT_LIVEPATCH_STATE(flags);
421+
422+
if (live_patch_state == BNXT_LIVEPATCH_NOT_INSTALLED)
411423
continue;
412-
if ((flags & FW_LIVEPATCH_QUERY_RESP_STATUS_FLAGS_ACTIVE) &&
413-
!strncmp(query_resp->active_ver, query_resp->install_ver,
414-
sizeof(query_resp->active_ver)))
424+
425+
if (live_patch_state == BNXT_LIVEPATCH_ACTIVATED) {
426+
activated = true;
415427
continue;
428+
}
429+
430+
if (live_patch_state == BNXT_LIVEPATCH_INSTALLED)
431+
patch_req->opcode = FW_LIVEPATCH_REQ_OPCODE_ACTIVATE;
432+
else if (live_patch_state == BNXT_LIVEPATCH_REMOVED)
433+
patch_req->opcode = FW_LIVEPATCH_REQ_OPCODE_DEACTIVATE;
416434

417435
patch_req->fw_target = target;
418436
rc = hwrm_req_send(bp, patch_req);
@@ -424,8 +442,13 @@ bnxt_dl_livepatch_activate(struct bnxt *bp, struct netlink_ext_ack *extack)
424442
}
425443

426444
if (!rc && !installed) {
427-
NL_SET_ERR_MSG_MOD(extack, "No live patches found");
428-
rc = -ENOENT;
445+
if (activated) {
446+
NL_SET_ERR_MSG_MOD(extack, "Live patch already activated");
447+
rc = -EEXIST;
448+
} else {
449+
NL_SET_ERR_MSG_MOD(extack, "No live patches found");
450+
rc = -ENOENT;
451+
}
429452
}
430453
hwrm_req_drop(bp, query_req);
431454
hwrm_req_drop(bp, patch_req);

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

Lines changed: 13 additions & 4 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"
@@ -1969,6 +1970,9 @@ static int bnxt_get_fecparam(struct net_device *dev,
19691970
case PORT_PHY_QCFG_RESP_ACTIVE_FEC_FEC_RS272_IEEE_ACTIVE:
19701971
fec->active_fec |= ETHTOOL_FEC_LLRS;
19711972
break;
1973+
case PORT_PHY_QCFG_RESP_ACTIVE_FEC_FEC_NONE_ACTIVE:
1974+
fec->active_fec |= ETHTOOL_FEC_OFF;
1975+
break;
19721976
}
19731977
return 0;
19741978
}
@@ -3454,7 +3458,7 @@ static int bnxt_run_loopback(struct bnxt *bp)
34543458
if (!skb)
34553459
return -ENOMEM;
34563460
data = skb_put(skb, pkt_size);
3457-
eth_broadcast_addr(data);
3461+
ether_addr_copy(&data[i], bp->dev->dev_addr);
34583462
i += ETH_ALEN;
34593463
ether_addr_copy(&data[i], bp->dev->dev_addr);
34603464
i += ETH_ALEN;
@@ -3548,9 +3552,12 @@ static void bnxt_self_test(struct net_device *dev, struct ethtool_test *etest,
35483552
if (!offline) {
35493553
bnxt_run_fw_tests(bp, test_mask, &test_results);
35503554
} else {
3551-
rc = bnxt_close_nic(bp, false, false);
3552-
if (rc)
3555+
bnxt_ulp_stop(bp);
3556+
rc = bnxt_close_nic(bp, true, false);
3557+
if (rc) {
3558+
bnxt_ulp_start(bp, rc);
35533559
return;
3560+
}
35543561
bnxt_run_fw_tests(bp, test_mask, &test_results);
35553562

35563563
buf[BNXT_MACLPBK_TEST_IDX] = 1;
@@ -3560,6 +3567,7 @@ static void bnxt_self_test(struct net_device *dev, struct ethtool_test *etest,
35603567
if (rc) {
35613568
bnxt_hwrm_mac_loopback(bp, false);
35623569
etest->flags |= ETH_TEST_FL_FAILED;
3570+
bnxt_ulp_start(bp, rc);
35633571
return;
35643572
}
35653573
if (bnxt_run_loopback(bp))
@@ -3585,7 +3593,8 @@ static void bnxt_self_test(struct net_device *dev, struct ethtool_test *etest,
35853593
}
35863594
bnxt_hwrm_phy_loopback(bp, false, false);
35873595
bnxt_half_close_nic(bp);
3588-
rc = bnxt_open_nic(bp, false, true);
3596+
rc = bnxt_open_nic(bp, true, true);
3597+
bnxt_ulp_start(bp, rc);
35893598
}
35903599
if (rc || bnxt_test_irq(bp)) {
35913600
buf[BNXT_IRQ_TEST_IDX] = 1;

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -644,17 +644,23 @@ static int __hwrm_send(struct bnxt *bp, struct bnxt_hwrm_ctx *ctx)
644644

645645
/* Last byte of resp contains valid bit */
646646
valid = ((u8 *)ctx->resp) + len - 1;
647-
for (j = 0; j < HWRM_VALID_BIT_DELAY_USEC; j++) {
647+
for (j = 0; j < HWRM_VALID_BIT_DELAY_USEC; ) {
648648
/* make sure we read from updated DMA memory */
649649
dma_rmb();
650650
if (*valid)
651651
break;
652-
usleep_range(1, 5);
652+
if (j < 10) {
653+
udelay(1);
654+
j++;
655+
} else {
656+
usleep_range(20, 30);
657+
j += 20;
658+
}
653659
}
654660

655661
if (j >= HWRM_VALID_BIT_DELAY_USEC) {
656662
hwrm_err(bp, ctx, "Error (timeout: %u) msg {0x%x 0x%x} len:%d v:%d\n",
657-
hwrm_total_timeout(i), req_type,
663+
hwrm_total_timeout(i) + j, req_type,
658664
le16_to_cpu(ctx->req->seq_id), len, *valid);
659665
goto exit;
660666
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ static inline unsigned int hwrm_total_timeout(unsigned int n)
9090
}
9191

9292

93-
#define HWRM_VALID_BIT_DELAY_USEC 150
93+
#define HWRM_VALID_BIT_DELAY_USEC 50000
9494

9595
static inline bool bnxt_cfa_hwrm_message(u16 req_type)
9696
{

0 commit comments

Comments
 (0)