diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-06-15 12:40:05 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-06-15 12:40:05 -0400 |
commit | 2ed0e21b30b53d3a94e204196e523e6c8f732b56 (patch) | |
tree | de2635426477d86338a9469ce09ba0626052288f /include/linux/mii.h | |
parent | 0fa213310cd8fa7a51071cdcf130e26fa56e9549 (diff) | |
parent | 9cbc1cb8cd46ce1f7645b9de249b2ce8460129bb (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6: (1244 commits)
pkt_sched: Rename PSCHED_US2NS and PSCHED_NS2US
ipv4: Fix fib_trie rebalancing
Bluetooth: Fix issue with uninitialized nsh.type in DTL-1 driver
Bluetooth: Fix Kconfig issue with RFKILL integration
PIM-SM: namespace changes
ipv4: update ARPD help text
net: use a deferred timer in rt_check_expire
ieee802154: fix kconfig bool/tristate muckup
bonding: initialization rework
bonding: use is_zero_ether_addr
bonding: network device names are case sensative
bonding: elminate bad refcount code
bonding: fix style issues
bonding: fix destructor
bonding: remove bonding read/write semaphore
bonding: initialize before registration
bonding: bond_create always called with default parameters
x_tables: Convert printk to pr_err
netfilter: conntrack: optional reliable conntrack event delivery
list_nulls: add hlist_nulls_add_head and hlist_nulls_del
...
Diffstat (limited to 'include/linux/mii.h')
-rw-r--r-- | include/linux/mii.h | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/include/linux/mii.h b/include/linux/mii.h index ad748588faf1..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 | */ | ||
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 | * 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 |
@@ -250,18 +266,12 @@ static inline u8 mii_resolve_flowctrl_fdx(u16 lcladv, u16 rmtadv) | |||
250 | { | 266 | { |
251 | u8 cap = 0; | 267 | u8 cap = 0; |
252 | 268 | ||
253 | if (lcladv & ADVERTISE_PAUSE_CAP) { | 269 | if (lcladv & rmtadv & ADVERTISE_PAUSE_CAP) { |
254 | if (lcladv & ADVERTISE_PAUSE_ASYM) { | 270 | cap = FLOW_CTRL_TX | FLOW_CTRL_RX; |
255 | if (rmtadv & LPA_PAUSE_CAP) | 271 | } else if (lcladv & rmtadv & ADVERTISE_PAUSE_ASYM) { |
256 | cap = FLOW_CTRL_TX | FLOW_CTRL_RX; | 272 | if (lcladv & ADVERTISE_PAUSE_CAP) |
257 | else if (rmtadv & LPA_PAUSE_ASYM) | 273 | cap = FLOW_CTRL_RX; |
258 | cap = FLOW_CTRL_RX; | 274 | else if (rmtadv & ADVERTISE_PAUSE_CAP) |
259 | } else { | ||
260 | if (rmtadv & LPA_PAUSE_CAP) | ||
261 | cap = FLOW_CTRL_TX | FLOW_CTRL_RX; | ||
262 | } | ||
263 | } else if (lcladv & ADVERTISE_PAUSE_ASYM) { | ||
264 | if ((rmtadv & LPA_PAUSE_CAP) && (rmtadv & LPA_PAUSE_ASYM)) | ||
265 | cap = FLOW_CTRL_TX; | 275 | cap = FLOW_CTRL_TX; |
266 | } | 276 | } |
267 | 277 | ||