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 02/13] net: dsa: Store vlan_filtering as a property of dsa_port
Date: Sun, 28 Apr 2019 21:45:43 +0300	[thread overview]
Message-ID: <20190428184554.9968-3-olteanv@gmail.com> (raw)
In-Reply-To: <20190428184554.9968-1-olteanv@gmail.com>

This allows drivers to query the VLAN setting imposed by the bridge
driver directly from DSA, instead of keeping their own state based on
the .port_vlan_filtering callback.

Signed-off-by: Vladimir Oltean <olteanv@gmail.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
---
 include/net/dsa.h |  1 +
 net/dsa/port.c    | 12 ++++++++----
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/include/net/dsa.h b/include/net/dsa.h
index b550f7bb5314..79a87913126c 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -161,6 +161,7 @@ struct dsa_port {
 	const char		*mac;
 	struct device_node	*dn;
 	unsigned int		ageing_time;
+	bool			vlan_filtering;
 	u8			stp_state;
 	struct net_device	*bridge_dev;
 	struct devlink_port	devlink_port;
diff --git a/net/dsa/port.c b/net/dsa/port.c
index ea848596afe3..0caf7f9bfb57 100644
--- a/net/dsa/port.c
+++ b/net/dsa/port.c
@@ -158,15 +158,19 @@ int dsa_port_vlan_filtering(struct dsa_port *dp, bool vlan_filtering,
 			    struct switchdev_trans *trans)
 {
 	struct dsa_switch *ds = dp->ds;
+	int err;
 
 	/* bridge skips -EOPNOTSUPP, so skip the prepare phase */
 	if (switchdev_trans_ph_prepare(trans))
 		return 0;
 
-	if (ds->ops->port_vlan_filtering)
-		return ds->ops->port_vlan_filtering(ds, dp->index,
-						    vlan_filtering);
-
+	if (ds->ops->port_vlan_filtering) {
+		err = ds->ops->port_vlan_filtering(ds, dp->index,
+						   vlan_filtering);
+		if (err)
+			return err;
+		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 ` Vladimir Oltean [this message]
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 ` [PATCH net-next 07/13] net: dsa: Keep the vlan_filtering setting in dsa_switch if it's global Vladimir Oltean
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-3-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).