[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190521193004.10767-5-vivien.didelot@gmail.com>
Date: Tue, 21 May 2019 15:29:59 -0400
From: Vivien Didelot <vivien.didelot@...il.com>
To: netdev@...r.kernel.org
Cc: cphealy@...il.com, Vivien Didelot <vivien.didelot@...il.com>,
Florian Fainelli <f.fainelli@...il.com>,
Andrew Lunn <andrew@...n.ch>,
"David S. Miller" <davem@...emloft.net>
Subject: [RFC net-next 4/9] net: dsa: introduce dsa_is_upstream_port
Introduce a dsa_is_upstream_port helper to check if a given switch
port is directly or indirectly connected to a CPU port.
Signed-off-by: Vivien Didelot <vivien.didelot@...il.com>
---
include/net/dsa.h | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/include/net/dsa.h b/include/net/dsa.h
index 7b10a067b06d..c5b45bfeea01 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -347,6 +347,15 @@ static inline unsigned int dsa_upstream_port(struct dsa_switch *ds, int port)
return dsa_towards_port(ds, cpu_dp->ds->index, cpu_dp->index);
}
+/* Return whether the port is a local upstream port */
+static inline bool dsa_is_upstream_port(struct dsa_switch *ds, int port)
+{
+ if (dsa_is_unused_port(ds, port))
+ return false;
+
+ return dsa_upstream_port(ds, port) == port;
+}
+
static inline bool dsa_port_is_vlan_filtering(const struct dsa_port *dp)
{
const struct dsa_switch *ds = dp->ds;
--
2.21.0
Powered by blists - more mailing lists