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

Jonas Gorski jogo at openwrt.org
Tue Mar 10 08:22:26 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
>     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.

ARL table access is something very common in switch chips, I think it
would make more sense to come up with an API for swconfig for the
switches to implement that instead of cooking up our own language for
each switch driver.

So generally I am thinking of something like

swconfig dev switch0 arl find <mac> [vid <vid]
swconfig dev switch0 arl delete <mac> [vid <vid>]
swconfig dev switch0 arl add <mac> [vid <vid>] [ports <ports>] [static <0|1>]
swconfig dev switch0 arl add_port <mac> [vid <vid>] port <port> <-
this might be useful for igmpproxy & co, to update multicast
forwarding tables in the switch itself.
swconfig dev switch0 arl del_port <mac> [vid <vid>] port <port>

openwrt-devel mailing list
openwrt-devel at lists.openwrt.org

More information about the openwrt-devel mailing list