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 AA3AA1B49C for ; Fri, 4 Jan 2019 14:28:01 +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 199D2C05D3E0; Fri, 4 Jan 2019 13:28:01 +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 B53C15C228; Fri, 4 Jan 2019 13:27:59 +0000 (UTC) From: Kevin Traynor To: Rafal Kozik Cc: Michal Krawczyk , dpdk stable Date: Fri, 4 Jan 2019 13:24:34 +0000 Message-Id: <20190104132455.15170-52-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.32]); Fri, 04 Jan 2019 13:28:01 +0000 (UTC) Subject: [dpdk-stable] patch 'net/ena: destroy queues if start failed' 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:02 -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 d1c1d3023e98a2719fb147c8207801611483cb6b Mon Sep 17 00:00:00 2001 From: Rafal Kozik Date: Fri, 14 Dec 2018 14:18:35 +0100 Subject: [PATCH] net/ena: destroy queues if start failed [ upstream commit 26e5543dc85b3be23879ba90ddb00e3456179805 ] If start function fails, previously created queues have to be removed. ena_queue_restart_all() and ena_queue_restart() are renamed to ena_queue_start_all() and ena_queue_start(). ena_free_io_queues_all() is renamed to ena_queue_stop_all(). Fixes: df238f84c0a2 ("net/ena: recreate HW IO rings on start and stop") Signed-off-by: Rafal Kozik Acked-by: Michal Krawczyk --- drivers/net/ena/ena_ethdev.c | 95 +++++++++++++++++++++++------------- 1 file changed, 60 insertions(+), 35 deletions(-) diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c index e7b462859..86ee7942c 100644 --- a/drivers/net/ena/ena_ethdev.c +++ b/drivers/net/ena/ena_ethdev.c @@ -243,8 +243,10 @@ static int ena_link_update(struct rte_eth_dev *dev, int wait_to_complete); static int ena_create_io_queue(struct ena_ring *ring); -static void ena_free_io_queues_all(struct ena_adapter *adapter); -static int ena_queue_restart(struct ena_ring *ring); -static int ena_queue_restart_all(struct rte_eth_dev *dev, - enum ena_ring_type ring_type); +static void ena_queue_stop(struct ena_ring *ring); +static void ena_queue_stop_all(struct rte_eth_dev *dev, + enum ena_ring_type ring_type); +static int ena_queue_start(struct ena_ring *ring); +static int ena_queue_start_all(struct rte_eth_dev *dev, + enum ena_ring_type ring_type); static void ena_stats_restart(struct rte_eth_dev *dev); static void ena_infos_get(struct rte_eth_dev *dev, @@ -802,7 +804,4 @@ static void ena_tx_queue_release(void *queue) "API violation"); - /* Free all bufs */ - ena_tx_queue_release_bufs(ring); - /* Free ring resources */ if (ring->tx_buffer_info) @@ -865,6 +864,6 @@ static int ena_link_update(struct rte_eth_dev *dev, } -static int ena_queue_restart_all(struct rte_eth_dev *dev, - enum ena_ring_type ring_type) +static int ena_queue_start_all(struct rte_eth_dev *dev, + enum ena_ring_type ring_type) { struct ena_adapter *adapter = @@ -894,11 +893,11 @@ static int ena_queue_restart_all(struct rte_eth_dev *dev, } - rc = ena_queue_restart(&queues[i]); + rc = ena_queue_start(&queues[i]); if (rc) { PMD_INIT_LOG(ERR, - "failed to restart queue %d type(%d)", + "failed to start queue %d type(%d)", i, ring_type); - return rc; + goto err; } } @@ -906,4 +905,11 @@ static int ena_queue_restart_all(struct rte_eth_dev *dev, return 0; + +err: + while (i--) + if (queues[i].configured) + ena_queue_stop(&queues[i]); + + return rc; } @@ -1054,11 +1060,11 @@ static int ena_start(struct rte_eth_dev *dev) return rc; - rc = ena_queue_restart_all(dev, ENA_RING_TYPE_RX); + rc = ena_queue_start_all(dev, ENA_RING_TYPE_RX); if (rc) return rc; - rc = ena_queue_restart_all(dev, ENA_RING_TYPE_TX); + rc = ena_queue_start_all(dev, ENA_RING_TYPE_TX); if (rc) - return rc; + goto err_start_tx; if (adapter->rte_dev->data->dev_conf.rxmode.mq_mode & @@ -1066,5 +1072,5 @@ static int ena_start(struct rte_eth_dev *dev) rc = ena_rss_init_default(adapter); if (rc) - return rc; + goto err_rss_init; } @@ -1081,4 +1087,10 @@ static int ena_start(struct rte_eth_dev *dev) return 0; + +err_rss_init: + ena_queue_stop_all(dev, ENA_RING_TYPE_TX); +err_start_tx: + ena_queue_stop_all(dev, ENA_RING_TYPE_RX); + return rc; } @@ -1089,5 +1101,6 @@ static void ena_stop(struct rte_eth_dev *dev) rte_timer_stop_sync(&adapter->timer_wd); - ena_free_io_queues_all(adapter); + ena_queue_stop_all(dev, ENA_RING_TYPE_TX); + ena_queue_stop_all(dev, ENA_RING_TYPE_RX); adapter->state = ENA_ADAPTER_STATE_STOPPED; @@ -1152,34 +1165,44 @@ static int ena_create_io_queue(struct ena_ring *ring) } -static void ena_free_io_queues_all(struct ena_adapter *adapter) +static void ena_queue_stop(struct ena_ring *ring) { - struct rte_eth_dev *eth_dev = adapter->rte_dev; - struct ena_com_dev *ena_dev = &adapter->ena_dev; - int i; - uint16_t ena_qid; - uint16_t nb_rxq = eth_dev->data->nb_rx_queues; - uint16_t nb_txq = eth_dev->data->nb_tx_queues; + struct ena_com_dev *ena_dev = &ring->adapter->ena_dev; - for (i = 0; i < nb_txq; ++i) { - ena_qid = ENA_IO_TXQ_IDX(i); - ena_com_destroy_io_queue(ena_dev, ena_qid); - - ena_tx_queue_release_bufs(&adapter->tx_ring[i]); + if (ring->type == ENA_RING_TYPE_RX) { + ena_com_destroy_io_queue(ena_dev, ENA_IO_RXQ_IDX(ring->id)); + ena_rx_queue_release_bufs(ring); + } else { + ena_com_destroy_io_queue(ena_dev, ENA_IO_TXQ_IDX(ring->id)); + ena_tx_queue_release_bufs(ring); } +} - for (i = 0; i < nb_rxq; ++i) { - ena_qid = ENA_IO_RXQ_IDX(i); - ena_com_destroy_io_queue(ena_dev, ena_qid); +static void ena_queue_stop_all(struct rte_eth_dev *dev, + enum ena_ring_type ring_type) +{ + struct ena_adapter *adapter = + (struct ena_adapter *)(dev->data->dev_private); + struct ena_ring *queues = NULL; + uint16_t nb_queues, i; - ena_rx_queue_release_bufs(&adapter->rx_ring[i]); + if (ring_type == ENA_RING_TYPE_RX) { + queues = adapter->rx_ring; + nb_queues = dev->data->nb_rx_queues; + } else { + queues = adapter->tx_ring; + nb_queues = dev->data->nb_tx_queues; } + + for (i = 0; i < nb_queues; ++i) + if (queues[i].configured) + ena_queue_stop(&queues[i]); } -static int ena_queue_restart(struct ena_ring *ring) +static int ena_queue_start(struct ena_ring *ring) { int rc, bufs_num; ena_assert_msg(ring->configured == 1, - "Trying to restart unconfigured queue\n"); + "Trying to start unconfigured queue\n"); rc = ena_create_io_queue(ring); @@ -1198,4 +1221,6 @@ static int ena_queue_restart(struct ena_ring *ring) rc = ena_populate_rx_queue(ring, bufs_num); if (rc != bufs_num) { + ena_com_destroy_io_queue(&ring->adapter->ena_dev, + ENA_IO_RXQ_IDX(ring->id)); PMD_INIT_LOG(ERR, "Failed to populate rx ring !"); return ENA_COM_FAULT; -- 2.19.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2019-01-04 13:23:08.711272851 +0000 +++ 0052-net-ena-destroy-queues-if-start-failed.patch 2019-01-04 13:23:07.000000000 +0000 @@ -1,8 +1,10 @@ -From 26e5543dc85b3be23879ba90ddb00e3456179805 Mon Sep 17 00:00:00 2001 +From d1c1d3023e98a2719fb147c8207801611483cb6b Mon Sep 17 00:00:00 2001 From: Rafal Kozik Date: Fri, 14 Dec 2018 14:18:35 +0100 Subject: [PATCH] net/ena: destroy queues if start failed +[ upstream commit 26e5543dc85b3be23879ba90ddb00e3456179805 ] + If start function fails, previously created queues have to be removed. ena_queue_restart_all() and ena_queue_restart() are renamed to @@ -11,7 +13,6 @@ ena_free_io_queues_all() is renamed to ena_queue_stop_all(). Fixes: df238f84c0a2 ("net/ena: recreate HW IO rings on start and stop") -Cc: stable@dpdk.org Signed-off-by: Rafal Kozik Acked-by: Michal Krawczyk @@ -20,10 +21,10 @@ 1 file changed, 60 insertions(+), 35 deletions(-) diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c -index 5f7dec086..deb97151d 100644 +index e7b462859..86ee7942c 100644 --- a/drivers/net/ena/ena_ethdev.c +++ b/drivers/net/ena/ena_ethdev.c -@@ -245,8 +245,10 @@ static int ena_link_update(struct rte_eth_dev *dev, +@@ -243,8 +243,10 @@ static int ena_link_update(struct rte_eth_dev *dev, int wait_to_complete); static int ena_create_io_queue(struct ena_ring *ring); -static void ena_free_io_queues_all(struct ena_adapter *adapter); @@ -38,15 +39,15 @@ + enum ena_ring_type ring_type); static void ena_stats_restart(struct rte_eth_dev *dev); static void ena_infos_get(struct rte_eth_dev *dev, -@@ -806,7 +808,4 @@ static void ena_tx_queue_release(void *queue) +@@ -802,7 +804,4 @@ static void ena_tx_queue_release(void *queue) "API violation"); - /* Free all bufs */ - ena_tx_queue_release_bufs(ring); - /* Free ring resources */ - if (ring->push_buf_intermediate_buf) -@@ -873,6 +872,6 @@ static int ena_link_update(struct rte_eth_dev *dev, + if (ring->tx_buffer_info) +@@ -865,6 +864,6 @@ static int ena_link_update(struct rte_eth_dev *dev, } -static int ena_queue_restart_all(struct rte_eth_dev *dev, @@ -55,7 +56,7 @@ + enum ena_ring_type ring_type) { struct ena_adapter *adapter = -@@ -902,11 +901,11 @@ static int ena_queue_restart_all(struct rte_eth_dev *dev, +@@ -894,11 +893,11 @@ static int ena_queue_restart_all(struct rte_eth_dev *dev, } - rc = ena_queue_restart(&queues[i]); @@ -70,7 +71,7 @@ + goto err; } } -@@ -914,4 +913,11 @@ static int ena_queue_restart_all(struct rte_eth_dev *dev, +@@ -906,4 +905,11 @@ static int ena_queue_restart_all(struct rte_eth_dev *dev, return 0; + @@ -82,7 +83,7 @@ + return rc; } -@@ -1102,11 +1108,11 @@ static int ena_start(struct rte_eth_dev *dev) +@@ -1054,11 +1060,11 @@ static int ena_start(struct rte_eth_dev *dev) return rc; - rc = ena_queue_restart_all(dev, ENA_RING_TYPE_RX); @@ -97,14 +98,14 @@ + goto err_start_tx; if (adapter->rte_dev->data->dev_conf.rxmode.mq_mode & -@@ -1114,5 +1120,5 @@ static int ena_start(struct rte_eth_dev *dev) +@@ -1066,5 +1072,5 @@ static int ena_start(struct rte_eth_dev *dev) rc = ena_rss_init_default(adapter); if (rc) - return rc; + goto err_rss_init; } -@@ -1129,4 +1135,10 @@ static int ena_start(struct rte_eth_dev *dev) +@@ -1081,4 +1087,10 @@ static int ena_start(struct rte_eth_dev *dev) return 0; + @@ -115,7 +116,7 @@ + return rc; } -@@ -1137,5 +1149,6 @@ static void ena_stop(struct rte_eth_dev *dev) +@@ -1089,5 +1101,6 @@ static void ena_stop(struct rte_eth_dev *dev) rte_timer_stop_sync(&adapter->timer_wd); - ena_free_io_queues_all(adapter); @@ -123,7 +124,7 @@ + ena_queue_stop_all(dev, ENA_RING_TYPE_RX); adapter->state = ENA_ADAPTER_STATE_STOPPED; -@@ -1200,34 +1213,44 @@ static int ena_create_io_queue(struct ena_ring *ring) +@@ -1152,34 +1165,44 @@ static int ena_create_io_queue(struct ena_ring *ring) } -static void ena_free_io_queues_all(struct ena_adapter *adapter) @@ -186,7 +187,7 @@ + "Trying to start unconfigured queue\n"); rc = ena_create_io_queue(ring); -@@ -1246,4 +1269,6 @@ static int ena_queue_restart(struct ena_ring *ring) +@@ -1198,4 +1221,6 @@ static int ena_queue_restart(struct ena_ring *ring) rc = ena_populate_rx_queue(ring, bufs_num); if (rc != bufs_num) { + ena_com_destroy_io_queue(&ring->adapter->ena_dev,