Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 103400
b: refs/heads/master
c: eb6aafe
h: refs/heads/master
v: v3
  • Loading branch information
David S. Miller committed Jul 9, 2008
1 parent e3ab49a commit 663edcf
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 18 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 86d804e10a37cd86f16bf72386c37e843a98a74b
refs/heads/master: eb6aafe3f843cb0e939546c03540a3b4911b6964
8 changes: 5 additions & 3 deletions trunk/include/net/pkt_sched.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,15 @@ extern struct qdisc_rate_table *qdisc_get_rtab(struct tc_ratespec *r,
struct nlattr *tab);
extern void qdisc_put_rtab(struct qdisc_rate_table *tab);

extern void __qdisc_run(struct net_device *dev);
extern void __qdisc_run(struct netdev_queue *txq);

static inline void qdisc_run(struct net_device *dev)
static inline void qdisc_run(struct netdev_queue *txq)
{
struct net_device *dev = txq->dev;

if (!netif_queue_stopped(dev) &&
!test_and_set_bit(__LINK_STATE_QDISC_RUNNING, &dev->state))
__qdisc_run(dev);
__qdisc_run(txq);
}

extern int tc_classify_compat(struct sk_buff *skb, struct tcf_proto *tp,
Expand Down
4 changes: 2 additions & 2 deletions trunk/net/core/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1734,7 +1734,7 @@ int dev_queue_xmit(struct sk_buff *skb)
/* reset queue_mapping to zero */
skb_set_queue_mapping(skb, 0);
rc = q->enqueue(skb, q);
qdisc_run(dev);
qdisc_run(txq);
spin_unlock(&txq->lock);

rc = rc == NET_XMIT_BYPASS ? NET_XMIT_SUCCESS : rc;
Expand Down Expand Up @@ -1930,7 +1930,7 @@ static void net_tx_action(struct softirq_action *h)
clear_bit(__LINK_STATE_SCHED, &dev->state);

if (spin_trylock(&txq->lock)) {
qdisc_run(dev);
qdisc_run(txq);
spin_unlock(&txq->lock);
} else {
netif_schedule_queue(txq);
Expand Down
26 changes: 14 additions & 12 deletions trunk/net/sched/sch_generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,8 @@ static inline int dev_requeue_skb(struct sk_buff *skb,
return 0;
}

static inline struct sk_buff *dev_dequeue_skb(struct net_device *dev,
struct netdev_queue *dev_queue,
struct Qdisc *q)
static inline struct sk_buff *dequeue_skb(struct netdev_queue *dev_queue,
struct Qdisc *q)
{
struct sk_buff *skb;

Expand All @@ -90,10 +89,10 @@ static inline struct sk_buff *dev_dequeue_skb(struct net_device *dev,
}

static inline int handle_dev_cpu_collision(struct sk_buff *skb,
struct net_device *dev,
struct netdev_queue *dev_queue,
struct Qdisc *q)
{
struct net_device *dev = dev_queue->dev;
int ret;

if (unlikely(dev->xmit_lock_owner == smp_processor_id())) {
Expand Down Expand Up @@ -139,21 +138,23 @@ static inline int handle_dev_cpu_collision(struct sk_buff *skb,
* >0 - queue is not empty.
*
*/
static inline int qdisc_restart(struct net_device *dev)
static inline int qdisc_restart(struct netdev_queue *txq)
{
struct netdev_queue *txq = &dev->tx_queue;
struct Qdisc *q = txq->qdisc;
struct sk_buff *skb;
int ret = NETDEV_TX_BUSY;
struct net_device *dev;
struct sk_buff *skb;

/* Dequeue packet */
if (unlikely((skb = dev_dequeue_skb(dev, txq, q)) == NULL))
if (unlikely((skb = dequeue_skb(txq, q)) == NULL))
return 0;


/* And release queue */
spin_unlock(&txq->lock);

dev = txq->dev;

HARD_TX_LOCK(dev, smp_processor_id());
if (!netif_subqueue_stopped(dev, skb))
ret = dev_hard_start_xmit(skb, dev);
Expand All @@ -170,7 +171,7 @@ static inline int qdisc_restart(struct net_device *dev)

case NETDEV_TX_LOCKED:
/* Driver try lock failed */
ret = handle_dev_cpu_collision(skb, dev, txq, q);
ret = handle_dev_cpu_collision(skb, txq, q);
break;

default:
Expand All @@ -186,11 +187,12 @@ static inline int qdisc_restart(struct net_device *dev)
return ret;
}

void __qdisc_run(struct net_device *dev)
void __qdisc_run(struct netdev_queue *txq)
{
struct net_device *dev = txq->dev;
unsigned long start_time = jiffies;

while (qdisc_restart(dev)) {
while (qdisc_restart(txq)) {
if (netif_queue_stopped(dev))
break;

Expand All @@ -200,7 +202,7 @@ void __qdisc_run(struct net_device *dev)
* 2. we've been doing it for too long.
*/
if (need_resched() || jiffies != start_time) {
netif_schedule_queue(&dev->tx_queue);
netif_schedule_queue(txq);
break;
}
}
Expand Down

0 comments on commit 663edcf

Please sign in to comment.