From patchwork Wed Feb 14 23:13:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Lunn X-Patchwork-Id: 201578 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:b825:b0:106:860b:bbdd with SMTP id da37csp486938dyb; Thu, 15 Feb 2024 07:45:08 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWkEG1bjQoXhhqpNUU07FN33tVeF4XXsfntV4OX0+198RqzbaOJg/Hn6P6fPWV1FSz0Wt3ccARsA+uoMKFPaYOWpX37hg== X-Google-Smtp-Source: AGHT+IEB4u5Tihl/+SyIHwM4saBZwm7YNowlFAWDBh7wcRzWEgq7tvuZa87TNG/yM1juJfHPxnXs X-Received: by 2002:a0c:cb12:0:b0:68f:135e:a051 with SMTP id o18-20020a0ccb12000000b0068f135ea051mr1944964qvk.56.1708011908226; Thu, 15 Feb 2024 07:45:08 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708011908; cv=pass; d=google.com; s=arc-20160816; b=GVM97bvoMPINIMFtYQiWElwDubTfxFwRjjjWkrUFvOKYiN0YdVDXA/49tqywzgNOj1 x5k+uFhGQ01BPhStHSTDlX2pD9m/wKbRZx+bDMSuJOCK/L3MZ7Hkz2rNzTjTXj0sZYR0 9I5Aayb3yqpWC+CS4pXKRmnAiONBb20JvejalGJzzgK9qZjnvK5ZZgP8Jmwspy0PgX0l 665KjEVYTAicosUWGRh1T6uXLMIQlIZWlPq5a3JRgwQ5vXRY0y+GIAHn/rF/LzgG+wru FQwaBjqnR+DMQeUa1SafoLpAYSMSIcxy0bkBiBer02HOOhIdXm0Qv8yBLL2SBh9f8QVJ jS5w== 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=cy2kGO2U2TPr1pnz3CApIMBYaE8Xib0u+l8VUL1Ic70=; fh=7ogY8TTBnoDyVw0Ew02z/XaZICVahvk3b1eitAEneUQ=; b=K+6DPwL/YUHSvjmePqqTbvpqBm8pzo5Ixwt+MfKyenmPH7Rc1m4XwhmmZZuS0ZJc5d ImvU5ZexYf1IhzMJMXQldJOVuZjrOmxxJJGXi5IaKSePneYp1AOS5lqVuWK7sDYq1P5k i66a629xRjPXAThdx5xXw+Qr81IlpsV/CvFbbPRMr9KwjvoBtZ5c81mnhTH7lJLLZ3N2 YtqDRCgTE9mdtJhKu4IXPRqEm44ycPYqdvQXfa6zvAFr6YTr32HcOaii8qM+UyROtaFF 14WfwGDtKc7ax4Xcn5VCHz9rxRubtZy0sK1W+IyuKH9gZLf0LSgu3MKIgcjvx5V14OrL 8pmA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=uP0qoXg4; 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-66107-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-66107-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. [147.75.199.223]) by mx.google.com with ESMTPS id p11-20020a05621421eb00b0067f68fb505fsi1597310qvj.577.2024.02.15.07.45.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 07:45:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-66107-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=uP0qoXg4; 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-66107-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-66107-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 9FA331C28D51 for ; Wed, 14 Feb 2024 23:15:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D60D7145B21; Wed, 14 Feb 2024 23:14:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="uP0qoXg4" 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 54F3513F008; Wed, 14 Feb 2024 23:14:01 +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=1707952445; cv=none; b=PAa4BgPpOQ6a5Vv25Szp7k2fwBlPSullYdSdv2aPg6m5hw4PUA+jCHjnBukq6ZUuCoqcYTVX8hnii76XJnGoaUDEC7zERh9IBwQYdf0FMB2UNgoe+N5BOtLP+3qU8ADg+3Hryem9hbJlVcQXRk2SQqQojopbNrNaojy0+5BAc8s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707952445; c=relaxed/simple; bh=F0mfdZrj/FgaIdcQuHDCEsazFz0S4bAcsGtKqN8CFVA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=rOkCNVGJp+GiWZYaGesJPcAaCLylKupCiJZOU7rCOGEMGbB2yK+LAYyj9tmLmSdvXLmjXy3xMwJ5AQkcT7wD2BHO9pIMbcfqwTcSfomG7w4ikACTAQDQAyExoLY++GH+r3XYHPU2L5Sf60g4parJHZ1BKBSdQVY+FGgVYQ/1lXc= 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=uP0qoXg4; 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=cy2kGO2U2TPr1pnz3CApIMBYaE8Xib0u+l8VUL1Ic70=; b=uP 0qoXg4dx5oMZc0Iv6uyhdgoe9Ru9lQnFBArmstvh6Ryh545tHEHsdaY3ugqKteu7Y1IOCXWMp9rgO GgdqlDrQ6q11AmTyzf0j5+alk0NHrVjEKz5z73x5x+bXLrUNPYPLNS194Z6nFiWY9Pa40aG/QSQYy 6fYdFNkbXS9dGmU=; Received: from c-76-156-77-114.hsd1.mn.comcast.net ([76.156.77.114] 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 1raOS0-007pqx-Dd; Thu, 15 Feb 2024 00:14:00 +0100 From: Andrew Lunn Date: Wed, 14 Feb 2024 17:13:18 -0600 Subject: [PATCH net-next v2 1/8] 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: <20240214-keee-u32-cleanup-v2-1-4ac534b83d66@lunn.ch> References: <20240214-keee-u32-cleanup-v2-0-4ac534b83d66@lunn.ch> In-Reply-To: <20240214-keee-u32-cleanup-v2-0-4ac534b83d66@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=3506; i=andrew@lunn.ch; h=from:subject:message-id; bh=F0mfdZrj/FgaIdcQuHDCEsazFz0S4bAcsGtKqN8CFVA=; b=owEBbQKS/ZANAwAKAea/DcumaUyEAcsmYgBlzUkjfDOiT7wmdGuQ6MHVBZSDeJjy+AriB0xgA Q20DCz14HaJAjMEAAEKAB0WIQRh+xAly1MmORb54bfmvw3LpmlMhAUCZc1JIwAKCRDmvw3LpmlM hC+QD/41sRM9msf8/LaoNjawjEnqaKsUrkZRMAvhFdGWnakR1s85yBU4WSovRcxZgqZcvQpT5Uz t/lrAFTqQmkF+hwXQfIO70vA7rMKPQlwYHwo9LeCjPDLzToxyS/Ra0X7IL4B1xL4QkF6Ur64AlG lULMuLf+N4ZLMAOS49qCoy4hGhF0SYABPcNWPUisiTIB5DVCUfLXjftf4N920mW4S2bujFV2tHm PLaK+OPgTS+KQC+h8QT/2NtGOeQYkXmTXOt1+hTe2ub1l10aaK0+g9aXZ/43OJ4to5IPmVlFb9f W5+bd1Ty90uUqbRJgtAYWI8g3g3HNIRUCa+ULq6gupZjpiI6TT02lOKzIxE0J5ZWjz5jRm5+C3c yQ/iwHjvbYEtIdDVB3K+QRFuqMbZQ7c6soKqXblCCsUq/P/eIa0WInxJLiBy5Dm//ULswC9eoIn ouOtWo8WmLFtiHNXTUk6Ir1u0qhKxNniIdGuo4/5Aq/itlC0VNEuiDobO+m6GTo/Y1IbSeFjK8c r4JxtIvEirQgNc+Jab0LMkkztvc2uzi8JOcxbEn/mhYmc2iXI6cfZsOf5HTiWfTXI79VUnTJAKe sDO2P4elnZ6tOVyWiYqp0xRrS/mLpyTSNyFxMHt8Q2vMEGb6uVYqmFdPgwn3FtcoSyDXDH+yV0a GBSR1XKBtcAxH+A== X-Developer-Key: i=andrew@lunn.ch; a=openpgp; fpr=61FB1025CB53263916F9E1B7E6BF0DCBA6694C84 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790980294891357429 X-GMAIL-MSGID: 1790980294891357429 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 --- drivers/net/usb/Kconfig | 1 + drivers/net/usb/r8152.c | 31 +++++++++++++++---------------- 2 files changed, 16 insertions(+), 16 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..fa5e9b7f3bb4 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,23 +8925,22 @@ 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; } @@ -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 Wed Feb 14 23:13:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Lunn X-Patchwork-Id: 201573 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:b825:b0:106:860b:bbdd with SMTP id da37csp484109dyb; Thu, 15 Feb 2024 07:40:07 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUohAr8L1QTEY8G/9NyoImxevLvZEqeOU5u1BhqKTJN+U/GsgfTOI6aCIjEl4UA370BZuxP2/10gjDDDCBWXEFsr+wC0Q== X-Google-Smtp-Source: AGHT+IFyvugzxcdu1VEs3TIU5ZXTcIo3TdDAoAfgC25NHuCs4Ek5TB2Svv25S4ZO9BlgXgXsimae X-Received: by 2002:a05:620a:1aa4:b0:785:da87:825b with SMTP id bl36-20020a05620a1aa400b00785da87825bmr2959816qkb.38.1708011607182; Thu, 15 Feb 2024 07:40:07 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708011607; cv=pass; d=google.com; s=arc-20160816; b=n0RSwIgx3zMEeQ522zGPuv12Dt7e2obCw7o6hDDG5jhA0awTnTeibvOpZUW7BlEhXm r99pvgshbXfMTYjLCQftdVnH7N95ejcM+3ePxdnXom1bObjqdk1fy5pHNqD8aFTusmZ2 wMbQm6oIKS0pAkWoqUJGRsq2pMAoDGgZ79g7KvPwoJXPFzvunHRiNfQaV47NRljh8q4f hG+mG6grDbv4sliORRMBHoT/Beqdp2+hoT9m/STvkaOKBFaCICDGP6sQ6DB11IutKUf0 kBiTjrOMLOd1yDzM0VhYDfPJ2q6TXCyuQWgwMw6pHmf1gfw5FNBrFE2sA9R8fTDF/Ue7 MZ5A== 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=P+iVOKfe0QUAmq5u62aYl+kgowfoyTeuYGFA/S6XHMaSe7MrTuU3QuyyxxrNjlRzZF bDA9UyVBBb26PcTsbnYkeeKHFM/QnXIm5IcnqgOPqQTrMOqpzo6Cwye+SGJOWiS8joe+ 1bJF4jHSKNy8HvL4q0m2UBPG75soKyV0QHwVM42RpGDWNWuTvymZJ5tWHcnaPtTOLVOy BLS2TavQV0kLkf6ZfnEU4jKQvB6aLkACEAsHDUhBQLmh5Y1x+FkXg56oozoPgvMwWm8q qC6edI5+w3XNEiNTxk+vlH8vXI3guFzuvC9l2/m11qU9MHG3gyyfB7ljxnTb2D7fJChI 64lw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=EcmZlUX1; 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-66106-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-66106-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 ea20-20020a05620a489400b007873ca4eaaesi600217qkb.660.2024.02.15.07.40.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 07:40:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-66106-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=EcmZlUX1; 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-66106-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-66106-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 9149F1C289FD for ; Wed, 14 Feb 2024 23:15:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 18220145356; Wed, 14 Feb 2024 23:14:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="EcmZlUX1" 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 96CA68662D; Wed, 14 Feb 2024 23:14:02 +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=1707952444; cv=none; b=pTDRFHkih9ch9ql+gDcMvAJugZH4K7K0muGDbWN3LEVoKvpHRU7QEeO1coIbO/nOCkWkwEYSoNN55Tpy51/lVsE2e8yq6u5Bhvcb9OLdeP7ymIV/7Rh/uURPIGbjAzMTvJZ5busFHe5meElnRdGDqhcuKSSPkHl5keIrjoc/gy0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707952444; c=relaxed/simple; bh=Cpjch1b1D9Jp2vWORWgwbDnErRScd5QZqvv0qT6yMzg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=GJFPHdY45EVHKi2h0NAfgn/nNKAa6eE0vmVsEhcyz+w+AfKJlDq2avYRW0FB86Nl8CDnQ27QYkDjORyDTlRi9ZIbs7NHobL+sboWBSn3oxeqiv0TmVWhzbcKGAym+WmxbV0QVEdgptQv3IVvRUszX2sMpM2rcVZkyTPosVmdBRE= 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=EcmZlUX1; 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=Ec mZlUX1UNq6CGMMG95w8sPC14i27KZlqTSZGKA57NsJlVIjQ9FwBDhHwxtaz0l7cr9Rq8uq8kM0WZ3 92UOvFqNHTCZ4SfH3RNOO5NPv6bFmkB0tAfrilrUSTg7Va5DRXNIWvPu2njlgshDVWGx3ylPCQDkf BsYBfLxCM0LqDK8=; Received: from c-76-156-77-114.hsd1.mn.comcast.net ([76.156.77.114] 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 1raOS3-007pqx-Ma; Thu, 15 Feb 2024 00:14:03 +0100 From: Andrew Lunn Date: Wed, 14 Feb 2024 17:13:19 -0600 Subject: [PATCH net-next v2 2/8] 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: <20240214-keee-u32-cleanup-v2-2-4ac534b83d66@lunn.ch> References: <20240214-keee-u32-cleanup-v2-0-4ac534b83d66@lunn.ch> In-Reply-To: <20240214-keee-u32-cleanup-v2-0-4ac534b83d66@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/DcumaUyEAcsmYgBlzUkjg41ZWDOkDbY4cl40Mp4plWC8lPr7urE1Y xR07ZdFiaeJAjMEAAEKAB0WIQRh+xAly1MmORb54bfmvw3LpmlMhAUCZc1JIwAKCRDmvw3LpmlM hN6FD/9iVloxbhIqi9a5XdLaZHPNJhtehuPbEtTJcduK9CjOBQJo3/YJ61KGd5GbWhYvcbJUM3p 4ORL4n3zpsPJLCUpmyb5AaBpHGVpl2jVow+BXmYTq3ak0SAFy6sZEE9jH5csHzwd3VLbG4Aaxey YCYCdG/Lev2aCsILsqNXLSVlW4pe6bx8qGmhulchBIj6VfjJfbWJjC1DiIRtuUKvQ9SFLm27TvB sQTf6/jPPT4O2AlgHq+DtIie2a16S0KezI75fuNiBzY2g5/uefVcHq9H++6tAKo6D8ySCG/lP5f NVpTZA0/7h8yDd70FNNOxb89bjpEnWUlJrE/bS8ujD3LU83Ii02+e4z7jrwTCnhc6HeiByrWMVm soxaZ/7BEhvn0D3tQEwjRrQyWizBT6Q1P2M1pAGPq1rVPoqC206dBW7YdZ2Gx60O94+NACvUvYE DmJZ6yE07Xfnec7nQKx44bqjfO1Z5ciykD7+m8QlfJ3hGgaS6B5raS1q5t3qP8NnHU/4JMNvp72 R2vojGJspg8mEglMV6ZY5zzHE39B02NfEPQTqBGz9k+dgO7TtfTVADuCnO8AzvUAoYuvC1fwht0 2rVfbJluv7EynpimelGOXDCkEURXHWnmD9calR7xXpQmbKJs5ol+gtF0Th+v4CSxDiAxBVrl0pQ T0gvmhUd+Tq087w== X-Developer-Key: i=andrew@lunn.ch; a=openpgp; fpr=61FB1025CB53263916F9E1B7E6BF0DCBA6694C84 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790979979233145927 X-GMAIL-MSGID: 1790979979233145927 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 Wed Feb 14 23:13:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Lunn X-Patchwork-Id: 201524 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:b825:b0:106:860b:bbdd with SMTP id da37csp462485dyb; Thu, 15 Feb 2024 07:08:28 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWpw0naU4/zici781meAWt7g+J5gXLcH5vXON4gKCXWadWgXNhc+AMZFGbDAWqk71WRJYJzXb3Erv2PMKJWjXrT0aI1Pw== X-Google-Smtp-Source: AGHT+IG5WJXGPEow8+n3OJx5oj3D3HyvFv2tF44QiCFakZ9TKDn6QRlWHDKtxZyP+rdrmSepfNI6 X-Received: by 2002:a05:6a00:a15:b0:6e0:42f4:ab39 with SMTP id p21-20020a056a000a1500b006e042f4ab39mr2538763pfh.4.1708009708674; Thu, 15 Feb 2024 07:08:28 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708009708; cv=pass; d=google.com; s=arc-20160816; b=eavomYOKxZqoaqWncMDQ8OXCqpOJ82WHJWF3g9y3sPHo1l0rhZ7x/cT605CcES6iVa 9Lw8hf/TFVa46idnHVazdwZE3KZUDTwn4cu9EdndxLCxzoojWd3p/jT476T7JfI8WA12 GYwq73EYAKA2tF9br0ZPU9Avd4NCFOLX8rutx35aIqjtieeTS9xJGpH4xdEmP1JB5t+s nG7oP2UHWivB52oxuxIuMn3U9vkxp/sn2mYIaj7aOR3VEHIHqP7mXXhU/wKDDq0SYZuk fkMJt+wo6BNeCBW4XcprTqdeT7sBXxOuUSPG0lWaNwpxqLmYKe3MijDQd3yK3eM4yVKP K6aw== 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=AxkCovA8WTklS4qklske5XSSr6YrvNsrFCPyhLF3kWfzzhnJ7rI5/Qu4etafz18mzz sc0DUL+V2ScZF64qKKjq5Ugl9ovmZ6K2yP5VRn9oePwkByO4tAR0GW6E9TaCoJWStenQ 0tni6F2E5B2msrcMqs+uBb6mXQ/F9jvmwG3+bNuqSRpJzeOe6aCovxrY9g14G2H1a2O/ HpP1CCPGwzTq2eVgbo0/Akaqj9QZauh+yTMU3ioK+Knn44aYJKUfP3pKn0/2C81pTFbY TlVGTkSMITcK5+X0vml1TT6lNwAT+sgxcORHA7cMFJG/X2RG0jVjyQ5RAB+qgZ2jyVlr YF3g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=dIqo28Ti; 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-66108-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-66108-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id a22-20020a637f16000000b005ce0be7966fsi1222548pgd.898.2024.02.15.07.08.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 07:08:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-66108-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=dIqo28Ti; 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-66108-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-66108-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id EC3F5B29F99 for ; Wed, 14 Feb 2024 23:15:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 18637145FE7; Wed, 14 Feb 2024 23:14:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="dIqo28Ti" 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 EEFCF145332; Wed, 14 Feb 2024 23:14:05 +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=1707952448; cv=none; b=GWFhL2SPy6ijQLIfiQsJ/M80VK88O8wvZopKjMcXnI9FOMYRD/fEbG/GgF7jnRCbg5L7OloApnBqFwC66RF+4rchC+R8aClYCkAUPDf+Bx/aQglPOt9NsAIf1OMvJQvsH+4N4HD5mhMyzy+75s75HkmpF5P+sMgy8naztQCOJgU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707952448; c=relaxed/simple; bh=w1DJYkt9FTZRnNhfN8ZM1D8JVVgGCSqPVVQnR9uVLaE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=fx8hYuOy5QMxA0F3mCDCbjmij1mR8grD0PqxvFzdEatsLCEX7+tc9mBjIN8A3HGI8p5jqRuwqLpuReCyuDN6Oubl7SsuEI9awQoFAtH8g4VEHInM4BZqo4DdYsEkblcQDAAbd9OzyX39eYEGmQHwbgmuZsANFaz9GvrWz2D4Mcg= 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=dIqo28Ti; 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=dI qo28TiVHsgnDlCbxnh68GM9Zatv6Sci78O0cUQy2nNvNRJOu5GGXgTmeiJKd69Fww1IFBXthHNpmz fjyLfZZFSh8TxB81ZUS+W3CXRgHnT7FQfuKn5nxjlKu/Ajmv7gKP8cdBUvoBLcSl8KsWovh3sMxtq sVaH3tsLT1XzcVs=; Received: from c-76-156-77-114.hsd1.mn.comcast.net ([76.156.77.114] 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 1raOS6-007pqx-Vb; Thu, 15 Feb 2024 00:14:07 +0100 From: Andrew Lunn Date: Wed, 14 Feb 2024 17:13:20 -0600 Subject: [PATCH net-next v2 3/8] 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: <20240214-keee-u32-cleanup-v2-3-4ac534b83d66@lunn.ch> References: <20240214-keee-u32-cleanup-v2-0-4ac534b83d66@lunn.ch> In-Reply-To: <20240214-keee-u32-cleanup-v2-0-4ac534b83d66@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/DcumaUyEAcsmYgBlzUkkII+d18nk9TsjScFtFJDnDHC6I2nLalnU0 zBCp3NJkTuJAjMEAAEKAB0WIQRh+xAly1MmORb54bfmvw3LpmlMhAUCZc1JJAAKCRDmvw3LpmlM hGTQD/9padJ5okLCRydr6Wbzfdd810RJWCKYWF+vx0xycV5WdEaNoKa4AHigiBEcpnhS1umpB4z CfmZyHOVZVBsYgwiqPqFRFNCtqx3XPXfgt7eifpr7kN6M/kji/gIL3YI04Ju0oyjQ6CkDnQYOlD jVdef55dc8kgI9wPxPNEk7a37qKr8r+ZKO5ZpFmE82yYuFrzMbJtKsynd/H0LD7h9COt3n2o30a NfoSQRbwMV0/9tJrOapAQprbL2YnI6kzfCumMH1zpG0fLk95JTIt0k5pVTp4bNAdhg/bYqQwIy4 dNDtEuClGKFfKTCYAr0w8BsbaefFGqvEkq/4Q/fyV1Q17misQdDgzN2Fm+GRVg5oe3S/4icgjOX XbbAz6J+W7t19mmLieCTLgkmfO6rjX0cYIeV0d3o150D5EtIGWpVtdw/0Qe2fgQUWWV1WCxO5/e JSB5MPGuUySE+h1TyrudJIWM/Aa4FySmQXmDReesi1T1HoYhhNLW13rIOL15o2nctnjO8TcK+nW kK/TdzZf+cKUImzxMcSSKvl598E/EByvVC6/2xOHz4ZV6ymtdlerJPplgVrmh0y3ISeCmI7VMWx 8iiFSRigWoKJe+y+JubyjJfGhzIqPqVTgo/fjB8zUmTZ94AUXas9L1gagTP7vhWySqZN5dY7Zj2 m9KMHVuknOrgKOA== X-Developer-Key: i=andrew@lunn.ch; a=openpgp; fpr=61FB1025CB53263916F9E1B7E6BF0DCBA6694C84 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790977988470047433 X-GMAIL-MSGID: 1790977988470047433 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 --- 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 Wed Feb 14 23:13:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Lunn X-Patchwork-Id: 201579 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:b825:b0:106:860b:bbdd with SMTP id da37csp486977dyb; Thu, 15 Feb 2024 07:45:10 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWdzStIN7b6BzdplEjwUQNE+uJTaGdpylunziXldh9OalZX6BNzmZ81sFBnJQtmf3szhiceoRLEzzZDwgA40PG4ikzm8w== X-Google-Smtp-Source: AGHT+IHrAxcpwshv1+9bWcsFWZ1WveHuYnJqI4EdE39w4OJgUjvh2ib9qsT1QZNr0wxAYSkOl3G5 X-Received: by 2002:a05:6102:38ca:b0:46e:d0ab:b28f with SMTP id k10-20020a05610238ca00b0046ed0abb28fmr2167291vst.4.1708011910665; Thu, 15 Feb 2024 07:45:10 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708011910; cv=pass; d=google.com; s=arc-20160816; b=VJWqnixHvPN5UZEbJUZaAw+e0vZM31smN2wODK1d8Mwl/d+VM1CVNzNmVDiJWc1olk QP8DYAoHDZcSOUDl04HMoHofaN/yo6jFYQwmNuh359cwDqN5yOsuFtpgYiL3qaShso6l N8Z6wGme0KZ8EeAiUUBE+zAPaNlrnytn60WFtd3T2H8uy1CK1zDAPvSrekEsE2lsupJe 0kdrY9NjsRhWCrzUqz4geJNh8OPA7+23WRSe893ZuYns3FhGlZE4yL/NXISIGrqvhEku YNLG8pJCw1eJH01d7pWOIinsQ6xNrJaZFkzdCn5x5KzXUYiUrm4c5tX5st7LqboBEFJz aF2g== 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=FM74o3OI8b9RT/w1X7WQHMsjr7LiCOXNHn4Bg3yHfal0ZFOsO2JebOP2NJlyHp4nYe 2qTZ78gwxufHKcBt1fxBfosP/rCiANQaq0/31TmnY7342y6dSkd9purMcUGV162UHZRh WVwFSZvLDWY0zwx68w6g38TqBCo0Jb4qTcpJ4Mm3fcvACAucfc2R0LfX8Ace7wKZF6gg yn8g3f/ObdUu6S/L0DHZ1No2w+jG7MznrpoLMutsZzu3Pz+UQu8LV1hWk09Fg3PxOE6B xCpnR3k25a/7X4a9FI0l6UzDPRi924ENk+wX8x6QcXnTwjZR25EsCQ0gzit6TE3wK9/j MY8A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=zemVsAkM; 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-66109-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-66109-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. [147.75.199.223]) by mx.google.com with ESMTPS id o9-20020a0561020e0900b0046b18add795si280279vst.21.2024.02.15.07.45.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 07:45:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-66109-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=zemVsAkM; 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-66109-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-66109-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 9E85A1C292FE for ; Wed, 14 Feb 2024 23:15:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 66B0C1419AE; Wed, 14 Feb 2024 23:14:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="zemVsAkM" 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 93766145B18; Wed, 14 Feb 2024 23:14:08 +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=1707952450; cv=none; b=KRn74UQgUeWE/Z2edL2FYs5QPJd2l7tLro8WIwVEomK3BlBhoSKU98V9Jpw4h/HpuFH/h1oDz8AyfuqSupZLuuNBEQsyY3IgMojdjpdFdAJbKSiinH6Hq1kn6p8qruBYrPiY760D82xX2XLMNCPQZo7DPxjUjSYDNw1swhS1oM8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707952450; 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=ARkK3Z+QcvSuvFkcqAVjHZoURfZrSsXG76KCkjvx/Sm+ik6bFcawvaVfatQtxpuNLtYiQYy95PCwBwj82eTeOyLhwUzl7S8+G6Qud7HUGRkYx2Nuzxa1Di97JSWUPogHLiZw/5LLggZznm6JxjmlBAwlsFiPY9Ps8IM7cfXshSY= 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=zemVsAkM; 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=ze mVsAkM42tVnaeAhCmEdTmT2utCzw4dvfivzVxx4c2xvMHO+8FgMraPMDso2wUwPxcJUPkP6+uRyll 0OIoF1ofJTFP+S4XNtQP+oyY45oUwuvdspzd4LynSj/K82Zt5NPtfHoIgOJCiWJ92VOiBsuJh6G6T GiauQ6Vi4ve5CJY=; Received: from c-76-156-77-114.hsd1.mn.comcast.net ([76.156.77.114] 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 1raOSA-007pqx-Be; Thu, 15 Feb 2024 00:14:10 +0100 From: Andrew Lunn Date: Wed, 14 Feb 2024 17:13:21 -0600 Subject: [PATCH net-next v2 4/8] 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: <20240214-keee-u32-cleanup-v2-4-4ac534b83d66@lunn.ch> References: <20240214-keee-u32-cleanup-v2-0-4ac534b83d66@lunn.ch> In-Reply-To: <20240214-keee-u32-cleanup-v2-0-4ac534b83d66@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/DcumaUyEAcsmYgBlzUkkpnErWegm/hSZ07cibEcmZhVFuZh0VmzwH yKKGsm+iR2JAjMEAAEKAB0WIQRh+xAly1MmORb54bfmvw3LpmlMhAUCZc1JJAAKCRDmvw3LpmlM hPNGEADaErtOXgBoRPoBdcW946pa6SsqV7GkF3amERUOi2by2ZZL0a1l/DKUy21dxJk3Jqhqdvy xQz9ytLj+BoSQ3pkP6boKqTEc2h66Xft9MJkn0WEDlrh4hv1gDDvrEG+r2oqpS3BzIRQ6HDv+UI Onxye18e5AYhM1TLl3M3zqsj/rP2AV60tCmGxfiKpmnNfeXQoDsAzjTgR6ddqUYJk94wOS38BAc IqD9WYERvj+MCPjTO9cYFxZR8MWFExDwFtsH4viE0yiMnrczZuMqAqixzlsj0TJAY4qLzpaNQA3 1z/Dtms7OWjPPXtxtg+Bqzi86K0eRMetNz4tsZG7qmdRcKu7jfFw3rTvIgtYQTJ6Hhv4IKkkJ64 +aVN+ejcgnpltjq19ACrig2Bo1L64ZT+JI0JohbW9PUfChB/qiZjyv1SuoKz6hgWijv7FSKFJ9C 9D5jkZBKWR/UYThQmztZWcOK9D0knyi7bsZ1TzA2uYpHcrAcmBcWzyZxWFJSi0xmfMJsZp757Es aEhfMHpzsrYeB5Z/Vp1X96EtjSazjo+F7edCYXeB2PeZPrW9PcSMAcZLmDH7HJDyCnvKyXNBUKB tEdCJsGDQeekrpQ3uXW5BBf/JuQidxQGztguFJD4XTTaxMB7DisHH0X1iK72TdMT03lOlcb9Jjo WWWpe3OcHwTsCiA== X-Developer-Key: i=andrew@lunn.ch; a=openpgp; fpr=61FB1025CB53263916F9E1B7E6BF0DCBA6694C84 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790980296756123042 X-GMAIL-MSGID: 1790980296756123042 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 Wed Feb 14 23:13:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Lunn X-Patchwork-Id: 201637 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:b825:b0:106:860b:bbdd with SMTP id da37csp511923dyb; Thu, 15 Feb 2024 08:21:18 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCW1DIqHkrOv27FvZHvRRftrOQR6MAmu39BE/Vag3gCifyHyCnqKVUMK2lOVrZkqnF8gM17VefSoKu8hpAaUByhk/UWQpQ== X-Google-Smtp-Source: AGHT+IGSgiSUvqkjyvOyY53NK94VPFULnsET6Os7EZSOh6zGzm2pOmb84Kr0Dp7PbOMd2MsEcB8z X-Received: by 2002:a17:907:382:b0:a3d:841e:3d75 with SMTP id ss2-20020a170907038200b00a3d841e3d75mr1587548ejb.61.1708014078152; Thu, 15 Feb 2024 08:21:18 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708014078; cv=pass; d=google.com; s=arc-20160816; b=PhoExQs+mgGAfxQlmhXTRf2Oel3p5FoBv2lUQVMUpgmg0RhJXfWObe0wFLAV86tkKt BHVkQR0tlIQZJ5EkE8jzbpd5qRTLOxn9cbtYtLS0BckYqPE25wsUL1KgERX1mqBNhbO+ UQCg+6Yq5Aq5GXDknafD66ffQULilYYm0cVmpxrvgYiwQ3Yrck8N4Sz47K2xUC1s0uY2 r/PkBJLxJHTTWx0mSGjfSsjtkiavW0RN84bqu1qIBbyT8LITMra2p1uEZR75ehXthYC6 IdiTJPHv+zop3BdF4S5AIXrTUNpJHxF3jSLWDlqhxKAlFcjPamM+2J0Ohqqw9f2dFUvL ETKg== 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=49iqTWfS/7oGaeehgWp7vgxQU4YHET0VID5+MapWGoc=; fh=7ogY8TTBnoDyVw0Ew02z/XaZICVahvk3b1eitAEneUQ=; b=ZKiVU73cnODsH2HDx5voyX0XFZ/Vy8PIKbKZmE2CnPO9jTteLapTXsj1Pgh82NompX B/dcRzgOLb+raCdL4UzWk+zTLDWyMJWK1spUkneKR04VuXzxhIwxkBg/usGTRmtmzfa6 71ZJtJRwEqcnfdoq8E6v33Ot52qzpLxHoMfoPBzleItc6P7gmApBaHhuDSN6SWL/N1jz jbmu38lmO4xue8e2kHI6HN6NJJk1pwYLHLRK6YyhodQ9Le/kzCj3lg+EZSQGUBQQXQJ7 X/jz58jGEvfR3aktxheFFXQCVnR85KMalRjWmYcboUCDyoMcUMLAeOQ4p50JOVaxdq5Z gdUg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=nYISlLWx; 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-66110-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-66110-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. [147.75.80.249]) by mx.google.com with ESMTPS id u17-20020a1709063b9100b00a3d539ada16si797551ejf.433.2024.02.15.08.21.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 08:21:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-66110-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=nYISlLWx; 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-66110-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-66110-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 A6D621F22399 for ; Wed, 14 Feb 2024 23:16:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AF32C1419B4; Wed, 14 Feb 2024 23:14:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="nYISlLWx" 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 7F19F145FF3; Wed, 14 Feb 2024 23:14:11 +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=1707952453; cv=none; b=OkX/nqt8tJhGzU1f4qjoLfKjZG7HWzVpr0iZ34uJVWYCRGiB08fydIwlsKL/YTVSfTqTOg6mRmOOqx2VmlxoP2Cw/V5Y8ZyDErLmfMhHiBYDjCLjCMn1LA54ZKLstymT37AvZXAvWL6S1OYnP1+dvjJbYsumng02UnGkAcU2xFg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707952453; c=relaxed/simple; bh=9+M44JGWsDWJYIbg9x3Eie/quc/6CSKv3btaL1mRVk8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=mK9++Vr8qwFZuwCS1NtY2iEMV1qgaaSOV9Gip6Q5bHe3156UPnbr0XzQKCQWluywXjMwPbsyXfL8qRzezyIG5osgbK+GAdL6EDHI5bjMFCvGM+cfhYG2iSP6U5a4DvQJPbQx8hB/EYl/5FjKu6ROv4UgyTCuelMD3OYPH1kQb9o= 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=nYISlLWx; 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=49iqTWfS/7oGaeehgWp7vgxQU4YHET0VID5+MapWGoc=; b=nY ISlLWxsAC6LYs872WEaIwPQGL6ohm+NGpCk3V02m6hb0+iElzuP54/oahiBRVEUL7KKFXZuFtrc2M D8kJcxZzzgKydkEWgg79f2HdeA4AKHCNCGypqZe+IKjmZCOh6RqhKgAlsU50/sSMdL0dHazSyM4Sn PFgbk8YgbySfDD4=; Received: from c-76-156-77-114.hsd1.mn.comcast.net ([76.156.77.114] 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 1raOSD-007pqx-KV; Thu, 15 Feb 2024 00:14:13 +0100 From: Andrew Lunn Date: Wed, 14 Feb 2024 17:13:22 -0600 Subject: [PATCH net-next v2 5/8] 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: <20240214-keee-u32-cleanup-v2-5-4ac534b83d66@lunn.ch> References: <20240214-keee-u32-cleanup-v2-0-4ac534b83d66@lunn.ch> In-Reply-To: <20240214-keee-u32-cleanup-v2-0-4ac534b83d66@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=2657; i=andrew@lunn.ch; h=from:subject:message-id; bh=9+M44JGWsDWJYIbg9x3Eie/quc/6CSKv3btaL1mRVk8=; b=owEBbQKS/ZANAwAKAea/DcumaUyEAcsmYgBlzUkk+rR68hA2G2PyV777v/AUcs9UNwvnxswYZ A2Rl6AaeMqJAjMEAAEKAB0WIQRh+xAly1MmORb54bfmvw3LpmlMhAUCZc1JJAAKCRDmvw3LpmlM hKLQD/9T1pxSQXqLaiLLzt97eAe5eh4P4BlIJxZg5HlocwxaIeSSoaLGERNr/OWaT4TIKyGRSh/ lZirct/22D1jAULjbl9oYWmQB9d8OOy9gXWKqp/80sCszIHwXJI0X6918X1bNsl2A390Wil7wSa 2Ooi2TvFjVLveS7RDsggmbplfNeKdLQp7VmCWB38g9F4PmF2dh2EjSYX4d925lVwUt3kvXvI53G WlCNpJsZpt3VELBsJacfYDoYaFXhOAvXUwl/XnFVw9effCslhGDxGhKYKWZP88rBRDTN/P7iDyy dqQCRdgKqSbSDErdgHgrL87BCuf7zi7y4l0zb3g3L6Qk08AwkOh3Ct0cvm8DBFdisvtfFj09z37 Peh4XLIPMRS9PbHiJUaus/LEim9eNkNZevLOEYG6RsRp0IoRrodKhGdFkNXh1RfC3oJJJPtxLXn rSz1K4nqFO9X2g9Yq7XZ/kEKTaajs7Ec3GQ/8Iaea/5V67HwgD2LA+bBCZfMhxOLJXiomLSrPJK qfqXSwBLPmKiU0iKISe9X5QNeHE9bi0u8LhwP7vHzR09cW7z/f+jH8pL0MeLxLRv3bdcmP6mzOp 1UfSIvRKDjhnDyDCo+K4F925AKdrHB7XI0w57CqJZIGR1n8aGJp4OjbBgnlQ1Op0SQolefAhA1l TWVacQfReSV1M4A== X-Developer-Key: i=andrew@lunn.ch; a=openpgp; fpr=61FB1025CB53263916F9E1B7E6BF0DCBA6694C84 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790921146334048151 X-GMAIL-MSGID: 1790982570121302205 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. 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 Wed Feb 14 23:13:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Lunn X-Patchwork-Id: 201639 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:b825:b0:106:860b:bbdd with SMTP id da37csp512484dyb; Thu, 15 Feb 2024 08:22:22 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUINneNN1AkPr4zt0e7NkDCJ2yfytO+7eF+IC2+tFrrLcyMaE6HYRbyzLxu1sCqz6ksBq3ZqQCC1Zn9UGVNDl0jkUQhgA== X-Google-Smtp-Source: AGHT+IEFfwaeR8Yy85FpeIcF43H8Wrf8WHoGzxuppvRvS8qHEaCqs3iF965oxi+ZYJ9F/oTb4To8 X-Received: by 2002:a17:907:382:b0:a3d:7d05:21ac with SMTP id ss2-20020a170907038200b00a3d7d0521acmr1761000ejb.53.1708014142099; Thu, 15 Feb 2024 08:22:22 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708014142; cv=pass; d=google.com; s=arc-20160816; b=AHtRp+3gAKcSJKosJF0PrELJ4/HnwUY3Apjd5QzyIGdeqacHzlPQJ9nLypkUR/oxee MNZtXC9YGpIMCFOw5nLEjKhIxLqNvbhEgAlR7GKBe0H4m9EB/UOR/bUeksHjxVlGnF5u VRDm7kSRaqSrTe1bxmnzOWij1P547RPSJR2WNEQgcFlWo0vjFrq017B3Mc3I4sdNNd1V JUW2reiPg/MjDDCDoWXdrOYCr9KohBJAqMHCrvnp29kHast9PTE3F3cRLOe1M+xNY5In 2yEgWumuJAqt9MLfVpUWc9fUsEK72TWOcO5ziNGtHP7eOpDdZS5sbD28zii7N5Zbg5aP WgJA== 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=jSuIBWXyJRZfObqBHrcQs1Hji+t598/IllJp4dbmrKNM1o8ZXUz2HwZ9yWL8Zuq9/e +2tjdu4cYkn+ci/vjoCRz/eDy3r8oYskG7lbMhKm3dkVxo1XCbnXWTyghaEaYDUtLI39 yKd7cRZNhshEA9MvDkZ9ixZcuR+BCjyh1jukNyPpbIkqYBcWzV/UnMQRCYcvFBP4j1q9 W1jz4hgDb6pVQa4Plu+h9na9gv52kL3BUbtmU+E2j+mqZtZkTyy8RrX1EQs2MY1WuHq1 nRru+kHPZeA7zjJHsTs3CYq6qAXe++mkeijy+rhaoHvhrZ6G3Ztqv5Xcqk7yTy+WiqJL OT2w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=RUUb3Myx; 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-66111-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-66111-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. [147.75.80.249]) by mx.google.com with ESMTPS id lu26-20020a170906fada00b00a3d813eb233si751429ejb.555.2024.02.15.08.22.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 08:22:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-66111-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=RUUb3Myx; 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-66111-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-66111-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 C03A01F2BC1F for ; Wed, 14 Feb 2024 23:16:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0F6421420A4; Wed, 14 Feb 2024 23:14:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="RUUb3Myx" 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 CD9311468F0; Wed, 14 Feb 2024 23:14:15 +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=1707952457; cv=none; b=atVTJ5YZnhy3aaeeT7tip7rY9VCvV8j9UJn4TbmfufsrlLRrjWtuqsVYddbKN6cXVa9CGUNLdnUwef4jLWYN5N0a19G7KNZmms/zFcba2UIfb8LcKJrACVYtOalp5bBsMDqrCBTR2RcS179jfsGaobsjN3Ee7iZLRWLvf8eDo50= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707952457; c=relaxed/simple; bh=nLsygJVJCduLk95szsdKOpEa7GzGsR0GfRGWNH5oTU4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=G3QwPGIuS8n+9/hn5CkDjXgb/8iPrd+DNw6KM9KG75OtH08RMn43LNG22emFwd+TVmFGkT5wNE56xQyMX6wR0ADrWfRWjUH2bz15izKyxdc7zVgR3lZUZElCAU3EBbgn4wVXqL8d0wyjZCGSFDHKdmgodfqx1mSHYzj1KaLB70A= 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=RUUb3Myx; 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=RU Ub3MyxHW0OHnH2+JYo4k9foRknGy5oKWm0apnay6fyshEe7Y86ypbdPNMO/j/U2E3/2kAd72ZnFya 6iLKJIRn2MqU8Hm0ZwOAA0CaLYoUENL0w9TCzLEGz+n8VGvPtI754yU7J5Sv3UGM/mxXL1DQvow5e vxgLUpohAcI7wD8=; Received: from c-76-156-77-114.hsd1.mn.comcast.net ([76.156.77.114] 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 1raOSG-007pqx-TN; Thu, 15 Feb 2024 00:14:17 +0100 From: Andrew Lunn Date: Wed, 14 Feb 2024 17:13:23 -0600 Subject: [PATCH net-next v2 6/8] 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: <20240214-keee-u32-cleanup-v2-6-4ac534b83d66@lunn.ch> References: <20240214-keee-u32-cleanup-v2-0-4ac534b83d66@lunn.ch> In-Reply-To: <20240214-keee-u32-cleanup-v2-0-4ac534b83d66@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/DcumaUyEAcsmYgBlzUklucfkw4BIxR2M2JoZU1CZik7uA1zJsjtcw dtVu/ZqVcuJAjMEAAEKAB0WIQRh+xAly1MmORb54bfmvw3LpmlMhAUCZc1JJQAKCRDmvw3LpmlM hJQqD/4iP8C+aiskVBclRtSTU9R6l288uCkWHl3gTi1cKG8A6dyYIgaAqcZNT9X5I7V6SM7yVnO 06pGErLm1KP3RDoiDtHd/Ao9XJ9hAcnD13YSdxKT0ymNSZ4xePQij/mGtZkJ2RoiqIqTgzBirne lwdDxzGgStv3OaZPdmxHnqq9r+dBX7zG4FGR3I33DBGkgwasWYbDKRbHVYxBc3rw5Tc3pskN2lx Wfl7vH6L14U+F4QZ6wXERHtN3WZl9JQWgMDLzgM/DwTckwGOtWShMObkU1Wr6KCQ1u8V24TlR55 MZ++jUcjCvpCcQXrQDGMeUdkQ5XhspK82eHzCB4QjOtgRssMyJX824yFk+kikq2gHL3wS0cwFsb OUXI969Wu/mctH7xc9+65hen1X1W2zAp5g1n9dell/PJ0gkUrFegF+qWks6cEdqhR5blVxZFc0U qysb4EejFzNWRmfXl9NbjcJ1HnRA/eG1kNksSIYXlGu3iD9HjfPrIw2u+hIiZD4PNoDUYHqgPV/ wXtT+h2XkJYzqJwkXI1txBW+2yGpHY9PQn1AyHH0jYhSNVGhe8mDn/n28BIxft2itNaVoC0VpUK dQkFYoIT6FTdAHvK/YAYUikQPlmHvqjlWxh9NEa+UWpzQAuBkdd6HaNEyEbT4M1X96wsnVB6Owo FdmUbmcDA0cGpCA== X-Developer-Key: i=andrew@lunn.ch; a=openpgp; fpr=61FB1025CB53263916F9E1B7E6BF0DCBA6694C84 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790982637043495045 X-GMAIL-MSGID: 1790982637043495045 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/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 Wed Feb 14 23:13:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Lunn X-Patchwork-Id: 201638 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:b825:b0:106:860b:bbdd with SMTP id da37csp512354dyb; Thu, 15 Feb 2024 08:22:09 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXGHHo0Bb0XbZaxM7ahL/EkU871uMsRpY4q/NeXsvxaAkz4AG1CArJQ5UWXipBUd+cM77NoPVZgT3IZxsJwlG90Z7qanw== X-Google-Smtp-Source: AGHT+IEFYCpiIKZCDH5EA/XDYtgNFOKsw69B8xNu/IrAfNmp9rJViQbyIYT7sE/8Tzw6y5VUiEdG X-Received: by 2002:a17:906:22ca:b0:a3c:f308:26f6 with SMTP id q10-20020a17090622ca00b00a3cf30826f6mr1476712eja.53.1708014128761; Thu, 15 Feb 2024 08:22:08 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708014128; cv=pass; d=google.com; s=arc-20160816; b=hHXNkuTVYkLlWxdtCQFG2KS9RjacRTwN8v73k7xv+4Dqtnpg3UlFJvZf+rOwHuHpDi U0BhvcmdescXMxspY8HTGxSJWwdAy00V7tGBOX0DC/YFvjmXzG2K5CNeE8y0mQLwFEcd tAhOE1GUSi7BPKL+P++iuGnH7JgN9dXxbjnT7K/r4bo+kxjYR1JT6RrR+9aAJIZ+yerV BoOQD3/rrsdtpqKLIwvuBLlhfAH1hwyK2z8gj6f4Yd394sIBw42nOovtPtMKRWHRqaFR ggtbE2VZv12MPi0fmHlUw9uqrFheAYpIPj3nV8zLyo1Whgg/48Uya03SxkcPO1bcN7+b vzRQ== 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=4VBrx1qM6Gzjf/dZj0JHXBU4KIuERNSMCLhowQQxEkc=; fh=7ogY8TTBnoDyVw0Ew02z/XaZICVahvk3b1eitAEneUQ=; b=CXNSURGIQ1H/dS+Znh+eizSaHvUxol9X2ZcTOQVP8H1lgrvGq82lvsSf09VEwP8TMN km3hVO9CW3HOAZ9RpeLTKpb2ZRynd4XZ/8Qizz9kUx4fARnXYirWsgL0L/k6TUjTwZw2 ENXiadr+Rqa5w7jLGlgS9XWNvLB03Thj028yaRSFBfLVjGJPIjEgDmeNpwRGC62LAcxa 4YmKeFI0BkCL850G2mqATSyB3V4Pm1+Kyri2fare0nIiTwGqRJkYaUTlR0dUDekgbgSD FxrNRmy90R4y3ivg0YhSM+B2oP80Qxle38bBbZxjATxAhDZgkYeaNBAgip5ZS1f7EtkK ZmRA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=yYvr0HZB; 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-66112-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-66112-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 v23-20020a1709067d9700b00a3d170ab99dsi758532ejo.575.2024.02.15.08.22.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 08:22:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-66112-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=yYvr0HZB; 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-66112-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-66112-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 519091F2BF5D for ; Wed, 14 Feb 2024 23:17:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 950B91474C1; Wed, 14 Feb 2024 23:14:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="yYvr0HZB" 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 EFC26146910; Wed, 14 Feb 2024 23:14:18 +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=1707952460; cv=none; b=CkITx/o7x88BRKo/4X3d4ah4HCYzUC3qdtxqewDKzPlSEzum1iRLsjzjoexgHEvX5HQfW+VQ1pc+nKbvwDQggQBIm2/8HwNs/cXuB+xmu++tCbxTEsLjutu4myBi5V3wEA41N2QHysVWO3/Ea5YbB26MTf4dR48eg6fNB1zHKKU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707952460; c=relaxed/simple; bh=JAaXmFLPL7MF52z7W5bakKctdf1rOc6D32Y12paOGJs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=FdXeUYkBmIHbOnoQy39C/ZvgJvkMUuNjZWK1cGTeiYpZniFK0U2drXNRyi5H8VzW9r1ofpHRK/GA9UBbFOos7MDjyDiJwTTgotb2ZeC353EshqC12RSXAwfcKBaNmFgnJyq6aILA23+jEdNZjY8esrrdH2poUp650JkvVwC18zc= 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=yYvr0HZB; 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=4VBrx1qM6Gzjf/dZj0JHXBU4KIuERNSMCLhowQQxEkc=; b=yY vr0HZBqvrauJsxjToICtsqe65J5iyJVMVOpkM0HE6Q18WSpF3X0KcTW6LdKQeEwd97UksOlIuIA3i lI4zlN82bM2oB5fqSDLrIrTWCPdkJWOEkhM6O153yRL0AUUYmY+WBZC2wpyXCC45iJtkyUgOsTliX up/XhO4uqpS2tSk=; Received: from c-76-156-77-114.hsd1.mn.comcast.net ([76.156.77.114] 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 1raOSK-007pqx-65; Thu, 15 Feb 2024 00:14:20 +0100 From: Andrew Lunn Date: Wed, 14 Feb 2024 17:13:24 -0600 Subject: [PATCH net-next v2 7/8] 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: <20240214-keee-u32-cleanup-v2-7-4ac534b83d66@lunn.ch> References: <20240214-keee-u32-cleanup-v2-0-4ac534b83d66@lunn.ch> In-Reply-To: <20240214-keee-u32-cleanup-v2-0-4ac534b83d66@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=3793; i=andrew@lunn.ch; h=from:subject:message-id; bh=JAaXmFLPL7MF52z7W5bakKctdf1rOc6D32Y12paOGJs=; b=owEBbQKS/ZANAwAKAea/DcumaUyEAcsmYgBlzUkl6bCIJsuq7uQBOYjilp8H2Mc3zzEENWGYb MCFQq2u2xaJAjMEAAEKAB0WIQRh+xAly1MmORb54bfmvw3LpmlMhAUCZc1JJQAKCRDmvw3LpmlM hMUzD/4pN42aAVrMi68wrLcT4Yavlv/tqf6KXGJhjQAiOJQUeR/4OGZInc1i2zK4vJuZipO9xIm 0ZadbJHSZ09NML3NPztSN0ShX/BLW8p7EW3y9kur4/+j+zoPQ2H2vlkL0KOAoMEXouADNM4Z8N0 daiRGodsxguANENju/n8NP58WtOkLTwnZ1yjtlxvFgPrGSMb3zThyf6KZQq3xqF2bgzTJsmK6YE sQehiGAhUMyA5VQqTlS2pZ4BYa5c9qJvgmrCJSOgwdL5wffKGqpFlxdz/nOrLutVZ253xM3NzkU eohPeP85zU9bfBt+l55P35oEm/52xLFwxF8e2e+r5ES3MncE5TfNWdLh7X9r6E9UcdrXywHRLo3 BAfDlG6v6tCAP7hlFTLBQzRUkhfJ1e7RV9u8Xgtn7W0t4JXHjvsQYt6eESkiTDTqXbMyEBE6c3g SjlahGsXzmlYMAWt+i9U/cYHIbifW089bGhCmbqsA7Ya2TCJyb33ZGwn8IWLEh4+vXOljdewW1/ a0NrTuk41WViJ9wj2h8gM/nl5BbT79sWa2nQSsnQDFwdmxJ0Bv3k3RwZ+20DpJafFCbZhp8ouaS 9GzTx2GWRXdNDoe3Fv52tyO37UERPptmt6zT2wGrtiNluF+pUVhqJL3E66XLQRZo6xE/YzxM18g TAF01T6FlbQaZqg== X-Developer-Key: i=andrew@lunn.ch; a=openpgp; fpr=61FB1025CB53263916F9E1B7E6BF0DCBA6694C84 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790982623344576549 X-GMAIL-MSGID: 1790982623344576549 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/ethernet/intel/igb/igb_ethtool.c | 33 ++++++++++++++++++---------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/intel/igb/igb_ethtool.c b/drivers/net/ethernet/intel/igb/igb_ethtool.c index b87b23d2151c..5da50574a28c 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: @@ -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 Wed Feb 14 23:13:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Lunn X-Patchwork-Id: 201575 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:b825:b0:106:860b:bbdd with SMTP id da37csp484998dyb; Thu, 15 Feb 2024 07:41:38 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCX4HVtC5I8CfXI1OJmH7qUcMMGNojl/b5WeRW5Gtb0/zGJbS3gVnEQ4kgLgRL0wsCY/o+34bKO3qjLJTCFQPub1fWYa5w== X-Google-Smtp-Source: AGHT+IHWy1YaE23Xz4yB2WzTFdVcAfjLNR1hW82VCFNfXKUsb/AlcuV+WLlAse0UPnZjc77czoto X-Received: by 2002:a17:90a:6082:b0:298:cc4d:cf67 with SMTP id z2-20020a17090a608200b00298cc4dcf67mr1587725pji.20.1708011697856; Thu, 15 Feb 2024 07:41:37 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708011697; cv=pass; d=google.com; s=arc-20160816; b=C6t/sgKkUnB66qt/OLNEhO90HLqjgCGKqKwbddnnoUbBRHVR4Lj0UdaBmXAWuJ8Y58 Vea/7lV9eXwNX0r12kAb5mQoBrxQyM9Z1QdCSMuydK8kJTfQ4FKFWQGasqWU4WUlkwYl BUD2lSbbvHrJjVi5S+jyIwxQ3I7MOmoVvMnObwwzli4HHORA7XDi0qb+2Dk+829Wf2AA +VoWKy2Zs1hzNSOysps0zpVJ6YL4yOG+PvPnV0D7o7lP1Gf8rnI+l0ZdL9XNJi5PyQmX D4ZcZBdgSSsoES78CykDL0ObIdz6qHr79ZYRey8aOr7RwanG4lVR8jz8fyQXZPQ7QI+0 bKeA== 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=fUJMCDjkFeWon0cBCEnnsfVYxph3Rkp3BIXm/CVGHoj+k4sLjg/6DJuQxkfNGuljtP QLgrtMa4UpFGm+U4VukQH2GWFaDf8mg/lCVQvg6hHcA2LsqukE7lsUOqqwv/pCGt2bWi jhiVRYmginVKsjxcfrzbOO1Kcrd/eMRy3RtmvfRIJQYg2FqA/07jGlGqk7cJCzDv804l 7Pa5kZdDh3yL/q7r1ou6QCBlh8gneIICX2WyC9wvhzXjYW7zX0iHO41HXLrURcw1yIys enWjHhgqrBX6EIzBgLgSoK4mP4i9vYTTDzlVeYPgzv7oAwxK5L+D68LqeKeOMGxFi8O1 LCwg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=KTKfCbqz; 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-66113-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-66113-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 il4-20020a17090b164400b00294731fbed3si1408999pjb.146.2024.02.15.07.41.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 07:41:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-66113-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=KTKfCbqz; 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-66113-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-66113-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 2243A290905 for ; Wed, 14 Feb 2024 23:17:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EF7FD1474B0; Wed, 14 Feb 2024 23:14:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="KTKfCbqz" 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 DC696250F6; Wed, 14 Feb 2024 23:14: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=1707952474; cv=none; b=nv2MJhMd9zgzQZtFYHHGyuDl7nSKaSImE9/7Wn2SQaEngwA27BKqAjg9FkFoN2YuRZ/1aG3H2l+Ro/zOm1vGHA5Mlnjw9Pvz7GgeE8PoH4SJ7tuqwTT8KiAlR5tR5EAP0ElMZEPxvesLEDZEYbeB6u9yWKTSTx/7+ezk404LpVI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707952474; c=relaxed/simple; bh=JUBlNHQ9KEInXfv/Ts82d6LWLEYOujFvKhAve8sOAdY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=mXkHEeDPZPWuiSw00XBrIWfbJxVaZ165Aw35Fex/jrft4JoT/9dcobI31tzBO/2SopNFWH6XTCZiP9RkzslwdkjGZrGgEU64fr+bNJsxAahURStpBoK0nbXlRGlHvVBbqm4/8pET2ecMqCMvrF88VwSuPLOc/v4pKqq50zWY2Uc= 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=KTKfCbqz; 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=KT KfCbqzHMlot+Qw4VoK7sWzsR5eTkkxy5tkQyuR836xwuSc8UenUGk1NAo3ocYCvRF3J2LZrUOm+zW o9JCPCeth3907YcUiVNDjKnk5Hgl3JtsqUG0RIBr0w2QeUiTwrqJjxgAX5wr68pBYWr4Sl8An2U9s jE8NNWhAtTtyv5U=; Received: from c-76-156-77-114.hsd1.mn.comcast.net ([76.156.77.114] 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 1raOSN-007pqx-IF; Thu, 15 Feb 2024 00:14:23 +0100 From: Andrew Lunn Date: Wed, 14 Feb 2024 17:13:25 -0600 Subject: [PATCH net-next v2 8/8] 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: <20240214-keee-u32-cleanup-v2-8-4ac534b83d66@lunn.ch> References: <20240214-keee-u32-cleanup-v2-0-4ac534b83d66@lunn.ch> In-Reply-To: <20240214-keee-u32-cleanup-v2-0-4ac534b83d66@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/DcumaUyEAcsmYgBlzUklKe7j/H8r+mEvYMjo5M5wQh5Gdw3q5KAH6 L4whiI972WJAjMEAAEKAB0WIQRh+xAly1MmORb54bfmvw3LpmlMhAUCZc1JJQAKCRDmvw3LpmlM hM1xD/4lxlo53phEXX7A+P7upo21SlhwgWCNZMC87FoevHKp68+yAODJhTyHVO3yo4u23qG+2+3 wNMfeQuHGf3WU3WLoZI19M3MXvOvpaRuORsWD2dQE7RfWyTc96Y/+6nFRTJkHuPAF28DdbPT7dg du/5w20lBhkS6IP0IcJP0HBrdVysT45EHnfEBd+94BWl3V8ObTcboi3LOswuQzqUGcl/ODndHmc LRWGNt10pa4KnGYVN01LcghbfJxPWqf5WQeIPtIQew1+kCwkA/wtWRuDzG7qwrdVUXi+08sZfnz 9U1SrZQT+bgCaUC07pmkLMhvmIJMgppqgNHPNcRhuw6d8bkLLsVIquS0OAScGxlaIQBzzP56I7y 3PaphJ2FTOeNzVVbzpudFftXfa2y/7dJhiTVwajYimZ3sYTkOyTdhEuS+nJwLHVCBkNUN3MVOyc A59iMSl8qVyEZm5x+7/zrqcN17CEIiXkQQcnc1F94IvhUpj86R2WdsVKoMl0KJq3GAAe3D9YhAK ClQLSYI5P5Ld4msk2tuDKc8SAddHjnGNYrsjDuw7njYUNbzVuQjyiuBSvfrKClGVtFSRuJ7+YFM ARcRM8h671nefDkpmgYUmaE1ltPGHsWXymsy8Zbs1lVSOP98rMbc3wVr3pVFgmBsrzFZKYguQV8 qIgXgkNp3fpbajw== X-Developer-Key: i=andrew@lunn.ch; a=openpgp; fpr=61FB1025CB53263916F9E1B7E6BF0DCBA6694C84 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790980074411304739 X-GMAIL-MSGID: 1790980074411304739 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/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;