Skip to content
Snippets Groups Projects
Commit 1c1e3700 authored by Yuiko Oshino's avatar Yuiko Oshino Committed by Joe Hershberger
Browse files

net: Add mii_resolve_flowctrl_fdx()


Add an mii helper function to resolve flow control status per
IEEE 802.3-2005 table 28B-3.
This function was taken from the Linux source tree.

Signed-off-by: default avatarYuiko Oshino <yuiko.oshino@microchip.com>
Acked-by: default avatarJoe Hershberger <joe.hershberger@ni.com>
parent 3f8f1410
No related branches found
No related tags found
No related merge requests found
...@@ -190,4 +190,27 @@ static inline unsigned int mii_duplex (unsigned int duplex_lock, ...@@ -190,4 +190,27 @@ static inline unsigned int mii_duplex (unsigned int duplex_lock,
return 0; return 0;
} }
/**
* mii_resolve_flowctrl_fdx
* @lcladv: value of MII ADVERTISE register
* @rmtadv: value of MII LPA register
*
* Resolve full duplex flow control as per IEEE 802.3-2005 table 28B-3
*/
static inline u8 mii_resolve_flowctrl_fdx(u16 lcladv, u16 rmtadv)
{
u8 cap = 0;
if (lcladv & rmtadv & ADVERTISE_PAUSE_CAP) {
cap = FLOW_CTRL_TX | FLOW_CTRL_RX;
} else if (lcladv & rmtadv & ADVERTISE_PAUSE_ASYM) {
if (lcladv & ADVERTISE_PAUSE_CAP)
cap = FLOW_CTRL_RX;
else if (rmtadv & ADVERTISE_PAUSE_CAP)
cap = FLOW_CTRL_TX;
}
return cap;
}
#endif /* __LINUX_MII_H__ */ #endif /* __LINUX_MII_H__ */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment