diff options
| author | John Fastabend <john.fastabend@gmail.com> | 2014-09-12 23:04:52 -0400 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2014-09-13 12:30:25 -0400 |
| commit | 46e5da40aec256155cfedee96dd21a75da941f2c (patch) | |
| tree | cc3986c52025d252c2a063053692595e60c80e13 /include/linux | |
| parent | d1015645dd535bbf10e52a3ef6d02ee0c3e0b267 (diff) | |
net: qdisc: use rcu prefix and silence sparse warnings
Add __rcu notation to qdisc handling by doing this we can make
smatch output more legible. And anyways some of the cases should
be using rcu_dereference() see qdisc_all_tx_empty(),
qdisc_tx_chainging(), and so on.
Also *wake_queue() API is commonly called from driver timer routines
without rcu lock or rtnl lock. So I added rcu_read_lock() blocks
around netif_wake_subqueue and netif_tx_wake_queue.
Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/netdevice.h | 29 |
1 files changed, 4 insertions, 25 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index ba72f6baae1a..ae721f53739e 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
| @@ -543,7 +543,7 @@ struct netdev_queue { | |||
| 543 | * read mostly part | 543 | * read mostly part |
| 544 | */ | 544 | */ |
| 545 | struct net_device *dev; | 545 | struct net_device *dev; |
| 546 | struct Qdisc *qdisc; | 546 | struct Qdisc __rcu *qdisc; |
| 547 | struct Qdisc *qdisc_sleeping; | 547 | struct Qdisc *qdisc_sleeping; |
| 548 | #ifdef CONFIG_SYSFS | 548 | #ifdef CONFIG_SYSFS |
| 549 | struct kobject kobj; | 549 | struct kobject kobj; |
| @@ -2356,12 +2356,7 @@ static inline void input_queue_tail_incr_save(struct softnet_data *sd, | |||
| 2356 | DECLARE_PER_CPU_ALIGNED(struct softnet_data, softnet_data); | 2356 | DECLARE_PER_CPU_ALIGNED(struct softnet_data, softnet_data); |
| 2357 | 2357 | ||
| 2358 | void __netif_schedule(struct Qdisc *q); | 2358 | void __netif_schedule(struct Qdisc *q); |
| 2359 | 2359 | void netif_schedule_queue(struct netdev_queue *txq); | |
| 2360 | static inline void netif_schedule_queue(struct netdev_queue *txq) | ||
| 2361 | { | ||
| 2362 | if (!(txq->state & QUEUE_STATE_ANY_XOFF)) | ||
| 2363 | __netif_schedule(txq->qdisc); | ||
| 2364 | } | ||
| 2365 | 2360 | ||
| 2366 | static inline void netif_tx_schedule_all(struct net_device *dev) | 2361 | static inline void netif_tx_schedule_all(struct net_device *dev) |
| 2367 | { | 2362 | { |
| @@ -2397,11 +2392,7 @@ static inline void netif_tx_start_all_queues(struct net_device *dev) | |||
| 2397 | } | 2392 | } |
| 2398 | } | 2393 | } |
| 2399 | 2394 | ||
| 2400 | static inline void netif_tx_wake_queue(struct netdev_queue *dev_queue) | 2395 | void netif_tx_wake_queue(struct netdev_queue *dev_queue); |
| 2401 | { | ||
| 2402 | if (test_and_clear_bit(__QUEUE_STATE_DRV_XOFF, &dev_queue->state)) | ||
| 2403 | __netif_schedule(dev_queue->qdisc); | ||
| 2404 | } | ||
| 2405 | 2396 | ||
| 2406 | /** | 2397 | /** |
| 2407 | * netif_wake_queue - restart transmit | 2398 | * netif_wake_queue - restart transmit |
| @@ -2673,19 +2664,7 @@ static inline bool netif_subqueue_stopped(const struct net_device *dev, | |||
| 2673 | return __netif_subqueue_stopped(dev, skb_get_queue_mapping(skb)); | 2664 | return __netif_subqueue_stopped(dev, skb_get_queue_mapping(skb)); |
| 2674 | } | 2665 | } |
| 2675 | 2666 | ||
| 2676 | /** | 2667 | void netif_wake_subqueue(struct net_device *dev, u16 queue_index); |
| 2677 | * netif_wake_subqueue - allow sending packets on subqueue | ||
| 2678 | * @dev: network device | ||
| 2679 | * @queue_index: sub queue index | ||
| 2680 | * | ||
| 2681 | * Resume individual transmit queue of a device with multiple transmit queues. | ||
| 2682 | */ | ||
| 2683 | static inline void netif_wake_subqueue(struct net_device *dev, u16 queue_index) | ||
| 2684 | { | ||
| 2685 | struct netdev_queue *txq = netdev_get_tx_queue(dev, queue_index); | ||
| 2686 | if (test_and_clear_bit(__QUEUE_STATE_DRV_XOFF, &txq->state)) | ||
| 2687 | __netif_schedule(txq->qdisc); | ||
| 2688 | } | ||
| 2689 | 2668 | ||
| 2690 | #ifdef CONFIG_XPS | 2669 | #ifdef CONFIG_XPS |
| 2691 | int netif_set_xps_queue(struct net_device *dev, const struct cpumask *mask, | 2670 | int netif_set_xps_queue(struct net_device *dev, const struct cpumask *mask, |
