* [PATCH 1/2] net/virtio: propagate return value of called function
@ 2023-03-22 10:23 Boleslav Stankevich
2023-03-22 10:23 ` [PATCH 2/2] net/virtio: fix device init to return negative errno Boleslav Stankevich
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: Boleslav Stankevich @ 2023-03-22 10:23 UTC (permalink / raw)
To: dev
Cc: Boleslav Stankevich, stable, Andrew Rybchenko, Maxime Coquelin,
Chenbo Xia, David Marchand, Hyong Youb Kim, Harman Kalra
rte_intr_vec_list_alloc() may fail because of different reasons which
are indicated by different negative errno values.
Fixes: d61138d4f0e2 ("drivers: remove direct access to interrupt handle")
Cc: stable@dpdk.org
Signed-off-by: Boleslav Stankevich <boleslav.stankevich@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
---
drivers/net/virtio/virtio_ethdev.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index ae84d313be..5c8b7b95e9 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1390,6 +1390,7 @@ 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");
@@ -1401,11 +1402,12 @@ virtio_configure_intr(struct rte_eth_dev *dev)
return -1;
}
- if (rte_intr_vec_list_alloc(dev->intr_handle, "intr_vec",
- hw->max_queue_pairs)) {
+ ret = rte_intr_vec_list_alloc(dev->intr_handle, "intr_vec",
+ hw->max_queue_pairs);
+ if (ret < 0) {
PMD_INIT_LOG(ERR, "Failed to allocate %u rxq vectors",
hw->max_queue_pairs);
- return -ENOMEM;
+ return ret;
}
if (dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC) {
--
2.30.2
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 2/2] net/virtio: fix device init to return negative errno
2023-03-22 10:23 [PATCH 1/2] net/virtio: propagate return value of called function Boleslav Stankevich
@ 2023-03-22 10:23 ` Boleslav Stankevich
2023-05-11 8:20 ` Xia, Chenbo
2023-06-01 20:01 ` Maxime Coquelin
2023-03-28 3:14 ` [PATCH 1/2] net/virtio: propagate return value of called function Xia, Chenbo
` (2 subsequent siblings)
3 siblings, 2 replies; 8+ messages in thread
From: Boleslav Stankevich @ 2023-03-22 10:23 UTC (permalink / raw)
To: dev
Cc: Boleslav Stankevich, stable, Andrew Rybchenko, Maxime Coquelin,
Chenbo Xia, Jianfeng Tan, Yuanhan Liu, Tetsuya Mukawa,
Huawei Xie
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")
Cc: stable@dpdk.org
Signed-off-by: Boleslav Stankevich <boleslav.stankevich@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
---
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 5c8b7b95e9..ca4ade9ff2 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1397,9 +1397,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",
@@ -1428,12 +1429,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;
@@ -1756,7 +1758,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;
}
}
@@ -1778,7 +1780,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;
@@ -1818,7 +1820,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);
@@ -1900,7 +1902,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,9 +1915,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);
@@ -1937,10 +1941,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.30.2
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: [PATCH 1/2] net/virtio: propagate return value of called function
2023-03-22 10:23 [PATCH 1/2] net/virtio: propagate return value of called function Boleslav Stankevich
2023-03-22 10:23 ` [PATCH 2/2] net/virtio: fix device init to return negative errno Boleslav Stankevich
@ 2023-03-28 3:14 ` Xia, Chenbo
2023-03-30 7:13 ` Andrew Rybchenko
2023-05-11 8:19 ` Xia, Chenbo
2023-06-01 20:01 ` Maxime Coquelin
3 siblings, 1 reply; 8+ messages in thread
From: Xia, Chenbo @ 2023-03-28 3:14 UTC (permalink / raw)
To: Boleslav Stankevich, dev
Cc: stable, Andrew Rybchenko, Maxime Coquelin, David Marchand,
Hyong Youb Kim, Harman Kalra
> -----Original Message-----
> From: Boleslav Stankevich <boleslav.stankevich@oktetlabs.ru>
> Sent: Wednesday, March 22, 2023 6:23 PM
> To: dev@dpdk.org
> Cc: Boleslav Stankevich <boleslav.stankevich@oktetlabs.ru>;
> stable@dpdk.org; Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>; Maxime
> Coquelin <maxime.coquelin@redhat.com>; Xia, Chenbo <chenbo.xia@intel.com>;
> David Marchand <david.marchand@redhat.com>; Hyong Youb Kim
> <hyonkim@cisco.com>; Harman Kalra <hkalra@marvell.com>
> Subject: [PATCH 1/2] net/virtio: propagate return value of called function
>
> rte_intr_vec_list_alloc() may fail because of different reasons which
> are indicated by different negative errno values.
>
> Fixes: d61138d4f0e2 ("drivers: remove direct access to interrupt handle")
> Cc: stable@dpdk.org
>
> Signed-off-by: Boleslav Stankevich <boleslav.stankevich@oktetlabs.ru>
> Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
I see Boleslav's email is updated in mailmap file but patchwork is still complaining
about it.
@Adrew & Maxime,
Do you know why?
Thanks,
Chenbo
> ---
> drivers/net/virtio/virtio_ethdev.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/virtio/virtio_ethdev.c
> b/drivers/net/virtio/virtio_ethdev.c
> index ae84d313be..5c8b7b95e9 100644
> --- a/drivers/net/virtio/virtio_ethdev.c
> +++ b/drivers/net/virtio/virtio_ethdev.c
> @@ -1390,6 +1390,7 @@ 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");
> @@ -1401,11 +1402,12 @@ virtio_configure_intr(struct rte_eth_dev *dev)
> return -1;
> }
>
> - if (rte_intr_vec_list_alloc(dev->intr_handle, "intr_vec",
> - hw->max_queue_pairs)) {
> + ret = rte_intr_vec_list_alloc(dev->intr_handle, "intr_vec",
> + hw->max_queue_pairs);
> + if (ret < 0) {
> PMD_INIT_LOG(ERR, "Failed to allocate %u rxq vectors",
> hw->max_queue_pairs);
> - return -ENOMEM;
> + return ret;
> }
>
> if (dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC) {
> --
> 2.30.2
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] net/virtio: propagate return value of called function
2023-03-28 3:14 ` [PATCH 1/2] net/virtio: propagate return value of called function Xia, Chenbo
@ 2023-03-30 7:13 ` Andrew Rybchenko
0 siblings, 0 replies; 8+ messages in thread
From: Andrew Rybchenko @ 2023-03-30 7:13 UTC (permalink / raw)
To: Xia, Chenbo, Boleslav Stankevich, dev
Cc: stable, Maxime Coquelin, David Marchand, Hyong Youb Kim, Harman Kalra
On 3/28/23 06:14, Xia, Chenbo wrote:
>> -----Original Message-----
>> From: Boleslav Stankevich <boleslav.stankevich@oktetlabs.ru>
>> Sent: Wednesday, March 22, 2023 6:23 PM
>> To: dev@dpdk.org
>> Cc: Boleslav Stankevich <boleslav.stankevich@oktetlabs.ru>;
>> stable@dpdk.org; Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>; Maxime
>> Coquelin <maxime.coquelin@redhat.com>; Xia, Chenbo <chenbo.xia@intel.com>;
>> David Marchand <david.marchand@redhat.com>; Hyong Youb Kim
>> <hyonkim@cisco.com>; Harman Kalra <hkalra@marvell.com>
>> Subject: [PATCH 1/2] net/virtio: propagate return value of called function
>>
>> rte_intr_vec_list_alloc() may fail because of different reasons which
>> are indicated by different negative errno values.
>>
>> Fixes: d61138d4f0e2 ("drivers: remove direct access to interrupt handle")
>> Cc: stable@dpdk.org
>>
>> Signed-off-by: Boleslav Stankevich <boleslav.stankevich@oktetlabs.ru>
>> Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
>
> I see Boleslav's email is updated in mailmap file but patchwork is still complaining
> about it.
>
> @Adrew & Maxime,
>
> Do you know why?
My idea was that next-virtio was not updated yet at that
moment. Don't know how to check it. May be just resent?
Andrew.
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: [PATCH 1/2] net/virtio: propagate return value of called function
2023-03-22 10:23 [PATCH 1/2] net/virtio: propagate return value of called function Boleslav Stankevich
2023-03-22 10:23 ` [PATCH 2/2] net/virtio: fix device init to return negative errno Boleslav Stankevich
2023-03-28 3:14 ` [PATCH 1/2] net/virtio: propagate return value of called function Xia, Chenbo
@ 2023-05-11 8:19 ` Xia, Chenbo
2023-06-01 20:01 ` Maxime Coquelin
3 siblings, 0 replies; 8+ messages in thread
From: Xia, Chenbo @ 2023-05-11 8:19 UTC (permalink / raw)
To: Boleslav Stankevich, dev
Cc: stable, Andrew Rybchenko, Maxime Coquelin, David Marchand,
Hyong Youb Kim, Harman Kalra
> -----Original Message-----
> From: Boleslav Stankevich <boleslav.stankevich@oktetlabs.ru>
> Sent: Wednesday, March 22, 2023 6:23 PM
> To: dev@dpdk.org
> Cc: Boleslav Stankevich <boleslav.stankevich@oktetlabs.ru>;
> stable@dpdk.org; Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>; Maxime
> Coquelin <maxime.coquelin@redhat.com>; Xia, Chenbo <chenbo.xia@intel.com>;
> David Marchand <david.marchand@redhat.com>; Hyong Youb Kim
> <hyonkim@cisco.com>; Harman Kalra <hkalra@marvell.com>
> Subject: [PATCH 1/2] net/virtio: propagate return value of called function
>
> rte_intr_vec_list_alloc() may fail because of different reasons which
> are indicated by different negative errno values.
>
> Fixes: d61138d4f0e2 ("drivers: remove direct access to interrupt handle")
> Cc: stable@dpdk.org
>
> Signed-off-by: Boleslav Stankevich <boleslav.stankevich@oktetlabs.ru>
> Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
> ---
> drivers/net/virtio/virtio_ethdev.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/virtio/virtio_ethdev.c
> b/drivers/net/virtio/virtio_ethdev.c
> index ae84d313be..5c8b7b95e9 100644
> --- a/drivers/net/virtio/virtio_ethdev.c
> +++ b/drivers/net/virtio/virtio_ethdev.c
> @@ -1390,6 +1390,7 @@ 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");
> @@ -1401,11 +1402,12 @@ virtio_configure_intr(struct rte_eth_dev *dev)
> return -1;
> }
>
> - if (rte_intr_vec_list_alloc(dev->intr_handle, "intr_vec",
> - hw->max_queue_pairs)) {
> + ret = rte_intr_vec_list_alloc(dev->intr_handle, "intr_vec",
> + hw->max_queue_pairs);
> + if (ret < 0) {
> PMD_INIT_LOG(ERR, "Failed to allocate %u rxq vectors",
> hw->max_queue_pairs);
> - return -ENOMEM;
> + return ret;
> }
>
> if (dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC) {
> --
> 2.30.2
I assume the mailmap warning should be fixed when merging. So:
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: [PATCH 2/2] net/virtio: fix device init to return negative errno
2023-03-22 10:23 ` [PATCH 2/2] net/virtio: fix device init to return negative errno Boleslav Stankevich
@ 2023-05-11 8:20 ` Xia, Chenbo
2023-06-01 20:01 ` Maxime Coquelin
1 sibling, 0 replies; 8+ messages in thread
From: Xia, Chenbo @ 2023-05-11 8:20 UTC (permalink / raw)
To: Boleslav Stankevich, dev
Cc: stable, Andrew Rybchenko, Maxime Coquelin, Jianfeng Tan,
Yuanhan Liu, Tetsuya Mukawa, Huawei Xie
> -----Original Message-----
> From: Boleslav Stankevich <boleslav.stankevich@oktetlabs.ru>
> Sent: Wednesday, March 22, 2023 6:23 PM
> To: dev@dpdk.org
> Cc: Boleslav Stankevich <boleslav.stankevich@oktetlabs.ru>;
> stable@dpdk.org; Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>; Maxime
> Coquelin <maxime.coquelin@redhat.com>; Xia, Chenbo <chenbo.xia@intel.com>;
> Jianfeng Tan <jianfeng.tan@intel.com>; Yuanhan Liu <yliu@fridaylinux.org>;
> Tetsuya Mukawa <mtetsuyah@gmail.com>; Huawei Xie <huawei.xhw@alibaba-
> inc.com>
> Subject: [PATCH 2/2] net/virtio: fix device init to return negative errno
>
> 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")
> Cc: stable@dpdk.org
>
> Signed-off-by: Boleslav Stankevich <boleslav.stankevich@oktetlabs.ru>
> Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
> ---
> 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 5c8b7b95e9..ca4ade9ff2 100644
> --- a/drivers/net/virtio/virtio_ethdev.c
> +++ b/drivers/net/virtio/virtio_ethdev.c
> @@ -1397,9 +1397,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",
> @@ -1428,12 +1429,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;
> @@ -1756,7 +1758,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;
> }
> }
>
> @@ -1778,7 +1780,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;
> @@ -1818,7 +1820,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);
>
> @@ -1900,7 +1902,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,9 +1915,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);
> @@ -1937,10 +1941,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.30.2
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] net/virtio: propagate return value of called function
2023-03-22 10:23 [PATCH 1/2] net/virtio: propagate return value of called function Boleslav Stankevich
` (2 preceding siblings ...)
2023-05-11 8:19 ` Xia, Chenbo
@ 2023-06-01 20:01 ` Maxime Coquelin
3 siblings, 0 replies; 8+ messages in thread
From: Maxime Coquelin @ 2023-06-01 20:01 UTC (permalink / raw)
To: Boleslav Stankevich, dev
Cc: stable, Andrew Rybchenko, Chenbo Xia, David Marchand,
Hyong Youb Kim, Harman Kalra
On 3/22/23 11:23, Boleslav Stankevich wrote:
> rte_intr_vec_list_alloc() may fail because of different reasons which
> are indicated by different negative errno values.
>
> Fixes: d61138d4f0e2 ("drivers: remove direct access to interrupt handle")
> Cc: stable@dpdk.org
>
> Signed-off-by: Boleslav Stankevich <boleslav.stankevich@oktetlabs.ru>
> Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
> ---
> drivers/net/virtio/virtio_ethdev.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
> index ae84d313be..5c8b7b95e9 100644
> --- a/drivers/net/virtio/virtio_ethdev.c
> +++ b/drivers/net/virtio/virtio_ethdev.c
> @@ -1390,6 +1390,7 @@ 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");
> @@ -1401,11 +1402,12 @@ virtio_configure_intr(struct rte_eth_dev *dev)
> return -1;
> }
>
> - if (rte_intr_vec_list_alloc(dev->intr_handle, "intr_vec",
> - hw->max_queue_pairs)) {
> + ret = rte_intr_vec_list_alloc(dev->intr_handle, "intr_vec",
> + hw->max_queue_pairs);
> + if (ret < 0) {
> PMD_INIT_LOG(ERR, "Failed to allocate %u rxq vectors",
> hw->max_queue_pairs);
> - return -ENOMEM;
> + return ret;
> }
>
> if (dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC) {
Applied to dpdk-next-virtio/main.
Thanks,
Maxime
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] net/virtio: fix device init to return negative errno
2023-03-22 10:23 ` [PATCH 2/2] net/virtio: fix device init to return negative errno Boleslav Stankevich
2023-05-11 8:20 ` Xia, Chenbo
@ 2023-06-01 20:01 ` Maxime Coquelin
1 sibling, 0 replies; 8+ messages in thread
From: Maxime Coquelin @ 2023-06-01 20:01 UTC (permalink / raw)
To: Boleslav Stankevich, dev
Cc: stable, Andrew Rybchenko, Chenbo Xia, Jianfeng Tan, Yuanhan Liu,
Tetsuya Mukawa, Huawei Xie
On 3/22/23 11:23, Boleslav Stankevich wrote:
> 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")
> Cc: stable@dpdk.org
>
> Signed-off-by: Boleslav Stankevich <boleslav.stankevich@oktetlabs.ru>
> Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
> ---
> 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 5c8b7b95e9..ca4ade9ff2 100644
> --- a/drivers/net/virtio/virtio_ethdev.c
> +++ b/drivers/net/virtio/virtio_ethdev.c
> @@ -1397,9 +1397,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",
> @@ -1428,12 +1429,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;
> @@ -1756,7 +1758,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;
> }
> }
>
> @@ -1778,7 +1780,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;
> @@ -1818,7 +1820,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);
>
> @@ -1900,7 +1902,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,9 +1915,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);
> @@ -1937,10 +1941,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;
> }
> }
>
Applied to dpdk-next-virtio/main.
Thanks,
Maxime
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2023-06-01 20:01 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-22 10:23 [PATCH 1/2] net/virtio: propagate return value of called function Boleslav Stankevich
2023-03-22 10:23 ` [PATCH 2/2] net/virtio: fix device init to return negative errno Boleslav Stankevich
2023-05-11 8:20 ` Xia, Chenbo
2023-06-01 20:01 ` Maxime Coquelin
2023-03-28 3:14 ` [PATCH 1/2] net/virtio: propagate return value of called function Xia, Chenbo
2023-03-30 7:13 ` Andrew Rybchenko
2023-05-11 8:19 ` Xia, Chenbo
2023-06-01 20:01 ` Maxime Coquelin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).