Subject: Re: am335x: no multicast reception over VLAN

From: Mugunthan V N <[email-masked]>
Date: Tue, 5 Apr 2016 11:41:53 +0530

On Friday 01 April 2016 05:39 PM, Grygorii Strashko wrote:
> On 03/31/2016 10:52 AM, Yegor Yefremov wrote:
>> On Thu, Mar 31, 2016 at 8:37 AM, Mugunthan V N <[email-masked]> wrote:
>>> On Thursday 31 March 2016 01:17 AM, Peter Korsgaard wrote:
>>>>>>>>> "Mugunthan" == Mugunthan V N <[email-masked]> writes:
>>>>
>>>> Hi,
>>>>
>>>>   > You had received these packets as tcpdump will enable promiscuous mode
>>>>   > so that you receive all the packets from the wire.
>>>>
>>>> FYI, you can use the -p option to tcpdump to not put the interface into
>>>> promiscuous mode.
>>>>
>>>
>>> Thanks for the information Peter Korsgaard.
>>>
>>> Yegor, can you provide tcpdump using -p as well in Grygorii commands.
>>
>> Before VLAN configuration:
>>
>> # switch-config -d
>> cpsw hw version 1.12 (0)
>> 0   : type: vlan , vid = 1, untag_force = 0x3, reg_mcast = 0x3,
>> unreg_mcast = 0x0, member_list = 0x3
>> 1   : type: mcast, vid = 1, addr = ff:ff:ff:ff:ff:ff, mcast_state = f,
>> no super, port_mask = 0x3
>> 2   : type: ucast, vid = 1, addr = 74:6a:8f:00:16:12, ucast_type =
>> persistant, port_num = 0x0, Secure
>> 3   : type: vlan , vid = 0, untag_force = 0x7, reg_mcast = 0x0,
>> unreg_mcast = 0x0, member_list = 0x7
>> 4   : type: mcast, vid = 1, addr = 01:00:5e:00:00:01, mcast_state = f,
>> no super, port_mask = 0x3
>> 5   : type: vlan , vid = 2, untag_force = 0x5, reg_mcast = 0x5,
>> unreg_mcast = 0x0, member_list = 0x5
>> 6   : type: mcast, vid = 2, addr = ff:ff:ff:ff:ff:ff, mcast_state = f,
>> no super, port_mask = 0x5
>> 7   : type: ucast, vid = 2, addr = 74:6a:8f:00:16:13, ucast_type =
>> persistant, port_num = 0x0, Secure
>> 8   : type: mcast, vid = 2, addr = 01:00:5e:00:00:01, mcast_state = f,
>> no super, port_mask = 0x5
>>
>> After VLAN configuration:
>>
>> # switch-config -d
>> cpsw hw version 1.12 (0)
>> 0   : type: vlan , vid = 1, untag_force = 0x3, reg_mcast = 0x3,
>> unreg_mcast = 0x0, member_list = 0x3
>> 1   : type: mcast, vid = 1, addr = ff:ff:ff:ff:ff:ff, mcast_state = f,
>> no super, port_mask = 0x3
>> 2   : type: ucast, vid = 1, addr = 74:6a:8f:00:16:12, ucast_type =
>> persistant, port_num = 0x0, Secure
>> 3   : type: vlan , vid = 0, untag_force = 0x7, reg_mcast = 0x0,
>> unreg_mcast = 0x0, member_list = 0x7
>> 4   : type: mcast, vid = 1, addr = 01:00:5e:00:00:01, mcast_state = f,
>> no super, port_mask = 0x3
>> 5   : type: vlan , vid = 2, untag_force = 0x5, reg_mcast = 0x5,
>> unreg_mcast = 0x0, member_list = 0x5
>> 6   : type: mcast, vid = 2, addr = ff:ff:ff:ff:ff:ff, mcast_state = f,
>> no super, port_mask = 0x5
>> 7   : type: ucast, vid = 2, addr = 74:6a:8f:00:16:13, ucast_type =
>> persistant, port_num = 0x0, Secure
>> 8   : type: mcast, vid = 2, addr = 01:00:5e:00:00:01, mcast_state = f,
>> no super, port_mask = 0x5
>> 9   : type: vlan , vid = 100, untag_force = 0x0, reg_mcast = 0x5,
>> unreg_mcast = 0x0, member_list = 0x5
>> 10  : type: ucast, vid = 100, addr = 74:6a:8f:00:16:13, ucast_type =
>> persistant, port_num = 0x0
>> 11  : type: mcast, vid = 100, addr = ff:ff:ff:ff:ff:ff, mcast_state =
>> f, no super, port_mask = 0x5
>> 12  : type: mcast, vid = 2, addr = 01:80:c2:00:00:21, mcast_state = f,
>> no super, port_mask = 0x5
>>
>> During mulitcast receive:
>>
>> # switch-config -d
>> cpsw hw version 1.12 (0)
>> 0   : type: vlan , vid = 1, untag_force = 0x3, reg_mcast = 0x3, unreg_mcast = 0x0, member_list = 0x3
>> 1   : type: mcast, vid = 1, addr = ff:ff:ff:ff:ff:ff, mcast_state = f, no super, port_mask = 0x3
>> 2   : type: ucast, vid = 1, addr = 74:6a:8f:00:16:12, ucast_type = persistant, port_num = 0x0, Secure
>> 3   : type: vlan , vid = 0, untag_force = 0x7, reg_mcast = 0x0, unreg_mcast = 0x0, member_list = 0x7
> 
> unreg_mcast = 0x0 means unregistered multicast packets will be dropped
> 
>> 4   : type: mcast, vid = 1, addr = 01:00:5e:00:00:01, mcast_state = f, no super, port_mask = 0x3
>> 5   : type: vlan , vid = 2, untag_force = 0x5, reg_mcast = 0x5, unreg_mcast = 0x0, member_list = 0x5
> 
> unreg_mcast = 0x0 
> 
>> 6   : type: mcast, vid = 2, addr = ff:ff:ff:ff:ff:ff, mcast_state = f, no super, port_mask = 0x5
>> 7   : type: ucast, vid = 2, addr = 74:6a:8f:00:16:13, ucast_type = persistant, port_num = 0x0, Secure
>> 8   : type: mcast, vid = 2, addr = 01:00:5e:00:00:01, mcast_state = f, no super, port_mask = 0x5
>> 9   : type: vlan , vid = 100, untag_force = 0x0, reg_mcast = 0x5, unreg_mcast = 0x0, member_list = 0x5
> 
> unreg_mcast = 0x0 
> 
>> 10  : type: ucast, vid = 100, addr = 74:6a:8f:00:16:13, ucast_type = persistant, port_num = 0x0
>> 11  : type: mcast, vid = 100, addr = ff:ff:ff:ff:ff:ff, mcast_state = f, no super, port_mask = 0x5
>> 12  : type: mcast, vid = 2, addr = 01:80:c2:00:00:21, mcast_state = f, no super, port_mask = 0x5
>> 13  : type: mcast, vid = 2, addr = 01:00:5e:03:1d:47, mcast_state = f, no super, port_mask = 0x5
> 
> This is requested mcast address, but it's registered for vid=2 (propagated through .ndo_set_rx_mode())
> 
>> 14  : type: ucast, vid = 100, addr = 66:22:04:bc:90:26, ucast_type = untouched , port_num = 0x2
> 
> [...]
>>
>> Both tcpdumps with -p option showed no packets. If I execute ping, I
>> can see related ICMP packets. addr = 66:22:04:bc:90:26 is PandaBoards
>> MAC.
>>
>> Btw I've attached my test scripts (mcastr.py - multicast receiver and
>> mcastt.py - multicast transmitter). Could you reproduce my setup?
>>
> 
> I was able to reproduce an issue with your script. As I understand, when cpsw receive the
> mcast packet with dst_address=01:00:5e:03:1d:47 and vid=100 it hits
> the case:
> "if (Multicast packet) # destination address not found
> then portmask is the logical “AND” of unreg_mcast_flood_mask and vlan_member_list
> then goto Egress process"
> 
> and as result packet is dropped (you can check eth1 statistic # ethtool -S eth1).
> 
> Unfortunately, I was no able to configure mcast address properly in dual mac mode :(,
> but probably Mugunthan can comment here - mcast addressess are offloaded to cpsw from

I was able to add mcast address for eth0/eth1, but not finding a way to
add mcast entries to eth1.100 interface. I gone through Linux network
stack and didn't find a way where stack asks the driver to add mcast
address for vlan interfaces. *_Network Experts_* can help us here.

> Net core through  .ndo_set_rx_mode() and struct netdev_hw_addr doesn't contain any
> information about vlan and cpsw uses default port vlan, which is vid=2 for eth1 in 
> dual mac mode.
>  
> 
> 
> As W/A the allmulti flag can be used:
> 
> # ifconfig eth1.100 allmulti 

For now this is the only possible option that can be used.

Regards
Mugunthan V N