netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* phy: fixed link 1000 or 100 set with autoneg off
@ 2023-10-23  7:01 Jia, Fang
  2023-10-23  7:42 ` Bagas Sanjaya
  2023-10-23  7:52 ` Heiner Kallweit
  0 siblings, 2 replies; 7+ messages in thread
From: Jia, Fang @ 2023-10-23  7:01 UTC (permalink / raw)
  To: Andrew Lunn, Florian Fainelli, Heiner Kallweit, David S. Miller
  Cc: netdev, linux-kernel

Hi Experts,

We use NXP LS1046 board and face an issue about the eth interface speed.

1) Scenario

we set fixed link 1000Mb/s in device tree.

However, after we set the auto-neg off, then the eth1's speed changed to 
10M and Duplex changed to Half.
The value of /sys/class/net/eth1/speed is 10 and 
/sys/class/net/eth1/duplex is half

2) Log is as following.

# ifconfig eth1 up
# ethtool eth1
Settings for eth1:
         Supported ports: [ MII ] 

         Supported link modes:   1000baseT/Full
         Supported pause frame use: Symmetric Receive-only
         Supports auto-negotiation: Yes 
 

         Supported FEC modes: Not reported 
 

         Advertised link modes:  1000baseT/Full
         Advertised pause frame use: Symmetric Receive-only 
 

         Advertised auto-negotiation: Yes
         Advertised FEC modes: Not reported
         Speed: 1000Mb/s
         Duplex: Full
         Port: MII
         PHYAD: 1
         Transceiver: internal
         Auto-negotiation: on
         Supports Wake-on: d
         Wake-on: d
         Current message level: 0xffffffff (-1)
                                drv probe link timer ifdown ifup rx_err 
tx_err tx_queued intr tx_done rx_status pktdata hw wol 0xffff8000
         Link detected: yes

# ethtool -s eth1 autoneg off
# ethtool eth1
Settings for eth1:
         Supported ports: [ MII ]
         Supported link modes:   1000baseT/Full
         Supported pause frame use: Symmetric Receive-only
         Supports auto-negotiation: Yes
         Supported FEC modes: Not reported
         Advertised link modes:  1000baseT/Full
         Advertised pause frame use: Symmetric Receive-only
         Advertised auto-negotiation: No
         Advertised FEC modes: Not reported
         Speed: 10Mb/s
         Duplex: Half
         Port: MII
         PHYAD: 1
         Transceiver: internal
         Auto-negotiation: off
         Supports Wake-on: d
         Wake-on: d
         Current message level: 0xffffffff (-1)
                                drv probe link timer ifdown ifup rx_err 
tx_err tx_queued intr tx_done rx_status pktdata hw wol 0xffff8000
         Link detected: yes

3) After code tracing, we found that:

phy_state_machine()
	state PHY_RUNNING: phy_check_link_status()
		phy_read_status()
			genphy_read_status()
				genphy_read_status_fixed()

In genphy_read_status_fixed(), the speed and duplex changed.
It seems like the bmcr value is always 0x1000 from swphy_read_reg().

After revert the commit 726097d6d6d(net: phy: improve auto-neg emulation 
in swphy), then the Speed and Duplex shown comes back to 1000M and Full.

Could you please take a look it ? Can we revert this commit, is there 
any side impact ?

Best Regards,
Fang

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

* Re: phy: fixed link 1000 or 100 set with autoneg off
  2023-10-23  7:01 phy: fixed link 1000 or 100 set with autoneg off Jia, Fang
@ 2023-10-23  7:42 ` Bagas Sanjaya
  2023-10-23  7:52 ` Heiner Kallweit
  1 sibling, 0 replies; 7+ messages in thread
From: Bagas Sanjaya @ 2023-10-23  7:42 UTC (permalink / raw)
  To: Jia, Fang, Andrew Lunn, Florian Fainelli, Heiner Kallweit,
	David S. Miller
  Cc: Linux Networking, Linux Kernel Mailing List, Linux Regression

[-- Attachment #1: Type: text/plain, Size: 3034 bytes --]

On Mon, Oct 23, 2023 at 03:01:10PM +0800, Jia, Fang wrote:
> Hi Experts,
> 
> We use NXP LS1046 board and face an issue about the eth interface speed.
> 
> 1) Scenario
> 
> we set fixed link 1000Mb/s in device tree.
> 
> However, after we set the auto-neg off, then the eth1's speed changed to 10M
> and Duplex changed to Half.
> The value of /sys/class/net/eth1/speed is 10 and /sys/class/net/eth1/duplex
> is half
> 
> 2) Log is as following.
> 
> # ifconfig eth1 up
> # ethtool eth1
> Settings for eth1:
>         Supported ports: [ MII ]
> 
>         Supported link modes:   1000baseT/Full
>         Supported pause frame use: Symmetric Receive-only
>         Supports auto-negotiation: Yes
> 
> 
>         Supported FEC modes: Not reported
> 
> 
>         Advertised link modes:  1000baseT/Full
>         Advertised pause frame use: Symmetric Receive-only
> 
> 
>         Advertised auto-negotiation: Yes
>         Advertised FEC modes: Not reported
>         Speed: 1000Mb/s
>         Duplex: Full
>         Port: MII
>         PHYAD: 1
>         Transceiver: internal
>         Auto-negotiation: on
>         Supports Wake-on: d
>         Wake-on: d
>         Current message level: 0xffffffff (-1)
>                                drv probe link timer ifdown ifup rx_err
> tx_err tx_queued intr tx_done rx_status pktdata hw wol 0xffff8000
>         Link detected: yes
> 
> # ethtool -s eth1 autoneg off
> # ethtool eth1
> Settings for eth1:
>         Supported ports: [ MII ]
>         Supported link modes:   1000baseT/Full
>         Supported pause frame use: Symmetric Receive-only
>         Supports auto-negotiation: Yes
>         Supported FEC modes: Not reported
>         Advertised link modes:  1000baseT/Full
>         Advertised pause frame use: Symmetric Receive-only
>         Advertised auto-negotiation: No
>         Advertised FEC modes: Not reported
>         Speed: 10Mb/s
>         Duplex: Half
>         Port: MII
>         PHYAD: 1
>         Transceiver: internal
>         Auto-negotiation: off
>         Supports Wake-on: d
>         Wake-on: d
>         Current message level: 0xffffffff (-1)
>                                drv probe link timer ifdown ifup rx_err
> tx_err tx_queued intr tx_done rx_status pktdata hw wol 0xffff8000
>         Link detected: yes
> 
> 3) After code tracing, we found that:
> 
> phy_state_machine()
> 	state PHY_RUNNING: phy_check_link_status()
> 		phy_read_status()
> 			genphy_read_status()
> 				genphy_read_status_fixed()
> 
> In genphy_read_status_fixed(), the speed and duplex changed.
> It seems like the bmcr value is always 0x1000 from swphy_read_reg().
> 
> After revert the commit 726097d6d6d(net: phy: improve auto-neg emulation in
> swphy), then the Speed and Duplex shown comes back to 1000M and Full.
> 

Thanks for the regression report. I'm adding it to regzbot

#regzbot ^introduced: 726097d6d6d8e9

-- 
An old man doll... just what I always wanted! - Clara

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

* Re: phy: fixed link 1000 or 100 set with autoneg off
  2023-10-23  7:01 phy: fixed link 1000 or 100 set with autoneg off Jia, Fang
  2023-10-23  7:42 ` Bagas Sanjaya
@ 2023-10-23  7:52 ` Heiner Kallweit
  2023-10-23  8:34   ` Jia, Fang
  2023-10-23 14:57   ` David Laight
  1 sibling, 2 replies; 7+ messages in thread
From: Heiner Kallweit @ 2023-10-23  7:52 UTC (permalink / raw)
  To: Jia, Fang, Andrew Lunn, Florian Fainelli, David S. Miller
  Cc: netdev, linux-kernel

On 23.10.2023 09:01, Jia, Fang wrote:
> Hi Experts,
> 
> We use NXP LS1046 board and face an issue about the eth interface speed.
> 
> 1) Scenario
> 
> we set fixed link 1000Mb/s in device tree.
> 
> However, after we set the auto-neg off, then the eth1's speed changed to 10M and Duplex changed to Half.
> The value of /sys/class/net/eth1/speed is 10 and /sys/class/net/eth1/duplex is half
> 
Why do you set aneg to off? Leave aneg on, that's the only supported
mode in swphy. 1000Mbps requires aneg anyway per standard.

> 2) Log is as following.
> 
> # ifconfig eth1 up
> # ethtool eth1
> Settings for eth1:
>         Supported ports: [ MII ]
>         Supported link modes:   1000baseT/Full
>         Supported pause frame use: Symmetric Receive-only
>         Supports auto-negotiation: Yes
> 
>         Supported FEC modes: Not reported
> 
>         Advertised link modes:  1000baseT/Full
>         Advertised pause frame use: Symmetric Receive-only
> 
>         Advertised auto-negotiation: Yes
>         Advertised FEC modes: Not reported
>         Speed: 1000Mb/s
>         Duplex: Full
>         Port: MII
>         PHYAD: 1
>         Transceiver: internal
>         Auto-negotiation: on
>         Supports Wake-on: d
>         Wake-on: d
>         Current message level: 0xffffffff (-1)
>                                drv probe link timer ifdown ifup rx_err tx_err tx_queued intr tx_done rx_status pktdata hw wol 0xffff8000
>         Link detected: yes
> 
> # ethtool -s eth1 autoneg off
> # ethtool eth1
> Settings for eth1:
>         Supported ports: [ MII ]
>         Supported link modes:   1000baseT/Full
>         Supported pause frame use: Symmetric Receive-only
>         Supports auto-negotiation: Yes
>         Supported FEC modes: Not reported
>         Advertised link modes:  1000baseT/Full
>         Advertised pause frame use: Symmetric Receive-only
>         Advertised auto-negotiation: No
>         Advertised FEC modes: Not reported
>         Speed: 10Mb/s
>         Duplex: Half
>         Port: MII
>         PHYAD: 1
>         Transceiver: internal
>         Auto-negotiation: off
>         Supports Wake-on: d
>         Wake-on: d
>         Current message level: 0xffffffff (-1)
>                                drv probe link timer ifdown ifup rx_err tx_err tx_queued intr tx_done rx_status pktdata hw wol 0xffff8000
>         Link detected: yes
> 
> 3) After code tracing, we found that:
> 
> phy_state_machine()
>     state PHY_RUNNING: phy_check_link_status()
>         phy_read_status()
>             genphy_read_status()
>                 genphy_read_status_fixed()
> 
> In genphy_read_status_fixed(), the speed and duplex changed.
> It seems like the bmcr value is always 0x1000 from swphy_read_reg().
> 
> After revert the commit 726097d6d6d(net: phy: improve auto-neg emulation in swphy), then the Speed and Duplex shown comes back to 1000M and Full.
> 
> Could you please take a look it ? Can we revert this commit, is there any side impact ?
> 
> Best Regards,
> Fang


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

* Re: phy: fixed link 1000 or 100 set with autoneg off
  2023-10-23  7:52 ` Heiner Kallweit
@ 2023-10-23  8:34   ` Jia, Fang
  2023-10-23 14:28     ` Andrew Lunn
  2023-10-23 14:57   ` David Laight
  1 sibling, 1 reply; 7+ messages in thread
From: Jia, Fang @ 2023-10-23  8:34 UTC (permalink / raw)
  To: Heiner Kallweit, Andrew Lunn, Florian Fainelli, David S. Miller
  Cc: netdev, linux-kernel



On 10/23/23 15:52, Heiner Kallweit wrote:
> CAUTION: This email comes from a non Wind River email account!
> Do not click links or open attachments unless you recognize the sender and know the content is safe.
> 
> On 23.10.2023 09:01, Jia, Fang wrote:
>> Hi Experts,
>>
>> We use NXP LS1046 board and face an issue about the eth interface speed.
>>
>> 1) Scenario
>>
>> we set fixed link 1000Mb/s in device tree.
>>
>> However, after we set the auto-neg off, then the eth1's speed changed to 10M and Duplex changed to Half.
>> The value of /sys/class/net/eth1/speed is 10 and /sys/class/net/eth1/duplex is half
>>
> Why do you set aneg to off? Leave aneg on, that's the only supported
> mode in swphy. 1000Mbps requires aneg anyway per standard.

Thanks very much for your reply.

Actually, due to some reason, the phydev's default aneg state is off.
And we just found if use ethtool to set, it had the same result.

We also found that when we set speed to 100, same result.

So we can assume that swphy only supports the aneg on, no matter the 
speed setting. Am I right ?

> 
>> 2) Log is as following.
>>
>> # ifconfig eth1 up
>> # ethtool eth1
>> Settings for eth1:
>>          Supported ports: [ MII ]
>>          Supported link modes:   1000baseT/Full
>>          Supported pause frame use: Symmetric Receive-only
>>          Supports auto-negotiation: Yes
>>
>>          Supported FEC modes: Not reported
>>
>>          Advertised link modes:  1000baseT/Full
>>          Advertised pause frame use: Symmetric Receive-only
>>
>>          Advertised auto-negotiation: Yes
>>          Advertised FEC modes: Not reported
>>          Speed: 1000Mb/s
>>          Duplex: Full
>>          Port: MII
>>          PHYAD: 1
>>          Transceiver: internal
>>          Auto-negotiation: on
>>          Supports Wake-on: d
>>          Wake-on: d
>>          Current message level: 0xffffffff (-1)
>>                                 drv probe link timer ifdown ifup rx_err tx_err tx_queued intr tx_done rx_status pktdata hw wol 0xffff8000
>>          Link detected: yes
>>
>> # ethtool -s eth1 autoneg off
>> # ethtool eth1
>> Settings for eth1:
>>          Supported ports: [ MII ]
>>          Supported link modes:   1000baseT/Full
>>          Supported pause frame use: Symmetric Receive-only
>>          Supports auto-negotiation: Yes
>>          Supported FEC modes: Not reported
>>          Advertised link modes:  1000baseT/Full
>>          Advertised pause frame use: Symmetric Receive-only
>>          Advertised auto-negotiation: No
>>          Advertised FEC modes: Not reported
>>          Speed: 10Mb/s
>>          Duplex: Half
>>          Port: MII
>>          PHYAD: 1
>>          Transceiver: internal
>>          Auto-negotiation: off
>>          Supports Wake-on: d
>>          Wake-on: d
>>          Current message level: 0xffffffff (-1)
>>                                 drv probe link timer ifdown ifup rx_err tx_err tx_queued intr tx_done rx_status pktdata hw wol 0xffff8000
>>          Link detected: yes
>>
>> 3) After code tracing, we found that:
>>
>> phy_state_machine()
>>      state PHY_RUNNING: phy_check_link_status()
>>          phy_read_status()
>>              genphy_read_status()
>>                  genphy_read_status_fixed()
>>
>> In genphy_read_status_fixed(), the speed and duplex changed.
>> It seems like the bmcr value is always 0x1000 from swphy_read_reg().
>>
>> After revert the commit 726097d6d6d(net: phy: improve auto-neg emulation in swphy), then the Speed and Duplex shown comes back to 1000M and Full.
>>
>> Could you please take a look it ? Can we revert this commit, is there any side impact ?
>>
>> Best Regards,
>> Fang
> 

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

* Re: phy: fixed link 1000 or 100 set with autoneg off
  2023-10-23  8:34   ` Jia, Fang
@ 2023-10-23 14:28     ` Andrew Lunn
  2023-10-26  2:41       ` Jia, Fang
  0 siblings, 1 reply; 7+ messages in thread
From: Andrew Lunn @ 2023-10-23 14:28 UTC (permalink / raw)
  To: Jia, Fang
  Cc: Heiner Kallweit, Florian Fainelli, David S. Miller, netdev,
	linux-kernel

> Thanks very much for your reply.
> 
> Actually, due to some reason, the phydev's default aneg state is off.
> And we just found if use ethtool to set, it had the same result.

I find it surprising it defaults to aneg off. Are you sure something
has not turned it off before you look at it?

The emulator does not support writing to any registers. However,
fixed_mdio_write() does not return an error, it just does nothing.  It
needs testing, but maybe try making it return -EOPNOTSUPP. That should
prevent auto-neg being turned off, but it might also break everything
if it tries to do some other write during probe or link up. It could
be it needs a more select response, allowing writes to some bits, like
the reset bit, and start auto-neg, but not others like disable
auto-neg.

	Andrew

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

* RE: phy: fixed link 1000 or 100 set with autoneg off
  2023-10-23  7:52 ` Heiner Kallweit
  2023-10-23  8:34   ` Jia, Fang
@ 2023-10-23 14:57   ` David Laight
  1 sibling, 0 replies; 7+ messages in thread
From: David Laight @ 2023-10-23 14:57 UTC (permalink / raw)
  To: 'Heiner Kallweit', Jia, Fang, Andrew Lunn,
	Florian Fainelli, David S. Miller
  Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org

From: Heiner Kallweit
> Sent: 23 October 2023 08:52
> 
> On 23.10.2023 09:01, Jia, Fang wrote:
> > Hi Experts,
> >
> > We use NXP LS1046 board and face an issue about the eth interface speed.
> >
> > 1) Scenario
> >
> > we set fixed link 1000Mb/s in device tree.
> >
> > However, after we set the auto-neg off, then the eth1's speed changed to 10M and Duplex changed to Half.
> > The value of /sys/class/net/eth1/speed is 10 and /sys/class/net/eth1/duplex is half
> >
> Why do you set aneg to off? Leave aneg on, that's the only supported
> mode in swphy. 1000Mbps requires aneg anyway per standard.

Limiting the advertised modes has always worked better than
trying to set a fixed mode.
Although connect to a 10M hub (that sends out single link test pulses)
and you'll end up 10M/HDX regardless of the ANAR register. 

Not least of the problems is that you need to get the far end
to use exactly the same mode.

Otherwise it is very easy to get a mismatch.
In the 'old days' a HDX/FDX mismatch was easy to get and very confusing.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

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

* Re: phy: fixed link 1000 or 100 set with autoneg off
  2023-10-23 14:28     ` Andrew Lunn
@ 2023-10-26  2:41       ` Jia, Fang
  0 siblings, 0 replies; 7+ messages in thread
From: Jia, Fang @ 2023-10-26  2:41 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: Heiner Kallweit, Florian Fainelli, David S. Miller, netdev,
	linux-kernel

Thanks very much for all your reply.

Do you think is it possible that we don't ignore the speed and duplex 
settings in BMCR, but we only add the bit BMCR_ANENABLE in BMCR ? just 
for example, return (bmcr |= BMCR_ANENABLE);


On 10/23/23 22:28, Andrew Lunn wrote:
> CAUTION: This email comes from a non Wind River email account!
> Do not click links or open attachments unless you recognize the sender and know the content is safe.
> 
>> Thanks very much for your reply.
>>
>> Actually, due to some reason, the phydev's default aneg state is off.
>> And we just found if use ethtool to set, it had the same result.
> 
> I find it surprising it defaults to aneg off. Are you sure something
> has not turned it off before you look at it?
> 

These days I was trying to find how and why set to aneg off. It seems 
like due to "the some reason", we have to do this.

> The emulator does not support writing to any registers. However,
> fixed_mdio_write() does not return an error, it just does nothing.  It
> needs testing, but maybe try making it return -EOPNOTSUPP. That should
> prevent auto-neg being turned off, but it might also break everything
> if it tries to do some other write during probe or link up. It could
> be it needs a more select response, allowing writes to some bits, like
> the reset bit, and start auto-neg, but not others like disable
> auto-neg.
> 
>          Andrew

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

end of thread, other threads:[~2023-10-26  2:41 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-23  7:01 phy: fixed link 1000 or 100 set with autoneg off Jia, Fang
2023-10-23  7:42 ` Bagas Sanjaya
2023-10-23  7:52 ` Heiner Kallweit
2023-10-23  8:34   ` Jia, Fang
2023-10-23 14:28     ` Andrew Lunn
2023-10-26  2:41       ` Jia, Fang
2023-10-23 14:57   ` David Laight

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).