[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ebb3f4f8-0f71-094b-e997-ffcd769d6e48@gmail.com>
Date: Mon, 11 May 2020 20:35:38 -0700
From: Florian Fainelli <f.fainelli@...il.com>
To: Vladimir Oltean <olteanv@...il.com>, andrew@...n.ch,
vivien.didelot@...il.com
Cc: davem@...emloft.net, kuba@...nel.org, jiri@...lanox.com,
idosch@...sch.org, rmk+kernel@...linux.org.uk,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 net-next 09/15] net: dsa: tag_8021q: support up to 8
VLANs per port using sub-VLANs
On 5/11/2020 6:53 AM, Vladimir Oltean wrote:
> From: Vladimir Oltean <vladimir.oltean@....com>
>
> For switches that support VLAN retagging, such as sja1105, we extend
> dsa_8021q by encoding a "sub-VLAN" into the remaining 3 free bits in the
> dsa_8021q tag.
>
> A sub-VLAN is nothing more than a number in the range 0-7, which serves
> as an index into a per-port driver lookup table. The sub-VLAN value of
> zero means that traffic is untagged (this is also backwards-compatible
> with dsa_8021q without retagging).
>
> The switch should be configured to retag VLAN-tagged traffic that gets
> transmitted towards the CPU port (and towards the CPU only). Example:
>
> bridge vlan add dev sw1p0 vid 100
>
> The switch retags frames received on port 0, going to the CPU, and
> having VID 100, to the VID of 1104 (0x0450). In dsa_8021q language:
>
> | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
> +-----------+-----+-----------------+-----------+-----------------------+
> | DIR | SVL | SWITCH_ID | SUBVLAN | PORT |
> +-----------+-----+-----------------+-----------+-----------------------+
>
> 0x0450 means:
> - DIR = 0b01: this is an RX VLAN
> - SUBVLAN = 0b001: this is subvlan #1
> - SWITCH_ID = 0b001: this is switch 1 (see the name "sw1p0")
> - PORT = 0b0000: this is port 0 (see the name "sw1p0")
>
> The driver also remembers the "1 -> 100" mapping. In the hotpath, if the
> sub-VLAN from the tag encodes a non-untagged frame, this mapping is used
> to create a VLAN hwaccel tag, with the value of 100.
>
> Signed-off-by: Vladimir Oltean <vladimir.oltean@....com>
Reviewed-by: Florian Fainelli <f.fainelli@...il.com>
--
Florian
Powered by blists - more mailing lists