ER-X-SFP - SFP (eth5) port has link-state (LED = lit), but swconfig says link: port:5 link:down

What come in mind: may be MDIO frequency setting. I have seens it some ware in á SDK they set the MDIO frequency for external phy's.

RGMII_2 pins are connected! Too ephy and internal switch P5. But I am not sure how that changes from one state to the other.

This indeed makes the router detect the SFP and the link, many thanks!

However, I don't see the switch itself anymore, swconfig list doesn't show anything. Do I miss something? Further, are there any plans to have this included in the official OpenWRT release?

1 Like

Correct! switch code is converted to DSA.

Today new patches are posted to support MT7621 and MT7530 in the mainline kernel. https://marc.info/?l=linux-netdev&m=154805471408751&w=2

When that is in we can include it in the openwrt.
I have a working version of this code and it seems great at the moment.

1 Like

Awesome stuff.
How hard would it be to backport it to 4.19 since its pretty much only matter of time when ramips is bumped to 4.19

Thanks a million, guys! Am a bit of a novice, could you pls update (me) how to implement the patches to have both switch and SFP port working? Any specifics/specials I need to take into account?

Can someone verify whether updatet DSA code already made it into OpenWrt release? VDorst github link is broken.
Any help please

I am very eager to ask a question here, is this mt7530 patch possible to support the SFP port of ERX-SFP?

I don't see reference to MT7621, so I fear no support for SFP port on ER-X-SFP

Pulled tree https://github.com/vdorst/openwrt/tree/mt7621-ramips-dsa2 here and compiled firmware.

Still need to verify with other SFP device, but fixing speed using ethtool didn't work for me to get the port talking...

Confirmed it works: ethtool --change lan5 speed 1000 duplex full autoneg off

I am still working on it.

But I am not working on openwrt but the upstream kernel 5.3-RCx.
https://patchwork.ozlabs.org/patch/1136519/
https://patchwork.ozlabs.org/patch/1136551/

Also implementing PHYLINK API which is the way to go for the SFP port.

1 Like

The patches are accepted!
Linux v5.4 supports mt7621 and mt7530 with port 5.

2 Likes

Great job... Latest openwrt version is still with kernel 4.14.131. Do you think a backport is possible?
Any tip on how to compile a kernel with support? Thanks

4.19 support for Ramips is WIP.
There is a PR open for it

Yes and No.

Net-next driver which will be v5.4 has support for mt7628, mt7621, mt7622, mt7623 and mt7629, also PHYLINK API.
mt7628 is missing a esw/DSA driver in the kernel. But Stefan did make a first start with a dsa switch driver for mt7628. https://github.com/stroese/linux/blob/gardena-v5.2-ethernet-phy-v1-2019-07-10/drivers/net/dsa/mt7628.c

other issue with the upstream driver

  • TRGMII mode is not working on all devices. I got 2 devices (UBNT-ERX-SFP and MTC-WR1201).
  • UBNT-ERX-SFP works in TRGMII and RGMII mode, but MTC-WR1201 only works in RGMII mode with an extra patch. I am still working on that. But I think I am not on time to get is in the current net-next.
  • mt7621 now using QDMA for both TX/RX path. RX path has a silicon bug. So RX path should use PDMA.
  • mt7621 has performance issues. iperf from the device TX could reach 941mb/s but RX is stuck at around 300-500mbit.
  • No HWNAT support.

Net-next driver mt7530 switch:
Supports:

  • DSA
  • PHYLINK API
  • Port 5, so Port 0 / 4 can be used as WAN port on the 2nd GMAC or in case of UBNT-ERX-SFP port 5 is connected to SFP cage.

Backporting MT7530 is maybe a good start.

1 Like

12 posts were split to a new topic: Which registers to use to enable RGMII2 on the MT7621

I modified the current openwrt switch to support port 5 in the same way as the upstream kernel.
You can try it out with the link below.
Port 5 only works at 1Gbit and is currently forced at 1Gbit with no link detection.
Port 5 is used as wan other ports are lan ports.

1 Like

Great! I will try it

I test it and it seems not work.

root@X-WRT:~# swconfig dev switch0 show | grep link
	link: port:0 link:down
	link: port:1 link:down
	link: port:2 link:up speed:1000baseT full-duplex 
	link: port:3 link:down
	link: port:4 link:down
	link: port:5 link:up speed:1000baseT full-duplex 
	link: port:6 link:up speed:1000baseT full-duplex 
	link: port:7 link:down

It shows link up dmesg on my PC when the router boot-up, and then link-down

and the boot dmesg log:

[    0.000000] Linux version 4.14.149 (ptpt52@SC-GAME) (gcc version 8.3.0 (OpenWrt GCC 8.3.0 r11252-8ab2525069)) #0 SMP Sun Oct 20 01:55:44 2019
[    0.000000] SoC Type: MediaTek MT7621 ver:1 eco:3
[    0.000000] bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 0001992f (MIPS 1004Kc)
[    0.000000] MIPS: machine is UBNT-ERX-SFP
[    0.000000] Determined physical RAM map:
[    0.000000]  memory: 10000000 @ 00000000 (usable)
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] VPE topology {2,2} total 4
[    0.000000] Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes.
[    0.000000] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
[    0.000000] MIPS secondary cache 256kB, 8-way, linesize 32 bytes.
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000000000000-0x000000000fffffff]
[    0.000000]   HighMem  empty
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x000000000fffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x000000000fffffff]
[    0.000000] On node 0 totalpages: 65536
[    0.000000] free_area_init_node: node 0, pgdat 805fa8c0, node_mem_map 81003000
[    0.000000]   Normal zone: 576 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 65536 pages, LIFO batch:15
[    0.000000] random: get_random_bytes called from start_kernel+0x9c/0x4d8 with crng_init=0
[    0.000000] percpu: Embedded 14 pages/cpu s26064 r8192 d23088 u57344
[    0.000000] pcpu-alloc: s26064 r8192 d23088 u57344 alloc=14*4096
[    0.000000] pcpu-alloc: [0] 0 [0] 1 [0] 2 [0] 3 
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 64960
[    0.000000] Kernel command line: console=ttyS0,57600 rootfstype=squashfs,jffs2
[    0.000000] PID hash table entries: 1024 (order: 0, 4096 bytes)
[    0.000000] Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
[    0.000000] Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
[    0.000000] Writing ErrCtl register=00002085
[    0.000000] Readback ErrCtl register=00002085
[    0.000000] Memory: 251632K/262144K available (4826K kernel code, 249K rwdata, 1048K rodata, 1288K init, 253K bss, 10512K reserved, 0K cma-reserved, 0K highmem)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[    0.000000] Hierarchical RCU implementation.
[    0.000000] NR_IRQS: 256
[    0.000000] CPU Clock: 880MHz
[    0.000000] clocksource: GIC: mask: 0xffffffffffffffff max_cycles: 0xcaf478abb4, max_idle_ns: 440795247997 ns
[    0.000000] clocksource: MIPS: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 4343773742 ns
[    0.000009] sched_clock: 32 bits at 440MHz, resolution 2ns, wraps every 4880645118ns
[    0.015491] Calibrating delay loop... 586.13 BogoMIPS (lpj=2930688)
[    0.087825] pid_max: default: 32768 minimum: 301
[    0.097183] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.110207] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.126304] Hierarchical SRCU implementation.
[    0.135822] smp: Bringing up secondary CPUs ...
[    0.164281] Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes.
[    0.164290] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
[    0.164302] MIPS secondary cache 256kB, 8-way, linesize 32 bytes.
[    0.164436] CPU1 revision is: 0001992f (MIPS 1004Kc)
[    0.205150] Synchronize counters for CPU 1: done.
[    0.288048] Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes.
[    0.288056] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
[    0.288064] MIPS secondary cache 256kB, 8-way, linesize 32 bytes.
[    0.288139] CPU2 revision is: 0001992f (MIPS 1004Kc)
[    0.326086] Synchronize counters for CPU 2: done.
[    0.405170] Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes.
[    0.405179] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
[    0.405186] MIPS secondary cache 256kB, 8-way, linesize 32 bytes.
[    0.405264] CPU3 revision is: 0001992f (MIPS 1004Kc)
[    0.445650] Synchronize counters for CPU 3: done.
[    0.505260] smp: Brought up 1 node, 4 CPUs
[    0.514164] devtmpfs: initialized
[    0.524331] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.543809] futex hash table entries: 1024 (order: 3, 32768 bytes)
[    0.556345] pinctrl core: initialized pinctrl subsystem
[    0.568026] NET: Registered protocol family 16
[    0.586068] FPU Affinity set after 11720 emulations
[    0.595983] mt7621_gpio 1e000600.gpio: registering 32 gpios
[    0.607415] mt7621_gpio 1e000600.gpio: registering 32 gpios
[    0.618736] mt7621_gpio 1e000600.gpio: registering 32 gpios
[    0.632672] clocksource: Switched to clocksource GIC
[    0.644048] random: fast init done
[    0.652321] NET: Registered protocol family 2
[    0.661606] TCP established hash table entries: 2048 (order: 1, 8192 bytes)
[    0.675360] TCP bind hash table entries: 2048 (order: 2, 16384 bytes)
[    0.688141] TCP: Hash tables configured (established 2048 bind 2048)
[    0.700856] UDP hash table entries: 256 (order: 1, 8192 bytes)
[    0.712351] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes)
[    0.725028] NET: Registered protocol family 1
[    0.733581] PCI: CLS 0 bytes, default 32
[    0.972594] 4 CPUs re-calibrate udelay(lpj = 2924544)
[    0.983921] Crashlog allocated RAM at address 0x3f00000
[    0.994443] workingset: timestamp_bits=14 max_order=16 bucket_order=2
[    1.015766] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    1.027276] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    1.050311] io scheduler noop registered
[    1.058024] io scheduler deadline registered (default)
[    1.069284] Serial: 8250/16550 driver, 3 ports, IRQ sharing disabled
[    1.083696] console [ttyS0] disabled
[    1.090710] 1e000c00.uartlite: ttyS0 at MMIO 0x1e000c00 (irq = 19, base_baud = 3125000) is a 16550A
[    1.108742] console [ttyS0] enabled
[    1.122517] bootconsole [early0] disabled
[    1.140490] MediaTek Nand driver init, version v2.1 Fix AHB virt2phys error
[    1.154531] Enable NFI Clock
[    1.160252] # MTK NAND # : Use HW ECC
[    1.167564] Device not found, ID: c2da
[    1.175025] Not Support this Device! 
[    1.182467] chip_mode=00000001
[    1.188554] Support this Device in MTK table! c2da 
[    1.198451] [NAND]select ecc bit:4, sparesize :64 spare_per_sector=16
[    1.211327] nand: device found, Manufacturer ID: 0xc2, Chip ID: 0xda
[    1.223977] nand: Macronix NAND 256MiB 3,3V 8-bit
[    1.233349] nand: 256 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
[    1.248449] Scanning device for bad blocks
[    1.760791] 6 fixed-partitions partitions found on MTD device MT7621-NAND
[    1.774310] Creating 6 MTD partitions on "MT7621-NAND":
[    1.784729] 0x000000000000-0x000000080000 : "u-boot"
[    1.796244] 0x000000080000-0x0000000e0000 : "u-boot-env"
[    1.808296] 0x0000000e0000-0x000000140000 : "factory"
[    1.819787] 0x000000140000-0x000000440000 : "kernel1"
[    1.831288] 0x000000440000-0x000000740000 : "kernel2"
[    1.843014] 0x000000740000-0x00000ff00000 : "ubi"
[    1.855768] [mtk_nand] probe successfully!
[    1.864666] Signature matched and data read!
[    1.873170] load_fact_bbt success 2047
[    1.881440] libphy: Fixed MDIO Bus: probed
[    1.954317] mt7621-gsw 1e110000.gsw: Setup P5, HWTRAP=0x17c8f, intf_sel=GMAC5, phy-mode=rgmii-rxid
[    1.973513] libphy: mdio: probed
[    3.381769] mtk_soc_eth 1e100000.ethernet: loaded mt7530 driver
[    3.394340] mtk_soc_eth 1e100000.ethernet eth0: mediatek frame engine at 0xbe100000, irq 20
[    3.413800] NET: Registered protocol family 10
[    3.424243] Segment Routing with IPv6
[    3.431615] NET: Registered protocol family 17
[    3.440560] bridge: filtering via arp/ip/ip6tables is no longer available by default. Update your scripts to load br_netfilter if you need this.
[    3.466353] 8021q: 802.1Q VLAN Support v1.8
[    3.477963] UBI: auto-attach mtd5
[    3.484668] ubi0: attaching mtd5
[    4.694158] mtk_soc_eth 1e100000.ethernet eth0: port 2 link up
[    5.771135] ubi0: scanning is finished
[    5.796282] ubi0: attached mtd5 (name "ubi", size 247 MiB)
[    5.807262] ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
[    5.820952] ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
[    5.834469] ubi0: VID header offset: 2048 (aligned 2048), data offset: 4096
[    5.848330] ubi0: good PEBs: 1982, bad PEBs: 0, corrupted PEBs: 0
[    5.860462] ubi0: user volume: 2, internal volumes: 1, max. volumes count: 128
[    5.874846] ubi0: max/mean erase counter: 1/0, WL threshold: 4096, image sequence number: 1319621856
[    5.893029] ubi0: available PEBs: 0, total reserved PEBs: 1982, PEBs reserved for bad PEB handling: 40
[    5.911576] ubi0: background thread "ubi_bgt0d" started, PID 364
[    5.913590] block ubiblock0_0: created from ubi0:0(rootfs)
[    5.934510] ubiblock: device ubiblock0_0 (rootfs) set to be root filesystem
[    5.948381] hctosys: unable to open rtc device (rtc0)
[    5.964666] VFS: Mounted root (squashfs filesystem) readonly on device 254:0.
[    5.985066] devtmpfs: mounted
[    5.995523] Freeing unused kernel memory: 1288K
[    6.004568] This architecture does not have kernel memory protection.
[    6.537916] init: Console is alive
[    6.545037] init: - watchdog -
[    7.375116] kmodloader: loading kernel modules from /etc/modules-boot.d/*
[    7.435552] softdog: initialized. soft_noboot=0 soft_margin=60 sec soft_panic=0 (nowayout=0)
[    7.454173] kmodloader: done loading kernel modules from /etc/modules-boot.d/*
[    7.482960] init: - preinit -
[    8.308931] mtk_soc_eth 1e100000.ethernet: PPE started
[   11.537076] UBIFS (ubi0:1): background thread "ubifs_bgt0_1" started, PID 434
[   11.576300] random: procd: uninitialized urandom read (4 bytes read)
[   11.610845] UBIFS (ubi0:1): recovery needed
[   11.772809] UBIFS (ubi0:1): recovery completed
[   11.781781] UBIFS (ubi0:1): UBIFS: mounted UBI device 0, volume 1, name "rootfs_data"
[   11.797378] UBIFS (ubi0:1): LEB size: 126976 bytes (124 KiB), min./max. I/O unit sizes: 2048 bytes/2048 bytes
[   11.817122] UBIFS (ubi0:1): FS size: 239095808 bytes (228 MiB, 1883 LEBs), journal size 11935744 bytes (11 MiB, 94 LEBs)
[   11.838756] UBIFS (ubi0:1): reserved for root: 4952683 bytes (4836 KiB)
[   11.851928] UBIFS (ubi0:1): media format: w4/r0 (latest is w5/r0), UUID 0B80EE26-BE79-426D-B184-3BB9BD8979F4, small LPT model
[   11.878661] mount_root: switching to ubifs overlay
[   11.948338] urandom-seed: Seeding with /etc/urandom.seed
[   12.053121] mtk_soc_eth 1e100000.ethernet: 0x100 = 0x6060000c, 0x10c = 0x80818
[   12.075573] procd: - early -
[   12.081402] procd: - watchdog -
[   12.722805] procd: - watchdog -
[   12.729375] procd: - ubus -
[   12.742803] random: ubusd: uninitialized urandom read (4 bytes read)
[   12.831209] random: ubusd: uninitialized urandom read (4 bytes read)
[   12.844378] random: ubusd: uninitialized urandom read (4 bytes read)
[   12.857992] procd: - init -
[   13.526903] urngd: v1.0.0 started.
[   13.541967] kmodloader: loading kernel modules from /etc/modules.d/*
[   13.582107] tun: Universal TUN/TAP device driver, 1.6
[   13.605053] l2tp_core: L2TP core driver, V2.0
[   13.615051] l2tp_netlink: L2TP netlink interface
[   13.626738] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
[   13.646464] gre: GRE over IPv4 demultiplexor driver
[   13.658778] ip_gre: GRE over IPv4 tunneling driver
[   13.674945] ip6_gre: GRE over IPv6 tunneling driver
[   13.694557] ip6_tables: (C) 2000-2006 Netfilter Core Team
[   13.707471] random: crng init done
[   13.714402] random: 6 urandom warning(s) missed due to ratelimiting
[   13.732981] nf_conntrack version 0.5.0 (4096 buckets, 16384 max)
[   13.816311] Netfilter messages via NETLINK v0.30.
[   13.828233] ip_set: protocol 6
[   13.866132] i2c /dev entries driver
[   13.881802] pca953x 0-0025: 0-0025 supply vcc not found, using dummy regulator
[   13.911096] pca953x 0-0025: interrupt support not compiled in
[   13.922898] i2c-gpio i2c-gpio: using pins 3 (SDA) and 4 (SCL)
[   13.936484] Mirror/redirect action on
[   13.956398] u32 classifier
[   13.961836]     input device check on
[   13.969277]     Actions configured
[   13.998573] {natcap}:natcap_init(): version: 7.0.1
[   14.008198] {natcap}:natcap_init(): natcap_major=250, natcap_minor=0
[   14.025422] {natcap}:natcap_peer_init(): natcap_peer_major=249, natcap_peer_minor=0
[   14.045146] {natflow}:natflow_init(): natflow_major=248, natflow_minor=0
[   14.059320] {natflow}:natflow_zone_init(): natflow_zone_major=247, natflow_zone_minor=0
[   14.076068] {natflow}:natflow_user_init(): natflow_user_major=246, natflow_user_minor=0
[   14.092701] {natflow}:natflow_ktun_init(): natflow_ktun_major=245, natflow_ktun_minor=0
[   14.117772] Bridge firewalling registered
[   14.131095] ip_tables: (C) 2000-2006 Netfilter Core Team
[   14.218427] ctnetlink v0.93: registering with nfnetlink.
[   14.233962] nf_conntrack_rtsp v0.7 loading
[   14.324085] nf_nat_rtsp v0.7 loading
[   14.348191] nf_tables: (c) 2007-2009 Patrick McHardy <kaber@trash.net>
[   14.406976] wireguard: WireGuard 0.0.20191012 loaded. See www.wireguard.com for information.
[   14.423907] wireguard: Copyright (C) 2015-2019 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
[   14.500679] xt_time: kernel timezone is -0000
[   14.527124] PPP generic driver version 2.4.2
[   14.537647] PPP MPPE Compression module registered
[   14.549391] NET: Registered protocol family 24
[   14.560090] PPTP driver version 0.8.5
[   14.572109] l2tp_ppp: PPPoL2TP kernel driver, V2.0
[   14.585299] kmodloader: done loading kernel modules from /etc/modules.d/*
[   22.551220] mtk_soc_eth 1e100000.ethernet: PPE started
[   22.570318] br-lan: port 1(eth0.1) entered blocking state
[   22.581148] br-lan: port 1(eth0.1) entered disabled state
[   22.593116] device eth0.1 entered promiscuous mode
[   22.602720] device eth0 entered promiscuous mode
[   22.615182] br-lan: port 1(eth0.1) entered blocking state
[   22.625993] br-lan: port 1(eth0.1) entered forwarding state
[   22.637491] IPv6: ADDRCONF(NETDEV_UP): br-lan: link is not ready
[   23.563713] IPv6: ADDRCONF(NETDEV_CHANGE): br-lan: link becomes ready

so any help?