linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/2] iproute2: add support for invisible qdisc dumping
@ 2017-02-25 21:29 Jiri Kosina
  2017-02-27 11:52 ` Phil Sutter
  2017-03-01 18:05 ` Stephen Hemminger
  0 siblings, 2 replies; 4+ messages in thread
From: Jiri Kosina @ 2017-02-25 21:29 UTC (permalink / raw)
  To: David S. Miller, Stephen Hemminger, Eric Dumazet,
	Jamal Hadi Salim, Phil Sutter, Cong Wang, Daniel Borkmann
  Cc: netdev, linux-kernel

From: Jiri Kosina <jkosina@suse.cz>

Support the new TCA_DUMP_INVISIBLE netlink attribute that allows asking 
kernel to perform 'full qdisc dump', as for historical reasons some of the 
default qdiscs are being hidden by the kernel.

The command syntax is being extended by voluntary 'invisible' argument to
'tc qdisc show'.

Signed-off-by: Jiri Kosina <jkosina@suse.cz>
---
 tc/tc_qdisc.c | 25 +++++++++++++++++++++++--
 1 file changed, 23 insertions(+), 2 deletions(-)

diff --git a/tc/tc_qdisc.c b/tc/tc_qdisc.c
index 3a3701c2..29da9269 100644
--- a/tc/tc_qdisc.c
+++ b/tc/tc_qdisc.c
@@ -34,7 +34,7 @@ static int usage(void)
 	fprintf(stderr, "       [ stab [ help | STAB_OPTIONS] ]\n");
 	fprintf(stderr, "       [ [ QDISC_KIND ] [ help | OPTIONS ] ]\n");
 	fprintf(stderr, "\n");
-	fprintf(stderr, "       tc qdisc show [ dev STRING ] [ ingress | clsact ]\n");
+	fprintf(stderr, "       tc qdisc show [ dev STRING ] [ ingress | clsact | invisible ]\n");
 	fprintf(stderr, "Where:\n");
 	fprintf(stderr, "QDISC_KIND := { [p|b]fifo | tbf | prio | cbq | red | etc. }\n");
 	fprintf(stderr, "OPTIONS := ... try tc qdisc add <desired QDISC_KIND> help\n");
@@ -292,6 +292,7 @@ static int tc_qdisc_list(int argc, char **argv)
 {
 	struct tcmsg t = { .tcm_family = AF_UNSPEC };
 	char d[16] = {};
+	bool dump_invisible = false;
 
 	while (argc > 0) {
 		if (strcmp(*argv, "dev") == 0) {
@@ -306,6 +307,8 @@ static int tc_qdisc_list(int argc, char **argv)
 			t.tcm_parent = TC_H_INGRESS;
 		} else if (matches(*argv, "help") == 0) {
 			usage();
+		} else if (strcmp(*argv, "invisible") == 0) {
+			dump_invisible = true;
 		} else {
 			fprintf(stderr, "What is \"%s\"? Try \"tc qdisc help\".\n", *argv);
 			return -1;
@@ -325,7 +328,25 @@ static int tc_qdisc_list(int argc, char **argv)
 		filter_ifindex = t.tcm_ifindex;
 	}
 
-	if (rtnl_dump_request(&rth, RTM_GETQDISC, &t, sizeof(t)) < 0) {
+	if (dump_invisible) {
+		struct {
+			struct nlmsghdr n;
+			struct tcmsg t;
+			char buf[256];
+		} req = {
+			.n.nlmsg_type = RTM_GETQDISC,
+			.n.nlmsg_len = NLMSG_LENGTH(sizeof(struct tcmsg)),
+		};
+
+		req.t.tcm_family = AF_UNSPEC;
+
+		addattr(&req.n, 256, TCA_DUMP_INVISIBLE);
+		if (rtnl_dump_request_n(&rth, &req.n) < 0) {
+			perror("Cannot send dump request");
+			return 1;
+		}
+
+	} else if (rtnl_dump_request(&rth, RTM_GETQDISC, &t, sizeof(t)) < 0) {
 		perror("Cannot send dump request");
 		return 1;
 	}
-- 
Jiri Kosina
SUSE Labs

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] iproute2: add support for invisible qdisc dumping
  2017-02-25 21:29 [PATCH 2/2] iproute2: add support for invisible qdisc dumping Jiri Kosina
@ 2017-02-27 11:52 ` Phil Sutter
  2017-03-08 10:40   ` Jiri Kosina
  2017-03-01 18:05 ` Stephen Hemminger
  1 sibling, 1 reply; 4+ messages in thread
From: Phil Sutter @ 2017-02-27 11:52 UTC (permalink / raw)
  To: Jiri Kosina
  Cc: David S. Miller, Stephen Hemminger, Eric Dumazet,
	Jamal Hadi Salim, Cong Wang, Daniel Borkmann, netdev,
	linux-kernel

On Sat, Feb 25, 2017 at 10:29:17PM +0100, Jiri Kosina wrote:
> From: Jiri Kosina <jkosina@suse.cz>
> 
> Support the new TCA_DUMP_INVISIBLE netlink attribute that allows asking 
> kernel to perform 'full qdisc dump', as for historical reasons some of the 
> default qdiscs are being hidden by the kernel.
> 
> The command syntax is being extended by voluntary 'invisible' argument to
> 'tc qdisc show'.
> 
> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
> ---
>  tc/tc_qdisc.c | 25 +++++++++++++++++++++++--
>  1 file changed, 23 insertions(+), 2 deletions(-)

Would you mind adding a description of the new keyword to tc man page as
well?

> diff --git a/tc/tc_qdisc.c b/tc/tc_qdisc.c
> index 3a3701c2..29da9269 100644
> --- a/tc/tc_qdisc.c
> +++ b/tc/tc_qdisc.c
> @@ -34,7 +34,7 @@ static int usage(void)
>  	fprintf(stderr, "       [ stab [ help | STAB_OPTIONS] ]\n");
>  	fprintf(stderr, "       [ [ QDISC_KIND ] [ help | OPTIONS ] ]\n");
>  	fprintf(stderr, "\n");
> -	fprintf(stderr, "       tc qdisc show [ dev STRING ] [ ingress | clsact ]\n");
> +	fprintf(stderr, "       tc qdisc show [ dev STRING ] [ ingress | clsact | invisible ]\n");

Doesn't look like these are mutually exclusive. Therefore I would
suggest fixing the syntax to:

| +	fprintf(stderr, "       tc qdisc show [ dev STRING ] [ ingress | clsact ] [ invisible ]\n");

Cheers, Phil

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] iproute2: add support for invisible qdisc dumping
  2017-02-25 21:29 [PATCH 2/2] iproute2: add support for invisible qdisc dumping Jiri Kosina
  2017-02-27 11:52 ` Phil Sutter
@ 2017-03-01 18:05 ` Stephen Hemminger
  1 sibling, 0 replies; 4+ messages in thread
From: Stephen Hemminger @ 2017-03-01 18:05 UTC (permalink / raw)
  To: Jiri Kosina
  Cc: David S. Miller, Eric Dumazet, Jamal Hadi Salim, Phil Sutter,
	Cong Wang, Daniel Borkmann, netdev, linux-kernel

On Sat, 25 Feb 2017 22:29:17 +0100 (CET)
Jiri Kosina <jikos@kernel.org> wrote:

> From: Jiri Kosina <jkosina@suse.cz>
> 
> Support the new TCA_DUMP_INVISIBLE netlink attribute that allows asking 
> kernel to perform 'full qdisc dump', as for historical reasons some of the 
> default qdiscs are being hidden by the kernel.
> 
> The command syntax is being extended by voluntary 'invisible' argument to
> 'tc qdisc show'.
> 
> Signed-off-by: Jiri Kosina <jkosina@suse.cz>

Still waiting for TCA_DUMP_INVISIBLE to make it into net-next

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] iproute2: add support for invisible qdisc dumping
  2017-02-27 11:52 ` Phil Sutter
@ 2017-03-08 10:40   ` Jiri Kosina
  0 siblings, 0 replies; 4+ messages in thread
From: Jiri Kosina @ 2017-03-08 10:40 UTC (permalink / raw)
  To: Phil Sutter
  Cc: David S. Miller, Stephen Hemminger, Eric Dumazet,
	Jamal Hadi Salim, Cong Wang, Daniel Borkmann, netdev,
	linux-kernel

On Mon, 27 Feb 2017, Phil Sutter wrote:

> > Support the new TCA_DUMP_INVISIBLE netlink attribute that allows asking 
> > kernel to perform 'full qdisc dump', as for historical reasons some of the 
> > default qdiscs are being hidden by the kernel.
> > 
> > The command syntax is being extended by voluntary 'invisible' argument to
> > 'tc qdisc show'.
> > 
> > Signed-off-by: Jiri Kosina <jkosina@suse.cz>
> > ---
> >  tc/tc_qdisc.c | 25 +++++++++++++++++++++++--
> >  1 file changed, 23 insertions(+), 2 deletions(-)
> 
> Would you mind adding a description of the new keyword to tc man page as
> well?

Seems like tc manpage would need more updates, as it doesn't seem to 
reflect the '[ ingress | clsact ]' possibility either. So I'll send this 
as a followup patch, fixing all these at once.

> > diff --git a/tc/tc_qdisc.c b/tc/tc_qdisc.c
> > index 3a3701c2..29da9269 100644
> > --- a/tc/tc_qdisc.c
> > +++ b/tc/tc_qdisc.c
> > @@ -34,7 +34,7 @@ static int usage(void)
> >  	fprintf(stderr, "       [ stab [ help | STAB_OPTIONS] ]\n");
> >  	fprintf(stderr, "       [ [ QDISC_KIND ] [ help | OPTIONS ] ]\n");
> >  	fprintf(stderr, "\n");
> > -	fprintf(stderr, "       tc qdisc show [ dev STRING ] [ ingress | clsact ]\n");
> > +	fprintf(stderr, "       tc qdisc show [ dev STRING ] [ ingress | clsact | invisible ]\n");
> 
> Doesn't look like these are mutually exclusive. Therefore I would
> suggest fixing the syntax to:
> 
> | +	fprintf(stderr, "       tc qdisc show [ dev STRING ] [ ingress | clsact ] [ invisible ]\n");

Makes sense, will include this in v2.

Thanks,

-- 
Jiri Kosina
SUSE Labs

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-03-08 10:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-25 21:29 [PATCH 2/2] iproute2: add support for invisible qdisc dumping Jiri Kosina
2017-02-27 11:52 ` Phil Sutter
2017-03-08 10:40   ` Jiri Kosina
2017-03-01 18:05 ` Stephen Hemminger

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).