atm: br2684: Make headroom and hard_header_len depend on the payload type
authorPascal Hambourg <pascal@plouf.fr.eu.org>
Wed, 17 Aug 2011 06:37:18 +0000 (08:37 +0200)
committerDavid S. Miller <davem@davemloft.net>
Tue, 29 Nov 2011 05:28:06 +0000 (00:28 -0500)
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/atm/br2684.c

index 53b0aa14a1e628f89059c2beb3ca02089ffd0a88..ed72263d0dc78c3a0dffbf9f2ceab8e071717e5c 100644 (file)
@@ -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;