aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/sch_generic.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/net/sch_generic.h')
-rw-r--r--include/net/sch_generic.h22
1 files changed, 20 insertions, 2 deletions
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index 5482e9582f55..c33180dd42b4 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -45,6 +45,8 @@ struct Qdisc
45#define TCQ_F_BUILTIN 1 45#define TCQ_F_BUILTIN 1
46#define TCQ_F_THROTTLED 2 46#define TCQ_F_THROTTLED 2
47#define TCQ_F_INGRESS 4 47#define TCQ_F_INGRESS 4
48#define TCQ_F_CAN_BYPASS 8
49#define TCQ_F_MQROOT 16
48#define TCQ_F_WARN_NONWC (1 << 16) 50#define TCQ_F_WARN_NONWC (1 << 16)
49 int padded; 51 int padded;
50 struct Qdisc_ops *ops; 52 struct Qdisc_ops *ops;
@@ -79,6 +81,7 @@ struct Qdisc
79struct Qdisc_class_ops 81struct Qdisc_class_ops
80{ 82{
81 /* Child qdisc manipulation */ 83 /* Child qdisc manipulation */
84 struct netdev_queue * (*select_queue)(struct Qdisc *, struct tcmsg *);
82 int (*graft)(struct Qdisc *, unsigned long cl, 85 int (*graft)(struct Qdisc *, unsigned long cl,
83 struct Qdisc *, struct Qdisc **); 86 struct Qdisc *, struct Qdisc **);
84 struct Qdisc * (*leaf)(struct Qdisc *, unsigned long cl); 87 struct Qdisc * (*leaf)(struct Qdisc *, unsigned long cl);
@@ -121,6 +124,7 @@ struct Qdisc_ops
121 void (*reset)(struct Qdisc *); 124 void (*reset)(struct Qdisc *);
122 void (*destroy)(struct Qdisc *); 125 void (*destroy)(struct Qdisc *);
123 int (*change)(struct Qdisc *, struct nlattr *arg); 126 int (*change)(struct Qdisc *, struct nlattr *arg);
127 void (*attach)(struct Qdisc *);
124 128
125 int (*dump)(struct Qdisc *, struct sk_buff *); 129 int (*dump)(struct Qdisc *, struct sk_buff *);
126 int (*dump_stats)(struct Qdisc *, struct gnet_dump *); 130 int (*dump_stats)(struct Qdisc *, struct gnet_dump *);
@@ -182,6 +186,11 @@ struct qdisc_skb_cb {
182 char data[]; 186 char data[];
183}; 187};
184 188
189static inline int qdisc_qlen(struct Qdisc *q)
190{
191 return q->q.qlen;
192}
193
185static inline struct qdisc_skb_cb *qdisc_skb_cb(struct sk_buff *skb) 194static inline struct qdisc_skb_cb *qdisc_skb_cb(struct sk_buff *skb)
186{ 195{
187 return (struct qdisc_skb_cb *)skb->cb; 196 return (struct qdisc_skb_cb *)skb->cb;
@@ -249,6 +258,8 @@ static inline void sch_tree_unlock(struct Qdisc *q)
249 258
250extern struct Qdisc noop_qdisc; 259extern struct Qdisc noop_qdisc;
251extern struct Qdisc_ops noop_qdisc_ops; 260extern struct Qdisc_ops noop_qdisc_ops;
261extern struct Qdisc_ops pfifo_fast_ops;
262extern struct Qdisc_ops mq_qdisc_ops;
252 263
253struct Qdisc_class_common 264struct Qdisc_class_common
254{ 265{
@@ -296,6 +307,8 @@ extern void dev_init_scheduler(struct net_device *dev);
296extern void dev_shutdown(struct net_device *dev); 307extern void dev_shutdown(struct net_device *dev);
297extern void dev_activate(struct net_device *dev); 308extern void dev_activate(struct net_device *dev);
298extern void dev_deactivate(struct net_device *dev); 309extern void dev_deactivate(struct net_device *dev);
310extern struct Qdisc *dev_graft_qdisc(struct netdev_queue *dev_queue,
311 struct Qdisc *qdisc);
299extern void qdisc_reset(struct Qdisc *qdisc); 312extern void qdisc_reset(struct Qdisc *qdisc);
300extern void qdisc_destroy(struct Qdisc *qdisc); 313extern void qdisc_destroy(struct Qdisc *qdisc);
301extern void qdisc_tree_decrease_qlen(struct Qdisc *qdisc, unsigned int n); 314extern void qdisc_tree_decrease_qlen(struct Qdisc *qdisc, unsigned int n);
@@ -387,13 +400,18 @@ static inline int qdisc_enqueue_root(struct sk_buff *skb, struct Qdisc *sch)
387 return qdisc_enqueue(skb, sch) & NET_XMIT_MASK; 400 return qdisc_enqueue(skb, sch) & NET_XMIT_MASK;
388} 401}
389 402
403static inline void __qdisc_update_bstats(struct Qdisc *sch, unsigned int len)
404{
405 sch->bstats.bytes += len;
406 sch->bstats.packets++;
407}
408
390static inline int __qdisc_enqueue_tail(struct sk_buff *skb, struct Qdisc *sch, 409static inline int __qdisc_enqueue_tail(struct sk_buff *skb, struct Qdisc *sch,
391 struct sk_buff_head *list) 410 struct sk_buff_head *list)
392{ 411{
393 __skb_queue_tail(list, skb); 412 __skb_queue_tail(list, skb);
394 sch->qstats.backlog += qdisc_pkt_len(skb); 413 sch->qstats.backlog += qdisc_pkt_len(skb);
395 sch->bstats.bytes += qdisc_pkt_len(skb); 414 __qdisc_update_bstats(sch, qdisc_pkt_len(skb));
396 sch->bstats.packets++;
397 415
398 return NET_XMIT_SUCCESS; 416 return NET_XMIT_SUCCESS;
399} 417}