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>
This commit is contained in:
parent
f655418785
commit
a9f28eba6e
@ -536,6 +536,26 @@ static inline void mii_lpa_mod_linkmode_x(unsigned long *linkmodes, u16 lpa,
|
|||||||
lpa & LPA_1000XFULL);
|
lpa & LPA_1000XFULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
* mii_advertise_flowctrl - get flow control advertisement flags
|
||||||
* @cap: Flow control capabilities (FLOW_CTRL_RX, FLOW_CTRL_TX or both)
|
* @cap: Flow control capabilities (FLOW_CTRL_RX, FLOW_CTRL_TX or both)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user