Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp3881998imm; Wed, 5 Sep 2018 07:28:23 -0700 (PDT) X-Google-Smtp-Source: ANB0VdY8sfvRcRbfJO41dYLmYmo6nPRQ/D/x8ulfLpOVEG25ekMvTzGgvZ6zuzpXUMEJUI5CgBA5 X-Received: by 2002:a63:7217:: with SMTP id n23-v6mr36553269pgc.193.1536157703684; Wed, 05 Sep 2018 07:28:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536157703; cv=none; d=google.com; s=arc-20160816; b=awHe4lwz3xVAsEizz6xpLMTFxxlc9KBsy1izFPYYp5+Ufj1nM9OoF+2Vx/v91Y/cje 6+ERPe6HNk9FxHwxGz5+mZPVlZBmjIPxWGHW99QXF2WLrvT4l84cfHBiNm16JTxvlGCH hfwEx8bmTlvz8ICFz1HrHB9kulZXZVe0m7S33PX3OUXidwXicOAnX0FzBxVSACZwq0SN ARmOUFZLKAGsjMige+WOYjP0B1rReQcQ1UNYlOm2ZGSlphec8LG+8OD+ysPwfh/3umdD h3vKxuw2Yl7ppx6jZEx5pD763gQKjoXDrwVgxsmP8DQ+1W2uOyg5CAKjSNfqfUXgaV+c JWzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=zJ15nCupgUeJFAlXcGCC40bGXaqOIVf9cKtdp3m/FQs=; b=Y1S5vaNp4njFsxpq9sjgCEabfIE0jOKURi122pKrqlDd26EHOhqHLH8g5StFLAiCNs xy5/HnaECggVqF6ue7QrhOKdkxlZPq4Se9IdLlfR6GOinbFl5Gla3QCiEha4Wgxw6FoI 8mGtT9sdBgR0KD/qW82vGI2GaaXLcbkGNpIFfFJKK9cNpFZsd8IJSJ797cYRP0Rf4yf9 IAv1M2lpEzjtyaej0wk436gxGaBsq+QUS4Zxr0Fzs79VarNRCtF690peSP+egeAlNb8e 4sff48fPRzG9i9sq5sfC2ls8Gn299UfAHgdra6uTWTt2CHZp2hE4vCwSoSsVqDz1ZUGe QcCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="PmXnf/FV"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 11-v6si2052610plb.383.2018.09.05.07.28.07; Wed, 05 Sep 2018 07:28:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="PmXnf/FV"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727727AbeIES4o (ORCPT + 99 others); Wed, 5 Sep 2018 14:56:44 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:43247 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726046AbeIES4o (ORCPT ); Wed, 5 Sep 2018 14:56:44 -0400 Received: by mail-pg1-f196.google.com with SMTP id v66-v6so3512734pgb.10; Wed, 05 Sep 2018 07:26:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=zJ15nCupgUeJFAlXcGCC40bGXaqOIVf9cKtdp3m/FQs=; b=PmXnf/FVFXhNH+8rPAEJCgV3+1dGMr5UvnAJHQ8iqSD51O0K5HV6HoF9nfQCquBceX Ynko/7KiWHi+VuYahrLLcCtmbKBdhNceGPY2/odjrgwmBtcJhkin1Q39DZtCMx+6Bupi qjF+uDXtXCIX1Pa/m6dVedwlSDeBiQ5sfHDmIxhKR4c6WhKTPgDc4TQmJpltId7WXdSN MBj+11XuyQwHReVp6Kj6TWdtYYVjx10LYCCYttBg2YeiaKiOsyJplDu4/OLc3rFntuGg GjlLGKCytZyEd9vMx+I3iZjnbkoYShgskvD6dTR7vgHWFlhgTn9eGLIvs3nPXgmRv6gD XlAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=zJ15nCupgUeJFAlXcGCC40bGXaqOIVf9cKtdp3m/FQs=; b=grDQ//mzJpu+0ckEUGS3azRIUoe/7ubzmijIvUXxWItIHQ89jeFMrAiYKnIkbGMnt8 5LaIT6Z/aem1K7A4MTb7+JVojWbbAh0HH/LMqpg0nWsXcqOvz3tOQFN1bqsj7XYAr8py rTvBBWvs1EaRMpR7Dn8mLO9hjsyGPPn90cd/OklAT92G2Ritw4qSaiJuex3RSo9q1S29 mcj7zfAy3IJOOalooGa4Qwd9k96qoi6/cYenkXcfB4RZdNbLfMb0meIGcwNnT4Hely07 RdDBMFkoaKUtt0cmrVCHM+d/z0TI0rISIhNl6oKJld3YkpQyGpaVZVyi9wBCaNzb+D9f 2erA== X-Gm-Message-State: APzg51BRoHFOrG/NUKsiU+JE/oJzgIr664ARriS4OqZ9E8d1KOmHXwX6 uVhq0sg3GrUCPC4VhCuuwn0XoYIB X-Received: by 2002:a63:cd4c:: with SMTP id a12-v6mr36967623pgj.15.1536157578033; Wed, 05 Sep 2018 07:26:18 -0700 (PDT) Received: from dsa-mb.local ([2601:282:800:fd80:cbf:8500:e2a8:f094]) by smtp.googlemail.com with ESMTPSA id u25-v6sm3180230pfk.177.2018.09.05.07.26.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Sep 2018 07:26:16 -0700 (PDT) Subject: Re: [PATCH net] devlink: Fix devlink_param_driverinit_value_set() stub return code To: Moshe Shemesh , "David S. Miller" Cc: Jiri Pirko , netdev@vger.kernel.org, linux-kernel@vger.kernel.org References: <1536066265-18641-1-git-send-email-moshe@mellanox.com> <2bf31ad0-c3f8-cdfd-8b96-1a8e3280064d@gmail.com> <7fd426d1-61a9-7f45-bf26-05bd9e180277@mellanox.com> From: David Ahern Message-ID: Date: Wed, 5 Sep 2018 08:26:15 -0600 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <7fd426d1-61a9-7f45-bf26-05bd9e180277@mellanox.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 >>> Acked-by: Jiri Pirko >>> --- >>>   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.