Hello community, here is the log from the commit of package ethtool for openSUSE:Factory checked in at 2020-06-16 13:45:01 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ethtool (Old) and /work/SRC/openSUSE:Factory/.ethtool.new.3606 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ethtool" Tue Jun 16 13:45:01 2020 rev:62 rq:814575 version:5.7 Changes: -------- --- /work/SRC/openSUSE:Factory/ethtool/ethtool.changes 2020-05-17 23:42:43.461004189 +0200 +++ /work/SRC/openSUSE:Factory/.ethtool.new.3606/ethtool.changes 2020-06-16 13:45:40.685768179 +0200 @@ -1,0 +2,26 @@ +Fri Jun 12 10:19:38 UTC 2020 - Michal Kubecek <[email protected]> + +- prevent misleading netlink error message when running on kernel + without ethtool netlink support: + netlink-fix-error-message-suppression.patch + +------------------------------------------------------------------- +Sun Jun 7 19:55:27 UTC 2020 - Michal Kubecek <[email protected]> + +- update to new upstream release 5.7 + * support LLRS (Low Latency Reed Solomon) FEC mode + * accept long legacy flag names (-K) + * support for newer SFF-8024 compliance codes + * report transceiver when reported by kernel + * improve fallback from netlink to ioctl and error messages +- drop patches present in 5.7 release: + netlink-show-netlink-error-even-without-extack.patch + features-accept-long-legacy-flag-names-when-setting-.patch + refactor-interface-between-ioctl-and-netlink-code.patch + netlink-use-genetlink-ops-information-to-decide-abou.patch +- refresh + netlink-fix-build-warnings.patch +- fix cherry picked from upstream git: + netlink-fix-unwanted-switch-fall-through-in-family_i.patch + +------------------------------------------------------------------- Old: ---- ethtool-5.6.tar.sign ethtool-5.6.tar.xz features-accept-long-legacy-flag-names-when-setting-.patch netlink-show-netlink-error-even-without-extack.patch netlink-use-genetlink-ops-information-to-decide-abou.patch refactor-interface-between-ioctl-and-netlink-code.patch New: ---- ethtool-5.7.tar.sign ethtool-5.7.tar.xz netlink-fix-error-message-suppression.patch netlink-fix-unwanted-switch-fall-through-in-family_i.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ethtool.spec ++++++ --- /var/tmp/diff_new_pack.kBtqQt/_old 2020-06-16 13:45:41.901777959 +0200 +++ /var/tmp/diff_new_pack.kBtqQt/_new 2020-06-16 13:45:41.905777991 +0200 @@ -17,7 +17,7 @@ Name: ethtool -Version: 5.6 +Version: 5.7 Release: 0 Summary: Utility for examining and tuning Ethernet-based network interfaces License: GPL-2.0-only @@ -34,10 +34,8 @@ BuildRequires: pkgconfig(libmnl) Patch1: netlink-fix-build-warnings.patch -Patch2: netlink-show-netlink-error-even-without-extack.patch -Patch3: features-accept-long-legacy-flag-names-when-setting-.patch -Patch4: refactor-interface-between-ioctl-and-netlink-code.patch -Patch5: netlink-use-genetlink-ops-information-to-decide-abou.patch +Patch2: netlink-fix-unwanted-switch-fall-through-in-family_i.patch +Patch3: netlink-fix-error-message-suppression.patch %description Ethtool is a small utility for examining and tuning ethernet-based @@ -48,8 +46,6 @@ %patch1 -p1 %patch2 -p1 %patch3 -p1 -%patch4 -p1 -%patch5 -p1 %build export CFLAGS="%optflags -W -Wall -Wstrict-prototypes -Wformat-security -Wpointer-arith -Wno-missing-field-initializers" ++++++ ethtool-5.6.tar.xz -> ethtool-5.7.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ethtool-5.6/NEWS new/ethtool-5.7/NEWS --- old/ethtool-5.6/NEWS 2020-05-12 16:54:14.000000000 +0200 +++ new/ethtool-5.7/NEWS 2020-06-04 20:06:41.000000000 +0200 @@ -1,3 +1,13 @@ +Version 5.7 - Jun 4, 2020 + * Feature: ethtool: Add support for Low Latency Reed Solomon + * Fix: ethtool.c: Report transceiver correctly + * Feature: features: accept long legacy flag names when setting features + * Feature: refactor interface between ioctl and netlink code + * Feature: netlink: use genetlink ops information to decide about fallback + * Feature: netlink: show netlink error even without extack + * Feature: ethtool: add support for newer SFF-8024 compliance codes + * Feature: Rewrite printf() due to -Werror=format-security + Version 5.6 - May 12, 2020 * Feature: add --debug option to control debugging messages * Feature: use named initializers in command line option list diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ethtool-5.6/configure new/ethtool-5.7/configure --- old/ethtool-5.6/configure 2020-05-12 16:56:20.000000000 +0200 +++ new/ethtool-5.7/configure 2020-06-04 20:08:06.000000000 +0200 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for ethtool 5.6. +# Generated by GNU Autoconf 2.69 for ethtool 5.7. # # Report bugs to <[email protected]>. # @@ -580,8 +580,8 @@ # Identity of this package. PACKAGE_NAME='ethtool' PACKAGE_TARNAME='ethtool' -PACKAGE_VERSION='5.6' -PACKAGE_STRING='ethtool 5.6' +PACKAGE_VERSION='5.7' +PACKAGE_STRING='ethtool 5.7' PACKAGE_BUGREPORT='[email protected]' PACKAGE_URL='' @@ -1254,7 +1254,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures ethtool 5.6 to adapt to many kinds of systems. +\`configure' configures ethtool 5.7 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1320,7 +1320,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of ethtool 5.6:";; + short | recursive ) echo "Configuration of ethtool 5.7:";; esac cat <<\_ACEOF @@ -1430,7 +1430,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -ethtool configure 5.6 +ethtool configure 5.7 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1677,7 +1677,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by ethtool $as_me 5.6, which was +It was created by ethtool $as_me 5.7, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2542,7 +2542,7 @@ # Define the identity of the package. PACKAGE='ethtool' - VERSION='5.6' + VERSION='5.7' cat >>confdefs.h <<_ACEOF @@ -5122,7 +5122,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by ethtool $as_me 5.6, which was +This file was extended by ethtool $as_me 5.7, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -5188,7 +5188,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -ethtool config.status 5.6 +ethtool config.status 5.7 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ethtool-5.6/configure.ac new/ethtool-5.7/configure.ac --- old/ethtool-5.6/configure.ac 2020-05-12 16:47:34.000000000 +0200 +++ new/ethtool-5.7/configure.ac 2020-06-04 20:02:03.000000000 +0200 @@ -1,5 +1,5 @@ dnl Process this file with autoconf to produce a configure script. -AC_INIT(ethtool, 5.6, [email protected]) +AC_INIT(ethtool, 5.7, [email protected]) AC_PREREQ(2.52) AC_CONFIG_SRCDIR([ethtool.c]) AM_INIT_AUTOMAKE([gnu subdir-objects]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ethtool-5.6/ethtool.8 new/ethtool-5.7/ethtool.8 --- old/ethtool-5.6/ethtool.8 2020-05-12 16:56:21.000000000 +0200 +++ new/ethtool-5.7/ethtool.8 2020-06-04 20:08:08.000000000 +0200 @@ -113,7 +113,7 @@ . hy \\n(HY .. . -.TH ETHTOOL 8 "May 2020" "Ethtool version 5.6" +.TH ETHTOOL 8 "Jun 2020" "Ethtool version 5.7" .SH NAME ethtool \- query or control network driver and hardware settings . @@ -420,7 +420,7 @@ .B ethtool \-\-set\-fec .I devname .B encoding -.BR auto | off | rs | baser \ [...] +.BR auto | off | rs | baser | llrs \ [...] .HP .B ethtool \-Q|\-\-per\-queue .I devname @@ -1228,7 +1228,7 @@ administratively and report the problem in the system logs for users to correct. .RS 4 .TP -.BR encoding\ auto | off | rs | baser \ [...] +.BR encoding\ auto | off | rs | baser | llrs \ [...] Sets the FEC encoding for the device. Combinations of options are specified as e.g. @@ -1241,6 +1241,7 @@ off Turn off FEC RS Force RS-FEC encoding BaseR Force BaseR encoding +LLRS Force LLRS-FEC encoding .TE .RE .TP diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ethtool-5.6/ethtool.8.in new/ethtool-5.7/ethtool.8.in --- old/ethtool-5.6/ethtool.8.in 2020-05-12 16:48:10.000000000 +0200 +++ new/ethtool-5.7/ethtool.8.in 2020-06-04 20:02:37.000000000 +0200 @@ -113,7 +113,7 @@ . hy \\n(HY .. . -.TH ETHTOOL 8 "May 2020" "Ethtool version @VERSION@" +.TH ETHTOOL 8 "Jun 2020" "Ethtool version @VERSION@" .SH NAME ethtool \- query or control network driver and hardware settings . @@ -420,7 +420,7 @@ .B ethtool \-\-set\-fec .I devname .B encoding -.BR auto | off | rs | baser \ [...] +.BR auto | off | rs | baser | llrs \ [...] .HP .B ethtool \-Q|\-\-per\-queue .I devname @@ -1228,7 +1228,7 @@ administratively and report the problem in the system logs for users to correct. .RS 4 .TP -.BR encoding\ auto | off | rs | baser \ [...] +.BR encoding\ auto | off | rs | baser | llrs \ [...] Sets the FEC encoding for the device. Combinations of options are specified as e.g. @@ -1241,6 +1241,7 @@ off Turn off FEC RS Force RS-FEC encoding BaseR Force BaseR encoding +LLRS Force LLRS-FEC encoding .TE .RE .TP diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ethtool-5.6/ethtool.c new/ethtool-5.7/ethtool.c --- old/ethtool-5.6/ethtool.c 2020-03-13 20:16:59.000000000 +0100 +++ new/ethtool-5.7/ethtool.c 2020-05-13 21:54:38.000000000 +0200 @@ -502,6 +502,7 @@ ETHTOOL_LINK_MODE_FEC_NONE_BIT, ETHTOOL_LINK_MODE_FEC_RS_BIT, ETHTOOL_LINK_MODE_FEC_BASER_BIT, + ETHTOOL_LINK_MODE_FEC_LLRS_BIT, }; unsigned int i; @@ -754,6 +755,12 @@ fprintf(stdout, " RS"); fecreported = 1; } + if (ethtool_link_mode_test_bit(ETHTOOL_LINK_MODE_FEC_LLRS_BIT, + mask)) { + fprintf(stdout, " LLRS"); + fecreported = 1; + } + if (!fecreported) fprintf(stdout, " Not reported"); fprintf(stdout, "\n"); @@ -1562,6 +1569,8 @@ fprintf(stdout, " BaseR"); if (fec & ETHTOOL_FEC_RS) fprintf(stdout, " RS"); + if (fec & ETHTOOL_FEC_LLRS) + fprintf(stdout, " LLRS"); } #define N_SOTS 7 @@ -2297,26 +2306,33 @@ /* Generate cmdline_info for legacy flags and kernel-named * features, and parse our arguments. */ - cmdline_features = calloc(ARRAY_SIZE(off_flag_def) + defs->n_features, + cmdline_features = calloc(2 * ARRAY_SIZE(off_flag_def) + + defs->n_features, sizeof(cmdline_features[0])); if (!cmdline_features) { perror("Cannot parse arguments"); rc = 1; goto err; } - for (i = 0; i < ARRAY_SIZE(off_flag_def); i++) + j = 0; + for (i = 0; i < ARRAY_SIZE(off_flag_def); i++) { flag_to_cmdline_info(off_flag_def[i].short_name, off_flag_def[i].value, &off_flags_wanted, &off_flags_mask, - &cmdline_features[i]); + &cmdline_features[j++]); + flag_to_cmdline_info(off_flag_def[i].long_name, + off_flag_def[i].value, + &off_flags_wanted, &off_flags_mask, + &cmdline_features[j++]); + } for (i = 0; i < defs->n_features; i++) flag_to_cmdline_info( defs->def[i].name, FEATURE_FIELD_FLAG(i), &FEATURE_WORD(efeatures->features, i, requested), &FEATURE_WORD(efeatures->features, i, valid), - &cmdline_features[ARRAY_SIZE(off_flag_def) + i]); + &cmdline_features[j++]); parse_generic_cmdline(ctx, &any_changed, cmdline_features, - ARRAY_SIZE(off_flag_def) + defs->n_features); + 2 * ARRAY_SIZE(off_flag_def) + defs->n_features); free(cmdline_features); if (!any_changed) { @@ -2497,8 +2513,8 @@ if (link_usettings == NULL) return NULL; - /* keep transceiver 0 */ memcpy(&link_usettings->base, &ecmd.req, sizeof(link_usettings->base)); + link_usettings->deprecated.transceiver = ecmd.req.transceiver; /* copy link mode bitmaps */ u32_offs = 0; @@ -5074,7 +5090,8 @@ return ETHTOOL_FEC_RS; if (!strcasecmp(str, "baser")) return ETHTOOL_FEC_BASER; - + if (!strcasecmp(str, "llrs")) + return ETHTOOL_FEC_LLRS; return 0; } @@ -5157,7 +5174,7 @@ const char *opts; bool no_dev; int (*func)(struct cmd_context *); - int (*nlfunc)(struct cmd_context *); + nl_func_t nlfunc; const char *help; const char *xhelp; }; @@ -5486,7 +5503,7 @@ .opts = "--set-fec", .func = do_sfec, .help = "Set FEC settings", - .xhelp = " [ encoding auto|off|rs|baser [...]]\n" + .xhelp = " [ encoding auto|off|rs|baser|llrs [...]]\n" }, { .opts = "-Q|--per-queue", @@ -5731,6 +5748,11 @@ ctx->fd = -1; return 0; } + if (strlen(ctx->devname) >= IFNAMSIZ) { + fprintf(stderr, "Device name longer than %u characters\n", + IFNAMSIZ - 1); + exit_bad_args(); + } /* Setup our control structures. */ memset(&ctx->ifr, 0, sizeof(ctx->ifr)); @@ -5750,9 +5772,9 @@ int main(int argc, char **argp) { - int (*nlfunc)(struct cmd_context *) = NULL; int (*func)(struct cmd_context *); struct cmd_context ctx = {}; + nl_func_t nlfunc = NULL; bool no_dev; int ret; int k; @@ -5775,19 +5797,12 @@ argp += 2; argc -= 2; } -#ifdef ETHTOOL_ENABLE_NETLINK if (*argp && !strcmp(*argp, "--monitor")) { - if (netlink_init(&ctx)) { - fprintf(stderr, - "Option --monitor is only available with netlink.\n"); - return 1; - } else { - ctx.argp = ++argp; - ctx.argc = --argc; - return nl_monitor(&ctx); - } + ctx.argp = ++argp; + ctx.argc = --argc; + ret = nl_monitor(&ctx); + return ret ? 1 : 0; } -#endif /* First argument must be either a valid option or a device * name to get settings for (which we don't expect to begin @@ -5812,40 +5827,17 @@ no_dev = false; opt_found: - if (nlfunc) { - if (netlink_init(&ctx)) - nlfunc = NULL; /* fallback to ioctl() */ - } - if (!no_dev) { ctx.devname = *argp++; argc--; - /* netlink supports altnames, we will have to recheck against - * IFNAMSIZ later in case of fallback to ioctl - */ - if (!ctx.devname || strlen(ctx.devname) >= ALTIFNAMSIZ) { - netlink_done(&ctx); + if (!ctx.devname) exit_bad_args(); - } } - ctx.argc = argc; ctx.argp = argp; + netlink_run_handler(&ctx, nlfunc, !func); - if (nlfunc) { - ret = nlfunc(&ctx); - netlink_done(&ctx); - if ((ret != -EOPNOTSUPP) || !func) - return (ret >= 0) ? ret : 1; - } - - if (ctx.devname && strlen(ctx.devname) >= IFNAMSIZ) { - fprintf(stderr, - "ethtool: device names longer than %u characters are only allowed with netlink\n", - IFNAMSIZ - 1); - exit_bad_args(); - } ret = ioctl_init(&ctx, no_dev); if (ret) return ret; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ethtool-5.6/ethtool.spec new/ethtool-5.7/ethtool.spec --- old/ethtool-5.6/ethtool.spec 2020-05-12 16:56:22.000000000 +0200 +++ new/ethtool-5.7/ethtool.spec 2020-06-04 20:08:09.000000000 +0200 @@ -1,5 +1,5 @@ Name : ethtool -Version : 5.6 +Version : 5.7 Release : 1 Group : Utilities diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ethtool-5.6/netlink/extapi.h new/ethtool-5.7/netlink/extapi.h --- old/ethtool-5.6/netlink/extapi.h 2020-03-13 20:10:51.000000000 +0100 +++ new/ethtool-5.7/netlink/extapi.h 2020-05-13 21:54:38.000000000 +0200 @@ -10,10 +10,12 @@ struct cmd_context; struct nl_context; +typedef int (*nl_func_t)(struct cmd_context *); + #ifdef ETHTOOL_ENABLE_NETLINK -int netlink_init(struct cmd_context *ctx); -void netlink_done(struct cmd_context *ctx); +void netlink_run_handler(struct cmd_context *ctx, nl_func_t nlfunc, + bool no_fallback); int nl_gset(struct cmd_context *ctx); int nl_sset(struct cmd_context *ctx); @@ -24,13 +26,15 @@ #else /* ETHTOOL_ENABLE_NETLINK */ -static inline int netlink_init(struct cmd_context *ctx maybe_unused) +static inline void netlink_run_handler(struct cmd_context *ctx, + nl_func_t nlfunc, bool no_fallback) { - return -EOPNOTSUPP; } -static inline void netlink_done(struct cmd_context *ctx maybe_unused) +static inline int nl_monitor(struct cmd_context *ctx) { + fprintf(stderr, "Netlink not supported by ethtool, option --monitor unsupported.\n"); + return -EOPNOTSUPP; } static inline void nl_monitor_usage(void) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ethtool-5.6/netlink/monitor.c new/ethtool-5.7/netlink/monitor.c --- old/ethtool-5.6/netlink/monitor.c 2020-03-13 20:10:51.000000000 +0100 +++ new/ethtool-5.7/netlink/monitor.c 2020-05-13 21:54:38.000000000 +0200 @@ -167,16 +167,25 @@ int nl_monitor(struct cmd_context *ctx) { - struct nl_context *nlctx = ctx->nlctx; - struct nl_socket *nlsk = nlctx->ethnl_socket; - uint32_t grpid = nlctx->ethnl_mongrp; + struct nl_context *nlctx; + struct nl_socket *nlsk; + uint32_t grpid; bool is_dev; int ret; + ret = netlink_init(ctx); + if (ret < 0) { + fprintf(stderr, "Netlink interface initialization failed, option --monitor not supported.\n"); + return ret; + } + nlctx = ctx->nlctx; + nlsk = nlctx->ethnl_socket; + grpid = nlctx->ethnl_mongrp; if (!grpid) { fprintf(stderr, "multicast group 'monitor' not found\n"); return -EOPNOTSUPP; } + if (parse_monitor(ctx) < 0) return 1; is_dev = ctx->devname && strcmp(ctx->devname, WILDCARD_DEVNAME); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ethtool-5.6/netlink/netlink.c new/ethtool-5.7/netlink/netlink.c --- old/ethtool-5.6/netlink/netlink.c 2020-03-13 20:10:51.000000000 +0100 +++ new/ethtool-5.7/netlink/netlink.c 2020-05-13 21:54:38.000000000 +0200 @@ -92,16 +92,88 @@ return 0; } +/** + * netlink_cmd_check() - check support for netlink command + * @ctx: ethtool command context + * @cmd: netlink command id + * @devname: device name from user + * @allow_wildcard: wildcard dumps supported + * + * Check if command @cmd is known to be unsupported based on ops information + * from genetlink family id request. Set nlctx->ioctl_fallback if ethtool + * should fall back to ioctl, i.e. when we do not know in advance that + * netlink request is supported. Set nlctx->wildcard_unsupported if "*" was + * used as device name but the request does not support wildcards (on either + * side). + * + * Return: true if we know the netlink request is not supported and should + * fail (and possibly fall back) without actually sending it to kernel. + */ +bool netlink_cmd_check(struct cmd_context *ctx, unsigned int cmd, + bool allow_wildcard) +{ + bool is_dump = !strcmp(ctx->devname, WILDCARD_DEVNAME); + uint32_t cap = is_dump ? GENL_CMD_CAP_DUMP : GENL_CMD_CAP_DO; + struct nl_context *nlctx = ctx->nlctx; + + if (is_dump && !allow_wildcard) { + nlctx->wildcard_unsupported = true; + return true; + } + if (!nlctx->ops_flags) { + nlctx->ioctl_fallback = true; + return false; + } + if (cmd > ETHTOOL_MSG_USER_MAX || !nlctx->ops_flags[cmd]) { + nlctx->ioctl_fallback = true; + return true; + } + + if (is_dump && !(nlctx->ops_flags[cmd] & GENL_CMD_CAP_DUMP)) + nlctx->wildcard_unsupported = true; + + return !(nlctx->ops_flags[cmd] & cap); +} + /* initialization */ -struct fam_info { - const char *fam_name; - const char *grp_name; - uint16_t fam_id; - uint32_t grp_id; -}; +static int genl_read_ops(struct nl_context *nlctx, + const struct nlattr *ops_attr) +{ + struct nlattr *op_attr; + uint32_t *ops_flags; + int ret; -static void find_mc_group(struct nlattr *nest, struct fam_info *info) + ops_flags = calloc(__ETHTOOL_MSG_USER_CNT, sizeof(ops_flags[0])); + if (!ops_flags) + return -ENOMEM; + + mnl_attr_for_each_nested(op_attr, ops_attr) { + const struct nlattr *tb[CTRL_ATTR_OP_MAX + 1] = {}; + DECLARE_ATTR_TB_INFO(tb); + uint32_t op_id; + + ret = mnl_attr_parse_nested(op_attr, attr_cb, &tb_info); + if (ret < 0) + goto err; + + if (!tb[CTRL_ATTR_OP_ID] || !tb[CTRL_ATTR_OP_FLAGS]) + continue; + op_id = mnl_attr_get_u32(tb[CTRL_ATTR_OP_ID]); + if (op_id >= __ETHTOOL_MSG_USER_CNT) + continue; + + ops_flags[op_id] = mnl_attr_get_u32(tb[CTRL_ATTR_OP_FLAGS]); + } + + nlctx->ops_flags = ops_flags; + return 0; +err: + free(ops_flags); + return ret; +} + +static void find_mc_group(struct nl_context *nlctx, struct nlattr *nest) { const struct nlattr *grp_tb[CTRL_ATTR_MCAST_GRP_MAX + 1] = {}; DECLARE_ATTR_TB_INFO(grp_tb); @@ -116,9 +188,9 @@ !grp_tb[CTRL_ATTR_MCAST_GRP_ID]) continue; if (strcmp(mnl_attr_get_str(grp_tb[CTRL_ATTR_MCAST_GRP_NAME]), - info->grp_name)) + ETHTOOL_MCGRP_MONITOR_NAME)) continue; - info->grp_id = + nlctx->ethnl_mongrp = mnl_attr_get_u32(grp_tb[CTRL_ATTR_MCAST_GRP_ID]); return; } @@ -126,16 +198,21 @@ static int family_info_cb(const struct nlmsghdr *nlhdr, void *data) { - struct fam_info *info = data; + struct nl_context *nlctx = data; struct nlattr *attr; + int ret; mnl_attr_for_each(attr, nlhdr, GENL_HDRLEN) { switch (mnl_attr_get_type(attr)) { case CTRL_ATTR_FAMILY_ID: - info->fam_id = mnl_attr_get_u16(attr); + nlctx->ethnl_fam = mnl_attr_get_u16(attr); break; + case CTRL_ATTR_OPS: + ret = genl_read_ops(nlctx, attr); + if (ret < 0) + return MNL_CB_ERROR; case CTRL_ATTR_MCAST_GROUPS: - find_mc_group(attr, info); + find_mc_group(nlctx, attr); break; } } @@ -144,41 +221,37 @@ } #ifdef TEST_ETHTOOL -static int get_genl_family(struct nl_socket *nlsk, struct fam_info *info) +static int get_genl_family(struct nl_context *nlctx, struct nl_socket *nlsk) { return 0; } #else -static int get_genl_family(struct nl_socket *nlsk, struct fam_info *info) +static int get_genl_family(struct nl_context *nlctx, struct nl_socket *nlsk) { struct nl_msg_buff *msgbuff = &nlsk->msgbuff; int ret; - nlsk->nlctx->suppress_nlerr = 2; + nlctx->suppress_nlerr = 2; ret = __msg_init(msgbuff, GENL_ID_CTRL, CTRL_CMD_GETFAMILY, NLM_F_REQUEST | NLM_F_ACK, 1); if (ret < 0) goto out; ret = -EMSGSIZE; - if (ethnla_put_strz(msgbuff, CTRL_ATTR_FAMILY_NAME, info->fam_name)) + if (ethnla_put_strz(msgbuff, CTRL_ATTR_FAMILY_NAME, ETHTOOL_GENL_NAME)) goto out; nlsock_sendmsg(nlsk, NULL); - nlsock_process_reply(nlsk, family_info_cb, info); - ret = info->fam_id ? 0 : -EADDRNOTAVAIL; + nlsock_process_reply(nlsk, family_info_cb, nlctx); + ret = nlctx->ethnl_fam ? 0 : -EADDRNOTAVAIL; out: - nlsk->nlctx->suppress_nlerr = 0; + nlctx->suppress_nlerr = 0; return ret; } #endif int netlink_init(struct cmd_context *ctx) { - struct fam_info info = { - .fam_name = ETHTOOL_GENL_NAME, - .grp_name = ETHTOOL_MCGRP_MONITOR_NAME, - }; struct nl_context *nlctx; int ret; @@ -189,11 +262,9 @@ ret = nlsock_init(nlctx, &nlctx->ethnl_socket, NETLINK_GENERIC); if (ret < 0) goto out_free; - ret = get_genl_family(nlctx->ethnl_socket, &info); + ret = get_genl_family(nlctx, nlctx->ethnl_socket); if (ret < 0) goto out_nlsk; - nlctx->ethnl_fam = info.fam_id; - nlctx->ethnl_mongrp = info.grp_id; ctx->nlctx = nlctx; return 0; @@ -201,16 +272,84 @@ out_nlsk: nlsock_done(nlctx->ethnl_socket); out_free: + free(nlctx->ops_flags); free(nlctx); return ret; } -void netlink_done(struct cmd_context *ctx) +static void netlink_done(struct cmd_context *ctx) { if (!ctx->nlctx) return; + free(ctx->nlctx->ops_flags); free(ctx->nlctx); ctx->nlctx = NULL; cleanup_all_strings(); } + +/** + * netlink_run_handler() - run netlink handler for subcommand + * @ctx: command context + * @nlfunc: subcommand netlink handler to call + * @no_fallback: there is no ioctl fallback handler + * + * This function returns only if ioctl() handler should be run as fallback. + * Otherwise it exits with appropriate return code. + */ +void netlink_run_handler(struct cmd_context *ctx, nl_func_t nlfunc, + bool no_fallback) +{ + bool wildcard = ctx->devname && !strcmp(ctx->devname, WILDCARD_DEVNAME); + struct nl_context *nlctx; + const char *reason; + int ret; + + if (ctx->devname && strlen(ctx->devname) >= ALTIFNAMSIZ) { + fprintf(stderr, "device name '%s' longer than %u characters\n", + ctx->devname, ALTIFNAMSIZ - 1); + exit(1); + } + + if (!nlfunc) { + reason = "ethtool netlink support for subcommand missing"; + goto no_support; + } + if (netlink_init(ctx)) { + reason = "netlink interface initialization failed"; + goto no_support; + } + nlctx = ctx->nlctx; + + ret = nlfunc(ctx); + netlink_done(ctx); + if (no_fallback || ret != -EOPNOTSUPP || !nlctx->ioctl_fallback) { + if (nlctx->wildcard_unsupported) + fprintf(stderr, "%s\n", + "subcommand does not support wildcard dump"); + exit(ret >= 0 ? ret : 1); + } + if (nlctx->wildcard_unsupported) + reason = "subcommand does not support wildcard dump"; + else + reason = "kernel netlink support for subcommand missing"; + +no_support: + if (no_fallback) { + fprintf(stderr, "%s, subcommand not supported by ioctl\n", + reason); + exit(1); + } + if (wildcard) { + fprintf(stderr, "%s, wildcard dump not supported\n", reason); + exit(1); + } + if (ctx->devname && strlen(ctx->devname) >= IFNAMSIZ) { + fprintf(stderr, + "%s, device name longer than %u not supported\n", + reason, IFNAMSIZ - 1); + exit(1); + } + + /* fallback to ioctl() */ +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ethtool-5.6/netlink/netlink.h new/ethtool-5.7/netlink/netlink.h --- old/ethtool-5.6/netlink/netlink.h 2020-03-13 20:10:51.000000000 +0100 +++ new/ethtool-5.7/netlink/netlink.h 2020-05-13 21:54:38.000000000 +0200 @@ -25,6 +25,7 @@ unsigned int suppress_nlerr; uint16_t ethnl_fam; uint32_t ethnl_mongrp; + uint32_t *ops_flags; struct nl_socket *ethnl_socket; struct nl_socket *ethnl2_socket; struct nl_socket *rtnl_socket; @@ -36,6 +37,8 @@ const char *param; char **argp; int argc; + bool ioctl_fallback; + bool wildcard_unsupported; }; struct attr_tb_info { @@ -49,6 +52,9 @@ int nomsg_reply_cb(const struct nlmsghdr *nlhdr, void *data); int attr_cb(const struct nlattr *attr, void *data); +int netlink_init(struct cmd_context *ctx); +bool netlink_cmd_check(struct cmd_context *ctx, unsigned int cmd, + bool allow_wildcard); const char *get_dev_name(const struct nlattr *nest); int get_dev_info(const struct nlattr *nest, int *ifindex, char *ifname); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ethtool-5.6/netlink/nlsock.c new/ethtool-5.7/netlink/nlsock.c --- old/ethtool-5.6/netlink/nlsock.c 2020-03-13 20:10:51.000000000 +0100 +++ new/ethtool-5.7/netlink/nlsock.c 2020-05-13 22:05:04.000000000 +0200 @@ -173,25 +173,25 @@ { const struct nlattr *tb[NLMSGERR_ATTR_MAX + 1] = {}; DECLARE_ATTR_TB_INFO(tb); + unsigned int err_offset = 0; unsigned int tlv_offset; struct nlmsgerr *nlerr; bool silent; - if (len < NLMSG_HDRLEN + sizeof(*nlerr)) + if ((len < NLMSG_HDRLEN + sizeof(*nlerr)) || (len < nlhdr->nlmsg_len)) return -EFAULT; nlerr = mnl_nlmsg_get_payload(nlhdr); - silent = (!(nlhdr->nlmsg_flags & NLM_F_ACK_TLVS) || - suppress_nlerr >= 2 || - (suppress_nlerr && nlerr->error == -EOPNOTSUPP)); - if (silent) - goto out; + silent = suppress_nlerr >= 2 || + (suppress_nlerr && nlerr->error == -EOPNOTSUPP); + if (silent || !(nlhdr->nlmsg_flags & NLM_F_ACK_TLVS)) + goto tlv_done; tlv_offset = sizeof(*nlerr); if (!(nlhdr->nlmsg_flags & NLM_F_CAPPED)) tlv_offset += MNL_ALIGN(mnl_nlmsg_get_payload_len(&nlerr->msg)); - if (mnl_attr_parse(nlhdr, tlv_offset, attr_cb, &tb_info) < 0) - goto out; + goto tlv_done; + if (tb[NLMSGERR_ATTR_MSG]) { const char *msg = mnl_attr_get_str(tb[NLMSGERR_ATTR_MSG]); @@ -202,24 +202,21 @@ mnl_attr_get_u32(tb[NLMSGERR_ATTR_OFFS])); fputc('\n', stderr); } + if (tb[NLMSGERR_ATTR_OFFS]) + err_offset = mnl_attr_get_u32(tb[NLMSGERR_ATTR_OFFS]); - if (nlerr->error && pretty) { - unsigned int err_offset = 0; - - if (tb[NLMSGERR_ATTR_OFFS]) - err_offset = mnl_attr_get_u32(tb[NLMSGERR_ATTR_OFFS]); +tlv_done: + if (nlerr->error && !silent) { + errno = -nlerr->error; + perror("netlink error"); + } + if (pretty && !(nlhdr->nlmsg_flags & NLM_F_CAPPED) && + nlhdr->nlmsg_len >= NLMSG_HDRLEN + nlerr->msg.nlmsg_len) { fprintf(stderr, "offending message%s:\n", err_offset ? " and attribute" : ""); pretty_print_genlmsg(&nlerr->msg, ethnl_umsg_desc, ethnl_umsg_n_desc, err_offset); } - -out: - if (nlerr->error) { - errno = -nlerr->error; - if (!silent) - perror("netlink error"); - } return nlerr->error; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ethtool-5.6/netlink/parser.c new/ethtool-5.7/netlink/parser.c --- old/ethtool-5.6/netlink/parser.c 2020-03-13 20:10:51.000000000 +0100 +++ new/ethtool-5.7/netlink/parser.c 2020-05-13 21:54:38.000000000 +0200 @@ -1023,6 +1023,13 @@ goto out_free; } + if (group_style == PARSER_GROUP_MSG) { + ret = -EOPNOTSUPP; + for (buff = buffs; buff; buff = buff->next) + if (msgbuff_len(&buff->msgbuff) > buff->orig_len && + netlink_cmd_check(nlctx->ctx, buff->id, false)) + goto out_free; + } for (buff = buffs; buff; buff = buff->next) { struct nl_msg_buff *msgbuff = &buff->msgbuff; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ethtool-5.6/netlink/settings.c new/ethtool-5.7/netlink/settings.c --- old/ethtool-5.6/netlink/settings.c 2020-03-13 20:10:51.000000000 +0100 +++ new/ethtool-5.7/netlink/settings.c 2020-05-13 21:54:38.000000000 +0200 @@ -207,6 +207,8 @@ { LM_CLASS_REAL, 400000, DUPLEX_FULL }, [ETHTOOL_LINK_MODE_400000baseCR8_Full_BIT] = { LM_CLASS_REAL, 400000, DUPLEX_FULL }, + [ETHTOOL_LINK_MODE_FEC_LLRS_BIT] = + { LM_CLASS_FEC }, }; const unsigned int link_modes_count = ARRAY_SIZE(link_modes); @@ -375,7 +377,7 @@ after: if (first && if_none) printf("%s", if_none); - printf(after); + printf("%s", after); return 0; err: @@ -726,6 +728,13 @@ struct nl_socket *nlsk = nlctx->ethnl_socket; int ret; + if (netlink_cmd_check(ctx, ETHTOOL_MSG_LINKMODES_GET, true) || + netlink_cmd_check(ctx, ETHTOOL_MSG_LINKINFO_GET, true) || + netlink_cmd_check(ctx, ETHTOOL_MSG_WOL_GET, true) || + netlink_cmd_check(ctx, ETHTOOL_MSG_DEBUG_GET, true) || + netlink_cmd_check(ctx, ETHTOOL_MSG_LINKSTATE_GET, true)) + return -EOPNOTSUPP; + nlctx->suppress_nlerr = 1; ret = gset_request(nlsk, ETHTOOL_MSG_LINKMODES_GET, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ethtool-5.6/qsfp.c new/ethtool-5.7/qsfp.c --- old/ethtool-5.6/qsfp.c 2019-03-14 19:42:05.000000000 +0100 +++ new/ethtool-5.7/qsfp.c 2020-05-13 21:54:38.000000000 +0200 @@ -375,6 +375,107 @@ printf("%s 100G Ethernet: 100G ACC or 25GAUI C2M ACC with worst BER of 10^(-12)\n", pfx); break; + case SFF8636_ETHERNET_100GE_DWDM2: + printf("%s 100GE-DWDM2 (DWDM transceiver using 2 wavelengths on a 1550 nm DWDM grid with a reach up to 80 km)\n", + pfx); + break; + case SFF8636_ETHERNET_100G_1550NM_WDM: + printf("%s 100G 1550nm WDM (4 wavelengths)\n", pfx); + break; + case SFF8636_ETHERNET_10G_BASET_SR: + printf("%s 10GBASE-T Short Reach (30 meters)\n", pfx); + break; + case SFF8636_ETHERNET_5G_BASET: + printf("%s 5GBASE-T\n", pfx); + break; + case SFF8636_ETHERNET_2HALFG_BASET: + printf("%s 2.5GBASE-T\n", pfx); + break; + case SFF8636_ETHERNET_40G_SWDM4: + printf("%s 40G SWDM4\n", pfx); + break; + case SFF8636_ETHERNET_100G_SWDM4: + printf("%s 100G SWDM4\n", pfx); + break; + case SFF8636_ETHERNET_100G_PAM4_BIDI: + printf("%s 100G PAM4 BiDi\n", pfx); + break; + case SFF8636_ETHERNET_4WDM10_MSA: + printf("%s 4WDM-10 MSA (10km version of 100G CWDM4 with same RS(528,514) FEC in host system)\n", + pfx); + break; + case SFF8636_ETHERNET_4WDM20_MSA: + printf("%s 4WDM-20 MSA (20km version of 100GBASE-LR4 with RS(528,514) FEC in host system)\n", + pfx); + break; + case SFF8636_ETHERNET_4WDM40_MSA: + printf("%s 4WDM-40 MSA (40km reach with APD receiver and RS(528,514) FEC in host system)\n", + pfx); + break; + case SFF8636_ETHERNET_100G_DR: + printf("%s 100GBASE-DR (clause 140), CAUI-4 (no FEC)\n", pfx); + break; + case SFF8636_ETHERNET_100G_FR_NOFEC: + printf("%s 100G-FR or 100GBASE-FR1 (clause 140), CAUI-4 (no FEC)\n", pfx); + break; + case SFF8636_ETHERNET_100G_LR_NOFEC: + printf("%s 100G-LR or 100GBASE-LR1 (clause 140), CAUI-4 (no FEC)\n", pfx); + break; + case SFF8636_ETHERNET_200G_ACC1: + printf("%s Active Copper Cable with 50GAUI, 100GAUI-2 or 200GAUI-4 C2M. Providing a worst BER of 10-6 or below\n", + pfx); + break; + case SFF8636_ETHERNET_200G_AOC1: + printf("%s Active Optical Cable with 50GAUI, 100GAUI-2 or 200GAUI-4 C2M. Providing a worst BER of 10-6 or below\n", + pfx); + break; + case SFF8636_ETHERNET_200G_ACC2: + printf("%s Active Copper Cable with 50GAUI, 100GAUI-2 or 200GAUI-4 C2M. Providing a worst BER of 2.6x10-4 for ACC, 10-5 for AUI, or below\n", + pfx); + break; + case SFF8636_ETHERNET_200G_A0C2: + printf("%s Active Optical Cable with 50GAUI, 100GAUI-2 or 200GAUI-4 C2M. Providing a worst BER of 2.6x10-4 for ACC, 10-5 for AUI, or below\n", + pfx); + break; + case SFF8636_ETHERNET_200G_CR4: + printf("%s 50GBASE-CR, 100GBASE-CR2, or 200GBASE-CR4\n", pfx); + break; + case SFF8636_ETHERNET_200G_SR4: + printf("%s 50GBASE-SR, 100GBASE-SR2, or 200GBASE-SR4\n", pfx); + break; + case SFF8636_ETHERNET_200G_DR4: + printf("%s 50GBASE-FR or 200GBASE-DR4\n", pfx); + break; + case SFF8636_ETHERNET_200G_FR4: + printf("%s 200GBASE-FR4\n", pfx); + break; + case SFF8636_ETHERNET_200G_PSM4: + printf("%s 200G 1550 nm PSM4\n", pfx); + break; + case SFF8636_ETHERNET_50G_LR: + printf("%s 50GBASE-LR\n", pfx); + break; + case SFF8636_ETHERNET_200G_LR4: + printf("%s 200GBASE-LR4\n", pfx); + break; + case SFF8636_ETHERNET_64G_EA: + printf("%s 64GFC EA\n", pfx); + break; + case SFF8636_ETHERNET_64G_SW: + printf("%s 64GFC SW\n", pfx); + break; + case SFF8636_ETHERNET_64G_LW: + printf("%s 64GFC LW\n", pfx); + break; + case SFF8636_ETHERNET_128FC_EA: + printf("%s 128GFC EA\n", pfx); + break; + case SFF8636_ETHERNET_128FC_SW: + printf("%s 128GFC SW\n", pfx); + break; + case SFF8636_ETHERNET_128FC_LW: + printf("%s 128GFC LW\n", pfx); + break; default: printf("%s (reserved or unknown)\n", pfx); break; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ethtool-5.6/qsfp.h new/ethtool-5.7/qsfp.h --- old/ethtool-5.6/qsfp.h 2018-02-27 20:19:33.000000000 +0100 +++ new/ethtool-5.7/qsfp.h 2020-05-13 21:54:38.000000000 +0200 @@ -496,6 +496,42 @@ #define SFF8636_ETHERNET_100G_AOC2 0x18 #define SFF8636_ETHERNET_100G_ACC2 0x19 +#define SFF8636_ETHERNET_100GE_DWDM2 0x1A +#define SFF8636_ETHERNET_100G_1550NM_WDM 0x1B +#define SFF8636_ETHERNET_10G_BASET_SR 0x1C +#define SFF8636_ETHERNET_5G_BASET 0x1D +#define SFF8636_ETHERNET_2HALFG_BASET 0x1E +#define SFF8636_ETHERNET_40G_SWDM4 0x1F +#define SFF8636_ETHERNET_100G_SWDM4 0x20 +#define SFF8636_ETHERNET_100G_PAM4_BIDI 0x21 +#define SFF8636_ETHERNET_4WDM10_MSA 0x22 +#define SFF8636_ETHERNET_4WDM20_MSA 0x23 +#define SFF8636_ETHERNET_4WDM40_MSA 0x24 +#define SFF8636_ETHERNET_100G_DR 0x25 +#define SFF8636_ETHERNET_100G_FR_NOFEC 0x26 +#define SFF8636_ETHERNET_100G_LR_NOFEC 0x27 +/* 28h-2Fh reserved */ +#define SFF8636_ETHERNET_200G_ACC1 0x30 +#define SFF8636_ETHERNET_200G_AOC1 0x31 +#define SFF8636_ETHERNET_200G_ACC2 0x32 +#define SFF8636_ETHERNET_200G_A0C2 0x33 +/* 34h-3Fh reserved */ +#define SFF8636_ETHERNET_200G_CR4 0x40 +#define SFF8636_ETHERNET_200G_SR4 0x41 +#define SFF8636_ETHERNET_200G_DR4 0x42 +#define SFF8636_ETHERNET_200G_FR4 0x43 +#define SFF8636_ETHERNET_200G_PSM4 0x44 +#define SFF8636_ETHERNET_50G_LR 0x45 +#define SFF8636_ETHERNET_200G_LR4 0x46 +/* 47h-4Fh reserved */ +#define SFF8636_ETHERNET_64G_EA 0x50 +#define SFF8636_ETHERNET_64G_SW 0x51 +#define SFF8636_ETHERNET_64G_LW 0x52 +#define SFF8636_ETHERNET_128FC_EA 0x53 +#define SFF8636_ETHERNET_128FC_SW 0x54 +#define SFF8636_ETHERNET_128FC_LW 0x55 +/* 56h-5Fh reserved */ + #define SFF8636_OPTION_2_OFFSET 0xC1 /* Rx output amplitude */ #define SFF8636_O2_RX_OUTPUT_AMP (1 << 0) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ethtool-5.6/sfpid.c new/ethtool-5.7/sfpid.c --- old/ethtool-5.6/sfpid.c 2019-10-29 18:51:21.000000000 +0100 +++ new/ethtool-5.7/sfpid.c 2020-05-13 21:54:38.000000000 +0200 @@ -191,8 +191,76 @@ printf("%s Extended: 100G AOC or 25GAUI C2M AOC with worst BER of 10^(-12)\n", pfx); if (id[36] == 0x19) printf("%s Extended: 100G ACC or 25GAUI C2M ACC with worst BER of 10^(-12)\n", pfx); + if (id[36] == 0x1a) + printf("%s Extended: 100GE-DWDM2 (DWDM transceiver using 2 wavelengths on a 1550 nm DWDM grid with a reach up to 80 km)\n", + pfx); + if (id[36] == 0x1b) + printf("%s Extended: 100G 1550nm WDM (4 wavelengths)\n", pfx); if (id[36] == 0x1c) printf("%s Extended: 10Gbase-T Short Reach\n", pfx); + if (id[36] == 0x1d) + printf("%s Extended: 5GBASE-T\n", pfx); + if (id[36] == 0x1e) + printf("%s Extended: 2.5GBASE-T\n", pfx); + if (id[36] == 0x1f) + printf("%s Extended: 40G SWDM4\n", pfx); + if (id[36] == 0x20) + printf("%s Extended: 100G SWDM4\n", pfx); + if (id[36] == 0x21) + printf("%s Extended: 100G PAM4 BiDi\n", pfx); + if (id[36] == 0x22) + printf("%s Extended: 4WDM-10 MSA (10km version of 100G CWDM4 with same RS(528,514) FEC in host system)\n", + pfx); + if (id[36] == 0x23) + printf("%s Extended: 4WDM-20 MSA (20km version of 100GBASE-LR4 with RS(528,514) FEC in host system)\n", + pfx); + if (id[36] == 0x24) + printf("%s Extended: 4WDM-40 MSA (40km reach with APD receiver and RS(528,514) FEC in host system)\n", + pfx); + if (id[36] == 0x25) + printf("%s Extended: 100GBASE-DR (clause 140), CAUI-4 (no FEC)\n", pfx); + if (id[36] == 0x26) + printf("%s Extended: 100G-FR or 100GBASE-FR1 (clause 140), CAUI-4 (no FEC)\n", pfx); + if (id[36] == 0x27) + printf("%s Extended: 100G-LR or 100GBASE-LR1 (clause 140), CAUI-4 (no FEC)\n", pfx); + if (id[36] == 0x30) + printf("%s Extended: Active Copper Cable with 50GAUI, 100GAUI-2 or 200GAUI-4 C2M. Providing a worst BER of 10-6 or below\n", + pfx); + if (id[36] == 0x31) + printf("%s Extended: Active Optical Cable with 50GAUI, 100GAUI-2 or 200GAUI-4 C2M. Providing a worst BER of 10-6 or below\n", + pfx); + if (id[36] == 0x32) + printf("%s Extended: Active Copper Cable with 50GAUI, 100GAUI-2 or 200GAUI-4 C2M. Providing a worst BER of 2.6x10-4 for ACC, 10-5 for AUI, or below\n", + pfx); + if (id[36] == 0x33) + printf("%s Extended: Active Optical Cable with 50GAUI, 100GAUI-2 or 200GAUI-4 C2M. Providing a worst BER of 2.6x10-4 for ACC, 10-5 for AUI, or below\n", + pfx); + if (id[36] == 0x40) + printf("%s Extended: 50GBASE-CR, 100GBASE-CR2, or 200GBASE-CR4\n", pfx); + if (id[36] == 0x41) + printf("%s Extended: 50GBASE-SR, 100GBASE-SR2, or 200GBASE-SR4\n", pfx); + if (id[36] == 0x42) + printf("%s Extended: 50GBASE-FR or 200GBASE-DR4\n", pfx); + if (id[36] == 0x43) + printf("%s Extended: 200GBASE-FR4\n", pfx); + if (id[36] == 0x44) + printf("%s Extended: 200G 1550 nm PSM4\n", pfx); + if (id[36] == 0x45) + printf("%s Extended: 50GBASE-LR\n", pfx); + if (id[36] == 0x46) + printf("%s Extended: 200GBASE-LR4\n", pfx); + if (id[36] == 0x50) + printf("%s Extended: 64GFC EA\n", pfx); + if (id[36] == 0x51) + printf("%s Extended: 64GFC SW\n", pfx); + if (id[36] == 0x52) + printf("%s Extended: 64GFC LW\n", pfx); + if (id[36] == 0x53) + printf("%s Extended: 128GFC EA\n", pfx); + if (id[36] == 0x54) + printf("%s Extended: 128GFC SW\n", pfx); + if (id[36] == 0x55) + printf("%s Extended: 128GFC LW\n", pfx); } static void sff8079_show_encoding(const __u8 *id) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ethtool-5.6/uapi/linux/ethtool.h new/ethtool-5.7/uapi/linux/ethtool.h --- old/ethtool-5.6/uapi/linux/ethtool.h 2020-03-13 20:10:50.000000000 +0100 +++ new/ethtool-5.7/uapi/linux/ethtool.h 2020-05-13 21:54:38.000000000 +0200 @@ -1328,6 +1328,7 @@ ETHTOOL_FEC_OFF_BIT, ETHTOOL_FEC_RS_BIT, ETHTOOL_FEC_BASER_BIT, + ETHTOOL_FEC_LLRS_BIT, }; #define ETHTOOL_FEC_NONE (1 << ETHTOOL_FEC_NONE_BIT) @@ -1335,6 +1336,7 @@ #define ETHTOOL_FEC_OFF (1 << ETHTOOL_FEC_OFF_BIT) #define ETHTOOL_FEC_RS (1 << ETHTOOL_FEC_RS_BIT) #define ETHTOOL_FEC_BASER (1 << ETHTOOL_FEC_BASER_BIT) +#define ETHTOOL_FEC_LLRS (1 << ETHTOOL_FEC_LLRS_BIT) /* CMDs currently supported */ #define ETHTOOL_GSET 0x00000001 /* DEPRECATED, Get settings. @@ -1519,6 +1521,7 @@ ETHTOOL_LINK_MODE_400000baseLR8_ER8_FR8_Full_BIT = 71, ETHTOOL_LINK_MODE_400000baseDR8_Full_BIT = 72, ETHTOOL_LINK_MODE_400000baseCR8_Full_BIT = 73, + ETHTOOL_LINK_MODE_FEC_LLRS_BIT = 74, /* must be last entry */ __ETHTOOL_LINK_MODE_MASK_NBITS ++++++ netlink-fix-build-warnings.patch ++++++ --- /var/tmp/diff_new_pack.kBtqQt/_old 2020-06-16 13:45:42.225780565 +0200 +++ /var/tmp/diff_new_pack.kBtqQt/_new 2020-06-16 13:45:42.225780565 +0200 @@ -1,21 +1,21 @@ From: Michal Kubecek <[email protected]> -Date: Tue, 12 May 2020 22:10:19 +0200 +Date: Fri, 29 May 2020 01:21:12 +0200 Subject: netlink: fix build warnings -Patch-mainline: Not yet, going to submit for 5.7 cycle +Patch-mainline: v5.8 +Git-commit: a9b8685859075771887aad0328246e0afa089caf Depending on compiler version and options, some of these warnings may result in build failure. - gcc 4.8 wants __KERNEL_DIV_ROUND_UP defined before including ethtool.h - avoid pointer arithmetic on void * -- do not use printf(s) if string is not a string literal Signed-off-by: Michal Kubecek <[email protected]> +Tested-by: Heiko Thiery <[email protected]> --- netlink/desc-ethtool.c | 2 +- netlink/parser.c | 2 +- - netlink/settings.c | 2 +- - 3 files changed, 3 insertions(+), 3 deletions(-) + 2 files changed, 2 insertions(+), 2 deletions(-) --- a/netlink/desc-ethtool.c +++ b/netlink/desc-ethtool.c @@ -41,14 +41,3 @@ ret = parser->handler(nlctx, parser->type, parser->handler_data, msgbuff, param_dest); if (ret < 0) ---- a/netlink/settings.c -+++ b/netlink/settings.c -@@ -375,7 +375,7 @@ static int dump_link_modes(struct nl_context *nlctx, - after: - if (first && if_none) - printf("%s", if_none); -- printf(after); -+ fputs(after, stdout); - - return 0; - err: ++++++ netlink-fix-error-message-suppression.patch ++++++ From: Michal Kubecek <[email protected]> Date: Wed, 10 Jun 2020 13:47:34 +0200 Subject: netlink: fix error message suppression Patch-mainline: v5.8 Git-commit: a4d9db29f8326d68762dbc0f78ad6f1aa4f29887 Rewrite of nlsock_process_reply() used a bool variable to store the value of nlctx->suppress_nlerr before passing to nlsock_process_ack(). This causes the value of 2 (suppress all error/warning messages) to be converted to 1 (suppress only -EOPNOTSUPP). As a result, -ENOENT returned by failed genetlink family lookup when running on kernel without ethtool netlink support is not ignored and misleading "netlink error: No such file or directory" message is issued even if the ioctl fallback works as expected. Fixes: 76bdf9372824 ("netlink: use pretty printing for ethtool netlink messages") Reported-by: Heiner Kallweit <[email protected]> Signed-off-by: Michal Kubecek <[email protected]> --- netlink/nlsock.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/netlink/nlsock.c +++ b/netlink/nlsock.c @@ -255,12 +255,12 @@ int nlsock_process_reply(struct nl_socket *nlsk, mnl_cb_t reply_cb, void *data) nlhdr = (struct nlmsghdr *)buff; if (nlhdr->nlmsg_type == NLMSG_ERROR) { - bool silent = nlsk->nlctx->suppress_nlerr; + unsigned int suppress = nlsk->nlctx->suppress_nlerr; bool pretty; pretty = debug_on(nlsk->nlctx->ctx->debug, DEBUG_NL_PRETTY_MSG); - return nlsock_process_ack(nlhdr, len, silent, pretty); + return nlsock_process_ack(nlhdr, len, suppress, pretty); } msgbuff->nlhdr = nlhdr; ++++++ netlink-fix-unwanted-switch-fall-through-in-family_i.patch ++++++ From: Michal Kubecek <[email protected]> Date: Sun, 7 Jun 2020 21:32:50 +0200 Subject: netlink: fix unwanted switch fall through in family_info_cb() Patch-mainline: v5.8 Git-commit: c07ea9e10498a09a08cc9b507704471d4d7f505b Recently added switch branch for CTRL_ATTR_OPS in family_info_cb() is missing final break statement so that it will fall through into CTRL_ATTR_MCAST_GROUPS. Fixes: 6c19c0d559c8 ("netlink: use genetlink ops information to decide about fallback") Signed-off-by: Michal Kubecek <[email protected]> --- netlink/netlink.c | 1 + 1 file changed, 1 insertion(+) --- a/netlink/netlink.c +++ b/netlink/netlink.c @@ -211,6 +211,7 @@ static int family_info_cb(const struct nlmsghdr *nlhdr, void *data) ret = genl_read_ops(nlctx, attr); if (ret < 0) return MNL_CB_ERROR; + break; case CTRL_ATTR_MCAST_GROUPS: find_mc_group(nlctx, attr); break;
