Signed-off-by: Pravin B Shelar <pshe...@nicira.com> --- datapath/linux/compat/include/net/dst.h | 22 ++++++++++++++++++++++ datapath/tunnel.c | 2 +- datapath/tunnel.h | 14 -------------- 3 files changed, 23 insertions(+), 15 deletions(-)
diff --git a/datapath/linux/compat/include/net/dst.h b/datapath/linux/compat/include/net/dst.h index f481a9d..5341daa 100644 --- a/datapath/linux/compat/include/net/dst.h +++ b/datapath/linux/compat/include/net/dst.h @@ -14,4 +14,26 @@ static inline void skb_dst_drop(struct sk_buff *skb) #endif +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) +/* + * On these kernels we have a fast mechanism to tell if the ARP cache for a + * particular destination has changed. + **/ +#define HAVE_HH_SEQ +#endif + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) +/* + * On these kernels we have a fast mechanism to tell if the routing table + * has changed. + **/ +#define HAVE_RT_GENID + +static inline int rt_genid(struct net *net) +{ + return atomic_read(&net->ipv4.rt_genid); +} + +#endif + #endif diff --git a/datapath/tunnel.c b/datapath/tunnel.c index 33d2fe9..76db7a5 100644 --- a/datapath/tunnel.c +++ b/datapath/tunnel.c @@ -825,7 +825,7 @@ static bool check_cache_valid(const struct tnl_cache *cache, time_before(jiffies, cache->expiration) && #endif #ifdef HAVE_RT_GENID - atomic_read(&init_net.ipv4.rt_genid) == cache->rt->rt_genid && + rt_genid(&init_net) == cache->rt->rt_genid && #endif #ifdef HAVE_HH_SEQ hh->hh_lock.sequence == cache->hh_seq && diff --git a/datapath/tunnel.h b/datapath/tunnel.h index 6865ae6..3975227 100644 --- a/datapath/tunnel.h +++ b/datapath/tunnel.h @@ -141,20 +141,6 @@ struct tnl_ops { struct dst_entry *, struct sk_buff *); }; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) -/* - * On these kernels we have a fast mechanism to tell if the ARP cache for a - * particular destination has changed. - */ -#define HAVE_HH_SEQ -#endif -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) -/* - * On these kernels we have a fast mechanism to tell if the routing table - * has changed. - */ -#define HAVE_RT_GENID -#endif #if !defined(HAVE_HH_SEQ) || !defined(HAVE_RT_GENID) /* If we can't detect all system changes directly we need to use a timeout. */ #define NEED_CACHE_TIMEOUT -- 1.7.1 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev