[13/51] net/netvsc: check status of getting ethdev info
diff mbox series

Message ID 1566915962-5472-14-git-send-email-arybchenko@solarflare.com
State Superseded, archived
Delegated to: Ferruh Yigit
Headers show
Series
  • ethdev: change rte_eth_dev_info_get() return value to int
Related show

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Andrew Rybchenko Aug. 27, 2019, 2:25 p.m. UTC
From: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>

rte_eth_dev_info_get() return value was changed from void to int,
so this patch modify rte_eth_dev_info_get() usage across
net/netvsc according to its new return type.

Signed-off-by: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 drivers/net/netvsc/hn_vf.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

Comments

Stephen Hemminger Aug. 27, 2019, 8:17 p.m. UTC | #1
On Tue, 27 Aug 2019 15:25:24 +0100
Andrew Rybchenko <arybchenko@solarflare.com> wrote:

> From: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>
> 
> rte_eth_dev_info_get() return value was changed from void to int,
> so this patch modify rte_eth_dev_info_get() usage across
> net/netvsc according to its new return type.
> 
> Signed-off-by: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>
> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
> ---
>  drivers/net/netvsc/hn_vf.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/netvsc/hn_vf.c b/drivers/net/netvsc/hn_vf.c
> index 03f855b..b6b1e5d 100644
> --- a/drivers/net/netvsc/hn_vf.c
> +++ b/drivers/net/netvsc/hn_vf.c
> @@ -176,8 +176,16 @@ static void hn_vf_info_merge(struct rte_eth_dev *vf_dev,
>  			     struct rte_eth_dev_info *info)
>  {
>  	struct rte_eth_dev_info vf_info;
> +	int ret;
> +
> +	ret = rte_eth_dev_info_get(vf_dev->data->port_id, &vf_info);
> +	if (ret != 0) {
> +		PMD_DRV_LOG(ERR,
> +			"Error during getting device (port %u) info: %s\n",
> +			vf_dev->data->port_id, strerror(-ret));
>  
> -	rte_eth_dev_info_get(vf_dev->data->port_id, &vf_info);
> +		return;
> +	}
>  

I would prefer that the driver api callback change to return an
error and not add more log messages.

Or maybe this patch is temporary until you get there in the patchset.
Andrew Rybchenko Aug. 28, 2019, 7:06 a.m. UTC | #2
On 8/27/19 11:17 PM, Stephen Hemminger wrote:
> On Tue, 27 Aug 2019 15:25:24 +0100
> Andrew Rybchenko <arybchenko@solarflare.com> wrote:
>
>> From: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>
>>
>> rte_eth_dev_info_get() return value was changed from void to int,
>> so this patch modify rte_eth_dev_info_get() usage across
>> net/netvsc according to its new return type.
>>
>> Signed-off-by: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>
>> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
>> ---
>>   drivers/net/netvsc/hn_vf.c | 10 +++++++++-
>>   1 file changed, 9 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/netvsc/hn_vf.c b/drivers/net/netvsc/hn_vf.c
>> index 03f855b..b6b1e5d 100644
>> --- a/drivers/net/netvsc/hn_vf.c
>> +++ b/drivers/net/netvsc/hn_vf.c
>> @@ -176,8 +176,16 @@ static void hn_vf_info_merge(struct rte_eth_dev *vf_dev,
>>   			     struct rte_eth_dev_info *info)
>>   {
>>   	struct rte_eth_dev_info vf_info;
>> +	int ret;
>> +
>> +	ret = rte_eth_dev_info_get(vf_dev->data->port_id, &vf_info);
>> +	if (ret != 0) {
>> +		PMD_DRV_LOG(ERR,
>> +			"Error during getting device (port %u) info: %s\n",
>> +			vf_dev->data->port_id, strerror(-ret));
>>   
>> -	rte_eth_dev_info_get(vf_dev->data->port_id, &vf_info);
>> +		return;
>> +	}
>>   
> I would prefer that the driver api callback change to return an
> error and not add more log messages.
>
> Or maybe this patch is temporary until you get there in the patchset.

Got it. We'll change hn_vf_info_merge() and hn_vf_info_get() to return
int in this patch, but the return value will be ignored hn_dev_info_get()
before the patch which changes dev_infos_get prototype to return int
(that patch will be huge since it should update all drivers at once, so
it is better to preparation here).

Thanks.

Patch
diff mbox series

diff --git a/drivers/net/netvsc/hn_vf.c b/drivers/net/netvsc/hn_vf.c
index 03f855b..b6b1e5d 100644
--- a/drivers/net/netvsc/hn_vf.c
+++ b/drivers/net/netvsc/hn_vf.c
@@ -176,8 +176,16 @@  static void hn_vf_info_merge(struct rte_eth_dev *vf_dev,
 			     struct rte_eth_dev_info *info)
 {
 	struct rte_eth_dev_info vf_info;
+	int ret;
+
+	ret = rte_eth_dev_info_get(vf_dev->data->port_id, &vf_info);
+	if (ret != 0) {
+		PMD_DRV_LOG(ERR,
+			"Error during getting device (port %u) info: %s\n",
+			vf_dev->data->port_id, strerror(-ret));
 
-	rte_eth_dev_info_get(vf_dev->data->port_id, &vf_info);
+		return;
+	}
 
 	info->speed_capa = vf_info.speed_capa;
 	info->default_rxportconf = vf_info.default_rxportconf;