[NET_SCHED]: Move top-level device queueing code to seperate function Signed-off-by: Patrick McHardy --- commit a39585afe71dafab96208515a8fa99c92b108fee tree fbb7672a3061a38edc9f75d3fb8f34652796b109 parent 2a6508576111d82246ee018edbcc4b0f0d18acad author Patrick McHardy Tue, 04 Jul 2006 15:03:28 +0200 committer Patrick McHardy Tue, 04 Jul 2006 15:03:28 +0200 include/net/pkt_sched.h | 1 + net/core/dev.c | 10 +--------- net/sched/sch_generic.c | 12 ++++++++++++ 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h index 1925c65..44cf69e 100644 --- a/include/net/pkt_sched.h +++ b/include/net/pkt_sched.h @@ -224,6 +224,7 @@ extern struct qdisc_rate_table *qdisc_ge struct rtattr *tab); extern void qdisc_put_rtab(struct qdisc_rate_table *tab); +extern int qdisc_enqueue_root(struct net_device *dev, struct sk_buff *skb); extern void __qdisc_run(struct net_device *dev); static inline void qdisc_run(struct net_device *dev) diff --git a/net/core/dev.c b/net/core/dev.c index 066a60a..8599120 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -1449,15 +1449,7 @@ #ifdef CONFIG_NET_CLS_ACT skb->tc_verd = SET_TC_AT(skb->tc_verd,AT_EGRESS); #endif if (q->enqueue) { - /* Grab device queue */ - spin_lock(&dev->queue_lock); - - rc = q->enqueue(skb, q); - - qdisc_run(dev); - - spin_unlock(&dev->queue_lock); - rc = rc == NET_XMIT_BYPASS ? NET_XMIT_SUCCESS : rc; + rc = qdisc_enqueue_root(dev, skb); goto out; } diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c index d735f51..2bab466 100644 --- a/net/sched/sch_generic.c +++ b/net/sched/sch_generic.c @@ -77,6 +77,18 @@ void qdisc_unlock_tree(struct net_device if one is grabbed, another must be free. */ +int qdisc_enqueue_root(struct net_device *dev, struct sk_buff *skb) +{ + int ret; + + spin_lock(&dev->queue_lock); + ret = dev->qdisc->enqueue(skb, dev->qdisc); + qdisc_run(dev); + spin_unlock(&dev->queue_lock); + + return ret == NET_XMIT_BYPASS ? NET_XMIT_SUCCESS : ret; +} + /* Kick device. Note, that this procedure can be called by a watchdog timer, so that