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: 12426201 X-Patchwork-Delegate: mkubecek+ethtool@suse.cz 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 X-Patchwork-Delegate: mkubecek+ethtool@suse.cz X-Patchwork-State: RFC 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