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 DD79AA04F0 for ; Wed, 18 Dec 2019 07:24:49 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A96271BF75; Wed, 18 Dec 2019 07:24:48 +0100 (CET) Received: from relay.smtp.broadcom.com (unknown [192.19.211.62]) by dpdk.org (Postfix) with ESMTP id 6699B2BE5 for ; Wed, 18 Dec 2019 07:24:45 +0100 (CET) Received: from dhcp-10-123-153-55.dhcp.broadcom.net (dhcp-10-123-153-55.dhcp.broadcom.net [10.123.153.55]) by relay.smtp.broadcom.com (Postfix) with ESMTP id ECFC528FA68; Tue, 17 Dec 2019 22:24:44 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.10.3 relay.smtp.broadcom.com ECFC528FA68 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1576650285; bh=KqtgvnVuwCSHld9ONxl815JiNUFugk/iyKOdwGlXNpg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lVKh9wWFw+aYF5b3QIp/i+1dVu+9BbILG00n7SUNf/zB/GW6gc0SLB3vsWt8A+Fis uGUbZZjTdlG0S0L4emVwBwE+6O5ZstNMKOVGZKnbZFX5LR//qaPP6taWRGCaSYBS/D do+Vd3XnmSVhBd4BI0fVyzKiTuuj7KOji6hlji9U= From: Somnath Kotur To: stable@dpdk.org Cc: ktraynor@redhat.com Date: Wed, 18 Dec 2019 11:54:01 +0530 Message-Id: <20191218062411.13079-10-somnath.kotur@broadcom.com> X-Mailer: git-send-email 2.10.1.613.g2cc2e70 In-Reply-To: <20191218062411.13079-1-somnath.kotur@broadcom.com> References: <20191218062411.13079-1-somnath.kotur@broadcom.com> Subject: [dpdk-stable] [PATCH 18.11 09/19] net/bnxt: fix async link handling and update X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" From: Ajit Khaparde 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") Cc: stable@dpdk.org Signed-off-by: Ajit Khaparde Reviewed-by: Kalesh AP Reviewed-by: Lance Richardson Signed-off-by: Somnath Kotur --- drivers/net/bnxt/bnxt_cpr.c | 2 +- drivers/net/bnxt/bnxt_ethdev.c | 12 ++++++++---- drivers/net/bnxt/bnxt_irq.c | 2 +- drivers/net/bnxt/bnxt_irq.h | 1 + 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/net/bnxt/bnxt_cpr.c b/drivers/net/bnxt/bnxt_cpr.c index ff8fa04..4529080 100644 --- a/drivers/net/bnxt/bnxt_cpr.c +++ b/drivers/net/bnxt/bnxt_cpr.c @@ -26,7 +26,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 f9c7cd2..5a62695 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -595,6 +595,8 @@ 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); + rc = bnxt_init_chip(bp); if (rc) goto error; @@ -609,7 +611,6 @@ 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; bp->dev_stopped = 0; return 0; @@ -663,7 +664,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); @@ -675,6 +678,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); bp->dev_stopped = 1; } @@ -809,8 +814,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 9c913d2..57365d7 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 460a97a..1b56e08 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 -- 2.10.1