Commit 60611652 authored by Sean Anderson's avatar Sean Anderson Committed by David S. Miller

net: phylink: Export phylink_caps_to_linkmodes

This function is convenient for MAC drivers. They can use it to add or
remove particular link modes based on capabilities (such as if half
duplex is not supported for a particular interface mode).
Signed-off-by: default avatarSean Anderson <sean.anderson@seco.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 72bc3695
...@@ -155,8 +155,15 @@ static const char *phylink_an_mode_str(unsigned int mode) ...@@ -155,8 +155,15 @@ static const char *phylink_an_mode_str(unsigned int mode)
return mode < ARRAY_SIZE(modestr) ? modestr[mode] : "unknown"; return mode < ARRAY_SIZE(modestr) ? modestr[mode] : "unknown";
} }
static void phylink_caps_to_linkmodes(unsigned long *linkmodes, /**
unsigned long caps) * phylink_caps_to_linkmodes() - Convert capabilities to ethtool link modes
* @linkmodes: ethtool linkmode mask (must be already initialised)
* @caps: bitmask of MAC capabilities
*
* Set all possible pause, speed and duplex linkmodes in @linkmodes that are
* supported by the @caps. @linkmodes must have been initialised previously.
*/
void phylink_caps_to_linkmodes(unsigned long *linkmodes, unsigned long caps)
{ {
if (caps & MAC_SYM_PAUSE) if (caps & MAC_SYM_PAUSE)
__set_bit(ETHTOOL_LINK_MODE_Pause_BIT, linkmodes); __set_bit(ETHTOOL_LINK_MODE_Pause_BIT, linkmodes);
...@@ -295,6 +302,7 @@ static void phylink_caps_to_linkmodes(unsigned long *linkmodes, ...@@ -295,6 +302,7 @@ static void phylink_caps_to_linkmodes(unsigned long *linkmodes,
__set_bit(ETHTOOL_LINK_MODE_400000baseCR4_Full_BIT, linkmodes); __set_bit(ETHTOOL_LINK_MODE_400000baseCR4_Full_BIT, linkmodes);
} }
} }
EXPORT_SYMBOL_GPL(phylink_caps_to_linkmodes);
/** /**
* phylink_get_linkmodes() - get acceptable link modes * phylink_get_linkmodes() - get acceptable link modes
......
...@@ -547,6 +547,7 @@ void pcs_link_up(struct phylink_pcs *pcs, unsigned int mode, ...@@ -547,6 +547,7 @@ void pcs_link_up(struct phylink_pcs *pcs, unsigned int mode,
phy_interface_t interface, int speed, int duplex); phy_interface_t interface, int speed, int duplex);
#endif #endif
void phylink_caps_to_linkmodes(unsigned long *linkmodes, unsigned long caps);
void phylink_get_linkmodes(unsigned long *linkmodes, phy_interface_t interface, void phylink_get_linkmodes(unsigned long *linkmodes, phy_interface_t interface,
unsigned long mac_capabilities); unsigned long mac_capabilities);
void phylink_generic_validate(struct phylink_config *config, void phylink_generic_validate(struct phylink_config *config,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment