summaryrefslogtreecommitdiffstats
path: root/target
diff options
context:
space:
mode:
authorblogic <blogic@3c298f89-4303-0410-b956-a3cf2f4a3e73>2012-02-14 20:11:22 +0000
committerblogic <blogic@3c298f89-4303-0410-b956-a3cf2f4a3e73>2012-02-14 20:11:22 +0000
commit12ee6100a29f4010af2e5797826abc95a4732f43 (patch)
tree82b8a358bcf6285f27ea1b432e54d440d3bfb255 /target
parent3412b9496cb58f7ae836fe7630047fa8aac22829 (diff)
linux-atm: headroom/padding fixes
Submitted upstream to netdev by Chas Williams on linux-atm. Signed-off-by: Philip Prindeville <philipp_subx@redfish-solutions.com> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@30540 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target')
-rw-r--r--target/linux/generic/patches-2.6.39/051-linux_atm-chas.patch83
-rw-r--r--target/linux/generic/patches-3.0/051-linux_atm-chas.patch83
-rw-r--r--target/linux/generic/patches-3.1/051-linux_atm-chas.patch83
3 files changed, 249 insertions, 0 deletions
diff --git a/target/linux/generic/patches-2.6.39/051-linux_atm-chas.patch b/target/linux/generic/patches-2.6.39/051-linux_atm-chas.patch
new file mode 100644
index 000000000..08bb77df6
--- /dev/null
+++ b/target/linux/generic/patches-2.6.39/051-linux_atm-chas.patch
@@ -0,0 +1,83 @@
+
+
+From: Pascal Hambourg <pascal@plouf.fr.eu.org>
+Date: Wed, 17 Aug 2011 08:37:18 +0200
+Subject: [PATCH 1/2] atm: br2684: Make headroom and hard_header_len depend on the payload type
+
+Routed payload requires less headroom than bridged payload.
+So do not reallocate headroom if not needed.
+Also, add worst case AAL5 overhead to netdev->hard_header_len.
+
+Signed-off-by: Pascal Hambourg <pascal@plouf.fr.eu.org>
+Signed-off-by: chas williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
+---
+ net/atm/br2684.c | 8 ++++++--
+ 1 files changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/net/atm/br2684.c b/net/atm/br2684.c
+index 53b0aa1..ed72263 100644
+--- a/net/atm/br2684.c
++++ b/net/atm/br2684.c
+@@ -202,7 +202,10 @@ static int br2684_xmit_vcc(struct sk_buff *skb, struct net_device *dev,
+ {
+ struct br2684_dev *brdev = BRPRIV(dev);
+ struct atm_vcc *atmvcc;
+- int minheadroom = (brvcc->encaps == e_llc) ? 10 : 2;
++ int minheadroom = (brvcc->encaps == e_llc) ?
++ ((brdev->payload == p_bridged) ?
++ sizeof(llc_oui_pid_pad) : sizeof(llc_oui_ipv4)) :
++ ((brdev->payload == p_bridged) ? BR2684_PAD_LEN : 0);
+
+ if (skb_headroom(skb) < minheadroom) {
+ struct sk_buff *skb2 = skb_realloc_headroom(skb, minheadroom);
+@@ -583,6 +586,7 @@ static void br2684_setup(struct net_device *netdev)
+ struct br2684_dev *brdev = BRPRIV(netdev);
+
+ ether_setup(netdev);
++ netdev->hard_header_len += sizeof(llc_oui_pid_pad); /* worst case */
+ brdev->net_dev = netdev;
+
+ netdev->netdev_ops = &br2684_netdev_ops;
+@@ -595,7 +599,7 @@ static void br2684_setup_routed(struct net_device *netdev)
+ struct br2684_dev *brdev = BRPRIV(netdev);
+
+ brdev->net_dev = netdev;
+- netdev->hard_header_len = 0;
++ netdev->hard_header_len = sizeof(llc_oui_ipv4); /* worst case */
+ netdev->netdev_ops = &br2684_netdev_ops_routed;
+ netdev->addr_len = 0;
+ netdev->mtu = 1500;
+
+From: Pascal Hambourg <pascal@plouf.fr.eu.org>
+Date: Wed, 17 Aug 2011 08:37:52 +0200
+Subject: [PATCH 2/2] atm: br2684: Avoid alignment issues
+
+Use memcmp() instead of cast to u16 when checking the PAD field.
+
+Signed-off-by: Pascal Hambourg <pascal@plouf.fr.eu.org>
+Signed-off-by: chas williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
+---
+ net/atm/br2684.c | 3 ++-
+ 1 files changed, 2 insertions(+), 1 deletions(-)
+
+diff --git a/net/atm/br2684.c b/net/atm/br2684.c
+index ed72263..353fccf 100644
+--- a/net/atm/br2684.c
++++ b/net/atm/br2684.c
+@@ -53,6 +53,7 @@ static const unsigned char ethertype_ipv4[] = { ETHERTYPE_IPV4 };
+ static const unsigned char ethertype_ipv6[] = { ETHERTYPE_IPV6 };
+ static const unsigned char llc_oui_pid_pad[] =
+ { LLC, SNAP_BRIDGED, PID_ETHERNET, PAD_BRIDGED };
++static const unsigned char pad[] = { PAD_BRIDGED };
+ static const unsigned char llc_oui_ipv4[] = { LLC, SNAP_ROUTED, ETHERTYPE_IPV4 };
+ static const unsigned char llc_oui_ipv6[] = { LLC, SNAP_ROUTED, ETHERTYPE_IPV6 };
+
+@@ -453,7 +454,7 @@ static void br2684_push(struct atm_vcc *atmvcc, struct sk_buff *skb)
+ skb->pkt_type = PACKET_HOST;
+ } else { /* p_bridged */
+ /* first 2 chars should be 0 */
+- if (*((u16 *) (skb->data)) != 0)
++ if (memcmp(skb->data, pad, BR2684_PAD_LEN) != 0)
+ goto error;
+ skb_pull(skb, BR2684_PAD_LEN);
+ skb->protocol = eth_type_trans(skb, net_dev);
diff --git a/target/linux/generic/patches-3.0/051-linux_atm-chas.patch b/target/linux/generic/patches-3.0/051-linux_atm-chas.patch
new file mode 100644
index 000000000..08bb77df6
--- /dev/null
+++ b/target/linux/generic/patches-3.0/051-linux_atm-chas.patch
@@ -0,0 +1,83 @@
+
+
+From: Pascal Hambourg <pascal@plouf.fr.eu.org>
+Date: Wed, 17 Aug 2011 08:37:18 +0200
+Subject: [PATCH 1/2] atm: br2684: Make headroom and hard_header_len depend on the payload type
+
+Routed payload requires less headroom than bridged payload.
+So do not reallocate headroom if not needed.
+Also, add worst case AAL5 overhead to netdev->hard_header_len.
+
+Signed-off-by: Pascal Hambourg <pascal@plouf.fr.eu.org>
+Signed-off-by: chas williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
+---
+ net/atm/br2684.c | 8 ++++++--
+ 1 files changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/net/atm/br2684.c b/net/atm/br2684.c
+index 53b0aa1..ed72263 100644
+--- a/net/atm/br2684.c
++++ b/net/atm/br2684.c
+@@ -202,7 +202,10 @@ static int br2684_xmit_vcc(struct sk_buff *skb, struct net_device *dev,
+ {
+ struct br2684_dev *brdev = BRPRIV(dev);
+ struct atm_vcc *atmvcc;
+- int minheadroom = (brvcc->encaps == e_llc) ? 10 : 2;
++ int minheadroom = (brvcc->encaps == e_llc) ?
++ ((brdev->payload == p_bridged) ?
++ sizeof(llc_oui_pid_pad) : sizeof(llc_oui_ipv4)) :
++ ((brdev->payload == p_bridged) ? BR2684_PAD_LEN : 0);
+
+ if (skb_headroom(skb) < minheadroom) {
+ struct sk_buff *skb2 = skb_realloc_headroom(skb, minheadroom);
+@@ -583,6 +586,7 @@ static void br2684_setup(struct net_device *netdev)
+ struct br2684_dev *brdev = BRPRIV(netdev);
+
+ ether_setup(netdev);
++ netdev->hard_header_len += sizeof(llc_oui_pid_pad); /* worst case */
+ brdev->net_dev = netdev;
+
+ netdev->netdev_ops = &br2684_netdev_ops;
+@@ -595,7 +599,7 @@ static void br2684_setup_routed(struct net_device *netdev)
+ struct br2684_dev *brdev = BRPRIV(netdev);
+
+ brdev->net_dev = netdev;
+- netdev->hard_header_len = 0;
++ netdev->hard_header_len = sizeof(llc_oui_ipv4); /* worst case */
+ netdev->netdev_ops = &br2684_netdev_ops_routed;
+ netdev->addr_len = 0;
+ netdev->mtu = 1500;
+
+From: Pascal Hambourg <pascal@plouf.fr.eu.org>
+Date: Wed, 17 Aug 2011 08:37:52 +0200
+Subject: [PATCH 2/2] atm: br2684: Avoid alignment issues
+
+Use memcmp() instead of cast to u16 when checking the PAD field.
+
+Signed-off-by: Pascal Hambourg <pascal@plouf.fr.eu.org>
+Signed-off-by: chas williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
+---
+ net/atm/br2684.c | 3 ++-
+ 1 files changed, 2 insertions(+), 1 deletions(-)
+
+diff --git a/net/atm/br2684.c b/net/atm/br2684.c
+index ed72263..353fccf 100644
+--- a/net/atm/br2684.c
++++ b/net/atm/br2684.c
+@@ -53,6 +53,7 @@ static const unsigned char ethertype_ipv4[] = { ETHERTYPE_IPV4 };
+ static const unsigned char ethertype_ipv6[] = { ETHERTYPE_IPV6 };
+ static const unsigned char llc_oui_pid_pad[] =
+ { LLC, SNAP_BRIDGED, PID_ETHERNET, PAD_BRIDGED };
++static const unsigned char pad[] = { PAD_BRIDGED };
+ static const unsigned char llc_oui_ipv4[] = { LLC, SNAP_ROUTED, ETHERTYPE_IPV4 };
+ static const unsigned char llc_oui_ipv6[] = { LLC, SNAP_ROUTED, ETHERTYPE_IPV6 };
+
+@@ -453,7 +454,7 @@ static void br2684_push(struct atm_vcc *atmvcc, struct sk_buff *skb)
+ skb->pkt_type = PACKET_HOST;
+ } else { /* p_bridged */
+ /* first 2 chars should be 0 */
+- if (*((u16 *) (skb->data)) != 0)
++ if (memcmp(skb->data, pad, BR2684_PAD_LEN) != 0)
+ goto error;
+ skb_pull(skb, BR2684_PAD_LEN);
+ skb->protocol = eth_type_trans(skb, net_dev);
diff --git a/target/linux/generic/patches-3.1/051-linux_atm-chas.patch b/target/linux/generic/patches-3.1/051-linux_atm-chas.patch
new file mode 100644
index 000000000..08bb77df6
--- /dev/null
+++ b/target/linux/generic/patches-3.1/051-linux_atm-chas.patch
@@ -0,0 +1,83 @@
+
+
+From: Pascal Hambourg <pascal@plouf.fr.eu.org>
+Date: Wed, 17 Aug 2011 08:37:18 +0200
+Subject: [PATCH 1/2] atm: br2684: Make headroom and hard_header_len depend on the payload type
+
+Routed payload requires less headroom than bridged payload.
+So do not reallocate headroom if not needed.
+Also, add worst case AAL5 overhead to netdev->hard_header_len.
+
+Signed-off-by: Pascal Hambourg <pascal@plouf.fr.eu.org>
+Signed-off-by: chas williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
+---
+ net/atm/br2684.c | 8 ++++++--
+ 1 files changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/net/atm/br2684.c b/net/atm/br2684.c
+index 53b0aa1..ed72263 100644
+--- a/net/atm/br2684.c
++++ b/net/atm/br2684.c
+@@ -202,7 +202,10 @@ static int br2684_xmit_vcc(struct sk_buff *skb, struct net_device *dev,
+ {
+ struct br2684_dev *brdev = BRPRIV(dev);
+ struct atm_vcc *atmvcc;
+- int minheadroom = (brvcc->encaps == e_llc) ? 10 : 2;
++ int minheadroom = (brvcc->encaps == e_llc) ?
++ ((brdev->payload == p_bridged) ?
++ sizeof(llc_oui_pid_pad) : sizeof(llc_oui_ipv4)) :
++ ((brdev->payload == p_bridged) ? BR2684_PAD_LEN : 0);
+
+ if (skb_headroom(skb) < minheadroom) {
+ struct sk_buff *skb2 = skb_realloc_headroom(skb, minheadroom);
+@@ -583,6 +586,7 @@ static void br2684_setup(struct net_device *netdev)
+ struct br2684_dev *brdev = BRPRIV(netdev);
+
+ ether_setup(netdev);
++ netdev->hard_header_len += sizeof(llc_oui_pid_pad); /* worst case */
+ brdev->net_dev = netdev;
+
+ netdev->netdev_ops = &br2684_netdev_ops;
+@@ -595,7 +599,7 @@ static void br2684_setup_routed(struct net_device *netdev)
+ struct br2684_dev *brdev = BRPRIV(netdev);
+
+ brdev->net_dev = netdev;
+- netdev->hard_header_len = 0;
++ netdev->hard_header_len = sizeof(llc_oui_ipv4); /* worst case */
+ netdev->netdev_ops = &br2684_netdev_ops_routed;
+ netdev->addr_len = 0;
+ netdev->mtu = 1500;
+
+From: Pascal Hambourg <pascal@plouf.fr.eu.org>
+Date: Wed, 17 Aug 2011 08:37:52 +0200
+Subject: [PATCH 2/2] atm: br2684: Avoid alignment issues
+
+Use memcmp() instead of cast to u16 when checking the PAD field.
+
+Signed-off-by: Pascal Hambourg <pascal@plouf.fr.eu.org>
+Signed-off-by: chas williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
+---
+ net/atm/br2684.c | 3 ++-
+ 1 files changed, 2 insertions(+), 1 deletions(-)
+
+diff --git a/net/atm/br2684.c b/net/atm/br2684.c
+index ed72263..353fccf 100644
+--- a/net/atm/br2684.c
++++ b/net/atm/br2684.c
+@@ -53,6 +53,7 @@ static const unsigned char ethertype_ipv4[] = { ETHERTYPE_IPV4 };
+ static const unsigned char ethertype_ipv6[] = { ETHERTYPE_IPV6 };
+ static const unsigned char llc_oui_pid_pad[] =
+ { LLC, SNAP_BRIDGED, PID_ETHERNET, PAD_BRIDGED };
++static const unsigned char pad[] = { PAD_BRIDGED };
+ static const unsigned char llc_oui_ipv4[] = { LLC, SNAP_ROUTED, ETHERTYPE_IPV4 };
+ static const unsigned char llc_oui_ipv6[] = { LLC, SNAP_ROUTED, ETHERTYPE_IPV6 };
+
+@@ -453,7 +454,7 @@ static void br2684_push(struct atm_vcc *atmvcc, struct sk_buff *skb)
+ skb->pkt_type = PACKET_HOST;
+ } else { /* p_bridged */
+ /* first 2 chars should be 0 */
+- if (*((u16 *) (skb->data)) != 0)
++ if (memcmp(skb->data, pad, BR2684_PAD_LEN) != 0)
+ goto error;
+ skb_pull(skb, BR2684_PAD_LEN);
+ skb->protocol = eth_type_trans(skb, net_dev);