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 3F1E01B494 for ; Fri, 23 Nov 2018 11:29:57 +0100 (CET) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A6C853082141; Fri, 23 Nov 2018 10:29:56 +0000 (UTC) Received: from ktraynor.remote.csb (unknown [10.36.118.7]) by smtp.corp.redhat.com (Postfix) with ESMTP id 390EF413C; Fri, 23 Nov 2018 10:29:53 +0000 (UTC) From: Kevin Traynor To: Chas Williams Cc: Maxime Coquelin , dpdk stable Date: Fri, 23 Nov 2018 10:26:42 +0000 Message-Id: <20181123102713.17309-38-ktraynor@redhat.com> In-Reply-To: <20181123102713.17309-1-ktraynor@redhat.com> References: <20181123102713.17309-1-ktraynor@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Fri, 23 Nov 2018 10:29:56 +0000 (UTC) Subject: [dpdk-stable] patch 'net/virtio: do not re-enter clean up routines' has been queued to stable release 18.08.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, 23 Nov 2018 10:29:57 -0000 Hi, FYI, your patch has been queued to stable release 18.08.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 11/29/18. 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. If the code is different (ie: not only metadata diffs), due for example to a change in context or macro names, please double check it. Thanks. Kevin Traynor --- >>From 9ca7220ac5a4c0372ffd78565a5d69c49bcdecaf Mon Sep 17 00:00:00 2001 From: Chas Williams Date: Mon, 17 Jul 2017 19:05:22 -0400 Subject: [PATCH] net/virtio: do not re-enter clean up routines [ upstream commit 2a821d81f355a40508c81c006f1e3002a1ba2494 ] .dev_uninit calls .dev_stop and .dev_close. The work that is done in those routines doesn't need repeated. Use started and opened to track the adapter's status. Fixes: c1f86306a026 ("virtio: add new driver") Signed-off-by: Chas Williams Reviewed-by: Maxime Coquelin --- drivers/net/virtio/virtio_ethdev.c | 16 +++++++++++++--- drivers/net/virtio/virtio_pci.h | 3 ++- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index 4745899c6..b8693ff80 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -589,4 +589,8 @@ virtio_dev_close(struct rte_eth_dev *dev) PMD_INIT_LOG(DEBUG, "virtio_dev_close"); + if (!hw->opened) + return; + hw->opened = false; + /* reset the NIC */ if (dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC) @@ -1928,4 +1932,6 @@ virtio_dev_configure(struct rte_eth_dev *dev) hw->use_simple_rx = 0; + hw->opened = true; + return 0; } @@ -2018,5 +2024,5 @@ virtio_dev_start(struct rte_eth_dev *dev) set_rxtx_funcs(dev); - hw->started = 1; + hw->started = true; /* Initialize Link state */ @@ -2084,4 +2090,8 @@ virtio_dev_stop(struct rte_eth_dev *dev) rte_spinlock_lock(&hw->state_lock); + if (!hw->started) + goto out_unlock; + hw->started = false; + if (intr_conf->lsc || intr_conf->rxq) { virtio_intr_disable(dev); @@ -2095,7 +2105,7 @@ virtio_dev_stop(struct rte_eth_dev *dev) } - hw->started = 0; memset(&link, 0, sizeof(link)); rte_eth_linkstatus_set(dev, &link); +out_unlock: rte_spinlock_unlock(&hw->state_lock); } @@ -2113,5 +2123,5 @@ virtio_dev_link_update(struct rte_eth_dev *dev, __rte_unused int wait_to_complet link.link_autoneg = ETH_LINK_FIXED; - if (hw->started == 0) { + if (!hw->started) { link.link_status = ETH_LINK_DOWN; } else if (vtpci_with_feature(hw, VIRTIO_NET_F_STATUS)) { diff --git a/drivers/net/virtio/virtio_pci.h b/drivers/net/virtio/virtio_pci.h index 58fdd3d45..7ffd443e1 100644 --- a/drivers/net/virtio/virtio_pci.h +++ b/drivers/net/virtio/virtio_pci.h @@ -233,5 +233,5 @@ struct virtio_hw { uint64_t guest_features; uint32_t max_queue_pairs; - uint16_t started; + bool started; uint16_t max_mtu; uint16_t vtnet_hdr_size; @@ -259,4 +259,5 @@ struct virtio_hw { rte_spinlock_t state_lock; struct rte_mbuf **inject_pkts; + bool opened; struct virtqueue **vqs; -- 2.19.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2018-11-23 10:22:55.253419471 +0000 +++ 0038-net-virtio-do-not-re-enter-clean-up-routines.patch 2018-11-23 10:22:54.000000000 +0000 @@ -1,14 +1,15 @@ -From 2a821d81f355a40508c81c006f1e3002a1ba2494 Mon Sep 17 00:00:00 2001 +From 9ca7220ac5a4c0372ffd78565a5d69c49bcdecaf Mon Sep 17 00:00:00 2001 From: Chas Williams Date: Mon, 17 Jul 2017 19:05:22 -0400 Subject: [PATCH] net/virtio: do not re-enter clean up routines +[ upstream commit 2a821d81f355a40508c81c006f1e3002a1ba2494 ] + .dev_uninit calls .dev_stop and .dev_close. The work that is done in those routines doesn't need repeated. Use started and opened to track the adapter's status. Fixes: c1f86306a026 ("virtio: add new driver") -Cc: stable@dpdk.org Signed-off-by: Chas Williams Reviewed-by: Maxime Coquelin @@ -18,7 +19,7 @@ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c -index cb6248eb6..e1fe36a23 100644 +index 4745899c6..b8693ff80 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -589,4 +589,8 @@ virtio_dev_close(struct rte_eth_dev *dev) @@ -30,21 +31,21 @@ + /* reset the NIC */ if (dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC) -@@ -1925,4 +1929,6 @@ virtio_dev_configure(struct rte_eth_dev *dev) +@@ -1928,4 +1932,6 @@ virtio_dev_configure(struct rte_eth_dev *dev) hw->use_simple_rx = 0; + hw->opened = true; + return 0; } -@@ -2015,5 +2021,5 @@ virtio_dev_start(struct rte_eth_dev *dev) +@@ -2018,5 +2024,5 @@ virtio_dev_start(struct rte_eth_dev *dev) set_rxtx_funcs(dev); - hw->started = 1; + hw->started = true; /* Initialize Link state */ -@@ -2081,4 +2087,8 @@ virtio_dev_stop(struct rte_eth_dev *dev) +@@ -2084,4 +2090,8 @@ virtio_dev_stop(struct rte_eth_dev *dev) rte_spinlock_lock(&hw->state_lock); + if (!hw->started) @@ -53,7 +54,7 @@ + if (intr_conf->lsc || intr_conf->rxq) { virtio_intr_disable(dev); -@@ -2092,7 +2102,7 @@ virtio_dev_stop(struct rte_eth_dev *dev) +@@ -2095,7 +2105,7 @@ virtio_dev_stop(struct rte_eth_dev *dev) } - hw->started = 0; @@ -62,7 +63,7 @@ +out_unlock: rte_spinlock_unlock(&hw->state_lock); } -@@ -2110,5 +2120,5 @@ virtio_dev_link_update(struct rte_eth_dev *dev, __rte_unused int wait_to_complet +@@ -2113,5 +2123,5 @@ virtio_dev_link_update(struct rte_eth_dev *dev, __rte_unused int wait_to_complet link.link_autoneg = ETH_LINK_FIXED; - if (hw->started == 0) { @@ -70,17 +71,17 @@ link.link_status = ETH_LINK_DOWN; } else if (vtpci_with_feature(hw, VIRTIO_NET_F_STATUS)) { diff --git a/drivers/net/virtio/virtio_pci.h b/drivers/net/virtio/virtio_pci.h -index 64ba6ecbc..e961a58ca 100644 +index 58fdd3d45..7ffd443e1 100644 --- a/drivers/net/virtio/virtio_pci.h +++ b/drivers/net/virtio/virtio_pci.h -@@ -232,5 +232,5 @@ struct virtio_hw { +@@ -233,5 +233,5 @@ struct virtio_hw { uint64_t guest_features; uint32_t max_queue_pairs; - uint16_t started; + bool started; uint16_t max_mtu; uint16_t vtnet_hdr_size; -@@ -258,4 +258,5 @@ struct virtio_hw { +@@ -259,4 +259,5 @@ struct virtio_hw { rte_spinlock_t state_lock; struct rte_mbuf **inject_pkts; + bool opened;