On 17-04-20 09:59 AM, Jiri Pirko wrote:
Thu, Apr 20, 2017 at 03:06:21PM CEST, j...@mojatatu.com wrote:
From: Jamal Hadi Salim <j...@mojatatu.com>
When you dump hundreds of thousands of actions, getting only 32 per
dump batch even when the socket buffer and memory allocations allow
is inefficient.
With this change, the user will get as many as possibly fitting
within the given constraints available to the kernel.
A new top level TLV space is introduced. An attribute
TCAA_ACT_FLAGS is used to carry the flags indicating the user
is capable of processing these large dumps. Older user space which
doesn't set this flag doesn't get the large (than 32) batches.
The kernel uses the TCAA_ACT_COUNT attribute to tell the user how many
actions are put in a single batch. As such user space app knows how long
to iterate (independent of the type of action being dumped)
instead of hardcoded maximum of 32.
Some results dumping 1.5M actions, first unpatched tc which the
kernel doesn't help:
prompt$ time -p tc actions ls action gact | grep index | wc -l
1500000
real 1388.43
user 2.07
sys 1386.79
Now lets see a patched tc which sets the correct flags when requesting
a dump:
prompt$ time -p updatedtc actions ls action gact | grep index | wc -l
1500000
real 178.13
user 2.02
sys 176.96
Signed-off-by: Jamal Hadi Salim <j...@mojatatu.com>
---
include/uapi/linux/rtnetlink.h | 21 +++++++++++++++++--
net/sched/act_api.c | 46 +++++++++++++++++++++++++++++++++---------
2 files changed, 55 insertions(+), 12 deletions(-)
diff --git a/include/uapi/linux/rtnetlink.h b/include/uapi/linux/rtnetlink.h
index cce0613..d7d28ec 100644
--- a/include/uapi/linux/rtnetlink.h
+++ b/include/uapi/linux/rtnetlink.h
@@ -674,10 +674,27 @@ struct tcamsg {
unsigned char tca__pad1;
unsigned short tca__pad2;
};
+
+enum {
+ TCAA_UNSPEC,
TCAA stands for "traffic control action action". I don't get it :(
TC Action Attributes == TCAA.
Prefix still sounds wrong to me, sorry :/
Should be:
TCA_SOMETHING_*
TCA_ATTR_XXX ?
I have another opportunity to make a change where we should close
the discussion on this. We cant drag it forever.
cheers,
jamal