netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vladimir Oltean <olteanv@gmail.com>
To: f.fainelli@gmail.com, vivien.didelot@gmail.com, andrew@lunn.ch,
	davem@davemloft.net
Cc: netdev@vger.kernel.org, Vladimir Oltean <olteanv@gmail.com>
Subject: [PATCH net-next 07/13] net: dsa: Keep the vlan_filtering setting in dsa_switch if it's global
Date: Sun, 28 Apr 2019 21:45:48 +0300	[thread overview]
Message-ID: <20190428184554.9968-8-olteanv@gmail.com> (raw)
In-Reply-To: <20190428184554.9968-1-olteanv@gmail.com>

The current behavior is not as obvious as one would assume (which is
that, if the driver set vlan_filtering_is_global = 1, then checking any
dp->vlan_filtering would yield the same result). Only the ports which
are actively enslaved into a bridge would have vlan_filtering set.

This makes it tricky for drivers to check what the global state is.
So fix this and make the struct dsa_switch hold this global setting.

Signed-off-by: Vladimir Oltean <olteanv@gmail.com>
---
 include/net/dsa.h | 5 +++++
 net/dsa/port.c    | 5 ++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/include/net/dsa.h b/include/net/dsa.h
index aab3c2029edd..4e0f7e9c5aa1 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -233,6 +233,11 @@ struct dsa_switch {
 	 */
 	bool			vlan_filtering_is_global;
 
+	/* In case vlan_filtering_is_global is set, the VLAN awareness state
+	 * should be retrieved from here and not from the per-port settings.
+	 */
+	bool			vlan_filtering;
+
 	unsigned long		*bitmap;
 	unsigned long		_bitmap;
 
diff --git a/net/dsa/port.c b/net/dsa/port.c
index 67bfad30cd40..555fdbf0a3f4 100644
--- a/net/dsa/port.c
+++ b/net/dsa/port.c
@@ -208,7 +208,10 @@ int dsa_port_vlan_filtering(struct dsa_port *dp, bool vlan_filtering,
 	if (err)
 		return err;
 
-	dp->vlan_filtering = vlan_filtering;
+	if (ds->vlan_filtering_is_global)
+		ds->vlan_filtering = vlan_filtering;
+	else
+		dp->vlan_filtering = vlan_filtering;
 	return 0;
 }
 
-- 
2.17.1


  parent reply	other threads:[~2019-04-28 18:48 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-28 18:45 [PATCH net-next 00/13] Improvements to DSA core VLAN manipulation Vladimir Oltean
2019-04-28 18:45 ` [PATCH net-next 01/13] net: dsa: Fix pharse -> phase typo Vladimir Oltean
2019-04-28 18:45 ` [PATCH net-next 02/13] net: dsa: Store vlan_filtering as a property of dsa_port Vladimir Oltean
2019-04-28 18:45 ` [PATCH net-next 03/13] net: dsa: Be aware of switches where VLAN filtering is a global setting Vladimir Oltean
2019-04-28 18:45 ` [PATCH net-next 04/13] net: dsa: b53: Let DSA handle mismatched VLAN filtering settings Vladimir Oltean
2019-04-28 18:45 ` [PATCH net-next 05/13] net: dsa: Unset vlan_filtering when ports leave the bridge Vladimir Oltean
2019-04-28 18:45 ` [PATCH net-next 06/13] net: dsa: mt7530: Let DSA handle the unsetting of vlan_filtering Vladimir Oltean
2019-04-28 18:45 ` Vladimir Oltean [this message]
2019-04-28 18:45 ` [PATCH net-next 08/13] net: dsa: Add helper function to retrieve VLAN awareness setting Vladimir Oltean
2019-04-29 21:55   ` Andrew Lunn
2019-04-28 18:45 ` [PATCH net-next 09/13] net: dsa: mt7530: Use the DSA vlan_filtering helper function Vladimir Oltean
2019-04-28 18:45 ` [PATCH net-next 10/13] net: dsa: Skip calling .port_vlan_filtering on no change Vladimir Oltean
2019-04-29 21:57   ` Andrew Lunn
2019-04-28 18:45 ` [PATCH net-next 11/13] net: dsa: b53: Let DSA call .port_vlan_filtering only when necessary Vladimir Oltean
2019-04-29 21:57   ` Andrew Lunn
2019-04-28 18:45 ` [PATCH net-next 12/13] net: dsa: b53: Use vlan_filtering property from dsa_switch Vladimir Oltean
2019-04-29 21:58   ` Andrew Lunn
2019-04-28 18:45 ` [PATCH net-next 13/13] net: dsa: Add more convenient functions for installing port VLANs Vladimir Oltean
2019-05-01  3:05 ` [PATCH net-next 00/13] Improvements to DSA core VLAN manipulation David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190428184554.9968-8-olteanv@gmail.com \
    --to=olteanv@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=vivien.didelot@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).