8devices / carambola

Carambola - RT305x/SoC based PCB
http://openwrt.org/
GNU General Public License v2.0
26 stars 12 forks source link

Add VLAN support #5

Closed vbolshakov closed 11 years ago

vbolshakov commented 11 years ago

ARC Flex FreeStation 5 (http://wiki.openwrt.org/toh/arc/freestation) look exactly like Carambola. OpenWRT's Table of Hardware say that it support VLAN.

Can you integrate VLAN support into you codebase?

8devices commented 11 years ago

Hi,

Can you tell more about what exactly you are trying to achieve and what does not work ? A sample scenario/network diagram would be very helpful too!

vbolshakov commented 11 years ago

Hello.

I try to use Carambola in VoIP desktop phone scenario - PC connected to VoIP phone and phone connected to network. PC use one 802.1Q VLAN, phone use another VLAN. In my case it will be UPS with IP management cart connected to first Carambola Eth port, and Carambola will connect to switch using second Eth port. I wont to separate management and access networks, so none be able to access UPS over WiFi.

I install OpenWRT build for ARC Flex FreeStation 5 and it almost worked, but Eth - i can connect to Carambola over WiFi, but can't connect to it over Eth.

8devices commented 11 years ago

Hi,

I will check what I can do about this.

8devices commented 11 years ago

Patch like this should help:

Index: linux-3.3.8/drivers/net/ethernet/ramips/ramips_esw.c
===================================================================
--- linux-3.3.8.orig/drivers/net/ethernet/ramips/ramips_esw.c   2012-10-05 14:01:24.652475633 +0300
+++ linux-3.3.8/drivers/net/ethernet/ramips/ramips_esw.c    2012-10-05 13:59:00.748473129 +0300
@@ -203,9 +203,11 @@

    /* vodoo from original driver */
    rt305x_esw_wr(esw, 0xC8A07850, RT305X_ESW_REG_FCT0);
-   rt305x_esw_wr(esw, 0x00000000, RT305X_ESW_REG_SGC2);
    rt305x_esw_wr(esw, 0x00405555, RT305X_ESW_REG_PFC1);

+   /* Enable Double VLAN support on ports 0-4 */
+   rt305x_esw_wr(esw, 0x0000001F, RT305X_ESW_REG_SGC2);
+
    /* Enable Back Pressure, and Flow Control */
    rt305x_esw_wr(esw,
              ((RT305X_ESW_PORTS_ALL << RT305X_ESW_POC1_EN_BP_S) |

You need to check out sources ant edit target/linux/ramips/files/drivers/net/ethernet/ramips/ramips_esw.c file before running 'make'. After that in order to have extra VLAN you could simple run:

# vconfig  add eth0.1  100
# vconfig add eth0.2  200

There should be two eth0.1.100 and eth0.2.200 interfaces. VLAN #100 and #200 tagged frames should be visible on those interfaces accordingly. Can you try please ?

vbolshakov commented 11 years ago

Just tested and got two problems:

  1. It is software VLAN realization and huge traffic will load CPU to 100%
  2. 1500 byte packets dropped while go through Carambola

As i understand RT3050 have 5 port FE switch (+2 GE ports int RT3052) and one (virtual) Ethernet like interface in CPU. Ports 0 and 1 is hardware ports on Carambola. Port 7 is virtual CPU Ethernet. In current Carambola platform config there is static VLAN configuration of internal switch that bind Port 0 to VLAN 1 and Port 1 to VLAN2 or vice verse (both in access/untagged mode). And use vconfig like mechanism to ebable software VLAN processing on Port 7.

Can you add swconfig into Carambola build and network/switch page for luci?

I try latest OpenWRT build for FreeStation 5 and got both Eth ports worked as part of one VLAN. Tomorrow i will try OpenWRT build for Carambola, and try to add swconfig into it.

PS. May be you can import this things when you will merge with OpenWRT repo.

vbolshakov commented 11 years ago

Just tested original OpenWRT build for Carambola - it is also working with VLANs. GPIO not test - my test environment not ready yet.

Can you shortly describe difference of 8device repo from original OpenWRT?

8devices commented 11 years ago

Main difference is that on flash partitions are of fixed sizes:

#define CARAMBOLA_UBOOT_SIZE    0x030000 /*  192KB */
#define CARAMBOLA_UBOOT_ENV     0x010000 /*   64KB */
#define CARAMBOLA_FACTORY_SIZE  0x010000 /*   64KB */
#define CARAMBOLA_KERNEL_SIZE   0x120000 /* 1152KB */
#define CARAMBOLA_ROOTFS_SIZE   0x690000 /* 6720KB */

Changes that are unlikely to be taken by OpenWRT upstream.

Also the same code is/was used as a base for http://www.8devices.com/wiki_carambola/doku.php/carambola_demo_projects

And other future projects :)