aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/mii.h
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2009-04-29 04:19:03 -0400
committerDavid S. Miller <davem@davemloft.net>2009-04-29 20:32:35 -0400
commita8c30832b5b12e5d4e9d1c20cdac3cc2880e08b8 (patch)
treeff4016ada65d46cf52582b4b23a4eddc92a371a9 /include/linux/mii.h
parent44c22ee91b56d7cad3b48c439dd96aad2e910fbc (diff)
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>
Diffstat (limited to 'include/linux/mii.h')
-rw-r--r--include/linux/mii.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/linux/mii.h b/include/linux/mii.h
index 14ecb2e114f1..359fba880274 100644
--- a/include/linux/mii.h
+++ b/include/linux/mii.h
@@ -240,6 +240,22 @@ static inline unsigned int mii_duplex (unsigned int duplex_lock,
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 */
246static 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 * mii_resolve_flowctrl_fdx 259 * mii_resolve_flowctrl_fdx
244 * @lcladv: value of MII ADVERTISE register 260 * @lcladv: value of MII ADVERTISE register
245 * @rmtadv: value of MII LPA register 261 * @rmtadv: value of MII LPA register