linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Moshe Shemesh <moshe@mellanox.com>
To: David Ahern <dsahern@gmail.com>, "David S. Miller" <davem@davemloft.net>
Cc: Jiri Pirko <jiri@mellanox.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net] devlink: Fix devlink_param_driverinit_value_set() stub return code
Date: Wed, 5 Sep 2018 15:48:56 +0300	[thread overview]
Message-ID: <7fd426d1-61a9-7f45-bf26-05bd9e180277@mellanox.com> (raw)
In-Reply-To: <2bf31ad0-c3f8-cdfd-8b96-1a8e3280064d@gmail.com>



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.
> 

  reply	other threads:[~2018-09-05 12:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2018-09-05 14:26     ` David Ahern
2018-09-06  7:30       ` Moshe Shemesh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7fd426d1-61a9-7f45-bf26-05bd9e180277@mellanox.com \
    --to=moshe@mellanox.com \
    --cc=davem@davemloft.net \
    --cc=dsahern@gmail.com \
    --cc=jiri@mellanox.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).