bnxt_en: Bug fixes.
Michael Chan
maintainercover bnxt_en: Bug fixes.
Miscellaneous bug fix patches, including two resource handling fixes for the RDMA driver, a PCI shutdown patch to add pci_disable_device(), a patch to fix ethtool selftest crash, and the last one suppresses an unnecessry error message.
Please also queue patches 1, 2, and 3 for -stable. Thanks.
Michael Chan (5):
bnxt_en: Disable bus master during PCI shutdown and driver unload.
bnxt_en: Fix ethtool selftest crash under error conditions.
bnxt_en: Fix statistics context reservation logic for RDMA driver.
bnxt_en: Cap the returned MSIX vectors to the RDMA driver.
bnxt_en: Suppress error messages when querying DSCP DCB capabilities.
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 20 +++++++++++++------- drivers/net/ethernet/broadcom/bnxt/bnxt_dcb.c | 2 +- drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 6 +++--- drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c | 4 +++- 4 files changed, 20 insertions(+), 12 deletions(-)
Signature · 1 line
2.5.1
Michael Chan
maintainerPATCH 1/5 bnxt_en: Disable bus master during PCI shutdown and driver unload.
Some chips with older firmware can continue to perform DMA read from context memory even after the memory has been freed. In the PCI shutdown method, we need to call pci_disable_device() to shutdown DMA to prevent this DMA before we put the device into D3hot. DMA memory request in D3hot state will generate PCI fatal error. Similarly, in the driver remove method, the context memory should only be freed after DMA has been shutdown for correctness.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +2 -1
@@ -10262,10 +10262,10 @@ static void bnxt_remove_one(struct pci_dev *pdev)bnxt_dcb_free (bp);kfree (bp->edev); bp->edev =NULL ; +bnxt_cleanup_pci (bp);bnxt_free_ctx_mem (bp);kfree (bp->ctx); bp->ctx =NULL ; -bnxt_cleanup_pci (bp);bnxt_free_port_stats (bp);free_netdev (dev); }
@@ -10859,6 +10859,7 @@ static void bnxt_shutdown(struct pci_dev *pdev)if (system_state ==SYSTEM_POWER_OFF ) {bnxt_clear_int_mode (bp); +pci_disable_device (pdev);pci_wake_from_d3 (pdev, bp->wol);pci_set_power_state (pdev, PCI_D3hot); }
Signature · 1 line
2.5.1
Michael Chan
maintainerPATCH 2/5 bnxt_en: Fix ethtool selftest crash under error conditions.
In reply to Michael ChanAfter ethtool loopback packet tests, we re-open the nic for the next IRQ test. If the open fails, we must not proceed with the IRQ test or we will crash with NULL pointer dereference. Fix it by checking the bnxt_open_nic() return code before proceeding.
--- drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +3 -3
@@ -2842,7 +2842,7 @@ static void bnxt_self_test(struct net_device *dev, struct ethtool_test *etest,bool offline = false;u8 test_results =0 ;u8 test_mask =0 ; -int rc, i; +int rc =0 , i;if (!bp->num_tests || !BNXT_SINGLE_PF (bp))return ;
@@ -2913,9 +2913,9 @@ static void bnxt_self_test(struct net_device *dev, struct ethtool_test *etest, }bnxt_hwrm_phy_loopback (bp, false, false);bnxt_half_close_nic (bp); -bnxt_open_nic (bp, false, true); + rc =bnxt_open_nic (bp, false, true); } -if (bnxt_test_irq (bp)) { +if (rc ||bnxt_test_irq (bp)) { buf[BNXT_IRQ_TEST_IDX ] =1 ; etest->flags |=ETH_TEST_FL_FAILED ; }
Signature · 1 line
2.5.1
Michael Chan
maintainerPATCH 3/5 bnxt_en: Fix statistics context reservation logic for RDMA driver.
In reply to Michael ChanThe current logic assumes that the RDMA driver uses one statistics context adjacent to the ones used by the network driver. This assumption is not true and the statistics context used by the RDMA driver is tied to its MSIX base vector. This wrong assumption can cause RDMA driver failure after changing ethtool rings on the network side. Fix the statistics reservation logic accordingly.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +11 -6
@@ -5508,7 +5508,16 @@ static int bnxt_cp_rings_in_use(struct bnxt *bp)static int bnxt_get_func_stat_ctxs (struct bnxt *bp) { -return bp->cp_nr_rings +bnxt_get_ulp_stat_ctxs (bp); +int ulp_stat =bnxt_get_ulp_stat_ctxs (bp); +int cp = bp->cp_nr_rings; + +if (!ulp_stat) +return cp; + +if (bnxt_nq_rings_in_use (bp) > cp +bnxt_get_ulp_msix_num (bp)) +return bnxt_get_ulp_msix_base (bp) + ulp_stat; + +return cp + ulp_stat; }static bool bnxt_need_reserve_rings (struct bnxt *bp)
@@ -7477,11 +7486,7 @@ unsigned int bnxt_get_avail_cp_rings_for_en(struct bnxt *bp)unsigned int bnxt_get_avail_stat_ctxs_for_en (struct bnxt *bp) { -unsigned int stat; - - stat =bnxt_get_max_func_stat_ctxs (bp) -bnxt_get_ulp_stat_ctxs (bp); - stat -= bp->cp_nr_rings; -return stat; +return bnxt_get_max_func_stat_ctxs (bp) -bnxt_get_func_stat_ctxs (bp); }int bnxt_get_avail_msix (struct bnxt *bp,int num)
Signature · 1 line
2.5.1
Michael Chan
maintainerPATCH 4/5 bnxt_en: Cap the returned MSIX vectors to the RDMA driver.
In reply to Michael ChanIn an earlier commit to improve NQ reservations on 57500 chips, we set the resv_irqs on the 57500 VFs to the fixed value assigned by the PF regardless of how many are actually used. The current code assumes that resv_irqs minus the ones used by the network driver must be the ones for the RDMA driver. This is no longer true and we may return more MSIX vectors than requested, causing inconsistency. Fix it by capping the value.
--- drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c +3 -1
@@ -157,8 +157,10 @@ static int bnxt_req_msix_vecs(struct bnxt_en_dev *edev, int ulp_id,if (BNXT_NEW_RM (bp)) {struct bnxt_hw_resc *hw_resc = &bp->hw_resc; +int resv_msix; - avail_msix = hw_resc->resv_irqs - bp->cp_nr_rings; + resv_msix = hw_resc->resv_irqs - bp->cp_nr_rings; + avail_msix =min_t (int, resv_msix, avail_msix); edev->ulp_tbl[ulp_id].msix_requested = avail_msix; }bnxt_fill_msix_vecs (bp, ent);
Signature · 1 line
2.5.1
Michael Chan
maintainerPATCH 5/5 bnxt_en: Suppress error messages when querying DSCP DCB capabilities.
In reply to Michael ChanSome firmware versions do not support this so use the silent variant to send the message to firmware to suppress the harmless error. This error message is unnecessarily alarming the user.
--- drivers/net/ethernet/broadcom/bnxt/bnxt_dcb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/broadcom/bnxt/bnxt_dcb.c +1 -1
@@ -396,7 +396,7 @@ static int bnxt_hwrm_queue_dscp_qcaps(struct bnxt *bp)bnxt_hwrm_cmd_hdr_init (bp, &req,HWRM_QUEUE_DSCP_QCAPS ,-1 ,-1 );mutex_lock (&bp->hwrm_cmd_lock); - rc =_hwrm_send_message (bp, &req,sizeof (req),HWRM_CMD_TIMEOUT ); + rc =_hwrm_send_message_silent (bp, &req,sizeof (req),HWRM_CMD_TIMEOUT );if (!rc) { bp->max_dscp_value = (1 << resp->num_dscp_bits) -1 ;if (bp->max_dscp_value <0x3f )
Signature · 1 line
2.5.1
David Miller
maintainerFrom: Michael Chan <[email protected]>
Date: Sat, 29 Jun 2019 11:16:43 -0400
Quoted 4 lines
Miscellaneous bug fix patches, including two resource handling fixes for the RDMA driver, a PCI shutdown patch to add
pci_disable_device(), a patch to fix ethtool selftest crash, and the last one suppresses an unnecessry error message.
Series applied.
Quoted 1 line
Please also queue patches 1, 2, and 3 for -stable. Thanks.
Queued up.