[2/5] net/bnx2x: fix interrupt flood

Message ID 20190604185352.28629-2-shshaikh@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series [1/5] net/bnx2x: fix packet drop |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation fail Compilation issues

Commit Message

Shahed Shaikh June 4, 2019, 6:53 p.m. UTC
  PMD sets up and clears the slow path interrupt status block in dev_start
and dev_stop flow and slow path interrupt status block DMA memory for
device is allocated in dev_configure flow.

This situation creates a state where, after dev_stop is called, and if
there is a slow path interrupt from device, PMD sees the old value of
status block consumer in dev_start flow, since DMA memory for status block
belongs to old configuration and dev_start will result in
new slow path interrupt status block configuration.
And since PMD fails to ack new slow path interrupt with correct status
block consumer value, device continues to trigger interrupt causing an
interrupt flood.

Fix is to create and destroy status block DMA memory in dev_start and
dev_stop flow instead of dev_configure and dev_close flow.

Fixes: 540a211084a7 ("bnx2x: driver core")
Cc: stable@dpdk.org

Signed-off-by: Shahed Shaikh <shshaikh@marvell.com>
---
 drivers/net/bnx2x/bnx2x.c        | 10 ++++++++++
 drivers/net/bnx2x/bnx2x_ethdev.c | 10 ----------
 2 files changed, 10 insertions(+), 10 deletions(-)
  

Patch

diff --git a/drivers/net/bnx2x/bnx2x.c b/drivers/net/bnx2x/bnx2x.c
index 0698b1a8a..e9f05a73a 100644
--- a/drivers/net/bnx2x/bnx2x.c
+++ b/drivers/net/bnx2x/bnx2x.c
@@ -2401,6 +2401,9 @@  static void bnx2x_free_mem(struct bnx2x_softc *sc)
 	ecore_ilt_mem_op(sc, ILT_MEMOP_FREE);
 
 	bnx2x_free_ilt_lines_mem(sc);
+
+	/* free the host hardware/software hsi structures */
+	bnx2x_free_hsi_mem(sc);
 }
 
 static int bnx2x_alloc_mem(struct bnx2x_softc *sc)
@@ -2451,6 +2454,13 @@  static int bnx2x_alloc_mem(struct bnx2x_softc *sc)
 		return -1;
 	}
 
+	/* allocate the host hardware/software hsi structures */
+	if (bnx2x_alloc_hsi_mem(sc) != 0) {
+		PMD_DRV_LOG(ERR, sc, "bnx2x_alloc_hsi_mem was failed");
+		bnx2x_free_mem(sc);
+		return -ENXIO;
+	}
+
 	return 0;
 }
 
diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c
index 3063aea64..5dfd708ef 100644
--- a/drivers/net/bnx2x/bnx2x_ethdev.c
+++ b/drivers/net/bnx2x/bnx2x_ethdev.c
@@ -207,13 +207,6 @@  bnx2x_dev_configure(struct rte_eth_dev *dev)
 		return -ENXIO;
 	}
 
-	/* allocate the host hardware/software hsi structures */
-	if (bnx2x_alloc_hsi_mem(sc) != 0) {
-		PMD_DRV_LOG(ERR, sc, "bnx2x_alloc_hsi_mem was failed");
-		bnx2x_free_ilt_mem(sc);
-		return -ENXIO;
-	}
-
 	bnx2x_dev_rxtx_init_dummy(dev);
 	return 0;
 }
@@ -294,9 +287,6 @@  bnx2x_dev_close(struct rte_eth_dev *dev)
 	bnx2x_dev_clear_queues(dev);
 	memset(&(dev->data->dev_link), 0 , sizeof(struct rte_eth_link));
 
-	/* free the host hardware/software hsi structures */
-	bnx2x_free_hsi_mem(sc);
-
 	/* free ilt */
 	bnx2x_free_ilt_mem(sc);
 }