[lantiq] fixes etop locking issue
[openwrt.git] / target / linux / generic / patches-3.1 / 051-linux_atm-chas.patch
1
2
3 From: Pascal Hambourg <pascal@plouf.fr.eu.org>
4 Date: Wed, 17 Aug 2011 08:37:18 +0200
5 Subject: [PATCH 1/2] atm: br2684: Make headroom and hard_header_len depend on the payload type
6
7 Routed payload requires less headroom than bridged payload.
8 So do not reallocate headroom if not needed.
9 Also, add worst case AAL5 overhead to netdev->hard_header_len.
10
11 Signed-off-by: Pascal Hambourg <pascal@plouf.fr.eu.org>
12 Signed-off-by: chas williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
13 ---
14 net/atm/br2684.c | 8 ++++++--
15 1 files changed, 6 insertions(+), 2 deletions(-)
16
17 diff --git a/net/atm/br2684.c b/net/atm/br2684.c
18 index 53b0aa1..ed72263 100644
19 --- a/net/atm/br2684.c
20 +++ b/net/atm/br2684.c
21 @@ -202,7 +202,10 @@ static int br2684_xmit_vcc(struct sk_buff *skb, struct net_device *dev,
22 {
23 struct br2684_dev *brdev = BRPRIV(dev);
24 struct atm_vcc *atmvcc;
25 - int minheadroom = (brvcc->encaps == e_llc) ? 10 : 2;
26 + int minheadroom = (brvcc->encaps == e_llc) ?
27 + ((brdev->payload == p_bridged) ?
28 + sizeof(llc_oui_pid_pad) : sizeof(llc_oui_ipv4)) :
29 + ((brdev->payload == p_bridged) ? BR2684_PAD_LEN : 0);
30
31 if (skb_headroom(skb) < minheadroom) {
32 struct sk_buff *skb2 = skb_realloc_headroom(skb, minheadroom);
33 @@ -583,6 +586,7 @@ static void br2684_setup(struct net_device *netdev)
34 struct br2684_dev *brdev = BRPRIV(netdev);
35
36 ether_setup(netdev);
37 + netdev->hard_header_len += sizeof(llc_oui_pid_pad); /* worst case */
38 brdev->net_dev = netdev;
39
40 netdev->netdev_ops = &br2684_netdev_ops;
41 @@ -595,7 +599,7 @@ static void br2684_setup_routed(struct net_device *netdev)
42 struct br2684_dev *brdev = BRPRIV(netdev);
43
44 brdev->net_dev = netdev;
45 - netdev->hard_header_len = 0;
46 + netdev->hard_header_len = sizeof(llc_oui_ipv4); /* worst case */
47 netdev->netdev_ops = &br2684_netdev_ops_routed;
48 netdev->addr_len = 0;
49 netdev->mtu = 1500;
50
51 From: Pascal Hambourg <pascal@plouf.fr.eu.org>
52 Date: Wed, 17 Aug 2011 08:37:52 +0200
53 Subject: [PATCH 2/2] atm: br2684: Avoid alignment issues
54
55 Use memcmp() instead of cast to u16 when checking the PAD field.
56
57 Signed-off-by: Pascal Hambourg <pascal@plouf.fr.eu.org>
58 Signed-off-by: chas williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
59 ---
60 net/atm/br2684.c | 3 ++-
61 1 files changed, 2 insertions(+), 1 deletions(-)
62
63 diff --git a/net/atm/br2684.c b/net/atm/br2684.c
64 index ed72263..353fccf 100644
65 --- a/net/atm/br2684.c
66 +++ b/net/atm/br2684.c
67 @@ -53,6 +53,7 @@ static const unsigned char ethertype_ipv4[] = { ETHERTYPE_IPV4 };
68 static const unsigned char ethertype_ipv6[] = { ETHERTYPE_IPV6 };
69 static const unsigned char llc_oui_pid_pad[] =
70 { LLC, SNAP_BRIDGED, PID_ETHERNET, PAD_BRIDGED };
71 +static const unsigned char pad[] = { PAD_BRIDGED };
72 static const unsigned char llc_oui_ipv4[] = { LLC, SNAP_ROUTED, ETHERTYPE_IPV4 };
73 static const unsigned char llc_oui_ipv6[] = { LLC, SNAP_ROUTED, ETHERTYPE_IPV6 };
74
75 @@ -453,7 +454,7 @@ static void br2684_push(struct atm_vcc *atmvcc, struct sk_buff *skb)
76 skb->pkt_type = PACKET_HOST;
77 } else { /* p_bridged */
78 /* first 2 chars should be 0 */
79 - if (*((u16 *) (skb->data)) != 0)
80 + if (memcmp(skb->data, pad, BR2684_PAD_LEN) != 0)
81 goto error;
82 skb_pull(skb, BR2684_PAD_LEN);
83 skb->protocol = eth_type_trans(skb, net_dev);
This page took 0.045547 seconds and 5 git commands to generate.