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

Xueming Li xuemingl at nvidia.com
Sun Jun 25 08:35:03 CEST 2023


Hi,

FYI, your patch has been queued to stable release 22.11.3

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/27/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://git.dpdk.org/dpdk-stable/log/?h=22.11-staging

This queued commit can be viewed at:
https://git.dpdk.org/dpdk-stable/commit/?h=22.11-staging&id=d228fa562b1d875d492be083abf4258ced0ee409

Thanks.

Xueming Li <xuemingl at nvidia.com>

---
>From d228fa562b1d875d492be083abf4258ced0ee409 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
Cc: Xueming Li <xuemingl at nvidia.com>

[ 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 | 33 +++++++++++++++++-------------
 1 file changed, 19 insertions(+), 14 deletions(-)

diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 0c0c7c78f9..c4f6fa55b3 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1804,9 +1804,10 @@ virtio_configure_intr(struct rte_eth_dev *dev)
 		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;
 	}
 
 	ret = rte_intr_vec_list_alloc(dev->intr_handle, "intr_vec",
@@ -1835,12 +1836,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;
@@ -2163,7 +2165,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;
 		}
 	}
 
@@ -2185,7 +2187,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;
@@ -2225,7 +2227,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. */
 	virtio_set_status(hw, VIRTIO_CONFIG_STATUS_DRIVER);
 	if (virtio_ethdev_negotiate_features(hw, req_features) < 0)
-		return -1;
+		return -EINVAL;
 
 	hw->weak_barriers = !virtio_with_feature(hw, VIRTIO_F_ORDER_PLATFORM);
 
@@ -2307,7 +2309,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;
@@ -2320,9 +2322,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);
@@ -2344,10 +2348,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.25.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2023-06-25 14:32:00.769978100 +0800
+++ 0085-net-virtio-fix-initialization-to-return-negative-err.patch	2023-06-25 14:31:58.455773900 +0800
@@ -1 +1 @@
-From 55e19d06f8a8a865297532071453c10544a07a24 Mon Sep 17 00:00:00 2001
+From d228fa562b1d875d492be083abf4258ced0ee409 Mon Sep 17 00:00:00 2001
@@ -4,0 +5,3 @@
+Cc: Xueming Li <xuemingl at nvidia.com>
+
+[ upstream commit 55e19d06f8a8a865297532071453c10544a07a24 ]
@@ -14 +16,0 @@
-Cc: stable at dpdk.org
@@ -24 +26 @@
-index a81110e70a..2c23f1c00e 100644
+index 0c0c7c78f9..c4f6fa55b3 100644
@@ -27 +29 @@
-@@ -1360,9 +1360,10 @@ virtio_configure_intr(struct rte_eth_dev *dev)
+@@ -1804,9 +1804,10 @@ virtio_configure_intr(struct rte_eth_dev *dev)
@@ -40 +42 @@
-@@ -1391,12 +1392,13 @@ virtio_configure_intr(struct rte_eth_dev *dev)
+@@ -1835,12 +1836,13 @@ virtio_configure_intr(struct rte_eth_dev *dev)
@@ -57 +59 @@
-@@ -1719,7 +1721,7 @@ virtio_dev_rss_init(struct rte_eth_dev *eth_dev)
+@@ -2163,7 +2165,7 @@ virtio_dev_rss_init(struct rte_eth_dev *eth_dev)
@@ -66 +68 @@
-@@ -1741,7 +1743,7 @@ virtio_dev_rss_init(struct rte_eth_dev *eth_dev)
+@@ -2185,7 +2187,7 @@ virtio_dev_rss_init(struct rte_eth_dev *eth_dev)
@@ -75 +77 @@
-@@ -1781,7 +1783,7 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features)
+@@ -2225,7 +2227,7 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features)
@@ -84 +86 @@
-@@ -1863,7 +1865,7 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features)
+@@ -2307,7 +2309,7 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features)
@@ -93 +95 @@
-@@ -1876,9 +1878,11 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features)
+@@ -2320,9 +2322,11 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features)
@@ -108 +110 @@
-@@ -1900,10 +1904,11 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features)
+@@ -2344,10 +2348,11 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features)


More information about the stable mailing list