All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] ixgene-v2: prepare for phylib stop exporting phy_10_100_features_array
@ 2025-02-11 20:48 Heiner Kallweit
  2025-02-11 21:24 ` Andrew Lunn
  0 siblings, 1 reply; 3+ messages in thread
From: Heiner Kallweit @ 2025-02-11 20:48 UTC (permalink / raw)
  To: Paolo Abeni, Jakub Kicinski, Eric Dumazet, David Miller,
	Andrew Lunn, Simon Horman, Iyappan Subramanian, Keyur Chudgar
  Cc: netdev@vger.kernel.org

As part of phylib cleanup we plan to stop exporting the feature arrays.
So explicitly remove the modes not supported by the MAC. The media type
bits don't have any impact on kernel behavior, so don't touch them.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/net/ethernet/apm/xgene-v2/mdio.c   | 24 +++++++++++-----------
 3 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/drivers/net/ethernet/apm/xgene-v2/mdio.c b/drivers/net/ethernet/apm/xgene-v2/mdio.c
index eba06831a..b41f15501 100644
--- a/drivers/net/ethernet/apm/xgene-v2/mdio.c
+++ b/drivers/net/ethernet/apm/xgene-v2/mdio.c
@@ -97,7 +97,6 @@ void xge_mdio_remove(struct net_device *ndev)
 
 int xge_mdio_config(struct net_device *ndev)
 {
-	__ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, };
 	struct xge_pdata *pdata = netdev_priv(ndev);
 	struct device *dev = &pdata->pdev->dev;
 	struct mii_bus *mdio_bus;
@@ -137,17 +136,18 @@ int xge_mdio_config(struct net_device *ndev)
 		goto err;
 	}
 
-	linkmode_set_bit_array(phy_10_100_features_array,
-			       ARRAY_SIZE(phy_10_100_features_array),
-			       mask);
-	linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseT_Half_BIT, mask);
-	linkmode_set_bit(ETHTOOL_LINK_MODE_AUI_BIT, mask);
-	linkmode_set_bit(ETHTOOL_LINK_MODE_MII_BIT, mask);
-	linkmode_set_bit(ETHTOOL_LINK_MODE_FIBRE_BIT, mask);
-	linkmode_set_bit(ETHTOOL_LINK_MODE_BNC_BIT, mask);
-
-	linkmode_andnot(phydev->supported, phydev->supported, mask);
-	linkmode_copy(phydev->advertising, phydev->supported);
+	linkmode_clear_bit(ETHTOOL_LINK_MODE_10baseT_Full_BIT,
+			   phydev->supported);
+	linkmode_clear_bit(ETHTOOL_LINK_MODE_10baseT_Half_BIT,
+			   phydev->supported);
+	linkmode_clear_bit(ETHTOOL_LINK_MODE_100baseT_Full_BIT,
+			   phydev->supported);
+	linkmode_clear_bit(ETHTOOL_LINK_MODE_100baseT_Half_BIT,
+			   phydev->supported);
+	linkmode_clear_bit(ETHTOOL_LINK_MODE_1000baseT_Half_BIT,
+			   phydev->supported);
+
+	phy_advertise_supported(phydev);
 	pdata->phy_speed = SPEED_UNKNOWN;
 
 	return 0;
-- 
2.48.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] ixgene-v2: prepare for phylib stop exporting phy_10_100_features_array
  2025-02-11 20:48 [PATCH net-next] ixgene-v2: prepare for phylib stop exporting phy_10_100_features_array Heiner Kallweit
@ 2025-02-11 21:24 ` Andrew Lunn
  2025-02-11 21:57   ` Heiner Kallweit
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Lunn @ 2025-02-11 21:24 UTC (permalink / raw)
  To: Heiner Kallweit
  Cc: Paolo Abeni, Jakub Kicinski, Eric Dumazet, David Miller,
	Andrew Lunn, Simon Horman, Iyappan Subramanian, Keyur Chudgar,
	netdev@vger.kernel.org

> +	linkmode_clear_bit(ETHTOOL_LINK_MODE_10baseT_Full_BIT,
> +			   phydev->supported);
> +	linkmode_clear_bit(ETHTOOL_LINK_MODE_10baseT_Half_BIT,
> +			   phydev->supported);
> +	linkmode_clear_bit(ETHTOOL_LINK_MODE_100baseT_Full_BIT,
> +			   phydev->supported);
> +	linkmode_clear_bit(ETHTOOL_LINK_MODE_100baseT_Half_BIT,
> +			   phydev->supported);
> +	linkmode_clear_bit(ETHTOOL_LINK_MODE_1000baseT_Half_BIT,
> +			   phydev->supported);
> +
> +	phy_advertise_supported(phydev);

phy_remove_link_mode() would be better. The MAC driver then does not
need to know about the insides of the phydev structure, and it
implicitly handles this last part.

    Andrew

---
pw-bot: cr

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] ixgene-v2: prepare for phylib stop exporting phy_10_100_features_array
  2025-02-11 21:24 ` Andrew Lunn
@ 2025-02-11 21:57   ` Heiner Kallweit
  0 siblings, 0 replies; 3+ messages in thread
From: Heiner Kallweit @ 2025-02-11 21:57 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: Paolo Abeni, Jakub Kicinski, Eric Dumazet, David Miller,
	Andrew Lunn, Simon Horman, Iyappan Subramanian, Keyur Chudgar,
	netdev@vger.kernel.org

On 11.02.2025 22:24, Andrew Lunn wrote:
>> +	linkmode_clear_bit(ETHTOOL_LINK_MODE_10baseT_Full_BIT,
>> +			   phydev->supported);
>> +	linkmode_clear_bit(ETHTOOL_LINK_MODE_10baseT_Half_BIT,
>> +			   phydev->supported);
>> +	linkmode_clear_bit(ETHTOOL_LINK_MODE_100baseT_Full_BIT,
>> +			   phydev->supported);
>> +	linkmode_clear_bit(ETHTOOL_LINK_MODE_100baseT_Half_BIT,
>> +			   phydev->supported);
>> +	linkmode_clear_bit(ETHTOOL_LINK_MODE_1000baseT_Half_BIT,
>> +			   phydev->supported);
>> +
>> +	phy_advertise_supported(phydev);
> 
> phy_remove_link_mode() would be better. The MAC driver then does not
> need to know about the insides of the phydev structure, and it
> implicitly handles this last part.
> 

Only small drawback is that it unnecessarily calls phy_advertise_supported()
after each statement. Therefore I decided against it.
But you're right, it's cleaner.

>     Andrew
> 

Heiner

> ---
> pw-bot: cr


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-02-11 21:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-11 20:48 [PATCH net-next] ixgene-v2: prepare for phylib stop exporting phy_10_100_features_array Heiner Kallweit
2025-02-11 21:24 ` Andrew Lunn
2025-02-11 21:57   ` Heiner Kallweit

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.