diff options
author | Jarek Poplawski <jarkao2@gmail.com> | 2008-10-31 03:46:19 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-10-31 03:46:19 -0400 |
commit | 03c05f0d4bb0c267edf12d614025a40e33c5a6f9 (patch) | |
tree | c23b79ed8b7dfcdabb872f5c114541ae2de8ac0f /net/sched/sch_tbf.c | |
parent | 8e3af97899db433111287e07d5105189f56fe191 (diff) |
pkt_sched: Use qdisc->ops->peek() instead of ->dequeue() & ->requeue()
Use qdisc->ops->peek() instead of ->dequeue() & ->requeue() pair.
After this patch the only remaining user of qdisc->ops->requeue() is
netem_enqueue(). Based on ideas of Herbert Xu, Patrick McHardy and
David S. Miller.
Signed-off-by: Jarek Poplawski <jarkao2@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/sch_tbf.c')
-rw-r--r-- | net/sched/sch_tbf.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/net/sched/sch_tbf.c b/net/sched/sch_tbf.c index 94c61598b86a..61fdc77a48d2 100644 --- a/net/sched/sch_tbf.c +++ b/net/sched/sch_tbf.c | |||
@@ -169,7 +169,7 @@ static struct sk_buff *tbf_dequeue(struct Qdisc* sch) | |||
169 | struct tbf_sched_data *q = qdisc_priv(sch); | 169 | struct tbf_sched_data *q = qdisc_priv(sch); |
170 | struct sk_buff *skb; | 170 | struct sk_buff *skb; |
171 | 171 | ||
172 | skb = q->qdisc->dequeue(q->qdisc); | 172 | skb = q->qdisc->ops->peek(q->qdisc); |
173 | 173 | ||
174 | if (skb) { | 174 | if (skb) { |
175 | psched_time_t now; | 175 | psched_time_t now; |
@@ -192,6 +192,10 @@ static struct sk_buff *tbf_dequeue(struct Qdisc* sch) | |||
192 | toks -= L2T(q, len); | 192 | toks -= L2T(q, len); |
193 | 193 | ||
194 | if ((toks|ptoks) >= 0) { | 194 | if ((toks|ptoks) >= 0) { |
195 | skb = q->qdisc->dequeue(q->qdisc); | ||
196 | if (unlikely(!skb)) | ||
197 | return NULL; | ||
198 | |||
195 | q->t_c = now; | 199 | q->t_c = now; |
196 | q->tokens = toks; | 200 | q->tokens = toks; |
197 | q->ptokens = ptoks; | 201 | q->ptokens = ptoks; |
@@ -214,12 +218,6 @@ static struct sk_buff *tbf_dequeue(struct Qdisc* sch) | |||
214 | (cf. CSZ, HPFQ, HFSC) | 218 | (cf. CSZ, HPFQ, HFSC) |
215 | */ | 219 | */ |
216 | 220 | ||
217 | if (q->qdisc->ops->requeue(skb, q->qdisc) != NET_XMIT_SUCCESS) { | ||
218 | /* When requeue fails skb is dropped */ | ||
219 | qdisc_tree_decrease_qlen(q->qdisc, 1); | ||
220 | sch->qstats.drops++; | ||
221 | } | ||
222 | |||
223 | sch->qstats.overlimits++; | 221 | sch->qstats.overlimits++; |
224 | } | 222 | } |
225 | return NULL; | 223 | return NULL; |