Commit bc4adf0e authored by Jakub Kicinski's avatar Jakub Kicinski

Merge branch 'bnxt_en-bug-fixes'

Michael Chan says:

====================
bnxt_en: Bug fixes.

The first patch fixes recovery of fatal AER errors.  The second one
fixes a potential array out of bounds issue.
====================

Link: https://lore.kernel.org/r/1609096698-15009-1-git-send-email-michael.chan@broadcom.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents 74f88c16 a029a2fe
...@@ -6790,8 +6790,10 @@ static int bnxt_hwrm_func_backing_store_qcaps(struct bnxt *bp) ...@@ -6790,8 +6790,10 @@ static int bnxt_hwrm_func_backing_store_qcaps(struct bnxt *bp)
ctx->tqm_fp_rings_count = resp->tqm_fp_rings_count; ctx->tqm_fp_rings_count = resp->tqm_fp_rings_count;
if (!ctx->tqm_fp_rings_count) if (!ctx->tqm_fp_rings_count)
ctx->tqm_fp_rings_count = bp->max_q; ctx->tqm_fp_rings_count = bp->max_q;
else if (ctx->tqm_fp_rings_count > BNXT_MAX_TQM_FP_RINGS)
ctx->tqm_fp_rings_count = BNXT_MAX_TQM_FP_RINGS;
tqm_rings = ctx->tqm_fp_rings_count + 1; tqm_rings = ctx->tqm_fp_rings_count + BNXT_MAX_TQM_SP_RINGS;
ctx_pg = kcalloc(tqm_rings, sizeof(*ctx_pg), GFP_KERNEL); ctx_pg = kcalloc(tqm_rings, sizeof(*ctx_pg), GFP_KERNEL);
if (!ctx_pg) { if (!ctx_pg) {
kfree(ctx); kfree(ctx);
...@@ -6925,7 +6927,8 @@ static int bnxt_hwrm_func_backing_store_cfg(struct bnxt *bp, u32 enables) ...@@ -6925,7 +6927,8 @@ static int bnxt_hwrm_func_backing_store_cfg(struct bnxt *bp, u32 enables)
pg_attr = &req.tqm_sp_pg_size_tqm_sp_lvl, pg_attr = &req.tqm_sp_pg_size_tqm_sp_lvl,
pg_dir = &req.tqm_sp_page_dir, pg_dir = &req.tqm_sp_page_dir,
ena = FUNC_BACKING_STORE_CFG_REQ_ENABLES_TQM_SP; ena = FUNC_BACKING_STORE_CFG_REQ_ENABLES_TQM_SP;
i < 9; i++, num_entries++, pg_attr++, pg_dir++, ena <<= 1) { i < BNXT_MAX_TQM_RINGS;
i++, num_entries++, pg_attr++, pg_dir++, ena <<= 1) {
if (!(enables & ena)) if (!(enables & ena))
continue; continue;
...@@ -12887,10 +12890,10 @@ static pci_ers_result_t bnxt_io_error_detected(struct pci_dev *pdev, ...@@ -12887,10 +12890,10 @@ static pci_ers_result_t bnxt_io_error_detected(struct pci_dev *pdev,
*/ */
static pci_ers_result_t bnxt_io_slot_reset(struct pci_dev *pdev) static pci_ers_result_t bnxt_io_slot_reset(struct pci_dev *pdev)
{ {
pci_ers_result_t result = PCI_ERS_RESULT_DISCONNECT;
struct net_device *netdev = pci_get_drvdata(pdev); struct net_device *netdev = pci_get_drvdata(pdev);
struct bnxt *bp = netdev_priv(netdev); struct bnxt *bp = netdev_priv(netdev);
int err = 0, off; int err = 0, off;
pci_ers_result_t result = PCI_ERS_RESULT_DISCONNECT;
netdev_info(bp->dev, "PCI Slot Reset\n"); netdev_info(bp->dev, "PCI Slot Reset\n");
...@@ -12919,22 +12922,8 @@ static pci_ers_result_t bnxt_io_slot_reset(struct pci_dev *pdev) ...@@ -12919,22 +12922,8 @@ static pci_ers_result_t bnxt_io_slot_reset(struct pci_dev *pdev)
pci_save_state(pdev); pci_save_state(pdev);
err = bnxt_hwrm_func_reset(bp); err = bnxt_hwrm_func_reset(bp);
if (!err) { if (!err)
err = bnxt_hwrm_func_qcaps(bp);
if (!err && netif_running(netdev))
err = bnxt_open(netdev);
}
bnxt_ulp_start(bp, err);
if (!err) {
bnxt_reenable_sriov(bp);
result = PCI_ERS_RESULT_RECOVERED; result = PCI_ERS_RESULT_RECOVERED;
}
}
if (result != PCI_ERS_RESULT_RECOVERED) {
if (netif_running(netdev))
dev_close(netdev);
pci_disable_device(pdev);
} }
rtnl_unlock(); rtnl_unlock();
...@@ -12952,10 +12941,21 @@ static pci_ers_result_t bnxt_io_slot_reset(struct pci_dev *pdev) ...@@ -12952,10 +12941,21 @@ static pci_ers_result_t bnxt_io_slot_reset(struct pci_dev *pdev)
static void bnxt_io_resume(struct pci_dev *pdev) static void bnxt_io_resume(struct pci_dev *pdev)
{ {
struct net_device *netdev = pci_get_drvdata(pdev); struct net_device *netdev = pci_get_drvdata(pdev);
struct bnxt *bp = netdev_priv(netdev);
int err;
netdev_info(bp->dev, "PCI Slot Resume\n");
rtnl_lock(); rtnl_lock();
netif_device_attach(netdev); err = bnxt_hwrm_func_qcaps(bp);
if (!err && netif_running(netdev))
err = bnxt_open(netdev);
bnxt_ulp_start(bp, err);
if (!err) {
bnxt_reenable_sriov(bp);
netif_device_attach(netdev);
}
rtnl_unlock(); rtnl_unlock();
} }
......
...@@ -1436,6 +1436,11 @@ struct bnxt_ctx_pg_info { ...@@ -1436,6 +1436,11 @@ struct bnxt_ctx_pg_info {
struct bnxt_ctx_pg_info **ctx_pg_tbl; struct bnxt_ctx_pg_info **ctx_pg_tbl;
}; };
#define BNXT_MAX_TQM_SP_RINGS 1
#define BNXT_MAX_TQM_FP_RINGS 8
#define BNXT_MAX_TQM_RINGS \
(BNXT_MAX_TQM_SP_RINGS + BNXT_MAX_TQM_FP_RINGS)
struct bnxt_ctx_mem_info { struct bnxt_ctx_mem_info {
u32 qp_max_entries; u32 qp_max_entries;
u16 qp_min_qp1_entries; u16 qp_min_qp1_entries;
...@@ -1474,7 +1479,7 @@ struct bnxt_ctx_mem_info { ...@@ -1474,7 +1479,7 @@ struct bnxt_ctx_mem_info {
struct bnxt_ctx_pg_info stat_mem; struct bnxt_ctx_pg_info stat_mem;
struct bnxt_ctx_pg_info mrav_mem; struct bnxt_ctx_pg_info mrav_mem;
struct bnxt_ctx_pg_info tim_mem; struct bnxt_ctx_pg_info tim_mem;
struct bnxt_ctx_pg_info *tqm_mem[9]; struct bnxt_ctx_pg_info *tqm_mem[BNXT_MAX_TQM_RINGS];
}; };
struct bnxt_fw_health { struct bnxt_fw_health {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment