diff options
author | Vivien Didelot <vivien.didelot@savoirfairelinux.com> | 2017-10-16 11:12:15 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-10-18 12:24:33 +0100 |
commit | d945097bb19501bd95790d8220d4eeb418b6ebb2 (patch) | |
tree | ff83357b296408d65537c9e04f5880cf0dba7aff /net/dsa/dsa_priv.h | |
parent | 6158eaa7a717b469b1b0c0ae6d79910737686279 (diff) | |
download | op-kernel-dev-d945097bb19501bd95790d8220d4eeb418b6ebb2.zip op-kernel-dev-d945097bb19501bd95790d8220d4eeb418b6ebb2.tar.gz |
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.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h index 2850077c..569a492 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); |