Commit 0babba3d authored by Stephen Hemminger's avatar Stephen Hemminger Committed by David S. Miller

[PKT_SCHED]: Cache align qdisc data.

This patch has qdisc code use the same interface as the
netdevice code to cache align the object private data.
Signed-off-by: default avatarStephen Hemminger <shemminger@osdl.org>
Signed-off-by: default avatarDavid S. Miller <davem@redhat.com>
parent 33f5782f
...@@ -77,6 +77,7 @@ struct Qdisc ...@@ -77,6 +77,7 @@ struct Qdisc
#define TCQ_F_BUILTIN 1 #define TCQ_F_BUILTIN 1
#define TCQ_F_THROTTLED 2 #define TCQ_F_THROTTLED 2
#define TCQ_F_INGRES 4 #define TCQ_F_INGRES 4
int padded;
struct Qdisc_ops *ops; struct Qdisc_ops *ops;
u32 handle; u32 handle;
atomic_t refcnt; atomic_t refcnt;
...@@ -93,10 +94,17 @@ struct Qdisc ...@@ -93,10 +94,17 @@ struct Qdisc
* and it will live until better solution will be invented. * and it will live until better solution will be invented.
*/ */
struct Qdisc *__parent; struct Qdisc *__parent;
char data[0];
}; };
#define QDISC_ALIGN 32
#define QDISC_ALIGN_CONST (QDISC_ALIGN - 1)
static inline void *qdisc_priv(struct Qdisc *q)
{
return (char *)q + ((sizeof(struct Qdisc) + QDISC_ALIGN_CONST)
& ~QDISC_ALIGN_CONST);
}
struct qdisc_rate_table struct qdisc_rate_table
{ {
struct tc_ratespec rate; struct tc_ratespec rate;
......
This diff is collapsed.
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#endif #endif
#define PRIV(sch) ((struct dsmark_qdisc_data *) (sch)->data) #define PRIV(sch) qdisc_priv(sch)
/* /*
......
...@@ -45,7 +45,7 @@ struct fifo_sched_data ...@@ -45,7 +45,7 @@ struct fifo_sched_data
static int static int
bfifo_enqueue(struct sk_buff *skb, struct Qdisc* sch) bfifo_enqueue(struct sk_buff *skb, struct Qdisc* sch)
{ {
struct fifo_sched_data *q = (struct fifo_sched_data *)sch->data; struct fifo_sched_data *q = qdisc_priv(sch);
if (sch->stats.backlog + skb->len <= q->limit) { if (sch->stats.backlog + skb->len <= q->limit) {
__skb_queue_tail(&sch->q, skb); __skb_queue_tail(&sch->q, skb);
...@@ -106,7 +106,7 @@ fifo_reset(struct Qdisc* sch) ...@@ -106,7 +106,7 @@ fifo_reset(struct Qdisc* sch)
static int static int
pfifo_enqueue(struct sk_buff *skb, struct Qdisc* sch) pfifo_enqueue(struct sk_buff *skb, struct Qdisc* sch)
{ {
struct fifo_sched_data *q = (struct fifo_sched_data *)sch->data; struct fifo_sched_data *q = qdisc_priv(sch);
if (sch->q.qlen < q->limit) { if (sch->q.qlen < q->limit) {
__skb_queue_tail(&sch->q, skb); __skb_queue_tail(&sch->q, skb);
...@@ -138,7 +138,7 @@ pfifo_dequeue(struct Qdisc* sch) ...@@ -138,7 +138,7 @@ pfifo_dequeue(struct Qdisc* sch)
static int fifo_init(struct Qdisc *sch, struct rtattr *opt) static int fifo_init(struct Qdisc *sch, struct rtattr *opt)
{ {
struct fifo_sched_data *q = (void*)sch->data; struct fifo_sched_data *q = qdisc_priv(sch);
if (opt == NULL) { if (opt == NULL) {
unsigned int limit = sch->dev->tx_queue_len ? : 1; unsigned int limit = sch->dev->tx_queue_len ? : 1;
...@@ -158,7 +158,7 @@ static int fifo_init(struct Qdisc *sch, struct rtattr *opt) ...@@ -158,7 +158,7 @@ static int fifo_init(struct Qdisc *sch, struct rtattr *opt)
static int fifo_dump(struct Qdisc *sch, struct sk_buff *skb) static int fifo_dump(struct Qdisc *sch, struct sk_buff *skb)
{ {
struct fifo_sched_data *q = (void*)sch->data; struct fifo_sched_data *q = qdisc_priv(sch);
unsigned char *b = skb->tail; unsigned char *b = skb->tail;
struct tc_fifo_qopt opt; struct tc_fifo_qopt opt;
......
...@@ -285,10 +285,9 @@ static const u8 prio2band[TC_PRIO_MAX+1] = ...@@ -285,10 +285,9 @@ static const u8 prio2band[TC_PRIO_MAX+1] =
static int static int
pfifo_fast_enqueue(struct sk_buff *skb, struct Qdisc* qdisc) pfifo_fast_enqueue(struct sk_buff *skb, struct Qdisc* qdisc)
{ {
struct sk_buff_head *list; struct sk_buff_head *list = qdisc_priv(qdisc);
list = ((struct sk_buff_head*)qdisc->data) + list += prio2band[skb->priority&TC_PRIO_MAX];
prio2band[skb->priority&TC_PRIO_MAX];
if (list->qlen < qdisc->dev->tx_queue_len) { if (list->qlen < qdisc->dev->tx_queue_len) {
__skb_queue_tail(list, skb); __skb_queue_tail(list, skb);
...@@ -306,7 +305,7 @@ static struct sk_buff * ...@@ -306,7 +305,7 @@ static struct sk_buff *
pfifo_fast_dequeue(struct Qdisc* qdisc) pfifo_fast_dequeue(struct Qdisc* qdisc)
{ {
int prio; int prio;
struct sk_buff_head *list = ((struct sk_buff_head*)qdisc->data); struct sk_buff_head *list = qdisc_priv(qdisc);
struct sk_buff *skb; struct sk_buff *skb;
for (prio = 0; prio < 3; prio++, list++) { for (prio = 0; prio < 3; prio++, list++) {
...@@ -322,10 +321,9 @@ pfifo_fast_dequeue(struct Qdisc* qdisc) ...@@ -322,10 +321,9 @@ pfifo_fast_dequeue(struct Qdisc* qdisc)
static int static int
pfifo_fast_requeue(struct sk_buff *skb, struct Qdisc* qdisc) pfifo_fast_requeue(struct sk_buff *skb, struct Qdisc* qdisc)
{ {
struct sk_buff_head *list; struct sk_buff_head *list = qdisc_priv(qdisc);
list = ((struct sk_buff_head*)qdisc->data) + list += prio2band[skb->priority&TC_PRIO_MAX];
prio2band[skb->priority&TC_PRIO_MAX];
__skb_queue_head(list, skb); __skb_queue_head(list, skb);
qdisc->q.qlen++; qdisc->q.qlen++;
...@@ -336,7 +334,7 @@ static void ...@@ -336,7 +334,7 @@ static void
pfifo_fast_reset(struct Qdisc* qdisc) pfifo_fast_reset(struct Qdisc* qdisc)
{ {
int prio; int prio;
struct sk_buff_head *list = ((struct sk_buff_head*)qdisc->data); struct sk_buff_head *list = qdisc_priv(qdisc);
for (prio=0; prio < 3; prio++) for (prio=0; prio < 3; prio++)
skb_queue_purge(list+prio); skb_queue_purge(list+prio);
...@@ -361,9 +359,7 @@ static int pfifo_fast_dump(struct Qdisc *qdisc, struct sk_buff *skb) ...@@ -361,9 +359,7 @@ static int pfifo_fast_dump(struct Qdisc *qdisc, struct sk_buff *skb)
static int pfifo_fast_init(struct Qdisc *qdisc, struct rtattr *opt) static int pfifo_fast_init(struct Qdisc *qdisc, struct rtattr *opt)
{ {
int i; int i;
struct sk_buff_head *list; struct sk_buff_head *list = qdisc_priv(qdisc);
list = ((struct sk_buff_head*)qdisc->data);
for (i=0; i<3; i++) for (i=0; i<3; i++)
skb_queue_head_init(list+i); skb_queue_head_init(list+i);
...@@ -387,13 +383,22 @@ static struct Qdisc_ops pfifo_fast_ops = { ...@@ -387,13 +383,22 @@ static struct Qdisc_ops pfifo_fast_ops = {
struct Qdisc * qdisc_create_dflt(struct net_device *dev, struct Qdisc_ops *ops) struct Qdisc * qdisc_create_dflt(struct net_device *dev, struct Qdisc_ops *ops)
{ {
void *p;
struct Qdisc *sch; struct Qdisc *sch;
int size = sizeof(*sch) + ops->priv_size; int size;
/* ensure that the Qdisc and the private data are 32-byte aligned */
size = ((sizeof(*sch) + QDISC_ALIGN_CONST) & ~QDISC_ALIGN_CONST);
size += ops->priv_size + QDISC_ALIGN_CONST;
sch = kmalloc(size, GFP_KERNEL); p = kmalloc(size, GFP_KERNEL);
if (!sch) if (!p)
return NULL; return NULL;
memset(sch, 0, size); memset(p, 0, size);
sch = (struct Qdisc *)(((unsigned long)p + QDISC_ALIGN_CONST)
& ~QDISC_ALIGN_CONST);
sch->padded = (char *)sch - (char *)p;
INIT_LIST_HEAD(&sch->list); INIT_LIST_HEAD(&sch->list);
skb_queue_head_init(&sch->q); skb_queue_head_init(&sch->q);
...@@ -410,7 +415,7 @@ struct Qdisc * qdisc_create_dflt(struct net_device *dev, struct Qdisc_ops *ops) ...@@ -410,7 +415,7 @@ struct Qdisc * qdisc_create_dflt(struct net_device *dev, struct Qdisc_ops *ops)
if (!ops->init || ops->init(sch, NULL) == 0) if (!ops->init || ops->init(sch, NULL) == 0)
return sch; return sch;
kfree(sch); kfree(p);
return NULL; return NULL;
} }
...@@ -445,7 +450,7 @@ static void __qdisc_destroy(struct rcu_head *head) ...@@ -445,7 +450,7 @@ static void __qdisc_destroy(struct rcu_head *head)
dev_put(qdisc->dev); dev_put(qdisc->dev);
if (!(qdisc->flags&TCQ_F_BUILTIN)) if (!(qdisc->flags&TCQ_F_BUILTIN))
kfree(qdisc); kfree((char *) qdisc - qdisc->padded);
} }
/* Under dev->queue_lock and BH! */ /* Under dev->queue_lock and BH! */
......
...@@ -106,7 +106,7 @@ gred_enqueue(struct sk_buff *skb, struct Qdisc* sch) ...@@ -106,7 +106,7 @@ gred_enqueue(struct sk_buff *skb, struct Qdisc* sch)
{ {
psched_time_t now; psched_time_t now;
struct gred_sched_data *q=NULL; struct gred_sched_data *q=NULL;
struct gred_sched *t= (struct gred_sched *)sch->data; struct gred_sched *t= qdisc_priv(sch);
unsigned long qave=0; unsigned long qave=0;
int i=0; int i=0;
...@@ -215,7 +215,7 @@ static int ...@@ -215,7 +215,7 @@ static int
gred_requeue(struct sk_buff *skb, struct Qdisc* sch) gred_requeue(struct sk_buff *skb, struct Qdisc* sch)
{ {
struct gred_sched_data *q; struct gred_sched_data *q;
struct gred_sched *t= (struct gred_sched *)sch->data; struct gred_sched *t= qdisc_priv(sch);
q= t->tab[(skb->tc_index&0xf)]; q= t->tab[(skb->tc_index&0xf)];
/* error checking here -- probably unnecessary */ /* error checking here -- probably unnecessary */
PSCHED_SET_PASTPERFECT(q->qidlestart); PSCHED_SET_PASTPERFECT(q->qidlestart);
...@@ -231,7 +231,7 @@ gred_dequeue(struct Qdisc* sch) ...@@ -231,7 +231,7 @@ gred_dequeue(struct Qdisc* sch)
{ {
struct sk_buff *skb; struct sk_buff *skb;
struct gred_sched_data *q; struct gred_sched_data *q;
struct gred_sched *t= (struct gred_sched *)sch->data; struct gred_sched *t= qdisc_priv(sch);
skb = __skb_dequeue(&sch->q); skb = __skb_dequeue(&sch->q);
if (skb) { if (skb) {
...@@ -264,7 +264,7 @@ static unsigned int gred_drop(struct Qdisc* sch) ...@@ -264,7 +264,7 @@ static unsigned int gred_drop(struct Qdisc* sch)
struct sk_buff *skb; struct sk_buff *skb;
struct gred_sched_data *q; struct gred_sched_data *q;
struct gred_sched *t= (struct gred_sched *)sch->data; struct gred_sched *t= qdisc_priv(sch);
skb = __skb_dequeue_tail(&sch->q); skb = __skb_dequeue_tail(&sch->q);
if (skb) { if (skb) {
...@@ -300,7 +300,7 @@ static void gred_reset(struct Qdisc* sch) ...@@ -300,7 +300,7 @@ static void gred_reset(struct Qdisc* sch)
{ {
int i; int i;
struct gred_sched_data *q; struct gred_sched_data *q;
struct gred_sched *t= (struct gred_sched *)sch->data; struct gred_sched *t= qdisc_priv(sch);
__skb_queue_purge(&sch->q); __skb_queue_purge(&sch->q);
...@@ -323,7 +323,7 @@ static void gred_reset(struct Qdisc* sch) ...@@ -323,7 +323,7 @@ static void gred_reset(struct Qdisc* sch)
static int gred_change(struct Qdisc *sch, struct rtattr *opt) static int gred_change(struct Qdisc *sch, struct rtattr *opt)
{ {
struct gred_sched *table = (struct gred_sched *)sch->data; struct gred_sched *table = qdisc_priv(sch);
struct gred_sched_data *q; struct gred_sched_data *q;
struct tc_gred_qopt *ctl; struct tc_gred_qopt *ctl;
struct tc_gred_sopt *sopt; struct tc_gred_sopt *sopt;
...@@ -469,7 +469,7 @@ static int gred_change(struct Qdisc *sch, struct rtattr *opt) ...@@ -469,7 +469,7 @@ static int gred_change(struct Qdisc *sch, struct rtattr *opt)
static int gred_init(struct Qdisc *sch, struct rtattr *opt) static int gred_init(struct Qdisc *sch, struct rtattr *opt)
{ {
struct gred_sched *table = (struct gred_sched *)sch->data; struct gred_sched *table = qdisc_priv(sch);
struct tc_gred_sopt *sopt; struct tc_gred_sopt *sopt;
struct rtattr *tb[TCA_GRED_STAB]; struct rtattr *tb[TCA_GRED_STAB];
struct rtattr *tb2[TCA_GRED_DPS]; struct rtattr *tb2[TCA_GRED_DPS];
...@@ -502,7 +502,7 @@ static int gred_dump(struct Qdisc *sch, struct sk_buff *skb) ...@@ -502,7 +502,7 @@ static int gred_dump(struct Qdisc *sch, struct sk_buff *skb)
struct rtattr *rta; struct rtattr *rta;
struct tc_gred_qopt *opt = NULL ; struct tc_gred_qopt *opt = NULL ;
struct tc_gred_qopt *dst; struct tc_gred_qopt *dst;
struct gred_sched *table = (struct gred_sched *)sch->data; struct gred_sched *table = qdisc_priv(sch);
struct gred_sched_data *q; struct gred_sched_data *q;
int i; int i;
unsigned char *b = skb->tail; unsigned char *b = skb->tail;
...@@ -593,7 +593,7 @@ static int gred_dump(struct Qdisc *sch, struct sk_buff *skb) ...@@ -593,7 +593,7 @@ static int gred_dump(struct Qdisc *sch, struct sk_buff *skb)
static void gred_destroy(struct Qdisc *sch) static void gred_destroy(struct Qdisc *sch)
{ {
struct gred_sched *table = (struct gred_sched *)sch->data; struct gred_sched *table = qdisc_priv(sch);
int i; int i;
for (i = 0;i < table->DPs; i++) { for (i = 0;i < table->DPs; i++) {
......
...@@ -1016,7 +1016,7 @@ hfsc_hash(u32 h) ...@@ -1016,7 +1016,7 @@ hfsc_hash(u32 h)
static inline struct hfsc_class * static inline struct hfsc_class *
hfsc_find_class(u32 classid, struct Qdisc *sch) hfsc_find_class(u32 classid, struct Qdisc *sch)
{ {
struct hfsc_sched *q = (struct hfsc_sched *)sch->data; struct hfsc_sched *q = qdisc_priv(sch);
struct hfsc_class *cl; struct hfsc_class *cl;
list_for_each_entry(cl, &q->clhash[hfsc_hash(classid)], hlist) { list_for_each_entry(cl, &q->clhash[hfsc_hash(classid)], hlist) {
...@@ -1061,7 +1061,7 @@ static int ...@@ -1061,7 +1061,7 @@ static int
hfsc_change_class(struct Qdisc *sch, u32 classid, u32 parentid, hfsc_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
struct rtattr **tca, unsigned long *arg) struct rtattr **tca, unsigned long *arg)
{ {
struct hfsc_sched *q = (struct hfsc_sched *)sch->data; struct hfsc_sched *q = qdisc_priv(sch);
struct hfsc_class *cl = (struct hfsc_class *)*arg; struct hfsc_class *cl = (struct hfsc_class *)*arg;
struct hfsc_class *parent = NULL; struct hfsc_class *parent = NULL;
struct rtattr *opt = tca[TCA_OPTIONS-1]; struct rtattr *opt = tca[TCA_OPTIONS-1];
...@@ -1204,7 +1204,7 @@ hfsc_destroy_filters(struct tcf_proto **fl) ...@@ -1204,7 +1204,7 @@ hfsc_destroy_filters(struct tcf_proto **fl)
static void static void
hfsc_destroy_class(struct Qdisc *sch, struct hfsc_class *cl) hfsc_destroy_class(struct Qdisc *sch, struct hfsc_class *cl)
{ {
struct hfsc_sched *q = (struct hfsc_sched *)sch->data; struct hfsc_sched *q = qdisc_priv(sch);
hfsc_destroy_filters(&cl->filter_list); hfsc_destroy_filters(&cl->filter_list);
qdisc_destroy(cl->qdisc); qdisc_destroy(cl->qdisc);
...@@ -1218,7 +1218,7 @@ hfsc_destroy_class(struct Qdisc *sch, struct hfsc_class *cl) ...@@ -1218,7 +1218,7 @@ hfsc_destroy_class(struct Qdisc *sch, struct hfsc_class *cl)
static int static int
hfsc_delete_class(struct Qdisc *sch, unsigned long arg) hfsc_delete_class(struct Qdisc *sch, unsigned long arg)
{ {
struct hfsc_sched *q = (struct hfsc_sched *)sch->data; struct hfsc_sched *q = qdisc_priv(sch);
struct hfsc_class *cl = (struct hfsc_class *)arg; struct hfsc_class *cl = (struct hfsc_class *)arg;
if (cl->level > 0 || cl->filter_cnt > 0 || cl == &q->root) if (cl->level > 0 || cl->filter_cnt > 0 || cl == &q->root)
...@@ -1240,7 +1240,7 @@ hfsc_delete_class(struct Qdisc *sch, unsigned long arg) ...@@ -1240,7 +1240,7 @@ hfsc_delete_class(struct Qdisc *sch, unsigned long arg)
static struct hfsc_class * static struct hfsc_class *
hfsc_classify(struct sk_buff *skb, struct Qdisc *sch, int *qres) hfsc_classify(struct sk_buff *skb, struct Qdisc *sch, int *qres)
{ {
struct hfsc_sched *q = (struct hfsc_sched *)sch->data; struct hfsc_sched *q = qdisc_priv(sch);
struct hfsc_class *cl; struct hfsc_class *cl;
struct tcf_result res; struct tcf_result res;
struct tcf_proto *tcf; struct tcf_proto *tcf;
...@@ -1381,7 +1381,7 @@ hfsc_unbind_tcf(struct Qdisc *sch, unsigned long arg) ...@@ -1381,7 +1381,7 @@ hfsc_unbind_tcf(struct Qdisc *sch, unsigned long arg)
static struct tcf_proto ** static struct tcf_proto **
hfsc_tcf_chain(struct Qdisc *sch, unsigned long arg) hfsc_tcf_chain(struct Qdisc *sch, unsigned long arg)
{ {
struct hfsc_sched *q = (struct hfsc_sched *)sch->data; struct hfsc_sched *q = qdisc_priv(sch);
struct hfsc_class *cl = (struct hfsc_class *)arg; struct hfsc_class *cl = (struct hfsc_class *)arg;
if (cl == NULL) if (cl == NULL)
...@@ -1489,7 +1489,7 @@ hfsc_dump_class(struct Qdisc *sch, unsigned long arg, struct sk_buff *skb, ...@@ -1489,7 +1489,7 @@ hfsc_dump_class(struct Qdisc *sch, unsigned long arg, struct sk_buff *skb,
static void static void
hfsc_walk(struct Qdisc *sch, struct qdisc_walker *arg) hfsc_walk(struct Qdisc *sch, struct qdisc_walker *arg)
{ {
struct hfsc_sched *q = (struct hfsc_sched *)sch->data; struct hfsc_sched *q = qdisc_priv(sch);
struct hfsc_class *cl; struct hfsc_class *cl;
unsigned int i; unsigned int i;
...@@ -1523,7 +1523,7 @@ hfsc_watchdog(unsigned long arg) ...@@ -1523,7 +1523,7 @@ hfsc_watchdog(unsigned long arg)
static void static void
hfsc_schedule_watchdog(struct Qdisc *sch, u64 cur_time) hfsc_schedule_watchdog(struct Qdisc *sch, u64 cur_time)
{ {
struct hfsc_sched *q = (struct hfsc_sched *)sch->data; struct hfsc_sched *q = qdisc_priv(sch);
struct hfsc_class *cl; struct hfsc_class *cl;
u64 next_time = 0; u64 next_time = 0;
long delay; long delay;
...@@ -1545,7 +1545,7 @@ hfsc_schedule_watchdog(struct Qdisc *sch, u64 cur_time) ...@@ -1545,7 +1545,7 @@ hfsc_schedule_watchdog(struct Qdisc *sch, u64 cur_time)
static int static int
hfsc_init_qdisc(struct Qdisc *sch, struct rtattr *opt) hfsc_init_qdisc(struct Qdisc *sch, struct rtattr *opt)
{ {
struct hfsc_sched *q = (struct hfsc_sched *)sch->data; struct hfsc_sched *q = qdisc_priv(sch);
struct tc_hfsc_qopt *qopt; struct tc_hfsc_qopt *qopt;
unsigned int i; unsigned int i;
...@@ -1585,7 +1585,7 @@ hfsc_init_qdisc(struct Qdisc *sch, struct rtattr *opt) ...@@ -1585,7 +1585,7 @@ hfsc_init_qdisc(struct Qdisc *sch, struct rtattr *opt)
static int static int
hfsc_change_qdisc(struct Qdisc *sch, struct rtattr *opt) hfsc_change_qdisc(struct Qdisc *sch, struct rtattr *opt)
{ {
struct hfsc_sched *q = (struct hfsc_sched *)sch->data; struct hfsc_sched *q = qdisc_priv(sch);
struct tc_hfsc_qopt *qopt; struct tc_hfsc_qopt *qopt;
if (opt == NULL || RTA_PAYLOAD(opt) < sizeof(*qopt)) if (opt == NULL || RTA_PAYLOAD(opt) < sizeof(*qopt))
...@@ -1632,7 +1632,7 @@ hfsc_reset_class(struct hfsc_class *cl) ...@@ -1632,7 +1632,7 @@ hfsc_reset_class(struct hfsc_class *cl)
static void static void
hfsc_reset_qdisc(struct Qdisc *sch) hfsc_reset_qdisc(struct Qdisc *sch)
{ {
struct hfsc_sched *q = (struct hfsc_sched *)sch->data; struct hfsc_sched *q = qdisc_priv(sch);
struct hfsc_class *cl; struct hfsc_class *cl;
unsigned int i; unsigned int i;
...@@ -1651,7 +1651,7 @@ hfsc_reset_qdisc(struct Qdisc *sch) ...@@ -1651,7 +1651,7 @@ hfsc_reset_qdisc(struct Qdisc *sch)
static void static void
hfsc_destroy_qdisc(struct Qdisc *sch) hfsc_destroy_qdisc(struct Qdisc *sch)
{ {
struct hfsc_sched *q = (struct hfsc_sched *)sch->data; struct hfsc_sched *q = qdisc_priv(sch);
struct hfsc_class *cl, *next; struct hfsc_class *cl, *next;
unsigned int i; unsigned int i;
...@@ -1666,7 +1666,7 @@ hfsc_destroy_qdisc(struct Qdisc *sch) ...@@ -1666,7 +1666,7 @@ hfsc_destroy_qdisc(struct Qdisc *sch)
static int static int
hfsc_dump_qdisc(struct Qdisc *sch, struct sk_buff *skb) hfsc_dump_qdisc(struct Qdisc *sch, struct sk_buff *skb)
{ {
struct hfsc_sched *q = (struct hfsc_sched *)sch->data; struct hfsc_sched *q = qdisc_priv(sch);
unsigned char *b = skb->tail; unsigned char *b = skb->tail;
struct tc_hfsc_qopt qopt; struct tc_hfsc_qopt qopt;
...@@ -1730,7 +1730,7 @@ hfsc_enqueue(struct sk_buff *skb, struct Qdisc *sch) ...@@ -1730,7 +1730,7 @@ hfsc_enqueue(struct sk_buff *skb, struct Qdisc *sch)
static struct sk_buff * static struct sk_buff *
hfsc_dequeue(struct Qdisc *sch) hfsc_dequeue(struct Qdisc *sch)
{ {
struct hfsc_sched *q = (struct hfsc_sched *)sch->data; struct hfsc_sched *q = qdisc_priv(sch);
struct hfsc_class *cl; struct hfsc_class *cl;
struct sk_buff *skb; struct sk_buff *skb;
u64 cur_time; u64 cur_time;
...@@ -1799,7 +1799,7 @@ hfsc_dequeue(struct Qdisc *sch) ...@@ -1799,7 +1799,7 @@ hfsc_dequeue(struct Qdisc *sch)
static int static int
hfsc_requeue(struct sk_buff *skb, struct Qdisc *sch) hfsc_requeue(struct sk_buff *skb, struct Qdisc *sch)
{ {
struct hfsc_sched *q = (struct hfsc_sched *)sch->data; struct hfsc_sched *q = qdisc_priv(sch);
__skb_queue_head(&q->requeue, skb); __skb_queue_head(&q->requeue, skb);
sch->q.qlen++; sch->q.qlen++;
...@@ -1809,7 +1809,7 @@ hfsc_requeue(struct sk_buff *skb, struct Qdisc *sch) ...@@ -1809,7 +1809,7 @@ hfsc_requeue(struct sk_buff *skb, struct Qdisc *sch)
static unsigned int static unsigned int
hfsc_drop(struct Qdisc *sch) hfsc_drop(struct Qdisc *sch)
{ {
struct hfsc_sched *q = (struct hfsc_sched *)sch->data; struct hfsc_sched *q = qdisc_priv(sch);
struct hfsc_class *cl; struct hfsc_class *cl;
unsigned int len; unsigned int len;
......
...@@ -267,7 +267,7 @@ static __inline__ int htb_hash(u32 h) ...@@ -267,7 +267,7 @@ static __inline__ int htb_hash(u32 h)
/* find class in global hash table using given handle */ /* find class in global hash table using given handle */
static __inline__ struct htb_class *htb_find(u32 handle, struct Qdisc *sch) static __inline__ struct htb_class *htb_find(u32 handle, struct Qdisc *sch)
{ {
struct htb_sched *q = (struct htb_sched *)sch->data; struct htb_sched *q = qdisc_priv(sch);
struct list_head *p; struct list_head *p;
if (TC_H_MAJ(handle) != sch->handle) if (TC_H_MAJ(handle) != sch->handle)
return NULL; return NULL;
...@@ -300,7 +300,7 @@ static inline u32 htb_classid(struct htb_class *cl) ...@@ -300,7 +300,7 @@ static inline u32 htb_classid(struct htb_class *cl)
static struct htb_class *htb_classify(struct sk_buff *skb, struct Qdisc *sch, int *qres) static struct htb_class *htb_classify(struct sk_buff *skb, struct Qdisc *sch, int *qres)
{ {
struct htb_sched *q = (struct htb_sched *)sch->data; struct htb_sched *q = qdisc_priv(sch);
struct htb_class *cl; struct htb_class *cl;
struct tcf_result res; struct tcf_result res;
struct tcf_proto *tcf; struct tcf_proto *tcf;
...@@ -712,7 +712,7 @@ htb_deactivate(struct htb_sched *q,struct htb_class *cl) ...@@ -712,7 +712,7 @@ htb_deactivate(struct htb_sched *q,struct htb_class *cl)
static int htb_enqueue(struct sk_buff *skb, struct Qdisc *sch) static int htb_enqueue(struct sk_buff *skb, struct Qdisc *sch)
{ {
int ret = NET_XMIT_SUCCESS; int ret = NET_XMIT_SUCCESS;
struct htb_sched *q = (struct htb_sched *)sch->data; struct htb_sched *q = qdisc_priv(sch);
struct htb_class *cl = htb_classify(skb,sch,&ret); struct htb_class *cl = htb_classify(skb,sch,&ret);
...@@ -759,7 +759,7 @@ static int htb_enqueue(struct sk_buff *skb, struct Qdisc *sch) ...@@ -759,7 +759,7 @@ static int htb_enqueue(struct sk_buff *skb, struct Qdisc *sch)
/* TODO: requeuing packet charges it to policers again !! */ /* TODO: requeuing packet charges it to policers again !! */
static int htb_requeue(struct sk_buff *skb, struct Qdisc *sch) static int htb_requeue(struct sk_buff *skb, struct Qdisc *sch)
{ {
struct htb_sched *q = (struct htb_sched *)sch->data; struct htb_sched *q = qdisc_priv(sch);
int ret = NET_XMIT_SUCCESS; int ret = NET_XMIT_SUCCESS;
struct htb_class *cl = htb_classify(skb,sch, &ret); struct htb_class *cl = htb_classify(skb,sch, &ret);
struct sk_buff *tskb; struct sk_buff *tskb;
...@@ -800,7 +800,7 @@ static void htb_timer(unsigned long arg) ...@@ -800,7 +800,7 @@ static void htb_timer(unsigned long arg)
static void htb_rate_timer(unsigned long arg) static void htb_rate_timer(unsigned long arg)
{ {
struct Qdisc *sch = (struct Qdisc*)arg; struct Qdisc *sch = (struct Qdisc*)arg;
struct htb_sched *q = (struct htb_sched *)sch->data; struct htb_sched *q = qdisc_priv(sch);
struct list_head *p; struct list_head *p;
/* lock queue so that we can muck with it */ /* lock queue so that we can muck with it */
...@@ -1060,7 +1060,7 @@ htb_dequeue_tree(struct htb_sched *q,int prio,int level) ...@@ -1060,7 +1060,7 @@ htb_dequeue_tree(struct htb_sched *q,int prio,int level)
static void htb_delay_by(struct Qdisc *sch,long delay) static void htb_delay_by(struct Qdisc *sch,long delay)
{ {
struct htb_sched *q = (struct htb_sched *)sch->data; struct htb_sched *q = qdisc_priv(sch);
if (delay <= 0) delay = 1; if (delay <= 0) delay = 1;
if (unlikely(delay > 5*HZ)) { if (unlikely(delay > 5*HZ)) {
if (net_ratelimit()) if (net_ratelimit())
...@@ -1077,7 +1077,7 @@ static void htb_delay_by(struct Qdisc *sch,long delay) ...@@ -1077,7 +1077,7 @@ static void htb_delay_by(struct Qdisc *sch,long delay)
static struct sk_buff *htb_dequeue(struct Qdisc *sch) static struct sk_buff *htb_dequeue(struct Qdisc *sch)
{ {
struct sk_buff *skb = NULL; struct sk_buff *skb = NULL;
struct htb_sched *q = (struct htb_sched *)sch->data; struct htb_sched *q = qdisc_priv(sch);
int level; int level;
long min_delay; long min_delay;
#ifdef HTB_DEBUG #ifdef HTB_DEBUG
...@@ -1147,7 +1147,7 @@ static struct sk_buff *htb_dequeue(struct Qdisc *sch) ...@@ -1147,7 +1147,7 @@ static struct sk_buff *htb_dequeue(struct Qdisc *sch)
/* try to drop from each class (by prio) until one succeed */ /* try to drop from each class (by prio) until one succeed */
static unsigned int htb_drop(struct Qdisc* sch) static unsigned int htb_drop(struct Qdisc* sch)
{ {
struct htb_sched *q = (struct htb_sched *)sch->data; struct htb_sched *q = qdisc_priv(sch);
int prio; int prio;
for (prio = TC_HTB_NUMPRIO - 1; prio >= 0; prio--) { for (prio = TC_HTB_NUMPRIO - 1; prio >= 0; prio--) {
...@@ -1172,7 +1172,7 @@ static unsigned int htb_drop(struct Qdisc* sch) ...@@ -1172,7 +1172,7 @@ static unsigned int htb_drop(struct Qdisc* sch)
/* always caled under BH & queue lock */ /* always caled under BH & queue lock */
static void htb_reset(struct Qdisc* sch) static void htb_reset(struct Qdisc* sch)
{ {
struct htb_sched *q = (struct htb_sched *)sch->data; struct htb_sched *q = qdisc_priv(sch);
int i; int i;
HTB_DBG(0,1,"htb_reset sch=%p, handle=%X\n",sch,sch->handle); HTB_DBG(0,1,"htb_reset sch=%p, handle=%X\n",sch,sch->handle);
...@@ -1210,7 +1210,7 @@ static void htb_reset(struct Qdisc* sch) ...@@ -1210,7 +1210,7 @@ static void htb_reset(struct Qdisc* sch)
static int htb_init(struct Qdisc *sch, struct rtattr *opt) static int htb_init(struct Qdisc *sch, struct rtattr *opt)
{ {
struct htb_sched *q = (struct htb_sched*)sch->data; struct htb_sched *q = qdisc_priv(sch);
struct rtattr *tb[TCA_HTB_INIT]; struct rtattr *tb[TCA_HTB_INIT];
struct tc_htb_glob *gopt; struct tc_htb_glob *gopt;
int i; int i;
...@@ -1265,7 +1265,7 @@ static int htb_init(struct Qdisc *sch, struct rtattr *opt) ...@@ -1265,7 +1265,7 @@ static int htb_init(struct Qdisc *sch, struct rtattr *opt)
static int htb_dump(struct Qdisc *sch, struct sk_buff *skb) static int htb_dump(struct Qdisc *sch, struct sk_buff *skb)
{ {
struct htb_sched *q = (struct htb_sched*)sch->data; struct htb_sched *q = qdisc_priv(sch);
unsigned char *b = skb->tail; unsigned char *b = skb->tail;
struct rtattr *rta; struct rtattr *rta;
struct tc_htb_glob gopt; struct tc_htb_glob gopt;
...@@ -1300,7 +1300,7 @@ static int htb_dump_class(struct Qdisc *sch, unsigned long arg, ...@@ -1300,7 +1300,7 @@ static int htb_dump_class(struct Qdisc *sch, unsigned long arg,
struct sk_buff *skb, struct tcmsg *tcm) struct sk_buff *skb, struct tcmsg *tcm)
{ {
#ifdef HTB_DEBUG #ifdef HTB_DEBUG
struct htb_sched *q = (struct htb_sched*)sch->data; struct htb_sched *q = qdisc_priv(sch);
#endif #endif
struct htb_class *cl = (struct htb_class*)arg; struct htb_class *cl = (struct htb_class*)arg;
unsigned char *b = skb->tail; unsigned char *b = skb->tail;
...@@ -1358,7 +1358,7 @@ static int htb_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new, ...@@ -1358,7 +1358,7 @@ static int htb_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new,
sch_tree_lock(sch); sch_tree_lock(sch);
if ((*old = xchg(&cl->un.leaf.q, new)) != NULL) { if ((*old = xchg(&cl->un.leaf.q, new)) != NULL) {
if (cl->prio_activity) if (cl->prio_activity)
htb_deactivate ((struct htb_sched*)sch->data,cl); htb_deactivate (qdisc_priv(sch),cl);
/* TODO: is it correct ? Why CBQ doesn't do it ? */ /* TODO: is it correct ? Why CBQ doesn't do it ? */
sch->q.qlen -= (*old)->q.qlen; sch->q.qlen -= (*old)->q.qlen;
...@@ -1379,7 +1379,7 @@ static struct Qdisc * htb_leaf(struct Qdisc *sch, unsigned long arg) ...@@ -1379,7 +1379,7 @@ static struct Qdisc * htb_leaf(struct Qdisc *sch, unsigned long arg)
static unsigned long htb_get(struct Qdisc *sch, u32 classid) static unsigned long htb_get(struct Qdisc *sch, u32 classid)
{ {
#ifdef HTB_DEBUG #ifdef HTB_DEBUG
struct htb_sched *q = (struct htb_sched *)sch->data; struct htb_sched *q = qdisc_priv(sch);
#endif #endif
struct htb_class *cl = htb_find(classid,sch); struct htb_class *cl = htb_find(classid,sch);
HTB_DBG(0,1,"htb_get clid=%X q=%p cl=%p ref=%d\n",classid,q,cl,cl?cl->refcnt:0); HTB_DBG(0,1,"htb_get clid=%X q=%p cl=%p ref=%d\n",classid,q,cl,cl?cl->refcnt:0);
...@@ -1400,7 +1400,7 @@ static void htb_destroy_filters(struct tcf_proto **fl) ...@@ -1400,7 +1400,7 @@ static void htb_destroy_filters(struct tcf_proto **fl)
static void htb_destroy_class(struct Qdisc* sch,struct htb_class *cl) static void htb_destroy_class(struct Qdisc* sch,struct htb_class *cl)
{ {
struct htb_sched *q = (struct htb_sched *)sch->data; struct htb_sched *q = qdisc_priv(sch);
HTB_DBG(0,1,"htb_destrycls clid=%X ref=%d\n", cl?cl->classid:0,cl?cl->refcnt:0); HTB_DBG(0,1,"htb_destrycls clid=%X ref=%d\n", cl?cl->classid:0,cl?cl->refcnt:0);
if (!cl->level) { if (!cl->level) {
BUG_TRAP(cl->un.leaf.q); BUG_TRAP(cl->un.leaf.q);
...@@ -1435,7 +1435,7 @@ static void htb_destroy_class(struct Qdisc* sch,struct htb_class *cl) ...@@ -1435,7 +1435,7 @@ static void htb_destroy_class(struct Qdisc* sch,struct htb_class *cl)
/* always caled under BH & queue lock */ /* always caled under BH & queue lock */
static void htb_destroy(struct Qdisc* sch) static void htb_destroy(struct Qdisc* sch)
{ {
struct htb_sched *q = (struct htb_sched *)sch->data; struct htb_sched *q = qdisc_priv(sch);
HTB_DBG(0,1,"htb_destroy q=%p\n",q); HTB_DBG(0,1,"htb_destroy q=%p\n",q);
del_timer_sync (&q->timer); del_timer_sync (&q->timer);
...@@ -1457,7 +1457,7 @@ static void htb_destroy(struct Qdisc* sch) ...@@ -1457,7 +1457,7 @@ static void htb_destroy(struct Qdisc* sch)
static int htb_delete(struct Qdisc *sch, unsigned long arg) static int htb_delete(struct Qdisc *sch, unsigned long arg)
{ {
struct htb_sched *q = (struct htb_sched *)sch->data; struct htb_sched *q = qdisc_priv(sch);
struct htb_class *cl = (struct htb_class*)arg; struct htb_class *cl = (struct htb_class*)arg;
HTB_DBG(0,1,"htb_delete q=%p cl=%X ref=%d\n",q,cl?cl->classid:0,cl?cl->refcnt:0); HTB_DBG(0,1,"htb_delete q=%p cl=%X ref=%d\n",q,cl?cl->classid:0,cl?cl->refcnt:0);
...@@ -1484,7 +1484,7 @@ static int htb_delete(struct Qdisc *sch, unsigned long arg) ...@@ -1484,7 +1484,7 @@ static int htb_delete(struct Qdisc *sch, unsigned long arg)
static void htb_put(struct Qdisc *sch, unsigned long arg) static void htb_put(struct Qdisc *sch, unsigned long arg)
{ {
#ifdef HTB_DEBUG #ifdef HTB_DEBUG
struct htb_sched *q = (struct htb_sched *)sch->data; struct htb_sched *q = qdisc_priv(sch);
#endif #endif
struct htb_class *cl = (struct htb_class*)arg; struct htb_class *cl = (struct htb_class*)arg;
HTB_DBG(0,1,"htb_put q=%p cl=%X ref=%d\n",q,cl?cl->classid:0,cl?cl->refcnt:0); HTB_DBG(0,1,"htb_put q=%p cl=%X ref=%d\n",q,cl?cl->classid:0,cl?cl->refcnt:0);
...@@ -1497,7 +1497,7 @@ static int htb_change_class(struct Qdisc *sch, u32 classid, ...@@ -1497,7 +1497,7 @@ static int htb_change_class(struct Qdisc *sch, u32 classid,
u32 parentid, struct rtattr **tca, unsigned long *arg) u32 parentid, struct rtattr **tca, unsigned long *arg)
{ {
int err = -EINVAL; int err = -EINVAL;
struct htb_sched *q = (struct htb_sched *)sch->data; struct htb_sched *q = qdisc_priv(sch);
struct htb_class *cl = (struct htb_class*)*arg,*parent; struct htb_class *cl = (struct htb_class*)*arg,*parent;
struct rtattr *opt = tca[TCA_OPTIONS-1]; struct rtattr *opt = tca[TCA_OPTIONS-1];
struct qdisc_rate_table *rtab = NULL, *ctab = NULL; struct qdisc_rate_table *rtab = NULL, *ctab = NULL;
...@@ -1623,7 +1623,7 @@ static int htb_change_class(struct Qdisc *sch, u32 classid, ...@@ -1623,7 +1623,7 @@ static int htb_change_class(struct Qdisc *sch, u32 classid,
static struct tcf_proto **htb_find_tcf(struct Qdisc *sch, unsigned long arg) static struct tcf_proto **htb_find_tcf(struct Qdisc *sch, unsigned long arg)
{ {
struct htb_sched *q = (struct htb_sched *)sch->data; struct htb_sched *q = qdisc_priv(sch);
struct htb_class *cl = (struct htb_class *)arg; struct htb_class *cl = (struct htb_class *)arg;
struct tcf_proto **fl = cl ? &cl->filter_list : &q->filter_list; struct tcf_proto **fl = cl ? &cl->filter_list : &q->filter_list;
HTB_DBG(0,2,"htb_tcf q=%p clid=%X fref=%d fl=%p\n",q,cl?cl->classid:0,cl?cl->filter_cnt:q->filter_cnt,*fl); HTB_DBG(0,2,"htb_tcf q=%p clid=%X fref=%d fl=%p\n",q,cl?cl->classid:0,cl?cl->filter_cnt:q->filter_cnt,*fl);
...@@ -1633,7 +1633,7 @@ static struct tcf_proto **htb_find_tcf(struct Qdisc *sch, unsigned long arg) ...@@ -1633,7 +1633,7 @@ static struct tcf_proto **htb_find_tcf(struct Qdisc *sch, unsigned long arg)
static unsigned long htb_bind_filter(struct Qdisc *sch, unsigned long parent, static unsigned long htb_bind_filter(struct Qdisc *sch, unsigned long parent,
u32 classid) u32 classid)
{ {
struct htb_sched *q = (struct htb_sched *)sch->data; struct htb_sched *q = qdisc_priv(sch);
struct htb_class *cl = htb_find (classid,sch); struct htb_class *cl = htb_find (classid,sch);
HTB_DBG(0,2,"htb_bind q=%p clid=%X cl=%p fref=%d\n",q,classid,cl,cl?cl->filter_cnt:q->filter_cnt); HTB_DBG(0,2,"htb_bind q=%p clid=%X cl=%p fref=%d\n",q,classid,cl,cl?cl->filter_cnt:q->filter_cnt);
/*if (cl && !cl->level) return 0; /*if (cl && !cl->level) return 0;
...@@ -1654,7 +1654,7 @@ static unsigned long htb_bind_filter(struct Qdisc *sch, unsigned long parent, ...@@ -1654,7 +1654,7 @@ static unsigned long htb_bind_filter(struct Qdisc *sch, unsigned long parent,
static void htb_unbind_filter(struct Qdisc *sch, unsigned long arg) static void htb_unbind_filter(struct Qdisc *sch, unsigned long arg)
{ {
struct htb_sched *q = (struct htb_sched *)sch->data; struct htb_sched *q = qdisc_priv(sch);
struct htb_class *cl = (struct htb_class *)arg; struct htb_class *cl = (struct htb_class *)arg;
HTB_DBG(0,2,"htb_unbind q=%p cl=%p fref=%d\n",q,cl,cl?cl->filter_cnt:q->filter_cnt); HTB_DBG(0,2,"htb_unbind q=%p cl=%p fref=%d\n",q,cl,cl?cl->filter_cnt:q->filter_cnt);
if (cl) if (cl)
...@@ -1665,7 +1665,7 @@ static void htb_unbind_filter(struct Qdisc *sch, unsigned long arg) ...@@ -1665,7 +1665,7 @@ static void htb_unbind_filter(struct Qdisc *sch, unsigned long arg)
static void htb_walk(struct Qdisc *sch, struct qdisc_walker *arg) static void htb_walk(struct Qdisc *sch, struct qdisc_walker *arg)
{ {
struct htb_sched *q = (struct htb_sched *)sch->data; struct htb_sched *q = qdisc_priv(sch);
int i; int i;
if (arg->stop) if (arg->stop)
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
#endif #endif
#define PRIV(sch) ((struct ingress_qdisc_data *) (sch)->data) #define PRIV(sch) qdisc_priv(sch)
/* Thanks to Doron Oz for this hack /* Thanks to Doron Oz for this hack
......
...@@ -603,7 +603,7 @@ static inline int tabledist(int mu, int sigma) ...@@ -603,7 +603,7 @@ static inline int tabledist(int mu, int sigma)
*/ */
static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch) static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch)
{ {
struct netem_sched_data *q = (struct netem_sched_data *)sch->data; struct netem_sched_data *q = qdisc_priv(sch);
struct netem_skb_cb *cb = (struct netem_skb_cb *)skb->cb; struct netem_skb_cb *cb = (struct netem_skb_cb *)skb->cb;
psched_time_t now; psched_time_t now;
long delay; long delay;
...@@ -659,7 +659,7 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch) ...@@ -659,7 +659,7 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch)
/* Requeue packets but don't change time stamp */ /* Requeue packets but don't change time stamp */
static int netem_requeue(struct sk_buff *skb, struct Qdisc *sch) static int netem_requeue(struct sk_buff *skb, struct Qdisc *sch)
{ {
struct netem_sched_data *q = (struct netem_sched_data *)sch->data; struct netem_sched_data *q = qdisc_priv(sch);
int ret; int ret;
if ((ret = q->qdisc->ops->requeue(skb, q->qdisc)) == 0) if ((ret = q->qdisc->ops->requeue(skb, q->qdisc)) == 0)
...@@ -670,7 +670,7 @@ static int netem_requeue(struct sk_buff *skb, struct Qdisc *sch) ...@@ -670,7 +670,7 @@ static int netem_requeue(struct sk_buff *skb, struct Qdisc *sch)
static unsigned int netem_drop(struct Qdisc* sch) static unsigned int netem_drop(struct Qdisc* sch)
{ {
struct netem_sched_data *q = (struct netem_sched_data *)sch->data; struct netem_sched_data *q = qdisc_priv(sch);
unsigned int len; unsigned int len;
if ((len = q->qdisc->ops->drop(q->qdisc)) != 0) { if ((len = q->qdisc->ops->drop(q->qdisc)) != 0) {
...@@ -686,7 +686,7 @@ static unsigned int netem_drop(struct Qdisc* sch) ...@@ -686,7 +686,7 @@ static unsigned int netem_drop(struct Qdisc* sch)
*/ */
static struct sk_buff *netem_dequeue(struct Qdisc *sch) static struct sk_buff *netem_dequeue(struct Qdisc *sch)
{ {
struct netem_sched_data *q = (struct netem_sched_data *)sch->data; struct netem_sched_data *q = qdisc_priv(sch);
struct sk_buff *skb; struct sk_buff *skb;
psched_time_t now; psched_time_t now;
...@@ -726,7 +726,7 @@ static void netem_watchdog(unsigned long arg) ...@@ -726,7 +726,7 @@ static void netem_watchdog(unsigned long arg)
static void netem_reset(struct Qdisc *sch) static void netem_reset(struct Qdisc *sch)
{ {
struct netem_sched_data *q = (struct netem_sched_data *)sch->data; struct netem_sched_data *q = qdisc_priv(sch);
qdisc_reset(q->qdisc); qdisc_reset(q->qdisc);
skb_queue_purge(&q->delayed); skb_queue_purge(&q->delayed);
...@@ -754,7 +754,7 @@ static int set_fifo_limit(struct Qdisc *q, int limit) ...@@ -754,7 +754,7 @@ static int set_fifo_limit(struct Qdisc *q, int limit)
static int netem_change(struct Qdisc *sch, struct rtattr *opt) static int netem_change(struct Qdisc *sch, struct rtattr *opt)
{ {
struct netem_sched_data *q = (struct netem_sched_data *)sch->data; struct netem_sched_data *q = qdisc_priv(sch);
struct tc_netem_qopt *qopt = RTA_DATA(opt); struct tc_netem_qopt *qopt = RTA_DATA(opt);
struct Qdisc *child; struct Qdisc *child;
int ret; int ret;
...@@ -791,7 +791,7 @@ static int netem_change(struct Qdisc *sch, struct rtattr *opt) ...@@ -791,7 +791,7 @@ static int netem_change(struct Qdisc *sch, struct rtattr *opt)
static int netem_init(struct Qdisc *sch, struct rtattr *opt) static int netem_init(struct Qdisc *sch, struct rtattr *opt)
{ {
struct netem_sched_data *q = (struct netem_sched_data *)sch->data; struct netem_sched_data *q = qdisc_priv(sch);
if (!opt) if (!opt)
return -EINVAL; return -EINVAL;
...@@ -809,7 +809,7 @@ static int netem_init(struct Qdisc *sch, struct rtattr *opt) ...@@ -809,7 +809,7 @@ static int netem_init(struct Qdisc *sch, struct rtattr *opt)
static void netem_destroy(struct Qdisc *sch) static void netem_destroy(struct Qdisc *sch)
{ {
struct netem_sched_data *q = (struct netem_sched_data *)sch->data; struct netem_sched_data *q = qdisc_priv(sch);
del_timer_sync(&q->timer); del_timer_sync(&q->timer);
qdisc_destroy(q->qdisc); qdisc_destroy(q->qdisc);
...@@ -817,7 +817,7 @@ static void netem_destroy(struct Qdisc *sch) ...@@ -817,7 +817,7 @@ static void netem_destroy(struct Qdisc *sch)
static int netem_dump(struct Qdisc *sch, struct sk_buff *skb) static int netem_dump(struct Qdisc *sch, struct sk_buff *skb)
{ {
struct netem_sched_data *q = (struct netem_sched_data *)sch->data; struct netem_sched_data *q = qdisc_priv(sch);
unsigned char *b = skb->tail; unsigned char *b = skb->tail;
struct tc_netem_qopt qopt; struct tc_netem_qopt qopt;
...@@ -839,7 +839,7 @@ static int netem_dump(struct Qdisc *sch, struct sk_buff *skb) ...@@ -839,7 +839,7 @@ static int netem_dump(struct Qdisc *sch, struct sk_buff *skb)
static int netem_dump_class(struct Qdisc *sch, unsigned long cl, static int netem_dump_class(struct Qdisc *sch, unsigned long cl,
struct sk_buff *skb, struct tcmsg *tcm) struct sk_buff *skb, struct tcmsg *tcm)
{ {
struct netem_sched_data *q = (struct netem_sched_data*)sch->data; struct netem_sched_data *q = qdisc_priv(sch);
if (cl != 1) /* only one class */ if (cl != 1) /* only one class */
return -ENOENT; return -ENOENT;
...@@ -853,7 +853,7 @@ static int netem_dump_class(struct Qdisc *sch, unsigned long cl, ...@@ -853,7 +853,7 @@ static int netem_dump_class(struct Qdisc *sch, unsigned long cl,
static int netem_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new, static int netem_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new,
struct Qdisc **old) struct Qdisc **old)
{ {
struct netem_sched_data *q = (struct netem_sched_data *)sch->data; struct netem_sched_data *q = qdisc_priv(sch);
if (new == NULL) if (new == NULL)
new = &noop_qdisc; new = &noop_qdisc;
...@@ -869,7 +869,7 @@ static int netem_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new, ...@@ -869,7 +869,7 @@ static int netem_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new,
static struct Qdisc *netem_leaf(struct Qdisc *sch, unsigned long arg) static struct Qdisc *netem_leaf(struct Qdisc *sch, unsigned long arg)
{ {
struct netem_sched_data *q = (struct netem_sched_data *)sch->data; struct netem_sched_data *q = qdisc_priv(sch);
return q->qdisc; return q->qdisc;
} }
......
...@@ -49,7 +49,7 @@ struct prio_sched_data ...@@ -49,7 +49,7 @@ struct prio_sched_data
struct Qdisc *prio_classify(struct sk_buff *skb, struct Qdisc *sch,int *r) struct Qdisc *prio_classify(struct sk_buff *skb, struct Qdisc *sch,int *r)
{ {
struct prio_sched_data *q = (struct prio_sched_data *)sch->data; struct prio_sched_data *q = qdisc_priv(sch);
u32 band = skb->priority; u32 band = skb->priority;
struct tcf_result res; struct tcf_result res;
...@@ -151,7 +151,7 @@ static struct sk_buff * ...@@ -151,7 +151,7 @@ static struct sk_buff *
prio_dequeue(struct Qdisc* sch) prio_dequeue(struct Qdisc* sch)
{ {
struct sk_buff *skb; struct sk_buff *skb;
struct prio_sched_data *q = (struct prio_sched_data *)sch->data; struct prio_sched_data *q = qdisc_priv(sch);
int prio; int prio;
struct Qdisc *qdisc; struct Qdisc *qdisc;
...@@ -169,7 +169,7 @@ prio_dequeue(struct Qdisc* sch) ...@@ -169,7 +169,7 @@ prio_dequeue(struct Qdisc* sch)
static unsigned int prio_drop(struct Qdisc* sch) static unsigned int prio_drop(struct Qdisc* sch)
{ {
struct prio_sched_data *q = (struct prio_sched_data *)sch->data; struct prio_sched_data *q = qdisc_priv(sch);
int prio; int prio;
unsigned int len; unsigned int len;
struct Qdisc *qdisc; struct Qdisc *qdisc;
...@@ -189,7 +189,7 @@ static void ...@@ -189,7 +189,7 @@ static void
prio_reset(struct Qdisc* sch) prio_reset(struct Qdisc* sch)
{ {
int prio; int prio;
struct prio_sched_data *q = (struct prio_sched_data *)sch->data; struct prio_sched_data *q = qdisc_priv(sch);
for (prio=0; prio<q->bands; prio++) for (prio=0; prio<q->bands; prio++)
qdisc_reset(q->queues[prio]); qdisc_reset(q->queues[prio]);
...@@ -200,7 +200,7 @@ static void ...@@ -200,7 +200,7 @@ static void
prio_destroy(struct Qdisc* sch) prio_destroy(struct Qdisc* sch)
{ {
int prio; int prio;
struct prio_sched_data *q = (struct prio_sched_data *)sch->data; struct prio_sched_data *q = qdisc_priv(sch);
struct tcf_proto *tp; struct tcf_proto *tp;
while ((tp = q->filter_list) != NULL) { while ((tp = q->filter_list) != NULL) {
...@@ -214,7 +214,7 @@ prio_destroy(struct Qdisc* sch) ...@@ -214,7 +214,7 @@ prio_destroy(struct Qdisc* sch)
static int prio_tune(struct Qdisc *sch, struct rtattr *opt) static int prio_tune(struct Qdisc *sch, struct rtattr *opt)
{ {
struct prio_sched_data *q = (struct prio_sched_data *)sch->data; struct prio_sched_data *q = qdisc_priv(sch);
struct tc_prio_qopt *qopt = RTA_DATA(opt); struct tc_prio_qopt *qopt = RTA_DATA(opt);
int i; int i;
...@@ -259,7 +259,7 @@ static int prio_tune(struct Qdisc *sch, struct rtattr *opt) ...@@ -259,7 +259,7 @@ static int prio_tune(struct Qdisc *sch, struct rtattr *opt)
static int prio_init(struct Qdisc *sch, struct rtattr *opt) static int prio_init(struct Qdisc *sch, struct rtattr *opt)
{ {
struct prio_sched_data *q = (struct prio_sched_data *)sch->data; struct prio_sched_data *q = qdisc_priv(sch);
int i; int i;
for (i=0; i<TCQ_PRIO_BANDS; i++) for (i=0; i<TCQ_PRIO_BANDS; i++)
...@@ -278,7 +278,7 @@ static int prio_init(struct Qdisc *sch, struct rtattr *opt) ...@@ -278,7 +278,7 @@ static int prio_init(struct Qdisc *sch, struct rtattr *opt)
static int prio_dump(struct Qdisc *sch, struct sk_buff *skb) static int prio_dump(struct Qdisc *sch, struct sk_buff *skb)
{ {
struct prio_sched_data *q = (struct prio_sched_data *)sch->data; struct prio_sched_data *q = qdisc_priv(sch);
unsigned char *b = skb->tail; unsigned char *b = skb->tail;
struct tc_prio_qopt opt; struct tc_prio_qopt opt;
...@@ -295,7 +295,7 @@ static int prio_dump(struct Qdisc *sch, struct sk_buff *skb) ...@@ -295,7 +295,7 @@ static int prio_dump(struct Qdisc *sch, struct sk_buff *skb)
static int prio_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new, static int prio_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new,
struct Qdisc **old) struct Qdisc **old)
{ {
struct prio_sched_data *q = (struct prio_sched_data *)sch->data; struct prio_sched_data *q = qdisc_priv(sch);
unsigned long band = arg - 1; unsigned long band = arg - 1;
if (band >= q->bands) if (band >= q->bands)
...@@ -317,7 +317,7 @@ static int prio_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new, ...@@ -317,7 +317,7 @@ static int prio_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new,
static struct Qdisc * static struct Qdisc *
prio_leaf(struct Qdisc *sch, unsigned long arg) prio_leaf(struct Qdisc *sch, unsigned long arg)
{ {
struct prio_sched_data *q = (struct prio_sched_data *)sch->data; struct prio_sched_data *q = qdisc_priv(sch);
unsigned long band = arg - 1; unsigned long band = arg - 1;
if (band >= q->bands) if (band >= q->bands)
...@@ -328,7 +328,7 @@ prio_leaf(struct Qdisc *sch, unsigned long arg) ...@@ -328,7 +328,7 @@ prio_leaf(struct Qdisc *sch, unsigned long arg)
static unsigned long prio_get(struct Qdisc *sch, u32 classid) static unsigned long prio_get(struct Qdisc *sch, u32 classid)
{ {
struct prio_sched_data *q = (struct prio_sched_data *)sch->data; struct prio_sched_data *q = qdisc_priv(sch);
unsigned long band = TC_H_MIN(classid); unsigned long band = TC_H_MIN(classid);
if (band - 1 >= q->bands) if (band - 1 >= q->bands)
...@@ -350,7 +350,7 @@ static void prio_put(struct Qdisc *q, unsigned long cl) ...@@ -350,7 +350,7 @@ static void prio_put(struct Qdisc *q, unsigned long cl)
static int prio_change(struct Qdisc *sch, u32 handle, u32 parent, struct rtattr **tca, unsigned long *arg) static int prio_change(struct Qdisc *sch, u32 handle, u32 parent, struct rtattr **tca, unsigned long *arg)
{ {
unsigned long cl = *arg; unsigned long cl = *arg;
struct prio_sched_data *q = (struct prio_sched_data *)sch->data; struct prio_sched_data *q = qdisc_priv(sch);
if (cl - 1 > q->bands) if (cl - 1 > q->bands)
return -ENOENT; return -ENOENT;
...@@ -359,7 +359,7 @@ static int prio_change(struct Qdisc *sch, u32 handle, u32 parent, struct rtattr ...@@ -359,7 +359,7 @@ static int prio_change(struct Qdisc *sch, u32 handle, u32 parent, struct rtattr
static int prio_delete(struct Qdisc *sch, unsigned long cl) static int prio_delete(struct Qdisc *sch, unsigned long cl)
{ {
struct prio_sched_data *q = (struct prio_sched_data *)sch->data; struct prio_sched_data *q = qdisc_priv(sch);
if (cl - 1 > q->bands) if (cl - 1 > q->bands)
return -ENOENT; return -ENOENT;
return 0; return 0;
...@@ -369,7 +369,7 @@ static int prio_delete(struct Qdisc *sch, unsigned long cl) ...@@ -369,7 +369,7 @@ static int prio_delete(struct Qdisc *sch, unsigned long cl)
static int prio_dump_class(struct Qdisc *sch, unsigned long cl, struct sk_buff *skb, static int prio_dump_class(struct Qdisc *sch, unsigned long cl, struct sk_buff *skb,
struct tcmsg *tcm) struct tcmsg *tcm)
{ {
struct prio_sched_data *q = (struct prio_sched_data *)sch->data; struct prio_sched_data *q = qdisc_priv(sch);
if (cl - 1 > q->bands) if (cl - 1 > q->bands)
return -ENOENT; return -ENOENT;
...@@ -381,7 +381,7 @@ static int prio_dump_class(struct Qdisc *sch, unsigned long cl, struct sk_buff * ...@@ -381,7 +381,7 @@ static int prio_dump_class(struct Qdisc *sch, unsigned long cl, struct sk_buff *
static void prio_walk(struct Qdisc *sch, struct qdisc_walker *arg) static void prio_walk(struct Qdisc *sch, struct qdisc_walker *arg)
{ {
struct prio_sched_data *q = (struct prio_sched_data *)sch->data; struct prio_sched_data *q = qdisc_priv(sch);
int prio; int prio;
if (arg->stop) if (arg->stop)
...@@ -402,7 +402,7 @@ static void prio_walk(struct Qdisc *sch, struct qdisc_walker *arg) ...@@ -402,7 +402,7 @@ static void prio_walk(struct Qdisc *sch, struct qdisc_walker *arg)
static struct tcf_proto ** prio_find_tcf(struct Qdisc *sch, unsigned long cl) static struct tcf_proto ** prio_find_tcf(struct Qdisc *sch, unsigned long cl)
{ {
struct prio_sched_data *q = (struct prio_sched_data *)sch->data; struct prio_sched_data *q = qdisc_priv(sch);
if (cl) if (cl)
return NULL; return NULL;
......
...@@ -180,7 +180,7 @@ static int red_ecn_mark(struct sk_buff *skb) ...@@ -180,7 +180,7 @@ static int red_ecn_mark(struct sk_buff *skb)
static int static int
red_enqueue(struct sk_buff *skb, struct Qdisc* sch) red_enqueue(struct sk_buff *skb, struct Qdisc* sch)
{ {
struct red_sched_data *q = (struct red_sched_data *)sch->data; struct red_sched_data *q = qdisc_priv(sch);
psched_time_t now; psched_time_t now;
...@@ -303,7 +303,7 @@ red_enqueue(struct sk_buff *skb, struct Qdisc* sch) ...@@ -303,7 +303,7 @@ red_enqueue(struct sk_buff *skb, struct Qdisc* sch)
static int static int
red_requeue(struct sk_buff *skb, struct Qdisc* sch) red_requeue(struct sk_buff *skb, struct Qdisc* sch)
{ {
struct red_sched_data *q = (struct red_sched_data *)sch->data; struct red_sched_data *q = qdisc_priv(sch);
PSCHED_SET_PASTPERFECT(q->qidlestart); PSCHED_SET_PASTPERFECT(q->qidlestart);
...@@ -316,7 +316,7 @@ static struct sk_buff * ...@@ -316,7 +316,7 @@ static struct sk_buff *
red_dequeue(struct Qdisc* sch) red_dequeue(struct Qdisc* sch)
{ {
struct sk_buff *skb; struct sk_buff *skb;
struct red_sched_data *q = (struct red_sched_data *)sch->data; struct red_sched_data *q = qdisc_priv(sch);
skb = __skb_dequeue(&sch->q); skb = __skb_dequeue(&sch->q);
if (skb) { if (skb) {
...@@ -330,7 +330,7 @@ red_dequeue(struct Qdisc* sch) ...@@ -330,7 +330,7 @@ red_dequeue(struct Qdisc* sch)
static unsigned int red_drop(struct Qdisc* sch) static unsigned int red_drop(struct Qdisc* sch)
{ {
struct sk_buff *skb; struct sk_buff *skb;
struct red_sched_data *q = (struct red_sched_data *)sch->data; struct red_sched_data *q = qdisc_priv(sch);
skb = __skb_dequeue_tail(&sch->q); skb = __skb_dequeue_tail(&sch->q);
if (skb) { if (skb) {
...@@ -347,7 +347,7 @@ static unsigned int red_drop(struct Qdisc* sch) ...@@ -347,7 +347,7 @@ static unsigned int red_drop(struct Qdisc* sch)
static void red_reset(struct Qdisc* sch) static void red_reset(struct Qdisc* sch)
{ {
struct red_sched_data *q = (struct red_sched_data *)sch->data; struct red_sched_data *q = qdisc_priv(sch);
__skb_queue_purge(&sch->q); __skb_queue_purge(&sch->q);
sch->stats.backlog = 0; sch->stats.backlog = 0;
...@@ -358,7 +358,7 @@ static void red_reset(struct Qdisc* sch) ...@@ -358,7 +358,7 @@ static void red_reset(struct Qdisc* sch)
static int red_change(struct Qdisc *sch, struct rtattr *opt) static int red_change(struct Qdisc *sch, struct rtattr *opt)
{ {
struct red_sched_data *q = (struct red_sched_data *)sch->data; struct red_sched_data *q = qdisc_priv(sch);
struct rtattr *tb[TCA_RED_STAB]; struct rtattr *tb[TCA_RED_STAB];
struct tc_red_qopt *ctl; struct tc_red_qopt *ctl;
...@@ -407,7 +407,7 @@ int red_copy_xstats(struct sk_buff *skb, struct tc_red_xstats *st) ...@@ -407,7 +407,7 @@ int red_copy_xstats(struct sk_buff *skb, struct tc_red_xstats *st)
static int red_dump(struct Qdisc *sch, struct sk_buff *skb) static int red_dump(struct Qdisc *sch, struct sk_buff *skb)
{ {
struct red_sched_data *q = (struct red_sched_data *)sch->data; struct red_sched_data *q = qdisc_priv(sch);
unsigned char *b = skb->tail; unsigned char *b = skb->tail;
struct rtattr *rta; struct rtattr *rta;
struct tc_red_qopt opt; struct tc_red_qopt opt;
......
...@@ -211,7 +211,7 @@ static inline void sfq_inc(struct sfq_sched_data *q, sfq_index x) ...@@ -211,7 +211,7 @@ static inline void sfq_inc(struct sfq_sched_data *q, sfq_index x)
static unsigned int sfq_drop(struct Qdisc *sch) static unsigned int sfq_drop(struct Qdisc *sch)
{ {
struct sfq_sched_data *q = (struct sfq_sched_data *)sch->data; struct sfq_sched_data *q = qdisc_priv(sch);
sfq_index d = q->max_depth; sfq_index d = q->max_depth;
struct sk_buff *skb; struct sk_buff *skb;
unsigned int len; unsigned int len;
...@@ -253,7 +253,7 @@ static unsigned int sfq_drop(struct Qdisc *sch) ...@@ -253,7 +253,7 @@ static unsigned int sfq_drop(struct Qdisc *sch)
static int static int
sfq_enqueue(struct sk_buff *skb, struct Qdisc* sch) sfq_enqueue(struct sk_buff *skb, struct Qdisc* sch)
{ {
struct sfq_sched_data *q = (struct sfq_sched_data *)sch->data; struct sfq_sched_data *q = qdisc_priv(sch);
unsigned hash = sfq_hash(q, skb); unsigned hash = sfq_hash(q, skb);
sfq_index x; sfq_index x;
...@@ -288,7 +288,7 @@ sfq_enqueue(struct sk_buff *skb, struct Qdisc* sch) ...@@ -288,7 +288,7 @@ sfq_enqueue(struct sk_buff *skb, struct Qdisc* sch)
static int static int
sfq_requeue(struct sk_buff *skb, struct Qdisc* sch) sfq_requeue(struct sk_buff *skb, struct Qdisc* sch)
{ {
struct sfq_sched_data *q = (struct sfq_sched_data *)sch->data; struct sfq_sched_data *q = qdisc_priv(sch);
unsigned hash = sfq_hash(q, skb); unsigned hash = sfq_hash(q, skb);
sfq_index x; sfq_index x;
...@@ -324,7 +324,7 @@ sfq_requeue(struct sk_buff *skb, struct Qdisc* sch) ...@@ -324,7 +324,7 @@ sfq_requeue(struct sk_buff *skb, struct Qdisc* sch)
static struct sk_buff * static struct sk_buff *
sfq_dequeue(struct Qdisc* sch) sfq_dequeue(struct Qdisc* sch)
{ {
struct sfq_sched_data *q = (struct sfq_sched_data *)sch->data; struct sfq_sched_data *q = qdisc_priv(sch);
struct sk_buff *skb; struct sk_buff *skb;
sfq_index a, old_a; sfq_index a, old_a;
...@@ -369,7 +369,7 @@ sfq_reset(struct Qdisc* sch) ...@@ -369,7 +369,7 @@ sfq_reset(struct Qdisc* sch)
static void sfq_perturbation(unsigned long arg) static void sfq_perturbation(unsigned long arg)
{ {
struct Qdisc *sch = (struct Qdisc*)arg; struct Qdisc *sch = (struct Qdisc*)arg;
struct sfq_sched_data *q = (struct sfq_sched_data *)sch->data; struct sfq_sched_data *q = qdisc_priv(sch);
q->perturbation = net_random()&0x1F; q->perturbation = net_random()&0x1F;
q->perturb_timer.expires = jiffies + q->perturb_period; q->perturb_timer.expires = jiffies + q->perturb_period;
...@@ -382,7 +382,7 @@ static void sfq_perturbation(unsigned long arg) ...@@ -382,7 +382,7 @@ static void sfq_perturbation(unsigned long arg)
static int sfq_change(struct Qdisc *sch, struct rtattr *opt) static int sfq_change(struct Qdisc *sch, struct rtattr *opt)
{ {
struct sfq_sched_data *q = (struct sfq_sched_data *)sch->data; struct sfq_sched_data *q = qdisc_priv(sch);
struct tc_sfq_qopt *ctl = RTA_DATA(opt); struct tc_sfq_qopt *ctl = RTA_DATA(opt);
if (opt->rta_len < RTA_LENGTH(sizeof(*ctl))) if (opt->rta_len < RTA_LENGTH(sizeof(*ctl)))
...@@ -408,7 +408,7 @@ static int sfq_change(struct Qdisc *sch, struct rtattr *opt) ...@@ -408,7 +408,7 @@ static int sfq_change(struct Qdisc *sch, struct rtattr *opt)
static int sfq_init(struct Qdisc *sch, struct rtattr *opt) static int sfq_init(struct Qdisc *sch, struct rtattr *opt)
{ {
struct sfq_sched_data *q = (struct sfq_sched_data *)sch->data; struct sfq_sched_data *q = qdisc_priv(sch);
int i; int i;
init_timer(&q->perturb_timer); init_timer(&q->perturb_timer);
...@@ -440,13 +440,13 @@ static int sfq_init(struct Qdisc *sch, struct rtattr *opt) ...@@ -440,13 +440,13 @@ static int sfq_init(struct Qdisc *sch, struct rtattr *opt)
static void sfq_destroy(struct Qdisc *sch) static void sfq_destroy(struct Qdisc *sch)
{ {
struct sfq_sched_data *q = (struct sfq_sched_data *)sch->data; struct sfq_sched_data *q = qdisc_priv(sch);
del_timer(&q->perturb_timer); del_timer(&q->perturb_timer);
} }
static int sfq_dump(struct Qdisc *sch, struct sk_buff *skb) static int sfq_dump(struct Qdisc *sch, struct sk_buff *skb)
{ {
struct sfq_sched_data *q = (struct sfq_sched_data *)sch->data; struct sfq_sched_data *q = qdisc_priv(sch);
unsigned char *b = skb->tail; unsigned char *b = skb->tail;
struct tc_sfq_qopt opt; struct tc_sfq_qopt opt;
......
...@@ -137,7 +137,7 @@ struct tbf_sched_data ...@@ -137,7 +137,7 @@ struct tbf_sched_data
static int tbf_enqueue(struct sk_buff *skb, struct Qdisc* sch) static int tbf_enqueue(struct sk_buff *skb, struct Qdisc* sch)
{ {
struct tbf_sched_data *q = (struct tbf_sched_data *)sch->data; struct tbf_sched_data *q = qdisc_priv(sch);
int ret; int ret;
if (skb->len > q->max_size) { if (skb->len > q->max_size) {
...@@ -163,7 +163,7 @@ static int tbf_enqueue(struct sk_buff *skb, struct Qdisc* sch) ...@@ -163,7 +163,7 @@ static int tbf_enqueue(struct sk_buff *skb, struct Qdisc* sch)
static int tbf_requeue(struct sk_buff *skb, struct Qdisc* sch) static int tbf_requeue(struct sk_buff *skb, struct Qdisc* sch)
{ {
struct tbf_sched_data *q = (struct tbf_sched_data *)sch->data; struct tbf_sched_data *q = qdisc_priv(sch);
int ret; int ret;
if ((ret = q->qdisc->ops->requeue(skb, q->qdisc)) == 0) if ((ret = q->qdisc->ops->requeue(skb, q->qdisc)) == 0)
...@@ -174,7 +174,7 @@ static int tbf_requeue(struct sk_buff *skb, struct Qdisc* sch) ...@@ -174,7 +174,7 @@ static int tbf_requeue(struct sk_buff *skb, struct Qdisc* sch)
static unsigned int tbf_drop(struct Qdisc* sch) static unsigned int tbf_drop(struct Qdisc* sch)
{ {
struct tbf_sched_data *q = (struct tbf_sched_data *)sch->data; struct tbf_sched_data *q = qdisc_priv(sch);
unsigned int len; unsigned int len;
if ((len = q->qdisc->ops->drop(q->qdisc)) != 0) { if ((len = q->qdisc->ops->drop(q->qdisc)) != 0) {
...@@ -194,7 +194,7 @@ static void tbf_watchdog(unsigned long arg) ...@@ -194,7 +194,7 @@ static void tbf_watchdog(unsigned long arg)
static struct sk_buff *tbf_dequeue(struct Qdisc* sch) static struct sk_buff *tbf_dequeue(struct Qdisc* sch)
{ {
struct tbf_sched_data *q = (struct tbf_sched_data *)sch->data; struct tbf_sched_data *q = qdisc_priv(sch);
struct sk_buff *skb; struct sk_buff *skb;
skb = q->qdisc->dequeue(q->qdisc); skb = q->qdisc->dequeue(q->qdisc);
...@@ -261,7 +261,7 @@ static struct sk_buff *tbf_dequeue(struct Qdisc* sch) ...@@ -261,7 +261,7 @@ static struct sk_buff *tbf_dequeue(struct Qdisc* sch)
static void tbf_reset(struct Qdisc* sch) static void tbf_reset(struct Qdisc* sch)
{ {
struct tbf_sched_data *q = (struct tbf_sched_data *)sch->data; struct tbf_sched_data *q = qdisc_priv(sch);
qdisc_reset(q->qdisc); qdisc_reset(q->qdisc);
sch->q.qlen = 0; sch->q.qlen = 0;
...@@ -300,7 +300,7 @@ static struct Qdisc *tbf_create_dflt_qdisc(struct net_device *dev, u32 limit) ...@@ -300,7 +300,7 @@ static struct Qdisc *tbf_create_dflt_qdisc(struct net_device *dev, u32 limit)
static int tbf_change(struct Qdisc* sch, struct rtattr *opt) static int tbf_change(struct Qdisc* sch, struct rtattr *opt)
{ {
int err = -EINVAL; int err = -EINVAL;
struct tbf_sched_data *q = (struct tbf_sched_data *)sch->data; struct tbf_sched_data *q = qdisc_priv(sch);
struct rtattr *tb[TCA_TBF_PTAB]; struct rtattr *tb[TCA_TBF_PTAB];
struct tc_tbf_qopt *qopt; struct tc_tbf_qopt *qopt;
struct qdisc_rate_table *rtab = NULL; struct qdisc_rate_table *rtab = NULL;
...@@ -366,7 +366,7 @@ static int tbf_change(struct Qdisc* sch, struct rtattr *opt) ...@@ -366,7 +366,7 @@ static int tbf_change(struct Qdisc* sch, struct rtattr *opt)
static int tbf_init(struct Qdisc* sch, struct rtattr *opt) static int tbf_init(struct Qdisc* sch, struct rtattr *opt)
{ {
struct tbf_sched_data *q = (struct tbf_sched_data *)sch->data; struct tbf_sched_data *q = qdisc_priv(sch);
if (opt == NULL) if (opt == NULL)
return -EINVAL; return -EINVAL;
...@@ -383,7 +383,7 @@ static int tbf_init(struct Qdisc* sch, struct rtattr *opt) ...@@ -383,7 +383,7 @@ static int tbf_init(struct Qdisc* sch, struct rtattr *opt)
static void tbf_destroy(struct Qdisc *sch) static void tbf_destroy(struct Qdisc *sch)
{ {
struct tbf_sched_data *q = (struct tbf_sched_data *)sch->data; struct tbf_sched_data *q = qdisc_priv(sch);
del_timer(&q->wd_timer); del_timer(&q->wd_timer);
...@@ -397,7 +397,7 @@ static void tbf_destroy(struct Qdisc *sch) ...@@ -397,7 +397,7 @@ static void tbf_destroy(struct Qdisc *sch)
static int tbf_dump(struct Qdisc *sch, struct sk_buff *skb) static int tbf_dump(struct Qdisc *sch, struct sk_buff *skb)
{ {
struct tbf_sched_data *q = (struct tbf_sched_data *)sch->data; struct tbf_sched_data *q = qdisc_priv(sch);
unsigned char *b = skb->tail; unsigned char *b = skb->tail;
struct rtattr *rta; struct rtattr *rta;
struct tc_tbf_qopt opt; struct tc_tbf_qopt opt;
...@@ -426,7 +426,7 @@ static int tbf_dump(struct Qdisc *sch, struct sk_buff *skb) ...@@ -426,7 +426,7 @@ static int tbf_dump(struct Qdisc *sch, struct sk_buff *skb)
static int tbf_dump_class(struct Qdisc *sch, unsigned long cl, static int tbf_dump_class(struct Qdisc *sch, unsigned long cl,
struct sk_buff *skb, struct tcmsg *tcm) struct sk_buff *skb, struct tcmsg *tcm)
{ {
struct tbf_sched_data *q = (struct tbf_sched_data*)sch->data; struct tbf_sched_data *q = qdisc_priv(sch);
if (cl != 1) /* only one class */ if (cl != 1) /* only one class */
return -ENOENT; return -ENOENT;
...@@ -440,7 +440,7 @@ static int tbf_dump_class(struct Qdisc *sch, unsigned long cl, ...@@ -440,7 +440,7 @@ static int tbf_dump_class(struct Qdisc *sch, unsigned long cl,
static int tbf_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new, static int tbf_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new,
struct Qdisc **old) struct Qdisc **old)
{ {
struct tbf_sched_data *q = (struct tbf_sched_data *)sch->data; struct tbf_sched_data *q = qdisc_priv(sch);
if (new == NULL) if (new == NULL)
new = &noop_qdisc; new = &noop_qdisc;
...@@ -456,7 +456,7 @@ static int tbf_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new, ...@@ -456,7 +456,7 @@ static int tbf_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new,
static struct Qdisc *tbf_leaf(struct Qdisc *sch, unsigned long arg) static struct Qdisc *tbf_leaf(struct Qdisc *sch, unsigned long arg)
{ {
struct tbf_sched_data *q = (struct tbf_sched_data *)sch->data; struct tbf_sched_data *q = qdisc_priv(sch);
return q->qdisc; return q->qdisc;
} }
......
...@@ -81,7 +81,7 @@ struct teql_sched_data ...@@ -81,7 +81,7 @@ struct teql_sched_data
struct sk_buff_head q; struct sk_buff_head q;
}; };
#define NEXT_SLAVE(q) (((struct teql_sched_data*)((q)->data))->next) #define NEXT_SLAVE(q) (((struct teql_sched_data*)qdisc_priv(q))->next)
#define FMASK (IFF_BROADCAST|IFF_POINTOPOINT|IFF_BROADCAST) #define FMASK (IFF_BROADCAST|IFF_POINTOPOINT|IFF_BROADCAST)
...@@ -91,7 +91,7 @@ static int ...@@ -91,7 +91,7 @@ static int
teql_enqueue(struct sk_buff *skb, struct Qdisc* sch) teql_enqueue(struct sk_buff *skb, struct Qdisc* sch)
{ {
struct net_device *dev = sch->dev; struct net_device *dev = sch->dev;
struct teql_sched_data *q = (struct teql_sched_data *)sch->data; struct teql_sched_data *q = qdisc_priv(sch);
__skb_queue_tail(&q->q, skb); __skb_queue_tail(&q->q, skb);
if (q->q.qlen <= dev->tx_queue_len) { if (q->q.qlen <= dev->tx_queue_len) {
...@@ -109,7 +109,7 @@ teql_enqueue(struct sk_buff *skb, struct Qdisc* sch) ...@@ -109,7 +109,7 @@ teql_enqueue(struct sk_buff *skb, struct Qdisc* sch)
static int static int
teql_requeue(struct sk_buff *skb, struct Qdisc* sch) teql_requeue(struct sk_buff *skb, struct Qdisc* sch)
{ {
struct teql_sched_data *q = (struct teql_sched_data *)sch->data; struct teql_sched_data *q = qdisc_priv(sch);
__skb_queue_head(&q->q, skb); __skb_queue_head(&q->q, skb);
return 0; return 0;
...@@ -118,7 +118,7 @@ teql_requeue(struct sk_buff *skb, struct Qdisc* sch) ...@@ -118,7 +118,7 @@ teql_requeue(struct sk_buff *skb, struct Qdisc* sch)
static struct sk_buff * static struct sk_buff *
teql_dequeue(struct Qdisc* sch) teql_dequeue(struct Qdisc* sch)
{ {
struct teql_sched_data *dat = (struct teql_sched_data *)sch->data; struct teql_sched_data *dat = qdisc_priv(sch);
struct sk_buff *skb; struct sk_buff *skb;
skb = __skb_dequeue(&dat->q); skb = __skb_dequeue(&dat->q);
...@@ -143,7 +143,7 @@ teql_neigh_release(struct neighbour *n) ...@@ -143,7 +143,7 @@ teql_neigh_release(struct neighbour *n)
static void static void
teql_reset(struct Qdisc* sch) teql_reset(struct Qdisc* sch)
{ {
struct teql_sched_data *dat = (struct teql_sched_data *)sch->data; struct teql_sched_data *dat = qdisc_priv(sch);
skb_queue_purge(&dat->q); skb_queue_purge(&dat->q);
sch->q.qlen = 0; sch->q.qlen = 0;
...@@ -154,7 +154,7 @@ static void ...@@ -154,7 +154,7 @@ static void
teql_destroy(struct Qdisc* sch) teql_destroy(struct Qdisc* sch)
{ {
struct Qdisc *q, *prev; struct Qdisc *q, *prev;
struct teql_sched_data *dat = (struct teql_sched_data *)sch->data; struct teql_sched_data *dat = qdisc_priv(sch);
struct teql_master *master = dat->m; struct teql_master *master = dat->m;
if ((prev = master->slaves) != NULL) { if ((prev = master->slaves) != NULL) {
...@@ -184,7 +184,7 @@ static int teql_qdisc_init(struct Qdisc *sch, struct rtattr *opt) ...@@ -184,7 +184,7 @@ static int teql_qdisc_init(struct Qdisc *sch, struct rtattr *opt)
{ {
struct net_device *dev = sch->dev; struct net_device *dev = sch->dev;
struct teql_master *m = (struct teql_master*)sch->ops; struct teql_master *m = (struct teql_master*)sch->ops;
struct teql_sched_data *q = (struct teql_sched_data *)sch->data; struct teql_sched_data *q = qdisc_priv(sch);
if (dev->hard_header_len > m->dev->hard_header_len) if (dev->hard_header_len > m->dev->hard_header_len)
return -EINVAL; return -EINVAL;
...@@ -229,7 +229,7 @@ static int teql_qdisc_init(struct Qdisc *sch, struct rtattr *opt) ...@@ -229,7 +229,7 @@ static int teql_qdisc_init(struct Qdisc *sch, struct rtattr *opt)
static int static int
__teql_resolve(struct sk_buff *skb, struct sk_buff *skb_res, struct net_device *dev) __teql_resolve(struct sk_buff *skb, struct sk_buff *skb_res, struct net_device *dev)
{ {
struct teql_sched_data *q = (void*)dev->qdisc->data; struct teql_sched_data *q = qdisc_priv(dev->qdisc);
struct neighbour *mn = skb->dst->neighbour; struct neighbour *mn = skb->dst->neighbour;
struct neighbour *n = q->ncache; struct neighbour *n = q->ncache;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment