From patchwork Sun Feb 4 23:40: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: 196602 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp575694dyb; Sun, 4 Feb 2024 15:42:19 -0800 (PST) X-Google-Smtp-Source: AGHT+IGha9XG//JMcBw8vpyJQh3XDvWPcuSrv3BMu3puXBwRDTGqGaixEALCcBXGSOM2haK/IMqB X-Received: by 2002:a05:6a21:1645:b0:19e:3027:14c5 with SMTP id no5-20020a056a21164500b0019e302714c5mr6874264pzb.50.1707090138898; Sun, 04 Feb 2024 15:42:18 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707090138; cv=pass; d=google.com; s=arc-20160816; b=M8VQVWUZadJ5gbm9T5cAhGZ2XMlsOBNoOtnH0yGlHRTzCKz3QuDecd11BLzEUgQ/Uz xHSyPU9LP4mxEf3tE/QMe0vNh3pmSEO6Ug5UtyQjiNxsiXR+WZNZAJpWjhdMaK4z80Ir UZAiiJlOTNXp2zpbx7SglsQsmxUSW/ULOnKtTbAIW8w0tR3lahrqRu9T6CIRwVzapPd5 zwoQr6KKFDHJETZ5KA+sX/9d+7A/H98MS+XQgvKQ/oWTo/SLSs3qFFFg45WlqwBfwtdL FqTgJrZT+hwTxBAa9HkjV1G2sF8pf/onpLFAVL32xD7ui5sJVnHilpTRc7xkVQF6YNas zOJA== 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=BB6trBKXJIilPGmK71jUVejqD9+gym9kmGBKn6oD3VM=; b=ouYA6wytYrTaaicTOPJ3WvISK4dI+FQBfBtUey4iPuwwgocxfxQNpzD5bTxLqk3rTp bUYyxLgxaclxyxuiCDhaXfXAxjtc5cAh24bwekAsf6O/tAa1O7kIr/bL5ZzBr3W8bOuF vMhRr+qqlPlldVyaMkbvkPg25S6xD+leGvNbUQ8OoyeflLyt4ArZKzdsOKAZbIs+a3Dz jQBgmA3uC4yfFJlEeN54zpMlB19r0XwVpO8OL7N1jga1X8lkm53TLE/Ff6hzNws6Y7zI hKlVWZcxO+2fOmHVaz6K2MGsNDA9GMf4CUoHevZGI12kN7d+yiz3H4vbOcr8uy3qekfw ekEw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=398yUCJr; 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-51949-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51949-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch X-Forwarded-Encrypted: i=1; AJvYcCXxRLjd2/xprcYzu9gUXnWu7ZUrR4bdVZz7VbvpxeBsiFFfyK1DFraFP6MUHatUC5Y7UEvCr8UChgGoOi7HCyK3oImf3g== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id q7-20020a056a00084700b006e040cac63fsi1031962pfk.365.2024.02.04.15.42.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Feb 2024 15:42:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-51949-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=398yUCJr; 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-51949-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51949-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 00ED0B21514 for ; Sun, 4 Feb 2024 23:41:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EBBF612E6D; Sun, 4 Feb 2024 23:40:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="398yUCJr" 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 45FBEBE65; Sun, 4 Feb 2024 23:40:44 +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=1707090045; cv=none; b=OlajReUPtrZHsLebx5yioFt0RwyNQ9VQdUJkPmPatExeE5LVhRfj9TfwOTheVUbiquv9kDcgz6Oo1ZMIRaW3utqsqMaDWAKeSsLD7WY5gY5m7iT1ByIiDNZ5v+H2dgE/1d+VtrpdZkP4gUZ8QKXE5yPUd0mWy4zVKvONUS00MVs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707090045; c=relaxed/simple; bh=F0mfdZrj/FgaIdcQuHDCEsazFz0S4bAcsGtKqN8CFVA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=VU4yb8JXgIIcPRKF6cnfLxg+oQUkSrY/9KPvZe1oAMZ9U8pqyQC3PvgPi4dGw1KKjg/3Lq6rMIC5GlE2dNupE2AYlrp8zT4FZ0+EUKa/UdvD9CJQrdh+sSBjAkATWXq52fdii2+GGG7zigAoR0yQ47fY1UlRhY/yu3n1tF5+q00= 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=398yUCJr; 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=39 8yUCJrdNtIZSuZwtLEHMPm2jkANYun+1ozzN1FQ8M6NtnyQVuwMsTNfT63FF+T/139WJJOjhowhLM RT5ZRslw0wFQmL1z5O3KvZsTSuGfjySd9Bf6iVrPcBgBLw66uZgna9S9Xz+ZcF/KK+qQ6srMRynsw XUPle5n8SGRtKzo=; 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 1rWm6D-006z7T-9A; Mon, 05 Feb 2024 00:40:33 +0100 From: Andrew Lunn Date: Sun, 04 Feb 2024 17:40:18 -0600 Subject: [PATCH 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: <20240204-keee-u32-cleanup-v1-1-fb6e08329d9a@lunn.ch> References: <20240204-keee-u32-cleanup-v1-0-fb6e08329d9a@lunn.ch> In-Reply-To: <20240204-keee-u32-cleanup-v1-0-fb6e08329d9a@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/DcumaUyEAcsmYgBlwCBosEVBhWdcRq7v/M/7QBQSJoRWKWr+VUNRF Juz9Z/insWJAjMEAAEKAB0WIQRh+xAly1MmORb54bfmvw3LpmlMhAUCZcAgaAAKCRDmvw3LpmlM hHZOEADJyfCKM2B0x5eZEcjZDvkTSuCKtiAJAQ+VLAMB3eh58XyLnRuar4cYyBUONQF3h6EANYL UfbKHe/bd/m++33qitFc7ibDUatYE4qOrIVC6PG0OLaPlePJ6+GrzePmoIMLuv8jlpsoPRJvFKI Zqci5bkDmYgZDjDuAVQqQ8PmbI+uBSeMFhBM4f/C4PsGJRDYKkdBazp8bxPm0S41qHf1r13DbOB sITU2gPfS7j7de5THdg/HnxrdYY4SUz4LMYdldMdimlrs9rd8nXT4q+paIPH0T+AtLMqp0bg4rx qgc4k5TOqPwwf09kBd83hK8JwNTuMSIenx3vbWCsmaHz01HFwz2EHgs5+PWvw6ovBfVJHrKnOht lI3Aq9AdU23qeU0phrPTUXO9twZtjEtLfWfDW5KGRzkMW127mxKxSJNne5zYndHaqMl4FRGMqcQ wQgNcqtxOl0BO2pwrLfNLr3MlRLL5p9osXA7hnOluT/v9+XYgvAeV3C01avNpDfrJZ6iRPqFilk 5LkRzFyvfP9byOUaPfEtr0hnPIIGGrarbubkxV4GF/yIBYRaTyFabpXGaYVHuh0wy2dAL0xKXBK Kbkw3nohgK2+f1MiZaftQTHaKOO7svZgMto9C6kaJt6ymWVY5Ujl6CnFIGM+/QcvuIqQmR3+ZBR mJSkbswk+bBI8rw== X-Developer-Key: i=andrew@lunn.ch; a=openpgp; fpr=61FB1025CB53263916F9E1B7E6BF0DCBA6694C84 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790013749531187124 X-GMAIL-MSGID: 1790013749531187124 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 Sun Feb 4 23:40: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: 196601 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp575648dyb; Sun, 4 Feb 2024 15:42:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IEmVwwSt9wqApiFSEsAuolHAE8+HXDtCkz91Lrc2zs8CwDZ2c9WTMkbrWyAnv+N81SP0EAK X-Received: by 2002:a17:90b:1116:b0:296:36ce:18c5 with SMTP id gi22-20020a17090b111600b0029636ce18c5mr7008960pjb.25.1707090133115; Sun, 04 Feb 2024 15:42:13 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707090133; cv=pass; d=google.com; s=arc-20160816; b=BSQ076qcTHN/q/HXUpEo1lxKWIOBoOkJKJWtUvgFoe0wrlOd8WHCrWLFbLWWH+XrSo gI+PFCEh5pfxeOE+DhNnfNSUQJ2USNTLK5ptfd5C+aBQSph5JMAZrUL9EemZ34cCpUOu TD+2OAQzgl0UYGzmo1bxWGLrnBq9Xd8k4/8wcYhLCfBjPOVB0aHS860ap/PvSpK6ROp2 W8PLz9hTWat3E1g21IMAUsUm2Y3snN+tNtQ+PKdwFVlba98fq6OnOGuQ0khH36JkucXh cl+bfXFakplngAz1yT8n7mxCsZ21rCvUzTER5iVmWtSa9UCl/JKBknfaT6fOYbuQ7XxI X0HQ== 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=JhiIqVAth0WJj5hHLJ7v5kJSxOVYO9jiZ1D7LPY0Y4o=; b=vE65PRulq0Zwt06mNNOugptnEj7WKJXw1IW42/PeDJru9KfRSQb9xJ1MBJPm2U9Z05 OaAjddHzfGRMM09ewrKVJPtjL+vjseKzVItwi9mW+iRwfLmfWKFF9Tdj8KELKcjjF3VS mX9nySGQ0vI1ewCRwdUkrQy/zkuFnLHlkvrK4UImBWzDJ03vCTSPlG2KrhYc1Ykpo9CQ vsyMMzmMv08RV9IAiWe7nPkhzmx8HsUUKj8/rFXzMU65oY3iBLZBatgjIl2Hra77cnOZ XEkF1IH0f3rTqD8LJ+fMQcc5HiuUyGJC6Ba4wjwKnmba10ErIn4o7wzXToS6f4dht2cY rHHA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=ACyqW11G; 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-51948-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51948-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch X-Forwarded-Encrypted: i=1; AJvYcCUFLxVBLctCAS/fu7dVmkbCmMwK2q6IGXwBL3TD0xEVuE9Ka66lxGsqTboAMsM4P9AzK2tL32k39nV37KvMwQWUpXYiMQ== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id dw14-20020a17090b094e00b0028e7a1782b7si3495776pjb.97.2024.02.04.15.42.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Feb 2024 15:42:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-51948-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=ACyqW11G; 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-51948-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51948-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 3AB49B21926 for ; Sun, 4 Feb 2024 23:41:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A085612E45; Sun, 4 Feb 2024 23:40:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="ACyqW11G" 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 45F99BE5D; Sun, 4 Feb 2024 23:40:44 +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=1707090045; cv=none; b=lpFO4Nfqtv+TBY0TI91yyavKLJHyAOnkQtUE8F+zTyCoZXdJJPJH7MfPBe9grinOcCfaCDOaHUAlygsfWpAPMoxUaTpIM03WjK8iWAYFFm9qgv9tvZcJep0Dg5hIqMaFXK29HbW2NPMhYVHaQZH1b6+Vwms0dAkoucY/IBseM0E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707090045; c=relaxed/simple; bh=Cpjch1b1D9Jp2vWORWgwbDnErRScd5QZqvv0qT6yMzg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=loa1uD7x2rxJPmtFoWt8i9yNzg+ykDFMStGYxIR6nKNfBPZ554cs+DpwvkIF4OUYxhBOa9RFH9Bgp5mqk4jST9kKh5iltKVSUPZtxOnKoheA0puX4kpLUs9/hAIdeBjhHXA9R3UGAYWGCL1xhY2NKuFuUDn0kYfOVD3NJXazZdQ= 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=ACyqW11G; 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=AC yqW11GQSsth0jqiJMmkoQvKInfmu5V9qNxon//vnegtjVdxg3I1jNSddotbXYx8zhCVbVqc+JqFGt WfpdQ9j1B3nCR98SlcK3JhrdtTPgfx2yadhAzlvhvrgFXw714lqDTDUNNqjsqrftdtA6KaZK59iDs 1T1x5udWmwS0Sz4=; 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 1rWm6G-006z7T-I3; Mon, 05 Feb 2024 00:40:36 +0100 From: Andrew Lunn Date: Sun, 04 Feb 2024 17:40:19 -0600 Subject: [PATCH 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: <20240204-keee-u32-cleanup-v1-2-fb6e08329d9a@lunn.ch> References: <20240204-keee-u32-cleanup-v1-0-fb6e08329d9a@lunn.ch> In-Reply-To: <20240204-keee-u32-cleanup-v1-0-fb6e08329d9a@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/DcumaUyEAcsmYgBlwCBoJEjpNMDvkqadpv9yFL1h1A7Hf4gta7ioS jqRDownKJiJAjMEAAEKAB0WIQRh+xAly1MmORb54bfmvw3LpmlMhAUCZcAgaAAKCRDmvw3LpmlM hAw+D/9nrVrHGFvrGdpbtwShUj8PZP0T7RCUAoJ6QYG56CQ2SmAP71TvYlHb3DASw4BWmQoA0V2 LsthsrcZyDqnp2ub/TjkQkwTjmKjxR1ZpUQHcr5aQelUaEcbHtksNSRwweFkYxOjWISV0bTM7F7 B5ByV1VebraSgmTmbm/y3kbnA0c4EY9mAErdGDB2F5Ff3tl4BsaHZ4cH/xyUb/IbmhR0OZF5mvt rmdtp0jgqkHle3Fv2O0uXvvuxxKo+pBVBmBYYrunWf+G3ClU0LysWaCp2rHvIRxKdbInGLOZBiz rg3Vj8d+g3YMwMuimq53fdNdocRi0UzP4TLtKXsXSngKhWtO7avR8GoG8Cu41LlDnl2RFx6vsG9 1iyr1AY7pLkjImh4Izm5aHjoE1gKvpOgBo3CIptG9nyRr0i+Xmsxszdz+Y9mEZcyEjKyQ0ccAe1 3K+LVEE6TwS1c60DA58q+sgf0ftr8J5X7fN/G6Z+lELW3hUERaMTNbpfQ2quSRFTLiaByJ4UB8o CGuvyV7q1rY8/Pn5dSq06oTZqUDYYhq4au3FsKynxlS2kFiteSasMDqZKGS81DLvAY65Gh+7pPt jTXBfGreO1lv6eYVwBxPBb3dBgzKphFugUDCOatb29/E/KbGH/qhHYGvflDBxQz5Y6r+vQ48jez lFnQVxEVru1w4Xg== X-Developer-Key: i=andrew@lunn.ch; a=openpgp; fpr=61FB1025CB53263916F9E1B7E6BF0DCBA6694C84 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790013743766782443 X-GMAIL-MSGID: 1790013743766782443 Make use of the existing linkmode helpers for converting PHY EEE register values into links modes, now that ethtool_keee uses link modes, rather than u32 values. Signed-off-by: Andrew Lunn --- drivers/net/usb/ax88179_178a.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/net/usb/ax88179_178a.c b/drivers/net/usb/ax88179_178a.c index d6168eaa286f..d4bf9865d87b 100644 --- a/drivers/net/usb/ax88179_178a.c +++ b/drivers/net/usb/ax88179_178a.c @@ -676,21 +676,21 @@ ax88179_ethtool_get_eee(struct usbnet *dev, struct ethtool_keee *data) MDIO_MMD_PCS); if (val < 0) return val; - data->supported_u32 = mmd_eee_cap_to_ethtool_sup_t(val); + mii_eee_cap1_mod_linkmode_t(data->supported, val); /* Get advertisement EEE */ val = ax88179_phy_read_mmd_indirect(dev, MDIO_AN_EEE_ADV, MDIO_MMD_AN); if (val < 0) return val; - data->advertised_u32 = mmd_eee_adv_to_ethtool_adv_t(val); + mii_eee_cap1_mod_linkmode_t(data->advertised, val); /* Get LP advertisement EEE */ val = ax88179_phy_read_mmd_indirect(dev, MDIO_AN_EEE_LPABLE, MDIO_MMD_AN); if (val < 0) return val; - data->lp_advertised_u32 = mmd_eee_adv_to_ethtool_adv_t(val); + mii_eee_cap1_mod_linkmode_t(data->lp_advertised, val); return 0; } @@ -698,7 +698,7 @@ ax88179_ethtool_get_eee(struct usbnet *dev, struct ethtool_keee *data) static int ax88179_ethtool_set_eee(struct usbnet *dev, struct ethtool_keee *data) { - u16 tmp16 = ethtool_adv_to_mmd_eee_adv_t(data->advertised_u32); + u16 tmp16 = linkmode_to_mii_eee_cap1_t(data->advertised); return ax88179_phy_write_mmd_indirect(dev, MDIO_AN_EEE_ADV, MDIO_MMD_AN, tmp16); @@ -1663,7 +1663,6 @@ static int ax88179_reset(struct usbnet *dev) ax88179_disable_eee(dev); ax88179_ethtool_get_eee(dev, &eee_data); - eee_data.advertised_u32 = 0; ax88179_ethtool_set_eee(dev, &eee_data); /* Restart autoneg */ From patchwork Sun Feb 4 23:40: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: 196603 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp575717dyb; Sun, 4 Feb 2024 15:42:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IE5/b61y3GErd2BsYbPXhqM4JuH69dX5Y+OaK/0fyF25qTN08GTxx5BIHlRRWv6ShIdVDYU X-Received: by 2002:a17:902:fc44:b0:1d9:bff2:67d3 with SMTP id me4-20020a170902fc4400b001d9bff267d3mr348545plb.0.1707090144211; Sun, 04 Feb 2024 15:42:24 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707090144; cv=pass; d=google.com; s=arc-20160816; b=zz/m9ca3s7IMYdwtvpAHnbjit4ToDfAy+DDaXh8naEh+0sfwiQf6wHd7cGMTxM371t 3fhoquhMg6i+FjIRHo1ZhdPRaiV7ao7DKtA18s4wBnC3GVs0aedYRMALao/L/zJ038YG 4+lA6n+SY0MgueIESQZ7B/o8dbi7GCr1UPQvQgH85cEXdwHjddT7dqSD+JNzzC6AD56/ /CefdNIZ9tx+hU8qPCijiPLyGZ0ozJ9h+EpRoxtMZxzLlm027YiKh4R6b/XVRGwsswUC iz8dMo/RFcbYjbDvcUX1j6VPLfokbEctogZSJYAaYJ8Xn3uTvmq6UERr4A02mj8783qn lgcA== 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=5l9Cl3X8A0rtc7tYsEKwbufw55bNs5sNQYr4t6yq6u8=; b=KTtSlaca8OCvYRk8UkE6yxh1FgKprHqA13ClLWIdxhzJ4wnp6wVblbD80I9q+qNxST SsHwmBo+ph/icUIUMERyzitmEemdLMXN6uwjgcS/rnIuOuM5gyEdltI6Kzu5q+QicWct gDTYmhHlJnPFa+5XVsQvZpRXtb4bFSqyvMIZLBx5SdeZx7k9d3Q5P5Oz+Zik2NeMo7tX 17UbG3E8z6g74DYJPYO+y3D2PFsdQYArVsDA3Wkuu8DngqEiXJ6Rt9jN4s53bmqig5Pt RWHxNkTIQJpaRQNmY8Pa5vomvFRDkriSMYskosEbrknmoViPLI0WqIxkhy3WkVgOt/gS sUFg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b="wj7U/D4/"; 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-51951-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51951-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch X-Forwarded-Encrypted: i=1; AJvYcCVL9w81Gd/Fhh6esk11gl0VeH05vcHQRdyA6653R9Dw1ZGIQh3lVLA5N9xZydBWc9Y18SfEVtkIK8TLCHdBc4oLijbhVA== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id q12-20020a170902eb8c00b001d8d6c1fcbcsi5437160plg.64.2024.02.04.15.42.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Feb 2024 15:42:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-51951-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="wj7U/D4/"; 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-51951-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51951-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 EEAC6282480 for ; Sun, 4 Feb 2024 23:42:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1F7C313FEA; Sun, 4 Feb 2024 23:40:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="wj7U/D4/" 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 59405125BC; Sun, 4 Feb 2024 23:40:47 +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=1707090048; cv=none; b=Uifq4fAAoAfZxwQJdsc4n0dHP93Ff43fP8bXYRC/ycLllzXzp7xBtn3xkqzuw+GEP0a3RER6Uzqf7lzWAaJHmihwmXIgzsuqT7oP/lfvyWSAZmuR/joEdhB5vFKI4cjLfmd0cQKwbjXhg23MULCnXC9DMFtdrt7DcrBvC/LtFjY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707090048; c=relaxed/simple; bh=w1DJYkt9FTZRnNhfN8ZM1D8JVVgGCSqPVVQnR9uVLaE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=cJIKG0yg32k3fF8RMJMKSWzKlZovuibjV5Aef9B8VN1VgWbWtcd6yqwp8EnfolUl61pqK3gFDGZ73BQXgAH3F97t6adiN/ktIwnpKWdEhG57NLu6vK66fIr5iXLzg+z4P8LOm9LM2WJSA8k/k59/KuxpflSIy09piNBKOIX1MfQ= 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=wj7U/D4/; 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=wj 7U/D4/09bMUQraEGSAJXfdYZo3Na1YHmFlEhuSIUn6QP88V/QDfr5Hc7TaJP1D1RS5WiDeZL/1XY2 aSyMXvDh/JlagPNT5GDKF3NFFbV/JPsaniWUz62xD8tbhe5ANvXVzzsbniKLoJA8+CwdHL/FxPHwD F207h3tU86t79LQ=; 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 1rWm6J-006z7T-R0; Mon, 05 Feb 2024 00:40:40 +0100 From: Andrew Lunn Date: Sun, 04 Feb 2024 17:40:20 -0600 Subject: [PATCH 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: <20240204-keee-u32-cleanup-v1-3-fb6e08329d9a@lunn.ch> References: <20240204-keee-u32-cleanup-v1-0-fb6e08329d9a@lunn.ch> In-Reply-To: <20240204-keee-u32-cleanup-v1-0-fb6e08329d9a@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/DcumaUyEAcsmYgBlwCBon+s0cfQymfK1yKJWI3CJgbZEzc2imyu6H L7upZDxOPeJAjMEAAEKAB0WIQRh+xAly1MmORb54bfmvw3LpmlMhAUCZcAgaAAKCRDmvw3LpmlM hJNLEACUectcqUkkbAM2nZU+LrkjMEu+yeWzxiAl/BthabY6sfWCMweyFwHr7e2ZGsXEVEwMAxA lst7aQCILYGVrOcttw0xtlMaGYzt7OgMO+wRyKm274hTe0t0FiszcIaWMK7mWgwLe6i8LNnDGXB UCRX0dzeZK6fWxlevwii98L4P4bpQKSyc8veZD8rFmzmawXlz1z+bzMZL3BvpLpr7sFI1wBekIB nOaeMUU9ApSxYM/NO6+9x6R2O9Z2Jxg55K/GAygI6mqA7qs1IEPQXTTdvBZzeNm0fABB41bFpYQ H1haLfnckwjLdBw6zCs+8z94Jguh9giD6aYWGNDjgnUCzWOyyqIqpgEaGIMxjEkmmq9mk448wnM cq+czs3mHS28K/056kzZrNAit9/SLNMRwZi63aO2Te6M8X+rahpcANpD0g+PYKXBnSI1/kfax6I JhaDbkGmepsMrvL/F6PP2MrJAikviJuX9fyKsLiO7FxWhKx6/l1R1tqlmCkLGBFYL821dF2fAe4 L12EuB07Fi+EVJeGgCsKw47q915MG/wY6bk8bk9VII9EIDrwPAVMx5ABmr5ZWui8FAKG7xfNxZ5 ww4cqVE7My8aRWf38hABt/pPK4t5uS0w/XR3jpuGPoHcOjpW8egnmn6+PoZWgfDYmSl76rNSkzV myrUpDkn0v4hiAQ== X-Developer-Key: i=andrew@lunn.ch; a=openpgp; fpr=61FB1025CB53263916F9E1B7E6BF0DCBA6694C84 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790013754674306853 X-GMAIL-MSGID: 1790013754674306853 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 Sun Feb 4 23:40: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: 196604 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp575857dyb; Sun, 4 Feb 2024 15:42:49 -0800 (PST) X-Google-Smtp-Source: AGHT+IF49Lc2Vky1EE9sPJ+eiRG7+6r+1Z6I9y3uwhW+Q3q9DsosL2wrNgvkcSnlWzo5+y10Y+eR X-Received: by 2002:a0d:e804:0:b0:5ff:9fb4:33fc with SMTP id r4-20020a0de804000000b005ff9fb433fcmr8885954ywe.6.1707090169244; Sun, 04 Feb 2024 15:42:49 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707090169; cv=pass; d=google.com; s=arc-20160816; b=fs6zdVF8kmG0Qki86JXUsyCvV+3VAH9ktvYusDgFHz/1PWCKUaqSSqp2OIF+9Yab8q yiLLmufZa2eg2M0b2sIFU2isYZNDn5+hq0n4DX7qj54IILzrgpckZLbtYqTNt3KCmW/3 BIX8YKSpclPOZXrONrUsdldGD6zyt69RAwjUmc3jNTHUVL2+j7gCu71BYJpotJ+YLKHP PLp72tNQMIkVh+08i+J/A+NX1SYXj+1DCVjU7UE2vFMlYHOTW6mUgtCzRGn8CAT9GU/8 MOtvkxZtiJATNqZr6na1+iIBz8IJWpUSE91jq2r7ebUMCXUukULV9YKPL3+8kJIMF9tE bmGg== 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=2doDt/91LNf7zzFsUBINicxOOYdEgf2b3C1wAn071vI=; fh=c52s70HtIVBPWQMv7S4E7q+w5CdZJygkK/5ovZPyObs=; b=WygGH162e5sinsxde/dnXXRrMCyDIlpK3RVlE4T/W7vVa7qmxQReiwYeTKapyRRN5e UPlR2lqIASefNtUxaPbJUSFldMVM8TP3vYyuWvu6bBRTNgQL5TgpsjrXE27qctD75pWD SO9G+PxgObsodCv6skYckMmoKDalPXeOPznBPAGXaWSQlazGYf+BwyicoWRJZUgcCGu1 B8AZX+Nql5R+KWJnrvQOxFCYaX0mkuU3GPHLQpjSeSDe8IRd4KTaJL3bGw+AcwDh+75M gIt3YdRqKknXs92NwYm1VVEK1jcsdFpNRye9xenMQgINlRjR/APYVEldFAmRMabwy7ae 0kJQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=URto8lFB; 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-51952-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51952-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch X-Forwarded-Encrypted: i=1; AJvYcCWTXAbpUm6+Eee7vsup8ICUS6F0oJ9koyPMzypEkfmj8AbRiHLqn83WqU7eosvxWyoWEevbHlLB74nYuUZopk8ETjTzAg== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id v5-20020a0ced45000000b0068c92b892fesi3997393qvq.526.2024.02.04.15.42.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Feb 2024 15:42:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-51952-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=URto8lFB; 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-51952-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51952-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 F359E1C20DAC for ; Sun, 4 Feb 2024 23:42:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8CAE21D526; Sun, 4 Feb 2024 23:40:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="URto8lFB" 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 AAC8A13AED; Sun, 4 Feb 2024 23:40:50 +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=1707090052; cv=none; b=TlFdag9tuvyFhlfXNF0sm/bQbmHh80F/V6GdPGU9wReLJaXn8HILyt6doA7xdRBfOuJF0329IKgLK+Tfjr++pLaWcLeCFsXHBF7q8Ux8fxWRJf0Nr8cs2WlmuH00vjo5zauPU3NemcvsfaD6bxOdiN7TZpFL7zBrwVRdO0PA45E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707090052; c=relaxed/simple; bh=yGpciCvZe42X8Mm7gnxdnrEyn2lQDD1PdJhg+NXrF4o=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=tQO6QXJGAjRXLZ42zTV58gsFoN0VNE+XkhtSs5L8uS5YtqYOcMJlSGpxigvt00dPZUKof9Swd+dN9a4xIGsjRZEda9ZtRqdVSj5fT+k7DHmF707qBGgZN8v3fQLuYlek452lmUYcfCzJycWTlNYeky6wMc3O88J2KxAosu7xMVc= 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=URto8lFB; 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=2doDt/91LNf7zzFsUBINicxOOYdEgf2b3C1wAn071vI=; b=UR to8lFByG5VmS3jcLKkE4cZh4CrkLMuo4ibIT8PeTw3mmEe9HolO2wXFJAaCmXadQaVC8T9GVlXxI1 NzdyaR5a9fBzHi7L7NKggAFVP4MsNbo1f+gbXat3+dO0Nogds94E4FMh0p2IGM46AGcF9oJDODcoy kIBKCdFevAcp4HY=; 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 1rWm6N-006z7T-3f; Mon, 05 Feb 2024 00:40:43 +0100 From: Andrew Lunn Date: Sun, 04 Feb 2024 17:40:21 -0600 Subject: [PATCH 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: <20240204-keee-u32-cleanup-v1-4-fb6e08329d9a@lunn.ch> References: <20240204-keee-u32-cleanup-v1-0-fb6e08329d9a@lunn.ch> In-Reply-To: <20240204-keee-u32-cleanup-v1-0-fb6e08329d9a@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=yGpciCvZe42X8Mm7gnxdnrEyn2lQDD1PdJhg+NXrF4o=; b=owEBbQKS/ZANAwAKAea/DcumaUyEAcsmYgBlwCBpDmpYmXcVeSnqCUCfj4AuZvYih8ct4aIbx Kfh3Gm5iAqJAjMEAAEKAB0WIQRh+xAly1MmORb54bfmvw3LpmlMhAUCZcAgaQAKCRDmvw3LpmlM hCFcD/9Q7dRbdXUgdLfvaj0hb71Zsw3WnJjZqyt4hMRUEvY7m/0uJUMgbz+MlDZflhj73ItTPXB yb92ilkRsNgfR13MDrwgvLiSY0fmkMaG+ozLfDi9+VHEF+I/7qcxdm9+9MSfG0qi/7Xgv+l2RpG VlAqFnsJFoGStqBwV9lkCcc3P26TDAMyJ0d7FQENrr/T/ZBgp/C6+j2cmcNDOLFpT+GgOCXnkD/ wTQrFPt2XXQXPccESXngoqnY7GWexMQw/7jML8ahXRFPgmLbXyZq7400Vw6H7jdgE7lZzIYwygz 3n2ZL51hJVdOaiFDzcEGBlrOEymdpiBOUi7GfrVDL7m03euFUvWnVK39gbFcRP6+x+zZuGPwYis bsngfk2oZq08bhwD6kNxpqZamWOJwFx6cWScSHRqtYPaast9STPHnJ3a+XzEK6vFnCdVxXygqKm CdTACf9C0nXLbupsIKGV0NjF2o0e81zLJRjCzNKWIhby50o7eEhO1gUE6ybzDcLT/PtM2r4PsBQ 2R05axTmS3HNNlXDfLQG/1Fx37TJiMcizqP+3aFWFUQezmxyEp0hbK64SBI4QyLHVBfGKB/5VnQ 7CeZt9Oxnela6x8plSzz8CO4lwGFf14zjiJFOz3LdvqZvoiRxpfuDHkZDZPj9gf1vGq+w++FyWK oV+lENAMrd2mAQA== X-Developer-Key: i=andrew@lunn.ch; a=openpgp; fpr=61FB1025CB53263916F9E1B7E6BF0DCBA6694C84 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790013781240904778 X-GMAIL-MSGID: 1790013781240904778 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 ca69a8221793..960116871082 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; s32 rc; @@ -3436,28 +3437,29 @@ ixgbe_get_eee_fw(struct ixgbe_adapter *adapter, struct ethtool_keee *edata) if (rc) return rc; - edata->lp_advertised_u32 = 0; for (i = 0; i < ARRAY_SIZE(ixgbe_lp_map); ++i) { if (info[0] & ixgbe_lp_map[i].lp_advertised) - edata->lp_advertised_u32 |= ixgbe_lp_map[i].mac_speed; + linkmode_set_bit(ixgbe_lp_map[i].link_mode, + edata->lp_advertised); } - edata->supported_u32 = 0; for (i = 0; i < ARRAY_SIZE(ixgbe_ls_map); ++i) { if (hw->phy.eee_speeds_supported & ixgbe_ls_map[i].mac_speed) - edata->supported_u32 |= ixgbe_ls_map[i].supported; + linkmode_set_bit(ixgbe_lp_map[i].link_mode, + edata->lp_advertised); } - edata->advertised_u32 = 0; for (i = 0; i < ARRAY_SIZE(ixgbe_ls_map); ++i) { if (hw->phy.eee_speeds_advertised & ixgbe_ls_map[i].mac_speed) - edata->advertised_u32 |= ixgbe_ls_map[i].supported; + linkmode_set_bit(ixgbe_lp_map[i].link_mode, + edata->advertised); } - edata->eee_enabled = !!edata->advertised_u32; + edata->eee_enabled = !linkmode_empty(edata->advertised); edata->tx_lpi_enabled = edata->eee_enabled; - if (edata->advertised_u32 & edata->lp_advertised_u32) - edata->eee_active = true; + + linkmode_and(common, edata->advertised, edata->lp_advertised); + edata->eee_active = !linkmode_empty(common); return 0; } @@ -3504,7 +3506,7 @@ static int ixgbe_set_eee(struct net_device *netdev, struct ethtool_keee *edata) return -EINVAL; } - if (eee_data.advertised_u32 != edata->advertised_u32) { + if (!linkmode_equal(eee_data.advertised, edata->advertised)) { e_err(drv, "Setting EEE advertised speeds is not supported\n"); return -EINVAL; From patchwork Sun Feb 4 23:40: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: 196605 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp575968dyb; Sun, 4 Feb 2024 15:43:14 -0800 (PST) X-Google-Smtp-Source: AGHT+IH2ohdqcUr+v64KYNBBZAF+/y//fPYc/Tof/pr16k95hzEDrUoCYZWIhsPZMfyqHNBV6wDa X-Received: by 2002:a17:906:53d7:b0:a36:f672:5dab with SMTP id p23-20020a17090653d700b00a36f6725dabmr4838973ejo.16.1707090194318; Sun, 04 Feb 2024 15:43:14 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707090194; cv=pass; d=google.com; s=arc-20160816; b=eJKvp+xBAqZcMkJrcouLORV1+dyz384p+8Ysv9k1ZfZc1xc+p6/cNUFH1ndkN/nAmk GkNXr1GpqvgBQPuulQycbFR2Q26BF2T97POO5q9Z1uYbz/SZHUVruoKSfYhM++LBTPUQ w7gms51JGPJJ4kYBZD80/a3cuc//Yhx7SGHwtqoo3FhfcIP+KWYjBptie95O0UmrPEbo o4S9bh8xD5tC5pmSp5ajnUArOEAY/N9f585kbT6sIIh14+aM52cEEqqybtzXNb1+jmT/ O2rxEzHe8k46stKG6NuDouiGBMO8J5Tp9VdivtcAwm3tNGr2vszKJSdc9nxtRTD0Jmmc NK7A== 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=VMT+7HT9bLdZtz1arkF5M0mqUpczvKtrktRMX+PXxh0=; fh=jIcwkXDkn1No8F9V/QgxknAQXEobz9vX99K2GQ6vEUQ=; b=odXNMVPEwFa7/c5uaGlyg12obj3t+i6hDKSyMkweCrJAU7n9OdbCQ9G89TuISzmfT8 RM1yd82BzD/DPAQeobFhcSHdP2Rcvpyw+sWS9i6dRFFpEfByyWLCPE7TnBhGnUX/AtA/ xQrvMoDurytGWnsrJCSGMpJ+n1bCDEuwANITXuKMMX2hvKPku4KVnyZDMZF+BpgEZQdE GFZg3qTYCoD33hfKP8A+j/L/B2OH5HA5znCD8zGW8Rxm2D+3ZSarV3IC7TpMQvZRz/jJ 9Baxc2Pqad82tku4YJPp785EGeYLzhpuWRKmwkKkE6pgPUYRYYcGwdqKJh04a5/IgrTX xw1Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=qbo2AZkM; 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-51953-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51953-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch X-Forwarded-Encrypted: i=1; AJvYcCUwlInc4NI3axVo07tsqjg7RyF2kNIHwHSBRm0Q97R216M0yocAdNx/JJT+T5+TDBi8D+rejzsHLwP/pT8DVaR5kScT8Q== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id j8-20020a170906410800b00a3735ded125si2357685ejk.391.2024.02.04.15.43.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Feb 2024 15:43:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-51953-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=qbo2AZkM; 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-51953-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51953-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 DEB971F21680 for ; Sun, 4 Feb 2024 23:43:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E32431EB51; Sun, 4 Feb 2024 23:40:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="qbo2AZkM" 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 4D61014A91; Sun, 4 Feb 2024 23:40:54 +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=1707090056; cv=none; b=quyqYZeFESjWxzcJ3s9lVmc+4D7PMIzx1Ts3XsrPea7/PWYuXOXs6xNjqlVtaVUEpDlX69Oo6//+AN0iIhtydsxMapL3M3qXF9ecZBlm7v7tNo0C9qqQLHEfbOWcG1vcIN8fUiRcJr4oyvRXxRp1l6PlUfz/NhMFRkda2kegSIA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707090056; c=relaxed/simple; bh=7O5kudOyUkfuKOsf1feA2qBdlnbcsxmqX0W2Kbo7rmo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=EtJXiRTf2Qh2kPXTiuragUPTGc1JtOpq62kn1HjI3zn3szJkRcHOBIuP5tsQ+mg17ixbTRlVa7zewnTEa0mVcK3RlJeLvow2/3cCaVGCL5A6tLz0Vnl4RyNIYGTvp2Li8Rm2Rdz+sG8XRyESxzXM1sX5wYTkJ1KXUgq7PgB4LvQ= 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=qbo2AZkM; 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=VMT+7HT9bLdZtz1arkF5M0mqUpczvKtrktRMX+PXxh0=; b=qb o2AZkMrrvyZShRoCtkkEWgam5m0HSU6TPa/3uZogeU09NWJajQ2KXaUPxnFR1SY8VCSDYTXe/7gHQ L1fAs1aqKNrUOTQT37ez1kQz0LliIutbBePjLLVm7mT9evSbFMot9ZC3g75vKYCbSAtPoJJjsFyVn b86XwPYZ1S9e3Pw=; 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 1rWm6Q-006z7T-Ce; Mon, 05 Feb 2024 00:40:46 +0100 From: Andrew Lunn Date: Sun, 04 Feb 2024 17:40:22 -0600 Subject: [PATCH 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: <20240204-keee-u32-cleanup-v1-5-fb6e08329d9a@lunn.ch> References: <20240204-keee-u32-cleanup-v1-0-fb6e08329d9a@lunn.ch> In-Reply-To: <20240204-keee-u32-cleanup-v1-0-fb6e08329d9a@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=7O5kudOyUkfuKOsf1feA2qBdlnbcsxmqX0W2Kbo7rmo=; b=owEBbQKS/ZANAwAKAea/DcumaUyEAcsmYgBlwCBp/zrzpuGGHdcJTLlVsL488w2Uusu4PUh7R 0nXYrq5o3WJAjMEAAEKAB0WIQRh+xAly1MmORb54bfmvw3LpmlMhAUCZcAgaQAKCRDmvw3LpmlM hG66D/9NLRCHZoRQp8gY9TB7CsrIoSE+dx0IRf3PPHXhSiPhHeUvgmcgmlsn2cKn1tEL64IoSEF +MN373ADjjBxjq/Szuiney1GOIJ3RWuZb9GjiTyY6eRbHqvemufpEhz+8SMWtMUaRzms86gxDDz lVbjx1wlV1Tzb1S9O9LMFBSEW49r7f4h4f25EF9fBEvHobfHb5xOVxZ2T+1WChT+CgDaNhLO5mg jzcNcje8FUisl2joaGom87r4BpPITUIZ0TiCiWjmpRxvPFptTD/yKxAxWSVBoM7exMllB6mDiKc abO7xCAtYct7s2b/8g0b9QC5Ht+TFjCWp8fT1iezR8TCipX082MGh6f0XRSqP/4gP7FOPZY5Jxx XCXsa7HXABh7HMFkD1RZN90VS5O76vY/ns6BFAgEATJw9MFWbW081v+SFeBvRGRE/LznCKDV4o8 tDo/i20mEW7dHBIHhOVX1h3Y8nuOpOiaqd4taFvZ9GCYZcVLypGCuTUDmC2OhJqELjMXESsiveI TUHfCDDfRAWVu8PjnfKncHVoH76/C60kCtyUYfw2A4KC9ZUdwWzNx5dv7y9tp8sWdBadUyIyqg8 W60tUagyzazUSrWiBgGtQ+4N1mD0ekMpLYOxytlDShg0CbhvuhpumuKkBXyRw+Q4l9cO+ctbpNZ cn/bKdl7nfyHlNw== X-Developer-Key: i=andrew@lunn.ch; a=openpgp; fpr=61FB1025CB53263916F9E1B7E6BF0DCBA6694C84 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790013807337522937 X-GMAIL-MSGID: 1790013807337522937 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 7f844e967421..e9aed4069ebe 100644 --- a/drivers/net/ethernet/intel/igc/igc_ethtool.c +++ b/drivers/net/ethernet/intel/igc/igc_ethtool.c @@ -1634,7 +1634,6 @@ static int igc_ethtool_get_eee(struct net_device *netdev, mmd_eee_adv_to_ethtool_adv_t(adapter->eee_advert); *edata = adapter->eee; - edata->supported_u32 = SUPPORTED_Autoneg; eeer = rd32(IGC_EEER); @@ -1647,9 +1646,6 @@ static int igc_ethtool_get_eee(struct net_device *netdev, edata->eee_enabled = hw->dev_spec._base.eee_enable; - edata->advertised_u32 = SUPPORTED_Autoneg; - edata->lp_advertised_u32 = SUPPORTED_Autoneg; - /* Report correct negotiated EEE status for devices that * wrongly report EEE at half-duplex */ From patchwork Sun Feb 4 23:40: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: 196606 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp576067dyb; Sun, 4 Feb 2024 15:43:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IH3ki41Yv9nKpBU3eeooNdE26L54GzHtGSlWDHMOQ9sBThe0j8TdnrOBN9zFNdsdVrjxwPs X-Received: by 2002:a05:6a21:9703:b0:19c:a795:c04d with SMTP id ub3-20020a056a21970300b0019ca795c04dmr7292899pzb.18.1707090216288; Sun, 04 Feb 2024 15:43:36 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707090216; cv=pass; d=google.com; s=arc-20160816; b=ySz2EUk6xIL+1ntRoNxNnDITJVmb+UzCE6NNsItCoGaWy+LT7pJ/eQJsXqtqmob6Ag SR7YrUULJCex4d9YF8oAEXY2w3fA72uBEP8hzloLuyE6NR0hPqlbp9ssanjfoE3hGYgc 3QylL2QOIILahX5+kWjOaE4AV8R3xG3WU5i6hf5y1MFwewVPoDsfmeDwNgU1eurF1oUJ HPPe3mO/ORNySOao4OyBZ0XghlAFiRluCeA65wqGCub2t1jwqjLcUDLB0Pq5J62cuNWz YN+JkrZ1CbBUHwk3+0EQTIPOcpfdMHapaVAfKsoRcnXaj9C0ZB9eKA6t9KCBEl0lNWzh dPTA== 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=6SeFzMRB/is/AU9T0n3v36DfDtqUZW+fzx4hxvfDmK0=; b=ad/NWOJBBMm6gKeQJ+21kDRLX8RPLQ9T0Kx6hZu4OOU3pMc4/cTmK+vOrh9drLcThc BtIN4ZxgzcDcp3pKlH3IZ2wDK7189hbj5QI3Wv8UztbfbtE/hwo8Ve190oORbq8VskI1 hZd5Q4mAay8mhzoERJX9NOLCTy6GYRJIqXcrVmjMHVfHsMfcBv9L9Ge5UpMk0IgROK07 g2cIh0e9te25wEfMFRPip80jOVDa2GJ17PuNcfre2W41ruxBfXmDMeGiRrlolAJHb7Ra ngEVsfHEnB4bP3NAd+YMYp4fEzSwqBleTDFGLbHVQNNcOPjrwo6ixWh5xKwdfaCs/Zzf SreA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=ZMcxmBBH; 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-51954-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51954-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch X-Forwarded-Encrypted: i=1; AJvYcCVi98eBGrt3kLTdWfBMyGRrgu7YnYdqBvOsuwUIJXVyIU/mF/GOa5Wo1b73q7qCTP7akf1jLTuRb+s0Gfqh80v0FRTpkw== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id u21-20020a62d455000000b006e04c54d3f6si8391pfl.24.2024.02.04.15.43.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Feb 2024 15:43:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-51954-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=ZMcxmBBH; 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-51954-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51954-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 13B7828291C for ; Sun, 4 Feb 2024 23:43:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A45B7C8E0; Sun, 4 Feb 2024 23:41:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="ZMcxmBBH" 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 642E71EA71; Sun, 4 Feb 2024 23:40:57 +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=1707090058; cv=none; b=LRCNNYJusX5sZygVyEJxOafLKY/sbmUVDUKSQEhfWbjhkooubdiYEzaDAhlY0KZ12lK2ETofU78cU25RJUUDz/5GTHY3REzX3TYkEXzYoVmkH5AxGKDFwBaCulHnLqnZEJrL0EL4WK0ZNNae9OKbwFB4KsHqlNusXvru7vFPstg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707090058; c=relaxed/simple; bh=nLsygJVJCduLk95szsdKOpEa7GzGsR0GfRGWNH5oTU4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=RhgBU+rVPdc6qJMU6udhdEDtVD1dIZLLkVETqEIR0Y65H32MTFxGosXakFxabJelRa6kCjPY+N9rGd5rUa5AX4GvzX2NZhOD5Wj6Mfyyou6VSaidMMej1cdczMBXVf7MbvlCyJVHwte2jaWXuyxEusdiK/tpME+IdeADyu176YM= 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=ZMcxmBBH; 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=ZM cxmBBHlIhSCPAlwVLBoz3Fekp/dYlX6F3SanTzQTRzOR+lxnu6sEtW7uiemGZkSN5AS+iKyP2KiTl V4FDxCUDTJFQr+o90HYrb//4tNVP6zw5wRcCU9wfWrcN1Q28REsGFniPRYH9RomDuKrLiCcRp6C8j +INF94+EMgeVlwc=; 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 1rWm6T-006z7T-Lq; Mon, 05 Feb 2024 00:40:49 +0100 From: Andrew Lunn Date: Sun, 04 Feb 2024 17:40:23 -0600 Subject: [PATCH 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: <20240204-keee-u32-cleanup-v1-6-fb6e08329d9a@lunn.ch> References: <20240204-keee-u32-cleanup-v1-0-fb6e08329d9a@lunn.ch> In-Reply-To: <20240204-keee-u32-cleanup-v1-0-fb6e08329d9a@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/DcumaUyEAcsmYgBlwCBpVzUXNjKxZFogkHO2Vi+0+ncows3pPdO7m IgiFrRgNjGJAjMEAAEKAB0WIQRh+xAly1MmORb54bfmvw3LpmlMhAUCZcAgaQAKCRDmvw3LpmlM hJ5GEAC+Up2GLnNGBrVKddbao8VwxNlTND+5pPoV/Tsh0UGTcxNgfMGyhNDlu4yDEKZUaCTAOVZ BOkqbMr0Yg6NF0wmfrUvqdk4/b7UaqnvMI4NVTo4VDdzvyFKR64Kyv6Cf6nStHQMOia+5V5k4By +ZAVelTkjyOH+0uUI0+iQOKhFfpXNRVH2I5rsPH9BIzh0WvAsAjTVPvAmTOOlXBE5bd9PCyREBK ErUeGpXGTXKtGyAq/cozv7Cv1vLIK96SMf3IBnjVbCya9ithFar8DRpq8ZVZ2E8HQpiX70Ubg9l J1+Zs9A1TixSu4SBszHkvbZjrn2y85aTvU3hVVYFWN3M28WTkXOWczm7xWiFjRS9bzz1z/ZvQUi aK0yPzLkZqXvfmXIb53E/YwKcp9gl7AylFxm1vns8rjN7QWCvBk3GUjWLkRhGXzhCBps5W/8rNx YIqcBiphznQNC1hadEUm/UIZFzNmq6Ho02XFMqWl0ozwz4BAL0QSG+DwGvOionnWxsIVBwyoDri 0JYgES9vfbVZmjNq95mfCSTpFo4B/6MFwcgoxtfBLayJ1E08Wr0kNrFnqBlJCxJHFhg+DqKDdLC Ok0Yshs7CSybELHhfbI9+FkghH0Elw0OVlUEliIxgt2TFmQ1fDuDruITZ0V4FGPx8FZ25/TsLJa og612fGbmUSkMvA== X-Developer-Key: i=andrew@lunn.ch; a=openpgp; fpr=61FB1025CB53263916F9E1B7E6BF0DCBA6694C84 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790013830285455322 X-GMAIL-MSGID: 1790013830285455322 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 Sun Feb 4 23:40: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: 196607 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp576189dyb; Sun, 4 Feb 2024 15:44:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IHVgFkvPWRwyxjXStRwolz+F5ElIMs+6BvCPObpPPw6mSenPFxy2M3SsAYP2CsOh2t0JutP X-Received: by 2002:a17:902:b788:b0:1d8:ebdf:182a with SMTP id e8-20020a170902b78800b001d8ebdf182amr7500317pls.44.1707090246263; Sun, 04 Feb 2024 15:44:06 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707090246; cv=pass; d=google.com; s=arc-20160816; b=SYwjpkbIqdoaUTj9U58JNzeEEnGN7014FwPVYeFhDoI/EyDpqMyfRVYFNYhbJwVz+R I8hmZDeotoSMVuEm2T4bV6a5WuvdS80S51lBSMG+g4+0FvWKj8ogGLWVrOyF1FReXR8o AeYum3LCCsC4biC+OjwahDKBtrt9Rn/FUwG70lMuTe4WcpsYkwFB1xBWtnuGWt2pNKOk PWJpW1qR3TrP65/6ae3Ib/myevaaKe7zPfw8csk2N4QItcaPO8H59NMBlDQg4RuSQMdv 6CvlEDi1vENZVwCFgXJ+wGQhTpud6hDkCa0YYsoJ2cylZ1vSXTyNTyMEfOdeh+YZW+Ai QlRg== 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=Nlnk1r6wv0zjIATTtjfz3ohTL3KfP4POBx3c7YGq5bw=; fh=y/kN+ZyB7fj8aEqeMsev5gz0ycFiFbJOtmI+dI66BEE=; b=ibW8kuMO5uAth77icbU0hz5udveJDiSAa8CiGUPk+wH9QwNEop129nvlHlQV0ShPVb s+JIT18FP2kB6HSNDgibtdgakD3Y+ermis4GFxqNkCE7x/st5hLtwyWHXrw4MDLnTtID OmDrIVxvswDC756xpHxAUW6mIaMxzClviPi/WaACh92zCAhUChVpU7TzNbG4siU+lbQp dIVT/be2YRiLCA5NRNMI0xV445Q1dvlukawstikTGyHgmwDWIdmos5nCKpZ/mUsJZF3L DqaAUNByclFaMpSJf6PbCwD2irH/BRO0kQsJmJBNWhStR9QxbVxPD8tidEyH1kUHgsrx Ve5Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=OQhuciae; 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-51955-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51955-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch X-Forwarded-Encrypted: i=1; AJvYcCX3P6TTbXURRDTfAuwbpLUjlKz32jW1RAAzybvVMWzBlCfx9ocu5DommGWaaPOPbOsKLeGkgUTk/I23Z1WOrwR5wgrNYQ== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 12-20020a170902ee4c00b001d5cfb42818si4870348plo.642.2024.02.04.15.44.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Feb 2024 15:44:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-51955-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=OQhuciae; 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-51955-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51955-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 CC1EC2816CC for ; Sun, 4 Feb 2024 23:44:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 81A9533CF9; Sun, 4 Feb 2024 23:41:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="OQhuciae" 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 D7EC52C1B5; Sun, 4 Feb 2024 23:41:00 +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=1707090062; cv=none; b=dFWv5c2GyuW9qdrM5h9jufFOn+4L4PwU5ScVZT2dW/imtZrL2l/oPO+5VFOz9fkBMsr7jPn+53N8/G0sEgArUHy4sFpwtoR15iwpy8IEO9V9Q9bTBMRW5wo+oVzVyBb7W/zH765R5p9nku4YF1W8MVi+ken8vjClsZDOlUlHfDA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707090062; c=relaxed/simple; bh=ws+upct0PshnxLVgeoYRns1h4CRUSKNFPaU8Nlm38ZU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=YpvYJ/X9BaeKx561/mswyMxC/znmiD60lnqQytIptJsyL3OGjU0PiRzjMTOTCSmXmgyoUxVSpXCnj5XpG163nvsTLXus1DMueCTaNlKKlZGGtOTQdmVeV4cPKDeqE5BsdCHW2lj3534S2RIWr389zEN6l+w7PctL4imAILAuTMI= 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=OQhuciae; 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=Nlnk1r6wv0zjIATTtjfz3ohTL3KfP4POBx3c7YGq5bw=; b=OQ huciaeJ1DtcXaLuD+sV3aGf67lAPXS35NLZZrKgWxciuji2bkV+UdCaB4xWNVU5iwc9jm0PhCTQzD RdJ+TiBFLvxonabpFO3GMzQQaK2bXms2NXwcNmijf/mDgXnCB68HQ4NHGLcfmiSt23m7KCheDsgGI oPxqGAq2FEm26a4=; 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 1rWm6W-006z7T-UX; Mon, 05 Feb 2024 00:40:53 +0100 From: Andrew Lunn Date: Sun, 04 Feb 2024 17:40:24 -0600 Subject: [PATCH 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: <20240204-keee-u32-cleanup-v1-7-fb6e08329d9a@lunn.ch> References: <20240204-keee-u32-cleanup-v1-0-fb6e08329d9a@lunn.ch> In-Reply-To: <20240204-keee-u32-cleanup-v1-0-fb6e08329d9a@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=3792; i=andrew@lunn.ch; h=from:subject:message-id; bh=ws+upct0PshnxLVgeoYRns1h4CRUSKNFPaU8Nlm38ZU=; b=owEBbQKS/ZANAwAKAea/DcumaUyEAcsmYgBlwCBqCc+fmKtf/FluwMD0LkVS0gmee2uK8i3YT IFDqQsNWh+JAjMEAAEKAB0WIQRh+xAly1MmORb54bfmvw3LpmlMhAUCZcAgagAKCRDmvw3LpmlM hKXOEADJFoEHcexuJjbwrvB6F7MiEWC277cu82Gg+rso6IXZqpEA+8ookBg++M94FlD2561fZHz VS/C4JAg+EM25YAW0xklY96I3t7UvzlmqePH3BGjD46z1pYsGoOI03wV8ZKGa4MQDzpQOn/KzBk he8INnb5dKurZLmDW4bw4a7VQ5tEEbLXS7Eaf0jTkzKxntVVAR2O9+zINH/0nb9QRmdxkms5x6J s+Cfns4dmgA3pr+Ry6armR+kcCs788XAGhDTb6/P/24qGk7aYMcKKw9ajiD7NXc+J90NpI5OSko DHzQz6l97ENgC1GcSx9fqrA1VuhlQ9HQxxgHsABDFollZYlHOL0XE7XufkEOaoV+yx9LGqMND2k XRn8z/qA5ihAJzuO/NpxzX/E5EzWyMPvMUyB4wgO+mSjFwuKiNj2UZLG9p1N48XsZBdoWo+1eSz WSU/UU8WgdbrZ3D6SFGYZcpccEPL2ghWh7L8tzFExFn+F7CqIOe5t1Ss5SjzEms80cxOHLVl3SA s0zrdM4GUiQMe1yx1kpzT6hl75kHFChLkt3JhmyaD7mT8PY7pbwdnp0I1AcTBA7XEQmvEK0Zi9g CGUIg3k+uo3mAD35RPXLiKJVbQ1ZutHSkRqvaeAdQyZ7pLRwvRNuQRaJWCQtQr23K3luw2h5QvG JDWFUm4FftW2WRA== X-Developer-Key: i=andrew@lunn.ch; a=openpgp; fpr=61FB1025CB53263916F9E1B7E6BF0DCBA6694C84 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790013862454504624 X-GMAIL-MSGID: 1790013862454504624 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..fd771668f946 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_100baseT_Full_BIT, + edata->advertised); } else if (!edata->eee_enabled) { dev_err(&adapter->pdev->dev, @@ -3153,7 +3164,7 @@ static int igb_set_eee(struct net_device *netdev, return -EINVAL; } - adapter->eee_advert = ethtool_adv_to_mmd_eee_adv_t(edata->advertised_u32); + adapter->eee_advert = linkmode_to_mii_eee_cap1_t(edata->advertised); if (hw->dev_spec._82575.eee_disable != !edata->eee_enabled) { hw->dev_spec._82575.eee_disable = !edata->eee_enabled; adapter->flags |= IGB_FLAG_EEE; From patchwork Sun Feb 4 23:40: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: 196608 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp576669dyb; Sun, 4 Feb 2024 15:45:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IFgGE5ynfSYRWmNYjWW1oQb+j3lk8PV8pcJTjUC7O733SxLYsG7rPgB5QcdsHcSy6m8cSV8 X-Received: by 2002:a05:6358:6a43:b0:178:9b16:5bbe with SMTP id c3-20020a0563586a4300b001789b165bbemr17201641rwh.9.1707090343147; Sun, 04 Feb 2024 15:45:43 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707090343; cv=pass; d=google.com; s=arc-20160816; b=Uwpi0dm+GOmXtPvA8vGS8SbVkXCEwhWu1gq3HEEmYh2kTGfZ9aT+0/16iZrvh67Jh4 ijEDdBq3eB5gCMYSppQwLzWE1GhGHUwB/N07tsnGBOUOho9TWchiSNJD4oKHU6ximrM5 AKA4eO+jIqLGk1oii3aDshJMcqzk3TbRZJ5MLnRQP0aCyWUcGOfNV7Fhae1GANemc942 ywRRD1X8+NAgwtedIBsF0BsaJ4oyfnwQbVqf7BHd9wRpen6ikHy/8Anh6PKuygCWcwCh D27f6klLbHFYQTTPRvugc3rHo5u8VXzklHKpa2E23FUQ++2laXdAFllyAvmhy1mcDYvG h2LQ== 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=qhzUzBBE/ag86Iuv8pKOl72IzBpodGhMjRQDM/+8K5Y=; fh=nxP7MH+H5ifhg0oDG/qG3P8PJbzAk/HH/dGoP2nUpYQ=; b=DJ9q0sIFJWFBdwidHXHL6IRO5j3RXsPtdlg7libMgCpf/gJRiV3G+/WGHdK4ubFmrc QeKr1RrDeGO8EjHvEipv0JoVFCdd9AOnUrAPTUAYZ8Ioc+WU+jJXjFEj2uqZHmQyg8zw Zbp2MHwlS6EfqBsDfaFq7xp9XEZuqp3tATEQJkCMconQQTjpo4ejRZqY9ZkjWvWASMeh N5E9xthsrQgMQe44qlVV//f4N/m8KpO494Gl84SvlCT0O+DrvAlYcMmc4CUluDJFeqat UzqZw6RYUnBzCPCmTaGYMqsbllk8fuDd4OUvOdANVJpZTs7oU4tWoGBZAvdsTzRQTSiA wezg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=a11NRg3H; 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-51956-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51956-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch X-Forwarded-Encrypted: i=1; AJvYcCUh0c91Fr6jyJyG2gkS6Y1UUEXC8jW9dSDIgRK+NxpIWgFXKbnIkNDNETCTw0cLs+Wo0i+GaPmKsoeE4Kf4Dr73yxdDug== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id l11-20020a63da4b000000b005cdf488ba0asi5030042pgj.746.2024.02.04.15.45.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Feb 2024 15:45:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-51956-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=a11NRg3H; 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-51956-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51956-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 AED8FB216A5 for ; Sun, 4 Feb 2024 23:44:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E2A38FBE4; Sun, 4 Feb 2024 23:41:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="a11NRg3H" 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 BDFD7DDBB; Sun, 4 Feb 2024 23:41:03 +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=1707090065; cv=none; b=uOh4KyNkVRiZMrqniXgkW6Xpxa3XB/DA6C0b51IJeZMlOfPtH4t/zCL9u3jNW3BI8q71sIUa3kerKUy99aOnhfQk4Cd/PHG+xoEzb7LtRSI/wZjqWOHLGv7n7yPZNF3RHJ5mtHlsaNtzuzxDYLupFfVLaakrOondnsdtalC2JOE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707090065; c=relaxed/simple; bh=GY/i358jYl4X2zeywHliUg8zbjHunLh0+ZONAyCsEDA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=aAI++OIheVavLbfGXqVxUnmAvAKR5YQe/WKvqPkiKplhYqoxLFgxVcKvl6sQJtj8olYh27MsTRZ7KCirrGhSRmU5MMl0igljjwrG3xHiwkVFLGAM2K2uq0JzT61JxH/aTnIs2S3rGnA5BtrlS8TiX3ZkLdKdcGxFVBy5Omddj2U= 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=a11NRg3H; 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=qhzUzBBE/ag86Iuv8pKOl72IzBpodGhMjRQDM/+8K5Y=; b=a1 1NRg3H7ioa/uQU6pi/ZYzRyp/9SW1iXD8TQh21Su2H/FGxpmTEIhW/G1CHiBRuLFnRY5iuX1nar71 Vp/lgjZHmQODZsHCwzFL6WN98kX9yVukadk/EWHaVtIb4yyrDBPkzfpz6q9sX59x1yZZD0w8IihVb xM4YFFx/kjoZQLA=; 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 1rWm6a-006z7T-7L; Mon, 05 Feb 2024 00:40:56 +0100 From: Andrew Lunn Date: Sun, 04 Feb 2024 17:40:25 -0600 Subject: [PATCH 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: <20240204-keee-u32-cleanup-v1-8-fb6e08329d9a@lunn.ch> References: <20240204-keee-u32-cleanup-v1-0-fb6e08329d9a@lunn.ch> In-Reply-To: <20240204-keee-u32-cleanup-v1-0-fb6e08329d9a@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=GY/i358jYl4X2zeywHliUg8zbjHunLh0+ZONAyCsEDA=; b=owEBbQKS/ZANAwAKAea/DcumaUyEAcsmYgBlwCBqchq37ZWAaCXguBx3KZrCunBRHw7lO6YQI BGeHWL/fxmJAjMEAAEKAB0WIQRh+xAly1MmORb54bfmvw3LpmlMhAUCZcAgagAKCRDmvw3LpmlM hP3+EACmrlqVvQVpi8hIGv7u5kcwmZhDfq2v8zuE8ahroCH+WVKmtXgT7ujGkPXLj5rrHSNQ/Tb oc2Gm0y9F67PRPsKstTJE6dA+6MbKjAt6WBUiVEQq/FKf5rRumNLyD1zJa3qQqPckX1QCdLS53R jS5ub1Kl29ZaY1uVJSM6maQ6TLbJDCO0fihwjnPzrQjM8yeRdCakWGGi1zOSmwqqSk53LiIk9/+ szNw6xdTqY5leQVYyCoc+iLPDMCqeO7nMnUzXwzeaPRv9y0EU676Gc06lOKBP2X4xDU6xHZqTcu SKzpM9We/Bgd2sKHPUEiuywZv+OOeKktgaTksyQxG6Q+TXfLXdYAFx0INrkOb1duE9nY5nGZdPG 6/zXaCs2uwEHbGyEowgLAGCli6RLOMmMALU02Ti+Xc7GCXB9RuyiPhe1BMZijpEvi4rDKgTSifB sLkyNIgCwf31Xm/KGlZ/aGdKMS8l0Bnn+ZViQhpfHkWyjtSEEfY+Gu6845mPQt7/FXT4hRo3E0B TL1SUMeyGbGcb4j/OtcSgf3p6Kq1gMJgCaePXLGV5Nd3idrfpE9+LNZVPa0PSq6HvHm4hLnNhMP zZaFrKD+qEymoaFGnDIrjnkeoHcqtpFNI+rza8BkAxh6WVJLybo4W4ECsNFYch9pa5P7XNJOUpc hk4xXG7KVvmucew== X-Developer-Key: i=andrew@lunn.ch; a=openpgp; fpr=61FB1025CB53263916F9E1B7E6BF0DCBA6694C84 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790013963943165657 X-GMAIL-MSGID: 1790013963943165657 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 e9aed4069ebe..e9d78bcb0201 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;