diff mbox series

[net] net: ethernet: xgbe: re-add aneg to supported features in PHY quirks

Message ID 46521973-7738-4157-9f5e-0bb6f694acba@gmail.com (mailing list archive)
State New
Delegated to: Netdev Maintainers
Headers show
Series [net] net: ethernet: xgbe: re-add aneg to supported features in PHY quirks | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag present in non-next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 1 this patch: 1
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers warning 1 maintainers not CCed: shyam-sundar.s-k@amd.com
netdev/build_clang success Errors and warnings before: 2 this patch: 2
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 1 this patch: 1
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 43 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2025-01-13--00-00 (tests: 883)

Commit Message

Heiner Kallweit Jan. 12, 2025, 9:59 p.m. UTC
In 4.19, before the switch to linkmode bitmaps, PHY_GBIT_FEATURES
included feature bits for aneg and TP/MII ports.

				 SUPPORTED_TP | \
				 SUPPORTED_MII)

				 SUPPORTED_10baseT_Full)

				 SUPPORTED_100baseT_Full)

				 SUPPORTED_1000baseT_Full)

				 PHY_100BT_FEATURES | \
				 PHY_DEFAULT_FEATURES)

				 PHY_1000BT_FEATURES)

Referenced commit expanded PHY_GBIT_FEATURES, silently removing
PHY_DEFAULT_FEATURES. The removed part can be re-added by using
the new PHY_GBIT_FEATURES definition.
Not clear to me is why nobody seems to have noticed this issue.

I stumbled across this when checking what it takes to make
phy_10_100_features_array et al private to phylib.

Fixes: d0939c26c53a ("net: ethernet: xgbe: expand PHY_GBIT_FEAUTRES")
Cc: stable@vger.kernel.org
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c | 19 ++-----------------
 1 file changed, 2 insertions(+), 17 deletions(-)

Comments

Heiner Kallweit Jan. 12, 2025, 10:02 p.m. UTC | #1
On 12.01.2025 22:59, Heiner Kallweit wrote:
> In 4.19, before the switch to linkmode bitmaps, PHY_GBIT_FEATURES
> included feature bits for aneg and TP/MII ports.
> 
> 				 SUPPORTED_TP | \
> 				 SUPPORTED_MII)
> 
> 				 SUPPORTED_10baseT_Full)
> 
> 				 SUPPORTED_100baseT_Full)
> 
> 				 SUPPORTED_1000baseT_Full)
> 
> 				 PHY_100BT_FEATURES | \
> 				 PHY_DEFAULT_FEATURES)
> 
> 				 PHY_1000BT_FEATURES)
> 
> Referenced commit expanded PHY_GBIT_FEATURES, silently removing
> PHY_DEFAULT_FEATURES. The removed part can be re-added by using
> the new PHY_GBIT_FEATURES definition.
> Not clear to me is why nobody seems to have noticed this issue.
> 
> I stumbled across this when checking what it takes to make
> phy_10_100_features_array et al private to phylib.
> 
> Fixes: d0939c26c53a ("net: ethernet: xgbe: expand PHY_GBIT_FEAUTRES")
> Cc: stable@vger.kernel.org
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> ---
>  drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c | 19 ++-----------------
>  1 file changed, 2 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c b/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
> index 6a716337f..268399dfc 100644
> --- a/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
> +++ b/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
> @@ -923,7 +923,6 @@ static void xgbe_phy_free_phy_device(struct xgbe_prv_data *pdata)
>  
>  static bool xgbe_phy_finisar_phy_quirks(struct xgbe_prv_data *pdata)
>  {
> -	__ETHTOOL_DECLARE_LINK_MODE_MASK(supported) = { 0, };
>  	struct xgbe_phy_data *phy_data = pdata->phy_data;
>  	unsigned int phy_id = phy_data->phydev->phy_id;
>  
> @@ -945,14 +944,7 @@ static bool xgbe_phy_finisar_phy_quirks(struct xgbe_prv_data *pdata)
>  	phy_write(phy_data->phydev, 0x04, 0x0d01);
>  	phy_write(phy_data->phydev, 0x00, 0x9140);
>  
> -	linkmode_set_bit_array(phy_10_100_features_array,
> -			       ARRAY_SIZE(phy_10_100_features_array),
> -			       supported);
> -	linkmode_set_bit_array(phy_gbit_features_array,
> -			       ARRAY_SIZE(phy_gbit_features_array),
> -			       supported);
> -
> -	linkmode_copy(phy_data->phydev->supported, supported);
> +	linkmode_copy(phy_data->phydev->supported, PHY_GBIT_FEATURES);
>  
>  	phy_support_asym_pause(phy_data->phydev);
>  
> @@ -964,7 +956,6 @@ static bool xgbe_phy_finisar_phy_quirks(struct xgbe_prv_data *pdata)
>  
>  static bool xgbe_phy_belfuse_phy_quirks(struct xgbe_prv_data *pdata)
>  {
> -	__ETHTOOL_DECLARE_LINK_MODE_MASK(supported) = { 0, };
>  	struct xgbe_phy_data *phy_data = pdata->phy_data;
>  	struct xgbe_sfp_eeprom *sfp_eeprom = &phy_data->sfp_eeprom;
>  	unsigned int phy_id = phy_data->phydev->phy_id;
> @@ -1028,13 +1019,7 @@ static bool xgbe_phy_belfuse_phy_quirks(struct xgbe_prv_data *pdata)
>  	reg = phy_read(phy_data->phydev, 0x00);
>  	phy_write(phy_data->phydev, 0x00, reg & ~0x00800);
>  
> -	linkmode_set_bit_array(phy_10_100_features_array,
> -			       ARRAY_SIZE(phy_10_100_features_array),
> -			       supported);
> -	linkmode_set_bit_array(phy_gbit_features_array,
> -			       ARRAY_SIZE(phy_gbit_features_array),
> -			       supported);
> -	linkmode_copy(phy_data->phydev->supported, supported);
> +	linkmode_copy(phy_data->phydev->supported, PHY_GBIT_FEATURES);
>  	phy_support_asym_pause(phy_data->phydev);
>  
>  	netif_dbg(pdata, drv, pdata->netdev,

+ Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
diff mbox series

Patch

diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c b/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
index 6a716337f..268399dfc 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
@@ -923,7 +923,6 @@  static void xgbe_phy_free_phy_device(struct xgbe_prv_data *pdata)
 
 static bool xgbe_phy_finisar_phy_quirks(struct xgbe_prv_data *pdata)
 {
-	__ETHTOOL_DECLARE_LINK_MODE_MASK(supported) = { 0, };
 	struct xgbe_phy_data *phy_data = pdata->phy_data;
 	unsigned int phy_id = phy_data->phydev->phy_id;
 
@@ -945,14 +944,7 @@  static bool xgbe_phy_finisar_phy_quirks(struct xgbe_prv_data *pdata)
 	phy_write(phy_data->phydev, 0x04, 0x0d01);
 	phy_write(phy_data->phydev, 0x00, 0x9140);
 
-	linkmode_set_bit_array(phy_10_100_features_array,
-			       ARRAY_SIZE(phy_10_100_features_array),
-			       supported);
-	linkmode_set_bit_array(phy_gbit_features_array,
-			       ARRAY_SIZE(phy_gbit_features_array),
-			       supported);
-
-	linkmode_copy(phy_data->phydev->supported, supported);
+	linkmode_copy(phy_data->phydev->supported, PHY_GBIT_FEATURES);
 
 	phy_support_asym_pause(phy_data->phydev);
 
@@ -964,7 +956,6 @@  static bool xgbe_phy_finisar_phy_quirks(struct xgbe_prv_data *pdata)
 
 static bool xgbe_phy_belfuse_phy_quirks(struct xgbe_prv_data *pdata)
 {
-	__ETHTOOL_DECLARE_LINK_MODE_MASK(supported) = { 0, };
 	struct xgbe_phy_data *phy_data = pdata->phy_data;
 	struct xgbe_sfp_eeprom *sfp_eeprom = &phy_data->sfp_eeprom;
 	unsigned int phy_id = phy_data->phydev->phy_id;
@@ -1028,13 +1019,7 @@  static bool xgbe_phy_belfuse_phy_quirks(struct xgbe_prv_data *pdata)
 	reg = phy_read(phy_data->phydev, 0x00);
 	phy_write(phy_data->phydev, 0x00, reg & ~0x00800);
 
-	linkmode_set_bit_array(phy_10_100_features_array,
-			       ARRAY_SIZE(phy_10_100_features_array),
-			       supported);
-	linkmode_set_bit_array(phy_gbit_features_array,
-			       ARRAY_SIZE(phy_gbit_features_array),
-			       supported);
-	linkmode_copy(phy_data->phydev->supported, supported);
+	linkmode_copy(phy_data->phydev->supported, PHY_GBIT_FEATURES);
 	phy_support_asym_pause(phy_data->phydev);
 
 	netif_dbg(pdata, drv, pdata->netdev,