mbox series

[net-next,v2,0/6] net: dsa: explicit programmation of VLAN on CPU ports

Message ID 20190825172520.22798-1-vivien.didelot@gmail.com
Headers show
Series net: dsa: explicit programmation of VLAN on CPU ports | expand

Message

Vivien Didelot Aug. 25, 2019, 5:25 p.m. UTC
When a VLAN is programmed on a user port, every switch of the fabric also
program the CPU ports and the DSA links as part of the VLAN. To do that,
DSA makes use of bitmaps to prepare all members of a VLAN.

While this is expected for DSA links which are used as conduit between
interconnected switches, only the dedicated CPU port of the slave must be
programmed, not all CPU ports of the fabric. This may also cause problems in
other corners of DSA such as the tag_8021q.c driver, which needs to program
its ports manually, CPU port included.

We need the dsa_port_vlan_{add,del} functions and its dsa_port_vid_{add,del}
variants to simply trigger the VLAN programmation without any logic in them,
but they may currently skip the operation based on the bridge device state.

This patchset gets rid of the bitmap operations, and moves the bridge device
check as well as the explicit programmation of CPU ports where they belong,
in the slave code.

While at it, clear the VLAN flags before programming a CPU port, as it
doesn't make sense to forward the PVID flag for example for such ports.

Changes in v2: only clear the PVID flag.

Vivien Didelot (6):
  net: dsa: remove bitmap operations
  net: dsa: do not skip -EOPNOTSUPP in dsa_port_vid_add
  net: dsa: add slave VLAN helpers
  net: dsa: check bridge VLAN in slave operations
  net: dsa: program VLAN on CPU port from slave
  net: dsa: clear VLAN PVID flag for CPU port

 include/net/dsa.h |   3 --
 net/dsa/dsa2.c    |  14 -----
 net/dsa/port.c    |  14 ++---
 net/dsa/slave.c   |  79 +++++++++++++++++++++++----
 net/dsa/switch.c  | 135 +++++++++++++++++++++-------------------------
 5 files changed, 136 insertions(+), 109 deletions(-)

Comments

Vladimir Oltean Aug. 25, 2019, 6:27 p.m. UTC | #1
On Sun, 25 Aug 2019 at 20:25, Vivien Didelot <vivien.didelot@gmail.com> wrote:
>
> When a VLAN is programmed on a user port, every switch of the fabric also
> program the CPU ports and the DSA links as part of the VLAN. To do that,
> DSA makes use of bitmaps to prepare all members of a VLAN.
>
> While this is expected for DSA links which are used as conduit between
> interconnected switches, only the dedicated CPU port of the slave must be
> programmed, not all CPU ports of the fabric. This may also cause problems in
> other corners of DSA such as the tag_8021q.c driver, which needs to program
> its ports manually, CPU port included.
>
> We need the dsa_port_vlan_{add,del} functions and its dsa_port_vid_{add,del}
> variants to simply trigger the VLAN programmation without any logic in them,
> but they may currently skip the operation based on the bridge device state.
>
> This patchset gets rid of the bitmap operations, and moves the bridge device
> check as well as the explicit programmation of CPU ports where they belong,
> in the slave code.
>
> While at it, clear the VLAN flags before programming a CPU port, as it
> doesn't make sense to forward the PVID flag for example for such ports.
>
> Changes in v2: only clear the PVID flag.
>
> Vivien Didelot (6):
>   net: dsa: remove bitmap operations
>   net: dsa: do not skip -EOPNOTSUPP in dsa_port_vid_add
>   net: dsa: add slave VLAN helpers
>   net: dsa: check bridge VLAN in slave operations
>   net: dsa: program VLAN on CPU port from slave
>   net: dsa: clear VLAN PVID flag for CPU port
>
>  include/net/dsa.h |   3 --
>  net/dsa/dsa2.c    |  14 -----
>  net/dsa/port.c    |  14 ++---
>  net/dsa/slave.c   |  79 +++++++++++++++++++++++----
>  net/dsa/switch.c  | 135 +++++++++++++++++++++-------------------------
>  5 files changed, 136 insertions(+), 109 deletions(-)
>
> --
> 2.23.0
>

For the whole series:
Tested-by: Vladimir Oltean <olteanv@gmail.com>
Thanks!
David Miller Aug. 28, 2019, 3:17 a.m. UTC | #2
From: Vladimir Oltean <olteanv@gmail.com>
Date: Sun, 25 Aug 2019 21:27:23 +0300

> On Sun, 25 Aug 2019 at 20:25, Vivien Didelot <vivien.didelot@gmail.com> wrote:
>>
>> When a VLAN is programmed on a user port, every switch of the fabric also
>> program the CPU ports and the DSA links as part of the VLAN. To do that,
>> DSA makes use of bitmaps to prepare all members of a VLAN.
>>
>> While this is expected for DSA links which are used as conduit between
>> interconnected switches, only the dedicated CPU port of the slave must be
>> programmed, not all CPU ports of the fabric. This may also cause problems in
>> other corners of DSA such as the tag_8021q.c driver, which needs to program
>> its ports manually, CPU port included.
>>
>> We need the dsa_port_vlan_{add,del} functions and its dsa_port_vid_{add,del}
>> variants to simply trigger the VLAN programmation without any logic in them,
>> but they may currently skip the operation based on the bridge device state.
>>
>> This patchset gets rid of the bitmap operations, and moves the bridge device
>> check as well as the explicit programmation of CPU ports where they belong,
>> in the slave code.
>>
>> While at it, clear the VLAN flags before programming a CPU port, as it
>> doesn't make sense to forward the PVID flag for example for such ports.
>>
>> Changes in v2: only clear the PVID flag.
 ...
> For the whole series:
> Tested-by: Vladimir Oltean <olteanv@gmail.com>
> Thanks!

Series applied.