Add a "clearstats" subcommand to cxgbetool that lets you clear the
MAC statistics for any port. For example: # cxgbetool t4nex0 clearstats 0 Submitted by: gnn@ MFC after: 3 days
This commit is contained in:
parent
66887009ec
commit
7e226bdcd6
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=241416
@ -82,6 +82,7 @@ usage(FILE *fp)
|
||||
{
|
||||
fprintf(fp, "Usage: %s <nexus> [operation]\n", progname);
|
||||
fprintf(fp,
|
||||
"\tclearstats <port> clear port statistics\n"
|
||||
"\tcontext <type> <id> show an SGE context\n"
|
||||
"\tfilter <idx> [<param> <val>] ... set a filter\n"
|
||||
"\tfilter <idx> delete|clear delete a filter\n"
|
||||
@ -1577,6 +1578,28 @@ read_i2c(int argc, const char *argv[])
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
clearstats(int argc, const char *argv[])
|
||||
{
|
||||
char *p;
|
||||
long l;
|
||||
uint32_t port;
|
||||
|
||||
if (argc != 1) {
|
||||
warnx("incorrect number of arguments.");
|
||||
return (EINVAL);
|
||||
}
|
||||
|
||||
p = str_to_number(argv[0], &l, NULL);
|
||||
if (*p) {
|
||||
warnx("invalid port id \"%s\"", argv[0]);
|
||||
return (EINVAL);
|
||||
}
|
||||
port = l;
|
||||
|
||||
return doit(CHELSIO_T4_CLEAR_STATS, &port);
|
||||
}
|
||||
|
||||
static int
|
||||
run_cmd(int argc, const char *argv[])
|
||||
{
|
||||
@ -1605,6 +1628,8 @@ run_cmd(int argc, const char *argv[])
|
||||
rc = read_tcb(argc, argv);
|
||||
else if (!strcmp(cmd, "i2c"))
|
||||
rc = read_i2c(argc, argv);
|
||||
else if (!strcmp(cmd, "clearstats"))
|
||||
rc = clearstats(argc, argv);
|
||||
else {
|
||||
rc = EINVAL;
|
||||
warnx("invalid command \"%s\"", cmd);
|
||||
|
Loading…
Reference in New Issue
Block a user