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>
This commit is contained in:

committed by
David S. Miller

parent
edc7ccbbcf
commit
5f991f7bdd
@@ -334,6 +334,25 @@ static inline void mii_adv_to_linkmode_adv_t(unsigned long *advertising,
|
||||
linkmode_set_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT, 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)
|
||||
|
Reference in New Issue
Block a user