Commit a8c30832b5b12e5d4e9d1c20cdac3cc2880e08b8
Committed by
David S. Miller
1 parent
44c22ee91b
Exists in
master
and in
7 other branches
mii: Add mii_advertise_flowctrl()
This converts flow control capabilites to an advertising mask and can be useful in combination with mii_resolve_flowctrl_fdx(). Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Showing 1 changed file with 16 additions and 0 deletions Side-by-side Diff
include/linux/mii.h
... | ... | @@ -240,6 +240,22 @@ |
240 | 240 | } |
241 | 241 | |
242 | 242 | /** |
243 | + * mii_advertise_flowctrl - get flow control advertisement flags | |
244 | + * @cap: Flow control capabilities (FLOW_CTRL_RX, FLOW_CTRL_TX or both) | |
245 | + */ | |
246 | +static inline u16 mii_advertise_flowctrl(int cap) | |
247 | +{ | |
248 | + u16 adv = 0; | |
249 | + | |
250 | + if (cap & FLOW_CTRL_RX) | |
251 | + adv = ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM; | |
252 | + if (cap & FLOW_CTRL_TX) | |
253 | + adv ^= ADVERTISE_PAUSE_ASYM; | |
254 | + | |
255 | + return adv; | |
256 | +} | |
257 | + | |
258 | +/** | |
243 | 259 | * mii_resolve_flowctrl_fdx |
244 | 260 | * @lcladv: value of MII ADVERTISE register |
245 | 261 | * @rmtadv: value of MII LPA register |