Don't define skb_copy_{to,from}_linear_data_offset if it is available.
authorBen Pfaff <blp@nicira.com>
Tue, 3 Feb 2009 18:27:22 +0000 (10:27 -0800)
committerBen Pfaff <blp@nicira.com>
Tue, 3 Feb 2009 18:27:22 +0000 (10:27 -0800)
Linux 2.6.22 introduced functions skb_copy_from_linear_data_offset()
and skb_copy_to_linear_data_offset().  In earlier versions we defined them.
But Xen backports these functions, so this became a duplicate definition.
So check for them at configure time instead of depending on the kernel
version number.

acinclude.m4
datapath/linux-2.6/compat-2.6/include/linux/skbuff.h

index d4795fd5bc5181fe63fb2c73f1f9a3931aadc363..c9c9f7a11dce2302a8fed19610ddd3773f8176e9 100644 (file)
@@ -120,6 +120,9 @@ AC_DEFUN([OFP_CHECK_LINUX26_COMPAT], [
                   [OFP_DEFINE([HAVE_SKBUFF_HEADER_HELPERS])])
   OFP_GREP_IFELSE([$KSRC26/include/linux/skbuff.h], [raw],
                   [OFP_DEFINE([HAVE_MAC_RAW])])
+  OFP_GREP_IFELSE([$KSRC26/include/linux/skbuff.h], 
+                  [skb_copy_from_linear_data_offset],
+                  [OFP_DEFINE([HAVE_SKB_COPY_FROM_LINEAR_DATA_OFFSET])])
   OFP_GREP_IFELSE([$KSRC26/include/net/netlink.h], [NLA_NUL_STRING],
                   [OFP_DEFINE([HAVE_NLA_NUL_STRING])])
   OFP_CHECK_VETH
index 9d38c46d859b2d7db7540a8e94a633f964a919c0..55d32eb1d87029627da813004ceb85a8da4ad8a9 100644 (file)
@@ -5,7 +5,7 @@
 
 #include <linux/version.h>
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22)
+#ifndef HAVE_SKB_COPY_FROM_LINEAR_DATA_OFFSET
 static inline void skb_copy_from_linear_data_offset(const struct sk_buff *skb,
                                                     const int offset, void *to,
                                                     const unsigned int len)
@@ -21,7 +21,7 @@ static inline void skb_copy_to_linear_data_offset(struct sk_buff *skb,
        memcpy(skb->data + offset, from, len);
 }
 
-#endif  /* linux < 2.6.22 */
+#endif /* !HAVE_SKB_COPY_FROM_LINEAR_DATA_OFFSET */
 
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)