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
#define TCQ_F_BUILTIN 1
#define TCQ_F_THROTTLED 2
#define TCQ_F_INGRES 4
int padded;
struct Qdisc_ops *ops;
u32 handle;
atomic_t refcnt;
......@@ -93,10 +94,17 @@ struct Qdisc
* and it will live until better solution will be invented.
*/
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 tc_ratespec rate;
......
......@@ -241,7 +241,7 @@ cbq_reclassify(struct sk_buff *skb, struct cbq_class *this)
static struct cbq_class *
cbq_classify(struct sk_buff *skb, struct Qdisc *sch, int *qres)
{
struct cbq_sched_data *q = (struct cbq_sched_data*)sch->data;
struct cbq_sched_data *q = qdisc_priv(sch);
struct cbq_class *head = &q->link;
struct cbq_class **defmap;
struct cbq_class *cl = NULL;
......@@ -344,7 +344,7 @@ cbq_classify(struct sk_buff *skb, struct Qdisc *sch, int *qres)
static __inline__ void cbq_activate_class(struct cbq_class *cl)
{
struct cbq_sched_data *q = (struct cbq_sched_data*)cl->qdisc->data;
struct cbq_sched_data *q = qdisc_priv(cl->qdisc);
int prio = cl->cpriority;
struct cbq_class *cl_tail;
......@@ -368,7 +368,7 @@ static __inline__ void cbq_activate_class(struct cbq_class *cl)
static void cbq_deactivate_class(struct cbq_class *this)
{
struct cbq_sched_data *q = (struct cbq_sched_data*)this->qdisc->data;
struct cbq_sched_data *q = qdisc_priv(this->qdisc);
int prio = this->cpriority;
struct cbq_class *cl;
struct cbq_class *cl_prev = q->active[prio];
......@@ -419,7 +419,7 @@ cbq_mark_toplevel(struct cbq_sched_data *q, struct cbq_class *cl)
static int
cbq_enqueue(struct sk_buff *skb, struct Qdisc *sch)
{
struct cbq_sched_data *q = (struct cbq_sched_data *)sch->data;
struct cbq_sched_data *q = qdisc_priv(sch);
int len = skb->len;
int ret = NET_XMIT_SUCCESS;
struct cbq_class *cl = cbq_classify(skb, sch,&ret);
......@@ -466,7 +466,7 @@ cbq_enqueue(struct sk_buff *skb, struct Qdisc *sch)
static int
cbq_requeue(struct sk_buff *skb, struct Qdisc *sch)
{
struct cbq_sched_data *q = (struct cbq_sched_data *)sch->data;
struct cbq_sched_data *q = qdisc_priv(sch);
struct cbq_class *cl;
int ret;
......@@ -500,7 +500,7 @@ cbq_requeue(struct sk_buff *skb, struct Qdisc *sch)
static void cbq_ovl_classic(struct cbq_class *cl)
{
struct cbq_sched_data *q = (struct cbq_sched_data *)cl->qdisc->data;
struct cbq_sched_data *q = qdisc_priv(cl->qdisc);
psched_tdiff_t delay = PSCHED_TDIFF(cl->undertime, q->now);
if (!cl->delayed) {
......@@ -554,7 +554,7 @@ static void cbq_ovl_classic(struct cbq_class *cl)
static void cbq_ovl_rclassic(struct cbq_class *cl)
{
struct cbq_sched_data *q = (struct cbq_sched_data *)cl->qdisc->data;
struct cbq_sched_data *q = qdisc_priv(cl->qdisc);
struct cbq_class *this = cl;
do {
......@@ -573,7 +573,7 @@ static void cbq_ovl_rclassic(struct cbq_class *cl)
static void cbq_ovl_delay(struct cbq_class *cl)
{
struct cbq_sched_data *q = (struct cbq_sched_data *)cl->qdisc->data;
struct cbq_sched_data *q = qdisc_priv(cl->qdisc);
psched_tdiff_t delay = PSCHED_TDIFF(cl->undertime, q->now);
if (!cl->delayed) {
......@@ -609,7 +609,7 @@ static void cbq_ovl_delay(struct cbq_class *cl)
static void cbq_ovl_lowprio(struct cbq_class *cl)
{
struct cbq_sched_data *q = (struct cbq_sched_data*)cl->qdisc->data;
struct cbq_sched_data *q = qdisc_priv(cl->qdisc);
cl->penalized = jiffies + cl->penalty;
......@@ -678,7 +678,7 @@ static unsigned long cbq_undelay_prio(struct cbq_sched_data *q, int prio)
static void cbq_undelay(unsigned long arg)
{
struct Qdisc *sch = (struct Qdisc*)arg;
struct cbq_sched_data *q = (struct cbq_sched_data*)sch->data;
struct cbq_sched_data *q = qdisc_priv(sch);
long delay = 0;
unsigned pmask;
......@@ -715,7 +715,7 @@ static int cbq_reshape_fail(struct sk_buff *skb, struct Qdisc *child)
{
int len = skb->len;
struct Qdisc *sch = child->__parent;
struct cbq_sched_data *q = (struct cbq_sched_data *)sch->data;
struct cbq_sched_data *q = qdisc_priv(sch);
struct cbq_class *cl = q->rx_class;
q->rx_class = NULL;
......@@ -863,7 +863,7 @@ cbq_update(struct cbq_sched_data *q)
static __inline__ struct cbq_class *
cbq_under_limit(struct cbq_class *cl)
{
struct cbq_sched_data *q = (struct cbq_sched_data*)cl->qdisc->data;
struct cbq_sched_data *q = qdisc_priv(cl->qdisc);
struct cbq_class *this_cl = cl;
if (cl->tparent == NULL)
......@@ -903,7 +903,7 @@ cbq_under_limit(struct cbq_class *cl)
static __inline__ struct sk_buff *
cbq_dequeue_prio(struct Qdisc *sch, int prio)
{
struct cbq_sched_data *q = (struct cbq_sched_data *)sch->data;
struct cbq_sched_data *q = qdisc_priv(sch);
struct cbq_class *cl_tail, *cl_prev, *cl;
struct sk_buff *skb;
int deficit;
......@@ -1006,7 +1006,7 @@ cbq_dequeue_prio(struct Qdisc *sch, int prio)
static __inline__ struct sk_buff *
cbq_dequeue_1(struct Qdisc *sch)
{
struct cbq_sched_data *q = (struct cbq_sched_data *)sch->data;
struct cbq_sched_data *q = qdisc_priv(sch);
struct sk_buff *skb;
unsigned activemask;
......@@ -1025,7 +1025,7 @@ static struct sk_buff *
cbq_dequeue(struct Qdisc *sch)
{
struct sk_buff *skb;
struct cbq_sched_data *q = (struct cbq_sched_data *)sch->data;
struct cbq_sched_data *q = qdisc_priv(sch);
psched_time_t now;
psched_tdiff_t incr;
......@@ -1150,7 +1150,7 @@ static void cbq_normalize_quanta(struct cbq_sched_data *q, int prio)
static void cbq_sync_defmap(struct cbq_class *cl)
{
struct cbq_sched_data *q = (struct cbq_sched_data*)cl->qdisc->data;
struct cbq_sched_data *q = qdisc_priv(cl->qdisc);
struct cbq_class *split = cl->split;
unsigned h;
int i;
......@@ -1216,7 +1216,7 @@ static void cbq_change_defmap(struct cbq_class *cl, u32 splitid, u32 def, u32 ma
static void cbq_unlink_class(struct cbq_class *this)
{
struct cbq_class *cl, **clp;
struct cbq_sched_data *q = (struct cbq_sched_data*)this->qdisc->data;
struct cbq_sched_data *q = qdisc_priv(this->qdisc);
for (clp = &q->classes[cbq_hash(this->classid)]; (cl = *clp) != NULL; clp = &cl->next) {
if (cl == this) {
......@@ -1249,7 +1249,7 @@ static void cbq_unlink_class(struct cbq_class *this)
static void cbq_link_class(struct cbq_class *this)
{
struct cbq_sched_data *q = (struct cbq_sched_data*)this->qdisc->data;
struct cbq_sched_data *q = qdisc_priv(this->qdisc);
unsigned h = cbq_hash(this->classid);
struct cbq_class *parent = this->tparent;
......@@ -1270,7 +1270,7 @@ static void cbq_link_class(struct cbq_class *this)
static unsigned int cbq_drop(struct Qdisc* sch)
{
struct cbq_sched_data *q = (struct cbq_sched_data *)sch->data;
struct cbq_sched_data *q = qdisc_priv(sch);
struct cbq_class *cl, *cl_head;
int prio;
unsigned int len;
......@@ -1293,7 +1293,7 @@ static unsigned int cbq_drop(struct Qdisc* sch)
static void
cbq_reset(struct Qdisc* sch)
{
struct cbq_sched_data *q = (struct cbq_sched_data *)sch->data;
struct cbq_sched_data *q = qdisc_priv(sch);
struct cbq_class *cl;
int prio;
unsigned h;
......@@ -1363,7 +1363,7 @@ static void cbq_addprio(struct cbq_sched_data *q, struct cbq_class *cl)
static int cbq_set_wrr(struct cbq_class *cl, struct tc_cbq_wrropt *wrr)
{
struct cbq_sched_data *q = (struct cbq_sched_data *)cl->qdisc->data;
struct cbq_sched_data *q = qdisc_priv(cl->qdisc);
if (wrr->allot)
cl->allot = wrr->allot;
......@@ -1432,7 +1432,7 @@ static int cbq_set_fopt(struct cbq_class *cl, struct tc_cbq_fopt *fopt)
static int cbq_init(struct Qdisc *sch, struct rtattr *opt)
{
struct cbq_sched_data *q = (struct cbq_sched_data*)sch->data;
struct cbq_sched_data *q = qdisc_priv(sch);
struct rtattr *tb[TCA_CBQ_MAX];
struct tc_ratespec *r;
......@@ -1623,7 +1623,7 @@ int cbq_copy_xstats(struct sk_buff *skb, struct tc_cbq_xstats *st)
static int cbq_dump(struct Qdisc *sch, struct sk_buff *skb)
{
struct cbq_sched_data *q = (struct cbq_sched_data*)sch->data;
struct cbq_sched_data *q = qdisc_priv(sch);
unsigned char *b = skb->tail;
struct rtattr *rta;
......@@ -1650,7 +1650,7 @@ static int
cbq_dump_class(struct Qdisc *sch, unsigned long arg,
struct sk_buff *skb, struct tcmsg *tcm)
{
struct cbq_sched_data *q = (struct cbq_sched_data*)sch->data;
struct cbq_sched_data *q = qdisc_priv(sch);
struct cbq_class *cl = (struct cbq_class*)arg;
unsigned char *b = skb->tail;
struct rtattr *rta;
......@@ -1726,7 +1726,7 @@ cbq_leaf(struct Qdisc *sch, unsigned long arg)
static unsigned long cbq_get(struct Qdisc *sch, u32 classid)
{
struct cbq_sched_data *q = (struct cbq_sched_data *)sch->data;
struct cbq_sched_data *q = qdisc_priv(sch);
struct cbq_class *cl = cbq_class_lookup(q, classid);
if (cl) {
......@@ -1760,7 +1760,7 @@ static void cbq_destroy_class(struct cbq_class *cl)
static void
cbq_destroy(struct Qdisc* sch)
{
struct cbq_sched_data *q = (struct cbq_sched_data *)sch->data;
struct cbq_sched_data *q = qdisc_priv(sch);
struct cbq_class *cl;
unsigned h;
......@@ -1791,7 +1791,7 @@ static void cbq_put(struct Qdisc *sch, unsigned long arg)
if (--cl->refcnt == 0) {
#ifdef CONFIG_NET_CLS_POLICE
struct cbq_sched_data *q = (struct cbq_sched_data *)sch->data;
struct cbq_sched_data *q = qdisc_priv(sch);
spin_lock_bh(&sch->dev->queue_lock);
if (q->rx_class == cl)
......@@ -1808,7 +1808,7 @@ cbq_change_class(struct Qdisc *sch, u32 classid, u32 parentid, struct rtattr **t
unsigned long *arg)
{
int err;
struct cbq_sched_data *q = (struct cbq_sched_data *)sch->data;
struct cbq_sched_data *q = qdisc_priv(sch);
struct cbq_class *cl = (struct cbq_class*)*arg;
struct rtattr *opt = tca[TCA_OPTIONS-1];
struct rtattr *tb[TCA_CBQ_MAX];
......@@ -2004,7 +2004,7 @@ cbq_change_class(struct Qdisc *sch, u32 classid, u32 parentid, struct rtattr **t
static int cbq_delete(struct Qdisc *sch, unsigned long arg)
{
struct cbq_sched_data *q = (struct cbq_sched_data *)sch->data;
struct cbq_sched_data *q = qdisc_priv(sch);
struct cbq_class *cl = (struct cbq_class*)arg;
if (cl->filters || cl->children || cl == &q->link)
......@@ -2042,7 +2042,7 @@ static int cbq_delete(struct Qdisc *sch, unsigned long arg)
static struct tcf_proto **cbq_find_tcf(struct Qdisc *sch, unsigned long arg)
{
struct cbq_sched_data *q = (struct cbq_sched_data *)sch->data;
struct cbq_sched_data *q = qdisc_priv(sch);
struct cbq_class *cl = (struct cbq_class *)arg;
if (cl == NULL)
......@@ -2054,7 +2054,7 @@ static struct tcf_proto **cbq_find_tcf(struct Qdisc *sch, unsigned long arg)
static unsigned long cbq_bind_filter(struct Qdisc *sch, unsigned long parent,
u32 classid)
{
struct cbq_sched_data *q = (struct cbq_sched_data *)sch->data;
struct cbq_sched_data *q = qdisc_priv(sch);
struct cbq_class *p = (struct cbq_class*)parent;
struct cbq_class *cl = cbq_class_lookup(q, classid);
......@@ -2076,7 +2076,7 @@ static void cbq_unbind_filter(struct Qdisc *sch, unsigned long arg)
static void cbq_walk(struct Qdisc *sch, struct qdisc_walker *arg)
{
struct cbq_sched_data *q = (struct cbq_sched_data *)sch->data;
struct cbq_sched_data *q = qdisc_priv(sch);
unsigned h;
if (arg->stop)
......
......@@ -30,7 +30,7 @@
#endif
#define PRIV(sch) ((struct dsmark_qdisc_data *) (sch)->data)
#define PRIV(sch) qdisc_priv(sch)
/*
......
......@@ -45,7 +45,7 @@ struct fifo_sched_data
static int
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) {
__skb_queue_tail(&sch->q, skb);
......@@ -106,7 +106,7 @@ fifo_reset(struct Qdisc* sch)
static int
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) {
__skb_queue_tail(&sch->q, skb);
......@@ -138,7 +138,7 @@ pfifo_dequeue(struct Qdisc* sch)
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) {
unsigned int limit = sch->dev->tx_queue_len ? : 1;
......@@ -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)
{
struct fifo_sched_data *q = (void*)sch->data;
struct fifo_sched_data *q = qdisc_priv(sch);
unsigned char *b = skb->tail;
struct tc_fifo_qopt opt;
......
......@@ -285,10 +285,9 @@ static const u8 prio2band[TC_PRIO_MAX+1] =
static int
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) +
prio2band[skb->priority&TC_PRIO_MAX];
list += prio2band[skb->priority&TC_PRIO_MAX];
if (list->qlen < qdisc->dev->tx_queue_len) {
__skb_queue_tail(list, skb);
......@@ -306,7 +305,7 @@ static struct sk_buff *
pfifo_fast_dequeue(struct Qdisc* qdisc)
{
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;
for (prio = 0; prio < 3; prio++, list++) {
......@@ -322,10 +321,9 @@ pfifo_fast_dequeue(struct Qdisc* qdisc)
static int
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) +
prio2band[skb->priority&TC_PRIO_MAX];
list += prio2band[skb->priority&TC_PRIO_MAX];
__skb_queue_head(list, skb);
qdisc->q.qlen++;
......@@ -336,7 +334,7 @@ static void
pfifo_fast_reset(struct Qdisc* qdisc)
{
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++)
skb_queue_purge(list+prio);
......@@ -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)
{
int i;
struct sk_buff_head *list;
list = ((struct sk_buff_head*)qdisc->data);
struct sk_buff_head *list = qdisc_priv(qdisc);
for (i=0; i<3; i++)
skb_queue_head_init(list+i);
......@@ -387,13 +383,22 @@ static struct Qdisc_ops pfifo_fast_ops = {
struct Qdisc * qdisc_create_dflt(struct net_device *dev, struct Qdisc_ops *ops)
{
void *p;
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);
if (!sch)
p = kmalloc(size, GFP_KERNEL);
if (!p)
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);
skb_queue_head_init(&sch->q);
......@@ -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)
return sch;
kfree(sch);
kfree(p);
return NULL;
}
......@@ -445,7 +450,7 @@ static void __qdisc_destroy(struct rcu_head *head)
dev_put(qdisc->dev);
if (!(qdisc->flags&TCQ_F_BUILTIN))
kfree(qdisc);
kfree((char *) qdisc - qdisc->padded);
}
/* Under dev->queue_lock and BH! */
......
......@@ -106,7 +106,7 @@ gred_enqueue(struct sk_buff *skb, struct Qdisc* sch)
{
psched_time_t now;
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;
int i=0;
......@@ -215,7 +215,7 @@ static int
gred_requeue(struct sk_buff *skb, struct Qdisc* sch)
{
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)];
/* error checking here -- probably unnecessary */
PSCHED_SET_PASTPERFECT(q->qidlestart);
......@@ -231,7 +231,7 @@ gred_dequeue(struct Qdisc* sch)
{
struct sk_buff *skb;
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);
if (skb) {
......@@ -264,7 +264,7 @@ static unsigned int gred_drop(struct Qdisc* sch)
struct sk_buff *skb;
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);
if (skb) {
......@@ -300,7 +300,7 @@ static void gred_reset(struct Qdisc* sch)
{
int i;
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);
......@@ -323,7 +323,7 @@ static void gred_reset(struct Qdisc* sch)
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 tc_gred_qopt *ctl;
struct tc_gred_sopt *sopt;
......@@ -469,7 +469,7 @@ static int gred_change(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 rtattr *tb[TCA_GRED_STAB];
struct rtattr *tb2[TCA_GRED_DPS];
......@@ -502,7 +502,7 @@ static int gred_dump(struct Qdisc *sch, struct sk_buff *skb)
struct rtattr *rta;
struct tc_gred_qopt *opt = NULL ;
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;
int i;
unsigned char *b = skb->tail;
......@@ -593,7 +593,7 @@ static int gred_dump(struct Qdisc *sch, struct sk_buff *skb)
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;
for (i = 0;i < table->DPs; i++) {
......
......@@ -1016,7 +1016,7 @@ hfsc_hash(u32 h)
static inline struct hfsc_class *
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;
list_for_each_entry(cl, &q->clhash[hfsc_hash(classid)], hlist) {
......@@ -1061,7 +1061,7 @@ static int
hfsc_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
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 *parent = NULL;
struct rtattr *opt = tca[TCA_OPTIONS-1];
......@@ -1204,7 +1204,7 @@ hfsc_destroy_filters(struct tcf_proto **fl)
static void
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);
qdisc_destroy(cl->qdisc);
......@@ -1218,7 +1218,7 @@ hfsc_destroy_class(struct Qdisc *sch, struct hfsc_class *cl)
static int
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;
if (cl->level > 0 || cl->filter_cnt > 0 || cl == &q->root)
......@@ -1240,7 +1240,7 @@ hfsc_delete_class(struct Qdisc *sch, unsigned long arg)
static struct hfsc_class *
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 tcf_result res;
struct tcf_proto *tcf;
......@@ -1381,7 +1381,7 @@ hfsc_unbind_tcf(struct Qdisc *sch, unsigned long arg)
static struct tcf_proto **
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;
if (cl == NULL)
......@@ -1489,7 +1489,7 @@ hfsc_dump_class(struct Qdisc *sch, unsigned long arg, struct sk_buff *skb,
static void
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;
unsigned int i;
......@@ -1523,7 +1523,7 @@ hfsc_watchdog(unsigned long arg)
static void
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;
u64 next_time = 0;
long delay;
......@@ -1545,7 +1545,7 @@ hfsc_schedule_watchdog(struct Qdisc *sch, u64 cur_time)
static int
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;
unsigned int i;
......@@ -1585,7 +1585,7 @@ hfsc_init_qdisc(struct Qdisc *sch, struct rtattr *opt)
static int
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;
if (opt == NULL || RTA_PAYLOAD(opt) < sizeof(*qopt))
......@@ -1632,7 +1632,7 @@ hfsc_reset_class(struct hfsc_class *cl)
static void
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;
unsigned int i;
......@@ -1651,7 +1651,7 @@ hfsc_reset_qdisc(struct Qdisc *sch)
static void
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;
unsigned int i;
......@@ -1666,7 +1666,7 @@ hfsc_destroy_qdisc(struct Qdisc *sch)
static int
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;
struct tc_hfsc_qopt qopt;
......@@ -1730,7 +1730,7 @@ hfsc_enqueue(struct sk_buff *skb, struct Qdisc *sch)
static struct sk_buff *
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 sk_buff *skb;
u64 cur_time;
......@@ -1799,7 +1799,7 @@ hfsc_dequeue(struct Qdisc *sch)
static int
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);
sch->q.qlen++;
......@@ -1809,7 +1809,7 @@ hfsc_requeue(struct sk_buff *skb, struct Qdisc *sch)
static unsigned int
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;
unsigned int len;
......
......@@ -267,7 +267,7 @@ static __inline__ int htb_hash(u32 h)
/* find class in global hash table using given handle */
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;
if (TC_H_MAJ(handle) != sch->handle)
return NULL;
......@@ -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)
{
struct htb_sched *q = (struct htb_sched *)sch->data;
struct htb_sched *q = qdisc_priv(sch);
struct htb_class *cl;
struct tcf_result res;
struct tcf_proto *tcf;
......@@ -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)
{
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);
......@@ -759,7 +759,7 @@ static int htb_enqueue(struct sk_buff *skb, struct Qdisc *sch)
/* TODO: requeuing packet charges it to policers again !! */
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;
struct htb_class *cl = htb_classify(skb,sch, &ret);
struct sk_buff *tskb;
......@@ -800,7 +800,7 @@ static void htb_timer(unsigned long arg)
static void htb_rate_timer(unsigned long 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;
/* lock queue so that we can muck with it */
......@@ -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)
{
struct htb_sched *q = (struct htb_sched *)sch->data;
struct htb_sched *q = qdisc_priv(sch);
if (delay <= 0) delay = 1;
if (unlikely(delay > 5*HZ)) {
if (net_ratelimit())
......@@ -1077,7 +1077,7 @@ static void htb_delay_by(struct Qdisc *sch,long delay)
static struct sk_buff *htb_dequeue(struct Qdisc *sch)
{
struct sk_buff *skb = NULL;
struct htb_sched *q = (struct htb_sched *)sch->data;
struct htb_sched *q = qdisc_priv(sch);
int level;
long min_delay;
#ifdef HTB_DEBUG
......@@ -1147,7 +1147,7 @@ static struct sk_buff *htb_dequeue(struct Qdisc *sch)
/* try to drop from each class (by prio) until one succeed */
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;
for (prio = TC_HTB_NUMPRIO - 1; prio >= 0; prio--) {
......@@ -1172,7 +1172,7 @@ static unsigned int htb_drop(struct Qdisc* sch)
/* always caled under BH & queue lock */
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;
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)
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 tc_htb_glob *gopt;
int i;
......@@ -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)
{
struct htb_sched *q = (struct htb_sched*)sch->data;
struct htb_sched *q = qdisc_priv(sch);
unsigned char *b = skb->tail;
struct rtattr *rta;
struct tc_htb_glob gopt;
......@@ -1300,7 +1300,7 @@ static int htb_dump_class(struct Qdisc *sch, unsigned long arg,
struct sk_buff *skb, struct tcmsg *tcm)
{
#ifdef HTB_DEBUG
struct htb_sched *q = (struct htb_sched*)sch->data;
struct htb_sched *q = qdisc_priv(sch);
#endif
struct htb_class *cl = (struct htb_class*)arg;
unsigned char *b = skb->tail;
......@@ -1358,7 +1358,7 @@ static int htb_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new,
sch_tree_lock(sch);
if ((*old = xchg(&cl->un.leaf.q, new)) != NULL) {
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 ? */
sch->q.qlen -= (*old)->q.qlen;
......@@ -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)
{
#ifdef HTB_DEBUG
struct htb_sched *q = (struct htb_sched *)sch->data;
struct htb_sched *q = qdisc_priv(sch);
#endif
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);
......@@ -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)
{
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);
if (!cl->level) {
BUG_TRAP(cl->un.leaf.q);
......@@ -1435,7 +1435,7 @@ static void htb_destroy_class(struct Qdisc* sch,struct htb_class *cl)
/* always caled under BH & queue lock */
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);
del_timer_sync (&q->timer);
......@@ -1457,7 +1457,7 @@ static void htb_destroy(struct Qdisc* sch)
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;
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)
static void htb_put(struct Qdisc *sch, unsigned long arg)
{
#ifdef HTB_DEBUG
struct htb_sched *q = (struct htb_sched *)sch->data;
struct htb_sched *q = qdisc_priv(sch);
#endif
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);
......@@ -1497,7 +1497,7 @@ static int htb_change_class(struct Qdisc *sch, u32 classid,
u32 parentid, struct rtattr **tca, unsigned long *arg)
{
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 rtattr *opt = tca[TCA_OPTIONS-1];
struct qdisc_rate_table *rtab = NULL, *ctab = NULL;
......@@ -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)
{
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 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);
......@@ -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,
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);
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;
......@@ -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)
{
struct htb_sched *q = (struct htb_sched *)sch->data;
struct htb_sched *q = qdisc_priv(sch);
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);
if (cl)
......@@ -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)
{
struct htb_sched *q = (struct htb_sched *)sch->data;
struct htb_sched *q = qdisc_priv(sch);
int i;
if (arg->stop)
......
......@@ -40,7 +40,7 @@
#endif
#define PRIV(sch) ((struct ingress_qdisc_data *) (sch)->data)
#define PRIV(sch) qdisc_priv(sch)
/* Thanks to Doron Oz for this hack
......
......@@ -603,7 +603,7 @@ static inline int tabledist(int mu, int sigma)
*/
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;
psched_time_t now;
long delay;
......@@ -659,7 +659,7 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch)
/* Requeue packets but don't change time stamp */
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;
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)
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;
if ((len = q->qdisc->ops->drop(q->qdisc)) != 0) {
......@@ -686,7 +686,7 @@ static unsigned int netem_drop(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;
psched_time_t now;
......@@ -726,7 +726,7 @@ static void netem_watchdog(unsigned long arg)
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);
skb_queue_purge(&q->delayed);
......@@ -754,7 +754,7 @@ static int set_fifo_limit(struct Qdisc *q, int limit)
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 Qdisc *child;
int ret;
......@@ -791,7 +791,7 @@ static int netem_change(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)
return -EINVAL;
......@@ -809,7 +809,7 @@ static int netem_init(struct Qdisc *sch, struct rtattr *opt)
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);
qdisc_destroy(q->qdisc);
......@@ -817,7 +817,7 @@ static void netem_destroy(struct Qdisc *sch)
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;
struct tc_netem_qopt qopt;
......@@ -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,
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 */
return -ENOENT;
......@@ -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,
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)
new = &noop_qdisc;
......@@ -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)
{
struct netem_sched_data *q = (struct netem_sched_data *)sch->data;
struct netem_sched_data *q = qdisc_priv(sch);
return q->qdisc;
}
......
......@@ -49,7 +49,7 @@ struct prio_sched_data
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;
struct tcf_result res;
......@@ -151,7 +151,7 @@ static struct sk_buff *
prio_dequeue(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);
int prio;
struct Qdisc *qdisc;
......@@ -169,7 +169,7 @@ prio_dequeue(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;
unsigned int len;
struct Qdisc *qdisc;
......@@ -189,7 +189,7 @@ static void
prio_reset(struct Qdisc* sch)
{
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++)
qdisc_reset(q->queues[prio]);
......@@ -200,7 +200,7 @@ static void
prio_destroy(struct Qdisc* sch)
{
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;
while ((tp = q->filter_list) != NULL) {
......@@ -214,7 +214,7 @@ prio_destroy(struct Qdisc* sch)
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);
int i;
......@@ -259,7 +259,7 @@ static int prio_tune(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;
for (i=0; i<TCQ_PRIO_BANDS; i++)
......@@ -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)
{
struct prio_sched_data *q = (struct prio_sched_data *)sch->data;
struct prio_sched_data *q = qdisc_priv(sch);
unsigned char *b = skb->tail;
struct tc_prio_qopt opt;
......@@ -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,
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;
if (band >= q->bands)
......@@ -317,7 +317,7 @@ static int prio_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new,
static struct Qdisc *
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;
if (band >= q->bands)
......@@ -328,7 +328,7 @@ prio_leaf(struct Qdisc *sch, unsigned long arg)
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);
if (band - 1 >= q->bands)
......@@ -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)
{
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)
return -ENOENT;
......@@ -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)
{
struct prio_sched_data *q = (struct prio_sched_data *)sch->data;
struct prio_sched_data *q = qdisc_priv(sch);
if (cl - 1 > q->bands)
return -ENOENT;
return 0;
......@@ -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,
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)
return -ENOENT;
......@@ -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)
{
struct prio_sched_data *q = (struct prio_sched_data *)sch->data;
struct prio_sched_data *q = qdisc_priv(sch);
int prio;
if (arg->stop)
......@@ -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)
{
struct prio_sched_data *q = (struct prio_sched_data *)sch->data;
struct prio_sched_data *q = qdisc_priv(sch);
if (cl)
return NULL;
......
......@@ -180,7 +180,7 @@ static int red_ecn_mark(struct sk_buff *skb)
static int
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;
......@@ -303,7 +303,7 @@ red_enqueue(struct sk_buff *skb, struct Qdisc* sch)
static int
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);
......@@ -316,7 +316,7 @@ static struct sk_buff *
red_dequeue(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);
skb = __skb_dequeue(&sch->q);
if (skb) {
......@@ -330,7 +330,7 @@ red_dequeue(struct Qdisc* sch)
static unsigned int red_drop(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);
skb = __skb_dequeue_tail(&sch->q);
if (skb) {
......@@ -347,7 +347,7 @@ static unsigned int red_drop(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);
sch->stats.backlog = 0;
......@@ -358,7 +358,7 @@ static void red_reset(struct Qdisc* sch)
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 tc_red_qopt *ctl;
......@@ -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)
{
struct red_sched_data *q = (struct red_sched_data *)sch->data;
struct red_sched_data *q = qdisc_priv(sch);
unsigned char *b = skb->tail;
struct rtattr *rta;
struct tc_red_qopt opt;
......
......@@ -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)
{
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;
struct sk_buff *skb;
unsigned int len;
......@@ -253,7 +253,7 @@ static unsigned int sfq_drop(struct Qdisc *sch)
static int
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);
sfq_index x;
......@@ -288,7 +288,7 @@ sfq_enqueue(struct sk_buff *skb, struct Qdisc* sch)
static int
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);
sfq_index x;
......@@ -324,7 +324,7 @@ sfq_requeue(struct sk_buff *skb, struct Qdisc* sch)
static struct sk_buff *
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;
sfq_index a, old_a;
......@@ -369,7 +369,7 @@ sfq_reset(struct Qdisc* sch)
static void sfq_perturbation(unsigned long 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->perturb_timer.expires = jiffies + q->perturb_period;
......@@ -382,7 +382,7 @@ static void sfq_perturbation(unsigned long arg)
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);
if (opt->rta_len < RTA_LENGTH(sizeof(*ctl)))
......@@ -408,7 +408,7 @@ static int sfq_change(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;
init_timer(&q->perturb_timer);
......@@ -440,13 +440,13 @@ static int sfq_init(struct Qdisc *sch, struct rtattr *opt)
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);
}
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;
struct tc_sfq_qopt opt;
......
......@@ -137,7 +137,7 @@ struct tbf_sched_data
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;
if (skb->len > q->max_size) {
......@@ -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)
{
struct tbf_sched_data *q = (struct tbf_sched_data *)sch->data;
struct tbf_sched_data *q = qdisc_priv(sch);
int ret;
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)
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;
if ((len = q->qdisc->ops->drop(q->qdisc)) != 0) {
......@@ -194,7 +194,7 @@ static void tbf_watchdog(unsigned long arg)
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;
skb = q->qdisc->dequeue(q->qdisc);
......@@ -261,7 +261,7 @@ static struct sk_buff *tbf_dequeue(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);
sch->q.qlen = 0;
......@@ -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)
{
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 tc_tbf_qopt *qopt;
struct qdisc_rate_table *rtab = NULL;
......@@ -366,7 +366,7 @@ static int tbf_change(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)
return -EINVAL;
......@@ -383,7 +383,7 @@ static int tbf_init(struct Qdisc* sch, struct rtattr *opt)
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);
......@@ -397,7 +397,7 @@ static void tbf_destroy(struct Qdisc *sch)
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;
struct rtattr *rta;
struct tc_tbf_qopt opt;
......@@ -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,
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 */
return -ENOENT;
......@@ -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,
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)
new = &noop_qdisc;
......@@ -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)
{
struct tbf_sched_data *q = (struct tbf_sched_data *)sch->data;
struct tbf_sched_data *q = qdisc_priv(sch);
return q->qdisc;
}
......
......@@ -81,7 +81,7 @@ struct teql_sched_data
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)
......@@ -91,7 +91,7 @@ static int
teql_enqueue(struct sk_buff *skb, struct Qdisc* sch)
{
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);
if (q->q.qlen <= dev->tx_queue_len) {
......@@ -109,7 +109,7 @@ teql_enqueue(struct sk_buff *skb, struct Qdisc* sch)
static int
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);
return 0;
......@@ -118,7 +118,7 @@ teql_requeue(struct sk_buff *skb, struct Qdisc* sch)
static struct sk_buff *
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;
skb = __skb_dequeue(&dat->q);
......@@ -143,7 +143,7 @@ teql_neigh_release(struct neighbour *n)
static void
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);
sch->q.qlen = 0;
......@@ -154,7 +154,7 @@ static void
teql_destroy(struct Qdisc* sch)
{
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;
if ((prev = master->slaves) != NULL) {
......@@ -184,7 +184,7 @@ static int teql_qdisc_init(struct Qdisc *sch, struct rtattr *opt)
{
struct net_device *dev = sch->dev;
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)
return -EINVAL;
......@@ -229,7 +229,7 @@ static int teql_qdisc_init(struct Qdisc *sch, struct rtattr *opt)
static int
__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 *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