Received: by 2002:a05:7412:798b:b0:fc:a2b0:25d7 with SMTP id fb11csp850498rdb; Fri, 23 Feb 2024 01:48:32 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVPSgogXr8RNSW4Ez6thHnF9Q+6pU2zqhLHJGgTKJSfV58AJZZ4zS1rt1qu93QdVS4xHgjRyN+RvJUSyKzTGca6q5YrilyrRLfLQDpiWA== X-Google-Smtp-Source: AGHT+IEDBh07DncP+5BDMyDXZsQNwpZtEkehyZVwdgxaxQGOA+KhyMvgTDu/WRg1+HsJ2U3Z61DG X-Received: by 2002:a0c:e088:0:b0:68f:ac2c:8837 with SMTP id l8-20020a0ce088000000b0068fac2c8837mr1573681qvk.24.1708681712517; Fri, 23 Feb 2024 01:48:32 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708681712; cv=pass; d=google.com; s=arc-20160816; b=EhVSaSduMHL0zQs9ButvxH3gW/iX4r4XQgLd29PCr09F8sxTjVJ6UgSj/aALmNEkmh +t/9de6imW7UzpKncU84GXg0gZexIz2gEtgmEh8Zuv2OIgX9qViGCdvOP5iJsns0MUMu vRBxURIlYRq41pvcw7gJ08eZpzAeBXxAc9BU+vP8rZ2ZuwEbET3woyOnCnN5Px8CK/he kPntKv42Gs4r+NmmF4j7NS6PHmAbmOwgSGTI8dI8Rgqsn/TLUtJ9FURMnQjbH8RPv/mD xAVvfofqnbzdPkzdD6vo76KtNj2CjIsfegJ5WrOr6hKxLgunfWBg8wtPwN68gnlTOiP1 2p+w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=edFLDTuzDrwmqIbrAtjgmcPlEbZe7AtS/HF/+IvRl1w=; fh=sVZ6H5f6ewU2fC+U58NocBocCWosMlAmPb9AApl9d+c=; b=BgFfpC7/mdno3wQ1zBq6Bjml/5H2iILxcyAMu7CQfE7n4thIGP/SGfXbu1nhDBayit bUYajNyMT/vVRVL4JZvGI76yG7GCGKoKju/DmgUusYDRpqQArJod8suQXocKbz91pN+G eO0361qOgY0pWZ6SFizda/XQeaghUV4AFBnVE8wqBdG4975SxxNHtQ+HZnSJtuj+6ysK 8o5pmJ0xX+E2Slbevs3bCkVNR6jRRi9XAwaluSXx5Brp5K/jDk3cN6JEMKtbb+hwgDWS WTdABKj6gv3ObYWOo07YIwfxSfDd0XHfeETGIx6JtAfzI7f5zM6QiqbSLD35c0U2UIDH /BHw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=pengutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-78067-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-78067-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id d5-20020a05621421c500b0068f761b112esi10185902qvh.357.2024.02.23.01.48.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 01:48:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-78067-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=pengutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-78067-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-78067-linux.lists.archive=gmail.com@vger.kernel.org" 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 3B9581C239FA for ; Fri, 23 Feb 2024 09:48:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 55CE05FBB5; Fri, 23 Feb 2024 09:45:01 +0000 (UTC) Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (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 05D7A5D48C for ; Fri, 23 Feb 2024 09:44:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708681499; cv=none; b=Qyfvfk+HQ2WxTKkRZVQcXMudH02mT+G0pUGQ0w84+S/w1ufPlb8dAjhhS93Vfc/3lYhJqYgsIfAOPnRLx5rosFwd0biMO9C5sJvmijemVi0IFynqCq7h8NxaE45pIMWmdeLGJDoyZO9KjZsQvhxNsl/r9/Ovk25EohdG+3dV7So= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708681499; c=relaxed/simple; bh=TR/ZiArrOlLQxYU0ILdHl+xxn41A+NFoAQya+K+oN8A=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=EOwuwogsQyp9YwljQtznIwd4qmgOqRaptZFxdxFhVZtyav6N8FHSVn0cA+Tl9k3ZqbufD5K8z6J5PMnxrgrmoA48VlUwP3C+sSIJJVp/zE1Kp23uJrU/9yQ71Nu7JI0bhlTiIh5oSrDdxH37K3xMLuAA/ewe4YYoZ5ZSck6z3Wc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rdS6W-00080n-LP; Fri, 23 Feb 2024 10:44:28 +0100 Received: from [2a0a:edc0:0:1101:1d::ac] (helo=dude04.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rdS6V-002OkW-Cm; Fri, 23 Feb 2024 10:44:27 +0100 Received: from ore by dude04.red.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1rdS6V-002tpv-0w; Fri, 23 Feb 2024 10:44:27 +0100 From: Oleksij Rempel To: Wei Fang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andrew Lunn , Heiner Kallweit , Russell King Cc: Russell King , Florian Fainelli , Oleksij Rempel , kernel@pengutronix.de, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Shenwei Wang , Clark Wang , NXP Linux Team Subject: [PATCH net-next v6 4/8] net: phy: Keep track of EEE configuration Date: Fri, 23 Feb 2024 10:44:21 +0100 Message-Id: <20240223094425.691209-5-o.rempel@pengutronix.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240223094425.691209-1-o.rempel@pengutronix.de> References: <20240223094425.691209-1-o.rempel@pengutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ore@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org From: Andrew Lunn Have phylib keep track of the EEE configuration. This simplifies the MAC drivers, in that they don't need to store it. Future patches to phylib will also make use of this information to further simplify the MAC drivers. Reviewed-by: Russell King (Oracle) Signed-off-by: Andrew Lunn Reviewed-by: Florian Fainelli Signed-off-by: Oleksij Rempel --- v6: add @ in front of eee_cfg --- drivers/net/phy/phy.c | 7 +++++-- include/linux/phy.h | 3 +++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index ab18b0d9beb4..f0ed07c74a36 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -1660,8 +1660,8 @@ EXPORT_SYMBOL(phy_get_eee_err); * @phydev: target phy_device struct * @data: ethtool_keee data * - * Description: it reportes the Supported/Advertisement/LP Advertisement - * capabilities. + * Description: reports the Supported/Advertisement/LP Advertisement + * capabilities, etc. */ int phy_ethtool_get_eee(struct phy_device *phydev, struct ethtool_keee *data) { @@ -1672,6 +1672,7 @@ int phy_ethtool_get_eee(struct phy_device *phydev, struct ethtool_keee *data) mutex_lock(&phydev->lock); ret = genphy_c45_ethtool_get_eee(phydev, data); + eeecfg_to_eee(&phydev->eee_cfg, data); mutex_unlock(&phydev->lock); return ret; @@ -1694,6 +1695,8 @@ int phy_ethtool_set_eee(struct phy_device *phydev, struct ethtool_keee *data) mutex_lock(&phydev->lock); ret = genphy_c45_ethtool_set_eee(phydev, data); + if (!ret) + eee_to_eeecfg(data, &phydev->eee_cfg); mutex_unlock(&phydev->lock); return ret; diff --git a/include/linux/phy.h b/include/linux/phy.h index 432c561f5809..c315928357c8 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -30,6 +30,7 @@ #include #include +#include #define PHY_DEFAULT_FEATURES (SUPPORTED_Autoneg | \ SUPPORTED_TP | \ @@ -595,6 +596,7 @@ struct macsec_ops; * @advertising_eee: Currently advertised EEE linkmodes * @eee_enabled: Flag indicating whether the EEE feature is enabled * @enable_tx_lpi: When True, MAC should transmit LPI to PHY + * @eee_cfg: User configuration of EEE * @lp_advertising: Current link partner advertised linkmodes * @host_interfaces: PHY interface modes supported by host * @eee_broken_modes: Energy efficient ethernet modes which should be prohibited @@ -715,6 +717,7 @@ struct phy_device { /* Energy efficient ethernet modes which should be prohibited */ u32 eee_broken_modes; bool enable_tx_lpi; + struct eee_config eee_cfg; #ifdef CONFIG_LED_TRIGGER_PHY struct phy_led_trigger *phy_led_triggers; -- 2.39.2