netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Heiner Kallweit <hkallweit1@gmail.com>
To: Paolo Abeni <pabeni@redhat.com>, Jakub Kicinski <kuba@kernel.org>,
	David Miller <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Simon Horman <horms@kernel.org>, Andrew Lunn <andrew@lunn.ch>,
	Russell King - ARM Linux <linux@armlinux.org.uk>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: [PATCH net-next v2 07/10] net: phy: remove disabled EEE modes from advertising in phy_probe
Date: Sat, 11 Jan 2025 21:30:41 +0100	[thread overview]
Message-ID: <80c86da0-80c8-4d1b-91d7-3d31e3c38bb2@gmail.com> (raw)
In-Reply-To: <90b3fbda-1cb7-4072-912c-b03bf542dcdb@gmail.com>

A PHY driver may populate eee_disabled_modes in its probe or get_features
callback, therefore filter the EEE advertisement read from the PHY.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/net/phy/phy_device.c | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index f6a5f986f..ff4b4d42b 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -3613,22 +3613,21 @@ static int phy_probe(struct device *dev)
 	if (err)
 		goto out;
 
-	/* There is no "enabled" flag. If PHY is advertising, assume it is
-	 * kind of enabled.
-	 */
-	phydev->eee_cfg.eee_enabled = !linkmode_empty(phydev->advertising_eee);
+	/* Get the EEE modes we want to prohibit. */
+	of_set_phy_eee_broken(phydev);
 
 	/* Some PHYs may advertise, by default, not support EEE modes. So,
-	 * we need to clean them.
+	 * we need to clean them. In addition remove all disabled EEE modes.
 	 */
-	if (phydev->eee_cfg.eee_enabled)
-		linkmode_and(phydev->advertising_eee, phydev->supported_eee,
-			     phydev->advertising_eee);
+	linkmode_and(phydev->advertising_eee, phydev->supported_eee,
+		     phydev->advertising_eee);
+	linkmode_andnot(phydev->advertising_eee, phydev->advertising_eee,
+			phydev->eee_disabled_modes);
 
-	/* Get the EEE modes we want to prohibit. We will ask
-	 * the PHY stop advertising these mode later on
+	/* There is no "enabled" flag. If PHY is advertising, assume it is
+	 * kind of enabled.
 	 */
-	of_set_phy_eee_broken(phydev);
+	phydev->eee_cfg.eee_enabled = !linkmode_empty(phydev->advertising_eee);
 
 	/* Get master/slave strap overrides */
 	of_set_phy_timing_role(phydev);
-- 
2.47.1



  parent reply	other threads:[~2025-01-11 20:30 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-11 20:24 [PATCH net-next v2 00/10] net: phy: improve phylib EEE handling Heiner Kallweit
2025-01-11 20:25 ` [PATCH net-next v2 01/10] net: phy: rename eee_broken_modes to eee_disabled_modes Heiner Kallweit
2025-01-11 20:26 ` [PATCH net-next v2 02/10] net: phy: rename phy_set_eee_broken to phy_disable_eee_mode Heiner Kallweit
2025-01-11 20:27 ` [PATCH net-next v2 03/10] ethtool: allow ethtool op set_eee to set an NL extack message Heiner Kallweit
2025-01-11 20:28 ` [PATCH net-next v2 04/10] net: phy: c45: improve handling of disabled EEE modes in ethtool functions Heiner Kallweit
2025-01-12  1:37   ` Jakub Kicinski
2025-01-11 20:29 ` [PATCH net-next v2 05/10] net: phy: move definition of phy_is_started before phy_disable_eee_mode Heiner Kallweit
2025-01-11 20:30 ` [PATCH net-next v2 06/10] net: phy: improve phy_disable_eee_mode Heiner Kallweit
2025-01-11 20:30 ` Heiner Kallweit [this message]
2025-01-11 20:31 ` [PATCH net-next v2 08/10] net: phy: c45: Don't silently remove disabled EEE modes any longer when writing advertisement register Heiner Kallweit
2025-01-11 20:32 ` [PATCH net-next v2 09/10] net: phy: c45: use cached EEE advertisement in genphy_c45_ethtool_get_eee Heiner Kallweit
2025-01-11 20:33 ` [PATCH net-next v2 10/10] net: phy: c45: remove local advertisement parameter from genphy_c45_eee_is_active Heiner Kallweit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=80c86da0-80c8-4d1b-91d7-3d31e3c38bb2@gmail.com \
    --to=hkallweit1@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).