[1/2] net/virtio: propagate return value of called function

Message ID 20230322102325.1739053-1-boleslav.stankevich@oktetlabs.ru (mailing list archive)
State Accepted, archived
Delegated to: Maxime Coquelin
Headers
Series [1/2] net/virtio: propagate return value of called function |

Checks

Context Check Description
ci/checkpatch warning coding style issues

Commit Message

Boleslav Stankevich March 22, 2023, 10:23 a.m. UTC
  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(-)
  

Comments

Chenbo Xia March 28, 2023, 3:14 a.m. UTC | #1
> -----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
  
Andrew Rybchenko March 30, 2023, 7:13 a.m. UTC | #2
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.
  
Chenbo Xia May 11, 2023, 8:19 a.m. UTC | #3
> -----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>
  
Maxime Coquelin June 1, 2023, 8:01 p.m. UTC | #4
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
  

Patch

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) {