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

Pravin B Shelar pshelar at nicira.com
Wed Sep 4 19:56:10 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        |   14 ++++++++------
 datapath/datapath.c |    5 -----
 2 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/acinclude.m4 b/acinclude.m4
index 73ee5ce..8145340 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -134,14 +134,16 @@ AC_DEFUN([OVS_CHECK_LINUX], [
     AC_MSG_RESULT([$kversion])
 
     if test "$version" -ge 3; then
-       : # Linux 3.x
-    elif test "$version" = 2 && test "$patchlevel" -ge 6; then
-       : # Linux 2.6.x
+       if test "$version" = 3 && 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
     else
-       if test "$KBUILD" = "$KSRC"; then
-         AC_ERROR([Linux kernel in $KBUILD is version $kversion, but version 2.6 or later is required])
+       if test "$version" -le 1 || test "$patchlevel" -le 5 || test "$sublevel" -le 31; then
+         AC_ERROR([Linux kernel in $KBUILD is version $kversion, but version 2.6.32 or later is required])
        else
-         AC_ERROR([Linux kernel in build tree $KBUILD (source tree $KSRC) is version $kversion, but version 2.6 or later is required])
+         : # Linux 2.6.x
        fi
     fi
     if (test ! -e "$KBUILD"/include/linux/version.h && \
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