tc: qdisc: filter qdisc's by parent/handle specification
Subsystems (2)
PATCH 1/1 tc: qdisc: filter qdisc's by parent/handle specification
There wasn't a way to get a qdisc info by handle or parent, only full dump of qdisc's with following grep/sed usage.
The 'qdisc get' command have been added.
tc qdisc { show | get } [ dev STRING ] [ QDISC_ID ] [ invisible ]
QDISC_ID := { root | ingress | handle QHANDLE | parent CLASSID }
This change doesn't require any changes in the kernel.
--- man/man8/tc.8 | 8 +++- tc/tc_qdisc.c | 109 +++++++++++++++++++++++++++++++++++--------------- 2 files changed, 82 insertions(+), 35 deletions(-)
man/man8/tc.8 +6 -2
@@ -77,9 +77,13 @@ tc \- show / manipulate traffic control settings .B tc .RI "[ " OPTIONS " ]" .RI "[ " FORMAT " ]" -.B qdisc show [ dev +.B qdisc { show | get } [ dev \fIDEV\fR -.B ] +.B ] [ root | ingress | handle +\fIQHANDLE\fR +.B | parent +\fICLASSID\fR +.B ] [ invisible ] .P .B tc .RI "[ " OPTIONS " ]"
tc/tc_qdisc.c +76 -33
167 lines not on this page · raw message
Signature · 1 line
2.26.2
Quoted 11 lines · On Mon, 15 Jun 2020 22:29:28 +0300 Anton Danilov…
There wasn't a way to get a qdisc info by handle or parent, only full dump of qdisc's with following grep/sed usage.
The 'qdisc get' command have been added.
tc qdisc { show | get } [ dev STRING ] [
QDISC_ID] [ invisible ]
QDISC_ID:= { root | ingress | handle QHANDLE | parent CLASSID }This change doesn't require any changes in the kernel.
Signed-off-by Anton Danilov <[email protected]>
The idea looks good, but you need to conform to the kernel style. Look at these checkpatch warnings.
ERROR: space required before the open parenthesis '(' #210: FILE: tc/tc_qdisc.c:397:
+ if(get_tc_classid(&handle, *argv)) {
WARNING: else is not generally useful after a break or return #214: FILE: tc/tc_qdisc.c:401:
+ break;
+ } else {
ERROR: space required before the open parenthesis '(' #224: FILE: tc/tc_qdisc.c:411:
+ if(get_qdisc_handle(&handle, *argv)) {
WARNING: else is not generally useful after a break or return #228: FILE: tc/tc_qdisc.c:415:
+ break;
+ } else {
ERROR: space prohibited before that close parenthesis ')' #292: FILE: tc/tc_qdisc.c:478:
+ || matches(*argv, "lst") == 0 || matches(*argv, "get") == 0 )
total: 3 errors, 2 warnings, 182 lines che