mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-23 15:32:33 +00:00
45 lines
1.4 KiB
Diff
45 lines
1.4 KiB
Diff
|
From: Russell King <rmk+kernel@arm.linux.org.uk>
|
||
|
Date: Thu, 1 Oct 2015 20:27:19 +0100
|
||
|
Subject: [PATCH] phylink: add ethtool nway_reset support
|
||
|
|
||
|
Add ethtool nway_reset support to phylink, to allow userspace to
|
||
|
request a re-negotiation of the link.
|
||
|
|
||
|
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
|
||
|
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
|
||
|
---
|
||
|
|
||
|
--- a/drivers/net/phy/phylink.c
|
||
|
+++ b/drivers/net/phy/phylink.c
|
||
|
@@ -783,6 +783,20 @@ int phylink_ethtool_ksettings_set(struct
|
||
|
}
|
||
|
EXPORT_SYMBOL_GPL(phylink_ethtool_ksettings_set);
|
||
|
|
||
|
+int phylink_ethtool_nway_reset(struct phylink *pl)
|
||
|
+{
|
||
|
+ int ret = 0;
|
||
|
+
|
||
|
+ mutex_lock(&pl->config_mutex);
|
||
|
+ if (pl->phydev)
|
||
|
+ ret = genphy_restart_aneg(pl->phydev);
|
||
|
+ phylink_mac_an_restart(pl);
|
||
|
+ mutex_unlock(&pl->config_mutex);
|
||
|
+
|
||
|
+ return ret;
|
||
|
+}
|
||
|
+EXPORT_SYMBOL_GPL(phylink_ethtool_nway_reset);
|
||
|
+
|
||
|
/* This emulates MII registers for a fixed-mode phy operating as per the
|
||
|
* passed in state. "aneg" defines if we report negotiation is possible.
|
||
|
*
|
||
|
--- a/include/linux/phylink.h
|
||
|
+++ b/include/linux/phylink.h
|
||
|
@@ -86,6 +86,7 @@ int phylink_ethtool_ksettings_get(struct
|
||
|
struct ethtool_link_ksettings *);
|
||
|
int phylink_ethtool_ksettings_set(struct phylink *,
|
||
|
const struct ethtool_link_ksettings *);
|
||
|
+int phylink_ethtool_nway_reset(struct phylink *);
|
||
|
int phylink_mii_ioctl(struct phylink *, struct ifreq *, int);
|
||
|
|
||
|
int phylink_set_link(struct phylink *pl, unsigned int mode, u8 port,
|