From: Vlad Buslov <vladbu@nvidia.com>
To: dsahern@gmail.com, stephen@networkplumber.org
Cc: netdev@vger.kernel.org, Vlad Buslov <vladbu@mellanox.com>,
Jiri Pirko <jiri@mellanox.com>
Subject: [RESEND PATCH iproute2-next 2/2] tc: implement support for terse dump
Date: Wed, 30 Sep 2020 10:36:51 +0300 [thread overview]
Message-ID: <20200930073651.31247-3-vladbu@nvidia.com> (raw)
In-Reply-To: <20200930073651.31247-1-vladbu@nvidia.com>
From: Vlad Buslov <vladbu@mellanox.com>
Implement support for classifier/action terse dump using new TCA_DUMP_FLAGS
tlv with only available flag value TCA_DUMP_FLAGS_TERSE. Set the flag when
user requested it with following example CLI:
> tc -s filter show terse dev ens1f0 ingress
In terse mode dump only outputs essential data needed to identify the
filter and action (handle, cookie, etc.) and stats, if requested by the
user. The intention is to significantly improve rule dump rate by omitting
all static data that do not change after rule is created.
Signed-off-by: Vlad Buslov <vladbu@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
---
tc/tc_filter.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/tc/tc_filter.c b/tc/tc_filter.c
index c591a19f3123..6a82f9bb42fb 100644
--- a/tc/tc_filter.c
+++ b/tc/tc_filter.c
@@ -595,6 +595,7 @@ static int tc_filter_list(int cmd, int argc, char **argv)
.t.tcm_parent = TC_H_UNSPEC,
.t.tcm_family = AF_UNSPEC,
};
+ bool terse_dump = false;
char d[IFNAMSIZ] = {};
__u32 prio = 0;
__u32 protocol = 0;
@@ -687,6 +688,8 @@ static int tc_filter_list(int cmd, int argc, char **argv)
invarg("invalid chain index value", *argv);
filter_chain_index_set = 1;
filter_chain_index = chain_index;
+ } else if (matches(*argv, "terse") == 0) {
+ terse_dump = true;
} else if (matches(*argv, "help") == 0) {
usage();
} else {
@@ -721,6 +724,15 @@ static int tc_filter_list(int cmd, int argc, char **argv)
if (filter_chain_index_set)
addattr32(&req.n, sizeof(req), TCA_CHAIN, chain_index);
+ if (terse_dump) {
+ struct nla_bitfield32 flags = {
+ .value = TCA_DUMP_FLAGS_TERSE,
+ .selector = TCA_DUMP_FLAGS_TERSE
+ };
+
+ addattr_l(&req.n, MAX_MSG, TCA_DUMP_FLAGS, &flags, sizeof(flags));
+ }
+
if (rtnl_dump_request_n(&rth, &req.n) < 0) {
perror("Cannot send dump request");
return 1;
--
2.21.0
next prev parent reply other threads:[~2020-09-30 7:37 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-30 7:36 [RESEND PATCH iproute2-next 0/2] Implement filter terse dump mode support Vlad Buslov
2020-09-30 7:36 ` [RESEND PATCH iproute2-next 1/2] tc: skip actions that don't have options attribute when printing Vlad Buslov
2020-09-30 7:36 ` Vlad Buslov [this message]
2020-09-30 15:57 ` [RESEND PATCH iproute2-next 2/2] tc: implement support for terse dump David Ahern
2020-09-30 17:02 ` Vlad Buslov
2020-09-30 17:33 ` Stephen Hemminger
2020-09-30 20:11 ` Vlad Buslov
2020-09-30 11:31 ` [RESEND PATCH iproute2-next 0/2] Implement filter terse dump mode support Ivan Vecera
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=20200930073651.31247-3-vladbu@nvidia.com \
--to=vladbu@nvidia.com \
--cc=dsahern@gmail.com \
--cc=jiri@mellanox.com \
--cc=netdev@vger.kernel.org \
--cc=stephen@networkplumber.org \
--cc=vladbu@mellanox.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).