mbox series

[RFC,net-next,0/4] net: ethernet: ti: cpsw: fix vlan mcast

Message ID 20181016182035.18234-1-ivan.khoronzhuk@linaro.org (mailing list archive)
Headers show
Series net: ethernet: ti: cpsw: fix vlan mcast | expand

Message

Ivan Khoronzhuk Oct. 16, 2018, 6:20 p.m. UTC
The cpsw holds separate mcast entires for vlan entries. At this moment
driver adds only not vlan mcast addresses, omitting vlan/mcast entries.
As result mcast for vlans doesn't work. It can be fixed by adding same
mcast entries for every created vlan, but this patchseries uses more
sophisticated way and allows to create mcast entries only for vlans
that really require it. Generic functions from this series can be
reused for fixing vlan and macvlan unicast.

Simple example of ALE table before and after this series, having same
mcast entries as for vlan 100 as for real device (reserved vlan 2),
and one mcast address only for vlan 100 - 01:1b:19:00:00:00.

<---- Before this patchset ---->
vlan , vid = 2, untag_force = 0x5, reg_mcast = 0x5, mem_list = 0x5
mcast, vid = 2, addr = ff:ff:ff:ff:ff:ff, port_mask = 0x1
ucast, vid = 2, addr = 74:da:ea:47:7d:9d, persistant, port_num = 0x0
vlan , vid = 0, untag_force = 0x7, reg_mcast = 0x0, mem_list = 0x7
mcast, vid = 2, addr = 33:33:00:00:00:01, port_mask = 0x1
mcast, vid = 2, addr = 01:00:5e:00:00:01, port_mask = 0x1
vlan , vid = 1, untag_force = 0x3, reg_mcast = 0x3, mem_list = 0x3
mcast, vid = 1, addr = ff:ff:ff:ff:ff:ff, port_mask = 0x1
ucast, vid = 1, addr = 74:da:ea:47:7d:9c, persistant, port_num = 0x0
mcast, vid = 1, addr = 33:33:00:00:00:01, port_mask = 0x1
mcast, vid = 1, addr = 01:00:5e:00:00:01, port_mask = 0x1
mcast, vid = 2, addr = 01:80:c2:00:00:00, port_mask = 0x1
mcast, vid = 2, addr = 01:80:c2:00:00:03, port_mask = 0x1
mcast, vid = 2, addr = 01:80:c2:00:00:0e, port_mask = 0x1
mcast, vid = 1, addr = 01:80:c2:00:00:00, port_mask = 0x1
mcast, vid = 1, addr = 01:80:c2:00:00:03, port_mask = 0x1
mcast, vid = 1, addr = 01:80:c2:00:00:0e, port_mask = 0x1
mcast, vid = 2, addr = 33:33:ff:47:7d:9d, port_mask = 0x1
mcast, vid = 2, addr = 33:33:00:00:00:fb, port_mask = 0x1
mcast, vid = 2, addr = 33:33:00:01:00:03, port_mask = 0x1
mcast, vid = 1, addr = 33:33:ff:47:7d:9c, port_mask = 0x1
mcast, vid = 1, addr = 33:33:00:00:00:fb, port_mask = 0x1
mcast, vid = 1, addr = 33:33:00:01:00:03, port_mask = 0x1
mcast, vid = 1, addr = 01:00:5e:00:00:fb, port_mask = 0x1
mcast, vid = 1, addr = 01:00:5e:00:00:fc, port_mask = 0x1
vlan , vid = 100, untag_force = 0x0, reg_mcast = 0x5, mem_list = 0x5
ucast, vid = 100, addr = 74:da:ea:47:7d:9d, persistant, port_num = 0x0
mcast, vid = 100, addr = ff:ff:ff:ff:ff:ff, port_mask = 0x1
mcast, vid = 2, addr = 01:1b:19:00:00:00, port_mask = 0x1
			 ^^^
 Here mcast entry (ptpl2), has to be added only for vlan 100
 but added for reserved vlan 2...that's not enough.

<---- After this patchset ---->
vlan , vid = 2, untag_force = 0x5, reg_mcast = 0x5, mem_list = 0x5
mcast, vid = 2, addr = ff:ff:ff:ff:ff:ff, port_mask = 0x1
ucast, vid = 2, addr = 74:da:ea:47:7d:9d, persistant, port_num = 0x0
vlan , vid = 0, untag_force = 0x7, reg_mcast = 0x0, mem_list = 0x7
mcast, vid = 2, addr = 33:33:00:00:00:01, port_mask = 0x1
mcast, vid = 2, addr = 01:00:5e:00:00:01, port_mask = 0x1
vlan , vid = 1, untag_force = 0x3, reg_mcast = 0x3, mem_list = 0x3
mcast, vid = 1, addr = ff:ff:ff:ff:ff:ff, port_mask = 0x1
ucast, vid = 1, addr = 74:da:ea:47:7d:9c, persistant, port_num = 0x0
mcast, vid = 1, addr = 33:33:00:00:00:01, port_mask = 0x1
mcast, vid = 1, addr = 01:00:5e:00:00:01, port_mask = 0x1
mcast, vid = 2, addr = 01:80:c2:00:00:00, port_mask = 0x1
mcast, vid = 2, addr = 01:80:c2:00:00:03, port_mask = 0x1
mcast, vid = 2, addr = 01:80:c2:00:00:0e, port_mask = 0x1
mcast, vid = 1, addr = 01:80:c2:00:00:00, port_mask = 0x1
mcast, vid = 1, addr = 01:80:c2:00:00:03, port_mask = 0x1
mcast, vid = 1, addr = 01:80:c2:00:00:0e, port_mask = 0x1
mcast, vid = 2, addr = 33:33:ff:47:7d:9d, port_mask = 0x1
mcast, vid = 1, addr = 33:33:ff:47:7d:9c, port_mask = 0x1
mcast, vid = 2, addr = 33:33:00:00:00:fb, port_mask = 0x1
mcast, vid = 2, addr = 33:33:00:01:00:03, port_mask = 0x1
mcast, vid = 1, addr = 33:33:00:00:00:fb, port_mask = 0x1
mcast, vid = 1, addr = 33:33:00:01:00:03, port_mask = 0x1
vlan , vid = 100, untag_force = 0x0, reg_mcast = 0x5, mem_list = 0x5
ucast, vid = 100, addr = 74:da:ea:47:7d:9d, persistant, port_num = 0x0
mcast, vid = 100, addr = ff:ff:ff:ff:ff:ff, port_mask = 0x1
mcast, vid = 100, addr = 33:33:00:00:00:01, port_mask = 0x1
mcast, vid = 100, addr = 01:00:5e:00:00:01, port_mask = 0x1
mcast, vid = 100, addr = 33:33:ff:47:7d:9d, port_mask = 0x1
mcast, vid = 100, addr = 01:80:c2:00:00:00, port_mask = 0x1
mcast, vid = 100, addr = 01:80:c2:00:00:03, port_mask = 0x1
mcast, vid = 100, addr = 01:80:c2:00:00:0e, port_mask = 0x1
mcast, vid = 100, addr = 33:33:00:00:00:fb, port_mask = 0x1
mcast, vid = 100, addr = 33:33:00:01:00:03, port_mask = 0x1
mcast, vid = 100, addr = 01:1b:19:00:00:00, port_mask = 0x1
			 ^^^
    Here mcast entry (ptpl2), is added only for vlan 100
    as it should be.

Based on net-next/master

Ivan Khoronzhuk (4):
  net: core: dev_addr_lists: add auxiliary func to handle reference
    address updates
  net: 8021q: vlan_core: allow use list of vlans for real device
  net: ethernet: ti: cpsw: fix vlan mcast
  net: ethernet: ti: cpsw: fix vlan configuration while down/up

 drivers/net/ethernet/ti/cpsw.c | 189 +++++++++++++++++++++++++++------
 include/linux/if_vlan.h        |  10 ++
 include/linux/netdevice.h      |  10 ++
 net/8021q/vlan_core.c          |  27 +++++
 net/core/dev_addr_lists.c      |  97 +++++++++++++++++
 5 files changed, 303 insertions(+), 30 deletions(-)

Comments

Grygorii Strashko Oct. 16, 2018, 7:38 p.m. UTC | #1
On 10/16/2018 01:20 PM, Ivan Khoronzhuk wrote:
> The cpsw holds separate mcast entires for vlan entries. At this moment
> driver adds only not vlan mcast addresses, omitting vlan/mcast entries.
> As result mcast for vlans doesn't work. It can be fixed by adding same
> mcast entries for every created vlan, but this patchseries uses more
> sophisticated way and allows to create mcast entries only for vlans
> that really require it. Generic functions from this series can be
> reused for fixing vlan and macvlan unicast.

I assume this is first of all for dual_mac mode.

> 
> Simple example of ALE table before and after this series, having same
> mcast entries as for vlan 100 as for real device (reserved vlan 2),
> and one mcast address only for vlan 100 - 01:1b:19:00:00:00.
> 
[...]

> vlan , vid = 100, untag_force = 0x0, reg_mcast = 0x5, mem_list = 0x5
> ucast, vid = 100, addr = 74:da:ea:47:7d:9d, persistant, port_num = 0x0
> mcast, vid = 100, addr = ff:ff:ff:ff:ff:ff, port_mask = 0x1
> mcast, vid = 100, addr = 33:33:00:00:00:01, port_mask = 0x1
> mcast, vid = 100, addr = 01:00:5e:00:00:01, port_mask = 0x1
> mcast, vid = 100, addr = 33:33:ff:47:7d:9d, port_mask = 0x1
> mcast, vid = 100, addr = 01:80:c2:00:00:00, port_mask = 0x1
> mcast, vid = 100, addr = 01:80:c2:00:00:03, port_mask = 0x1
> mcast, vid = 100, addr = 01:80:c2:00:00:0e, port_mask = 0x1
> mcast, vid = 100, addr = 33:33:00:00:00:fb, port_mask = 0x1
> mcast, vid = 100, addr = 33:33:00:01:00:03, port_mask = 0x1
> mcast, vid = 100, addr = 01:1b:19:00:00:00, port_mask = 0x1
> 			 ^^^
>      Here mcast entry (ptpl2), is added only for vlan 100
>      as it should be.
> 
> Based on net-next/master

Thank you.
For patches 2-4
Reviewed-by: Grygorii Strashko <grygorii.strashko@ti.com>

For patch 1 - I'm not sure, so it'd good to get more comments.

> 
> Ivan Khoronzhuk (4):
>    net: core: dev_addr_lists: add auxiliary func to handle reference
>      address updates
>    net: 8021q: vlan_core: allow use list of vlans for real device
>    net: ethernet: ti: cpsw: fix vlan mcast
>    net: ethernet: ti: cpsw: fix vlan configuration while down/up
> 
>   drivers/net/ethernet/ti/cpsw.c | 189 +++++++++++++++++++++++++++------
>   include/linux/if_vlan.h        |  10 ++
>   include/linux/netdevice.h      |  10 ++
>   net/8021q/vlan_core.c          |  27 +++++
>   net/core/dev_addr_lists.c      |  97 +++++++++++++++++
>   5 files changed, 303 insertions(+), 30 deletions(-)
>
Ivan Khoronzhuk Oct. 17, 2018, 8:11 p.m. UTC | #2
On Tue, Oct 16, 2018 at 02:38:33PM -0500, Grygorii Strashko wrote:
>
>
>On 10/16/2018 01:20 PM, Ivan Khoronzhuk wrote:
>>The cpsw holds separate mcast entires for vlan entries. At this moment
>>driver adds only not vlan mcast addresses, omitting vlan/mcast entries.
>>As result mcast for vlans doesn't work. It can be fixed by adding same
>>mcast entries for every created vlan, but this patchseries uses more
>>sophisticated way and allows to create mcast entries only for vlans
>>that really require it. Generic functions from this series can be
>>reused for fixing vlan and macvlan unicast.
>
>I assume this is first of all for dual_mac mode.
Mainly yes, but affects on switch mode also (and single port) adding
appropriate mcast entries.

-- Regards,
Ivan Khoronzhuk