aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNavdeep Parhar <np@FreeBSD.org>2023-04-02 00:43:20 +0000
committerNavdeep Parhar <np@FreeBSD.org>2024-01-11 05:06:58 +0000
commitf0eedbcd80395190ff120b37beb59097827a1892 (patch)
tree14ef94f38871258069a7d3119d580dfebb59c57d
parent0e3fce67f1e5899be93f334022803ce9a52e7a13 (diff)
downloadsrc-f0eedbcd80395190ff120b37beb59097827a1892.tar.gz
src-f0eedbcd80395190ff120b37beb59097827a1892.zip
cxgbetool(8): Add support for tracing loopback traffic for a port.
Use lo<n> to tap the loopback for port <n>. Sponsored by: Chelsio Communications (cherry picked from commit 4913a24e7910edf5a3f52536b780d1b1d4bb73a4)
-rw-r--r--usr.sbin/cxgbetool/cxgbetool.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/usr.sbin/cxgbetool/cxgbetool.c b/usr.sbin/cxgbetool/cxgbetool.c
index 6f9031240515..c02bc7fdc054 100644
--- a/usr.sbin/cxgbetool/cxgbetool.c
+++ b/usr.sbin/cxgbetool/cxgbetool.c
@@ -122,7 +122,7 @@ usage(FILE *fp)
"\tsched-queue <port> <queue> <class> bind NIC queues to TX Scheduling class\n"
"\tstdio interactive mode\n"
"\ttcb <tid> read TCB\n"
- "\ttracer <idx> tx<n>|rx<n> set and enable a tracer\n"
+ "\ttracer <idx> tx<n>|rx<n>|lo<n> set and enable a tracer\n"
"\ttracer <idx> disable|enable disable or enable a tracer\n"
"\ttracer list list all tracers\n"
);
@@ -2476,17 +2476,24 @@ set_tracer(uint8_t idx, int argc, const char *argv[])
t.valid = 1;
if (argc != 1) {
- warnx("must specify tx<n> or rx<n>.");
+ warnx("must specify one of tx/rx/lo<n>");
return (EINVAL);
}
len = strlen(argv[0]);
if (len != 3) {
- warnx("argument must be 3 characters (tx<n> or rx<n>)");
+ warnx("argument must be 3 characters (tx/rx/lo<n>). eg. tx0");
return (EINVAL);
}
- if (strncmp(argv[0], "tx", 2) == 0) {
+ if (strncmp(argv[0], "lo", 2) == 0) {
+ port = argv[0][2] - '0';
+ if (port < 0 || port > 3) {
+ warnx("'%c' in %s is invalid", argv[0][2], argv[0]);
+ return (EINVAL);
+ }
+ port += 8;
+ } else if (strncmp(argv[0], "tx", 2) == 0) {
port = argv[0][2] - '0';
if (port < 0 || port > 3) {
warnx("'%c' in %s is invalid", argv[0][2], argv[0]);