batman-adv: 2013.2.0 stability fixes
[feed/routing.git] / batman-adv / patches / 0002-batman-adv-vlan-add-protocol-argument-to-packet-tagging-fun.patch
1 From 82d1a8ebf19a1b9841ee44ce7b2448114be3e772 Mon Sep 17 00:00:00 2001
2 From: Patrick McHardy <kaber@trash.net>
3 Date: Wed, 24 Apr 2013 17:42:56 +0200
4 Subject: [PATCH 2/6] net: vlan: add protocol argument to packet tagging
5 functions
6
7 Add a protocol argument to the VLAN packet tagging functions. In case of HW
8 tagging, we need that protocol available in the ndo_start_xmit functions,
9 so it is stored in a new field in the skb. The new field fits into a hole
10 (on 64 bit) and doesn't increase the sks's size.
11
12 Signed-off-by: Patrick McHardy <kaber@trash.net>
13 Signed-off-by: David S. Miller <davem@davemloft.net>
14 [siwu@hrz.tu-chemnitz.de: added compat code]
15 Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
16 Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
17 ---
18 bridge_loop_avoidance.c | 2 +-
19 compat.h | 16 +++++++++++++++-
20 2 files changed, 16 insertions(+), 2 deletions(-)
21
22 diff --git a/bridge_loop_avoidance.c b/bridge_loop_avoidance.c
23 index 6a4f728..379061c 100644
24 --- a/bridge_loop_avoidance.c
25 +++ b/bridge_loop_avoidance.c
26 @@ -341,7 +341,7 @@ static void batadv_bla_send_claim(struct batadv_priv *bat_priv, uint8_t *mac,
27 }
28
29 if (vid != -1)
30 - skb = vlan_insert_tag(skb, vid);
31 + skb = vlan_insert_tag(skb, htons(ETH_P_8021Q), vid);
32
33 skb_reset_mac_header(skb);
34 skb->protocol = eth_type_trans(skb, soft_iface);
35 diff --git a/compat.h b/compat.h
36 index 0663df5..c1dadac 100644
37 --- a/compat.h
38 +++ b/compat.h
39 @@ -170,7 +170,7 @@ static const struct { \
40 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0)
41
42 #define kfree_rcu(ptr, rcu_head) call_rcu(&ptr->rcu_head, batadv_free_rcu_##ptr)
43 -#define vlan_insert_tag(skb, vid) __vlan_put_tag(skb, vid)
44 +#define vlan_insert_tag(skb, proto, vid) __vlan_put_tag(skb, vid)
45
46 void batadv_free_rcu_gw_node(struct rcu_head *rcu);
47 void batadv_free_rcu_neigh_node(struct rcu_head *rcu);
48 @@ -278,4 +278,18 @@ static int __batadv_interface_set_mac_addr(x, y)
49
50 #endif /* < KERNEL_VERSION(3, 9, 0) */
51
52 +#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0)
53 +
54 +#ifndef vlan_insert_tag
55 +
56 +/* include this header early to let the following define
57 + * not mess up the original function prototype.
58 + */
59 +#include <linux/if_vlan.h>
60 +#define vlan_insert_tag(skb, proto, vid) vlan_insert_tag(skb, vid)
61 +
62 +#endif /* vlan_insert_tag */
63 +
64 +#endif /* < KERNEL_VERSION(3, 10, 0) */
65 +
66 #endif /* _NET_BATMAN_ADV_COMPAT_H_ */
67 --
68 1.7.10.4
69