Re: AR8316 Switch Support

Anythings we could do to make the AR8316 switch to support VLAN tagging.

Re: AR8316 Switch Support

are we there yet ? wink

Re: AR8316 Switch Support

sxpert wrote:

are we there yet ? wink

Unfortunately, no. I did some playing around with the switch on my rs pro, and did not get anything vlan releated to work (treating it as an AR8216 on speed).

After the exams in mid februrary, I will meet with russo and we will try to get the switch on the 450g at least to the stage it is on the rs pro (unless somebody else was faster wink.

Re: AR8316 Switch Support

Could you describe how you are accessing the AR8316 as an AR8216? Are you doing this programatically or through the shell? How did you get the default RS_Pro build to add the 8216 switch into the system and initialize it (or at least add it in)?

The VLAN and higher speeds would be great, but right now I just need to be able to see if the port is up/down, that would be very helpful.

Basically -- how do I communicate with the switch just to read some basic regsiters?

Thanks

Re: AR8316 Switch Support

paulCutler wrote:

Could you describe how you are accessing the AR8316 as an AR8216? Are you doing this programatically or through the shell? How did you get the default RS_Pro build to add the 8216 switch into the system and initialize it (or at least add it in)?

The VLAN and higher speeds would be great, but right now I just need to be able to see if the port is up/down, that would be very helpful.

Basically -- how do I communicate with the switch just to read some basic regsiters?

Thanks

I took the ar8216 driver found in generic-2.6/files/drivers/net/phy and modified it a bit (mostly uncommenting the most stuff).

You do want to comment out:
* the part where it replaces the netops (packet header does not seem to work, neither in nor out).
* the reset/hw_apply part (it configures the switch in a way it does not seem to send any packets any more to the cpu port).

Look at switch.c/h, you can add a command for swconfig to read out the switch status and return it, e.g. name it status and then you can do swconfig dev eth0 port 3 get status.

See the ar8216.h for which bit on the port status register means what ('though there is a small error in there, the first two bits define the speed, and 0b00 = 10Mbit, 0b01 = 100Mbit, 0b10 = 1000Mbit; not 0b10 = Speed_err.

The switch ports on the routerstation pro are wired according the following:
* Port 5 directly wired to WAN on eth0.
* Ports 2-4 are LAN3-1 (i.e., LAN1 is Port 4, LAN2 is 3 and LAN1 is 2).
* Port 1 isn't connected anywhere
* Port 0 is the CPU port and connected with eth1.

This should get you going.


I would post patches, but unfortunately my code isn't currently in a usable state.


Different Topic:

It seems the TRENDnet TEW-673GR that was announced a year ago as the first router using the XSPAN platform with the AR8316 switch never made it to production and was replaced by the TEW-673GRU, which seems to be almost the same router, but with a realtek switch instead of the atheros one.

So there goes my hope of getting something usable (regarding vlans).

31 (edited by Joseph Watson 2010-02-07 23:32:44)

Re: AR8316 Switch Support

I also really hope that we will get vlan support some time.

I found a poll over at Ubiquiti Networks trying to get support for vlan's.  So if you are interested, head on over and vote.  Maybe with enough people, they will spend some time on it.

http://www.ubnt.com/forum/showthread.php?t=17639

Re: AR8316 Switch Support

I've been in touch with a company that provides licenses for Atheros products.  They said there is an SDK and full source code available for the AR8316 switch, however it can only be licensed to a company such as Ubiquiti.

Therefore, we are dependent on Ubiquiti releasing at the very least a binary of the driver if we want to use all the features of the switch.  Either that, or hope that someone can modify the AR8216 driver enough to support the AR8316 (which I believe KanjiMonster is attempting).

abyrne on Freenode

Maintainer of wide-dhcpv6 package

Re: AR8316 Switch Support

Andrew-ACT wrote:

I've been in touch with a company that provides licenses for Atheros products.  They said there is an SDK and full source code available for the AR8316 switch, however it can only be licensed to a company such as Ubiquiti.

That's my experience too. At least somewhat, after I let slip I'm not a company I did not get any response anymore.

Andrew-ACT wrote:

Either that, or hope that someone can modify the AR8216 driver enough to support the AR8316 (which I believe KanjiMonster is attempting).

Exactly. Well, at least I'm making some progress, even if it is little (many first attempts were foiled by deficiencies in the ag71xx driver - but I'm confident I'll fix them, and perhaps even add jumbo frame support - at least it seems doable).
Now is university exam time, so I currently have no time for it, but in about a week I'll be working on it again. And then it won't be me alone, but I'll be working with russo. I'm quite confident we should get the RB450G to at least the same level as the RS Pro in no time :-).

Re: AR8316 Switch Support

any news here ??

Re: AR8316 Switch Support

I pulled the following files from /trunk/target/linux/generic-2.6/files/drivers/net/phy/
* ar8216.c/h
* swconfig.c

and placed them into /trunk/target/linux/ar71xx/files/drivers/net/phy/

I can see the 8216 driver init run, but it fails during the "ar8216_probe" call. I am not sure if this is because I am looking for the ID of the 8216 and instead I have an 8316 on the board. If anyone could help move this ahead I would really appreciate it.

KanjiMonster, could you send me the files that you have working? Even if they are ugly I am willing to test and clean them up.

Re: AR8316 Switch Support

Ditto.  I have both the RN450G and the RS Pro.  I would be willing to see what I can get working on them as well, but without any docs or a starting point, it's pretty tough.

Re: AR8316 Switch Support

i'm not sure if everybody is aware that i proposed a bounty for the developer who came with a full working patch for enabling network stuff on RB450G.

i've posted it on another thread about RB450G. Please check it !

https://forum.openwrt.org/viewtopic.php?id=22759&p=2#p98910

Re: AR8316 Switch Support

Okay, for anyone interested, here is the first "beta" version of "my" driver (its basically just the ar8216 with some ar8316 extensions).

There are two patches:
* the generic ar8316 support for the ar8216 driver, and
* the inclusion of the driver in ar71xx and configuration updates.

These should be applied with

patch -p1 < <patch>

and should apply cleanly to revision 20110 (or the appropriate git equivalent).

The driver contains the switch initialization code from the routerstation, and generates some debug output. It is working on my routerstation pro, but totally untested on the rb-450g. So I am especially interested in feedback from rb-450g owners. Post feedback (and the debug output)! :)
It looks like that on the RS Pro:

eth0: Atheros AG71xx at 0xb9000000, irq 4
eth0: AR8316 PHY driver attached.
eth1: Atheros AG71xx at 0xba000000, irq 5
eth1: AR8316 PHY driver attached.
ar8316: updating reg 0x00008 from 0x81461bea to 0x81461bea
ar8316: updating reg 0x000b0 from 0xcc37cc37 to 0xcc37cc37
ar8316: updating reg 0x000b4 from 0xca37ca37 to 0xcc37cc37
ar8316: updating reg 0x000b8 from 0xca37ca37 to 0xca37ca37
ar8316: updating reg 0x000bc from 0x00000000 to 0x00000000
ar8316: updating phy4 dbg reg 0x12 from 0x4c0c to 0x480c
ar8316: updating phy4 dbg reg 0x00 from 0x824e to 0x824e
ar8316: updating phy4 dbg reg 0x05 from 0x3d47 to 0x3d47

(obviously there are no real changes as the switch was already initialized by the redboot).

Known issues:
* The switch is registered as a six port switch, but port 5 isn't usable on either rs pro or rb 450g (its the wan port and independent of the switch), and port 1 isn't connected on rs pro. Also, there is no connection between the switch port numbers and the labels on the board.
* The switch's vlan table can hold 4096 entries, but the driver limits it to 32 tracked entries. Using the full 4k entries makes the private data ~12kB big, and produces strange side effects like alignment errors. This might be a SLUB bug. If you need more than 32 entries, you can easily change the #define at the top of the ar8216.c.
* ar8216 support might be totally broken.
* There is some code ugliness.
* No jumbo frame support (the ag71xx driver doesn't support jumbo frames itself, so only external devices communicating through the switch would profit from it).

Also: Thanks to russo for providing me with the initial motivation for doing this!

KM

TL;DR:
* Patches apply to r20110.
* Driver should work on rb-450g, but is untested.
* Post feedback!
* Have fun.

KM

Disclaimer: No warranty for anything. I am not responsible if the switch breaks, takes over the world or steals your girlfriend.

Re: AR8316 Switch Support

KanjiMonster wrote:

Okay, for anyone interested, here is the first "beta" version of "my" driver (its basically just the ar8216 with some ar8316 extensions).

Unfortunately this did not work for me on my RS Pro.  The eth1 was all okay (my LAN ports), however eth0 wouldn't work (I run PPPoE over it to my ISP).

ag71xx_mdio: probed
eth0: Atheros AG71xx at 0xb9000000, irq 4
eth0: AR8316 PHY driver attached.
eth0: connected to PHY at ag71xx-mdio:04 [uid=004dd041, driver=Atheros AR8316]
eth1: Atheros AG71xx at 0xba000000, irq 5
eth1: AR8316 PHY driver attached.
ar8316: updating reg 0x00008 from 0x81461bea to 0x81461bea
ar8316: updating reg 0x000b0 from 0xcc37cc37 to 0xcc37cc37
ar8316: updating reg 0x000b4 from 0xca37ca37 to 0xcc37cc37
ar8316: updating reg 0x000b8 from 0xca37ca37 to 0xca37ca37
ar8316: updating reg 0x000bc from 0x00000000 to 0x00000000
ar8316: updating phy4 dbg reg 0x12 from 0x4c0c to 0x480c
ar8316: updating phy4 dbg reg 0x00 from 0x824e to 0x824e
ar8316: updating phy4 dbg reg 0x05 from 0x3d47 to 0x3d47
eth1: connected to PHY at ag71xx-mdio:00 [uid=004dd041, driver=Atheros AR8316]
ADDRCONF(NETDEV_UP): eth0: link is not ready
ADDRCONF(NETDEV_UP): eth1: link is not ready
device eth1 entered promiscuous mode
eth1: link up (1000Mbps/Full duplex)

i.e. eth0 never comes up, but is configured and visible via ifconfig

Jan  1 11:01:19 gateway daemon.warn pppd[441]: Timeout waiting for PADO packets
Jan  1 11:01:19 gateway daemon.err pppd[441]: Unable to complete PPPoE Discovery
Jan  1 11:02:04 gateway daemon.warn pppd[441]: Timeout waiting for PADO packets
Jan  1 11:02:04 gateway daemon.err pppd[441]: Unable to complete PPPoE Discovery
abyrne on Freenode

Maintainer of wide-dhcpv6 package

Re: AR8316 Switch Support

Andrew-ACT wrote:
KanjiMonster wrote:

Okay, for anyone interested, here is the first "beta" version of "my" driver (its basically just the ar8216 with some ar8316 extensions).

Unfortunately this did not work for me on my RS Pro.  The eth1 was all okay (my LAN ports), however eth0 wouldn't work (I run PPPoE over it to my ISP).

I'll take a look at it later today (furtunately my ISP is also using PPPoE, so I can test it locally :-).
Stintel noticed another problem, the switch stops working after serveral network restarts. So the beta label was perhaps a bit optimistic and should have been alpha wink

KM

41 (edited by robrob 2010-03-10 18:02:53)

Re: AR8316 Switch Support

Kanji,

I am not using your driver but I have noticed that my RSPro switch will stop working after a few network restarts in trunk 20010.

Re: AR8316 Switch Support

I just took a look ath the PPPoE problem.

It seems it isn't a problem of PPPoE, but that the WAN port doesn't connect at 100 Mbit (or 10 Mbit). At least here. Not even the led comes on.

But since it does under redboot, it must be something in my patch that I setup wrong, it must be fixable.

KM

Re: AR8316 Switch Support

I think I got it, and it is quite obvious:

    pdev->supported = priv->chip == AR8316 ? 
        ADVERTISED_1000baseT_Full : ADVERTISED_100baseT_Full;
    pdev->advertising = priv->chip == AR8316 ? 
        ADVERTISED_1000baseT_Full : ADVERTISED_100baseT_Full;
    
    if (pdev->addr != 0) {
        kfree(priv);
        return 0;
    }

Probably it would help if I told linux that it supports modes other than 1000baseT_Full wink

Currently compiling it; if it works, I'll update the patch.

KM

Re: AR8316 Switch Support

I just updated the first patch to the newest code version.

Changes since first release:
* Guard register modifications with a mutex.
* Fix WAN port (now supports speeds other than gigabit wink

KM

Re: AR8316 Switch Support

This is great, however the switch dont init here, I think.

Kernel log:
ag71xx_mdio: probed
eth0: Atheros AG71xx at 0xb9000000, irq 4
eth0: connected to PHY at ag71xx-mdio:04 [uid=004dd041, driver=Generic PHY]
eth1: Atheros AG71xx at 0xba000000, irq 5
eth1: connected to 4 PHYs

syslog:
sysinit: Failed to connect to the switch

No lines with "ar8316" in the log files.
I just applied the patches, and compiled, is it something else I have to do?
I didnt "make clean", could it be it?  (I have done it now, and currently compiling)

46 (edited by KanjiMonster 2010-03-10 20:51:49)

Re: AR8316 Switch Support

Yeah, you need to do a clean (or just delete the linux-2.6.32.9 directory in build_dir).

KM

Edit: Of course, manually copying the modified files from target/linux/generic-2.6/files/ and target/linux/ar71xx/files/ to build_dir/linux-ar71xx/linux-2.6.32.9/ works too.

Re: AR8316 Switch Support

KanjiMonster wrote:

I just updated the first patch to the newest code version.

Changes since first release:
* Guard register modifications with a mutex.
* Fix WAN port (now supports speeds other than gigabit wink

KM

Thanks KM.  I (and I'm sure everyone) appreciate the work you've done!  I'll try out the new patch in the next day or so.

Are you going to stick with modifications to the ar8216 driver, or create a standalone ar8316 driver?  Keeping them in the one file could cause issues in the future if someone breaks ar8216 when adding ar8316 functionality, or vice versa.  Having said that, if the differences between them are so small, a single driver is probably fine.

abyrne on Freenode

Maintainer of wide-dhcpv6 package

48 (edited by KanjiMonster 2010-03-11 12:45:18)

Re: AR8316 Switch Support

Andrew-ACT wrote:

Are you going to stick with modifications to the ar8216 driver, or create a standalone ar8316 driver?  Keeping them in the one file could cause issues in the future if someone breaks ar8216 when adding ar8316 functionality, or vice versa.  Having said that, if the differences between them are so small, a single driver is probably fine.

The plan is to make the changes/special handling as small as possible, and after inclusion into openwrt rename it to a generic atheros switch driver name. My biggest problem is that I don't have access to any ar8216 devices (or the tp-link 741nd, which seems to have a third kind of atheros switch chip, which looks something between a ar8216 with a gigabit cpu port and a ar8316 with external 100M ports).

Thursday Update
* No functional changes, just reduced the patch size a bit. Breakage of ar8216 much less likely now.

KM

49 (edited by flaxrt 2010-03-11 18:23:22)

Re: AR8316 Switch Support

I'll compile and boot this on an RB450G. I'm not quite sure though what the end result should be as openwrt's naming of the ethernet  ports still confuses me.
Anyway thank you for your work and let me know what I can do to help.

--- Later that day smile
ag71xx_mdio: probed
eth0: Atheros AG71xx at 0xba000000, irq 5
eth0: AR8316 PHY driver attached.
eth1: Atheros AG71xx at 0xb9000000, irq 4
eth1: AR8316 PHY driver attached.
ar8316: updating reg 0x00008 from 0x01061b68 to 0x81461bea
ar8316: updating reg 0x000b0 from 0xcc00cc00 to 0xcc37cc37
ar8316: updating reg 0x000b4 from 0xca35ca35 to 0xcc37cc37
ar8316: updating reg 0x000b8 from 0xcf35cf35 to 0xca37ca37
ar8316: updating reg 0x000bc from 0x00000000 to 0x00000000
ar8316: updating phy4 dbg reg 0x12 from 0x480c to 0x480c
ar8316: updating phy4 dbg reg 0x00 from 0x824e to 0x824e
ar8316: updating phy4 dbg reg 0x05 from 0x3d47 to 0x3d47
Atheros AR71xx hardware watchdog driver version 0.1.0
TCP westwood registered
NET: Registered protocol family 17
802.1Q VLAN Support v1.8 Ben Greear <greearb@candelatech.com>
All bugs added by David S. Miller <davem@redhat.com>
Freeing unused kernel memory: 1268k freed
gpio-buttons driver version 0.1.2
input: gpio-buttons as /devices/platform/gpio-buttons/input/input0
Button Hotplug driver version 0.3.1
- preinit -
Registered led device: rb4xx:yellow:user
Press f<ENTER> to enter failsafe mode
eth0: link up (100Mbps/Full duplex)
- regular preinit -
---------------

eth0 is the first port , the rest of the ports  are bridged as eth1 and working ok.
Could you please tell me how to check individual ports?

Thank you very much.

Re: AR8316 Switch Support

flaxrt wrote:

I'll compile and boot this on an RB450G.

Great to hear something from an RB450G owner smile.

I'm not quite sure though what the end result should be as openwrt's naming of the ethernet  ports still confuses me.

The AR7161 has two ethernet controllers, therefore there are two interfaces, eth0 and eth1. one of these is the wan port, the other is the connection to the CPU port of the switch.

On the rs pro, its connected like this:

    +-----------+       +-----------+
    |           | Eth0  |           |
    |           +-------+----------5+-WAN
    |           |       | AR8316    |
    |    CPU    |       |        +-4+-LAN1
    |           | Eth1  |        +-3+-LAN2
    |           +-------+0-------+-2+-LAN3
    |           |       |        +-1+ (not connected)
    +-----------+       +-----------+

while on the RB450G, it could look like this (I couldn't verify it yet, as I don't own one).

    +-----------+       +-----------+
    |           | Eth1  |           |
    |           +-------+----------5+-WAN
    |           |       | AR8316    |
    |    CPU    |       |        +-4+-LAN1
    |           | Eth0  |        +-3+-LAN2
    |           +-------+0-------+-2+-LAN3
    |           |       |        +-1+-LAN4
    +-----------+       +-----------+

Where the numbers represent the internal port numbers of the switch (which are used for configuring the switch).

Anyway thank you for your work and let me know what I can do to help.

What you are doing right now is currently exactly what I need ;-).

--- Later that day smile

ar8316: updating reg 0x00008 from 0x01061b68 to 0x81461bea
ar8316: updating reg 0x000b0 from 0xcc00cc00 to 0xcc37cc37
ar8316: updating reg 0x000b4 from 0xca35ca35 to 0xcc37cc37
ar8316: updating reg 0x000b8 from 0xcf35cf35 to 0xca37ca37
ar8316: updating reg 0x000bc from 0x00000000 to 0x00000000

Okay, it seems the LEDs are setup a bit different.

eth0 is the first port , the rest of the ports  are bridged as eth1 and working ok.
Could you please tell me how to check individual ports?

Yeah. Great to hear! I'll upload later a version that prints port changes on the kernel log, then you can check which port corresponds to which.

KM