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>
This commit is contained in:
parent
d1015645dd
commit
46e5da40ae
6 changed files with 82 additions and 42 deletions
|
@ -543,7 +543,7 @@ struct netdev_queue {
|
|||
* read mostly part
|
||||
*/
|
||||
struct net_device *dev;
|
||||
struct Qdisc *qdisc;
|
||||
struct Qdisc __rcu *qdisc;
|
||||
struct Qdisc *qdisc_sleeping;
|
||||
#ifdef CONFIG_SYSFS
|
||||
struct kobject kobj;
|
||||
|
@ -2356,12 +2356,7 @@ static inline void input_queue_tail_incr_save(struct softnet_data *sd,
|
|||
DECLARE_PER_CPU_ALIGNED(struct softnet_data, softnet_data);
|
||||
|
||||
void __netif_schedule(struct Qdisc *q);
|
||||
|
||||
static inline void netif_schedule_queue(struct netdev_queue *txq)
|
||||
{
|
||||
if (!(txq->state & QUEUE_STATE_ANY_XOFF))
|
||||
__netif_schedule(txq->qdisc);
|
||||
}
|
||||
void netif_schedule_queue(struct netdev_queue *txq);
|
||||
|
||||
static inline void netif_tx_schedule_all(struct net_device *dev)
|
||||
{
|
||||
|
@ -2397,11 +2392,7 @@ static inline void netif_tx_start_all_queues(struct net_device *dev)
|
|||
}
|
||||
}
|
||||
|
||||
static inline void netif_tx_wake_queue(struct netdev_queue *dev_queue)
|
||||
{
|
||||
if (test_and_clear_bit(__QUEUE_STATE_DRV_XOFF, &dev_queue->state))
|
||||
__netif_schedule(dev_queue->qdisc);
|
||||
}
|
||||
void netif_tx_wake_queue(struct netdev_queue *dev_queue);
|
||||
|
||||
/**
|
||||
* netif_wake_queue - restart transmit
|
||||
|
@ -2673,19 +2664,7 @@ static inline bool netif_subqueue_stopped(const struct net_device *dev,
|
|||
return __netif_subqueue_stopped(dev, skb_get_queue_mapping(skb));
|
||||
}
|
||||
|
||||
/**
|
||||
* netif_wake_subqueue - allow sending packets on subqueue
|
||||
* @dev: network device
|
||||
* @queue_index: sub queue index
|
||||
*
|
||||
* Resume individual transmit queue of a device with multiple transmit queues.
|
||||
*/
|
||||
static inline void netif_wake_subqueue(struct net_device *dev, u16 queue_index)
|
||||
{
|
||||
struct netdev_queue *txq = netdev_get_tx_queue(dev, queue_index);
|
||||
if (test_and_clear_bit(__QUEUE_STATE_DRV_XOFF, &txq->state))
|
||||
__netif_schedule(txq->qdisc);
|
||||
}
|
||||
void netif_wake_subqueue(struct net_device *dev, u16 queue_index);
|
||||
|
||||
#ifdef CONFIG_XPS
|
||||
int netif_set_xps_queue(struct net_device *dev, const struct cpumask *mask,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue