[dpdk-stable] patch 'net/virtio: do not re-enter clean up routines' has been queued to stable release 18.08.1

Kevin Traynor ktraynor at redhat.com
Fri Nov 23 11:26:42 CET 2018


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 <ciwillia at brocade.com>
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 <ciwillia at brocade.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin at redhat.com>
---
 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 <ciwillia at brocade.com>
 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 at dpdk.org
 
 Signed-off-by: Chas Williams <ciwillia at brocade.com>
 Reviewed-by: Maxime Coquelin <maxime.coquelin at redhat.com>
@@ -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;


More information about the stable mailing list