: Pseudo-classful qdisc consolidation
Subsystems (4)
cover : Pseudo-classful qdisc consolidation
These patches contain some preparatory cleanups and consolidate the Qdisc_class_ops for pseudo-classful qdiscs. The main reason for RFC is that the naming is not particular appealing (both qdisc_q_... and sch_pseudo_classful), suggestions for better names are welcome.
include/net/pkt_sched.h | 4 + include/net/sch_generic.h | 78 +++++++++++++------- net/core/dev.c | 4 +- net/sched/Kconfig | 6 ++ net/sched/Makefile | 1 + net/sched/sch_atm.c | 17 +++-- net/sched/sch_blackhole.c | 2 +- net/sched/sch_cbq.c | 18 +++-- net/sched/sch_dsmark.c | 11 +-- net/sched/sch_fifo.c | 62 +++++++++++++--- net/sched/sch_generic.c | 12 ++-- net/sched/sch_gred.c | 18 ++-- net/sched/sch_hfsc.c | 12 ++-- net/sched/sch_htb.c | 11 ++- net/sched/sch_netem.c | 157 +++++++-------------------------------- net/sched/sch_prio.c | 13 ++- net/sched/sch_pseudo_classful.c | 101 +++++++++++++++++++++++++ net/sched/sch_red.c | 152 ++++++-------------------------------- net/sched/sch_sfq.c | 2 +- net/sched/sch_tbf.c | 150 +++++-------------------------------- 20 files changed, 347 insertions(+), 484 deletions(-) create mode 100644 net/sched/sch_pseudo_classful.c
Patrick McHardy (5):
[NET_SCHED]: Consolidate default fifo setup [NET_SCHED]: Rename qdisc helpers for built-in queue [NET_SCHED]: Introduce child qdisc helpers [NET_SCHED]: Use qdisc helpers
[NET_SCHED]: Consolidate class ops for pseudo classful qdisc
RFC 1/5 : Consolidate default fifo setup
commit e56c933715900be7c6ad30bd07d342d31c457112
Author: Patrick McHardy <[email protected]> Date: Wed Jan 2 21:35:19 2008 +0100
[NET_SCHED]: Consolidate default fifo setup
include/net/pkt_sched.h +4 -0
@@ -72,6 +72,10 @@ extern void qdisc_watchdog_cancel(struct qdisc_watchdog *wd);extern struct Qdisc_ops pfifo_qdisc_ops;extern struct Qdisc_ops bfifo_qdisc_ops; +extern int fifo_set_limit (struct Qdisc *q,unsigned int limit); +extern struct Qdisc *fifo_create_dflt (struct Qdisc *sch,struct Qdisc_ops *ops, +unsigned int limit); +extern int register_qdisc (struct Qdisc_ops *qops);extern int unregister_qdisc (struct Qdisc_ops *qops);extern struct Qdisc *qdisc_lookup (struct net_device *dev,u32 handle);
net/sched/sch_fifo.c +42 -0
45 lines not on this page · raw message
net/sched/sch_netem.c +1 -23
@@ -310,28 +310,6 @@ static void netem_reset(struct Qdisc *sch)qdisc_watchdog_cancel (&q->watchdog); } -/* Pass size change message down to embedded FIFO */ -static int set_fifo_limit (struct Qdisc *q,int limit) -{ -struct rtattr *rta; -int ret = -ENOMEM ; - -/* Hack to avoid sending change message to non-FIFO */ -if (strncmp (q->ops->id +1 ,"fifo" ,4 ) !=0 ) -return 0 ; - - rta =kmalloc (RTA_LENGTH (sizeof (struct tc_fifo_qopt )),GFP_KERNEL ); -if (rta) { - rta->rta_type =RTM_NEWQDISC ; - rta->rta_len =RTA_LENGTH (sizeof (struct tc_fifo_qopt )); - ((struct tc_fifo_qopt *)RTA_DATA (rta))->limit = limit; - - ret = q->ops->change (q, rta); -kfree (rta); - } -return ret; -} -/* * Distribution data is a variable size payload containing * signed 16 bit values.
@@ -414,7 +392,7 @@ static int netem_change(struct Qdisc *sch, struct rtattr *opt)return -EINVAL ; qopt =RTA_DATA (opt); - ret =set_fifo_limit (q->qdisc, qopt->limit); + ret =fifo_set_limit (q->qdisc, qopt->limit);if (ret) {pr_debug ("netem: can't set fifo limit\n" );return ret;
net/sched/sch_red.c +3 -30
@@ -174,33 +174,6 @@ static void red_destroy(struct Qdisc *sch)qdisc_destroy (q->qdisc); } -static struct Qdisc *red_create_dflt (struct Qdisc *sch,u32 limit) -{ -struct Qdisc *q; -struct rtattr *rta; -int ret; - - q =qdisc_create_dflt (sch->dev, &bfifo_qdisc_ops, -TC_H_MAKE (sch->handle,1 )); -if (q) { - rta =kmalloc (RTA_LENGTH (sizeof (struct tc_fifo_qopt )), -GFP_KERNEL ); -if (rta) { - rta->rta_type =RTM_NEWQDISC ; - rta->rta_len =RTA_LENGTH (sizeof (struct tc_fifo_qopt )); - ((struct tc_fifo_qopt *)RTA_DATA (rta))->limit = limit; - - ret = q->ops->change (q, rta); -kfree (rta); - -if (ret ==0 ) -return q; - } -qdisc_destroy (q); - } -return NULL ; -} -static int red_change (struct Qdisc *sch,struct rtattr *opt) {struct red_sched_data *q =qdisc_priv (sch);
@@ -220,9 +193,9 @@ static int red_change(struct Qdisc *sch, struct rtattr *opt) ctl =RTA_DATA (tb[TCA_RED_PARMS -1 ]);if (ctl->limit >0 ) { - child =red_create_dflt (sch, ctl->limit); -if (child ==NULL ) -return -ENOMEM ; + child =fifo_create_dflt (sch, &bfifo_qdisc_ops, ctl->limit); +if (IS_ERR (child)) +return PTR_ERR (child); }sch_tree_lock (sch);
net/sched/sch_tbf.c +3 -29
@@ -242,33 +242,6 @@ static void tbf_reset(struct Qdisc* sch)qdisc_watchdog_cancel (&q->watchdog); } -static struct Qdisc *tbf_create_dflt_qdisc (struct Qdisc *sch,u32 limit) -{ -struct Qdisc *q; -struct rtattr *rta; -int ret; - - q =qdisc_create_dflt (sch->dev, &bfifo_qdisc_ops, -TC_H_MAKE (sch->handle,1 )); -if (q) { - rta =kmalloc (RTA_LENGTH (sizeof (struct tc_fifo_qopt )),GFP_KERNEL ); -if (rta) { - rta->rta_type =RTM_NEWQDISC ; - rta->rta_len =RTA_LENGTH (sizeof (struct tc_fifo_qopt )); - ((struct tc_fifo_qopt *)RTA_DATA (rta))->limit = limit; - - ret = q->ops->change (q, rta); -kfree (rta); - -if (ret ==0 ) -return q; - } -qdisc_destroy (q); - } - -return NULL ; -} -static int tbf_change (struct Qdisc * sch,struct rtattr *opt) {int err = -EINVAL ;
@@ -312,8 +285,9 @@ static int tbf_change(struct Qdisc* sch, struct rtattr *opt) goto done;if (qopt->limit >0 ) { -if ((child =tbf_create_dflt_qdisc (sch, qopt->limit)) ==NULL ) - goto done; + child =fifo_create_dflt (sch, &bfifo_qdisc_ops, qopt->limit); +if (IS_ERR (child)) +return PTR_ERR (child); }sch_tree_lock (sch);
RFC 2/5 : Rename qdisc helpers for built-in queue
In reply to Patrick McHardycommit c1f4198dd24ce854b7d55d0ed23a61d36d7defc9
Author: Patrick McHardy <[email protected]> Date: Wed Jan 2 21:35:21 2008 +0100
[NET_SCHED]: Rename qdisc helpers for built-in queue
Rename all helper functions dealing with the built-in queue of struct Qdisc (sch->q) to qdisc_q_... to make the naming more consistent and avoid naming clashes with the next patch, which introduces a few simple helpers that should logically use those names.
include/net/sch_generic.h +25 -25
@@ -180,8 +180,8 @@ extern struct Qdisc *qdisc_create_dflt(struct net_device *dev,extern void tcf_destroy (struct tcf_proto *tp);extern void tcf_destroy_chain (struct tcf_proto *fl); -static inline int __qdisc_enqueue_tail (struct sk_buff *skb,struct Qdisc *sch, -struct sk_buff_head *list) +static inline int __qdisc_q_enqueue_tail (struct sk_buff *skb,struct Qdisc *sch, +struct sk_buff_head *list) {__skb_queue_tail (list, skb); sch->qstats.backlog += skb->len;
@@ -191,13 +191,13 @@ static inline int __qdisc_enqueue_tail(struct sk_buff *skb, struct Qdisc *sch,return NET_XMIT_SUCCESS ; } -static inline int qdisc_enqueue_tail (struct sk_buff *skb,struct Qdisc *sch) +static inline int qdisc_q_enqueue_tail (struct sk_buff *skb,struct Qdisc *sch) { -return __qdisc_enqueue_tail (skb, sch, &sch->q); +return __qdisc_q_enqueue_tail (skb, sch, &sch->q); } -static inline struct sk_buff *__qdisc_dequeue_head (struct Qdisc *sch, -struct sk_buff_head *list) +static inline struct sk_buff *__qdisc_q_dequeue_head (struct Qdisc *sch, +struct sk_buff_head *list) {struct sk_buff *skb =__skb_dequeue (list);
@@ -207,13 +207,13 @@ static inline struct sk_buff *__qdisc_dequeue_head(struct Qdisc *sch,return skb; } -static inline struct sk_buff *qdisc_dequeue_head (struct Qdisc *sch) +static inline struct sk_buff *qdisc_q_dequeue_head (struct Qdisc *sch) { -return __qdisc_dequeue_head (sch, &sch->q); +return __qdisc_q_dequeue_head (sch, &sch->q); } -static inline struct sk_buff *__qdisc_dequeue_tail (struct Qdisc *sch, -struct sk_buff_head *list) +static inline struct sk_buff *__qdisc_q_dequeue_tail (struct Qdisc *sch, +struct sk_buff_head *list) {struct sk_buff *skb =__skb_dequeue_tail (list);
@@ -223,13 +223,13 @@ static inline struct sk_buff *__qdisc_dequeue_tail(struct Qdisc *sch,return skb; } -static inline struct sk_buff *qdisc_dequeue_tail (struct Qdisc *sch) +static inline struct sk_buff *qdisc_q_dequeue_tail (struct Qdisc *sch) { -return __qdisc_dequeue_tail (sch, &sch->q); +return __qdisc_q_dequeue_tail (sch, &sch->q); } -static inline int __qdisc_requeue (struct sk_buff *skb,struct Qdisc *sch, -struct sk_buff_head *list) +static inline int __qdisc_q_requeue (struct sk_buff *skb,struct Qdisc *sch, +struct sk_buff_head *list) {__skb_queue_head (list, skb); sch->qstats.backlog += skb->len;
@@ -238,13 +238,13 @@ static inline int __qdisc_requeue(struct sk_buff *skb, struct Qdisc *sch,return NET_XMIT_SUCCESS ; } -static inline int qdisc_requeue (struct sk_buff *skb,struct Qdisc *sch) +static inline int qdisc_q_requeue (struct sk_buff *skb,struct Qdisc *sch) { -return __qdisc_requeue (skb, sch, &sch->q); +return __qdisc_q_requeue (skb, sch, &sch->q); } -static inline void __qdisc_reset_queue (struct Qdisc *sch, -struct sk_buff_head *list) +static inline void __qdisc_q_reset (struct Qdisc *sch, +struct sk_buff_head *list) {/* * We do not know the backlog in bytes of this list, it
@@ -253,16 +253,16 @@ static inline void __qdisc_reset_queue(struct Qdisc *sch,skb_queue_purge (list); } -static inline void qdisc_reset_queue (struct Qdisc *sch) +static inline void qdisc_q_reset (struct Qdisc *sch) { -__qdisc_reset_queue (sch, &sch->q); +__qdisc_q_reset (sch, &sch->q); sch->qstats.backlog =0 ; } -static inline unsigned int __qdisc_queue_drop (struct Qdisc *sch, -struct sk_buff_head *list) +static inline unsigned int __qdisc_q_drop (struct Qdisc *sch, +struct sk_buff_head *list) { -struct sk_buff *skb =__qdisc_dequeue_tail (sch, list); +struct sk_buff *skb =__qdisc_q_dequeue_tail (sch, list);if (likely (skb !=NULL )) {unsigned int len = skb->len;
@@ -273,9 +273,9 @@ static inline unsigned int __qdisc_queue_drop(struct Qdisc *sch,return 0 ; } -static inline unsigned int qdisc_queue_drop (struct Qdisc *sch) +static inline unsigned int qdisc_q_drop (struct Qdisc *sch) { -return __qdisc_queue_drop (sch, &sch->q); +return __qdisc_q_drop (sch, &sch->q); }static inline int qdisc_drop (struct sk_buff *skb,struct Qdisc *sch)
net/sched/sch_fifo.c +10 -10
@@ -28,7 +28,7 @@ static int bfifo_enqueue(struct sk_buff *skb, struct Qdisc* sch)struct fifo_sched_data *q =qdisc_priv (sch);if (likely (sch->qstats.backlog + skb->len <= q->limit)) -return qdisc_enqueue_tail (skb, sch); +return qdisc_q_enqueue_tail (skb, sch);return qdisc_reshape_fail (skb, sch); }
@@ -38,7 +38,7 @@ static int pfifo_enqueue(struct sk_buff *skb, struct Qdisc* sch)struct fifo_sched_data *q =qdisc_priv (sch);if (likely (skb_queue_len (&sch->q) < q->limit)) -return qdisc_enqueue_tail (skb, sch); +return qdisc_q_enqueue_tail (skb, sch);return qdisc_reshape_fail (skb, sch); }
@@ -82,11 +82,11 @@ struct Qdisc_ops pfifo_qdisc_ops __read_mostly = { .id = "pfifo", .priv_size = sizeof(struct fifo_sched_data), .enqueue = pfifo_enqueue, - .dequeue = qdisc_dequeue_head, - .requeue = qdisc_requeue, - .drop = qdisc_queue_drop, + .dequeue = qdisc_q_dequeue_head, + .requeue = qdisc_q_requeue, + .drop = qdisc_q_drop, .init = fifo_init, - .reset = qdisc_reset_queue, + .reset = qdisc_q_reset, .change = fifo_init, .dump = fifo_dump, .owner = THIS_MODULE,
@@ -96,11 +96,11 @@ struct Qdisc_ops bfifo_qdisc_ops __read_mostly = { .id = "bfifo", .priv_size = sizeof(struct fifo_sched_data), .enqueue = bfifo_enqueue, - .dequeue = qdisc_dequeue_head, - .requeue = qdisc_requeue, - .drop = qdisc_queue_drop, + .dequeue = qdisc_q_dequeue_head, + .requeue = qdisc_q_requeue, + .drop = qdisc_q_drop, .init = fifo_init, - .reset = qdisc_reset_queue, + .reset = qdisc_q_reset, .change = fifo_init, .dump = fifo_dump, .owner = THIS_MODULE,
net/sched/sch_generic.c +4 -4
@@ -344,7 +344,7 @@ static int pfifo_fast_enqueue(struct sk_buff *skb, struct Qdisc* qdisc)if (skb_queue_len (list) < qdisc->dev->tx_queue_len) { qdisc->q.qlen++; -return __qdisc_enqueue_tail (skb, qdisc, list); +return __qdisc_q_enqueue_tail (skb, qdisc, list); }return qdisc_drop (skb, qdisc);
@@ -358,7 +358,7 @@ static struct sk_buff *pfifo_fast_dequeue(struct Qdisc* qdisc)for (prio =0 ; prio <PFIFO_FAST_BANDS ; prio++) {if (!skb_queue_empty (list + prio)) { qdisc->q.qlen--; -return __qdisc_dequeue_head (qdisc, list + prio); +return __qdisc_q_dequeue_head (qdisc, list + prio); } }
@@ -368,7 +368,7 @@ static struct sk_buff *pfifo_fast_dequeue(struct Qdisc* qdisc)static int pfifo_fast_requeue (struct sk_buff *skb,struct Qdisc * qdisc) { qdisc->q.qlen++; -return __qdisc_requeue (skb, qdisc,prio2list (skb, qdisc)); +return __qdisc_q_requeue (skb, qdisc,prio2list (skb, qdisc)); }static void pfifo_fast_reset (struct Qdisc * qdisc)
@@ -377,7 +377,7 @@ static void pfifo_fast_reset(struct Qdisc* qdisc)struct sk_buff_head *list =qdisc_priv (qdisc);for (prio =0 ; prio <PFIFO_FAST_BANDS ; prio++) -__qdisc_reset_queue (qdisc, list + prio); +__qdisc_q_reset (qdisc, list + prio); qdisc->qstats.backlog =0 ; qdisc->q.qlen =0 ;
net/sched/sch_gred.c +6 -6
@@ -165,7 +165,7 @@ static int gred_enqueue(struct sk_buff *skb, struct Qdisc* sch)* allows for DP flows to be left untouched. */ if (skb_queue_len (&sch->q) < sch->dev->tx_queue_len) -return qdisc_enqueue_tail (skb, sch); +return qdisc_q_enqueue_tail (skb, sch);else goto drop; }
@@ -228,7 +228,7 @@ static int gred_enqueue(struct sk_buff *skb, struct Qdisc* sch)if (q->backlog + skb->len <= q->limit) { q->backlog += skb->len; -return qdisc_enqueue_tail (skb, sch); +return qdisc_q_enqueue_tail (skb, sch); } q->stats.pdrop++;
@@ -257,7 +257,7 @@ static int gred_requeue(struct sk_buff *skb, struct Qdisc* sch) q->backlog += skb->len; } -return qdisc_requeue (skb, sch); +return qdisc_q_requeue (skb, sch); }static struct sk_buff *gred_dequeue (struct Qdisc * sch)
@@ -265,7 +265,7 @@ static struct sk_buff *gred_dequeue(struct Qdisc* sch)struct sk_buff *skb;struct gred_sched *t =qdisc_priv (sch); - skb =qdisc_dequeue_head (sch); + skb =qdisc_q_dequeue_head (sch);if (skb) {struct gred_sched_data *q;
@@ -297,7 +297,7 @@ static unsigned int gred_drop(struct Qdisc* sch)struct sk_buff *skb;struct gred_sched *t =qdisc_priv (sch); - skb =qdisc_dequeue_tail (sch); + skb =qdisc_q_dequeue_tail (sch);if (skb) {unsigned int len = skb->len;struct gred_sched_data *q;
@@ -332,7 +332,7 @@ static void gred_reset(struct Qdisc* sch)int i;struct gred_sched *t =qdisc_priv (sch); -qdisc_reset_queue (sch); +qdisc_q_reset (sch);for (i =0 ; i < t->DPs; i++) {struct gred_sched_data *q = t->tab[i];
net/sched/sch_netem.c +5 -5
@@ -470,7 +470,7 @@ static int tfifo_enqueue(struct sk_buff *nskb, struct Qdisc *sch)/* Optimize for add at tail */ if (likely (skb_queue_empty (list) || tnext >= q->oldest)) { q->oldest = tnext; -return qdisc_enqueue_tail (nskb, sch); +return qdisc_q_enqueue_tail (nskb, sch); } skb_queue_reverse_walk(list, skb) {
@@ -526,11 +526,11 @@ static struct Qdisc_ops tfifo_qdisc_ops __read_mostly = { .id = "tfifo", .priv_size = sizeof(struct fifo_sched_data), .enqueue = tfifo_enqueue, - .dequeue = qdisc_dequeue_head, - .requeue = qdisc_requeue, - .drop = qdisc_queue_drop, + .dequeue = qdisc_q_dequeue_head, + .requeue = qdisc_q_requeue, + .drop = qdisc_q_drop, .init = tfifo_init, - .reset = qdisc_reset_queue, + .reset = qdisc_q_reset, .change = tfifo_init, .dump = tfifo_dump, };
RFC 3/5 : Introduce child qdisc helpers
In reply to Patrick McHardycommit a6d1954517202bffb14f5122756891d8c5b8e2e2
Author: Patrick McHardy <[email protected]> Date: Wed Jan 16 12:08:18 2008 +0100
[NET_SCHED]: Introduce child qdisc helpers
Introduce a few helpers to dispatch calls to child qdiscs without repeating the qdisc argument every time.
include/net/sch_generic.h +21 -1
@@ -180,6 +180,26 @@ extern struct Qdisc *qdisc_create_dflt(struct net_device *dev,extern void tcf_destroy (struct tcf_proto *tp);extern void tcf_destroy_chain (struct tcf_proto *fl); +static inline int qdisc_enqueue (struct sk_buff *skb,struct Qdisc *sch) +{ +return sch->enqueue (skb, sch); +} + +static inline struct sk_buff *qdisc_dequeue (struct Qdisc *sch) +{ +return sch->dequeue (sch); +} + +static inline int qdisc_requeue (struct sk_buff *skb,struct Qdisc *sch) +{ +return sch->ops->requeue (skb, sch); +} + +static inline unsigned int qdisc_drop (struct Qdisc *sch) +{ +return sch->ops->drop ? sch->ops->drop (sch) :0 ; +} +static inline int __qdisc_q_enqueue_tail (struct sk_buff *skb,struct Qdisc *sch,struct sk_buff_head *list) {
@@ -278,7 +298,7 @@ static inline unsigned int qdisc_q_drop(struct Qdisc *sch)return __qdisc_q_drop (sch, &sch->q); } -static inline int qdisc_drop (struct sk_buff *skb,struct Qdisc *sch) +static inline int qdisc_drop_skb (struct sk_buff *skb,struct Qdisc *sch) {kfree_skb (skb); sch->qstats.drops++;
net/sched/sch_blackhole.c +1 -1
@@ -19,7 +19,7 @@static int blackhole_enqueue (struct sk_buff *skb,struct Qdisc *sch) { -qdisc_drop (skb, sch); +qdisc_drop_skb (skb, sch);return NET_XMIT_SUCCESS ; }
net/sched/sch_generic.c +1 -1
@@ -347,7 +347,7 @@ static int pfifo_fast_enqueue(struct sk_buff *skb, struct Qdisc* qdisc)return __qdisc_q_enqueue_tail (skb, qdisc, list); } -return qdisc_drop (skb, qdisc); +return qdisc_drop_skb (skb, qdisc); }static struct sk_buff *pfifo_fast_dequeue (struct Qdisc * qdisc)
net/sched/sch_gred.c +3 -3
@@ -233,10 +233,10 @@ static int gred_enqueue(struct sk_buff *skb, struct Qdisc* sch) q->stats.pdrop++; drop: -return qdisc_drop (skb, sch); +return qdisc_drop_skb (skb, sch); congestion_drop: -qdisc_drop (skb, sch); +qdisc_drop_skb (skb, sch);return NET_XMIT_CN ; }
@@ -316,7 +316,7 @@ static unsigned int gred_drop(struct Qdisc* sch)red_start_of_idle_period (&q->parms); } -qdisc_drop (skb, sch); +qdisc_drop_skb (skb, sch);return len; }
net/sched/sch_red.c +1 -1
@@ -104,7 +104,7 @@ static int red_enqueue(struct sk_buff *skb, struct Qdisc* sch)return ret; congestion_drop: -qdisc_drop (skb, sch); +qdisc_drop_skb (skb, sch);return NET_XMIT_CN ; }
net/sched/sch_sfq.c +1 -1
@@ -257,7 +257,7 @@ sfq_enqueue(struct sk_buff *skb, struct Qdisc* sch)* i.e. drop _this_ packet. */ if (q->qs[x].qlen >= q->limit) -return qdisc_drop (skb, sch); +return qdisc_drop_skb (skb, sch); sch->qstats.backlog += skb->len;__skb_queue_tail (&q->qs[x], skb);
RFC 4/5 : Use qdisc helpers
In reply to Patrick McHardycommit 8b0737e99efbf5b51f950d9fa95d69f96bf0a926
Author: Patrick McHardy <[email protected]> Date: Wed Jan 16 12:22:00 2008 +0100
[NET_SCHED]: Use qdisc helpers
Use the new qdisc helpers where possible. Also pull return value assignments out of conditions and use proper NET_XMIT codes where possible.
net/core/dev.c +2 -2
@@ -1673,7 +1673,7 @@ gso:if (q->enqueue) {/* reset queue_mapping to zero */ skb_set_queue_mapping (skb,0 ); - rc = q->enqueue (skb, q); + rc =qdisc_enqueue (skb, q);qdisc_run (dev);spin_unlock (&dev->queue_lock);
@@ -1970,7 +1970,7 @@ static int ing_filter(struct sk_buff *skb)spin_lock (&dev->ingress_lock);if ((q = dev->qdisc_ingress) !=NULL ) - result = q->enqueue (skb, q); + result =qdisc_enqueue (skb, q);spin_unlock (&dev->ingress_lock);return result;
net/sched/sch_atm.c +10 -7
@@ -430,7 +430,8 @@ static int atm_tc_enqueue(struct sk_buff *skb, struct Qdisc *sch)#endif } -if ((ret = flow->q->enqueue (skb, flow->q)) !=0 ) { + ret =qdisc_enqueue (skb, flow->q); +if (ret !=NET_XMIT_SUCCESS ) { drop:__maybe_unused sch->qstats.drops++;if (flow)
@@ -478,9 +479,9 @@ static void sch_atm_dequeue(unsigned long data)* If traffic is properly shaped, this won't generate nasty * little bursts. Otherwise, it may ... (but that's okay) */ -while ((skb = flow->q->dequeue (flow->q))) { +while ((skb =qdisc_dequeue (flow->q))) {if (!atm_may_send (flow->vcc, skb->truesize)) { - (void )flow->q->ops->requeue (skb, flow->q); +qdisc_requeue (skb, flow->q);break ; }D2PRINTK ("atm_tc_dequeue: sending on class %p\n" , flow);
@@ -514,7 +515,7 @@ static struct sk_buff *atm_tc_dequeue(struct Qdisc *sch)D2PRINTK ("atm_tc_dequeue(sch %p,[qdisc %p])\n" , sch, p);tasklet_schedule (&p->task); - skb = p->link.q->dequeue (p->link.q); + skb =qdisc_dequeue (p->link.q);if (skb) sch->q.qlen--;return skb;
@@ -526,7 +527,7 @@ static int atm_tc_requeue(struct sk_buff *skb, struct Qdisc *sch)int ret;D2PRINTK ("atm_tc_requeue(skb %p,sch %p,[qdisc %p])\n" , skb, sch, p); - ret = p->link.q->ops->requeue (skb, p->link.q); + ret =qdisc_requeue (skb, p->link.q);if (!ret) { sch->q.qlen++; sch->qstats.requeues++;
@@ -544,9 +545,11 @@ static unsigned int atm_tc_drop(struct Qdisc *sch)unsigned int len;DPRINTK ("atm_tc_drop(sch %p,[qdisc %p])\n" , sch, p); -for (flow = p->flows; flow; flow = flow->next) -if (flow->q->ops->drop && (len = flow->q->ops->drop (flow->q))) +for (flow = p->flows; flow; flow = flow->next) { + len =qdisc_drop (flow->q); +if (len >0 )return len; + }return 0 ; }
net/sched/sch_cbq.c +10 -8
@@ -396,7 +396,8 @@ cbq_enqueue(struct sk_buff *skb, struct Qdisc *sch)#ifdef CONFIG_NET_CLS_ACT cl->q->__parent = sch;#endif -if ((ret = cl->q->enqueue (skb, cl->q)) ==NET_XMIT_SUCCESS ) { + ret =qdisc_enqueue (skb, cl->q); +if (ret ==NET_XMIT_SUCCESS ) { sch->q.qlen++; sch->bstats.packets++; sch->bstats.bytes+=len;
@@ -432,7 +433,8 @@ cbq_requeue(struct sk_buff *skb, struct Qdisc *sch) q->rx_class = cl; cl->q->__parent = sch;#endif -if ((ret = cl->q->ops->requeue (skb, cl->q)) ==0 ) { + ret =qdisc_requeue (skb, cl->q); +if (ret ==NET_XMIT_SUCCESS ) { sch->q.qlen++; sch->qstats.requeues++;if (!cl->next_alive)
@@ -580,9 +582,8 @@ static void cbq_ovl_lowprio(struct cbq_class *cl)static void cbq_ovl_drop (struct cbq_class *cl) { -if (cl->q->ops->drop) -if (cl->q->ops->drop (cl->q)) - cl->qdisc->q.qlen--; +if (qdisc_drop (cl->q)) + cl->qdisc->q.qlen--; cl->xstats.overactions++;cbq_ovl_classic (cl); }
@@ -680,7 +681,7 @@ static int cbq_reshape_fail(struct sk_buff *skb, struct Qdisc *child) q->rx_class = cl; cl->q->__parent = sch; -if (cl->q->enqueue (skb, cl->q) ==0 ) { +if (qdisc_enqueue (skb, cl->q) ==NET_XMIT_SUCCESS ) { sch->q.qlen++; sch->bstats.packets++; sch->bstats.bytes+=len;
@@ -880,7 +881,7 @@ cbq_dequeue_prio(struct Qdisc *sch, int prio) goto next_class; } - skb = cl->q->dequeue (cl->q); + skb =qdisc_dequeue (cl->q);/* Class did not give us any skb :-( It could occur even if cl->q->q.qlen != 0
@@ -1226,7 +1227,8 @@ static unsigned int cbq_drop(struct Qdisc* sch) cl = cl_head; do { - if (cl->q->ops->drop && (len = cl->q->ops->drop(cl->q))) { + len = qdisc_drop(cl->q); + if (len > 0) { sch->q.qlen--; if (!cl->q->q.qlen) cbq_deactivate_class(cl);
net/sched/sch_dsmark.c +4 -7
@@ -257,7 +257,7 @@ static int dsmark_enqueue(struct sk_buff *skb,struct Qdisc *sch) } } - err = p->q->enqueue (skb,p->q); + err =qdisc_enqueue (skb, p->q);if (err !=NET_XMIT_SUCCESS ) { sch->qstats.drops++;return err;
@@ -278,7 +278,7 @@ static struct sk_buff *dsmark_dequeue(struct Qdisc *sch)D2PRINTK ("dsmark_dequeue(sch %p,[qdisc %p])\n" , sch, p); - skb = p->q->ops->dequeue (p->q); + skb =qdisc_dequeue (p->q);if (skb ==NULL )return NULL ;
@@ -319,7 +319,7 @@ static int dsmark_requeue(struct sk_buff *skb,struct Qdisc *sch)D2PRINTK ("dsmark_requeue(skb %p,sch %p,[qdisc %p])\n" , skb, sch, p); - err = p->q->ops->requeue (skb, p->q); + err =qdisc_requeue (skb, p->q);if (err !=NET_XMIT_SUCCESS ) { sch->qstats.drops++;return err;
@@ -338,10 +338,7 @@ static unsigned int dsmark_drop(struct Qdisc *sch)DPRINTK ("dsmark_reset(sch %p,[qdisc %p])\n" , sch, p); -if (p->q->ops->drop ==NULL ) -return 0 ; - - len = p->q->ops->drop (p->q); + len =qdisc_drop (p->q);if (len) sch->q.qlen--;
net/sched/sch_generic.c +1 -1
@@ -76,7 +76,7 @@ static inline struct sk_buff *dev_dequeue_skb(struct net_device *dev,if ((skb = dev->gso_skb)) dev->gso_skb =NULL ;else - skb = q->dequeue (q); + skb =qdisc_dequeue (q);return skb; }
net/sched/sch_hfsc.c +6 -6
@@ -892,14 +892,14 @@ qdisc_peek_len(struct Qdisc *sch)struct sk_buff *skb;unsigned int len; - skb = sch->dequeue (sch); + skb =qdisc_dequeue (sch);if (skb ==NULL ) {if (net_ratelimit ())printk ("qdisc_peek_len: non work-conserving qdisc ?\n" );return 0 ; } len = skb->len; -if (unlikely (sch->ops->requeue (skb, sch) !=NET_XMIT_SUCCESS )) { +if (unlikely (qdisc_requeue (skb, sch) !=NET_XMIT_SUCCESS )) {if (net_ratelimit ())printk ("qdisc_peek_len: failed to requeue\n" );qdisc_tree_decrease_qlen (sch,1 );
@@ -1574,7 +1574,7 @@ hfsc_enqueue(struct sk_buff *skb, struct Qdisc *sch) } len = skb->len; - err = cl->qdisc->enqueue (skb, cl->qdisc); + err =qdisc_enqueue (skb, cl->qdisc);if (unlikely (err !=NET_XMIT_SUCCESS )) { cl->qstats.drops++; sch->qstats.drops++;
@@ -1630,7 +1630,7 @@ hfsc_dequeue(struct Qdisc *sch) } } - skb = cl->qdisc->dequeue (cl->qdisc); + skb =qdisc_dequeue (cl->qdisc);if (skb ==NULL ) {if (net_ratelimit ())printk ("HFSC: Non-work-conserving qdisc ?\n" );
@@ -1681,8 +1681,8 @@ hfsc_drop(struct Qdisc *sch)unsigned int len;list_for_each_entry (cl, &q->droplist, dlist) { -if (cl->qdisc->ops->drop !=NULL && - (len = cl->qdisc->ops->drop (cl->qdisc)) >0 ) { + len =qdisc_drop (cl->qdisc); +if (len >0 ) {if (cl->qdisc->q.qlen ==0 ) {update_vf (cl,0 ,0 );set_passive (cl);
net/sched/sch_htb.c +6 -5
@@ -592,7 +592,7 @@ static int htb_enqueue(struct sk_buff *skb, struct Qdisc *sch)kfree_skb (skb);return ret;#endif - }else if (cl->un.leaf.q->enqueue (skb, cl->un.leaf.q) != + }else if (qdisc_enqueue (skb, cl->un.leaf.q) !=NET_XMIT_SUCCESS ) { sch->qstats.drops++; cl->qstats.drops++;
@@ -629,7 +629,7 @@ static int htb_requeue(struct sk_buff *skb, struct Qdisc *sch) sch->qstats.drops++;return NET_XMIT_CN ; } - }else if (cl->un.leaf.q->ops->requeue (skb, cl->un.leaf.q) != + }else if (qdisc_requeue (skb, cl->un.leaf.q) !=NET_XMIT_SUCCESS ) { sch->qstats.drops++; cl->qstats.drops++;
@@ -849,7 +849,7 @@ next: goto next; } - skb = cl->un.leaf.q->dequeue (cl->un.leaf.q); + skb =qdisc_dequeue (cl->un.leaf.q);if (likely (skb !=NULL ))break ;if (!cl->warned) {
@@ -949,8 +949,9 @@ static unsigned int htb_drop(struct Qdisc *sch) struct htb_class *cl = list_entry(p, struct htb_class, un.leaf.drop_list);unsigned int len; -if (cl->un.leaf.q->ops->drop && - (len = cl->un.leaf.q->ops->drop (cl->un.leaf.q))) { + + len =qdisc_drop (cl->un.leaf.q); +if (len) { sch->q.qlen--;if (!cl->un.leaf.q->q.qlen)htb_deactivate (q, cl);
net/sched/sch_netem.c +9 -7
@@ -184,7 +184,7 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch)u32 dupsave = q->duplicate;/* prevent duplicating a dup... */ q->duplicate =0 ; - rootq->enqueue (skb2, rootq); +qdisc_enqueue (skb2, rootq); q->duplicate = dupsave; }
@@ -218,7 +218,7 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch) now =psched_get_time (); cb->time_to_send = now + delay; ++q->counter; - ret = q->qdisc->enqueue (skb, q->qdisc); + ret =qdisc_enqueue (skb, q->qdisc); }else {/* * Do re-ordering by putting one out of N packets at the front
@@ -226,7 +226,7 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch)*/ cb->time_to_send =psched_get_time (); q->counter =0 ; - ret = q->qdisc->ops->requeue (skb, q->qdisc); + ret =qdisc_requeue (skb, q->qdisc); }if (likely (ret ==NET_XMIT_SUCCESS )) {
@@ -246,7 +246,8 @@ static int netem_requeue(struct sk_buff *skb, struct Qdisc *sch)struct netem_sched_data *q =qdisc_priv (sch);int ret; -if ((ret = q->qdisc->ops->requeue (skb, q->qdisc)) ==0 ) { + ret =qdisc_requeue (skb, q->qdisc); +if (ret ==NET_XMIT_SUCCESS ) { sch->q.qlen++; sch->qstats.requeues++; }
@@ -259,7 +260,8 @@ static unsigned int netem_drop(struct Qdisc* sch)struct netem_sched_data *q =qdisc_priv (sch);unsigned int len =0 ; -if (q->qdisc->ops->drop && (len = q->qdisc->ops->drop (q->qdisc)) !=0 ) { + len =qdisc_drop (q->qdisc); +if (len >0 ) { sch->q.qlen--; sch->qstats.drops++; }
@@ -275,7 +277,7 @@ static struct sk_buff *netem_dequeue(struct Qdisc *sch)if (sch->flags &TCQ_F_THROTTLED )return NULL ; - skb = q->qdisc->dequeue (q->qdisc); + skb =qdisc_dequeue (q->qdisc);if (skb) {const struct netem_skb_cb *cb = (const struct netem_skb_cb *)skb->cb;
@@ -288,7 +290,7 @@ static struct sk_buff *netem_dequeue(struct Qdisc *sch)return skb; } -if (unlikely (q->qdisc->ops->requeue (skb, q->qdisc) !=NET_XMIT_SUCCESS )) { +if (unlikely (qdisc_requeue (skb, q->qdisc) !=NET_XMIT_SUCCESS )) {qdisc_tree_decrease_qlen (q->qdisc,1 ); sch->qstats.drops++; printk(KERN_ERR "netem: %s could not requeue\n",
net/sched/sch_prio.c +8 -5
@@ -86,7 +86,8 @@ prio_enqueue(struct sk_buff *skb, struct Qdisc *sch) }#endif -if ((ret = qdisc->enqueue (skb, qdisc)) ==NET_XMIT_SUCCESS ) { + ret =qdisc_enqueue (skb, qdisc); +if (ret ==NET_XMIT_SUCCESS ) { sch->bstats.bytes += skb->len; sch->bstats.packets++; sch->q.qlen++;
@@ -113,7 +114,8 @@ prio_requeue(struct sk_buff *skb, struct Qdisc* sch) }#endif -if ((ret = qdisc->ops->requeue (skb, qdisc)) ==NET_XMIT_SUCCESS ) { + ret =qdisc_requeue (skb, qdisc); +if (ret ==NET_XMIT_SUCCESS ) { sch->q.qlen++; sch->qstats.requeues++;return 0 ;
@@ -138,7 +140,7 @@ prio_dequeue(struct Qdisc* sch)*/ if (!__netif_subqueue_stopped (sch->dev, (q->mq ? prio :0 ))) { qdisc = q->queues[prio]; - skb = qdisc->dequeue (qdisc); + skb =qdisc_dequeue (qdisc);if (skb) { sch->q.qlen--;return skb;
@@ -168,7 +170,7 @@ static struct sk_buff *rr_dequeue(struct Qdisc* sch)if (!__netif_subqueue_stopped (sch->dev, (q->mq ? q->curband :0 ))) { qdisc = q->queues[q->curband]; - skb = qdisc->dequeue (qdisc); + skb =qdisc_dequeue (qdisc);if (skb) { sch->q.qlen--; q->curband++;
@@ -193,7 +195,8 @@ static unsigned int prio_drop(struct Qdisc* sch)for (prio = q->bands-1 ; prio >=0 ; prio--) { qdisc = q->queues[prio]; -if (qdisc->ops->drop && (len = qdisc->ops->drop (qdisc)) !=0 ) { + len =qdisc_drop (qdisc); +if (len >0 ) { sch->q.qlen--;return len; }
net/sched/sch_red.c +5 -4
@@ -92,7 +92,7 @@ static int red_enqueue(struct sk_buff *skb, struct Qdisc* sch)break ; } - ret = child->enqueue (skb, child); + ret =qdisc_enqueue (skb, child);if (likely (ret ==NET_XMIT_SUCCESS )) { sch->bstats.bytes += skb->len; sch->bstats.packets++;
@@ -117,7 +117,7 @@ static int red_requeue(struct sk_buff *skb, struct Qdisc* sch)if (red_is_idling (&q->parms))red_end_of_idle_period (&q->parms); - ret = child->ops->requeue (skb, child); + ret =qdisc_requeue (skb, child);if (likely (ret ==NET_XMIT_SUCCESS )) { sch->qstats.requeues++; sch->q.qlen++;
@@ -131,7 +131,7 @@ static struct sk_buff * red_dequeue(struct Qdisc* sch)struct red_sched_data *q =qdisc_priv (sch);struct Qdisc *child = q->qdisc; - skb = child->dequeue (child); + skb =qdisc_dequeue (child);if (skb) sch->q.qlen--;else if (!red_is_idling (&q->parms))
@@ -146,7 +146,8 @@ static unsigned int red_drop(struct Qdisc* sch)struct Qdisc *child = q->qdisc;unsigned int len; -if (child->ops->drop && (len = child->ops->drop (child)) >0 ) { + len =qdisc_drop (child); +if (len >0 ) { q->stats.other++; sch->qstats.drops++; sch->q.qlen--;
net/sched/sch_tbf.c +7 -4
@@ -133,7 +133,8 @@ static int tbf_enqueue(struct sk_buff *skb, struct Qdisc* sch)return NET_XMIT_DROP ; } -if ((ret = q->qdisc->enqueue (skb, q->qdisc)) !=0 ) { + ret =qdisc_enqueue (skb, q->qdisc); +if (ret !=NET_XMIT_SUCCESS ) { sch->qstats.drops++;return ret; }
@@ -149,7 +150,8 @@ static int tbf_requeue(struct sk_buff *skb, struct Qdisc* sch)struct tbf_sched_data *q =qdisc_priv (sch);int ret; -if ((ret = q->qdisc->ops->requeue (skb, q->qdisc)) ==0 ) { + ret =qdisc_requeue (skb, q->qdisc); +if (ret ==NET_XMIT_SUCCESS ) { sch->q.qlen++; sch->qstats.requeues++; }
@@ -162,7 +164,8 @@ static unsigned int tbf_drop(struct Qdisc* sch)struct tbf_sched_data *q =qdisc_priv (sch);unsigned int len =0 ; -if (q->qdisc->ops->drop && (len = q->qdisc->ops->drop (q->qdisc)) !=0 ) { + len =qdisc_drop (q->qdisc); +if (len >0 ) { sch->q.qlen--; sch->qstats.drops++; }
@@ -174,7 +177,7 @@ static struct sk_buff *tbf_dequeue(struct Qdisc* sch)struct tbf_sched_data *q =qdisc_priv (sch);struct sk_buff *skb; - skb = q->qdisc->dequeue (q->qdisc); + skb =qdisc_dequeue (q->qdisc);if (skb) {psched_time_t now;
RFC 5/5 : Consolidate class ops for pseudo classful qdisc
In reply to Patrick McHardycommit e97ba18f7a8f9342fa06d0f5606a186b18e1d7f8
Author: Patrick McHardy <[email protected]> Date: Wed Jan 16 12:22:06 2008 +0100
[NET_SCHED]: Consolidate class ops for pseudo classful qdisc
include/net/sch_generic.h +6 -0
@@ -351,4 +351,10 @@ static inline struct sk_buff *skb_act_clone(struct sk_buff *skb, gfp_t gfp_mask) }#endif +struct pc_sched_data { +struct Qdisc *qdisc; +}; + +extern const struct Qdisc_class_ops pseudo_classful_ops; +#endif
net/sched/Kconfig +6 -0
@@ -43,6 +43,9 @@ if NET_SCHED comment "Queueing/Scheduling" +config NET_SCH_PC + tristate + config NET_SCH_CBQ tristate "Class Based Queueing (CBQ)" ---help---
@@ -141,6 +144,7 @@ config NET_SCH_SFQ config NET_SCH_TEQL tristate "True Link Equalizer (TEQL)" + select NET_SCH_PC ---help--- Say Y here if you want to use the True Link Equalizer (TLE) packet scheduling algorithm. This queueing discipline allows the combination
@@ -153,6 +157,7 @@ config NET_SCH_TEQL config NET_SCH_TBF tristate "Token Bucket Filter (TBF)" + select NET_SCH_PC ---help--- Say Y here if you want to use the Token Bucket Filter (TBF) packet scheduling algorithm.
@@ -186,6 +191,7 @@ config NET_SCH_DSMARK config NET_SCH_NETEM tristate "Network emulator (NETEM)" + select NET_SCH_PC ---help--- Say Y if you want to emulate network delay, loss, and packet re-ordering. This is often useful to simulate networks when
net/sched/Makefile +1 -0
@@ -14,6 +14,7 @@ obj-$(CONFIG_NET_ACT_IPT) += act_ipt.o obj-$(CONFIG_NET_ACT_NAT) += act_nat.o obj-$(CONFIG_NET_ACT_PEDIT) += act_pedit.o obj-$(CONFIG_NET_ACT_SIMP) += act_simple.o +obj-$(CONFIG_NET_SCH_PC) += sch_pseudo_classful.o obj-$(CONFIG_NET_SCH_FIFO) += sch_fifo.o obj-$(CONFIG_NET_SCH_CBQ) += sch_cbq.o obj-$(CONFIG_NET_SCH_HTB) += sch_htb.o
net/sched/sch_netem.c +18 -103
203 lines not on this page · raw message
net/sched/sch_pseudo_classful.c new file +101 -0
101 lines not on this page · raw message
net/sched/sch_red.c +13 -95
175 lines not on this page · raw message
net/sched/sch_tbf.c +14 -101
189 lines not on this page · raw message
Re: [RFC NET_SCHED 05/05]: Consolidate class ops for pseudo classful qdisc
Review
Quoted 12 lines · Patrick McHardy
commit
e97ba18f7a8f9342fa06d0f5606a186b18e1d7f8Author: Patrick McHardy <[email protected]> Date: Wed Jan 16 12:22:06 2008 +0100[
NET_SCHED]: Consolidate class ops for pseudo classful qdiscSigned-off-by Patrick McHardy <[email protected]>config
NET_SCH_TEQL(quoted diff) +1
-0tristate "True Link Equalizer (TEQL)" + select NET_SCH_PC
Oops .. this should have been at the NET_SCH_RED entry.
commit d89898d2e77b5c1753d21174870277d235994afa
Author: Patrick McHardy <[email protected]> Date: Sun Jan 20 19:31:05 2008 +0100
[NET_SCHED]: Consolidate class ops for pseudo classful qdisc
include/net/sch_generic.h +6 -0
@@ -351,4 +351,10 @@ static inline struct sk_buff *skb_act_clone(struct sk_buff *skb, gfp_t gfp_mask) }#endif +struct pc_sched_data { +struct Qdisc *qdisc; +}; + +extern const struct Qdisc_class_ops pseudo_classful_ops; +#endif
net/sched/Kconfig +6 -0
@@ -43,6 +43,9 @@ if NET_SCHED comment "Queueing/Scheduling" +config NET_SCH_PC + tristate + config NET_SCH_CBQ tristate "Class Based Queueing (CBQ)" ---help---
@@ -119,6 +122,7 @@ config NET_SCH_RR config NET_SCH_RED tristate "Random Early Detection (RED)" + select NET_SCH_PC ---help--- Say Y here if you want to use the Random Early Detection (RED) packet scheduling algorithm.
@@ -153,6 +157,7 @@ config NET_SCH_TEQL config NET_SCH_TBF tristate "Token Bucket Filter (TBF)" + select NET_SCH_PC ---help--- Say Y here if you want to use the Token Bucket Filter (TBF) packet scheduling algorithm.
@@ -186,6 +191,7 @@ config NET_SCH_DSMARK config NET_SCH_NETEM tristate "Network emulator (NETEM)" + select NET_SCH_PC ---help--- Say Y if you want to emulate network delay, loss, and packet re-ordering. This is often useful to simulate networks when
net/sched/Makefile +1 -0
@@ -14,6 +14,7 @@ obj-$(CONFIG_NET_ACT_IPT) += act_ipt.o obj-$(CONFIG_NET_ACT_NAT) += act_nat.o obj-$(CONFIG_NET_ACT_PEDIT) += act_pedit.o obj-$(CONFIG_NET_ACT_SIMP) += act_simple.o +obj-$(CONFIG_NET_SCH_PC) += sch_pseudo_classful.o obj-$(CONFIG_NET_SCH_FIFO) += sch_fifo.o obj-$(CONFIG_NET_SCH_CBQ) += sch_cbq.o obj-$(CONFIG_NET_SCH_HTB) += sch_htb.o
net/sched/sch_netem.c +18 -103
203 lines not on this page · raw message
net/sched/sch_pseudo_classful.c new file +101 -0
101 lines not on this page · raw message
net/sched/sch_red.c +13 -95
175 lines not on this page · raw message
net/sched/sch_tbf.c +14 -101
189 lines not on this page · raw message