ethtool(1) cable test support
Subsystems (3)
PATCH v4 6/6 ethtool.8.in: Add --json option
In reply to Andrew LunnDocument the --json option, which the --cable-test and --cable-test-tdr options support.
--- ethtool.8.in | 8 ++++++++ 1 file changed, 8 insertions(+)
ethtool.8.in +8 -0
@@ -137,6 +137,9 @@ ethtool \- query or control network driver and hardware settings .BN --debug .I args .HP +.B ethtool [--json] +.I args +.HP .B ethtool \-\-monitor [ .I command
@@ -476,6 +479,11 @@ lB l. 0x01 Parser information .TE .TP +.BI \-\-json +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 \-a \-\-show\-pause Queries the specified Ethernet device for pause parameter information. .TP
Signature · 1 line
2.27.0
PATCH v4 2/6 Add cable test TDR support
In reply to Andrew LunnAdd support for accessing the cable test time domain reflectromatry data. Add a new command --cable-test-tdr, and support for dumping the data which is returned.
--- ethtool.c | 8 ++ netlink/cable_test.c | 296 +++++++++++++++++++++++++++++++++++++++++++ netlink/extapi.h | 2 + netlink/monitor.c | 4 + netlink/netlink.h | 2 + netlink/parser.c | 42 ++++++ netlink/parser.h | 4 + 7 files changed, 358 insertions(+)
ethtool.c +8 -0
@@ -5487,6 +5487,14 @@ static const struct option args[] = { .nlfunc = nl_cable_test, .help = "Perform a cable test", }, + { + .opts = "--cable-test-tdr", + .nlfunc = nl_cable_test_tdr, + .help = "Print cable test time domain reflectrometery data", + .xhelp =" [ first N ]\n" +" [ last N ]\n" +" [ step N ]\n" + }, { .opts = "-h|--help", .no_dev = true,
netlink/cable_test.c +296 -0
305 lines not on this page · raw message
netlink/extapi.h +2 -0
@@ -36,6 +36,7 @@ int nl_geee(struct cmd_context *ctx);int nl_seee (struct cmd_context *ctx);int nl_tsinfo (struct cmd_context *ctx);int nl_cable_test (struct cmd_context *ctx); +int nl_cable_test_tdr (struct cmd_context *ctx);int nl_monitor (struct cmd_context *ctx);void nl_monitor_usage (void );
@@ -76,6 +77,7 @@ static inline void nl_monitor_usage(void)#define nl_seee NULL#define nl_tsinfo NULL#define nl_cable_test NULL +#define nl_cable_test_tdr NULL#endif /* ETHTOOL_ENABLE_NETLINK */
netlink/monitor.c +4 -0
@@ -63,6 +63,10 @@ static struct { .cmd = ETHTOOL_MSG_CABLE_TEST_NTF, .cb = cable_test_ntf_cb, }, + { + .cmd = ETHTOOL_MSG_CABLE_TEST_TDR_NTF, + .cb = cable_test_tdr_ntf_cb, + }, };static void clear_filter (struct nl_context *nlctx)
netlink/netlink.h +2 -0
@@ -80,6 +80,8 @@ int pause_reply_cb(const struct nlmsghdr *nlhdr, void *data);int eee_reply_cb (const struct nlmsghdr *nlhdr,void *data);int cable_test_reply_cb (const struct nlmsghdr *nlhdr,void *data);int cable_test_ntf_cb (const struct nlmsghdr *nlhdr,void *data); +int cable_test_tdr_reply_cb (const struct nlmsghdr *nlhdr,void *data); +int cable_test_tdr_ntf_cb (const struct nlmsghdr *nlhdr,void *data);/* dump helpers */
netlink/parser.c +42 -0
54 lines not on this page · raw message
netlink/parser.h +4 -0
@@ -111,6 +111,10 @@ int nl_parse_direct_u32(struct nl_context *nlctx, uint16_t type,int nl_parse_direct_u8 (struct nl_context *nlctx,uint16_t type,const void *data,struct nl_msg_buff *msgbuff,void *dest); +/* NLA_U32 represented as float number of meters, converted to cm. */ +int nl_parse_direct_m2cm (struct nl_context *nlctx,uint16_t type, +const void *data,struct nl_msg_buff *msgbuff, +void *dest);/* NLA_U8 represented as on | off */ int nl_parse_u8bool (struct nl_context *nlctx,uint16_t type,const void *data,struct nl_msg_buff *msgbuff,void *dest);
Signature · 1 line
2.27.0
PATCH v4 5/6 ethtool.8.in: Document the cable test commands
In reply to Andrew LunnExtend the man page with --cable-test and --cable-test-tdr commands.
---
v2: Fixup some grammar/English errors.
v3: More grammar/English errors fixed.
--- ethtool.8.in | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+)
ethtool.8.in +45 -0
@@ -434,6 +434,16 @@ ethtool \- query or control network driver and hardware settings .I sub_command .RB ... . +.HP +.B ethtool \-\-cable\-test +.I devname +.HP +.B ethtool \-\-cable\-test\-tdr +.I devname +.BN first N +.BN last N +.BN step N +.BN pair N . .\" Adjust lines (i.e. full justification) and hyphenate. .ad
@@ -1277,6 +1287,41 @@ Sub command to apply. The supported sub commands include --show-coalesce and --coalesce. .RE .TP +q.B \-\-cable\-test +Perform a cable test and report the results. What results are returned depends +on the capabilities of the network interface. Typically open pairs and shorted +pairs can be reported, along with pairs being O.K. When a fault is detected +the approximate distance to the fault may be reported. +.TP +.B \-\-cable\-test\-tdr +Perform a cable test and report the raw Time Domain Reflectometer +data. A pulse is sent down a cable pair and the amplitude of the +reflection, for a given distance, is reported. A break in the cable +returns a big reflection. Minor damage to the cable returns a small +reflection. If the cable is shorted, the amplitude of the reflection +can be negative. By default, data is returned for lengths between 0 +and 150m at 1m steps, for all pairs. However parameters can be passed +to restrict the collection of data. It should be noted, that the +interface will round the distances to whatever granularity is actually +implemented. This is often 0.8 of a meter. The results should include +the actual rounded first and last distance and step size. +.RS 4 +.TP +.B first \ N +Distance along the cable, in meters, where the first measurement +should be made. +.TP +.B last \ N +Distance along the cable, in meters, where the last measurement should +be made. +.TP +.B step \ N +Distance, in meters, between each measurement. +.TP +.B pair \ N +Which pair should be measured. Typically a cable has 4 pairs. 0 = Pair A, 1 = Pair B, ... +.RE +.TP .B \-\-monitor Listens to netlink notification and displays them. .RS 4
Signature · 1 line
2.27.0
PATCH v4 4/6 Add --json command line argument parsing
In reply to Andrew LunnAllow --json to be passed as an option to select JSON output. The option is handled in the same way as --debug, setting a variable in the command context, which can then later be used per option to select JSON outputters.
v3:
Make use of json_print to simplify the code.
--- ethtool.c | 33 ++++++++++------ internal.h | 4 ++ netlink/cable_test.c | 92 ++++++++++++++++++++++++++++++-------------- 3 files changed, 90 insertions(+), 39 deletions(-)
ethtool.c +22 -11
@@ -5518,10 +5518,10 @@ static int show_usage(struct cmd_context *ctx maybe_unused)fprintf (stdout,PACKAGE " version " VERSION "\n" );fprintf (stdout,"Usage:\n" -" ethtool [ --debug MASK ] DEVNAME\t" +" ethtool [ --debug MASK ][ --json ] DEVNAME\t" "Display standard information about device\n" );for (i =0 ; args[i].opts; i++) { -fputs (" ethtool [ --debug MASK ] " , stdout); +fputs (" ethtool [ --debug MASK ][ --json ] " , stdout); fprintf(stdout, "%s %s\t%s\n", args[i].opts, args[i].no_dev ? "\t" : "DEVNAME",
@@ -5530,6 +5530,7 @@ static int show_usage(struct cmd_context *ctx maybe_unused)fputs (args[i].xhelp, stdout); }nl_monitor_usage (); +fprintf (stdout,"Not all options support JSON output\n" );return 0 ; }
@@ -5768,17 +5769,27 @@ int main(int argc, char **argp) argp++; argc--; -if (*argp && !strcmp (*argp,"--debug" )) { -char *eptr; +while (true) { +if (*argp && !strcmp (*argp,"--debug" )) { +char *eptr; -if (argc <2 ) -exit_bad_args (); - ctx.debug =strtoul (argp[1 ], &eptr,0 ); -if (!argp[1 ][0 ] || *eptr) -exit_bad_args (); +if (argc <2 ) +exit_bad_args (); + ctx.debug =strtoul (argp[1 ], &eptr,0 ); +if (!argp[1 ][0 ] || *eptr) +exit_bad_args (); - argp +=2 ; - argc -=2 ; + argp +=2 ; + argc -=2 ; +continue ; + } +if (*argp && !strcmp (*argp,"--json" )) { + ctx.json = true; + argp +=1 ; + argc -=1 ; +continue ; + } +break ; }if (*argp && !strcmp (*argp,"--monitor" )) { ctx.argp = ++argp;
internal.h +4 -0
@@ -23,6 +23,9 @@#include <sys/ioctl.h> #include <net/if.h> +#include "json_writer.h" +#include "json_print.h" +#define maybe_unused __attribute__((__unused__))/* internal for netlink interface */
@@ -221,6 +224,7 @@ struct cmd_context {int argc;/* number of arguments to the sub-command */ char **argp;/* arguments to the sub-command */ unsigned long debug;/* debugging mask */ +bool json;/* Output JSON, if supported */ #ifdef ETHTOOL_ENABLE_NETLINK struct nl_context *nlctx;/* netlink context (opaque) */ #endif
netlink/cable_test.c +64 -28
201 lines not on this page · raw message
Signature · 1 line
2.27.0
PATCH v4 1/6 Add cable test support
In reply to Andrew LunnAdd support for starting a cable test, and report the results.
This code does not follow the usual patterns because of the way the kernel reports the results of the cable test. It can take a number of seconds for cable testing to occur. So the action request messages is immediately acknowledges, and the test is then performed asynchronous. Once the test has completed, the results are returned as a notification.
This means the command starts as usual. It then monitors multicast messages until it receives the results.
--- Makefile.am | 2 +- ethtool.c | 5 + netlink/cable_test.c | 266 +++++++++++++++++++++++++++++++++++++++++++ netlink/extapi.h | 2 + netlink/monitor.c | 4 + netlink/netlink.h | 3 +- 6 files changed, 280 insertions(+), 2 deletions(-) create mode 100644 netlink/cable_test.c
Makefile.am +1 -1
@@ -35,7 +35,7 @@ ethtool_SOURCES += \ netlink/channels.c netlink/coalesce.c netlink/pause.c \ netlink/eee.c netlink/tsinfo.c \ netlink/desc-ethtool.c netlink/desc-genlctrl.c \ - netlink/desc-rtnl.c \ + netlink/desc-rtnl.c netlink/cable_test.c \ uapi/linux/ethtool_netlink.h \ uapi/linux/netlink.h uapi/linux/genetlink.h \ uapi/linux/rtnetlink.h uapi/linux/if_link.h
ethtool.c +5 -0
@@ -5482,6 +5482,11 @@ static const struct option args[] = { .xhelp = "The supported sub commands include --show-coalesce, --coalesce" " [queue_mask %x] SUB_COMMAND\n", }, + { + .opts = "--cable-test", + .nlfunc = nl_cable_test, + .help = "Perform a cable test", + }, { .opts = "-h|--help", .no_dev = true,
netlink/cable_test.c new file +266 -0
266 lines not on this page · raw message
netlink/extapi.h +2 -0
@@ -35,6 +35,7 @@ int nl_spause(struct cmd_context *ctx);int nl_geee (struct cmd_context *ctx);int nl_seee (struct cmd_context *ctx);int nl_tsinfo (struct cmd_context *ctx); +int nl_cable_test (struct cmd_context *ctx);int nl_monitor (struct cmd_context *ctx);void nl_monitor_usage (void );
@@ -74,6 +75,7 @@ static inline void nl_monitor_usage(void)#define nl_geee NULL#define nl_seee NULL#define nl_tsinfo NULL +#define nl_cable_test NULL#endif /* ETHTOOL_ENABLE_NETLINK */
netlink/monitor.c +4 -0
@@ -59,6 +59,10 @@ static struct { .cmd = ETHTOOL_MSG_EEE_NTF, .cb = eee_reply_cb, }, + { + .cmd = ETHTOOL_MSG_CABLE_TEST_NTF, + .cb = cable_test_ntf_cb, + }, };static void clear_filter (struct nl_context *nlctx)
netlink/netlink.h +2 -1
@@ -78,6 +78,8 @@ int channels_reply_cb(const struct nlmsghdr *nlhdr, void *data);int coalesce_reply_cb (const struct nlmsghdr *nlhdr,void *data);int pause_reply_cb (const struct nlmsghdr *nlhdr,void *data);int eee_reply_cb (const struct nlmsghdr *nlhdr,void *data); +int cable_test_reply_cb (const struct nlmsghdr *nlhdr,void *data); +int cable_test_ntf_cb (const struct nlmsghdr *nlhdr,void *data);/* dump helpers */
@@ -108,7 +110,6 @@ static inline void show_bool(const struct nlattr *attr, const char *label) }/* misc */ -static inline void copy_devname (char *dst,const char *src) {strncpy (dst, src,ALTIFNAMSIZ );
Signature · 1 line
2.27.0
PATCH v4 3/6 json_writer/json_print: Import the iproute2 helper code for JSON output
In reply to Andrew LunnIn general, Linux network tools use JSON for machine readable output. See for example -json for iproute2 and devlink. In order to support JSON output from ethtool, import the iproute2 helper code.
--- Makefile.am | 3 +- json_print.c | 228 +++++++++++++++++++++++++++++ json_print.h | 67 +++++++++ json_writer.c | 391 ++++++++++++++++++++++++++++++++++++++++++++++++++ json_writer.h | 76 ++++++++++ 5 files changed, 764 insertions(+), 1 deletion(-) create mode 100644 json_print.c create mode 100644 json_print.h create mode 100644 json_writer.c create mode 100644 json_writer.h
Makefile.am +2 -1
@@ -7,7 +7,8 @@ EXTRA_DIST = LICENSE ethtool.8 ethtool.spec.in aclocal.m4 ChangeLog autogen.sh sbin_PROGRAMS = ethtool ethtool_SOURCES = ethtool.c uapi/linux/ethtool.h internal.h \ - uapi/linux/net_tstamp.h rxclass.c common.c common.h + uapi/linux/net_tstamp.h rxclass.c common.c common.h \ + json_writer.c json_writer.h json_print.c json_print.h if ETHTOOL_ENABLE_PRETTY_DUMP ethtool_SOURCES += \ amd8111e.c de2104x.c dsa.c e100.c e1000.c et131x.c igb.c \
json_print.c new file +228 -0
228 lines not on this page · raw message
json_print.h new file +67 -0
67 lines not on this page · raw message
json_writer.c new file +391 -0
391 lines not on this page · raw message
json_writer.h new file +76 -0
76 lines not on this page · raw message
Signature · 1 line
2.27.0
v4 cover ethtool(1) cable test support
Add the user space side of the ethtool cable test.
The TDR output is most useful when fed to some other tool which can visualize the data. So add JSON support, by borrowing code from iproute2.
v2:
man page fixes.
v3:
More man page fixes.
Use json_print from iproute2.
v4:
checkpatch cleanup
ethtool --cable-test dev
Place breakout into cable_test_context
Remove Pair: Pair output
Andrew Lunn (6):
Add cable test support
Add cable test TDR support
json_writer: Import the iproute2 helper code for JSON output Add --json command line argument parsing ethtool.8.in: Document the cable test commands ethtool.8.in: Add --json option
Makefile.am | 5 +- ethtool.8.in | 53 ++++ ethtool.c | 46 +++- internal.h | 4 + json_writer.c | 389 +++++++++++++++++++++++++++ json_writer.h | 76 ++++++ netlink/cable_test.c | 624 +++++++++++++++++++++++++++++++++++++++++++ netlink/extapi.h | 4 + netlink/monitor.c | 8 + netlink/netlink.h | 5 +- netlink/parser.c | 41 +++ netlink/parser.h | 4 + 12 files changed, 1245 insertions(+), 14 deletions(-) create mode 100644 json_writer.c create mode 100644 json_writer.h create mode 100644 netlink/cable_test.c
Signature · 1 line
2.26.2
Re: [PATCH ethtool v4 1/6] Add cable test support
In reply to Andrew LunnQuoted 14 lines · Andrew Lunn
Add support for starting a cable test, and report the results.
This code does not follow the usual patterns because of the way the kernel reports the results of the cable test. It can take a number of seconds for cable testing to occur. So the action request messages is immediately acknowledges, and the test is then performed asynchronous. Once the test has completed, the results are returned as a notification.
This means the command starts as usual. It then monitors multicast messages until it receives the results.
Signed-off-by Andrew Lunn <[email protected]>---
[...]
Quoted 5 lines
netlink/monitor.c +0
-0
netlink/monitor.c static struct { · line 67
Quoted 9 lines
netlink/monitor.c +4
-0@@ -59,6 +59,10 @@ static struct { .cmd = ETHTOOL_MSG_EEE_NTF, .cb = eee_reply_cb, }, + { + .cmd = ETHTOOL_MSG_CABLE_TEST_NTF, + .cb = cable_test_ntf_cb, + }, };
Please add also an entry to monitor_opts[] so that user can use --cable-test as filter for --monitor.
Looks good otherwise.
Michal
Re: [PATCH ethtool v4 2/6] Add cable test TDR support
In reply to Andrew LunnQuoted 6 lines · Andrew Lunn
Add support for accessing the cable test time domain reflectromatry data. Add a new command --cable-test-tdr, and support for dumping the data which is returned.
Signed-off-by Andrew Lunn <[email protected]>---
Looks good to me, only three minor issues:
ethtool.c static const struct option args[] = { · line 5496
Quoted 13 lines
ethtool.c +7
-0@@ -5487,6 +5487,14 @@ static const struct option args[] = { .nlfunc = nl_cable_test, .help = "Perform a cable test", }, + { + .opts = "--cable-test-tdr", + .nlfunc = nl_cable_test_tdr, + .help ="Print cable test time domain reflectrometery data" , + .xhelp = " [ first N ]\n" +" [ last N ]\n" +" [ step N ]\n"
The "pair" parameter is missing here.
Quoted 4 lines
ethtool.c +1
-0+ }, { .opts = "-h|--help", .no_dev = true,
[...]
Quoted 5 lines
netlink/monitor.c +0
-0
netlink/monitor.c static struct { · line 71
Quoted 9 lines
netlink/monitor.c +4
-0@@ -63,6 +63,10 @@ static struct { .cmd = ETHTOOL_MSG_CABLE_TEST_NTF, .cb = cable_test_ntf_cb, }, + { + .cmd = ETHTOOL_MSG_CABLE_TEST_TDR_NTF, + .cb = cable_test_tdr_ntf_cb, + }, };
Please add also an entry to monitor_opts[] to allow filtering monitor events.
[...]
Quoted 4 lines
netlink/parser.c +0
-0
[...]
Quoted 15 lines
netlink/parser.c +11
-0@@ -211,6 +227,32 @@ int nl_parse_direct_u8(struct nl_context *nlctx, uint16_t type,return (type &ðnla_put_u8 (msgbuff, type, val)) ? -EMSGSIZE :0 ; } +/* Parser handler for float meters and convert it to cm. Generates +* NLA_U32 or fills an uint32_t. +*/ +int nl_parse_direct_m2cm (struct nl_context *nlctx,uint16_t type, +const void *data,struct nl_msg_buff *msgbuff, +void *dest) +{ +const char *arg = *nlctx->argp; +float meters; +uint32_t cm; +int ret;
netlink/parser.c int nl_parse_direct_u8(struct nl_context *nlctx, uint16_t type, · line 250
Quoted 10 lines
netlink/parser.c +10
-0+ + nlctx->argp++; + nlctx->argc--; + ret =parse_float (arg, &meters,0 ,150 ); +if (ret <0 ) { +parser_err_invalid_value (nlctx, arg); +return ret; + } + + cm = (uint32_t )(meters *100 );
When I tried to test the generated requests, I noticed that e.g. "20.3" was sent as 2029 rather than 2030. It's unlikely to cause an actual problem but we should probably use e.g.
cm = (uint32_t)(meters * 100 + 0.5);
to prevent such rounding errors.
Michal
Quoted 8 lines
netlink/parser.c +5
-0+if (dest) + *(uint32_t *)dest = cm; +return (type &ðnla_put_u32 (msgbuff, type, cm)) ? -EMSGSIZE :0 ; +} +/* Parser handler for (tri-state) bool. Expects "name on|off", generates * NLA_U8 which is 1 for "on" and 0 for "off". */
Quoted 13 lines · Andrew Lunn
Add the user space side of the ethtool cable test.
The TDR output is most useful when fed to some other tool which can visualize the data. So add JSON support, by borrowing code from iproute2.
v2:
man page fixes.v3:
More man page fixes.
Usejson_printfrom iproute2.
Quoted 5 lines
v4:
checkpatch cleanup
ethtool --cable-test dev
Place breakout intocable_test_context
Remove Pair: Pair output
Hello Andrew,
could you please test this update of netlink/desc-ethtool.c on top of your series? The userspace messages look as expected but I'm not sure if I have a device with cable test support available to test pretty printing of kernel messages. (And even if I do, I almost certainly won't have physical access to it.)
Thank you,
Michal
netlink/desc-ethtool.c +82 -0
@@ -206,6 +206,84 @@ static const struct pretty_nla_desc __tsinfo_desc[] = { NLATTR_DESC_U32(ETHTOOL_A_TSINFO_PHC_INDEX), }; +static const struct pretty_nla_desc __cable_test_desc[] = { +NLATTR_DESC_INVALID (ETHTOOL_A_CABLE_TEST_UNSPEC ), +NLATTR_DESC_NESTED (ETHTOOL_A_CABLE_TEST_HEADER , header), +}; + +static const struct pretty_nla_desc __cable_test_result_desc[] = { +NLATTR_DESC_INVALID (ETHTOOL_A_CABLE_RESULT_UNSPEC ), +NLATTR_DESC_U8 (ETHTOOL_A_CABLE_RESULT_PAIR ), +NLATTR_DESC_U8 (ETHTOOL_A_CABLE_RESULT_CODE ), +}; + +static const struct pretty_nla_desc __cable_test_flength_desc[] = { +NLATTR_DESC_INVALID (ETHTOOL_A_CABLE_FAULT_LENGTH_UNSPEC ), +NLATTR_DESC_U8 (ETHTOOL_A_CABLE_FAULT_LENGTH_PAIR ), +NLATTR_DESC_U32 (ETHTOOL_A_CABLE_FAULT_LENGTH_CM ), +}; + +static const struct pretty_nla_desc __cable_nest_desc[] = { +NLATTR_DESC_INVALID (ETHTOOL_A_CABLE_NEST_UNSPEC ), +NLATTR_DESC_NESTED (ETHTOOL_A_CABLE_NEST_RESULT , cable_test_result), +NLATTR_DESC_NESTED (ETHTOOL_A_CABLE_NEST_FAULT_LENGTH , + cable_test_flength), +}; + +static const struct pretty_nla_desc __cable_test_ntf_desc[] = { +NLATTR_DESC_INVALID (ETHTOOL_A_CABLE_TEST_NTF_UNSPEC ), +NLATTR_DESC_NESTED (ETHTOOL_A_CABLE_TEST_NTF_HEADER , header), +NLATTR_DESC_U8 (ETHTOOL_A_CABLE_TEST_NTF_STATUS ), +NLATTR_DESC_NESTED (ETHTOOL_A_CABLE_TEST_NTF_NEST , cable_nest), +}; + +static const struct pretty_nla_desc __cable_test_tdr_cfg_desc[] = { +NLATTR_DESC_INVALID (ETHTOOL_A_CABLE_TEST_TDR_CFG_UNSPEC ), +NLATTR_DESC_U32 (ETHTOOL_A_CABLE_TEST_TDR_CFG_FIRST ), +NLATTR_DESC_U32 (ETHTOOL_A_CABLE_TEST_TDR_CFG_LAST ), +NLATTR_DESC_U32 (ETHTOOL_A_CABLE_TEST_TDR_CFG_STEP ), +NLATTR_DESC_U8 (ETHTOOL_A_CABLE_TEST_TDR_CFG_PAIR ), +}; + +static const struct pretty_nla_desc __cable_test_tdr_desc[] = { +NLATTR_DESC_INVALID (ETHTOOL_A_CABLE_TEST_TDR_UNSPEC ), +NLATTR_DESC_NESTED (ETHTOOL_A_CABLE_TEST_TDR_HEADER , header), +NLATTR_DESC_NESTED (ETHTOOL_A_CABLE_TEST_TDR_CFG , cable_test_tdr_cfg), +}; + +static const struct pretty_nla_desc __cable_step_desc[] = { +NLATTR_DESC_INVALID (ETHTOOL_A_CABLE_STEP_UNSPEC ), +NLATTR_DESC_U32 (ETHTOOL_A_CABLE_STEP_FIRST_DISTANCE ), +NLATTR_DESC_U32 (ETHTOOL_A_CABLE_STEP_LAST_DISTANCE ), +NLATTR_DESC_U32 (ETHTOOL_A_CABLE_STEP_STEP_DISTANCE ), +}; + +static const struct pretty_nla_desc __cable_amplitude_desc[] = { +NLATTR_DESC_INVALID (ETHTOOL_A_CABLE_AMPLITUDE_UNSPEC ), +NLATTR_DESC_U8 (ETHTOOL_A_CABLE_AMPLITUDE_PAIR ), +NLATTR_DESC_S16 (ETHTOOL_A_CABLE_AMPLITUDE_mV), +}; + +static const struct pretty_nla_desc __cable_pulse_desc[] = { +NLATTR_DESC_INVALID (ETHTOOL_A_CABLE_PULSE_UNSPEC ), +NLATTR_DESC_S16 (ETHTOOL_A_CABLE_PULSE_mV), +}; + +static const struct pretty_nla_desc __cable_test_tdr_nest_desc[] = { +NLATTR_DESC_INVALID (ETHTOOL_A_CABLE_TDR_NEST_UNSPEC ), +NLATTR_DESC_NESTED (ETHTOOL_A_CABLE_TDR_NEST_STEP , cable_step), +NLATTR_DESC_NESTED (ETHTOOL_A_CABLE_TDR_NEST_AMPLITUDE , cable_amplitude), +NLATTR_DESC_NESTED (ETHTOOL_A_CABLE_TDR_NEST_PULSE , cable_pulse), +}; + +static const struct pretty_nla_desc __cable_test_tdr_ntf_desc[] = { +NLATTR_DESC_INVALID (ETHTOOL_A_CABLE_TEST_TDR_UNSPEC ), +NLATTR_DESC_NESTED (ETHTOOL_A_CABLE_TEST_TDR_NTF_HEADER , header), +NLATTR_DESC_U8 (ETHTOOL_A_CABLE_TEST_TDR_NTF_STATUS ), +NLATTR_DESC_NESTED (ETHTOOL_A_CABLE_TEST_TDR_NTF_NEST , + cable_test_tdr_nest), +}; +const struct pretty_nlmsg_desc ethnl_umsg_desc[] = {NLMSG_DESC_INVALID (ETHTOOL_MSG_USER_NONE ),NLMSG_DESC (ETHTOOL_MSG_STRSET_GET , strset),
@@ -233,6 +311,8 @@ const struct pretty_nlmsg_desc ethnl_umsg_desc[] = {NLMSG_DESC (ETHTOOL_MSG_EEE_GET , eee),NLMSG_DESC (ETHTOOL_MSG_EEE_SET , eee),NLMSG_DESC (ETHTOOL_MSG_TSINFO_GET , tsinfo), +NLMSG_DESC (ETHTOOL_MSG_CABLE_TEST_ACT , cable_test), + NLMSG_DESC(ETHTOOL_MSG_CABLE_TEST_TDR_ACT, cable_test_tdr), };const unsigned int ethnl_umsg_n_desc =ARRAY_SIZE (ethnl_umsg_desc);
@@ -265,6 +345,8 @@ const struct pretty_nlmsg_desc ethnl_kmsg_desc[] = {NLMSG_DESC (ETHTOOL_MSG_EEE_GET_REPLY , eee),NLMSG_DESC (ETHTOOL_MSG_EEE_NTF , eee),NLMSG_DESC (ETHTOOL_MSG_TSINFO_GET_REPLY , tsinfo), +NLMSG_DESC (ETHTOOL_MSG_CABLE_TEST_NTF , cable_test_ntf), + NLMSG_DESC(ETHTOOL_MSG_CABLE_TEST_TDR_NTF, cable_test_tdr_ntf), };const unsigned int ethnl_kmsg_n_desc =ARRAY_SIZE (ethnl_kmsg_desc);
Quoted 20 lines · Michal Kubecek
Quoted 13 lines · Andrew Lunn
Add the user space side of the ethtool cable test.
The TDR output is most useful when fed to some other tool which can visualize the data. So add JSON support, by borrowing code from iproute2.
v2:
man page fixes.v3:
More man page fixes.
Usejson_printfrom iproute2.Quoted 5 lines
v4:
checkpatch cleanup
ethtool --cable-test dev
Place breakout intocable_test_context
Remove Pair: Pair output
Quoted 7 lines
Hello Andrew,
could you please test this update of
netlink/desc-ethtool.con top of your series? The userspace messages look as expected but I'm not sure if I have a device with cable test support available to test pretty printing of kernel messages. (And even if I do, I almost certainly won't have physical access to it.)
Hi Michal
Currently there are three PHY drivers with support: Marvell, Atheros at803x, and bcm54140. And you can do some amount of testing without physical access, you can expect the test results to indicate the cable is O.K.
However, i will give these a go.
Some sort of capture and reply would be interesting for this, and for regression testing. The ability to do something like
ethtool --monitor -w test.cap
To dump the netlink socket data to a file, and
ethtool --monitor -r test.cap
to read from the file and decode its contents. Maybe this is already possible via nlmon?
Andrew
Andrew Lunn
Tested-byQuoted 7 lines
Hello Andrew,
could you please test this update of
netlink/desc-ethtool.con top of your series? The userspace messages look as expected but I'm not sure if I have a device with cable test support available to test pretty printing of kernel messages. (And even if I do, I almost certainly won't have physical access to it.)
/home/andrew/ethtool/ethtool --debug 0xff --cable-test-tdr lan2 first 10 last 12
...
sending genetlink packet (56 bytes):
msg length 56 ethool ETHTOOL_MSG_CABLE_TEST_TDR_ACT ETHTOOL_MSG_CABLE_TEST_TDR_ACT
ETHTOOL_A_CABLE_TEST_TDR_HEADER
ETHTOOL_A_HEADER_DEV_NAME = "lan2"
ETHTOOL_A_CABLE_TEST_TDR_CFG
ETHTOOL_A_CABLE_TEST_TDR_CFG_FIRST = 1000 ETHTOOL_A_CABLE_TEST_TDR_CFG_LAST = 1200
---------------- ------------------
| 0000000056 | | message length | | 00020 | R-A- | | type | flags | | 0000000002 | | sequence number| | 0000000000 | | port ID | ---------------- ------------------ | 1b 01 00 00 | | extra header | |00016|N-|00001| |len |flags| type| |00009|--|00002| |len |flags| type| | 6c 61 6e 32 | | data | l a n 2 | 00 00 00 00 | | data | |00020|N-|00002| |len |flags| type| |00008|--|00001| |len |flags| type| | e8 03 00 00 | | data | |00008|--|00002| |len |flags| type| | b0 04 00 00 | | data |
---------------- ------------------
received genetlink packet (52 bytes):
msg length 52 ethool ETHTOOL_MSG_CABLE_TEST_TDR_NTF ETHTOOL_MSG_CABLE_TEST_TDR_NTF
ETHTOOL_A_CABLE_TEST_TDR_NTF_HEADER
ETHTOOL_A_HEADER_DEV_INDEX = 7 ETHTOOL_A_HEADER_DEV_NAME = "lan2"
ETHTOOL_A_CABLE_TEST_TDR_NTF_STATUS = 1
---------------- ------------------
| 0000000052 | | message length | | 00020 | ---- | | type | flags | | 0000000036 | | sequence number| | 0000000000 | | port ID | ---------------- ------------------ | 1c 01 00 00 | | extra header | |00024|N-|00001| |len |flags| type| |00008|--|00001| |len |flags| type| | 07 00 00 00 | | data | |00009|--|00002| |len |flags| type| | 6c 61 6e 32 | | data | l a n 2 | 00 00 00 00 | | data | |00005|--|00002| |len |flags| type| | 01 00 00 00 | | data |
---------------- ------------------
Cable test TDR started for device lan2.
received genetlink packet (36 bytes):
msg length 36 error errno=0
---------------- ------------------
| 0000000036 | | message length | | 00002 | ---- | | type | flags | | 0000000002 | | sequence number| | 0000006959 | | port ID | ---------------- ------------------ | 00 00 00 00 | | | | 38 00 00 00 | | | | 14 00 05 00 | | | | 02 00 00 00 | | | | 00 00 00 00 | | |
---------------- ------------------
received genetlink packet (336 bytes):
msg length 336 ethool ETHTOOL_MSG_CABLE_TEST_TDR_NTF ETHTOOL_MSG_CABLE_TEST_TDR_NTF
ETHTOOL_A_CABLE_TEST_TDR_NTF_HEADER
ETHTOOL_A_HEADER_DEV_INDEX = 7 ETHTOOL_A_HEADER_DEV_NAME = "lan2"
ETHTOOL_A_CABLE_TEST_TDR_NTF_STATUS = 2 ETHTOOL_A_CABLE_TEST_TDR_NTF_NEST
ETHTOOL_A_CABLE_TDR_NEST_PULSE
ETHTOOL_A_CABLE_PULSE_mV = 1000
ETHTOOL_A_CABLE_TDR_NEST_STEP
ETHTOOL_A_CABLE_STEP_FIRST_DISTANCE = 966 ETHTOOL_A_CABLE_STEP_LAST_DISTANCE = 1127 ETHTOOL_A_CABLE_STEP_STEP_DISTANCE = 80
ETHTOOL_A_CABLE_TDR_NEST_AMPLITUDE
ETHTOOL_A_CABLE_AMPLITUDE_PAIR = 0 ETHTOOL_A_CABLE_AMPLITUDE_mV = 46
ETHTOOL_A_CABLE_TDR_NEST_AMPLITUDE
ETHTOOL_A_CABLE_AMPLITUDE_PAIR = 1 ETHTOOL_A_CABLE_AMPLITUDE_mV = 117
ETHTOOL_A_CABLE_TDR_NEST_AMPLITUDE
ETHTOOL_A_CABLE_AMPLITUDE_PAIR = 2 ETHTOOL_A_CABLE_AMPLITUDE_mV = 85
ETHTOOL_A_CABLE_TDR_NEST_AMPLITUDE
ETHTOOL_A_CABLE_AMPLITUDE_PAIR = 3 ETHTOOL_A_CABLE_AMPLITUDE_mV = 93
ETHTOOL_A_CABLE_TDR_NEST_AMPLITUDE
ETHTOOL_A_CABLE_AMPLITUDE_PAIR = 0 ETHTOOL_A_CABLE_AMPLITUDE_mV = 7
ETHTOOL_A_CABLE_TDR_NEST_AMPLITUDE
ETHTOOL_A_CABLE_AMPLITUDE_PAIR = 1 ETHTOOL_A_CABLE_AMPLITUDE_mV = 15
ETHTOOL_A_CABLE_TDR_NEST_AMPLITUDE
ETHTOOL_A_CABLE_AMPLITUDE_PAIR = 2 ETHTOOL_A_CABLE_AMPLITUDE_mV = 23
ETHTOOL_A_CABLE_TDR_NEST_AMPLITUDE
ETHTOOL_A_CABLE_AMPLITUDE_PAIR = 3 ETHTOOL_A_CABLE_AMPLITUDE_mV = 31
ETHTOOL_A_CABLE_TDR_NEST_AMPLITUDE
ETHTOOL_A_CABLE_AMPLITUDE_PAIR = 0 ETHTOOL_A_CABLE_AMPLITUDE_mV = 148
ETHTOOL_A_CABLE_TDR_NEST_AMPLITUDE
ETHTOOL_A_CABLE_AMPLITUDE_PAIR = 1 ETHTOOL_A_CABLE_AMPLITUDE_mV = 156
ETHTOOL_A_CABLE_TDR_NEST_AMPLITUDE
ETHTOOL_A_CABLE_AMPLITUDE_PAIR = 2 ETHTOOL_A_CABLE_AMPLITUDE_mV = 320
ETHTOOL_A_CABLE_TDR_NEST_AMPLITUDE
ETHTOOL_A_CABLE_AMPLITUDE_PAIR = 3 ETHTOOL_A_CABLE_AMPLITUDE_mV = 39
---------------- ------------------
| 0000000336 | | message length | | 00020 | ---- | | type | flags | | 0000000035 | | sequence number| | 0000000000 | | port ID | ---------------- ------------------ | 1c 01 00 00 | | extra header | |00024|N-|00001| |len |flags| type| |00008|--|00001| |len |flags| type| | 07 00 00 00 | | data | |00009|--|00002| |len |flags| type| | 6c 61 6e 32 | | data | l a n 2 | 00 00 00 00 | | data | |00005|--|00002| |len |flags| type| | 02 00 00 00 | | data | |00284|N-|00003| |len |flags| type| |00012|N-|00003| |len |flags| type| |00006|--|00001| |len |flags| type| | e8 03 00 00 | | data | |00028|N-|00001| |len |flags| type| |00008|--|00001| |len |flags| type| | c6 03 00 00 | | data | |00008|--|00002| |len |flags| type| | 67 04 00 00 | | data | g |00008|--|00003| |len |flags| type| | 50 00 00 00 | | data | P |00020|N-|00002| |len |flags| type| |00005|--|00001| |len |flags| type| | 00 00 00 00 | | data | |00006|--|00002| |len |flags| type| | 2e 00 00 00 | | data | . |00020|N-|00002| |len |flags| type| |00005|--|00001| |len |flags| type| | 01 00 00 00 | | data | |00006|--|00002| |len |flags| type| | 75 00 00 00 | | data | u |00020|N-|00002| |len |flags| type| |00005|--|00001| |len |flags| type| | 02 00 00 00 | | data | |00006|--|00002| |len |flags| type| | 55 00 00 00 | | data | U |00020|N-|00002| |len |flags| type| |00005|--|00001| |len |flags| type| | 03 00 00 00 | | data | |00006|--|00002| |len |flags| type| | 5d 00 00 00 | | data | ] |00020|N-|00002| |len |flags| type| |00005|--|00001| |len |flags| type| | 00 00 00 00 | | data | |00006|--|00002| |len |flags| type| | 07 00 00 00 | | data | |00020|N-|00002| |len |flags| type| |00005|--|00001| |len |flags| type| | 01 00 00 00 | | data | |00006|--|00002| |len |flags| type| | 0f 00 00 00 | | data | |00020|N-|00002| |len |flags| type| |00005|--|00001| |len |flags| type| | 02 00 00 00 | | data | |00006|--|00002| |len |flags| type| | 17 00 00 00 | | data | |00020|N-|00002| |len |flags| type| |00005|--|00001| |len |flags| type| | 03 00 00 00 | | data | |00006|--|00002| |len |flags| type| | 1f 00 00 00 | | data | |00020|N-|00002| |len |flags| type| |00005|--|00001| |len |flags| type| | 00 00 00 00 | | data | |00006|--|00002| |len |flags| type| | 94 00 00 00 | | data | |00020|N-|00002| |len |flags| type| |00005|--|00001| |len |flags| type| | 01 00 00 00 | | data | |00006|--|00002| |len |flags| type| | 9c 00 00 00 | | data | |00020|N-|00002| |len |flags| type| |00005|--|00001| |len |flags| type| | 02 00 00 00 | | data | |00006|--|00002| |len |flags| type| | 40 01 00 00 | | data | @ |00020|N-|00002| |len |flags| type| |00005|--|00001| |len |flags| type| | 03 00 00 00 | | data | |00006|--|00002| |len |flags| type| | 27 00 00 00 | | data | '
---------------- ------------------
Cable test TDR completed for device lan2. TDR Pulse 1000mV
Step configuration: 9.66-11.27 meters in 0.80m steps
Pair A Amplitude 46
Pair B Amplitude 117
Pair C Amplitude 85
Pair D Amplitude 93
Pair A Amplitude 7
Pair B Amplitude 15 Pair C Amplitude 23 Pair D Amplitude 31 Pair A Amplitude 148 Pair B Amplitude 156 Pair C Amplitude 320
Pair D Amplitude 39
/home/andrew/ethtool/ethtool --debug 0xff --cable-test lan2
...
sending genetlink packet (36 bytes):
msg length 36 ethool ETHTOOL_MSG_CABLE_TEST_ACT ETHTOOL_MSG_CABLE_TEST_ACT
ETHTOOL_A_CABLE_TEST_HEADER
ETHTOOL_A_HEADER_DEV_NAME = "lan2"
---------------- ------------------
| 0000000036 | | message length | | 00020 | R-A- | | type | flags | | 0000000002 | | sequence number| | 0000000000 | | port ID | ---------------- ------------------ | 1a 01 00 00 | | extra header | |00016|N-|00001| |len |flags| type| |00009|--|00002| |len |flags| type| | 6c 61 6e 32 | | data | l a n 2 | 00 00 00 00 | | data |
---------------- ------------------
received genetlink packet (52 bytes):
msg length 52 ethool ETHTOOL_MSG_CABLE_TEST_NTF ETHTOOL_MSG_CABLE_TEST_NTF
ETHTOOL_A_CABLE_TEST_NTF_HEADER
ETHTOOL_A_HEADER_DEV_INDEX = 7 ETHTOOL_A_HEADER_DEV_NAME = "lan2"
ETHTOOL_A_CABLE_TEST_NTF_STATUS = 1
---------------- ------------------
| 0000000052 | | message length | | 00020 | ---- | | type | flags | | 0000000034 | | sequence number| | 0000000000 | | port ID | ---------------- ------------------ | 1b 01 00 00 | | extra header | |00024|N-|00001| |len |flags| type| |00008|--|00001| |len |flags| type| | 07 00 00 00 | | data | |00009|--|00002| |len |flags| type| | 6c 61 6e 32 | | data | l a n 2 | 00 00 00 00 | | data | |00005|--|00002| |len |flags| type| | 01 00 00 00 | | data |
---------------- ------------------
Cable test started for device lan2.
received genetlink packet (36 bytes):
msg length 36 error errno=0
---------------- ------------------
| 0000000036 | | message length | | 00002 | ---- | | type | flags | | 0000000002 | | sequence number| | 0000006949 | | port ID | ---------------- ------------------ | 00 00 00 00 | | | | 24 00 00 00 | | | | 14 00 05 00 | | | | 02 00 00 00 | | | | 00 00 00 00 | | |
---------------- ------------------
received genetlink packet (216 bytes):
msg length 216 ethool ETHTOOL_MSG_CABLE_TEST_NTF ETHTOOL_MSG_CABLE_TEST_NTF
ETHTOOL_A_CABLE_TEST_NTF_HEADER
ETHTOOL_A_HEADER_DEV_INDEX = 7 ETHTOOL_A_HEADER_DEV_NAME = "lan2"
ETHTOOL_A_CABLE_TEST_NTF_STATUS = 2 ETHTOOL_A_CABLE_TEST_NTF_NEST
ETHTOOL_A_CABLE_NEST_RESULT
ETHTOOL_A_CABLE_RESULT_PAIR = 0 ETHTOOL_A_CABLE_RESULT_CODE = 2
ETHTOOL_A_CABLE_NEST_RESULT
ETHTOOL_A_CABLE_RESULT_PAIR = 1 ETHTOOL_A_CABLE_RESULT_CODE = 2
ETHTOOL_A_CABLE_NEST_RESULT
ETHTOOL_A_CABLE_RESULT_PAIR = 2 ETHTOOL_A_CABLE_RESULT_CODE = 2
ETHTOOL_A_CABLE_NEST_RESULT
ETHTOOL_A_CABLE_RESULT_PAIR = 3 ETHTOOL_A_CABLE_RESULT_CODE = 2
ETHTOOL_A_CABLE_NEST_FAULT_LENGTH
ETHTOOL_A_CABLE_FAULT_LENGTH_PAIR = 0 ETHTOOL_A_CABLE_FAULT_LENGTH_CM = 2400
ETHTOOL_A_CABLE_NEST_FAULT_LENGTH
ETHTOOL_A_CABLE_FAULT_LENGTH_PAIR = 1 ETHTOOL_A_CABLE_FAULT_LENGTH_CM = 2480
ETHTOOL_A_CABLE_NEST_FAULT_LENGTH
ETHTOOL_A_CABLE_FAULT_LENGTH_PAIR = 2 ETHTOOL_A_CABLE_FAULT_LENGTH_CM = 2400
ETHTOOL_A_CABLE_NEST_FAULT_LENGTH
ETHTOOL_A_CABLE_FAULT_LENGTH_PAIR = 3 ETHTOOL_A_CABLE_FAULT_LENGTH_CM = 2400
---------------- ------------------
| 0000000216 | | message length | | 00020 | ---- | | type | flags | | 0000000033 | | sequence number| | 0000000000 | | port ID | ---------------- ------------------ | 1b 01 00 00 | | extra header | |00024|N-|00001| |len |flags| type| |00008|--|00001| |len |flags| type| | 07 00 00 00 | | data | |00009|--|00002| |len |flags| type| | 6c 61 6e 32 | | data | l a n 2 | 00 00 00 00 | | data | |00005|--|00002| |len |flags| type| | 02 00 00 00 | | data | |00164|N-|00003| |len |flags| type| |00020|N-|00001| |len |flags| type| |00005|--|00001| |len |flags| type| | 00 00 00 00 | | data | |00005|--|00002| |len |flags| type| | 02 00 00 00 | | data | |00020|N-|00001| |len |flags| type| |00005|--|00001| |len |flags| type| | 01 00 00 00 | | data | |00005|--|00002| |len |flags| type| | 02 00 00 00 | | data | |00020|N-|00001| |len |flags| type| |00005|--|00001| |len |flags| type| | 02 00 00 00 | | data | |00005|--|00002| |len |flags| type| | 02 00 00 00 | | data | |00020|N-|00001| |len |flags| type| |00005|--|00001| |len |flags| type| | 03 00 00 00 | | data | |00005|--|00002| |len |flags| type| | 02 00 00 00 | | data | |00020|N-|00002| |len |flags| type| |00005|--|00001| |len |flags| type| | 00 00 00 00 | | data | |00008|--|00002| |len |flags| type| | 60 09 00 00 | | data | ` |00020|N-|00002| |len |flags| type| |00005|--|00001| |len |flags| type| | 01 00 00 00 | | data | |00008|--|00002| |len |flags| type| | b0 09 00 00 | | data | |00020|N-|00002| |len |flags| type| |00005|--|00001| |len |flags| type| | 02 00 00 00 | | data | |00008|--|00002| |len |flags| type| | 60 09 00 00 | | data | ` |00020|N-|00002| |len |flags| type| |00005|--|00001| |len |flags| type| | 03 00 00 00 | | data | |00008|--|00002| |len |flags| type| | 60 09 00 00 | | data | `
---------------- ------------------
Cable test completed for device lan2.
Pair A code Open Circuit
Pair B code Open Circuit
Pair C code Open Circuit
Pair D code Open Circuit
Pair A, fault length: 24.00m
Pair B, fault length: 24.80m
Pair C, fault length: 24.00m
Pair D, fault length: 24.00m
Andrew
Quoted 41 lines · Andrew Lunn
Quoted 20 lines · Michal Kubecek
Quoted 13 lines · Andrew Lunn
Add the user space side of the ethtool cable test.
The TDR output is most useful when fed to some other tool which can visualize the data. So add JSON support, by borrowing code from iproute2.
v2:
man page fixes.v3:
More man page fixes.
Usejson_printfrom iproute2.Quoted 5 lines
v4:
checkpatch cleanup
ethtool --cable-test dev
Place breakout intocable_test_context
Remove Pair: Pair outputQuoted 7 lines
Hello Andrew,
could you please test this update of
netlink/desc-ethtool.con top of your series? The userspace messages look as expected but I'm not sure if I have a device with cable test support available to test pretty printing of kernel messages. (And even if I do, I almost certainly won't have physical access to it.)Hi Michal
Currently there are three PHY drivers with support: Marvell, Atheros at803x, and bcm54140. And you can do some amount of testing without physical access, you can expect the test results to indicate the cable is O.K.
However, i will give these a go.
Some sort of capture and reply would be interesting for this, and for regression testing. The ability to do something like
Quoted 8 lines
ethtool --monitor -w test.cap
To dump the netlink socket data to a file, and
ethtool --monitor -r test.cap
to read from the file and decode its contents. Maybe this is already possible via nlmon?
Such feature would definitely be useful. It should be possible to capture the data using nlmon and tcpdump but whenever I tried to use nlmon to capture netlink data, I found it rather difficult to capture only the traffic I was interested in. For the second part (feeding the captured data to ethtool), we would probably need some tool which would work like tcpreplay. Having support in ethtool makes very good sense and it shouldn't require too much extra code, perhaps a dependency on libpcap.
In the long term, I would like to write a packetdrill-like framework for selftests where testcases would be scripts consisting of statements saying e.g. "run with this command line", "expect this netlink message", "reply with this netlink message", "expect this output" etc. But that would be more complex and ability to capture into a file and replay it would b useful independently of that.
Michal
Quoted 9 lines · Andrew Lunn
Quoted 7 lines
Hello Andrew,
could you please test this update of
netlink/desc-ethtool.con top of your series? The userspace messages look as expected but I'm not sure if I have a device with cable test support available to test pretty printing of kernel messages. (And even if I do, I almost certainly won't have physical access to it.)Tested-by Andrew Lunn <[email protected]>
Thank you,
Michal