|
|
07a51b |
From a3d12445422afa12a67a7cd121b7add89f6c7d67 Mon Sep 17 00:00:00 2001
|
|
|
07a51b |
From: Andrea Claudi <aclaudi@redhat.com>
|
|
|
07a51b |
Date: Thu, 16 Apr 2020 12:41:49 +0200
|
|
|
07a51b |
Subject: [PATCH] tc: implement support for action flags
|
|
|
07a51b |
|
|
|
07a51b |
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1770671
|
|
|
07a51b |
Upstream Status: iproute2.git commit fb2e033add073
|
|
|
07a51b |
|
|
|
07a51b |
commit fb2e033add073893dea71bb483353790fe8c5354
|
|
|
07a51b |
Author: Vlad Buslov <vladbu@mellanox.com>
|
|
|
07a51b |
Date: Wed Oct 30 16:20:40 2019 +0200
|
|
|
07a51b |
|
|
|
07a51b |
tc: implement support for action flags
|
|
|
07a51b |
|
|
|
07a51b |
Implement setting and printing of action flags with single available flag
|
|
|
07a51b |
value "no_percpu" that translates to kernel UAPI TCA_ACT_FLAGS value
|
|
|
07a51b |
TCA_ACT_FLAGS_NO_PERCPU_STATS. Update man page with information regarding
|
|
|
07a51b |
usage of action flags.
|
|
|
07a51b |
|
|
|
07a51b |
Example usage:
|
|
|
07a51b |
|
|
|
07a51b |
# tc actions add action gact drop no_percpu
|
|
|
07a51b |
# sudo tc actions list action gact
|
|
|
07a51b |
total acts 1
|
|
|
07a51b |
|
|
|
07a51b |
action order 0: gact action drop
|
|
|
07a51b |
random type none pass val 0
|
|
|
07a51b |
index 1 ref 1 bind 0
|
|
|
07a51b |
no_percpu
|
|
|
07a51b |
|
|
|
07a51b |
Signed-off-by: Vlad Buslov <vladbu@mellanox.com>
|
|
|
07a51b |
Signed-off-by: David Ahern <dsahern@gmail.com>
|
|
|
07a51b |
---
|
|
|
07a51b |
man/man8/tc-actions.8 | 14 ++++++++++++++
|
|
|
07a51b |
tc/m_action.c | 19 +++++++++++++++++++
|
|
|
07a51b |
2 files changed, 33 insertions(+)
|
|
|
07a51b |
|
|
|
07a51b |
diff --git a/man/man8/tc-actions.8 b/man/man8/tc-actions.8
|
|
|
07a51b |
index f46166e3f6859..bee59f7247fae 100644
|
|
|
07a51b |
--- a/man/man8/tc-actions.8
|
|
|
07a51b |
+++ b/man/man8/tc-actions.8
|
|
|
07a51b |
@@ -47,6 +47,8 @@ actions \- independently defined actions in tc
|
|
|
07a51b |
] [
|
|
|
07a51b |
.I COOKIESPEC
|
|
|
07a51b |
] [
|
|
|
07a51b |
+.I FLAGS
|
|
|
07a51b |
+] [
|
|
|
07a51b |
.I CONTROL
|
|
|
07a51b |
]
|
|
|
07a51b |
|
|
|
07a51b |
@@ -71,6 +73,10 @@ ACTNAME
|
|
|
07a51b |
:=
|
|
|
07a51b |
.BI cookie " COOKIE"
|
|
|
07a51b |
|
|
|
07a51b |
+.I FLAGS
|
|
|
07a51b |
+:=
|
|
|
07a51b |
+.I no_percpu
|
|
|
07a51b |
+
|
|
|
07a51b |
.I ACTDETAIL
|
|
|
07a51b |
:=
|
|
|
07a51b |
.I ACTNAME ACTPARAMS
|
|
|
07a51b |
@@ -186,6 +192,14 @@ As such, it can be used as a correlating value for maintaining user state.
|
|
|
07a51b |
The value to be stored is completely arbitrary and does not require a specific
|
|
|
07a51b |
format. It is stored inside the action structure itself.
|
|
|
07a51b |
|
|
|
07a51b |
+.TP
|
|
|
07a51b |
+.I FLAGS
|
|
|
07a51b |
+Action-specific flags. Currently, the only supported flag is
|
|
|
07a51b |
+.I no_percpu
|
|
|
07a51b |
+which indicates that action is expected to have minimal software data-path
|
|
|
07a51b |
+traffic and doesn't need to allocate stat counters with percpu allocator.
|
|
|
07a51b |
+This option is intended to be used by hardware-offloaded actions.
|
|
|
07a51b |
+
|
|
|
07a51b |
.TP
|
|
|
07a51b |
.BI since " MSTIME"
|
|
|
07a51b |
When dumping large number of actions, a millisecond time-filter can be
|
|
|
07a51b |
diff --git a/tc/m_action.c b/tc/m_action.c
|
|
|
07a51b |
index bdc62720879c1..c46aeaafa8ebf 100644
|
|
|
07a51b |
--- a/tc/m_action.c
|
|
|
07a51b |
+++ b/tc/m_action.c
|
|
|
07a51b |
@@ -249,6 +249,16 @@ done0:
|
|
|
07a51b |
addattr_l(n, MAX_MSG, TCA_ACT_COOKIE,
|
|
|
07a51b |
&act_ck, act_ck_len);
|
|
|
07a51b |
|
|
|
07a51b |
+ if (*argv && strcmp(*argv, "no_percpu") == 0) {
|
|
|
07a51b |
+ struct nla_bitfield32 flags =
|
|
|
07a51b |
+ { TCA_ACT_FLAGS_NO_PERCPU_STATS,
|
|
|
07a51b |
+ TCA_ACT_FLAGS_NO_PERCPU_STATS };
|
|
|
07a51b |
+
|
|
|
07a51b |
+ addattr_l(n, MAX_MSG, TCA_ACT_FLAGS, &flags,
|
|
|
07a51b |
+ sizeof(struct nla_bitfield32));
|
|
|
07a51b |
+ NEXT_ARG_FWD();
|
|
|
07a51b |
+ }
|
|
|
07a51b |
+
|
|
|
07a51b |
addattr_nest_end(n, tail);
|
|
|
07a51b |
ok++;
|
|
|
07a51b |
}
|
|
|
07a51b |
@@ -317,6 +327,15 @@ static int tc_print_one_action(FILE *f, struct rtattr *arg)
|
|
|
07a51b |
strsz, b1, sizeof(b1)));
|
|
|
07a51b |
print_string(PRINT_FP, NULL, "%s", _SL_);
|
|
|
07a51b |
}
|
|
|
07a51b |
+ if (tb[TCA_ACT_FLAGS]) {
|
|
|
07a51b |
+ struct nla_bitfield32 *flags = RTA_DATA(tb[TCA_ACT_FLAGS]);
|
|
|
07a51b |
+
|
|
|
07a51b |
+ if (flags->selector & TCA_ACT_FLAGS_NO_PERCPU_STATS)
|
|
|
07a51b |
+ print_bool(PRINT_ANY, "no_percpu", "\tno_percpu",
|
|
|
07a51b |
+ flags->value &
|
|
|
07a51b |
+ TCA_ACT_FLAGS_NO_PERCPU_STATS);
|
|
|
07a51b |
+ print_string(PRINT_FP, NULL, "%s", _SL_);
|
|
|
07a51b |
+ }
|
|
|
07a51b |
|
|
|
07a51b |
return 0;
|
|
|
07a51b |
}
|
|
|
07a51b |
--
|
|
|
07a51b |
2.25.4
|
|
|
07a51b |
|