* [PATCH net 1/5] bnxt_en: Disable bus master during PCI shutdown and driver unload.
2019-06-29 15:16 [PATCH net 0/5] bnxt_en: Bug fixes Michael Chan
@ 2019-06-29 15:16 ` Michael Chan
2019-06-29 15:16 ` [PATCH net 2/5] bnxt_en: Fix ethtool selftest crash under error conditions Michael Chan
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Michael Chan @ 2019-06-29 15:16 UTC (permalink / raw)
To: davem; +Cc: netdev
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.
Fixes: 98f04cf0f1fc ("bnxt_en: Check context memory requirements from firmware.")
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
---
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index f758b2e..b9bc829 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -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);
}
--
2.5.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH net 2/5] bnxt_en: Fix ethtool selftest crash under error conditions.
2019-06-29 15:16 [PATCH net 0/5] bnxt_en: Bug fixes Michael Chan
2019-06-29 15:16 ` [PATCH net 1/5] bnxt_en: Disable bus master during PCI shutdown and driver unload Michael Chan
@ 2019-06-29 15:16 ` Michael Chan
2019-06-29 15:16 ` [PATCH net 3/5] bnxt_en: Fix statistics context reservation logic for RDMA driver Michael Chan
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Michael Chan @ 2019-06-29 15:16 UTC (permalink / raw)
To: davem; +Cc: netdev
After 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.
Reported-by: Somasundaram Krishnasamy <somasundaram.krishnasamy@oracle.com>
Fixes: 67fea463fd87 ("bnxt_en: Add interrupt test to ethtool -t selftest.")
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
---
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
index a6c7baf..ec68707 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
@@ -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;
}
--
2.5.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH net 3/5] bnxt_en: Fix statistics context reservation logic for RDMA driver.
2019-06-29 15:16 [PATCH net 0/5] bnxt_en: Bug fixes Michael Chan
2019-06-29 15:16 ` [PATCH net 1/5] bnxt_en: Disable bus master during PCI shutdown and driver unload Michael Chan
2019-06-29 15:16 ` [PATCH net 2/5] bnxt_en: Fix ethtool selftest crash under error conditions Michael Chan
@ 2019-06-29 15:16 ` Michael Chan
2019-06-29 15:16 ` [PATCH net 4/5] bnxt_en: Cap the returned MSIX vectors to the " Michael Chan
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Michael Chan @ 2019-06-29 15:16 UTC (permalink / raw)
To: davem; +Cc: netdev
The 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.
Fixes: 780baad44f0f ("bnxt_en: Reserve 1 stat_ctx for RDMA driver.")
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
---
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index b9bc829..9090c79 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -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)
--
2.5.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH net 4/5] bnxt_en: Cap the returned MSIX vectors to the RDMA driver.
2019-06-29 15:16 [PATCH net 0/5] bnxt_en: Bug fixes Michael Chan
` (2 preceding siblings ...)
2019-06-29 15:16 ` [PATCH net 3/5] bnxt_en: Fix statistics context reservation logic for RDMA driver Michael Chan
@ 2019-06-29 15:16 ` Michael Chan
2019-06-29 15:16 ` [PATCH net 5/5] bnxt_en: Suppress error messages when querying DSCP DCB capabilities Michael Chan
2019-06-30 23:01 ` [PATCH net 0/5] bnxt_en: Bug fixes David Miller
5 siblings, 0 replies; 7+ messages in thread
From: Michael Chan @ 2019-06-29 15:16 UTC (permalink / raw)
To: davem; +Cc: netdev
In 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.
Fixes: 01989c6b69d9 ("bnxt_en: Improve NQ reservations.")
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
---
drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c
index bfa342a..fc77caf 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c
@@ -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);
--
2.5.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH net 5/5] bnxt_en: Suppress error messages when querying DSCP DCB capabilities.
2019-06-29 15:16 [PATCH net 0/5] bnxt_en: Bug fixes Michael Chan
` (3 preceding siblings ...)
2019-06-29 15:16 ` [PATCH net 4/5] bnxt_en: Cap the returned MSIX vectors to the " Michael Chan
@ 2019-06-29 15:16 ` Michael Chan
2019-06-30 23:01 ` [PATCH net 0/5] bnxt_en: Bug fixes David Miller
5 siblings, 0 replies; 7+ messages in thread
From: Michael Chan @ 2019-06-29 15:16 UTC (permalink / raw)
To: davem; +Cc: netdev
Some 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.
Fixes: afdc8a84844a ("bnxt_en: Add DCBNL DSCP application protocol support.")
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
---
drivers/net/ethernet/broadcom/bnxt/bnxt_dcb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_dcb.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_dcb.c
index 7077515..07301cb 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_dcb.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_dcb.c
@@ -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)
--
2.5.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH net 0/5] bnxt_en: Bug fixes.
2019-06-29 15:16 [PATCH net 0/5] bnxt_en: Bug fixes Michael Chan
` (4 preceding siblings ...)
2019-06-29 15:16 ` [PATCH net 5/5] bnxt_en: Suppress error messages when querying DSCP DCB capabilities Michael Chan
@ 2019-06-30 23:01 ` David Miller
5 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2019-06-30 23:01 UTC (permalink / raw)
To: michael.chan; +Cc: netdev
From: Michael Chan <michael.chan@broadcom.com>
Date: Sat, 29 Jun 2019 11:16:43 -0400
> 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.
> Please also queue patches 1, 2, and 3 for -stable. Thanks.
Queued up.
^ permalink raw reply [flat|nested] 7+ messages in thread