From patchwork Sun Sep 1 22:12:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajit Khaparde X-Patchwork-Id: 58348 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5B2FD1C1C2; Mon, 2 Sep 2019 00:16:03 +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 63A771C1C1 for ; Mon, 2 Sep 2019 00:16:02 +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 9416C30D117; Sun, 1 Sep 2019 15:15:56 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 rnd-relay.smtp.broadcom.com 9416C30D117 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1567376156; bh=vQn/pkxkvy2C7iySlXSMnfcOv08ZnIXyrWM4MtLwiws=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KhPMuSnZxfdZ7pMcmSzprmsB/5zwFVqj5LGwmjqKfWCErczwJ2YzArwi3W/uQzvu2 KCH40BVLbs8kTkfXs5mx2TFmhQEk9v3J/FlX/VI3ryDK8huENfu16EGeU6k21LuI9W XBoR4Jx8L9q6kUDdC78vpLLR49e+IdKgGKY9LBdI= Received: from localhost.localdomain (unknown [10.230.30.225]) by nis-sj1-27.broadcom.com (Postfix) with ESMTP id 05BD9AC071D; Sun, 1 Sep 2019 15:16:00 -0700 (PDT) From: Ajit Khaparde To: dev@dpdk.org Cc: ferruh.yigit@intel.com, Kalesh Anakkur Purayil , Lance Richardson Date: Sun, 1 Sep 2019 15:12:08 -0700 Message-Id: <20190901221213.92149-6-ajit.khaparde@broadcom.com> X-Mailer: git-send-email 2.20.1 (Apple Git-117) In-Reply-To: <20190901221213.92149-1-ajit.khaparde@broadcom.com> References: <20190901221213.92149-1-ajit.khaparde@broadcom.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 05/15] net/bnxt: fix async link handling and update 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" When updating the link because of an async link notification there is no need to set wait_for_completion. At this point the link related information should be available without need to poll. Use rte_eth_linkstatus_set instead of memcpy to ensure atomicity while updating the link status. We force the physical link down as a part of device stop. But we are not waiting there enough and handling the async notification before exiting. It just sits in the default CQ till we do a device start. Fix it by calling the CQ handler in device stop. Fixes: 7bc8e9a227cc ("net/bnxt: support async link notification") Reviewed-by: Kalesh Anakkur Purayil Reviewed-by: Lance Richardson Signed-off-by: Ajit Khaparde --- drivers/net/bnxt/bnxt_cpr.c | 2 +- drivers/net/bnxt/bnxt_ethdev.c | 11 +++++++---- drivers/net/bnxt/bnxt_irq.c | 2 +- drivers/net/bnxt/bnxt_irq.h | 1 + 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/net/bnxt/bnxt_cpr.c b/drivers/net/bnxt/bnxt_cpr.c index 3cedb891e..eb44d872d 100644 --- a/drivers/net/bnxt/bnxt_cpr.c +++ b/drivers/net/bnxt/bnxt_cpr.c @@ -31,7 +31,7 @@ void bnxt_handle_async_event(struct bnxt *bp, case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_SPEED_CHANGE: case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_SPEED_CFG_CHANGE: /* FALLTHROUGH */ - bnxt_link_update_op(bp->eth_dev, 1); + bnxt_link_update_op(bp->eth_dev, 0); break; case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_PF_DRVR_UNLOAD: PMD_DRV_LOG(INFO, "Async event: PF driver unloaded\n"); diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index 3c8307b63..f6383327c 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -815,6 +815,7 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev) bp->rx_cp_nr_rings, RTE_ETHDEV_QUEUE_STAT_CNTRS); } + bnxt_enable_int(bp); bnxt_hwrm_if_change(bp, 1); rc = bnxt_init_chip(bp); @@ -836,7 +837,6 @@ 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; eth_dev->data->dev_started = 1; bp->dev_stopped = 0; @@ -897,7 +897,9 @@ static void bnxt_dev_stop_op(struct rte_eth_dev *eth_dev) /* TBD: STOP HW queues DMA */ eth_dev->data->dev_link.link_status = 0; } - bnxt_set_hwrm_link_config(bp, false); + bnxt_dev_set_link_down_op(eth_dev); + /* Wait for link to be reset and the async notification to process. */ + rte_delay_ms(BNXT_LINK_WAIT_INTERVAL * 2); /* Clean queue intr-vector mapping */ rte_intr_efd_disable(intr_handle); @@ -909,6 +911,8 @@ static void bnxt_dev_stop_op(struct rte_eth_dev *eth_dev) bnxt_hwrm_port_clr_stats(bp); bnxt_free_tx_mbufs(bp); bnxt_free_rx_mbufs(bp); + /* Process any remaining notifications in default completion queue */ + bnxt_int_handler(eth_dev); bnxt_shutdown_nic(bp); bnxt_hwrm_if_change(bp, 0); bp->dev_stopped = 1; @@ -1055,8 +1059,7 @@ int bnxt_link_update_op(struct rte_eth_dev *eth_dev, int wait_to_complete) /* Timed out or success */ if (new.link_status != eth_dev->data->dev_link.link_status || new.link_speed != eth_dev->data->dev_link.link_speed) { - memcpy(ð_dev->data->dev_link, &new, - sizeof(struct rte_eth_link)); + rte_eth_linkstatus_set(eth_dev, &new); _rte_eth_dev_callback_process(eth_dev, RTE_ETH_EVENT_INTR_LSC, diff --git a/drivers/net/bnxt/bnxt_irq.c b/drivers/net/bnxt/bnxt_irq.c index a22700a0d..729d68d70 100644 --- a/drivers/net/bnxt/bnxt_irq.c +++ b/drivers/net/bnxt/bnxt_irq.c @@ -18,7 +18,7 @@ * Interrupts */ -static void bnxt_int_handler(void *param) +void bnxt_int_handler(void *param) { struct rte_eth_dev *eth_dev = (struct rte_eth_dev *)param; struct bnxt *bp = eth_dev->data->dev_private; diff --git a/drivers/net/bnxt/bnxt_irq.h b/drivers/net/bnxt/bnxt_irq.h index 460a97a09..1b56e0806 100644 --- a/drivers/net/bnxt/bnxt_irq.h +++ b/drivers/net/bnxt/bnxt_irq.h @@ -22,5 +22,6 @@ void bnxt_disable_int(struct bnxt *bp); void bnxt_enable_int(struct bnxt *bp); int bnxt_setup_int(struct bnxt *bp); int bnxt_request_int(struct bnxt *bp); +void bnxt_int_handler(void *param); #endif