Skip to content

Commit 0a7bc4d

Browse files
committed
Merge branch 'bnxt_en-fixes'
Michael Chan says: ==================== bnxt_en: Misc. bug fixes This series fixes a bug in the driver initialization path, MSIX setup sequencing issue in the FW error and AER paths, a missing skb_mark_for_recycle() in the VLAN error path, some ethtool coredump fixes, an ethtool selftest fix, and an ethtool register dump byte order fix. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2 parents b936a9b + 02e8be5 commit 0a7bc4d

File tree

4 files changed

+65
-24
lines changed

4 files changed

+65
-24
lines changed

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

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2015,6 +2015,7 @@ static struct sk_buff *bnxt_rx_vlan(struct sk_buff *skb, u8 cmp_type,
20152015
}
20162016
return skb;
20172017
vlan_err:
2018+
skb_mark_for_recycle(skb);
20182019
dev_kfree_skb(skb);
20192020
return NULL;
20202021
}
@@ -11602,6 +11603,9 @@ static void bnxt_init_napi(struct bnxt *bp)
1160211603
poll_fn = bnxt_poll_p5;
1160311604
else if (BNXT_CHIP_TYPE_NITRO_A0(bp))
1160411605
cp_nr_rings--;
11606+
11607+
set_bit(BNXT_STATE_NAPI_DISABLED, &bp->state);
11608+
1160511609
for (i = 0; i < cp_nr_rings; i++) {
1160611610
bnapi = bp->bnapi[i];
1160711611
netif_napi_add_config_locked(bp->dev, &bnapi->napi, poll_fn,
@@ -12321,12 +12325,15 @@ static int bnxt_hwrm_if_change(struct bnxt *bp, bool up)
1232112325
{
1232212326
struct hwrm_func_drv_if_change_output *resp;
1232312327
struct hwrm_func_drv_if_change_input *req;
12324-
bool fw_reset = !bp->irq_tbl;
1232512328
bool resc_reinit = false;
1232612329
bool caps_change = false;
1232712330
int rc, retry = 0;
12331+
bool fw_reset;
1232812332
u32 flags = 0;
1232912333

12334+
fw_reset = (bp->fw_reset_state == BNXT_FW_RESET_STATE_ABORT);
12335+
bp->fw_reset_state = 0;
12336+
1233012337
if (!(bp->fw_cap & BNXT_FW_CAP_IF_CHANGE))
1233112338
return 0;
1233212339

@@ -12395,13 +12402,8 @@ static int bnxt_hwrm_if_change(struct bnxt *bp, bool up)
1239512402
set_bit(BNXT_STATE_ABORT_ERR, &bp->state);
1239612403
return rc;
1239712404
}
12405+
/* IRQ will be initialized later in bnxt_request_irq()*/
1239812406
bnxt_clear_int_mode(bp);
12399-
rc = bnxt_init_int_mode(bp);
12400-
if (rc) {
12401-
clear_bit(BNXT_STATE_FW_RESET_DET, &bp->state);
12402-
netdev_err(bp->dev, "init int mode failed\n");
12403-
return rc;
12404-
}
1240512407
}
1240612408
rc = bnxt_cancel_reservations(bp, fw_reset);
1240712409
}
@@ -14834,7 +14836,7 @@ static void bnxt_fw_reset_abort(struct bnxt *bp, int rc)
1483414836
clear_bit(BNXT_STATE_IN_FW_RESET, &bp->state);
1483514837
if (bp->fw_reset_state != BNXT_FW_RESET_STATE_POLL_VF)
1483614838
bnxt_dl_health_fw_status_update(bp, false);
14837-
bp->fw_reset_state = 0;
14839+
bp->fw_reset_state = BNXT_FW_RESET_STATE_ABORT;
1483814840
netif_close(bp->dev);
1483914841
}
1484014842

@@ -16932,10 +16934,9 @@ static pci_ers_result_t bnxt_io_slot_reset(struct pci_dev *pdev)
1693216934
if (!err)
1693316935
result = PCI_ERS_RESULT_RECOVERED;
1693416936

16937+
/* IRQ will be initialized later in bnxt_io_resume */
1693516938
bnxt_ulp_irq_stop(bp);
1693616939
bnxt_clear_int_mode(bp);
16937-
err = bnxt_init_int_mode(bp);
16938-
bnxt_ulp_irq_restart(bp, err);
1693916940
}
1694016941

1694116942
reset_exit:
@@ -16964,10 +16965,13 @@ static void bnxt_io_resume(struct pci_dev *pdev)
1696416965

1696516966
err = bnxt_hwrm_func_qcaps(bp);
1696616967
if (!err) {
16967-
if (netif_running(netdev))
16968+
if (netif_running(netdev)) {
1696816969
err = bnxt_open(netdev);
16969-
else
16970+
} else {
1697016971
err = bnxt_reserve_rings(bp, true);
16972+
if (!err)
16973+
err = bnxt_init_int_mode(bp);
16974+
}
1697116975
}
1697216976

1697316977
if (!err)

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2614,6 +2614,7 @@ struct bnxt {
26142614
#define BNXT_FW_RESET_STATE_POLL_FW 4
26152615
#define BNXT_FW_RESET_STATE_OPENING 5
26162616
#define BNXT_FW_RESET_STATE_POLL_FW_DOWN 6
2617+
#define BNXT_FW_RESET_STATE_ABORT 7
26172618

26182619
u16 fw_reset_min_dsecs;
26192620
#define BNXT_DFLT_FW_RST_MIN_DSECS 20

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

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,20 +110,30 @@ static int bnxt_hwrm_dbg_dma_data(struct bnxt *bp, void *msg,
110110
}
111111
}
112112

113+
if (cmn_req->req_type ==
114+
cpu_to_le16(HWRM_DBG_COREDUMP_RETRIEVE))
115+
info->dest_buf_size += len;
116+
113117
if (info->dest_buf) {
114118
if ((info->seg_start + off + len) <=
115119
BNXT_COREDUMP_BUF_LEN(info->buf_len)) {
116-
memcpy(info->dest_buf + off, dma_buf, len);
120+
u16 copylen = min_t(u16, len,
121+
info->dest_buf_size - off);
122+
123+
memcpy(info->dest_buf + off, dma_buf, copylen);
124+
if (copylen < len)
125+
break;
117126
} else {
118127
rc = -ENOBUFS;
128+
if (cmn_req->req_type ==
129+
cpu_to_le16(HWRM_DBG_COREDUMP_LIST)) {
130+
kfree(info->dest_buf);
131+
info->dest_buf = NULL;
132+
}
119133
break;
120134
}
121135
}
122136

123-
if (cmn_req->req_type ==
124-
cpu_to_le16(HWRM_DBG_COREDUMP_RETRIEVE))
125-
info->dest_buf_size += len;
126-
127137
if (!(cmn_resp->flags & HWRM_DBG_CMN_FLAGS_MORE))
128138
break;
129139

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

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2062,6 +2062,17 @@ static int bnxt_get_regs_len(struct net_device *dev)
20622062
return reg_len;
20632063
}
20642064

2065+
#define BNXT_PCIE_32B_ENTRY(start, end) \
2066+
{ offsetof(struct pcie_ctx_hw_stats, start), \
2067+
offsetof(struct pcie_ctx_hw_stats, end) }
2068+
2069+
static const struct {
2070+
u16 start;
2071+
u16 end;
2072+
} bnxt_pcie_32b_entries[] = {
2073+
BNXT_PCIE_32B_ENTRY(pcie_ltssm_histogram[0], pcie_ltssm_histogram[3]),
2074+
};
2075+
20652076
static void bnxt_get_regs(struct net_device *dev, struct ethtool_regs *regs,
20662077
void *_p)
20672078
{
@@ -2094,12 +2105,27 @@ static void bnxt_get_regs(struct net_device *dev, struct ethtool_regs *regs,
20942105
req->pcie_stat_host_addr = cpu_to_le64(hw_pcie_stats_addr);
20952106
rc = hwrm_req_send(bp, req);
20962107
if (!rc) {
2097-
__le64 *src = (__le64 *)hw_pcie_stats;
2098-
u64 *dst = (u64 *)(_p + BNXT_PXP_REG_LEN);
2099-
int i;
2100-
2101-
for (i = 0; i < sizeof(*hw_pcie_stats) / sizeof(__le64); i++)
2102-
dst[i] = le64_to_cpu(src[i]);
2108+
u8 *dst = (u8 *)(_p + BNXT_PXP_REG_LEN);
2109+
u8 *src = (u8 *)hw_pcie_stats;
2110+
int i, j;
2111+
2112+
for (i = 0, j = 0; i < sizeof(*hw_pcie_stats); ) {
2113+
if (i >= bnxt_pcie_32b_entries[j].start &&
2114+
i <= bnxt_pcie_32b_entries[j].end) {
2115+
u32 *dst32 = (u32 *)(dst + i);
2116+
2117+
*dst32 = le32_to_cpu(*(__le32 *)(src + i));
2118+
i += 4;
2119+
if (i > bnxt_pcie_32b_entries[j].end &&
2120+
j < ARRAY_SIZE(bnxt_pcie_32b_entries) - 1)
2121+
j++;
2122+
} else {
2123+
u64 *dst64 = (u64 *)(dst + i);
2124+
2125+
*dst64 = le64_to_cpu(*(__le64 *)(src + i));
2126+
i += 8;
2127+
}
2128+
}
21032129
}
21042130
hwrm_req_drop(bp, req);
21052131
}
@@ -4991,14 +5017,14 @@ static void bnxt_self_test(struct net_device *dev, struct ethtool_test *etest,
49915017
if (!bp->num_tests || !BNXT_PF(bp))
49925018
return;
49935019

5020+
memset(buf, 0, sizeof(u64) * bp->num_tests);
49945021
if (etest->flags & ETH_TEST_FL_OFFLINE &&
49955022
bnxt_ulp_registered(bp->edev)) {
49965023
etest->flags |= ETH_TEST_FL_FAILED;
49975024
netdev_warn(dev, "Offline tests cannot be run with RoCE driver loaded\n");
49985025
return;
49995026
}
50005027

5001-
memset(buf, 0, sizeof(u64) * bp->num_tests);
50025028
if (!netif_running(dev)) {
50035029
etest->flags |= ETH_TEST_FL_FAILED;
50045030
return;

0 commit comments

Comments
 (0)