diff options
author | Eric Dumazet <eric.dumazet@gmail.com> | 2010-11-23 05:42:02 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-11-28 13:47:18 -0500 |
commit | 5a0d2268d259886f0c87131639d19eb4a67b4532 (patch) | |
tree | 952e6225fcee027f3a4ae8e1c2b2c889eff3a8b2 /include/linux/netdevice.h | |
parent | d3c15cab213becc49a6f2ad7f48a59513a5f17dd (diff) |
net: add netif_tx_queue_frozen_or_stopped
When testing struct netdev_queue state against FROZEN bit, we also test
XOFF bit. We can test both bits at once and save some cycles.
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/netdevice.h')
-rw-r--r-- | include/linux/netdevice.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index badf9285fe0d..7c6ae2f4b9ab 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -493,6 +493,8 @@ static inline void napi_synchronize(const struct napi_struct *n) | |||
493 | enum netdev_queue_state_t { | 493 | enum netdev_queue_state_t { |
494 | __QUEUE_STATE_XOFF, | 494 | __QUEUE_STATE_XOFF, |
495 | __QUEUE_STATE_FROZEN, | 495 | __QUEUE_STATE_FROZEN, |
496 | #define QUEUE_STATE_XOFF_OR_FROZEN ((1 << __QUEUE_STATE_XOFF) | \ | ||
497 | (1 << __QUEUE_STATE_FROZEN)) | ||
496 | }; | 498 | }; |
497 | 499 | ||
498 | struct netdev_queue { | 500 | struct netdev_queue { |
@@ -1629,9 +1631,9 @@ static inline int netif_queue_stopped(const struct net_device *dev) | |||
1629 | return netif_tx_queue_stopped(netdev_get_tx_queue(dev, 0)); | 1631 | return netif_tx_queue_stopped(netdev_get_tx_queue(dev, 0)); |
1630 | } | 1632 | } |
1631 | 1633 | ||
1632 | static inline int netif_tx_queue_frozen(const struct netdev_queue *dev_queue) | 1634 | static inline int netif_tx_queue_frozen_or_stopped(const struct netdev_queue *dev_queue) |
1633 | { | 1635 | { |
1634 | return test_bit(__QUEUE_STATE_FROZEN, &dev_queue->state); | 1636 | return dev_queue->state & QUEUE_STATE_XOFF_OR_FROZEN; |
1635 | } | 1637 | } |
1636 | 1638 | ||
1637 | /** | 1639 | /** |