Message ID | 1458569575-2314-1-git-send-email-bhanuprakash.bodireddy@intel.com |
---|---|
State | Changes Requested |
Headers | show |
On 03/21/2016 04:12 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/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@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" Limiting autodetection to x86_64-native-linuxapp-gcc seems ... quite limited. That would not, for example, find DPDK on Fedora or RHEL since the target name is x86_64-default-linuxapp-gcc on x86_64, never mind non-x86_64 architectures. I'd suggest figuring the target name from $DEFAULT_RTE_SDK/*/.config matches, that is what rhel/openvswitch-fedora.spec does to solve this problem. Sorry for not noticing this on the first round. > + 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" > OTOH... there's another way of looking at it all: with DPDK >= 2.2 standard installation, the library and includes should actually be in the regular compiler etc search paths and all this poking around be unnecessary, you could just try to link to it. That said, I wouldn't be surprised if there are some further gotchas to sort in that direction. - Panu -
Hello Panu, My answers inline. -----Original Message----- From: Panu Matilainen [mailto:pmatilai@redhat.com] Sent: Wednesday, March 23, 2016 1:20 PM To: Bodireddy, Bhanuprakash <bhanuprakash.bodireddy@intel.com>; dev@openvswitch.org Subject: Re: [PATCH v2] acinclude: Autodetect DPDK location when configuring OVS On 03/21/2016 04:12 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/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@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" Limiting autodetection to x86_64-native-linuxapp-gcc seems ... quite limited. That would not, for example, find DPDK on Fedora or RHEL since the target name is x86_64-default-linuxapp-gcc on x86_64, never mind non-x86_64 architectures. I'd suggest figuring the target name from $DEFAULT_RTE_SDK/*/.config matches, that is what rhel/openvswitch-fedora.spec does to solve this problem. [BHANU] Good point. Will handle this case. Sorry for not noticing this on the first round. > + 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" > OTOH... there's another way of looking at it all: with DPDK >= 2.2 standard installation, the library and includes should actually be in the regular compiler etc search paths and all this poking around be unnecessary, you could just try to link to it. That said, I wouldn't be surprised if there are some further gotchas to sort in that direction. [BHANU] I quickly verified this by installing latest DPDK on fedora22. In this case the DPDK library got installed in /usr/local/lib and the header files in to /usr/local/include/dpdk/ directory. I presume in case of RHEL it may be /usr/lib & /usr/lib/include/dpdk. I would rework the patch to handle the below cases. - In auto discovery approach, find and link against dpdk library found in default Library search path. - In other case, link against the dpdk library present in the DPDK build location passed on "--with-dpdk". Regards, Bhanu Prakash. - Panu -
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"
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@intel.com> --- acinclude.m4 | 41 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-)