All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH net-next] net: mvpp2: deny disabling autoneg for 802.3z modes
@ 2021-07-12 15:47 Russell King (Oracle)
  2021-07-12 21:27 ` Marek Behun
  2021-07-13  0:25 ` Marcin Wojtas
  0 siblings, 2 replies; 3+ messages in thread
From: Russell King (Oracle) @ 2021-07-12 15:47 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit
  Cc: David S. Miller, netdev, Marcin Wojtas, Jakub Kicinski

The documentation for Armada 8040 says:

  Bit 2 Field InBandAnEn In-band Auto-Negotiation enable. ...
  When <PortType> = 1 (1000BASE-X) this field must be set to 1.

We presently ignore whether userspace requests autonegotiation or not
through the ethtool ksettings interface. However, we have some network
interfaces that wish to do this. To offer a consistent API across
network interfaces, deny the ability to disable autonegotiation on
mvneta hardware when in 1000BASE-X and 2500BASE-X.

This means the only way to switch between 2500BASE-X and 1000BASE-X
on SFPs that support this will be:

 # ethtool -s ethX advertise 0x20000006000 # 1000BASE-X Pause AsymPause
 # ethtool -s ethX advertise 0xe000        # 2500BASE-X Pause AsymPause

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
net-next is currently closed, but I'd like to collect acks for this
patch. Thanks.

 drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
index 3229bafa2a2c..878fb17dea41 100644
--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
+++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
@@ -6269,6 +6269,15 @@ static void mvpp2_phylink_validate(struct phylink_config *config,
 		if (!mvpp2_port_supports_rgmii(port))
 			goto empty_set;
 		break;
+	case PHY_INTERFACE_MODE_1000BASEX:
+	case PHY_INTERFACE_MODE_2500BASEX:
+		/* When in 802.3z mode, we must have AN enabled:
+		 * Bit 2 Field InBandAnEn In-band Auto-Negotiation enable. ...
+		 * When <PortType> = 1 (1000BASE-X) this field must be set to 1.
+		 */
+		if (!phylink_test(state->advertising, Autoneg))
+			goto empty_set;
+		break;
 	default:
 		break;
 	}
-- 
2.20.1


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

* Re: [RFC PATCH net-next] net: mvpp2: deny disabling autoneg for 802.3z modes
  2021-07-12 15:47 [RFC PATCH net-next] net: mvpp2: deny disabling autoneg for 802.3z modes Russell King (Oracle)
@ 2021-07-12 21:27 ` Marek Behun
  2021-07-13  0:25 ` Marcin Wojtas
  1 sibling, 0 replies; 3+ messages in thread
From: Marek Behun @ 2021-07-12 21:27 UTC (permalink / raw)
  To: Russell King (Oracle)
  Cc: Andrew Lunn, Heiner Kallweit, David S. Miller, netdev,
	Marcin Wojtas, Jakub Kicinski

On Mon, 12 Jul 2021 16:47:21 +0100
"Russell King (Oracle)" <rmk+kernel@armlinux.org.uk> wrote:

> The documentation for Armada 8040 says:
> 
>   Bit 2 Field InBandAnEn In-band Auto-Negotiation enable. ...
>   When <PortType> = 1 (1000BASE-X) this field must be set to 1.
> 
> We presently ignore whether userspace requests autonegotiation or not
> through the ethtool ksettings interface. However, we have some network
> interfaces that wish to do this. To offer a consistent API across
> network interfaces, deny the ability to disable autonegotiation on
> mvneta hardware when in 1000BASE-X and 2500BASE-X.
> 
> This means the only way to switch between 2500BASE-X and 1000BASE-X
> on SFPs that support this will be:
> 
>  # ethtool -s ethX advertise 0x20000006000 # 1000BASE-X Pause AsymPause
>  # ethtool -s ethX advertise 0xe000        # 2500BASE-X Pause AsymPause
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
> net-next is currently closed, but I'd like to collect acks for this
> patch. Thanks.
> 
>  drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
> index 3229bafa2a2c..878fb17dea41 100644
> --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
> +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
> @@ -6269,6 +6269,15 @@ static void mvpp2_phylink_validate(struct phylink_config *config,
>  		if (!mvpp2_port_supports_rgmii(port))
>  			goto empty_set;
>  		break;
> +	case PHY_INTERFACE_MODE_1000BASEX:
> +	case PHY_INTERFACE_MODE_2500BASEX:
> +		/* When in 802.3z mode, we must have AN enabled:
> +		 * Bit 2 Field InBandAnEn In-band Auto-Negotiation enable. ...
> +		 * When <PortType> = 1 (1000BASE-X) this field must be set to 1.
> +		 */
> +		if (!phylink_test(state->advertising, Autoneg))
> +			goto empty_set;
> +		break;
>  	default:
>  		break;
>  	}

Acked-by: Marek Behún <kabel@kernel.org>

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

* Re: [RFC PATCH net-next] net: mvpp2: deny disabling autoneg for 802.3z modes
  2021-07-12 15:47 [RFC PATCH net-next] net: mvpp2: deny disabling autoneg for 802.3z modes Russell King (Oracle)
  2021-07-12 21:27 ` Marek Behun
@ 2021-07-13  0:25 ` Marcin Wojtas
  1 sibling, 0 replies; 3+ messages in thread
From: Marcin Wojtas @ 2021-07-13  0:25 UTC (permalink / raw)
  To: Russell King (Oracle)
  Cc: Andrew Lunn, Heiner Kallweit, David S. Miller, netdev, Jakub Kicinski

Hi,

pon., 12 lip 2021 o 17:47 Russell King (Oracle)
<rmk+kernel@armlinux.org.uk> napisał(a):
>
> The documentation for Armada 8040 says:
>
>   Bit 2 Field InBandAnEn In-band Auto-Negotiation enable. ...
>   When <PortType> = 1 (1000BASE-X) this field must be set to 1.
>
> We presently ignore whether userspace requests autonegotiation or not
> through the ethtool ksettings interface. However, we have some network
> interfaces that wish to do this. To offer a consistent API across
> network interfaces, deny the ability to disable autonegotiation on
> mvneta hardware when in 1000BASE-X and 2500BASE-X.
>

s/mvneta/mvpp2/

With that change you can add my:
Acked-by: Marcin Wojtas <mw@semihalf.com>

Thanks,
Marcin

> This means the only way to switch between 2500BASE-X and 1000BASE-X
> on SFPs that support this will be:
>
>  # ethtool -s ethX advertise 0x20000006000 # 1000BASE-X Pause AsymPause
>  # ethtool -s ethX advertise 0xe000        # 2500BASE-X Pause AsymPause
>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
> net-next is currently closed, but I'd like to collect acks for this
> patch. Thanks.
>
>  drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
>
> diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
> index 3229bafa2a2c..878fb17dea41 100644
> --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
> +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
> @@ -6269,6 +6269,15 @@ static void mvpp2_phylink_validate(struct phylink_config *config,
>                 if (!mvpp2_port_supports_rgmii(port))
>                         goto empty_set;
>                 break;
> +       case PHY_INTERFACE_MODE_1000BASEX:
> +       case PHY_INTERFACE_MODE_2500BASEX:
> +               /* When in 802.3z mode, we must have AN enabled:
> +                * Bit 2 Field InBandAnEn In-band Auto-Negotiation enable. ...
> +                * When <PortType> = 1 (1000BASE-X) this field must be set to 1.
> +                */
> +               if (!phylink_test(state->advertising, Autoneg))
> +                       goto empty_set;
> +               break;
>         default:
>                 break;
>         }
> --
> 2.20.1
>

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

end of thread, other threads:[~2021-07-13  0:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-12 15:47 [RFC PATCH net-next] net: mvpp2: deny disabling autoneg for 802.3z modes Russell King (Oracle)
2021-07-12 21:27 ` Marek Behun
2021-07-13  0:25 ` Marcin Wojtas

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.