diff mbox series

[v2,2/2] net: macb: Allow SGMII only if we are a GEM in mac_validate

Message ID 20211011165517.2857893-2-sean.anderson@seco.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series [v2,1/2] net: macb: Clean up macb_validate | expand

Checks

Context Check Description
netdev/cover_letter success Single patches do not need cover letters
netdev/fixes_present success Fixes tag not required for -next series
netdev/patch_count success Link
netdev/tree_selection success Guessed tree name to be net-next
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cc_maintainers fail 1 blamed authors not CCed: atenart@kernel.org; 1 maintainers not CCed: atenart@kernel.org
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 25 this patch: 25
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Fixes tag looks correct
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 31 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 25 this patch: 25
netdev/header_inline success No static functions without inline keyword in header files

Commit Message

Sean Anderson Oct. 11, 2021, 4:55 p.m. UTC
This aligns mac_validate with mac_config. In mac_config, SGMII is only
enabled if macb_is_gem. Validate should care if the mac is a gem as
well. This also simplifies the logic now that all gigabit modes depend
on the mac being a GEM.

Fixes: 7897b071ac3b ("net: macb: convert to phylink")
Signed-off-by: Sean Anderson <sean.anderson@seco.com>
---

Changes in v2:
- New

 drivers/net/ethernet/cadence/macb_main.c | 22 +++++++++-------------
 1 file changed, 9 insertions(+), 13 deletions(-)

Comments

Jakub Kicinski Oct. 12, 2021, 12:17 a.m. UTC | #1
On Mon, 11 Oct 2021 12:55:17 -0400 Sean Anderson wrote:
> This aligns mac_validate with mac_config. In mac_config, SGMII is only
> enabled if macb_is_gem. Validate should care if the mac is a gem as
> well. This also simplifies the logic now that all gigabit modes depend
> on the mac being a GEM.
> 
> Fixes: 7897b071ac3b ("net: macb: convert to phylink")
> Signed-off-by: Sean Anderson <sean.anderson@seco.com>

Please make sure you CC the author of the original patch, they tend to
be a good person to review the change. Or at the very least validate
the Fixes tag. Adding Antoine.

>  drivers/net/ethernet/cadence/macb_main.c | 22 +++++++++-------------
>  1 file changed, 9 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
> index a9105ec1b885..ae8c969a609c 100644
> --- a/drivers/net/ethernet/cadence/macb_main.c
> +++ b/drivers/net/ethernet/cadence/macb_main.c
> @@ -534,22 +534,18 @@ static void macb_validate(struct phylink_config *config,
>  	case PHY_INTERFACE_MODE_RGMII_ID:
>  	case PHY_INTERFACE_MODE_RGMII_RXID:
>  	case PHY_INTERFACE_MODE_RGMII_TXID:
> -		if (!macb_is_gem(bp)) {
> -			if (one)
> -				goto none;
> -			else
> -				goto mii;
> -		}
> -		fallthrough;
>  	case PHY_INTERFACE_MODE_SGMII:
> -		if (bp->caps & MACB_CAPS_GIGABIT_MODE_AVAILABLE) {
> -			phylink_set(mask, 1000baseT_Full);
> -			phylink_set(mask, 1000baseX_Full);
> -			if (!(bp->caps & MACB_CAPS_NO_GIGABIT_HALF))
> -				phylink_set(mask, 1000baseT_Half);
> +		if (macb_is_gem(bp)) {
> +			if (bp->caps & MACB_CAPS_GIGABIT_MODE_AVAILABLE) {
> +				phylink_set(mask, 1000baseT_Full);
> +				phylink_set(mask, 1000baseX_Full);
> +				if (!(bp->caps & MACB_CAPS_NO_GIGABIT_HALF))
> +					phylink_set(mask, 1000baseT_Half);
> +			}
> +		} else if (one) {
> +			goto none;
>  		}
>  		fallthrough;
> -	mii:
>  	case PHY_INTERFACE_MODE_MII:
>  	case PHY_INTERFACE_MODE_RMII:
>  		phylink_set(mask, 10baseT_Half);
Antoine Tenart Oct. 12, 2021, 8:27 a.m. UTC | #2
Hello Sean,

Quoting Jakub Kicinski (2021-10-12 02:17:59)
> On Mon, 11 Oct 2021 12:55:17 -0400 Sean Anderson wrote:
> > This aligns mac_validate with mac_config. In mac_config, SGMII is only
> > enabled if macb_is_gem. Validate should care if the mac is a gem as
> > well. This also simplifies the logic now that all gigabit modes depend
> > on the mac being a GEM.

This looks correct.

> > Fixes: 7897b071ac3b ("net: macb: convert to phylink")

If this is a fix, the patch has to be first in the series as it is
depending on the first one which is not a fix.

Thanks,
Antoine
Sean Anderson Oct. 12, 2021, 4:20 p.m. UTC | #3
On 10/12/21 4:27 AM, Antoine Tenart wrote:
> Hello Sean,
> 
> Quoting Jakub Kicinski (2021-10-12 02:17:59)
>> On Mon, 11 Oct 2021 12:55:17 -0400 Sean Anderson wrote:
>> > This aligns mac_validate with mac_config. In mac_config, SGMII is only
>> > enabled if macb_is_gem. Validate should care if the mac is a gem as
>> > well. This also simplifies the logic now that all gigabit modes depend
>> > on the mac being a GEM.
> 
> This looks correct.
> 
>> > Fixes: 7897b071ac3b ("net: macb: convert to phylink")
> 
> If this is a fix, the patch has to be first in the series as it is
> depending on the first one which is not a fix.

Ok, I can put this first then.

--Sean
diff mbox series

Patch

diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
index a9105ec1b885..ae8c969a609c 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -534,22 +534,18 @@  static void macb_validate(struct phylink_config *config,
 	case PHY_INTERFACE_MODE_RGMII_ID:
 	case PHY_INTERFACE_MODE_RGMII_RXID:
 	case PHY_INTERFACE_MODE_RGMII_TXID:
-		if (!macb_is_gem(bp)) {
-			if (one)
-				goto none;
-			else
-				goto mii;
-		}
-		fallthrough;
 	case PHY_INTERFACE_MODE_SGMII:
-		if (bp->caps & MACB_CAPS_GIGABIT_MODE_AVAILABLE) {
-			phylink_set(mask, 1000baseT_Full);
-			phylink_set(mask, 1000baseX_Full);
-			if (!(bp->caps & MACB_CAPS_NO_GIGABIT_HALF))
-				phylink_set(mask, 1000baseT_Half);
+		if (macb_is_gem(bp)) {
+			if (bp->caps & MACB_CAPS_GIGABIT_MODE_AVAILABLE) {
+				phylink_set(mask, 1000baseT_Full);
+				phylink_set(mask, 1000baseX_Full);
+				if (!(bp->caps & MACB_CAPS_NO_GIGABIT_HALF))
+					phylink_set(mask, 1000baseT_Half);
+			}
+		} else if (one) {
+			goto none;
 		}
 		fallthrough;
-	mii:
 	case PHY_INTERFACE_MODE_MII:
 	case PHY_INTERFACE_MODE_RMII:
 		phylink_set(mask, 10baseT_Half);