* [PATCH 1/4] cls_route: Use generic routines for class binding and police config/dump
2004-10-29 14:06 [PATCHSET 0/4] PKT_SCHED: More classifier cleanups Thomas Graf
@ 2004-10-29 14:06 ` Thomas Graf
2004-10-29 14:07 ` [PATCH 2/4] cls_rsvp*: " Thomas Graf
` (3 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Thomas Graf @ 2004-10-29 14:06 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev, hadi
Signed-off-by: Thomas Graf <tgraf@suug.ch>
--- linux-2.6.10-rc1-bk7.orig/net/sched/cls_route.c 2004-10-29 11:18:17.000000000 +0200
+++ linux-2.6.10-rc1-bk7/net/sched/cls_route.c 2004-10-29 10:57:07.000000000 +0200
@@ -292,11 +292,8 @@
struct route4_filter *f;
while ((f = b->ht[h2]) != NULL) {
- unsigned long cl;
-
b->ht[h2] = f->next;
- if ((cl = __cls_set_class(&f->res.class, 0)) != 0)
- tp->q->ops->cl_ops->unbind_tcf(tp->q, cl);
+ tcf_unbind_filter(tp, &f->res);
#ifdef CONFIG_NET_CLS_POLICE
tcf_police_release(f->police,TCA_ACT_UNBIND);
#endif
@@ -325,17 +322,12 @@
for (fp = &b->ht[from_hash(h>>16)]; *fp; fp = &(*fp)->next) {
if (*fp == f) {
- unsigned long cl;
-
tcf_tree_lock(tp);
*fp = f->next;
tcf_tree_unlock(tp);
route4_reset_fastmap(tp->q->dev, head, f->id);
-
- if ((cl = cls_set_class(tp, &f->res.class, 0)) != 0)
- tp->q->ops->cl_ops->unbind_tcf(tp->q, cl);
-
+ tcf_unbind_filter(tp, &f->res);
#ifdef CONFIG_NET_CLS_POLICE
tcf_police_release(f->police,TCA_ACT_UNBIND);
#endif
@@ -379,27 +371,18 @@
return -EINVAL;
if ((f = (struct route4_filter*)*arg) != NULL) {
- /* Node exists: adjust only classid */
-
if (f->handle != handle && handle)
return -EINVAL;
if (tb[TCA_ROUTE4_CLASSID-1]) {
- unsigned long cl;
-
f->res.classid = *(u32*)RTA_DATA(tb[TCA_ROUTE4_CLASSID-1]);
- cl = cls_set_class(tp, &f->res.class, tp->q->ops->cl_ops->bind_tcf(tp->q, base, f->res.classid));
- if (cl)
- tp->q->ops->cl_ops->unbind_tcf(tp->q, cl);
+ tcf_bind_filter(tp, &f->res, base);
}
#ifdef CONFIG_NET_CLS_POLICE
if (tb[TCA_ROUTE4_POLICE-1]) {
- struct tcf_police *police = tcf_police_locate(tb[TCA_ROUTE4_POLICE-1], tca[TCA_RATE-1]);
-
- tcf_tree_lock(tp);
- police = xchg(&f->police, police);
- tcf_tree_unlock(tp);
-
- tcf_police_release(police,TCA_ACT_UNBIND);
+ err = tcf_change_police(tp, &f->police,
+ tb[TCA_ROUTE4_POLICE-1], tca[TCA_RATE-1]);
+ if (err < 0)
+ return err;
}
#endif
return 0;
@@ -492,10 +475,10 @@
goto errout;
}
- cls_set_class(tp, &f->res.class, tp->q->ops->cl_ops->bind_tcf(tp->q, base, f->res.classid));
+ tcf_bind_filter(tp, &f->res, base);
#ifdef CONFIG_NET_CLS_POLICE
if (tb[TCA_ROUTE4_POLICE-1])
- f->police = tcf_police_locate(tb[TCA_ROUTE4_POLICE-1], tca[TCA_RATE-1]);
+ tcf_change_police(tp, &f->police, tb[TCA_ROUTE4_POLICE-1], tca[TCA_RATE-1]);
#endif
f->next = f1;
@@ -577,16 +560,8 @@
if (f->res.classid)
RTA_PUT(skb, TCA_ROUTE4_CLASSID, 4, &f->res.classid);
#ifdef CONFIG_NET_CLS_POLICE
- if (f->police) {
- struct rtattr * p_rta = (struct rtattr*)skb->tail;
-
- RTA_PUT(skb, TCA_ROUTE4_POLICE, 0, NULL);
-
- if (tcf_police_dump(skb, f->police) < 0)
- goto rtattr_failure;
-
- p_rta->rta_len = skb->tail - (u8*)p_rta;
- }
+ if (tcf_dump_police(skb, f->police, TCA_ROUTE4_POLICE) < 0)
+ goto rtattr_failure;
#endif
rta->rta_len = skb->tail - b;
^ permalink raw reply [flat|nested] 7+ messages in thread* [PATCH 2/4] cls_rsvp*: Use generic routines for class binding and police config/dump
2004-10-29 14:06 [PATCHSET 0/4] PKT_SCHED: More classifier cleanups Thomas Graf
2004-10-29 14:06 ` [PATCH 1/4] cls_route: Use generic routines for class binding and police config/dump Thomas Graf
@ 2004-10-29 14:07 ` Thomas Graf
2004-10-30 0:01 ` [RESEND " Thomas Graf
2004-10-29 14:08 ` [PATCH 3/4] cls_tcindex: " Thomas Graf
` (2 subsequent siblings)
4 siblings, 1 reply; 7+ messages in thread
From: Thomas Graf @ 2004-10-29 14:07 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev, hadi
Signed-off-by: Thomas Graf <tgraf@suug.ch>
--- linux-2.6.10-rc1-bk7.orig/net/sched/cls_rsvp.h 2004-10-29 11:18:17.000000000 +0200
+++ linux-2.6.10-rc1-bk7/net/sched/cls_rsvp.h 2004-10-29 11:24:07.000000000 +0200
@@ -272,11 +272,8 @@
struct rsvp_filter *f;
while ((f = s->ht[h2]) != NULL) {
- unsigned long cl;
-
s->ht[h2] = f->next;
- if ((cl = __cls_set_class(&f->res.class, 0)) != 0)
- tp->q->ops->cl_ops->unbind_tcf(tp->q, cl);
+ tcf_unbind_filter(tp, &f->res);
#ifdef CONFIG_NET_CLS_POLICE
tcf_police_release(f->police,TCA_ACT_UNBIND);
#endif
@@ -299,16 +296,10 @@
for (fp = &s->ht[(h>>8)&0xFF]; *fp; fp = &(*fp)->next) {
if (*fp == f) {
- unsigned long cl;
-
-
tcf_tree_lock(tp);
*fp = f->next;
tcf_tree_unlock(tp);
-
- if ((cl = cls_set_class(tp, &f->res.class, 0)) != 0)
- tp->q->ops->cl_ops->unbind_tcf(tp->q, cl);
-
+ tcf_unbind_filter(tp, &f->res);
#ifdef CONFIG_NET_CLS_POLICE
tcf_police_release(f->police,TCA_ACT_UNBIND);
#endif
@@ -437,22 +428,15 @@
if (f->handle != handle && handle)
return -EINVAL;
if (tb[TCA_RSVP_CLASSID-1]) {
- unsigned long cl;
-
f->res.classid = *(u32*)RTA_DATA(tb[TCA_RSVP_CLASSID-1]);
- cl = cls_set_class(tp, &f->res.class, tp->q->ops->cl_ops->bind_tcf(tp->q, base, f->res.classid));
- if (cl)
- tp->q->ops->cl_ops->unbind_tcf(tp->q, cl);
+ tcf_bind_filter(tp, &f->res, base);
}
#ifdef CONFIG_NET_CLS_POLICE
if (tb[TCA_RSVP_POLICE-1]) {
- struct tcf_police *police = tcf_police_locate(tb[TCA_RSVP_POLICE-1], tca[TCA_RATE-1]);
-
- tcf_tree_lock(tp);
- police = xchg(&f->police, police);
- tcf_tree_unlock(tp);
-
- tcf_police_release(police,TCA_ACT_UNBIND);
+ err = tcf_change_police(tp, &f->police,
+ tb[TCA_RSVP_POLICE-1], tca[TCA_RATE-1]);
+ if (err < 0)
+ return err;
}
#endif
return 0;
@@ -531,10 +515,10 @@
f->sess = s;
if (f->tunnelhdr == 0)
- cls_set_class(tp, &f->res.class, tp->q->ops->cl_ops->bind_tcf(tp->q, base, f->res.classid));
+ tcf_bind_filter(tp, &f->res, base);
#ifdef CONFIG_NET_CLS_POLICE
if (tb[TCA_RSVP_POLICE-1])
- f->police = tcf_police_locate(tb[TCA_RSVP_POLICE-1], tca[TCA_RATE-1]);
+ tcf_change_police(tp, &f->police, tb[TCA_RSVP_POLICE-1], tca[TCA_RATE-1]);
#endif
for (fp = &s->ht[h2]; *fp; fp = &(*fp)->next)
@@ -641,16 +625,8 @@
if (((f->handle>>8)&0xFF) != 16)
RTA_PUT(skb, TCA_RSVP_SRC, sizeof(f->src), f->src);
#ifdef CONFIG_NET_CLS_POLICE
- if (f->police) {
- struct rtattr * p_rta = (struct rtattr*)skb->tail;
-
- RTA_PUT(skb, TCA_RSVP_POLICE, 0, NULL);
-
- if (tcf_police_dump(skb, f->police) < 0)
- goto rtattr_failure;
-
- p_rta->rta_len = skb->tail - (u8*)p_rta;
- }
+ if (tcf_dump_police(skb, f->police, TCA_RSVP_POLICE) < 0)
+ got rtattr_failure;
#endif
rta->rta_len = skb->tail - b;
^ permalink raw reply [flat|nested] 7+ messages in thread* [RESEND 2/4] cls_rsvp*: Use generic routines for class binding and police config/dump
2004-10-29 14:07 ` [PATCH 2/4] cls_rsvp*: " Thomas Graf
@ 2004-10-30 0:01 ` Thomas Graf
0 siblings, 0 replies; 7+ messages in thread
From: Thomas Graf @ 2004-10-30 0:01 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev, hadi
Resend of original patch with a typo fix included.
Signed-off-by: Thomas Graf <tgraf@suug.ch>
--- linux-2.6.10-rc1-bk7.orig/net/sched/cls_rsvp.h 2004-10-29 11:18:17.000000000 +0200
+++ linux-2.6.10-rc1-bk7/net/sched/cls_rsvp.h 2004-10-29 11:24:07.000000000 +0200
@@ -272,11 +272,8 @@
struct rsvp_filter *f;
while ((f = s->ht[h2]) != NULL) {
- unsigned long cl;
-
s->ht[h2] = f->next;
- if ((cl = __cls_set_class(&f->res.class, 0)) != 0)
- tp->q->ops->cl_ops->unbind_tcf(tp->q, cl);
+ tcf_unbind_filter(tp, &f->res);
#ifdef CONFIG_NET_CLS_POLICE
tcf_police_release(f->police,TCA_ACT_UNBIND);
#endif
@@ -299,16 +296,10 @@
for (fp = &s->ht[(h>>8)&0xFF]; *fp; fp = &(*fp)->next) {
if (*fp == f) {
- unsigned long cl;
-
-
tcf_tree_lock(tp);
*fp = f->next;
tcf_tree_unlock(tp);
-
- if ((cl = cls_set_class(tp, &f->res.class, 0)) != 0)
- tp->q->ops->cl_ops->unbind_tcf(tp->q, cl);
-
+ tcf_unbind_filter(tp, &f->res);
#ifdef CONFIG_NET_CLS_POLICE
tcf_police_release(f->police,TCA_ACT_UNBIND);
#endif
@@ -437,22 +428,15 @@
if (f->handle != handle && handle)
return -EINVAL;
if (tb[TCA_RSVP_CLASSID-1]) {
- unsigned long cl;
-
f->res.classid = *(u32*)RTA_DATA(tb[TCA_RSVP_CLASSID-1]);
- cl = cls_set_class(tp, &f->res.class, tp->q->ops->cl_ops->bind_tcf(tp->q, base, f->res.classid));
- if (cl)
- tp->q->ops->cl_ops->unbind_tcf(tp->q, cl);
+ tcf_bind_filter(tp, &f->res, base);
}
#ifdef CONFIG_NET_CLS_POLICE
if (tb[TCA_RSVP_POLICE-1]) {
- struct tcf_police *police = tcf_police_locate(tb[TCA_RSVP_POLICE-1], tca[TCA_RATE-1]);
-
- tcf_tree_lock(tp);
- police = xchg(&f->police, police);
- tcf_tree_unlock(tp);
-
- tcf_police_release(police,TCA_ACT_UNBIND);
+ err = tcf_change_police(tp, &f->police,
+ tb[TCA_RSVP_POLICE-1], tca[TCA_RATE-1]);
+ if (err < 0)
+ return err;
}
#endif
return 0;
@@ -531,10 +515,10 @@
f->sess = s;
if (f->tunnelhdr == 0)
- cls_set_class(tp, &f->res.class, tp->q->ops->cl_ops->bind_tcf(tp->q, base, f->res.classid));
+ tcf_bind_filter(tp, &f->res, base);
#ifdef CONFIG_NET_CLS_POLICE
if (tb[TCA_RSVP_POLICE-1])
- f->police = tcf_police_locate(tb[TCA_RSVP_POLICE-1], tca[TCA_RATE-1]);
+ tcf_change_police(tp, &f->police, tb[TCA_RSVP_POLICE-1], tca[TCA_RATE-1]);
#endif
for (fp = &s->ht[h2]; *fp; fp = &(*fp)->next)
@@ -641,16 +625,8 @@
if (((f->handle>>8)&0xFF) != 16)
RTA_PUT(skb, TCA_RSVP_SRC, sizeof(f->src), f->src);
#ifdef CONFIG_NET_CLS_POLICE
- if (f->police) {
- struct rtattr * p_rta = (struct rtattr*)skb->tail;
-
- RTA_PUT(skb, TCA_RSVP_POLICE, 0, NULL);
-
- if (tcf_police_dump(skb, f->police) < 0)
- goto rtattr_failure;
-
- p_rta->rta_len = skb->tail - (u8*)p_rta;
- }
+ if (tcf_dump_police(skb, f->police, TCA_RSVP_POLICE) < 0)
+ goto rtattr_failure;
#endif
rta->rta_len = skb->tail - b;
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 3/4] cls_tcindex: Use generic routines for class binding and police config/dump
2004-10-29 14:06 [PATCHSET 0/4] PKT_SCHED: More classifier cleanups Thomas Graf
2004-10-29 14:06 ` [PATCH 1/4] cls_route: Use generic routines for class binding and police config/dump Thomas Graf
2004-10-29 14:07 ` [PATCH 2/4] cls_rsvp*: " Thomas Graf
@ 2004-10-29 14:08 ` Thomas Graf
2004-10-29 14:09 ` [PATCH 4/4] cls_u32: Use generic routines for class binding and police/action config/dump Thomas Graf
2004-11-02 1:06 ` [PATCHSET 0/4] PKT_SCHED: More classifier cleanups David S. Miller
4 siblings, 0 replies; 7+ messages in thread
From: Thomas Graf @ 2004-10-29 14:08 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev, hadi
Signed-off-by: Thomas Graf <tgraf@suug.ch>
--- linux-2.6.10-rc1-bk7.orig/net/sched/cls_tcindex.c 2004-10-28 22:03:29.000000000 +0200
+++ linux-2.6.10-rc1-bk7/net/sched/cls_tcindex.c 2004-10-29 11:43:29.000000000 +0200
@@ -165,7 +165,6 @@
struct tcindex_data *p = PRIV(tp);
struct tcindex_filter_result *r = (struct tcindex_filter_result *) arg;
struct tcindex_filter *f = NULL;
- unsigned long cl;
DPRINTK("tcindex_delete(tp %p,arg 0x%lx),p %p,f %p\n",tp,arg,p,f);
if (p->perfect) {
@@ -187,9 +186,7 @@
*walk = f->next;
tcf_tree_unlock(tp);
}
- cl = __cls_set_class(&r->res.class,0);
- if (cl)
- tp->q->ops->cl_ops->unbind_tcf(tp->q,cl);
+ tcf_unbind_filter(tp, &r->res);
#ifdef CONFIG_NET_CLS_POLICE
tcf_police_release(r->police, TCA_ACT_UNBIND);
#endif
@@ -313,28 +310,19 @@
}
DPRINTK("r=%p\n",r);
if (tb[TCA_TCINDEX_CLASSID-1]) {
- unsigned long cl = cls_set_class(tp,&r->res.class,0);
-
- if (cl)
- tp->q->ops->cl_ops->unbind_tcf(tp->q,cl);
r->res.classid = *(__u32 *) RTA_DATA(tb[TCA_TCINDEX_CLASSID-1]);
- r->res.class = tp->q->ops->cl_ops->bind_tcf(tp->q,base,
- r->res.classid);
+ tcf_bind_filter(tp, &r->res, base);
+
if (!r->res.class) {
r->res.classid = 0;
return -ENOENT;
}
- }
+ }
#ifdef CONFIG_NET_CLS_POLICE
- {
- struct tcf_police *police;
-
- police = tb[TCA_TCINDEX_POLICE-1] ?
- tcf_police_locate(tb[TCA_TCINDEX_POLICE-1],NULL) : NULL;
- tcf_tree_lock(tp);
- police = xchg(&r->police,police);
- tcf_tree_unlock(tp);
- tcf_police_release(police,TCA_ACT_UNBIND);
+ if (tb[TCA_TCINDEX_POLICE-1]) {
+ int err = tcf_change_police(tp, &r->police, tb[TCA_TCINDEX_POLICE-1], NULL);
+ if (err < 0)
+ return err;
}
#endif
if (r != &new_filter_result)
@@ -459,14 +447,8 @@
if (r->res.class)
RTA_PUT(skb, TCA_TCINDEX_CLASSID, 4, &r->res.classid);
#ifdef CONFIG_NET_CLS_POLICE
- if (r->police) {
- struct rtattr *p_rta = (struct rtattr *) skb->tail;
-
- RTA_PUT(skb,TCA_TCINDEX_POLICE,0,NULL);
- if (tcf_police_dump(skb,r->police) < 0)
- goto rtattr_failure;
- p_rta->rta_len = skb->tail-(u8 *) p_rta;
- }
+ if (tcf_dump_police(skb, r->police, TCA_TCINDEX_POLICE) < 0)
+ goto rtattr_failure;
#endif
}
rta->rta_len = skb->tail-b;
^ permalink raw reply [flat|nested] 7+ messages in thread* [PATCH 4/4] cls_u32: Use generic routines for class binding and police/action config/dump
2004-10-29 14:06 [PATCHSET 0/4] PKT_SCHED: More classifier cleanups Thomas Graf
` (2 preceding siblings ...)
2004-10-29 14:08 ` [PATCH 3/4] cls_tcindex: " Thomas Graf
@ 2004-10-29 14:09 ` Thomas Graf
2004-11-02 1:06 ` [PATCHSET 0/4] PKT_SCHED: More classifier cleanups David S. Miller
4 siblings, 0 replies; 7+ messages in thread
From: Thomas Graf @ 2004-10-29 14:09 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev, hadi
Signed-off-by: Thomas Graf <tgraf@suug.ch>
--- linux-2.6.10-rc1-bk7.orig/net/sched/cls_u32.c 2004-10-28 22:03:29.000000000 +0200
+++ linux-2.6.10-rc1-bk7/net/sched/cls_u32.c 2004-10-29 12:04:11.000000000 +0200
@@ -156,18 +156,9 @@
*res = n->res;
#ifdef CONFIG_NET_CLS_IND
- /* yes, i know it sucks but the feature is
- ** optional dammit! - JHS */
- if (0 != n->indev[0]) {
- if (NULL == skb->input_dev) {
- n = n->next;
- goto next_knode;
- } else {
- if (0 != strcmp(n->indev, skb->input_dev->name)) {
- n = n->next;
- goto next_knode;
- }
- }
+ if (!tcf_match_indev(skb, n->indev)) {
+ n = n->next;
+ goto next_knode;
}
#endif
#ifdef CONFIG_CLS_U32_PERF
@@ -346,10 +337,7 @@
static int u32_destroy_key(struct tcf_proto *tp, struct tc_u_knode *n)
{
- unsigned long cl;
-
- if ((cl = __cls_set_class(&n->res.class, 0)) != 0)
- tp->q->ops->cl_ops->unbind_tcf(tp->q, cl);
+ tcf_unbind_filter(tp, &n->res);
#ifdef CONFIG_NET_CLS_ACT
if (n->action) {
tcf_action_destroy(n->action, TCA_ACT_UNBIND);
@@ -495,15 +483,11 @@
return handle|(i>0xFFF ? 0xFFF : i);
}
-static int u32_set_parms(struct Qdisc *q, unsigned long base,
+static int u32_set_parms(struct tcf_proto *tp, unsigned long base,
struct tc_u_hnode *ht,
struct tc_u_knode *n, struct rtattr **tb,
struct rtattr *est)
{
-#ifdef CONFIG_NET_CLS_ACT
- struct tc_action *act = NULL;
- int ret;
-#endif
if (tb[TCA_U32_LINK-1]) {
u32 handle = *(u32*)RTA_DATA(tb[TCA_U32_LINK-1]);
struct tc_u_hnode *ht_down = NULL;
@@ -519,88 +503,43 @@
ht_down->refcnt++;
}
- sch_tree_lock(q);
+ tcf_tree_lock(tp);
ht_down = xchg(&n->ht_down, ht_down);
- sch_tree_unlock(q);
+ tcf_tree_unlock(tp);
if (ht_down)
ht_down->refcnt--;
}
if (tb[TCA_U32_CLASSID-1]) {
- unsigned long cl;
-
n->res.classid = *(u32*)RTA_DATA(tb[TCA_U32_CLASSID-1]);
- sch_tree_lock(q);
- cl = __cls_set_class(&n->res.class, q->ops->cl_ops->bind_tcf(q, base, n->res.classid));
- sch_tree_unlock(q);
- if (cl)
- q->ops->cl_ops->unbind_tcf(q, cl);
+ tcf_bind_filter(tp, &n->res, base);
}
#ifdef CONFIG_NET_CLS_ACT
- /*backward compatibility */
- if (tb[TCA_U32_POLICE-1])
- {
- act = kmalloc(sizeof(*act),GFP_KERNEL);
- if (NULL == act)
- return -ENOMEM;
-
- memset(act,0,sizeof(*act));
- ret = tcf_action_init_1(tb[TCA_U32_POLICE-1], est,act,"police", TCA_ACT_NOREPLACE, TCA_ACT_BIND);
- if (0 > ret){
- tcf_action_destroy(act, TCA_ACT_UNBIND);
- return ret;
- }
- act->type = TCA_OLD_COMPAT;
-
- sch_tree_lock(q);
- act = xchg(&n->action, act);
- sch_tree_unlock(q);
-
- tcf_action_destroy(act, TCA_ACT_UNBIND);
-
+ if (tb[TCA_U32_POLICE-1]) {
+ int err = tcf_change_act_police(tp, &n->action, tb[TCA_U32_POLICE-1], est);
+ if (err < 0)
+ return err;
}
- if(tb[TCA_U32_ACT-1]) {
- act = kmalloc(sizeof(*act),GFP_KERNEL);
- if (NULL == act)
- return -ENOMEM;
- memset(act,0,sizeof(*act));
- ret = tcf_action_init(tb[TCA_U32_ACT-1], est,act,NULL,TCA_ACT_NOREPLACE, TCA_ACT_BIND);
- if (0 > ret) {
- tcf_action_destroy(act, TCA_ACT_UNBIND);
- return ret;
- }
-
- sch_tree_lock(q);
- act = xchg(&n->action, act);
- sch_tree_unlock(q);
-
- tcf_action_destroy(act, TCA_ACT_UNBIND);
+ if (tb[TCA_U32_ACT-1]) {
+ int err = tcf_change_act(tp, &n->action, tb[TCA_U32_ACT-1], est);
+ if (err < 0)
+ return err;
}
-
-
#else
#ifdef CONFIG_NET_CLS_POLICE
if (tb[TCA_U32_POLICE-1]) {
- struct tcf_police *police = tcf_police_locate(tb[TCA_U32_POLICE-1], est);
- sch_tree_lock(q);
- police = xchg(&n->police, police);
- sch_tree_unlock(q);
- tcf_police_release(police, TCA_ACT_UNBIND);
+ int err = tcf_change_police(tp, &n->police, tb[TCA_U32_POLICE-1], est);
+ if (err < 0)
+ return err;
}
#endif
#endif
#ifdef CONFIG_NET_CLS_IND
- n->indev[0] = 0;
- if(tb[TCA_U32_INDEV-1]) {
- struct rtattr *input_dev = tb[TCA_U32_INDEV-1];
- if (RTA_PAYLOAD(input_dev) >= IFNAMSIZ) {
- printk("cls_u32: bad indev name %s\n",(char*)RTA_DATA(input_dev));
- /* should we clear state first? */
- return -EINVAL;
- }
- sprintf(n->indev, "%s", (char*)RTA_DATA(input_dev));
- printk("got IND %s\n",n->indev);
+ if (tb[TCA_U32_INDEV-1]) {
+ int err = tcf_change_indev(tp, n->indev, tb[TCA_U32_INDEV-1]);
+ if (err < 0)
+ return err;
}
#endif
@@ -630,7 +569,7 @@
if (TC_U32_KEY(n->handle) == 0)
return -EINVAL;
- return u32_set_parms(tp->q, base, n->ht_up, n, tb, tca[TCA_RATE-1]);
+ return u32_set_parms(tp, base, n->ht_up, n, tb, tca[TCA_RATE-1]);
}
if (tb[TCA_U32_DIVISOR-1]) {
@@ -718,7 +657,7 @@
}
n->fshift = i;
}
- err = u32_set_parms(tp->q, base, ht, n, tb, tca[TCA_RATE-1]);
+ err = u32_set_parms(tp, base, ht, n, tb, tca[TCA_RATE-1]);
if (err == 0) {
struct tc_u_knode **ins;
for (ins = &ht->ht[TC_U32_HASH(handle)]; *ins; ins = &(*ins)->next)
@@ -806,49 +745,18 @@
if (n->ht_down)
RTA_PUT(skb, TCA_U32_LINK, 4, &n->ht_down->handle);
#ifdef CONFIG_NET_CLS_ACT
- /* again for backward compatible mode - we want
- * to work with both old and new modes of entering
- * tc data even if iproute2 was newer - jhs
- */
- if (n->action) {
- struct rtattr * p_rta = (struct rtattr*)skb->tail;
-
- if (n->action->type != TCA_OLD_COMPAT) {
- RTA_PUT(skb, TCA_U32_ACT, 0, NULL);
- if (tcf_action_dump(skb,n->action, 0, 0) < 0) {
- goto rtattr_failure;
- }
- } else {
- RTA_PUT(skb, TCA_U32_POLICE, 0, NULL);
- if (tcf_action_dump_old(skb,n->action,0,0) < 0) {
- goto rtattr_failure;
- }
- }
-
- p_rta->rta_len = skb->tail - (u8*)p_rta;
- }
-
+ if (tcf_dump_act(skb, n->action, TCA_U32_ACT, TCA_U32_POLICE) < 0)
+ goto rtattr_failure;
#else
#ifdef CONFIG_NET_CLS_POLICE
- if (n->police) {
- struct rtattr * p_rta = (struct rtattr*)skb->tail;
- RTA_PUT(skb, TCA_U32_POLICE, 0, NULL);
-
- if (tcf_police_dump(skb, n->police) < 0)
- goto rtattr_failure;
-
- p_rta->rta_len = skb->tail - (u8*)p_rta;
-
- }
+ if (tcf_dump_police(skb, n->police, TCA_U32_POLICE) < 0)
+ goto rtattr_failure;
#endif
#endif
#ifdef CONFIG_NET_CLS_IND
- if(strlen(n->indev)) {
- struct rtattr * p_rta = (struct rtattr*)skb->tail;
+ if(strlen(n->indev))
RTA_PUT(skb, TCA_U32_INDEV, IFNAMSIZ, n->indev);
- p_rta->rta_len = skb->tail - (u8*)p_rta;
- }
#endif
#ifdef CONFIG_CLS_U32_PERF
RTA_PUT(skb, TCA_U32_PCNT,
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCHSET 0/4] PKT_SCHED: More classifier cleanups
2004-10-29 14:06 [PATCHSET 0/4] PKT_SCHED: More classifier cleanups Thomas Graf
` (3 preceding siblings ...)
2004-10-29 14:09 ` [PATCH 4/4] cls_u32: Use generic routines for class binding and police/action config/dump Thomas Graf
@ 2004-11-02 1:06 ` David S. Miller
4 siblings, 0 replies; 7+ messages in thread
From: David S. Miller @ 2004-11-02 1:06 UTC (permalink / raw)
To: Thomas Graf; +Cc: netdev, hadi
On Fri, 29 Oct 2004 16:06:12 +0200
Thomas Graf <tgraf@suug.ch> wrote:
> Cleans up route,rsvp,tcindex, and u32 classifier to
> use the generic classifier routines.
>
> All trivial changes not changing any behaviour.
>
> Relative to patchset "Generic classifier routines / cls_fw cleanup"
All applied, thanks a lot Thomas.
^ permalink raw reply [flat|nested] 7+ messages in thread