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 7C982A04F3 for ; Thu, 19 Dec 2019 15:36:46 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7127C1BF80; Thu, 19 Dec 2019 15:36:46 +0100 (CET) Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) by dpdk.org (Postfix) with ESMTP id F0A171BF80 for ; Thu, 19 Dec 2019 15:36:44 +0100 (CET) Received: by mail-wr1-f65.google.com with SMTP id q6so6190466wro.9 for ; Thu, 19 Dec 2019 06:36:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=by3A4IruqdXspwZe6LXQ6uSNHwOWLqKI3MNPhnihqZE=; b=bh7cIfnPG+kytu2pKtWqcuBmoW6OsUvejuOeg/d2w5IpVFPfODnoo1J8cVCsHtFVTk vxuOikXPs6cZvT94xT7bWJ//8xsHBF0ruyZPC5s6O7WraPR3qdXAvAJ952uifpDTXNTf DIE3RzmSr5c4a7/rJ59mbZsFTSgxJLgEZdyvfO3wF4AcYby4XYebhntu8wuQF++7nM6n 6FkXImm6lxNll5oxBqZ/zc4xiDXZc1Fidmc3YiD5bqd2F0vQxmEh3m7hTn+3s6WmwM6v BIgb6ygcgyQmUMzMfq8uhy1JyMoX2i8o2lQ3DtEHzyBxV8UIn+MvCPvPI6DpAQLrhyW4 iriA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=by3A4IruqdXspwZe6LXQ6uSNHwOWLqKI3MNPhnihqZE=; b=pzKLkPUfCdRCOoB8zATBHlkovxwUaBN4SB13WE2I1zO3UZW3XIt1T8RNEzfsyZOjSr Bxuc/apV4+GtwtJtXhAo2t30i91i+e9uO5Mmm+AIvZ48VhZrjMIggyFme3ZVTlrNxvnq d2G8Do+xaLIvCYL8But/KsHgkzpWZcHh7t2dOOVmfQJYLsqXB6c0TgLdErRq1vna+I5B nLMuNpIrkS6sF/i05AcDemeajHnkDFcaN/upLGqNWLhyGE/+fRBrn9c00Smd0P1x80be zYo5jRhLZ1FDadxv1g82zvmg6rOIZlaZxyfA43jfSdM5BFmCy4Qie1LVeJ142aphg2H/ P2tA== X-Gm-Message-State: APjAAAW4Nf5gjDTitzA5XSh8l6iUdov4VoKEAK9vckNDVZ2AcZWwysxG sj/T15wiz4igrHI6XXiAgSUcDHRxCk4= X-Google-Smtp-Source: APXvYqwUpp6kDLXUiuo/LnjVawB/mLgm9XEuPboJf6kMc3bwillvTJcv2kC2/RZMjy9S2NzTwBLwSA== X-Received: by 2002:adf:e6cb:: with SMTP id y11mr9985671wrm.345.1576766204584; Thu, 19 Dec 2019 06:36:44 -0800 (PST) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id g18sm6140732wmh.48.2019.12.19.06.36.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2019 06:36:43 -0800 (PST) From: luca.boccassi@gmail.com To: Ajit Khaparde Cc: Kalesh AP , Lance Richardson , dpdk stable Date: Thu, 19 Dec 2019 14:33:09 +0000 Message-Id: <20191219143447.21506-42-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191219143447.21506-1-luca.boccassi@gmail.com> References: <20191219143447.21506-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'net/bnxt: fix async link handling and update' has been queued to LTS release 17.11.10 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" Hi, FYI, your patch has been queued to LTS release 17.11.10 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 12/21/19. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Thanks. Luca Boccassi --- >From ec4ba4b7e2084e3745932acd619388c62b699883 Mon Sep 17 00:00:00 2001 From: Ajit Khaparde Date: Wed, 2 Oct 2019 10:17:34 -0700 Subject: [PATCH] net/bnxt: fix async link handling and update [ upstream commit c023cd5b2192ae2d63d041f17d3db384f9eb62cd ] 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") Signed-off-by: Ajit Khaparde Reviewed-by: Kalesh AP Reviewed-by: Lance Richardson --- drivers/net/bnxt/bnxt_cpr.c | 2 +- drivers/net/bnxt/bnxt_ethdev.c | 18 +++++++++++++++++- drivers/net/bnxt/bnxt_irq.c | 2 +- drivers/net/bnxt/bnxt_irq.h | 1 + 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/drivers/net/bnxt/bnxt_cpr.c b/drivers/net/bnxt/bnxt_cpr.c index cde8adc3b0..ba702df753 100644 --- a/drivers/net/bnxt/bnxt_cpr.c +++ b/drivers/net/bnxt/bnxt_cpr.c @@ -55,7 +55,7 @@ void bnxt_handle_async_event(struct bnxt *bp, case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_STATUS_CHANGE: case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_SPEED_CHANGE: case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_SPEED_CFG_CHANGE: - bnxt_link_update_op(bp->eth_dev, 1); + bnxt_link_update_op(bp->eth_dev, 0); break; default: RTE_LOG(DEBUG, PMD, "handle_async_event id = 0x%x\n", event_id); diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index bc7b82f6c1..0e990014d0 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -592,6 +592,8 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev) } bp->dev_stopped = 0; + bnxt_enable_int(bp); + rc = bnxt_init_chip(bp); if (rc) goto error; @@ -644,15 +646,29 @@ 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 = (struct bnxt *)eth_dev->data->dev_private; + struct rte_intr_handle *intr_handle + = &bp->pdev->intr_handle; 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); + 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); + 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); + /* Process any remaining notifications in default completion queue */ + bnxt_int_handler(eth_dev); bnxt_shutdown_nic(bp); bp->dev_stopped = 1; } diff --git a/drivers/net/bnxt/bnxt_irq.c b/drivers/net/bnxt/bnxt_irq.c index 49436cfd9c..c332431dba 100644 --- a/drivers/net/bnxt/bnxt_irq.c +++ b/drivers/net/bnxt/bnxt_irq.c @@ -45,7 +45,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 = (struct bnxt *)eth_dev->data->dev_private; diff --git a/drivers/net/bnxt/bnxt_irq.h b/drivers/net/bnxt/bnxt_irq.h index 4d2f7af9f5..3162217791 100644 --- a/drivers/net/bnxt/bnxt_irq.h +++ b/drivers/net/bnxt/bnxt_irq.h @@ -50,5 +50,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.20.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2019-12-19 14:32:28.011485851 +0000 +++ 0042-net-bnxt-fix-async-link-handling-and-update.patch 2019-12-19 14:32:25.925294256 +0000 @@ -1,8 +1,10 @@ -From c023cd5b2192ae2d63d041f17d3db384f9eb62cd Mon Sep 17 00:00:00 2001 +From ec4ba4b7e2084e3745932acd619388c62b699883 Mon Sep 17 00:00:00 2001 From: Ajit Khaparde Date: Wed, 2 Oct 2019 10:17:34 -0700 Subject: [PATCH] net/bnxt: fix async link handling and update +[ upstream commit c023cd5b2192ae2d63d041f17d3db384f9eb62cd ] + 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. @@ -15,52 +17,51 @@ 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 --- drivers/net/bnxt/bnxt_cpr.c | 2 +- - drivers/net/bnxt/bnxt_ethdev.c | 11 +++++++---- + drivers/net/bnxt/bnxt_ethdev.c | 18 +++++++++++++++++- drivers/net/bnxt/bnxt_irq.c | 2 +- drivers/net/bnxt/bnxt_irq.h | 1 + - 4 files changed, 10 insertions(+), 6 deletions(-) + 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/drivers/net/bnxt/bnxt_cpr.c b/drivers/net/bnxt/bnxt_cpr.c -index 4817672ef0..f58372516a 100644 +index cde8adc3b0..ba702df753 100644 --- a/drivers/net/bnxt/bnxt_cpr.c +++ b/drivers/net/bnxt/bnxt_cpr.c -@@ -66,7 +66,7 @@ void bnxt_handle_async_event(struct bnxt *bp, +@@ -55,7 +55,7 @@ void bnxt_handle_async_event(struct bnxt *bp, + case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_STATUS_CHANGE: 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"); + default: + RTE_LOG(DEBUG, PMD, "handle_async_event id = 0x%x\n", event_id); diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c -index d1c5acb3e2..4d15ba5ceb 100644 +index bc7b82f6c1..0e990014d0 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c -@@ -834,6 +834,7 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev) - bp->rx_cp_nr_rings, RTE_ETHDEV_QUEUE_STAT_CNTRS); +@@ -592,6 +592,8 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev) } + bp->dev_stopped = 0; + bnxt_enable_int(bp); - rc = bnxt_hwrm_if_change(bp, 1); - if (!rc) { - if (bp->flags & BNXT_FLAG_IF_CHANGE_HOT_FW_RESET_DONE) { -@@ -862,7 +863,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); ++ + rc = bnxt_init_chip(bp); + if (rc) + goto error; +@@ -644,15 +646,29 @@ 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 = (struct bnxt *)eth_dev->data->dev_private; ++ struct rte_intr_handle *intr_handle ++ = &bp->pdev->intr_handle; -- bnxt_enable_int(bp); - bp->flags |= BNXT_FLAG_INIT_DONE; - eth_dev->data->dev_started = 1; - bp->dev_stopped = 0; -@@ -926,7 +926,9 @@ static void bnxt_dev_stop_op(struct rte_eth_dev *eth_dev) + if (bp->eth_dev->data->dev_started) { /* TBD: STOP HW queues DMA */ eth_dev->data->dev_link.link_status = 0; } @@ -68,33 +69,27 @@ + 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); -@@ -938,6 +940,8 @@ static void bnxt_dev_stop_op(struct rte_eth_dev *eth_dev) ++ ++ /* 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); + /* 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; -@@ -1084,8 +1088,7 @@ out: - /* 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 a22700a0da..729d68d704 100644 +index 49436cfd9c..c332431dba 100644 --- a/drivers/net/bnxt/bnxt_irq.c +++ b/drivers/net/bnxt/bnxt_irq.c -@@ -18,7 +18,7 @@ +@@ -45,7 +45,7 @@ * Interrupts */ @@ -102,12 +97,12 @@ +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; + struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private; diff --git a/drivers/net/bnxt/bnxt_irq.h b/drivers/net/bnxt/bnxt_irq.h -index 460a97a09c..1b56e08068 100644 +index 4d2f7af9f5..3162217791 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); +@@ -50,5 +50,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);