[OpenWrt-Devel] [PATCH 3/3][RESEND] b53: implement ARL Table read/write operations

Jonas Gorski jogo at openwrt.org
Tue Mar 10 08:13:28 EDT 2015


On Mon, Feb 23, 2015 at 4:55 PM, Alexandru Ardelean
<ardeleanalex at gmail.com> wrote:
> From: Alexandru Ardelean <ardeleanalex at gmail.com>
>
> Read/Write operations for the ARL table.
> To use it:
>    swconfig dev switch0 set arl "rd XX:XX:XX:XX:XX:XX vid NNNN"
>    swconfig dev switch0 get arl
>
> Output should be:
>   ARL Operation: Read
>     MAC: XX:XX:XX:XX:XX:XX
>     VLAN ID: NNNN
>     Valid: 1
>     Age: 1
>     Static: 0
>     Port(s): 001
>
> Reading/Writing the ARL table is a bit complex of an operation,
> so string parsing is used.
> The idea is that this uses swconfig 'set' prepare a r/w operation
> and swconfig 'get' to execute an operation.
> Not the most elegant approach, but it works fairly well for a
> debugging operation using b53 hardware.
>
> There are 3 op codes: rd, wr and cl. 'cl' clears any previous rd/wr.
> This parsing is stupid simple, so any spaces, cases and quotes matter.
> If a operation failed, the output will be 'failed' and the kernel
> log can be consulted. The kernel log can also be consulted for
> various messages that may have been printed during a r/w operation.
>
> For 'rd' and 'wr' ops
>  - if VLAN not enabled, only the MAC address is required
>  - if VLAN is enabled, both MAC and VLAN ID are required
>
> Commands:
>  - swconfig dev switch0 set arl cl - clear any prev op; no 'get' call required
>  - swconfig dev switch0 set arl "rd <MAC> <VID>" - the call 'get',
>      if output is 'failed' check kernel log
>  - swconfig dev switch0 set arl "rd <MAC> <VID> \
>    [static 0/1] [age 0/1] [valid 0/1] [ports NNN]"
>
> The write operation takes parameters, static, age and valid, which
> are bits that can be set/modified in the ARL table.
>
> The ports must field is dependant on the type of MAC.
>  - for unicat MACs, ports is a port number
>  - for multicast MACs, ports is a bitmask for ports on which to forward
> This is the same meaning when reading MAC/VID entries.

There seem to be four ARL register table layouts:

(Very) old FE switch chips (5325, 5365):

2 ARL table entries at 0x10 and 0x18 format (64 bit wide);

[63] valid, [62]: static, [61] age, [60:59]: priority, [60:48]: port
id, [47:0] mac.

where port id is either a numeric id in case of single cast, and a
bitmask for multicast addresses. Note there is no VID field.

BCM63XX:

2 ARL table entries at 0x10 and 0x20 (64 + 16 bit wide), format

0x?0: (64 bit)
[60:48]: vid [47:0] mac.
0x?8 (16 bit):
[15]: valid [14]: static, [13]  age [12:10]: priority. [8:0] port id /
forward map.

where port id is either a numeric id in case of single cast, and a
bitmask for multicast addresses. Note there is no VID field.

BCM539x:

4 ARL table entries at 0x10/0x20/0x30/0x40, format:
0x?0: (64 bit)
[60:48]: vid [47:0] mac.
0x?8 (32 bit):
[16]: valid [15]: static, [14]  age [12:10]: priority. [8:0] port id /
forward map.

where port id is either a numeric id in case of single cast, and a
bitmask for multicast addresses. Note there is no VID field.

BCM531xx:

4 ARL table entries at 0x10/0x20/0x30/0x40, format:
0x?0: (64 bit)
[60:48]: vid [47:0] mac.
0x?8 (32 bit):
[16]: valid [15]: static, [14]  age [13:11]: priority. [8:0] port id /
forward map.

At least for BCM53101 the portid /forward map is always a bitmap, but
I'm not sure about BCM53115/53118/53125/53125.


Generally it would be nice to also have the option to just search for
a MAC to find out the ports/vid(s) with the ARL sarch register. But
more to this in a second email.


Jonas
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list