From patchwork Sat Feb 17 18:08: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: 202664 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp446722dyc; Sat, 17 Feb 2024 10:10:51 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCV2zqmnT92CePkdJvJmjwVMqiYC0iHd9QXAm56h2etYimDK2nLEJazYwnE29UKBqccR6sugCg5Si75sIGvVzrBYT8kXCA== X-Google-Smtp-Source: AGHT+IEKfAz393aT9B7YmNbzAsWtgseQ649bWIENxKMz2vQibJi2M3QvoFWBqPOmITi78r2cno3q X-Received: by 2002:a17:90a:8304:b0:298:a422:937d with SMTP id h4-20020a17090a830400b00298a422937dmr10347431pjn.24.1708193451455; Sat, 17 Feb 2024 10:10:51 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708193451; cv=pass; d=google.com; s=arc-20160816; b=cDJF/+ju9Ce7GOK3xGGdL0AIya2cFZXVxTzRapj0TIV80qgpcDvGRRe1YmvFki9bB5 +x2BwH+/EVH4h2F2PMElW5r6X9eTjvgbZXP92+uO/1FKsSBQAdFZwKmjDlMgPiZTzqDZ wHoS74yrGFBjvBiTDIyJuM1AiaQBk9zPIrXjPQBzcLCaBYwl+WQK7Wx7SPRgGvFTYS8j 130AbYeQprwPUhIEuIaDXQpty6D0AcH2dHVZgpUOklvpHX0pEW3dfHF0OLgB/He/a2Wu 8WLmec5ehCZ33Ea5rMFQvSgQWoBA73HkJvJeQ/e+2Ab/wUxVEgxo9q41P869CPpmYxOl xZMA== 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=0GuuETdOHn2q6Ve6ooEo4mBMAGP8WIJeKVWxLk41wYfXRblPYAYHdhtQCxndI6Bs1A 9Mr+ofMMzZy74mhaZ2fT4SIikOgKFlGMpIC8qqUKFEA/IFKwXKTaTKvyTEvTOnlpUYe7 tO/vpWrW1D6PsPE379hAywkt1lHkwciNkcbH9Hs8YL51+Y4hdZda1zbnNtO9Zguy/hsZ ciU2Ht/hjk3nGg9pg5Qq62Kq3fZuGWzvD4pBA9n3DKeznUz3TT/nv5vOl0N9+dRKvasI Qi5yl+5rweVF9L16f04jiX5qv+bL1UOTqfitLH9uxXI5VELZ039syyPblvwi9IJsz7nZ qtyA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=wtELyE6u; 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-70001-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70001-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 gl10-20020a17090b120a00b00296a394fab4si1797788pjb.60.2024.02.17.10.10.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Feb 2024 10:10:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-70001-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=wtELyE6u; 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-70001-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70001-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 44A592814FB for ; Sat, 17 Feb 2024 18:10:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 82BB97F46C; Sat, 17 Feb 2024 18:09:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="wtELyE6u" 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 515527E0E3; Sat, 17 Feb 2024 18:09: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=1708193368; cv=none; b=Hwz7SafVzh/zAol7MzPMN/sVqQwcPLC2vzHHifNpJXv9BMS/hDPXJu1oGlRFtm4c2pgUPKFzAHnu5Apt1m/1PHUGwyedaSEveahEKKS6BLcmfiTT1I4pbZ8K91tpJpNjhbO/Tn1+U2Eg3e1k0X0XFYbEuBgTQsXLOnige0Shd1Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708193368; c=relaxed/simple; bh=F0mfdZrj/FgaIdcQuHDCEsazFz0S4bAcsGtKqN8CFVA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ipHEkLnJDurHyqa6HzNQC/a250KL9nVfdTWQ6h6YNrvTPDaeNovs4434cXkEjEpqydBq+q0jX8jaxr67G61tDyzIATjYfj6KNDZTk1jc9gukisd3zDk+Z5i5Af/27i2BqfRiNSSZvGtRwB0/ASM4JbtdAO3vlZDWN5sf/eOnEJE= 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=wtELyE6u; 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=wt ELyE6uwjCmpuz/iQy5V1SDaGivOesNVgGfRW8PAYlXaKPhe+YIXeTnGRlRpevR603wcN3GjijVh1C 26Wy362WaFzMqUApI9HEO/F4uYLHIv5yo+G9qclOI3oG+2fMcDWT2coQXhfzluqmOwFbA6KCp9WJC 4uj8tJBhz3OHnY4=; 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 1rbP7p-0084hf-S0; Sat, 17 Feb 2024 19:09:22 +0100 From: Andrew Lunn Date: Sat, 17 Feb 2024 12:08:22 -0600 Subject: [PATCH net-next v3 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: <20240217-keee-u32-cleanup-v3-1-fcf6b62a0c7f@lunn.ch> References: <20240217-keee-u32-cleanup-v3-0-fcf6b62a0c7f@lunn.ch> In-Reply-To: <20240217-keee-u32-cleanup-v3-0-fcf6b62a0c7f@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/DcumaUyEAcsmYgBl0PY5RMYKHr9BbcggVVLmatVyES123SsD69hBv mT1m7+50kWJAjMEAAEKAB0WIQRh+xAly1MmORb54bfmvw3LpmlMhAUCZdD2OQAKCRDmvw3LpmlM hAqPEAC8IJdckcEDDXuFuDJGrTYlhBa/c4Cgv2emfdcMoFuP5SQN8alLVCTPZEaDgB/eu7NB7AJ Pys+EANlnPSGppi9BYLWuKplwDpEQ911h5NTNkbEM/v2402nS6eAXgba1oBLfxnAsfq2rVEmr7B ak3zcIYl3Dlir+T4WtT970bNcVEXvXSOBEm9UGZqcWKjxotntcK95R5O7i1RJuKVUEYh/2NRt9A GD6cNyxMJ2MLdirPZOc11EpRztvBXZyyuiEWqSk9Z4U9n+SeC9WQ1Jj3HmIvZiFlECGjR/30xZW fcuoflhxnEbTREPCGiURMviWXgz1jP/01c3z8PSP53joC1tWmd8gKS7JVrvLK6t2sBHuimMJ6/t ZAD266C8ksvRzRqVGLfQfCr3Zvp6TlingjrTkSzxM48755OxuH+J6PQR5i6aARvvNB2QDFLC24W 1NivKOYu0wb6ksamsd1c8KmZxbfq7FJih/kOuQ5mTXDRLpVdCLI2y4Bk+a4gttAFcmHiO2vBDZ4 Yec2n4IS86/y/t2OOZie+2O4kMLmrZiaKZcAe44y+01iQvVwpNB2NvD1S+abJFxJPg/WIZbKJlC MXutR61h27yCJs10sBsIrgsBhSQ8I2I77ETrYdezNPbWVkdEogJDOraweiiHAClONv5KEftl8ov aCSbHiHMD9/phdg== X-Developer-Key: i=andrew@lunn.ch; a=openpgp; fpr=61FB1025CB53263916F9E1B7E6BF0DCBA6694C84 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791170656134111331 X-GMAIL-MSGID: 1791170656134111331 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 Sat Feb 17 18:08: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: 202663 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp446613dyc; Sat, 17 Feb 2024 10:10:38 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXRY948gaOWRTR4jneu9BkOIAX/zzmJ0qxrKm27xOhFU4n5U3+HTVs9CH+L0LZryPx8XWef9U420rKAFkLxEmsSy+QIzg== X-Google-Smtp-Source: AGHT+IFfbACjyBaQvkqGyBwjHjx0T+dWodoWXLoiIjF03ubLp15AzoHWW/O7j9yne06EdPYIzNOo X-Received: by 2002:a05:622a:c4:b0:42d:bfaa:dbb5 with SMTP id p4-20020a05622a00c400b0042dbfaadbb5mr11238519qtw.49.1708193438277; Sat, 17 Feb 2024 10:10:38 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708193438; cv=pass; d=google.com; s=arc-20160816; b=iltgGuLO1odUZjtlWx9fNwIY2KULzqfswm+918BkBBAhxLkhomwYNR8t+lKJcxD2SE A5T/EQs1lTJYuXAW8uzof97CZxNiac8gJYFNEO9usLGwuuyMkY0Jcovwxl6Y1X05TQxq 1O5QrRw42Q3PLZnYf36YgO/+Ck7wISVtfQ1193f5V2QXtZBb6UViS5/y2tAwjQbtJ2T/ rpo8h5AbUwnSNDty1pJymQwjCteENBxalL90qO4pX40M5m6Jf3vSWQxAdVkDM4xvYGAX rEQeNsx7+kG7ERA5tXBgMYU+aCDJ/3n/zm3Cqu37wO3pUpRpfscfPYs9W4UmODixPonU hlDQ== 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=ihP7AQ+J6izpGPj7OVwl3IzV74sqI16qkj3dcY8EXa1xYeB3j8emHzmEZTAv5IbRcC pK1zk/IXeO42a840JkNs8c6unD2PvjfmAxGB6iIO9K/YMqiESC4ABtFprXKz2M8Ag1CO o5yUWjx95/Ntp20p18mCYFz8tvy0Fgvk7DJiAWqXfN3uJAyk/MIoXqHJhcp6qk02GZga kmiz5pXcw+SiaK27zpiIFTG70YXWr//tRmFPvORPZT+dzgBWCQ6QjVl5ByKBnyu1z8yo vN9IlGKRe3FcNqy1uDd6eEvixnIJXV4/o2BlU31wC6OCn2dN9gP6QDZ9rs5QD+TxsvOV 2aAg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=fHzdW0lH; 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-70000-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70000-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 o24-20020ac85558000000b0042ddd577a3esi2429912qtr.10.2024.02.17.10.10.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Feb 2024 10:10:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-70000-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=fHzdW0lH; 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-70000-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70000-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 16CEA1C20E00 for ; Sat, 17 Feb 2024 18:10:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B77A57E0F2; Sat, 17 Feb 2024 18:09:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="fHzdW0lH" 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 515917E0F6; Sat, 17 Feb 2024 18:09: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=1708193367; cv=none; b=kOm2TkV91Ic2asmxpD91PVK0lJpWxE+l5X1TqvLjueBqz277ztZNB6l1pUOtAZcMGuDTXJG2X5ZNOnVEODRMcGYB/aP363CevxO+eUCc0KadJXtftN2Xp8GRc5uEObrtXaylBo/ffWBC5J2dEpzIhPxPtW2+++anYeGQlwcB1BM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708193367; c=relaxed/simple; bh=Cpjch1b1D9Jp2vWORWgwbDnErRScd5QZqvv0qT6yMzg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=jBi2ba3+LeZiuFE8P8KpRgQXAuu+YKE919MkjC4AB4nVvR0NIKzRxpqBLA4+l9g5tlXsR42myPiuMsDv2PW7KbZF6JykA7YaWNbsXl9Lh5DQnBbqaAa4P/Yr0zH3hlyHf9LIfECg1wGIXSbSvYOwMrWyh6+TVAC1SuUsYlx5M6Y= 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=fHzdW0lH; 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=fH zdW0lHWWLc/POW7pCTRFlBPk0DTs51pOcrx5hZAeKc+yuhw66JdOu9liqOCUS6PlwztyVpu2xXFyR fAc4DNDXHYMuwGk2j1/BKViX47ZpsqWTolXVm1CHUxfY0PdZj5/YwIHsVeisJ0cgeM6KmmKFlcBBn 8hvbnIItV7Hhsyw=; 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 1rbP7t-0084hf-4e; Sat, 17 Feb 2024 19:09:25 +0100 From: Andrew Lunn Date: Sat, 17 Feb 2024 12:08:23 -0600 Subject: [PATCH net-next v3 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: <20240217-keee-u32-cleanup-v3-2-fcf6b62a0c7f@lunn.ch> References: <20240217-keee-u32-cleanup-v3-0-fcf6b62a0c7f@lunn.ch> In-Reply-To: <20240217-keee-u32-cleanup-v3-0-fcf6b62a0c7f@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/DcumaUyEAcsmYgBl0PY58DYGzHvvkqG4UGjQxMYZTQXXDJTNrQh7C t80oBY825qJAjMEAAEKAB0WIQRh+xAly1MmORb54bfmvw3LpmlMhAUCZdD2OQAKCRDmvw3LpmlM hFOkD/9dZqCRSsbEoUP+e0wgdaogNOGOUIP3TaXJlttrSDQPWatzT5sKf2NInwGIeghthNUwQtN g4oTdX9/RtvbQlE6Eyyy1uvY9ihn0Ef+n8aqukpo10C5oibY8apbB7ARds/QXwLYwZJeHzKu5i7 PMUxda2IqqYKVc5S+ON+69Hn73FXd1FcixOrJJqXh71SC0xxOAwJ/whbLVFthrDlR79LJKw+RTE 10WgYbimMkATPAKjULJ5Lw1oQbohp3uufTgUZIGmRw9yu+7u6pu44TbxAOZvhCFPcYwX3FgSci8 lTMKsk372sAGERmTTf9j1PuDVSwbmdrnVF+vDnwEYjuWYj7KELPdYq9KgtGc5v/mZK4Cif/Jxxv yHEVMdtgVFHdrPJ8gOLdKIhuTdox/4pmCfUHCNkwSWNjD6jgObCzteXnKYhaphpO5MECQrrkO4Y oFp/V1yjg8JB7RZKzwxUSW2UrxyrGLcBkXEW40A5XzSDn8ld3d6f4kt8mLY4zJbazDJNGG/pnH+ vBi2/KDlcc4JNSfn4KignPAP5Rifjv0bXmOsYotpeqjApuJ+8GQZmwCkbdrBoKmtLIwxiNRz+zZ wjXphDf8kZ6cHTvqmr/fgsamquAVDSit8hXWznjJk0QPaomFeOKREGCFqY0iQ1Tks1Ddx/zzNXz Qev5yto7x7TSveA== X-Developer-Key: i=andrew@lunn.ch; a=openpgp; fpr=61FB1025CB53263916F9E1B7E6BF0DCBA6694C84 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791170642892549716 X-GMAIL-MSGID: 1791170642892549716 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 Sat Feb 17 18:08: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: 202667 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp447440dyc; Sat, 17 Feb 2024 10:12:16 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUPyecSbMddvUxFDpvlVyKQ6+zOexTfdZwOAVCILkwtOjlmCclhTPewEyGYrz4kyD8Ij+XXWIqMLiDNYoGTPjcIoKrj+g== X-Google-Smtp-Source: AGHT+IHX/4xYrTMFJY2mjewWA5YRtUL4Yz7qQB2b2Xk0yv9pm6JJZGFyFCbVZLrTUH0qrRLRQ0P+ X-Received: by 2002:a05:6a21:1707:b0:19b:673d:824d with SMTP id nv7-20020a056a21170700b0019b673d824dmr9080059pzb.46.1708193536049; Sat, 17 Feb 2024 10:12:16 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708193536; cv=pass; d=google.com; s=arc-20160816; b=MFK3Uaik71xCnsOgyXqii6NYZOoK1ibzZvgHY4ceowD21dDOW34Gxp74pEwaysExkl qpJXOjUsbAf9jxBN6iAHGQQwnnwI9AQkpg1SL4mLNM2lY9mOVoGmZ4b0vWwJGhY7P3JK VxVIDDlSlHdqKDoe5wnMNDGJ7LhHEABYahhYZRaM8iNG9Huysf5xpYoWjOmsVpP5tVu2 HxKgKKlk0+hUWghfnXV4rq05/YSur5w/0AwyF2La4U/ns81KV/u/XSIiNnhMDRzrPBJQ CDUuFw8tm84TXNttr0+zEuEt3FSXQ67+oEM1lX6u5AO7gGv7LjQ/qvDtrk6uZcPGATr0 T4Qw== 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=cdlUqKPU3hfxJsT9535PRlaDjhWUwBwWnpLMRa17JQS/7AevCNahayJ5bKIooXz0tk txoydRheJ9pao1kAlHKPpAXmiNxN+bD1kihZhSAd5UfiO6fc0vohylY5qamqk8ObUqWH 44j5xqbzHbjybDHFWIZ48YRRsqxdp+nE0Zb58TxSFJ72J/j7yrqQA7ZPQTlXJokCHbaT fmgAHYpFHJPoEABoDoufU0faBzcwjefb1CHx6PALrfS3b1MoViZ2mv+pZYJQIW6eSzqg M2CiYv/eYaRFxud/Cruehck6pMVQPIPnR/XVFH0P78CH+rA6FZHSh0NSqoHjX/2utC5M zYKw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=XbtwDvdk; 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-70003-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70003-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. [147.75.48.161]) by mx.google.com with ESMTPS id dr19-20020a056a020fd300b005d8b6fe2b5dsi1795944pgb.569.2024.02.17.10.12.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Feb 2024 10:12:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-70003-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=XbtwDvdk; 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-70003-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70003-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 48DAAB21EE0 for ; Sat, 17 Feb 2024 18:11:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9A9497F7FC; Sat, 17 Feb 2024 18:09:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="XbtwDvdk" 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 59A2B7E581; Sat, 17 Feb 2024 18:09:28 +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=1708193371; cv=none; b=bYYU9K/lM4QxLwcJe5MSBvsXVAoLcDkspeCMNVsc+tiJHc6ZXM8JtriJ8dmDQUqCzus3LrxISwxfkxUqn0/Ux0f5VDCgEIZSEmwp61DKmCFu6+mac4Q5FfMy4XL0VL1hzdAKOJimkZ0P32RIC6GQSCfPymSxWF9VhLnFN6YPMBM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708193371; c=relaxed/simple; bh=w1DJYkt9FTZRnNhfN8ZM1D8JVVgGCSqPVVQnR9uVLaE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=bm9/x0YMeKcKI/fqJLgWFzTKqEgmzl9w/qDfUh3RA3eBaUEhJljwnUcSRD4r/F5SQfd6k1UNlP7g/FLgpjpCzXvbqMwQBk9KA9//CgbGZx+PBHSKE831pPuK4vfVkuTlkmFoGMvSjacfoWYLZeyXw6K2ZVk6NQ+RKw4BhigPUWw= 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=XbtwDvdk; 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=Xb twDvdknCyspMJC3tsle5kDdlsVSH7Y8rcPHzAM3dSkJdTszsordejLyHEsvQVFrcoW65K8U2ybRvQ xRqOuyP0A7f5ffZdNDKgtmJWZBjKiNhI9Ty986g7fkAc6J2i6mszrVAaCX3XmDBHKpdaOveTYIEFH mQpp2GdhP5hY1Vg=; 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 1rbP7w-0084hf-Dd; Sat, 17 Feb 2024 19:09:28 +0100 From: Andrew Lunn Date: Sat, 17 Feb 2024 12:08:24 -0600 Subject: [PATCH net-next v3 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: <20240217-keee-u32-cleanup-v3-3-fcf6b62a0c7f@lunn.ch> References: <20240217-keee-u32-cleanup-v3-0-fcf6b62a0c7f@lunn.ch> In-Reply-To: <20240217-keee-u32-cleanup-v3-0-fcf6b62a0c7f@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/DcumaUyEAcsmYgBl0PY6W0jHOX8rQJCKgVnosXE7coleas4hMNphl 9WSc4SAKESJAjMEAAEKAB0WIQRh+xAly1MmORb54bfmvw3LpmlMhAUCZdD2OgAKCRDmvw3LpmlM hEhPEAC0EZ9NyFSjjhW8MJZ3dOVD6+dXQdUHHJq8UOPPi2l79vslkL9v0u6TL10PRiZTqQHJnIZ TkIA0plVfEz6GPBDtJ8F3Hgn0T0jUYmMU2MZWWhR0DQIiUzixfZEBG+5E0SM0gaFyILcgn2Qlkp 22N87QCZWkE2u0NjLtAOKBtvsFKBA7ZxkT8V3NDj53X+UAQrwFntHuackbRExRFQk/hHJ7mFRLP BVIzcojiUKC6lFB6D0CA6k+k0RlcTlM3f9cH/48q4uzt0lhEK45qA2LyzaisFpfWz51tU+g6PM+ 1nx7itpoWetPrysf5++maJ+Sggl5haRDivaULhVupqXP8ML3WKE9DiTfrZHfUXpQES9n7DvM9HZ aOMVA43m0Hmi/iYvJxfCrtJn9uo1wNupuxsfwXpoaqeIlViOcjNDo9imaDZqDNCbr/Ut7V3fiCq JL6/zptX7YCZ7swrI/JaSSKQXZ5KKaUB0Wn2rPseeFisBzsvpRJQtwpny3nfI6RrGsS5wzZ0tlp p00m4AGExsqT5kj2yJ5cyG3ZaYFa5EnVqD8Mq6bBi0qLu0p2pBFL9rS5tyrwIg2wt1n8PDtsd8d UDmmPw1qPnxbZIUS8/QsYHjlRN1K90g3rwStuRU6cKyYGymBv26+1Rt/Sfh5EjxFviA8LUGrK65 XeL8b40aH4kWV+w== X-Developer-Key: i=andrew@lunn.ch; a=openpgp; fpr=61FB1025CB53263916F9E1B7E6BF0DCBA6694C84 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791170745420226095 X-GMAIL-MSGID: 1791170745420226095 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 Sat Feb 17 18:08: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: 202666 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp447265dyc; Sat, 17 Feb 2024 10:11:52 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXJRAPRlMRWuXUZLZnfMdsZd6vlJ8EqIlbgSaJNgewPhS14UI8B/GagCggmk0qq6+MudYwaK2rjijPINnHgJJM0AuyGoQ== X-Google-Smtp-Source: AGHT+IF2wxoVifUrayShOkZqs34YE9OpRpg5VZMIFkLYFVUJxrWdMhEztuu22xDh6vg05/+v0nYj X-Received: by 2002:a17:902:64d0:b0:1db:8ca0:2699 with SMTP id y16-20020a17090264d000b001db8ca02699mr7499525pli.24.1708193512215; Sat, 17 Feb 2024 10:11:52 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708193512; cv=pass; d=google.com; s=arc-20160816; b=Mh/8FBOvS9kbyya+bnQb9Ylk25x0NRBHVFg55u1JVBmwqN1PopDeOdGXmVVAc8jlDM K9EszocD1KpuUPel1Yu8IDu+4eW3JDSCac9SvkYYU3/mkCmFMCtKSxBlj15UVL6ba6Ly 6vyeZx/inBoCh5j5iZeBN8KVkSUDPVA7XOftqyWq8T4Hn2vk2o/e1OAefowvhOUSd/JE J3gru9f6a3DQYlM4AGnVKoVwytD//aS2mK15KcKPkeP5h8E+tHXwNQbQgpklv0UxLFnd V0C6ZHmVEiD1nIJ9Kr8zl3YM5C1rQ4IT0Lac7ZqBf+b/9UUdbX+1rz8Kvn4ZG+4nFgoO zn0Q== 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=q2QQP2WrfjK0ggBb1+R1ZWXyFmZPjAuv0fNwAHtLY1w5jjQ2VvH/mjaNENAQhf6iRK LD5BjAdlj1DCAzHH4/jM5p1oREdUbioO7eRRM3QDDSdQ74iDcjiL+wsJ58LGscAeWWob 8LfPJEXTTt16lUFY3POx0qia8oQaxuDdWIU+5z2HKd3R0sqCHBMXOB/4A0vCZPSoYj/U f3iF2Okfp8YEscC9tEICdQYJthYk3ZpPAbpziRNZ6EAiIcZm5+7waCFf4raFq4aAJRBp YSJSlxBFEBNJt2jm7566y0k/OaQejoJ5a/6FKUoAwpqZr4pmTIqEZCJhhOiAhLa5JvgC vQlg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=2XxJKIdI; 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-70004-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70004-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 w13-20020a170902e88d00b001dbde64981esi220296plg.379.2024.02.17.10.11.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Feb 2024 10:11:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-70004-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=2XxJKIdI; 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-70004-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70004-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 0A953282604 for ; Sat, 17 Feb 2024 18:11:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0C18D7FBA9; Sat, 17 Feb 2024 18:09:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="2XxJKIdI" 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 19E157E78C; Sat, 17 Feb 2024 18:09:30 +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=1708193371; cv=none; b=b3UBvG38z3stanhRWmy4M7DjQZunrRtXSvVJo2LlUDIt2lcIELg+7JowyCAL3gRYz2cqk8tQA9+8vc2330/rGWDJED4qXwSxNGg2KV8IABYhUsT2scvRVEWFTAY+PGXXgtBSCohLXWwllMQZimGeCulTHG4WwKCdZooKjdf50ko= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708193371; 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=tG9nXd2g0crrEv9K2rtdI6tvwhkxa5Cvh5KGTVaGqO2vlV4u9Tev8w4OiZIQ4wGExsko2vg2i7ME5GkmMPdFTGO4z5QKP3r8q5K5m7N0fWnlWET7ZodJZsV3zd19rqKbOt92ndaz6/R/eAvDyy+tF/b48rVBlKJe44y6hQ3ccEg= 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=2XxJKIdI; 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=2X xJKIdIjACY4CXrdtGNuJ/4hgAiCHadwOA5QMtv8EWoBcbjZf5ykSBnAp2UcxUhgIW51R74mdxdYT1 uYYpnxPb5GZSc+ig9AeIDIjKiRIjpkaexe7I3k7uKZYa7jjf7k7Sk3+LmbBdK9uFcFPyMd/yCDjEC DT0ShDFgWDeWUIU=; 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 1rbP80-0084hf-3V; Sat, 17 Feb 2024 19:09:32 +0100 From: Andrew Lunn Date: Sat, 17 Feb 2024 12:08:25 -0600 Subject: [PATCH net-next v3 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: <20240217-keee-u32-cleanup-v3-4-fcf6b62a0c7f@lunn.ch> References: <20240217-keee-u32-cleanup-v3-0-fcf6b62a0c7f@lunn.ch> In-Reply-To: <20240217-keee-u32-cleanup-v3-0-fcf6b62a0c7f@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/DcumaUyEAcsmYgBl0PY6xzJip9b+Ys/6/moZRoD886ziSVg1X2tSJ pFVf0xirFaJAjMEAAEKAB0WIQRh+xAly1MmORb54bfmvw3LpmlMhAUCZdD2OgAKCRDmvw3LpmlM hJxmEACLm8vGvPo7Z2FgLb7KH1kwL9wQZJthCGRy2NaPog/Oo76x3SaYUE+DDEPaYqB2JpACDT6 Lg6euJv+rawMgEK7RUWZkc5w1bOe1GiXhVAa3BgV+XBA8YV+x7y6Qq3zt5ZTE0czZP+Ug+fB2kG FQmhGoc7Z5IK0/b/f3F1WWhf5Zda7UE6VTNBFOl88g+AIOCh3gWzMxElGl2KJgnq+1JpZSEy4gz HtwaiN6vS5yeC0q91rCB5/ymmm59lN2Lm58HWw/7ZZIvCWErZ4voCDAhzEzRrp2JXYNtvy6g6cP amXqfATLVlw8PnHn9ghuyhyTOV1Ptw8W7wxPq/BQayZ9oTt4YLrKdh/cGpYDm+ywJPl6xoSSQL0 cBq4kBvyTiV+hCOVRwKKfZUHhNokXQ1o7b7UimYA+DHfb8o8WnNzX5kBsMoAKu8j96ZVmI3uEul lU+f9LhhpQJxcKrWaY44G+1VLdt1sDZopDsdOIwmZx6VdICHydiWxH9NTf7QUpLrjjEtGWBrXNz TqNuMVXEH76/aPjTtX01hAfQ2iZD8vG2lmm2iGm/Q4PVZH6T/EvFquz7hVHL1ETy5pSuhqdUhhS HpG9PKiIlg5YisUnNKz/vb2SNQx5YWETj41D5DjUuTEaNlWF/ulug6MnDYWpPKeG36ILn8kTdlC 5PeNLrDqkY9huGQ== X-Developer-Key: i=andrew@lunn.ch; a=openpgp; fpr=61FB1025CB53263916F9E1B7E6BF0DCBA6694C84 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791170720014731204 X-GMAIL-MSGID: 1791170720014731204 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 Sat Feb 17 18:08:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Lunn X-Patchwork-Id: 202665 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp447085dyc; Sat, 17 Feb 2024 10:11:31 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCV8B9khbMXR6nAXQBVxx/s5BgfvQvlH33kBT0QNeHVGZtzoSYo5GznNq/Ujylz9xczqZW02VxNSw2YrI6xEQ5ZzdbLO/w== X-Google-Smtp-Source: AGHT+IFKRHwUAJzvzcUmGQyzV+AqjUleOQilZFvoZOlT8ia98X5r2MoBw4jiYrLyxKcVqwNczY9+ X-Received: by 2002:ac2:5214:0:b0:512:8f84:c3d1 with SMTP id a20-20020ac25214000000b005128f84c3d1mr3877194lfl.57.1708193490923; Sat, 17 Feb 2024 10:11:30 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708193490; cv=pass; d=google.com; s=arc-20160816; b=JD86aQ/CXaEtqWBrKSxQhwUXakfCgAUAL9cImt64OkxVmODuTC1nvc90dK7zAq+mzY HnIJAZQfDo/Yw7Laub9vZebLgTXMMMMFRPdLo3elh944f9UEIssvcrcEAs5aYSATop1b GMRakF4LDuXfZ2IMvAfO3TVO0qMDMkR+x3m26W62Ewa5Gg1tyPajdlbc0oKlcJkTGXsr vwSLPj4vWgKm5VDcz9elAobyDrkkY8u0QC6i1gHsZM+YyvvBh7nDmOZlyGkJawf5xhD+ 4C/t6ntjffoXWhDgg+Dh+I1zNGVzOQngHnmMeKabOCW8qUCMaH/+NQqzHEB+6M7/XKuV mqyA== 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=uPGuRh//vLvdiw5LUy7BL0FyR+rjzHJ7tdSMRf7EZeaOGZ5ULSd4AvLBwNK6ppQXVH RWEEzZMBMQprf5jUlMo75wviIy+1TuDO4bswiCQIckKIEDH9y4wyoA0rWebzmfn3nrqQ Y81DrVWpLywD55DQxBZ+lCpD/plgMZA/Z6yGFcGLJa98LuvLS/vMvZWw30cQukovgj61 vCFCxLANVy5R56vze3XgVdciv/fbqzwx3dW99Ej/f3PItn56m73y95HuwdrpkQSuHWtM WsL5P2j/dCJpNdCwng+bCkrzbxT9zyn94DMH/w/9K2wnLOWAa9dkfuOvZQyDIBca7hLo pEFg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=GeWsZXvz; 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-70002-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70002-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 c7-20020a170906340700b00a3db0577915si1009742ejb.872.2024.02.17.10.11.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Feb 2024 10:11:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-70002-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=GeWsZXvz; 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-70002-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70002-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 5CD9C1F213EC for ; Sat, 17 Feb 2024 18:11:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4FEE541C63; Sat, 17 Feb 2024 18:09:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="GeWsZXvz" 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 599C97E580; Sat, 17 Feb 2024 18:09:28 +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=1708193370; cv=none; b=G2pGUldnrSoxfGoGRmybxyuxPkSFxIa1pHS7w7VbQ3CkGyah+rrmRQNefFbJwJ1bqOW6IK4lTfC3J2/GZaKidPar5A6J8WTtHjf/uf7D9se/k6wW1YpDiCUUg2GGi1F/y2boD5VpSqg2h+l0FY4Sp1S8I5RonvQfX03j6Mc/OJs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708193370; c=relaxed/simple; bh=jBShEoehGOiH3XARbTLV/6y5l6NHG5lC8OunACxocoE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=XXQzKJ85ZaW3dt5/ICJizhzftpbl9/8M6PyplZ5YQxxK4lP6MUHSlYvsSpH/T+v+V9OMY6DPQ7EKYgeGZaUi5gLTXROvC3u3Jal4aNk8rK7rkLp1wFL0TTqhaGJx3FX1SNhQcmCwpivnxyRG3ETnTvm5s2/UaPrA1BQWGTOrm/c= 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=GeWsZXvz; 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=Ge WsZXvzoyXc6KytUoTSElPJ81kUgrOBxVQMMXwq/hJZ5AXQLyE7SCZLntg8sAeW6AXesLM1E45iXaB BTDz+Nx1ZdAznhc4az/tOjzyD+vIGkWsG5SZ3V51fgel3mWJO/yc2M3luzHDlujROrPQvuwWBnW+G W5Hy0PRH7sSpwzE=; 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 1rbP83-0084hf-Pd; Sat, 17 Feb 2024 19:09:36 +0100 From: Andrew Lunn Date: Sat, 17 Feb 2024 12:08:26 -0600 Subject: [PATCH net-next v3 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: <20240217-keee-u32-cleanup-v3-5-fcf6b62a0c7f@lunn.ch> References: <20240217-keee-u32-cleanup-v3-0-fcf6b62a0c7f@lunn.ch> In-Reply-To: <20240217-keee-u32-cleanup-v3-0-fcf6b62a0c7f@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/DcumaUyEAcsmYgBl0PY7k7SN/4S228ROAzg7ZuMLyNMUmBTSrVMwB alKMwysKQqJAjMEAAEKAB0WIQRh+xAly1MmORb54bfmvw3LpmlMhAUCZdD2OwAKCRDmvw3LpmlM hIAMD/9/if2OuCb4y445VS2/pfmVOV65uM3dKPOUIpYfYE4pqnEqNUHN09yJtOtOgAPCn+7nPsQ 78NihovKh+pxO3ScOCoKfGkzcz6j3rRx9DX5yU2Mz7xGZh/AYfDDeKj2I9Pzl+UqGDIllEUscbn zExhnK3Gb0B+HGFIqF74KgN8AzoOenG8VLz7MXBe7v1/gzl/ZRXOQXA9lxokuotfV0UNl2nhrwC QW+hQcvwSY5qFu+u9kwqld+pfIGnFdn8TmflpUlD4MFXnaivCLZxVk2H1Bl0I9BwIL7v+IOKD+R HYPwoBO+NwFZZEq60YZGG66ciN5vlB6OEEv73u/AROr01D9OlwBJLlTSY/fctnk3Zaaer5Fcu4g s+a+p3Z2JEuA+1Jc5PqulsOLRBsfULx/EPPSnoMdpYnko7IgWMs1b/Qg61XPp3/ne7xYnXpKnUt HwLlKSoGp4/iTiejU5oZuf7MfKpj3ROHHr7lSBBMdLpH1dhGccG0El1naxVPpQsV9PnHp4Wf6tv 30ZIMHfvXtMPIYFQDk6eKQtYZSEetgZk3CoLj4Ks0CeAfRnhgjuh5hfUUY8MJyKai8Zm3EfqU9D JHThBufm38cB/4OpIoUPWl6VeJUPr+4cP26J2SKGhc5rDfH7v7ysyCtrhA3BBGuqjWCYobqcyU6 YWMovgekCvgh2/g== X-Developer-Key: i=andrew@lunn.ch; a=openpgp; fpr=61FB1025CB53263916F9E1B7E6BF0DCBA6694C84 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791170697616623394 X-GMAIL-MSGID: 1791170697616623394 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 Sat Feb 17 18:08:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Lunn X-Patchwork-Id: 202668 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp447528dyc; Sat, 17 Feb 2024 10:12:25 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWC8qbxTvo9HICCUkZPQMeWawS86AUSXN9aG0EPOkM7TSMC/hYeuNYHCGsoWkWbxSFNVGj9HPgnzb+Xpph08CHNj9X5mQ== X-Google-Smtp-Source: AGHT+IHPvh/Hunmxy+Z0x7knBGq4NvglbfLMdDAlVwVfGmfg8luNa7iThnjcxk66eDCZ1A8sC5hY X-Received: by 2002:a05:620a:4f1:b0:787:1e8f:2c68 with SMTP id b17-20020a05620a04f100b007871e8f2c68mr7972343qkh.57.1708193544837; Sat, 17 Feb 2024 10:12:24 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708193544; cv=pass; d=google.com; s=arc-20160816; b=uzq/4T/hiEvZq7fBS4JgmeeRm1Io3tGh37tWETdiabg1t4cw9nuT++x6S3tCEDcBrY fwyCmxs8hha7UrADP90DYjORXGJmmuLOzONG/zKP+6IEW32TaOK3FqjEq2Ioj+UbdH9s MNLam1JeiAn506AKHEBTb0wMdrSaMlX+3rOGkRr8N+HYwZV3XxBDSF3G2sVECtBrVctF GfNnPmPyIgSd1JaG+tLjJGFMzO4zJNg3ZGyyk/FExBOMoC/XEvX2l34zbGE/hha4s2Sp LKe0b+B5mX0C6A3n6HSEoKwK/2JvUH1H9o/HanUEDM5cLn7xNtLOCLJaeW4nMIsHLFFx mGxQ== 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=GABBspXByCi4fnDHSmMPbHltp4fDZq341WOQ98qXkoVROnrS2Acl/AcHVncRiaAycF gKjmZMC2vxdV8c47QzqNR1Cm4X8r/IA+fGMzt5eRrMh8RAZrFuE1H0NYfJrzn1xyjosX YfrXcMvNydqZgLw1dRexKbCzCs6SVeDjPSd2xB8wYNPh4n6zTjep3viEbnzxssivV1Be RP50mWuBd/4FNsRunZOae1xg7YigJM4Edf28M8hLtyK10Wt6un4HehJ10x+ySLD5MC3L w/qFJXguaX2eWI1cDguOKnnYmWqeVX96klT1N/GG9lnvQepnJKVf411+JIMJkYku+qEy /OqQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=lgZxLCzS; 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-70005-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70005-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 y2-20020a05620a09c200b00785b2c633aasi2633946qky.55.2024.02.17.10.12.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Feb 2024 10:12:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-70005-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=lgZxLCzS; 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-70005-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70005-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 84D2A1C20EAB for ; Sat, 17 Feb 2024 18:12:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 388DC8002F; Sat, 17 Feb 2024 18:09:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="lgZxLCzS" 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 5BD4F7F461; Sat, 17 Feb 2024 18:09:30 +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=1708193374; cv=none; b=TLaiWMALTP5slfSPn8Fo/y1ERrX0gQ3Psucd7iqEKywL5X/r93ZTIwZZtb7RbduHAiMH0V9jYn4QVNuDhsUGXHixr1pXwbpoxBTJupO3erhlxcOnCgGUgmgFNF74vf+1RToXVaxvnme3BXyCv3lNhEnoTdtCQPqm6A9GjeGIAyE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708193374; c=relaxed/simple; bh=nLsygJVJCduLk95szsdKOpEa7GzGsR0GfRGWNH5oTU4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=HF2Gcy+x+p6S4LtF6p9vu5kJa1hRBsSmWhpjJ3egkUUVin2Gg9vZkRmuCEoLpPexk+BrgQSLW+G2Y9gV/y8xS3GPFWyTKeOLtdFFtg4fmz/E2H2ABzLvyY2DyJ1knkn106HgcXvhAhEJcOm9fy845LH1mqaacc+3L98lPiy7les= 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=lgZxLCzS; 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=lg ZxLCzSqzEiN4nvNhIqKb6czIezJYgdiYghZBH0CaAZ4tgZd6O5kWymLV++SU62cQIX3cmuuBh/F81 q5Sa9JN/82qNEsbO4udyDK7o+gHPWHpK3011idwIhkZv0GAZuJoSMgdyhI5fybJIHBs5BhiY+y/Wm qhLHCOE36QswYaM=; 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 1rbP87-0084hf-2I; Sat, 17 Feb 2024 19:09:39 +0100 From: Andrew Lunn Date: Sat, 17 Feb 2024 12:08:27 -0600 Subject: [PATCH net-next v3 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: <20240217-keee-u32-cleanup-v3-6-fcf6b62a0c7f@lunn.ch> References: <20240217-keee-u32-cleanup-v3-0-fcf6b62a0c7f@lunn.ch> In-Reply-To: <20240217-keee-u32-cleanup-v3-0-fcf6b62a0c7f@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/DcumaUyEAcsmYgBl0PY7GEK/s8u6Wc0Cu2THTjAxHAyzvWlxPU5JN 0P439nErQqJAjMEAAEKAB0WIQRh+xAly1MmORb54bfmvw3LpmlMhAUCZdD2OwAKCRDmvw3LpmlM hDf3D/9Tqgzm33tJDXQ8k+RUMPeKw9daJDllil9l16SUwN72TllnIemNI4grngazAtyT0BFBsLQ bDRIf9Hd2fOB4qPTwW6LmGs8zF1F7pii4j/r+8Ul8meJVN5FkfPrwSKu6nnhnuNXSoanKs+OJiS 3eg+gXOdasnyvQEXIiptt46oYpqXCIxstK9ZiDRLCenxsdVc/HUG2Jl3Ahy2fa+bsFxgeacNA7K 1cM/+14TT+wvWYrN9wnIWYUW8B3Ihh5OdR/O5zpjjN7Kt5vqgwem/ikWuMYTfevQQizHyKmX/cr Li8/WLL1/BEvBUO0GR3C9LjAUMGuSyMX1Ga+VeN3umBA+TXE+rzwNf2DB8X9UuhnM+GaanqoJS/ K0JPhE53HQAv/mnCNDN0gxSc+C4XtmvxKeZ6zzp52UGWDfLaG2fbzgmAiS/6lRHSOfw01mBLfhp SJHMLzqavE9sYW/wq5EwSxIGEjZrPD9ygH9YuitFWZyJOMMlUA6BzG6Gz45tDWT8T4W+ML5X1DB lmOBJ5fZd30TddR0nCXycxlx1D3DCHGx9vh8u9lfdEP0cMDYA3najmw0ItBQwadmC5uEQc+4sju BA8ubZMHrK9u+Wodl1kmBwA+u06auzSqcUIs1C7Os8So6UNuZCN4iMdwM+IpXoPcgryVcEmw10W fpIFNtmkMClfEOA== X-Developer-Key: i=andrew@lunn.ch; a=openpgp; fpr=61FB1025CB53263916F9E1B7E6BF0DCBA6694C84 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791170754451299055 X-GMAIL-MSGID: 1791170754451299055 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 Sat Feb 17 18:08:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Lunn X-Patchwork-Id: 202669 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp447589dyc; Sat, 17 Feb 2024 10:12:33 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWbwKrpjP3XG2xZo/dzgLK4Gt5ZnY8Q+sEiQOYD7FHp1zDC6x4oUQiwpAUc6l9f8vfy+X9zEAcFTRyco9jF62kgzZgLLw== X-Google-Smtp-Source: AGHT+IEU2FWUjkHe7y5+XPYGi4CcrnTg1a+HuaUMwLNHRZ149+eCAXv9KnnPoOjH9aAV3LYBlcyS X-Received: by 2002:a92:d350:0:b0:363:c47c:f64e with SMTP id a16-20020a92d350000000b00363c47cf64emr9297209ilh.4.1708193553480; Sat, 17 Feb 2024 10:12:33 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708193553; cv=pass; d=google.com; s=arc-20160816; b=AGyU55EFS4AMgvvmUQnjUo2VPE/LsO1qdnQu2WmVjCn+TcWtu/3mqJFczI2oxeiY+I S5f0mjFfVwvyXfwxdJp5dfDMNp1/tNBb1KYHdoUcEpcCOlm+zQwcBwnP7K8D/yWFgXpe e7w8WNOty2INdgSnjPq+L37qtDboUbAqbhu3eo1pRt/rjsKOPFNAsp+bIkrC6EJpo+yW BAhDFS9m1MGBVqmfd8qetz9X4f9q9Gg0oATfp5LKAeMp5R1cVk53vrLEopVd8eIdI2E8 wqJ0bMlbbdKULPz2n5UWEKqnOI3GguShlE2tP4oFG+0UD8wA9IVJcDqj3MW5oUgFVYbb aZyQ== 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=0ZiEMNAUHmkmpK+lqvS2Eeu4K82khn9McC539GfA+juA365np8AvGnzcyAdmDM9OIs uopDFSZ76sujT/UdyzKP+8r/L9BTBnXxMlMFfrUDQSawPUGrUQO+bkV5F/iYg7+zslEU T+4zPDw+JGDEfCGvBRDJk2UsZsJ0vgUJOx2sVvpBipqO2qpR8QHIFCL/pEgoqCxNZ/oc DO50Iiyxj1XFsi4a/34g2nWaTTZ5WHwc6Um2u+kpeZXtpaFsBFRfi+myJOgYFcVtaPSa R52hOatXfgTec7IN6lxx8JnIELUJ7XkmXkh6A+9Vlzzoy7IJ7Bq4IsoCoNfhWJ0k69UT qZVg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=WLzCMe+j; 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-70006-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70006-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 f21-20020a633815000000b005dc529d418dsi1740118pga.750.2024.02.17.10.12.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Feb 2024 10:12:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-70006-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=WLzCMe+j; 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-70006-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70006-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 2BECA28172E for ; Sat, 17 Feb 2024 18:12:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AEA7C80040; Sat, 17 Feb 2024 18:09:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="WLzCMe+j" 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 539627F7F5; Sat, 17 Feb 2024 18:09:34 +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=1708193375; cv=none; b=CJvJ8PyMGtykXheev03l9b76oEkQbwkAfBKnya49JbgvSnKJSrUV4yW7xgD2lsBK9QkCoolJ+a2ZO/jcf1R9pttNhyOaC8T2Mk/QTwVSIhoMfqtyfDR9AfdkemKVq4uHRR39Wja7yIuCauPc7G/aEmKl33CTrccie8vqT3RfKWM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708193375; c=relaxed/simple; bh=JAaXmFLPL7MF52z7W5bakKctdf1rOc6D32Y12paOGJs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=sqklW8pCL45lC5GNwDsPz+G98XdLbjClVwQc+E124j1uiDUJfhvV16q1taHkL6n5lnKt5f+fCgLefCPt2LYdtFTAX3yOpO2aqegduD178sHRjwp+CQQGmXzBrvNG11GD0dk0hgecH2AYw+dlQqTCXozpOgs3BVNxM4P/iqOKWBQ= 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=WLzCMe+j; 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=WL zCMe+jixLCOsxo+Y0NyK+tVSvJ8oEncWSyNjpOuE3bs1s6VaQ7NxGEctJJAhwt19Tfo7/NSK9nMPF TqZZ9G3hst3qbl/yQDtH1VzcTM6TIgXP7A+EXYfjK1S3M7q45leW+V8ZNDTn1wAjFZTmJjPL7Jk3B y3rMEmwonxzPKcw=; 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 1rbP8A-0084hf-BG; Sat, 17 Feb 2024 19:09:42 +0100 From: Andrew Lunn Date: Sat, 17 Feb 2024 12:08:28 -0600 Subject: [PATCH net-next v3 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: <20240217-keee-u32-cleanup-v3-7-fcf6b62a0c7f@lunn.ch> References: <20240217-keee-u32-cleanup-v3-0-fcf6b62a0c7f@lunn.ch> In-Reply-To: <20240217-keee-u32-cleanup-v3-0-fcf6b62a0c7f@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/DcumaUyEAcsmYgBl0PY7PbH9bV4ynmYdotjif8o5ti3hDTv55GCwL ySlVhIGWEWJAjMEAAEKAB0WIQRh+xAly1MmORb54bfmvw3LpmlMhAUCZdD2OwAKCRDmvw3LpmlM hK/fD/9ztCXRyyqY0vnBtz+rgygONJN/FA3Vvz4Kds2LWhg0JsLeVDrJYEi/j9aPoKRd67ANuP+ a0TAZNT/ZeG3vKikDgJrg9+vnpHvNBrVbFNwB16xfckii6GbYjgIjaOdA1eEyywz4+mMGkDDUod JRPkqbMKf3hE9uz3HrhxwxK+FNoaeF9pFDzhadnX9rE7AhfSNAAgU0tWDjoGlcL8RQic8gkPTNs A8hwNjBfO3W1z/6fm6wh2v8TBzJPjlMH7KJQnk7t4vzCPg1t+hVsV5PKA9FIPlAy230yDetX/CT xdaHGcwodGKufKtQzOsoGBhwLvZpidYdixzMutBkAulhZyc19g+wxWKdY7kF9PxGmoDO9T0D1G4 mxnSDYMH7uHqQgnfCWDcseUv6Oi3qGYQGfjC7XvtGACIj+QkhvGtauA6nI+Zv3pOR5vS07h4MJc 5FtgiWUX714Uncwp5fw3LwJIBOU7/y5HoK7cjZJIhiAqQiOn0vg9IgaGp/3CJsw4QfVTM3NZRr+ hQPckJAi/F2PQ8EOw7WMjItWLXm8afpu0r0wGITYd12vL6pDl4Bg96xcEevL+PQ6i1v6BHt08KF B2xu9/xW6HNxW/Ro41Z+MZBQlPvLYbG1sYRmW7Yf0BV1F+1lcYQBel7kzDFlaMZou3FjIpc4xIe helrL70LGOBWDtA== X-Developer-Key: i=andrew@lunn.ch; a=openpgp; fpr=61FB1025CB53263916F9E1B7E6BF0DCBA6694C84 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791170763764881417 X-GMAIL-MSGID: 1791170763764881417 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 Sat Feb 17 18:08:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Lunn X-Patchwork-Id: 202670 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp447771dyc; Sat, 17 Feb 2024 10:12:56 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWQDmpezViVOtoH9pqGZ4TkopEv1l5F2TtuLRa+dQ7LJf7qR3/jhAPpCHaXHwqeUqgUCRWQXefO3BoRJwuB5F6w/uKhjQ== X-Google-Smtp-Source: AGHT+IGcL4Yr+zFoEJJ3h0V7LzYxcM98RUtwKVMZfKHbqdnKwQoCC0tSOlrlfklBsea1tEdI6GQT X-Received: by 2002:a0c:f2cf:0:b0:68f:5757:dd07 with SMTP id c15-20020a0cf2cf000000b0068f5757dd07mr1006510qvm.22.1708193576461; Sat, 17 Feb 2024 10:12:56 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708193576; cv=pass; d=google.com; s=arc-20160816; b=StJheCV/xkNri22T06SRqmbeaGX1BsupK7a3IcZHxU7jbpWbOYqbGTzbhTg8JcQ7Wb MFUS5gLdyfEAwmwRvQo5be13eQ8amTdUPK+ZoLAiyZjZeXNGJS/HsTVH6LE/L8pvaJQD +dgcWZau9HWyi+yZwwHbyMPmLBWlq2p21h5bY/Hj3k8A3LvzapRfop5eVH9Q2vouLadS Z0UJOiE1+Sl1tr5dEYyBXg3NEd8wzXtp4k7zOvsEaFFjnIUnpA9FmPRFKofRCPQjDH2F nZsifkBjYjxW1NCIcReNrz4vQ9iQmWqbsnldZDD2HWdrw1rCefh/4aFbkpb1ZvRKJOKm HcYg== 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=oN50KyDp8HQd3Vztu+/2Vn5cCrKrNcfVeT74062a4/Ox3ZnOw/OW8T2ZZ8cCLpnRiG xnaGWJXP5mPM3cJs4hX5p6lLNFRy5Y/+aqg5qbDJUmVrbM5o+atYnaahrUw7f2xvsk3U 13omxUUZ3bL9JbMc15OkGAGrRDBR0MQRMtJucZc0m0Ew/aDW3MV5Fhs3i3JEBZ43OsKi 4uWQ7M9xm2WNT6B3Ta4pK37Q2rKhwIKeLZJnasrHDwACQpq3npOxEYXmm7NRK7zK2Xc5 N2jWT0DPsCN+jmslwjA+OkUsovbgv3I14eBMbCglp5BL79T2Rde1IFxismpJzZ7X/Hqv jnPg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=h+uWf32b; 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-70007-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70007-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 gv4-20020a056214262400b0068c9733d2f8si2550304qvb.257.2024.02.17.10.12.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Feb 2024 10:12:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-70007-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=h+uWf32b; 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-70007-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70007-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 06A251C20D1F for ; Sat, 17 Feb 2024 18:12:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F31D88060C; Sat, 17 Feb 2024 18:09:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="h+uWf32b" 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 04F1D80038; Sat, 17 Feb 2024 18:09:37 +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=1708193379; cv=none; b=PxMj/WYZ1VEVqWv1aImTVx9K8+1EnsQXFcnyZKM3MLYiDh71//XAyMOtTpgEAhrAbMxPfKRMmo4/s+FmytXIyBOdFqU5j0CdkGKZrnrKRysxZYGaFZRIoziNElwdk50flXFllF5+gLUGTEfscHHhhjUNXmb80ql7F20STIPPazA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708193379; c=relaxed/simple; bh=JUBlNHQ9KEInXfv/Ts82d6LWLEYOujFvKhAve8sOAdY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=i5AtO0D1x/2y0QbUXc3Hro4HdjNEmTM8mA/X80en1JbQlV2Ydxkn+L6zrLTSpY6Hl4QxNAkdOSqYYZ7xnYF82zJ9GWyUDYS+7sotmF81sAsXpzvBM3PjGC7Wnu2WdviNoEysUp/qauLzm0d7QCiPeITt8BQsr3o0VMzqZHIIdsc= 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=h+uWf32b; 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=h+ uWf32bDXfJHQJlMFbKO6z40qckTpR053ZZDrThpza8HPRCmYD5+qyuRiRGDdmFlLv8TlW8ISUbj6l boeUJRLC17kMIxYbNl8R5RR3C0kThhxypeYpnT0A5tY+DOel5jDpbWI0BrBzZ/v2tEPqfPj3jiOSD M5wzXybhUhJhe5Q=; 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 1rbP8D-0084hf-KD; Sat, 17 Feb 2024 19:09:45 +0100 From: Andrew Lunn Date: Sat, 17 Feb 2024 12:08:29 -0600 Subject: [PATCH net-next v3 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: <20240217-keee-u32-cleanup-v3-8-fcf6b62a0c7f@lunn.ch> References: <20240217-keee-u32-cleanup-v3-0-fcf6b62a0c7f@lunn.ch> In-Reply-To: <20240217-keee-u32-cleanup-v3-0-fcf6b62a0c7f@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/DcumaUyEAcsmYgBl0PY8QswMZXFgclyrmiaG6Mz5z1C9NpM6VoMTr 6lMSfGhKCqJAjMEAAEKAB0WIQRh+xAly1MmORb54bfmvw3LpmlMhAUCZdD2PAAKCRDmvw3LpmlM hOLjEADIAYAUBqeIHdM2i1gNP2BQ6NHP0THsFP5kUpdF+K1kenJv0qXrOFtwSiazeWwckU8rDDa iU7BFilBn0lFc8ts4/NhsGYy6xlEsCk8k7aRc9OzEnsQMm/YzEutyHJ273avPL+41R8aMG9/e7+ TazrzAWDTXwBi1VPIQlb38Oim45OPghmPCAIfbd287xo/AFoQjT5jeITBBO/WE3/Y6LolrMLxK5 YXcWxlJaL7J1r1wKMp6U99icOY6tid1XdxZ7J3Ue5jiPmZxsDgSeIzT4VRaYbfJ+NpjuL+sdrqT Hh1FImogd5Ebu0vwkSB6fTt32/FR8+w2R4WFYkqNP8esEDlWabLkPFwBP00S5icCAz3KvdodWet G7PyjZPBC9CP+w2CIYs3FOL4G2JlTDRnqb0as5Oyx1Zn9FGQucl17WqV7nA5itVuOxFT8KS53d/ ysLkTQL6B8GetPqlskK1uSTbFkYDFKknZPsvtD3Uq20RjywJ4ILmEIWcNLGh04XhZAjAlZQr8Yd 63V0Gmq+nmEWZ3bE/vZrbf8382A9gzYMNjq4T5tlo2fApr1jj2T38h25dr1gfERwjaG9qkh6Cnl lvhAvXj9DyYwb0ZWcOSAqGLl5tyXkIZ8Y3Ip3U4Jp2CaMCalhsJ1nL7f4yNdOpBQgVfh1EfssjZ rghfWW6fjwdPtCQ== X-Developer-Key: i=andrew@lunn.ch; a=openpgp; fpr=61FB1025CB53263916F9E1B7E6BF0DCBA6694C84 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791170787807234516 X-GMAIL-MSGID: 1791170787807234516 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;