lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190521193004.10767-6-vivien.didelot@gmail.com>
Date:   Tue, 21 May 2019 15:30:00 -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 5/9] net: dsa: introduce dsa_to_master

Introduce a dsa_to_master helper to find the master interface dedicated
to a given switch port.

Signed-off-by: Vivien Didelot <vivien.didelot@...il.com>
---
 include/net/dsa.h | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/include/net/dsa.h b/include/net/dsa.h
index c5b45bfeea01..b0be2687bd61 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -356,6 +356,19 @@ static inline bool dsa_is_upstream_port(struct dsa_switch *ds, int port)
 	return dsa_upstream_port(ds, port) == port;
 }
 
+static inline struct net_device *dsa_to_master(struct dsa_switch *ds, int port)
+{
+	const struct dsa_port *dp = dsa_to_port(ds, port);
+
+	if (dp->type == DSA_PORT_TYPE_CPU)
+		return dp->master;
+
+	if (dp->cpu_dp)
+		return dp->cpu_dp->master;
+
+	return NULL;
+}
+
 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

Powered by Openwall GNU/*/Linux Powered by OpenVZ