patch 'net/virtio: fix initialization to return negative errno' has been queued to stable release 20.11.9

luca.boccassi at gmail.com luca.boccassi at gmail.com
Thu Jun 15 03:32:40 CEST 2023


Hi,

FYI, your patch has been queued to stable release 20.11.9

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 06/17/23. 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.

Queued patches are on a temporary branch at:
https://github.com/bluca/dpdk-stable

This queued commit can be viewed at:
https://github.com/bluca/dpdk-stable/commit/08faea99b9c9334771c5e39373fefeef12fde63a

Thanks.

Luca Boccassi

---
>From 08faea99b9c9334771c5e39373fefeef12fde63a Mon Sep 17 00:00:00 2001
From: Boleslav Stankevich <boleslav.stankevich at oktetlabs.ru>
Date: Wed, 22 Mar 2023 13:23:25 +0300
Subject: [PATCH] net/virtio: fix initialization to return negative errno

[ upstream commit 55e19d06f8a8a865297532071453c10544a07a24 ]

virtio_init_device() and called helper functions sometimes return -1
when return code should be negative errno. Fix all such cases to return
correct negative errno instead.

Fixes: 26b683b4f7d0 ("net/virtio: setup Rx queue interrupts")
Fixes: 0c9d66207054 ("net/virtio: support RSS")
Fixes: 6ba1f63b5ab0 ("virtio: support specification 1.0")
Fixes: 49d26d9e3f47 ("net/virtio: support MTU feature")

Signed-off-by: Boleslav Stankevich <boleslav.stankevich at oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko at oktetlabs.ru>
Reviewed-by: Chenbo Xia <chenbo.xia at intel.com>
---
 drivers/net/virtio/virtio_ethdev.c | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 011130c61f..1ee738f8cc 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1695,15 +1695,17 @@ static int
 virtio_configure_intr(struct rte_eth_dev *dev)
 {
 	struct virtio_hw *hw = dev->data->dev_private;
+	int ret;
 
 	if (!rte_intr_cap_multiple(dev->intr_handle)) {
 		PMD_INIT_LOG(ERR, "Multiple intr vector not supported");
 		return -ENOTSUP;
 	}
 
-	if (rte_intr_efd_enable(dev->intr_handle, dev->data->nb_rx_queues)) {
+	ret = rte_intr_efd_enable(dev->intr_handle, dev->data->nb_rx_queues);
+	if (ret < 0) {
 		PMD_INIT_LOG(ERR, "Fail to create eventfd");
-		return -1;
+		return ret;
 	}
 
 	if (!dev->intr_handle->intr_vec) {
@@ -1735,12 +1737,13 @@ virtio_configure_intr(struct rte_eth_dev *dev)
 	 */
 	if (virtio_intr_enable(dev) < 0) {
 		PMD_DRV_LOG(ERR, "interrupt enable failed");
-		return -1;
+		return -EINVAL;
 	}
 
-	if (virtio_queues_bind_intr(dev) < 0) {
+	ret = virtio_queues_bind_intr(dev);
+	if (ret < 0) {
 		PMD_INIT_LOG(ERR, "Failed to bind queue/interrupt");
-		return -1;
+		return ret;
 	}
 
 	return 0;
@@ -1796,7 +1799,7 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features)
 	/* Tell the host we've known how to drive the device. */
 	vtpci_set_status(hw, VIRTIO_CONFIG_STATUS_DRIVER);
 	if (virtio_negotiate_features(hw, req_features) < 0)
-		return -1;
+		return -EINVAL;
 
 	hw->weak_barriers = !vtpci_with_feature(hw, VIRTIO_F_ORDER_PLATFORM);
 
@@ -1881,7 +1884,7 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features)
 			if (config->mtu < RTE_ETHER_MIN_MTU) {
 				PMD_INIT_LOG(ERR, "invalid max MTU value (%u)",
 						config->mtu);
-				return -1;
+				return -EINVAL;
 			}
 
 			hw->max_mtu = config->mtu;
@@ -1913,10 +1916,11 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features)
 		return ret;
 
 	if (eth_dev->data->dev_conf.intr_conf.rxq) {
-		if (virtio_configure_intr(eth_dev) < 0) {
+		ret = virtio_configure_intr(eth_dev);
+		if (ret < 0) {
 			PMD_INIT_LOG(ERR, "failed to configure interrupt");
 			virtio_free_queues(hw);
-			return -1;
+			return ret;
 		}
 	}
 
-- 
2.39.2

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2023-06-15 01:56:36.995835046 +0100
+++ 0045-net-virtio-fix-initialization-to-return-negative-err.patch	2023-06-15 01:56:34.659543314 +0100
@@ -1 +1 @@
-From 55e19d06f8a8a865297532071453c10544a07a24 Mon Sep 17 00:00:00 2001
+From 08faea99b9c9334771c5e39373fefeef12fde63a Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 55e19d06f8a8a865297532071453c10544a07a24 ]
+
@@ -14 +15,0 @@
-Cc: stable at dpdk.org
@@ -20,2 +21,2 @@
- drivers/net/virtio/virtio_ethdev.c | 33 +++++++++++++++++-------------
- 1 file changed, 19 insertions(+), 14 deletions(-)
+ drivers/net/virtio/virtio_ethdev.c | 22 +++++++++++++---------
+ 1 file changed, 13 insertions(+), 9 deletions(-)
@@ -24 +25 @@
-index a81110e70a..2c23f1c00e 100644
+index 011130c61f..1ee738f8cc 100644
@@ -27 +28,8 @@
-@@ -1360,9 +1360,10 @@ virtio_configure_intr(struct rte_eth_dev *dev)
+@@ -1695,15 +1695,17 @@ static int
+ virtio_configure_intr(struct rte_eth_dev *dev)
+ {
+ 	struct virtio_hw *hw = dev->data->dev_private;
++	int ret;
+ 
+ 	if (!rte_intr_cap_multiple(dev->intr_handle)) {
+ 		PMD_INIT_LOG(ERR, "Multiple intr vector not supported");
@@ -39,2 +47,2 @@
- 	ret = rte_intr_vec_list_alloc(dev->intr_handle, "intr_vec",
-@@ -1391,12 +1392,13 @@ virtio_configure_intr(struct rte_eth_dev *dev)
+ 	if (!dev->intr_handle->intr_vec) {
+@@ -1735,12 +1737,13 @@ virtio_configure_intr(struct rte_eth_dev *dev)
@@ -57,19 +65 @@
-@@ -1719,7 +1721,7 @@ virtio_dev_rss_init(struct rte_eth_dev *eth_dev)
- 				eth_dev->device->numa_node);
- 		if (!hw->rss_key) {
- 			PMD_INIT_LOG(ERR, "Failed to allocate RSS key");
--			return -1;
-+			return -ENOMEM;
- 		}
- 	}
- 
-@@ -1741,7 +1743,7 @@ virtio_dev_rss_init(struct rte_eth_dev *eth_dev)
- 				eth_dev->device->numa_node);
- 		if (!hw->rss_reta) {
- 			PMD_INIT_LOG(ERR, "Failed to allocate RSS reta");
--			return -1;
-+			return -ENOMEM;
- 		}
- 
- 		hw->rss_rx_queues = 0;
-@@ -1781,7 +1783,7 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features)
+@@ -1796,7 +1799,7 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features)
@@ -77,2 +67,2 @@
- 	virtio_set_status(hw, VIRTIO_CONFIG_STATUS_DRIVER);
- 	if (virtio_ethdev_negotiate_features(hw, req_features) < 0)
+ 	vtpci_set_status(hw, VIRTIO_CONFIG_STATUS_DRIVER);
+ 	if (virtio_negotiate_features(hw, req_features) < 0)
@@ -82 +72 @@
- 	hw->weak_barriers = !virtio_with_feature(hw, VIRTIO_F_ORDER_PLATFORM);
+ 	hw->weak_barriers = !vtpci_with_feature(hw, VIRTIO_F_ORDER_PLATFORM);
@@ -84 +74 @@
-@@ -1863,7 +1865,7 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features)
+@@ -1881,7 +1884,7 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features)
@@ -93,16 +83 @@
-@@ -1876,9 +1878,11 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features)
- 		}
- 
- 		hw->rss_hash_types = 0;
--		if (virtio_with_feature(hw, VIRTIO_NET_F_RSS))
--			if (virtio_dev_rss_init(eth_dev))
--				return -1;
-+		if (virtio_with_feature(hw, VIRTIO_NET_F_RSS)) {
-+			ret = virtio_dev_rss_init(eth_dev);
-+			if (ret < 0)
-+				return ret;
-+		}
- 
- 		PMD_INIT_LOG(DEBUG, "config->max_virtqueue_pairs=%d",
- 				config->max_virtqueue_pairs);
-@@ -1900,10 +1904,11 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features)
+@@ -1913,10 +1916,11 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features)


More information about the stable mailing list