[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20221129095140.3913303-3-mailhol.vincent@wanadoo.fr>
Date: Tue, 29 Nov 2022 18:51:39 +0900
From: Vincent Mailhol <mailhol.vincent@...adoo.fr>
To: Jiri Pirko <jiri@...dia.com>, netdev@...r.kernel.org,
Jakub Kicinski <kuba@...nel.org>
Cc: "David S . Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Paolo Abeni <pabeni@...hat.com>, linux-kernel@...r.kernel.org,
Boris Brezillon <bbrezillon@...nel.org>,
Arnaud Ebalard <arno@...isbad.org>,
Srujana Challa <schalla@...vell.com>,
Kurt Kanzenbach <kurt@...utronix.de>,
Andrew Lunn <andrew@...n.ch>,
Florian Fainelli <f.fainelli@...il.com>,
Vladimir Oltean <olteanv@...il.com>,
Michael Chan <michael.chan@...adcom.com>,
Ioana Ciornei <ioana.ciornei@....com>,
Dimitris Michailidis <dmichail@...gible.com>,
Yisen Zhuang <yisen.zhuang@...wei.com>,
Salil Mehta <salil.mehta@...wei.com>,
Jesse Brandeburg <jesse.brandeburg@...el.com>,
Tony Nguyen <anthony.l.nguyen@...el.com>,
Sunil Goutham <sgoutham@...vell.com>,
Linu Cherian <lcherian@...vell.com>,
Geetha sowjanya <gakula@...vell.com>,
Jerin Jacob <jerinj@...vell.com>,
hariprasad <hkelam@...vell.com>,
Subbaraya Sundeep <sbhatta@...vell.com>,
Taras Chornyi <tchornyi@...vell.com>,
Saeed Mahameed <saeedm@...dia.com>,
Leon Romanovsky <leon@...nel.org>,
Ido Schimmel <idosch@...dia.com>,
Petr Machata <petrm@...dia.com>,
Simon Horman <simon.horman@...igine.com>,
Shannon Nelson <snelson@...sando.io>, drivers@...sando.io,
Ariel Elior <aelior@...vell.com>,
Manish Chopra <manishc@...vell.com>,
Jonathan Lemon <jonathan.lemon@...il.com>,
Vadim Fedorenko <vadfed@...com>,
Richard Cochran <richardcochran@...il.com>,
Vadim Pasternak <vadimp@...lanox.com>,
Shalom Toledo <shalomt@...lanox.com>,
linux-crypto@...r.kernel.org, intel-wired-lan@...ts.osuosl.org,
linux-rdma@...r.kernel.org, oss-drivers@...igine.com,
Jiri Pirko <jiri@...lanox.com>,
Herbert Xu <herbert@...dor.apana.org.au>,
Hao Chen <chenhao288@...ilicon.com>,
Guangbin Huang <huangguangbin2@...wei.com>,
Minghao Chi <chi.minghao@....com.cn>,
Shijith Thotton <sthotton@...vell.com>,
Vincent Mailhol <mailhol.vincent@...adoo.fr>,
Jacob Keller <jacob.e.keller@...el.com>
Subject: [PATCH net-next v6 2/3] net: devlink: make the devlink_ops::info_get() callback optional
Some drivers only reported the driver name in their
devlink_ops::info_get() callback. Now that the core provides this
information, the callback became empty. For such drivers, just
removing the callback would prevent the core from executing
devlink_nl_info_fill() meaning that "devlink dev info" would not
return anything.
Make the callback function optional by executing
devlink_nl_info_fill() even if devlink_ops::info_get() is NULL.
N.B.: the drivers with devlink support which previously did not
implement devlink_ops::info_get() will now also be able to report
the driver name.
Signed-off-by: Vincent Mailhol <mailhol.vincent@...adoo.fr>
Reviewed-by: Jacob Keller <jacob.e.keller@...el.com>
Reviewed-by: Jiri Pirko <jiri@...dia.com>
---
net/core/devlink.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/net/core/devlink.c b/net/core/devlink.c
index 3babc16eeb6b..817d978bb729 100644
--- a/net/core/devlink.c
+++ b/net/core/devlink.c
@@ -6773,9 +6773,11 @@ devlink_nl_info_fill(struct sk_buff *msg, struct devlink *devlink,
goto err_cancel_msg;
req.msg = msg;
- err = devlink->ops->info_get(devlink, &req, extack);
- if (err)
- goto err_cancel_msg;
+ if (devlink->ops->info_get) {
+ err = devlink->ops->info_get(devlink, &req, extack);
+ if (err)
+ goto err_cancel_msg;
+ }
err = devlink_nl_driver_info_get(dev->driver, &req);
if (err)
@@ -6796,9 +6798,6 @@ static int devlink_nl_cmd_info_get_doit(struct sk_buff *skb,
struct sk_buff *msg;
int err;
- if (!devlink->ops->info_get)
- return -EOPNOTSUPP;
-
msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
if (!msg)
return -ENOMEM;
@@ -6824,7 +6823,7 @@ static int devlink_nl_cmd_info_get_dumpit(struct sk_buff *msg,
int err = 0;
devlinks_xa_for_each_registered_get(sock_net(msg->sk), index, devlink) {
- if (idx < start || !devlink->ops->info_get)
+ if (idx < start)
goto inc;
devl_lock(devlink);
--
2.25.1
Powered by blists - more mailing lists