aboutsummaryrefslogtreecommitdiffstats
path: root/net/dsa/tag_brcm.c
diff options
context:
space:
mode:
authorVivien Didelot <vivien.didelot@savoirfairelinux.com>2017-10-16 11:12:15 -0400
committerDavid S. Miller <davem@davemloft.net>2017-10-18 12:24:33 +0100
commitd945097bb19501bd95790d8220d4eeb418b6ebb2 (patch)
treeff83357b296408d65537c9e04f5880cf0dba7aff /net/dsa/tag_brcm.c
parentnet: dsa: add slave notify helper (diff)
downloadlinux-dev-d945097bb19501bd95790d8220d4eeb418b6ebb2.tar.xz
linux-dev-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/tag_brcm.c')
-rw-r--r--net/dsa/tag_brcm.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/net/dsa/tag_brcm.c b/net/dsa/tag_brcm.c
index cc4f472fbd77..2a0fa9f9f7ca 100644
--- a/net/dsa/tag_brcm.c
+++ b/net/dsa/tag_brcm.c
@@ -61,7 +61,7 @@
static struct sk_buff *brcm_tag_xmit(struct sk_buff *skb, struct net_device *dev)
{
- struct dsa_slave_priv *p = netdev_priv(dev);
+ struct dsa_port *dp = dsa_slave_to_port(dev);
u16 queue = skb_get_queue_mapping(skb);
u8 *brcm_tag;
@@ -82,15 +82,14 @@ static struct sk_buff *brcm_tag_xmit(struct sk_buff *skb, struct net_device *dev
((queue & BRCM_IG_TC_MASK) << BRCM_IG_TC_SHIFT);
brcm_tag[1] = 0;
brcm_tag[2] = 0;
- if (p->dp->index == 8)
+ if (dp->index == 8)
brcm_tag[2] = BRCM_IG_DSTMAP2_MASK;
- brcm_tag[3] = (1 << p->dp->index) & BRCM_IG_DSTMAP1_MASK;
+ brcm_tag[3] = (1 << dp->index) & BRCM_IG_DSTMAP1_MASK;
/* Now tell the master network device about the desired output queue
* as well
*/
- skb_set_queue_mapping(skb, BRCM_TAG_SET_PORT_QUEUE(p->dp->index,
- queue));
+ skb_set_queue_mapping(skb, BRCM_TAG_SET_PORT_QUEUE(dp->index, queue));
return skb;
}