From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 61014A00E6 for ; Fri, 12 Jul 2019 08:08:29 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A2B851BDE8; Fri, 12 Jul 2019 08:07:13 +0200 (CEST) Received: from rnd-relay.smtp.broadcom.com (rnd-relay.smtp.broadcom.com [192.19.229.170]) by dpdk.org (Postfix) with ESMTP id EF5251B9FA for ; Fri, 12 Jul 2019 08:07:08 +0200 (CEST) Received: from nis-sj1-27.broadcom.com (nis-sj1-27.lvn.broadcom.net [10.75.144.136]) by rnd-relay.smtp.broadcom.com (Postfix) with ESMTP id AE5CB30C368; Thu, 11 Jul 2019 23:07:07 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 rnd-relay.smtp.broadcom.com AE5CB30C368 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1562911627; bh=1FGIpZfzEfeX+mimCRLgB34nI3BR1NfO51tt/CEQVj8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZmT0GT5MDwK/xd3oE1GkAdfd5Mz10BNvs1W7GhfgHFZtEMpybUcU9qk5i3tMuKXIk lPVKsjNyVoA/8x8/hJvCJah070tsbgASF3/lpMjWd0xNhMaLuayBhY/4R41aflahW3 hTvz1kpNxRz5HdQ3v6VYDWvfTk4OSRmH7G3MFxOM= Received: from localhost.localdomain (unknown [10.230.44.246]) by nis-sj1-27.broadcom.com (Postfix) with ESMTP id 0A74DAC074B; Thu, 11 Jul 2019 23:07:05 -0700 (PDT) From: Ajit Khaparde To: dev@dpdk.org Cc: ferruh.yigit@intel.com, Kalesh AP , Somnath Kotur Date: Fri, 12 Jul 2019 11:36:18 +0530 Message-Id: <20190712060622.76975-12-ajit.khaparde@broadcom.com> X-Mailer: git-send-email 2.20.1 (Apple Git-117) In-Reply-To: <20190712060622.76975-1-ajit.khaparde@broadcom.com> References: <20190712060622.76975-1-ajit.khaparde@broadcom.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH 11/15] net/bnxt: fix to enable disable interrupts correctly in start stop X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Kalesh AP 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") Signed-off-by: Kalesh AP Reviewed-by: Somnath Kotur Reviewed-by: Ajit Khaparde --- drivers/net/bnxt/bnxt_ethdev.c | 17 ++++++++++++++++- drivers/net/bnxt/bnxt_irq.c | 2 -- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index 523a8f1c5..ff0edeef4 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 @@ 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; diff --git a/drivers/net/bnxt/bnxt_irq.c b/drivers/net/bnxt/bnxt_irq.c index 61f7498a5..6c4dce401 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; -- 2.20.1 (Apple Git-117)