From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id D554E1B49D for ; Fri, 4 Jan 2019 14:28:03 +0100 (CET) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 42C717F6C8; Fri, 4 Jan 2019 13:28:03 +0000 (UTC) Received: from ktraynor.remote.csb (ovpn-117-13.ams2.redhat.com [10.36.117.13]) by smtp.corp.redhat.com (Postfix) with ESMTP id A811F5C1A1; Fri, 4 Jan 2019 13:28:01 +0000 (UTC) From: Kevin Traynor To: Rafal Kozik Cc: Michal Krawczyk , dpdk stable Date: Fri, 4 Jan 2019 13:24:35 +0000 Message-Id: <20190104132455.15170-53-ktraynor@redhat.com> In-Reply-To: <20190104132455.15170-1-ktraynor@redhat.com> References: <20190104132455.15170-1-ktraynor@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Fri, 04 Jan 2019 13:28:03 +0000 (UTC) Subject: [dpdk-stable] patch 'net/ena: do not reconfigure queues on reset' has been queued to LTS release 18.11.1 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: , X-List-Received-Date: Fri, 04 Jan 2019 13:28:04 -0000 Hi, FYI, your patch has been queued to LTS release 18.11.1 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 01/11/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. Kevin Traynor --- >>From 25322f4868adec75fed18b587975d9598017f563 Mon Sep 17 00:00:00 2001 From: Rafal Kozik Date: Fri, 14 Dec 2018 14:18:36 +0100 Subject: [PATCH] net/ena: do not reconfigure queues on reset [ upstream commit e457bc70e5d6d589b1c3e1e93979aa42a64fbc06 ] Reset function should return the port to initial state, in which no Tx and Rx queues are setup. Then application should reconfigure the queues. According to DPDK documentation the rte_eth_dev_reset() itself is a generic function which only does some hardware reset operations through calling dev_unint() and dev_init(). ena_com_dev_reset which perform NIC registers reset should be called during stop. Fixes: 2081d5e2e92d ("net/ena: add reset routine") Signed-off-by: Rafal Kozik Acked-by: Michal Krawczyk --- drivers/net/ena/ena_ethdev.c | 107 +++++++++++++---------------------- 1 file changed, 38 insertions(+), 69 deletions(-) diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c index 86ee7942c..80d90b301 100644 --- a/drivers/net/ena/ena_ethdev.c +++ b/drivers/net/ena/ena_ethdev.c @@ -261,4 +261,6 @@ static int ena_get_sset_count(struct rte_eth_dev *dev, int sset); static void ena_interrupt_handler_rte(void *cb_arg); static void ena_timer_wd_callback(struct rte_timer *timer, void *arg); +static void ena_destroy_device(struct rte_eth_dev *eth_dev); +static int eth_ena_dev_init(struct rte_eth_dev *eth_dev); static const struct eth_dev_ops ena_dev_ops = { @@ -544,62 +546,12 @@ static int ena_dev_reset(struct rte_eth_dev *dev) { - struct rte_mempool *mb_pool_rx[ENA_MAX_NUM_QUEUES]; - struct rte_eth_dev *eth_dev; - struct rte_pci_device *pci_dev; - struct rte_intr_handle *intr_handle; - struct ena_com_dev *ena_dev; - struct ena_com_dev_get_features_ctx get_feat_ctx; - struct ena_adapter *adapter; - int nb_queues; - int rc, i; - bool wd_state; + int rc = 0; - adapter = (struct ena_adapter *)(dev->data->dev_private); - ena_dev = &adapter->ena_dev; - eth_dev = adapter->rte_dev; - pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev); - intr_handle = &pci_dev->intr_handle; - nb_queues = eth_dev->data->nb_rx_queues; - - ena_com_set_admin_running_state(ena_dev, false); - - rc = ena_com_dev_reset(ena_dev, adapter->reset_reason); + ena_destroy_device(dev); + rc = eth_ena_dev_init(dev); if (rc) - RTE_LOG(ERR, PMD, "Device reset failed\n"); - - for (i = 0; i < nb_queues; i++) - mb_pool_rx[i] = adapter->rx_ring[i].mb_pool; - - ena_rx_queue_release_all(eth_dev); - ena_tx_queue_release_all(eth_dev); - - rte_intr_disable(intr_handle); - - ena_com_abort_admin_commands(ena_dev); - ena_com_wait_for_abort_completion(ena_dev); - ena_com_admin_destroy(ena_dev); - ena_com_mmio_reg_read_request_destroy(ena_dev); - - rc = ena_device_init(ena_dev, &get_feat_ctx, &wd_state); - if (rc) { PMD_INIT_LOG(CRIT, "Cannot initialize device\n"); - return rc; - } - adapter->wd_state = wd_state; - rte_intr_enable(intr_handle); - ena_com_set_admin_polling_mode(ena_dev, false); - ena_com_admin_aenq_enable(ena_dev); - - for (i = 0; i < nb_queues; ++i) - ena_rx_queue_setup(eth_dev, i, adapter->rx_ring_size, 0, NULL, - mb_pool_rx[i]); - - for (i = 0; i < nb_queues; ++i) - ena_tx_queue_setup(eth_dev, i, adapter->tx_ring_size, 0, NULL); - - adapter->trigger_reset = false; - - return 0; + return rc; } @@ -771,9 +723,4 @@ static void ena_rx_queue_release(void *queue) struct ena_ring *ring = (struct ena_ring *)queue; - ena_assert_msg(ring->configured, - "API violation - releasing not configured queue"); - ena_assert_msg(ring->adapter->state != ENA_ADAPTER_STATE_RUNNING, - "API violation"); - /* Free ring resources */ if (ring->rx_buffer_info) @@ -799,9 +746,4 @@ static void ena_tx_queue_release(void *queue) struct ena_ring *ring = (struct ena_ring *)queue; - ena_assert_msg(ring->configured, - "API violation. Releasing not configured queue"); - ena_assert_msg(ring->adapter->state != ENA_ADAPTER_STATE_RUNNING, - "API violation"); - /* Free ring resources */ if (ring->tx_buffer_info) @@ -1099,4 +1041,6 @@ static void ena_stop(struct rte_eth_dev *dev) struct ena_adapter *adapter = (struct ena_adapter *)(dev->data->dev_private); + struct ena_com_dev *ena_dev = &adapter->ena_dev; + int rc; rte_timer_stop_sync(&adapter->timer_wd); @@ -1104,4 +1048,10 @@ static void ena_stop(struct rte_eth_dev *dev) ena_queue_stop_all(dev, ENA_RING_TYPE_RX); + if (adapter->trigger_reset) { + rc = ena_com_dev_reset(ena_dev, adapter->reset_reason); + if (rc) + RTE_LOG(ERR, PMD, "Device reset failed rc=%d\n", rc); + } + adapter->state = ENA_ADAPTER_STATE_STOPPED; } @@ -1754,15 +1704,36 @@ err: } -static int eth_ena_dev_uninit(struct rte_eth_dev *eth_dev) +static void ena_destroy_device(struct rte_eth_dev *eth_dev) { struct ena_adapter *adapter = (struct ena_adapter *)(eth_dev->data->dev_private); + struct ena_com_dev *ena_dev = &adapter->ena_dev; - if (rte_eal_process_type() != RTE_PROC_PRIMARY) - return 0; + if (adapter->state == ENA_ADAPTER_STATE_FREE) + return; + + ena_com_set_admin_running_state(ena_dev, false); if (adapter->state != ENA_ADAPTER_STATE_CLOSED) ena_close(eth_dev); + ena_com_delete_debug_area(ena_dev); + ena_com_delete_host_info(ena_dev); + + ena_com_abort_admin_commands(ena_dev); + ena_com_wait_for_abort_completion(ena_dev); + ena_com_admin_destroy(ena_dev); + ena_com_mmio_reg_read_request_destroy(ena_dev); + + adapter->state = ENA_ADAPTER_STATE_FREE; +} + +static int eth_ena_dev_uninit(struct rte_eth_dev *eth_dev) +{ + if (rte_eal_process_type() != RTE_PROC_PRIMARY) + return 0; + + ena_destroy_device(eth_dev); + eth_dev->dev_ops = NULL; eth_dev->rx_pkt_burst = NULL; @@ -1770,6 +1741,4 @@ static int eth_ena_dev_uninit(struct rte_eth_dev *eth_dev) eth_dev->tx_pkt_prepare = NULL; - adapter->state = ENA_ADAPTER_STATE_FREE; - return 0; } -- 2.19.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2019-01-04 13:23:08.737670599 +0000 +++ 0053-net-ena-do-not-reconfigure-queues-on-reset.patch 2019-01-04 13:23:07.000000000 +0000 @@ -1,8 +1,10 @@ -From e457bc70e5d6d589b1c3e1e93979aa42a64fbc06 Mon Sep 17 00:00:00 2001 +From 25322f4868adec75fed18b587975d9598017f563 Mon Sep 17 00:00:00 2001 From: Rafal Kozik Date: Fri, 14 Dec 2018 14:18:36 +0100 Subject: [PATCH] net/ena: do not reconfigure queues on reset +[ upstream commit e457bc70e5d6d589b1c3e1e93979aa42a64fbc06 ] + Reset function should return the port to initial state, in which no Tx and Rx queues are setup. Then application should reconfigure the queues. @@ -14,26 +16,25 @@ during stop. Fixes: 2081d5e2e92d ("net/ena: add reset routine") -Cc: stable@dpdk.org Signed-off-by: Rafal Kozik Acked-by: Michal Krawczyk --- - drivers/net/ena/ena_ethdev.c | 108 ++++++++++++----------------------- - 1 file changed, 38 insertions(+), 70 deletions(-) + drivers/net/ena/ena_ethdev.c | 107 +++++++++++++---------------------- + 1 file changed, 38 insertions(+), 69 deletions(-) diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c -index deb97151d..3715619a7 100644 +index 86ee7942c..80d90b301 100644 --- a/drivers/net/ena/ena_ethdev.c +++ b/drivers/net/ena/ena_ethdev.c -@@ -263,4 +263,6 @@ static int ena_get_sset_count(struct rte_eth_dev *dev, int sset); +@@ -261,4 +261,6 @@ static int ena_get_sset_count(struct rte_eth_dev *dev, int sset); static void ena_interrupt_handler_rte(void *cb_arg); static void ena_timer_wd_callback(struct rte_timer *timer, void *arg); +static void ena_destroy_device(struct rte_eth_dev *eth_dev); +static int eth_ena_dev_init(struct rte_eth_dev *eth_dev); static const struct eth_dev_ops ena_dev_ops = { -@@ -547,63 +549,12 @@ static int +@@ -544,62 +546,12 @@ static int ena_dev_reset(struct rte_eth_dev *dev) { - struct rte_mempool *mb_pool_rx[ENA_MAX_NUM_QUEUES]; @@ -88,12 +89,11 @@ - ena_com_admin_aenq_enable(ena_dev); - - for (i = 0; i < nb_queues; ++i) -- ena_rx_queue_setup(eth_dev, i, adapter->rx_ring[i].ring_size, 0, -- NULL, mb_pool_rx[i]); +- ena_rx_queue_setup(eth_dev, i, adapter->rx_ring_size, 0, NULL, +- mb_pool_rx[i]); - - for (i = 0; i < nb_queues; ++i) -- ena_tx_queue_setup(eth_dev, i, adapter->tx_ring[i].ring_size, 0, -- NULL); +- ena_tx_queue_setup(eth_dev, i, adapter->tx_ring_size, 0, NULL); - - adapter->trigger_reset = false; - @@ -101,7 +101,7 @@ + return rc; } -@@ -775,9 +726,4 @@ static void ena_rx_queue_release(void *queue) +@@ -771,9 +723,4 @@ static void ena_rx_queue_release(void *queue) struct ena_ring *ring = (struct ena_ring *)queue; - ena_assert_msg(ring->configured, @@ -111,7 +111,7 @@ - /* Free ring resources */ if (ring->rx_buffer_info) -@@ -803,9 +749,4 @@ static void ena_tx_queue_release(void *queue) +@@ -799,9 +746,4 @@ static void ena_tx_queue_release(void *queue) struct ena_ring *ring = (struct ena_ring *)queue; - ena_assert_msg(ring->configured, @@ -120,15 +120,15 @@ - "API violation"); - /* Free ring resources */ - if (ring->push_buf_intermediate_buf) -@@ -1147,4 +1088,6 @@ static void ena_stop(struct rte_eth_dev *dev) + if (ring->tx_buffer_info) +@@ -1099,4 +1041,6 @@ static void ena_stop(struct rte_eth_dev *dev) struct ena_adapter *adapter = (struct ena_adapter *)(dev->data->dev_private); + struct ena_com_dev *ena_dev = &adapter->ena_dev; + int rc; rte_timer_stop_sync(&adapter->timer_wd); -@@ -1152,4 +1095,10 @@ static void ena_stop(struct rte_eth_dev *dev) +@@ -1104,4 +1048,10 @@ static void ena_stop(struct rte_eth_dev *dev) ena_queue_stop_all(dev, ENA_RING_TYPE_RX); + if (adapter->trigger_reset) { @@ -139,7 +139,7 @@ + adapter->state = ENA_ADAPTER_STATE_STOPPED; } -@@ -1909,15 +1858,36 @@ err: +@@ -1754,15 +1704,36 @@ err: } -static int eth_ena_dev_uninit(struct rte_eth_dev *eth_dev) @@ -179,7 +179,7 @@ + eth_dev->dev_ops = NULL; eth_dev->rx_pkt_burst = NULL; -@@ -1925,6 +1895,4 @@ static int eth_ena_dev_uninit(struct rte_eth_dev *eth_dev) +@@ -1770,6 +1741,4 @@ static int eth_ena_dev_uninit(struct rte_eth_dev *eth_dev) eth_dev->tx_pkt_prepare = NULL; - adapter->state = ENA_ADAPTER_STATE_FREE;