diff mbox

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

Message ID 1458299491-13560-1-git-send-email-bhanuprakash.bodireddy@intel.com
State Changes Requested
Headers show

Commit Message

Bodireddy, Bhanuprakash March 18, 2016, 11:11 a.m. UTC
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/src.

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

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
---
 acinclude.m4 |   36 ++++++++++++++++++++++++++++++++++--
 1 files changed, 34 insertions(+), 2 deletions(-)

Comments

Panu Matilainen March 18, 2016, 11:22 a.m. UTC | #1
On 03/18/2016 01:11 PM, Bhanuprakash Bodireddy wrote:
> 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/src.
>
> This patch fixes the problem by searching for DPDK libraries in
> standard location and configures OVS sources for dpdk datapath.
>
> Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
> ---
>   acinclude.m4 |   36 ++++++++++++++++++++++++++++++++++--
>   1 files changed, 34 insertions(+), 2 deletions(-)
>
> diff --git a/acinclude.m4 b/acinclude.m4
> index 74f0494..c1036e4 100644
> --- a/acinclude.m4
> +++ b/acinclude.m4
> @@ -163,9 +163,41 @@ 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])
> +      DEFAULT_RTE_SDK="/usr/src/dpdk*"
> +      DEFAULT_RTE_TARGET="x86_64-native-linuxapp-gcc"
> +      dpdk_build=`find $DEFAULT_RTE_SDK -name $DEFAULT_RTE_TARGET 2>/dev/null | head -1`
> +      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"
> +        fi
> +      else
> +        AC_MSG_ERROR([Unable to find dpdk in /usr/src, if installed in a non-standard location specify the target location using '--with-dpdk' option])
> +      fi

Um, /usr/src is in no way a standard location for dpdk. "make install" 
in dpdk >= 2.2.0 installs the sdk environment to 
<prefix>/share/dpdk/<target> where <prefix> by upstream default is 
/usr/local. Distros are likely to use /usr as the prfix.

I'd suggest using the dpdk upstream installation layout as a starting 
point for automatic discovery.

	- Panu -
Bodireddy, Bhanuprakash March 20, 2016, 8:38 p.m. UTC | #2
Hello Panu,

Thanks for the comments.  I have  follow up question on the auto discovery of DPDK install location. 
As the  DPDK install location can vary with distros, do OVS configure script has to search for DPDK libraries in /usr/local/share as a starting point and proceed to /usr/share location (or) search only in /usr/local/share and throw up an error in case of missing libraries? 

I shall send out the updated patch based on your feedback.

Regards,
Bhanu Prakash.

-----Original Message-----
From: Panu Matilainen [mailto:pmatilai@redhat.com] 

Sent: Friday, March 18, 2016 11:23 AM
To: Bodireddy, Bhanuprakash <bhanuprakash.bodireddy@intel.com>; dev@openvswitch.org
Subject: Re: [ovs-dev] [PATCH] acinclude: Autodetect DPDK location when configuring OVS

On 03/18/2016 01:11 PM, Bhanuprakash Bodireddy wrote:
> 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/src.

>

> This patch fixes the problem by searching for DPDK libraries in 

> standard location and configures OVS sources for dpdk datapath.

>

> Signed-off-by: Bhanuprakash Bodireddy 

> <bhanuprakash.bodireddy@intel.com>

> ---

>   acinclude.m4 |   36 ++++++++++++++++++++++++++++++++++--

>   1 files changed, 34 insertions(+), 2 deletions(-)

>

> diff --git a/acinclude.m4 b/acinclude.m4 index 74f0494..c1036e4 100644

> --- a/acinclude.m4

> +++ b/acinclude.m4

> @@ -163,9 +163,41 @@ 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])

> +      DEFAULT_RTE_SDK="/usr/src/dpdk*"

> +      DEFAULT_RTE_TARGET="x86_64-native-linuxapp-gcc"

> +      dpdk_build=`find $DEFAULT_RTE_SDK -name $DEFAULT_RTE_TARGET 2>/dev/null | head -1`

> +      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"

> +        fi

> +      else

> +        AC_MSG_ERROR([Unable to find dpdk in /usr/src, if installed in a non-standard location specify the target location using '--with-dpdk' option])

> +      fi


Um, /usr/src is in no way a standard location for dpdk. "make install" 
in dpdk >= 2.2.0 installs the sdk environment to <prefix>/share/dpdk/<target> where <prefix> by upstream default is /usr/local. Distros are likely to use /usr as the prfix.

I'd suggest using the dpdk upstream installation layout as a starting point for automatic discovery.

	- Panu -


--------------------------------------------------------------
Intel Research and Development Ireland Limited
Registered in Ireland
Registered Office: Collinstown Industrial Park, Leixlip, County Kildare
Registered Number: 308263


This e-mail and any attachments may contain confidential material for the sole
use of the intended recipient(s). Any review or distribution by others is
strictly prohibited. If you are not the intended recipient, please contact the
sender and delete all copies.
Panu Matilainen March 21, 2016, 9:23 a.m. UTC | #3
On 03/20/2016 10:38 PM, Bodireddy, Bhanuprakash wrote:
> Hello Panu,
>
> Thanks for the comments.  I have  follow up question on the auto discovery of DPDK install location.
> As the  DPDK install location can vary with distros, do OVS configure script has to search for DPDK libraries in /usr/local/share as a starting point and proceed to /usr/share location (or) search only in /usr/local/share and throw up an error in case of missing libraries?

I'd say try the most likely prefixes (/usr/local and /usr) and error out 
if not found.

On a related note, if a path is manually specified in --with-dpdk then 
autodiscovery should be skipped, whether the specified path contains 
dpdk or not.

> I shall send out the updated patch based on your feedback.

Thanks for working on this.

Another, a different kind of approach would be working on adding a 
pkg-config file to dpdk which would largely make this kind of guessing 
unnecessary.


>
> --------------------------------------------------------------
> Intel Research and Development Ireland Limited
> Registered in Ireland
> Registered Office: Collinstown Industrial Park, Leixlip, County Kildare
> Registered Number: 308263
>
>
> This e-mail and any attachments may contain confidential material for the sole
> use of the intended recipient(s). Any review or distribution by others is
> strictly prohibited. If you are not the intended recipient, please contact the
> sender and delete all copies.
>

This kind of disclaimer is meaningless and not very appropriate on a 
public mailing list, please remove it.

	- Panu -
diff mbox

Patch

diff --git a/acinclude.m4 b/acinclude.m4
index 74f0494..c1036e4 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -163,9 +163,41 @@  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])
+      DEFAULT_RTE_SDK="/usr/src/dpdk*"
+      DEFAULT_RTE_TARGET="x86_64-native-linuxapp-gcc"
+      dpdk_build=`find $DEFAULT_RTE_SDK -name $DEFAULT_RTE_TARGET 2>/dev/null | head -1`
+      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"
+        fi
+      else
+        AC_MSG_ERROR([Unable to find dpdk in /usr/src, if installed in a non-standard location specify the target location using '--with-dpdk' option])
+      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([Invalid dpdk build directory $with_dpdk])
+      fi
+      ;;
+  esac
 
+  if test X"$RTE_SDK" != X; then
     DPDK_INCLUDE=$RTE_SDK/include
     DPDK_LIB_DIR=$RTE_SDK/lib
     DPDK_LIB="-ldpdk"