Switch, missing port

On CHAOS CALMER 15.05.1
Target "Mediatek Ralink MIPS" Subtarghet "RT5350" Targhet profile "A5-V11"
The switch had 5 ports, of which port 4 was used in the object

In the last compiled, there is only port 1, so the ethernet does not work.

root@OpenWrt:/# swconfig dev switch0 port 4 show
Port 4:
        disable: 1
        doubletag: 0
        untag: 0
        led: 5
        lan: 0
        recv_bad: 0
        recv_good: 0
        tr_bad: 0
        tr_good: 0
        pvid: 0
        link: port:4 link:down

Clip_2

Changed /etc/network

config switch_vlan
        option device 'rt305x'
        option vlan '1'
        option ports '0 1 2 3 4 6t'

Sended command:

swconfig dev switch0 port 1 set disable 0
swconfig dev switch0 port 2 set disable 0
swconfig dev switch0 port 3 set disable 0
swconfig dev switch0 port 4 set disable 0
swconfig dev switch0 port 5 set disable 0
swconfig dev switch0 set apply

Nothing, port 4 does not appear.

After:

swconfig dev switch0 port 4 set disable 0
swconfig dev switch0 set apply

ping work, but not other.
lan 4 icon does not appear in luci

At reboot the switch loses the configuration and the ping no longer goes

help, please, help

Are you having an issue with version 15, or version 17?

The pictures seems to suggest 17.01.4 works.

Top pictures is v15, that works well, use port 4.
Bottom picture is, the last version that does not work, use only port 1

Please show results of:

swconfig dev switch0 show

I'm trying to change the sources in:

/target/linux/ramips/base-files/etc/board.d/02_network
Line 66
a5-v11
ucidef_add_switch "switch0" /
	"0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "6@eth0"
ucidef_add_switch_attr "switch0" "enable" "false"
ucidef_set_interface_lan "eth0"
;;

Nothing, also changing network file, only one port appears in luci

root@OpenWrt:/# swconfig dev switch0 show
Global attributes:
        enable_vlan: 1
        alternate_vlan_disable: 0
        bc_storm_protect: 0
        led_frequency: 0
Port 0:
        disable: 0
        doubletag: 0
        untag: 1
        led: 5
        lan: 1
        recv_bad: 0
        recv_good: 0
        tr_bad: 0
        tr_good: 0
        pvid: 1
        link: port:0 link:down
Port 1:
        disable: 1
        doubletag: 0
        untag: 0
        led: 5
        lan: 0
        recv_bad: 0
        recv_good: 0
        tr_bad: 0
        tr_good: 0
        pvid: 0
        link: port:1 link:down
Port 2:
        disable: 1
        doubletag: 0
        untag: 0
        led: 5
        lan: 0
        recv_bad: 0
        recv_good: 0
        tr_bad: 0
        tr_good: 0
        pvid: 0
        link: port:2 link:down
Port 3:
        disable: 1
        doubletag: 0
        untag: 0
        led: 5
        lan: 0
        recv_bad: 0
        recv_good: 0
        tr_bad: 0
        tr_good: 0
        pvid: 0
        link: port:3 link:down
Port 4:
        disable: 1
        doubletag: 0
        untag: 0
        led: 5
        lan: 0
        recv_bad: 0
        recv_good: 0
        tr_bad: 0
        tr_good: 0
        pvid: 0
        link: port:4 link:down
Port 5:
        disable: 1
        doubletag: 0
        untag: 0
        led: ???
        lan: 0
        recv_bad: 0
        recv_good: 0
        tr_bad: 0
        tr_good: 0
        pvid: 0
        link: port:5 link:down
Port 6:
        disable: 0
        doubletag: 0
        untag: 0
        led: ???
        lan: ???
        recv_bad: ???
        recv_good: ???
        tr_bad: ???
        tr_good: ???
        pvid: 0
        link: port:6 link:up speed:1000baseT full-duplex
VLAN 1:
        ports: 0 6t

Also on this way not work:

/target/linux/ramips/base-files/etc/board.d/02_network

Line 66
a5-v11
		ucidef_add_switch "switch0" \
			"0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4:wan:5" "6@eth0"
		ucidef_add_switch_attr "switch0" "enable" "false"
		ucidef_set_interface_lan "eth0"
		;;

I believe the problem is in this file, but I do not understand.

/target/linux/ramips/base-files/etc/board.d/02_network

ramips_setup_rt3x5x_vlans()
{
	if [ ! -x /sbin/swconfig ]; then
		# legacy default
		ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
		return
	fi
	local wanports=""
	local lanports=""
	for port in 5 4 3 2 1 0; do
		if [ `swconfig dev rt305x port $port get disable` = "1" ]; then
			continue
		fi
		if [ `swconfig dev rt305x port $port get lan` = "0" ]; then
			wanports="$port:wan $wanports"
		else
			lanports="$port:lan $lanports"
		fi
	done
	ucidef_add_switch "rt305x" $lanports $wanports "6t@eth0"
}

I believe the files you are looking at are for creating initial config for "fresh flash". You should be editing your /etc/config/network. Once you've gotten that working, then it may be appropriate to contribute changes to the initial-configuration scripts.

In the file: /etc/config/network

I changed this:

config switch_vlan
        option device 'rt305x'
        option vlan '1'
        option ports '0 6t'

in this:

config switch_vlan
        option device 'rt305x'
        option vlan '1'
        option ports '1 2 3 4 5 6t'

Port 4 is always disabled.

root@OpenWrt:/# swconfig dev switch0 show
Global attributes:
        enable_vlan: 1
        alternate_vlan_disable: 0
        bc_storm_protect: 0
        led_frequency: 0
Port 0:
        disable: 0
        doubletag: 0
        untag: 0
        led: 5
        lan: 1
        recv_bad: 0
        recv_good: 0
        tr_bad: 0
        tr_good: 0
        pvid: 0
        link: port:0 link:down
Port 1:
        disable: 1
        doubletag: 0
        untag: 1
        led: 5
        lan: 0
        recv_bad: 0
        recv_good: 0
        tr_bad: 0
        tr_good: 0
        pvid: 1
        link: port:1 link:down
Port 2:
        disable: 1
        doubletag: 0
        untag: 1
        led: 5
        lan: 0
        recv_bad: 0
        recv_good: 0
        tr_bad: 0
        tr_good: 0
        pvid: 1
        link: port:2 link:down
Port 3:
        disable: 1
        doubletag: 0
        untag: 1
        led: 5
        lan: 0
        recv_bad: 0
        recv_good: 0
        tr_bad: 0
        tr_good: 0
        pvid: 1
        link: port:3 link:down
Port 4:
        disable: 1
        doubletag: 0
        untag: 1
        led: 5
        lan: 0
        recv_bad: 0
        recv_good: 0
        tr_bad: 0
        tr_good: 0
        pvid: 1
        link: port:4 link:down
Port 5:
        disable: 1
        doubletag: 0
        untag: 1
        led: ???
        lan: 0
        recv_bad: 0
        recv_good: 0
        tr_bad: 0
        tr_good: 0
        pvid: 1
        link: port:5 link:down
Port 6:
        disable: 0
        doubletag: 0
        untag: 0
        led: ???
        lan: ???
        recv_bad: ???
        recv_good: ???
        tr_bad: ???
        tr_good: ???
        pvid: 0
        link: port:6 link:up speed:1000baseT full-duplex
VLAN 1:
        ports: 1 2 3 4 5 6t

Solved.

/target/linux/ramips/dts/A5-V11.dts

&esw {
	mediatek,portmap = <0x00>;
	mediatek,portdisable = <0x0f>;
};

/target/linux/ramips/base-files/etc/board.d/02_network

a5-v11)
	ucidef_set_interface_lan "eth0.1"
	ucidef_add_switch "switch0" "6@eth0"
	ucidef_add_switch_vlan "switch0" "1" "6t"
	;;
1 Like

Probably worthwhile posting a patch to the OpenWRT/LEDE developer mailing list to get the changes reviewed and included in the source.

1 Like