mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: hongbo.wang@nxp.com
To: xiaoliang.yang_1@nxp.com, allan.nielsen@microchip.com,
	po.liu@nxp.com, claudiu.manoil@nxp.com,
	alexandru.marginean@nxp.com, vladimir.oltean@nxp.com,
	leoyang.li@nxp.com, mingkai.hu@nxp.com, andrew@lunn.ch,
	f.fainelli@gmail.com, vivien.didelot@gmail.com,
	davem@davemloft.net, jiri@resnulli.us, idosch@idosch.org,
	kuba@kernel.org, vinicius.gomes@intel.com,
	nikolay@cumulusnetworks.com, roopa@cumulusnetworks.com,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	horatiu.vultur@microchip.com, alexandre.belloni@bootlin.com,
	UNGLinuxDriver@microchip.com, linux-devel@linux.nxdi.nxp.com
Cc: "hongbo.wang" <hongbo.wang@nxp.com>
Subject: [PATCH 2/2] net: dsa: Set flag for 802.1AD when deleting vlan for dsa switch and port
Date: Mon, 20 Jul 2020 18:41:19 +0800	[thread overview]
Message-ID: <20200720104119.19146-2-hongbo.wang@nxp.com> (raw)
In-Reply-To: <20200720104119.19146-1-hongbo.wang@nxp.com>

From: "hongbo.wang" <hongbo.wang@nxp.com>

the following command will be supported:
Add VLAN:
    ip link add link swp1 name swp1.100 type vlan protocol 802.1ad id 100
Delete VLAN:
    ip link del link swp1 name swp1.100

Signed-off-by: hongbo.wang <hongbo.wang@nxp.com>
---
 net/dsa/dsa_priv.h  | 2 +-
 net/dsa/port.c      | 3 ++-
 net/dsa/slave.c     | 6 +++++-
 net/dsa/tag_8021q.c | 2 +-
 4 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h
index adecf73bd608..5cd804c1d7e3 100644
--- a/net/dsa/dsa_priv.h
+++ b/net/dsa/dsa_priv.h
@@ -165,7 +165,7 @@ int dsa_port_vlan_add(struct dsa_port *dp,
 int dsa_port_vlan_del(struct dsa_port *dp,
 		      const struct switchdev_obj_port_vlan *vlan);
 int dsa_port_vid_add(struct dsa_port *dp, u16 vid, u16 flags);
-int dsa_port_vid_del(struct dsa_port *dp, u16 vid);
+int dsa_port_vid_del(struct dsa_port *dp, u16 vid, u16 flags);
 int dsa_port_link_register_of(struct dsa_port *dp);
 void dsa_port_link_unregister_of(struct dsa_port *dp);
 extern const struct phylink_mac_ops dsa_port_phylink_mac_ops;
diff --git a/net/dsa/port.c b/net/dsa/port.c
index e23ece229c7e..8a8ecb91a030 100644
--- a/net/dsa/port.c
+++ b/net/dsa/port.c
@@ -454,10 +454,11 @@ int dsa_port_vid_add(struct dsa_port *dp, u16 vid, u16 flags)
 }
 EXPORT_SYMBOL(dsa_port_vid_add);
 
-int dsa_port_vid_del(struct dsa_port *dp, u16 vid)
+int dsa_port_vid_del(struct dsa_port *dp, u16 vid, u16 flags)
 {
 	struct switchdev_obj_port_vlan vlan = {
 		.obj.id = SWITCHDEV_OBJ_ID_PORT_VLAN,
+		.flags = flags,
 		.vid_begin = vid,
 		.vid_end = vid,
 	};
diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index 376d7ac5f1e5..14784a6718a9 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -1270,6 +1270,7 @@ static int dsa_slave_vlan_rx_add_vid(struct net_device *dev, __be16 proto,
 static int dsa_slave_vlan_rx_kill_vid(struct net_device *dev, __be16 proto,
 				      u16 vid)
 {
+	u16 flags = 0;
 	struct dsa_port *dp = dsa_slave_to_port(dev);
 	struct bridge_vlan_info info;
 	int ret;
@@ -1290,10 +1291,13 @@ static int dsa_slave_vlan_rx_kill_vid(struct net_device *dev, __be16 proto,
 			return -EBUSY;
 	}
 
+	if (ntohs(proto) == ETH_P_8021AD)
+		flags |= BRIDGE_VLAN_INFO_8021AD;
+
 	/* Do not deprogram the CPU port as it may be shared with other user
 	 * ports which can be members of this VLAN as well.
 	 */
-	return dsa_port_vid_del(dp, vid);
+	return dsa_port_vid_del(dp, vid, flags);
 }
 
 struct dsa_hw_port {
diff --git a/net/dsa/tag_8021q.c b/net/dsa/tag_8021q.c
index 780b2a15ac9b..87b732c5cccf 100644
--- a/net/dsa/tag_8021q.c
+++ b/net/dsa/tag_8021q.c
@@ -154,7 +154,7 @@ static int dsa_8021q_vid_apply(struct dsa_switch *ds, int port, u16 vid,
 	if (enabled)
 		return dsa_port_vid_add(dp, vid, flags);
 
-	return dsa_port_vid_del(dp, vid);
+	return dsa_port_vid_del(dp, vid, flags);
 }
 
 /* RX VLAN tagging (left) and TX VLAN tagging (right) setup shown for a single
-- 
2.17.1


  reply	other threads:[~2020-07-20 10:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-20 10:41 [PATCH 1/2] net: dsa: Add flag for 802.1AD when adding VLAN " hongbo.wang
2020-07-20 10:41 ` hongbo.wang [this message]
2020-07-20 10:44 ` Nikolay Aleksandrov
2020-07-21  3:10   ` [EXT] " Hongbo Wang
2020-07-21  4:57 ` Florian Fainelli
2020-07-21  6:01   ` [EXT] " Hongbo Wang

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=20200720104119.19146-2-hongbo.wang@nxp.com \
    --to=hongbo.wang@nxp.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=alexandru.marginean@nxp.com \
    --cc=allan.nielsen@microchip.com \
    --cc=andrew@lunn.ch \
    --cc=claudiu.manoil@nxp.com \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=horatiu.vultur@microchip.com \
    --cc=idosch@idosch.org \
    --cc=jiri@resnulli.us \
    --cc=kuba@kernel.org \
    --cc=leoyang.li@nxp.com \
    --cc=linux-devel@linux.nxdi.nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingkai.hu@nxp.com \
    --cc=netdev@vger.kernel.org \
    --cc=nikolay@cumulusnetworks.com \
    --cc=po.liu@nxp.com \
    --cc=roopa@cumulusnetworks.com \
    --cc=vinicius.gomes@intel.com \
    --cc=vivien.didelot@gmail.com \
    --cc=vladimir.oltean@nxp.com \
    --cc=xiaoliang.yang_1@nxp.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

all inboxes | Powered by JetHome®