Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp190526lqg; Fri, 1 Mar 2024 02:07:52 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUT222gAlKRtaW30/CKCnXXtDqYqZ/+oDQMxdnBOmC7fW0JM065BobknmDjA3lQ0rRKlS/A1UfiGXiOm7QTF7lrmr49558CJThHn2KChw== X-Google-Smtp-Source: AGHT+IHQ/Xc8Gg3TXGEzvGCMUjohlzmLeLz1OIn0HCjHFAJg7IyUWCVzX2Dv+T9YzYMp0CaoDovY X-Received: by 2002:a17:902:c3cd:b0:1dc:af82:98b2 with SMTP id j13-20020a170902c3cd00b001dcaf8298b2mr941322plj.43.1709287671875; Fri, 01 Mar 2024 02:07:51 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709287671; cv=pass; d=google.com; s=arc-20160816; b=Yjy6J+ijs2C3KM6FiYzIoGhtp9l1FUB/H+cYphSkhe9LTK7DXwsw+KFAE7NapSX5a3 pm39ugfC5+HnWY88o2XtsC2F4PIsHTdVijp+LboQ1FpiFtfPz9n8GyICMF9xD78bRj7t 0ZLyDDKEjiXRdVh/DTT70yjn//fc4VEdWwXQxh5qJGfsiWbDajF3yJ6uS+wOb9LA4+wp 9waDdLezxWUbhRbEKAQbIu+qcqXjrZR26YLgQUyndFACsPGLNL8sI8DZFKx9JuOrsztu d0j3XwY2jzPxiAdxYp6qoG+cgOAajO2vI2+RvZ+3WSKXcKnI3vMKTzTA0TgrFErMATlt kFFA== 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=9YsSAjmT+/hFU+VxkrfHtXWIoAPQ5d5y5/WIvvBVfsc=; fh=sVZ6H5f6ewU2fC+U58NocBocCWosMlAmPb9AApl9d+c=; b=F8kBAfAwrRR6zLpTo0OFpQAhoum/8JGrpQ0I+HOLXOvb9shP48SEjrdZUu1HHSXRIn bjlCbDcS3VuKIuLR7W6qk881UaFnRQ8qiE1l2/2KlOWmQhrS9sN76CyH1WclXFs5cgf4 pGnhyxXlh/xOww0KLFOBxzS/ZqjuoMIUd2uaSU8IEWKMALrxtPNURkauF4cUo4Y1jDum nyXCZJuiD7AtPoJqjYoJzAzWIUcPZfWLw36Yplg1d4TH7BqSHPwx3Vc08AQc/64AQ/9t KXJ8SinnxfEJBf3c4yjmUdavWnKtufcpykTY4thHIDD6MWJm3HU/6hVh6U5z6rXzKCVq MW/g==; 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-88234-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88234-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id k2-20020a170902ce0200b001dcb7d02094si3334618plg.392.2024.03.01.02.07.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 02:07:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-88234-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=pengutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-88234-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88234-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 911692850FA for ; Fri, 1 Mar 2024 10:07:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6D71F6BFC0; Fri, 1 Mar 2024 10:04:19 +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 5E581482C1 for ; Fri, 1 Mar 2024 10:04:17 +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=1709287458; cv=none; b=fnSJaNOx77n5fCHf8dU2M8y4lSG2bKvCuPJqDEHGF5T/SD386bPlG+mszhOKLzwENKNd0gWaXfw05W8JOgr65KKQYGs03MdCLJ6q0wfrxO9KOJ2BojcIKINnoDoYosm51+iYCrcZ6O1uVlSZoB0HdRALvRbcrdTQIGTpJJfLHX4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709287458; c=relaxed/simple; bh=2gdb8QFpvX/+BfbeE/tU8fiuiVqBgFxh855Pe4Pdm2g=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=bLtp9V9qmdXn4BjTvueNxChA44OFOFRD5RXLGXl70BU8gV9b4S/BXsmVsfcuNqkQrwH7yrSVR/cthSBTN+nk6RmMBDwo1tH/D4Q2Gp9TIgkl7nxz58r+BZ3/OAQ4IpUs00rMKGVNyrO8TZ5wPx8lSdLHBFZqq5nYnaTDYIzgehA= 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 1rfziG-0003of-LC; Fri, 01 Mar 2024 11:01:56 +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 1rfziE-003kq7-JZ; Fri, 01 Mar 2024 11:01:54 +0100 Received: from ore by dude04.red.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1rfziE-003tMo-1g; Fri, 01 Mar 2024 11:01:54 +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 v8 4/8] net: phy: Keep track of EEE configuration Date: Fri, 1 Mar 2024 11:01:49 +0100 Message-Id: <20240301100153.927743-5-o.rempel@pengutronix.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240301100153.927743-1-o.rempel@pengutronix.de> References: <20240301100153.927743-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 ab18b0d9beb47..f0ed07c74a36e 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 432c561f58098..c315928357c8c 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