summaryrefslogtreecommitdiffstats
path: root/net/dsa/dsa_priv.h
diff options
context:
space:
mode:
authorVivien Didelot2017-10-16 17:12:15 +0200
committerDavid S. Miller2017-10-18 13:24:33 +0200
commitd945097bb19501bd95790d8220d4eeb418b6ebb2 (patch)
treeff83357b296408d65537c9e04f5880cf0dba7aff /net/dsa/dsa_priv.h
parentnet: dsa: add slave notify helper (diff)
downloadkernel-qcow2-linux-d945097bb19501bd95790d8220d4eeb418b6ebb2.tar.gz
kernel-qcow2-linux-d945097bb19501bd95790d8220d4eeb418b6ebb2.tar.xz
kernel-qcow2-linux-d945097bb19501bd95790d8220d4eeb418b6ebb2.zip
net: dsa: add slave to port helper
Many portions of DSA core code require to get the dsa_port structure corresponding to a slave net_device. For this purpose, introduce a dsa_slave_to_port() helper. Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dsa/dsa_priv.h')
-rw-r--r--net/dsa/dsa_priv.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h
index 2850077cc9cc..569a4929b4c9 100644
--- a/net/dsa/dsa_priv.h
+++ b/net/dsa/dsa_priv.h
@@ -169,6 +169,13 @@ int dsa_slave_resume(struct net_device *slave_dev);
int dsa_slave_register_notifier(void);
void dsa_slave_unregister_notifier(void);
+static inline struct dsa_port *dsa_slave_to_port(const struct net_device *dev)
+{
+ struct dsa_slave_priv *p = netdev_priv(dev);
+
+ return p->dp;
+}
+
/* switch.c */
int dsa_switch_register_notifier(struct dsa_switch *ds);
void dsa_switch_unregister_notifier(struct dsa_switch *ds);