diff options
author | Andrew Lunn <andrew@lunn.ch> | 2018-09-30 00:04:13 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-10-02 08:55:36 +0300 |
commit | 5f991f7bddc991ecc3c8a009ffd76fccff4661c7 (patch) | |
tree | 041625dea9f72ac77fef229b92476238619ab91a /include/linux/mii.h | |
parent | edc7ccbbcf32b97c7d26cd556f364eb4f22c4285 (diff) | |
download | linux-5f991f7bddc991ecc3c8a009ffd76fccff4661c7.tar.xz |
net: phy: Add helper for advertise to lcl value
Add a helper to convert the local advertising to an LCL capabilities,
which is then used to resolve pause flow control settings.
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/mii.h')
-rw-r--r-- | include/linux/mii.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/include/linux/mii.h b/include/linux/mii.h index 8c7da9473ad9..9ed49c8261d0 100644 --- a/include/linux/mii.h +++ b/include/linux/mii.h @@ -335,6 +335,25 @@ static inline void mii_adv_to_linkmode_adv_t(unsigned long *advertising, } /** + * ethtool_adv_to_lcl_adv_t + * @advertising:pointer to ethtool advertising + * + * A small helper function that translates ethtool advertising to LVL + * pause capabilities. + */ +static inline u32 ethtool_adv_to_lcl_adv_t(u32 advertising) +{ + u32 lcl_adv = 0; + + if (advertising & ADVERTISED_Pause) + lcl_adv |= ADVERTISE_PAUSE_CAP; + if (advertising & ADVERTISED_Asym_Pause) + lcl_adv |= ADVERTISE_PAUSE_ASYM; + + return lcl_adv; +} + +/** * mii_advertise_flowctrl - get flow control advertisement flags * @cap: Flow control capabilities (FLOW_CTRL_RX, FLOW_CTRL_TX or both) */ |