All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] ethtool: Move __ethtool_get_link_ksettings() to common file
@ 2021-04-08 10:58 Danielle Ratson
  2021-04-08 13:49 ` Andrew Lunn
  0 siblings, 1 reply; 3+ messages in thread
From: Danielle Ratson @ 2021-04-08 10:58 UTC (permalink / raw)
  To: netdev
  Cc: davem, kuba, alobakin, meirl, dmurphy, andrew, mkubecek,
	f.fainelli, irusskikh, alexanderduyck, magnus.karlsson, ecree,
	idosch, jiri, mlxsw, 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.

Signed-off-by: Danielle Ratson <danieller@nvidia.com>
Suggested-by: Jakub Kicinski <kuba@kernel.org>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] ethtool: Move __ethtool_get_link_ksettings() to common file
  2021-04-08 10:58 [PATCH net-next] ethtool: Move __ethtool_get_link_ksettings() to common file Danielle Ratson
@ 2021-04-08 13:49 ` Andrew Lunn
  2021-04-22 15:38   ` Danielle Ratson
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Lunn @ 2021-04-08 13:49 UTC (permalink / raw)
  To: Danielle Ratson
  Cc: netdev, davem, kuba, alobakin, meirl, dmurphy, mkubecek,
	f.fainelli, irusskikh, alexanderduyck, magnus.karlsson, ecree,
	idosch, jiri, mlxsw

On Thu, Apr 08, 2021 at 01:58:13PM +0300, Danielle Ratson wrote:
> __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@nvidia.com>
> Suggested-by: Jakub Kicinski <kuba@kernel.org>
> Reviewed-by: Ido Schimmel <idosch@nvidia.com>
> Reviewed-by: Jiri Pirko <jiri@nvidia.com>

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH net-next] ethtool: Move __ethtool_get_link_ksettings() to common file
  2021-04-08 13:49 ` Andrew Lunn
@ 2021-04-22 15:38   ` Danielle Ratson
  0 siblings, 0 replies; 3+ messages in thread
From: Danielle Ratson @ 2021-04-22 15:38 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: netdev, davem, kuba, alobakin, Meir Lichtinger, dmurphy,
	mkubecek, f.fainelli, irusskikh, alexanderduyck, magnus.karlsson,
	ecree, Ido Schimmel, Jiri Pirko, mlxsw



> -----Original Message-----
> From: Andrew Lunn <andrew@lunn.ch>
> Sent: Thursday, April 8, 2021 4:50 PM
> To: Danielle Ratson <danieller@nvidia.com>
> Cc: netdev@vger.kernel.org; davem@davemloft.net; kuba@kernel.org; alobakin@pm.me; Meir Lichtinger <meirl@nvidia.com>;
> dmurphy@ti.com; mkubecek@suse.cz; f.fainelli@gmail.com; irusskikh@marvell.com; alexanderduyck@fb.com;
> magnus.karlsson@intel.com; ecree@solarflare.com; Ido Schimmel <idosch@nvidia.com>; Jiri Pirko <jiri@nvidia.com>; mlxsw
> <mlxsw@nvidia.com>
> Subject: Re: [PATCH net-next] ethtool: Move __ethtool_get_link_ksettings() to common file
> 
> On Thu, Apr 08, 2021 at 01:58:13PM +0300, Danielle Ratson wrote:
> > __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@nvidia.com>
> > Suggested-by: Jakub Kicinski <kuba@kernel.org>
> > Reviewed-by: Ido Schimmel <idosch@nvidia.com>
> > Reviewed-by: Jiri Pirko <jiri@nvidia.com>
> 
> 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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-04-22 15:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-08 10:58 [PATCH net-next] ethtool: Move __ethtool_get_link_ksettings() to common file Danielle Ratson
2021-04-08 13:49 ` Andrew Lunn
2021-04-22 15:38   ` Danielle Ratson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.