pkt_sched: Make QDISC_RUNNING a qdisc state.
Currently it is associated with a netdev_queue, but when we have qdisc sharing that no longer makes any sense. Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
d3b753db7c
commit
e2627c8c22
@ -441,7 +441,6 @@ static inline void napi_synchronize(const struct napi_struct *n)
|
|||||||
enum netdev_queue_state_t
|
enum netdev_queue_state_t
|
||||||
{
|
{
|
||||||
__QUEUE_STATE_XOFF,
|
__QUEUE_STATE_XOFF,
|
||||||
__QUEUE_STATE_QDISC_RUNNING,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct netdev_queue {
|
struct netdev_queue {
|
||||||
|
@ -88,8 +88,10 @@ extern void __qdisc_run(struct netdev_queue *txq);
|
|||||||
|
|
||||||
static inline void qdisc_run(struct netdev_queue *txq)
|
static inline void qdisc_run(struct netdev_queue *txq)
|
||||||
{
|
{
|
||||||
|
struct Qdisc *q = txq->qdisc;
|
||||||
|
|
||||||
if (!netif_tx_queue_stopped(txq) &&
|
if (!netif_tx_queue_stopped(txq) &&
|
||||||
!test_and_set_bit(__QUEUE_STATE_QDISC_RUNNING, &txq->state))
|
!test_and_set_bit(__QDISC_STATE_RUNNING, &q->state))
|
||||||
__qdisc_run(txq);
|
__qdisc_run(txq);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,6 +23,11 @@ struct qdisc_rate_table
|
|||||||
int refcnt;
|
int refcnt;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum qdisc_state_t
|
||||||
|
{
|
||||||
|
__QDISC_STATE_RUNNING,
|
||||||
|
};
|
||||||
|
|
||||||
struct Qdisc
|
struct Qdisc
|
||||||
{
|
{
|
||||||
int (*enqueue)(struct sk_buff *skb, struct Qdisc *dev);
|
int (*enqueue)(struct sk_buff *skb, struct Qdisc *dev);
|
||||||
@ -36,6 +41,7 @@ struct Qdisc
|
|||||||
u32 handle;
|
u32 handle;
|
||||||
u32 parent;
|
u32 parent;
|
||||||
atomic_t refcnt;
|
atomic_t refcnt;
|
||||||
|
unsigned long state;
|
||||||
struct sk_buff *gso_skb;
|
struct sk_buff *gso_skb;
|
||||||
struct sk_buff_head q;
|
struct sk_buff_head q;
|
||||||
struct netdev_queue *dev_queue;
|
struct netdev_queue *dev_queue;
|
||||||
|
@ -130,8 +130,8 @@ static inline int handle_dev_cpu_collision(struct sk_buff *skb,
|
|||||||
/*
|
/*
|
||||||
* NOTE: Called under queue->lock with locally disabled BH.
|
* NOTE: Called under queue->lock with locally disabled BH.
|
||||||
*
|
*
|
||||||
* __QUEUE_STATE_QDISC_RUNNING guarantees only one CPU can process
|
* __QDISC_STATE_RUNNING guarantees only one CPU can process
|
||||||
* this queue at a time. queue->lock serializes queue accesses for
|
* this qdisc at a time. queue->lock serializes queue accesses for
|
||||||
* this queue AND txq->qdisc pointer itself.
|
* this queue AND txq->qdisc pointer itself.
|
||||||
*
|
*
|
||||||
* netif_tx_lock serializes accesses to device driver.
|
* netif_tx_lock serializes accesses to device driver.
|
||||||
@ -146,9 +146,9 @@ static inline int handle_dev_cpu_collision(struct sk_buff *skb,
|
|||||||
* >0 - queue is not empty.
|
* >0 - queue is not empty.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static inline int qdisc_restart(struct netdev_queue *txq)
|
static inline int qdisc_restart(struct netdev_queue *txq,
|
||||||
|
struct Qdisc *q)
|
||||||
{
|
{
|
||||||
struct Qdisc *q = txq->qdisc;
|
|
||||||
int ret = NETDEV_TX_BUSY;
|
int ret = NETDEV_TX_BUSY;
|
||||||
struct net_device *dev;
|
struct net_device *dev;
|
||||||
struct sk_buff *skb;
|
struct sk_buff *skb;
|
||||||
@ -168,7 +168,6 @@ static inline int qdisc_restart(struct netdev_queue *txq)
|
|||||||
HARD_TX_UNLOCK(dev, txq);
|
HARD_TX_UNLOCK(dev, txq);
|
||||||
|
|
||||||
spin_lock(&txq->lock);
|
spin_lock(&txq->lock);
|
||||||
q = txq->qdisc;
|
|
||||||
|
|
||||||
switch (ret) {
|
switch (ret) {
|
||||||
case NETDEV_TX_OK:
|
case NETDEV_TX_OK:
|
||||||
@ -197,8 +196,9 @@ static inline int qdisc_restart(struct netdev_queue *txq)
|
|||||||
void __qdisc_run(struct netdev_queue *txq)
|
void __qdisc_run(struct netdev_queue *txq)
|
||||||
{
|
{
|
||||||
unsigned long start_time = jiffies;
|
unsigned long start_time = jiffies;
|
||||||
|
struct Qdisc *q = txq->qdisc;
|
||||||
|
|
||||||
while (qdisc_restart(txq)) {
|
while (qdisc_restart(txq, q)) {
|
||||||
if (netif_tx_queue_stopped(txq))
|
if (netif_tx_queue_stopped(txq))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -213,7 +213,7 @@ void __qdisc_run(struct netdev_queue *txq)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
clear_bit(__QUEUE_STATE_QDISC_RUNNING, &txq->state);
|
clear_bit(__QDISC_STATE_RUNNING, &q->state);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dev_watchdog(unsigned long arg)
|
static void dev_watchdog(unsigned long arg)
|
||||||
@ -666,14 +666,16 @@ static bool some_qdisc_is_running(struct net_device *dev, int lock)
|
|||||||
|
|
||||||
for (i = 0; i < dev->num_tx_queues; i++) {
|
for (i = 0; i < dev->num_tx_queues; i++) {
|
||||||
struct netdev_queue *dev_queue;
|
struct netdev_queue *dev_queue;
|
||||||
|
struct Qdisc *q;
|
||||||
int val;
|
int val;
|
||||||
|
|
||||||
dev_queue = netdev_get_tx_queue(dev, i);
|
dev_queue = netdev_get_tx_queue(dev, i);
|
||||||
|
q = dev_queue->qdisc;
|
||||||
|
|
||||||
if (lock)
|
if (lock)
|
||||||
spin_lock_bh(&dev_queue->lock);
|
spin_lock_bh(&dev_queue->lock);
|
||||||
|
|
||||||
val = test_bit(__QUEUE_STATE_QDISC_RUNNING, &dev_queue->state);
|
val = test_bit(__QDISC_STATE_RUNNING, &q->state);
|
||||||
|
|
||||||
if (lock)
|
if (lock)
|
||||||
spin_unlock_bh(&dev_queue->lock);
|
spin_unlock_bh(&dev_queue->lock);
|
||||||
|
Loading…
Reference in New Issue
Block a user