Skip to content

Commit

Permalink
Merge branch 'bnxt_en-Bug-fixes'
Browse files Browse the repository at this point in the history
Michael Chan says:

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

There are 4 driver fixes in this series:

1. Fix RX buffer leak during OOM condition.
2. Call pci_disable_msix() under correct conditions to prevent hitting BUG.
3. Reduce unneeded mmeory allocation in kdump kernel to prevent OOM.
4. Don't read device serial number on VFs because it is not supported.

Please queue shenki#1, shenki#2, #3 for -stable as well.  Thanks.
===================

Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
davem330 committed May 23, 2019
2 parents 31680ac + 2e9217d commit db51a73
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 17 deletions.
30 changes: 17 additions & 13 deletions drivers/net/ethernet/broadcom/bnxt/bnxt.c
Original file line number Diff line number Diff line change
Expand Up @@ -1642,6 +1642,8 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_cp_ring_info *cpr,
skb = bnxt_copy_skb(bnapi, data_ptr, len, dma_addr);
bnxt_reuse_rx_data(rxr, cons, data);
if (!skb) {
if (agg_bufs)
bnxt_reuse_rx_agg_bufs(cpr, cp_cons, agg_bufs);
rc = -ENOMEM;
goto next_rx;
}
Expand Down Expand Up @@ -6377,7 +6379,7 @@ static int bnxt_alloc_ctx_mem(struct bnxt *bp)
if (!ctx || (ctx->flags & BNXT_CTX_FLAG_INITED))
return 0;

if (bp->flags & BNXT_FLAG_ROCE_CAP) {
if ((bp->flags & BNXT_FLAG_ROCE_CAP) && !is_kdump_kernel()) {
pg_lvl = 2;
extra_qps = 65536;
extra_srqs = 8192;
Expand Down Expand Up @@ -7616,22 +7618,23 @@ static void bnxt_clear_int_mode(struct bnxt *bp)
bp->flags &= ~BNXT_FLAG_USING_MSIX;
}

int bnxt_reserve_rings(struct bnxt *bp)
int bnxt_reserve_rings(struct bnxt *bp, bool irq_re_init)
{
int tcs = netdev_get_num_tc(bp->dev);
bool reinit_irq = false;
bool irq_cleared = false;
int rc;

if (!bnxt_need_reserve_rings(bp))
return 0;

if (BNXT_NEW_RM(bp) && (bnxt_get_num_msix(bp) != bp->total_irqs)) {
if (irq_re_init && BNXT_NEW_RM(bp) &&
bnxt_get_num_msix(bp) != bp->total_irqs) {
bnxt_ulp_irq_stop(bp);
bnxt_clear_int_mode(bp);
reinit_irq = true;
irq_cleared = true;
}
rc = __bnxt_reserve_rings(bp);
if (reinit_irq) {
if (irq_cleared) {
if (!rc)
rc = bnxt_init_int_mode(bp);
bnxt_ulp_irq_restart(bp, rc);
Expand Down Expand Up @@ -8530,7 +8533,7 @@ static int __bnxt_open_nic(struct bnxt *bp, bool irq_re_init, bool link_re_init)
return rc;
}
}
rc = bnxt_reserve_rings(bp);
rc = bnxt_reserve_rings(bp, irq_re_init);
if (rc)
return rc;
if ((bp->flags & BNXT_FLAG_RFS) &&
Expand Down Expand Up @@ -10434,7 +10437,7 @@ static int bnxt_set_dflt_rings(struct bnxt *bp, bool sh)

if (sh)
bp->flags |= BNXT_FLAG_SHARED_RINGS;
dflt_rings = netif_get_num_default_rss_queues();
dflt_rings = is_kdump_kernel() ? 1 : netif_get_num_default_rss_queues();
/* Reduce default rings on multi-port cards so that total default
* rings do not exceed CPU count.
*/
Expand Down Expand Up @@ -10722,11 +10725,12 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
goto init_err_pci_clean;
}

/* Read the adapter's DSN to use as the eswitch switch_id */
rc = bnxt_pcie_dsn_get(bp, bp->switch_id);
if (rc)
goto init_err_pci_clean;

if (BNXT_PF(bp)) {
/* Read the adapter's DSN to use as the eswitch switch_id */
rc = bnxt_pcie_dsn_get(bp, bp->switch_id);
if (rc)
goto init_err_pci_clean;
}
bnxt_hwrm_func_qcfg(bp);
bnxt_hwrm_vnic_qcaps(bp);
bnxt_hwrm_port_led_qcaps(bp);
Expand Down
6 changes: 4 additions & 2 deletions drivers/net/ethernet/broadcom/bnxt/bnxt.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

#include <linux/interrupt.h>
#include <linux/rhashtable.h>
#include <linux/crash_dump.h>
#include <net/devlink.h>
#include <net/dst_metadata.h>
#include <net/xdp.h>
Expand Down Expand Up @@ -1369,7 +1370,8 @@ struct bnxt {
#define BNXT_CHIP_TYPE_NITRO_A0(bp) ((bp)->flags & BNXT_FLAG_CHIP_NITRO_A0)
#define BNXT_RX_PAGE_MODE(bp) ((bp)->flags & BNXT_FLAG_RX_PAGE_MODE)
#define BNXT_SUPPORTS_TPA(bp) (!BNXT_CHIP_TYPE_NITRO_A0(bp) && \
!(bp->flags & BNXT_FLAG_CHIP_P5))
!(bp->flags & BNXT_FLAG_CHIP_P5) && \
!is_kdump_kernel())

/* Chip class phase 5 */
#define BNXT_CHIP_P5(bp) \
Expand Down Expand Up @@ -1790,7 +1792,7 @@ unsigned int bnxt_get_avail_stat_ctxs_for_en(struct bnxt *bp);
unsigned int bnxt_get_max_func_cp_rings(struct bnxt *bp);
unsigned int bnxt_get_avail_cp_rings_for_en(struct bnxt *bp);
int bnxt_get_avail_msix(struct bnxt *bp, int num);
int bnxt_reserve_rings(struct bnxt *bp);
int bnxt_reserve_rings(struct bnxt *bp, bool irq_re_init);
void bnxt_tx_disable(struct bnxt *bp);
void bnxt_tx_enable(struct bnxt *bp);
int bnxt_hwrm_set_pause(struct bnxt *);
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,7 @@ static int bnxt_set_channels(struct net_device *dev,
*/
}
} else {
rc = bnxt_reserve_rings(bp);
rc = bnxt_reserve_rings(bp, true);
}

return rc;
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ static int bnxt_req_msix_vecs(struct bnxt_en_dev *edev, int ulp_id,
bnxt_close_nic(bp, true, false);
rc = bnxt_open_nic(bp, true, false);
} else {
rc = bnxt_reserve_rings(bp);
rc = bnxt_reserve_rings(bp, true);
}
}
if (rc) {
Expand Down

0 comments on commit db51a73

Please sign in to comment.