From f0219d98defd92297c688855d25294805ec89a3d Mon Sep 17 00:00:00 2001 From: Shahed Shaikh Date: Tue, 4 Jun 2019 11:53:49 -0700 Subject: [PATCH 1/1] net/bnx2x: fix interrupt flood 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 Acked-by: Rasesh Mody --- drivers/net/bnx2x/bnx2x.c | 10 ++++++++++ drivers/net/bnx2x/bnx2x_ethdev.c | 10 ---------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/net/bnx2x/bnx2x.c b/drivers/net/bnx2x/bnx2x.c index 5f353a7ef7..5a47fd8fea 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 567dc55603..11a20e210a 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); } -- 2.20.1