Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp2181082rdb; Tue, 20 Feb 2024 22:23:46 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXOeHmQT7GxJQR4lt1FrTYEBw3M8uR+/3ZoA4QRuhJBCrgCiTuI7sO27j3t51mQUyPdO/GOPV9Q6rGuGD64gM33G9Vz5Q9xL1A3n29ztA== X-Google-Smtp-Source: AGHT+IFXOgeM+o0A1E8+RNWtehfmZWaoEVEQAw/DRWgxuWqyEFi51lUfVtE/hK1J99aQjhcWGq3U X-Received: by 2002:a17:902:d2c5:b0:1db:f965:471e with SMTP id n5-20020a170902d2c500b001dbf965471emr8221189plc.58.1708496626423; Tue, 20 Feb 2024 22:23:46 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708496626; cv=pass; d=google.com; s=arc-20160816; b=ATYSWq44vouFrvZjab+GvEf9nNYeznIywHbC6wFceNYcgvowCx/UGPU7gX0zTE715H zE2usR00jWwOEBzHKBwGOrindWzkMX6AzAkzRlopF57e+MjGI6NreJiotM1mjRM7uMte GlvzbRPNhHoKrXmS4eJKvs3h0VZSGcr9QNH8F5P53ASmhC2ueBsIdRRxAty7l+vdjONe RB9k3+SsgEjoUMwTGwf9QKwJxBI1EFUmHyxpjOih7Cu2pK4KyZj6wLEQy2YWQ0UhWfug FHomhE4HRpmN0+MrvbG9fBWZ3HhDSTPDnuiU7kBqjXWgn5UssZYWEgdSRaQloG+pLRzA hTeA== 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=lBoKZbQXrArN6nWaCN4D0KzlXl4c9vAdT33+mQH3Eh0=; fh=Z3AakHyZxCIxzcEMoIHNDSzvhjhv+HMsD8Ki54Zfyg0=; b=wS2srOXLxz3DlP/JjR0xhxjlqZHr0Bu1RrjKiot13MuPoUgnTloPq58GCOA4X0I2b2 1Kn1o77GfyAx+QIzt/HUpcxABn1Hl2lo2ltSSW8A9twJJB17ss/zVgeGahAPzbP+EKA1 6X/u7Uf4W87NivgR1sXihWpaJZnqvTcsHxZOesuVx+S6K47rYXwbiyPAmSMAYUESJ/1s Ex/lBpS6YpJ/nw9HjOUw/7AXMrpNH0TrtktOe6kHOk22GYwIvkgabUGt6LYffPkedCWF hIW2WR2qgtjc7wXrcPfKiq6G8rgqGVkAl46q8WMN5hTr76KZi8qVrQ/WW5aXXiHTPBnM KsQw==; 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-74144-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-74144-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 b7-20020a170902650700b001dc0687868asi3659531plk.459.2024.02.20.22.23.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Feb 2024 22:23:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-74144-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-74144-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-74144-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 AB899283A58 for ; Wed, 21 Feb 2024 06:23:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9A10F3CF45; Wed, 21 Feb 2024 06:21:26 +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 D9D1B3B199 for ; Wed, 21 Feb 2024 06:21:23 +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=1708496486; cv=none; b=SlufQpX0HT7TmKaUK2Akd8K25KacFHeCm8w1Ahaw9lZGPLftYZeHLIAvlIpQT5Ic/zamJ7KIQbRTyYJof/xwpqKiM8ycaMCMyx27OP043TuPzu9yCOYx/6JULb1eF29guSRAhb/F7LcM/CgUOm8uSc4i3/wgCc5n7aNeIf5EpHA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708496486; c=relaxed/simple; bh=h5B2mQ5YiQNtOmIc/nz9c0lAqgBaCz+3M88Jsys5uF8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=CUF1uIgO7FvX9svgRgGGkRlGNI1VbQpSxIqtP2BDGwTIprn73kklEp9IYIVF2Su013IYBQLNT/Vb9cU7CA22vi1KaYpLExcEV1YU+wMvNEhpMfrdA0bjvbSTtnYZKzG4kIwc4FYNFex6OxvlT/mdeNhAbgyCAK6T3W1mjsNU/5Q= 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 1rcfyh-00010S-4Y; Wed, 21 Feb 2024 07:21:11 +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 1rcfye-001zFD-Ne; Wed, 21 Feb 2024 07:21:08 +0100 Received: from ore by dude04.red.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1rcfye-003GaG-25; Wed, 21 Feb 2024 07:21:08 +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 , 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 v5 4/8] net: phy: Keep track of EEE configuration Date: Wed, 21 Feb 2024 07:21:03 +0100 Message-Id: <20240221062107.778661-5-o.rempel@pengutronix.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240221062107.778661-1-o.rempel@pengutronix.de> References: <20240221062107.778661-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 Signed-off-by: Oleksij Rempel --- 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 207e68b0eec6..7f3629d56503 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..356916695a26 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