From: Jakub Kicinski <kuba@kernel.org>
To: mkubecek@suse.cz
Cc: netdev@vger.kernel.org, kernel-team@fb.com,
Jakub Kicinski <kuba@kernel.org>
Subject: [PATCH ethtool-next v2 4/6] add support for stats in subcommands
Date: Tue, 6 Oct 2020 08:04:23 -0700 [thread overview]
Message-ID: <20201006150425.2631432-5-kuba@kernel.org> (raw)
In-Reply-To: <20201006150425.2631432-1-kuba@kernel.org>
Add new parameters (-I | --include-statistics) which will
control requesting statistic dumps from the kernel.
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
ethtool.8.in | 7 +++++++
ethtool.c | 8 ++++++++
internal.h | 1 +
3 files changed, 16 insertions(+)
diff --git a/ethtool.8.in b/ethtool.8.in
index f70edb5d9d39..866b4e940dc0 100644
--- a/ethtool.8.in
+++ b/ethtool.8.in
@@ -140,6 +140,9 @@ ethtool \- query or control network driver and hardware settings
.B ethtool [--json]
.I args
.HP
+.B ethtool [-I | --include-statistics]
+.I args
+.HP
.B ethtool \-\-monitor
[
.I command
@@ -499,6 +502,10 @@ Output results in JavaScript Object Notation (JSON). Only a subset of
options support this. Those which do not will continue to output
plain text in the presence of this option.
.TP
+.B \-I \-\-include\-statistics
+Include command-related statistics in the output. This option allows
+displaying relevant device statistics for selected get commands.
+.TP
.B \-a \-\-show\-pause
Queries the specified Ethernet device for pause parameter information.
.TP
diff --git a/ethtool.c b/ethtool.c
index 403616bb7fa0..1d9067e774af 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -6031,6 +6031,7 @@ static int show_usage(struct cmd_context *ctx __maybe_unused)
fprintf(stdout, "FLAGS:\n");
fprintf(stdout, " --debug MASK turn on debugging messages\n");
fprintf(stdout, " --json enable JSON output format (not supported by all commands)\n");
+ fprintf(stdout, " -I|--include-statistics request device statistics related to the command (not supported by all commands)\n");
return 0;
}
@@ -6291,6 +6292,13 @@ int main(int argc, char **argp)
argc -= 1;
continue;
}
+ if (*argp && (!strcmp(*argp, "--include-statistics") ||
+ !strcmp(*argp, "-I"))) {
+ ctx.show_stats = true;
+ argp += 1;
+ argc -= 1;
+ continue;
+ }
break;
}
if (*argp && !strcmp(*argp, "--monitor")) {
diff --git a/internal.h b/internal.h
index 935ebac3ca2e..27da8eac57bb 100644
--- a/internal.h
+++ b/internal.h
@@ -225,6 +225,7 @@ struct cmd_context {
char **argp; /* arguments to the sub-command */
unsigned long debug; /* debugging mask */
bool json; /* Output JSON, if supported */
+ bool show_stats; /* include command-specific stats */
#ifdef ETHTOOL_ENABLE_NETLINK
struct nl_context *nlctx; /* netlink context (opaque) */
#endif
--
2.26.2
next prev parent reply other threads:[~2020-10-06 15:04 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-06 15:04 [PATCH ethtool-next v2 0/6] pause frame stats Jakub Kicinski
2020-10-06 15:04 ` [PATCH ethtool-next v2 1/6] update UAPI header copies Jakub Kicinski
2020-10-06 15:04 ` [PATCH ethtool-next v2 2/6] pause: add --json support Jakub Kicinski
2020-10-06 15:04 ` [PATCH ethtool-next v2 3/6] separate FLAGS out in -h Jakub Kicinski
2020-10-06 15:04 ` Jakub Kicinski [this message]
2020-10-06 15:04 ` [PATCH ethtool-next v2 5/6] netlink: use policy dumping to check if stats flag is supported Jakub Kicinski
2020-10-06 19:39 ` Ido Schimmel
2020-10-06 20:00 ` Michal Kubecek
2020-10-12 15:44 ` Michal Kubecek
2020-10-06 15:04 ` [PATCH ethtool-next v2 6/6] pause: add support for dumping statistics Jakub Kicinski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201006150425.2631432-5-kuba@kernel.org \
--to=kuba@kernel.org \
--cc=kernel-team@fb.com \
--cc=mkubecek@suse.cz \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).