[ovs-dev] [PATCH v2 02/13] datapath: Move kernel version check to configure.

Pravin B Shelar pshelar at nicira.com
Tue Sep 3 20:59:23 UTC 2013


Rather than having compile time check in datapath.c, its better
to check kernel version at configuration step.

Signed-off-by: Pravin B Shelar <pshelar at nicira.com>
---
 acinclude.m4        |   12 ++++++++++--
 datapath/datapath.c |    5 -----
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/acinclude.m4 b/acinclude.m4
index 73ee5ce..e754cfa 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -134,9 +134,17 @@ AC_DEFUN([OVS_CHECK_LINUX], [
     AC_MSG_RESULT([$kversion])
 
     if test "$version" -ge 3; then
-       : # Linux 3.x
+       if test "$patchlevel" -le 10; then
+          : # Linux 3.x
+       else
+         AC_ERROR([Linux kernel in $KBUILD is version $kversion, but version newer than 3.10.x is not supported])
+       fi
     elif test "$version" = 2 && test "$patchlevel" -ge 6; then
-       : # Linux 2.6.x
+       if test "$sublevel" -le 31; then
+         AC_ERROR([Linux kernel in $KBUILD is version $kversion, but version 2.6.32 or later is required])
+       else
+         : # Linux 2.6.x
+       fi
     else
        if test "$KBUILD" = "$KSRC"; then
          AC_ERROR([Linux kernel in $KBUILD is version $kversion, but version 2.6 or later is required])
diff --git a/datapath/datapath.c b/datapath/datapath.c
index 98651a4..b6410c4 100644
--- a/datapath/datapath.c
+++ b/datapath/datapath.c
@@ -61,11 +61,6 @@
 #include "vport-internal_dev.h"
 #include "vport-netdev.h"
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32) || \
-    LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)
-#error Kernels before 2.6.32 or after 3.10 are not supported by this version of Open vSwitch.
-#endif
-
 #define REHASH_FLOW_INTERVAL (10 * 60 * HZ)
 static void rehash_flow_table(struct work_struct *work);
 static DECLARE_DELAYED_WORK(rehash_flow_wq, rehash_flow_table);
-- 
1.7.1




More information about the dev mailing list