summaryrefslogtreecommitdiffstats
path: root/net/dsa/legacy.c
diff options
context:
space:
mode:
authorVivien Didelot <vivien.didelot@savoirfairelinux.com>2017-10-16 17:12:15 +0200
committerDavid S. Miller <davem@davemloft.net>2017-10-18 13:24:33 +0200
commitd945097bb19501bd95790d8220d4eeb418b6ebb2 (patch)
treeff83357b296408d65537c9e04f5880cf0dba7aff /net/dsa/legacy.c
parentnet: dsa: add slave notify helper (diff)
downloadlinux-d945097bb19501bd95790d8220d4eeb418b6ebb2.tar.xz
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/legacy.c')
-rw-r--r--net/dsa/legacy.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/net/dsa/legacy.c b/net/dsa/legacy.c
index b0fefbffe082..cc28c6f792a3 100644
--- a/net/dsa/legacy.c
+++ b/net/dsa/legacy.c
@@ -740,8 +740,7 @@ int dsa_legacy_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
const unsigned char *addr, u16 vid,
u16 flags)
{
- struct dsa_slave_priv *p = netdev_priv(dev);
- struct dsa_port *dp = p->dp;
+ struct dsa_port *dp = dsa_slave_to_port(dev);
return dsa_port_fdb_add(dp, addr, vid);
}
@@ -750,8 +749,7 @@ int dsa_legacy_fdb_del(struct ndmsg *ndm, struct nlattr *tb[],
struct net_device *dev,
const unsigned char *addr, u16 vid)
{
- struct dsa_slave_priv *p = netdev_priv(dev);
- struct dsa_port *dp = p->dp;
+ struct dsa_port *dp = dsa_slave_to_port(dev);
return dsa_port_fdb_del(dp, addr, vid);
}