]> The Tcpdump Group git mirrors - libpcap/commitdiff
update configure and cmake
authorjingleyang <[email protected]>
Sun, 23 Dec 2018 16:04:17 +0000 (00:04 +0800)
committerjingleyang <[email protected]>
Sun, 23 Dec 2018 16:04:17 +0000 (00:04 +0800)
.travis.yml
CMakeLists.txt
configure
configure.ac
pcap-dpdk.c

index 41ea9cd219947fb17532876207fa3e521c1bd3be..4adf82ae3b882f456374ce14a7d0d0b6a8f55ed8 100644 (file)
@@ -54,6 +54,7 @@ addons:
       - libbluetooth-dev
       - libnl-genl-3-dev
       - libibverbs-dev
+      - libnuma-dev
 
 git:
   quiet: true
index f0e9ba8fe44719ff6efcd9d08a22620b831b30a1..3a61334aa198b7cf7d27825b60bc12d8c334f204 100644 (file)
@@ -1415,6 +1415,12 @@ endif()
 
 # Check for DPDK sniffing support
 if (NOT DISABLE_DPDK)
+       if (NOT DEFINED DPDK_INC_DIR)
+               set(DPDK_INC_DIR $ENV{RTE_SDK}/$ENV{RTE_TARGET}/include)
+       endif()
+       if (NOT DEFINED DPDK_LIB_DIR)
+               set(DPDK_LIB_DIR $ENV{RTE_SDK}/$ENV{RTE_TARGET}/lib)
+       endif()
        set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} "-march=native")
        include_directories(AFTER ${DPDK_INC_DIR})
        link_directories(AFTER ${DPDK_LIB_DIR})
index 5ca0e18eb93bd347800aee6c5a5dac93b702709a..4b98e50fffb9421bffe1df986c5df31803fb137b 100755 (executable)
--- a/configure
+++ b/configure
@@ -723,7 +723,6 @@ infodir
 docdir
 oldincludedir
 includedir
-runstatedir
 localstatedir
 sharedstatedir
 sysconfdir
@@ -824,7 +823,6 @@ datadir='${datarootdir}'
 sysconfdir='${prefix}/etc'
 sharedstatedir='${prefix}/com'
 localstatedir='${prefix}/var'
-runstatedir='${localstatedir}/run'
 includedir='${prefix}/include'
 oldincludedir='/usr/include'
 docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@@ -1077,15 +1075,6 @@ do
   | -silent | --silent | --silen | --sile | --sil)
     silent=yes ;;
 
-  -runstatedir | --runstatedir | --runstatedi | --runstated \
-  | --runstate | --runstat | --runsta | --runst | --runs \
-  | --run | --ru | --r)
-    ac_prev=runstatedir ;;
-  -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
-  | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
-  | --run=* | --ru=* | --r=*)
-    runstatedir=$ac_optarg ;;
-
   -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
     ac_prev=sbindir ;;
   -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1223,7 +1212,7 @@ fi
 for ac_var in  exec_prefix prefix bindir sbindir libexecdir datarootdir \
                datadir sysconfdir sharedstatedir localstatedir includedir \
                oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
-               libdir localedir mandir runstatedir
+               libdir localedir mandir
 do
   eval ac_val=\$$ac_var
   # Remove trailing slashes.
@@ -1376,7 +1365,6 @@ Fine tuning of the installation directories:
   --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
   --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
   --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
-  --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]
   --libdir=DIR            object code libraries [EPREFIX/lib]
   --includedir=DIR        C header files [PREFIX/include]
   --oldincludedir=DIR     C header files for non-gcc [/usr/include]
@@ -4243,7 +4231,7 @@ else
     We can't simply define LARGE_OFF_T to be 9223372036854775807,
     since some C++ compilers masquerading as C compilers
     incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
                       && LARGE_OFF_T % 2147483647 == 1)
                      ? 1 : -1];
@@ -4289,7 +4277,7 @@ else
     We can't simply define LARGE_OFF_T to be 9223372036854775807,
     since some C++ compilers masquerading as C compilers
     incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
                       && LARGE_OFF_T % 2147483647 == 1)
                      ? 1 : -1];
@@ -4313,7 +4301,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
     We can't simply define LARGE_OFF_T to be 9223372036854775807,
     since some C++ compilers masquerading as C compilers
     incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
                       && LARGE_OFF_T % 2147483647 == 1)
                      ? 1 : -1];
@@ -4358,7 +4346,7 @@ else
     We can't simply define LARGE_OFF_T to be 9223372036854775807,
     since some C++ compilers masquerading as C compilers
     incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
                       && LARGE_OFF_T % 2147483647 == 1)
                      ? 1 : -1];
@@ -4382,7 +4370,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
     We can't simply define LARGE_OFF_T to be 9223372036854775807,
     since some C++ compilers masquerading as C compilers
     incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
                       && LARGE_OFF_T % 2147483647 == 1)
                      ? 1 : -1];
@@ -10419,7 +10407,7 @@ $as_echo "#define PCAP_SUPPORT_NETMAP 1" >>confdefs.h
 
 fi
 
-# Check for DPDK support, defualt no.
+# Check for DPDK support, defualt no. --enable-dpdk shall be setted explicitly.
 # Check whether --enable-dpdk was given.
 if test "${enable_dpdk+set}" = set; then :
   enableval=$enable_dpdk; enable_dpdk=$enableval
@@ -10433,7 +10421,6 @@ fi
 if test "${with_dpdk_includes+set}" = set; then :
   withval=$with_dpdk_includes;
        # User wants DPDK support and has specified a header directory, so use the provided value.
-       enable_dpdk=yes
        dpdk_include_dir=$withval
 
 fi
@@ -10444,7 +10431,6 @@ fi
 if test "${with_dpdk_libraries+set}" = set; then :
   withval=$with_dpdk_libraries;
        # User wants DPDK support and has specified a library directory, so use the provided value.
-       enable_dpdk=yes
        dpdk_lib_dir=$withval
 
 fi
 
 if test "x$enable_dpdk" != "xno" ; then
        # If necessary, set default paths for DPDK API headers and libraries.
-       if test -z "$dpdk_root"; then
-               dpdk_root=/usr/local
-       fi
-
        if test -z "$dpdk_include_dir"; then
-               dpdk_include_dir="$dpdk_root/include/dpdk"
+               dpdk_include_dir="$RTE_SDK/$RTE_TARGET/include"
        fi
 
        if test -z "$dpdk_lib_dir"; then
-               dpdk_lib_dir="$dpdk_root/lib"
+               dpdk_lib_dir="$RTE_SDK/$RTE_TARGET/lib"
        fi
        DPDK_MACHINE_CFLAGS="-march=native"
        DPDK_CFLAGS="$DPDK_MACHINE_CFLAGS -I$dpdk_include_dir"
index ae380c629116be45cd281e1b11cb1be9b7d55290..24df7d026bd299e10908d6efd304052a876557b9 100644 (file)
@@ -2128,7 +2128,7 @@ AC_INCLUDES_DEFAULT
        AC_SUBST(NETMAP_SRC)
 fi
 
-# Check for DPDK support, defualt no.
+# Check for DPDK support, defualt no. --enable-dpdk shall be setted explicitly. 
 AC_ARG_ENABLE([dpdk],
 [AC_HELP_STRING([--enable-dpdk],[enable dpdk support @<:@default=no@:>@])],
     [enable_dpdk=$enableval],
@@ -2138,7 +2138,6 @@ AC_ARG_WITH([dpdk-includes],
 AC_HELP_STRING([--with-dpdk-includes=IDIR],[Endace DPDK include directory, if not DIR/include]),
 [
        # User wants DPDK support and has specified a header directory, so use the provided value.
-       enable_dpdk=yes
        dpdk_include_dir=$withval
 ],[])
 
@@ -2146,22 +2145,17 @@ AC_ARG_WITH([dpdk-libraries],
 AC_HELP_STRING([--with-dpdk-libraries=LDIR],[Endace DPDK library directory, if not DIR/lib]),
 [
        # User wants DPDK support and has specified a library directory, so use the provided value.
-       enable_dpdk=yes
        dpdk_lib_dir=$withval
 ],[])
 
 if test "x$enable_dpdk" != "xno" ; then
        # If necessary, set default paths for DPDK API headers and libraries.
-       if test -z "$dpdk_root"; then
-               dpdk_root=/usr/local
-       fi
-
        if test -z "$dpdk_include_dir"; then
-               dpdk_include_dir="$dpdk_root/include/dpdk"
+               dpdk_include_dir="$RTE_SDK/$RTE_TARGET/include"
        fi
 
        if test -z "$dpdk_lib_dir"; then
-               dpdk_lib_dir="$dpdk_root/lib"
+               dpdk_lib_dir="$RTE_SDK/$RTE_TARGET/lib"
        fi
        DPDK_MACHINE_CFLAGS="-march=native"
        DPDK_CFLAGS="$DPDK_MACHINE_CFLAGS -I$dpdk_include_dir"
index 0d4a85cdd0b21477067efa9894fd4ab90ed888be..f30543c04d5153337f2957c2dfa91089a9862302 100644 (file)
 Date: Dec 16, 2018
 
 Description:
-1. Pcap-dpdk provides libpcap the ability to use DPDK with the device name as dpdk:[portid], such as dpdk:0.
+1. Pcap-dpdk provides libpcap the ability to use DPDK with the device name as dpdk:{portid}, such as dpdk:0.
 2. DPDK is a set of libraries and drivers for fast packet processing. (https://www.dpdk.org/) 
+3. The testprogs/capturetest provides 6.4Gbps/800,000 pps on Intel 10-Gigabit X540-AT2 with DPDK 18.11.
 
 Limitations:
-1. By default enable_dpdk is no, unless you set inlcudes and lib dir
-by --with-dpdk-includes= --with-dpdk-libraries=
+1. By default DPDK support is no, unless you explicitly set --enable-dpdk with ./configure or -DDISABLE_DPDK=OFF with cmake.
 2. Only support link libdpdk.so dynamicly, because the libdpdk.a will not work correctly.
 3. Only support read operation, and packet injection has not been supported yet.
-4. I have tested on DPDK v18.11.
+
 Usage:
 1. compile DPDK as shared library and install.(https://github.com/DPDK/dpdk.git)
 
 You shall modify the file $RTE_SDK/$RTE_TARGET/.config and set:
 CONFIG_RTE_BUILD_SHARED_LIB=y
+By the following command:
+sed -i 's/CONFIG_RTE_BUILD_SHARED_LIB=n/CONFIG_RTE_BUILD_SHARED_LIB=y/' $RTE_SDK/$RTE_TARGET/.config
 
 2. launch l2fwd that is one of DPDK examples correctly, and get device information.
 
@@ -53,13 +55,18 @@ $RTE_SDK/examples/l2fwd/$RTE_TARGET/l2fwd -dlibrte_pmd_e1000.so -dlibrte_pmd_ixg
 
 3. compile libpcap with dpdk options.
 
-you shall run the following command to generate a new configure
+In order to find inlucde and lib automatically, you shall export DPDK envionment variable which are used for compiling DPDK.
+
+export RTE_SDK={your DPDK base directory}
+export RTE_TARGET={your target name}
+
+3.1 with configure
+
+./configure --enable-dpdk --with-dpdk-includes=$RTE_SDK/$RTE_TARGET/include --with-dpdk-libraries=$RTE_SDK/$RTE_TARGET/lib && make -s all && make -s testprogs && make install
 
-make clean
-autoreconf
+3.2 with cmake
 
-Then, run configure with dpdk options.
-For Ubuntu, they are --with-dpdk-includes=/usr/local/include/dpdk/ --with-dpdk-libraries=/usr/local/lib
+mkdir -p build && cd build && cmake -DDISABLE_DPDK=OFF -DDPDK_INC_DIR=$RTE_SDK/$RTE_TARGET/include -DDPDK_LIB_DIR=$RTE_SDK/$RTE_TARGET/lib" ../ && make -s all && make -s testprogs && make install 
 
 4. link your own program with libpcap, and use DPDK with the device name as dpdk:{portid}, such as dpdk:0.
 And you shall set DPDK configure options by environment variable DPDK_CFG