[ovs-dev] [PATCH v2] acinclude: Autodetect DPDK location when configuring OVS

Bhanuprakash Bodireddy bhanuprakash.bodireddy at intel.com
Mon Mar 21 14:12:55 UTC 2016


When using DPDK datapath, the OVS configure script requires the DPDK
build directory passed on --with-dpdk. This can be avoided if the DPDK
is installed in standard location i.e /usr/local/share/dpdk (or)
/usr/share/dpdk

This patch fixes the problem by searching for DPDK libraries in standard
location and configures OVS sources for dpdk datapath.

If the install location is manually specified in "--with-dpdk"
autodiscovery shall be skipped.

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy at intel.com>
---
 acinclude.m4 | 41 +++++++++++++++++++++++++++++++++++++++--
 1 file changed, 39 insertions(+), 2 deletions(-)

diff --git a/acinclude.m4 b/acinclude.m4
index 74f0494..d780759 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -163,9 +163,46 @@ AC_DEFUN([OVS_CHECK_DPDK], [
               [AC_HELP_STRING([--with-dpdk=/path/to/dpdk],
                               [Specify the DPDK build directory])])
 
-  if test X"$with_dpdk" != X; then
-    RTE_SDK=$with_dpdk
+  RTE_SDK=""
+  AC_MSG_CHECKING([whether dpdk datapath is enabled])
+  case "$with_dpdk" in
+    yes)
+      AC_MSG_RESULT([$with_dpdk])
+      INSTALL_PREFIX="/usr/local /usr"
+      for i in $INSTALL_PREFIX; do
+          DEFAULT_RTE_SDK="$i/share/dpdk"
+          DEFAULT_RTE_TARGET="x86_64-native-linuxapp-gcc"
+          DPDK_BUILD=$DEFAULT_RTE_SDK/$DEFAULT_RTE_TARGET
+          if test -d "$DPDK_BUILD"; then
+            AC_CHECK_FILE("$DPDK_BUILD/lib/libdpdk.a", dpdk_lib=1, [AC_CHECK_FILE("$DPDK_BUILD/lib/libdpdk.so", dpdk_lib=1, dpdk_lib=0)])
+            if test "$dpdk_lib" = 1; then
+              RTE_SDK="$DPDK_BUILD"
+              break
+            fi
+          fi
+      done
+      if test -z "$RTE_SDK"; then
+        AC_MSG_ERROR([Could not find DPDK libraries in $INSTALL_PREFIX directories, Use '--with-dpdk' to specify the path to DPDK libraries installed in non-standard location])
+      fi
+      ;;
+    no)
+      AC_MSG_RESULT([$with_dpdk])
+      ;;
+    "")
+      AC_MSG_RESULT([no])
+      ;;
+    *)
+      AC_MSG_RESULT([yes])
+      AC_CHECK_FILE("$with_dpdk/lib/libdpdk.a", dpdk_lib=1, [AC_CHECK_FILE("$with_dpdk/lib/libdpdk.so", dpdk_lib=1, dpdk_lib=0)])
+      if test "$dpdk_lib" = 1; then
+        RTE_SDK="$with_dpdk"
+      else
+        AC_MSG_ERROR([Could not find DPDK libraries in $with_dpdk/lib])
+      fi
+      ;;
+  esac
 
+  if test X"$RTE_SDK" != X; then
     DPDK_INCLUDE=$RTE_SDK/include
     DPDK_LIB_DIR=$RTE_SDK/lib
     DPDK_LIB="-ldpdk"
-- 
2.4.3




More information about the dev mailing list