lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210408105813.2555878-1-danieller@nvidia.com>
Date:   Thu, 8 Apr 2021 13:58:13 +0300
From:   Danielle Ratson <danieller@...dia.com>
To:     <netdev@...r.kernel.org>
CC:     <davem@...emloft.net>, <kuba@...nel.org>, <alobakin@...me>,
        <meirl@...lanox.com>, <dmurphy@...com>, <andrew@...n.ch>,
        <mkubecek@...e.cz>, <f.fainelli@...il.com>,
        <irusskikh@...vell.com>, <alexanderduyck@...com>,
        <magnus.karlsson@...el.com>, <ecree@...arflare.com>,
        <idosch@...dia.com>, <jiri@...dia.com>, <mlxsw@...dia.com>,
        Danielle Ratson <danieller@...dia.com>
Subject: [PATCH net-next] ethtool: Move __ethtool_get_link_ksettings() to common file

__ethtool_get_link_ksettings() function is shared by both ioctl and
netlink ethtool interfaces.

Move it to net/ethtool/common.c file, which is the suitable place for
a shared code.

Signed-off-by: Danielle Ratson <danieller@...dia.com>
Suggested-by: Jakub Kicinski <kuba@...nel.org>
Reviewed-by: Ido Schimmel <idosch@...dia.com>
Reviewed-by: Jiri Pirko <jiri@...dia.com>
---
 net/ethtool/common.c | 14 ++++++++++++++
 net/ethtool/ioctl.c  | 14 --------------
 2 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/net/ethtool/common.c b/net/ethtool/common.c
index f9dcbad84788..0dc78e0e8a25 100644
--- a/net/ethtool/common.c
+++ b/net/ethtool/common.c
@@ -484,6 +484,20 @@ convert_legacy_settings_to_link_ksettings(
 	return retval;
 }
 
+/* Internal kernel helper to query a device ethtool_link_settings. */
+int __ethtool_get_link_ksettings(struct net_device *dev,
+				 struct ethtool_link_ksettings *link_ksettings)
+{
+	ASSERT_RTNL();
+
+	if (!dev->ethtool_ops->get_link_ksettings)
+		return -EOPNOTSUPP;
+
+	memset(link_ksettings, 0, sizeof(*link_ksettings));
+	return dev->ethtool_ops->get_link_ksettings(dev, link_ksettings);
+}
+EXPORT_SYMBOL(__ethtool_get_link_ksettings);
+
 int __ethtool_get_link(struct net_device *dev)
 {
 	if (!dev->ethtool_ops->get_link)
diff --git a/net/ethtool/ioctl.c b/net/ethtool/ioctl.c
index a9f67574148f..8944f4496cf0 100644
--- a/net/ethtool/ioctl.c
+++ b/net/ethtool/ioctl.c
@@ -422,20 +422,6 @@ struct ethtool_link_usettings {
 	} link_modes;
 };
 
-/* Internal kernel helper to query a device ethtool_link_settings. */
-int __ethtool_get_link_ksettings(struct net_device *dev,
-				 struct ethtool_link_ksettings *link_ksettings)
-{
-	ASSERT_RTNL();
-
-	if (!dev->ethtool_ops->get_link_ksettings)
-		return -EOPNOTSUPP;
-
-	memset(link_ksettings, 0, sizeof(*link_ksettings));
-	return dev->ethtool_ops->get_link_ksettings(dev, link_ksettings);
-}
-EXPORT_SYMBOL(__ethtool_get_link_ksettings);
-
 /* convert ethtool_link_usettings in user space to a kernel internal
  * ethtool_link_ksettings. return 0 on success, errno on error.
  */
-- 
2.26.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ