aboutsummaryrefslogtreecommitdiff
path: root/net/dsa/legacy.c
diff options
context:
space:
mode:
authorVivien Didelot2017-10-16 11:12:15 -0400
committerDavid S. Miller2017-10-18 12:24:33 +0100
commitd945097bb19501bd95790d8220d4eeb418b6ebb2 (patch)
treeff83357b296408d65537c9e04f5880cf0dba7aff /net/dsa/legacy.c
parent6158eaa7a717b469b1b0c0ae6d79910737686279 (diff)
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);
}