All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] devlink: Fix devlink_param_driverinit_value_set() stub return code
@ 2018-09-04 13:04 Moshe Shemesh
  2018-09-04 16:13 ` David Ahern
  0 siblings, 1 reply; 5+ messages in thread
From: Moshe Shemesh @ 2018-09-04 13:04 UTC (permalink / raw)
  To: David S. Miller; +Cc: Jiri Pirko, netdev, linux-kernel, Moshe Shemesh

The stub function returned -EOPNOTSUPP while CONFIG_NET_DEVLINK is off.
It caused false warning during driver load. Driver needs to update
devlink on a parameter value if devlink module is there, if not it
doesn't need any error code.

Fixes: ec01aeb1803e ("devlink: Add support for get/set driverinit value")
Signed-off-by: Moshe Shemesh <moshe@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
---
 include/net/devlink.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/net/devlink.h b/include/net/devlink.h
index b9b89d6..b467357 100644
--- a/include/net/devlink.h
+++ b/include/net/devlink.h
@@ -781,7 +781,7 @@ static inline bool devlink_dpipe_table_counter_enabled(struct devlink *devlink,
 devlink_param_driverinit_value_set(struct devlink *devlink, u32 param_id,
 				   union devlink_param_value init_val)
 {
-	return -EOPNOTSUPP;
+	return 0;
 }
 
 static inline void
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net] devlink: Fix devlink_param_driverinit_value_set() stub return code
  2018-09-04 13:04 [PATCH net] devlink: Fix devlink_param_driverinit_value_set() stub return code Moshe Shemesh
@ 2018-09-04 16:13 ` David Ahern
  2018-09-05 12:48   ` Moshe Shemesh
  0 siblings, 1 reply; 5+ messages in thread
From: David Ahern @ 2018-09-04 16:13 UTC (permalink / raw)
  To: Moshe Shemesh, David S. Miller; +Cc: Jiri Pirko, netdev, linux-kernel

On 9/4/18 7:04 AM, Moshe Shemesh wrote:
> The stub function returned -EOPNOTSUPP while CONFIG_NET_DEVLINK is off.
> It caused false warning during driver load. Driver needs to update
> devlink on a parameter value if devlink module is there, if not it
> doesn't need any error code.
> 
> Fixes: ec01aeb1803e ("devlink: Add support for get/set driverinit value")
> Signed-off-by: Moshe Shemesh <moshe@mellanox.com>
> Acked-by: Jiri Pirko <jiri@mellanox.com>
> ---
>  include/net/devlink.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/net/devlink.h b/include/net/devlink.h
> index b9b89d6..b467357 100644
> --- a/include/net/devlink.h
> +++ b/include/net/devlink.h
> @@ -781,7 +781,7 @@ static inline bool devlink_dpipe_table_counter_enabled(struct devlink *devlink,
>  devlink_param_driverinit_value_set(struct devlink *devlink, u32 param_id,
>  				   union devlink_param_value init_val)
>  {
> -	return -EOPNOTSUPP;
> +	return 0;
>  }
>  
>  static inline void
> 

This should be handled by the driver -- check for -EOPNOTSUPP and not
log an error.

devlink is generic infrastructure. If a call is made and the operation
is not supported, then devlink should return an error.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net] devlink: Fix devlink_param_driverinit_value_set() stub return code
  2018-09-04 16:13 ` David Ahern
@ 2018-09-05 12:48   ` Moshe Shemesh
  2018-09-05 14:26     ` David Ahern
  0 siblings, 1 reply; 5+ messages in thread
From: Moshe Shemesh @ 2018-09-05 12:48 UTC (permalink / raw)
  To: David Ahern, David S. Miller; +Cc: Jiri Pirko, netdev, linux-kernel



On 9/4/2018 7:13 PM, David Ahern wrote:
> On 9/4/18 7:04 AM, Moshe Shemesh wrote:
>> The stub function returned -EOPNOTSUPP while CONFIG_NET_DEVLINK is off.
>> It caused false warning during driver load. Driver needs to update
>> devlink on a parameter value if devlink module is there, if not it
>> doesn't need any error code.
>>
>> Fixes: ec01aeb1803e ("devlink: Add support for get/set driverinit value")
>> Signed-off-by: Moshe Shemesh <moshe@mellanox.com>
>> Acked-by: Jiri Pirko <jiri@mellanox.com>
>> ---
>>   include/net/devlink.h | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/include/net/devlink.h b/include/net/devlink.h
>> index b9b89d6..b467357 100644
>> --- a/include/net/devlink.h
>> +++ b/include/net/devlink.h
>> @@ -781,7 +781,7 @@ static inline bool devlink_dpipe_table_counter_enabled(struct devlink *devlink,
>>   devlink_param_driverinit_value_set(struct devlink *devlink, u32 param_id,
>>   				   union devlink_param_value init_val)
>>   {
>> -	return -EOPNOTSUPP;
>> +	return 0;
>>   }
>>   
>>   static inline void
>>
> 
> This should be handled by the driver -- check for -EOPNOTSUPP and not
> log an error.

This is a stub inline function.
The return value would be ambiguous as the non-stub function can also 
return -EOPNOTSUPP, in case the driver-init mode is not supported for a 
parameter.
> 
> devlink is generic infrastructure. If a call is made and the operation
> is not supported, then devlink should return an error.

In general the stub functions should take care that the driver won't 
feel the missing code as much as possible. That's why 
devlink_params_register() returns success and so should this function.
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net] devlink: Fix devlink_param_driverinit_value_set() stub return code
  2018-09-05 12:48   ` Moshe Shemesh
@ 2018-09-05 14:26     ` David Ahern
  2018-09-06  7:30       ` Moshe Shemesh
  0 siblings, 1 reply; 5+ messages in thread
From: David Ahern @ 2018-09-05 14:26 UTC (permalink / raw)
  To: Moshe Shemesh, David S. Miller; +Cc: Jiri Pirko, netdev, linux-kernel

On 9/5/18 6:48 AM, Moshe Shemesh wrote:
> 
> 
> On 9/4/2018 7:13 PM, David Ahern wrote:
>> On 9/4/18 7:04 AM, Moshe Shemesh wrote:
>>> The stub function returned -EOPNOTSUPP while CONFIG_NET_DEVLINK is off.
>>> It caused false warning during driver load. Driver needs to update
>>> devlink on a parameter value if devlink module is there, if not it
>>> doesn't need any error code.
>>>
>>> Fixes: ec01aeb1803e ("devlink: Add support for get/set driverinit
>>> value")
>>> Signed-off-by: Moshe Shemesh <moshe@mellanox.com>
>>> Acked-by: Jiri Pirko <jiri@mellanox.com>
>>> ---
>>>   include/net/devlink.h | 2 +-
>>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/include/net/devlink.h b/include/net/devlink.h
>>> index b9b89d6..b467357 100644
>>> --- a/include/net/devlink.h
>>> +++ b/include/net/devlink.h
>>> @@ -781,7 +781,7 @@ static inline bool
>>> devlink_dpipe_table_counter_enabled(struct devlink *devlink,
>>>   devlink_param_driverinit_value_set(struct devlink *devlink, u32
>>> param_id,
>>>                      union devlink_param_value init_val)
>>>   {
>>> -    return -EOPNOTSUPP;
>>> +    return 0;
>>>   }
>>>     static inline void
>>>
>>
>> This should be handled by the driver -- check for -EOPNOTSUPP and not
>> log an error.
> 
> This is a stub inline function.
> The return value would be ambiguous as the non-stub function can also
> return -EOPNOTSUPP, in case the driver-init mode is not supported for a
> parameter.
>>
>> devlink is generic infrastructure. If a call is made and the operation
>> is not supported, then devlink should return an error.
> 
> In general the stub functions should take care that the driver won't
> feel the missing code as much as possible. That's why
> devlink_params_register() returns success and so should this function.
>>

A driver is accessing core infrastructure to set a value; core infra can
not because the code is not compiled in. The driver should be told that
the option is not enabled, and it is at the moment with the -EOPNOTSUPP
return code.

That is similar to devlink_dpipe_table_resource_set which returns
-EOPNOTSUPP when devlink is compiled out.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net] devlink: Fix devlink_param_driverinit_value_set() stub return code
  2018-09-05 14:26     ` David Ahern
@ 2018-09-06  7:30       ` Moshe Shemesh
  0 siblings, 0 replies; 5+ messages in thread
From: Moshe Shemesh @ 2018-09-06  7:30 UTC (permalink / raw)
  To: David Ahern, David S. Miller; +Cc: Jiri Pirko, netdev, linux-kernel



On 9/5/2018 5:26 PM, David Ahern wrote:
> On 9/5/18 6:48 AM, Moshe Shemesh wrote:
>>
>>
>> On 9/4/2018 7:13 PM, David Ahern wrote:
>>> On 9/4/18 7:04 AM, Moshe Shemesh wrote:
>>>> The stub function returned -EOPNOTSUPP while CONFIG_NET_DEVLINK is off.
>>>> It caused false warning during driver load. Driver needs to update
>>>> devlink on a parameter value if devlink module is there, if not it
>>>> doesn't need any error code.
>>>>
>>>> Fixes: ec01aeb1803e ("devlink: Add support for get/set driverinit
>>>> value")
>>>> Signed-off-by: Moshe Shemesh <moshe@mellanox.com>
>>>> Acked-by: Jiri Pirko <jiri@mellanox.com>
>>>> ---
>>>>    include/net/devlink.h | 2 +-
>>>>    1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> diff --git a/include/net/devlink.h b/include/net/devlink.h
>>>> index b9b89d6..b467357 100644
>>>> --- a/include/net/devlink.h
>>>> +++ b/include/net/devlink.h
>>>> @@ -781,7 +781,7 @@ static inline bool
>>>> devlink_dpipe_table_counter_enabled(struct devlink *devlink,
>>>>    devlink_param_driverinit_value_set(struct devlink *devlink, u32
>>>> param_id,
>>>>                       union devlink_param_value init_val)
>>>>    {
>>>> -    return -EOPNOTSUPP;
>>>> +    return 0;
>>>>    }
>>>>      static inline void
>>>>
>>>
>>> This should be handled by the driver -- check for -EOPNOTSUPP and not
>>> log an error.
>>
>> This is a stub inline function.
>> The return value would be ambiguous as the non-stub function can also
>> return -EOPNOTSUPP, in case the driver-init mode is not supported for a
>> parameter.
>>>
>>> devlink is generic infrastructure. If a call is made and the operation
>>> is not supported, then devlink should return an error.
>>
>> In general the stub functions should take care that the driver won't
>> feel the missing code as much as possible. That's why
>> devlink_params_register() returns success and so should this function.
>>>
> 
> A driver is accessing core infrastructure to set a value; core infra can
> not because the code is not compiled in. The driver should be told that
> the option is not enabled, and it is at the moment with the -EOPNOTSUPP
> return code.
> 
> That is similar to devlink_dpipe_table_resource_set which returns
> -EOPNOTSUPP when devlink is compiled out.

Yes, that was my original thought when I wrote this stub, but actually 
in this case the driver has the value and it wants to update devlink, so 
devlink will have it too. If devlink module is not there why should it 
really care ?

> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-09-06  7:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-04 13:04 [PATCH net] devlink: Fix devlink_param_driverinit_value_set() stub return code Moshe Shemesh
2018-09-04 16:13 ` David Ahern
2018-09-05 12:48   ` Moshe Shemesh
2018-09-05 14:26     ` David Ahern
2018-09-06  7:30       ` Moshe Shemesh

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.