This adds support for Fast Link Down as new PHY tunable. Fast Link Down reduces the time until a link down event is reported for 1000BaseT. According to the standard it's 750ms what is too long for several use cases. v2: - add comment describing the constants
Unified · Split
| @@ -252,9 +252,17 @@ struct ethtool_tunable { · 251 unmodified lines | ||
| 252 | 252 | #define DOWNSHIFT_DEV_DEFAULT_COUNT 0xff |
| 253 | 253 | #define DOWNSHIFT_DEV_DISABLE 0 |
| 254 | 254 | |
| 255 | +/* Time in msecs after which link is reported as down | |
| 256 | + * 0 = lowest time supported by the PHY | |
| 257 | + * 0xff = off, link down detection according to standard | |
| 258 | + */ | |
| 259 | +#define ETHTOOL_PHY_FAST_LINK_DOWN_ON 0 | |
| 260 | +#define ETHTOOL_PHY_FAST_LINK_DOWN_OFF 0xff | |
| 261 | + | |
| 255 | 262 | enum phy_tunable_id { |
| 256 | 263 | ETHTOOL_PHY_ID_UNSPEC, |
| 257 | 264 | ETHTOOL_PHY_DOWNSHIFT, |
| 265 | + ETHTOOL_PHY_FAST_LINK_DOWN, | |
| 258 | 266 | /* |
| 259 | 267 | * Add your fresh new phy tunable attribute above and remember to update |
| 260 | 268 | * phy_tunable_strings[] in net/core/ethtool.c |
| @@ -136,6 +136,7 @@ static const char · 135 unmodified lines | ||
| 136 | 136 | phy_tunable_strings[__ETHTOOL_PHY_TUNABLE_COUNT][ETH_GSTRING_LEN] = { |
| 137 | 137 | [ETHTOOL_ID_UNSPEC] = "Unspec", |
| 138 | 138 | [ETHTOOL_PHY_DOWNSHIFT] = "phy-downshift", |
| 139 | + [ETHTOOL_PHY_FAST_LINK_DOWN] = "phy-fast-link-down", | |
| 139 | 140 | }; |
| 140 | 141 | |
| 141 | 142 | static int ethtool_get_features(struct net_device *dev, void __user *useraddr) |
| @@ -2432,6 +2433,7 @@ static int ethtool_phy_tunable_valid(const struct ethtool_tunable *tuna) · 2290 unmodified lines | ||
| 2432 | 2433 | { |
| 2433 | 2434 | switch (tuna->id) { |
| 2434 | 2435 | case ETHTOOL_PHY_DOWNSHIFT: |
| 2436 | + case ETHTOOL_PHY_FAST_LINK_DOWN: | |
| 2435 | 2437 | if (tuna->len != sizeof(u8) || |
| 2436 | 2438 | tuna->type_id != ETHTOOL_TUNABLE_U8) |
| 2437 | 2439 | return -EINVAL; |