Skip to contentSkip to conversation

ethtool: Move __ethtool_get_link_ksettings() to common file

PATCH In review Danielle Ratson 2 participants 3 messages Apr 8, 2021 – Apr 22, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 net/ethtool/common.c | 14 ++++++++++++++
 net/ethtool/ioctl.c  | 14 --------------
 2 files changed, 14 insertions(+), 14 deletions(-)
net/ethtool/common.c +14 -0
index f9dcbad84788..0dc78e0e8a25 100644
@@ -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)
net/ethtool/ioctl.c +0 -14
index a9f67574148f..8944f4496cf0 100644
@@ -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.
  */
Signature · 1 line
2.26.2
maintainer
#1 lore raw
Quoted 10 lines · Danielle Ratson

__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.

Seems sensible.

Did you look to see what else is shared and should move? Rather than doing it one function at a time, can we do it all at once?

Andrew

#2 lore raw
Quoted 24 lines

-----Original Message-----
From: Andrew Lunn <[email protected]>
Sent: Thursday, April 8, 2021 4:50 PM
To: Danielle Ratson <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Meir Lichtinger <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Ido Schimmel <[email protected]>; Jiri Pirko <[email protected]>; mlxsw <[email protected]>
Subject: Re: [PATCH net-next] ethtool: Move __ethtool_get_link_ksettings() to common file

Quoted 10 lines · Danielle Ratson

__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.

Quoted 5 lines

Seems sensible.

Did you look to see what else is shared and should move? Rather than doing it one function at a time, can we do it all at once?

Andrew

This is the only one I found that needs to be moved, thanks.