Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

bridge: switchdev: Offload VLAN flags to hardware bridge

When VLANs are created / destroyed on a VLAN filtering bridge (MASTER
flag set), the configuration is passed down to the hardware. However,
when only the flags (e.g. PVID) are toggled, the configuration is done
in the software bridge alone.

While it is possible to pass these flags to hardware when invoked with
the SELF flag set, this creates inconsistency with regards to the way
the VLANs are initially configured.

Pass the flags down to the hardware even when the VLAN already exists
and only the flags are toggled.

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Ido Schimmel and committed by
David S. Miller
7fbac984 930b37ee

+11
+11
net/bridge/br_vlan.c
··· 955 955 */ 956 956 int nbp_vlan_add(struct net_bridge_port *port, u16 vid, u16 flags) 957 957 { 958 + struct switchdev_obj_port_vlan v = { 959 + .obj.orig_dev = port->dev, 960 + .obj.id = SWITCHDEV_OBJ_ID_PORT_VLAN, 961 + .flags = flags, 962 + .vid_begin = vid, 963 + .vid_end = vid, 964 + }; 958 965 struct net_bridge_vlan *vlan; 959 966 int ret; 960 967 ··· 969 962 970 963 vlan = br_vlan_find(nbp_vlan_group(port), vid); 971 964 if (vlan) { 965 + /* Pass the flags to the hardware bridge */ 966 + ret = switchdev_port_obj_add(port->dev, &v.obj); 967 + if (ret && ret != -EOPNOTSUPP) 968 + return ret; 972 969 __vlan_add_flags(vlan, flags); 973 970 return 0; 974 971 }