器件型号: TDA4VH-Q1
您好、
我们在带有 SDK 11 的本机以太网配置和交换机模式中使用 CPSW9G。
我们使标志 AM65_CPSW_CTL_VLAN_Aware 处于活动状态、对于内核、我们将 VLAN_filtering 设置为 on。
我们的每个流量都使用单独的 VID 进行计算、我们不想使用默认 VID。 某些 VLAN 必须使用未标记的出口。
如果我们在 VLAN 接口上将数据包发送出去、内核将取消对数据包的标记(如使用未标记的出口配置)、并将其移交给交换机的内部主机端口。
交换机硬件现在继续在主机端口(未配置,但在交换机驱动程序中进行硬编码)上使用 VID 1 标记数据包、并在具有 VID 1 的物理端口上将该数据包发送出去(因为未配置未标记为 VID 1 的出口)。 这是非常不寻常和意外的行为、但可以或多或少地通过配置和驱动程序代码来解释。
我们的解决方案是在内核中禁用 VLAN_filtering、并让交换机硬件执行所有标记、取消标记和 VLAN 转发。 不幸的是、交换机硬件的行为并不像我们期望的那样。
如果我们将一个端口配置为使用 VID 2、将另一个端口配置为使用 VID 10、则这两个端口都可以通过未在端口上配置的 VID 接收数据包。 具有未知 VID 的数据包在进入时被丢弃(rx_port_mask_drop 增加)。
在出口上、这两个端口都允许发送任何 VID。 即使是完全没有配置的 VLAN。
打开或关闭 VLAN_FILTER 可以观察到这一点。 这让我想到、这是一个基本的交换机硬件问题。
这是发生在广播、多播和单播。
P3 - xg19
p5 - xf2
#!/bin/bash
devlink dev param set platform/c000000.ethernet name switch_mode value true cmode runtime
ip link add name switch type bridge
ip link set dev switch type bridge ageing_time 1000 vlan_default_pvid 0
ip link set dev xf2 up
ip link set dev xg19 up
ip link set dev switch up
ip link set dev xf2 master switch
ip link set dev xg19 master switch
ip link set dev switch type bridge vlan_filtering 0
#ip link set dev switch type bridge vlan_filtering 1
bridge vlan add dev switch vid 10 self
bridge vlan add dev switch vid 2 self
bridge vlan add dev xf2 vid 10 master
bridge vlan add dev xg19 vid 2 pvid untagged master
ip link set dev switch up
ip link add link switch name iface1 type vlan id 10
ip link set dev iface1 up
ip addr add "172.16.0.129/24" dev iface1
ip link add link switch name iface2 type vlan id 2
ip link set dev iface2 up
ip addr add "192.168.0.1/24" dev iface2
port vlan-id
xg19 2 PVID Egress Untagged
xf2 10
switch 2
10
Number of ALE entries: 512
0: Type: Inner VLAN
Nolearn Mask = 0x0, Ingress Check = 0
VLAN ID = 0, Registered Mask = 0x7f, No Frag = 0
Force Untagged Packet Egress = 0x7f, Limit Next Header Control = 0, Unregistered Mask = 0x7f, Members = 0x7f
1: Type: Multicast
Address = 01:80:c2:00:00:00, Multicast_State = Blocking/Forwarding/Learning, Super, port_mask = 0x1
2: Type: Unicast
VID = 1, Address = 00:60:c8:63:07:95, Unicast_type = Persistent, port_num = 0x0, Secure = 1, Blocked = 1, Touch = 0, Agable = 0
3: Type: Multicast
VID = 1, Address = ff:ff:ff:ff:ff:ff, Multicast_state = Forwarding, No Super, port_mask = 0x29
4: Type: Multicast
Address = 01:00:5e:00:00:01, Multicast_State = Forwarding, No Super, port_mask = 0x1
5: Type: Unicast
VID = 1, Address = 00:60:c8:63:07:96, Unicast_type = Persistent, port_num = 0x0, Secure = 1, Blocked = 1, Touch = 0, Agable = 0
6: Type: Inner VLAN
Nolearn Mask = 0x0, Ingress Check = 0
VLAN ID = 10, Registered Mask = 0x21, No Frag = 0
Force Untagged Packet Egress = 0x0, Limit Next Header Control = 0, Unregistered Mask = 0x1, Members = 0x21
7: Type: Unicast
VID = 10, Address = 00:60:c8:63:07:95, Unicast_type = Persistent, port_num = 0x0, Secure = 1, Blocked = 0, Touch = 0, Agable = 0
8: Type: Unicast
VID = 10, Address = 00:60:c8:63:07:96, Unicast_type = Persistent, port_num = 0x0, Secure = 1, Blocked = 0, Touch = 0, Agable = 0
9: Type: Inner VLAN
Nolearn Mask = 0x0, Ingress Check = 0
VLAN ID = 2, Registered Mask = 0x9, No Frag = 0
Force Untagged Packet Egress = 0x8, Limit Next Header Control = 0, Unregistered Mask = 0x1, Members = 0x9
10: Type: Unicast
VID = 2, Address = 00:60:c8:63:07:95, Unicast_type = Persistent, port_num = 0x0, Secure = 1, Blocked = 0, Touch = 0, Agable = 0
11: Type: Unicast
VID = 2, Address = 00:60:c8:63:07:96, Unicast_type = Persistent, port_num = 0x0, Secure = 1, Blocked = 0, Touch = 0, Agable = 0
12: Type: Multicast
VID = 0, Address = 01:00:5e:7f:ff:13, Multicast_state = Forwarding, No Super, port_mask = 0x1
查看驱动程序代码、似乎有几个寄存器可以解决此问题。
ALE_PORT_DROP_UNKNOWN_VLAN、ALE_PORT_UNKNOWN_VLAN_Member、ALE_PORT_UNKNOWN_MCAST_FLOSS、ALE_PORT_UNKNOWN_REG_MCAST_FLOSS
它们似乎都未在 CPSW9G 的驱动程序代码中设置。 ALE_PORT_DROP_UNKNOW_VLAN 仅用于 cpsw_new.c
我们是否误解了 CPSW9G 的功能? 这是预期行为吗?
此致、
Matthias
