[PATCH v2] ramips: fix at803x patch again

David Bauer mail at david-bauer.net
Sat Jun 12 04:06:36 PDT 2021


Hi John,

On 6/12/21 12:51 AM, John Thomson wrote:
> On Fri, 11 Jun 2021, at 08:10, David Bauer wrote:
>> Can you be more precise in terms of which issues are you facing? The
>> PHY capabilities on
>> the AR8333 now read 1000B-X as a supported link mode, so fiber
>> operation should be possible.
>>
>> Can you share the capabilities advertised with current master and your
>> path (ethtool).
>>
>> Reverting these patches would divert from upcoming kernel versions
>> (mind both are backports,
>> not downstream hacks), thus this is not a solution. Ideally, the fiber
>> operation should be
>> integrated into the upstream driver.
> 
> I agree that this should be corrected atop the backports.
> It would be great to see this SFP support upstreamed.
> I have not tested SFP on OpenWrt master for some time, so I cannot blame a change yet.
> 
> This is what I am seeing on ramips 760igs:
> 
> SFP (module, and driver LOS) has link detected, but this is not reflected by the interface
> (which is configured in OpenWrt as part of a bridge)

I suppose what is happening here is the bootloader switched the PHY to 
the fiber page while linux now switches it to the copper page 
unconditionally.

Technically, this is correct from upstream perspective, as the PHY 
upstream only supports copper opmode. But it breaks the hacked fiber 
support downstream.

DENGs initial patch fixed this with the old downstream hacks, where the 
page was only switched when the PHY operated in SGMII mode, as the whole 
assumption this patch was based upon was wrong but lead to the correct 
result.

However, while we now get the correct link modes, we now switch to the 
fiber page upon probe.

Note that I haven't verified this, as i do not own this board. I'll 
prepare a patch and send it to this thread this weekend. Would be great 
if someone with this board could test it :)

Best
David

> 
> sfp: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel master br-wan state DOWN qlen 1000
> 
> r16925+6-b721579842 master, plus my
> SPI-NOR changes: https://github.com/openwrt/openwrt/pull/3271/commits
> 
> I do not remember these being looped in dmesg when I had working SFP:
> sfp sfp1: SM: enter present:up:link_up event dev_up
> sfp sfp1: SM: exit present:up:link_up
> 
> ethtool sfp
> Settings for sfp:
> 	Supported ports: [ TP MII ]
> 	Supported link modes:   10baseT/Half 10baseT/Full
> 	                        100baseT/Half 100baseT/Full
> 	                        1000baseT/Full
> 	                        1000baseX/Full
> 	Supported pause frame use: Symmetric Receive-only
> 	Supports auto-negotiation: Yes
> 	Supported FEC modes: Not reported
> 	Advertised link modes:  10baseT/Half 10baseT/Full
> 	                        100baseT/Half 100baseT/Full
> 	                        1000baseT/Full
> 	                        1000baseX/Full
> 	Advertised pause frame use: Symmetric Receive-only
> 	Advertised auto-negotiation: Yes
> 	Advertised FEC modes: Not reported
> 	Speed: Unknown!
> 	Duplex: Unknown! (255)
> 	Port: MII
> 	PHYAD: 7
> 	Transceiver: external
> 	Auto-negotiation: on
> 	Current message level: 0x000000ff (255)
> 			       drv probe link timer ifdown ifup rx_err tx_err
> 	Link detected: no
> 
> Pieces missing from a very old (r14885+1-fe302d472a) working SFP build: link partner advertisement and link speed / duplex
>          Link partner advertised link modes:  1000baseX/Full
>          Link partner advertised pause frame use: Symmetric Receive-only
>          Link partner advertised auto-negotiation: Yes
>          Link partner advertised FEC modes: Not reported
>          Speed: 1000Mb/s
>          Duplex: Full
>          Port: MII
>          PHYAD: 7
>          Transceiver: external
>          Auto-negotiation: on
>          Current message level: 0x000000ff (255)
>                                 drv probe link timer ifdown ifup rx_err tx_err
>          Link detected: yes
> 
> these cannot be forced on my current build:
> ethtool -s sfp speed 1000 duplex full
> [  182.182182] at803x_config_aneg: fiber
> 
> 
> Attached:
> version=$(cat /etc/openwrt_version)
> mkdir -p "/tmp/sfp/$version"
> dmesg > "/tmp/sfp/$version/dmesg"
> logread > "/tmp/sfp/$version/logread"
> ethtool sfp > "/tmp/sfp/$version/ethtool_sfp"
> ethtool -m sfp > "/tmp/sfp/$version/ethtool_m_sfp"
> echo -n 'file sfp.c +p' > /sys/kernel/debug/dynamic_debug/control
> /etc/init.d/network restart
> dmesg > "/tmp/sfp/$version/dmesg_reup"
> logread > "/tmp/sfp/$version/logread_reup"
> # remove, and reinsert SFP module
> dmesg > "/tmp/sfp/$version/dmesg_reinsert"
> logread > "/tmp/sfp/$version/logread_reinsert"
> 
> diffconfig:
> CONFIG_TARGET_ramips=y
> CONFIG_TARGET_ramips_mt7621=y
> CONFIG_TARGET_ramips_mt7621_DEVICE_mikrotik_routerboard-760igs=y
> CONFIG_KERNEL_DYNAMIC_DEBUG=y
> CONFIG_KERNEL_MTD_PARTITIONED_MASTER=y
> CONFIG_PACKAGE_ethtool=y
> CONFIG_ETHTOOL_PRETTY_DUMP=y
> 
> Cheers,
> 
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
> 



More information about the openwrt-devel mailing list