netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Graf <tgraf@suug.ch>
To: "David S. Miller" <davem@davemloft.net>
Cc: netdev@oss.sgi.com
Subject: [PATCH] PKT_SCHED: Provide compat policer stats in action policer
Date: Wed, 15 Dec 2004 14:01:28 +0100	[thread overview]
Message-ID: <20041215130128.GK8493@postel.suug.ch> (raw)

Dave,

This should go in before 2.6.10. It fixes a forgotten case to provide
police backward compatibility statistics for old iproute2 versions
running on a new kernel with actions enabled. Should make distributions
happy with older iproute2 versions and all-included kernel configs
since they probably favour actions over plain policer.

Testing results:
  iproute2-2.4.7 on 2.6.10-rc3-bk8:
  cls-police: police creation succeeded
  cls-police: Sending 10 ICMP echo requests
  cls-police: police dumping succeeded with output:
  filter protocol ip pref 10 u32 
  filter protocol ip pref 10 u32 fh 800: ht divisor 1 
  filter protocol ip pref 10 u32 fh 800::800 order 2048 key ht 800 bkt 0 flowid 10:12 
  police 3 action drop rate 2Kbit burst 10Kb mtu 2Kb 
    match 00010000/00ff0000 at 8
   Sent 420 bytes 10 pkts (dropped 0, overlimits 0)  <-- This would have been missing
  cls-police: police deletion succeeded

 iproute2-2.6.9 on 2.6.10-rc3-bk8:
 ...
  filter protocol ip pref 10 u32 
  filter protocol ip pref 10 u32 fh 800: ht divisor 1 
  filter protocol ip pref 10 u32 fh 800::800 order 2048 key ht 800 bkt 0 flowid 10:12  (rule hit 10 success 10)
    match 00010000/00ff0000 at 8 (success 10 ) 
   police 0x4 rate 2000bit burst 10Kb mtu 2Kb action drop 
  ref 1 bind 1
   Sent 420 bytes 10 pkts (dropped 0, overlimits 0) 
 ...

 (Same results for fw classifier)

Signed-off-by: Thomas Graf <tgraf@suug.ch>

--- linux-2.6.10-rc3-bk7.orig/net/sched/act_api.c	2004-12-14 14:24:34.000000000 +0100
+++ linux-2.6.10-rc3-bk7/net/sched/act_api.c	2004-12-14 16:15:13.000000000 +0100
@@ -418,6 +418,7 @@
 
 int tcf_action_copy_stats (struct sk_buff *skb,struct tc_action *a)
 {
+	int err;
 	struct gnet_dump d;
 	struct tcf_act_hdr *h = a->priv;
 	
@@ -428,7 +429,14 @@
 	if (NULL == h)
 		goto errout;
 
-	if (gnet_stats_start_copy(skb, TCA_ACT_STATS, h->stats_lock, &d) < 0)
+	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
+		err = gnet_stats_start_copy(skb, TCA_ACT_STATS,
+			h->stats_lock, &d);
+
+	if (err < 0)
 		goto errout;
 
 	if (NULL != a->ops && NULL != a->ops->get_stats)

             reply	other threads:[~2004-12-15 13:01 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-15 13:01 Thomas Graf [this message]
2004-12-15 14:09 ` [PATCH] PKT_SCHED: Provide compat policer stats in action policer jamal
2004-12-15 15:22   ` Thomas Graf
2004-12-15 15:42   ` Patrick McHardy
2004-12-19 19:24     ` jamal
2004-12-20 10:17       ` Patrick McHardy
2004-12-20 14:03         ` Thomas Graf
2004-12-20 14:32           ` jamal
2004-12-20 14:27         ` jamal
2004-12-21  0:16           ` Thomas Graf
2004-12-22 13:10             ` jamal
2004-12-22 13:32               ` Thomas Graf
2004-12-22 13:54                 ` jamal
2004-12-21 10:11           ` Patrick McHardy
2004-12-20 23:51 ` David S. Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20041215130128.GK8493@postel.suug.ch \
    --to=tgraf@suug.ch \
    --cc=davem@davemloft.net \
    --cc=netdev@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).