From 143af30e2d940ad78412a287de1f3ac15ab4a1aa Mon Sep 17 00:00:00 2001 From: Pravin B Shelar Date: Tue, 8 Nov 2011 15:25:12 -0800 Subject: [PATCH] datapath: Update kernel support to 3.2. Signed-off-by: Pravin B Shelar Acked-by: Jesse Gross Bug #7772 --- datapath/brcompat.c | 1 + datapath/datapath.c | 4 ++-- datapath/linux/compat/include/linux/skbuff.h | 7 +++++++ datapath/tunnel.c | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/datapath/brcompat.c b/datapath/brcompat.c index 718e4897..bd223c7d 100644 --- a/datapath/brcompat.c +++ b/datapath/brcompat.c @@ -8,6 +8,7 @@ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt +#include #include #include #include diff --git a/datapath/datapath.c b/datapath/datapath.c index d2815e5d..9a22aab8 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -53,8 +53,8 @@ #include "vport-internal_dev.h" #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) || \ - LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0) -#error Kernels before 2.6.18 or after 3.1 are not supported by this version of Open vSwitch. + LINUX_VERSION_CODE > KERNEL_VERSION(3,2,0) +#error Kernels before 2.6.18 or after 3.2 are not supported by this version of Open vSwitch. #endif int (*dp_ioctl_hook)(struct net_device *dev, struct ifreq *rq, int cmd); diff --git a/datapath/linux/compat/include/linux/skbuff.h b/datapath/linux/compat/include/linux/skbuff.h index ccf47171..456d7446 100644 --- a/datapath/linux/compat/include/linux/skbuff.h +++ b/datapath/linux/compat/include/linux/skbuff.h @@ -232,4 +232,11 @@ static inline bool skb_warn_if_lro(const struct sk_buff *skb) #define consume_skb kfree_skb #endif +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,2,0) +static inline struct page *skb_frag_page(const skb_frag_t *frag) +{ + return frag->page; +} +#endif + #endif diff --git a/datapath/tunnel.c b/datapath/tunnel.c index 024861fc..19056b97 100644 --- a/datapath/tunnel.c +++ b/datapath/tunnel.c @@ -1045,7 +1045,7 @@ static bool need_linearize(const struct sk_buff *skb) * change them from underneath us and we can skip the linearization. */ for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) - if (unlikely(page_count(skb_shinfo(skb)->frags[i].page) > 1)) + if (unlikely(page_count(skb_frag_page(&skb_shinfo(skb)->frags[i])) > 1)) return true; return false; -- 2.30.2