Intel-Wired-Lan Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
To: Jiri Pirko <jiri@nvidia.com>,
	netdev@vger.kernel.org, Jakub Kicinski <kuba@kernel.org>
Cc: Andrew Lunn <andrew@lunn.ch>,
	Shijith Thotton <sthotton@marvell.com>,
	Simon Horman <simon.horman@corigine.com>,
	Kurt Kanzenbach <kurt@linutronix.de>,
	Eric Dumazet <edumazet@google.com>,
	Jerin Jacob <jerinj@marvell.com>,
	Subbaraya Sundeep <sbhatta@marvell.com>,
	Ioana Ciornei <ioana.ciornei@nxp.com>,
	drivers@pensando.io, Linu Cherian <lcherian@marvell.com>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	Leon Romanovsky <leon@kernel.org>,
	linux-rdma@vger.kernel.org, Shalom Toledo <shalomt@mellanox.com>,
	Srujana Challa <schalla@marvell.com>,
	Minghao Chi <chi.minghao@zte.com.cn>,
	Hao Chen <chenhao288@hisilicon.com>,
	Guangbin Huang <huangguangbin2@huawei.com>,
	Shannon Nelson <snelson@pensando.io>,
	intel-wired-lan@lists.osuosl.org, Vadim Fedorenko <vadfed@fb.com>,
	Paolo Abeni <pabeni@redhat.com>,
	Yisen Zhuang <yisen.zhuang@huawei.com>,
	Sunil Goutham <sgoutham@marvell.com>,
	Ariel Elior <aelior@marvell.com>,
	Ido Schimmel <idosch@nvidia.com>,
	Richard Cochran <richardcochran@gmail.com>,
	Arnaud Ebalard <arno@natisbad.org>,
	Jiri Pirko <jiri@mellanox.com>,
	Michael Chan <michael.chan@broadcom.com>,
	Vincent Mailhol <mailhol.vincent@wanadoo.fr>,
	Petr Machata <petrm@nvidia.com>,
	Salil Mehta <salil.mehta@huawei.com>,
	Dimitris Michailidis <dmichail@fungible.com>,
	Manish Chopra <manishc@marvell.com>,
	Boris Brezillon <bbrezillon@kernel.org>,
	oss-drivers@corigine.com, Vadim Pasternak <vadimp@mellanox.com>,
	linux-kernel@vger.kernel.org,
	"David S . Miller" <davem@davemloft.net>,
	Taras Chornyi <tchornyi@marvell.com>,
	hariprasad <hkelam@marvell.com>,
	linux-crypto@vger.kernel.org,
	Jonathan Lemon <jonathan.lemon@gmail.com>,
	Vladimir Oltean <olteanv@gmail.com>,
	Saeed Mahameed <saeedm@nvidia.com>,
	Geetha sowjanya <gakula@marvell.com>
Subject: [Intel-wired-lan] [PATCH net-next v4 3/3] net: devlink: make the devlink_ops::info_get() callback optional
Date: Mon, 28 Nov 2022 13:15:45 +0900	[thread overview]
Message-ID: <20221128041545.3170897-4-mailhol.vincent@wanadoo.fr> (raw)
In-Reply-To: <20221128041545.3170897-1-mailhol.vincent@wanadoo.fr>

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.

Remove all the empty devlink_ops::info_get() functions from the
drivers.

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@wanadoo.fr>
---
 .../net/ethernet/fungible/funeth/funeth_devlink.c   |  7 -------
 .../net/ethernet/marvell/octeontx2/af/rvu_devlink.c |  7 -------
 .../ethernet/marvell/octeontx2/nic/otx2_devlink.c   |  8 --------
 net/core/devlink.c                                  | 13 ++++++-------
 4 files changed, 6 insertions(+), 29 deletions(-)

diff --git a/drivers/net/ethernet/fungible/funeth/funeth_devlink.c b/drivers/net/ethernet/fungible/funeth/funeth_devlink.c
index 6668375edff6..4fbeb3fd71a8 100644
--- a/drivers/net/ethernet/fungible/funeth/funeth_devlink.c
+++ b/drivers/net/ethernet/fungible/funeth/funeth_devlink.c
@@ -3,14 +3,7 @@
 #include "funeth.h"
 #include "funeth_devlink.h"
 
-static int fun_dl_info_get(struct devlink *dl, struct devlink_info_req *req,
-			   struct netlink_ext_ack *extack)
-{
-	return 0;
-}
-
 static const struct devlink_ops fun_dl_ops = {
-	.info_get = fun_dl_info_get,
 };
 
 struct devlink *fun_devlink_alloc(struct device *dev)
diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_devlink.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_devlink.c
index f15439d26d21..bda1a6fa2ec4 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_devlink.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_devlink.c
@@ -1547,14 +1547,7 @@ static int rvu_devlink_eswitch_mode_set(struct devlink *devlink, u16 mode,
 	return 0;
 }
 
-static int rvu_devlink_info_get(struct devlink *devlink, struct devlink_info_req *req,
-				struct netlink_ext_ack *extack)
-{
-	return 0;
-}
-
 static const struct devlink_ops rvu_devlink_ops = {
-	.info_get = rvu_devlink_info_get,
 	.eswitch_mode_get = rvu_devlink_eswitch_mode_get,
 	.eswitch_mode_set = rvu_devlink_eswitch_mode_set,
 };
diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_devlink.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_devlink.c
index 5cc6416cf1a6..63ef7c41d18d 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_devlink.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_devlink.c
@@ -77,15 +77,7 @@ static const struct devlink_param otx2_dl_params[] = {
 			     otx2_dl_mcam_count_validate),
 };
 
-static int otx2_devlink_info_get(struct devlink *devlink,
-				 struct devlink_info_req *req,
-				 struct netlink_ext_ack *extack)
-{
-	return 0;
-}
-
 static const struct devlink_ops otx2_devlink_ops = {
-	.info_get = otx2_devlink_info_get,
 };
 
 int otx2_register_dl(struct otx2_nic *pfvf)
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

_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

  parent reply	other threads:[~2022-11-28 16:33 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20221122154934.13937-1-mailhol.vincent@wanadoo.fr>
2022-11-27  8:15 ` [Intel-wired-lan] [PATCH net-next v2 0/5] net: devlink: return the driver name in devlink_nl_info_fill Vincent Mailhol
2022-11-27  8:16   ` [Intel-wired-lan] [PATCH net-next v2 1/5] mlxsw: minimal: fix mlxsw_m_module_get_drvinfo() to correctly report driver name Vincent Mailhol
2022-11-27  8:16   ` [Intel-wired-lan] [PATCH net-next v2 2/5] mlxsw: core: fix mlxsw_devlink_info_get() " Vincent Mailhol
2022-11-27  8:16   ` [Intel-wired-lan] [PATCH net-next v2 3/5] net: devlink: let the core report the driver name instead of the drivers Vincent Mailhol
2022-11-27  8:16   ` [Intel-wired-lan] [PATCH net-next v2 4/5] net: devlink: remove devlink_info_driver_name_put() Vincent Mailhol
2022-11-27  8:16   ` [Intel-wired-lan] [PATCH net-next v2 5/5] net: devlink: make the devlink_ops::info_get() callback optional Vincent Mailhol
2022-11-27 13:09 ` [Intel-wired-lan] [PATCH net-next v3 0/5] net: devlink: return the driver name in devlink_nl_info_fill Vincent Mailhol
2022-11-27 13:09   ` [Intel-wired-lan] [PATCH net-next v3 1/5] mlxsw: minimal: fix mlxsw_m_module_get_drvinfo() to correctly report driver name Vincent Mailhol
2022-11-27 16:14     ` Ido Schimmel
2022-11-27 13:09   ` [Intel-wired-lan] [PATCH net-next v3 2/5] mlxsw: core: fix mlxsw_devlink_info_get() " Vincent Mailhol
2022-11-27 16:17     ` Ido Schimmel
2022-11-28  1:42       ` Vincent MAILHOL
2022-11-27 13:09   ` [Intel-wired-lan] [PATCH net-next v3 3/5] net: devlink: let the core report the driver name instead of the drivers Vincent Mailhol
2022-11-27 13:09   ` [Intel-wired-lan] [PATCH net-next v3 4/5] net: devlink: remove devlink_info_driver_name_put() Vincent Mailhol
2022-11-27 13:09   ` [Intel-wired-lan] [PATCH net-next v3 5/5] net: devlink: make the devlink_ops::info_get() callback optional Vincent Mailhol
2022-11-28  4:15 ` [Intel-wired-lan] [PATCH net-next v4 0/3] net: devlink: return the driver name in devlink_nl_info_fill Vincent Mailhol
2022-11-28  4:15   ` [Intel-wired-lan] [PATCH net-next v4 1/3] net: devlink: let the core report the driver name instead of the drivers Vincent Mailhol
2022-11-28 11:49     ` Ido Schimmel
2022-11-28  4:15   ` [Intel-wired-lan] [PATCH net-next v4 2/3] net: devlink: remove devlink_info_driver_name_put() Vincent Mailhol
2022-11-28  4:15   ` Vincent Mailhol [this message]
2022-11-28 18:42     ` [Intel-wired-lan] [PATCH net-next v4 3/3] net: devlink: make the devlink_ops::info_get() callback optional Jakub Kicinski

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=20221128041545.3170897-4-mailhol.vincent@wanadoo.fr \
    --to=mailhol.vincent@wanadoo.fr \
    --cc=aelior@marvell.com \
    --cc=andrew@lunn.ch \
    --cc=arno@natisbad.org \
    --cc=bbrezillon@kernel.org \
    --cc=chenhao288@hisilicon.com \
    --cc=chi.minghao@zte.com.cn \
    --cc=davem@davemloft.net \
    --cc=dmichail@fungible.com \
    --cc=drivers@pensando.io \
    --cc=edumazet@google.com \
    --cc=f.fainelli@gmail.com \
    --cc=gakula@marvell.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=hkelam@marvell.com \
    --cc=huangguangbin2@huawei.com \
    --cc=idosch@nvidia.com \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=ioana.ciornei@nxp.com \
    --cc=jerinj@marvell.com \
    --cc=jiri@mellanox.com \
    --cc=jiri@nvidia.com \
    --cc=jonathan.lemon@gmail.com \
    --cc=kuba@kernel.org \
    --cc=kurt@linutronix.de \
    --cc=lcherian@marvell.com \
    --cc=leon@kernel.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=manishc@marvell.com \
    --cc=michael.chan@broadcom.com \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=oss-drivers@corigine.com \
    --cc=pabeni@redhat.com \
    --cc=petrm@nvidia.com \
    --cc=richardcochran@gmail.com \
    --cc=saeedm@nvidia.com \
    --cc=salil.mehta@huawei.com \
    --cc=sbhatta@marvell.com \
    --cc=schalla@marvell.com \
    --cc=sgoutham@marvell.com \
    --cc=shalomt@mellanox.com \
    --cc=simon.horman@corigine.com \
    --cc=snelson@pensando.io \
    --cc=sthotton@marvell.com \
    --cc=tchornyi@marvell.com \
    --cc=vadfed@fb.com \
    --cc=vadimp@mellanox.com \
    --cc=yisen.zhuang@huawei.com \
    /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