All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch net-next] bridge: switchdev: Offload VLAN flags to hardware bridge
@ 2016-02-18 13:01 Jiri Pirko
  2016-02-18 16:18 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Jiri Pirko @ 2016-02-18 13:01 UTC (permalink / raw)
  To: netdev; +Cc: davem, idosch, eladr, yotamg, ogerlitz, roopa, nikolay

From: Ido Schimmel <idosch@mellanox.com>

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>
---
 net/bridge/br_vlan.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/net/bridge/br_vlan.c b/net/bridge/br_vlan.c
index 85e43af..9309bb4 100644
--- a/net/bridge/br_vlan.c
+++ b/net/bridge/br_vlan.c
@@ -955,6 +955,13 @@ err_rhtbl:
  */
 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;
 	int ret;
 
@@ -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);
 	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);
 		return 0;
 	}
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [patch net-next] bridge: switchdev: Offload VLAN flags to hardware bridge
  2016-02-18 13:01 [patch net-next] bridge: switchdev: Offload VLAN flags to hardware bridge Jiri Pirko
@ 2016-02-18 16:18 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2016-02-18 16:18 UTC (permalink / raw)
  To: jiri; +Cc: netdev, idosch, eladr, yotamg, ogerlitz, roopa, nikolay

From: Jiri Pirko <jiri@resnulli.us>
Date: Thu, 18 Feb 2016 14:01:46 +0100

> From: Ido Schimmel <idosch@mellanox.com>
> 
> 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>

Applied, thanks guys.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-02-18 16:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-18 13:01 [patch net-next] bridge: switchdev: Offload VLAN flags to hardware bridge Jiri Pirko
2016-02-18 16:18 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.