From patchwork Sun Feb 18 17:06:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Lunn X-Patchwork-Id: 202811 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp870579dyc; Sun, 18 Feb 2024 09:08:07 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUsOuCYiwYBDmMne9sBsys3pNPk6xvXO4laH3nLjRWEN7aDFImpvVaDPq2ZBj7ESAE1pfBwE89VAc1HmcdrXPvyQ6TfoA== X-Google-Smtp-Source: AGHT+IE0cFPs0Kv2IffaXzRbrFZgb1kUUKDfALTAECDvsy5kFHU2N9L9QYPttgZzAegAM3OsHYrH X-Received: by 2002:a62:c1c3:0:b0:6e4:6484:1a40 with SMTP id i186-20020a62c1c3000000b006e464841a40mr345182pfg.33.1708276087788; Sun, 18 Feb 2024 09:08:07 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708276087; cv=pass; d=google.com; s=arc-20160816; b=xecTXlTTHZ18+2YPonuWFAVbhy6EWvkc3AlToLZAqo8ZupSGEVuFK/Wfb+JJH9xTr4 9Cvggv54HkTQDlUdITqDu7mtBkAz9MfVfBGj3MtP6V8JiVjU+udNLm7/J4mreJvQnXFo VQOnXFlL+Nt4DL4NFFzqT3VFhzHk0GPw/xa56UWnGaEqIezUt5+Tnp64hrdNyOnWHi/x LjfYgZRLFhM0pPjn6/rBukD1GoITmTfH52OY+RxFjhZh+l0pZOj2BLxBRlAGRe8BbnpD wFm57mUkSbV7cpAsGgtKf25pnEm/wxZhHchmFw6F3Yw8yo1NlXdoVNcnBbV6FRViiFgE i3KQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=ITSb7tuO3rZ7WMe+oWG0eu6CGb3PGXPtHfF5HKSz74c=; fh=7ogY8TTBnoDyVw0Ew02z/XaZICVahvk3b1eitAEneUQ=; b=BAb1gwIbOMsncw+4VAFF7GdKi2oDmMIeiLJyUWtV37afuokGUkdeB5iKQing125mYn AnjNq988HcWFEIeJoze3urroBNiZVog7LJWMKooMVD0L9xEC5KAInEq/ynhO2ODkVOis lLBC3GWB9v3V97m98rjAM+dpkpLvRU6mYVUB7DO+lr+WrFxLpkcVFsfYZVMwxofZRIO1 FhumXjY89cn18WGwj83+kQdIlyiXIn5zujVlB0LPC4ddKWTJgizK5kAWfVeLjvT9zr9n mmL0vNrHPz0w573O/FxNVE6ZYVXoRcqzm1Jpa2jXWNiZo347jblKPL3BX/ONKObeYsJp FeIA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=y0gADhJ2; arc=pass (i=1 spf=pass spfdomain=lunn.ch dkim=pass dkdomain=lunn.ch dmarc=pass fromdomain=lunn.ch); spf=pass (google.com: domain of linux-kernel+bounces-70447-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70447-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id q21-20020a056a00085500b006e464571dd1si213150pfk.285.2024.02.18.09.08.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Feb 2024 09:08:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-70447-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=y0gADhJ2; arc=pass (i=1 spf=pass spfdomain=lunn.ch dkim=pass dkdomain=lunn.ch dmarc=pass fromdomain=lunn.ch); spf=pass (google.com: domain of linux-kernel+bounces-70447-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70447-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 931ED28159C for ; Sun, 18 Feb 2024 17:08:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 36D306F099; Sun, 18 Feb 2024 17:07:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="y0gADhJ2" Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7E48B6EB42; Sun, 18 Feb 2024 17:07:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=156.67.10.101 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708276045; cv=none; b=ezAJuar3fD0dpOZDD+bIM5O3IHljQCGoo8u+LrdH2P/0sLOL0Nbf96JSlqJp/mUBMgWbl9C1oR8zf3b3dQUiNn4yNUHsi6mYAgx6te/E1lt2ATYNrh0Y4b3ZWH1F7GJv7b1okQ9OhkwbK+z7Vab9vBMuD6Xz7SvnW65AmOn6cGU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708276045; c=relaxed/simple; bh=z58vyTAiVnpmwvSd4SKmRIwa1d8hKd2eZxCGc/JbUCY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Hdr8rwM0qSsrpCL/IYh8GlidHEWTjl4nn09JWMWxPLey8PPWi1coXoFEl9qvQHTCrwuqiwnLQxEiUXeT5tzqz4MedYE6N99ghjrJ1iBZpjUNOV7XGf96Ph0X5cPp3xXvHx54BRBDnoPtA9S0QdztF7sn5iDlbv2EV8prMQHyMRg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch; spf=pass smtp.mailfrom=lunn.ch; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b=y0gADhJ2; arc=none smtp.client-ip=156.67.10.101 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lunn.ch DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=Cc:To:In-Reply-To:References:Message-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From:From: Sender:Reply-To:Subject:Date:Message-ID:To:Cc:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Content-Disposition: In-Reply-To:References; bh=ITSb7tuO3rZ7WMe+oWG0eu6CGb3PGXPtHfF5HKSz74c=; b=y0 gADhJ2nD+VD9ntRO9+pSVxVJihJK4ztWvpbQT+YUmhgc27/lQ9rjQQphUj3hxL+PJCuNIKPdzKbi1 rUGnm4R/3Hwqk2iC8ixQgLaBYjUlLK4FC9qTGSAuRJ8dYRYn1MHx4jXwVArH0FGXI1UHYkmaGIN8U VXZgplhxfv6RcXE=; Received: from c-76-156-36-110.hsd1.mn.comcast.net ([76.156.36.110] helo=thinkpad.home.lunn.ch) by vps0.lunn.ch with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rbkdb-0088HX-KK; Sun, 18 Feb 2024 18:07:35 +0100 From: Andrew Lunn Date: Sun, 18 Feb 2024 11:06:58 -0600 Subject: [PATCH net-next v4 1/9] net: usb: r8152: Use linkmode helpers for EEE Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240218-keee-u32-cleanup-v4-1-71f13b7c3e60@lunn.ch> References: <20240218-keee-u32-cleanup-v4-0-71f13b7c3e60@lunn.ch> In-Reply-To: <20240218-keee-u32-cleanup-v4-0-71f13b7c3e60@lunn.ch> To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Ariel Elior , Manish Chopra , Jesse Brandeburg , Tony Nguyen Cc: linux-usb@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, intel-wired-lan@lists.osuosl.org, Andrew Lunn X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=3767; i=andrew@lunn.ch; h=from:subject:message-id; bh=z58vyTAiVnpmwvSd4SKmRIwa1d8hKd2eZxCGc/JbUCY=; b=owEBbQKS/ZANAwAKAea/DcumaUyEAcsmYgBl0jk+HKMQyW8jTLx8fFX5+cCFso8ByjcOJIMo6 4/TbkAqzP6JAjMEAAEKAB0WIQRh+xAly1MmORb54bfmvw3LpmlMhAUCZdI5PgAKCRDmvw3LpmlM hDhsD/0VZtueu7oG2OuUQZRxFFuP7MW5xydhYoEO8SwuZpie8b6OSGQMWIdzj32QN4FH2nHITYu mBIzCn8TTC3uKWKLeLdnxXKawDjdK40k68UuFMwQe/8OKy1c9aYg4932yAeofhFVbVPxc3vjlC1 ObWYqjERxRibMJ1tFLRWVN7I3t8MmRUtqp1JFI68QsbAGVDqhlrZ49Sjqqz4LGXx3UTHhzawCmj MN5uFD6TMjqPQgs7J06udrzQS4N9CcvCJxDdMCY5QlA6V4F9jUhHZbBpDk+c21z+M5vKlgFtXSB NAG+ExOmAuZbpl9RedvuvryPHgHRMVJ9Qo3yeuGwcbE6hbt7pyIFR8EI/YUkQuZ4f8i7XmRqtyZ tLlUa6/t+0yzBnVj9+J8/i4BLc0b4C2Unsc6+OdBZhatd8k+G0z2LgraMf8Abm3J4f8BoVBKbE3 XWBRqSCqAs8qlfaWdSxUViw/D9VIm/saVr8iGOSb17ngu8IIfJopzk1JYfGPisTASYr5YgByBxc hjM5KMVxnEmCHpHKfOaLzv8+ZFrM7OCYdjMik9m8JF1FTrloC+ePsvFagnx+zh7Nn68fvW8YDQK BxtVSjnGegqvMFIcPtDuYOuz4ygcL0M5qc8lQq6Db3uX4zTVV8bUiUuEMy4BnRZLrIWSDNseCbV Uaczba5fABF/EtQ== X-Developer-Key: i=andrew@lunn.ch; a=openpgp; fpr=61FB1025CB53263916F9E1B7E6BF0DCBA6694C84 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791257306694917912 X-GMAIL-MSGID: 1791257306694917912 Make use of the existing linkmode helpers for converting PHY EEE register values into links modes, now that ethtool_keee uses link modes, rather than u32 values. Rework determining if EEE is active to make is similar as to how phylib decides, and make use of a phylib helper to validate if EEE is valid in for the current link mode. This then requires that PHYLIB is selected. Signed-off-by: Andrew Lunn Reviewed-by: Simon Horman --- drivers/net/usb/Kconfig | 1 + drivers/net/usb/r8152.c | 33 ++++++++++++++++----------------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/drivers/net/usb/Kconfig b/drivers/net/usb/Kconfig index 3fd7dccf0f9c..3c360d4f0635 100644 --- a/drivers/net/usb/Kconfig +++ b/drivers/net/usb/Kconfig @@ -99,6 +99,7 @@ config USB_RTL8150 config USB_RTL8152 tristate "Realtek RTL8152/RTL8153 Based USB Ethernet Adapters" select MII + select PHYLIB select CRC32 select CRYPTO select CRYPTO_HASH diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index 3d806b3ff425..6d0dc2c967c4 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -8924,30 +8925,29 @@ static void rtl8152_get_strings(struct net_device *dev, u32 stringset, u8 *data) static int r8152_get_eee(struct r8152 *tp, struct ethtool_keee *eee) { - u32 lp, adv, supported = 0; + __ETHTOOL_DECLARE_LINK_MODE_MASK(common); u16 val; val = r8152_mmd_read(tp, MDIO_MMD_PCS, MDIO_PCS_EEE_ABLE); - supported = mmd_eee_cap_to_ethtool_sup_t(val); + mii_eee_cap1_mod_linkmode_t(eee->supported, val); val = r8152_mmd_read(tp, MDIO_MMD_AN, MDIO_AN_EEE_ADV); - adv = mmd_eee_adv_to_ethtool_adv_t(val); + mii_eee_cap1_mod_linkmode_t(eee->advertised, val); val = r8152_mmd_read(tp, MDIO_MMD_AN, MDIO_AN_EEE_LPABLE); - lp = mmd_eee_adv_to_ethtool_adv_t(val); + mii_eee_cap1_mod_linkmode_t(eee->lp_advertised, val); eee->eee_enabled = tp->eee_en; - eee->eee_active = !!(supported & adv & lp); - eee->supported_u32 = supported; - eee->advertised_u32 = tp->eee_adv; - eee->lp_advertised_u32 = lp; + + linkmode_and(common, eee->advertised, eee->lp_advertised); + eee->eee_active = phy_check_valid(tp->speed, tp->duplex, common); return 0; } static int r8152_set_eee(struct r8152 *tp, struct ethtool_keee *eee) { - u16 val = ethtool_adv_to_mmd_eee_adv_t(eee->advertised_u32); + u16 val = linkmode_to_mii_eee_cap1_t(eee->advertised); tp->eee_en = eee->eee_enabled; tp->eee_adv = val; @@ -8959,23 +8959,22 @@ static int r8152_set_eee(struct r8152 *tp, struct ethtool_keee *eee) static int r8153_get_eee(struct r8152 *tp, struct ethtool_keee *eee) { - u32 lp, adv, supported = 0; + __ETHTOOL_DECLARE_LINK_MODE_MASK(common); u16 val; val = ocp_reg_read(tp, OCP_EEE_ABLE); - supported = mmd_eee_cap_to_ethtool_sup_t(val); + mii_eee_cap1_mod_linkmode_t(eee->supported, val); val = ocp_reg_read(tp, OCP_EEE_ADV); - adv = mmd_eee_adv_to_ethtool_adv_t(val); + mii_eee_cap1_mod_linkmode_t(eee->advertised, val); val = ocp_reg_read(tp, OCP_EEE_LPABLE); - lp = mmd_eee_adv_to_ethtool_adv_t(val); + mii_eee_cap1_mod_linkmode_t(eee->lp_advertised, val); eee->eee_enabled = tp->eee_en; - eee->eee_active = !!(supported & adv & lp); - eee->supported_u32 = supported; - eee->advertised_u32 = tp->eee_adv; - eee->lp_advertised_u32 = lp; + + linkmode_and(common, eee->advertised, eee->lp_advertised); + eee->eee_active = phy_check_valid(tp->speed, tp->duplex, common); return 0; } From patchwork Sun Feb 18 17:06:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Lunn X-Patchwork-Id: 202812 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp870756dyc; Sun, 18 Feb 2024 09:08:30 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCURRp5iT/JCuFr6fGy/WfG4Xl5EXcGHJ0L4urgFfCOr/VhIwJvBJEcw8pBbbxwikhbLxqOOuZZCHriA/OR9L4br+j+afg== X-Google-Smtp-Source: AGHT+IFY/Y6FCx9oxfPoQamFEHFRzZXgzKYNs4FZQ4a/uwBbm/IbGHpUAOA8/el+Sn30jqfgvBcM X-Received: by 2002:a05:6a20:d908:b0:1a0:8ce9:1575 with SMTP id jd8-20020a056a20d90800b001a08ce91575mr7357653pzb.5.1708276110327; Sun, 18 Feb 2024 09:08:30 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708276110; cv=pass; d=google.com; s=arc-20160816; b=bTpXHMsRxSSFxhklKXrYvcwrm1oLMc45u80+wq/Us6V7eE6rRwEJ/H+d+UdUIzQzX1 +5ibJqMPcOexutzWAo1dNMcLyx661yn7WZt6du/zpKxF00VuBkRNbenBcs0YDZ+09Ncq 9B30PyDDakV7AEDsAGixfttfv6AoUbIRT2DYOypqVzt62DNfuMfcsd6GBUbqsZf0K012 GSvbBV4g0yI7VsMi3lfXdIMqRThVh6OPswZpuoVfpiERngX6ivtEQ1JxCA7VBVGEAxoO UmU0QR3lQGydBcJFG+9WHs0c2NFThPT7zEwasuboFTCof2BcQrxTBE0rqv/hZ+i+Z36G pEzg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=sauFk9hjjr6pfRUCRoWd8WYck0QUyoBECM2fduhdkgE=; fh=7ogY8TTBnoDyVw0Ew02z/XaZICVahvk3b1eitAEneUQ=; b=LWkBUUSYaTT3cFSuSopP1GJ+8L0TVVGIXHuZETKb8IK4uyBOSS/CGIP1MiISVRDTtp 7NcmDUcI2S7Jd3cnOgpllxfFQ9C7YMTJEwAe7DNtpFaOPbzAHG+i7HJXSCTRNCgcMhG0 9iIxFtFy+j+vFYEUyy6snMHk/3bSGlSdiGS4/TjCDuMAz8d+iYeoY5PMRFong8ynhAql wV3QTapF0VOo5UEO+prU5Fp0lP0JN/9VimmWDW5r1/HRr09M2vDhxsTZ/6aynYAZF6FP /YvoSu8/Rb/SHlxd/IBYmLlpYZauN6ThYYr8jUtkPMj8weF/fujIzmNWwyY23OpO6CdS cznA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=2OCcl4n5; arc=pass (i=1 spf=pass spfdomain=lunn.ch dkim=pass dkdomain=lunn.ch dmarc=pass fromdomain=lunn.ch); spf=pass (google.com: domain of linux-kernel+bounces-70449-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70449-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d25-20020a637359000000b005cdf8b03384si3117730pgn.805.2024.02.18.09.08.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Feb 2024 09:08:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-70449-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=2OCcl4n5; arc=pass (i=1 spf=pass spfdomain=lunn.ch dkim=pass dkdomain=lunn.ch dmarc=pass fromdomain=lunn.ch); spf=pass (google.com: domain of linux-kernel+bounces-70449-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70449-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 276442817F9 for ; Sun, 18 Feb 2024 17:08:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 693D76F52F; Sun, 18 Feb 2024 17:07:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="2OCcl4n5" Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 45FA26EB70; Sun, 18 Feb 2024 17:07:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=156.67.10.101 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708276047; cv=none; b=Z6vKF4b3BNw6KorBSimjVP/7A/f4WpvrdF+QTM9he6tFgaLBOHr/plriemaBfI5EUA1GrC9v/ObxtfmoQC3R3na/mDfY/FBPv7LHUaj6HaqPXRTu2qjvgykbk9tgwMpdzBUxl02sXB441amFwFQw3fC1Heu8M7Z91FiTucaNNw0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708276047; c=relaxed/simple; bh=Cpjch1b1D9Jp2vWORWgwbDnErRScd5QZqvv0qT6yMzg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=cBvo8KuF6Ay61rNse+hUa51IaIg2xoOddgB/rPZpV+Bhh75mDHSEFRTI7iuZEE4RHqkB/jTFasSngYNLsZJB8m72QeinQZbFj8kY49RPFN+i18XPcmW/x0LresjzubJ7rrKoyMAEoqz23xkoBSeJ1c/7mru30nLBY8rKENh3Gf8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch; spf=pass smtp.mailfrom=lunn.ch; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b=2OCcl4n5; arc=none smtp.client-ip=156.67.10.101 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lunn.ch DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=Cc:To:In-Reply-To:References:Message-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From:From: Sender:Reply-To:Subject:Date:Message-ID:To:Cc:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Content-Disposition: In-Reply-To:References; bh=sauFk9hjjr6pfRUCRoWd8WYck0QUyoBECM2fduhdkgE=; b=2O Ccl4n55jUdwRe7EWrtEpeQbvEYWSaCFLsjWlnk/PNFz/j36fameT2OMiA5WABrYUcdnhoZ7MQGjn6 qNKH3EciRCsNogU0ZUmsUPKultQ7do8thkeajQaEOSgpKbF3pAI/uG4jlVo8plbOUzSos+Wwn7Ocf ptTb6tDXe+gw21A=; Received: from c-76-156-36-110.hsd1.mn.comcast.net ([76.156.36.110] helo=thinkpad.home.lunn.ch) by vps0.lunn.ch with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rbkde-0088HX-TH; Sun, 18 Feb 2024 18:07:39 +0100 From: Andrew Lunn Date: Sun, 18 Feb 2024 11:06:59 -0600 Subject: [PATCH net-next v4 2/9] net: usb: ax88179_178a: Use linkmode helpers for EEE Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240218-keee-u32-cleanup-v4-2-71f13b7c3e60@lunn.ch> References: <20240218-keee-u32-cleanup-v4-0-71f13b7c3e60@lunn.ch> In-Reply-To: <20240218-keee-u32-cleanup-v4-0-71f13b7c3e60@lunn.ch> To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Ariel Elior , Manish Chopra , Jesse Brandeburg , Tony Nguyen Cc: linux-usb@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, intel-wired-lan@lists.osuosl.org, Andrew Lunn X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=2018; i=andrew@lunn.ch; h=from:subject:message-id; bh=Cpjch1b1D9Jp2vWORWgwbDnErRScd5QZqvv0qT6yMzg=; b=owEBbQKS/ZANAwAKAea/DcumaUyEAcsmYgBl0jk/F2ghMvHESY0ii+p6xLvRfuLi547nM6+PW XzeryVvpmaJAjMEAAEKAB0WIQRh+xAly1MmORb54bfmvw3LpmlMhAUCZdI5PwAKCRDmvw3LpmlM hImtEACou5MOgMSpSoKsDBGzpdDNAR4w+EcZv+ZP4gwiptwXGhZmTI6O9i3noKdzuT6+XAzke3v pgZoDmx3JS+HifsFTz3nNFL1DXmbuZsnZH1Fo8rxo0EZlRVbry1x6DKiGjuttPI8M6KAEYMm7kC gU3Tsokri+d8YxEj5FA69kP6y7dIp67l9g0JMhttq53+5ckwmoyDQKfhGXRZl9kTDSBXaO9I462 xwCSbCj9tJuD+Wv63yLLunQbbwZzxdUcevB06u9B5GljdDsjAaV7GuqGDDOP95kHSvlahGT9PW/ efMRQwYms+6vHmeWnT23Oyig2WtUntvJvnVnhgBg26Q+RldejplSlAgpe6Wd3zH37IxkWJ/45rF QiP7P9oscACkPhiJlBS7ndsTZISSPLRvcjrhv/98Czar4qhSM6VXgl96YWS0sGt9VDS4/oU0vsV WslNc7Lqrw/ZpZxZQF3FKYlx9NrhhRVbtaViK+j6f4eBp4XoprBCn6j8kPWQl9zOXELPMCPMFGw qiIRX4P8Agzf4R5axmnt0daBoyq06mPrieH2ydyczzb/OLkIaQLzIqqqPityuHq4Ni3PrhCS31m iRfAOyYDg+21U3Y+YqyapOAyGEdJMvavQQnEWQpnIrbq/ECwrqeN/ExHRU0YFGpPGxq13+RuTpK ezQxjoPNwKgB93Q== X-Developer-Key: i=andrew@lunn.ch; a=openpgp; fpr=61FB1025CB53263916F9E1B7E6BF0DCBA6694C84 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791257330610180556 X-GMAIL-MSGID: 1791257330610180556 Make use of the existing linkmode helpers for converting PHY EEE register values into links modes, now that ethtool_keee uses link modes, rather than u32 values. Signed-off-by: Andrew Lunn --- drivers/net/usb/ax88179_178a.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/net/usb/ax88179_178a.c b/drivers/net/usb/ax88179_178a.c index d6168eaa286f..d4bf9865d87b 100644 --- a/drivers/net/usb/ax88179_178a.c +++ b/drivers/net/usb/ax88179_178a.c @@ -676,21 +676,21 @@ ax88179_ethtool_get_eee(struct usbnet *dev, struct ethtool_keee *data) MDIO_MMD_PCS); if (val < 0) return val; - data->supported_u32 = mmd_eee_cap_to_ethtool_sup_t(val); + mii_eee_cap1_mod_linkmode_t(data->supported, val); /* Get advertisement EEE */ val = ax88179_phy_read_mmd_indirect(dev, MDIO_AN_EEE_ADV, MDIO_MMD_AN); if (val < 0) return val; - data->advertised_u32 = mmd_eee_adv_to_ethtool_adv_t(val); + mii_eee_cap1_mod_linkmode_t(data->advertised, val); /* Get LP advertisement EEE */ val = ax88179_phy_read_mmd_indirect(dev, MDIO_AN_EEE_LPABLE, MDIO_MMD_AN); if (val < 0) return val; - data->lp_advertised_u32 = mmd_eee_adv_to_ethtool_adv_t(val); + mii_eee_cap1_mod_linkmode_t(data->lp_advertised, val); return 0; } @@ -698,7 +698,7 @@ ax88179_ethtool_get_eee(struct usbnet *dev, struct ethtool_keee *data) static int ax88179_ethtool_set_eee(struct usbnet *dev, struct ethtool_keee *data) { - u16 tmp16 = ethtool_adv_to_mmd_eee_adv_t(data->advertised_u32); + u16 tmp16 = linkmode_to_mii_eee_cap1_t(data->advertised); return ax88179_phy_write_mmd_indirect(dev, MDIO_AN_EEE_ADV, MDIO_MMD_AN, tmp16); @@ -1663,7 +1663,6 @@ static int ax88179_reset(struct usbnet *dev) ax88179_disable_eee(dev); ax88179_ethtool_get_eee(dev, &eee_data); - eee_data.advertised_u32 = 0; ax88179_ethtool_set_eee(dev, &eee_data); /* Restart autoneg */ From patchwork Sun Feb 18 17:07:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Lunn X-Patchwork-Id: 202813 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp870939dyc; Sun, 18 Feb 2024 09:08:52 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXuMGyHSe2bcgc1Qe6RMYSE45Em4BEa8Fm//F+SgmVGjcCft+wjnr99NR9iQEcOj3cfQ4kbb7mTDrxELWZw3IPGFNZHWg== X-Google-Smtp-Source: AGHT+IFCPY2O9k3NvUNuT/5qS32Eza/nuYI+reI+Qrg6n4z4Ddosr730AX+L+zp6lsrhWzhQivPW X-Received: by 2002:a05:6a20:e198:b0:19c:a8a8:5c7b with SMTP id ks24-20020a056a20e19800b0019ca8a85c7bmr13327760pzb.56.1708276132079; Sun, 18 Feb 2024 09:08:52 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708276132; cv=pass; d=google.com; s=arc-20160816; b=Yhy2/zffwwpzsaEJ55Km+OjbYtrM3Gxl28ueB0OuMt+cZ7DDKdJEVWVGA3P0AB15TC DJi1vELkySkDpzCrjrzdvQ7jlABSdoIceYiWkQz+0q6QHIgjjYLshFMdwbfTyRyZ1Gy2 SKbDgSN1MTxVW9iMP05KqlKoP+0uS9aLeTQhyp5Nzun3MJzLBCG+yXQmspLLoiaKG7pl Nfb+oXVRbtCeC4TTJeKBlQGLNamck4ZQit5OngWAqZlAwmEWA0kGO013vREtf34RamU/ jErrn2alNI2bIRPqZZsjx3ZRpz+XzQsOROEvTruulWh9c8e9bYF2twu+qRiaET5Fj3Jm fbCg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=bgkZPYVA0V4hJb/XgJ4JlLp2dhut1zemAO++lcwUguU=; fh=7ogY8TTBnoDyVw0Ew02z/XaZICVahvk3b1eitAEneUQ=; b=SdxHhP9lmsq5xo9q+mWaNYCHFTUHm4C9VPz5EgWzCpindqU/mZfCfGl12YYDnOMZcA K6SoFT0pd2+9MIRhrsZ8GwnjWKeqmlTtbtj8f5pfI3q8HoGpRQUryPvWTm2ahMwxqc1/ E+GR24ogHj29KPDi4319/ssZhNNPHYR3qJ90XMRtIb7fFOxbJyHH4d/WKeXjbjrgAVMR 779j7WIlLRozyJdtqsbiiknYKfoLGR6D6DuOxYOSvLl4BQFR35mPXXZapfIyrnYXLWO0 Mp6iPrfxQRWc1s2cdGLaqbYPYrb984a8BQ8oggm4y83wWgvWD2wO2s5CEZoS3ewrmWI+ BJjw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=1K1pI2yL; arc=pass (i=1 spf=pass spfdomain=lunn.ch dkim=pass dkdomain=lunn.ch dmarc=pass fromdomain=lunn.ch); spf=pass (google.com: domain of linux-kernel+bounces-70450-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70450-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id i4-20020a62c104000000b006e2a6c63114si2742657pfg.98.2024.02.18.09.08.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Feb 2024 09:08:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-70450-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=1K1pI2yL; arc=pass (i=1 spf=pass spfdomain=lunn.ch dkim=pass dkdomain=lunn.ch dmarc=pass fromdomain=lunn.ch); spf=pass (google.com: domain of linux-kernel+bounces-70450-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70450-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id DA74C2817E8 for ; Sun, 18 Feb 2024 17:08:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3E93E6FBB8; Sun, 18 Feb 2024 17:07:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="1K1pI2yL" Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8727D6F523; Sun, 18 Feb 2024 17:07:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=156.67.10.101 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708276051; cv=none; b=OlblD4zTco3xEMOSqm4wstZqtoS8kTWgzfWye3LjLI2YZpRaGJW/FNps4PQIE4tZY0/tawEYcEk/tlgBJHX8mdk4kK97xx9F5l5Zxj2t/w4kX7CV80/aZtBMQa7/nQZO0Dyw1mDzk/D9S7ATo5EVDLnrJl5mjAjl+ElpZDd9umA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708276051; c=relaxed/simple; bh=w1DJYkt9FTZRnNhfN8ZM1D8JVVgGCSqPVVQnR9uVLaE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=HZsm3FeEX9KLQLexNunesXOKr+o3N9eQ8gN3L3gg+IXkMsU1Tlv6t11A16m2JOqZCgYq0z8SEPo5tbfrsxexH200MRhjX+SKnRpy6oqaXfo1MN9d+A87TGn69ODP5qb3WYduF/4qx32dyIcWKMK94QQ8qJkEZ29doMsy4sQbWkY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch; spf=pass smtp.mailfrom=lunn.ch; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b=1K1pI2yL; arc=none smtp.client-ip=156.67.10.101 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lunn.ch DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=Cc:To:In-Reply-To:References:Message-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From:From: Sender:Reply-To:Subject:Date:Message-ID:To:Cc:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Content-Disposition: In-Reply-To:References; bh=bgkZPYVA0V4hJb/XgJ4JlLp2dhut1zemAO++lcwUguU=; b=1K 1pI2yL1HTdd4PpgYvUcLr1D4ZokyrE+DqWWMehQALML51P/jeuKwecCH9Cz6s1wYB6ICqJlD3akYm tBR8tae4XKVKIDACd+alPVy20u1miv9CBMohRbqBnd+NvRjJXyACirbroxQ2aqSNhwz3tndH8k5cB YTKsTCgYx+7nRzU=; Received: from c-76-156-36-110.hsd1.mn.comcast.net ([76.156.36.110] helo=thinkpad.home.lunn.ch) by vps0.lunn.ch with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rbkdi-0088HX-5y; Sun, 18 Feb 2024 18:07:42 +0100 From: Andrew Lunn Date: Sun, 18 Feb 2024 11:07:00 -0600 Subject: [PATCH net-next v4 3/9] net: qlogic: qede: Use linkmode helpers for EEE Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240218-keee-u32-cleanup-v4-3-71f13b7c3e60@lunn.ch> References: <20240218-keee-u32-cleanup-v4-0-71f13b7c3e60@lunn.ch> In-Reply-To: <20240218-keee-u32-cleanup-v4-0-71f13b7c3e60@lunn.ch> To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Ariel Elior , Manish Chopra , Jesse Brandeburg , Tony Nguyen Cc: linux-usb@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, intel-wired-lan@lists.osuosl.org, Andrew Lunn X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=4430; i=andrew@lunn.ch; h=from:subject:message-id; bh=w1DJYkt9FTZRnNhfN8ZM1D8JVVgGCSqPVVQnR9uVLaE=; b=owEBbQKS/ZANAwAKAea/DcumaUyEAcsmYgBl0jk/THr+M7mqP78nd5RzXdgWbvVTgHvJlsuzZ 7xMAtGlnIyJAjMEAAEKAB0WIQRh+xAly1MmORb54bfmvw3LpmlMhAUCZdI5PwAKCRDmvw3LpmlM hJmqD/9WSvEPicM7UdEiBWGqw0w4cGuTLUuz25fQ3n29OdGUaVYCr2VYuHokkMHu+iDDzeKeGs1 GFn3hbEHUEu5uO4mId0kpOshj7qnLJkRF/GJD7gfDv5MRs/gn0W8KPt6AFzo/fMVLDowRyTRYLE 0kHmInQL0X3fZ0hXnFxruoCRocDSZetF3/dhXT0aL8TilTCGdDw8PxI1Rrd04utZQjcHaRcGvtz ZOnQWCgoVBXWJEj+f1Z1EJPod/rfSgMNwUdSQr2GFqh3S0Z5RTrhdzcVjxhosv19Qo+YWZIbkYo TvSzCGxj49H5KKyUC+wrKWmT+zamSdimTgKuGQKPJzsUJDaiKhnrYSzA7OLxBgSulMF6/DNiEPo WdH/pV0G0iVvqAG3FXHW3lXUKnbJIocMv+kWbWcPFQDRLQ1cyKWf6xruDzxpobvufh3ijZUBEJn /w8PtRojxHjkDJmaVXYBrOhneeIPKknMIRrV/HOtbswVZr9oQHcF/ncYh1n5exunSw3DxajAGqb WMetkaduMV4wDiMGcuYUB49tFuJAU7EvOpGlfamHRjH41lJxUPJ6Fh/soEmxkpRcBVTHdAjEIYH ci62RNrD/fw06aWHRp+WiY8wkGdRmoQE2B/F7B/QYktOTTQgXS0HtzDx4rywQt9Tdh7iih83BpJ gn0oVlqnxxNq0TA== X-Developer-Key: i=andrew@lunn.ch; a=openpgp; fpr=61FB1025CB53263916F9E1B7E6BF0DCBA6694C84 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791257353380663071 X-GMAIL-MSGID: 1791257353380663071 Make use of the existing linkmode helpers for bit manipulation of EEE advertise, support and link partner support. The aim is to drop the restricted _u32 variants in the near future. Signed-off-by: Andrew Lunn Reviewed-by: Simon Horman --- drivers/net/ethernet/qlogic/qede/qede_ethtool.c | 60 ++++++++++++++++--------- 1 file changed, 38 insertions(+), 22 deletions(-) diff --git a/drivers/net/ethernet/qlogic/qede/qede_ethtool.c b/drivers/net/ethernet/qlogic/qede/qede_ethtool.c index dfa15619fd78..ae3ebf0cf999 100644 --- a/drivers/net/ethernet/qlogic/qede/qede_ethtool.c +++ b/drivers/net/ethernet/qlogic/qede/qede_ethtool.c @@ -1789,18 +1789,26 @@ static int qede_get_eee(struct net_device *dev, struct ethtool_keee *edata) return -EOPNOTSUPP; } - if (current_link.eee.adv_caps & QED_EEE_1G_ADV) - edata->advertised_u32 = ADVERTISED_1000baseT_Full; - if (current_link.eee.adv_caps & QED_EEE_10G_ADV) - edata->advertised_u32 |= ADVERTISED_10000baseT_Full; - if (current_link.sup_caps & QED_EEE_1G_ADV) - edata->supported_u32 = ADVERTISED_1000baseT_Full; - if (current_link.sup_caps & QED_EEE_10G_ADV) - edata->supported_u32 |= ADVERTISED_10000baseT_Full; - if (current_link.eee.lp_adv_caps & QED_EEE_1G_ADV) - edata->lp_advertised_u32 = ADVERTISED_1000baseT_Full; - if (current_link.eee.lp_adv_caps & QED_EEE_10G_ADV) - edata->lp_advertised_u32 |= ADVERTISED_10000baseT_Full; + linkmode_mod_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT, + edata->advertised, + current_link.eee.adv_caps & QED_EEE_1G_ADV); + linkmode_mod_bit(ETHTOOL_LINK_MODE_10000baseT_Full_BIT, + edata->advertised, + current_link.eee.adv_caps & QED_EEE_10G_ADV); + + linkmode_mod_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT, + edata->supported, + current_link.sup_caps & QED_EEE_1G_ADV); + linkmode_mod_bit(ETHTOOL_LINK_MODE_10000baseT_Full_BIT, + edata->supported, + current_link.sup_caps & QED_EEE_10G_ADV); + + linkmode_mod_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT, + edata->lp_advertised, + current_link.eee.lp_adv_caps & QED_EEE_1G_ADV); + linkmode_mod_bit(ETHTOOL_LINK_MODE_10000baseT_Full_BIT, + edata->lp_advertised, + current_link.eee.lp_adv_caps & QED_EEE_10G_ADV); edata->tx_lpi_timer = current_link.eee.tx_lpi_timer; edata->eee_enabled = current_link.eee.enable; @@ -1812,9 +1820,12 @@ static int qede_get_eee(struct net_device *dev, struct ethtool_keee *edata) static int qede_set_eee(struct net_device *dev, struct ethtool_keee *edata) { + __ETHTOOL_DECLARE_LINK_MODE_MASK(supported) = {}; + __ETHTOOL_DECLARE_LINK_MODE_MASK(tmp) = {}; struct qede_dev *edev = netdev_priv(dev); struct qed_link_output current_link; struct qed_link_params params; + bool unsupp; if (!edev->ops->common->can_link_change(edev->cdev)) { DP_INFO(edev, "Link settings are not allowed to be changed\n"); @@ -1832,21 +1843,26 @@ static int qede_set_eee(struct net_device *dev, struct ethtool_keee *edata) memset(¶ms, 0, sizeof(params)); params.override_flags |= QED_LINK_OVERRIDE_EEE_CONFIG; - if (!(edata->advertised_u32 & (ADVERTISED_1000baseT_Full | - ADVERTISED_10000baseT_Full)) || - ((edata->advertised_u32 & (ADVERTISED_1000baseT_Full | - ADVERTISED_10000baseT_Full)) != - edata->advertised_u32)) { + linkmode_set_bit(ETHTOOL_LINK_MODE_10000baseT_Full_BIT, + supported); + linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT, + supported); + + unsupp = linkmode_andnot(tmp, edata->advertised, supported); + if (unsupp) { DP_VERBOSE(edev, QED_MSG_DEBUG, - "Invalid advertised capabilities %d\n", - edata->advertised_u32); + "Invalid advertised capabilities %*pb\n", + __ETHTOOL_LINK_MODE_MASK_NBITS, edata->advertised); return -EINVAL; } - if (edata->advertised_u32 & ADVERTISED_1000baseT_Full) + if (linkmode_test_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT, + edata->advertised)) params.eee.adv_caps = QED_EEE_1G_ADV; - if (edata->advertised_u32 & ADVERTISED_10000baseT_Full) - params.eee.adv_caps |= QED_EEE_10G_ADV; + if (linkmode_test_bit(ETHTOOL_LINK_MODE_10000baseT_Full_BIT, + edata->advertised)) + params.eee.adv_caps = QED_EEE_10G_ADV; + params.eee.enable = edata->eee_enabled; params.eee.tx_lpi_enable = edata->tx_lpi_enabled; params.eee.tx_lpi_timer = edata->tx_lpi_timer; From patchwork Sun Feb 18 17:07:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Lunn X-Patchwork-Id: 202814 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp871081dyc; Sun, 18 Feb 2024 09:09:15 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXR3Ku2TEs+tJR4n6lEUlWJhx+di8ZXbVMw1kG7dzRkaVNjAjHc/gscC3NPcvfhFf3UPqU1SXjyYPoaV29tPbpiLhPZtw== X-Google-Smtp-Source: AGHT+IF4ztcgsH4z8hvqVsdWtbIpjDI+G4cag+fX6gfR00uF+lxaimMfNkf39R2ziWh9czjDtqNW X-Received: by 2002:a92:b74d:0:b0:365:1eda:df6e with SMTP id c13-20020a92b74d000000b003651edadf6emr4826687ilm.26.1708276155209; Sun, 18 Feb 2024 09:09:15 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708276155; cv=pass; d=google.com; s=arc-20160816; b=bgWPyUOLBjo1of3beQVYRcEsItqk9UsS6+8X8XKmZ3lrYSjRdduT1jttS45j6UUj+G 3De+AV+wX4b31EC8s36Sx3csYPIF1xwCO3doRxrHmZqqYNG3XpJzfetsXmEXq9hqtO9c YS7XFzAOybuv1paV3ydoBRPHJ0nLqjT8FTN46Qt7QyzM95idzAfbRm1F0KepFV/1TexP t3Aly7uRGFKdnXLuGS5L4c57ex3pttD9aDxmTs7yQ58nGKqU3MbhFTmZnw+OLxHiW+ne MXv9Kv82myK77n3HMkHEgPqvNlHS4YqNEAKZUvOQRmoesqGOaGVREdCEpsNYSMK/uxn9 dnlA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=N1CZYG16uNIIX1bzINMMJKicgWAqJc4xUccwHeGoHyI=; fh=7ogY8TTBnoDyVw0Ew02z/XaZICVahvk3b1eitAEneUQ=; b=z6FH1EpxN4quKjj6HYNs2BdyrAiGJgrrDpM0PQoIFTDqzBepge87zo3+wsVi9R61Ys h71uicu4u+nldLuzebv+IOyYbzzl8nxsrjr6UQ/c++1yD2qK0QkX8sw4fSm1j6RCKae0 S3qr9aRFp0uUZDgk+LFwWO1Bq/Ue4FzBwIbTS18MYZjviH2Pe6ANxxXxaSmYnL9OP/s2 2ayknpQQJvR2zHa5eez3jNUG1+yH8STs/sEnwgswb7HrkBArO8YpraQAyh2HBh62LhpG N8Vofp4iwoERO74MhmMBzPPxXdh8bYP1R8jZ+ZSGz42/u9cexXuQfjZSKnXqMAD8dS82 qdUQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=XxDDd35v; arc=pass (i=1 spf=pass spfdomain=lunn.ch dkim=pass dkdomain=lunn.ch dmarc=pass fromdomain=lunn.ch); spf=pass (google.com: domain of linux-kernel+bounces-70451-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70451-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id o30-20020a63731e000000b005c625d44bd5si3188408pgc.281.2024.02.18.09.09.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Feb 2024 09:09:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-70451-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=XxDDd35v; arc=pass (i=1 spf=pass spfdomain=lunn.ch dkim=pass dkdomain=lunn.ch dmarc=pass fromdomain=lunn.ch); spf=pass (google.com: domain of linux-kernel+bounces-70451-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70451-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 064DF2817FF for ; Sun, 18 Feb 2024 17:09:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 133E271B5A; Sun, 18 Feb 2024 17:07:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="XxDDd35v" Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E2D1371B2A; Sun, 18 Feb 2024 17:07:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=156.67.10.101 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708276055; cv=none; b=rMbsHeW93AdOF82ogKYhT4/RG9hRQcBYvo2pCQupopZq3TNEuFY2nIgO/kU3GPPeRFY4o2xNsFB/L1zYFfmAYOAbi2VoAfj5Alcl7DjmS1FtqUfUVgLStGaCfM3y2xRLJTN/O9gf/egRtXZ81GuB0rqAo1vA+CnREpzNjhaS9vk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708276055; c=relaxed/simple; bh=6WQbQolAq5WAPWukfrjltstk+z0qZj+AW55w271U/ic=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=YFyxFyVXM/UUZsz05RiMLhRJwfr5g+KfbmCcwuB55EMWaQyl25ZojFUsJUStJZl9blgjfPb/h73jvuaAruvWV4z+MixKPAX9bpT8mvSHRQ6oRvJ/2Y3isfhAl2StOtKz6RK5ZWIVHAZgRSu2+Qu1oEE/WqS3tQXXLoCrgwfDcc0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch; spf=pass smtp.mailfrom=lunn.ch; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b=XxDDd35v; arc=none smtp.client-ip=156.67.10.101 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lunn.ch DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=Cc:To:In-Reply-To:References:Message-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From:From: Sender:Reply-To:Subject:Date:Message-ID:To:Cc:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Content-Disposition: In-Reply-To:References; bh=N1CZYG16uNIIX1bzINMMJKicgWAqJc4xUccwHeGoHyI=; b=Xx DDd35vWHSpe2eHQgGadIQYLkiyd/X9oZ56Su//nw0DIn/TVuzr6yb9V0JiquXhPu8wSaJU859Brz0 Tuhic6lp6/hJDJEJI41TRguDA69u1VgsbTrc9LChppOx7qvVsmzOQzjnKlObYh210/XWA5r4bWB7O s6LL7iYsboT3YNo=; Received: from c-76-156-36-110.hsd1.mn.comcast.net ([76.156.36.110] helo=thinkpad.home.lunn.ch) by vps0.lunn.ch with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rbkdl-0088HX-Eq; Sun, 18 Feb 2024 18:07:45 +0100 From: Andrew Lunn Date: Sun, 18 Feb 2024 11:07:01 -0600 Subject: [PATCH net-next v4 4/9] net: ethernet: ixgbe: Convert EEE to use linkmodes Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240218-keee-u32-cleanup-v4-4-71f13b7c3e60@lunn.ch> References: <20240218-keee-u32-cleanup-v4-0-71f13b7c3e60@lunn.ch> In-Reply-To: <20240218-keee-u32-cleanup-v4-0-71f13b7c3e60@lunn.ch> To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Ariel Elior , Manish Chopra , Jesse Brandeburg , Tony Nguyen Cc: linux-usb@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, intel-wired-lan@lists.osuosl.org, Andrew Lunn X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=4488; i=andrew@lunn.ch; h=from:subject:message-id; bh=6WQbQolAq5WAPWukfrjltstk+z0qZj+AW55w271U/ic=; b=owEBbQKS/ZANAwAKAea/DcumaUyEAcsmYgBl0jk/JERCgT2kg8FeEjUP6X0L62pRTwhM7DEPs 9WJvJelC/yJAjMEAAEKAB0WIQRh+xAly1MmORb54bfmvw3LpmlMhAUCZdI5PwAKCRDmvw3LpmlM hJE0D/sG4wq05q/2ZX9eEb5KvXIuYsdHoSNXUJnEf5z0+/BaDswOC8aGxcT0zhxEvZ82AyqHARW r3PGnlOTahAFVkdDg8jo+zWDpQeIQz/o0uTPTq69aUCn4lWAE5LjOlskkN1H6i43QNjSxRTjHWs 3Q7Wa/73w2GBnsWYqDI1eeBhNxHgGcR5X85m0PMU2mBiBm1kUglcCB+6nkaA39SvrxHms5Xprop FCfDhSeUuQsT0nmibaa+bk9zQod90pVnP4/I+lT9mLotA/NfEe82P7LINr9lf9QBuEqvYDsn+4a 0wtooO1K8SWmgvBMD1uMsEFT0bLQGw/i6TwmiX5oKSamfi5Kpi/MJH6v1LF1HY8Smpg/uJzcL/a dppr5lcdlvdY/Cx/LFIEJhgQ0GrKI+l8Pdtdkl3hv5LuFr/UF/1KVlj4Sq8Nz2CMkNfy0lqwSyB k6LgwGGN9s73364DlFY/UGDNIiwJ7LcjREpS7fIiCTMqZ1cQPQLRHT6ujFAMByPe5dhVpBhUfFh LZqcDgUeFLSGO8hKjfEZbaDB3XgZEGPOPKjgsACpwDYqNAQK2hdH8Cc79j14Afzh1DXC+AYiURS 2VcRoxUiJJs73zQsKUfsALFj2betp6be4uQBvSDegthjGW9tcAxsiLj4/qIufVPjaCF0hR+7rVA v+0K2l5FCH9zAkw== X-Developer-Key: i=andrew@lunn.ch; a=openpgp; fpr=61FB1025CB53263916F9E1B7E6BF0DCBA6694C84 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791257377459890029 X-GMAIL-MSGID: 1791257377459890029 Convert the tables to make use of ETHTOOL link mode bits, rather than the old u32 SUPPORTED speeds. Make use of the linkmode helps to set bits and compare linkmodes. As a result, the _u32 members of keee are no longer used, a step towards removing them. Signed-off-by: Andrew Lunn --- drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 48 ++++++++++++------------ 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c index b1e7338a4ed1..a0879f125146 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c @@ -3403,30 +3403,31 @@ static int ixgbe_get_module_eeprom(struct net_device *dev, static const struct { ixgbe_link_speed mac_speed; - u32 supported; + u32 link_mode; } ixgbe_ls_map[] = { - { IXGBE_LINK_SPEED_10_FULL, SUPPORTED_10baseT_Full }, - { IXGBE_LINK_SPEED_100_FULL, SUPPORTED_100baseT_Full }, - { IXGBE_LINK_SPEED_1GB_FULL, SUPPORTED_1000baseT_Full }, - { IXGBE_LINK_SPEED_2_5GB_FULL, SUPPORTED_2500baseX_Full }, - { IXGBE_LINK_SPEED_10GB_FULL, SUPPORTED_10000baseT_Full }, + { IXGBE_LINK_SPEED_10_FULL, ETHTOOL_LINK_MODE_10baseT_Full_BIT }, + { IXGBE_LINK_SPEED_100_FULL, ETHTOOL_LINK_MODE_100baseT_Full_BIT }, + { IXGBE_LINK_SPEED_1GB_FULL, ETHTOOL_LINK_MODE_1000baseT_Full_BIT }, + { IXGBE_LINK_SPEED_2_5GB_FULL, ETHTOOL_LINK_MODE_2500baseX_Full_BIT }, + { IXGBE_LINK_SPEED_10GB_FULL, ETHTOOL_LINK_MODE_10000baseT_Full_BIT }, }; static const struct { u32 lp_advertised; - u32 mac_speed; + u32 link_mode; } ixgbe_lp_map[] = { - { FW_PHY_ACT_UD_2_100M_TX_EEE, SUPPORTED_100baseT_Full }, - { FW_PHY_ACT_UD_2_1G_T_EEE, SUPPORTED_1000baseT_Full }, - { FW_PHY_ACT_UD_2_10G_T_EEE, SUPPORTED_10000baseT_Full }, - { FW_PHY_ACT_UD_2_1G_KX_EEE, SUPPORTED_1000baseKX_Full }, - { FW_PHY_ACT_UD_2_10G_KX4_EEE, SUPPORTED_10000baseKX4_Full }, - { FW_PHY_ACT_UD_2_10G_KR_EEE, SUPPORTED_10000baseKR_Full}, + { FW_PHY_ACT_UD_2_100M_TX_EEE, ETHTOOL_LINK_MODE_100baseT_Full_BIT }, + { FW_PHY_ACT_UD_2_1G_T_EEE, ETHTOOL_LINK_MODE_1000baseT_Full_BIT }, + { FW_PHY_ACT_UD_2_10G_T_EEE, ETHTOOL_LINK_MODE_10000baseT_Full_BIT }, + { FW_PHY_ACT_UD_2_1G_KX_EEE, ETHTOOL_LINK_MODE_1000baseKX_Full_BIT }, + { FW_PHY_ACT_UD_2_10G_KX4_EEE, ETHTOOL_LINK_MODE_10000baseKX4_Full_BIT }, + { FW_PHY_ACT_UD_2_10G_KR_EEE, ETHTOOL_LINK_MODE_10000baseKR_Full_BIT}, }; static int ixgbe_get_eee_fw(struct ixgbe_adapter *adapter, struct ethtool_keee *edata) { + __ETHTOOL_DECLARE_LINK_MODE_MASK(common); u32 info[FW_PHY_ACT_DATA_COUNT] = { 0 }; struct ixgbe_hw *hw = &adapter->hw; int rc; @@ -3436,28 +3437,29 @@ ixgbe_get_eee_fw(struct ixgbe_adapter *adapter, struct ethtool_keee *edata) if (rc) return rc; - edata->lp_advertised_u32 = 0; for (i = 0; i < ARRAY_SIZE(ixgbe_lp_map); ++i) { if (info[0] & ixgbe_lp_map[i].lp_advertised) - edata->lp_advertised_u32 |= ixgbe_lp_map[i].mac_speed; + linkmode_set_bit(ixgbe_lp_map[i].link_mode, + edata->lp_advertised); } - edata->supported_u32 = 0; for (i = 0; i < ARRAY_SIZE(ixgbe_ls_map); ++i) { if (hw->phy.eee_speeds_supported & ixgbe_ls_map[i].mac_speed) - edata->supported_u32 |= ixgbe_ls_map[i].supported; + linkmode_set_bit(ixgbe_lp_map[i].link_mode, + edata->lp_advertised); } - edata->advertised_u32 = 0; for (i = 0; i < ARRAY_SIZE(ixgbe_ls_map); ++i) { if (hw->phy.eee_speeds_advertised & ixgbe_ls_map[i].mac_speed) - edata->advertised_u32 |= ixgbe_ls_map[i].supported; + linkmode_set_bit(ixgbe_lp_map[i].link_mode, + edata->advertised); } - edata->eee_enabled = !!edata->advertised_u32; + edata->eee_enabled = !linkmode_empty(edata->advertised); edata->tx_lpi_enabled = edata->eee_enabled; - if (edata->advertised_u32 & edata->lp_advertised_u32) - edata->eee_active = true; + + linkmode_and(common, edata->advertised, edata->lp_advertised); + edata->eee_active = !linkmode_empty(common); return 0; } @@ -3504,7 +3506,7 @@ static int ixgbe_set_eee(struct net_device *netdev, struct ethtool_keee *edata) return -EINVAL; } - if (eee_data.advertised_u32 != edata->advertised_u32) { + if (!linkmode_equal(eee_data.advertised, edata->advertised)) { e_err(drv, "Setting EEE advertised speeds is not supported\n"); return -EINVAL; From patchwork Sun Feb 18 17:07:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Lunn X-Patchwork-Id: 202815 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp871250dyc; Sun, 18 Feb 2024 09:09:37 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVVao82KEBfomWKsDxFloY6OQgnZhBzpp3Ghmq5GnmV4PZ7moQ34Ev5Jx9CK//HuL9yisLmzulTKwCOHKF3Jitohozp7g== X-Google-Smtp-Source: AGHT+IGm0NonAyaSfyEj1vkyhkw8ycbZ+27ziRwZZ6Rt79NG89inlh/RA/ZHM78bxMWhN5+ZKNGz X-Received: by 2002:a05:6402:321:b0:564:7bed:c4df with SMTP id q1-20020a056402032100b005647bedc4dfmr132287edw.9.1708276177476; Sun, 18 Feb 2024 09:09:37 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708276177; cv=pass; d=google.com; s=arc-20160816; b=wa5ew9UMBWYmzFFRJd9AzGXk/JMJZB9UL6sseVg7mcsUxbpI+OnJbiGD3t7IIcEmdI shfN5mY+rNrHZGz8tJ5gvY9BQe4MlScjD3rmXulEs5FwdWqH3iJeE23JzV/8XDRMNQlG Za7gRbwUexenmFJ+zvPDwvpJBPcAiP1AJ4xJng5AdgEVGRr/e8M3Us1/50VnO16p+ivD noJrPQuOX2fNlvnK+fe8bZKSy9koMDj53dRFrzZeW6LjcXbkS+te4HNGQ7n1GejEfZ25 h/S5Zx4GVST9LqgSJX1WlTbKWJAtySsnda7sNYbKsqFBG+U07b5wMZT3s0f11O7pc71s A/DA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=aFRnThzSsM1GB0U7YhBosyITi6QEbbLLMwyncP4eReU=; fh=P3MkbJTmYKEBx+Jla3V8R5fCd1H1lmomdQcQsX8Xqvo=; b=Zorw7ZehCKjF2LSrXtzm5bxR2SKmCtqykVhxrw7JZL0CtCC4yEBMvm+0dCeHysThTG VFojYxMviIjSIwgN0/VQTLnhBJHzR0O34S0am7WgKz/pgKCEORDik2GyqCp5mn8n/his tDx7CsZjwB5re4KdTaNAyI/LnJe0o2ziz0y/Nybevi8XszQNTgBGWPfF+5XRn5bm64uO tIksf3laTpcXJE98YQLp8hjQ+gLRV6HzhaO36/6tG9Vf+ixaWoEfNJbugduXigbHUPN3 KtRjb5QeXZer+1BpOVX4jZfm1v9THGjVCO3mdeHowyFCXrEtY5togNA8rnsBXoONtFHI +jLw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=Pk89Yc2v; arc=pass (i=1 spf=pass spfdomain=lunn.ch dkim=pass dkdomain=lunn.ch dmarc=pass fromdomain=lunn.ch); spf=pass (google.com: domain of linux-kernel+bounces-70452-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70452-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id ch25-20020a0564021bd900b0056409ad278esi1713211edb.690.2024.02.18.09.09.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Feb 2024 09:09:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-70452-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=Pk89Yc2v; arc=pass (i=1 spf=pass spfdomain=lunn.ch dkim=pass dkdomain=lunn.ch dmarc=pass fromdomain=lunn.ch); spf=pass (google.com: domain of linux-kernel+bounces-70452-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70452-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 1B3BD1F2137D for ; Sun, 18 Feb 2024 17:09:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AA12573185; Sun, 18 Feb 2024 17:07:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="Pk89Yc2v" Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5377271B51; Sun, 18 Feb 2024 17:07:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=156.67.10.101 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708276057; cv=none; b=qxR8TUc5Ti74wwbnrtiaxu8O2KJfX9ommM1IZuzQEXTlQH3WBbRGWzXBAVRP2FSlYrtBd+/iemMN3TJqd8g3HbF9EosipkZh7ZMxDGjZTjmUbLN7c2XiCd7tN6luIzgSizoNG5IDWK4qaRdEQQXOGWXUDyh+n+wTsJX4KhP/Ipo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708276057; c=relaxed/simple; bh=jBShEoehGOiH3XARbTLV/6y5l6NHG5lC8OunACxocoE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=B1VMwOtoeXmCKY3d/Poa72YOjS0r0rQ5J9tH3pfpw5ibX6XADNnG3oi/rNApeXPx67iSXq/46Oas6e7s14Jnx1kYIURQJCJFjifvo2XuWvRL/uMYkaIkBD+CfHSh63/gUlfBbF6XvZtXtseS65jOrDJYZCCAHCcKvtMiDDLhgSw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch; spf=pass smtp.mailfrom=lunn.ch; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b=Pk89Yc2v; arc=none smtp.client-ip=156.67.10.101 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lunn.ch DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=Cc:To:In-Reply-To:References:Message-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From:From: Sender:Reply-To:Subject:Date:Message-ID:To:Cc:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Content-Disposition: In-Reply-To:References; bh=aFRnThzSsM1GB0U7YhBosyITi6QEbbLLMwyncP4eReU=; b=Pk 89Yc2vBB0hkAtYM0op8l3WOsI6xtG01wblt7FLT7nJm/Ax+xLUurl/bd7tL9CH/WATasT/02Tq6qG T5ttc0zFldzTa44E3jZ1yo6f81BOsJLijYDA4FjL5MgefEFcd5tYIsaKHYA2KBANwwjCkTFUSA4WT uCacSp4xR/wSuiw=; Received: from c-76-156-36-110.hsd1.mn.comcast.net ([76.156.36.110] helo=thinkpad.home.lunn.ch) by vps0.lunn.ch with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rbkdo-0088HX-UQ; Sun, 18 Feb 2024 18:07:49 +0100 From: Andrew Lunn Date: Sun, 18 Feb 2024 11:07:02 -0600 Subject: [PATCH net-next v4 5/9] net: intel: i40e/igc: Remove setting Autoneg in EEE capabilities Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240218-keee-u32-cleanup-v4-5-71f13b7c3e60@lunn.ch> References: <20240218-keee-u32-cleanup-v4-0-71f13b7c3e60@lunn.ch> In-Reply-To: <20240218-keee-u32-cleanup-v4-0-71f13b7c3e60@lunn.ch> To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Ariel Elior , Manish Chopra , Jesse Brandeburg , Tony Nguyen Cc: linux-usb@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, intel-wired-lan@lists.osuosl.org, Andrew Lunn , Jacob Keller X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=2711; i=andrew@lunn.ch; h=from:subject:message-id; bh=jBShEoehGOiH3XARbTLV/6y5l6NHG5lC8OunACxocoE=; b=owEBbQKS/ZANAwAKAea/DcumaUyEAcsmYgBl0jlAMT9Oz3fl2t1Fj5aWbUkFiXJyPsfMFfaXt ddsjRvTWY+JAjMEAAEKAB0WIQRh+xAly1MmORb54bfmvw3LpmlMhAUCZdI5QAAKCRDmvw3LpmlM hMRDEADZfbTifRtNPmUUkeYI81wNBVFF22R1hpdrqUQ4yOsirNebG6Lxb6yo5/tpVcagYOPhRP2 JtRRR8834buT3QWHcFEqG6HkAT2KomsSrgIpZxJISGMG4kIPqcWMdu2Ma1ulfETSLVe5C6FvSl7 jSfOafcJ4Dlp1DLvvmdPT0PNufPbzxH3jVptyuASzExmxApjQoKy+2Bv1WKZ/EN2betp3aYKpuW LdlXNiTTq0qSjDkFok++I9CxOuwlol5Ni8z6JpVsn1JPRP4o6867nzUXkCeiqplebMkxsBV0vgi 9aBv76el4AXAeF9q1Qclkb0HfYVHOJsYyMfAzcas/BPEGOOmEu88DlXfcP4LjAVPazeEN5zwDOs M0x5ofPejeGIefVduu6HeRUeLHuzm7MuUvImUSgAGTYcpZ+U4E28Ak5ifmUHEakS4luAhm0dw52 a8U9fd11NvneMvaFCtLYibcfYRzVRbbfgfoVAoSMu0W7uUep8baUw+tEz1AF78ZGGlbhuZ4rmsm IGf+5oEF1EdeVH2bqDshxYCxfWAheN8Jha8DMFpEPHa5L4xvlfDbCMvvrByrJ1lRdN4ObAi4bEY dEI3refN+CI6JlrPPsIk9DV+pprTjJ4yncawVxxFNvZ/a8BBPNbT9WNZHBvZWZsUb+IpUIjJB8T 4PhFdsczI68TF5w== X-Developer-Key: i=andrew@lunn.ch; a=openpgp; fpr=61FB1025CB53263916F9E1B7E6BF0DCBA6694C84 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791257401011548396 X-GMAIL-MSGID: 1791257401011548396 Energy Efficient Ethernet should always be negotiated with the link peer. Don't include SUPPORTED_Autoneg in the results of get_eee() for supported, advertised or lp_advertised, since it is assumed. Additionally, ethtool(1) ignores the set bit, and no other driver sets this. Reviewed-by: Jacob Keller Signed-off-by: Andrew Lunn --- drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 7 +------ drivers/net/ethernet/intel/igc/igc_ethtool.c | 4 ---- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c index 1b5473358e1a..42e7e6cdaa6d 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c +++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c @@ -5664,16 +5664,12 @@ static int i40e_get_eee(struct net_device *netdev, struct ethtool_keee *edata) if (phy_cfg.eee_capability == 0) return -EOPNOTSUPP; - edata->supported_u32 = SUPPORTED_Autoneg; - edata->lp_advertised_u32 = edata->supported_u32; - /* Get current configuration */ status = i40e_aq_get_phy_capabilities(hw, false, false, &phy_cfg, NULL); if (status) return -EAGAIN; - edata->advertised_u32 = phy_cfg.eee_capability ? SUPPORTED_Autoneg : 0U; - edata->eee_enabled = !!edata->advertised_u32; + edata->eee_enabled = !!phy_cfg.eee_capability; edata->tx_lpi_enabled = pf->stats.tx_lpi_status; edata->eee_active = pf->stats.tx_lpi_status && pf->stats.rx_lpi_status; @@ -5691,7 +5687,6 @@ static int i40e_is_eee_param_supported(struct net_device *netdev, u32 value; const char *name; } param[] = { - {edata->advertised_u32 & ~SUPPORTED_Autoneg, "advertise"}, {edata->tx_lpi_timer, "tx-timer"}, {edata->tx_lpi_enabled != pf->stats.tx_lpi_status, "tx-lpi"} }; diff --git a/drivers/net/ethernet/intel/igc/igc_ethtool.c b/drivers/net/ethernet/intel/igc/igc_ethtool.c index 47c797dd2cd9..ac92d10a3e97 100644 --- a/drivers/net/ethernet/intel/igc/igc_ethtool.c +++ b/drivers/net/ethernet/intel/igc/igc_ethtool.c @@ -1634,7 +1634,6 @@ static int igc_ethtool_get_eee(struct net_device *netdev, mmd_eee_adv_to_ethtool_adv_t(adapter->eee_advert); *edata = adapter->eee; - edata->supported_u32 = SUPPORTED_Autoneg; eeer = rd32(IGC_EEER); @@ -1647,9 +1646,6 @@ static int igc_ethtool_get_eee(struct net_device *netdev, edata->eee_enabled = hw->dev_spec._base.eee_enable; - edata->advertised_u32 = SUPPORTED_Autoneg; - edata->lp_advertised_u32 = SUPPORTED_Autoneg; - /* Report correct negotiated EEE status for devices that * wrongly report EEE at half-duplex */ From patchwork Sun Feb 18 17:07:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Lunn X-Patchwork-Id: 202816 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp871441dyc; Sun, 18 Feb 2024 09:10:00 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXFbTEeB63Lhoq+D9W67hFpD2uiQNf9RqeiphhSrAiDgOBYHWf/OIiCqmvyDcTVwd/MRsFdHiXy7scBYOOTXwpbFqE8/g== X-Google-Smtp-Source: AGHT+IF3uBjhGNSl6byVXr348uXgMI6AECoRyDizhNYVKlNEw5IbMg7ZiVA5wSnPPjc56gx2Rel2 X-Received: by 2002:a05:6402:609:b0:564:eff:5798 with SMTP id n9-20020a056402060900b005640eff5798mr3950235edv.38.1708276200478; Sun, 18 Feb 2024 09:10:00 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708276200; cv=pass; d=google.com; s=arc-20160816; b=gTgdqGMz3wNuBXc2CIJitArL+7DVE/xmbBoaOGlWIUhbN7MFgoUbkDZUCyiyZAV8E1 WTC5ixPlVvNYMlwhHwTWBr8fGpLEvgCa5A06dCq3xP49LjH1jdeANV5D4ceZb0uCtrAB ZEbCwZuEZA14JsvZ4xBnROHY444jE4yV7FzoIGFIEqlqnHWDtNSjYkJl7s1AsfEA/CKo cYnG7699661eEiD0bst5ALisU8cECwHq74gvEKTeCsgHjEtAgC+kpqSfe1MJbxNXqGNx XdekgxXTpUp/xY0268i9WxtL5KYy2t3ZiEScrV+G0z+fh6J0bsP7eKJV/i8FTMdFmhr0 aK7A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=SOMOZ6/FJXknA8+mFiIFxymCAEzF7Pi03pmztEUsl68=; fh=7ogY8TTBnoDyVw0Ew02z/XaZICVahvk3b1eitAEneUQ=; b=03weLSqbsZwN9P/adCj18FE1rH3pmVycJEmO8gPhhgXLqJ38PuxDE/0X2ZasRmMwNx o11/SXjIex3A6L2NbTAxwZS6CrHqM+EtHHu9mnAC7RNX7wF7sIAGofqMrUTMIxIIn0Un LmPlD7CDYOULelU0wAFh1XoO8qAFz03pvSQFbIRU5SEzahh0KcFNu+9LQ0ovlyEVBfgq wjLXOKo4tr5xfissYXSH/TbqeWs95iesAGyZ+Zr+bO9F6E3eqGM/JK4jUCQsOTyts7+H mfjcYqz/2ukQPJxKlM710M23FNzah0o2OnHqM+Bvsmhb/R7cRPWIgwpCbWvSpwSeA/FS sFxw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=0zxWT03K; arc=pass (i=1 spf=pass spfdomain=lunn.ch dkim=pass dkdomain=lunn.ch dmarc=pass fromdomain=lunn.ch); spf=pass (google.com: domain of linux-kernel+bounces-70453-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70453-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id s23-20020a05640217d700b0056428183019si1319368edy.136.2024.02.18.09.10.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Feb 2024 09:10:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-70453-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=0zxWT03K; arc=pass (i=1 spf=pass spfdomain=lunn.ch dkim=pass dkdomain=lunn.ch dmarc=pass fromdomain=lunn.ch); spf=pass (google.com: domain of linux-kernel+bounces-70453-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70453-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 1C5C71F21302 for ; Sun, 18 Feb 2024 17:10:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 18D07745C3; Sun, 18 Feb 2024 17:07:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="0zxWT03K" Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EA8D773180; Sun, 18 Feb 2024 17:07:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=156.67.10.101 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708276061; cv=none; b=FWFfJUkFC36JyR1tlFMhrrm/up8I6SKiSkAGSsZBx2XM/9OjB4ZdE5o6S7a2dvrsuholT0XYMG9FjvLAi/ir5mepj3kb+Wy4lVdVkkjAu9gIXs3lG6rzzPzFCe3yHVPCKlgjbHdEwEUV2wC6ernYwY53j0w0UTTntj1umuJnjFs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708276061; c=relaxed/simple; bh=nLsygJVJCduLk95szsdKOpEa7GzGsR0GfRGWNH5oTU4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=fh1BuX7+wJvdBp03R51kj5D4mwn2Z1D1Wr0RUhYnl3bYpYLWl7Pnw2rUljib2qCbNUKFH129EBSbx5uPE05KNoDJpuzJWSff/weMTxWk6mFYYVeSQj2KbsGr7/U+V/863WOfskWshHzJBpd7rLjkHSCXdd0Uci/R2LXzaFqU34M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch; spf=pass smtp.mailfrom=lunn.ch; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b=0zxWT03K; arc=none smtp.client-ip=156.67.10.101 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lunn.ch DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=Cc:To:In-Reply-To:References:Message-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From:From: Sender:Reply-To:Subject:Date:Message-ID:To:Cc:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Content-Disposition: In-Reply-To:References; bh=SOMOZ6/FJXknA8+mFiIFxymCAEzF7Pi03pmztEUsl68=; b=0z xWT03KHkP9zKDDeKKuB8Ff0OyH7C2sAQ9EDmDYp08qF7ZwVGjtsPUgZOcu/2ZJD1EodMYNq3vPpLL y/8mhrwXdBg0yQJNouHaJDZ/lNxjlcc9XGi4U3P43/fQgwDJjSFZg1Ly9N4frWV+NdABuSYw4N/r8 dShCiZ5zqJ4P5BY=; Received: from c-76-156-36-110.hsd1.mn.comcast.net ([76.156.36.110] helo=thinkpad.home.lunn.ch) by vps0.lunn.ch with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rbkds-0088HX-73; Sun, 18 Feb 2024 18:07:52 +0100 From: Andrew Lunn Date: Sun, 18 Feb 2024 11:07:03 -0600 Subject: [PATCH net-next v4 6/9] net: intel: e1000e: Use linkmode helpers for EEE Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240218-keee-u32-cleanup-v4-6-71f13b7c3e60@lunn.ch> References: <20240218-keee-u32-cleanup-v4-0-71f13b7c3e60@lunn.ch> In-Reply-To: <20240218-keee-u32-cleanup-v4-0-71f13b7c3e60@lunn.ch> To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Ariel Elior , Manish Chopra , Jesse Brandeburg , Tony Nguyen Cc: linux-usb@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, intel-wired-lan@lists.osuosl.org, Andrew Lunn X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=2663; i=andrew@lunn.ch; h=from:subject:message-id; bh=nLsygJVJCduLk95szsdKOpEa7GzGsR0GfRGWNH5oTU4=; b=owEBbQKS/ZANAwAKAea/DcumaUyEAcsmYgBl0jlA91EUO7alTOK9ZzIu3Ku6+PXdyh7P/mv9v OlgCS1389yJAjMEAAEKAB0WIQRh+xAly1MmORb54bfmvw3LpmlMhAUCZdI5QAAKCRDmvw3LpmlM hJvFD/0eOvrHI2+H64ekgmZKRhSn6D1jRFWAc0f5We8soO8bazUkB0XJWS7Mm0DR6UL+o6IT5HC eqbssQOQDJ/zpn0uRvqL0VE64wijEyorFqmWAfZR22HIEe86CBtLd4Uh9oLO6gC59ZxTrmXCrHB S2j5QShvaGbV4a0zHR6OocJXDZIuflfr5nU5+R7+KNh4U+8T/Ypm9ASeQnbKyFEUPDYjRMp1i1N u5uO4z3k3RqcNDNEakFuqKMT8UjsINWNK3wXP16M9j0fxhFq8V6nVbhVeKOB3FylMGZngHOHNfP wXo/6QMJxtC+4iWdVu3bnRqbvVOZY7riJ5iAt934v8G4/zhdE/y6Zx04Fo2YKdH8EtYHbJPGBKi qv6sAnCG/On8yOBarSZ4/+9h/4l810BGYRn+Kz6N0/A+Fmjo3zhq2isp0KJ//pX1H0/Wbt5QSge pOg7QwEQsDYq2KbUSYTJe2bx3CgZJwhBp96EnplyrfDKmqhlz3+c1dZazTRFqX8y4MKqG9gu3Cr hkKzfnbvNKfaGBoPtM670Zq/J2wv42pf/Ph1cp1CKBHso3xDGramiY4LVHiX4PkeYVO7q2Tzrs8 B84dygIfydXG9eKXUf26P3p/p/zdVw8VixEGr6evoe6KWPiBbLghjqZZeHfRwuvkYAJLsYU+6oB fTerw2DwSfqPtKg== X-Developer-Key: i=andrew@lunn.ch; a=openpgp; fpr=61FB1025CB53263916F9E1B7E6BF0DCBA6694C84 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791257425372380520 X-GMAIL-MSGID: 1791257425372380520 Make use of the existing linkmode helpers for converting PHY EEE register values into links modes, now that ethtool_keee uses link modes, rather than u32 values. Signed-off-by: Andrew Lunn Reviewed-by: Simon Horman --- drivers/net/ethernet/intel/e1000e/ethtool.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/intel/e1000e/ethtool.c b/drivers/net/ethernet/intel/e1000e/ethtool.c index ff243ae71b78..dc553c51d79a 100644 --- a/drivers/net/ethernet/intel/e1000e/ethtool.c +++ b/drivers/net/ethernet/intel/e1000e/ethtool.c @@ -2223,16 +2223,16 @@ static int e1000e_get_eee(struct net_device *netdev, struct ethtool_keee *edata) ret_val = e1000_read_emi_reg_locked(hw, cap_addr, &phy_data); if (ret_val) goto release; - edata->supported_u32 = mmd_eee_cap_to_ethtool_sup_t(phy_data); + mii_eee_cap1_mod_linkmode_t(edata->supported, phy_data); /* EEE Advertised */ - edata->advertised_u32 = mmd_eee_adv_to_ethtool_adv_t(adapter->eee_advert); + mii_eee_cap1_mod_linkmode_t(edata->advertised, adapter->eee_advert); /* EEE Link Partner Advertised */ ret_val = e1000_read_emi_reg_locked(hw, lpa_addr, &phy_data); if (ret_val) goto release; - edata->lp_advertised_u32 = mmd_eee_adv_to_ethtool_adv_t(phy_data); + mii_eee_cap1_mod_linkmode_t(edata->lp_advertised, phy_data); /* EEE PCS Status */ ret_val = e1000_read_emi_reg_locked(hw, pcs_stat_addr, &phy_data); @@ -2265,6 +2265,8 @@ static int e1000e_get_eee(struct net_device *netdev, struct ethtool_keee *edata) static int e1000e_set_eee(struct net_device *netdev, struct ethtool_keee *edata) { struct e1000_adapter *adapter = netdev_priv(netdev); + __ETHTOOL_DECLARE_LINK_MODE_MASK(supported) = {}; + __ETHTOOL_DECLARE_LINK_MODE_MASK(tmp) = {}; struct e1000_hw *hw = &adapter->hw; struct ethtool_keee eee_curr; s32 ret_val; @@ -2283,12 +2285,17 @@ static int e1000e_set_eee(struct net_device *netdev, struct ethtool_keee *edata) return -EINVAL; } - if (edata->advertised_u32 & ~(ADVERTISE_100_FULL | ADVERTISE_1000_FULL)) { + linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT, + supported); + linkmode_set_bit(ETHTOOL_LINK_MODE_100baseT_Full_BIT, + supported); + + if (linkmode_andnot(tmp, edata->advertised, supported)) { e_err("EEE advertisement supports only 100TX and/or 1000T full-duplex\n"); return -EINVAL; } - adapter->eee_advert = ethtool_adv_to_mmd_eee_adv_t(edata->advertised_u32); + adapter->eee_advert = linkmode_to_mii_eee_cap1_t(edata->advertised); hw->dev_spec.ich8lan.eee_disable = !edata->eee_enabled; From patchwork Sun Feb 18 17:07:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Lunn X-Patchwork-Id: 202817 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp871614dyc; Sun, 18 Feb 2024 09:10:24 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXfJhrg1AHbTnD4Gdct+ZZoR629trYet1gthQgSUv1V8T8k5fPEeaCwN/icTxxmqGbg6NL2Aea/PYFMT1dNraXh90LT1A== X-Google-Smtp-Source: AGHT+IFEMtpH5tSdK0buUf1Sxcwe+rdHvxo6fsry75PQ6EJ5nBZbQ4JM6fru0mnU+Cn4inn2XXJO X-Received: by 2002:a05:6214:3904:b0:68c:ca2f:b5d3 with SMTP id nh4-20020a056214390400b0068cca2fb5d3mr19151382qvb.1.1708276223953; Sun, 18 Feb 2024 09:10:23 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708276223; cv=pass; d=google.com; s=arc-20160816; b=nNcpkL3ZbFLgnQdqOnBtROczndCtxPZWk1mIneHsLgACht91pCHR9NSzh+hOJW4oQ3 4g+nUuZLCgkVL1QfHE6EkehkncaUnDi+3l0zlE0vPT/zXziU5ufCRq+yQNe4QYfXncGr kPNJQceH9Aw0n4MKnpz6CjYRQH1/dbIJK0moVoqmFaR4TAfZZMJSpC1VgsAalV/3pUTq 9QJ8+bbE5d2Y0Oh6lW19KThOdqRjxQXUW36x4rDCxFbCm1CTdwu9CXD0PBIqaZo+EMgH Vn/QM6IftszHjBAIVK8exWictlY1UMVlgocBbVyy6SHsfWhruX+IEOXVlW6JjcEYQB8+ 9cAw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=ZXONKmDn5sZIMxtipaagv56vEZFiWDyaXt+UaQErfVY=; fh=7ogY8TTBnoDyVw0Ew02z/XaZICVahvk3b1eitAEneUQ=; b=Ki744GisZXAMNro+lrlv8jithiLE9rBPlXeAX9EmQZXFXDZEUaM85FqQajxq5C35Wt S5dEx0ThXb3C9R0jeuktqeJfTqGf4BvZSBZHu8sZ8VTzr7DR/zq1w7MsotngOdJ7NOtJ R4DajlDVth9zTTY88D8IJfHjcx6yCDp/0I0FmOypYSdbWAUMPE3mz9TO/okwwDrmuv1n UwDQ/2lEHeJtjim6bCTzKFCyyoa/rs7GhuEd4UnL+hXEAPjfeHz8m6IZJ/L9bW4ctm5e /3gK9G/s3lPLKkzhEFPAFtdnPYu3ZAm6xFRJTgqqkUrL5c+0HP+H8f8uvwVtzICbM30G TT7Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=5tkRDZNI; arc=pass (i=1 spf=pass spfdomain=lunn.ch dkim=pass dkdomain=lunn.ch dmarc=pass fromdomain=lunn.ch); spf=pass (google.com: domain of linux-kernel+bounces-70454-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70454-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 2-20020a0562140dc200b0068f34f6c1b8si4551923qvt.14.2024.02.18.09.10.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Feb 2024 09:10:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-70454-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=5tkRDZNI; arc=pass (i=1 spf=pass spfdomain=lunn.ch dkim=pass dkdomain=lunn.ch dmarc=pass fromdomain=lunn.ch); spf=pass (google.com: domain of linux-kernel+bounces-70454-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70454-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id AE7D01C20944 for ; Sun, 18 Feb 2024 17:10:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A4C2D745DD; Sun, 18 Feb 2024 17:07:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="5tkRDZNI" Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1535F7429B; Sun, 18 Feb 2024 17:07:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=156.67.10.101 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708276064; cv=none; b=EDYfyHiA7QAMwLuqYFs9eR7gduWtYFFAbcuIm6B/gDwcBnCCl4BYQkWPgRtIkCC/lzjwlFI/Ovz510i4As54oHA/RMFN0Qhp/PkKitN1Ug89ByMhK3jUy1w2k7HWTA+Rb3T1KnzJbrlC8CBfTWMtPRsBFY14RAlapJ/DnRzE7b0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708276064; c=relaxed/simple; bh=xffr0GXqel7jbZc8Ik+9TtbWrjhgJxXahNX++S1de6k=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=mFvCTuOFtcBUrqZHRNHcNOYxnNhuIsT8IDl1KX62Fm2YEuO9Io6ZJeLozTrV2Hs+Xg3seCe7PanfiWaW+OZ9YeAWyFReuaR0JSK3exa2lyl35ctANlRqlWGAtJJ9HmKCfob9LnFCUmGPP5i4buon5ylXBSX+WEcWxmdQeFkEviE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch; spf=pass smtp.mailfrom=lunn.ch; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b=5tkRDZNI; arc=none smtp.client-ip=156.67.10.101 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lunn.ch DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=Cc:To:In-Reply-To:References:Message-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From:From: Sender:Reply-To:Subject:Date:Message-ID:To:Cc:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Content-Disposition: In-Reply-To:References; bh=ZXONKmDn5sZIMxtipaagv56vEZFiWDyaXt+UaQErfVY=; b=5t kRDZNIv8LqY9BzcHg2fZgk6Bo8lUpMX9l4570v6gHvcOttKEqB/32jUA9t80992Ddnx8IeM3Nw3R9 YB4qzGKfjsWqsJzKL37Zyaacfu1iKhFTwCzo8p8WvBpXleX/ktmAri9JXlVo11V5KMUzqSOizEXzM 3b7nbAMih5lEXdM=; Received: from c-76-156-36-110.hsd1.mn.comcast.net ([76.156.36.110] helo=thinkpad.home.lunn.ch) by vps0.lunn.ch with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rbkdv-0088HX-G5; Sun, 18 Feb 2024 18:07:55 +0100 From: Andrew Lunn Date: Sun, 18 Feb 2024 11:07:04 -0600 Subject: [PATCH net-next v4 7/9] net: intel: igb: Use linkmode helpers for EEE Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240218-keee-u32-cleanup-v4-7-71f13b7c3e60@lunn.ch> References: <20240218-keee-u32-cleanup-v4-0-71f13b7c3e60@lunn.ch> In-Reply-To: <20240218-keee-u32-cleanup-v4-0-71f13b7c3e60@lunn.ch> To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Ariel Elior , Manish Chopra , Jesse Brandeburg , Tony Nguyen Cc: linux-usb@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, intel-wired-lan@lists.osuosl.org, Andrew Lunn X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=4098; i=andrew@lunn.ch; h=from:subject:message-id; bh=xffr0GXqel7jbZc8Ik+9TtbWrjhgJxXahNX++S1de6k=; b=owEBbQKS/ZANAwAKAea/DcumaUyEAcsmYgBl0jlAaf/p+bCP3YC5GLSi2piZ2Lnuh9K6p/OH5 7GjWSxzhkKJAjMEAAEKAB0WIQRh+xAly1MmORb54bfmvw3LpmlMhAUCZdI5QAAKCRDmvw3LpmlM hMzFEAClMXS6MM6wJcO2I2b80AcQRh2RBR4Qa1lZMF11IbFoPeU9VekKg26fjatWIgKOjZZg8Hx rOaOGX9ZVInHZlE9AQNreE5HzzxJkzzrVrLTVVre9pnNnG6OWvKSQIK0dMZcU8KVKqfuhd4Hh0t OtllpsIw34yFNr6GP9Wv6eA7PbsApeTu5MhRWwR6EyewIjJwN3qFLNcq+lXjUh/5ssPqMN3xaGO BabQhTkX1cT3b5iwT8Cwo/cR3+yLrGv21ztnA6OkF4rB3pleEqqrdBs5xNurQQr7b/og5BzJ6Zu frTECSNMpL5IIVhh0qMkmrbX+mtEFMWK46BBnw5Kd3F5EQElkmTGLJBcbznJCS+trqRaeWuCROE ZAdAGLx+nvFOzuMHWjUl0blfO5VwNXbAwtqR8n2O4TxjS6O6dhdPe10sPn/cEijS60cLVrQqoAU iEmVF8oMgU4wZkBgnEN7s17io3+bQjJ9OSW2HZ5tLuZ9ukpceWxUccbfSGxdmHTsZEuzjvs9Qgy r7xu+4qg6Z7sMhxxmVGygg+sj2lLHyp/uQ2hfcNI2I4UI7pLKWrqSjG4kjsXv7VYmz7bJ9Wkvtw vWzJ5edDdB1aFxPyIqOckldZ6PD0ObnbQElNTXnTRzKECVUciI3zvd/yjpjgH/kdx7LlzIKw9+t 0WGZB83/wBwjHyQ== X-Developer-Key: i=andrew@lunn.ch; a=openpgp; fpr=61FB1025CB53263916F9E1B7E6BF0DCBA6694C84 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791257449482645165 X-GMAIL-MSGID: 1791257449482645165 Make use of the existing linkmode helpers for converting PHY EEE register values into links modes, now that ethtool_keee uses link modes, rather than u32 values. Signed-off-by: Andrew Lunn Reviewed-by: Simon Horman --- drivers/net/ethernet/intel/igb/igb_ethtool.c | 35 ++++++++++++++++++---------- 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/drivers/net/ethernet/intel/igb/igb_ethtool.c b/drivers/net/ethernet/intel/igb/igb_ethtool.c index b87b23d2151c..99977a22b843 100644 --- a/drivers/net/ethernet/intel/igb/igb_ethtool.c +++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c @@ -3038,11 +3038,13 @@ static int igb_get_eee(struct net_device *netdev, struct ethtool_keee *edata) (hw->phy.media_type != e1000_media_type_copper)) return -EOPNOTSUPP; - edata->supported_u32 = (SUPPORTED_1000baseT_Full | - SUPPORTED_100baseT_Full); + linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT, + edata->supported); + linkmode_set_bit(ETHTOOL_LINK_MODE_100baseT_Full_BIT, + edata->supported); if (!hw->dev_spec._82575.eee_disable) - edata->advertised_u32 = - mmd_eee_adv_to_ethtool_adv_t(adapter->eee_advert); + mii_eee_cap1_mod_linkmode_t(edata->advertised, + adapter->eee_advert); /* The IPCNFG and EEER registers are not supported on I354. */ if (hw->mac.type == e1000_i354) { @@ -3068,7 +3070,7 @@ static int igb_get_eee(struct net_device *netdev, struct ethtool_keee *edata) if (ret_val) return -ENODATA; - edata->lp_advertised_u32 = mmd_eee_adv_to_ethtool_adv_t(phy_data); + mii_eee_cap1_mod_linkmode_t(edata->lp_advertised, phy_data); break; case e1000_i354: case e1000_i210: @@ -3079,7 +3081,7 @@ static int igb_get_eee(struct net_device *netdev, struct ethtool_keee *edata) if (ret_val) return -ENODATA; - edata->lp_advertised_u32 = mmd_eee_adv_to_ethtool_adv_t(phy_data); + mii_eee_cap1_mod_linkmode_t(edata->lp_advertised, phy_data); break; default: @@ -3099,7 +3101,7 @@ static int igb_get_eee(struct net_device *netdev, struct ethtool_keee *edata) edata->eee_enabled = false; edata->eee_active = false; edata->tx_lpi_enabled = false; - edata->advertised_u32 &= ~edata->advertised_u32; + linkmode_zero(edata->advertised); } return 0; @@ -3109,6 +3111,8 @@ static int igb_set_eee(struct net_device *netdev, struct ethtool_keee *edata) { struct igb_adapter *adapter = netdev_priv(netdev); + __ETHTOOL_DECLARE_LINK_MODE_MASK(supported) = {}; + __ETHTOOL_DECLARE_LINK_MODE_MASK(tmp) = {}; struct e1000_hw *hw = &adapter->hw; struct ethtool_keee eee_curr; bool adv1g_eee = true, adv100m_eee = true; @@ -3138,14 +3142,21 @@ static int igb_set_eee(struct net_device *netdev, return -EINVAL; } - if (!edata->advertised_u32 || (edata->advertised_u32 & - ~(ADVERTISE_100_FULL | ADVERTISE_1000_FULL))) { + linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT, + supported); + linkmode_set_bit(ETHTOOL_LINK_MODE_100baseT_Full_BIT, + supported); + if (linkmode_andnot(tmp, edata->advertised, supported)) { dev_err(&adapter->pdev->dev, "EEE Advertisement supports only 100Tx and/or 100T full duplex\n"); return -EINVAL; } - adv100m_eee = !!(edata->advertised_u32 & ADVERTISE_100_FULL); - adv1g_eee = !!(edata->advertised_u32 & ADVERTISE_1000_FULL); + adv100m_eee = linkmode_test_bit( + ETHTOOL_LINK_MODE_100baseT_Full_BIT, + edata->advertised); + adv1g_eee = linkmode_test_bit( + ETHTOOL_LINK_MODE_1000baseT_Full_BIT, + edata->advertised); } else if (!edata->eee_enabled) { dev_err(&adapter->pdev->dev, @@ -3153,7 +3164,7 @@ static int igb_set_eee(struct net_device *netdev, return -EINVAL; } - adapter->eee_advert = ethtool_adv_to_mmd_eee_adv_t(edata->advertised_u32); + adapter->eee_advert = linkmode_to_mii_eee_cap1_t(edata->advertised); if (hw->dev_spec._82575.eee_disable != !edata->eee_enabled) { hw->dev_spec._82575.eee_disable = !edata->eee_enabled; adapter->flags |= IGB_FLAG_EEE; From patchwork Sun Feb 18 17:07:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Lunn X-Patchwork-Id: 202819 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp875446dyc; Sun, 18 Feb 2024 09:19:58 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWGGU8Voo0YfSfzGqHa3mnpX4fxIzEwN6dD9h4JesE+ZcA6poPMb6FtJLB8oruEU+q9ismjd+7hY9oAUe/lkrx3mUU0gw== X-Google-Smtp-Source: AGHT+IHFKjy+75GToVc9FEjcVLjJvGQw2j8QYv0v0NqoJF2rO7UvmVk+d6n60fQUAggmxeY6Afik X-Received: by 2002:a17:903:1107:b0:1d9:adc9:2962 with SMTP id n7-20020a170903110700b001d9adc92962mr13725677plh.20.1708276798281; Sun, 18 Feb 2024 09:19:58 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708276798; cv=pass; d=google.com; s=arc-20160816; b=YtUpqT/PVJ+gFDagSJ2BLnyPiB2fWV07zs+0aSBwzeXF7wrFjvRFyQK6HcEkT8iut2 aF8x+enSWC1XBTneadsdB3ueYptL0FvxAJFGIEXIkTx2+ZWBg3s1Vp5gJcHvmuM4KoDA 3pvQe3gOw6zmFx9jz/QvCGyCp7v6tQNu7dtzIk3wwNczTN66vB9lXA3yICMYBeLEbY1v N0p4vUtjTH71jPTYJrtQgzWPzfCA4yMajVbfI7DbFdAmIgJQTB0d5V4OWNhCwdlrr9aT smgt6f1z/b3SjDV7G/vXClZwsHEuvxdALm9h6iaU72Glf4J+Hurp38sbTmdu3hgpinlI yyZg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=VwM8omFAb/USTaaRR/I+p2JFbh5V/UtXkfhHiw9cl4I=; fh=7ogY8TTBnoDyVw0Ew02z/XaZICVahvk3b1eitAEneUQ=; b=sniq34PJrgRdqVcua5c63qH9fzM4L8dc49nOgWsIz5rRpzHtDpCWUF3OvOCxXTnV9x L8vsNGaHlOtw2jMGiIz8FI/Y+iSLoh2Rcawr4o0Vy/Z2aRBrZFQknayPQ6RCPu8CK4yS LmP35QFR1NhxVnBjAFGZ+oGCGsW5MwNVpYYbE2rgFPc2uvugt0G67GZdGXOrxjg+1gFl WckAwjAcJwF30nhisGSJ3SiF0YQ69QiMvRk2acJXKCI9I3zvNfXhTlTHvtFsOn6VKj51 STWizZZ0wSdPkyJ9Rfc2a/xZBtgZkmw66DdY8l1svNBg8zHdwItvVxZFfsZNA4cJ+dZs xH1A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b="Yc9l8/tk"; arc=pass (i=1 spf=pass spfdomain=lunn.ch dkim=pass dkdomain=lunn.ch dmarc=pass fromdomain=lunn.ch); spf=pass (google.com: domain of linux-kernel+bounces-70455-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70455-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id jd20-20020a170903261400b001db2ab0f3fcsi3208542plb.32.2024.02.18.09.19.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Feb 2024 09:19:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-70455-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b="Yc9l8/tk"; arc=pass (i=1 spf=pass spfdomain=lunn.ch dkim=pass dkdomain=lunn.ch dmarc=pass fromdomain=lunn.ch); spf=pass (google.com: domain of linux-kernel+bounces-70455-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70455-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id D9AFC2825CE for ; Sun, 18 Feb 2024 17:10:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5A9FD74E1F; Sun, 18 Feb 2024 17:07:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="Yc9l8/tk" Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2D67C745E5; Sun, 18 Feb 2024 17:07:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=156.67.10.101 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708276067; cv=none; b=ZQNH0vKoufrv+sqVT3FGJcZJGdeuuxw/RKo4tVSTMlY65vpO+qoPAJ+TDT+cO52JExf0db/yb4gA6BEM4krMApsrwaUoiTGaKCFU4fxUKZyr/jjDn73aj0OLXHWb3N99zPGzuG3cVoexDu8WklYbOFT7wySzUY2R70wp+Z0v8EI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708276067; c=relaxed/simple; bh=JUBlNHQ9KEInXfv/Ts82d6LWLEYOujFvKhAve8sOAdY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=tYYojPC2zFyBJpWVx16RIXm+WuXfMCYgzqOQQa3krPfW0jTnbNm5ihBuRz1udR+72fc905QNdVPJHe0IQ/dSKXW4q3FqTAOO4UmFYUZhDesQcq11Tyjn5WtU06Z+OtMZ1+RbHIsTsqL8y1uDOtbPe07DwXOP2KemeQwdIsbSto0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch; spf=pass smtp.mailfrom=lunn.ch; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b=Yc9l8/tk; arc=none smtp.client-ip=156.67.10.101 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lunn.ch DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=Cc:To:In-Reply-To:References:Message-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From:From: Sender:Reply-To:Subject:Date:Message-ID:To:Cc:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Content-Disposition: In-Reply-To:References; bh=VwM8omFAb/USTaaRR/I+p2JFbh5V/UtXkfhHiw9cl4I=; b=Yc 9l8/tkSqwjaElYJZfu/XA3cfDIXOFmDg/swedEeAVmxB2mUAH5wfpsuwODQ3aF04gGwkswjntUjDc 7vK/K1lj4LIZMrJ2TxjfjX9P2fTYh/raj0jb83qv0C2E7akG3Gao8EjF/hZ1ad9yjQWIWACPfZB9j DsTqtqQDeTrRqO4=; Received: from c-76-156-36-110.hsd1.mn.comcast.net ([76.156.36.110] helo=thinkpad.home.lunn.ch) by vps0.lunn.ch with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rbkdy-0088HX-Oy; Sun, 18 Feb 2024 18:07:58 +0100 From: Andrew Lunn Date: Sun, 18 Feb 2024 11:07:05 -0600 Subject: [PATCH net-next v4 8/9] net: intel: igc: Use linkmode helpers for EEE Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240218-keee-u32-cleanup-v4-8-71f13b7c3e60@lunn.ch> References: <20240218-keee-u32-cleanup-v4-0-71f13b7c3e60@lunn.ch> In-Reply-To: <20240218-keee-u32-cleanup-v4-0-71f13b7c3e60@lunn.ch> To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Ariel Elior , Manish Chopra , Jesse Brandeburg , Tony Nguyen Cc: linux-usb@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, intel-wired-lan@lists.osuosl.org, Andrew Lunn X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=1638; i=andrew@lunn.ch; h=from:subject:message-id; bh=JUBlNHQ9KEInXfv/Ts82d6LWLEYOujFvKhAve8sOAdY=; b=owEBbQKS/ZANAwAKAea/DcumaUyEAcsmYgBl0jlBR1jCpUGgmoGhhgBBTwtCSWKQdM++eFeLI 7FZYtP8Uc+JAjMEAAEKAB0WIQRh+xAly1MmORb54bfmvw3LpmlMhAUCZdI5QQAKCRDmvw3LpmlM hAd+EAC/o1GrNt9qRvp7CrUNHCoEMKRI7L8QKnx0ZtDef3lGW8PNHh0YcY4ovJUxUT929XeeAEf jOnF4K05TU72oBh3svHIwfED0592QpL8g5cNHR7FoPQL6+KaczbLzb+y3J4+A31+oBaw5pX/TGn h9c+oWpkQy4Ut6f4fVpo7gwaFmfH7FVUlnRnKYVi+rEEyw9qvZ/gNZteE5sRQlKDuw6B3SUjBfW JtLRWd6b06gsSwi8lZazLessKtZ7nzyZiS0X1g2jcj9i/QP9IJ+tudfMEYHFf63p1PRLSdnhA1k tQfB5QGhEB0XUFLPd0YB+uqtd6yUycjIBzahOVGuIUx2nIrnHjGcGkwuJ/q3CZHPgQqwAF0sHrf KgENrYLWdbB2Fmh52QEn2+Jy0xBaAqgTELz4rOzWZxViNCYYxtzsBV8bqtaRu29D8Jc4ceUBG0m XTxIfyI1BxROvoL5OkF6j4qhQzKJ8tUxXVUHT6DBfIoXVEESJQCEN8lUwLHEHkWlYM8NHyjAJfq LeXpl2TIewsM3LpifPVU329mmPKaWVAIxAnpq+Pnt0RZry7B+DS5W9nXMFmb/rNO3wteGFDoCof YMj/0GxrECMSjqKlEEaEdlLa56NPgh19J1Oe6S1FR8IEG8iI/2fHrUIaLVi3qCeQ+yj7nuhMt6D cUPj0P35gT2jjKA== X-Developer-Key: i=andrew@lunn.ch; a=openpgp; fpr=61FB1025CB53263916F9E1B7E6BF0DCBA6694C84 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791258051846523542 X-GMAIL-MSGID: 1791258051846523542 Make use of the existing linkmode helpers for converting PHY EEE register values into links modes, now that ethtool_keee uses link modes, rather than u32 values. Signed-off-by: Andrew Lunn Reviewed-by: Simon Horman --- drivers/net/ethernet/intel/igc/igc_ethtool.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/intel/igc/igc_ethtool.c b/drivers/net/ethernet/intel/igc/igc_ethtool.c index ac92d10a3e97..1a64f1ca6ca8 100644 --- a/drivers/net/ethernet/intel/igc/igc_ethtool.c +++ b/drivers/net/ethernet/intel/igc/igc_ethtool.c @@ -1630,8 +1630,8 @@ static int igc_ethtool_get_eee(struct net_device *netdev, u32 eeer; if (hw->dev_spec._base.eee_enable) - edata->advertised_u32 = - mmd_eee_adv_to_ethtool_adv_t(adapter->eee_advert); + mii_eee_cap1_mod_linkmode_t(edata->advertised, + adapter->eee_advert); *edata = adapter->eee; @@ -1653,7 +1653,7 @@ static int igc_ethtool_get_eee(struct net_device *netdev, edata->eee_enabled = false; edata->eee_active = false; edata->tx_lpi_enabled = false; - edata->advertised_u32 &= ~edata->advertised_u32; + linkmode_zero(edata->advertised); } return 0; @@ -1695,7 +1695,8 @@ static int igc_ethtool_set_eee(struct net_device *netdev, return -EINVAL; } - adapter->eee_advert = ethtool_adv_to_mmd_eee_adv_t(edata->advertised_u32); + adapter->eee_advert = linkmode_to_mii_eee_cap1_t(edata->advertised); + if (hw->dev_spec._base.eee_enable != edata->eee_enabled) { hw->dev_spec._base.eee_enable = edata->eee_enabled; adapter->flags |= IGC_FLAG_EEE; From patchwork Sun Feb 18 17:07:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Lunn X-Patchwork-Id: 202818 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp871986dyc; Sun, 18 Feb 2024 09:11:12 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCU+HijQC3JmgQcU75PsOcwaCvj0ABL1eQf6MeW1bMAPErnBVoVTByoTQiKVBrHG8DS6sJaHur6iu2EBV2hk1NWQT1kRQg== X-Google-Smtp-Source: AGHT+IEsPKfR3kRLIUWZkdqDXbTQch9JiY57oNC9xlMduNEiBMgHXFT/FkYQOuFUR1YZmqK7jIj5 X-Received: by 2002:a05:6402:32f:b0:564:5fd0:f30e with SMTP id q15-20020a056402032f00b005645fd0f30emr1059214edw.7.1708276271826; Sun, 18 Feb 2024 09:11:11 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708276271; cv=pass; d=google.com; s=arc-20160816; b=Uz12uwTv2rflagQJqrnp3VLBIPgVgBJC7HN09drU2Wp84Tg8xUaDl5R6nDpcU9cRLI PMy5rh/BxwYVmwenCyqPbrQCgeG3ZPudXolNpulhbHBODEoFcBBMDWnxH43NuCT8jbqd o/gQhvydt3dBZJmYgyp3rOQVn734mHtdL+vBXdwAVQFudhlq+Vr6zEO+WyYzHPQcCsrb Zcp9A0plwOsnkAZRny9kqnJZII0uaerzPdfJoFa2uvobzfaK+hDOtBXogcJIFj2OYEqc jJ4GU0WqpF8n1T5aIGLIXOCLf3JXTqma5+TD/wfDUGsFfTkYRzbiqPGsv3ppSJGABKLn lidA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=K1/H/lO2Y/ArsDeyXeOvrW6auZKE79iZc+y+GzqiREI=; fh=7ogY8TTBnoDyVw0Ew02z/XaZICVahvk3b1eitAEneUQ=; b=V2cr3AGWLqtkwiXp8QB0v06nUWl3n6qOQd4iMtsJbep1PIuEO9XaS/N8fgmY3qNfEe OUshY81IWuIzsB5C5+cEAUSCx6jitYQRjfsv/+sFYiJ4wpP4enNQYRD6yvw8R8KT+0lG AJV/6AU3WiPKUjbnfPIh0r5ooCfUAJe/dG04H6xMNEKmmvyPnMz81MJuaYa20gsvk8CI akIrZkOXZSjHNMZD6ndjqsKC1bupxJky0V4v2o/HKkH/I3zbbsnQJYd7Z29uU5DKtjOU 3MIAxhum1B0tanEH5oaKBDKQOOKKgdl/T0cNSqHK6IkJM7Fjyp4sRDiK44evOM71anZZ COCw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=joiWyt3w; arc=pass (i=1 spf=pass spfdomain=lunn.ch dkim=pass dkdomain=lunn.ch dmarc=pass fromdomain=lunn.ch); spf=pass (google.com: domain of linux-kernel+bounces-70456-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70456-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id e6-20020a056402190600b005645be35c6fsi611278edz.405.2024.02.18.09.11.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Feb 2024 09:11:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-70456-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=joiWyt3w; arc=pass (i=1 spf=pass spfdomain=lunn.ch dkim=pass dkdomain=lunn.ch dmarc=pass fromdomain=lunn.ch); spf=pass (google.com: domain of linux-kernel+bounces-70456-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70456-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 2F85A1F214CE for ; Sun, 18 Feb 2024 17:11:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 365827602C; Sun, 18 Feb 2024 17:07:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="joiWyt3w" Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 878BA74E16; Sun, 18 Feb 2024 17:07:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=156.67.10.101 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708276071; cv=none; b=nY8XlV0a4R8FtZYFCIbrb2rw8C6WDY6iGpnwoXUA5YIv1CGF93Z63JZJxj2B6K3kW5zXUXrpCAnalmDyeVe9Leqfcmk/mysPNNorp25ukTPNRG2DaE/A1npgQRHPdqxvoNDpRpgMQSDg2FPr06RbQLRMdB2QtmL9Ps7MDC4eiq4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708276071; c=relaxed/simple; bh=RuYxKjCx1KM7jfq1OwKbVsYU1FZNAf3c6Gkohmi02zY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=GD+nAXUsapvWqfUrgFzl1e2xk5PE0FZX1iyOopFm4yaECj9w6Z27A6XCfbhba7XeGypSraHLkta1vJan/ONX5/u2FPwktPmv7I7ff4ITRuz7NW7Z1qY2nYcEHrU1p/H2+ntBqAh3Lc4IihmvOYzBJ0vuet2xWYsDWA1y1cs5CIw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch; spf=pass smtp.mailfrom=lunn.ch; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b=joiWyt3w; arc=none smtp.client-ip=156.67.10.101 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lunn.ch DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=Cc:To:In-Reply-To:References:Message-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From:From: Sender:Reply-To:Subject:Date:Message-ID:To:Cc:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Content-Disposition: In-Reply-To:References; bh=K1/H/lO2Y/ArsDeyXeOvrW6auZKE79iZc+y+GzqiREI=; b=jo iWyt3wNQkr0ba9NPQR49VGysSetZVYZl/Z3LSOWJ58Zi725VzyYwtoLdURcMQbR6gS0S9aDaKdLnR zVUCRJPldpVlHgwlfMSB+g1dtn/SnH5h5jGh6HUJIhlbdMefBGTxfBXIPrm0zEz6t5c5xifrGZxOX 6lg+9b1oTRUq0m8=; Received: from c-76-156-36-110.hsd1.mn.comcast.net ([76.156.36.110] helo=thinkpad.home.lunn.ch) by vps0.lunn.ch with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rbke2-0088HX-1c; Sun, 18 Feb 2024 18:08:02 +0100 From: Andrew Lunn Date: Sun, 18 Feb 2024 11:07:06 -0600 Subject: [PATCH net-next v4 9/9] net: ethtool: eee: Remove legacy _u32 from keee Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240218-keee-u32-cleanup-v4-9-71f13b7c3e60@lunn.ch> References: <20240218-keee-u32-cleanup-v4-0-71f13b7c3e60@lunn.ch> In-Reply-To: <20240218-keee-u32-cleanup-v4-0-71f13b7c3e60@lunn.ch> To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Ariel Elior , Manish Chopra , Jesse Brandeburg , Tony Nguyen Cc: linux-usb@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, intel-wired-lan@lists.osuosl.org, Andrew Lunn X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=5127; i=andrew@lunn.ch; h=from:subject:message-id; bh=RuYxKjCx1KM7jfq1OwKbVsYU1FZNAf3c6Gkohmi02zY=; b=owEBbQKS/ZANAwAKAea/DcumaUyEAcsmYgBl0jlBT9FVJM6jr1aNdxTyfnA2A/SCXlRGYnR35 FjwQd/txRKJAjMEAAEKAB0WIQRh+xAly1MmORb54bfmvw3LpmlMhAUCZdI5QQAKCRDmvw3LpmlM hEmiD/45OjbJdmoKPe3LT4Pn6JzQpmCkgG+uMi3Q8A+XS780OsviI9D2SJBTB9tUt9bS9mBq6CB b24ihU5CFCSOgNYlaAjJ7V3HQvueqM1YQRhxtVrcY9dgxZqbMqdS1jM5kEA/atcffWugNjIpd9l sB4GvqWhsEFZVLofmmIf+g2pl1E4yGcR4E9PNsOm3hDxRPs7Y0044FEvCMeM1FaF9q8jGUb4eAY v1nh72ooROoPtZ0O9JSaSCTdoNrLxjLOD6Iod/1PBrkmn37qc0O6QEh26JFgCKTVgn5Hs7Ubi69 Gt3fg6po+8nmeiL59eD155DwuyTqBLhoSs9vdonNpCuNhQBVtUU48esETVMGmShvbfKJo+NGV1x S5SeO5VE6ZrUGozQgl1lbANIzYRv9RjmChOh2WNK9aU329h2Pcm3YdkRgs+eB3sDUx2kixOZN2Q HrqPyMinxjko/SRQnr5G3RymMvvM2iGUSClC5iblmsiDlrc6dOgfdbuGjtOA4R/dfmS4JU9mGfC 2/P1LtxwPhpUYuLNQ8bP76NxN7Ox/sViWTiKs32UznzzZFQBeJNaTbiYCfIZ2Y6ul02AUHPupxO nCMK8OJbrS6VBrk0FRPJhgH/2OgrtRrNkb9L+I+LIror0v4DVw+lsopECstrrnryFvbYo/WadhE o2ewBq29LTRAYuQ== X-Developer-Key: i=andrew@lunn.ch; a=openpgp; fpr=61FB1025CB53263916F9E1B7E6BF0DCBA6694C84 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791257500153987536 X-GMAIL-MSGID: 1791257500153987536 All MAC drivers have been converted to use the link mode members of keee. So remove the _u32 values, and the code in the ethtool core to convert the legacy _u32 values to link modes. Signed-off-by: Andrew Lunn Reviewed-by: Simon Horman --- include/linux/ethtool.h | 3 --- net/ethtool/eee.c | 31 ++++--------------------------- net/ethtool/ioctl.c | 29 ++++++++++------------------- 3 files changed, 14 insertions(+), 49 deletions(-) diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h index b90c33607594..9901e563f706 100644 --- a/include/linux/ethtool.h +++ b/include/linux/ethtool.h @@ -226,9 +226,6 @@ struct ethtool_keee { __ETHTOOL_DECLARE_LINK_MODE_MASK(supported); __ETHTOOL_DECLARE_LINK_MODE_MASK(advertised); __ETHTOOL_DECLARE_LINK_MODE_MASK(lp_advertised); - u32 supported_u32; - u32 advertised_u32; - u32 lp_advertised_u32; u32 tx_lpi_timer; bool tx_lpi_enabled; bool eee_active; diff --git a/net/ethtool/eee.c b/net/ethtool/eee.c index db6faa18fe41..bf398973eb8a 100644 --- a/net/ethtool/eee.c +++ b/net/ethtool/eee.c @@ -4,9 +4,6 @@ #include "common.h" #include "bitset.h" -#define EEE_MODES_COUNT \ - (sizeof_field(struct ethtool_keee, supported_u32) * BITS_PER_BYTE) - struct eee_req_info { struct ethnl_req_info base; }; @@ -41,15 +38,6 @@ static int eee_prepare_data(const struct ethnl_req_info *req_base, ret = dev->ethtool_ops->get_eee(dev, eee); ethnl_ops_complete(dev); - if (!ret && !ethtool_eee_use_linkmodes(eee)) { - ethtool_convert_legacy_u32_to_link_mode(eee->supported, - eee->supported_u32); - ethtool_convert_legacy_u32_to_link_mode(eee->advertised, - eee->advertised_u32); - ethtool_convert_legacy_u32_to_link_mode(eee->lp_advertised, - eee->lp_advertised_u32); - } - return ret; } @@ -62,11 +50,6 @@ static int eee_reply_size(const struct ethnl_req_info *req_base, int len = 0; int ret; - BUILD_BUG_ON(sizeof(eee->advertised_u32) * BITS_PER_BYTE != - EEE_MODES_COUNT); - BUILD_BUG_ON(sizeof(eee->lp_advertised_u32) * BITS_PER_BYTE != - EEE_MODES_COUNT); - /* MODES_OURS */ ret = ethnl_bitset_size(eee->advertised, eee->supported, __ETHTOOL_LINK_MODE_MASK_NBITS, @@ -154,16 +137,10 @@ ethnl_set_eee(struct ethnl_req_info *req_info, struct genl_info *info) if (ret < 0) return ret; - if (ethtool_eee_use_linkmodes(&eee)) { - ret = ethnl_update_bitset(eee.advertised, - __ETHTOOL_LINK_MODE_MASK_NBITS, - tb[ETHTOOL_A_EEE_MODES_OURS], - link_mode_names, info->extack, &mod); - } else { - ret = ethnl_update_bitset32(&eee.advertised_u32, EEE_MODES_COUNT, - tb[ETHTOOL_A_EEE_MODES_OURS], - link_mode_names, info->extack, &mod); - } + ret = ethnl_update_bitset(eee.advertised, + __ETHTOOL_LINK_MODE_MASK_NBITS, + tb[ETHTOOL_A_EEE_MODES_OURS], + link_mode_names, info->extack, &mod); if (ret < 0) return ret; ethnl_update_bool(&eee.eee_enabled, tb[ETHTOOL_A_EEE_ENABLED], &mod); diff --git a/net/ethtool/ioctl.c b/net/ethtool/ioctl.c index 1763e8b697e1..5464f237d8dd 100644 --- a/net/ethtool/ioctl.c +++ b/net/ethtool/ioctl.c @@ -1513,9 +1513,6 @@ static void eee_to_keee(struct ethtool_keee *keee, { memset(keee, 0, sizeof(*keee)); - keee->supported_u32 = eee->supported; - keee->advertised_u32 = eee->advertised; - keee->lp_advertised_u32 = eee->lp_advertised; keee->eee_active = eee->eee_active; keee->eee_enabled = eee->eee_enabled; keee->tx_lpi_enabled = eee->tx_lpi_enabled; @@ -1532,6 +1529,8 @@ static void eee_to_keee(struct ethtool_keee *keee, static void keee_to_eee(struct ethtool_eee *eee, const struct ethtool_keee *keee) { + bool overflow; + memset(eee, 0, sizeof(*eee)); eee->eee_active = keee->eee_active; @@ -1539,22 +1538,14 @@ static void keee_to_eee(struct ethtool_eee *eee, eee->tx_lpi_enabled = keee->tx_lpi_enabled; eee->tx_lpi_timer = keee->tx_lpi_timer; - if (ethtool_eee_use_linkmodes(keee)) { - bool overflow; - - overflow = !ethtool_convert_link_mode_to_legacy_u32(&eee->supported, - keee->supported); - ethtool_convert_link_mode_to_legacy_u32(&eee->advertised, - keee->advertised); - ethtool_convert_link_mode_to_legacy_u32(&eee->lp_advertised, - keee->lp_advertised); - if (overflow) - pr_warn("Ethtool ioctl interface doesn't support passing EEE linkmodes beyond bit 32\n"); - } else { - eee->supported = keee->supported_u32; - eee->advertised = keee->advertised_u32; - eee->lp_advertised = keee->lp_advertised_u32; - } + overflow = !ethtool_convert_link_mode_to_legacy_u32(&eee->supported, + keee->supported); + ethtool_convert_link_mode_to_legacy_u32(&eee->advertised, + keee->advertised); + ethtool_convert_link_mode_to_legacy_u32(&eee->lp_advertised, + keee->lp_advertised); + if (overflow) + pr_warn("Ethtool ioctl interface doesn't support passing EEE linkmodes beyond bit 32\n"); } static int ethtool_get_eee(struct net_device *dev, char __user *useraddr)