diff options
author | Jussi Kivilinna <jussi.kivilinna@mbnet.fi> | 2008-07-20 03:08:27 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-07-20 03:08:27 -0400 |
commit | 0abf77e55a2459aa9905be4b226e4729d5b4f0cb (patch) | |
tree | 0224961150c0c2c65b5ad407b1af8cf84266e919 /include/net/sch_generic.h | |
parent | 5f86173bdf15981ca49d0434f638b68f70a35644 (diff) |
net_sched: Add accessor function for packet length for qdiscs
Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/sch_generic.h')
-rw-r--r-- | include/net/sch_generic.h | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h index f396dff335a3..8229520e088a 100644 --- a/include/net/sch_generic.h +++ b/include/net/sch_generic.h | |||
@@ -306,6 +306,11 @@ static inline bool qdisc_tx_is_noop(const struct net_device *dev) | |||
306 | return true; | 306 | return true; |
307 | } | 307 | } |
308 | 308 | ||
309 | static inline unsigned int qdisc_pkt_len(struct sk_buff *skb) | ||
310 | { | ||
311 | return skb->len; | ||
312 | } | ||
313 | |||
309 | static inline int qdisc_enqueue(struct sk_buff *skb, struct Qdisc *sch) | 314 | static inline int qdisc_enqueue(struct sk_buff *skb, struct Qdisc *sch) |
310 | { | 315 | { |
311 | return sch->enqueue(skb, sch); | 316 | return sch->enqueue(skb, sch); |
@@ -320,8 +325,8 @@ static inline int __qdisc_enqueue_tail(struct sk_buff *skb, struct Qdisc *sch, | |||
320 | struct sk_buff_head *list) | 325 | struct sk_buff_head *list) |
321 | { | 326 | { |
322 | __skb_queue_tail(list, skb); | 327 | __skb_queue_tail(list, skb); |
323 | sch->qstats.backlog += skb->len; | 328 | sch->qstats.backlog += qdisc_pkt_len(skb); |
324 | sch->bstats.bytes += skb->len; | 329 | sch->bstats.bytes += qdisc_pkt_len(skb); |
325 | sch->bstats.packets++; | 330 | sch->bstats.packets++; |
326 | 331 | ||
327 | return NET_XMIT_SUCCESS; | 332 | return NET_XMIT_SUCCESS; |
@@ -338,7 +343,7 @@ static inline struct sk_buff *__qdisc_dequeue_head(struct Qdisc *sch, | |||
338 | struct sk_buff *skb = __skb_dequeue(list); | 343 | struct sk_buff *skb = __skb_dequeue(list); |
339 | 344 | ||
340 | if (likely(skb != NULL)) | 345 | if (likely(skb != NULL)) |
341 | sch->qstats.backlog -= skb->len; | 346 | sch->qstats.backlog -= qdisc_pkt_len(skb); |
342 | 347 | ||
343 | return skb; | 348 | return skb; |
344 | } | 349 | } |
@@ -354,7 +359,7 @@ static inline struct sk_buff *__qdisc_dequeue_tail(struct Qdisc *sch, | |||
354 | struct sk_buff *skb = __skb_dequeue_tail(list); | 359 | struct sk_buff *skb = __skb_dequeue_tail(list); |
355 | 360 | ||
356 | if (likely(skb != NULL)) | 361 | if (likely(skb != NULL)) |
357 | sch->qstats.backlog -= skb->len; | 362 | sch->qstats.backlog -= qdisc_pkt_len(skb); |
358 | 363 | ||
359 | return skb; | 364 | return skb; |
360 | } | 365 | } |
@@ -368,7 +373,7 @@ static inline int __qdisc_requeue(struct sk_buff *skb, struct Qdisc *sch, | |||
368 | struct sk_buff_head *list) | 373 | struct sk_buff_head *list) |
369 | { | 374 | { |
370 | __skb_queue_head(list, skb); | 375 | __skb_queue_head(list, skb); |
371 | sch->qstats.backlog += skb->len; | 376 | sch->qstats.backlog += qdisc_pkt_len(skb); |
372 | sch->qstats.requeues++; | 377 | sch->qstats.requeues++; |
373 | 378 | ||
374 | return NET_XMIT_SUCCESS; | 379 | return NET_XMIT_SUCCESS; |
@@ -401,7 +406,7 @@ static inline unsigned int __qdisc_queue_drop(struct Qdisc *sch, | |||
401 | struct sk_buff *skb = __qdisc_dequeue_tail(sch, list); | 406 | struct sk_buff *skb = __qdisc_dequeue_tail(sch, list); |
402 | 407 | ||
403 | if (likely(skb != NULL)) { | 408 | if (likely(skb != NULL)) { |
404 | unsigned int len = skb->len; | 409 | unsigned int len = qdisc_pkt_len(skb); |
405 | kfree_skb(skb); | 410 | kfree_skb(skb); |
406 | return len; | 411 | return len; |
407 | } | 412 | } |