From patchwork Thu Feb 29 14:07:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksij Rempel X-Patchwork-Id: 208375 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2097:b0:108:e6aa:91d0 with SMTP id gs23csp420610dyb; Thu, 29 Feb 2024 06:10:49 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCURjpIoJBvst2tR8x16mHc9jXofxhtBmgNb1ulEj10oKekUAInYB7Xvkc1nglDB8bAUr3b5wrOKSmCsablFHHvEUqbU7w== X-Google-Smtp-Source: AGHT+IHmKPOQP+K0RNYMSRFu5ldpOxd2uhHKe25MudpVNaPJPd8VWNH/mvROQ46Da/vp7B8eetkt X-Received: by 2002:a05:6402:2156:b0:566:5cb2:c76c with SMTP id bq22-20020a056402215600b005665cb2c76cmr1561142edb.3.1709215849488; Thu, 29 Feb 2024 06:10:49 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709215849; cv=pass; d=google.com; s=arc-20160816; b=wrSm8j9zL8wLIfvAtCSemrx5yAIXSW9TZqparvX2UYEfJfOAgw6z2VjG5N80A7RM7E VxrVMwaWHfmW3LeUCVfPruRpApxNJnX30waZGzNnIiHwRfvd061c+eRe+R9o5wHX8juC CLqD6aGKoHjhLp5lvQ7OofGbxqoRCIRFsqOXDx9h8lUGe0qfCmUgvX4IzS+0DSbWLFOo 0/nIu5d61dZ0hWmS29zEwLUq0Y3uEMFUeIocKAWiionMGXcNXFzfn+iGXKbVou/XxyRI sWmTfsDNRBXuxdvKwLo1iSE/zPz15iniurf4yNnz5Qr0D/ruuVSs/IJiHspIxaPRTerD IOkw== 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=WGM6iOqdG1Q/JrK21WPT4lk4b6QC6FTgLF/IhpynNMf3c4QfnHDpVhC6QxdNsY74uY dvCyQt82mjbibgEjvYC5JsUIuceWno4UV399cj3qsh9PRjb7Su/gx1eip1/CiLmkF35D M60hK9eAYvyw5a0pQd4mVc2iwfpKCV3QyJGkaKXqW5vgyFLyX+jcb3Bu3gETtVxyb08L 0YPZFlAkwwhF/6CGnfShuoZyjlzY/l2ZoT7lukIBCm9nEh6wJ4Ph2ggBIecQ+jwRSZIk PExAoQxbVlz62a+9cB1gCBJzsBewfjwcPp3+J8yzpJew3mZ1/Ulu3CCSOAdrX69WXGqK FkTQ==; 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-86802-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-86802-ouuuleilei=gmail.com@vger.kernel.org" Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id f21-20020a0564021e9500b005642ea075aesi651251edf.314.2024.02.29.06.10.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 06:10:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-86802-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; arc=pass (i=1 spf=pass spfdomain=pengutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-86802-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-86802-ouuuleilei=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 am.mirrors.kernel.org (Postfix) with ESMTPS id 0616B1F24018 for ; Thu, 29 Feb 2024 14:10:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 40F0912F580; Thu, 29 Feb 2024 14:08:28 +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 C972C12F58C for ; Thu, 29 Feb 2024 14:08:20 +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=1709215705; cv=none; b=GDiYk/cRQYnui38AwFaqWdIiQ6wC9/DLaJ+RnwiUg7BSIwgI0OcpAgLNc7RHYw4eWExMaKIYFFpttPMZeyGDoku7TixxbGqf2SDFD9X/xPZ/Qp+odScUp3+PBkiL1O5JncwHk1Br3PKWysDjwzk0BESFcH5t8N5YWTCFfCod6WU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709215705; c=relaxed/simple; bh=2gdb8QFpvX/+BfbeE/tU8fiuiVqBgFxh855Pe4Pdm2g=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=R5qtgW71WIZUS9woufl2m/v05eEOIlar98AbMXxlpM/OhpMiSJ0XFJj/N2EYQ/BTC3Ybnv7d4U4779pPgqsPI3wf6QEHK3BwX+Tzag1alMGKs5HIcDoXM49pYZTjW18S28bUzFbgQ5eY/cJbth/qZ4h5YjriKpWtdIFjUIOrLi0= 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 1rfh4t-0000Sv-MW; Thu, 29 Feb 2024 15:08:03 +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 1rfh4r-003bZx-Sy; Thu, 29 Feb 2024 15:08:01 +0100 Received: from ore by dude04.red.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1rfh4r-00ELmU-2C; Thu, 29 Feb 2024 15:08:01 +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 v7 4/8] net: phy: Keep track of EEE configuration Date: Thu, 29 Feb 2024 15:07:56 +0100 Message-Id: <20240229140800.3420180-5-o.rempel@pengutronix.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240229140800.3420180-1-o.rempel@pengutronix.de> References: <20240229140800.3420180-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 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792242718956225936 X-GMAIL-MSGID: 1792242718956225936 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;