Signed-off-by: Pritesh Kothari <pritesh.koth...@cisco.com>
---
v2: Use OVS_GREP_IFELSE instead of upstream kernel versions as Thomas suggested.
---
 FAQ                                               |    2 +-
 NEWS                                              |    2 +-
 acinclude.m4                                      |    8 ++++++--
 datapath/actions.c                                |    2 +-
 datapath/linux/Modules.mk                         |    1 +
 datapath/linux/compat/include/linux/etherdevice.h |    2 ++
 datapath/linux/compat/include/linux/if_tunnel.h   |    4 ++--
 datapath/linux/compat/include/linux/random.h      |   10 ++++++++++
 datapath/linux/compat/include/linux/skbuff.h      |    3 +++
 datapath/linux/compat/vxlan.c                     |    2 +-
 datapath/vport-lisp.c                             |    2 +-
 datapath/vport.c                                  |   12 ++++++------
 datapath/vport.h                                  |    2 +-
 13 files changed, 36 insertions(+), 16 deletions(-)
 create mode 100644 datapath/linux/compat/include/linux/random.h

diff --git a/FAQ b/FAQ
index 6b4be43..b376320 100644
--- a/FAQ
+++ b/FAQ
@@ -149,7 +149,7 @@ A: The following table lists the Linux kernel versions 
against which the
        1.11.x     2.6.18 to 3.8
        2.0.x      2.6.32 to 3.10
        2.1.x      2.6.32 to 3.11
-       2.2.x      2.6.32 to 3.13
+       2.2.x      2.6.32 to 3.14
 
    Open vSwitch userspace should also work with the Linux kernel module
    built into Linux 3.3 and later.
diff --git a/NEWS b/NEWS
index 7925598..292db8e 100644
--- a/NEWS
+++ b/NEWS
@@ -13,7 +13,7 @@ Post-v2.1.0
    - Upon the receipt of a SIGHUP signal, ovs-vswitchd no longer reopens its
      log file (it will terminate instead). Please use 'ovs-appctl vlog/reopen'
      instead.
-   - Support for Linux kernels up to 3.13. From Kernel 3.12 onwards OVS uses
+   - Support for Linux kernels up to 3.14. From Kernel 3.12 onwards OVS uses
      tunnel API for GRE and VXLAN.
    - Added DPDK support.
 
diff --git a/acinclude.m4 b/acinclude.m4
index 4269620..06983cb 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -134,10 +134,10 @@ AC_DEFUN([OVS_CHECK_LINUX], [
     AC_MSG_RESULT([$kversion])
 
     if test "$version" -ge 3; then
-       if test "$version" = 3 && test "$patchlevel" -le 13; then
+       if test "$version" = 3 && test "$patchlevel" -le 14; then
           : # Linux 3.x
        else
-         AC_ERROR([Linux kernel in $KBUILD is version $kversion, but version 
newer than 3.13.x is not supported])
+         AC_ERROR([Linux kernel in $KBUILD is version $kversion, but version 
newer than 3.14.x is not supported])
        fi
     else
        if test "$version" -le 1 || test "$patchlevel" -le 5 || test 
"$sublevel" -le 31; then
@@ -244,6 +244,9 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [
   OVS_GREP_IFELSE([$KSRC/include/linux/err.h], [ERR_CAST])
 
   OVS_GREP_IFELSE([$KSRC/include/linux/etherdevice.h], [eth_hw_addr_random])
+  OVS_GREP_IFELSE([$KSRC/include/linux/etherdevice.h], [ether_addr_copy])
+
+  OVS_GREP_IFELSE([$KSRC/include/linux/random.h], [prandom_u32])
 
   OVS_GREP_IFELSE([$KSRC/include/linux/if_vlan.h], [vlan_set_encap_proto])
 
@@ -288,6 +291,7 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [
   OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [__skb_fill_page_desc])
   OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [skb_reset_mac_len])
   OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [skb_unclone])
+  OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [skb_get_hash])
 
   OVS_GREP_IFELSE([$KSRC/include/linux/types.h], [bool],
                   [OVS_DEFINE([HAVE_BOOL_TYPE])])
diff --git a/datapath/actions.c b/datapath/actions.c
index 0b66e7c..59c5855 100644
--- a/datapath/actions.c
+++ b/datapath/actions.c
@@ -446,7 +446,7 @@ static int sample(struct datapath *dp, struct sk_buff *skb,
                 a = nla_next(a, &rem)) {
                switch (nla_type(a)) {
                case OVS_SAMPLE_ATTR_PROBABILITY:
-                       if (net_random() >= nla_get_u32(a))
+                       if (prandom_u32() >= nla_get_u32(a))
                                return 0;
                        break;
 
diff --git a/datapath/linux/Modules.mk b/datapath/linux/Modules.mk
index 1e76305..a8ec4be 100644
--- a/datapath/linux/Modules.mk
+++ b/datapath/linux/Modules.mk
@@ -43,6 +43,7 @@ openvswitch_headers += \
        linux/compat/include/linux/list.h \
        linux/compat/include/linux/log2.h \
        linux/compat/include/linux/net.h \
+       linux/compat/include/linux/random.h \
        linux/compat/include/linux/netdevice.h \
        linux/compat/include/linux/netdev_features.h \
        linux/compat/include/linux/netlink.h \
diff --git a/datapath/linux/compat/include/linux/etherdevice.h 
b/datapath/linux/compat/include/linux/etherdevice.h
index 556729d..c6e8e92 100644
--- a/datapath/linux/compat/include/linux/etherdevice.h
+++ b/datapath/linux/compat/include/linux/etherdevice.h
@@ -34,6 +34,7 @@ static inline int eth_mac_addr(struct net_device *dev, void 
*p)
 }
 #endif
 
+#ifndef HAVE_ETHER_ADDR_COPY
 static inline void ether_addr_copy(u8 *dst, const u8 *src)
 {
 #if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS)
@@ -48,5 +49,6 @@ static inline void ether_addr_copy(u8 *dst, const u8 *src)
        a[2] = b[2];
 #endif
 }
+#endif
 
 #endif
diff --git a/datapath/linux/compat/include/linux/if_tunnel.h 
b/datapath/linux/compat/include/linux/if_tunnel.h
index 96ab702..66f9b43 100644
--- a/datapath/linux/compat/include/linux/if_tunnel.h
+++ b/datapath/linux/compat/include/linux/if_tunnel.h
@@ -4,11 +4,11 @@
 #include <linux/version.h>
 #include_next <linux/if_tunnel.h>
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,14,0)
 
 #include <linux/u64_stats_sync.h>
 
-struct pcpu_tstats {
+struct pcpu_sw_netstats {
        u64     rx_packets;
        u64     rx_bytes;
        u64     tx_packets;
diff --git a/datapath/linux/compat/include/linux/random.h 
b/datapath/linux/compat/include/linux/random.h
new file mode 100644
index 0000000..f2a6d6a
--- /dev/null
+++ b/datapath/linux/compat/include/linux/random.h
@@ -0,0 +1,10 @@
+#ifndef __LINUX_RANDOM_WRAPPER_H
+#define __LINUX_RANDOM_WRAPPER_H 1
+
+#include_next <linux/random.h>
+
+#ifndef HAVE_PRANDOM_U32
+#define prandom_u32()          random32()
+#endif
+
+#endif
diff --git a/datapath/linux/compat/include/linux/skbuff.h 
b/datapath/linux/compat/include/linux/skbuff.h
index de0c56a..1745b22 100644
--- a/datapath/linux/compat/include/linux/skbuff.h
+++ b/datapath/linux/compat/include/linux/skbuff.h
@@ -264,6 +264,9 @@ void skb_zerocopy(struct sk_buff *to, const struct sk_buff 
*from, int len,
                  int hlen);
 #endif
 
+#ifndef HAVE_SKB_GET_HASH
+#define skb_get_hash skb_get_rxhash
+#endif
 
 #ifndef HAVE_SKB_HAS_FRAG_LIST
 #define skb_has_frag_list skb_has_frags
diff --git a/datapath/linux/compat/vxlan.c b/datapath/linux/compat/vxlan.c
index 848a395..b8b8fa7 100644
--- a/datapath/linux/compat/vxlan.c
+++ b/datapath/linux/compat/vxlan.c
@@ -132,7 +132,7 @@ __be16 vxlan_src_port(__u16 port_min, __u16 port_max, 
struct sk_buff *skb)
        unsigned int range = (port_max - port_min) + 1;
        u32 hash;
 
-       hash = skb_get_rxhash(skb);
+       hash = skb_get_hash(skb);
        if (!hash)
                hash = jhash(skb->data, 2 * ETH_ALEN,
                             (__force u32) skb->protocol);
diff --git a/datapath/vport-lisp.c b/datapath/vport-lisp.c
index 8e3ff69..a1e2b2b 100644
--- a/datapath/vport-lisp.c
+++ b/datapath/vport-lisp.c
@@ -165,7 +165,7 @@ static __be64 instance_id_to_tunnel_id(__u8 *iid)
  */
 static u16 get_src_port(struct net *net, struct sk_buff *skb)
 {
-       u32 hash = skb_get_rxhash(skb);
+       u32 hash = skb_get_hash(skb);
        unsigned int range;
        int high;
        int low;
diff --git a/datapath/vport.c b/datapath/vport.c
index 2673b81..23ad382 100644
--- a/datapath/vport.c
+++ b/datapath/vport.c
@@ -140,14 +140,14 @@ struct vport *ovs_vport_alloc(int priv_size, const struct 
vport_ops *ops,
        vport->ops = ops;
        INIT_HLIST_NODE(&vport->dp_hash_node);
 
-       vport->percpu_stats = alloc_percpu(struct pcpu_tstats);
+       vport->percpu_stats = alloc_percpu(struct pcpu_sw_netstats);
        if (!vport->percpu_stats) {
                kfree(vport);
                return ERR_PTR(-ENOMEM);
        }
 
        for_each_possible_cpu(i) {
-               struct pcpu_tstats *vport_stats;
+               struct pcpu_sw_netstats *vport_stats;
                vport_stats = per_cpu_ptr(vport->percpu_stats, i);
                u64_stats_init(&vport_stats->syncp);
        }
@@ -299,8 +299,8 @@ void ovs_vport_get_stats(struct vport *vport, struct 
ovs_vport_stats *stats)
        spin_unlock_bh(&vport->stats_lock);
 
        for_each_possible_cpu(i) {
-               const struct pcpu_tstats *percpu_stats;
-               struct pcpu_tstats local_stats;
+               const struct pcpu_sw_netstats *percpu_stats;
+               struct pcpu_sw_netstats local_stats;
                unsigned int start;
 
                percpu_stats = per_cpu_ptr(vport->percpu_stats, i);
@@ -369,7 +369,7 @@ int ovs_vport_get_options(const struct vport *vport, struct 
sk_buff *skb)
 void ovs_vport_receive(struct vport *vport, struct sk_buff *skb,
                       struct ovs_key_ipv4_tunnel *tun_key)
 {
-       struct pcpu_tstats *stats;
+       struct pcpu_sw_netstats *stats;
 
        stats = this_cpu_ptr(vport->percpu_stats);
        u64_stats_update_begin(&stats->syncp);
@@ -395,7 +395,7 @@ int ovs_vport_send(struct vport *vport, struct sk_buff *skb)
        int sent = vport->ops->send(vport, skb);
 
        if (likely(sent > 0)) {
-               struct pcpu_tstats *stats;
+               struct pcpu_sw_netstats *stats;
 
                stats = this_cpu_ptr(vport->percpu_stats);
 
diff --git a/datapath/vport.h b/datapath/vport.h
index 18b723e..5a42dfd 100644
--- a/datapath/vport.h
+++ b/datapath/vport.h
@@ -87,7 +87,7 @@ struct vport {
        struct hlist_node dp_hash_node;
        const struct vport_ops *ops;
 
-       struct pcpu_tstats __percpu *percpu_stats;
+       struct pcpu_sw_netstats __percpu *percpu_stats;
 
        spinlock_t stats_lock;
        struct vport_err_stats err_stats;
-- 
1.7.9.5

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to