All of lore.kernel.org
 help / color / mirror / Atom feed
* best way to disable ANEG and force ethernet link?
@ 2022-01-21 17:20 Tim Harvey
  2022-01-21 21:17 ` Andrew Lunn
  2022-01-22  9:33 ` Heiner Kallweit
  0 siblings, 2 replies; 3+ messages in thread
From: Tim Harvey @ 2022-01-21 17:20 UTC (permalink / raw)
  To: netdev

Greetings,

I'm troubleshooting a network issue and am looking for the best way to
force link speed/duplex without using auto-negotiation.

What is the best way to do this in Linux? Currently from a userspace
perspective I have only been able to using 'ifconfig' to bring the
link up, then 'mii-tool -F 100baseTx-FD <dev>' to force it. The
ethtool methods do not work on my MAC/PHY (not clear what ethtool
support is needed for that on a driver level). For testing purposes I
would like to avoid the link coming up at 1000mbps in the first place
and force it to 100mbps.

Before hacking the heck out of the phy layer in the kernel I was
hoping for some advice for the best place to do this.

In case it matters I have two boards that I would like to do this on:
an IMX8MM with FEC MAC and a CN803X with an RGMII (thunderx) vnic MAC.
Both have a GPY111 (Intel Xway) PHY.

Best regards,

Tim

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

* Re: best way to disable ANEG and force ethernet link?
  2022-01-21 17:20 best way to disable ANEG and force ethernet link? Tim Harvey
@ 2022-01-21 21:17 ` Andrew Lunn
  2022-01-22  9:33 ` Heiner Kallweit
  1 sibling, 0 replies; 3+ messages in thread
From: Andrew Lunn @ 2022-01-21 21:17 UTC (permalink / raw)
  To: Tim Harvey; +Cc: netdev

On Fri, Jan 21, 2022 at 09:20:45AM -0800, Tim Harvey wrote:
> Greetings,
> 
> I'm troubleshooting a network issue and am looking for the best way to
> force link speed/duplex without using auto-negotiation.

Hi Tim

man ethtool

       ethtool -s devname [speed N] [lanes N] [duplex half|full]
              [port tp|aui|bnc|mii] [mdix auto|on|off] [autoneg on|off]
              [advertise N[/M] | advertise mode on|off ...]  [phyad N]
              [xcvr internal|external] [wol N[/M] | wol p|u|m|b|a|g|s|f|d...]
              [sopass xx:yy:zz:aa:bb:cc] [master-slave preferred-
              master|preferred-slave|forced-master|forced-slave] [msglvl
              N[/M] | msglvl type on|off ...]

so try

ethtool -s eth42 autoneg off duplex full speed 10

> In case it matters I have two boards that I would like to do this on:
> an IMX8MM with FEC MAC and a CN803X with an RGMII (thunderx) vnic MAC.
> Both have a GPY111 (Intel Xway) PHY.

It does require MAC and PHY support. So you will have to try it and
see. fec_main just calls phy_ethtool_set_link_ksettings. So there is a
good chance this works for the FEC.
drivers/net/ethernet/cavium/thunder/nicvf_ethtool.c does not implement
.set_link_ksettings, so you might be out of luck there.

gpy_config_aneg() looks like it does something sensible.

But the devil is in the detail...

   Andrew


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

* Re: best way to disable ANEG and force ethernet link?
  2022-01-21 17:20 best way to disable ANEG and force ethernet link? Tim Harvey
  2022-01-21 21:17 ` Andrew Lunn
@ 2022-01-22  9:33 ` Heiner Kallweit
  1 sibling, 0 replies; 3+ messages in thread
From: Heiner Kallweit @ 2022-01-22  9:33 UTC (permalink / raw)
  To: Tim Harvey, netdev

On 21.01.2022 18:20, Tim Harvey wrote:
> Greetings,
> 
> I'm troubleshooting a network issue and am looking for the best way to
> force link speed/duplex without using auto-negotiation.
> 
> What is the best way to do this in Linux? Currently from a userspace
> perspective I have only been able to using 'ifconfig' to bring the
> link up, then 'mii-tool -F 100baseTx-FD <dev>' to force it. The
> ethtool methods do not work on my MAC/PHY (not clear what ethtool
> support is needed for that on a driver level). For testing purposes I
> would like to avoid the link coming up at 1000mbps in the first place
> and force it to 100mbps.
> 
> Before hacking the heck out of the phy layer in the kernel I was
> hoping for some advice for the best place to do this.
> 
> In case it matters I have two boards that I would like to do this on:
> an IMX8MM with FEC MAC and a CN803X with an RGMII (thunderx) vnic MAC.
> Both have a GPY111 (Intel Xway) PHY.
> 
> Best regards,
> 
> Tim

ifconfig is a legacy tool, better use ip. ethtool should work for you.
If not, please provide the details: Which command are you using, any error?
The Intel Xway PHY driver is loaded?
For just disabling Gbit mode you don't have to switch to forced mode.
You can just disable advertising Gbit mode:
ethtool -s <if> advertise 1000baseT/Full off

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

end of thread, other threads:[~2022-01-22  9:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-21 17:20 best way to disable ANEG and force ethernet link? Tim Harvey
2022-01-21 21:17 ` Andrew Lunn
2022-01-22  9:33 ` 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.