* [PATCH iproute2-next 0/2] Implement action terse dump
@ 2020-11-30 19:32 Vlad Buslov
2020-11-30 19:32 ` [PATCH iproute2-next 1/2] tc: use TCA_ACT_ prefix for action flags Vlad Buslov
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Vlad Buslov @ 2020-11-30 19:32 UTC (permalink / raw)
To: jhs, dsahern, stephen
Cc: netdev, davem, kuba, xiyou.wangcong, jiri, Vlad Buslov
Refactor action flags according to recommended kernel upstream naming using
TCA_ACT_ prefix. Implement support for new action terse dump flag.
Vlad Buslov (2):
tc: use TCA_ACT_ prefix for action flags
tc: implement support for action terse dump
include/uapi/linux/rtnetlink.h | 12 +++++++-----
man/man8/tc.8 | 2 +-
tc/m_action.c | 13 +++++++++++--
3 files changed, 19 insertions(+), 8 deletions(-)
--
2.29.2
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH iproute2-next 1/2] tc: use TCA_ACT_ prefix for action flags
2020-11-30 19:32 [PATCH iproute2-next 0/2] Implement action terse dump Vlad Buslov
@ 2020-11-30 19:32 ` Vlad Buslov
2020-11-30 19:32 ` [PATCH iproute2-next 2/2] tc: implement support for action terse dump Vlad Buslov
2020-12-03 3:50 ` [PATCH iproute2-next 0/2] Implement " David Ahern
2 siblings, 0 replies; 4+ messages in thread
From: Vlad Buslov @ 2020-11-30 19:32 UTC (permalink / raw)
To: jhs, dsahern, stephen
Cc: netdev, davem, kuba, xiyou.wangcong, jiri, Vlad Buslov
Use TCA_ACT_FLAG_LARGE_DUMP_ON alias according to new preferred naming for
action flags.
Signed-off-by: Vlad Buslov <vlad@buslov.dev>
---
include/uapi/linux/rtnetlink.h | 12 +++++++-----
tc/m_action.c | 4 ++--
2 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/include/uapi/linux/rtnetlink.h b/include/uapi/linux/rtnetlink.h
index 749878a5a6f2..c66fd247d90a 100644
--- a/include/uapi/linux/rtnetlink.h
+++ b/include/uapi/linux/rtnetlink.h
@@ -766,16 +766,18 @@ enum {
#define TA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct tcamsg))
/* tcamsg flags stored in attribute TCA_ROOT_FLAGS
*
- * TCA_FLAG_LARGE_DUMP_ON user->kernel to request for larger than TCA_ACT_MAX_PRIO
- * actions in a dump. All dump responses will contain the number of actions
- * being dumped stored in for user app's consumption in TCA_ROOT_COUNT
+ * TCA_ACT_FLAG_LARGE_DUMP_ON user->kernel to request for larger than
+ * TCA_ACT_MAX_PRIO actions in a dump. All dump responses will contain the
+ * number of actions being dumped stored in for user app's consumption in
+ * TCA_ROOT_COUNT
*
- * TCA_FLAG_TERSE_DUMP user->kernel to request terse (brief) dump that only
+ * TCA_ACT_FLAG_TERSE_DUMP user->kernel to request terse (brief) dump that only
* includes essential action info (kind, index, etc.)
*
*/
#define TCA_FLAG_LARGE_DUMP_ON (1 << 0)
-#define TCA_FLAG_TERSE_DUMP (1 << 1)
+#define TCA_ACT_FLAG_LARGE_DUMP_ON TCA_FLAG_LARGE_DUMP_ON
+#define TCA_ACT_FLAG_TERSE_DUMP (1 << 1)
/* New extended info filters for IFLA_EXT_MASK */
#define RTEXT_FILTER_VF (1 << 0)
diff --git a/tc/m_action.c b/tc/m_action.c
index 66e672453c25..77ff4a8d4126 100644
--- a/tc/m_action.c
+++ b/tc/m_action.c
@@ -735,8 +735,8 @@ static int tc_act_list_or_flush(int *argc_p, char ***argv_p, int event)
addattr_nest_end(&req.n, tail);
tail3 = NLMSG_TAIL(&req.n);
- flag_select.value |= TCA_FLAG_LARGE_DUMP_ON;
- flag_select.selector |= TCA_FLAG_LARGE_DUMP_ON;
+ flag_select.value |= TCA_ACT_FLAG_LARGE_DUMP_ON;
+ flag_select.selector |= TCA_ACT_FLAG_LARGE_DUMP_ON;
addattr_l(&req.n, MAX_MSG, TCA_ROOT_FLAGS, &flag_select,
sizeof(struct nla_bitfield32));
tail3->rta_len = (void *) NLMSG_TAIL(&req.n) - (void *) tail3;
--
2.29.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH iproute2-next 2/2] tc: implement support for action terse dump
2020-11-30 19:32 [PATCH iproute2-next 0/2] Implement action terse dump Vlad Buslov
2020-11-30 19:32 ` [PATCH iproute2-next 1/2] tc: use TCA_ACT_ prefix for action flags Vlad Buslov
@ 2020-11-30 19:32 ` Vlad Buslov
2020-12-03 3:50 ` [PATCH iproute2-next 0/2] Implement " David Ahern
2 siblings, 0 replies; 4+ messages in thread
From: Vlad Buslov @ 2020-11-30 19:32 UTC (permalink / raw)
To: jhs, dsahern, stephen
Cc: netdev, davem, kuba, xiyou.wangcong, jiri, Vlad Buslov
Implement support for action terse dump using new TCA_ACT_FLAG_TERSE_DUMP
value of TCA_ROOT_FLAGS tlv. Set the flag when user requested it with
following example CLI (-br for 'brief'):
$ tc -s -br actions ls action tunnel_key
total acts 2
action order 0: tunnel_key index 1
Action statistics:
Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
backlog 0b 0p requeues 0
action order 1: tunnel_key index 2
Action statistics:
Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
backlog 0b 0p requeues 0
In terse mode dump only outputs essential data needed to identify the
action (kind, index) and stats, if requested by the user.
Signed-off-by: Vlad Buslov <vlad@buslov.dev>
Suggested-by: Jamal Hadi Salim <jhs@mojatatu.com>
---
man/man8/tc.8 | 2 +-
tc/m_action.c | 9 +++++++++
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/man/man8/tc.8 b/man/man8/tc.8
index e8622053df65..4338572a36f3 100644
--- a/man/man8/tc.8
+++ b/man/man8/tc.8
@@ -858,7 +858,7 @@ alias.
.BR "\-br" , " \-brief"
Print only essential data needed to identify the filter and action (handle,
cookie, etc.) and stats. This option is currently only supported by
-.BR "tc filter show " command.
+.BR "tc filter show " and " tc actions ls " commands.
.SH "EXAMPLES"
.PP
diff --git a/tc/m_action.c b/tc/m_action.c
index 77ff4a8d4126..b16882a345dc 100644
--- a/tc/m_action.c
+++ b/tc/m_action.c
@@ -374,6 +374,11 @@ static int tc_print_one_action(FILE *f, struct rtattr *arg)
if (err < 0)
return err;
+ if (brief && tb[TCA_ACT_INDEX]) {
+ print_uint(PRINT_ANY, "index", "\t index %u",
+ rta_getattr_u32(tb[TCA_ACT_INDEX]));
+ print_nl();
+ }
if (show_stats && tb[TCA_ACT_STATS]) {
print_string(PRINT_FP, NULL, "\tAction statistics:", NULL);
print_nl();
@@ -737,6 +742,10 @@ static int tc_act_list_or_flush(int *argc_p, char ***argv_p, int event)
tail3 = NLMSG_TAIL(&req.n);
flag_select.value |= TCA_ACT_FLAG_LARGE_DUMP_ON;
flag_select.selector |= TCA_ACT_FLAG_LARGE_DUMP_ON;
+ if (brief) {
+ flag_select.value |= TCA_ACT_FLAG_TERSE_DUMP;
+ flag_select.selector |= TCA_ACT_FLAG_TERSE_DUMP;
+ }
addattr_l(&req.n, MAX_MSG, TCA_ROOT_FLAGS, &flag_select,
sizeof(struct nla_bitfield32));
tail3->rta_len = (void *) NLMSG_TAIL(&req.n) - (void *) tail3;
--
2.29.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH iproute2-next 0/2] Implement action terse dump
2020-11-30 19:32 [PATCH iproute2-next 0/2] Implement action terse dump Vlad Buslov
2020-11-30 19:32 ` [PATCH iproute2-next 1/2] tc: use TCA_ACT_ prefix for action flags Vlad Buslov
2020-11-30 19:32 ` [PATCH iproute2-next 2/2] tc: implement support for action terse dump Vlad Buslov
@ 2020-12-03 3:50 ` David Ahern
2 siblings, 0 replies; 4+ messages in thread
From: David Ahern @ 2020-12-03 3:50 UTC (permalink / raw)
To: Vlad Buslov, jhs, stephen; +Cc: netdev, davem, kuba, xiyou.wangcong, jiri
On 11/30/20 12:32 PM, Vlad Buslov wrote:
> Refactor action flags according to recommended kernel upstream naming using
> TCA_ACT_ prefix. Implement support for new action terse dump flag.
>
> Vlad Buslov (2):
> tc: use TCA_ACT_ prefix for action flags
> tc: implement support for action terse dump
>
> include/uapi/linux/rtnetlink.h | 12 +++++++-----
> man/man8/tc.8 | 2 +-
> tc/m_action.c | 13 +++++++++++--
> 3 files changed, 19 insertions(+), 8 deletions(-)
>
applied to iproute2-next. Thanks,
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-12-03 3:51 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-30 19:32 [PATCH iproute2-next 0/2] Implement action terse dump Vlad Buslov
2020-11-30 19:32 ` [PATCH iproute2-next 1/2] tc: use TCA_ACT_ prefix for action flags Vlad Buslov
2020-11-30 19:32 ` [PATCH iproute2-next 2/2] tc: implement support for action terse dump Vlad Buslov
2020-12-03 3:50 ` [PATCH iproute2-next 0/2] Implement " David Ahern
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).