Skip to contentSkip to conversation

ixgene-v2: prepare for phylib stop exporting phy_10_100_features_array

PATCH Applied Heiner Kallweit 4 participants 4 messages Feb 12, 2025 – Feb 13, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ixgene-v2: prepare for phylib stop exporting phy_10_100_features_array

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.

---
v2:
- use phy_remove_link_mode()

---
 drivers/net/ethernet/apm/xgene-v2/mdio.c | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)
drivers/net/ethernet/apm/xgene-v2/mdio.c +6 -12
index eba06831a..6a17045a5 100644
@@ -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,12 @@ 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);
+	phy_remove_link_mode(phydev, ETHTOOL_LINK_MODE_10baseT_Half_BIT);
+	phy_remove_link_mode(phydev, ETHTOOL_LINK_MODE_10baseT_Full_BIT);
+	phy_remove_link_mode(phydev, ETHTOOL_LINK_MODE_100baseT_Half_BIT);
+	phy_remove_link_mode(phydev, ETHTOOL_LINK_MODE_100baseT_Full_BIT);
+	phy_remove_link_mode(phydev, ETHTOOL_LINK_MODE_1000baseT_Half_BIT);
+
 	pdata->phy_speed = SPEED_UNKNOWN;
 
 	return 0;
Signature · 1 line
2.48.1
Reviewed-by on v2 1/1
#2 lore raw
In reply to Heiner Kallweit
Quoted 38 lines · Heiner Kallweit

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.

---
v2:
- use phy_remove_link_mode()

---
  drivers/net/ethernet/apm/xgene-v2/mdio.c | 18 ++++++------------
  1 file changed, 6 insertions(+), 12 deletions(-)
drivers/net/ethernet/apm/xgene-v2/mdio.c +0 -11
index eba06831a..6a17045a5 100644
@@ -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,12 @@ 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);

drivers/net/ethernet/apm/xgene-v2/mdio.c int xge_mdio_config(struct net_device *ndev) · line 147

Quoted 10 lines
drivers/net/ethernet/apm/xgene-v2/mdio.c +6 -1
-	linkmode_copy(phydev->advertising, phydev->supported);
+	phy_remove_link_mode(phydev, ETHTOOL_LINK_MODE_10baseT_Half_BIT);
+	phy_remove_link_mode(phydev, ETHTOOL_LINK_MODE_10baseT_Full_BIT);
+	phy_remove_link_mode(phydev, ETHTOOL_LINK_MODE_100baseT_Half_BIT);
+	phy_remove_link_mode(phydev, ETHTOOL_LINK_MODE_100baseT_Full_BIT);
+	phy_remove_link_mode(phydev, ETHTOOL_LINK_MODE_1000baseT_Half_BIT);
+
  	pdata->phy_speed = SPEED_UNKNOWN;
 
  	return 0;
#3 lore raw
In reply to Heiner Kallweit
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 10 lines · On Wed, 12 Feb 2025 07:32:52 +0100 you wrote:

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.

---
v2:
- use phy_remove_link_mode()

[...]

Here is the summary with links:
- [v2,net-next] ixgene-v2: prepare for phylib stop exporting phy_10_100_features_array

    https://git.kernel.org/netdev/net-next/c/5077bc7af28f

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html