Commit 7fbac984 authored by Ido Schimmel's avatar Ido Schimmel Committed by David S. Miller

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: default avatarIdo Schimmel <idosch@mellanox.com>
Signed-off-by: default avatarJiri Pirko <jiri@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 930b37ee
...@@ -955,6 +955,13 @@ int nbp_vlan_init(struct net_bridge_port *p) ...@@ -955,6 +955,13 @@ int nbp_vlan_init(struct net_bridge_port *p)
*/ */
int nbp_vlan_add(struct net_bridge_port *port, u16 vid, u16 flags) int nbp_vlan_add(struct net_bridge_port *port, u16 vid, u16 flags)
{ {
struct switchdev_obj_port_vlan v = {
.obj.orig_dev = port->dev,
.obj.id = SWITCHDEV_OBJ_ID_PORT_VLAN,
.flags = flags,
.vid_begin = vid,
.vid_end = vid,
};
struct net_bridge_vlan *vlan; struct net_bridge_vlan *vlan;
int ret; int ret;
...@@ -962,6 +969,10 @@ int nbp_vlan_add(struct net_bridge_port *port, u16 vid, u16 flags) ...@@ -962,6 +969,10 @@ int nbp_vlan_add(struct net_bridge_port *port, u16 vid, u16 flags)
vlan = br_vlan_find(nbp_vlan_group(port), vid); vlan = br_vlan_find(nbp_vlan_group(port), vid);
if (vlan) { if (vlan) {
/* Pass the flags to the hardware bridge */
ret = switchdev_port_obj_add(port->dev, &v.obj);
if (ret && ret != -EOPNOTSUPP)
return ret;
__vlan_add_flags(vlan, flags); __vlan_add_flags(vlan, flags);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment