From: Kalesh AP Date: Wed, 17 Jul 2019 10:41:35 +0000 (+0530) Subject: net/bnxt: fix enabling/disabling interrupts X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=ae2d19da02a95739e98554a42f2fce99b66be103;p=dpdk.git net/bnxt: fix enabling/disabling interrupts 1. Disable interrupts in dev_stop_op() 2. Enable interrupts in dev_start_op() 3. Clean queue intr-vector mapping in dev_stop_op() and thus fix a possible memory leak. Fixes: c09f57b49c13 ("net/bnxt: add start/stop/link update operations") Cc: stable@dpdk.org Signed-off-by: Kalesh AP Signed-off-by: Ajit Khaparde Reviewed-by: Somnath Kotur --- diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index 3f46065c84..91a2ca5583 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -779,6 +779,7 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev) eth_dev->rx_pkt_burst = bnxt_receive_function(eth_dev); eth_dev->tx_pkt_burst = bnxt_transmit_function(eth_dev); + bnxt_enable_int(bp); bp->flags |= BNXT_FLAG_INIT_DONE; return 0; @@ -818,6 +819,13 @@ static int bnxt_dev_set_link_down_op(struct rte_eth_dev *eth_dev) static void bnxt_dev_stop_op(struct rte_eth_dev *eth_dev) { struct bnxt *bp = eth_dev->data->dev_private; + struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev); + struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; + + bnxt_disable_int(bp); + + /* disable uio/vfio intr/eventfd mapping */ + rte_intr_disable(intr_handle); bp->flags &= ~BNXT_FLAG_INIT_DONE; if (bp->eth_dev->data->dev_started) { @@ -825,6 +833,14 @@ static void bnxt_dev_stop_op(struct rte_eth_dev *eth_dev) eth_dev->data->dev_link.link_status = 0; } bnxt_set_hwrm_link_config(bp, false); + + /* Clean queue intr-vector mapping */ + rte_intr_efd_disable(intr_handle); + if (intr_handle->intr_vec != NULL) { + rte_free(intr_handle->intr_vec); + intr_handle->intr_vec = NULL; + } + bnxt_hwrm_port_clr_stats(bp); bnxt_free_tx_mbufs(bp); bnxt_free_rx_mbufs(bp); @@ -3991,7 +4007,6 @@ skip_init: if (rc) goto error_free_int; - bnxt_enable_int(bp); bnxt_init_nic(bp); return 0; diff --git a/drivers/net/bnxt/bnxt_irq.c b/drivers/net/bnxt/bnxt_irq.c index 61f7498a5f..6c4dce4011 100644 --- a/drivers/net/bnxt/bnxt_irq.c +++ b/drivers/net/bnxt/bnxt_irq.c @@ -58,7 +58,6 @@ void bnxt_free_int(struct bnxt *bp) irq = bp->irq_tbl; if (irq) { if (irq->requested) { - rte_intr_disable(&bp->pdev->intr_handle); rte_intr_callback_unregister(&bp->pdev->intr_handle, irq->handler, (void *)bp->eth_dev); @@ -123,7 +122,6 @@ int bnxt_request_int(struct bnxt *bp) rte_intr_callback_register(&bp->pdev->intr_handle, irq->handler, (void *)bp->eth_dev); - rte_intr_enable(&bp->pdev->intr_handle); irq->requested = 1; return rc;