diff options
author | Daniel Borkmann <dborkman@redhat.com> | 2014-04-02 14:52:57 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-04-03 14:29:12 -0400 |
commit | 8e2f1a63f2217365223026422a2f8ba5967051d6 (patch) | |
tree | 617c58bd5a55d41cfe3c28e1087a17691f1ae197 /include/linux/netdevice.h | |
parent | 0f97ede45e65ffb6eab856313e79b14b902bcfaa (diff) |
packet: fix packet_direct_xmit for BQL enabled drivers
Currently, in packet_direct_xmit() we test the assigned netdevice queue
for netif_xmit_frozen_or_stopped() before doing an ndo_start_xmit().
This can have the side-effect that BQL enabled drivers which make use
of netdev_tx_sent_queue() internally, set __QUEUE_STATE_STACK_XOFF from
within the stack and would not fully fill the device's TX ring from
packet sockets with PACKET_QDISC_BYPASS enabled.
Instead, use a test without BQL bit so that bursts can be absorbed
into the NICs TX ring. Fix and code suggested by Eric Dumazet, thanks!
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/netdevice.h')
-rw-r--r-- | include/linux/netdevice.h | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 775cc956ff78..7ed3a3aa6604 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -519,11 +519,18 @@ enum netdev_queue_state_t { | |||
519 | __QUEUE_STATE_DRV_XOFF, | 519 | __QUEUE_STATE_DRV_XOFF, |
520 | __QUEUE_STATE_STACK_XOFF, | 520 | __QUEUE_STATE_STACK_XOFF, |
521 | __QUEUE_STATE_FROZEN, | 521 | __QUEUE_STATE_FROZEN, |
522 | #define QUEUE_STATE_ANY_XOFF ((1 << __QUEUE_STATE_DRV_XOFF) | \ | ||
523 | (1 << __QUEUE_STATE_STACK_XOFF)) | ||
524 | #define QUEUE_STATE_ANY_XOFF_OR_FROZEN (QUEUE_STATE_ANY_XOFF | \ | ||
525 | (1 << __QUEUE_STATE_FROZEN)) | ||
526 | }; | 522 | }; |
523 | |||
524 | #define QUEUE_STATE_DRV_XOFF (1 << __QUEUE_STATE_DRV_XOFF) | ||
525 | #define QUEUE_STATE_STACK_XOFF (1 << __QUEUE_STATE_STACK_XOFF) | ||
526 | #define QUEUE_STATE_FROZEN (1 << __QUEUE_STATE_FROZEN) | ||
527 | |||
528 | #define QUEUE_STATE_ANY_XOFF (QUEUE_STATE_DRV_XOFF | QUEUE_STATE_STACK_XOFF) | ||
529 | #define QUEUE_STATE_ANY_XOFF_OR_FROZEN (QUEUE_STATE_ANY_XOFF | \ | ||
530 | QUEUE_STATE_FROZEN) | ||
531 | #define QUEUE_STATE_DRV_XOFF_OR_FROZEN (QUEUE_STATE_DRV_XOFF | \ | ||
532 | QUEUE_STATE_FROZEN) | ||
533 | |||
527 | /* | 534 | /* |
528 | * __QUEUE_STATE_DRV_XOFF is used by drivers to stop the transmit queue. The | 535 | * __QUEUE_STATE_DRV_XOFF is used by drivers to stop the transmit queue. The |
529 | * netif_tx_* functions below are used to manipulate this flag. The | 536 | * netif_tx_* functions below are used to manipulate this flag. The |
@@ -2252,11 +2259,18 @@ static inline bool netif_xmit_stopped(const struct netdev_queue *dev_queue) | |||
2252 | return dev_queue->state & QUEUE_STATE_ANY_XOFF; | 2259 | return dev_queue->state & QUEUE_STATE_ANY_XOFF; |
2253 | } | 2260 | } |
2254 | 2261 | ||
2255 | static inline bool netif_xmit_frozen_or_stopped(const struct netdev_queue *dev_queue) | 2262 | static inline bool |
2263 | netif_xmit_frozen_or_stopped(const struct netdev_queue *dev_queue) | ||
2256 | { | 2264 | { |
2257 | return dev_queue->state & QUEUE_STATE_ANY_XOFF_OR_FROZEN; | 2265 | return dev_queue->state & QUEUE_STATE_ANY_XOFF_OR_FROZEN; |
2258 | } | 2266 | } |
2259 | 2267 | ||
2268 | static inline bool | ||
2269 | netif_xmit_frozen_or_drv_stopped(const struct netdev_queue *dev_queue) | ||
2270 | { | ||
2271 | return dev_queue->state & QUEUE_STATE_DRV_XOFF_OR_FROZEN; | ||
2272 | } | ||
2273 | |||
2260 | static inline void netdev_tx_sent_queue(struct netdev_queue *dev_queue, | 2274 | static inline void netdev_tx_sent_queue(struct netdev_queue *dev_queue, |
2261 | unsigned int bytes) | 2275 | unsigned int bytes) |
2262 | { | 2276 | { |