mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-02-17 16:00:38 -05:00
$ ynltool qstat
eth0 rx-packets: 493192163 rx-bytes: 1442544543997
tx-packets: 745999838 tx-bytes: 4574215826482
tx-stop: 7033 tx-wake: 7033
$ ynltool qstat show group-by queue
eth0 rx-0 packets: 70196880 bytes: 178633973750
eth0 rx-1 packets: 63623419 bytes: 197274745250
...
eth0 tx-1 packets: 98645810 bytes: 631247647938
stop: 1048 wake: 1048
eth0 tx-2 packets: 86775824 bytes: 563930471952
stop: 1126 wake: 1126
...
$ ynltool -j qstat | jq
[
{
"ifname": "eth0",
"ifindex": 2,
"rx": {
"packets": 493396439,
"bytes": 1443608198921
},
"tx": {
"packets": 746239978,
"bytes": 4574333772645,
"stop": 7072,
"wake": 7072
}
}
]
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Link: https://patch.msgid.link/20251107162227.980672-4-kuba@kernel.org
Acked-by: Stanislav Fomichev <sdf@fomichev.me>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
67 lines
1.7 KiB
C
67 lines
1.7 KiB
C
/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
|
|
/* Copyright (C) 2017-2018 Netronome Systems, Inc. */
|
|
/* Copyright Meta Platforms, Inc. and affiliates */
|
|
|
|
#ifndef __YNLTOOL_H
|
|
#define __YNLTOOL_H
|
|
|
|
#ifndef _GNU_SOURCE
|
|
#define _GNU_SOURCE
|
|
#endif
|
|
#include <stdbool.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <errno.h>
|
|
#include <string.h>
|
|
|
|
#include "json_writer.h"
|
|
|
|
#define NEXT_ARG() ({ argc--; argv++; if (argc < 0) usage(); })
|
|
#define NEXT_ARGP() ({ (*argc)--; (*argv)++; if (*argc < 0) usage(); })
|
|
#define BAD_ARG() ({ p_err("what is '%s'?", *argv); -1; })
|
|
#define GET_ARG() ({ argc--; *argv++; })
|
|
#define REQ_ARGS(cnt) \
|
|
({ \
|
|
int _cnt = (cnt); \
|
|
bool _res; \
|
|
\
|
|
if (argc < _cnt) { \
|
|
p_err("'%s' needs at least %d arguments, %d found", \
|
|
argv[-1], _cnt, argc); \
|
|
_res = false; \
|
|
} else { \
|
|
_res = true; \
|
|
} \
|
|
_res; \
|
|
})
|
|
|
|
#define HELP_SPEC_OPTIONS \
|
|
"OPTIONS := { {-j|--json} [{-p|--pretty}] }"
|
|
|
|
extern const char *bin_name;
|
|
|
|
extern json_writer_t *json_wtr;
|
|
extern bool json_output;
|
|
extern bool pretty_output;
|
|
|
|
void __attribute__((format(printf, 1, 2))) p_err(const char *fmt, ...);
|
|
void __attribute__((format(printf, 1, 2))) p_info(const char *fmt, ...);
|
|
|
|
bool is_prefix(const char *pfx, const char *str);
|
|
int detect_common_prefix(const char *arg, ...);
|
|
void usage(void) __attribute__((noreturn));
|
|
|
|
struct cmd {
|
|
const char *cmd;
|
|
int (*func)(int argc, char **argv);
|
|
};
|
|
|
|
int cmd_select(const struct cmd *cmds, int argc, char **argv,
|
|
int (*help)(int argc, char **argv));
|
|
|
|
/* subcommands */
|
|
int do_page_pool(int argc, char **argv);
|
|
int do_qstats(int argc, char **argv);
|
|
|
|
#endif /* __YNLTOOL_H */
|