Topic: Correctness of swconfig documentation

http://wiki.openwrt.org/doc/uci/network/switch wrote:

In the ports line, a number indicates that the specified vlan includes the port with that number. If the number is followed by a "t" or "*" then packets going out on that port are tagged.

Can anyone confirm that this is not strictly correct?

My understanding is that only "t" indicates that packets are tagged, and that "*" only indicates PVID as per the next section:

5 is generally the CPU or 'internal' port. If the number is followed by a "u" or not followed by anything the tag (e.g. vlan1) is removed when the packet goes out from that port. "*" also means that this vlan is the default vlan, so that a packet which is not tagged will be associated with this vlan.

This means that "3u", "3*" and "3u*" are meaningful with the latter two having the additional meaning that the PVID of port 3 is assigned this VLAN.

Re: Correctness of swconfig documentation

After some more poking around, I see that the documentation is incorrect.

Some detailed notes can be found in https://dev.openwrt.org/ticket/7268 and poking around in swlib.c.

Under switch_vlan, the option ports line only uses 't' to indicate if packets on this VLAN are tagged. The source code shows that all other suffixes (in particular '*' and 'u') are ignored. This example shows that port 4 belongs to VLAN 2 (VID is 2 by default, use option 'pvid' here to to override), and outbound packets are not tagged on this port.

config 'switch_vlan'

        option 'device' 'rtl8366rb'
        option 'vlan' '2'
        option 'ports' '4 5t'

To specify the PVID to be applied to all untagged packets received by a port, use option pvid under switch_port. This example shows port 4 is assigned a PVID of 2, meaning that untagged inbound packets on port 4 are assigned a VID of 2 (which was associated with VLAN 2 as shown above).

config 'switch_port'

        option 'port' '4'
        option 'pvid' '2'

Re: Correctness of swconfig documentation

The switch_port directive is not applicable to all drivers, in fact only to rtl8366s afaik.

4 (edited by KanjiMonster 2011-02-18 21:26:03)

Re: Correctness of swconfig documentation

jow wrote:

The switch_port directive is not applicable to all drivers, in fact only to rtl8366s afaik.

The Atheros switch drivers (should) also support the switch_port options, just with less options (iirc 'pvid' only (besides the port option wink, no led control or anything else).

quietdragon wrote:

After some more poking around, I see that the documentation is incorrect.

Under switch_vlan, the option ports line only uses 't' to indicate if packets on this VLAN are tagged. The source code shows that all other suffixes (in particular '*' and 'u') are ignored. This example shows that port 4 belongs to VLAN 2 (VID is 2 by default, use option 'pvid' here to to override), and outbound packets are not tagged on this port.

I think you are right, iirc the '*' is supported by broadcom kmod-switch style drivers only. It is used to set the default VLAN for untagged frames on a port.

Edit: Feel free to correct it, it's a wiki after all wink

Re: Correctness of swconfig documentation

KanjiMonster wrote:

Feel free to correct it, it's a wiki after all wink

Yeah, I wanted some feedback to see if I was on the right track to avoid confusing the issue even more.