Merge upstream ethtool @ master am: 10e3083c5a Original change: https://android-review.googlesource.com/c/platform/external/ethtool/+/3525056 Change-Id: I9384d17fbb430958101a252f8ed16e1ef468f1fd Signed-off-by: Automerger Merge Worker <[email protected]>
diff --git a/Makefile.am b/Makefile.am index 5a61a9a..862886b 100644 --- a/Makefile.am +++ b/Makefile.am
@@ -48,6 +48,7 @@ netlink/desc-rtnl.c netlink/cable_test.c netlink/tunnels.c \ netlink/plca.c \ netlink/pse-pd.c \ + netlink/phy.c \ uapi/linux/ethtool_netlink.h \ uapi/linux/netlink.h uapi/linux/genetlink.h \ uapi/linux/rtnetlink.h uapi/linux/if_link.h \
diff --git a/ethtool.8.in b/ethtool.8.in index ea3655f..9e272f7 100644 --- a/ethtool.8.in +++ b/ethtool.8.in
@@ -146,6 +146,10 @@ .B ethtool [-I | --include-statistics] .I args .HP +.B ethtool +.BN --phy +.I args +.HP .B ethtool \-\-monitor [ .I command @@ -541,6 +545,7 @@ .BR enable | disable ] .RB [ c33\-pse\-admin\-control .BR enable | disable ] +.BN c33\-pse\-avail\-pw\-limit N .HP .B ethtool \-\-flash\-module\-firmware .I devname @@ -548,6 +553,9 @@ .IR FILE .RB [ pass .IR PASS ] +.HP +.B ethtool \-\-show\-phys +.I devname . .\" Adjust lines (i.e. full justification) and hyphenate. .ad @@ -596,6 +604,23 @@ Include command-related statistics in the output. This option allows displaying relevant device statistics for selected get commands. .TP +.BI \-\-phy \ N +Target a PHY within the interface. The PHY index can be retrieved with +.B \-\-show\-phys. PHY index 0 targets the phy device directly attached to +the ethernet MAC, if any. +The following commands can accept a PHY index: +.TS +nokeep; +lB l. +\-\-cable\-test +\-\-cable\-test\-tdr +\-\-get\-plca\-cfg +\-\-set\-plca\-cfg +\-\-get\-plca\-status +\-\-show-pse +\-\-set-pse +.TE +.TP .B \-a \-\-show\-pause Queries the specified Ethernet device for pause parameter information. .RS 4 @@ -1175,6 +1200,10 @@ for the default RSS context, or a value returned by .BI ethtool\ -X\ ... \ context .BR new . +If combined with +.BR action \ or\ queue , +the Rx queue specified will be added to the value read from the RSS indirection +table to produce the actual Rx queue to deliver to. .TP .BI vf \ N Specifies the Virtual Function the filter applies to. Not compatible with action. @@ -1791,6 +1820,36 @@ support. It corresponds to IEEE 802.3-2022 30.9.1.1.5 (aPSEPowerDetectionStatus) with potential values being .B disabled, searching, delivering power, test, fault, other fault +.TP +.B c33-pse-extended-state +This attribute indicates the Extended state of the c33 PSE. The extended +state correlated with the c33 PSE Extended Substate allows to have more +detail on the c33 PSE current error state. +It corresponds to IEEE 802.3-2022 33.2.4.4 Variables. +.TP +.B c33-pse-extended-substate +This attribute indicates the Extended substate of the c33 PSE. Correlated +with the c33 PSE Extended state value, it allows to have more detail on the +c33 PSE current error state. +.TP +.B c33-pse-power-class +This attribute identifies the power class of the c33 PSE. It depends on +the class negotiated between the PSE and the PD. It corresponds to +IEEE 802.3-2022 30.9.1.1.8 (aPSEPowerClassification). +.TP +.B c33-pse-actual-power +This attribute identifies the actual power drawn by the c33 PSE. It +corresponds to ``IEEE 802.3-2022`` 30.9.1.1.23 (aPSEActualPower). Actual +power is reported in mW. +.TP +.B c33-pse-available-power-limit +This attribute identifies the configured c33 PSE power limit in mW. +.TP +.B c33-pse-power-limit-ranges +This attribute specifies the allowed power limit ranges in mW for +configuring the c33-pse-avail-pw-limit parameter. It defines the valid +power levels that can be assigned to the c33 PSE in compliance with the +c33 standard. .RE .TP @@ -1805,6 +1864,11 @@ .A2 c33-pse-admin-control \ enable disable This parameter manages c33 PSE Admin operations in accordance with the IEEE 802.3-2022 30.9.1.2.1 (acPSEAdminControl) specification. +.TP +.B c33-pse-avail-pw-limit \ N +This parameter manages c33 PSE Available Power Limit in mW, in accordance +with the IEEE 802.3-2022 33.2.4.4 Variables (pse_available_power) +specification. .RE .TP @@ -1828,6 +1892,39 @@ Optional transceiver module password that might be required as part of the transceiver module firmware update process. +.RE +.TP +.B \-\-show\-phys +Show the PHY devices attached to an interface, and the way they link together. +.RS 4 +.TP +.B phy_index +The PHY's index, that identifies it within the network interface. If the +interface has multiple PHYs, they will each have a unique index on that +interface. This index can then be used for commands that targets PHYs. +.TP +.B drvname +The name of the driver bound to this PHY device. +.TP +.B name +The PHY's device name, matching the name found in sysfs. +.TP +.B downstream_sfp_name +If the PHY drives an SFP cage, this field contains the name of the associated +SFP bus. +.TP +.B upstream_type \ mac | phy +Indicates the nature of the device the PHY is attached to. +.TP +.B upstream_index +If the PHY's upstream_type is +.B phy +, this field indicates the phy_index of the upstream phy. +.TP +.B upstream_sfp_name +If the PHY is withing an SFP/SFF module, this field contains the name of the +upstream SFP bus. + .SH BUGS Not supported (in part or whole) on all network drivers. .SH AUTHOR
diff --git a/ethtool.c b/ethtool.c index aba8863..a1393bc 100644 --- a/ethtool.c +++ b/ethtool.c
@@ -3883,8 +3883,10 @@ nfccmd.flow_type |= FLOW_RSS; err = send_ioctl(ctx, &nfccmd); - if (err < 0) + if (err < 0) { perror("Cannot change RX network flow hashing options"); + return 1; + } } else if (!strcmp(ctx->argp[0], "flow-type")) { struct ethtool_rx_flow_spec rx_rule_fs; __u32 rss_context = 0; @@ -5739,6 +5741,7 @@ const char *opts; bool no_dev; bool json; + bool targets_phy; int (*func)(struct cmd_context *); nl_chk_t nlchk; nl_func_t nlfunc; @@ -6158,12 +6161,14 @@ }, { .opts = "--cable-test", + .targets_phy = true, .json = true, .nlfunc = nl_cable_test, .help = "Perform a cable test", }, { .opts = "--cable-test-tdr", + .targets_phy = true, .json = true, .nlfunc = nl_cable_test_tdr, .help = "Print cable test time domain reflectrometery data", @@ -6191,11 +6196,13 @@ }, { .opts = "--get-plca-cfg", + .targets_phy = true, .nlfunc = nl_plca_get_cfg, .help = "Get PLCA configuration", }, { .opts = "--set-plca-cfg", + .targets_phy = true, .nlfunc = nl_plca_set_cfg, .help = "Set PLCA configuration", .xhelp = " [ enable on|off ]\n" @@ -6207,6 +6214,7 @@ }, { .opts = "--get-plca-status", + .targets_phy = true, .nlfunc = nl_plca_get_status, .help = "Get PLCA status information", }, @@ -6228,16 +6236,19 @@ }, { .opts = "--show-pse", + .targets_phy = true, .json = true, .nlfunc = nl_gpse, .help = "Show settings for Power Sourcing Equipment", }, { .opts = "--set-pse", + .targets_phy = true, .nlfunc = nl_spse, .help = "Set Power Sourcing Equipment settings", .xhelp = " [ podl-pse-admin-control enable|disable ]\n" " [ c33-pse-admin-control enable|disable ]\n" + " [ c33-pse-avail-pw-limit N ]\n" }, { .opts = "--flash-module-firmware", @@ -6247,6 +6258,11 @@ " [ pass PASS ]\n" }, { + .opts = "--show-phys", + .nlfunc = nl_get_phy, + .help = "List PHYs" + }, + { .opts = "-h|--help", .no_dev = true, .func = show_usage, @@ -6270,7 +6286,8 @@ fprintf(stdout, "Usage:\n"); for (i = 0; args[i].opts; i++) { fputs(" ethtool [ FLAGS ] ", stdout); - fprintf(stdout, "%s %s\t%s\n", + fprintf(stdout, "%s%s %s\t%s\n", + args[i].targets_phy ? "[ --phy PHY ] " : "", args[i].opts, args[i].no_dev ? "\t" : "DEVNAME", args[i].help); @@ -6556,6 +6573,19 @@ argc -= 1; continue; } + if (*argp && !strcmp(*argp, "--phy")) { + char *eptr; + + if (argc < 2) + exit_bad_args_info("--phy parameters expects a phy index"); + + ctx.phy_index = strtoul(argp[1], &eptr, 0); + if (!argp[1][0] || *eptr) + exit_bad_args_info("invalid phy index"); + argp += 2; + argc -= 2; + continue; + } break; } if (*argp && !strcmp(*argp, "--monitor")) { @@ -6591,6 +6621,10 @@ } if (ctx.json && !args[k].json) exit_bad_args_info("JSON output not available for this subcommand"); + + if (!args[k].targets_phy && ctx.phy_index) + exit_bad_args_info("Unexpected --phy parameter"); + ctx.argc = argc; ctx.argp = argp; netlink_run_handler(&ctx, args[k].nlchk, args[k].nlfunc, !args[k].func);
diff --git a/internal.h b/internal.h index d5c8997..f33539d 100644 --- a/internal.h +++ b/internal.h
@@ -223,6 +223,7 @@ bool json; /* Output JSON, if supported */ bool nl_disable; /* Disable netlink even if available */ bool show_stats; /* include command-specific stats */ + uint32_t phy_index; /* the phy index this command targets */ #ifdef ETHTOOL_ENABLE_NETLINK struct nl_context *nlctx; /* netlink context (opaque) */ #endif
diff --git a/netlink/cable_test.c b/netlink/cable_test.c index 9305a47..fdb046e 100644 --- a/netlink/cable_test.c +++ b/netlink/cable_test.c
@@ -18,7 +18,7 @@ }; static int nl_get_cable_test_result(const struct nlattr *nest, uint8_t *pair, - uint16_t *code) + uint16_t *code, uint32_t *src) { const struct nlattr *tb[ETHTOOL_A_CABLE_RESULT_MAX+1] = {}; DECLARE_ATTR_TB_INFO(tb); @@ -32,12 +32,15 @@ *pair = mnl_attr_get_u8(tb[ETHTOOL_A_CABLE_RESULT_PAIR]); *code = mnl_attr_get_u8(tb[ETHTOOL_A_CABLE_RESULT_CODE]); + if (tb[ETHTOOL_A_CABLE_RESULT_SRC]) + *src = mnl_attr_get_u32(tb[ETHTOOL_A_CABLE_RESULT_SRC]); return 0; } static int nl_get_cable_test_fault_length(const struct nlattr *nest, - uint8_t *pair, unsigned int *cm) + uint8_t *pair, unsigned int *cm, + uint32_t *src) { const struct nlattr *tb[ETHTOOL_A_CABLE_FAULT_LENGTH_MAX+1] = {}; DECLARE_ATTR_TB_INFO(tb); @@ -51,6 +54,8 @@ *pair = mnl_attr_get_u8(tb[ETHTOOL_A_CABLE_FAULT_LENGTH_PAIR]); *cm = mnl_attr_get_u32(tb[ETHTOOL_A_CABLE_FAULT_LENGTH_CM]); + if (tb[ETHTOOL_A_CABLE_FAULT_LENGTH_SRC]) + *src = mnl_attr_get_u32(tb[ETHTOOL_A_CABLE_FAULT_LENGTH_SRC]); return 0; } @@ -88,33 +93,54 @@ } } +static char *nl_src2txt(uint32_t src) +{ + switch (src) { + case ETHTOOL_A_CABLE_INF_SRC_TDR: + return "TDR"; + case ETHTOOL_A_CABLE_INF_SRC_ALCD: + return "ALCD"; + default: + return "Unknown"; + } +} + static int nl_cable_test_ntf_attr(struct nlattr *evattr) { unsigned int cm; + uint32_t src = UINT32_MAX; uint16_t code; uint8_t pair; int ret; switch (mnl_attr_get_type(evattr)) { case ETHTOOL_A_CABLE_NEST_RESULT: - ret = nl_get_cable_test_result(evattr, &pair, &code); + ret = nl_get_cable_test_result(evattr, &pair, &code, &src); if (ret < 0) return ret; open_json_object(NULL); print_string(PRINT_ANY, "pair", "%s ", nl_pair2txt(pair)); - print_string(PRINT_ANY, "code", "code %s\n", nl_code2txt(code)); + print_string(PRINT_ANY, "code", "code %s", nl_code2txt(code)); + if (src != UINT32_MAX) + print_string(PRINT_ANY, "src", ", source: %s", + nl_src2txt(src)); + print_nl(); close_json_object(); break; case ETHTOOL_A_CABLE_NEST_FAULT_LENGTH: - ret = nl_get_cable_test_fault_length(evattr, &pair, &cm); + ret = nl_get_cable_test_fault_length(evattr, &pair, &cm, &src); if (ret < 0) return ret; open_json_object(NULL); print_string(PRINT_ANY, "pair", "%s, ", nl_pair2txt(pair)); - print_float(PRINT_ANY, "length", "fault length: %0.2fm\n", + print_float(PRINT_ANY, "length", "fault length: %0.2fm", (float)cm / 100); + if (src != UINT32_MAX) + print_string(PRINT_ANY, "src", ", source: %s", + nl_src2txt(src)); + print_nl(); close_json_object(); break; } @@ -572,8 +598,8 @@ if (ret < 0) return 2; - if (ethnla_fill_header(msgbuff, ETHTOOL_A_CABLE_TEST_TDR_HEADER, - ctx->devname, 0)) + if (ethnla_fill_header_phy(msgbuff, ETHTOOL_A_CABLE_TEST_TDR_HEADER, + ctx->devname, ctx->phy_index, 0)) return -EMSGSIZE; ret = nl_parser(nlctx, tdr_params, NULL, PARSER_GROUP_NEST, NULL);
diff --git a/netlink/coalesce.c b/netlink/coalesce.c index bb93f9b..bc8b57b 100644 --- a/netlink/coalesce.c +++ b/netlink/coalesce.c
@@ -39,9 +39,9 @@ show_cr(); print_string(PRINT_ANY, "ifname", "Coalesce parameters for %s:\n", nlctx->devname); - show_bool("rx", "Adaptive RX: %s ", + show_bool("adaptive-rx", "Adaptive RX: %s ", tb[ETHTOOL_A_COALESCE_USE_ADAPTIVE_RX]); - show_bool("tx", "TX: %s\n", tb[ETHTOOL_A_COALESCE_USE_ADAPTIVE_TX]); + show_bool("adaptive-tx", "TX: %s\n", tb[ETHTOOL_A_COALESCE_USE_ADAPTIVE_TX]); show_u32("stats-block-usecs", "stats-block-usecs:\t", tb[ETHTOOL_A_COALESCE_STATS_BLOCK_USECS]); show_u32("sample-interval", "sample-interval:\t", @@ -85,9 +85,9 @@ show_u32("tx-frame-high", "tx-frame-high:\t", tb[ETHTOOL_A_COALESCE_TX_MAX_FRAMES_HIGH]); show_cr(); - show_bool("rx", "CQE mode RX: %s ", + show_bool("cqe-mode-rx", "CQE mode RX: %s ", tb[ETHTOOL_A_COALESCE_USE_CQE_MODE_RX]); - show_bool("tx", "TX: %s\n", tb[ETHTOOL_A_COALESCE_USE_CQE_MODE_TX]); + show_bool("cqe-mode-tx", "TX: %s\n", tb[ETHTOOL_A_COALESCE_USE_CQE_MODE_TX]); show_cr(); show_u32("tx-aggr-max-bytes", "tx-aggr-max-bytes:\t", tb[ETHTOOL_A_COALESCE_TX_AGGR_MAX_BYTES]);
diff --git a/netlink/desc-ethtool.c b/netlink/desc-ethtool.c index 5c0e1c6..32a9eb3 100644 --- a/netlink/desc-ethtool.c +++ b/netlink/desc-ethtool.c
@@ -252,12 +252,14 @@ NLATTR_DESC_INVALID(ETHTOOL_A_CABLE_RESULT_UNSPEC), NLATTR_DESC_U8(ETHTOOL_A_CABLE_RESULT_PAIR), NLATTR_DESC_U8(ETHTOOL_A_CABLE_RESULT_CODE), + NLATTR_DESC_U32(ETHTOOL_A_CABLE_RESULT_SRC), }; 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), + NLATTR_DESC_U32(ETHTOOL_A_CABLE_FAULT_LENGTH_SRC), }; static const struct pretty_nla_desc __cable_nest_desc[] = {
diff --git a/netlink/extapi.h b/netlink/extapi.h index c882295..9d6eddf 100644 --- a/netlink/extapi.h +++ b/netlink/extapi.h
@@ -56,6 +56,7 @@ int nl_gpse(struct cmd_context *ctx); int nl_spse(struct cmd_context *ctx); int nl_flash_module_fw(struct cmd_context *ctx); +int nl_get_phy(struct cmd_context *ctx); void nl_monitor_usage(void); @@ -132,6 +133,7 @@ #define nl_gpse NULL #define nl_spse NULL #define nl_flash_module_fw NULL +#define nl_get_phy NULL #endif /* ETHTOOL_ENABLE_NETLINK */
diff --git a/netlink/msgbuff.c b/netlink/msgbuff.c index 216f5b9..2275840 100644 --- a/netlink/msgbuff.c +++ b/netlink/msgbuff.c
@@ -138,6 +138,32 @@ return NULL; } +static bool __ethnla_fill_header_phy(struct nl_msg_buff *msgbuff, uint16_t type, + const char *devname, uint32_t phy_index, + uint32_t flags) +{ + struct nlattr *nest; + + nest = ethnla_nest_start(msgbuff, type); + if (!nest) + return true; + + if ((devname && + ethnla_put_strz(msgbuff, ETHTOOL_A_HEADER_DEV_NAME, devname)) || + (flags && + ethnla_put_u32(msgbuff, ETHTOOL_A_HEADER_FLAGS, flags)) || + (phy_index && + ethnla_put_u32(msgbuff, ETHTOOL_A_HEADER_PHY_INDEX, phy_index))) + goto err; + + ethnla_nest_end(msgbuff, nest); + return false; + +err: + ethnla_nest_cancel(msgbuff, nest); + return true; +} + /** * ethnla_fill_header() - write standard ethtool request header to message * @msgbuff: message buffer @@ -150,24 +176,26 @@ bool ethnla_fill_header(struct nl_msg_buff *msgbuff, uint16_t type, const char *devname, uint32_t flags) { - struct nlattr *nest; + return __ethnla_fill_header_phy(msgbuff, type, devname, 0, flags); +} - nest = ethnla_nest_start(msgbuff, type); - if (!nest) - return true; - - if ((devname && - ethnla_put_strz(msgbuff, ETHTOOL_A_HEADER_DEV_NAME, devname)) || - (flags && - ethnla_put_u32(msgbuff, ETHTOOL_A_HEADER_FLAGS, flags))) - goto err; - - ethnla_nest_end(msgbuff, nest); - return false; - -err: - ethnla_nest_cancel(msgbuff, nest); - return true; +/** + * ethnla_fill_header_phy() - write standard ethtool request header to message, + * targetting a device's phy + * @msgbuff: message buffer + * @type: attribute type for header nest + * @devname: device name (NULL to omit) + * @phy_index: phy index to target (0 to omit) + * @flags: request flags (omitted if 0) + * + * Return: pointer to the nest attribute or null of error + */ +bool ethnla_fill_header_phy(struct nl_msg_buff *msgbuff, uint16_t type, + const char *devname, uint32_t phy_index, + uint32_t flags) +{ + return __ethnla_fill_header_phy(msgbuff, type, devname, phy_index, + flags); } /**
diff --git a/netlink/msgbuff.h b/netlink/msgbuff.h index 7d6731f..7df19fc 100644 --- a/netlink/msgbuff.h +++ b/netlink/msgbuff.h
@@ -47,6 +47,9 @@ struct nlattr *ethnla_nest_start(struct nl_msg_buff *msgbuff, uint16_t type); bool ethnla_fill_header(struct nl_msg_buff *msgbuff, uint16_t type, const char *devname, uint32_t flags); +bool ethnla_fill_header_phy(struct nl_msg_buff *msgbuff, uint16_t type, + const char *devname, uint32_t phy_index, + uint32_t flags); /* length of current message */ static inline unsigned int msgbuff_len(const struct nl_msg_buff *msgbuff)
diff --git a/netlink/nlsock.c b/netlink/nlsock.c index 0ec2738..5450c9b 100644 --- a/netlink/nlsock.c +++ b/netlink/nlsock.c
@@ -291,6 +291,44 @@ ret = msg_init(nlctx, &nlsk->msgbuff, nlcmd, nlm_flags); if (ret < 0) return ret; + if (ethnla_fill_header_phy(&nlsk->msgbuff, hdr_attrtype, devname, + nlctx->ctx->phy_index, flags)) + return -EMSGSIZE; + + return 0; +} + +/** + * nlsock_prep_filtered_dump_request() - Initialize a filtered DUMP request + * @nlsk: netlink socket + * @nlcmd: netlink command + * @hdr_attrtype: netlink command header attribute + * @flags: netlink command header flags + * + * Prepare a DUMP request that may include the device index as a filtering + * attribute in the header. + * + * Return: 0 on success, or a negative number on error + */ +int nlsock_prep_filtered_dump_request(struct nl_socket *nlsk, + unsigned int nlcmd, uint16_t hdr_attrtype, + u32 flags) +{ + struct nl_context *nlctx = nlsk->nlctx; + const char *devname = nlctx->ctx->devname; + unsigned int nlm_flags; + int ret; + + nlctx->is_dump = true; + nlm_flags = NLM_F_REQUEST | NLM_F_ACK | NLM_F_DUMP; + + if (devname && !strcmp(devname, WILDCARD_DEVNAME)) + devname = NULL; + + ret = msg_init(nlctx, &nlsk->msgbuff, nlcmd, nlm_flags); + if (ret < 0) + return ret; + if (ethnla_fill_header(&nlsk->msgbuff, hdr_attrtype, devname, flags)) return -EMSGSIZE;
diff --git a/netlink/nlsock.h b/netlink/nlsock.h index b015f86..6a72966 100644 --- a/netlink/nlsock.h +++ b/netlink/nlsock.h
@@ -38,6 +38,8 @@ void nlsock_done(struct nl_socket *nlsk); int nlsock_prep_get_request(struct nl_socket *nlsk, unsigned int nlcmd, uint16_t hdr_attrtype, u32 flags); +int nlsock_prep_filtered_dump_request(struct nl_socket *nlsk, unsigned int nlcmd, + uint16_t hdr_attrtype, u32 flags); ssize_t nlsock_sendmsg(struct nl_socket *nlsk, struct nl_msg_buff *__msgbuff); int nlsock_send_get_request(struct nl_socket *nlsk, mnl_cb_t cb); int nlsock_process_reply(struct nl_socket *nlsk, mnl_cb_t reply_cb, void *data);
diff --git a/netlink/phy.c b/netlink/phy.c new file mode 100644 index 0000000..7578191 --- /dev/null +++ b/netlink/phy.c
@@ -0,0 +1,116 @@ +/* + * phy.c - List PHYs on an interface and their parameters + * + * Implementation of "ethtool --show-phys <dev>" + */ + +#include <errno.h> +#include <inttypes.h> +#include <string.h> +#include <stdio.h> + +#include "../internal.h" +#include "../common.h" +#include "netlink.h" + +/* PHY_GET / PHY_DUMP */ + +static const char * phy_upstream_type_to_str(uint8_t upstream_type) +{ + switch (upstream_type) { + case PHY_UPSTREAM_PHY: return "phy"; + case PHY_UPSTREAM_MAC: return "mac"; + default: return "Unknown"; + } +} + +int phy_reply_cb(const struct nlmsghdr *nlhdr, void *data) +{ + const struct nlattr *tb[ETHTOOL_A_PHY_MAX + 1] = {}; + struct nl_context *nlctx = data; + DECLARE_ATTR_TB_INFO(tb); + uint8_t upstream_type; + bool silent; + int err_ret; + int ret; + + silent = nlctx->is_dump || nlctx->is_monitor; + err_ret = silent ? MNL_CB_OK : MNL_CB_ERROR; + ret = mnl_attr_parse(nlhdr, GENL_HDRLEN, attr_cb, &tb_info); + if (ret < 0) + return err_ret; + nlctx->devname = get_dev_name(tb[ETHTOOL_A_PHY_HEADER]); + if (!dev_ok(nlctx)) + return err_ret; + + if (silent) + print_nl(); + + open_json_object(NULL); + + print_string(PRINT_ANY, "ifname", "PHY for %s:\n", nlctx->devname); + + show_u32("phy_index", "PHY index: ", tb[ETHTOOL_A_PHY_INDEX]); + + if (tb[ETHTOOL_A_PHY_DRVNAME]) + print_string(PRINT_ANY, "drvname", "Driver name: %s\n", + mnl_attr_get_str(tb[ETHTOOL_A_PHY_DRVNAME])); + + if (tb[ETHTOOL_A_PHY_NAME]) + print_string(PRINT_ANY, "name", "PHY device name: %s\n", + mnl_attr_get_str(tb[ETHTOOL_A_PHY_NAME])); + + if (tb[ETHTOOL_A_PHY_DOWNSTREAM_SFP_NAME]) + print_string(PRINT_ANY, "downstream_sfp_name", + "Downstream SFP bus name: %s\n", + mnl_attr_get_str(tb[ETHTOOL_A_PHY_DOWNSTREAM_SFP_NAME])); + + if (tb[ETHTOOL_A_PHY_UPSTREAM_TYPE]) { + upstream_type = mnl_attr_get_u8(tb[ETHTOOL_A_PHY_UPSTREAM_TYPE]); + print_string(PRINT_ANY, "upstream_type", "Upstream type: %s\n", + phy_upstream_type_to_str(upstream_type)); + } + + if (tb[ETHTOOL_A_PHY_UPSTREAM_INDEX]) + show_u32("upstream_index", "Upstream PHY index: ", + tb[ETHTOOL_A_PHY_UPSTREAM_INDEX]); + + if (tb[ETHTOOL_A_PHY_UPSTREAM_SFP_NAME]) + print_string(PRINT_ANY, "upstream_sfp_name", "Upstream SFP name: %s\n", + mnl_attr_get_str(tb[ETHTOOL_A_PHY_UPSTREAM_SFP_NAME])); + + if (!silent) + print_nl(); + + close_json_object(); + + return MNL_CB_OK; + + close_json_object(); + return err_ret; +} + +int nl_get_phy(struct cmd_context *ctx) +{ + struct nl_context *nlctx = ctx->nlctx; + struct nl_socket *nlsk = nlctx->ethnl_socket; + int ret; + + if (netlink_cmd_check(ctx, ETHTOOL_MSG_PHY_GET, true)) + return -EOPNOTSUPP; + if (ctx->argc > 0) { + fprintf(stderr, "ethtool: unexpected parameter '%s'\n", + *ctx->argp); + return 1; + } + + ret = nlsock_prep_filtered_dump_request(nlsk, ETHTOOL_MSG_PHY_GET, + ETHTOOL_A_PHY_HEADER, 0); + if (ret) + return ret; + + new_json_obj(ctx->json); + ret = nlsock_send_get_request(nlsk, phy_reply_cb); + delete_json_obj(); + return ret; +}
diff --git a/netlink/plca.c b/netlink/plca.c index 7d61e3b..7dc30a3 100644 --- a/netlink/plca.c +++ b/netlink/plca.c
@@ -211,8 +211,8 @@ NLM_F_REQUEST | NLM_F_ACK); if (ret < 0) return 2; - if (ethnla_fill_header(msgbuff, ETHTOOL_A_PLCA_HEADER, - ctx->devname, 0)) + if (ethnla_fill_header_phy(msgbuff, ETHTOOL_A_PLCA_HEADER, + ctx->devname, ctx->phy_index, 0)) return -EMSGSIZE; ret = nl_parser(nlctx, set_plca_params, NULL, PARSER_GROUP_NONE, NULL);
diff --git a/netlink/pse-pd.c b/netlink/pse-pd.c index 2c8dd89..fd1fc4d 100644 --- a/netlink/pse-pd.c +++ b/netlink/pse-pd.c
@@ -89,10 +89,226 @@ return "unsupported"; } } + +static const char *c33_pse_ext_state_name(u32 val) +{ + switch (val) { + case ETHTOOL_C33_PSE_EXT_STATE_ERROR_CONDITION: + return "Group of error_condition states"; + case ETHTOOL_C33_PSE_EXT_STATE_MR_MPS_VALID: + return "Group of mr_mps_valid states"; + case ETHTOOL_C33_PSE_EXT_STATE_MR_PSE_ENABLE: + return "Group of mr_pse_enable states"; + case ETHTOOL_C33_PSE_EXT_STATE_OPTION_DETECT_TED: + return "Group of option_detect_ted"; + case ETHTOOL_C33_PSE_EXT_STATE_OPTION_VPORT_LIM: + return "Group of option_vport_lim states"; + case ETHTOOL_C33_PSE_EXT_STATE_OVLD_DETECTED: + return "Group of ovld_detected states"; + case ETHTOOL_C33_PSE_EXT_STATE_PD_DLL_POWER_TYPE: + return "Group of pd_dll_power_type states"; + case ETHTOOL_C33_PSE_EXT_STATE_POWER_NOT_AVAILABLE: + return "Group of power_not_available states"; + case ETHTOOL_C33_PSE_EXT_STATE_SHORT_DETECTED: + return "Group of short_detected states"; + default: + return "unsupported"; + } +} + +static const char *c33_pse_ext_substate_mr_mps_valid_name(u32 val) +{ + switch (val) { + case ETHTOOL_C33_PSE_EXT_SUBSTATE_MR_MPS_VALID_DETECTED_UNDERLOAD: + return "Underload state"; + case ETHTOOL_C33_PSE_EXT_SUBSTATE_MR_MPS_VALID_CONNECTION_OPEN: + return "Port is not connected"; + default: + return "unsupported"; + } +} + +static const char *c33_pse_ext_substate_error_condition_name(u32 val) +{ + switch (val) { + case ETHTOOL_C33_PSE_EXT_SUBSTATE_ERROR_CONDITION_NON_EXISTING_PORT: + return "Non-existing port number"; + case ETHTOOL_C33_PSE_EXT_SUBSTATE_ERROR_CONDITION_UNDEFINED_PORT: + return "Undefined port"; + case ETHTOOL_C33_PSE_EXT_SUBSTATE_ERROR_CONDITION_INTERNAL_HW_FAULT: + return "Internal hardware fault"; + case ETHTOOL_C33_PSE_EXT_SUBSTATE_ERROR_CONDITION_COMM_ERROR_AFTER_FORCE_ON: + return "Communication error after force on"; + case ETHTOOL_C33_PSE_EXT_SUBSTATE_ERROR_CONDITION_UNKNOWN_PORT_STATUS: + return "Unknown port status"; + case ETHTOOL_C33_PSE_EXT_SUBSTATE_ERROR_CONDITION_HOST_CRASH_TURN_OFF: + return "Host crash turn off"; + case ETHTOOL_C33_PSE_EXT_SUBSTATE_ERROR_CONDITION_HOST_CRASH_FORCE_SHUTDOWN: + return "Host crash force shutdown"; + case ETHTOOL_C33_PSE_EXT_SUBSTATE_ERROR_CONDITION_CONFIG_CHANGE: + return "Configuration change"; + case ETHTOOL_C33_PSE_EXT_SUBSTATE_ERROR_CONDITION_DETECTED_OVER_TEMP: + return "Over temperature detected"; + default: + return "unsupported"; + } +} + +static const char *c33_pse_ext_substate_mr_pse_enable_name(u32 val) +{ + switch (val) { + case ETHTOOL_C33_PSE_EXT_SUBSTATE_MR_PSE_ENABLE_DISABLE_PIN_ACTIVE: + return "Disable pin active"; + default: + return "unsupported"; + } +} + +static const char *c33_pse_ext_substate_option_detect_ted_name(u32 val) +{ + switch (val) { + case ETHTOOL_C33_PSE_EXT_SUBSTATE_OPTION_DETECT_TED_DET_IN_PROCESS: + return "Detection in process"; + case ETHTOOL_C33_PSE_EXT_SUBSTATE_OPTION_DETECT_TED_CONNECTION_CHECK_ERROR: + return "Connection check error"; + default: + return "unsupported"; + } +} + +static const char *c33_pse_ext_substate_option_vport_lim_name(u32 val) +{ + switch (val) { + case ETHTOOL_C33_PSE_EXT_SUBSTATE_OPTION_VPORT_LIM_HIGH_VOLTAGE: + return "Main supply voltage is high"; + case ETHTOOL_C33_PSE_EXT_SUBSTATE_OPTION_VPORT_LIM_LOW_VOLTAGE: + return "Main supply voltage is low"; + case ETHTOOL_C33_PSE_EXT_SUBSTATE_OPTION_VPORT_LIM_VOLTAGE_INJECTION: + return "Voltage injection into the port"; + default: + return "unsupported"; + } +} + +static const char *c33_pse_ext_substate_ovld_detected_name(u32 val) +{ + switch (val) { + case ETHTOOL_C33_PSE_EXT_SUBSTATE_OVLD_DETECTED_OVERLOAD: + return "Overload state"; + default: + return "unsupported"; + } +} + +static const char *c33_pse_ext_substate_power_not_available_name(u32 val) +{ + switch (val) { + case ETHTOOL_C33_PSE_EXT_SUBSTATE_POWER_NOT_AVAILABLE_BUDGET_EXCEEDED: + return "Power budget exceeded for the controller"; + case ETHTOOL_C33_PSE_EXT_SUBSTATE_POWER_NOT_AVAILABLE_PORT_PW_LIMIT_EXCEEDS_CONTROLLER_BUDGET: + return "Configured port power limit exceeded controller power budget"; + case ETHTOOL_C33_PSE_EXT_SUBSTATE_POWER_NOT_AVAILABLE_PD_REQUEST_EXCEEDS_PORT_LIMIT: + return "Power request from PD exceeds port limit"; + case ETHTOOL_C33_PSE_EXT_SUBSTATE_POWER_NOT_AVAILABLE_HW_PW_LIMIT: + return "Power denied due to Hardware power limit"; + default: + return "unsupported"; + } +} + +static const char *c33_pse_ext_substate_short_detected_name(u32 val) +{ + switch (val) { + case ETHTOOL_C33_PSE_EXT_SUBSTATE_SHORT_DETECTED_SHORT_CONDITION: + return "Short condition was detected"; + default: + return "unsupported"; + } +} + +struct c33_pse_ext_substate_desc { + u32 state; + const char *(*substate_name)(u32 val); +}; + +static const struct c33_pse_ext_substate_desc c33_pse_ext_substate_map[] = { + { ETHTOOL_C33_PSE_EXT_STATE_ERROR_CONDITION, + c33_pse_ext_substate_error_condition_name }, + { ETHTOOL_C33_PSE_EXT_STATE_MR_MPS_VALID, + c33_pse_ext_substate_mr_mps_valid_name }, + { ETHTOOL_C33_PSE_EXT_STATE_MR_PSE_ENABLE, + c33_pse_ext_substate_mr_pse_enable_name }, + { ETHTOOL_C33_PSE_EXT_STATE_OPTION_DETECT_TED, + c33_pse_ext_substate_option_detect_ted_name }, + { ETHTOOL_C33_PSE_EXT_STATE_OPTION_VPORT_LIM, + c33_pse_ext_substate_option_vport_lim_name }, + { ETHTOOL_C33_PSE_EXT_STATE_OVLD_DETECTED, + c33_pse_ext_substate_ovld_detected_name }, + { ETHTOOL_C33_PSE_EXT_STATE_POWER_NOT_AVAILABLE, + c33_pse_ext_substate_power_not_available_name }, + { ETHTOOL_C33_PSE_EXT_STATE_SHORT_DETECTED, + c33_pse_ext_substate_short_detected_name }, + { /* sentinel */ } +}; + +static void c33_pse_print_ext_substate(u32 state, u32 substate) +{ + const struct c33_pse_ext_substate_desc *substate_map; + + substate_map = c33_pse_ext_substate_map; + while (substate_map->state) { + if (substate_map->state == state) { + print_string(PRINT_ANY, "c33-pse-extended-substate", + "Clause 33 PSE Extended Substate: %s\n", + substate_map->substate_name(substate)); + return; + } + substate_map++; + } +} + +static int c33_pse_dump_pw_limit_range(const struct nlattr *range) +{ + const struct nlattr *range_tb[ETHTOOL_A_C33_PSE_PW_LIMIT_MAX + 1] = {}; + DECLARE_ATTR_TB_INFO(range_tb); + const struct nlattr *attr; + u32 min, max; + int ret; + + ret = mnl_attr_parse_nested(range, attr_cb, &range_tb_info); + if (ret < 0) { + fprintf(stderr, + "malformed netlink message (power limit range)\n"); + return 1; + } + + attr = range_tb[ETHTOOL_A_C33_PSE_PW_LIMIT_MIN]; + if (!attr || mnl_attr_validate(attr, MNL_TYPE_U32) < 0) { + fprintf(stderr, + "malformed netlink message (power limit min)\n"); + return 1; + } + min = mnl_attr_get_u32(attr); + + attr = range_tb[ETHTOOL_A_C33_PSE_PW_LIMIT_MAX]; + if (!attr || mnl_attr_validate(attr, MNL_TYPE_U32) < 0) { + fprintf(stderr, + "malformed netlink message (power limit max)\n"); + return 1; + } + max = mnl_attr_get_u32(attr); + + print_string(PRINT_ANY, "range", "\trange:\n", NULL); + print_uint(PRINT_ANY, "min", "\t\tmin %u\n", min); + print_uint(PRINT_ANY, "max", "\t\tmax %u\n", max); + return 0; +} + int pse_reply_cb(const struct nlmsghdr *nlhdr, void *data) { const struct nlattr *tb[ETHTOOL_A_PSE_MAX + 1] = {}; struct nl_context *nlctx = data; + const struct nlattr *attr; DECLARE_ATTR_TB_INFO(tb); bool silent; int err_ret; @@ -151,6 +367,59 @@ c33_pse_pw_d_status_name(val)); } + if (tb[ETHTOOL_A_C33_PSE_EXT_STATE]) { + u32 val; + + val = mnl_attr_get_u32(tb[ETHTOOL_A_C33_PSE_EXT_STATE]); + print_string(PRINT_ANY, "c33-pse-extended-state", + "Clause 33 PSE Extended State: %s\n", + c33_pse_ext_state_name(val)); + + if (tb[ETHTOOL_A_C33_PSE_EXT_SUBSTATE]) { + u32 substate; + + substate = mnl_attr_get_u32(tb[ETHTOOL_A_C33_PSE_EXT_SUBSTATE]); + c33_pse_print_ext_substate(val, substate); + } + } + + if (tb[ETHTOOL_A_C33_PSE_PW_CLASS]) { + u32 val; + + val = mnl_attr_get_u32(tb[ETHTOOL_A_C33_PSE_PW_CLASS]); + print_uint(PRINT_ANY, "c33-pse-power-class", + "Clause 33 PSE Power Class: %u\n", val); + } + + if (tb[ETHTOOL_A_C33_PSE_ACTUAL_PW]) { + u32 val; + + val = mnl_attr_get_u32(tb[ETHTOOL_A_C33_PSE_ACTUAL_PW]); + print_uint(PRINT_ANY, "c33-pse-actual-power", + "Clause 33 PSE Actual Power: %u\n", val); + } + + if (tb[ETHTOOL_A_C33_PSE_AVAIL_PW_LIMIT]) { + u32 val; + + val = mnl_attr_get_u32(tb[ETHTOOL_A_C33_PSE_AVAIL_PW_LIMIT]); + print_uint(PRINT_ANY, "c33-pse-available-power-limit", + "Clause 33 PSE Available Power Limit: %u\n", val); + } + + if (tb[ETHTOOL_A_C33_PSE_PW_LIMIT_RANGES]) { + print_string(PRINT_ANY, "c33-pse-power-limit-ranges", + "Clause 33 PSE Power Limit Ranges:\n", NULL); + mnl_attr_for_each(attr, nlhdr, GENL_HDRLEN) { + if (mnl_attr_get_type(attr) == ETHTOOL_A_C33_PSE_PW_LIMIT_RANGES) { + if (c33_pse_dump_pw_limit_range(attr)) { + close_json_object(); + return err_ret; + } + } + } + } + close_json_object(); return MNL_CB_OK; @@ -212,6 +481,12 @@ .handler_data = c33_pse_admin_control_values, .min_argc = 1, }, + { + .arg = "c33-pse-avail-pw-limit", + .type = ETHTOOL_A_C33_PSE_AVAIL_PW_LIMIT, + .handler = nl_parse_direct_u32, + .min_argc = 1, + }, {} }; @@ -240,8 +515,8 @@ NLM_F_REQUEST | NLM_F_ACK); if (ret < 0) return 2; - if (ethnla_fill_header(msgbuff, ETHTOOL_A_PSE_HEADER, - ctx->devname, 0)) + if (ethnla_fill_header_phy(msgbuff, ETHTOOL_A_PSE_HEADER, + ctx->devname, ctx->phy_index, 0)) return -EMSGSIZE; ret = nl_parser(nlctx, spse_params, NULL, PARSER_GROUP_NONE, NULL);
diff --git a/netlink/settings.c b/netlink/settings.c index dbfb520..3008258 100644 --- a/netlink/settings.c +++ b/netlink/settings.c
@@ -546,7 +546,7 @@ (autoneg == AUTONEG_DISABLE) ? "off" : "on"); else print_bool(PRINT_JSON, "auto-negotiation", NULL, - autoneg == AUTONEG_DISABLE); + autoneg != AUTONEG_DISABLE); } if (tb[ETHTOOL_A_LINKMODES_MASTER_SLAVE_CFG]) { uint8_t val; @@ -605,7 +605,7 @@ uint8_t val = mnl_attr_get_u8(tb[ETHTOOL_A_LINKINFO_PHYADDR]); print_banner(nlctx); - print_uint(PRINT_ANY, "phyad", "\tPHYAD: %x\n", val); + print_uint(PRINT_ANY, "phyad", "\tPHYAD: %u\n", val); } if (tb[ETHTOOL_A_LINKINFO_TRANSCEIVER]) { uint8_t val;
diff --git a/rxclass.c b/rxclass.c index f17e3a5..1e202cc 100644 --- a/rxclass.c +++ b/rxclass.c
@@ -248,13 +248,17 @@ rxclass_print_nfc_spec_ext(fsp); - if (fsp->flow_type & FLOW_RSS) - fprintf(stdout, "\tRSS Context ID: %u\n", rss_context); - if (fsp->ring_cookie == RX_CLS_FLOW_DISC) { fprintf(stdout, "\tAction: Drop\n"); } else if (fsp->ring_cookie == RX_CLS_FLOW_WAKE) { fprintf(stdout, "\tAction: Wake-on-LAN\n"); + } else if (fsp->flow_type & FLOW_RSS) { + u64 queue = ethtool_get_flow_spec_ring(fsp->ring_cookie); + + fprintf(stdout, "\tAction: Direct to RSS Context %u", rss_context); + if (queue) + fprintf(stdout, " (queue base offset: %llu)", queue); + fprintf(stdout, "\n"); } else { u64 vf = ethtool_get_flow_spec_ring_vf(fsp->ring_cookie); u64 queue = ethtool_get_flow_spec_ring(fsp->ring_cookie);
diff --git a/uapi/linux/const.h b/uapi/linux/const.h index 1eb84b5..2122610 100644 --- a/uapi/linux/const.h +++ b/uapi/linux/const.h
@@ -28,6 +28,23 @@ #define _BITUL(x) (_UL(1) << (x)) #define _BITULL(x) (_ULL(1) << (x)) +#if !defined(__ASSEMBLY__) +/* + * Missing __asm__ support + * + * __BIT128() would not work in the __asm__ code, as it shifts an + * 'unsigned __init128' data type as direct representation of + * 128 bit constants is not supported in the gcc compiler, as + * they get silently truncated. + * + * TODO: Please revisit this implementation when gcc compiler + * starts representing 128 bit constants directly like long + * and unsigned long etc. Subsequently drop the comment for + * GENMASK_U128() which would then start supporting __asm__ code. + */ +#define _BIT128(x) ((unsigned __int128)(1) << (x)) +#endif + #define __ALIGN_KERNEL(x, a) __ALIGN_KERNEL_MASK(x, (__typeof__(x))(a) - 1) #define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask))
diff --git a/uapi/linux/ethtool.h b/uapi/linux/ethtool.h index fef07da..7022fcc 100644 --- a/uapi/linux/ethtool.h +++ b/uapi/linux/ethtool.h
@@ -2531,4 +2531,20 @@ * __u32 map_lp_advertising[link_mode_masks_nwords]; */ }; + +/** + * enum phy_upstream - Represents the upstream component a given PHY device + * is connected to, as in what is on the other end of the MII bus. Most PHYs + * will be attached to an Ethernet MAC controller, but in some cases, there's + * an intermediate PHY used as a media-converter, which will driver another + * MII interface as its output. + * @PHY_UPSTREAM_MAC: Upstream component is a MAC (a switch port, + * or ethernet controller) + * @PHY_UPSTREAM_PHY: Upstream component is a PHY (likely a media converter) + */ +enum phy_upstream { + PHY_UPSTREAM_MAC, + PHY_UPSTREAM_PHY, +}; + #endif /* _LINUX_ETHTOOL_H */
diff --git a/uapi/linux/ethtool_netlink.h b/uapi/linux/ethtool_netlink.h index dfc25a0..5d2bdd3 100644 --- a/uapi/linux/ethtool_netlink.h +++ b/uapi/linux/ethtool_netlink.h
@@ -58,6 +58,7 @@ ETHTOOL_MSG_MM_GET, ETHTOOL_MSG_MM_SET, ETHTOOL_MSG_MODULE_FW_FLASH_ACT, + ETHTOOL_MSG_PHY_GET, /* add new constants above here */ __ETHTOOL_MSG_USER_CNT, @@ -111,6 +112,8 @@ ETHTOOL_MSG_MM_GET_REPLY, ETHTOOL_MSG_MM_NTF, ETHTOOL_MSG_MODULE_FW_FLASH_NTF, + ETHTOOL_MSG_PHY_GET_REPLY, + ETHTOOL_MSG_PHY_NTF, /* add new constants above here */ __ETHTOOL_MSG_KERNEL_CNT, @@ -134,6 +137,7 @@ ETHTOOL_A_HEADER_DEV_INDEX, /* u32 */ ETHTOOL_A_HEADER_DEV_NAME, /* string */ ETHTOOL_A_HEADER_FLAGS, /* u32 - ETHTOOL_FLAG_* */ + ETHTOOL_A_HEADER_PHY_INDEX, /* u32 */ /* add new constants above here */ __ETHTOOL_A_HEADER_CNT, @@ -556,6 +560,10 @@ * a regular 100 Ohm cable and a part with the abnormal impedance value */ ETHTOOL_A_CABLE_RESULT_CODE_IMPEDANCE_MISMATCH, + /* TDR not possible due to high noise level */ + ETHTOOL_A_CABLE_RESULT_CODE_NOISE, + /* TDR resolution not possible / out of distance */ + ETHTOOL_A_CABLE_RESULT_CODE_RESOLUTION_NOT_POSSIBLE, }; enum { @@ -565,10 +573,20 @@ ETHTOOL_A_CABLE_PAIR_D, }; +/* Information source for specific results. */ +enum { + ETHTOOL_A_CABLE_INF_SRC_UNSPEC, + /* Results provided by the Time Domain Reflectometry (TDR) */ + ETHTOOL_A_CABLE_INF_SRC_TDR, + /* Results provided by the Active Link Cable Diagnostic (ALCD) */ + ETHTOOL_A_CABLE_INF_SRC_ALCD, +}; + enum { ETHTOOL_A_CABLE_RESULT_UNSPEC, ETHTOOL_A_CABLE_RESULT_PAIR, /* u8 ETHTOOL_A_CABLE_PAIR_ */ ETHTOOL_A_CABLE_RESULT_CODE, /* u8 ETHTOOL_A_CABLE_RESULT_CODE_ */ + ETHTOOL_A_CABLE_RESULT_SRC, /* u32 ETHTOOL_A_CABLE_INF_SRC_ */ __ETHTOOL_A_CABLE_RESULT_CNT, ETHTOOL_A_CABLE_RESULT_MAX = (__ETHTOOL_A_CABLE_RESULT_CNT - 1) @@ -578,6 +596,7 @@ ETHTOOL_A_CABLE_FAULT_LENGTH_UNSPEC, ETHTOOL_A_CABLE_FAULT_LENGTH_PAIR, /* u8 ETHTOOL_A_CABLE_PAIR_ */ ETHTOOL_A_CABLE_FAULT_LENGTH_CM, /* u32 */ + ETHTOOL_A_CABLE_FAULT_LENGTH_SRC, /* u32 ETHTOOL_A_CABLE_INF_SRC_ */ __ETHTOOL_A_CABLE_FAULT_LENGTH_CNT, ETHTOOL_A_CABLE_FAULT_LENGTH_MAX = (__ETHTOOL_A_CABLE_FAULT_LENGTH_CNT - 1) @@ -965,6 +984,7 @@ ETHTOOL_A_RSS_INDIR, /* binary */ ETHTOOL_A_RSS_HKEY, /* binary */ ETHTOOL_A_RSS_INPUT_XFRM, /* u32 */ + ETHTOOL_A_RSS_START_CONTEXT, /* u32 */ __ETHTOOL_A_RSS_CNT, ETHTOOL_A_RSS_MAX = (__ETHTOOL_A_RSS_CNT - 1), @@ -1049,6 +1069,22 @@ ETHTOOL_A_MODULE_FW_FLASH_MAX = (__ETHTOOL_A_MODULE_FW_FLASH_CNT - 1) }; +enum { + ETHTOOL_A_PHY_UNSPEC, + ETHTOOL_A_PHY_HEADER, /* nest - _A_HEADER_* */ + ETHTOOL_A_PHY_INDEX, /* u32 */ + ETHTOOL_A_PHY_DRVNAME, /* string */ + ETHTOOL_A_PHY_NAME, /* string */ + ETHTOOL_A_PHY_UPSTREAM_TYPE, /* u32 */ + ETHTOOL_A_PHY_UPSTREAM_INDEX, /* u32 */ + ETHTOOL_A_PHY_UPSTREAM_SFP_NAME, /* string */ + ETHTOOL_A_PHY_DOWNSTREAM_SFP_NAME, /* string */ + + /* add new constants above here */ + __ETHTOOL_A_PHY_CNT, + ETHTOOL_A_PHY_MAX = (__ETHTOOL_A_PHY_CNT - 1) +}; + /* generic netlink info */ #define ETHTOOL_GENL_NAME "ethtool" #define ETHTOOL_GENL_VERSION 1
diff --git a/uapi/linux/libc-compat.h b/uapi/linux/libc-compat.h index a159991..e25cd3f 100644 --- a/uapi/linux/libc-compat.h +++ b/uapi/linux/libc-compat.h
@@ -140,25 +140,6 @@ #endif /* _NETINET_IN_H */ -/* Coordinate with glibc netipx/ipx.h header. */ -#if defined(__NETIPX_IPX_H) - -#define __UAPI_DEF_SOCKADDR_IPX 0 -#define __UAPI_DEF_IPX_ROUTE_DEFINITION 0 -#define __UAPI_DEF_IPX_INTERFACE_DEFINITION 0 -#define __UAPI_DEF_IPX_CONFIG_DATA 0 -#define __UAPI_DEF_IPX_ROUTE_DEF 0 - -#else /* defined(__NETIPX_IPX_H) */ - -#define __UAPI_DEF_SOCKADDR_IPX 1 -#define __UAPI_DEF_IPX_ROUTE_DEFINITION 1 -#define __UAPI_DEF_IPX_INTERFACE_DEFINITION 1 -#define __UAPI_DEF_IPX_CONFIG_DATA 1 -#define __UAPI_DEF_IPX_ROUTE_DEF 1 - -#endif /* defined(__NETIPX_IPX_H) */ - /* Definitions for xattr.h */ #if defined(_SYS_XATTR_H) #define __UAPI_DEF_XATTR 0 @@ -240,23 +221,6 @@ #define __UAPI_DEF_IP6_MTUINFO 1 #endif -/* Definitions for ipx.h */ -#ifndef __UAPI_DEF_SOCKADDR_IPX -#define __UAPI_DEF_SOCKADDR_IPX 1 -#endif -#ifndef __UAPI_DEF_IPX_ROUTE_DEFINITION -#define __UAPI_DEF_IPX_ROUTE_DEFINITION 1 -#endif -#ifndef __UAPI_DEF_IPX_INTERFACE_DEFINITION -#define __UAPI_DEF_IPX_INTERFACE_DEFINITION 1 -#endif -#ifndef __UAPI_DEF_IPX_CONFIG_DATA -#define __UAPI_DEF_IPX_CONFIG_DATA 1 -#endif -#ifndef __UAPI_DEF_IPX_ROUTE_DEF -#define __UAPI_DEF_IPX_ROUTE_DEF 1 -#endif - /* Definitions for xattr.h */ #ifndef __UAPI_DEF_XATTR #define __UAPI_DEF_XATTR 1
diff --git a/uapi/linux/net_tstamp.h b/uapi/linux/net_tstamp.h index a2c66b3..858339d 100644 --- a/uapi/linux/net_tstamp.h +++ b/uapi/linux/net_tstamp.h
@@ -32,8 +32,9 @@ SOF_TIMESTAMPING_OPT_TX_SWHW = (1<<14), SOF_TIMESTAMPING_BIND_PHC = (1 << 15), SOF_TIMESTAMPING_OPT_ID_TCP = (1 << 16), + SOF_TIMESTAMPING_OPT_RX_FILTER = (1 << 17), - SOF_TIMESTAMPING_LAST = SOF_TIMESTAMPING_OPT_ID_TCP, + SOF_TIMESTAMPING_LAST = SOF_TIMESTAMPING_OPT_RX_FILTER, SOF_TIMESTAMPING_MASK = (SOF_TIMESTAMPING_LAST - 1) | SOF_TIMESTAMPING_LAST };