Modify

Opened 4 years ago

Last modified 7 months ago

#11143 reopened defect

switch eth0(Atheros AR8316) no traffic between ports possible

Reported by: darkwin Owned by: blogic
Priority: normal Milestone: Barrier Breaker 14.07
Component: packages Version: Trunk
Keywords: switch ar8316 Cc:

Description

hi, it isn´t possible to make trafic between lan Ports.
My router Buffalo WBMR-HP-G300H with openwrt trunk r30952

but from any port it´s posible to make trafic to internet and wlan clients.

dmesg

[    0.524000] ltq_mii: probed
[    0.548000] eth0: AR8316 switch driver attached.
[    0.552000] ar8316: Using port 4 as switch port
[    5.672000] eth0: attached PHY [Atheros AR8216/AR8236/AR8316] (phy_addr=0:00, irq=-1)
[    5.680000] Registered led device: soc:blue:movie
[    5.684000] Registered led device: soc:red:internet
[    5.684000] Registered led device: soc:green:internet
[    5.684000] Registered led device: soc:green:adsl
[    5.684000] Registered led device: soc:green:wlan
[    5.684000] Registered led device: soc:red:security
[    5.684000] Registered led device: soc:green:power
[    5.684000] Registered led device: soc:red:power
[    5.688000] Registered led device: soc:green:usb
[    5.688000] TCP westwood registered
[    5.688000] NET: Registered protocol family 17
[    5.692000] Bridge firewalling registered
[    5.696000] 8021q: 802.1Q VLAN Support v1.8

switch config

root@OpenWrt:/# swconfig dev eth0 show
Global attributes:
        enable_vlan: 0
Port 0:
        pvid: 0
        link: port:0 link:up speed:1000baseT full-duplex txflow rxflow
Port 1:
        pvid: 0
        link: port:1 link:down
Port 2:
        pvid: 0
        link: port:2 link:up speed:1000baseT full-duplex txflow rxflow auto
Port 3:
        pvid: 0
        link: port:3 link:down
Port 4:
        pvid: 0
        link: port:4 link:up speed:1000baseT full-duplex txflow rxflow auto
Port 5:
        pvid: 0
        link: port:5 link:down

network

config interface 'loopback'
        option ifname 'lo'
        option proto 'static'
        option ipaddr '127.0.0.1'
        option netmask '255.0.0.0'

config interface 'lan'
        option type 'bridge'
        option proto 'static'
        option ipaddr '192.168.1.1'
        option netmask '255.255.255.0'
        option _orig_ifname 'eth0 wlan0 wlan0-1 tun0 tun1'
        option _orig_bridge 'true'
        option ifname 'eth0'
        option stp '1'

config interface 'vpn'
        option ifname 'tun0'
        option defaultroute '0'
        option peerdns '0'
        option proto 'none'

config atm-bridge 'atm'
        option unit '0'
        option vpi '1'
        option encaps 'llc'
        option payload 'bridged'
        option fwannex 'b'
        option annex 'b'
        option vci '32'

config interface 'wan'
        option ifname 'nas0'
        option proto 'pppoe'
        option username '****'
        option password 'geheim'

config adsl-device 'adsl'
        option fwannex 'b'
        option annex 'b'

config interface 'vpn2'
        option proto 'none'
        option ifname 'tun1'
        option auto '1'

firewall

package firewall

config defaults
        option syn_flood '1'
        option input 'ACCEPT'
        option output 'ACCEPT'
        option forward 'REJECT'

config zone
        option name 'lan'
        option input 'ACCEPT'
        option output 'ACCEPT'
        option forward 'REJECT'
        option network 'lan'

config zone
        option name 'wan'
        option network 'wan'
        option input 'REJECT'
        option output 'ACCEPT'
        option forward 'REJECT'
        option masq '1'
        option mtu_fix '1'

config zone
        option name 'vpn'
        option input 'ACCEPT'
        option output 'ACCEPT'
        option forward 'ACCEPT'
        option masq '1'
        option network 'vpn vpn2'

config forwarding
        option src 'lan'
        option dest 'wan'

config rule
        option name 'Allow-DHCP-Renew'
        option src 'wan'
        option proto 'udp'
        option dest_port '68'
        option target 'ACCEPT'
        option family 'ipv4'

config rule
        option name 'Allow-Ping'
        option src 'wan'
        option proto 'icmp'
        option icmp_type 'echo-request'
        option family 'ipv4'
        option target 'ACCEPT'

config rule
        option name 'Allow-DHCPv6'
        option src 'wan'
        option proto 'udp'
        option src_ip 'fe80::/10'
        option src_port '547'
        option dest_ip 'fe80::/10'
        option dest_port '546'
        option family 'ipv6'
        option target 'ACCEPT'

config rule
        option name 'Allow-ICMPv6-Input'
        option src 'wan'
        option proto 'icmp'
        list icmp_type 'echo-request'
        list icmp_type 'echo-reply'
        list icmp_type 'destination-unreachable'
        list icmp_type 'packet-too-big'
        list icmp_type 'time-exceeded'
        list icmp_type 'bad-header'
        list icmp_type 'unknown-header-type'
        list icmp_type 'router-solicitation'
        list icmp_type 'neighbour-solicitation'
        option limit '1000/sec'
        option family 'ipv6'
        option target 'ACCEPT'

config rule
        option name 'Allow-ICMPv6-Forward'
        option src 'wan'
        option dest '*'
        option proto 'icmp'
        list icmp_type 'echo-request'
        list icmp_type 'echo-reply'
        list icmp_type 'destination-unreachable'
        list icmp_type 'packet-too-big'
        list icmp_type 'time-exceeded'
        list icmp_type 'bad-header'
        list icmp_type 'unknown-header-type'
        option limit '1000/sec'
        option family 'ipv6'
        option target 'ACCEPT'

config forwarding
        option src 'vpn'
        option dest 'lan'

config include
        option path '/etc/firewall.user'

config forwarding
        option dest 'vpn'
        option src 'lan'

Attachments (0)

Change History (49)

comment:1 Changed 4 years ago by nbd

  • Owner changed from developers to blogic
  • Status changed from new to assigned

The switch needs a configuration in /etc/config/network. The behavior you're describing is the default in an unconfigured state (meant to allow access to the router, but not forward packets between ports when you want to have a VLAN config).

comment:2 follow-up: Changed 4 years ago by darkwin <sven1810@…>

I do not understand completely. What must I put in/etc/config/network that's the Switch packets forward between switch ports?
Can you give me please an example?

comment:3 in reply to: ↑ 2 Changed 4 years ago by anonymous

Replying to darkwin <sven1810@…>:

I do not understand completely. What must I put in/etc/config/network that's the Switch packets forward between switch ports?
Can you give me please an example?

Me too please. I am having the same problem and cannot bridge any of the switch ports.

comment:4 Changed 4 years ago by jow

Simply add this to the network configuration and reboot:

config switch
  option name 'switch0'
  option reset '1'
  option enable_vlan '1'

config switch_vlan
  option device 'switch0'
  option vlan '1'
  option ports '0 1 2 3 4 5'

comment:5 Changed 4 years ago by darkwin <sven1810@…>

i have do this, but my switch ports are unuseable.

comment:6 Changed 4 years ago by breakdown@…

I can confirm, that the lan switch is not working on the WBMR-HP-G300H. I also tried the lan configuration settings from jow stated above.
DD-WRT had similiar problem with the lan switch. NBD fixed it:http://svn.dd-wrt.com/changeset/18886

comment:7 Changed 4 years ago by nbd

that dd-wrt commit has nothing to do with ar8316

comment:8 Changed 4 years ago by pepsi

Hi

I am using openwrt build 32336 and I have this issue. I tried jow's advice but my switch disabled.

Anyone knows how to configure /etc/config/network?

comment:9 Changed 4 years ago by Tim V

Didn't want to chance a reboot to test this, so tried as below on WMBR-HP-G300H running openwrt r31316 but got same result where all switch traffic between devices stopped and even router could no longer ping things on the wired network where it could while the switch was in unconfigured state.

Commands:

swconfig dev eth0 set reset

swconfig dev eth0 set enable_vlan 1

swconfig dev eth0 vlan 1 set ports "0 1 2 3 4 5"

swconfig dev eth0 set apply

Doing "swconfig dev eth0 set reset" and "swconfig dev eth0 set apply" after this reset the config back on the switch so it looked the same as unconfigured, but still no comms until I rebooted the router. Nothing apparent in dmesg prior to rebooting.

Seems like there are maybe two issues, and a $$ workaround:

  • Issue: Setting up vlans on the switch doesn't seem to work as expected, either by command line or uci/reboot. Seems from https://forum.openwrt.org/viewtopic.php?id=33058 that the tagging code in ar8316 (ar8216) driver doesn't let you do particularly exotic things, but I'd not consider having all ports participating on the same untagged vlan to be that exotic and it seems from that thread that the limitations wouldn't affect what we're trying to do here.
  • Issue: Resetting the switch may not fully reset it compared to a power cycle (or I have the commands wrong)
  • Workaround: Have a mostly working configuration here and limited time to muck about with it so I'm going to put a switch downstream from the router and just run a single cable to the router. Not loving it because now I'm £25 down on a new GB switch and wasting all the other GB ports on the router.

Has anybody either had success with the instructions in the thread? I can't see any relevant commits since 31316 regarding the issue, which probably explains why its still being seen on r32336 even when configuration is applied ;)

comment:10 Changed 4 years ago by pepsi

Hi Tim,

you know, the strange thing is on DDWRT switch worked fine! On ddwrt forum I read everyone has problem with switch like in openwrt. I used 18026 ddwrt build and then I flashed openwrt.

comment:11 Changed 4 years ago by breakdown

That's only half of the truth. Yes, the switch worked on dd-wrt untill build 18026. But all versions which came out afterwards have no working switch ether. Current dd-wrt build for this router is 19327.

comment:12 Changed 4 years ago by anonymous

There are a lot of people which switch doesn't work on 18026 too.(erasing nvram or hard reset do nothing)

comment:13 Changed 4 years ago by pierre

I have the same problem.. If I use an external switch it works fine (too bad it's a 100mbps and I need a gigabit :( )

comment:14 follow-ups: Changed 4 years ago by anonymous

Found bad mii writes to the CTRL register after hw_apply/setup_port. Resolved by mii_lo_first = true.

--- ar8216.c.old
+++ ar8216.c
@@ -444,7 +444,7 @@ ar8216_init_port(struct ar8216_priv *pri
 	/* Enable port learning and tx */
 	priv->write(priv, AR8216_REG_PORT_CTRL(port),
 		AR8216_PORT_CTRL_LEARN |
-		(4 << AR8216_PORT_CTRL_STATE_S));
+		(AR8216_PORT_STATE_FORWARD << AR8216_PORT_CTRL_STATE_S));
 
 	priv->write(priv, AR8216_REG_PORT_VLAN(port), 0);
 
@@ -575,7 +575,7 @@ ar8316_hw_init(struct ar8216_priv *priv)
 
 	/* Initialize the ports */
 	bus = priv->phy->bus;
-	for (i = 0; i < 5; i++) {
+	for (i = 0; i < priv->dev.ports; i++) {
 		if ((i == 4) && priv->port4_phy &&
 		    priv->phy->interface == PHY_INTERFACE_MODE_RGMII) {
 			/* work around for phy4 rgmii mode */
@@ -1246,6 +1246,7 @@ ar8216_id_chip(struct ar8216_priv *priv)
 		priv->chip = &ar8236_chip;
 		break;
 	case AR8XXX_VER_AR8316:
+		priv->mii_lo_first = true;
 		priv->chip = &ar8316_chip;
 		break;
 	case AR8XXX_VER_AR8327:

Config (tagless packets are treated as vid=0 it seems)

config switch
        option name eth0
        option enable '1'
        option reset '1'
        option enable_vlan '1'

config switch_vlan
        option device   'eth0'
        option vlan     '33'
        option vid      '0'
        option ports    '0 1 2 3 4 5'

Vlan tag behavior still needs work. Who has the datasheet?

comment:15 in reply to: ↑ 14 Changed 4 years ago by anonymous

Woah, that's great anonymous! thank you :)

The datasheet I don't know.. Try asking in #openwrt @IRC freenode

comment:16 Changed 4 years ago by antony

Any news yet?

It seems impossible to find the datasheet :(

We need to know just behaviour of the vlan pid?

comment:17 Changed 4 years ago by theAnswer

Fixed the problem!

tested on Build 32638

Just type these commands:

swconfig dev eth0 vlan 1 set ports "0 1 2 3 4 5"
swconfig dev eth0 set apply

comment:18 Changed 4 years ago by theAnswer

swconfig dev eth0 vlan 1 set ports "0 1 2 3 4 5" then swconfig dev eth0 set apply

comment:19 Changed 4 years ago by anonymous

The patch and config in comment 14 work for me, thanks! So basic switch traffic between lan ports is usable now. The vlan trunking issues explained in the forum thread above remain. I guess for correct 802.1q the chip's Rule Table must be configured, and code to do that is completely missing from the driver. No docs? Perhaps examine the registers on a fully working system.

comment:20 Changed 4 years ago by andybz

What can we do to get this added to trunk?

comment:21 in reply to: ↑ 14 ; follow-up: Changed 4 years ago by zooooot

Replying to anonymous:

Found bad mii writes to the CTRL register after hw_apply/setup_port. Resolved by mii_lo_first = true.

--- ar8216.c.old
+++ ar8216.c
@@ -444,7 +444,7 @@ ar8216_init_port(struct ar8216_priv *pri
 	/* Enable port learning and tx */
 	priv->write(priv, AR8216_REG_PORT_CTRL(port),
 		AR8216_PORT_CTRL_LEARN |
-		(4 << AR8216_PORT_CTRL_STATE_S));
+		(AR8216_PORT_STATE_FORWARD << AR8216_PORT_CTRL_STATE_S));
 
 	priv->write(priv, AR8216_REG_PORT_VLAN(port), 0);
 
@@ -575,7 +575,7 @@ ar8316_hw_init(struct ar8216_priv *priv)
 
 	/* Initialize the ports */
 	bus = priv->phy->bus;
-	for (i = 0; i < 5; i++) {
+	for (i = 0; i < priv->dev.ports; i++) {
 		if ((i == 4) && priv->port4_phy &&
 		    priv->phy->interface == PHY_INTERFACE_MODE_RGMII) {
 			/* work around for phy4 rgmii mode */
@@ -1246,6 +1246,7 @@ ar8216_id_chip(struct ar8216_priv *priv)
 		priv->chip = &ar8236_chip;
 		break;
 	case AR8XXX_VER_AR8316:
+		priv->mii_lo_first = true;
 		priv->chip = &ar8316_chip;
 		break;
 	case AR8XXX_VER_AR8327:

Config (tagless packets are treated as vid=0 it seems)

config switch
        option name eth0
        option enable '1'
        option reset '1'
        option enable_vlan '1'

config switch_vlan
        option device   'eth0'
        option vlan     '33'
        option vid      '0'
        option ports    '0 1 2 3 4 5'

Vlan tag behavior still needs work. Who has the datasheet?

Where can I edit this file? Can't find it

comment:22 in reply to: ↑ 21 Changed 4 years ago by anonymous

Replying to zooooot:

Where can I edit this file? Can't find it

Try this:
target/linux/generic/files/drivers/net/phy/ar8216.c

comment:23 Changed 4 years ago by zoooot

Thank you

comment:24 Changed 4 years ago by carmack

Hello,

anyone found a permanent way to fix this problem?

If yes, in which trunk revision?

comment:25 Changed 4 years ago by anonymous

Problem also exists on AR8116 switch (in EasyBox 803A). Please fix it, it's major stuff, as I think.

comment:26 Changed 4 years ago by anonymous

Sorry, I meant AR8216 switch, of course.

comment:27 Changed 4 years ago by anonymous

hi,

I wrote my solution in the wiki:
http://wiki.openwrt.org/toh/buffalo/wbmr-hp-g300h#wired.stations.cannot.ping.each.other

I configured the vlan throuch /etc/config/network based on a comment here. It works for me and I am happy that I do not need to do patching.

comment:28 Changed 4 years ago by reff

Thank you!! It worked! Finally I don't have to reapply the commands in SSH :)

comment:29 Changed 4 years ago by anonymous

in a current build of attitude adjustment the clean solution in /etc/config/network presented here http://wiki.openwrt.org/toh/buffalo/wbmr-hp-g300h#wired.stations.cannot.ping.each.other does not work for me anymore. with these settings applied no wired station is able to communicate with the router. I had to use the approach using swconfig and rc.local again.

comment:30 Changed 4 years ago by anonymous

Hi guys how do you edit the config file its in a read only file system.

comment:31 Changed 4 years ago by anonymous

Hi guys,

I'm also experiencing the issues in a current build of attitude adjustment that giving the swconfig commands on the CLI works fine, but the settings in /etc/config/network don't work out.
swconfig shows that the global attribute "enable_vlan" is set to 0 using the commands on CLI (works) and is set to 1 using the config file (doesn't work).

Any ideas?

comment:32 Changed 4 years ago by macmeck

this one fixed it for me in /etc/config/network

config switch
        option name 'eth0'
        option enable_vlan '0'
        option reset '1'

config switch_vlan
        option vlan '1'
        option device 'eth0'
        option ports '0 1 2 3 4 5'

could someone confirm and adjust it in the wiki?

comment:33 Changed 4 years ago by rj5r

Hi macmeck - I can confirm that "enable_vlan" must be set to 0.
My Buffalo WBMR-HP-G300H did not boot up without it,
i had to load the rescue system from TFTP to edit the /etc/config/network.
After that wired stations can access each other.

comment:34 Changed 4 years ago by blogic

  • Resolution set to fixed
  • Status changed from assigned to closed

please retest with latest trunk, problem should be fixed now

comment:35 Changed 3 years ago by anonymous

Problem still exist in trunk build + config in /etc/config/network dosent seems to work too ;(

comment:36 Changed 3 years ago by anonymous

  • Resolution fixed deleted
  • Status changed from closed to reopened

With the latest trunk, I need to configure the switch as follows (in effect replacing "eth0" with "switch0"):

config switch
        option name 'switch0'
        option enable_vlan '0'
        option reset '1'

config switch_vlan
        option vlan '1'
        option device 'switch0'
        option ports '0 1 2 3 4 5'

comment:37 Changed 3 years ago by anonymous

I can confirm network config fix in comment 36 works on r36112.

comment:38 Changed 3 years ago by anonymous

I have to debrick after using the following in /etc/config/network:

config switch

option name eth0
option enable '1'
option reset '1'
option enable_vlan '1'

config switch_vlan

option device 'eth0'
option vlan '33'
option vid '0'
option ports '0 1 2 3 4 5'

Did the patch with 'mii_lo_first = true' fix this for anyone? Does anyone have switch + vlans working together, patched or otherwise?

comment:39 Changed 3 years ago by anonymous

Following my previous post (38).. I cannot use any of the methods described here for configuring the switch on r36608 attitude adjustment.

comment:40 Changed 3 years ago by anonymous

In the latest barrier breaker trunk from svn the switch seems to be configured by default but trying to use vlans locked me out of the switch and I had to debrick.

comment:41 Changed 3 years ago by anonymous

Hi, if anyone has a working switch and vlans on a recent build either by a work-around or patch please post that here and I will add a note to the wiki.

comment:42 Changed 3 years ago by anonymous

For the person asking for the datasheet I found on google some likely looking PDFs. I can't post the links sadly. The first and fifth hits for 'AR8316 data sheet' look like they may be it. The first hit is a PDF that at least *claims* to be for AR8316 in any case.

comment:43 Changed 3 years ago by debwalker

After building attitude adjustment r37559 today the switch + VLANS (they show on the switch even) appear to be working with no manual tinkering using swconfig. Can be configured by luci. So, whatever changed it looks good so far and I made a note on the wiki.

Can someone confirm everything is working for them? I didn't get a chance to test pinging between stations yet.

comment:44 Changed 3 years ago by bassman

Barrier Breaker - I'm running r36689.
I also tried a minimal build of r38002 for a short time
and went back to a larger build r36689.

Apparently the switch doesn't yet work as supposed (no VLANs). I renamed it to switch0 in /etc/config/network, but no cigar. Can the problem be solved, or is it a physical impossibility?

comment:45 Changed 3 years ago by anonymous

This problem also occurs in Buffalo WHP-HP-G300N (http://wiki.openwrt.org/toh/buffalo/whr-hp-g300n) running 12.09 r36088

comment:46 Changed 3 years ago by anonymous

I spent a day configuring my WBMR-HP-G300H with the latest trunk (Barrier Breaker r39304). The switch worked right out of box.

I have successfully configured VLANs. I read from the forums that the real trouble is with VLANs that have both tagged and untagged members.

comment:47 Changed 3 years ago by anonymous

Problem with tagged and non-tagged on same port persists in latest trunk.
If I add a tagged vlan to port 2 I can not receive normal any more. Basically kills port for non-tagged.
Makes it difficult to trunk traffic over multiple devices.

Would require some sort of tunnel.

comment:48 Changed 2 years ago by jow

  • Milestone changed from Attitude Adjustment 12.09 to Barrier Breaker 14.07

Milestone Attitude Adjustment 12.09 deleted

comment:49 Changed 7 months ago by ballen4705

I have this problem with

D-Link DSL-2740B/DSL-2741B rev F1

OpenWrt Chaos Calmer 15.05 / LuCI (git-15.248.30277-3836b45)

stock installation. The WLAN can talk to any of the LAN ports and vice versa. But the LAN ports can not communicate with each other. Can someone here suggest a workaround?

Cheers,

Bruce

Add Comment

Modify Ticket

Action
as reopened .
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.