diff options
author | Russell King <rmk+kernel@armlinux.org.uk> | 2020-03-14 13:09:58 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2020-03-16 03:10:14 +0300 |
commit | a9f28eba6eaab651e4cec6d936a107b03d61754a (patch) | |
tree | ff3ba602d42085c33df8f302d72796ea62dcba70 /include/linux/mii.h | |
parent | f6554187855a4ddce235d22cc1486c118846b592 (diff) | |
download | linux-a9f28eba6eaab651e4cec6d936a107b03d61754a.tar.xz |
net: mii: add linkmode_adv_to_mii_adv_x()
Add a helper to convert a linkmode advertisement to a clause 37
advertisement value for 1000base-x and 2500base-x.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/mii.h')
-rw-r--r-- | include/linux/mii.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/include/linux/mii.h b/include/linux/mii.h index 309de4a3e6e7..219b93cad1dd 100644 --- a/include/linux/mii.h +++ b/include/linux/mii.h @@ -537,6 +537,26 @@ static inline void mii_lpa_mod_linkmode_x(unsigned long *linkmodes, u16 lpa, } /** + * linkmode_adv_to_mii_adv_x - encode a linkmode to config_reg + * @linkmodes: linkmodes + * @fd_bit: full duplex bit + */ +static inline u16 linkmode_adv_to_mii_adv_x(const unsigned long *linkmodes, + int fd_bit) +{ + u16 adv = 0; + + if (linkmode_test_bit(fd_bit, linkmodes)) + adv |= ADVERTISE_1000XFULL; + if (linkmode_test_bit(ETHTOOL_LINK_MODE_Pause_BIT, linkmodes)) + adv |= ADVERTISE_1000XPAUSE; + if (linkmode_test_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT, linkmodes)) + adv |= ADVERTISE_1000XPSE_ASYM; + + return adv; +} + +/** * mii_advertise_flowctrl - get flow control advertisement flags * @cap: Flow control capabilities (FLOW_CTRL_RX, FLOW_CTRL_TX or both) */ |