Skip to content

Commit

Permalink
net/bnxt: fix enabling/disabling interrupts
Browse files Browse the repository at this point in the history
[ upstream commit ae2d19d ]

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: c09f57b ("net/bnxt: add start/stop/link update operations")

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
  • Loading branch information
Kalesh AP authored and kevintraynor committed Aug 28, 2019
1 parent 001848b commit 76685b9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
17 changes: 16 additions & 1 deletion drivers/net/bnxt/bnxt_ethdev.c
Expand Up @@ -645,6 +645,7 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)
if (rc)
goto error;

bnxt_enable_int(bp);
bp->flags |= BNXT_FLAG_INIT_DONE;
return 0;

Expand Down Expand Up @@ -684,13 +685,28 @@ 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) {
/* TBD: STOP HW queues DMA */
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);
Expand Down Expand Up @@ -3517,7 +3533,6 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev)
if (rc)
goto error_free_int;

bnxt_enable_int(bp);
bnxt_init_nic(bp);

return 0;
Expand Down
2 changes: 0 additions & 2 deletions drivers/net/bnxt/bnxt_irq.c
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 76685b9

Please sign in to comment.