]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net-next: tag_mtk: add flow_dissect callback to the ops struct
authorJohn Crispin <john@phrozen.org>
Wed, 9 Aug 2017 12:41:18 +0000 (14:41 +0200)
committerDavid S. Miller <davem@davemloft.net>
Thu, 10 Aug 2017 05:51:47 +0000 (22:51 -0700)
The MT7530 inserts the 4 magic header in between the 802.3 address and
protocol field. The patch implements the callback that can be called by
the flow dissector to figure out the real protocol and offset of the
network header. With this patch applied we can properly parse the packet
and thus make hashing function properly.

Signed-off-by: Muciri Gatimu <muciri@openmesh.com>
Signed-off-by: Shashidhar Lakkavalli <shashidhar.lakkavalli@openmesh.com>
Signed-off-by: John Crispin <john@phrozen.org>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/dsa/tag_mtk.c

index 2f32b7ea3365ce87f61e6a5002fbe45a4228e85f..02163c045a96ac639891931583585881eac08b2e 100644 (file)
@@ -87,7 +87,17 @@ static struct sk_buff *mtk_tag_rcv(struct sk_buff *skb, struct net_device *dev,
        return skb;
 }
 
+static int mtk_tag_flow_dissect(const struct sk_buff *skb, __be16 *proto,
+                               int *offset)
+{
+       *offset = 4;
+       *proto = ((__be16 *)skb->data)[1];
+
+       return 0;
+}
+
 const struct dsa_device_ops mtk_netdev_ops = {
-       .xmit   = mtk_tag_xmit,
-       .rcv    = mtk_tag_rcv,
+       .xmit           = mtk_tag_xmit,
+       .rcv            = mtk_tag_rcv,
+       .flow_dissect   = mtk_tag_flow_dissect,
 };