net: dsa: tag_brcm: Indicate to master netdevice port + queue
authorFlorian Fainelli <f.fainelli@gmail.com>
Wed, 11 Oct 2017 17:57:49 +0000 (10:57 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 12 Oct 2017 19:10:02 +0000 (12:10 -0700)
We need to tell the DSA master network device doing the actual
transmission what the desired switch port and queue number is for it to
resolve that to the internal transmit queue it is mapped to.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/dsa.h
net/dsa/tag_brcm.c

index 40a709a0754dc5235b58080ac53160f8f9e489ed..ce1d622734d73ce9dec71ce8b1baad3be214422e 100644 (file)
@@ -516,4 +516,9 @@ static inline int call_dsa_notifiers(unsigned long val, struct net_device *dev,
 }
 #endif
 
+/* Broadcom tag specific helpers to insert and extract queue/port number */
+#define BRCM_TAG_SET_PORT_QUEUE(p, q)  ((p) << 8 | q)
+#define BRCM_TAG_GET_PORT(v)           ((v) >> 8)
+#define BRCM_TAG_GET_QUEUE(v)          ((v) & 0xff)
+
 #endif
index 8e4bdb9d9ae365da792e52c1f13adb432a20dfeb..cc4f472fbd77243f22d16586fc2d43df81f19814 100644 (file)
@@ -86,6 +86,12 @@ static struct sk_buff *brcm_tag_xmit(struct sk_buff *skb, struct net_device *dev
                brcm_tag[2] = BRCM_IG_DSTMAP2_MASK;
        brcm_tag[3] = (1 << p->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));
+
        return skb;
 }