From: Cong Wang <xiyou.wangcong@gmail.com>
To: netdev@vger.kernel.org
Cc: Cong Wang <xiyou.wangcong@gmail.com>,
Martin Olsson <martin.olsson+netdev@sentorsecurity.com>,
Jamal Hadi Salim <jhs@mojatatu.com>,
Jiri Pirko <jiri@resnulli.us>, David Ahern <dsahern@gmail.com>
Subject: [Patch iproute2] tc: add hit counter for matchall
Date: Thu, 17 Jan 2019 13:18:55 -0800 [thread overview]
Message-ID: <20190117211855.31030-1-xiyou.wangcong@gmail.com> (raw)
Cc: Martin Olsson <martin.olsson+netdev@sentorsecurity.com>
Cc: Jamal Hadi Salim <jhs@mojatatu.com>
Cc: Jiri Pirko <jiri@resnulli.us>
Cc: David Ahern <dsahern@gmail.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
---
tc/f_matchall.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/tc/f_matchall.c b/tc/f_matchall.c
index 5ebd0415..03dd51de 100644
--- a/tc/f_matchall.c
+++ b/tc/f_matchall.c
@@ -114,6 +114,7 @@ static int matchall_print_opt(struct filter_util *qu, FILE *f,
struct rtattr *opt, __u32 handle)
{
struct rtattr *tb[TCA_MATCHALL_MAX+1];
+ struct tc_matchall_pcnt *pf = NULL;
if (opt == NULL)
return 0;
@@ -143,6 +144,19 @@ static int matchall_print_opt(struct filter_util *qu, FILE *f,
print_bool(PRINT_ANY, "not_in_hw", "\n not_in_hw", true);
}
+ if (tb[TCA_MATCHALL_PCNT]) {
+ if (RTA_PAYLOAD(tb[TCA_MATCHALL_PCNT]) < sizeof(*pf)) {
+ print_string(PRINT_FP, NULL, "Broken perf counters\n", NULL);
+ return -1;
+ }
+ pf = RTA_DATA(tb[TCA_MATCHALL_PCNT]);
+ }
+
+ if (show_stats && NULL != pf)
+ print_u64(PRINT_ANY, "rule_hit", " (rule hit %llu)",
+ (unsigned long long) pf->rhit);
+
+
if (tb[TCA_MATCHALL_ACT])
tc_print_action(f, tb[TCA_MATCHALL_ACT], 0);
--
2.20.1
next reply other threads:[~2019-01-17 21:19 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-17 21:18 Cong Wang [this message]
2019-01-21 16:35 ` [Patch iproute2] tc: add hit counter for matchall David Ahern
2019-01-23 5:08 ` Cong Wang
2019-01-23 20:47 ` Stephen Hemminger
2019-01-24 1:16 ` Cong Wang
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=20190117211855.31030-1-xiyou.wangcong@gmail.com \
--to=xiyou.wangcong@gmail.com \
--cc=dsahern@gmail.com \
--cc=jhs@mojatatu.com \
--cc=jiri@resnulli.us \
--cc=martin.olsson+netdev@sentorsecurity.com \
--cc=netdev@vger.kernel.org \
/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