mac80211: assign needed_headroom/tailroom for netdevs
authorJohannes Berg <johannes@sipsolutions.net>
Tue, 13 May 2008 03:51:44 +0000 (20:51 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 13 May 2008 03:51:44 +0000 (20:51 -0700)
This assigns the netdev's needed_headroom/tailroom members to take
advantage of pre-allocated space for 802.11 headers.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/mac80211/iface.c

index 80954a5..06e88a5 100644 (file)
@@ -54,6 +54,15 @@ int ieee80211_if_add(struct net_device *dev, const char *name,
        if (!ndev)
                return -ENOMEM;
 
+       ndev->needed_headroom = local->tx_headroom +
+                               4*6 /* four MAC addresses */
+                               + 2 + 2 + 2 + 2 /* ctl, dur, seq, qos */
+                               + 6 /* mesh */
+                               + 8 /* rfc1042/bridge tunnel */
+                               - ETH_HLEN /* ethernet hard_header_len */
+                               + IEEE80211_ENCRYPT_HEADROOM;
+       ndev->needed_tailroom = IEEE80211_ENCRYPT_TAILROOM;
+
        ret = dev_alloc_name(ndev, ndev->name);
        if (ret < 0)
                goto fail;