aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Jakobi <tjakobi@math.uni-bielefeld.de>2017-11-21 10:15:57 -0500
committerDavid S. Miller <davem@davemloft.net>2017-11-23 11:36:31 -0500
commit9e77d7a5549dc4d4999a60676373ab3fd1dae4db (patch)
treeec3e04198f75de5fe0e2f5e3a6e82a7490326825
parent98d11291d189cb5adf49694d0ad1b971c0212697 (diff)
net: realtek: r8169: implement set_link_ksettings()
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> Tested-by: Holger Hoffstätte <holger@applied-asynchrony.com> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/realtek/r8169.c38
1 files changed, 22 insertions, 16 deletions
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
index 2cb3622c4acc..fc0d5fa65ad4 100644
--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
@@ -2030,21 +2030,6 @@ out:
2030 return ret; 2030 return ret;
2031} 2031}
2032 2032
2033static int rtl8169_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
2034{
2035 struct rtl8169_private *tp = netdev_priv(dev);
2036 int ret;
2037
2038 del_timer_sync(&tp->timer);
2039
2040 rtl_lock_work(tp);
2041 ret = rtl8169_set_speed(dev, cmd->autoneg, ethtool_cmd_speed(cmd),
2042 cmd->duplex, cmd->advertising);
2043 rtl_unlock_work(tp);
2044
2045 return ret;
2046}
2047
2048static netdev_features_t rtl8169_fix_features(struct net_device *dev, 2033static netdev_features_t rtl8169_fix_features(struct net_device *dev,
2049 netdev_features_t features) 2034 netdev_features_t features)
2050{ 2035{
@@ -2171,6 +2156,27 @@ static int rtl8169_get_link_ksettings(struct net_device *dev,
2171 return rc; 2156 return rc;
2172} 2157}
2173 2158
2159static int rtl8169_set_link_ksettings(struct net_device *dev,
2160 const struct ethtool_link_ksettings *cmd)
2161{
2162 struct rtl8169_private *tp = netdev_priv(dev);
2163 int rc;
2164 u32 advertising;
2165
2166 if (!ethtool_convert_link_mode_to_legacy_u32(&advertising,
2167 cmd->link_modes.advertising))
2168 return -EINVAL;
2169
2170 del_timer_sync(&tp->timer);
2171
2172 rtl_lock_work(tp);
2173 rc = rtl8169_set_speed(dev, cmd->base.autoneg, cmd->base.speed,
2174 cmd->base.duplex, advertising);
2175 rtl_unlock_work(tp);
2176
2177 return rc;
2178}
2179
2174static void rtl8169_get_regs(struct net_device *dev, struct ethtool_regs *regs, 2180static void rtl8169_get_regs(struct net_device *dev, struct ethtool_regs *regs,
2175 void *p) 2181 void *p)
2176{ 2182{
@@ -2591,7 +2597,6 @@ static const struct ethtool_ops rtl8169_ethtool_ops = {
2591 .get_link = ethtool_op_get_link, 2597 .get_link = ethtool_op_get_link,
2592 .get_coalesce = rtl_get_coalesce, 2598 .get_coalesce = rtl_get_coalesce,
2593 .set_coalesce = rtl_set_coalesce, 2599 .set_coalesce = rtl_set_coalesce,
2594 .set_settings = rtl8169_set_settings,
2595 .get_msglevel = rtl8169_get_msglevel, 2600 .get_msglevel = rtl8169_get_msglevel,
2596 .set_msglevel = rtl8169_set_msglevel, 2601 .set_msglevel = rtl8169_set_msglevel,
2597 .get_regs = rtl8169_get_regs, 2602 .get_regs = rtl8169_get_regs,
@@ -2603,6 +2608,7 @@ static const struct ethtool_ops rtl8169_ethtool_ops = {
2603 .get_ts_info = ethtool_op_get_ts_info, 2608 .get_ts_info = ethtool_op_get_ts_info,
2604 .nway_reset = rtl8169_nway_reset, 2609 .nway_reset = rtl8169_nway_reset,
2605 .get_link_ksettings = rtl8169_get_link_ksettings, 2610 .get_link_ksettings = rtl8169_get_link_ksettings,
2611 .set_link_ksettings = rtl8169_set_link_ksettings,
2606}; 2612};
2607 2613
2608static void rtl8169_get_mac_version(struct rtl8169_private *tp, 2614static void rtl8169_get_mac_version(struct rtl8169_private *tp,