From: Vladimir Oltean <olteanv@gmail.com>
To: "David S . Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
netdev@vger.kernel.org
Cc: Andrew Lunn <andrew@lunn.ch>,
Florian Fainelli <f.fainelli@gmail.com>,
Vivien Didelot <vivien.didelot@gmail.com>,
Claudiu Manoil <claudiu.manoil@nxp.com>,
Alexandre Belloni <alexandre.belloni@bootlin.com>,
Vladimir Oltean <vladimir.oltean@nxp.com>,
UNGLinuxDriver@microchip.com
Subject: [PATCH v8 net-next 01/11] net: dsa: tag_8021q: add helpers to deduce whether a VLAN ID is RX or TX VLAN
Date: Fri, 29 Jan 2021 02:59:59 +0200 [thread overview]
Message-ID: <20210129010009.3959398-2-olteanv@gmail.com> (raw)
In-Reply-To: <20210129010009.3959398-1-olteanv@gmail.com>
From: Vladimir Oltean <vladimir.oltean@nxp.com>
The sja1105 implementation can be blind about this, but the felix driver
doesn't do exactly what it's being told, so it needs to know whether it
is a TX or an RX VLAN, so it can install the appropriate type of TCAM
rule.
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
---
Changes in v8:
None.
Changes in v7:
None.
Changes in v6:
None.
Changes in v5:
None.
Changes in v4:
None.
Changes in v3:
None.
Changes in v2:
None.
include/linux/dsa/8021q.h | 14 ++++++++++++++
net/dsa/tag_8021q.c | 15 +++++++++++++--
2 files changed, 27 insertions(+), 2 deletions(-)
diff --git a/include/linux/dsa/8021q.h b/include/linux/dsa/8021q.h
index 88cd72dfa4e0..b12b05f1c8b4 100644
--- a/include/linux/dsa/8021q.h
+++ b/include/linux/dsa/8021q.h
@@ -64,6 +64,10 @@ int dsa_8021q_rx_source_port(u16 vid);
u16 dsa_8021q_rx_subvlan(u16 vid);
+bool vid_is_dsa_8021q_rxvlan(u16 vid);
+
+bool vid_is_dsa_8021q_txvlan(u16 vid);
+
bool vid_is_dsa_8021q(u16 vid);
#else
@@ -123,6 +127,16 @@ u16 dsa_8021q_rx_subvlan(u16 vid)
return 0;
}
+bool vid_is_dsa_8021q_rxvlan(u16 vid)
+{
+ return false;
+}
+
+bool vid_is_dsa_8021q_txvlan(u16 vid)
+{
+ return false;
+}
+
bool vid_is_dsa_8021q(u16 vid)
{
return false;
diff --git a/net/dsa/tag_8021q.c b/net/dsa/tag_8021q.c
index 8e3e8a5b8559..008c1ec6e20c 100644
--- a/net/dsa/tag_8021q.c
+++ b/net/dsa/tag_8021q.c
@@ -133,10 +133,21 @@ u16 dsa_8021q_rx_subvlan(u16 vid)
}
EXPORT_SYMBOL_GPL(dsa_8021q_rx_subvlan);
+bool vid_is_dsa_8021q_rxvlan(u16 vid)
+{
+ return (vid & DSA_8021Q_DIR_MASK) == DSA_8021Q_DIR_RX;
+}
+EXPORT_SYMBOL_GPL(vid_is_dsa_8021q_rxvlan);
+
+bool vid_is_dsa_8021q_txvlan(u16 vid)
+{
+ return (vid & DSA_8021Q_DIR_MASK) == DSA_8021Q_DIR_TX;
+}
+EXPORT_SYMBOL_GPL(vid_is_dsa_8021q_txvlan);
+
bool vid_is_dsa_8021q(u16 vid)
{
- return ((vid & DSA_8021Q_DIR_MASK) == DSA_8021Q_DIR_RX ||
- (vid & DSA_8021Q_DIR_MASK) == DSA_8021Q_DIR_TX);
+ return vid_is_dsa_8021q_rxvlan(vid) || vid_is_dsa_8021q_txvlan(vid);
}
EXPORT_SYMBOL_GPL(vid_is_dsa_8021q);
--
2.25.1
next prev parent reply other threads:[~2021-01-29 1:01 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-29 0:59 [PATCH v8 net-next 00/11] tag_8021q for Ocelot switches Vladimir Oltean
2021-01-29 0:59 ` Vladimir Oltean [this message]
2021-01-29 1:00 ` [PATCH v8 net-next 02/11] net: mscc: ocelot: export VCAP structures to include/soc/mscc Vladimir Oltean
2021-01-29 1:00 ` [PATCH v8 net-next 03/11] net: mscc: ocelot: store a namespaced VCAP filter ID Vladimir Oltean
2021-01-29 1:00 ` [PATCH v8 net-next 04/11] net: mscc: ocelot: reapply bridge forwarding mask on bonding join/leave Vladimir Oltean
2021-01-29 1:00 ` [PATCH v8 net-next 05/11] net: mscc: ocelot: don't use NPI tag prefix for the CPU port module Vladimir Oltean
2021-01-29 1:00 ` [PATCH v8 net-next 06/11] net: dsa: document the existing switch tree notifiers and add a new one Vladimir Oltean
2021-01-29 1:00 ` [PATCH v8 net-next 07/11] net: dsa: keep a copy of the tagging protocol in the DSA switch tree Vladimir Oltean
2021-01-29 1:00 ` [PATCH v8 net-next 08/11] net: dsa: allow changing the tag protocol via the "tagging" device attribute Vladimir Oltean
2021-01-29 23:43 ` Vladimir Oltean
2021-01-30 0:25 ` Jakub Kicinski
2021-01-29 1:00 ` [PATCH v8 net-next 09/11] net: dsa: felix: convert to the new .change_tag_protocol DSA API Vladimir Oltean
2021-01-29 1:00 ` [PATCH v8 net-next 10/11] net: dsa: add a second tagger for Ocelot switches based on tag_8021q Vladimir Oltean
2021-01-29 1:00 ` [PATCH v8 net-next 11/11] net: dsa: felix: perform switch setup for tag_8021q Vladimir Oltean
2021-01-30 5:40 ` [PATCH v8 net-next 00/11] tag_8021q for Ocelot switches patchwork-bot+netdevbpf
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=20210129010009.3959398-2-olteanv@gmail.com \
--to=olteanv@gmail.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=alexandre.belloni@bootlin.com \
--cc=andrew@lunn.ch \
--cc=claudiu.manoil@nxp.com \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=vivien.didelot@gmail.com \
--cc=vladimir.oltean@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;
as well as URLs for NNTP newsgroup(s).