All of lore.kernel.org
 help / color / mirror / Atom feed
* [RESEND PATCH] net: realtek: r8169: implement set_link_ksettings()
@ 2017-11-21 15:15 Tobias Jakobi
  2017-11-21 18:06 ` Holger Hoffstätte
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Tobias Jakobi @ 2017-11-21 15:15 UTC (permalink / raw)
  To: nic_swsd; +Cc: netdev, tremyfr, davem, Tobias Jakobi

Commit 6fa1ba61520576cf1346c4ff09a056f2950cb3bf partially
implemented the new ethtool API, by replacing get_settings()
with get_link_ksettings(). This breaks ethtool, since the
userspace tool (according to the new API specs) never tries
the legacy set() call, when the new get() call succeeds.

All attempts to chance some setting from userspace result in:
> Cannot set new settings: Operation not supported

Implement the missing set() call.

Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
---
 drivers/net/ethernet/realtek/r8169.c | 38 +++++++++++++++++++++---------------
 1 file changed, 22 insertions(+), 16 deletions(-)

diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
index dcb8c39382e7..a1a998dcd3e6 100644
--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
@@ -2030,21 +2030,6 @@ static int rtl8169_set_speed(struct net_device *dev,
 	return ret;
 }
 
-static int rtl8169_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
-{
-	struct rtl8169_private *tp = netdev_priv(dev);
-	int ret;
-
-	del_timer_sync(&tp->timer);
-
-	rtl_lock_work(tp);
-	ret = rtl8169_set_speed(dev, cmd->autoneg, ethtool_cmd_speed(cmd),
-				cmd->duplex, cmd->advertising);
-	rtl_unlock_work(tp);
-
-	return ret;
-}
-
 static netdev_features_t rtl8169_fix_features(struct net_device *dev,
 	netdev_features_t features)
 {
@@ -2171,6 +2156,27 @@ static int rtl8169_get_link_ksettings(struct net_device *dev,
 	return rc;
 }
 
+static int rtl8169_set_link_ksettings(struct net_device *dev,
+				      const struct ethtool_link_ksettings *cmd)
+{
+	struct rtl8169_private *tp = netdev_priv(dev);
+	int rc;
+	u32 advertising;
+
+	if (!ethtool_convert_link_mode_to_legacy_u32(&advertising,
+	    cmd->link_modes.advertising))
+		return -EINVAL;
+
+	del_timer_sync(&tp->timer);
+
+	rtl_lock_work(tp);
+	rc = rtl8169_set_speed(dev, cmd->base.autoneg, cmd->base.speed,
+			       cmd->base.duplex, advertising);
+	rtl_unlock_work(tp);
+
+	return rc;
+}
+
 static void rtl8169_get_regs(struct net_device *dev, struct ethtool_regs *regs,
 			     void *p)
 {
@@ -2591,7 +2597,6 @@ static const struct ethtool_ops rtl8169_ethtool_ops = {
 	.get_link		= ethtool_op_get_link,
 	.get_coalesce		= rtl_get_coalesce,
 	.set_coalesce		= rtl_set_coalesce,
-	.set_settings		= rtl8169_set_settings,
 	.get_msglevel		= rtl8169_get_msglevel,
 	.set_msglevel		= rtl8169_set_msglevel,
 	.get_regs		= rtl8169_get_regs,
@@ -2603,6 +2608,7 @@ static const struct ethtool_ops rtl8169_ethtool_ops = {
 	.get_ts_info		= ethtool_op_get_ts_info,
 	.nway_reset		= rtl8169_nway_reset,
 	.get_link_ksettings	= rtl8169_get_link_ksettings,
+	.set_link_ksettings	= rtl8169_set_link_ksettings,
 };
 
 static void rtl8169_get_mac_version(struct rtl8169_private *tp,
-- 
2.13.5

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

* Re: [RESEND PATCH] net: realtek: r8169: implement set_link_ksettings()
  2017-11-21 15:15 [RESEND PATCH] net: realtek: r8169: implement set_link_ksettings() Tobias Jakobi
@ 2017-11-21 18:06 ` Holger Hoffstätte
  2017-11-21 18:21 ` Andrew Lunn
  2017-11-23 16:37 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Holger Hoffstätte @ 2017-11-21 18:06 UTC (permalink / raw)
  To: Tobias Jakobi, nic_swsd; +Cc: netdev, tremyfr, davem

On 11/21/17 16:15, Tobias Jakobi wrote:
> Commit 6fa1ba61520576cf1346c4ff09a056f2950cb3bf partially
> implemented the new ethtool API, by replacing get_settings()
> with get_link_ksettings(). This breaks ethtool, since the
> userspace tool (according to the new API specs) never tries
> the legacy set() call, when the new get() call succeeds.
> 
> All attempts to chance some setting from userspace result in:
>> Cannot set new settings: Operation not supported
> 
> Implement the missing set() call.
> 
> Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>

I've had this in my 4.9/4.14 trees for a while and not noticed any
problems, therefore:

Tested-by: Holger Hoffstätte <holger@applied-asynchrony.com>

Thanks,

-h

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

* Re: [RESEND PATCH] net: realtek: r8169: implement set_link_ksettings()
  2017-11-21 15:15 [RESEND PATCH] net: realtek: r8169: implement set_link_ksettings() Tobias Jakobi
  2017-11-21 18:06 ` Holger Hoffstätte
@ 2017-11-21 18:21 ` Andrew Lunn
  2017-11-23 16:37 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Andrew Lunn @ 2017-11-21 18:21 UTC (permalink / raw)
  To: Tobias Jakobi; +Cc: nic_swsd, netdev, tremyfr, davem

On Tue, Nov 21, 2017 at 04:15:57PM +0100, Tobias Jakobi wrote:
> Commit 6fa1ba61520576cf1346c4ff09a056f2950cb3bf partially
> implemented the new ethtool API, by replacing get_settings()
> with get_link_ksettings(). This breaks ethtool, since the
> userspace tool (according to the new API specs) never tries
> the legacy set() call, when the new get() call succeeds.
> 
> All attempts to chance some setting from userspace result in:
> > Cannot set new settings: Operation not supported
> 
> Implement the missing set() call.
> 
> Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>

Fixes: 6fa1ba615205 ("net: realtek: r8169: use new api ethtool_{get|set}_link_ksettings")

It would be good to have this in stable.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

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

* Re: [RESEND PATCH] net: realtek: r8169: implement set_link_ksettings()
  2017-11-21 15:15 [RESEND PATCH] net: realtek: r8169: implement set_link_ksettings() Tobias Jakobi
  2017-11-21 18:06 ` Holger Hoffstätte
  2017-11-21 18:21 ` Andrew Lunn
@ 2017-11-23 16:37 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2017-11-23 16:37 UTC (permalink / raw)
  To: tjakobi; +Cc: nic_swsd, netdev, tremyfr

From: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Date: Tue, 21 Nov 2017 16:15:57 +0100

> Commit 6fa1ba61520576cf1346c4ff09a056f2950cb3bf partially
> implemented the new ethtool API, by replacing get_settings()
> with get_link_ksettings(). This breaks ethtool, since the
> userspace tool (according to the new API specs) never tries
> the legacy set() call, when the new get() call succeeds.
> 
> All attempts to chance some setting from userspace result in:
>> Cannot set new settings: Operation not supported
> 
> Implement the missing set() call.
> 
> Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>

Applied and queued up for -stable, thanks!

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

end of thread, other threads:[~2017-11-23 16:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-21 15:15 [RESEND PATCH] net: realtek: r8169: implement set_link_ksettings() Tobias Jakobi
2017-11-21 18:06 ` Holger Hoffstätte
2017-11-21 18:21 ` Andrew Lunn
2017-11-23 16:37 ` David Miller

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.