From patchwork Mon Aug 9 10:22:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 494873 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3CFF5C4320A for ; Mon, 9 Aug 2021 10:23:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1A7F361040 for ; Mon, 9 Aug 2021 10:23:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234964AbhHIKXy (ORCPT ); Mon, 9 Aug 2021 06:23:54 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:36693 "EHLO out3-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234646AbhHIKXn (ORCPT ); Mon, 9 Aug 2021 06:23:43 -0400 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id B70145C00E2; Mon, 9 Aug 2021 06:23:22 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Mon, 09 Aug 2021 06:23:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=oBZ/4QYSS5TWxc8jl7AUYDJt7K5+51mskC1yjtTLWmE=; b=wmVvb6fx GWZ39EddvbOaUoW3hadI8MFx8x2bYd2tWOYIwecgGgQZ+aJH4hZvAUnZ4Ee5o5gU nGmM9ETA66D+r8wZnkReoSNuR7or5Mt+ZDCTMiC56Bu65fdT0jsASv7jGyUU4ikQ +uQ80gBaE7U2Ut7Dyjad/7sK8fOcap9TGUcTMSnoLFdqO49zXp2GhKx/8ngoizsp 0JuSpQBrBO1yYwBSmS/BTS8rJmwXvXkYUO/IGuVkIuxdXhkL695hjJFxRwrH1FYp 3ham1TNsZHr8/8nxzWKPR+8CRQ9RkHufKKY7d+/atruESmqN5PuE/a+RPZwRaApN NyEBpngIjAOLFA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrjeejgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtkeertd ertddtnecuhfhrohhmpefkughoucfutghhihhmmhgvlhcuoehiughoshgthhesihguohhs tghhrdhorhhgqeenucggtffrrghtthgvrhhnpeduteeiveffffevleekleejffekhfekhe fgtdfftefhledvjefggfehgfevjeekhfenucevlhhushhtvghrufhiiigvpedvnecurfgr rhgrmhepmhgrihhlfhhrohhmpehiughoshgthhesihguohhstghhrdhorhhg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 9 Aug 2021 06:23:19 -0400 (EDT) From: Ido Schimmel To: netdev@vger.kernel.org Cc: davem@davemloft.net, kuba@kernel.org, andrew@lunn.ch, mkubecek@suse.cz, pali@kernel.org, vadimp@nvidia.com, mlxsw@nvidia.com, Ido Schimmel Subject: [RFC PATCH ethtool-next 1/6] Update UAPI header copies Date: Mon, 9 Aug 2021 13:22:51 +0300 Message-Id: <20210809102256.720119-2-idosch@idosch.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210809102256.720119-1-idosch@idosch.org> References: <20210809102256.720119-1-idosch@idosch.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Ido Schimmel Update to kernel commit XXX. Signed-off-by: Ido Schimmel --- uapi/linux/ethtool.h | 4 ++-- uapi/linux/ethtool_netlink.h | 35 ++++++++++++++++++++++++++++++++++- uapi/linux/if_link.h | 19 +++++++++++++++++++ uapi/linux/net_tstamp.h | 17 +++++++++++++++-- uapi/linux/netlink.h | 5 +++-- 5 files changed, 73 insertions(+), 7 deletions(-) diff --git a/uapi/linux/ethtool.h b/uapi/linux/ethtool.h index c6ec1111ffa3..f40b00d94276 100644 --- a/uapi/linux/ethtool.h +++ b/uapi/linux/ethtool.h @@ -231,7 +231,7 @@ enum tunable_id { ETHTOOL_PFC_PREVENTION_TOUT, /* timeout in msecs */ /* * Add your fresh new tunable attribute above and remember to update - * tunable_strings[] in net/core/ethtool.c + * tunable_strings[] in net/ethtool/common.c */ __ETHTOOL_TUNABLE_COUNT, }; @@ -295,7 +295,7 @@ enum phy_tunable_id { ETHTOOL_PHY_EDPD, /* * Add your fresh new phy tunable attribute above and remember to update - * phy_tunable_strings[] in net/core/ethtool.c + * phy_tunable_strings[] in net/ethtool/common.c */ __ETHTOOL_PHY_TUNABLE_COUNT, }; diff --git a/uapi/linux/ethtool_netlink.h b/uapi/linux/ethtool_netlink.h index 4653c4c79972..32eabb5773d0 100644 --- a/uapi/linux/ethtool_netlink.h +++ b/uapi/linux/ethtool_netlink.h @@ -46,6 +46,10 @@ enum { ETHTOOL_MSG_FEC_SET, ETHTOOL_MSG_MODULE_EEPROM_GET, ETHTOOL_MSG_STATS_GET, + ETHTOOL_MSG_PHC_VCLOCKS_GET, + ETHTOOL_MSG_MODULE_GET, + ETHTOOL_MSG_MODULE_SET, + ETHTOOL_MSG_MODULE_RESET_ACT, /* add new constants above here */ __ETHTOOL_MSG_USER_CNT, @@ -88,6 +92,10 @@ enum { ETHTOOL_MSG_FEC_NTF, ETHTOOL_MSG_MODULE_EEPROM_GET_REPLY, ETHTOOL_MSG_STATS_GET_REPLY, + ETHTOOL_MSG_PHC_VCLOCKS_GET_REPLY, + ETHTOOL_MSG_MODULE_GET_REPLY, + ETHTOOL_MSG_MODULE_NTF, + ETHTOOL_MSG_MODULE_RESET_NTF, /* add new constants above here */ __ETHTOOL_MSG_KERNEL_CNT, @@ -440,6 +448,19 @@ enum { ETHTOOL_A_TSINFO_MAX = (__ETHTOOL_A_TSINFO_CNT - 1) }; +/* PHC VCLOCKS */ + +enum { + ETHTOOL_A_PHC_VCLOCKS_UNSPEC, + ETHTOOL_A_PHC_VCLOCKS_HEADER, /* nest - _A_HEADER_* */ + ETHTOOL_A_PHC_VCLOCKS_NUM, /* u32 */ + ETHTOOL_A_PHC_VCLOCKS_INDEX, /* array, s32 */ + + /* add new constants above here */ + __ETHTOOL_A_PHC_VCLOCKS_CNT, + ETHTOOL_A_PHC_VCLOCKS_MAX = (__ETHTOOL_A_PHC_VCLOCKS_CNT - 1) +}; + /* CABLE TEST */ enum { @@ -675,7 +696,7 @@ enum { ETHTOOL_A_MODULE_EEPROM_PAGE, /* u8 */ ETHTOOL_A_MODULE_EEPROM_BANK, /* u8 */ ETHTOOL_A_MODULE_EEPROM_I2C_ADDRESS, /* u8 */ - ETHTOOL_A_MODULE_EEPROM_DATA, /* nested */ + ETHTOOL_A_MODULE_EEPROM_DATA, /* binary */ __ETHTOOL_A_MODULE_EEPROM_CNT, ETHTOOL_A_MODULE_EEPROM_MAX = (__ETHTOOL_A_MODULE_EEPROM_CNT - 1) @@ -816,6 +837,18 @@ enum { ETHTOOL_A_STATS_RMON_MAX = (__ETHTOOL_A_STATS_RMON_CNT - 1) }; +/* MODULE */ + +enum { + ETHTOOL_A_MODULE_UNSPEC, + ETHTOOL_A_MODULE_HEADER, /* nest - _A_HEADER_* */ + ETHTOOL_A_MODULE_LOW_POWER_ENABLED, /* u8 */ + + /* add new constants above here */ + __ETHTOOL_A_MODULE_CNT, + ETHTOOL_A_MODULE_MAX = (__ETHTOOL_A_MODULE_CNT - 1) +}; + /* generic netlink info */ #define ETHTOOL_GENL_NAME "ethtool" #define ETHTOOL_GENL_VERSION 1 diff --git a/uapi/linux/if_link.h b/uapi/linux/if_link.h index 0e81707a9637..62512efc4f73 100644 --- a/uapi/linux/if_link.h +++ b/uapi/linux/if_link.h @@ -341,6 +341,13 @@ enum { IFLA_ALT_IFNAME, /* Alternative ifname */ IFLA_PERM_ADDRESS, IFLA_PROTO_DOWN_REASON, + + /* device (sysfs) name as parent, used instead + * of IFLA_LINK where there's no parent netdev + */ + IFLA_PARENT_DEV_NAME, + IFLA_PARENT_DEV_BUS_NAME, + __IFLA_MAX }; @@ -1234,6 +1241,8 @@ enum { #define RMNET_FLAGS_INGRESS_MAP_COMMANDS (1U << 1) #define RMNET_FLAGS_INGRESS_MAP_CKSUMV4 (1U << 2) #define RMNET_FLAGS_EGRESS_MAP_CKSUMV4 (1U << 3) +#define RMNET_FLAGS_INGRESS_MAP_CKSUMV5 (1U << 4) +#define RMNET_FLAGS_EGRESS_MAP_CKSUMV5 (1U << 5) enum { IFLA_RMNET_UNSPEC, @@ -1249,4 +1258,14 @@ struct ifla_rmnet_flags { __u32 mask; }; +/* MCTP section */ + +enum { + IFLA_MCTP_UNSPEC, + IFLA_MCTP_NET, + __IFLA_MCTP_MAX, +}; + +#define IFLA_MCTP_MAX (__IFLA_MCTP_MAX - 1) + #endif /* _LINUX_IF_LINK_H */ diff --git a/uapi/linux/net_tstamp.h b/uapi/linux/net_tstamp.h index 7ed0b3d1c00a..fcc61c73a666 100644 --- a/uapi/linux/net_tstamp.h +++ b/uapi/linux/net_tstamp.h @@ -13,7 +13,7 @@ #include #include /* for SO_TIMESTAMPING */ -/* SO_TIMESTAMPING gets an integer bit field comprised of these values */ +/* SO_TIMESTAMPING flags */ enum { SOF_TIMESTAMPING_TX_HARDWARE = (1<<0), SOF_TIMESTAMPING_TX_SOFTWARE = (1<<1), @@ -30,8 +30,9 @@ enum { SOF_TIMESTAMPING_OPT_STATS = (1<<12), SOF_TIMESTAMPING_OPT_PKTINFO = (1<<13), SOF_TIMESTAMPING_OPT_TX_SWHW = (1<<14), + SOF_TIMESTAMPING_BIND_PHC = (1 << 15), - SOF_TIMESTAMPING_LAST = SOF_TIMESTAMPING_OPT_TX_SWHW, + SOF_TIMESTAMPING_LAST = SOF_TIMESTAMPING_BIND_PHC, SOF_TIMESTAMPING_MASK = (SOF_TIMESTAMPING_LAST - 1) | SOF_TIMESTAMPING_LAST }; @@ -46,6 +47,18 @@ enum { SOF_TIMESTAMPING_TX_SCHED | \ SOF_TIMESTAMPING_TX_ACK) +/** + * struct so_timestamping - SO_TIMESTAMPING parameter + * + * @flags: SO_TIMESTAMPING flags + * @bind_phc: Index of PTP virtual clock bound to sock. This is available + * if flag SOF_TIMESTAMPING_BIND_PHC is set. + */ +struct so_timestamping { + int flags; + int bind_phc; +}; + /** * struct hwtstamp_config - %SIOCGHWTSTAMP and %SIOCSHWTSTAMP parameter * diff --git a/uapi/linux/netlink.h b/uapi/linux/netlink.h index 5024c5435749..e83e2e300130 100644 --- a/uapi/linux/netlink.h +++ b/uapi/linux/netlink.h @@ -91,9 +91,10 @@ struct nlmsghdr { #define NLMSG_HDRLEN ((int) NLMSG_ALIGN(sizeof(struct nlmsghdr))) #define NLMSG_LENGTH(len) ((len) + NLMSG_HDRLEN) #define NLMSG_SPACE(len) NLMSG_ALIGN(NLMSG_LENGTH(len)) -#define NLMSG_DATA(nlh) ((void*)(((char*)nlh) + NLMSG_LENGTH(0))) +#define NLMSG_DATA(nlh) ((void *)(((char *)nlh) + NLMSG_HDRLEN)) #define NLMSG_NEXT(nlh,len) ((len) -= NLMSG_ALIGN((nlh)->nlmsg_len), \ - (struct nlmsghdr*)(((char*)(nlh)) + NLMSG_ALIGN((nlh)->nlmsg_len))) + (struct nlmsghdr *)(((char *)(nlh)) + \ + NLMSG_ALIGN((nlh)->nlmsg_len))) #define NLMSG_OK(nlh,len) ((len) >= (int)sizeof(struct nlmsghdr) && \ (nlh)->nlmsg_len >= sizeof(struct nlmsghdr) && \ (nlh)->nlmsg_len <= (len)) From patchwork Mon Aug 9 10:22:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 494254 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2CF30C4338F for ; Mon, 9 Aug 2021 10:23:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0FC7B61078 for ; Mon, 9 Aug 2021 10:23:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234987AbhHIKX7 (ORCPT ); Mon, 9 Aug 2021 06:23:59 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:33939 "EHLO out3-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234692AbhHIKXp (ORCPT ); Mon, 9 Aug 2021 06:23:45 -0400 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 60D3E5C0136; Mon, 9 Aug 2021 06:23:25 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Mon, 09 Aug 2021 06:23:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=QBa80+Qv0E42aXBMgEcpuUi9zmt7lJ9BJZ38rQU1kmM=; b=imj6Ve1W Efybh0jWzyzwGIFsxxZJqt6c+ife2dzVy6ppLZf5uxhdvLIA9waQ/Lv0LunLNwXL bxgjnd3/qcQ4w/ayowsfq5gaXwFNkZD8L1VNM68gAVPl1iZrta9OqHufRMihnYHJ T92WLg938/7YZRfn6hcvQiBp+gaatxicmvgkbRxereodzTRZUsjlL3xtTUTvEPG7 XGvuDKSx5DpA8Utx1Ppvze/7yymP7rQjO1rWgtt7Xm731elHMnW3cy/VpCHBeomL 4vBP/oDHPKlUZyNilKFM13hM3RKYglJlQ4kzHSHnP+Pezw7+DKPxKAl+zKgQlcCp 7DLrZQgV31yBxA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrjeejgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtkeertd ertddtnecuhfhrohhmpefkughoucfutghhihhmmhgvlhcuoehiughoshgthhesihguohhs tghhrdhorhhgqeenucggtffrrghtthgvrhhnpeduteeiveffffevleekleejffekhfekhe fgtdfftefhledvjefggfehgfevjeekhfenucevlhhushhtvghrufhiiigvpeefnecurfgr rhgrmhepmhgrihhlfhhrohhmpehiughoshgthhesihguohhstghhrdhorhhg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 9 Aug 2021 06:23:22 -0400 (EDT) From: Ido Schimmel To: netdev@vger.kernel.org Cc: davem@davemloft.net, kuba@kernel.org, andrew@lunn.ch, mkubecek@suse.cz, pali@kernel.org, vadimp@nvidia.com, mlxsw@nvidia.com, Ido Schimmel Subject: [RFC PATCH ethtool-next 2/6] ethtool: Add ability to control transceiver modules' low power mode Date: Mon, 9 Aug 2021 13:22:52 +0300 Message-Id: <20210809102256.720119-3-idosch@idosch.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210809102256.720119-1-idosch@idosch.org> References: <20210809102256.720119-1-idosch@idosch.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Ido Schimmel Add ability to control transceiver modules' low power mode over netlink. Example output and usage: $ ethtool --show-module swp11 Module parameters for swp11: low-power false $ ethtool --json --show-module swp11 [ { "ifname": "swp11", "low-power": false } ] # ethtool --set-module swp11 low-power on $ ethtool --show-module swp11 Module parameters for swp11: low-power true # ethtool --set-module swp11 low-power on # ethtool --set-module swp11 low-power off Despite three set commands, only two notifications were emitted, as the kernel only emits notifications when an attribute changes: $ ethtool --monitor listening... Module parameters for swp11: low-power true Module parameters for swp11: low-power false Signed-off-by: Ido Schimmel --- Makefile.am | 2 +- ethtool.8.in | 15 ++++ ethtool.c | 11 +++ netlink/desc-ethtool.c | 10 +++ netlink/extapi.h | 4 + netlink/module.c | 139 ++++++++++++++++++++++++++++++++++ netlink/monitor.c | 4 + netlink/netlink.h | 1 + shell-completion/bash/ethtool | 22 ++++++ 9 files changed, 207 insertions(+), 1 deletion(-) create mode 100644 netlink/module.c diff --git a/Makefile.am b/Makefile.am index dd357d0a158a..dc5fbec1e09d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -39,7 +39,7 @@ ethtool_SOURCES += \ netlink/eee.c netlink/tsinfo.c netlink/fec.c \ netlink/stats.c \ netlink/desc-ethtool.c netlink/desc-genlctrl.c \ - netlink/module-eeprom.c \ + netlink/module-eeprom.c netlink/module.c \ netlink/desc-rtnl.c netlink/cable_test.c netlink/tunnels.c \ uapi/linux/ethtool_netlink.h \ uapi/linux/netlink.h uapi/linux/genetlink.h \ diff --git a/ethtool.8.in b/ethtool.8.in index f83d6d17ae41..f9d901cdefca 100644 --- a/ethtool.8.in +++ b/ethtool.8.in @@ -475,6 +475,13 @@ ethtool \- query or control network driver and hardware settings .HP .B ethtool \-\-show\-tunnels .I devname +.HP +.B ethtool \-\-show\-module +.I devname +.HP +.B ethtool \-\-set\-module +.I devname +.B2 low-power on off . .\" Adjust lines (i.e. full justification) and hyphenate. .ad @@ -1458,6 +1465,14 @@ Show tunnel-related device capabilities and state. List UDP ports kernel has programmed the device to parse as VxLAN, or GENEVE tunnels. .RE +.TP +.B \-\-set\-module +Set the transceiver module's parameters. +.RS 4 +.TP +.A2 low-power on off +Enable / disable forcing of low power mode by the host. +.RE .SH BUGS Not supported (in part or whole) on all network drivers. .SH AUTHOR diff --git a/ethtool.c b/ethtool.c index 33a0a492cb15..89ff03b18fbf 100644 --- a/ethtool.c +++ b/ethtool.c @@ -6020,6 +6020,17 @@ static const struct option args[] = { .nlfunc = nl_gtunnels, .help = "Show NIC tunnel offload information", }, + { + .opts = "--show-module", + .nlfunc = nl_gmodule, + .help = "Show transceiver module settings", + }, + { + .opts = "--set-module", + .nlfunc = nl_smodule, + .help = "Set transceiver module settings", + .xhelp = " [ low-power on|off ]\n" + }, { .opts = "-h|--help", .no_dev = true, diff --git a/netlink/desc-ethtool.c b/netlink/desc-ethtool.c index d6fc4e2d03df..3fb31b28f288 100644 --- a/netlink/desc-ethtool.c +++ b/netlink/desc-ethtool.c @@ -374,6 +374,12 @@ const struct pretty_nla_desc __module_eeprom_desc[] = { NLATTR_DESC_BINARY(ETHTOOL_A_MODULE_EEPROM_DATA) }; +static const struct pretty_nla_desc __module_desc[] = { + NLATTR_DESC_INVALID(ETHTOOL_A_MODULE_UNSPEC), + NLATTR_DESC_NESTED(ETHTOOL_A_MODULE_HEADER, header), + NLATTR_DESC_BOOL(ETHTOOL_A_MODULE_LOW_POWER_ENABLED), +}; + const struct pretty_nlmsg_desc ethnl_umsg_desc[] = { NLMSG_DESC_INVALID(ETHTOOL_MSG_USER_NONE), NLMSG_DESC(ETHTOOL_MSG_STRSET_GET, strset), @@ -408,6 +414,8 @@ const struct pretty_nlmsg_desc ethnl_umsg_desc[] = { NLMSG_DESC(ETHTOOL_MSG_FEC_SET, fec), NLMSG_DESC(ETHTOOL_MSG_STATS_GET, stats), NLMSG_DESC(ETHTOOL_MSG_MODULE_EEPROM_GET, module_eeprom), + NLMSG_DESC(ETHTOOL_MSG_MODULE_GET, module), + NLMSG_DESC(ETHTOOL_MSG_MODULE_SET, module), }; const unsigned int ethnl_umsg_n_desc = ARRAY_SIZE(ethnl_umsg_desc); @@ -447,6 +455,8 @@ const struct pretty_nlmsg_desc ethnl_kmsg_desc[] = { NLMSG_DESC(ETHTOOL_MSG_FEC_NTF, fec), NLMSG_DESC(ETHTOOL_MSG_STATS_GET_REPLY, stats), NLMSG_DESC(ETHTOOL_MSG_MODULE_EEPROM_GET_REPLY, module_eeprom), + NLMSG_DESC(ETHTOOL_MSG_MODULE_GET_REPLY, module), + NLMSG_DESC(ETHTOOL_MSG_MODULE_NTF, module), }; const unsigned int ethnl_kmsg_n_desc = ARRAY_SIZE(ethnl_kmsg_desc); diff --git a/netlink/extapi.h b/netlink/extapi.h index 91bf02b5e3be..2ab4c6bc2f8d 100644 --- a/netlink/extapi.h +++ b/netlink/extapi.h @@ -43,6 +43,8 @@ int nl_gfec(struct cmd_context *ctx); int nl_sfec(struct cmd_context *ctx); bool nl_gstats_chk(struct cmd_context *ctx); int nl_gstats(struct cmd_context *ctx); +int nl_gmodule(struct cmd_context *ctx); +int nl_smodule(struct cmd_context *ctx); int nl_monitor(struct cmd_context *ctx); int nl_getmodule(struct cmd_context *ctx); @@ -99,6 +101,8 @@ static inline void nl_monitor_usage(void) #define nl_gstats_chk NULL #define nl_gstats NULL #define nl_getmodule NULL +#define nl_gmodule NULL +#define nl_smodule NULL #endif /* ETHTOOL_ENABLE_NETLINK */ diff --git a/netlink/module.c b/netlink/module.c new file mode 100644 index 000000000000..59a149075f0f --- /dev/null +++ b/netlink/module.c @@ -0,0 +1,139 @@ +/* + * module.c - netlink implementation of module commands + * + * Implementation of "ethtool --show-module " and + * "ethtool --set-module ..." + */ + +#include +#include +#include +#include +#include + +#include "../internal.h" +#include "../common.h" +#include "netlink.h" +#include "parser.h" + +/* MODULE_GET */ + +int module_reply_cb(const struct nlmsghdr *nlhdr, void *data) +{ + const struct nlattr *tb[ETHTOOL_A_MODULE_MAX + 1] = {}; + struct nl_context *nlctx = data; + DECLARE_ATTR_TB_INFO(tb); + 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_MODULE_HEADER]); + if (!dev_ok(nlctx)) + return err_ret; + + if (silent) + print_nl(); + + open_json_object(NULL); + + print_string(PRINT_ANY, "ifname", "Module parameters for %s:\n", + nlctx->devname); + + if (tb[ETHTOOL_A_MODULE_LOW_POWER_ENABLED]) { + bool low_power; + + low_power = + mnl_attr_get_u8(tb[ETHTOOL_A_MODULE_LOW_POWER_ENABLED]); + print_bool(PRINT_ANY, "low-power", "low-power %s\n", low_power); + } + + close_json_object(); + + return MNL_CB_OK; +} + +int nl_gmodule(struct cmd_context *ctx) +{ + struct nl_context *nlctx = ctx->nlctx; + struct nl_socket *nlsk; + int ret; + + if (netlink_cmd_check(ctx, ETHTOOL_MSG_MODULE_GET, true)) + return -EOPNOTSUPP; + if (ctx->argc > 0) { + fprintf(stderr, "ethtool: unexpected parameter '%s'\n", + *ctx->argp); + return 1; + } + + nlsk = nlctx->ethnl_socket; + ret = nlsock_prep_get_request(nlsk, ETHTOOL_MSG_MODULE_GET, + ETHTOOL_A_MODULE_HEADER, 0); + if (ret < 0) + return ret; + + new_json_obj(ctx->json); + ret = nlsock_send_get_request(nlsk, module_reply_cb); + delete_json_obj(); + return ret; +} + +/* MODULE_SET */ + +static const struct param_parser smodule_params[] = { + { + .arg = "low-power", + .type = ETHTOOL_A_MODULE_LOW_POWER_ENABLED, + .handler = nl_parse_u8bool, + .min_argc = 1, + }, + {} +}; + +int nl_smodule(struct cmd_context *ctx) +{ + struct nl_context *nlctx = ctx->nlctx; + struct nl_msg_buff *msgbuff; + struct nl_socket *nlsk; + int ret; + + if (netlink_cmd_check(ctx, ETHTOOL_MSG_MODULE_SET, false)) + return -EOPNOTSUPP; + if (!ctx->argc) { + fprintf(stderr, "ethtool (--set-module): parameters missing\n"); + return 1; + } + + nlctx->cmd = "--set-module"; + nlctx->argp = ctx->argp; + nlctx->argc = ctx->argc; + nlctx->devname = ctx->devname; + nlsk = nlctx->ethnl_socket; + msgbuff = &nlsk->msgbuff; + + ret = msg_init(nlctx, msgbuff, ETHTOOL_MSG_MODULE_SET, + NLM_F_REQUEST | NLM_F_ACK); + if (ret < 0) + return 2; + if (ethnla_fill_header(msgbuff, ETHTOOL_A_MODULE_HEADER, + ctx->devname, 0)) + return -EMSGSIZE; + + ret = nl_parser(nlctx, smodule_params, NULL, PARSER_GROUP_NONE, NULL); + if (ret < 0) + return 1; + + ret = nlsock_sendmsg(nlsk, NULL); + if (ret < 0) + return 83; + ret = nlsock_process_reply(nlsk, nomsg_reply_cb, nlctx); + if (ret == 0) + return 0; + else + return nlctx->exit_code ?: 83; +} diff --git a/netlink/monitor.c b/netlink/monitor.c index 0c4df9e78ee3..d631907817e2 100644 --- a/netlink/monitor.c +++ b/netlink/monitor.c @@ -71,6 +71,10 @@ static struct { .cmd = ETHTOOL_MSG_FEC_NTF, .cb = fec_reply_cb, }, + { + .cmd = ETHTOOL_MSG_MODULE_NTF, + .cb = module_reply_cb, + }, }; static void clear_filter(struct nl_context *nlctx) diff --git a/netlink/netlink.h b/netlink/netlink.h index 70fa666b20e5..f43c1bff6a58 100644 --- a/netlink/netlink.h +++ b/netlink/netlink.h @@ -91,6 +91,7 @@ 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); int fec_reply_cb(const struct nlmsghdr *nlhdr, void *data); +int module_reply_cb(const struct nlmsghdr *nlhdr, void *data); /* dump helpers */ diff --git a/shell-completion/bash/ethtool b/shell-completion/bash/ethtool index 45573413985d..5db3b4f50232 100644 --- a/shell-completion/bash/ethtool +++ b/shell-completion/bash/ethtool @@ -1137,6 +1137,26 @@ _ethtool_test() fi } +# Completion for ethtool --set-module +_ethtool_set_module() +{ + local -A settings=( + [low-power]=1 + ) + + if [ "${settings[$prev]+set}" ]; then + COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) ) + return + fi + + # Remove settings which have been seen + local word + for word in "${words[@]:3:${#words[@]}-4}"; do + unset "settings[$word]" + done + + COMPREPLY=( $( compgen -W "${!settings[*]}" -- "$cur" ) ) +} # Complete any ethtool command _ethtool() @@ -1189,6 +1209,8 @@ _ethtool() [--show-time-stamping]=devname [--statistics]=devname [--test]=test + [--set-module]=set_module + [--show-module]=devname ) local -A other_funcs=( [--config-ntuple]=config_nfc From patchwork Mon Aug 9 10:22:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 494872 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9C9ADC432BE for ; Mon, 9 Aug 2021 10:23:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7CD786108C for ; Mon, 9 Aug 2021 10:23:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234995AbhHIKYC (ORCPT ); Mon, 9 Aug 2021 06:24:02 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:55913 "EHLO out3-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234525AbhHIKXs (ORCPT ); Mon, 9 Aug 2021 06:23:48 -0400 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 44D6B5C0105; Mon, 9 Aug 2021 06:23:28 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Mon, 09 Aug 2021 06:23:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=IjZT1SsqOGtJZGxhg70Y1bsEMn6b+m15ceItbCbyreU=; b=iiWNkk3/ 1Jo+bCLIXTOhI0z84CDRlfiPlp+RWrfZYvfI9hzqXPHVU42zI4mtQRbtWY0U2v85 wosCUDz5TS37n1nlbiJWq5TKQn02R3EUBXp6a1NW40La/WkWFphAzvpjhI4GJXS3 nsqLkdBpbO1IIWhz9bM0XvWZ+LyIVC2wfp+wZ2k4ILywdb6ZUT0YY1NKZ300r3zn ecJjO8D5mbQkBGJMALfdbALQOUimLUrsR413niJSSTv8/HJ0xQXtahK4UIjSb2uE PFU5uAZTfvJiIb1CI8HZZGKGp16k+SumolYFbA+P0F5wg9bRyq/2ijJNPYngdcV1 BKFlGTSH7kXvVw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrjeejgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtkeertd ertddtnecuhfhrohhmpefkughoucfutghhihhmmhgvlhcuoehiughoshgthhesihguohhs tghhrdhorhhgqeenucggtffrrghtthgvrhhnpeduteeiveffffevleekleejffekhfekhe fgtdfftefhledvjefggfehgfevjeekhfenucevlhhushhtvghrufhiiigvpedvnecurfgr rhgrmhepmhgrihhlfhhrohhmpehiughoshgthhesihguohhstghhrdhorhhg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 9 Aug 2021 06:23:25 -0400 (EDT) From: Ido Schimmel To: netdev@vger.kernel.org Cc: davem@davemloft.net, kuba@kernel.org, andrew@lunn.ch, mkubecek@suse.cz, pali@kernel.org, vadimp@nvidia.com, mlxsw@nvidia.com, Ido Schimmel Subject: [RFC PATCH ethtool-next 3/6] ethtool: Print CMIS Module State Date: Mon, 9 Aug 2021 13:22:53 +0300 Message-Id: <20210809102256.720119-4-idosch@idosch.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210809102256.720119-1-idosch@idosch.org> References: <20210809102256.720119-1-idosch@idosch.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Ido Schimmel Print the CMIS Module State when dumping EEPROM contents via the '-m' option. It can be used, for example, to test module low power mode settings. Example output: # ethtool -m swp11 Identifier : 0x18 (QSFP-DD Double Density 8X Pluggable Transceiver (INF-8628)) ... Module State : 0x03 (ModuleReady) # ethtool --set-module swp11 low-power on # ethtool -m swp11 Identifier : 0x18 (QSFP-DD Double Density 8X Pluggable Transceiver (INF-8628)) ... Module State : 0x01 (ModuleLowPwr) Signed-off-by: Ido Schimmel --- cmis.c | 35 +++++++++++++++++++++++++++++++++++ cmis.h | 8 ++++++++ 2 files changed, 43 insertions(+) diff --git a/cmis.c b/cmis.c index 361b721f332f..f09219fd889d 100644 --- a/cmis.c +++ b/cmis.c @@ -42,6 +42,39 @@ static void cmis_show_rev_compliance(const __u8 *id) printf("\t%-41s : Rev. %d.%d\n", "Revision compliance", major, minor); } +/** + * Print the current Module State. Relevant documents: + * [1] CMIS Rev. 5, pag. 57, section 6.3.2.2, Figure 6-3 + * [2] CMIS Rev. 5, pag. 60, section 6.3.2.3, Figure 6-4 + * [3] CMIS Rev. 5, pag. 107, section 8.2.2, Table 8-6 + */ +static void cmis_show_mod_state(const __u8 *id) +{ + __u8 mod_state = (id[CMIS_MODULE_STATE_OFFSET] >> 1) & 0x07; + + printf("\t%-41s : 0x%02x", "Module State", mod_state); + switch (mod_state) { + case CMIS_MODULE_STATE_MODULE_LOW_PWR: + printf(" (ModuleLowPwr)\n"); + break; + case CMIS_MODULE_STATE_MODULE_PWR_UP: + printf(" (ModulePwrUp)\n"); + break; + case CMIS_MODULE_STATE_MODULE_READY: + printf(" (ModuleReady)\n"); + break; + case CMIS_MODULE_STATE_MODULE_PWR_DN: + printf(" (ModulePwrDn)\n"); + break; + case CMIS_MODULE_STATE_MODULE_FAULT: + printf(" (ModuleFault)\n"); + break; + default: + printf(" (reserved or unknown)\n"); + break; + } +} + /** * Print information about the device's power consumption. * Relevant documents: @@ -336,6 +369,7 @@ void qsfp_dd_show_all(const __u8 *id) cmis_show_link_len(id); cmis_show_vendor_info(id); cmis_show_rev_compliance(id); + cmis_show_mod_state(id); } void cmis_show_all(const struct ethtool_module_eeprom *page_zero, @@ -356,4 +390,5 @@ void cmis_show_all(const struct ethtool_module_eeprom *page_zero, cmis_show_vendor_info(page_zero_data); cmis_show_rev_compliance(page_zero_data); + cmis_show_mod_state(page_zero_data); } diff --git a/cmis.h b/cmis.h index 78ee1495bc33..197b70a2034d 100644 --- a/cmis.h +++ b/cmis.h @@ -5,6 +5,14 @@ #define CMIS_ID_OFFSET 0x00 #define CMIS_REV_COMPLIANCE_OFFSET 0x01 +/* Module State (Page 0) */ +#define CMIS_MODULE_STATE_OFFSET 0x03 +#define CMIS_MODULE_STATE_MODULE_LOW_PWR 0x01 +#define CMIS_MODULE_STATE_MODULE_PWR_UP 0x02 +#define CMIS_MODULE_STATE_MODULE_READY 0x03 +#define CMIS_MODULE_STATE_MODULE_PWR_DN 0x04 +#define CMIS_MODULE_STATE_MODULE_FAULT 0x05 + #define CMIS_MODULE_TYPE_OFFSET 0x55 #define CMIS_MT_MMF 0x01 #define CMIS_MT_SMF 0x02 From patchwork Mon Aug 9 10:22:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 494871 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 46363C4320A for ; Mon, 9 Aug 2021 10:24:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 26EB16108C for ; Mon, 9 Aug 2021 10:24:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235035AbhHIKYO (ORCPT ); Mon, 9 Aug 2021 06:24:14 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:42387 "EHLO out3-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234952AbhHIKXv (ORCPT ); Mon, 9 Aug 2021 06:23:51 -0400 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id D367F5C00DC; Mon, 9 Aug 2021 06:23:30 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Mon, 09 Aug 2021 06:23:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=C6Q9o8UsvFAF2AjFF9MWegxvzWIjheShEtj9ZibZ9dM=; b=eWHVHCrO qL+/bYfVFCtqYcXOD03vm8GnDhF0V5MFUMZhmL2voB0jALJJvts6lJgrAMEc+vp/ vy2zKRdg61tEExOrKWuOT86aacldQCcQYD/eDBjmjC9RUo0nUrqd/U2fVfEEFKXE FlOHksXUrZmp0DQu+hlIdzuhZU0SiTqorJ6Ff4g0nlIUwdJzpIzNhtaGRy+qcFrf jc+F9Ydp6coYhWquzxqQY4q/MBvp0BCxgbWqISuw0FhmybH32J8dybHbGtYbl5jF uYlhBud55ni9QdHUkoz9OU/VBgYi0XbXE1iHeOO5f80XJcu5wwq4nUOAX+UcI7vO SoezvKR2kzJHxw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrjeejgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtkeertd ertddtnecuhfhrohhmpefkughoucfutghhihhmmhgvlhcuoehiughoshgthhesihguohhs tghhrdhorhhgqeenucggtffrrghtthgvrhhnpeduteeiveffffevleekleejffekhfekhe fgtdfftefhledvjefggfehgfevjeekhfenucevlhhushhtvghrufhiiigvpedvnecurfgr rhgrmhepmhgrihhlfhhrohhmpehiughoshgthhesihguohhstghhrdhorhhg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 9 Aug 2021 06:23:28 -0400 (EDT) From: Ido Schimmel To: netdev@vger.kernel.org Cc: davem@davemloft.net, kuba@kernel.org, andrew@lunn.ch, mkubecek@suse.cz, pali@kernel.org, vadimp@nvidia.com, mlxsw@nvidia.com, Ido Schimmel Subject: [RFC PATCH ethtool-next 4/6] ethtool: Print CMIS Module-Level Controls Date: Mon, 9 Aug 2021 13:22:54 +0300 Message-Id: <20210809102256.720119-5-idosch@idosch.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210809102256.720119-1-idosch@idosch.org> References: <20210809102256.720119-1-idosch@idosch.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Ido Schimmel Print the CMIS Module-Level Controls when dumping EEPROM contents via the '-m' option. It can be used to understand low power mode enforcement by the host. Example output: # ethtool -m swp11 Identifier : 0x18 (QSFP-DD Double Density 8X Pluggable Transceiver (INF-8628)) ... Module State : 0x03 (ModuleReady) LowPwrAllowRequestHW : Off LowPwrRequestSW : Off # ethtool --set-module swp11 low-power on # ethtool -m swp11 Identifier : 0x18 (QSFP-DD Double Density 8X Pluggable Transceiver (INF-8628)) ... Module State : 0x01 (ModuleLowPwr) LowPwrAllowRequestHW : Off LowPwrRequestSW : On # ethtool --set-module swp11 low-power off # ethtool -m swp11 Identifier : 0x18 (QSFP-DD Double Density 8X Pluggable Transceiver (INF-8628)) ... Module State : 0x03 (ModuleReady) LowPwrAllowRequestHW : Off LowPwrRequestSW : Off In the above example, the LowPwrRequestHW signal is ignored and low power mode is controlled via software only. Signed-off-by: Ido Schimmel --- cmis.c | 17 +++++++++++++++++ cmis.h | 5 +++++ 2 files changed, 22 insertions(+) diff --git a/cmis.c b/cmis.c index f09219fd889d..f9b4720e6c2c 100644 --- a/cmis.c +++ b/cmis.c @@ -75,6 +75,21 @@ static void cmis_show_mod_state(const __u8 *id) } } +/** + * Print the current Module-Level Controls. Relevant documents: + * [1] CMIS Rev. 5, pag. 58, section 6.3.2.2, Table 6-12 + * [2] CMIS Rev. 5, pag. 111, section 8.2.6, Table 8-10 + */ +static void cmis_show_mod_lvl_controls(const __u8 *id) +{ + printf("\t%-41s : ", "LowPwrAllowRequestHW"); + printf("%s\n", ONOFF(id[CMIS_MODULE_CONTROL_OFFSET] & + CMIS_LOW_PWR_ALLOW_REQUEST_HW)); + printf("\t%-41s : ", "LowPwrRequestSW"); + printf("%s\n", ONOFF(id[CMIS_MODULE_CONTROL_OFFSET] & + CMIS_LOW_PWR_REQUEST_SW)); +} + /** * Print information about the device's power consumption. * Relevant documents: @@ -370,6 +385,7 @@ void qsfp_dd_show_all(const __u8 *id) cmis_show_vendor_info(id); cmis_show_rev_compliance(id); cmis_show_mod_state(id); + cmis_show_mod_lvl_controls(id); } void cmis_show_all(const struct ethtool_module_eeprom *page_zero, @@ -391,4 +407,5 @@ void cmis_show_all(const struct ethtool_module_eeprom *page_zero, cmis_show_vendor_info(page_zero_data); cmis_show_rev_compliance(page_zero_data); cmis_show_mod_state(page_zero_data); + cmis_show_mod_lvl_controls(page_zero_data); } diff --git a/cmis.h b/cmis.h index 197b70a2034d..5a314340eff0 100644 --- a/cmis.h +++ b/cmis.h @@ -21,6 +21,11 @@ #define CMIS_CURR_TEMP_OFFSET 0x0E #define CMIS_CURR_CURR_OFFSET 0x10 +/* Module-Level Controls (Page 0) */ +#define CMIS_MODULE_CONTROL_OFFSET 0x1A +#define CMIS_LOW_PWR_ALLOW_REQUEST_HW (1 << 6) +#define CMIS_LOW_PWR_REQUEST_SW (1 << 4) + #define CMIS_CTOR_OFFSET 0xCB /* Vendor related information (Page 0) */ From patchwork Mon Aug 9 10:22:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 494252 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 87678C432BE for ; Mon, 9 Aug 2021 10:24:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 66A976108C for ; Mon, 9 Aug 2021 10:24:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234769AbhHIKYd (ORCPT ); Mon, 9 Aug 2021 06:24:33 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:59023 "EHLO out3-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234956AbhHIKXy (ORCPT ); Mon, 9 Aug 2021 06:23:54 -0400 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 96C3D5C0134; Mon, 9 Aug 2021 06:23:33 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Mon, 09 Aug 2021 06:23:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=VusrUf+aL/BE0BgECObih5nPPGS0t017EDaB8u8IHqw=; b=Q0OpULZi ythwED51oFpuro9SpylcHs5X84dmDbBIzL/cGtSlHIbwPenBGDbDGbjybd80+n7A k9bYQqt2kREyANU2bU/2cvsCHSpWwcGBXRyuQDwsBi6vZC1MF1tGsWiam5ov+r2L crgfJtWh6TvEl1D/IZ6xzj9DTo/oWU1CoRXjKNELPpoYdSZmtch8yxW7LlXvPbIp D6nigt+Oi/kUzN31S+DfMocZGzxloxe/22U5/rv45T5L1Ei83wOLQHCju+VfaWQQ w5oue/Gu6bPU12QFsWeh95tsiF2v7+6AxFAdzluoZSKPNLfVjfrVqP3Q8t3MzQ3x X0Px+cJ5Up76cA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrjeejgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtkeertd ertddtnecuhfhrohhmpefkughoucfutghhihhmmhgvlhcuoehiughoshgthhesihguohhs tghhrdhorhhgqeenucggtffrrghtthgvrhhnpeduteeiveffffevleekleejffekhfekhe fgtdfftefhledvjefggfehgfevjeekhfenucevlhhushhtvghrufhiiigvpeefnecurfgr rhgrmhepmhgrihhlfhhrohhmpehiughoshgthhesihguohhstghhrdhorhhg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 9 Aug 2021 06:23:31 -0400 (EDT) From: Ido Schimmel To: netdev@vger.kernel.org Cc: davem@davemloft.net, kuba@kernel.org, andrew@lunn.ch, mkubecek@suse.cz, pali@kernel.org, vadimp@nvidia.com, mlxsw@nvidia.com, Ido Schimmel Subject: [RFC PATCH ethtool-next 5/6] ethtool: Print SFF-8636 Power set and Power override bits Date: Mon, 9 Aug 2021 13:22:55 +0300 Message-Id: <20210809102256.720119-6-idosch@idosch.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210809102256.720119-1-idosch@idosch.org> References: <20210809102256.720119-1-idosch@idosch.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Ido Schimmel Print the SFF-8636 Power set and Power override bits when dumping EEPROM contents via the '-m' option. They can be used to understand low power mode enforcement by the host. The 'SFF8636_LOW_PWR_MODE' define is renamed to 'SFF8636_LOW_PWR_SET' to reflect its naming in the standard for QSFP+/QSFP28. Example output: # ethtool -m swp13 Identifier : 0x11 (QSFP28) ... Extended identifier description : 5.0W max. Power consumption, High Power Class (> 3.5 W) enabled Power set : Off Power override : On ... Transmit avg optical power (Channel 1) : 0.7633 mW / -1.17 dBm Transmit avg optical power (Channel 2) : 0.7649 mW / -1.16 dBm Transmit avg optical power (Channel 3) : 0.7696 mW / -1.14 dBm Transmit avg optical power (Channel 4) : 0.7739 mW / -1.11 dBm Rcvr signal avg optical power(Channel 1) : 0.9240 mW / -0.34 dBm Rcvr signal avg optical power(Channel 2) : 0.9129 mW / -0.40 dBm Rcvr signal avg optical power(Channel 3) : 0.9194 mW / -0.36 dBm Rcvr signal avg optical power(Channel 4) : 0.8708 mW / -0.60 dBm # ethtool --set-module swp13 low-power on # ethtool -m swp13 Identifier : 0x11 (QSFP28) ... Extended identifier description : 5.0W max. Power consumption, High Power Class (> 3.5 W) not enabled Power set : On Power override : On ... Transmit avg optical power (Channel 1) : 0.0000 mW / -inf dBm Transmit avg optical power (Channel 2) : 0.0000 mW / -inf dBm Transmit avg optical power (Channel 3) : 0.0000 mW / -inf dBm Transmit avg optical power (Channel 4) : 0.0000 mW / -inf dBm Rcvr signal avg optical power(Channel 1) : 0.0000 mW / -inf dBm Rcvr signal avg optical power(Channel 2) : 0.0000 mW / -inf dBm Rcvr signal avg optical power(Channel 3) : 0.0000 mW / -inf dBm Rcvr signal avg optical power(Channel 4) : 0.0000 mW / -inf dBm # ethtool --set-module swp13 low-power off # ethtool -m swp13 Identifier : 0x11 (QSFP28) ... Extended identifier description : 5.0W max. Power consumption, High Power Class (> 3.5 W) enabled Power set : Off Power override : On ... Transmit avg optical power (Channel 1) : 0.7733 mW / -1.12 dBm Transmit avg optical power (Channel 2) : 0.7754 mW / -1.10 dBm Transmit avg optical power (Channel 3) : 0.7885 mW / -1.03 dBm Transmit avg optical power (Channel 4) : 0.7886 mW / -1.03 dBm Rcvr signal avg optical power(Channel 1) : 0.9248 mW / -0.34 dBm Rcvr signal avg optical power(Channel 2) : 0.9129 mW / -0.40 dBm Rcvr signal avg optical power(Channel 3) : 0.9187 mW / -0.37 dBm Rcvr signal avg optical power(Channel 4) : 0.8785 mW / -0.56 dBm In the above example, the LPMode signal is ignored (Power override is always on) and low power mode is controlled via software only. Signed-off-by: Ido Schimmel --- qsfp.c | 6 ++++++ qsfp.h | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/qsfp.c b/qsfp.c index 644fe148a5aa..08ffb90447f3 100644 --- a/qsfp.c +++ b/qsfp.c @@ -252,6 +252,12 @@ static void sff8636_show_ext_identifier(const __u8 *id) printf(" High Power Class (> 3.5 W) enabled\n"); else printf(" High Power Class (> 3.5 W) not enabled\n"); + printf("\t%-41s : ", "Power set"); + printf("%s\n", ONOFF(id[SFF8636_PWR_MODE_OFFSET] & + SFF8636_LOW_PWR_SET)); + printf("\t%-41s : ", "Power override"); + printf("%s\n", ONOFF(id[SFF8636_PWR_MODE_OFFSET] & + SFF8636_PWR_OVERRIDE)); } static void sff8636_show_connector(const __u8 *id) diff --git a/qsfp.h b/qsfp.h index 1d8f24b5cbc2..aabf09fdc623 100644 --- a/qsfp.h +++ b/qsfp.h @@ -180,7 +180,7 @@ #define SFF8636_PWR_MODE_OFFSET 0x5D #define SFF8636_HIGH_PWR_ENABLE (1 << 2) -#define SFF8636_LOW_PWR_MODE (1 << 1) +#define SFF8636_LOW_PWR_SET (1 << 1) #define SFF8636_PWR_OVERRIDE (1 << 0) #define SFF8636_TX_APP_SELECT_4_OFFSET 0x5E From patchwork Mon Aug 9 10:22:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 494870 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C9FBC4338F for ; Mon, 9 Aug 2021 10:24:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F176861078 for ; Mon, 9 Aug 2021 10:24:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234788AbhHIKYh (ORCPT ); Mon, 9 Aug 2021 06:24:37 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:54925 "EHLO out3-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234976AbhHIKX4 (ORCPT ); Mon, 9 Aug 2021 06:23:56 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 2E4975C0138; Mon, 9 Aug 2021 06:23:36 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Mon, 09 Aug 2021 06:23:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=/SVGRk5A5D/WNdcvmfXOa/VJ/qiTj0m3ow5WRexfQ/8=; b=G72lk1qO qDJAnFEhkic/aSS/wJt6ayuwGCh6B0rUojd73SuGIjPT/hmcTl0B2+vhHbbpmrO1 III9dNrJ/a+qF1TgukyW/Y3KCwW0JVWf0zwqF3sGGN217SRtOKobO/9WdrGiLg0a pRybxgUtoSWV0ISqDWlwFAjCWYUUUOsAdxDey4OZmbBGPDYWV79JgwBEmCwUN4DE cYhg+/CNtyZ3HMZQ/nHs37ViOdhEIdRwH0Abo+asvLAKuoFfYdQmuQKa5XC3CSAy Y4fIXGHqoM8zW+FU9ilQHMRF1HE0jzHDY+U+r7tcl2FIysCTPuns3g6i2U586+iQ oZImFeBFkale1A== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrjeejgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtkeertd ertddtnecuhfhrohhmpefkughoucfutghhihhmmhgvlhcuoehiughoshgthhesihguohhs tghhrdhorhhgqeenucggtffrrghtthgvrhhnpeduteeiveffffevleekleejffekhfekhe fgtdfftefhledvjefggfehgfevjeekhfenucevlhhushhtvghrufhiiigvpedunecurfgr rhgrmhepmhgrihhlfhhrohhmpehiughoshgthhesihguohhstghhrdhorhhg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 9 Aug 2021 06:23:33 -0400 (EDT) From: Ido Schimmel To: netdev@vger.kernel.org Cc: davem@davemloft.net, kuba@kernel.org, andrew@lunn.ch, mkubecek@suse.cz, pali@kernel.org, vadimp@nvidia.com, mlxsw@nvidia.com, Ido Schimmel Subject: [RFC PATCH ethtool-next 6/6] ethtool: Add ability to reset transceiver modules Date: Mon, 9 Aug 2021 13:22:56 +0300 Message-Id: <20210809102256.720119-7-idosch@idosch.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210809102256.720119-1-idosch@idosch.org> References: <20210809102256.720119-1-idosch@idosch.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Ido Schimmel Add ability to reset transceiver modules over netlink. Example usage: # ethtool --reset-module swp11 $ ethtool --monitor listening... Module reset done for swp11 Signed-off-by: Ido Schimmel --- ethtool.8.in | 9 ++++++ ethtool.c | 5 ++++ netlink/desc-ethtool.c | 2 ++ netlink/extapi.h | 2 ++ netlink/module.c | 52 +++++++++++++++++++++++++++++++++++ netlink/monitor.c | 4 +++ netlink/netlink.h | 1 + shell-completion/bash/ethtool | 1 + 8 files changed, 76 insertions(+) diff --git a/ethtool.8.in b/ethtool.8.in index f9d901cdefca..9953289758d4 100644 --- a/ethtool.8.in +++ b/ethtool.8.in @@ -482,6 +482,9 @@ ethtool \- query or control network driver and hardware settings .B ethtool \-\-set\-module .I devname .B2 low-power on off +.HP +.B ethtool \-\-reset\-module +.I devname . .\" Adjust lines (i.e. full justification) and hyphenate. .ad @@ -1473,6 +1476,12 @@ Set the transceiver module's parameters. .A2 low-power on off Enable / disable forcing of low power mode by the host. .RE +.TP +.B \-\-reset\-module +Reset the transceiver module to its initial state. Reset is performed by either +asserting the relevant hardware signal or by writing to the module's reset bit +in its EEPROM. +.RE .SH BUGS Not supported (in part or whole) on all network drivers. .SH AUTHOR diff --git a/ethtool.c b/ethtool.c index 89ff03b18fbf..0ce574b62692 100644 --- a/ethtool.c +++ b/ethtool.c @@ -6031,6 +6031,11 @@ static const struct option args[] = { .help = "Set transceiver module settings", .xhelp = " [ low-power on|off ]\n" }, + { + .opts = "--reset-module", + .nlfunc = nl_reset_module, + .help = "Reset transceiver module", + }, { .opts = "-h|--help", .no_dev = true, diff --git a/netlink/desc-ethtool.c b/netlink/desc-ethtool.c index 3fb31b28f288..fce065fce3ae 100644 --- a/netlink/desc-ethtool.c +++ b/netlink/desc-ethtool.c @@ -416,6 +416,7 @@ const struct pretty_nlmsg_desc ethnl_umsg_desc[] = { NLMSG_DESC(ETHTOOL_MSG_MODULE_EEPROM_GET, module_eeprom), NLMSG_DESC(ETHTOOL_MSG_MODULE_GET, module), NLMSG_DESC(ETHTOOL_MSG_MODULE_SET, module), + NLMSG_DESC(ETHTOOL_MSG_MODULE_RESET_ACT, module), }; const unsigned int ethnl_umsg_n_desc = ARRAY_SIZE(ethnl_umsg_desc); @@ -457,6 +458,7 @@ const struct pretty_nlmsg_desc ethnl_kmsg_desc[] = { NLMSG_DESC(ETHTOOL_MSG_MODULE_EEPROM_GET_REPLY, module_eeprom), NLMSG_DESC(ETHTOOL_MSG_MODULE_GET_REPLY, module), NLMSG_DESC(ETHTOOL_MSG_MODULE_NTF, module), + NLMSG_DESC(ETHTOOL_MSG_MODULE_RESET_NTF, module), }; const unsigned int ethnl_kmsg_n_desc = ARRAY_SIZE(ethnl_kmsg_desc); diff --git a/netlink/extapi.h b/netlink/extapi.h index 2ab4c6bc2f8d..6c294d9058ce 100644 --- a/netlink/extapi.h +++ b/netlink/extapi.h @@ -45,6 +45,7 @@ bool nl_gstats_chk(struct cmd_context *ctx); int nl_gstats(struct cmd_context *ctx); int nl_gmodule(struct cmd_context *ctx); int nl_smodule(struct cmd_context *ctx); +int nl_reset_module(struct cmd_context *ctx); int nl_monitor(struct cmd_context *ctx); int nl_getmodule(struct cmd_context *ctx); @@ -103,6 +104,7 @@ static inline void nl_monitor_usage(void) #define nl_getmodule NULL #define nl_gmodule NULL #define nl_smodule NULL +#define nl_reset_module NULL #endif /* ETHTOOL_ENABLE_NETLINK */ diff --git a/netlink/module.c b/netlink/module.c index 59a149075f0f..ae5423ff92f6 100644 --- a/netlink/module.c +++ b/netlink/module.c @@ -137,3 +137,55 @@ int nl_smodule(struct cmd_context *ctx) else return nlctx->exit_code ?: 83; } + +/* MODULE_RESET_ACT */ + +int module_reset_ntf_cb(const struct nlmsghdr *nlhdr, void *data) +{ + const struct nlattr *tb[ETHTOOL_A_MODULE_MAX + 1] = {}; + struct nl_context *nlctx = data; + DECLARE_ATTR_TB_INFO(tb); + int ret; + + ret = mnl_attr_parse(nlhdr, GENL_HDRLEN, attr_cb, &tb_info); + if (ret < 0) + return MNL_CB_OK; + nlctx->devname = get_dev_name(tb[ETHTOOL_A_MODULE_HEADER]); + if (!dev_ok(nlctx)) + return MNL_CB_OK; + + printf("\nModule reset done for %s\n", nlctx->devname); + + return MNL_CB_OK; +} + +int nl_reset_module(struct cmd_context *ctx) +{ + struct nl_context *nlctx = ctx->nlctx; + struct nl_msg_buff *msgbuff; + struct nl_socket *nlsk; + int ret; + + if (netlink_cmd_check(ctx, ETHTOOL_MSG_MODULE_RESET_ACT, false)) + return -EOPNOTSUPP; + + nlsk = nlctx->ethnl_socket; + msgbuff = &nlsk->msgbuff; + + ret = msg_init(nlctx, msgbuff, ETHTOOL_MSG_MODULE_RESET_ACT, + NLM_F_REQUEST | NLM_F_ACK); + if (ret < 0) + return 2; + if (ethnla_fill_header(msgbuff, ETHTOOL_A_MODULE_HEADER, + ctx->devname, 0)) + return -EMSGSIZE; + + ret = nlsock_sendmsg(nlsk, NULL); + if (ret < 0) + return 83; + ret = nlsock_process_reply(nlsk, nomsg_reply_cb, nlctx); + if (ret == 0) + return 0; + else + return nlctx->exit_code ?: 83; +} diff --git a/netlink/monitor.c b/netlink/monitor.c index d631907817e2..e850c3d72108 100644 --- a/netlink/monitor.c +++ b/netlink/monitor.c @@ -75,6 +75,10 @@ static struct { .cmd = ETHTOOL_MSG_MODULE_NTF, .cb = module_reply_cb, }, + { + .cmd = ETHTOOL_MSG_MODULE_RESET_NTF, + .cb = module_reset_ntf_cb, + }, }; static void clear_filter(struct nl_context *nlctx) diff --git a/netlink/netlink.h b/netlink/netlink.h index f43c1bff6a58..1e49d7f2bab3 100644 --- a/netlink/netlink.h +++ b/netlink/netlink.h @@ -92,6 +92,7 @@ int cable_test_tdr_reply_cb(const struct nlmsghdr *nlhdr, void *data); int cable_test_tdr_ntf_cb(const struct nlmsghdr *nlhdr, void *data); int fec_reply_cb(const struct nlmsghdr *nlhdr, void *data); int module_reply_cb(const struct nlmsghdr *nlhdr, void *data); +int module_reset_ntf_cb(const struct nlmsghdr *nlhdr, void *data); /* dump helpers */ diff --git a/shell-completion/bash/ethtool b/shell-completion/bash/ethtool index 5db3b4f50232..8818985f1cd9 100644 --- a/shell-completion/bash/ethtool +++ b/shell-completion/bash/ethtool @@ -1211,6 +1211,7 @@ _ethtool() [--test]=test [--set-module]=set_module [--show-module]=devname + [--reset-module]=devname ) local -A other_funcs=( [--config-ntuple]=config_nfc