aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@sunset.davemloft.net>2005-03-30 00:39:35 -0800
committerDavid S. Miller <davem@sunset.davemloft.net>2005-03-30 00:39:35 -0800
commit5f05eea685e77af818cb771d42e422e92bcde664 (patch)
treea6d32f872af04b5c4c0c3f1475d706c80df317d2
parent4f57d2511a796c775352f587a86f2cfc989bfcfc (diff)
parent7a69697fdef4f3d51ffbb931885eb387f28e9a2f (diff)
downloadhistory-5f05eea685e77af818cb771d42e422e92bcde664.tar.gz
Merge bk://kernel.bkbits.net/tgraf/net-2.6-tcf_exts
into sunset.davemloft.net:/home/davem/src/BK/net-2.6
-rw-r--r--include/net/act_api.h2
-rw-r--r--net/core/gen_stats.c10
-rw-r--r--net/sched/act_api.c19
-rw-r--r--net/sched/cls_api.c2
-rw-r--r--net/sched/cls_fw.c5
-rw-r--r--net/sched/cls_route.c5
-rw-r--r--net/sched/cls_tcindex.c5
-rw-r--r--net/sched/cls_u32.c2
8 files changed, 28 insertions, 22 deletions
diff --git a/include/net/act_api.h b/include/net/act_api.h
index 12736d17d3a30..ed00a995f576f 100644
--- a/include/net/act_api.h
+++ b/include/net/act_api.h
@@ -81,7 +81,7 @@ extern struct tc_action *tcf_action_init_1(struct rtattr *rta, struct rtattr *es
extern int tcf_action_dump(struct sk_buff *skb, struct tc_action *a, int, int);
extern int tcf_action_dump_old(struct sk_buff *skb, struct tc_action *a, int, int);
extern int tcf_action_dump_1(struct sk_buff *skb, struct tc_action *a, int, int);
-extern int tcf_action_copy_stats (struct sk_buff *,struct tc_action *);
+extern int tcf_action_copy_stats (struct sk_buff *,struct tc_action *, int);
#endif /* CONFIG_NET_CLS_ACT */
extern int tcf_police(struct sk_buff *skb, struct tcf_police *p);
diff --git a/net/core/gen_stats.c b/net/core/gen_stats.c
index 86cd889d0e2bf..ebb86fbd23ab6 100644
--- a/net/core/gen_stats.c
+++ b/net/core/gen_stats.c
@@ -26,7 +26,9 @@
static inline int
gnet_stats_copy(struct gnet_dump *d, int type, void *buf, int size)
{
- RTA_PUT(d->skb, type, size, buf);
+ if (type)
+ RTA_PUT(d->skb, type, size, buf);
+
return 0;
rtattr_failure:
@@ -58,7 +60,8 @@ gnet_stats_start_copy_compat(struct sk_buff *skb, int type, int tc_stats_type,
{
spin_lock_bh(lock);
d->lock = lock;
- d->tail = (struct rtattr *) skb->tail;
+ if (type)
+ d->tail = (struct rtattr *) skb->tail;
d->skb = skb;
d->compat_tc_stats = tc_stats_type;
d->compat_xstats = xstats_type;
@@ -194,7 +197,8 @@ gnet_stats_copy_app(struct gnet_dump *d, void *st, int len)
int
gnet_stats_finish_copy(struct gnet_dump *d)
{
- d->tail->rta_len = d->skb->tail - (u8 *) d->tail;
+ if (d->tail)
+ d->tail->rta_len = d->skb->tail - (u8 *) d->tail;
if (d->compat_tc_stats)
if (gnet_stats_copy(d, d->compat_tc_stats, &d->tc_stats,
diff --git a/net/sched/act_api.c b/net/sched/act_api.c
index eebef4e16a2f9..88962fa33199f 100644
--- a/net/sched/act_api.c
+++ b/net/sched/act_api.c
@@ -228,7 +228,7 @@ tcf_action_dump_1(struct sk_buff *skb, struct tc_action *a, int bind, int ref)
return err;
RTA_PUT(skb, TCA_KIND, IFNAMSIZ, a->ops->kind);
- if (tcf_action_copy_stats(skb, a))
+ if (tcf_action_copy_stats(skb, a, 0))
goto rtattr_failure;
r = (struct rtattr*) skb->tail;
RTA_PUT(skb, TCA_OPTIONS, 0, NULL);
@@ -380,19 +380,24 @@ err:
return NULL;
}
-int tcf_action_copy_stats(struct sk_buff *skb, struct tc_action *a)
+int tcf_action_copy_stats(struct sk_buff *skb, struct tc_action *a,
+ int compat_mode)
{
- int err;
+ int err = 0;
struct gnet_dump d;
struct tcf_act_hdr *h = a->priv;
if (h == NULL)
goto errout;
- if (a->type == TCA_OLD_COMPAT)
- err = gnet_stats_start_copy_compat(skb, TCA_ACT_STATS,
- TCA_STATS, TCA_XSTATS, h->stats_lock, &d);
- else
+ /* compat_mode being true specifies a call that is supposed
+ * to add additional backward compatiblity statistic TLVs.
+ */
+ if (compat_mode) {
+ if (a->type == TCA_OLD_COMPAT)
+ err = gnet_stats_start_copy_compat(skb, 0,
+ TCA_STATS, TCA_XSTATS, h->stats_lock, &d);
+ } else
err = gnet_stats_start_copy(skb, TCA_ACT_STATS,
h->stats_lock, &d);
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
index fe85d5588b46e..56e66c3fe0fa0 100644
--- a/net/sched/cls_api.c
+++ b/net/sched/cls_api.c
@@ -602,7 +602,7 @@ tcf_exts_dump_stats(struct sk_buff *skb, struct tcf_exts *exts,
{
#ifdef CONFIG_NET_CLS_ACT
if (exts->action)
- if (tcf_action_copy_stats(skb, exts->action) < 0)
+ if (tcf_action_copy_stats(skb, exts->action, 1) < 0)
goto rtattr_failure;
#elif defined CONFIG_NET_CLS_POLICE
if (exts->police)
diff --git a/net/sched/cls_fw.c b/net/sched/cls_fw.c
index b38af11f3935d..fdfc83af3d1f0 100644
--- a/net/sched/cls_fw.c
+++ b/net/sched/cls_fw.c
@@ -338,9 +338,8 @@ static int fw_dump(struct tcf_proto *tp, unsigned long fh,
rta->rta_len = skb->tail - b;
- if (f->exts.action && f->exts.action->type == TCA_OLD_COMPAT)
- if (tcf_exts_dump_stats(skb, &f->exts, &fw_ext_map) < 0)
- goto rtattr_failure;
+ if (tcf_exts_dump_stats(skb, &f->exts, &fw_ext_map) < 0)
+ goto rtattr_failure;
return skb->len;
diff --git a/net/sched/cls_route.c b/net/sched/cls_route.c
index 32cfa1043d881..02996ac05c75d 100644
--- a/net/sched/cls_route.c
+++ b/net/sched/cls_route.c
@@ -599,9 +599,8 @@ static int route4_dump(struct tcf_proto *tp, unsigned long fh,
rta->rta_len = skb->tail - b;
- if (f->exts.action && f->exts.action->type == TCA_OLD_COMPAT)
- if (tcf_exts_dump_stats(skb, &f->exts, &route_ext_map) < 0)
- goto rtattr_failure;
+ if (tcf_exts_dump_stats(skb, &f->exts, &route_ext_map) < 0)
+ goto rtattr_failure;
return skb->len;
diff --git a/net/sched/cls_tcindex.c b/net/sched/cls_tcindex.c
index d746598906d58..404d9d83a7fab 100644
--- a/net/sched/cls_tcindex.c
+++ b/net/sched/cls_tcindex.c
@@ -496,9 +496,8 @@ static int tcindex_dump(struct tcf_proto *tp, unsigned long fh,
goto rtattr_failure;
rta->rta_len = skb->tail-b;
- if (r->exts.action && r->exts.action->type == TCA_OLD_COMPAT)
- if (tcf_exts_dump_stats(skb, &r->exts, &tcindex_ext_map) < 0)
- goto rtattr_failure;
+ if (tcf_exts_dump_stats(skb, &r->exts, &tcindex_ext_map) < 0)
+ goto rtattr_failure;
}
return skb->len;
diff --git a/net/sched/cls_u32.c b/net/sched/cls_u32.c
index 550058c0cb5f5..364b87d86455d 100644
--- a/net/sched/cls_u32.c
+++ b/net/sched/cls_u32.c
@@ -775,7 +775,7 @@ static int u32_dump(struct tcf_proto *tp, unsigned long fh,
}
rta->rta_len = skb->tail - b;
- if (TC_U32_KEY(n->handle) && n->exts.action && n->exts.action->type == TCA_OLD_COMPAT)
+ if (TC_U32_KEY(n->handle))
if (tcf_exts_dump_stats(skb, &n->exts, &u32_ext_map) < 0)
goto rtattr_failure;
return skb->len;