linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RFT] net: dsa: Allow configuring CPU port VLANs
@ 2018-06-24 15:33 Florian Fainelli
  2018-06-25  9:13 ` Petr Machata
  0 siblings, 1 reply; 11+ messages in thread
From: Florian Fainelli @ 2018-06-24 15:33 UTC (permalink / raw)
  To: netdev
  Cc: petrm, jiri, ilias.apalodimas, Florian Fainelli, Andrew Lunn,
	Vivien Didelot, David S. Miller, open list

Up until now there was no way to specifically target the VLAN attributes and
membership of the CPU port of a DSA switch. This forced drivers to either
always have the CPU port be "VLAN tagged" (b53) in every VLAN that gets added
to the front-panel/user facing ports, or when the switch supports it, use an
"unmodified" semantic (mv88e6xxx).

This is less than ideal because there are cases where we might not even want to
have the CPU port be part of the same VLAN than its user facing ports, e.g: to
isolate a group of noisy stations. There are also cases where we want to
control exactly how the CPU port receives VLAN traffic such that proper
separation/identification can occur.

Make this possible by flagging events targeting an orig_dev which is a bridge
master and using that as a hint to mean that we want to configure the
CPU/management port. This is compatible with multiple bridges over the same
switch in that, an user still has the responsibility to create separate
broadcast domains with separate VLAN databases/IDs per bridge.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
Andrew, Vivien,

Could you test this on mv88e6xxx to make sure there is no regression? Thanks

 net/dsa/port.c   | 4 ++--
 net/dsa/switch.c | 5 ++++-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/net/dsa/port.c b/net/dsa/port.c
index ed0595459df1..37385e491117 100644
--- a/net/dsa/port.c
+++ b/net/dsa/port.c
@@ -253,7 +253,7 @@ int dsa_port_vlan_add(struct dsa_port *dp,
 	};
 
 	if (netif_is_bridge_master(vlan->obj.orig_dev))
-		return -EOPNOTSUPP;
+		info.port = dp->cpu_dp->index;
 
 	if (br_vlan_enabled(dp->bridge_dev))
 		return dsa_port_notify(dp, DSA_NOTIFIER_VLAN_ADD, &info);
@@ -271,7 +271,7 @@ int dsa_port_vlan_del(struct dsa_port *dp,
 	};
 
 	if (netif_is_bridge_master(vlan->obj.orig_dev))
-		return -EOPNOTSUPP;
+		info.port = dp->cpu_dp->index;
 
 	if (br_vlan_enabled(dp->bridge_dev))
 		return dsa_port_notify(dp, DSA_NOTIFIER_VLAN_DEL, &info);
diff --git a/net/dsa/switch.c b/net/dsa/switch.c
index b93511726069..d69bcc8f9ba2 100644
--- a/net/dsa/switch.c
+++ b/net/dsa/switch.c
@@ -211,8 +211,11 @@ static int dsa_switch_vlan_add(struct dsa_switch *ds,
 	bitmap_zero(members, ds->num_ports);
 	if (ds->index == info->sw_index)
 		set_bit(info->port, members);
+	/* CPU port is configured via dsa_port_vlan_add() with events
+	 * targeting the bridge device
+	 */
 	for (port = 0; port < ds->num_ports; port++)
-		if (dsa_is_cpu_port(ds, port) || dsa_is_dsa_port(ds, port))
+		if (dsa_is_dsa_port(ds, port))
 			set_bit(port, members);
 
 	if (switchdev_trans_ph_prepare(trans))
-- 
2.14.1


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

end of thread, other threads:[~2018-08-29  7:14 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-24 15:33 [PATCH RFT] net: dsa: Allow configuring CPU port VLANs Florian Fainelli
2018-06-25  9:13 ` Petr Machata
2018-06-25  9:17   ` Ilias Apalodimas
2018-08-10 23:58     ` Florian Fainelli
2018-08-14 18:17       ` Petr Machata
2018-08-14 18:30         ` Florian Fainelli
2018-08-28  8:32       ` Ilias Apalodimas
2018-08-28 16:58         ` Florian Fainelli
2018-08-28 19:08           ` Maxim Uvarov
2018-08-28 19:17             ` Florian Fainelli
2018-08-29  7:14               ` Maxim Uvarov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).