kernel: bump 4.9 to 4.9.57
[openwrt/openwrt.git] / target / linux / mediatek / patches-4.9 / 0040-net-next-tag_mtk-add-flow_dissect-callback-to-the-op.patch
1 From 9d6806e16e5ea68a49225da1ab065ef0b5d7704b Mon Sep 17 00:00:00 2001
2 From: John Crispin <john@phrozen.org>
3 Date: Mon, 7 Aug 2017 16:55:56 +0200
4 Subject: [PATCH 40/57] net-next: tag_mtk: add flow_dissect callback to the ops
5 struct
6
7 The MT7530 inserts the 4 magic header in between the 802.3 address and
8 protocol field. The patch implements the callback that can be called by
9 the flow dissector to figure out the real protocol and offset of the
10 network header. With this patch applied we can properly parse the packet
11 and thus make hashing function properly.
12
13 Signed-off-by: John Crispin <john@phrozen.org>
14 ---
15 net/dsa/tag_mtk.c | 14 ++++++++++++--
16 1 file changed, 12 insertions(+), 2 deletions(-)
17
18 --- a/net/dsa/tag_mtk.c
19 +++ b/net/dsa/tag_mtk.c
20 @@ -111,7 +111,17 @@ out:
21 return 0;
22 }
23
24 +static int mtk_tag_flow_dissect(const struct sk_buff *skb, __be16 *proto,
25 + int *offset)
26 +{
27 + *offset = 4;
28 + *proto = ((__be16 *)skb->data)[1];
29 +
30 + return 0;
31 +}
32 +
33 const struct dsa_device_ops mtk_netdev_ops = {
34 - .xmit = mtk_tag_xmit,
35 - .rcv = mtk_tag_rcv,
36 + .xmit = mtk_tag_xmit,
37 + .rcv = mtk_tag_rcv,
38 + .flow_dissect = mtk_tag_flow_dissect,
39 };