compat: backport __netdev_alloc_skb_ip_align()
authorLuis R. Rodriguez <mcgrof@frijolero.org>
Tue, 3 Apr 2012 00:05:38 +0000 (17:05 -0700)
committerLuis R. Rodriguez <mcgrof@frijolero.org>
Tue, 3 Apr 2012 00:05:38 +0000 (17:05 -0700)
mcgrof@tux ~/compat (git::master)$ ckmake
Trying kernel                  3.3.0-030300rc2-generic [OK]
Trying kernel                     3.2.2-030202-generic [OK]
Trying kernel                    3.1.10-030110-generic [OK]
Trying kernel                    3.0.18-030018-generic [OK]
Trying kernel                  2.6.39-02063904-generic [OK]
Trying kernel                  2.6.38-02063808-generic [OK]
Trying kernel                  2.6.37-02063706-generic [OK]
Trying kernel                  2.6.36-02063604-generic [OK]
Trying kernel                  2.6.35-02063512-generic [OK]
Trying kernel                  2.6.34-02063410-generic [OK]
Trying kernel                  2.6.33-02063305-generic [OK]
Trying kernel                  2.6.32-02063255-generic [OK]
Trying kernel                  2.6.31-02063113-generic [OK]
Trying kernel                  2.6.30-02063010-generic [OK]
Trying kernel                  2.6.29-02062906-generic [OK]
Trying kernel                  2.6.28-02062810-generic [OK]
Trying kernel                    2.6.27-020627-generic [OK]
Trying kernel                    2.6.26-020626-generic [OK]
Trying kernel                    2.6.25-020625-generic [OK]
Trying kernel                    2.6.24-020624-generic [OK]

Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
include/linux/compat-3.1.h

index 845499b..1e8e05e 100644 (file)
@@ -6,6 +6,17 @@
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0))
 
 #include <linux/security.h>
+#include <linux/skbuff.h>
+
+static inline struct sk_buff *__netdev_alloc_skb_ip_align(struct net_device *dev,
+                                                         unsigned int length, gfp_t gfp)
+{
+       struct sk_buff *skb = __netdev_alloc_skb(dev, length + NET_IP_ALIGN, gfp);
+
+       if (NET_IP_ALIGN && skb)
+               skb_reserve(skb, NET_IP_ALIGN);
+       return skb;
+}
 
 #define IS_ENABLED(option) defined(option)