From patchwork Sun Jun 18 18:41:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Lunn X-Patchwork-Id: 13283856 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 4FF549472 for ; Sun, 18 Jun 2023 18:41:46 +0000 (UTC) Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C6CB1A4 for ; Sun, 18 Jun 2023 11:41:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To: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=/w4C1vaCdWJXM71jbRSKyhX2b2j8XNF7KjXtH1oUPy0=; b=H43aj2/V/wZdm+ydKx2fR8bYZN BLH1lk6eGJ7rpjpKzPHlQpVIm7TaI3q2ajX0nT2eFv1uHXZEJrGXmZ3/88tJWJKKEs0uNwuPJOkQ3 b++PfjvOoa8sYTSsZBR7g0/R3DJBZA0ShsAZCrRFxjETBDJH9UzLzV4dN7qUPYesJIs8=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1qAxLC-00Gr3E-Jr; Sun, 18 Jun 2023 20:41:34 +0200 From: Andrew Lunn To: netdev Cc: Russell King , Heiner Kallweit , Florian Fainelli , Oleksij Rempel , Andrew Lunn Subject: [PATCH v4 net-next 5/9] net: phy: Keep track of EEE configuration Date: Sun, 18 Jun 2023 20:41:15 +0200 Message-Id: <20230618184119.4017149-6-andrew@lunn.ch> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230618184119.4017149-1-andrew@lunn.ch> References: <20230618184119.4017149-1-andrew@lunn.ch> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org 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. Signed-off-by: Andrew Lunn Reviewed-by: Russell King (Oracle) Reviewed-by: Florian Fainelli --- drivers/net/phy/phy.c | 5 ++++- include/linux/phy.h | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 629499e5aff0..48150d5626d8 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -1588,7 +1588,7 @@ EXPORT_SYMBOL(phy_get_eee_err); * @data: ethtool_eee data * * Description: it reportes the Supported/Advertisement/LP Advertisement - * capabilities. + * capabilities, etc. */ int phy_ethtool_get_eee(struct phy_device *phydev, struct ethtool_eee *data) { @@ -1599,6 +1599,7 @@ int phy_ethtool_get_eee(struct phy_device *phydev, struct ethtool_eee *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; @@ -1621,6 +1622,8 @@ int phy_ethtool_set_eee(struct phy_device *phydev, struct ethtool_eee *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 66f69d512f45..473ddf62bee9 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 | \ @@ -585,6 +586,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 @@ -702,6 +704,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;