From: Leon Romanovsky <leon@kernel.org>
To: "David S . Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>
Cc: Leon Romanovsky <leonro@nvidia.com>,
Ido Schimmel <idosch@nvidia.com>, Ingo Molnar <mingo@redhat.com>,
Jiri Pirko <jiri@nvidia.com>,
linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org,
mlxsw@nvidia.com, Moshe Shemesh <moshe@nvidia.com>,
netdev@vger.kernel.org, Saeed Mahameed <saeedm@nvidia.com>,
Salil Mehta <salil.mehta@huawei.com>,
Shay Drory <shayd@nvidia.com>,
Steven Rostedt <rostedt@goodmis.org>,
Tariq Toukan <tariqt@nvidia.com>,
Yisen Zhuang <yisen.zhuang@huawei.com>
Subject: [PATCH net-next v4 2/6] devlink: Move netdev_to_devlink helpers to devlink.c
Date: Tue, 12 Oct 2021 16:15:22 +0300 [thread overview]
Message-ID: <b11adcc241126d68c2509e65cddab7f06c23b80e.1634044267.git.leonro@nvidia.com> (raw)
In-Reply-To: <cover.1634044267.git.leonro@nvidia.com>
From: Leon Romanovsky <leonro@nvidia.com>
Both netdev_to_devlink and netdev_to_devlink_port are used in devlink.c
only, so move them in order to reduce their scope.
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
---
include/net/devlink.h | 17 -----------------
net/core/devlink.c | 18 ++++++++++++++++++
2 files changed, 18 insertions(+), 17 deletions(-)
diff --git a/include/net/devlink.h b/include/net/devlink.h
index ae03eb1c6cc9..7f44ad14e5ed 100644
--- a/include/net/devlink.h
+++ b/include/net/devlink.h
@@ -1486,23 +1486,6 @@ void *devlink_priv(struct devlink *devlink);
struct devlink *priv_to_devlink(void *priv);
struct device *devlink_to_dev(const struct devlink *devlink);
-static inline struct devlink_port *
-netdev_to_devlink_port(struct net_device *dev)
-{
- if (dev->netdev_ops->ndo_get_devlink_port)
- return dev->netdev_ops->ndo_get_devlink_port(dev);
- return NULL;
-}
-
-static inline struct devlink *netdev_to_devlink(struct net_device *dev)
-{
- struct devlink_port *devlink_port = netdev_to_devlink_port(dev);
-
- if (devlink_port)
- return devlink_port->devlink;
- return NULL;
-}
-
struct ib_device;
struct net *devlink_net(const struct devlink *devlink);
diff --git a/net/core/devlink.c b/net/core/devlink.c
index 87d1766ebdbf..e9e908c4cfb4 100644
--- a/net/core/devlink.c
+++ b/net/core/devlink.c
@@ -11381,6 +11381,24 @@ static void __devlink_compat_running_version(struct devlink *devlink,
nlmsg_free(msg);
}
+static struct devlink_port *netdev_to_devlink_port(struct net_device *dev)
+{
+ if (!dev->netdev_ops->ndo_get_devlink_port)
+ return NULL;
+
+ return dev->netdev_ops->ndo_get_devlink_port(dev);
+}
+
+static struct devlink *netdev_to_devlink(struct net_device *dev)
+{
+ struct devlink_port *devlink_port = netdev_to_devlink_port(dev);
+
+ if (!devlink_port)
+ return NULL;
+
+ return devlink_port->devlink;
+}
+
void devlink_compat_running_version(struct net_device *dev,
char *buf, size_t len)
{
--
2.31.1
next prev parent reply other threads:[~2021-10-12 13:15 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-12 13:15 [PATCH net-next v4 0/6] devlink reload simplification Leon Romanovsky
2021-10-12 13:15 ` [PATCH net-next v4 1/6] devlink: Reduce struct devlink exposure Leon Romanovsky
2021-10-12 13:15 ` Leon Romanovsky [this message]
2021-10-12 13:15 ` [PATCH net-next v4 3/6] devlink: Annotate devlink API calls Leon Romanovsky
2021-10-12 13:15 ` [PATCH net-next v4 4/6] devlink: Allow control devlink ops behavior through feature mask Leon Romanovsky
2021-10-12 13:15 ` [PATCH net-next v4 5/6] net/mlx5: Set devlink reload feature bit for supported devices only Leon Romanovsky
2021-10-12 13:15 ` [PATCH net-next v4 6/6] devlink: Delete reload enable/disable interface Leon Romanovsky
2021-10-13 0:20 ` [PATCH net-next v4 0/6] devlink reload simplification patchwork-bot+netdevbpf
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=b11adcc241126d68c2509e65cddab7f06c23b80e.1634044267.git.leonro@nvidia.com \
--to=leon@kernel.org \
--cc=davem@davemloft.net \
--cc=idosch@nvidia.com \
--cc=jiri@nvidia.com \
--cc=kuba@kernel.org \
--cc=leonro@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=mlxsw@nvidia.com \
--cc=moshe@nvidia.com \
--cc=netdev@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=saeedm@nvidia.com \
--cc=salil.mehta@huawei.com \
--cc=shayd@nvidia.com \
--cc=tariqt@nvidia.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
all inboxes | Powered by JetHome®