[dpdk-dev] [PATCH] drivers/aesni_gcm: fix zero data operation

2017-08-14 Thread Pablo de Lara
When data length passed to the PMD was zero,
the PMD was trying to get more data from a non-existent
next segment.

Fixes: 9c2a5775c028 ("crypto/aesni_gcm: migrate from MB library to ISA-L")
Cc: sta...@dpdk.org

Signed-off-by: Pablo de Lara 
---
 drivers/crypto/aesni_gcm/aesni_gcm_pmd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c 
b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
index e051624..5c9004f 100644
--- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
+++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
@@ -224,7 +224,7 @@ process_gcm_crypto_op(struct aesni_gcm_qp *qp, struct 
rte_crypto_op *op,
 
RTE_ASSERT(m_src != NULL);
 
-   while (offset >= m_src->data_len) {
+   while (offset >= m_src->data_len && data_length != 0) {
offset -= m_src->data_len;
m_src = m_src->next;
 
-- 
2.9.4



Re: [dpdk-dev] [PATCH 1/2] eventdev: add event adapter for ethernet Rx queues

2017-08-14 Thread Rao, Nikhil

On 8/10/2017 10:23 PM, Jerin Jacob wrote:

-Original Message-

Date: Wed, 9 Aug 2017 19:24:30 +
From: "Eads, Gage" 
Makes sense. Are you thinking the helper function would do stop + reconfig with 
additional port + start + setup port, or just setup the port with an ID the app 
supplies (only when a port is required, of course)? The second one could be done with 
little additional code -- the app just needs to check if an additional port is needed 
when configuring the eventdev, and another helper function could take a list of 
 pairs and return true if any don't have an inbuilt port.


I am in favor adding more logic in helper function(I believe, first one ) so 
that it will help
application reuse the helper functions for the normal case.



Hi Jerin,

My understanding of the discussion above is that the simple API adapter 
creation API is


int rte_event_eth_rx_adapter_create(id, eventdev_id)

And the raw API is

typedef int (*rx_adapter_conf_cb) (id, eventdev_id,
struct rte_event_eth_rx_adapter_conf *conf, void *arg);

struct rte_event_eth_rx_adapter_conf {
uint8_t rx_event_port_id;
uint32_t max_nb_rx;
};

int rte_event_eth_rx_adapter_create_ext(id, eventdev_id, conf_cb,
conf_arg)

The conf_cb is invoked if the rte_event_eth_rx_adapter_conf struct needs 
to be filled out. the _create_ext() API is used internally by 
rte_event_eth_rx_adapter_create()


Does that look OK to you ?

Nikhil



Re: [dpdk-dev] Announcement of SSE requirement change in dpdk

2017-08-14 Thread Bruce Richardson
On Sat, Aug 12, 2017 at 02:19:45PM -0400, Neil Horman wrote:
> On Fri, Aug 11, 2017 at 09:29:24PM +0100, Bruce Richardson wrote:
> > On Wed, Aug 09, 2017 at 04:21:32PM -0400, Neil Horman wrote:
> > > Can anyone point out to me when and where the change to require SSE4.2 was
> > > dicussed?  The first I saw of it was when the commit to the release notes 
> > > went
> > > in on August 3, and I can find no prior mention of it, save for the 
> > > patches that
> > > went in separately in the prior weeks.
> > > 
> > > Neil
> > > 
> > There was no real widespread discussion of it, if that's what you are
> > looking for. I made the proposal via patch, and it was reviewed and
> > acked by a number of folks, with nobody raising any objections at the
> I had a feeling that was the case, and yes, that does concern me somewhat.  In
> this particular case I think its ok, because I can't really imagine anyone 
> using
> older atom processors, but I think it could become problematic in the future 
> If
> that support line moves too far into territory in which theres downstream
> support issues (with things like OVS or other tree-external applications)
> 
> > time. Possibly it was a change that should have been more widely
> > publicised ahead of time, but I'm not sure what form that publicization
> > should have taken, since all tech discussion happens on the dev mailing
> > list anyway.
> > Not that I'm planning any similar changes, but for the future, what do
> > you think the process for changes like this should be - and what changes
> > would classify for it? If we have a process problem, let's try and fix
> > it.
> > 
> 
> I don't rightly know, to be honest.  DPDK is a little unique in this 
> situation,
> since user libraries are built to just access the lowest common denominator 
> of a
> given arch.  And in many ways, so is the kernel.  I'm open to suggestions, 
> but I
> think so some sort of plan would be a good idea.  These are just off the top 
> of
> my head, and likely have drawbacks, but just to get some conversation started:
> 
> 1) Use extendend ISA instructions opportunistically
>   By this I mean  to say, we could implement an alternatives system,
> simmilar to what we have in the kernel, which can do dynamic instruction
> replacement based on a run time test.  For example, you can write two versions
> of a function, one which impements its method with sse4 and another version
> which does the same thing using core isa instructions).  If sse4 is available 
> at
> runtime, the sse4 variant is mapped in, else the other version is.
>   This is something we sort of talked about before, and while theres been
> general support in its philosophy, its the sort of thing that takes alot of
> work, and it is only used in those cases where you know you can use the
> acceleration.
> 
> 2) Limit where you introduce hardware deprecation
>   Perhaps hardware deprecation can be announced in the same way ABI
> deprecation is, and then introduced at a later date (I would make an opening
> argument for the next LTS release).  Using the LTS release as a deprecation
> point is nice because it lets downstream consumers standardize on a release
> without having to worry about hardware support going away.
> 
> Just my $0.02.  food for thought
> Neil
> 
I think the ABI deprecation policy suggestion is a good one, where if we
want to drop support for some HW that was otherwise supported, we should
announce it at least one release in advance to make sure everyone is
aware of it.

/Bruce


[dpdk-dev] [RFCv2 02/40] build: create pkg-config file for DPDK

2017-08-14 Thread Bruce Richardson
Signed-off-by: Bruce Richardson 
---
 meson.build | 17 -
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index 8383d23b5..d7acf174d 100644
--- a/meson.build
+++ b/meson.build
@@ -36,9 +36,10 @@ project('DPDK', 'C',
meson_version: '>= 0.40.1'
 )
 
-# set up some global vars for compiler, platform and configuration
+# set up some global vars for compiler, platform, configuration, etc.
 cc = meson.get_compiler('c')
 dpdk_conf = configuration_data()
+dpdk_libraries = []
 
 # for static libs, treat the drivers as regular libraries, otherwise
 # for shared libs, put them in a driver folder
@@ -58,3 +59,17 @@ build_cfg = 'rte_build_config.h'
 configure_file(output: build_cfg,
configuration: dpdk_conf,
install_dir: get_option('includedir'))
+
+# the DPDK libs needs to be passed to the link command in reverse order
+dpdk_link_libs = []
+foreach lib: dpdk_libraries
+   dpdk_link_libs = [lib] + dpdk_link_libs
+endforeach
+
+pkg = import('pkgconfig')
+pkg.generate(name: meson.project_name(),
+   version: meson.project_version(),
+   libraries: dpdk_link_libs,
+   description: 'The Data Plane Development Kit (DPDK)',
+   extra_cflags: '-include "rte_config.h"'
+)
-- 
2.13.4



[dpdk-dev] [RFCv2 00/40] Building DPDK with meson and ninja

2017-08-14 Thread Bruce Richardson
Following on from previous RFC [http://dpdk.org/dev/patchwork/patch/25104/]
here is a second draft implementation for building DPDK with meson and
ninja. While still not building all of DPDK, and needing patch cleanup so
that patches don't overwrite previous work, it is more complete in many
ways than the previous version and includes:

* dynamic build configuration e.g. building pcap driver only if pcap is
  found, only build af_packet if the target is linux, and only building QAT
  and openssl crypto drivers if libcrypto is found
* support for pmdinfo inside the PMDs(for shared builds) and binaries (for
  static builds)
* generalized/standardized way of building libs and drivers, though the
  drivers code still needs generalization at the driver, rather than
  driver-class level.
* support for having a pkgconfig file for DPDK on install, and helloworld
  and l2fwd can be built using the pkgconfig info (via make, not ninja)
* support for library versions
* an implementation for FreeBSD as well as Linux
* all libraries are included in the build, as well as a number of NIC,
  crypto, and mempool drivers
* the igb_uio kernel module is build via the kernel Kbuild system as part
  of a meson/ninja DPDK build

there is still plenty to do on this, but please review and test it out.
I've kept the patches split so that the evolution of the work is a bit
clearer than having it all send in a monolithic patch. All feedback
welcome. I recommend one uses the latest meson release for this, though the
minimum version supported should be v0.4.

I've tested static and dynamic builds with clang and gcc on Fedora 26, and
done test builds on FreeBSD 11 with clang too. Build with other compilers
and on other OS's may have issues, so YMMV.

To do a basic build, using gcc and with shared libs, in a folder called 
"gcc-build":

user@host:dpdk$ meson gcc-build

user@host:dpdk$ cd gcc-build
user@host:gcc-build$ ninja
user@host:gcc-build$ sudo ninja install

To do a build with clang, using static libs:

user@host:dpdk$ CC=clang meson --default_library=static clang-build

user@host:dpdk$ cd clang-build
user@host:clang-build$ ninja
user@host:clang-build$ sudo ninja install

Other options can be adjusted by running "mesonconf" in the build
directory, i.e. gcc-build or clang-build in the examples above.


Bruce Richardson (40):
  build: initial hooks for using meson with DPDK
  build: create pkg-config file for DPDK
  build: build linuxapp EAL with meson and ninja
  build: add EAL support under BSD
  build: add core libraries to meson build system
  build: add i40e driver to meson build
  build: add pmdinfogen to build
  build: generate list of sources for pmdinfogen
  build: build i40e driver, including pmdinfo
  build: install usertools scripts
  build: simplify generation of pmd.c files
  build: generalize net driver build to higher level
  build: remove hard-coded enablement of vector driver
  build: add ixgbe driver to build
  build: set up standard deps for drivers
  build: add af_packet driver to build
  build: add pcap PMD support
  build: add symbol version map file support to libs
  build: build libraries in a loop for brevity
  build: version library .so files
  eal: add version information to meson build
  build: add mempool drivers to build
  build: add gro library to meson build
  build: tweak naming of pmd dependencies
  build: track driver include directories properly
  metrics: add metrics lib to meson build
  build: track dependencies recursively
  testpmd: compile testpmd with meson and ninja
  crypto/null: rename the version file to standard
  crypto/qat: remove dependency on ether library
  build: add cryptodev and some crypto drivers to build
  igb_uio: add igb_uio to meson build
  ip_frag: rename version file to standard name
  build: add most remaining libraries to meson build
  build: add packet framework libs to meson build
  acl: add acl library to meson build
  build: add ark and avp PMDs to build
  build: fix static library builds with base code
  build: fix driver dependencies for static builds
  examples: allow basic sample app build using pkg-config

 app/meson.build|  32 ++
 app/test-pmd/meson.build   |  74 +
 buildtools/gen-pmdinfo-cfile.sh|  41 
 buildtools/meson.build |  34 ++
 buildtools/pmdinfogen/meson.build  |  43 
 config/meson.build |  69 +
 config/rte_config.h| 114 +
 config/x86/meson.build |  70 +
 drivers/crypto/meson.build | 108 +++
 drivers/crypto/null/Makefile   |   2 +-
 drivers/crypto/null/meson.build|  32 ++
 ...crypto_version.

[dpdk-dev] [RFCv2 01/40] build: initial hooks for using meson with DPDK

2017-08-14 Thread Bruce Richardson
Signed-off-by: Bruce Richardson 
---
 config/meson.build | 47 ++
 config/rte_config.h| 50 +
 config/x86/meson.build | 68 ++
 meson.build| 60 
 meson_options.txt  |  1 +
 5 files changed, 226 insertions(+)
 create mode 100644 config/meson.build
 create mode 100644 config/rte_config.h
 create mode 100644 config/x86/meson.build
 create mode 100644 meson.build
 create mode 100644 meson_options.txt

diff --git a/config/meson.build b/config/meson.build
new file mode 100644
index 0..59247d784
--- /dev/null
+++ b/config/meson.build
@@ -0,0 +1,47 @@
+#   BSD LICENSE
+#
+#   Copyright(c) 2017 Intel Corporation. All rights reserved.
+#   All rights reserved.
+#
+#   Redistribution and use in source and binary forms, with or without
+#   modification, are permitted provided that the following conditions
+#   are met:
+#
+# * Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in
+#   the documentation and/or other materials provided with the
+#   distribution.
+# * Neither the name of Intel Corporation nor the names of its
+#   contributors may be used to endorse or promote products derived
+#   from this software without specific prior written permission.
+#
+#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+#   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+#   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+#   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+#   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+#   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+#   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+#   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+#   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+# set the machine type and cflags for it
+machine = get_option('machine')
+dpdk_conf.set('RTE_MACHINE', machine)
+add_project_arguments('-march=@0@'.format(machine), language: 'c')
+
+compile_time_cpuflags = []
+if host_machine.cpu_family().startswith('x86')
+   subdir('x86')
+endif
+dpdk_conf.set('RTE_COMPILE_TIME_CPUFLAGS', ','.join(compile_time_cpuflags))
+
+
+# set the install path for the drivers
+dpdk_conf.set_quoted('RTE_EAL_PMD_PATH', driver_install_path)
+
+install_headers('rte_config.h')
diff --git a/config/rte_config.h b/config/rte_config.h
new file mode 100644
index 0..79b0db90f
--- /dev/null
+++ b/config/rte_config.h
@@ -0,0 +1,50 @@
+/*
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2016 Intel Corporation. All rights reserved.
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in
+ *   the documentation and/or other materials provided with the
+ *   distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ *   contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * @file Header file containing DPDK compilation parameters
+ *
+ * Header file containing DPDK compilation parameters. Also include the
+ * meson-generated header file containing the

[dpdk-dev] [RFCv2 03/40] build: build linuxapp EAL with meson and ninja

2017-08-14 Thread Bruce Richardson
Signed-off-by: Bruce Richardson 
---
 config/meson.build | 24 +++-
 config/rte_config.h|  9 +++
 config/x86/meson.build |  2 +
 lib/librte_eal/common/arch/meson.build | 33 ++
 lib/librte_eal/common/arch/x86/meson.build | 32 ++
 lib/librte_eal/common/include/arch/meson.build | 33 ++
 lib/librte_eal/common/include/arch/x86/meson.build | 47 ++
 lib/librte_eal/common/include/meson.build  | 71 ++
 lib/librte_eal/common/meson.build  | 71 ++
 lib/librte_eal/linuxapp/eal/meson.build| 62 +++
 lib/librte_eal/linuxapp/meson.build| 32 ++
 lib/librte_eal/meson.build | 40 
 lib/meson.build| 41 +
 meson.build|  3 +
 meson_options.txt  |  7 ++-
 15 files changed, 504 insertions(+), 3 deletions(-)
 create mode 100644 lib/librte_eal/common/arch/meson.build
 create mode 100644 lib/librte_eal/common/arch/x86/meson.build
 create mode 100644 lib/librte_eal/common/include/arch/meson.build
 create mode 100644 lib/librte_eal/common/include/arch/x86/meson.build
 create mode 100644 lib/librte_eal/common/include/meson.build
 create mode 100644 lib/librte_eal/common/meson.build
 create mode 100644 lib/librte_eal/linuxapp/eal/meson.build
 create mode 100644 lib/librte_eal/linuxapp/meson.build
 create mode 100644 lib/librte_eal/meson.build
 create mode 100644 lib/meson.build

diff --git a/config/meson.build b/config/meson.build
index 59247d784..4a6a69d13 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -34,14 +34,34 @@ machine = get_option('machine')
 dpdk_conf.set('RTE_MACHINE', machine)
 add_project_arguments('-march=@0@'.format(machine), language: 'c')
 
+# add -include rte_config to cflags
+add_project_arguments('-include', 'rte_config.h', language: 'c')
+
+# disable any unwanted warnings
+unwanted_warnings = [
+   '-Wno-address-of-packed-member',
+   '-Wno-format-truncation'
+]
+foreach arg: unwanted_warnings
+   if cc.has_argument(arg)
+   add_project_arguments(arg, language: 'c')
+   endif
+endforeach
+
 compile_time_cpuflags = []
 if host_machine.cpu_family().startswith('x86')
-   subdir('x86')
+   arch_subdir = 'x86'
+   subdir(arch_subdir)
 endif
 dpdk_conf.set('RTE_COMPILE_TIME_CPUFLAGS', ','.join(compile_time_cpuflags))
 
-
 # set the install path for the drivers
 dpdk_conf.set_quoted('RTE_EAL_PMD_PATH', driver_install_path)
 
+# set other values pulled from the build options
+dpdk_conf.set('RTE_MAX_LCORE', get_option('max_lcores'))
+dpdk_conf.set('RTE_MAX_NUMA_NODES', get_option('max_numa_nodes'))
+dpdk_conf.set('RTE_LIBEAL_USE_HPET', get_option('use_hpet'))
+dpdk_conf.set('RTE_EAL_ALLOW_INV_SOCKET_ID', 
get_option('allow_invalid_socket_id'))
+
 install_headers('rte_config.h')
diff --git a/config/rte_config.h b/config/rte_config.h
index 79b0db90f..7724ebcbe 100644
--- a/config/rte_config.h
+++ b/config/rte_config.h
@@ -47,4 +47,13 @@
 
 #include 
 
+/* EAL defines */
+#define RTE_MAX_MEMSEG 512
+#define RTE_MAX_MEMZONE 2560
+#define RTE_MAX_TAILQ 32
+#define RTE_LOG_LEVEL RTE_LOG_INFO
+#define RTE_LOG_DP_LEVEL RTE_LOG_INFO
+#define RTE_BACKTRACE 1
+#define RTE_EAL_VFIO 1
+
 #endif /* _RTE_CONFIG_H_ */
diff --git a/config/x86/meson.build b/config/x86/meson.build
index 8fa3a38c0..54f8bcdb6 100644
--- a/config/x86/meson.build
+++ b/config/x86/meson.build
@@ -66,3 +66,5 @@ if cc.get_define('__AVX2__', args: march_opt) != ''
dpdk_conf.set('RTE_MACHINE_CPUFLAG_AVX2', 1)
compile_time_cpuflags += ['RTE_CPUFLAG_AVX2']
 endif
+
+dpdk_conf.set('RTE_CACHE_LINE_SIZE', 64)
diff --git a/lib/librte_eal/common/arch/meson.build 
b/lib/librte_eal/common/arch/meson.build
new file mode 100644
index 0..863d7e4bb
--- /dev/null
+++ b/lib/librte_eal/common/arch/meson.build
@@ -0,0 +1,33 @@
+#   BSD LICENSE
+#
+#   Copyright(c) 2017 Intel Corporation. All rights reserved.
+#   All rights reserved.
+#
+#   Redistribution and use in source and binary forms, with or without
+#   modification, are permitted provided that the following conditions
+#   are met:
+#
+# * Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in
+#   the documentation and/or other materials provided with the
+#   distribution.
+# * Neither the name of Intel Corporation nor the names of its
+#   contributors may be used to endorse or promote products derived
+#   from this software without specific prior written permission.
+#
+#   THIS SO

[dpdk-dev] [RFCv2 04/40] build: add EAL support under BSD

2017-08-14 Thread Bruce Richardson
Signed-off-by: Bruce Richardson 
---
 lib/librte_eal/bsdapp/eal/meson.build | 58 +++
 lib/librte_eal/bsdapp/meson.build | 32 +++
 lib/librte_eal/meson.build|  2 ++
 3 files changed, 92 insertions(+)
 create mode 100644 lib/librte_eal/bsdapp/eal/meson.build
 create mode 100644 lib/librte_eal/bsdapp/meson.build

diff --git a/lib/librte_eal/bsdapp/eal/meson.build 
b/lib/librte_eal/bsdapp/eal/meson.build
new file mode 100644
index 0..1df28d507
--- /dev/null
+++ b/lib/librte_eal/bsdapp/eal/meson.build
@@ -0,0 +1,58 @@
+#   BSD LICENSE
+#
+#   Copyright(c) 2017 Intel Corporation. All rights reserved.
+#   All rights reserved.
+#
+#   Redistribution and use in source and binary forms, with or without
+#   modification, are permitted provided that the following conditions
+#   are met:
+#
+# * Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in
+#   the documentation and/or other materials provided with the
+#   distribution.
+# * Neither the name of Intel Corporation nor the names of its
+#   contributors may be used to endorse or promote products derived
+#   from this software without specific prior written permission.
+#
+#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+#   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+#   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+#   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+#   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+#   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+#   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+#   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+#   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+eal_inc += include_directories('include')
+dpdk_includes += '-I@0@/include'.format(meson.current_source_dir())
+install_subdir('include/exec-env', install_dir: 'include')
+
+sources = ['eal_alarm.c',
+   'eal_debug.c',
+   'eal_hugepage_info.c',
+   'eal_interrupts.c',
+   'eal_lcore.c',
+   'eal_thread.c',
+   'eal_timer.c',
+   'eal.c',
+   'eal_memory.c',
+   'eal_pci.c',
+]
+
+eal_lib = library('rte_eal', sources, eal_common_sources, 
eal_common_arch_sources,
+   dependencies: dependency('threads'),
+   include_directories : eal_inc,
+   c_args: '-D_GNU_SOURCE',
+   link_args: '-lexecinfo',
+   install: true
+)
+
+dpdk_libraries += ['-pthread', eal_lib]
+
+rte_eal = declare_dependency(link_with: eal_lib, include_directories: eal_inc)
diff --git a/lib/librte_eal/bsdapp/meson.build 
b/lib/librte_eal/bsdapp/meson.build
new file mode 100644
index 0..bc9f22175
--- /dev/null
+++ b/lib/librte_eal/bsdapp/meson.build
@@ -0,0 +1,32 @@
+#   BSD LICENSE
+#
+#   Copyright(c) 2017 Intel Corporation. All rights reserved.
+#   All rights reserved.
+#
+#   Redistribution and use in source and binary forms, with or without
+#   modification, are permitted provided that the following conditions
+#   are met:
+#
+# * Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in
+#   the documentation and/or other materials provided with the
+#   distribution.
+# * Neither the name of Intel Corporation nor the names of its
+#   contributors may be used to endorse or promote products derived
+#   from this software without specific prior written permission.
+#
+#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+#   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+#   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+#   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+#   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+#   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+#   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+#   (INCLUDING NEGLIGENCE OR OTHER

[dpdk-dev] [RFCv2 05/40] build: add core libraries to meson build system

2017-08-14 Thread Bruce Richardson
Signed-off-by: Bruce Richardson 
---
 config/rte_config.h| 14 ++
 lib/librte_cmdline/meson.build | 63 ++
 lib/librte_compat/meson.build  | 35 +++
 lib/librte_ether/meson.build   | 49 
 lib/librte_hash/meson.build| 54 
 lib/librte_kvargs/meson.build  | 43 
 lib/librte_mbuf/meson.build| 42 
 lib/librte_mempool/meson.build | 43 
 lib/librte_net/meson.build | 52 ++
 lib/librte_ring/meson.build| 43 
 lib/meson.build| 18 ++--
 11 files changed, 447 insertions(+), 9 deletions(-)
 create mode 100644 lib/librte_cmdline/meson.build
 create mode 100644 lib/librte_compat/meson.build
 create mode 100644 lib/librte_ether/meson.build
 create mode 100644 lib/librte_hash/meson.build
 create mode 100644 lib/librte_kvargs/meson.build
 create mode 100644 lib/librte_mbuf/meson.build
 create mode 100644 lib/librte_mempool/meson.build
 create mode 100644 lib/librte_net/meson.build
 create mode 100644 lib/librte_ring/meson.build

diff --git a/config/rte_config.h b/config/rte_config.h
index 7724ebcbe..4d5f7214c 100644
--- a/config/rte_config.h
+++ b/config/rte_config.h
@@ -56,4 +56,18 @@
 #define RTE_BACKTRACE 1
 #define RTE_EAL_VFIO 1
 
+/* mempool defines */
+#define RTE_MEMPOOL_CACHE_MAX_SIZE 512
+
+/* mbuf defines */
+#define RTE_MBUF_DEFAULT_MEMPOOL_OPS "ring_mp_mc"
+#define RTE_MBUF_REFCNT_ATOMIC 1
+#define RTE_PKTMBUF_HEADROOM 128
+
+/* ether defines */
+#define RTE_MAX_ETHPORTS 32
+#define RTE_MAX_QUEUES_PER_PORT 1024
+#define RTE_ETHDEV_QUEUE_STAT_CNTRS 16
+#define RTE_ETHDEV_RXTX_CALLBACKS 1
+
 #endif /* _RTE_CONFIG_H_ */
diff --git a/lib/librte_cmdline/meson.build b/lib/librte_cmdline/meson.build
new file mode 100644
index 0..ceac0a429
--- /dev/null
+++ b/lib/librte_cmdline/meson.build
@@ -0,0 +1,63 @@
+#   BSD LICENSE
+#
+#   Copyright(c) 2017 Intel Corporation. All rights reserved.
+#   All rights reserved.
+#
+#   Redistribution and use in source and binary forms, with or without
+#   modification, are permitted provided that the following conditions
+#   are met:
+#
+# * Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in
+#   the documentation and/or other materials provided with the
+#   distribution.
+# * Neither the name of Intel Corporation nor the names of its
+#   contributors may be used to endorse or promote products derived
+#   from this software without specific prior written permission.
+#
+#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+#   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+#   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+#   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+#   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+#   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+#   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+#   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+#   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+sources = [ 'cmdline.c',
+   'cmdline_cirbuf.c',
+   'cmdline_parse.c',
+   'cmdline_parse_etheraddr.c',
+   'cmdline_parse_ipaddr.c',
+   'cmdline_parse_num.c',
+   'cmdline_parse_portlist.c',
+   'cmdline_parse_string.c',
+   'cmdline_rdline.c',
+   'cmdline_socket.c',
+   'cmdline_vt100.c']
+
+install_headers('cmdline.h',
+   'cmdline_parse.h',
+   'cmdline_parse_num.h',
+   'cmdline_parse_ipaddr.h',
+   'cmdline_parse_etheraddr.h',
+   'cmdline_parse_string.h',
+   'cmdline_rdline.h',
+   'cmdline_vt100.h',
+   'cmdline_socket.h',
+   'cmdline_cirbuf.h',
+   'cmdline_parse_portlist.h')
+
+cmdline_lib = library('rte_cmdline', sources, dependencies: rte_eal,
+   install: true)
+rte_cmdline = declare_dependency(link_with: cmdline_lib,
+   include_directories: include_directories('.'))
+
+dpdk_libraries += cmdline_lib
+
+dpdk_conf.set('RTE_LIBRTE_CMDLINE', 1)
diff --git a/lib/librte_compat/meson.build b/lib/librte_compat/meson.build
new file mode 100644
index 0..d4a994523
--- /dev/null
+++ b/lib/librte_compat/meson.build
@@ -0,0 +1,35 @@
+#   BSD LICENSE
+#
+#   Copyright(c) 2017 Intel Corporation. All rights reserved.
+#   All rights r

[dpdk-dev] [RFCv2 06/40] build: add i40e driver to meson build

2017-08-14 Thread Bruce Richardson
Signed-off-by: Bruce Richardson 
---
 config/rte_config.h   | 14 
 drivers/meson.build   | 32 ++
 drivers/net/i40e/base/meson.build | 55 ++
 drivers/net/i40e/meson.build  | 70 +++
 drivers/net/meson.build   | 32 ++
 meson.build   |  7 
 6 files changed, 210 insertions(+)
 create mode 100644 drivers/meson.build
 create mode 100644 drivers/net/i40e/base/meson.build
 create mode 100644 drivers/net/i40e/meson.build
 create mode 100644 drivers/net/meson.build

diff --git a/config/rte_config.h b/config/rte_config.h
index 4d5f7214c..5b687bb8e 100644
--- a/config/rte_config.h
+++ b/config/rte_config.h
@@ -47,6 +47,8 @@
 
 #include 
 
+/** library defines /
+
 /* EAL defines */
 #define RTE_MAX_MEMSEG 512
 #define RTE_MAX_MEMZONE 2560
@@ -70,4 +72,16 @@
 #define RTE_ETHDEV_QUEUE_STAT_CNTRS 16
 #define RTE_ETHDEV_RXTX_CALLBACKS 1
 
+/** driver defines /
+
+/* i40e defines */
+#define RTE_LIBRTE_I40E_RX_ALLOW_BULK_ALLOC 1
+#define RTE_LIBRTE_I40E_INC_VECTOR 1
+#undef RTE_LIBRTE_I40E_16BYTE_RX_DESC
+#define RTE_LIBRTE_I40E_QUEUE_NUM_PER_PF 64
+#define RTE_LIBRTE_I40E_QUEUE_NUM_PER_VF 4
+#define RTE_LIBRTE_I40E_QUEUE_NUM_PER_VM 4
+/* interval up to 8160 us, aligned to 2 (or default value) */
+#define RTE_LIBRTE_I40E_ITR_INTERVAL -1
+
 #endif /* _RTE_CONFIG_H_ */
diff --git a/drivers/meson.build b/drivers/meson.build
new file mode 100644
index 0..57f47c36f
--- /dev/null
+++ b/drivers/meson.build
@@ -0,0 +1,32 @@
+#   BSD LICENSE
+#
+#   Copyright(c) 2017 Intel Corporation. All rights reserved.
+#   All rights reserved.
+#
+#   Redistribution and use in source and binary forms, with or without
+#   modification, are permitted provided that the following conditions
+#   are met:
+#
+# * Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in
+#   the documentation and/or other materials provided with the
+#   distribution.
+# * Neither the name of Intel Corporation nor the names of its
+#   contributors may be used to endorse or promote products derived
+#   from this software without specific prior written permission.
+#
+#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+#   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+#   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+#   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+#   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+#   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+#   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+#   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+#   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+subdir('net')
diff --git a/drivers/net/i40e/base/meson.build 
b/drivers/net/i40e/base/meson.build
new file mode 100644
index 0..43399cb11
--- /dev/null
+++ b/drivers/net/i40e/base/meson.build
@@ -0,0 +1,55 @@
+#   BSD LICENSE
+#
+#   Copyright(c) 2017 Intel Corporation. All rights reserved.
+#   All rights reserved.
+#
+#   Redistribution and use in source and binary forms, with or without
+#   modification, are permitted provided that the following conditions
+#   are met:
+#
+# * Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in
+#   the documentation and/or other materials provided with the
+#   distribution.
+# * Neither the name of Intel Corporation nor the names of its
+#   contributors may be used to endorse or promote products derived
+#   from this software without specific prior written permission.
+#
+#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+#   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+#   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+#   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+#   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+#   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+#   THEORY OF LIABILIT

[dpdk-dev] [RFCv2 08/40] build: generate list of sources for pmdinfogen

2017-08-14 Thread Bruce Richardson
Signed-off-by: Bruce Richardson 
---
 drivers/net/i40e/meson.build | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/net/i40e/meson.build b/drivers/net/i40e/meson.build
index 1e23e0820..a6d0bf4e4 100644
--- a/drivers/net/i40e/meson.build
+++ b/drivers/net/i40e/meson.build
@@ -36,7 +36,7 @@ i40e_cflags = ['-DPF_DRIVER',
 
 subdir('base')
 
-sources = [
+sources = files(
'i40e_ethdev.c',
'i40e_rxtx.c',
'i40e_ethdev_vf.c',
@@ -45,12 +45,15 @@ sources = [
'i40e_flow.c',
'i40e_tm.c',
'rte_pmd_i40e.c'
-   ]
+   )
 
 if arch_subdir == 'x86'
-   sources += 'i40e_rxtx_vec_sse.c'
+   sources += files('i40e_rxtx_vec_sse.c')
 endif
 
+pmdinfogen_srcs = run_command('grep', '--files-with-matches', 
'RTE_PMD_REGISTER_.*(.*)', sources).stdout().strip().split()
+message(pmdinfogen_srcs)
+
 install_headers('rte_pmd_i40e.h')
 
 i40e_lib = library('rte_pmd_i40e', sources,
-- 
2.13.4



[dpdk-dev] [RFCv2 07/40] build: add pmdinfogen to build

2017-08-14 Thread Bruce Richardson
Signed-off-by: Bruce Richardson 
---
 buildtools/meson.build| 32 +
 buildtools/pmdinfogen/meson.build | 43 +++
 meson.build   |  1 +
 3 files changed, 76 insertions(+)
 create mode 100644 buildtools/meson.build
 create mode 100644 buildtools/pmdinfogen/meson.build

diff --git a/buildtools/meson.build b/buildtools/meson.build
new file mode 100644
index 0..92206f912
--- /dev/null
+++ b/buildtools/meson.build
@@ -0,0 +1,32 @@
+#   BSD LICENSE
+#
+#   Copyright(c) 2017 Intel Corporation. All rights reserved.
+#   All rights reserved.
+#
+#   Redistribution and use in source and binary forms, with or without
+#   modification, are permitted provided that the following conditions
+#   are met:
+#
+# * Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in
+#   the documentation and/or other materials provided with the
+#   distribution.
+# * Neither the name of Intel Corporation nor the names of its
+#   contributors may be used to endorse or promote products derived
+#   from this software without specific prior written permission.
+#
+#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+#   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+#   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+#   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+#   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+#   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+#   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+#   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+#   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+subdir('pmdinfogen')
diff --git a/buildtools/pmdinfogen/meson.build 
b/buildtools/pmdinfogen/meson.build
new file mode 100644
index 0..6b8a13baa
--- /dev/null
+++ b/buildtools/pmdinfogen/meson.build
@@ -0,0 +1,43 @@
+#   BSD LICENSE
+#
+#   Copyright(c) 2017 Intel Corporation. All rights reserved.
+#   All rights reserved.
+#
+#   Redistribution and use in source and binary forms, with or without
+#   modification, are permitted provided that the following conditions
+#   are met:
+#
+# * Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in
+#   the documentation and/or other materials provided with the
+#   distribution.
+# * Neither the name of Intel Corporation nor the names of its
+#   contributors may be used to endorse or promote products derived
+#   from this software without specific prior written permission.
+#
+#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+#   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+#   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+#   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+#   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+#   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+#   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+#   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+#   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+error_cflags = ['-Wno-maybe-uninitialized']
+cflags = []
+foreach arg: error_cflags
+   if cc.has_argument(arg)
+   cflags += arg
+   endif
+endforeach
+
+pmdinfogen = executable('pmdinfogen',
+   'pmdinfogen.c',
+   include_directories: eal_inc,
+   c_args: cflags)
diff --git a/meson.build b/meson.build
index 930656da6..54bb4632e 100644
--- a/meson.build
+++ b/meson.build
@@ -57,6 +57,7 @@ subdir('config')
 
 # now build libs and drivers
 subdir('lib')
+subdir('buildtools')
 subdir('drivers')
 
 # write the build config
-- 
2.13.4



[dpdk-dev] [RFCv2 10/40] build: install usertools scripts

2017-08-14 Thread Bruce Richardson
Signed-off-by: Bruce Richardson 
---
 meson.build   |  1 +
 usertools/meson.build | 32 
 2 files changed, 33 insertions(+)
 create mode 100644 usertools/meson.build

diff --git a/meson.build b/meson.build
index a0ab08252..717ec070d 100644
--- a/meson.build
+++ b/meson.build
@@ -62,6 +62,7 @@ subdir('config')
 subdir('lib')
 subdir('buildtools')
 subdir('drivers')
+subdir('usertools')
 
 # write the build config
 build_cfg = 'rte_build_config.h'
diff --git a/usertools/meson.build b/usertools/meson.build
new file mode 100644
index 0..977cd8b58
--- /dev/null
+++ b/usertools/meson.build
@@ -0,0 +1,32 @@
+#   BSD LICENSE
+#
+#   Copyright(c) 2017 Intel Corporation. All rights reserved.
+#   All rights reserved.
+#
+#   Redistribution and use in source and binary forms, with or without
+#   modification, are permitted provided that the following conditions
+#   are met:
+#
+# * Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in
+#   the documentation and/or other materials provided with the
+#   distribution.
+# * Neither the name of Intel Corporation nor the names of its
+#   contributors may be used to endorse or promote products derived
+#   from this software without specific prior written permission.
+#
+#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+#   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+#   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+#   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+#   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+#   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+#   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+#   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+#   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+install_data(['dpdk-devbind.py', 'dpdk-pmdinfo.py'], install_dir: 'bin')
-- 
2.13.4



[dpdk-dev] [RFCv2 09/40] build: build i40e driver, including pmdinfo

2017-08-14 Thread Bruce Richardson
Signed-off-by: Bruce Richardson 
---
 buildtools/gen-pmdinfo-cfile.sh| 45 ++
 buildtools/meson.build |  2 ++
 drivers/net/i40e/meson.build   | 30 -
 lib/librte_cmdline/meson.build | 17 +-
 lib/librte_eal/common/include/arch/meson.build |  1 +
 lib/librte_eal/common/include/meson.build  |  1 +
 lib/librte_eal/linuxapp/eal/meson.build|  1 +
 lib/librte_eal/meson.build |  1 +
 lib/librte_ether/meson.build   |  5 ++-
 lib/librte_hash/meson.build|  5 ++-
 lib/librte_kvargs/meson.build  |  5 ++-
 lib/librte_mbuf/meson.build|  5 ++-
 lib/librte_mempool/meson.build |  5 ++-
 lib/librte_net/meson.build |  5 ++-
 lib/librte_ring/meson.build|  5 ++-
 lib/meson.build| 31 --
 meson.build| 13 +++-
 17 files changed, 122 insertions(+), 55 deletions(-)
 create mode 100755 buildtools/gen-pmdinfo-cfile.sh

diff --git a/buildtools/gen-pmdinfo-cfile.sh b/buildtools/gen-pmdinfo-cfile.sh
new file mode 100755
index 0..a042375a8
--- /dev/null
+++ b/buildtools/gen-pmdinfo-cfile.sh
@@ -0,0 +1,45 @@
+#! /bin/sh
+#   BSD LICENSE
+#
+#   Copyright(c) 2017 Intel Corporation. All rights reserved.
+#   All rights reserved.
+#
+#   Redistribution and use in source and binary forms, with or without
+#   modification, are permitted provided that the following conditions
+#   are met:
+#
+# * Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in
+#   the documentation and/or other materials provided with the
+#   distribution.
+# * Neither the name of Intel Corporation nor the names of its
+#   contributors may be used to endorse or promote products derived
+#   from this software without specific prior written permission.
+#
+#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+#   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+#   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+#   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+#   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+#   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+#   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+#   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+#   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+input=$1
+output=$2
+pmdinfogen=$3
+CFLAGS=$4
+build_root=$5
+
+tmp_o=${output%.c.pmd.o}.o
+tmp_c=${output%.o}.c
+
+set -x
+cc -Wfatal-errors $CFLAGS -I$build_root -include rte_config.h -c $input -o 
$tmp_o && \
+   $pmdinfogen $tmp_o $tmp_c && \
+   cc -c $tmp_c -o $output
diff --git a/buildtools/meson.build b/buildtools/meson.build
index 92206f912..a08000be0 100644
--- a/buildtools/meson.build
+++ b/buildtools/meson.build
@@ -30,3 +30,5 @@
 #   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 subdir('pmdinfogen')
+
+pmdinfo = find_program('gen-pmdinfo-cfile.sh')
diff --git a/drivers/net/i40e/meson.build b/drivers/net/i40e/meson.build
index a6d0bf4e4..e1c3e17a9 100644
--- a/drivers/net/i40e/meson.build
+++ b/drivers/net/i40e/meson.build
@@ -47,21 +47,35 @@ sources = files(
'rte_pmd_i40e.c'
)
 
+deps = [rte_eal, rte_net,
+   rte_mbuf, rte_ether,
+   rte_mempool, rte_ring,
+   rte_hash, rte_kvargs]
+
 if arch_subdir == 'x86'
sources += files('i40e_rxtx_vec_sse.c')
 endif
 
-pmdinfogen_srcs = run_command('grep', '--files-with-matches', 
'RTE_PMD_REGISTER_.*(.*)', sources).stdout().strip().split()
-message(pmdinfogen_srcs)
-
 install_headers('rte_pmd_i40e.h')
 
-i40e_lib = library('rte_pmd_i40e', sources,
+pmdinfogen_srcs = run_command('grep', '--files-with-matches',
+   'RTE_PMD_REGISTER_.*(.*)', sources).stdout().strip().split()
+objs = []
+foreach src: pmdinfogen_srcs
+   out_filename = '@0@.pmd.o'.format(src.split('/')[-1])
+   pmd_o_file = custom_target(out_filename,
+   command: [pmdinfo, '@INPUT@', '@OUTPUT@',
+   pmdinfogen.full_path(),
+   ' '.join(dpdk_includes + i40e_cflags + 
['-march=@0@'.format(machine)]),
+   meson.build_root()],
+   input: src, output: out_filename,
+   depen

[dpdk-dev] [RFCv2 12/40] build: generalize net driver build to higher level

2017-08-14 Thread Bruce Richardson
Move the logic for generating the pmdinfo file and the driver library
itself to the meson.build file at the driver/net level, to avoid
duplicating code.

Signed-off-by: Bruce Richardson 
---
 drivers/net/i40e/base/meson.build |  2 +-
 drivers/net/i40e/meson.build  | 31 -
 drivers/net/meson.build   | 48 ++-
 3 files changed, 52 insertions(+), 29 deletions(-)

diff --git a/drivers/net/i40e/base/meson.build 
b/drivers/net/i40e/base/meson.build
index 43399cb11..69f55497e 100644
--- a/drivers/net/i40e/base/meson.build
+++ b/drivers/net/i40e/base/meson.build
@@ -43,7 +43,7 @@ error_cflags = ['-Wno-sign-compare',
'-Wno-unused-value',
'-Wno-format',
'-Wno-unused-but-set-variable']
-c_args = i40e_cflags
+c_args = cflags
 foreach flag: error_cflags
if cc.has_argument(flag)
c_args += flag
diff --git a/drivers/net/i40e/meson.build b/drivers/net/i40e/meson.build
index 7d103868d..4652b8ac9 100644
--- a/drivers/net/i40e/meson.build
+++ b/drivers/net/i40e/meson.build
@@ -29,12 +29,13 @@
 #   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 #   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-i40e_cflags = ['-DPF_DRIVER',
+cflags = ['-DPF_DRIVER',
'-DVF_DRIVER',
'-DINTEGRATED_VF',
'-DX722_A0_SUPPORT']
 
 subdir('base')
+libs = [base_lib]
 
 sources = files(
'i40e_ethdev.c',
@@ -56,31 +57,7 @@ if arch_subdir == 'x86'
sources += files('i40e_rxtx_vec_sse.c')
 endif
 
-install_headers('rte_pmd_i40e.h')
-
-pmdinfogen_srcs = run_command('grep', '--files-with-matches',
-   'RTE_PMD_REGISTER_.*(.*)', sources).stdout().strip().split()
-foreach src: pmdinfogen_srcs
-   out_filename = '@0@.pmd.c'.format(src.split('/')[-1])
-   tmp_lib = static_library('tmp_@0@'.format(src.underscorify()),
-   src, include_directories: include_directories('base'),
-   dependencies: deps,
-   c_args: i40e_cflags)
-   sources += custom_target(out_filename,
-   command: [pmdinfo, tmp_lib.full_path(), '@OUTPUT@', 
pmdinfogen],
-   output: out_filename,
-   depends: [pmdinfogen, tmp_lib])
-endforeach
+includes = include_directories('base', '.')
 
-i40e_lib = library('rte_pmd_i40e', sources,
-   include_directories: include_directories('base'),
-   dependencies: deps,
-   link_with: base_lib,
-   c_args: i40e_cflags,
-   install: true,
-   install_dir: 'dpdk/drivers')
-
-dpdk_drivers += i40e_lib
+install_headers('rte_pmd_i40e.h')
 
-i40e_pmd = declare_dependency(link_with: i40e_lib,
-   include_directories: include_directories('.'))
diff --git a/drivers/net/meson.build b/drivers/net/meson.build
index 22237b1aa..db242d71b 100644
--- a/drivers/net/meson.build
+++ b/drivers/net/meson.build
@@ -29,4 +29,50 @@
 #   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 #   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-subdir('i40e')
+drivers = ['i40e']
+
+foreach drv:drivers
+   dpdk_conf.set('RTE_LIBRTE_@0@_PMD'.format(drv.to_upper()),1)
+
+   # set up empty variables used for build
+   sources = []
+   libs = []
+   cflags = []
+   deps = []
+   includes = []
+
+   # pull in driver directory which should assign to each of the above
+   subdir(drv)
+
+   # generate pmdinfo sources
+   pmdinfogen_srcs = run_command('grep', '--files-with-matches',
+   'RTE_PMD_REGISTER_.*(.*)', sources).stdout().strip().split()
+   foreach src: pmdinfogen_srcs
+   out_filename = '@0@.pmd.c'.format(src.split('/')[-1])
+   tmp_lib = static_library('tmp_@0@'.format(src.underscorify()),
+   src, include_directories: includes,
+   dependencies: deps,
+   c_args: cflags)
+   sources += custom_target(out_filename,
+   command: [pmdinfo, tmp_lib.full_path(), 
'@OUTPUT@', pmdinfogen],
+   output: out_filename,
+   depends: [pmdinfogen, tmp_lib])
+   endforeach
+
+   # now build the driver itself, and add to the drivers list
+   lib = library('rte_pmd_@0@'.format(drv), sources,
+   include_directories: includes,
+   dependencies: deps,
+   link_with: libs,
+   c_args: cflags,
+   install: true,
+   install_dir: driver_install_path)
+
+   dpdk_drivers += lib
+
+   # create a dependency object and add it to the global dictionary so
+   # testpmd or other built-in apps can find it if necessary
+   set_variable('dep_pmd_@0@'.format(drv),
+   declare_dependency(link_with: lib,
+   include_directories: includes)

[dpdk-dev] [RFCv2 11/40] build: simplify generation of pmd.c files

2017-08-14 Thread Bruce Richardson
rather than using the compiler to generate a temporary .o file, get meson
to do it, so we don't need to track dpdk includes directly, and pass in a
range of parameters

Signed-off-by: Bruce Richardson 
---
 buildtools/gen-pmdinfo-cfile.sh| 14 +-
 drivers/net/i40e/meson.build   | 21 ++---
 lib/librte_eal/bsdapp/eal/meson.build  |  1 -
 lib/librte_eal/common/include/arch/meson.build |  1 -
 lib/librte_eal/common/include/meson.build  |  1 -
 lib/librte_eal/linuxapp/eal/meson.build|  1 -
 lib/meson.build|  3 ---
 meson.build|  2 --
 8 files changed, 15 insertions(+), 29 deletions(-)

diff --git a/buildtools/gen-pmdinfo-cfile.sh b/buildtools/gen-pmdinfo-cfile.sh
index a042375a8..fe88e627e 100755
--- a/buildtools/gen-pmdinfo-cfile.sh
+++ b/buildtools/gen-pmdinfo-cfile.sh
@@ -30,16 +30,12 @@
 #   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 #   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-input=$1
+
+arfile=$1
 output=$2
 pmdinfogen=$3
-CFLAGS=$4
-build_root=$5
 
-tmp_o=${output%.c.pmd.o}.o
-tmp_c=${output%.o}.c
+tmp_o=${output%.c.pmd.c}.tmp.o
 
-set -x
-cc -Wfatal-errors $CFLAGS -I$build_root -include rte_config.h -c $input -o 
$tmp_o && \
-   $pmdinfogen $tmp_o $tmp_c && \
-   cc -c $tmp_c -o $output
+ar p $arfile > $tmp_o && \
+   $pmdinfogen $tmp_o $output
diff --git a/drivers/net/i40e/meson.build b/drivers/net/i40e/meson.build
index e1c3e17a9..7d103868d 100644
--- a/drivers/net/i40e/meson.build
+++ b/drivers/net/i40e/meson.build
@@ -60,20 +60,19 @@ install_headers('rte_pmd_i40e.h')
 
 pmdinfogen_srcs = run_command('grep', '--files-with-matches',
'RTE_PMD_REGISTER_.*(.*)', sources).stdout().strip().split()
-objs = []
 foreach src: pmdinfogen_srcs
-   out_filename = '@0@.pmd.o'.format(src.split('/')[-1])
-   pmd_o_file = custom_target(out_filename,
-   command: [pmdinfo, '@INPUT@', '@OUTPUT@',
-   pmdinfogen.full_path(),
-   ' '.join(dpdk_includes + i40e_cflags + 
['-march=@0@'.format(machine)]),
-   meson.build_root()],
-   input: src, output: out_filename,
-   depends: pmdinfogen)
-   objs += pmd_o_file
+   out_filename = '@0@.pmd.c'.format(src.split('/')[-1])
+   tmp_lib = static_library('tmp_@0@'.format(src.underscorify()),
+   src, include_directories: include_directories('base'),
+   dependencies: deps,
+   c_args: i40e_cflags)
+   sources += custom_target(out_filename,
+   command: [pmdinfo, tmp_lib.full_path(), '@OUTPUT@', 
pmdinfogen],
+   output: out_filename,
+   depends: [pmdinfogen, tmp_lib])
 endforeach
 
-i40e_lib = library('rte_pmd_i40e', sources, objs,
+i40e_lib = library('rte_pmd_i40e', sources,
include_directories: include_directories('base'),
dependencies: deps,
link_with: base_lib,
diff --git a/lib/librte_eal/bsdapp/eal/meson.build 
b/lib/librte_eal/bsdapp/eal/meson.build
index 1df28d507..008a719b8 100644
--- a/lib/librte_eal/bsdapp/eal/meson.build
+++ b/lib/librte_eal/bsdapp/eal/meson.build
@@ -30,7 +30,6 @@
 #   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 eal_inc += include_directories('include')
-dpdk_includes += '-I@0@/include'.format(meson.current_source_dir())
 install_subdir('include/exec-env', install_dir: 'include')
 
 sources = ['eal_alarm.c',
diff --git a/lib/librte_eal/common/include/arch/meson.build 
b/lib/librte_eal/common/include/arch/meson.build
index 0bf3ee94d..863d7e4bb 100644
--- a/lib/librte_eal/common/include/arch/meson.build
+++ b/lib/librte_eal/common/include/arch/meson.build
@@ -30,5 +30,4 @@
 #   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 eal_inc += include_directories(arch_subdir)
-dpdk_includes += '-I@0@/@1@'.format(meson.current_source_dir(), arch_subdir)
 subdir(arch_subdir)
diff --git a/lib/librte_eal/common/include/meson.build 
b/lib/librte_eal/common/include/meson.build
index 6d61c8003..e92c4eb7c 100644
--- a/lib/librte_eal/common/include/meson.build
+++ b/lib/librte_eal/common/include/meson.build
@@ -30,7 +30,6 @@
 #   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 eal_inc += include_directories('.')
-dpdk_includes += '-I@0@'.format(meson.current_source_dir())
 
 common_headers = [
'rte_alarm.h',
diff --git a/lib/librte_eal/linuxapp/eal/meson.build 
b/lib/librte_eal/linuxapp/eal/meson.build
index f8547a8a4..79fcff42f 100644
--- a/lib/librte_eal/linuxapp/eal/meson.build
+++ b/lib/librte_eal/linuxapp/eal/meson.build
@@ -30,7 +30,6 @@
 #   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 eal_inc += include_directories('include')
-dpdk_include

[dpdk-dev] [RFCv2 13/40] build: remove hard-coded enablement of vector driver

2017-08-14 Thread Bruce Richardson
Signed-off-by: Bruce Richardson 
---
 config/rte_config.h  | 1 -
 drivers/net/i40e/meson.build | 1 +
 2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/config/rte_config.h b/config/rte_config.h
index 5b687bb8e..67028f682 100644
--- a/config/rte_config.h
+++ b/config/rte_config.h
@@ -76,7 +76,6 @@
 
 /* i40e defines */
 #define RTE_LIBRTE_I40E_RX_ALLOW_BULK_ALLOC 1
-#define RTE_LIBRTE_I40E_INC_VECTOR 1
 #undef RTE_LIBRTE_I40E_16BYTE_RX_DESC
 #define RTE_LIBRTE_I40E_QUEUE_NUM_PER_PF 64
 #define RTE_LIBRTE_I40E_QUEUE_NUM_PER_VF 4
diff --git a/drivers/net/i40e/meson.build b/drivers/net/i40e/meson.build
index 4652b8ac9..ea7f73d8e 100644
--- a/drivers/net/i40e/meson.build
+++ b/drivers/net/i40e/meson.build
@@ -54,6 +54,7 @@ deps = [rte_eal, rte_net,
rte_hash, rte_kvargs]
 
 if arch_subdir == 'x86'
+   dpdk_conf.set('RTE_LIBRTE_I40E_INC_VECTOR', 1)
sources += files('i40e_rxtx_vec_sse.c')
 endif
 
-- 
2.13.4



[dpdk-dev] [RFCv2 15/40] build: set up standard deps for drivers

2017-08-14 Thread Bruce Richardson
Driver should not need to specify that they depend on EAL, mempool, mbuf
etc., since all drivers are likely to depend on those. Instead, have it
that drivers only need to append to the deps array any extra dependencies
they have.

Signed-off-by: Bruce Richardson 
---
 drivers/net/i40e/meson.build  | 7 ++-
 drivers/net/ixgbe/meson.build | 7 ++-
 drivers/net/meson.build   | 4 +++-
 3 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/drivers/net/i40e/meson.build b/drivers/net/i40e/meson.build
index ea7f73d8e..3786af1ed 100644
--- a/drivers/net/i40e/meson.build
+++ b/drivers/net/i40e/meson.build
@@ -48,17 +48,14 @@ sources = files(
'rte_pmd_i40e.c'
)
 
-deps = [rte_eal, rte_net,
-   rte_mbuf, rte_ether,
-   rte_mempool, rte_ring,
-   rte_hash, rte_kvargs]
+deps += rte_hash
 
 if arch_subdir == 'x86'
dpdk_conf.set('RTE_LIBRTE_I40E_INC_VECTOR', 1)
sources += files('i40e_rxtx_vec_sse.c')
 endif
 
-includes = include_directories('base', '.')
+includes = include_directories('base')
 
 install_headers('rte_pmd_i40e.h')
 
diff --git a/drivers/net/ixgbe/meson.build b/drivers/net/ixgbe/meson.build
index b1efd96be..65c215271 100644
--- a/drivers/net/ixgbe/meson.build
+++ b/drivers/net/ixgbe/meson.build
@@ -46,16 +46,13 @@ sources = files(
'rte_pmd_ixgbe.c'
 )
 
-deps = [rte_eal, rte_net,
-   rte_mbuf, rte_ether,
-   rte_mempool, rte_ring,
-   rte_hash, rte_kvargs]
+deps += rte_hash
 
 if arch_subdir == 'x86'
dpdk_conf.set('RTE_IXGBE_INC_VECTOR', 1)
sources += files('ixgbe_rxtx_vec_sse.c')
 endif
 
-includes = include_directories('base', '.')
+includes = include_directories('base')
 
 install_headers('rte_pmd_ixgbe.h')
diff --git a/drivers/net/meson.build b/drivers/net/meson.build
index eccdc83d7..c1728e700 100644
--- a/drivers/net/meson.build
+++ b/drivers/net/meson.build
@@ -38,8 +38,10 @@ foreach drv:drivers
sources = []
libs = []
cflags = []
-   deps = []
includes = []
+   # set up standard deps. Drivers can append/override as necessary
+   deps = [rte_eal, rte_net, rte_mbuf, rte_ether,
+   rte_mempool, rte_ring, rte_kvargs]
 
# pull in driver directory which should assign to each of the above
subdir(drv)
-- 
2.13.4



[dpdk-dev] [RFCv2 14/40] build: add ixgbe driver to build

2017-08-14 Thread Bruce Richardson
Signed-off-by: Bruce Richardson 
---
 drivers/net/ixgbe/base/meson.build | 59 
 drivers/net/ixgbe/meson.build  | 61 ++
 drivers/net/meson.build|  5 ++--
 3 files changed, 123 insertions(+), 2 deletions(-)
 create mode 100644 drivers/net/ixgbe/base/meson.build
 create mode 100644 drivers/net/ixgbe/meson.build

diff --git a/drivers/net/ixgbe/base/meson.build 
b/drivers/net/ixgbe/base/meson.build
new file mode 100644
index 0..d5fb435e4
--- /dev/null
+++ b/drivers/net/ixgbe/base/meson.build
@@ -0,0 +1,59 @@
+#   BSD LICENSE
+#
+#   Copyright(c) 2017 Intel Corporation. All rights reserved.
+#   All rights reserved.
+#
+#   Redistribution and use in source and binary forms, with or without
+#   modification, are permitted provided that the following conditions
+#   are met:
+#
+# * Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in
+#   the documentation and/or other materials provided with the
+#   distribution.
+# * Neither the name of Intel Corporation nor the names of its
+#   contributors may be used to endorse or promote products derived
+#   from this software without specific prior written permission.
+#
+#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+#   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+#   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+#   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+#   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+#   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+#   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+#   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+#   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+sources = [
+   'ixgbe_82598.c',
+   'ixgbe_82599.c',
+   'ixgbe_api.c',
+   'ixgbe_common.c',
+   'ixgbe_dcb_82598.c',
+   'ixgbe_dcb_82599.c',
+   'ixgbe_dcb.c',
+   'ixgbe_hv_vf.c',
+   'ixgbe_mbx.c',
+   'ixgbe_phy.c',
+   'ixgbe_vf.c',
+   'ixgbe_x540.c',
+   'ixgbe_x550.c'
+]
+
+error_cflags = ['-Wno-unused-value',
+   '-Wno-unused-but-set-variable']
+c_args = cflags
+foreach flag: error_cflags
+   if cc.has_argument(flag)
+   c_args += flag
+   endif
+endforeach
+
+base_lib = static_library('ixgbe_base', sources,
+   dependencies: rte_eal,
+   c_args: c_args)
diff --git a/drivers/net/ixgbe/meson.build b/drivers/net/ixgbe/meson.build
new file mode 100644
index 0..b1efd96be
--- /dev/null
+++ b/drivers/net/ixgbe/meson.build
@@ -0,0 +1,61 @@
+#   BSD LICENSE
+#
+#   Copyright(c) 2017 Intel Corporation. All rights reserved.
+#   All rights reserved.
+#
+#   Redistribution and use in source and binary forms, with or without
+#   modification, are permitted provided that the following conditions
+#   are met:
+#
+# * Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in
+#   the documentation and/or other materials provided with the
+#   distribution.
+# * Neither the name of Intel Corporation nor the names of its
+#   contributors may be used to endorse or promote products derived
+#   from this software without specific prior written permission.
+#
+#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+#   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+#   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+#   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+#   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+#   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+#   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+#   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+#   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+cflags = ['-DRTE_LIBRTE_IXGBE_BYPASS']
+
+subdir('base')
+libs = [base_lib]
+
+sources = files(
+   'ixgbe_82599_bypass.c',
+   'ixgbe_bypass.c',
+   'ixgbe_ethd

[dpdk-dev] [RFCv2 16/40] build: add af_packet driver to build

2017-08-14 Thread Bruce Richardson
Signed-off-by: Bruce Richardson 
---
 drivers/net/af_packet/meson.build | 32 
 drivers/net/meson.build   |  5 +
 2 files changed, 37 insertions(+)
 create mode 100644 drivers/net/af_packet/meson.build

diff --git a/drivers/net/af_packet/meson.build 
b/drivers/net/af_packet/meson.build
new file mode 100644
index 0..56ba22e73
--- /dev/null
+++ b/drivers/net/af_packet/meson.build
@@ -0,0 +1,32 @@
+#   BSD LICENSE
+#
+#   Copyright(c) 2017 Intel Corporation. All rights reserved.
+#   All rights reserved.
+#
+#   Redistribution and use in source and binary forms, with or without
+#   modification, are permitted provided that the following conditions
+#   are met:
+#
+# * Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in
+#   the documentation and/or other materials provided with the
+#   distribution.
+# * Neither the name of Intel Corporation nor the names of its
+#   contributors may be used to endorse or promote products derived
+#   from this software without specific prior written permission.
+#
+#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+#   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+#   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+#   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+#   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+#   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+#   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+#   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+#   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+sources = files('rte_eth_af_packet.c')
diff --git a/drivers/net/meson.build b/drivers/net/meson.build
index c1728e700..df78c26d7 100644
--- a/drivers/net/meson.build
+++ b/drivers/net/meson.build
@@ -31,6 +31,11 @@
 
 drivers = ['i40e', 'ixgbe']
 
+# af_packet only works on linux
+if host_machine.system() == 'linux'
+   drivers += 'af_packet'
+endif
+
 foreach drv:drivers
dpdk_conf.set('RTE_LIBRTE_@0@_PMD'.format(drv.to_upper()),1)
 
-- 
2.13.4



[dpdk-dev] [RFCv2 18/40] build: add symbol version map file support to libs

2017-08-14 Thread Bruce Richardson
Signed-off-by: Bruce Richardson 
---
 drivers/net/meson.build | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/net/meson.build b/drivers/net/meson.build
index f64ab07f7..2358194e0 100644
--- a/drivers/net/meson.build
+++ b/drivers/net/meson.build
@@ -74,12 +74,17 @@ foreach drv:net_drivers
endforeach
 
# now build the driver itself, and add to the drivers list
-   lib = library('rte_pmd_@0@'.format(drv),
+   drv_name = 'rte_pmd_@0@'.format(drv)
+   version_map = '@0@/@1@/rte_pmd_@1@_version.map'.format(
+   meson.current_source_dir(), drv)
+   lib = library(drv_name,
sources,
include_directories: includes,
dependencies: deps,
link_with: libs,
c_args: cflags,
+   link_args: '-Wl,--version-script=' + version_map,
+   link_depends: version_map,
install: true,
install_dir: driver_install_path)
 
-- 
2.13.4



[dpdk-dev] [RFCv2 19/40] build: build libraries in a loop for brevity

2017-08-14 Thread Bruce Richardson
now each library just has to specify it's source files, header files and
dependencies, and the higher level lib directory will take care of the
rest. Special case for eal, which is not just in one subdir, and is more
complicated. It is also used sometimes by e.g. base code drivers, so give
it it's own shortcut dependency in case needed.

Signed-off-by: Bruce Richardson 
---
 drivers/net/i40e/meson.build|  2 +-
 drivers/net/ixgbe/meson.build   |  2 +-
 drivers/net/meson.build | 19 +++
 drivers/net/pcap/meson.build|  6 ++---
 lib/librte_cmdline/meson.build  | 12 +++---
 lib/librte_compat/meson.build   |  3 ++-
 lib/librte_eal/bsdapp/eal/meson.build   |  1 +
 lib/librte_eal/linuxapp/eal/meson.build |  1 +
 lib/librte_ether/meson.build| 13 --
 lib/librte_hash/meson.build | 16 -
 lib/librte_kvargs/meson.build   | 13 +++---
 lib/librte_mbuf/meson.build | 12 +++---
 lib/librte_mempool/meson.build  | 12 +++---
 lib/librte_net/meson.build  | 12 +++---
 lib/librte_ring/meson.build | 14 +++
 lib/meson.build | 42 +++--
 16 files changed, 79 insertions(+), 101 deletions(-)

diff --git a/drivers/net/i40e/meson.build b/drivers/net/i40e/meson.build
index 3786af1ed..3139fb001 100644
--- a/drivers/net/i40e/meson.build
+++ b/drivers/net/i40e/meson.build
@@ -48,7 +48,7 @@ sources = files(
'rte_pmd_i40e.c'
)
 
-deps += rte_hash
+deps += ['hash']
 
 if arch_subdir == 'x86'
dpdk_conf.set('RTE_LIBRTE_I40E_INC_VECTOR', 1)
diff --git a/drivers/net/ixgbe/meson.build b/drivers/net/ixgbe/meson.build
index 65c215271..1ea60b0e2 100644
--- a/drivers/net/ixgbe/meson.build
+++ b/drivers/net/ixgbe/meson.build
@@ -46,7 +46,7 @@ sources = files(
'rte_pmd_ixgbe.c'
 )
 
-deps += rte_hash
+deps += ['hash']
 
 if arch_subdir == 'x86'
dpdk_conf.set('RTE_IXGBE_INC_VECTOR', 1)
diff --git a/drivers/net/meson.build b/drivers/net/meson.build
index 2358194e0..cd2328605 100644
--- a/drivers/net/meson.build
+++ b/drivers/net/meson.build
@@ -51,13 +51,21 @@ foreach drv:net_drivers
libs = []
cflags = []
includes = []
+   # dependency managment. External deps managed using dependency
+   # objects, internal deps managed by name of lib
+   ext_deps = []
# set up standard deps. Drivers can append/override as necessary
-   deps = [rte_eal, rte_net, rte_mbuf, rte_ether,
-   rte_mempool, rte_ring, rte_kvargs]
+   deps = ['eal', 'net', 'mbuf', 'ether', 'mempool', 'ring', 'kvargs']
 
# pull in driver directory which should assign to each of the above
subdir(drv)
 
+   # get dependency objs from strings
+   dep_objs = ext_deps
+   foreach d:deps
+   dep_objs += [get_variable('dep_rte_' + d)] + dep_objs
+   endforeach
+
# generate pmdinfo sources
pmdinfogen_srcs = run_command('grep', '--files-with-matches',
'RTE_PMD_REGISTER_.*(.*)', sources).stdout().strip().split()
@@ -65,10 +73,11 @@ foreach drv:net_drivers
out_filename = '@0@.pmd.c'.format(src.split('/')[-1])
tmp_lib = static_library('tmp_@0@'.format(src.underscorify()),
src, include_directories: includes,
-   dependencies: deps,
+   dependencies: dep_objs,
c_args: cflags)
sources += custom_target(out_filename,
-   command: [pmdinfo, tmp_lib.full_path(), 
'@OUTPUT@', pmdinfogen],
+   command: [pmdinfo, tmp_lib.full_path(),
+   '@OUTPUT@', pmdinfogen],
output: out_filename,
depends: [pmdinfogen, tmp_lib])
endforeach
@@ -80,7 +89,7 @@ foreach drv:net_drivers
lib = library(drv_name,
sources,
include_directories: includes,
-   dependencies: deps,
+   dependencies: dep_objs,
link_with: libs,
c_args: cflags,
link_args: '-Wl,--version-script=' + version_map,
diff --git a/drivers/net/pcap/meson.build b/drivers/net/pcap/meson.build
index 015f6bfeb..a61668236 100644
--- a/drivers/net/pcap/meson.build
+++ b/drivers/net/pcap/meson.build
@@ -32,7 +32,7 @@
 sources = files('rte_eth_pcap.c')
 
 if pcap_dep.found()
-   deps += pcap_dep
+   ext_deps += pcap_dep
 else
-   deps += cc.find_library('pcap')
-endif
\ No newline at end of file
+   ext_deps += cc.find_library('pcap')
+endif
diff --git a/lib/librte_cmdline/meson.build b/lib/librte_cmdline/meson.build
index 0b909b77e..ed24b0b0e 100644
--- a/lib/librte_cmdline/meson.build
+++ b/lib/librte_cmdline/meson.build
@@ -41,7 +41,7 @@ sour

[dpdk-dev] [RFCv2 17/40] build: add pcap PMD support

2017-08-14 Thread Bruce Richardson
Signed-off-by: Bruce Richardson 
---
 drivers/net/meson.build  | 13 ++---
 drivers/net/pcap/meson.build | 38 ++
 2 files changed, 48 insertions(+), 3 deletions(-)
 create mode 100644 drivers/net/pcap/meson.build

diff --git a/drivers/net/meson.build b/drivers/net/meson.build
index df78c26d7..f64ab07f7 100644
--- a/drivers/net/meson.build
+++ b/drivers/net/meson.build
@@ -29,14 +29,21 @@
 #   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 #   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-drivers = ['i40e', 'ixgbe']
+net_drivers = ['i40e', 'ixgbe']
 
 # af_packet only works on linux
 if host_machine.system() == 'linux'
-   drivers += 'af_packet'
+   net_drivers += 'af_packet'
 endif
 
-foreach drv:drivers
+pcap_dep = dependency('pcap', required: false)
+# pcap doesn't use pkg-config, but future meson versions should support picking
+# it up as a dependency. For older versions <0.42 use find_program instead
+if pcap_dep.found() or find_program('pcap-config', required: false).found()
+   net_drivers += 'pcap'
+endif
+
+foreach drv:net_drivers
dpdk_conf.set('RTE_LIBRTE_@0@_PMD'.format(drv.to_upper()),1)
 
# set up empty variables used for build
diff --git a/drivers/net/pcap/meson.build b/drivers/net/pcap/meson.build
new file mode 100644
index 0..015f6bfeb
--- /dev/null
+++ b/drivers/net/pcap/meson.build
@@ -0,0 +1,38 @@
+#   BSD LICENSE
+#
+#   Copyright(c) 2017 Intel Corporation. All rights reserved.
+#   All rights reserved.
+#
+#   Redistribution and use in source and binary forms, with or without
+#   modification, are permitted provided that the following conditions
+#   are met:
+#
+# * Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in
+#   the documentation and/or other materials provided with the
+#   distribution.
+# * Neither the name of Intel Corporation nor the names of its
+#   contributors may be used to endorse or promote products derived
+#   from this software without specific prior written permission.
+#
+#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+#   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+#   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+#   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+#   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+#   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+#   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+#   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+#   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+sources = files('rte_eth_pcap.c')
+
+if pcap_dep.found()
+   deps += pcap_dep
+else
+   deps += cc.find_library('pcap')
+endif
\ No newline at end of file
-- 
2.13.4



[dpdk-dev] [RFCv2 20/40] build: version library .so files

2017-08-14 Thread Bruce Richardson
Also rename the ether library to ethdev to maintain backwards compatibility

Signed-off-by: Bruce Richardson 
---
 drivers/net/meson.build|  2 ++
 lib/librte_cmdline/meson.build |  1 +
 lib/librte_ether/meson.build   |  1 +
 lib/librte_hash/meson.build|  1 +
 lib/librte_kvargs/meson.build  |  2 +-
 lib/librte_mbuf/meson.build|  1 +
 lib/librte_mempool/meson.build |  2 +-
 lib/librte_net/meson.build |  1 +
 lib/meson.build| 14 +-
 9 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/drivers/net/meson.build b/drivers/net/meson.build
index cd2328605..6b9177c05 100644
--- a/drivers/net/meson.build
+++ b/drivers/net/meson.build
@@ -47,6 +47,7 @@ foreach drv:net_drivers
dpdk_conf.set('RTE_LIBRTE_@0@_PMD'.format(drv.to_upper()),1)
 
# set up empty variables used for build
+   version = 1
sources = []
libs = []
cflags = []
@@ -94,6 +95,7 @@ foreach drv:net_drivers
c_args: cflags,
link_args: '-Wl,--version-script=' + version_map,
link_depends: version_map,
+   version: '@0@.1'.format(version),
install: true,
install_dir: driver_install_path)
 
diff --git a/lib/librte_cmdline/meson.build b/lib/librte_cmdline/meson.build
index ed24b0b0e..c773f38c5 100644
--- a/lib/librte_cmdline/meson.build
+++ b/lib/librte_cmdline/meson.build
@@ -29,6 +29,7 @@
 #   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 #   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
+version = 2
 sources = files('cmdline.c',
'cmdline_cirbuf.c',
'cmdline_parse.c',
diff --git a/lib/librte_ether/meson.build b/lib/librte_ether/meson.build
index 1c1f69802..ed9c29a78 100644
--- a/lib/librte_ether/meson.build
+++ b/lib/librte_ether/meson.build
@@ -30,6 +30,7 @@
 #   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 
+version = 6
 sources = files('rte_ethdev.c', 'rte_flow.c', 'rte_tm.c')
 
 headers = files('rte_ethdev.h',
diff --git a/lib/librte_hash/meson.build b/lib/librte_hash/meson.build
index 2a0d21520..e3fb9fe0d 100644
--- a/lib/librte_hash/meson.build
+++ b/lib/librte_hash/meson.build
@@ -29,6 +29,7 @@
 #   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 #   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
+version = 2
 headers = files('rte_cmp_arm64.h',
'rte_cmp_x86.h',
'rte_crc_arm64.h',
diff --git a/lib/librte_kvargs/meson.build b/lib/librte_kvargs/meson.build
index f70c3970c..30599d06e 100644
--- a/lib/librte_kvargs/meson.build
+++ b/lib/librte_kvargs/meson.build
@@ -29,7 +29,7 @@
 #   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 #   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-
+version = 1
 sources = files('rte_kvargs.c')
 headers = files('rte_kvargs.h')
 deps = ['eal']
diff --git a/lib/librte_mbuf/meson.build b/lib/librte_mbuf/meson.build
index 8235a2b28..19cd68528 100644
--- a/lib/librte_mbuf/meson.build
+++ b/lib/librte_mbuf/meson.build
@@ -29,6 +29,7 @@
 #   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 #   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
+version = 3
 sources = files('rte_mbuf.c', 'rte_mbuf_ptype.c')
 headers = files('rte_mbuf.h', 'rte_mbuf_ptype.h')
 deps = ['eal', 'mempool', 'ring']
diff --git a/lib/librte_mempool/meson.build b/lib/librte_mempool/meson.build
index 1de47a6c9..9617010dd 100644
--- a/lib/librte_mempool/meson.build
+++ b/lib/librte_mempool/meson.build
@@ -29,7 +29,7 @@
 #   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 #   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-
+version = 2
 sources = files('rte_mempool.c', 'rte_mempool_ops.c')
 headers = files('rte_mempool.h')
 deps = ['eal', 'ring']
diff --git a/lib/librte_net/meson.build b/lib/librte_net/meson.build
index 493139d8c..0bfe53873 100644
--- a/lib/librte_net/meson.build
+++ b/lib/librte_net/meson.build
@@ -29,6 +29,7 @@
 #   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 #   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
+version = 1
 headers = files('rte_ip.h',
'rte_tcp.h',
'rte_udp.h',
diff --git a/lib/meson.build b/lib/meson.build
index a6b820661..55018173b 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -37,6 +37,7 @@ subdir('librte_compat')
 libs = ['ring', 'mempool', 'cmdline', 'mbuf', 'net', 'ether', 'hash', 'kvargs']
 
 foreach l:libs
+   version = 1
sources = []
headers = []
# use "deps" for internal DPDK dependencies, and "ext_deps" for
@@ -55,8 +56,19 @@ foreach l:libs
dep_objs = [get_variable('dep_rte_' + d)] + dep_objs
endforeach
 
-   lib = library('rte_' + l, sources, dependencies: dep_objs,
+   version_map = '@0@/@1@/rte_@2@_versi

[dpdk-dev] [RFCv2 22/40] build: add mempool drivers to build

2017-08-14 Thread Bruce Richardson
Signed-off-by: Bruce Richardson 
---
 drivers/mempool/meson.build   | 97 +++
 drivers/mempool/ring/meson.build  | 32 +
 drivers/mempool/stack/meson.build | 32 +
 drivers/meson.build   |  1 +
 4 files changed, 162 insertions(+)
 create mode 100644 drivers/mempool/meson.build
 create mode 100644 drivers/mempool/ring/meson.build
 create mode 100644 drivers/mempool/stack/meson.build

diff --git a/drivers/mempool/meson.build b/drivers/mempool/meson.build
new file mode 100644
index 0..869e75cb7
--- /dev/null
+++ b/drivers/mempool/meson.build
@@ -0,0 +1,97 @@
+#   BSD LICENSE
+#
+#   Copyright(c) 2017 Intel Corporation. All rights reserved.
+#   All rights reserved.
+#
+#   Redistribution and use in source and binary forms, with or without
+#   modification, are permitted provided that the following conditions
+#   are met:
+#
+# * Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in
+#   the documentation and/or other materials provided with the
+#   distribution.
+# * Neither the name of Intel Corporation nor the names of its
+#   contributors may be used to endorse or promote products derived
+#   from this software without specific prior written permission.
+#
+#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+#   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+#   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+#   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+#   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+#   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+#   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+#   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+#   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+mempool_drivers = ['ring', 'stack']
+
+foreach drv:mempool_drivers
+   dpdk_conf.set('RTE_LIBRTE_@0@_PMD'.format(drv.to_upper()),1)
+
+   # set up empty variables used for build
+   version = 1
+   sources = []
+   libs = []
+   cflags = []
+   includes = []
+   # dependency managment. External deps managed using dependency
+   # objects, internal deps managed by name of lib
+   ext_deps = []
+   # set up standard deps. Drivers can append/override as necessary
+   deps = ['eal', 'mempool', 'ring']
+
+   # pull in driver directory which should assign to each of the above
+   subdir(drv)
+
+   # get dependency objs from strings
+   dep_objs = ext_deps
+   foreach d:deps
+   dep_objs = [get_variable('dep_rte_' + d)] + dep_objs
+   endforeach
+
+   # generate pmdinfo sources
+   pmdinfogen_srcs = run_command('grep', '--files-with-matches',
+   'RTE_PMD_REGISTER_.*(.*)', sources).stdout().strip().split()
+   foreach src: pmdinfogen_srcs
+   out_filename = '@0@.pmd.c'.format(src.split('/')[-1])
+   tmp_lib = static_library('tmp_@0@'.format(src.underscorify()),
+   src, include_directories: includes,
+   dependencies: dep_objs,
+   c_args: cflags)
+   sources += custom_target(out_filename,
+   command: [pmdinfo, tmp_lib.full_path(),
+   '@OUTPUT@', pmdinfogen],
+   output: out_filename,
+   depends: [pmdinfogen, tmp_lib])
+   endforeach
+
+   # now build the driver itself, and add to the drivers list
+   drv_name = 'rte_mempool_@0@'.format(drv)
+   version_map = '@0@/@1@/rte_mempool_@1@_version.map'.format(
+   meson.current_source_dir(), drv)
+   lib = library(drv_name,
+   sources,
+   include_directories: includes,
+   dependencies: dep_objs,
+   link_with: libs,
+   c_args: cflags,
+   link_args: '-Wl,--version-script=' + version_map,
+   link_depends: version_map,
+   version: '@0@.1'.format(version),
+   install: true,
+   install_dir: driver_install_path)
+
+   dpdk_drivers += lib
+
+   # create a dependency object and add it to the global dictionary so
+   # testpmd or other built-in apps can find it if necessary
+   set_variable('dep_pmd_@0@'.format(drv),
+   declare_dependency(link_with: lib,
+   

[dpdk-dev] [RFCv2 21/40] eal: add version information to meson build

2017-08-14 Thread Bruce Richardson
Signed-off-by: Bruce Richardson 
---
 lib/librte_eal/bsdapp/eal/meson.build   | 6 +-
 lib/librte_eal/linuxapp/eal/meson.build | 6 +-
 lib/librte_eal/meson.build  | 1 +
 3 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/lib/librte_eal/bsdapp/eal/meson.build 
b/lib/librte_eal/bsdapp/eal/meson.build
index ff2c2fee8..6c5f5e93d 100644
--- a/lib/librte_eal/bsdapp/eal/meson.build
+++ b/lib/librte_eal/bsdapp/eal/meson.build
@@ -44,11 +44,15 @@ sources = ['eal_alarm.c',
'eal_pci.c',
 ]
 
+version_map = join_paths(meson.current_source_dir(), 'rte_eal_version.map')
 eal_lib = library('rte_eal', sources, eal_common_sources, 
eal_common_arch_sources,
dependencies: dependency('threads'),
include_directories : eal_inc,
+   version: '@0@.1'.format(version),
c_args: '-D_GNU_SOURCE',
-   link_args: '-lexecinfo',
+   link_depends: version_map,
+   link_args: ['-lexecinfo',
+   '-Wl,--version-script=' + version_map],
install: true
 )
 
diff --git a/lib/librte_eal/linuxapp/eal/meson.build 
b/lib/librte_eal/linuxapp/eal/meson.build
index d290ae65e..57bb5d52d 100644
--- a/lib/librte_eal/linuxapp/eal/meson.build
+++ b/lib/librte_eal/linuxapp/eal/meson.build
@@ -49,11 +49,15 @@ sources = ['eal_alarm.c',
'eal_pci.c',
 ]
 
+version_map = join_paths(meson.current_source_dir(), 'rte_eal_version.map')
 eal_lib = library('rte_eal', sources, eal_common_sources, 
eal_common_arch_sources,
dependencies: dependency('threads'),
include_directories : eal_inc,
+   version: '@0@.1'.format(version),
c_args: '-D_GNU_SOURCE',
-   link_args: '-ldl',
+   link_depends: version_map,
+   link_args: ['-ldl',
+   '-Wl,--version-script=' + version_map],
install: true
 )
 
diff --git a/lib/librte_eal/meson.build b/lib/librte_eal/meson.build
index dec6baedd..1b2556121 100644
--- a/lib/librte_eal/meson.build
+++ b/lib/librte_eal/meson.build
@@ -29,6 +29,7 @@
 #   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 #   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
+version = 4  # the version of the EAL API
 eal_inc = [global_inc]
 subdir('common')
 
-- 
2.13.4



[dpdk-dev] [RFCv2 23/40] build: add gro library to meson build

2017-08-14 Thread Bruce Richardson
Signed-off-by: Bruce Richardson 
---
 lib/librte_gro/meson.build | 34 ++
 lib/meson.build|  3 ++-
 2 files changed, 36 insertions(+), 1 deletion(-)
 create mode 100644 lib/librte_gro/meson.build

diff --git a/lib/librte_gro/meson.build b/lib/librte_gro/meson.build
new file mode 100644
index 0..3949575b7
--- /dev/null
+++ b/lib/librte_gro/meson.build
@@ -0,0 +1,34 @@
+#   BSD LICENSE
+#
+#   Copyright(c) 2017 Intel Corporation. All rights reserved.
+#   All rights reserved.
+#
+#   Redistribution and use in source and binary forms, with or without
+#   modification, are permitted provided that the following conditions
+#   are met:
+#
+# * Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in
+#   the documentation and/or other materials provided with the
+#   distribution.
+# * Neither the name of Intel Corporation nor the names of its
+#   contributors may be used to endorse or promote products derived
+#   from this software without specific prior written permission.
+#
+#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+#   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+#   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+#   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+#   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+#   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+#   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+#   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+#   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+sources = files('rte_gro.c', 'gro_tcp4.c')
+headers = files('rte_gro.h')
+deps = ['eal', 'mbuf', 'ether', 'net', 'mempool', 'ring']
diff --git a/lib/meson.build b/lib/meson.build
index 55018173b..ce74c609b 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -34,7 +34,8 @@ subdir('librte_eal')
 subdir('librte_compat')
 
 # process all libraries equally, as far as possible
-libs = ['ring', 'mempool', 'cmdline', 'mbuf', 'net', 'ether', 'hash', 'kvargs']
+libs = ['ring', 'mempool', 'cmdline', 'mbuf', 'net', 'ether', 'hash',
+   'kvargs', 'gro']
 
 foreach l:libs
version = 1
-- 
2.13.4



[dpdk-dev] [RFCv2 25/40] build: track driver include directories properly

2017-08-14 Thread Bruce Richardson
Signed-off-by: Bruce Richardson 
---
 drivers/mempool/meson.build   | 2 +-
 drivers/net/i40e/meson.build  | 2 +-
 drivers/net/ixgbe/meson.build | 2 +-
 drivers/net/meson.build   | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/mempool/meson.build b/drivers/mempool/meson.build
index 1d003b757..daaabc5b6 100644
--- a/drivers/mempool/meson.build
+++ b/drivers/mempool/meson.build
@@ -39,7 +39,7 @@ foreach drv:mempool_drivers
sources = []
libs = []
cflags = []
-   includes = []
+   includes = [include_directories(drv)]
# dependency managment. External deps managed using dependency
# objects, internal deps managed by name of lib
ext_deps = []
diff --git a/drivers/net/i40e/meson.build b/drivers/net/i40e/meson.build
index 3139fb001..dcc832b6f 100644
--- a/drivers/net/i40e/meson.build
+++ b/drivers/net/i40e/meson.build
@@ -55,7 +55,7 @@ if arch_subdir == 'x86'
sources += files('i40e_rxtx_vec_sse.c')
 endif
 
-includes = include_directories('base')
+includes += include_directories('base')
 
 install_headers('rte_pmd_i40e.h')
 
diff --git a/drivers/net/ixgbe/meson.build b/drivers/net/ixgbe/meson.build
index 1ea60b0e2..3e164f97f 100644
--- a/drivers/net/ixgbe/meson.build
+++ b/drivers/net/ixgbe/meson.build
@@ -53,6 +53,6 @@ if arch_subdir == 'x86'
sources += files('ixgbe_rxtx_vec_sse.c')
 endif
 
-includes = include_directories('base')
+includes += include_directories('base')
 
 install_headers('rte_pmd_ixgbe.h')
diff --git a/drivers/net/meson.build b/drivers/net/meson.build
index 07f3f7969..3e587d809 100644
--- a/drivers/net/meson.build
+++ b/drivers/net/meson.build
@@ -51,7 +51,7 @@ foreach drv:net_drivers
sources = []
libs = []
cflags = []
-   includes = []
+   includes = [include_directories(drv)]
# dependency managment. External deps managed using dependency
# objects, internal deps managed by name of lib
ext_deps = []
-- 
2.13.4



[dpdk-dev] [RFCv2 26/40] metrics: add metrics lib to meson build

2017-08-14 Thread Bruce Richardson
Signed-off-by: Bruce Richardson 
---
 lib/librte_metrics/meson.build | 34 ++
 lib/meson.build|  2 +-
 2 files changed, 35 insertions(+), 1 deletion(-)
 create mode 100644 lib/librte_metrics/meson.build

diff --git a/lib/librte_metrics/meson.build b/lib/librte_metrics/meson.build
new file mode 100644
index 0..3b67fff56
--- /dev/null
+++ b/lib/librte_metrics/meson.build
@@ -0,0 +1,34 @@
+#   BSD LICENSE
+#
+#   Copyright(c) 2017 Intel Corporation. All rights reserved.
+#   All rights reserved.
+#
+#   Redistribution and use in source and binary forms, with or without
+#   modification, are permitted provided that the following conditions
+#   are met:
+#
+# * Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in
+#   the documentation and/or other materials provided with the
+#   distribution.
+# * Neither the name of Intel Corporation nor the names of its
+#   contributors may be used to endorse or promote products derived
+#   from this software without specific prior written permission.
+#
+#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+#   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+#   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+#   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+#   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+#   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+#   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+#   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+#   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+sources = files('rte_metrics.c')
+headers = files('rte_metrics.h')
+deps = ['eal']
diff --git a/lib/meson.build b/lib/meson.build
index ce74c609b..0caf7bc75 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -35,7 +35,7 @@ subdir('librte_compat')
 
 # process all libraries equally, as far as possible
 libs = ['ring', 'mempool', 'cmdline', 'mbuf', 'net', 'ether', 'hash',
-   'kvargs', 'gro']
+   'kvargs', 'gro', 'metrics']
 
 foreach l:libs
version = 1
-- 
2.13.4



[dpdk-dev] [RFCv2 24/40] build: tweak naming of pmd dependencies

2017-08-14 Thread Bruce Richardson
Signed-off-by: Bruce Richardson 
---
 drivers/mempool/meson.build | 2 +-
 drivers/net/meson.build | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mempool/meson.build b/drivers/mempool/meson.build
index 869e75cb7..1d003b757 100644
--- a/drivers/mempool/meson.build
+++ b/drivers/mempool/meson.build
@@ -91,7 +91,7 @@ foreach drv:mempool_drivers
 
# create a dependency object and add it to the global dictionary so
# testpmd or other built-in apps can find it if necessary
-   set_variable('dep_pmd_@0@'.format(drv),
+   set_variable('dep_rte_mempool_@0@'.format(drv),
declare_dependency(link_with: lib,
include_directories: includes))
 endforeach
diff --git a/drivers/net/meson.build b/drivers/net/meson.build
index 6b9177c05..07f3f7969 100644
--- a/drivers/net/meson.build
+++ b/drivers/net/meson.build
@@ -103,7 +103,7 @@ foreach drv:net_drivers
 
# create a dependency object and add it to the global dictionary so
# testpmd or other built-in apps can find it if necessary
-   set_variable('dep_pmd_@0@'.format(drv),
+   set_variable('dep_rte_pmd_@0@'.format(drv),
declare_dependency(link_with: lib,
include_directories: includes))
 endforeach
-- 
2.13.4



[dpdk-dev] [RFCv2 27/40] build: track dependencies recursively

2017-08-14 Thread Bruce Richardson
Signed-off-by: Bruce Richardson 
---
 drivers/mempool/meson.build | 3 ++-
 drivers/net/meson.build | 6 --
 lib/librte_eal/bsdapp/eal/meson.build   | 5 -
 lib/librte_eal/linuxapp/eal/meson.build | 5 -
 lib/meson.build | 3 ++-
 5 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/drivers/mempool/meson.build b/drivers/mempool/meson.build
index daaabc5b6..d998797ca 100644
--- a/drivers/mempool/meson.build
+++ b/drivers/mempool/meson.build
@@ -93,5 +93,6 @@ foreach drv:mempool_drivers
# testpmd or other built-in apps can find it if necessary
set_variable('dep_rte_mempool_@0@'.format(drv),
declare_dependency(link_with: lib,
-   include_directories: includes))
+   include_directories: includes,
+   dependencies: dep_objs))
 endforeach
diff --git a/drivers/net/meson.build b/drivers/net/meson.build
index 3e587d809..00ee65988 100644
--- a/drivers/net/meson.build
+++ b/drivers/net/meson.build
@@ -56,7 +56,8 @@ foreach drv:net_drivers
# objects, internal deps managed by name of lib
ext_deps = []
# set up standard deps. Drivers can append/override as necessary
-   deps = ['eal', 'net', 'mbuf', 'ether', 'mempool', 'ring', 'kvargs']
+   # 'ether' as dep, also pulls in mbuf, net, mempool, ring, eal etc
+   deps = ['ether', 'kvargs']
 
# pull in driver directory which should assign to each of the above
subdir(drv)
@@ -105,5 +106,6 @@ foreach drv:net_drivers
# testpmd or other built-in apps can find it if necessary
set_variable('dep_rte_pmd_@0@'.format(drv),
declare_dependency(link_with: lib,
-   include_directories: includes))
+   include_directories: includes,
+   dependencies: dep_objs))
 endforeach
diff --git a/lib/librte_eal/bsdapp/eal/meson.build 
b/lib/librte_eal/bsdapp/eal/meson.build
index 6c5f5e93d..86a9e3d14 100644
--- a/lib/librte_eal/bsdapp/eal/meson.build
+++ b/lib/librte_eal/bsdapp/eal/meson.build
@@ -58,5 +58,8 @@ eal_lib = library('rte_eal', sources, eal_common_sources, 
eal_common_arch_source
 
 dpdk_libraries += ['-pthread', eal_lib]
 
-rte_eal = declare_dependency(link_with: eal_lib, include_directories: eal_inc)
+rte_eal = declare_dependency(link_with: eal_lib,
+   include_directories: eal_inc,
+   dependencies: dependency('threads'),
+   link_args: '-lexecinfo')
 set_variable('dep_rte_eal', rte_eal)
diff --git a/lib/librte_eal/linuxapp/eal/meson.build 
b/lib/librte_eal/linuxapp/eal/meson.build
index 57bb5d52d..90ecfc394 100644
--- a/lib/librte_eal/linuxapp/eal/meson.build
+++ b/lib/librte_eal/linuxapp/eal/meson.build
@@ -63,5 +63,8 @@ eal_lib = library('rte_eal', sources, eal_common_sources, 
eal_common_arch_source
 
 dpdk_libraries += ['-pthread', '-ldl', eal_lib]
 
-rte_eal = declare_dependency(link_with: eal_lib, include_directories: eal_inc)
+rte_eal = declare_dependency(link_with: eal_lib,
+   include_directories: eal_inc,
+   dependencies: dependency('threads'),
+   link_args: '-ldl')
 set_variable('dep_rte_eal', rte_eal)
diff --git a/lib/meson.build b/lib/meson.build
index 0caf7bc75..e0c9c3c81 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -72,7 +72,8 @@ foreach l:libs
version: '@0@.1'.format(version),
install: true)
dep = declare_dependency(link_with: lib,
-   include_directories: include_directories(dir_name))
+   include_directories: include_directories(dir_name),
+   dependencies: dep_objs)
set_variable('dep_rte_' + l, dep)
 
dpdk_libraries = [lib] + dpdk_libraries
-- 
2.13.4



[dpdk-dev] [RFCv2 28/40] testpmd: compile testpmd with meson and ninja

2017-08-14 Thread Bruce Richardson
Add testpmd to build. When done, it was found that the -ldl flag was
getting duplicated too many times in the build causing static linkage to
fail on testpmd as the commandline got to long. [Possible meson bug]. Fix
this by making testpmd link explicitly against libdl (or libexecinfo on
BSD) and don't have EAL track it as its dependency.

Signed-off-by: Bruce Richardson 
---
 app/meson.build | 32 +++
 app/test-pmd/meson.build| 71 +
 lib/librte_eal/bsdapp/eal/meson.build   |  9 +++--
 lib/librte_eal/linuxapp/eal/meson.build |  9 +++--
 meson.build |  6 ++-
 5 files changed, 118 insertions(+), 9 deletions(-)
 create mode 100644 app/meson.build
 create mode 100644 app/test-pmd/meson.build

diff --git a/app/meson.build b/app/meson.build
new file mode 100644
index 0..bdf043ead
--- /dev/null
+++ b/app/meson.build
@@ -0,0 +1,32 @@
+#   BSD LICENSE
+#
+#   Copyright(c) 2017 Intel Corporation. All rights reserved.
+#   All rights reserved.
+#
+#   Redistribution and use in source and binary forms, with or without
+#   modification, are permitted provided that the following conditions
+#   are met:
+#
+# * Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in
+#   the documentation and/or other materials provided with the
+#   distribution.
+# * Neither the name of Intel Corporation nor the names of its
+#   contributors may be used to endorse or promote products derived
+#   from this software without specific prior written permission.
+#
+#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+#   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+#   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+#   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+#   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+#   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+#   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+#   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+#   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+subdir('test-pmd')
diff --git a/app/test-pmd/meson.build b/app/test-pmd/meson.build
new file mode 100644
index 0..9c60f4bc0
--- /dev/null
+++ b/app/test-pmd/meson.build
@@ -0,0 +1,71 @@
+#   BSD LICENSE
+#
+#   Copyright(c) 2017 Intel Corporation. All rights reserved.
+#   All rights reserved.
+#
+#   Redistribution and use in source and binary forms, with or without
+#   modification, are permitted provided that the following conditions
+#   are met:
+#
+# * Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in
+#   the documentation and/or other materials provided with the
+#   distribution.
+# * Neither the name of Intel Corporation nor the names of its
+#   contributors may be used to endorse or promote products derived
+#   from this software without specific prior written permission.
+#
+#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+#   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+#   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+#   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+#   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+#   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+#   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+#   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+#   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+sources = files('cmdline.c',
+   'cmdline_flow.c',
+   'config.c',
+   'csumonly.c',
+   'flowgen.c',
+   'icmpecho.c',
+   'ieee1588fwd.c',
+   'iofwd.c',
+   'macfwd.c',
+   'macswap.c',
+   'parameters.c',
+   'rxonly.c',
+   'testpmd.c',
+   'txonly.c')
+
+deps = ['rte_eal', 'rte_net', 'rte_ether', 'rte_mempool', 'rte_ring',
+   'rte_mbuf', 'rte_gro', 'rte_cmdline', 'rte_metrics']
+if dpdk_conf.has('RTE_LIBRTE_I40E_PMD'

[dpdk-dev] [RFCv2 30/40] crypto/qat: remove dependency on ether library

2017-08-14 Thread Bruce Richardson
Signed-off-by: Bruce Richardson 
---
 drivers/crypto/qat/qat_crypto.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/crypto/qat/qat_crypto.c b/drivers/crypto/qat/qat_crypto.c
index 1f52cabfd..62ee175ba 100644
--- a/drivers/crypto/qat/qat_crypto.c
+++ b/drivers/crypto/qat/qat_crypto.c
@@ -46,7 +46,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
-- 
2.13.4



[dpdk-dev] [RFCv2 29/40] crypto/null: rename the version file to standard

2017-08-14 Thread Bruce Richardson
Signed-off-by: Bruce Richardson 
---
 drivers/crypto/null/Makefile| 2 +-
 .../null/{rte_pmd_null_crypto_version.map => rte_pmd_null_version.map}  | 0
 2 files changed, 1 insertion(+), 1 deletion(-)
 rename drivers/crypto/null/{rte_pmd_null_crypto_version.map => 
rte_pmd_null_version.map} (100%)

diff --git a/drivers/crypto/null/Makefile b/drivers/crypto/null/Makefile
index bc2724b39..b12b6f797 100644
--- a/drivers/crypto/null/Makefile
+++ b/drivers/crypto/null/Makefile
@@ -42,7 +42,7 @@ CFLAGS += $(WERROR_FLAGS)
 LIBABIVER := 1
 
 # versioning export map
-EXPORT_MAP := rte_pmd_null_crypto_version.map
+EXPORT_MAP := rte_pmd_null_version.map
 
 # library source files
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_NULL_CRYPTO) += null_crypto_pmd.c
diff --git a/drivers/crypto/null/rte_pmd_null_crypto_version.map 
b/drivers/crypto/null/rte_pmd_null_version.map
similarity index 100%
rename from drivers/crypto/null/rte_pmd_null_crypto_version.map
rename to drivers/crypto/null/rte_pmd_null_version.map
-- 
2.13.4



[dpdk-dev] [RFCv2 32/40] igb_uio: add igb_uio to meson build

2017-08-14 Thread Bruce Richardson
Signed-off-by: Bruce Richardson 
---
 lib/librte_eal/linuxapp/igb_uio/Kbuild  |  1 +
 lib/librte_eal/linuxapp/igb_uio/meson.build | 47 +
 lib/librte_eal/linuxapp/meson.build | 10 ++
 meson_options.txt   |  4 ++-
 4 files changed, 61 insertions(+), 1 deletion(-)
 create mode 100644 lib/librte_eal/linuxapp/igb_uio/Kbuild
 create mode 100644 lib/librte_eal/linuxapp/igb_uio/meson.build

diff --git a/lib/librte_eal/linuxapp/igb_uio/Kbuild 
b/lib/librte_eal/linuxapp/igb_uio/Kbuild
new file mode 100644
index 0..98c98fe52
--- /dev/null
+++ b/lib/librte_eal/linuxapp/igb_uio/Kbuild
@@ -0,0 +1 @@
+obj-m := igb_uio.o
diff --git a/lib/librte_eal/linuxapp/igb_uio/meson.build 
b/lib/librte_eal/linuxapp/igb_uio/meson.build
new file mode 100644
index 0..c046e1d66
--- /dev/null
+++ b/lib/librte_eal/linuxapp/igb_uio/meson.build
@@ -0,0 +1,47 @@
+#   BSD LICENSE
+#
+#   Copyright(c) 2017 Intel Corporation. All rights reserved.
+#   All rights reserved.
+#
+#   Redistribution and use in source and binary forms, with or without
+#   modification, are permitted provided that the following conditions
+#   are met:
+#
+# * Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in
+#   the documentation and/or other materials provided with the
+#   distribution.
+# * Neither the name of Intel Corporation nor the names of its
+#   contributors may be used to endorse or promote products derived
+#   from this software without specific prior written permission.
+#
+#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+#   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+#   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+#   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+#   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+#   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+#   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+#   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+#   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+mkfile = custom_target('igb_uio_makefile',
+   output: 'Makefile',
+   command: ['touch', '@OUTPUT@'])
+
+custom_target('igb_uio',
+   input: ['igb_uio.c', 'Kbuild'],
+   output: 'igb_uio.ko',
+   command: ['make', '-C', kernel_dir,
+   'M=' + meson.current_build_dir(),
+   'src=' + meson.current_source_dir(),
+   'EXTRA_CFLAGS=-I' + meson.current_source_dir() +
+   '/../../common/include',
+   'modules'],
+   depends: mkfile,
+   depend_files: [join_paths(kernel_dir, 'Kconfig')],
+   build_by_default: true)
diff --git a/lib/librte_eal/linuxapp/meson.build 
b/lib/librte_eal/linuxapp/meson.build
index bc9f22175..88164f297 100644
--- a/lib/librte_eal/linuxapp/meson.build
+++ b/lib/librte_eal/linuxapp/meson.build
@@ -30,3 +30,13 @@
 #   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 subdir('eal')
+
+if get_option('enable_kmods')
+   kernel_dir = get_option('kernel_dir')
+   if kernel_dir == ''
+   kernel_version = run_command('uname', '-r').stdout().strip()
+   kernel_dir = '/lib/modules/' + kernel_version + '/build'
+   endif
+
+   subdir('igb_uio')
+endif
\ No newline at end of file
diff --git a/meson_options.txt b/meson_options.txt
index 8f1db5330..9c45b8159 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -3,4 +3,6 @@ option('max_lcores', type: 'string', value: '128', description: 
'maximum number
 option('max_numa_nodes', type: 'string', value: '4', description: 'maximum 
number of NUMA nodes supported by EAL')
 option('use_hpet', type: 'boolean', value: false, description: 'use HPET timer 
in EAL')
 option('allow_invalid_socket_id', type: 'boolean', value: false,
-description: 'allow out-of-range NUMA socket id\'s for platforms that 
don\'t report the value correctly')
+   description: 'allow out-of-range NUMA socket id\'s for platforms that 
don\'t report the value correctly')
+option('enable_kmods', type: 'boolean', value: true, description: 'build 
kernel modules')
+option('kernel_dir', type: 'string', value: '', description: 'path to the 
kernel for building kernel modules')
-- 
2.13.4



[dpdk-dev] [RFCv2 33/40] ip_frag: rename version file to standard name

2017-08-14 Thread Bruce Richardson
The version file did not quite match the directory name, as it was missing
an '_' between ip and frag.

Signed-off-by: Bruce Richardson 
---
 lib/librte_ip_frag/Makefile| 2 +-
 lib/librte_ip_frag/{rte_ipfrag_version.map => rte_ip_frag_version.map} | 0
 2 files changed, 1 insertion(+), 1 deletion(-)
 rename lib/librte_ip_frag/{rte_ipfrag_version.map => rte_ip_frag_version.map} 
(100%)

diff --git a/lib/librte_ip_frag/Makefile b/lib/librte_ip_frag/Makefile
index 4e693bf8f..2a8c3e374 100644
--- a/lib/librte_ip_frag/Makefile
+++ b/lib/librte_ip_frag/Makefile
@@ -37,7 +37,7 @@ LIB = librte_ip_frag.a
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
 
-EXPORT_MAP := rte_ipfrag_version.map
+EXPORT_MAP := rte_ip_frag_version.map
 
 LIBABIVER := 1
 
diff --git a/lib/librte_ip_frag/rte_ipfrag_version.map 
b/lib/librte_ip_frag/rte_ip_frag_version.map
similarity index 100%
rename from lib/librte_ip_frag/rte_ipfrag_version.map
rename to lib/librte_ip_frag/rte_ip_frag_version.map
-- 
2.13.4



[dpdk-dev] [RFCv2 31/40] build: add cryptodev and some crypto drivers to build

2017-08-14 Thread Bruce Richardson
Signed-off-by: Bruce Richardson 
---
 config/rte_config.h|   9 
 drivers/crypto/meson.build | 103 +
 drivers/crypto/null/meson.build|  32 
 drivers/crypto/openssl/meson.build |  33 
 drivers/crypto/qat/meson.build |  36 +
 drivers/meson.build|   3 +-
 lib/librte_cryptodev/meson.build   |  39 ++
 lib/meson.build|   2 +-
 8 files changed, 255 insertions(+), 2 deletions(-)
 create mode 100644 drivers/crypto/meson.build
 create mode 100644 drivers/crypto/null/meson.build
 create mode 100644 drivers/crypto/openssl/meson.build
 create mode 100644 drivers/crypto/qat/meson.build
 create mode 100644 lib/librte_cryptodev/meson.build

diff --git a/config/rte_config.h b/config/rte_config.h
index 67028f682..6eb72415a 100644
--- a/config/rte_config.h
+++ b/config/rte_config.h
@@ -72,6 +72,9 @@
 #define RTE_ETHDEV_QUEUE_STAT_CNTRS 16
 #define RTE_ETHDEV_RXTX_CALLBACKS 1
 
+/* cryptodev defines */
+#define RTE_CRYPTO_MAX_DEVS 64
+#define RTE_CRYPTODEV_NAME_LEN 64
 /** driver defines /
 
 /* i40e defines */
@@ -83,4 +86,10 @@
 /* interval up to 8160 us, aligned to 2 (or default value) */
 #define RTE_LIBRTE_I40E_ITR_INTERVAL -1
 
+/*
+ * Number of sessions to create in the session memory pool
+ * on a single QuickAssist device.
+ */
+#define RTE_QAT_PMD_MAX_NB_SESSIONS 2048
+
 #endif /* _RTE_CONFIG_H_ */
diff --git a/drivers/crypto/meson.build b/drivers/crypto/meson.build
new file mode 100644
index 0..c26e3d387
--- /dev/null
+++ b/drivers/crypto/meson.build
@@ -0,0 +1,103 @@
+#   BSD LICENSE
+#
+#   Copyright(c) 2017 Intel Corporation. All rights reserved.
+#   All rights reserved.
+#
+#   Redistribution and use in source and binary forms, with or without
+#   modification, are permitted provided that the following conditions
+#   are met:
+#
+# * Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in
+#   the documentation and/or other materials provided with the
+#   distribution.
+# * Neither the name of Intel Corporation nor the names of its
+#   contributors may be used to endorse or promote products derived
+#   from this software without specific prior written permission.
+#
+#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+#   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+#   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+#   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+#   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+#   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+#   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+#   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+#   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+crypto_drivers = ['null']
+
+libcrypto_dep = dependency('libcrypto', required: false)
+if libcrypto_dep.found()
+   crypto_drivers += ['qat', 'openssl']
+endif
+
+foreach drv:crypto_drivers
+   dpdk_conf.set('RTE_LIBRTE_@0@_PMD'.format(drv.to_upper()),1)
+
+   # set up empty variables used for build
+   version = 1
+   sources = []
+   libs = []
+   cflags = []
+   includes = [include_directories(drv)]
+   # dependency managment. External deps managed using dependency
+   # objects, internal deps managed by name of lib
+   ext_deps = []
+   # set up standard deps. Drivers can append/override as necessary
+   deps = ['eal', 'mbuf', 'cryptodev', 'mempool', 'kvargs']
+
+   # pull in driver directory which should assign to each of the above
+   subdir(drv)
+
+   # get dependency objs from strings
+   dep_objs = ext_deps
+   foreach d:deps
+   dep_objs += [get_variable('dep_rte_' + d)] + dep_objs
+   endforeach
+
+   # generate pmdinfo sources
+   pmdinfogen_srcs = run_command('grep', '--files-with-matches',
+   'RTE_PMD_REGISTER_.*(.*)', sources).stdout().strip().split()
+   foreach src: pmdinfogen_srcs
+   out_filename = '@0@.pmd.c'.format(src.split('/')[-1])
+   tmp_lib = static_library('tmp_@0@'.format(src.underscorify()),
+   src, include_directories: includes,
+   dependencies: dep_objs,
+   c_args: cflags)
+   sources += custom_target(out_filename,
+   command: [pmdinfo, tmp_lib.full_path(),
+   

[dpdk-dev] [RFCv2 36/40] acl: add acl library to meson build

2017-08-14 Thread Bruce Richardson
Signed-off-by: Bruce Richardson 
---
 lib/librte_acl/meson.build | 60 ++
 lib/meson.build| 18 --
 2 files changed, 71 insertions(+), 7 deletions(-)
 create mode 100644 lib/librte_acl/meson.build

diff --git a/lib/librte_acl/meson.build b/lib/librte_acl/meson.build
new file mode 100644
index 0..ddaf29bf5
--- /dev/null
+++ b/lib/librte_acl/meson.build
@@ -0,0 +1,60 @@
+#   BSD LICENSE
+#
+#   Copyright(c) 2017 Intel Corporation. All rights reserved.
+#   All rights reserved.
+#
+#   Redistribution and use in source and binary forms, with or without
+#   modification, are permitted provided that the following conditions
+#   are met:
+#
+# * Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in
+#   the documentation and/or other materials provided with the
+#   distribution.
+# * Neither the name of Intel Corporation nor the names of its
+#   contributors may be used to endorse or promote products derived
+#   from this software without specific prior written permission.
+#
+#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+#   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+#   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+#   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+#   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+#   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+#   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+#   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+#   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+version = 2
+sources = files('acl_bld.c', 'acl_gen.c', 'acl_run_scalar.c',
+   'rte_acl.c', 'tb_mem.c')
+headers = files('rte_acl.h', 'rte_acl_osdep.h')
+deps += ['eal']
+
+if arch_subdir == 'x86'
+   sources += files('acl_run_sse.c')
+
+   # compile AVX2 version if either:
+   # a. we have AVX supported in minimum instruction set baseline
+   # b. it's not minimum instruction set, but supported by compiler
+   #
+   # in former case, just add avx2 C file to files list
+   # in latter case, compile c file to static lib, using correct compiler
+   # flags, and then have the .o file from static lib linked into main lib.
+   if dpdk_conf.has('RTE_MACHINE_CPUFLAG_AVX2')
+   sources += files('acl_run_avx2.c')
+   cflags += '-DCC_AVX2_SUPPORT'
+   elif cc.has_argument('-mavx2')
+   avx2_tmplib = static_library('avx2_tmp',
+   'acl_run_avx2.c',
+   dependencies: rte_eal,
+   c_args: '-mavx2')
+   objs += avx2_tmplib.extract_objects('acl_run_avx2.c')
+   cflags += '-DCC_AVX2_SUPPORT'
+   endif
+
+endif
diff --git a/lib/meson.build b/lib/meson.build
index 92d26b8aa..54efb4ba7 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -39,28 +39,30 @@ subdir('librte_compat')
 # sometimes skip deps that would be implied by others, e.g. if mempool is
 # given as a dep, no need to mention ring. This is especially true for the
 # core libs which are widely reused, so their deps are kept to a minimum.
-libs = ['ring', 'mempool', 'mbuf', 'net', 'ether', # core
+libraries = ['ring', 'mempool', 'mbuf', 'net', 'ether', # core
'metrics', # bitrate/latency stats depends on this
'hash',# efd depends on this
'kvargs',  # cryptodev depends on this
-   'bitratestats', 'cfgfile', 'cmdline', 'cryptodev', 'distributor',
-   'efd', 'eventdev', 'gro', 'ip_frag', 'jobstats',
+   'acl', 'bitratestats', 'cfgfile', 'cmdline', 'cryptodev',
+   'distributor', 'efd', 'eventdev', 'gro', 'ip_frag', 'jobstats',
'latencystats', 'lpm', 'meter', 'pdump', 'reorder', 'sched',
'timer']
-# acl - todo
 
 if host_machine.system() == 'linux'
-   libs += ['kni', 'power', 'vhost']
+   libraries += ['kni', 'power', 'vhost']
 endif
 
 # add pkt framework libs which use other libs from above, including optional
 # ones for linux
-libs += ['port', 'table', 'pipeline']
+libraries += ['port', 'table', 'pipeline']
 
-foreach l:libs
+foreach l:libraries
version = 1
sources = []
headers = []
+   cflags = []
+   objs = [] # other object files to link against, used e.g. for 
instruction-
+ # optimized versions of code
# use "deps" for internal DPDK dependencies, and "e

[dpdk-dev] [RFCv2 34/40] build: add most remaining libraries to meson build

2017-08-14 Thread Bruce Richardson
Only libraries not included in meson build at this point are the three
packet framework libs, and the acl library (which needs some custom
handling for the different instruction set levels it has).

Signed-off-by: Bruce Richardson 
---
 app/test-pmd/meson.build|  3 +++
 config/meson.build  |  2 ++
 config/rte_config.h | 19 ++
 drivers/mempool/meson.build |  2 +-
 lib/librte_bitratestats/meson.build | 34 
 lib/librte_cfgfile/meson.build  | 35 +
 lib/librte_cryptodev/meson.build|  1 +
 lib/librte_distributor/meson.build  | 39 +
 lib/librte_efd/meson.build  | 34 
 lib/librte_ether/meson.build|  2 +-
 lib/librte_eventdev/meson.build | 36 ++
 lib/librte_ip_frag/meson.build  | 39 +
 lib/librte_jobstats/meson.build | 34 
 lib/librte_kni/meson.build  | 35 +
 lib/librte_latencystats/meson.build | 34 
 lib/librte_lpm/meson.build  | 35 +
 lib/librte_mbuf/meson.build |  2 +-
 lib/librte_mempool/meson.build  |  3 +--
 lib/librte_meter/meson.build| 34 
 lib/librte_net/meson.build  |  2 +-
 lib/librte_pdump/meson.build| 34 
 lib/librte_power/meson.build| 35 +
 lib/librte_reorder/meson.build  | 34 
 lib/librte_sched/meson.build| 36 ++
 lib/librte_timer/meson.build| 34 
 lib/librte_vhost/meson.build| 36 ++
 lib/meson.build | 24 +++
 27 files changed, 648 insertions(+), 10 deletions(-)
 create mode 100644 lib/librte_bitratestats/meson.build
 create mode 100644 lib/librte_cfgfile/meson.build
 create mode 100644 lib/librte_distributor/meson.build
 create mode 100644 lib/librte_efd/meson.build
 create mode 100644 lib/librte_eventdev/meson.build
 create mode 100644 lib/librte_ip_frag/meson.build
 create mode 100644 lib/librte_jobstats/meson.build
 create mode 100644 lib/librte_kni/meson.build
 create mode 100644 lib/librte_latencystats/meson.build
 create mode 100644 lib/librte_lpm/meson.build
 create mode 100644 lib/librte_meter/meson.build
 create mode 100644 lib/librte_pdump/meson.build
 create mode 100644 lib/librte_power/meson.build
 create mode 100644 lib/librte_reorder/meson.build
 create mode 100644 lib/librte_sched/meson.build
 create mode 100644 lib/librte_timer/meson.build
 create mode 100644 lib/librte_vhost/meson.build

diff --git a/app/test-pmd/meson.build b/app/test-pmd/meson.build
index 9c60f4bc0..843feb54f 100644
--- a/app/test-pmd/meson.build
+++ b/app/test-pmd/meson.build
@@ -46,6 +46,9 @@ sources = files('cmdline.c',
 
 deps = ['rte_eal', 'rte_net', 'rte_ether', 'rte_mempool', 'rte_ring',
'rte_mbuf', 'rte_gro', 'rte_cmdline', 'rte_metrics']
+if dpdk_conf.has('RTE_LIBRTE_PDUMP')
+   deps += 'rte_pdump'
+endif
 if dpdk_conf.has('RTE_LIBRTE_I40E_PMD')
deps += 'rte_pmd_i40e'
 endif
diff --git a/config/meson.build b/config/meson.build
index 4a6a69d13..3a6bcc58d 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -33,6 +33,8 @@
 machine = get_option('machine')
 dpdk_conf.set('RTE_MACHINE', machine)
 add_project_arguments('-march=@0@'.format(machine), language: 'c')
+# some libs depend on maths lib
+add_project_link_arguments('-lm', language: 'c')
 
 # add -include rte_config to cflags
 add_project_arguments('-include', 'rte_config.h', language: 'c')
diff --git a/config/rte_config.h b/config/rte_config.h
index 6eb72415a..651c9b5d6 100644
--- a/config/rte_config.h
+++ b/config/rte_config.h
@@ -75,6 +75,25 @@
 /* cryptodev defines */
 #define RTE_CRYPTO_MAX_DEVS 64
 #define RTE_CRYPTODEV_NAME_LEN 64
+
+/* eventdev defines */
+#define RTE_EVENT_MAX_DEVS 16
+#define RTE_EVENT_MAX_QUEUES_PER_DEV 64
+
+/* ip_fragmentation defines */
+#define RTE_LIBRTE_IP_FRAG_MAX_FRAG 4
+#undef RTE_LIBRTE_IP_FRAG_TBL_STAT
+
+/* rte_power defines */
+#define RTE_MAX_LCORE_FREQS 64
+
+/* rte_sched defines */
+#undef RTE_SCHED_RED
+#undef RTE_SCHED_COLLECT_STATS
+#undef RTE_SCHED_SUBPORT_TC_OV
+#define RTE_SCHED_PORT_N_GRINDERS 8
+#undef RTE_SCHED_VECTOR
+
 /** driver defines /
 
 /* i40e defines */
diff --git a/drivers/mempool/meson.build b/drivers/mempool/meson.build
index d998797ca..a426b8f92 100644
--- a/drivers/mempool/meson.build
+++ b/drivers/mempool/meson.build
@@ -52,7 +52,7 @@ foreach drv:mempool_drivers
# get dependency objs from strings
dep_objs = ext_deps
foreach d:deps
-   dep_objs 

[dpdk-dev] [RFCv2 35/40] build: add packet framework libs to meson build

2017-08-14 Thread Bruce Richardson
Signed-off-by: Bruce Richardson 
---
 lib/librte_pipeline/meson.build | 35 +
 lib/librte_port/meson.build | 58 +
 lib/librte_table/meson.build| 52 
 lib/meson.build |  6 -
 4 files changed, 150 insertions(+), 1 deletion(-)
 create mode 100644 lib/librte_pipeline/meson.build
 create mode 100644 lib/librte_port/meson.build
 create mode 100644 lib/librte_table/meson.build

diff --git a/lib/librte_pipeline/meson.build b/lib/librte_pipeline/meson.build
new file mode 100644
index 0..56a3cf69f
--- /dev/null
+++ b/lib/librte_pipeline/meson.build
@@ -0,0 +1,35 @@
+#   BSD LICENSE
+#
+#   Copyright(c) 2017 Intel Corporation. All rights reserved.
+#   All rights reserved.
+#
+#   Redistribution and use in source and binary forms, with or without
+#   modification, are permitted provided that the following conditions
+#   are met:
+#
+# * Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in
+#   the documentation and/or other materials provided with the
+#   distribution.
+# * Neither the name of Intel Corporation nor the names of its
+#   contributors may be used to endorse or promote products derived
+#   from this software without specific prior written permission.
+#
+#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+#   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+#   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+#   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+#   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+#   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+#   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+#   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+#   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+version = 3
+sources = files('rte_pipeline.c')
+headers = files('rte_pipeline.h')
+deps += ['port', 'table']
\ No newline at end of file
diff --git a/lib/librte_port/meson.build b/lib/librte_port/meson.build
new file mode 100644
index 0..a130f6eb6
--- /dev/null
+++ b/lib/librte_port/meson.build
@@ -0,0 +1,58 @@
+#   BSD LICENSE
+#
+#   Copyright(c) 2017 Intel Corporation. All rights reserved.
+#   All rights reserved.
+#
+#   Redistribution and use in source and binary forms, with or without
+#   modification, are permitted provided that the following conditions
+#   are met:
+#
+# * Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in
+#   the documentation and/or other materials provided with the
+#   distribution.
+# * Neither the name of Intel Corporation nor the names of its
+#   contributors may be used to endorse or promote products derived
+#   from this software without specific prior written permission.
+#
+#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+#   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+#   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+#   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+#   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+#   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+#   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+#   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+#   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+version = 3
+sources = files(
+   'rte_port_ethdev.c',
+   'rte_port_fd.c',
+   'rte_port_ring.c',
+   'rte_port_sched.c',
+   'rte_port_source_sink.c')
+headers = files(
+   'rte_port_ethdev.h',
+   'rte_port_fd.h',
+   'rte_port.h',
+   'rte_port_ring.h',
+   'rte_port_sched.h',
+   'rte_port_source_sink.h')
+deps = ['ether', 'sched']
+
+if dpdk_conf.has('RTE_LIBRTE_IP_FRAG')
+   sources += files('rte_port_frag.c', 'rte_port_ras.c')
+   headers += files('rte_port_frag.h', 'rte_port_ras.h')
+   deps += ['ip_frag']
+endif
+
+if dpdk_conf.has('RTE_LIBRTE

[dpdk-dev] [RFCv2 37/40] build: add ark and avp PMDs to build

2017-08-14 Thread Bruce Richardson
Signed-off-by: Bruce Richardson 
---
 drivers/net/ark/meson.build | 44 
 drivers/net/avp/meson.build | 36 
 drivers/net/meson.build |  2 +-
 3 files changed, 81 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/ark/meson.build
 create mode 100644 drivers/net/avp/meson.build

diff --git a/drivers/net/ark/meson.build b/drivers/net/ark/meson.build
new file mode 100644
index 0..a94d70383
--- /dev/null
+++ b/drivers/net/ark/meson.build
@@ -0,0 +1,44 @@
+#   BSD LICENSE
+#
+#   Copyright(c) 2017 Intel Corporation. All rights reserved.
+#   All rights reserved.
+#
+#   Redistribution and use in source and binary forms, with or without
+#   modification, are permitted provided that the following conditions
+#   are met:
+#
+# * Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in
+#   the documentation and/or other materials provided with the
+#   distribution.
+# * Neither the name of Intel Corporation nor the names of its
+#   contributors may be used to endorse or promote products derived
+#   from this software without specific prior written permission.
+#
+#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+#   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+#   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+#   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+#   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+#   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+#   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+#   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+#   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+sources = files('ark_ddm.c',
+   'ark_ethdev.c',
+   'ark_ethdev_rx.c',
+   'ark_ethdev_tx.c',
+   'ark_mpu.c',
+   'ark_pktchkr.c',
+   'ark_pktdir.c',
+   'ark_pktgen.c',
+   'ark_rqp.c',
+   'ark_udm.c')
+if host_machine.system() == 'linux'
+   ext_deps += cc.find_library('dl')
+endif
diff --git a/drivers/net/avp/meson.build b/drivers/net/avp/meson.build
new file mode 100644
index 0..b42ed9df5
--- /dev/null
+++ b/drivers/net/avp/meson.build
@@ -0,0 +1,36 @@
+#   BSD LICENSE
+#
+#   Copyright(c) 2017 Intel Corporation. All rights reserved.
+#   All rights reserved.
+#
+#   Redistribution and use in source and binary forms, with or without
+#   modification, are permitted provided that the following conditions
+#   are met:
+#
+# * Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in
+#   the documentation and/or other materials provided with the
+#   distribution.
+# * Neither the name of Intel Corporation nor the names of its
+#   contributors may be used to endorse or promote products derived
+#   from this software without specific prior written permission.
+#
+#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+#   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+#   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+#   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+#   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+#   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+#   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+#   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+#   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+if host_machine.system() != 'linux'
+   build = false
+endif
+sources = files('avp_ethdev.c')
+install_headers('rte_avp_common.h', 'rte_avp_fifo.h')
diff --git a/drivers/net/meson.build b/drivers/net/meson.build
index 00ee65988..0c804d073 100644
--- a/drivers/net/meson.build
+++ b/drivers/net/meson.build
@@ -29,7 +29,7 @@
 #   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 #   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-net_drivers =

[dpdk-dev] [RFCv2 39/40] build: fix driver dependencies for static builds

2017-08-14 Thread Bruce Richardson
For static builds we need to better track the dependencies of drivers,
because, unlike with shared libs, the static libs don't track them
themselves. Because of this we have a new global list of external
dependencies which is used for creating the pkg-config file. We also move
the logic for what dependencies a driver has, and if those deps are met,
from the higher level build file to the drivers themselves.

Signed-off-by: Bruce Richardson 
---
 drivers/crypto/meson.build | 115 ++-
 drivers/crypto/openssl/meson.build |   7 +-
 drivers/crypto/qat/meson.build |   7 +-
 drivers/mempool/meson.build| 110 +-
 drivers/net/af_packet/meson.build  |   3 +
 drivers/net/ark/meson.build|   1 +
 drivers/net/meson.build| 123 ++---
 drivers/net/pcap/meson.build   |  11 +-
 lib/librte_eal/bsdapp/eal/meson.build  |   3 +-
 lib/librte_eal/common/include/arch/x86/meson.build |   1 +
 lib/librte_eal/linuxapp/eal/meson.build|   3 +-
 meson.build|   4 +-
 12 files changed, 211 insertions(+), 177 deletions(-)

diff --git a/drivers/crypto/meson.build b/drivers/crypto/meson.build
index 495e9350c..d27889088 100644
--- a/drivers/crypto/meson.build
+++ b/drivers/crypto/meson.build
@@ -29,75 +29,80 @@
 #   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 #   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-crypto_drivers = ['null']
-
-libcrypto_dep = dependency('libcrypto', required: false)
-if libcrypto_dep.found()
-   crypto_drivers += ['qat', 'openssl']
-endif
-
-foreach drv:crypto_drivers
-   dpdk_conf.set('RTE_LIBRTE_@0@_PMD'.format(drv.to_upper()),1)
+drivers = ['null', 'qat', 'openssl']
+std_deps = ['cryptodev'] # cryptodev pulls in all other needed deps
 
+foreach drv:drivers
# set up empty variables used for build
+   build = true # set to false to disable, e.g. missing deps
version = 1
sources = []
objs = []
cflags = []
includes = [include_directories(drv)]
-   # dependency managment. External deps managed using dependency
-   # objects, internal deps managed by name of lib
+   # set up internal deps. Drivers can append/override as necessary
+   deps = std_deps
+   # ext_deps: Stores external library dependency got
+   # using dependency() or cc.find_library(). For most cases, we
+   # probably also need to specify the "-l" flags in
+   # pkgconfig_extra_libs variable too, so that it can be reflected
+   # in the pkgconfig output for static builds
ext_deps = []
-   # set up standard deps. Drivers can append/override as necessary
-   deps = ['mbuf', 'cryptodev', 'kvargs']
+   pkgconfig_extra_libs = []
 
# pull in driver directory which should assign to each of the above
subdir(drv)
 
-   # get dependency objs from strings
-   dep_objs = ext_deps
-   foreach d:deps
-   dep_objs += [get_variable('dep_rte_' + d)] + dep_objs
-   endforeach
-
-   # generate pmdinfo sources
-   pmdinfogen_srcs = run_command('grep', '--files-with-matches',
-   'RTE_PMD_REGISTER_.*(.*)', sources).stdout().strip().split()
-   foreach src: pmdinfogen_srcs
-   out_filename = '@0@.pmd.c'.format(src.split('/')[-1])
-   tmp_lib = static_library('tmp_@0@'.format(src.underscorify()),
-   src, include_directories: includes,
-   dependencies: dep_objs,
-   c_args: cflags)
-   sources += custom_target(out_filename,
-   command: [pmdinfo, tmp_lib.full_path(),
-   '@OUTPUT@', pmdinfogen],
-   output: out_filename,
-   depends: [pmdinfogen, tmp_lib])
-   endforeach
+   if build
+   dpdk_conf.set('RTE_LIBRTE_@0@_PMD'.format(drv.to_upper()),1)
 
-   # now build the driver itself, and add to the drivers list
-   drv_name = 'rte_pmd_@0@'.format(drv)
-   version_map = '@0@/@1@/rte_pmd_@1@_version.map'.format(
-   meson.current_source_dir(), drv)
-   lib = library(drv_name,
-   sources,
-   objects: objs,
-   include_directories: includes,
-   dependencies: dep_objs,
-   c_args: cflags,
-   link_args: '-Wl,--version-script=' + version_map,
-   link_depends: version_map,
-   version: '@0@.1'.format(version),
-   install: true,
-   install_dir: driver_install_path)
+   # get dependency objs from strings
+   dep_objs = []
+   foreach d:deps
+ 

[dpdk-dev] [RFCv2 38/40] build: fix static library builds with base code

2017-08-14 Thread Bruce Richardson
for static library builds, we miss the base code, as the base code .a file
is not included in the overall driver .a file. Instead mark the objects in
the base code lib to be included in the overall library.

Signed-off-by: Bruce Richardson 
---
 drivers/crypto/meson.build | 6 +++---
 drivers/mempool/meson.build| 4 ++--
 drivers/net/i40e/base/meson.build  | 1 +
 drivers/net/i40e/meson.build   | 2 +-
 drivers/net/ixgbe/base/meson.build | 1 +
 drivers/net/ixgbe/meson.build  | 2 +-
 drivers/net/meson.build| 4 ++--
 7 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/drivers/crypto/meson.build b/drivers/crypto/meson.build
index c26e3d387..495e9350c 100644
--- a/drivers/crypto/meson.build
+++ b/drivers/crypto/meson.build
@@ -42,14 +42,14 @@ foreach drv:crypto_drivers
# set up empty variables used for build
version = 1
sources = []
-   libs = []
+   objs = []
cflags = []
includes = [include_directories(drv)]
# dependency managment. External deps managed using dependency
# objects, internal deps managed by name of lib
ext_deps = []
# set up standard deps. Drivers can append/override as necessary
-   deps = ['eal', 'mbuf', 'cryptodev', 'mempool', 'kvargs']
+   deps = ['mbuf', 'cryptodev', 'kvargs']
 
# pull in driver directory which should assign to each of the above
subdir(drv)
@@ -82,9 +82,9 @@ foreach drv:crypto_drivers
meson.current_source_dir(), drv)
lib = library(drv_name,
sources,
+   objects: objs,
include_directories: includes,
dependencies: dep_objs,
-   link_with: libs,
c_args: cflags,
link_args: '-Wl,--version-script=' + version_map,
link_depends: version_map,
diff --git a/drivers/mempool/meson.build b/drivers/mempool/meson.build
index a426b8f92..32763b326 100644
--- a/drivers/mempool/meson.build
+++ b/drivers/mempool/meson.build
@@ -37,7 +37,7 @@ foreach drv:mempool_drivers
# set up empty variables used for build
version = 1
sources = []
-   libs = []
+   objs = []
cflags = []
includes = [include_directories(drv)]
# dependency managment. External deps managed using dependency
@@ -77,9 +77,9 @@ foreach drv:mempool_drivers
meson.current_source_dir(), drv)
lib = library(drv_name,
sources,
+   objects: objs,
include_directories: includes,
dependencies: dep_objs,
-   link_with: libs,
c_args: cflags,
link_args: '-Wl,--version-script=' + version_map,
link_depends: version_map,
diff --git a/drivers/net/i40e/base/meson.build 
b/drivers/net/i40e/base/meson.build
index 69f55497e..ef19e358d 100644
--- a/drivers/net/i40e/base/meson.build
+++ b/drivers/net/i40e/base/meson.build
@@ -53,3 +53,4 @@ endforeach
 base_lib = static_library('i40e_base', sources,
dependencies: rte_eal,
c_args: c_args)
+base_objs = base_lib.extract_all_objects()
diff --git a/drivers/net/i40e/meson.build b/drivers/net/i40e/meson.build
index dcc832b6f..da3f0b6dc 100644
--- a/drivers/net/i40e/meson.build
+++ b/drivers/net/i40e/meson.build
@@ -35,7 +35,7 @@ cflags = ['-DPF_DRIVER',
'-DX722_A0_SUPPORT']
 
 subdir('base')
-libs = [base_lib]
+objs = [base_objs]
 
 sources = files(
'i40e_ethdev.c',
diff --git a/drivers/net/ixgbe/base/meson.build 
b/drivers/net/ixgbe/base/meson.build
index d5fb435e4..2f3fe0491 100644
--- a/drivers/net/ixgbe/base/meson.build
+++ b/drivers/net/ixgbe/base/meson.build
@@ -57,3 +57,4 @@ endforeach
 base_lib = static_library('ixgbe_base', sources,
dependencies: rte_eal,
c_args: c_args)
+base_objs = base_lib.extract_all_objects()
diff --git a/drivers/net/ixgbe/meson.build b/drivers/net/ixgbe/meson.build
index 3e164f97f..32c10a5e2 100644
--- a/drivers/net/ixgbe/meson.build
+++ b/drivers/net/ixgbe/meson.build
@@ -32,7 +32,7 @@
 cflags = ['-DRTE_LIBRTE_IXGBE_BYPASS']
 
 subdir('base')
-libs = [base_lib]
+objs = [base_objs]
 
 sources = files(
'ixgbe_82599_bypass.c',
diff --git a/drivers/net/meson.build b/drivers/net/meson.build
index 0c804d073..2fb7577fa 100644
--- a/drivers/net/meson.build
+++ b/drivers/net/meson.build
@@ -49,7 +49,7 @@ foreach drv:net_drivers
# set up empty variables used for build
version = 1
sources = []
-   libs = []
+   objs = []
cflags = []
includes = [include_directories(drv)]
# dependency managment. External deps managed using dependency
@@ -90,9 +90,9 @@ foreach drv:net_drivers
meson.current_source_dir(), drv)
lib = library(drv_name,
sources,
+   objects: objs,
include_directories: includes,
depende

[dpdk-dev] [RFCv2 40/40] examples: allow basic sample app build using pkg-config

2017-08-14 Thread Bruce Richardson
Signed-off-by: Bruce Richardson 
---
 examples/helloworld/Makefile | 13 +
 examples/l2fwd/Makefile  | 13 +
 2 files changed, 26 insertions(+)

diff --git a/examples/helloworld/Makefile b/examples/helloworld/Makefile
index c83ec01e8..270f02f91 100644
--- a/examples/helloworld/Makefile
+++ b/examples/helloworld/Makefile
@@ -29,6 +29,17 @@
 #   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 #   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
+ifeq ($(shell pkg-config --exists DPDK || echo 1),)
+# we have pkg-config install DPDK
+
+CFLAGS += $(shell pkg-config --cflags DPDK)
+LDFLAGS += $(shell pkg-config --libs DPDK)
+
+helloworld: main.o
+   $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
+
+else # legacy build system
+
 ifeq ($(RTE_SDK),)
 $(error "Please define RTE_SDK environment variable")
 endif
@@ -48,3 +59,5 @@ CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
 
 include $(RTE_SDK)/mk/rte.extapp.mk
+
+endif
diff --git a/examples/l2fwd/Makefile b/examples/l2fwd/Makefile
index 8896ab452..d631c7d35 100644
--- a/examples/l2fwd/Makefile
+++ b/examples/l2fwd/Makefile
@@ -29,6 +29,17 @@
 #   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 #   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
+ifeq ($(shell pkg-config --exists DPDK || echo 1),)
+# we have pkg-config install DPDK
+
+CFLAGS += $(shell pkg-config --cflags DPDK)
+LDFLAGS += $(shell pkg-config --libs DPDK)
+
+l2fwd: main.o
+   $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
+
+else # legacy build system
+
 ifeq ($(RTE_SDK),)
 $(error "Please define RTE_SDK environment variable")
 endif
@@ -48,3 +59,5 @@ CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
 
 include $(RTE_SDK)/mk/rte.extapp.mk
+
+endif
-- 
2.13.4



Re: [dpdk-dev] Announcement of SSE requirement change in dpdk

2017-08-14 Thread Neil Horman
On Mon, Aug 14, 2017 at 10:32:15AM +0100, Bruce Richardson wrote:
> On Sat, Aug 12, 2017 at 02:19:45PM -0400, Neil Horman wrote:
> > On Fri, Aug 11, 2017 at 09:29:24PM +0100, Bruce Richardson wrote:
> > > On Wed, Aug 09, 2017 at 04:21:32PM -0400, Neil Horman wrote:
> > > > Can anyone point out to me when and where the change to require SSE4.2 
> > > > was
> > > > dicussed?  The first I saw of it was when the commit to the release 
> > > > notes went
> > > > in on August 3, and I can find no prior mention of it, save for the 
> > > > patches that
> > > > went in separately in the prior weeks.
> > > > 
> > > > Neil
> > > > 
> > > There was no real widespread discussion of it, if that's what you are
> > > looking for. I made the proposal via patch, and it was reviewed and
> > > acked by a number of folks, with nobody raising any objections at the
> > I had a feeling that was the case, and yes, that does concern me somewhat.  
> > In
> > this particular case I think its ok, because I can't really imagine anyone 
> > using
> > older atom processors, but I think it could become problematic in the 
> > future If
> > that support line moves too far into territory in which theres downstream
> > support issues (with things like OVS or other tree-external applications)
> > 
> > > time. Possibly it was a change that should have been more widely
> > > publicised ahead of time, but I'm not sure what form that publicization
> > > should have taken, since all tech discussion happens on the dev mailing
> > > list anyway.
> > > Not that I'm planning any similar changes, but for the future, what do
> > > you think the process for changes like this should be - and what changes
> > > would classify for it? If we have a process problem, let's try and fix
> > > it.
> > > 
> > 
> > I don't rightly know, to be honest.  DPDK is a little unique in this 
> > situation,
> > since user libraries are built to just access the lowest common denominator 
> > of a
> > given arch.  And in many ways, so is the kernel.  I'm open to suggestions, 
> > but I
> > think so some sort of plan would be a good idea.  These are just off the 
> > top of
> > my head, and likely have drawbacks, but just to get some conversation 
> > started:
> > 
> > 1) Use extendend ISA instructions opportunistically
> > By this I mean  to say, we could implement an alternatives system,
> > simmilar to what we have in the kernel, which can do dynamic instruction
> > replacement based on a run time test.  For example, you can write two 
> > versions
> > of a function, one which impements its method with sse4 and another version
> > which does the same thing using core isa instructions).  If sse4 is 
> > available at
> > runtime, the sse4 variant is mapped in, else the other version is.
> > This is something we sort of talked about before, and while theres been
> > general support in its philosophy, its the sort of thing that takes alot of
> > work, and it is only used in those cases where you know you can use the
> > acceleration.
> > 
> > 2) Limit where you introduce hardware deprecation
> > Perhaps hardware deprecation can be announced in the same way ABI
> > deprecation is, and then introduced at a later date (I would make an opening
> > argument for the next LTS release).  Using the LTS release as a deprecation
> > point is nice because it lets downstream consumers standardize on a release
> > without having to worry about hardware support going away.
> > 
> > Just my $0.02.  food for thought
> > Neil
> > 
> I think the ABI deprecation policy suggestion is a good one, where if we
> want to drop support for some HW that was otherwise supported, we should
> announce it at least one release in advance to make sure everyone is
> aware of it.
> 

Ok, I can agree with that. Are we also agreed on limiting hardware deprecation
to LTS release points?
Neil

> /Bruce
> 


Re: [dpdk-dev] [RFC] Add RIB library

2017-08-14 Thread Bruce Richardson
On Tue, Jul 11, 2017 at 07:33:04PM +, Medvedkin Vladimir wrote:
> Hi,
> 
> I want to introduce new library for ip routing lookup that have some 
> advantages
> over current LPM library. In short:
>  - Increases the speed of control plane operations against lpm such as
>adding/deleting routes
>  - Adds abstraction from dataplane algorythms, so it is possible to add
>different ip route lookup algorythms such as DXR/poptrie/lpc-trie/etc
>in addition to current dir24_8
>  - It is possible to keep user defined application specific additional
>information in struct rte_rib_v4_node which represents route entry.
>It can be next hop/set of next hops (i.e. active and feasible),
>pointers to link rte_rib_v4_node based on some criteria (i.e. 
> next_hop),
>plenty of additional control plane information.
>  - For dir24_8 implementation it is possible to remove 
> rte_lpm_tbl_entry.depth
>field that helps to save 6 bits.
>  - Also new dir24_8 implementation supports different next_hop sizes
>(1/2/4/8 bytes per next hop)
> 
> It would be nice to hear your opinion. The draft is below.
> 
> Medvedkin Vladimir (1):
>   lib/rib: Add Routing Information Base library
> 

On reading this patch and then having discussion with you offline, it
appears there are two major new elements in this patchset:

1. a re-implementation of LPM, with the major advantage of having a
flexible data-size
2. a separate control plane structure that is designed to fit on top off
possibly multiple lookup structures for the data plane

Is this correct?

For the first part, I don't think we should carry about two separate LPM
implementations, but rather look to take the improvements in your
version back into the existing lib. [Or else replace the existing one,
but I prefer pulling the new stuff into it, so as to keep backward
compatibility]

For the second part, perhaps you could expand a bit more on the thought
here, and explain what all different data plane implementations would
fit under it. Would, for instance a hash-lookup work? In that case, what
would the data plane APIs be, and the control plane ones.

Thanks,
/Bruce


Re: [dpdk-dev] Announcement of SSE requirement change in dpdk

2017-08-14 Thread Bruce Richardson
On Mon, Aug 14, 2017 at 06:50:40AM -0400, Neil Horman wrote:
> On Mon, Aug 14, 2017 at 10:32:15AM +0100, Bruce Richardson wrote:
> > On Sat, Aug 12, 2017 at 02:19:45PM -0400, Neil Horman wrote:
> > > On Fri, Aug 11, 2017 at 09:29:24PM +0100, Bruce Richardson wrote:
> > > > On Wed, Aug 09, 2017 at 04:21:32PM -0400, Neil Horman wrote:
> > > > > Can anyone point out to me when and where the change to require 
> > > > > SSE4.2 was
> > > > > dicussed?  The first I saw of it was when the commit to the release 
> > > > > notes went
> > > > > in on August 3, and I can find no prior mention of it, save for the 
> > > > > patches that
> > > > > went in separately in the prior weeks.
> > > > > 
> > > > > Neil
> > > > > 
> > > > There was no real widespread discussion of it, if that's what you are
> > > > looking for. I made the proposal via patch, and it was reviewed and
> > > > acked by a number of folks, with nobody raising any objections at the
> > > I had a feeling that was the case, and yes, that does concern me 
> > > somewhat.  In
> > > this particular case I think its ok, because I can't really imagine 
> > > anyone using
> > > older atom processors, but I think it could become problematic in the 
> > > future If
> > > that support line moves too far into territory in which theres downstream
> > > support issues (with things like OVS or other tree-external applications)
> > > 
> > > > time. Possibly it was a change that should have been more widely
> > > > publicised ahead of time, but I'm not sure what form that publicization
> > > > should have taken, since all tech discussion happens on the dev mailing
> > > > list anyway.
> > > > Not that I'm planning any similar changes, but for the future, what do
> > > > you think the process for changes like this should be - and what changes
> > > > would classify for it? If we have a process problem, let's try and fix
> > > > it.
> > > > 
> > > 
> > > I don't rightly know, to be honest.  DPDK is a little unique in this 
> > > situation,
> > > since user libraries are built to just access the lowest common 
> > > denominator of a
> > > given arch.  And in many ways, so is the kernel.  I'm open to 
> > > suggestions, but I
> > > think so some sort of plan would be a good idea.  These are just off the 
> > > top of
> > > my head, and likely have drawbacks, but just to get some conversation 
> > > started:
> > > 
> > > 1) Use extendend ISA instructions opportunistically
> > >   By this I mean  to say, we could implement an alternatives system,
> > > simmilar to what we have in the kernel, which can do dynamic instruction
> > > replacement based on a run time test.  For example, you can write two 
> > > versions
> > > of a function, one which impements its method with sse4 and another 
> > > version
> > > which does the same thing using core isa instructions).  If sse4 is 
> > > available at
> > > runtime, the sse4 variant is mapped in, else the other version is.
> > >   This is something we sort of talked about before, and while theres been
> > > general support in its philosophy, its the sort of thing that takes alot 
> > > of
> > > work, and it is only used in those cases where you know you can use the
> > > acceleration.
> > > 
> > > 2) Limit where you introduce hardware deprecation
> > >   Perhaps hardware deprecation can be announced in the same way ABI
> > > deprecation is, and then introduced at a later date (I would make an 
> > > opening
> > > argument for the next LTS release).  Using the LTS release as a 
> > > deprecation
> > > point is nice because it lets downstream consumers standardize on a 
> > > release
> > > without having to worry about hardware support going away.
> > > 
> > > Just my $0.02.  food for thought
> > > Neil
> > > 
> > I think the ABI deprecation policy suggestion is a good one, where if we
> > want to drop support for some HW that was otherwise supported, we should
> > announce it at least one release in advance to make sure everyone is
> > aware of it.
> > 
> 
> Ok, I can agree with that. Are we also agreed on limiting hardware deprecation
> to LTS release points?
> Neil
> 
To be clear, you think any hardware deprecation should be done as part
of the LTS release, rather than just after one? I would have thought the
latter, so as to keep legacy HW support around for as long as possible,
but I won't have a problem either way.

If you think it's a good policy to have a fixed point at which any HW
deprecations happen, I don't have an objection to that, but I'm curious
as to whether others think it may be too restrictive. It's not something
we've had a lot of up till now to know how big a deal such a restriction
might be.

+techboard: I suggest the tech board take an agenda item to ratify and
assign owner to document a HW deprecation policy, based on this thread,
at it's next meeting.

/Bruce


Re: [dpdk-dev] [PATCH 1/2] eventdev: add event adapter for ethernet Rx queues

2017-08-14 Thread Jerin Jacob
-Original Message-
> Date: Mon, 14 Aug 2017 14:18:15 +0530
> From: "Rao, Nikhil" 
> To: Jerin Jacob , "Eads, Gage"
>  
> CC: "dev@dpdk.org" , "tho...@monjalon.net"
>  , "Richardson, Bruce" ,
>  "Van Haaren, Harry" , "hemant.agra...@nxp.com"
>  , "nipun.gu...@nxp.com" ,
>  "Vangati, Narender" , "Gujjar, Abhinandan S"
>  
> Subject: Re: [PATCH 1/2] eventdev: add event adapter for ethernet Rx queues
> User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101
>  Thunderbird/52.2.1
> 
> On 8/10/2017 10:23 PM, Jerin Jacob wrote:
> > -Original Message-
> > > Date: Wed, 9 Aug 2017 19:24:30 +
> > > From: "Eads, Gage" 
> > > Makes sense. Are you thinking the helper function would do stop + 
> > > reconfig with additional port + start + setup port, or just setup the 
> > > port with an ID the app supplies (only when a port is required, of 
> > > course)? The second one could be done with little additional code -- the 
> > > app just needs to check if an additional port is needed when configuring 
> > > the eventdev, and another helper function could take a list of  > > ethdev> pairs and return true if any don't have an inbuilt port.
> > 
> > I am in favor adding more logic in helper function(I believe, first one ) 
> > so that it will help
> > application reuse the helper functions for the normal case.
> > 
> 
> Hi Jerin,

Hi Nikhil,

> 
> My understanding of the discussion above is that the simple API adapter
> creation API is
> 
> int rte_event_eth_rx_adapter_create(id, eventdev_id)
> 
> And the raw API is
> 
> typedef int (*rx_adapter_conf_cb) (id, eventdev_id,
>   struct rte_event_eth_rx_adapter_conf *conf, void *arg);
> 
> struct rte_event_eth_rx_adapter_conf {
>   uint8_t rx_event_port_id;
>   uint32_t max_nb_rx;
> };
> 
> int rte_event_eth_rx_adapter_create_ext(id, eventdev_id, conf_cb,
>   conf_arg)
> 
> The conf_cb is invoked if the rte_event_eth_rx_adapter_conf struct needs to
> be filled out. the _create_ext() API is used internally by
> rte_event_eth_rx_adapter_create()
> 
> Does that look OK to you ?

Just elaborating with additional detail. Let me know my understating is correct
or not?

default_cb(id, eventdev_id, conf)
{

conf->rx_event_port_id = rte_event_port() + 1;
conf->max_nb_rx = ...;

}

rte_event_eth_rx_adapter_create(id, eventdev_id)
{
struct rte_event_eth_rx_adapter_conf default_conf_arg;

rte_event_eth_rx_adapter_create_ext(id, eventdev_id,
default_cb, &default_conf_arg);
}

Application is free to use rte_event_eth_rx_adapter_create() or
rte_event_eth_rx_adapter_create_ext(). rte_event_eth_rx_adapter_create_ext()
will be used by application when "default_cb" handler is not enough for
the use cases.


> 
> Nikhil
> 


Re: [dpdk-dev] Announcement of SSE requirement change in dpdk

2017-08-14 Thread Neil Horman
On Mon, Aug 14, 2017 at 11:58:21AM +0100, Bruce Richardson wrote:
> On Mon, Aug 14, 2017 at 06:50:40AM -0400, Neil Horman wrote:
> > On Mon, Aug 14, 2017 at 10:32:15AM +0100, Bruce Richardson wrote:
> > > On Sat, Aug 12, 2017 at 02:19:45PM -0400, Neil Horman wrote:
> > > > On Fri, Aug 11, 2017 at 09:29:24PM +0100, Bruce Richardson wrote:
> > > > > On Wed, Aug 09, 2017 at 04:21:32PM -0400, Neil Horman wrote:
> > > > > > Can anyone point out to me when and where the change to require 
> > > > > > SSE4.2 was
> > > > > > dicussed?  The first I saw of it was when the commit to the release 
> > > > > > notes went
> > > > > > in on August 3, and I can find no prior mention of it, save for the 
> > > > > > patches that
> > > > > > went in separately in the prior weeks.
> > > > > > 
> > > > > > Neil
> > > > > > 
> > > > > There was no real widespread discussion of it, if that's what you are
> > > > > looking for. I made the proposal via patch, and it was reviewed and
> > > > > acked by a number of folks, with nobody raising any objections at the
> > > > I had a feeling that was the case, and yes, that does concern me 
> > > > somewhat.  In
> > > > this particular case I think its ok, because I can't really imagine 
> > > > anyone using
> > > > older atom processors, but I think it could become problematic in the 
> > > > future If
> > > > that support line moves too far into territory in which theres 
> > > > downstream
> > > > support issues (with things like OVS or other tree-external 
> > > > applications)
> > > > 
> > > > > time. Possibly it was a change that should have been more widely
> > > > > publicised ahead of time, but I'm not sure what form that 
> > > > > publicization
> > > > > should have taken, since all tech discussion happens on the dev 
> > > > > mailing
> > > > > list anyway.
> > > > > Not that I'm planning any similar changes, but for the future, what do
> > > > > you think the process for changes like this should be - and what 
> > > > > changes
> > > > > would classify for it? If we have a process problem, let's try and fix
> > > > > it.
> > > > > 
> > > > 
> > > > I don't rightly know, to be honest.  DPDK is a little unique in this 
> > > > situation,
> > > > since user libraries are built to just access the lowest common 
> > > > denominator of a
> > > > given arch.  And in many ways, so is the kernel.  I'm open to 
> > > > suggestions, but I
> > > > think so some sort of plan would be a good idea.  These are just off 
> > > > the top of
> > > > my head, and likely have drawbacks, but just to get some conversation 
> > > > started:
> > > > 
> > > > 1) Use extendend ISA instructions opportunistically
> > > > By this I mean  to say, we could implement an alternatives 
> > > > system,
> > > > simmilar to what we have in the kernel, which can do dynamic instruction
> > > > replacement based on a run time test.  For example, you can write two 
> > > > versions
> > > > of a function, one which impements its method with sse4 and another 
> > > > version
> > > > which does the same thing using core isa instructions).  If sse4 is 
> > > > available at
> > > > runtime, the sse4 variant is mapped in, else the other version is.
> > > > This is something we sort of talked about before, and while 
> > > > theres been
> > > > general support in its philosophy, its the sort of thing that takes 
> > > > alot of
> > > > work, and it is only used in those cases where you know you can use the
> > > > acceleration.
> > > > 
> > > > 2) Limit where you introduce hardware deprecation
> > > > Perhaps hardware deprecation can be announced in the same way 
> > > > ABI
> > > > deprecation is, and then introduced at a later date (I would make an 
> > > > opening
> > > > argument for the next LTS release).  Using the LTS release as a 
> > > > deprecation
> > > > point is nice because it lets downstream consumers standardize on a 
> > > > release
> > > > without having to worry about hardware support going away.
> > > > 
> > > > Just my $0.02.  food for thought
> > > > Neil
> > > > 
> > > I think the ABI deprecation policy suggestion is a good one, where if we
> > > want to drop support for some HW that was otherwise supported, we should
> > > announce it at least one release in advance to make sure everyone is
> > > aware of it.
> > > 
> > 
> > Ok, I can agree with that. Are we also agreed on limiting hardware 
> > deprecation
> > to LTS release points?
> > Neil
> > 
> To be clear, you think any hardware deprecation should be done as part
> of the LTS release, rather than just after one? I would have thought the
> latter, so as to keep legacy HW support around for as long as possible,
> but I won't have a problem either way.
> 
Thats what I was proposing, yes, that we should limit HW deprecation to LTS
releases, as that allows people using an LTS release to be guaranteed hardware
support for the lifetime of the release, though I'm not really married to the
idea, I'm just using it as a starting p

[dpdk-dev] [PATCH] net/mlx5: fix xstats functions unlock missing

2017-08-14 Thread Matan Azrad
The corrupted code didn't unlock the spinlock in xstats
get and reset functions error flow.

Hence, if these errors happaned, the device spinlock was
left locked and many mlx5 device functionalities were blocked.

The fix unlocks the spinlock in the missed places.

Fixes: e62bc9e70608 ("net/mlx5: fix extended statistics")

Signed-off-by: Matan Azrad 
Cc: sta...@dpdk.org
---
 drivers/net/mlx5/mlx5_stats.c | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_stats.c b/drivers/net/mlx5/mlx5_stats.c
index 703f48c..33997af 100644
--- a/drivers/net/mlx5/mlx5_stats.c
+++ b/drivers/net/mlx5/mlx5_stats.c
@@ -442,8 +442,10 @@ mlx5_xstats_get(struct rte_eth_dev *dev,
 
priv_lock(priv);
stats_n = priv_ethtool_get_stats_n(priv);
-   if (stats_n < 0)
+   if (stats_n < 0) {
+   priv_unlock(priv);
return -1;
+   }
if (xstats_ctrl->stats_n != stats_n)
priv_xstats_init(priv);
ret = priv_xstats_get(priv, stats);
@@ -468,10 +470,11 @@ mlx5_xstats_reset(struct rte_eth_dev *dev)
priv_lock(priv);
stats_n = priv_ethtool_get_stats_n(priv);
if (stats_n < 0)
-   return;
+   goto unlock;
if (xstats_ctrl->stats_n != stats_n)
priv_xstats_init(priv);
priv_xstats_reset(priv);
+unlock:
priv_unlock(priv);
 }
 
-- 
2.7.4



Re: [dpdk-dev] [PATCH] crypto/openssl: performance improvements

2017-08-14 Thread De Lara Guarch, Pablo
Hi Akhil,

> -Original Message-
> From: Akhil Goyal [mailto:akhil.go...@nxp.com]
> Sent: Friday, July 28, 2017 12:08 PM
> To: dev@dpdk.org; Doherty, Declan 
> Cc: De Lara Guarch, Pablo ;
> hemant.agra...@nxp.com; Akhil Goyal 
> Subject: [PATCH] crypto/openssl: performance improvements
> 
> key and algo are added in the openssl ctx during session initialization
> instead of adding it for each packet.
> 
> Also in case of HMAC the openssl APIs HMAC_XXX give better performance
> for all HMAC cases.
> 
> Signed-off-by: Akhil Goyal 

Thanks for the patch, nice optimization!
Could you split this into two patches, as you are doing two different things 
here?
One for the first sentence and another one for the second sentence.
Also, as you do that, could you rename the title to be more explicit?
Like: crypto/openssl: initialize cipher key at session init

Finally, I was looking at GCM, and I think it could benefit from this.
I will send a separate patch for it, unless you want to integrate it in this 
patchset yourself.

Thanks,
Pablo



[dpdk-dev] [PATCH v1 1/4] eal: rename phys_addr_t to iova_addr_t

2017-08-14 Thread Santosh Shukla
Signed-off-by: Santosh Shukla 
---
v1 note:
- As changes percolate to all possible dpdk subsystem..
  so its difficult to tag subject with one common title,
  but since, core of changeset is at eal layer so keeping 'eal:'
  as title.

 app/test-crypto-perf/cperf_test_vectors.h  |  4 +--
 doc/guides/contributing/documentation.rst  |  4 +--
 doc/guides/prog_guide/cryptodev_lib.rst|  6 ++--
 drivers/bus/fslmc/portal/dpaa2_hw_pvt.h| 14 
 drivers/crypto/qat/qat_adf/qat_algs.h  |  6 ++--
 drivers/crypto/qat/qat_crypto.h|  2 +-
 drivers/mempool/dpaa2/dpaa2_hw_mempool.h   |  2 +-
 drivers/net/ark/ark_ddm.c  |  2 +-
 drivers/net/ark/ark_ddm.h  |  4 +--
 drivers/net/ark/ark_ethdev_rx.c| 12 +++
 drivers/net/ark/ark_ethdev_tx.c|  2 +-
 drivers/net/ark/ark_mpu.c  |  2 +-
 drivers/net/ark/ark_mpu.h  |  4 +--
 drivers/net/ark/ark_udm.c  |  2 +-
 drivers/net/ark/ark_udm.h  |  4 +--
 drivers/net/avp/avp_ethdev.c   |  2 +-
 drivers/net/avp/rte_avp_common.h   | 20 +--
 drivers/net/bnx2x/bnx2x.c  | 40 +++---
 drivers/net/bnx2x/bnx2x.h  | 22 ++--
 drivers/net/bnx2x/bnx2x_rxtx.c |  4 +--
 drivers/net/bnx2x/bnx2x_stats.c|  2 +-
 drivers/net/bnx2x/bnx2x_vfpf.c |  2 +-
 drivers/net/bnx2x/ecore_sp.h   |  2 +-
 drivers/net/bnxt/bnxt.h| 10 +++---
 drivers/net/bnxt/bnxt_cpr.h|  4 +--
 drivers/net/bnxt/bnxt_ethdev.c |  2 +-
 drivers/net/bnxt/bnxt_ring.c   |  2 +-
 drivers/net/bnxt/bnxt_ring.h   |  2 +-
 drivers/net/bnxt/bnxt_rxr.h|  4 +--
 drivers/net/bnxt/bnxt_txr.h|  2 +-
 drivers/net/bnxt/bnxt_vnic.c   |  2 +-
 drivers/net/bnxt/bnxt_vnic.h   |  6 ++--
 drivers/net/liquidio/lio_rxtx.c|  2 +-
 drivers/net/liquidio/lio_rxtx.h|  4 +--
 drivers/net/qede/base/bcm_osal.h   |  2 +-
 drivers/net/sfc/efsys.h|  2 +-
 drivers/net/sfc/sfc_ef10_rx.c  |  2 +-
 drivers/net/sfc/sfc_ef10_tx.c  |  4 +--
 drivers/net/thunderx/base/nicvf_hw.c   |  2 +-
 drivers/net/thunderx/base/nicvf_hw.h   |  2 +-
 drivers/net/thunderx/base/nicvf_hw_defs.h  |  6 ++--
 drivers/net/thunderx/nicvf_ethdev.c|  4 +--
 drivers/net/thunderx/nicvf_ethdev.h|  4 +--
 drivers/net/thunderx/nicvf_struct.h|  6 ++--
 drivers/net/virtio/virtio_rxtx.h   |  4 +--
 drivers/net/virtio/virtqueue.h |  2 +-
 drivers/net/xenvirt/rte_eth_xenvirt.c  |  2 +-
 drivers/net/xenvirt/rte_mempool_gntalloc.c |  6 ++--
 drivers/net/xenvirt/rte_xen_lib.c  |  6 ++--
 drivers/net/xenvirt/rte_xen_lib.h  |  8 ++---
 examples/l2fwd-crypto/main.c   |  2 +-
 lib/librte_cryptodev/rte_crypto.h  |  2 +-
 lib/librte_cryptodev/rte_crypto_sym.h  |  6 ++--
 lib/librte_cryptodev/rte_cryptodev.h   |  2 +-
 lib/librte_eal/bsdapp/eal/eal_memory.c |  4 +--
 lib/librte_eal/common/include/rte_malloc.h |  2 +-
 lib/librte_eal/common/include/rte_memory.h | 18 +-
 lib/librte_eal/common/include/rte_memzone.h|  2 +-
 lib/librte_eal/common/rte_malloc.c |  2 +-
 lib/librte_eal/linuxapp/eal/eal_memory.c   |  8 ++---
 lib/librte_eal/linuxapp/eal/eal_xen_memory.c   |  4 +--
 .../linuxapp/eal/include/exec-env/rte_kni_common.h | 19 +-
 lib/librte_mbuf/rte_mbuf.h |  8 ++---
 lib/librte_mempool/rte_mempool.c   | 18 +-
 lib/librte_mempool/rte_mempool.h   | 14 
 lib/librte_vhost/vhost.h   |  2 +-
 test/test/test_cryptodev.h |  2 +-
 test/test/test_memzone.c   |  8 ++---
 68 files changed, 195 insertions(+), 194 deletions(-)

diff --git a/app/test-crypto-perf/cperf_test_vectors.h 
b/app/test-crypto-perf/cperf_test_vectors.h
index 85955703c..a203272cf 100644
--- a/app/test-crypto-perf/cperf_test_vectors.h
+++ b/app/test-crypto-perf/cperf_test_vectors.h
@@ -78,13 +78,13 @@ struct cperf_test_vector {
 
struct {
uint8_t *data;
-   phys_addr_t phys_addr;
+   iova_addr_t phys_addr;
uint16_t length;
} aad;
 
struct {
uint8_t *data

[dpdk-dev] [PATCH v1 0/4] make dpdk iova aware

2017-08-14 Thread Santosh Shukla
Changeset based on deprecation notice[1], planned for v17.11 release.
Patches are based on version: 17.11-rc0.

Summary:
Renaming memory address translation api/ datatypes
and memory struct members to iova types.

Includes:
1st patch : rename phys_addr_t to iova_addr_t
2nd patch : rename dma var mainly buf_physaddr to buf_iovaaddr
3rd patch : rename memory translation api to _iova types.
4th patch : remove deprecation notice for dpdk iova aware.

Checkpatch warning:
- Noticed warning in changeset comining from legacy code. unreleated
  with iova changes.

Thanks.

[1]
http://dpdk.org/browse/dpdk/commit/doc/guides/rel_notes?id=caa570db61307e07efc461cf558ec291a3e71b29

Santosh Shukla (4):
  eal: rename phys_addr_t to iova_addr_t
  eal/memory: rename buf_physaddr to buf_iovaaddr
  eal/memory: rename memory translational api to _iova types
  doc: remove dpdk iova aware notice

 app/proc_info/main.c   |  2 +-
 app/test-crypto-perf/cperf_test_vector_parsing.c   |  4 +--
 app/test-crypto-perf/cperf_test_vectors.c  |  6 ++--
 app/test-crypto-perf/cperf_test_vectors.h  |  4 +--
 app/test-pmd/cmdline.c |  2 +-
 doc/guides/contributing/documentation.rst  |  4 +--
 doc/guides/prog_guide/cryptodev_lib.rst|  6 ++--
 doc/guides/prog_guide/img/mbuf1.svg|  2 +-
 doc/guides/rel_notes/deprecation.rst   |  7 
 doc/guides/rel_notes/release_17_11.rst | 27 ++
 drivers/bus/fslmc/fslmc_vfio.c |  2 +-
 drivers/bus/fslmc/portal/dpaa2_hw_pvt.h| 20 +--
 drivers/crypto/qat/qat_adf/qat_algs.h  |  6 ++--
 drivers/crypto/qat/qat_crypto.h|  2 +-
 drivers/crypto/qat/qat_qp.c|  2 +-
 drivers/mempool/dpaa2/dpaa2_hw_mempool.h   |  2 +-
 drivers/net/ark/ark_ddm.c  |  2 +-
 drivers/net/ark/ark_ddm.h  |  4 +--
 drivers/net/ark/ark_ethdev_rx.c| 24 ++---
 drivers/net/ark/ark_ethdev_tx.c|  6 ++--
 drivers/net/ark/ark_mpu.c  |  2 +-
 drivers/net/ark/ark_mpu.h  |  4 +--
 drivers/net/ark/ark_udm.c  |  2 +-
 drivers/net/ark/ark_udm.h  |  4 +--
 drivers/net/avp/avp_ethdev.c   |  2 +-
 drivers/net/avp/rte_avp_common.h   | 20 +--
 drivers/net/bnx2x/bnx2x.c  | 40 ++---
 drivers/net/bnx2x/bnx2x.h  | 22 ++--
 drivers/net/bnx2x/bnx2x_rxtx.c |  8 ++---
 drivers/net/bnx2x/bnx2x_stats.c|  2 +-
 drivers/net/bnx2x/bnx2x_vfpf.c |  2 +-
 drivers/net/bnx2x/ecore_sp.h   |  2 +-
 drivers/net/bnxt/bnxt.h| 10 +++---
 drivers/net/bnxt/bnxt_cpr.h|  4 +--
 drivers/net/bnxt/bnxt_ethdev.c | 10 +++---
 drivers/net/bnxt/bnxt_hwrm.c   | 14 
 drivers/net/bnxt/bnxt_ring.c   |  6 ++--
 drivers/net/bnxt/bnxt_ring.h   |  4 +--
 drivers/net/bnxt/bnxt_rxr.h|  4 +--
 drivers/net/bnxt/bnxt_txr.h|  2 +-
 drivers/net/bnxt/bnxt_vnic.c   |  6 ++--
 drivers/net/bnxt/bnxt_vnic.h   |  6 ++--
 drivers/net/cxgbe/sge.c|  4 +--
 drivers/net/e1000/em_rxtx.c|  4 +--
 drivers/net/e1000/igb_rxtx.c   |  4 +--
 drivers/net/ena/ena_ethdev.c   |  6 ++--
 drivers/net/enic/enic_main.c   |  2 +-
 drivers/net/enic/enic_rxtx.c   |  6 ++--
 drivers/net/fm10k/fm10k.h  |  4 +--
 drivers/net/fm10k/fm10k_ethdev.c   |  4 +--
 drivers/net/fm10k/fm10k_rxtx_vec.c |  4 +--
 drivers/net/i40e/i40e_ethdev.c |  2 +-
 drivers/net/i40e/i40e_fdir.c   |  2 +-
 drivers/net/i40e/i40e_rxtx.c   |  8 ++---
 drivers/net/i40e/i40e_rxtx_vec_altivec.c   |  4 +--
 drivers/net/i40e/i40e_rxtx_vec_neon.c  |  6 ++--
 drivers/net/i40e/i40e_rxtx_vec_sse.c   |  6 ++--
 drivers/net/ixgbe/ixgbe_rxtx.c |  4 +--
 drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c|  6 ++--
 drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c |  6 ++--
 drivers/net/liquidio/lio_rxtx.c|  4 +--
 drivers/net/liquidio/lio_rxtx.h|  4 +--
 drivers/net/mlx4/mlx4.c|  2 +-
 drivers/net/mlx5/mlx5_mr.c |  2 +-
 drivers/net/nfp/nfp_net.c  |  2 +-
 drivers/net/qede/base/bcm_osal.h   |  2 +-
 drivers/net/sfc

[dpdk-dev] [PATCH v1 2/4] eal/memory: rename buf_physaddr to buf_iovaaddr

2017-08-14 Thread Santosh Shukla
Signed-off-by: Santosh Shukla 
---
v1 notes:
 Since crux of change is at eal/memory area so using that as
 title.

 doc/guides/prog_guide/img/mbuf1.svg|  2 +-
 drivers/bus/fslmc/portal/dpaa2_hw_pvt.h|  2 +-
 drivers/net/ark/ark_ethdev_rx.c|  8 
 drivers/net/bnx2x/bnx2x_rxtx.c |  4 ++--
 drivers/net/bnxt/bnxt_ring.h   |  2 +-
 drivers/net/cxgbe/sge.c|  4 ++--
 drivers/net/ena/ena_ethdev.c   |  6 +++---
 drivers/net/enic/enic_main.c   |  2 +-
 drivers/net/enic/enic_rxtx.c   |  6 +++---
 drivers/net/fm10k/fm10k.h  |  4 ++--
 drivers/net/fm10k/fm10k_rxtx_vec.c |  4 ++--
 drivers/net/i40e/i40e_rxtx_vec_altivec.c   |  4 ++--
 drivers/net/i40e/i40e_rxtx_vec_neon.c  |  6 +++---
 drivers/net/i40e/i40e_rxtx_vec_sse.c   |  6 +++---
 drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c|  6 +++---
 drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c |  6 +++---
 drivers/net/nfp/nfp_net.c  |  2 +-
 drivers/net/virtio/virtio_ethdev.c |  2 +-
 drivers/net/virtio/virtqueue.h |  2 +-
 lib/librte_eal/common/eal_common_memory.c  |  2 +-
 lib/librte_eal/common/include/rte_memory.h |  2 +-
 lib/librte_eal/common/rte_malloc.c |  4 ++--
 lib/librte_eal/linuxapp/eal/eal_memory.c   |  8 
 lib/librte_eal/linuxapp/eal/eal_vfio.c |  4 ++--
 .../linuxapp/eal/include/exec-env/rte_kni_common.h |  2 +-
 lib/librte_eal/linuxapp/kni/kni_net.c  |  6 +++---
 lib/librte_kni/rte_kni.c   |  2 +-
 lib/librte_mbuf/rte_mbuf.c |  6 +++---
 lib/librte_mbuf/rte_mbuf.h | 14 +++---
 lib/librte_vhost/virtio_net.c  |  2 +-
 test/test/test_mbuf.c  |  2 +-
 31 files changed, 66 insertions(+), 66 deletions(-)

diff --git a/doc/guides/prog_guide/img/mbuf1.svg 
b/doc/guides/prog_guide/img/mbuf1.svg
index 5bd84d1bf..2f856bfd9 100644
--- a/doc/guides/prog_guide/img/mbuf1.svg
+++ b/doc/guides/prog_guide/img/mbuf1.svg
@@ -482,7 +482,7 @@
  sodipodi:role="line"
  x="187.85715"
  y="347.7193"
- id="tspan5240">(m->buf_physaddr is the(m->buf_iovaaddr is thebuf_physaddr)
+#define DPAA2_MBUF_VADDR_TO_IOVA(mbuf) ((mbuf)->buf_iovaaddr)
 #define DPAA2_OP_VADDR_TO_IOVA(op) (op->phys_addr)
 
 /**
diff --git a/drivers/net/ark/ark_ethdev_rx.c b/drivers/net/ark/ark_ethdev_rx.c
index 1cbda01a7..90cf304c0 100644
--- a/drivers/net/ark/ark_ethdev_rx.c
+++ b/drivers/net/ark/ark_ethdev_rx.c
@@ -500,22 +500,22 @@ eth_ark_rx_seed_mbufs(struct ark_rx_queue *queue)
case 0:
while (count != nb) {
queue->paddress_q[seed_m++] =
-   (*mbufs++)->buf_physaddr;
+   (*mbufs++)->buf_iovaaddr;
count++;
/* FALLTHROUGH */
case 3:
queue->paddress_q[seed_m++] =
-   (*mbufs++)->buf_physaddr;
+   (*mbufs++)->buf_iovaaddr;
count++;
/* FALLTHROUGH */
case 2:
queue->paddress_q[seed_m++] =
-   (*mbufs++)->buf_physaddr;
+   (*mbufs++)->buf_iovaaddr;
count++;
/* FALLTHROUGH */
case 1:
queue->paddress_q[seed_m++] =
-   (*mbufs++)->buf_physaddr;
+   (*mbufs++)->buf_iovaaddr;
count++;
/* FALLTHROUGH */
 
diff --git a/drivers/net/bnx2x/bnx2x_rxtx.c b/drivers/net/bnx2x/bnx2x_rxtx.c
index 7336124fc..e558bb12c 100644
--- a/drivers/net/bnx2x/bnx2x_rxtx.c
+++ b/drivers/net/bnx2x/bnx2x_rxtx.c
@@ -140,7 +140,7 @@ bnx2x_dev_rx_queue_setup(struct rte_eth_dev *dev,
return -ENOMEM;
}
rxq->sw_ring[idx] = mbuf;
-   rxq->rx_ring[idx] = mbuf->buf_physaddr;
+   rxq->rx_ring[idx] = mbuf->buf_iovaaddr;
}
rxq->pkt_first_seg = NULL;
rxq->pkt_last_seg = NULL;
@@ -400,7 +400,7 @@ bnx2x_recv_pkts(void *p_rxq, struct rte_mbuf **rx_pkts, 
uint16_t nb_pkts)
 
rx_mb = rxq->sw_ring[bd_cons];
rxq->sw_ring[bd_cons] = new_mb;
-   rxq->rx_ring[bd_prod] = new_mb->buf_physaddr;
+   rxq->rx_ring[bd_prod] = new_mb->buf_iovaaddr;
 
rx_pref = NEXT_RX_BD(bd_cons) & MAX_RX_BD(rx

[dpdk-dev] [PATCH v1 3/4] eal/memory: rename memory translational api to _iova types

2017-08-14 Thread Santosh Shukla
The following api renamed from:

rte_mempool_populate_phys()
rte_mempool_populate_phys_tab()
rte_eal_using_phys_addrs()
rte_mem_virt2phy()
rte_dump_physmem_layout()
rte_eal_get_physmem_layout()
rte_eal_get_physmem_size()
rte_malloc_virt2phy()
rte_mem_phy2mch()

To the following iova types api:

rte_mempool_populate_iova()
rte_mempool_populate_iova_tab()
rte_eal_using_iova_addrs()
rte_mem_virt2iova()
rte_dump_iovamem_layout()
rte_eal_get_iovamem_layout()
rte_eal_get_iovamem_size()
rte_malloc_virt2iova()
rte_mem_phy2iova()

Signed-off-by: Santosh Shukla 
---
 app/proc_info/main.c |  2 +-
 app/test-crypto-perf/cperf_test_vector_parsing.c |  4 ++--
 app/test-crypto-perf/cperf_test_vectors.c|  6 +++---
 app/test-pmd/cmdline.c   |  2 +-
 drivers/bus/fslmc/fslmc_vfio.c   |  2 +-
 drivers/bus/fslmc/portal/dpaa2_hw_pvt.h  |  4 ++--
 drivers/crypto/qat/qat_qp.c  |  2 +-
 drivers/net/ark/ark_ethdev_rx.c  |  4 ++--
 drivers/net/ark/ark_ethdev_tx.c  |  4 ++--
 drivers/net/bnxt/bnxt_ethdev.c   |  8 
 drivers/net/bnxt/bnxt_hwrm.c | 14 +++---
 drivers/net/bnxt/bnxt_ring.c |  4 ++--
 drivers/net/bnxt/bnxt_vnic.c |  4 ++--
 drivers/net/e1000/em_rxtx.c  |  4 ++--
 drivers/net/e1000/igb_rxtx.c |  4 ++--
 drivers/net/fm10k/fm10k_ethdev.c |  4 ++--
 drivers/net/i40e/i40e_ethdev.c   |  2 +-
 drivers/net/i40e/i40e_fdir.c |  2 +-
 drivers/net/i40e/i40e_rxtx.c |  8 
 drivers/net/ixgbe/ixgbe_rxtx.c   |  4 ++--
 drivers/net/liquidio/lio_rxtx.c  |  2 +-
 drivers/net/mlx4/mlx4.c  |  2 +-
 drivers/net/mlx5/mlx5_mr.c   |  2 +-
 drivers/net/sfc/sfc.c|  2 +-
 drivers/net/sfc/sfc_tso.c|  2 +-
 examples/l2fwd-crypto/main.c |  2 +-
 lib/librte_cryptodev/rte_cryptodev.c |  2 +-
 lib/librte_eal/bsdapp/eal/eal.c  |  2 +-
 lib/librte_eal/bsdapp/eal/eal_memory.c   |  2 +-
 lib/librte_eal/bsdapp/eal/rte_eal_version.map| 12 ++--
 lib/librte_eal/common/eal_common_memory.c|  6 +++---
 lib/librte_eal/common/eal_common_memzone.c   |  4 ++--
 lib/librte_eal/common/eal_private.h  |  2 +-
 lib/librte_eal/common/include/rte_malloc.h   |  2 +-
 lib/librte_eal/common/include/rte_memory.h   | 12 ++--
 lib/librte_eal/common/rte_malloc.c   |  2 +-
 lib/librte_eal/linuxapp/eal/eal.c|  2 +-
 lib/librte_eal/linuxapp/eal/eal_memory.c |  8 
 lib/librte_eal/linuxapp/eal/eal_pci.c|  4 ++--
 lib/librte_eal/linuxapp/eal/eal_vfio.c   |  6 +++---
 lib/librte_eal/linuxapp/eal/rte_eal_version.map  | 12 ++--
 lib/librte_mempool/rte_mempool.c | 24 
 lib/librte_mempool/rte_mempool.h |  4 ++--
 lib/librte_mempool/rte_mempool_version.map   |  4 ++--
 lib/librte_vhost/vhost_user.c|  4 ++--
 test/test/commands.c |  2 +-
 test/test/test_malloc.c  |  4 ++--
 test/test/test_memory.c  |  6 +++---
 test/test/test_mempool.c |  4 ++--
 test/test/test_memzone.c | 10 +-
 50 files changed, 120 insertions(+), 120 deletions(-)

diff --git a/app/proc_info/main.c b/app/proc_info/main.c
index 8b753a2ee..16df6d4b1 100644
--- a/app/proc_info/main.c
+++ b/app/proc_info/main.c
@@ -297,7 +297,7 @@ static void
 meminfo_display(void)
 {
printf("--- MEMORY_SEGMENTS ---\n");
-   rte_dump_physmem_layout(stdout);
+   rte_dump_iovamem_layout(stdout);
printf("- END_MEMORY_SEGMENTS -\n");
 
printf(" MEMORY_ZONES -\n");
diff --git a/app/test-crypto-perf/cperf_test_vector_parsing.c 
b/app/test-crypto-perf/cperf_test_vector_parsing.c
index 148a60414..2e4e10a85 100644
--- a/app/test-crypto-perf/cperf_test_vector_parsing.c
+++ b/app/test-crypto-perf/cperf_test_vector_parsing.c
@@ -390,7 +390,7 @@ parse_entry(char *entry, struct cperf_test_vector *vector,
} else if (strstr(key_token, "aad")) {
rte_free(vector->aad.data);
vector->aad.data = data;
-   vector->aad.phys_addr = rte_malloc_virt2phy(vector->aad.data);
+   vector->aad.phys_addr = rte_malloc_virt2iova(vector->aad.data);
if (tc_found)
vector->aad.length = data_length;
else {
@@ -405,7 +405,7 @@ parse_entry(char *entry, struct cperf_test_vector *vector,
} else if (strstr(key_token, "digest")) {
  

[dpdk-dev] [PATCH v1 4/4] doc: remove dpdk iova aware notice

2017-08-14 Thread Santosh Shukla
Removed dpdk iova aware ABI deprecation notice,
and updated ABI change details in release_17.11.rst.

Signed-off-by: Santosh Shukla 
---
 doc/guides/rel_notes/deprecation.rst   |  7 ---
 doc/guides/rel_notes/release_17_11.rst | 27 +++
 2 files changed, 27 insertions(+), 7 deletions(-)

diff --git a/doc/guides/rel_notes/deprecation.rst 
b/doc/guides/rel_notes/deprecation.rst
index 3362f3350..6482363bf 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -32,13 +32,6 @@ Deprecation Notices
 * eal: the support of Xen dom0 will be removed from EAL in 17.11; and with
   that, drivers/net/xenvirt and examples/vhost_xen will also be removed.
 
-* eal: An ABI change is planned for 17.11 to make DPDK aware of IOVA address
-  translation scheme.
-  Reference to phys address in EAL data-structure or functions may change to
-  IOVA address or more appropriate name.
-  The change will be only for the name.
-  Functional aspects of the API or data-structure will remain same.
-
 * The mbuf flags PKT_RX_VLAN_PKT and PKT_RX_QINQ_PKT are deprecated and
   are respectively replaced by PKT_RX_VLAN_STRIPPED and
   PKT_RX_QINQ_STRIPPED, that are better described. The old flags and
diff --git a/doc/guides/rel_notes/release_17_11.rst 
b/doc/guides/rel_notes/release_17_11.rst
index 170f4f916..30d0c0229 100644
--- a/doc/guides/rel_notes/release_17_11.rst
+++ b/doc/guides/rel_notes/release_17_11.rst
@@ -124,7 +124,34 @@ ABI Changes
Also, make sure to start the actual text at the margin.
=
 
+* **Following datatypes, structure member and function renamed to iova type.**
 
+  * Renamed ``phys_addr_t`` to ``iova_addr_t``.
+  * Renamed ``buf_physaddr`` to ``buf_iovaaddr`` for struct rte_mbuf.
+  * Renamed ``phys_addr`` to ``iova_addr`` for struct rte_memseg.
+  * The Following memory translation api renamed from:
+
+* ``rte_mempool_populate_phys()``
+* ``rte_mempool_populate_phys_tab()``
+* ``rte_eal_using_phys_addrs()``
+* ``rte_mem_virt2phy()``
+* ``rte_dump_physmem_layout()``
+* ``rte_eal_get_physmem_layout()``
+* ``rte_eal_get_physmem_size()``
+* ``rte_malloc_virt2phy()``
+* ``rte_mem_phy2mch()``
+
+  * To the following iova types api:
+
+* ``rte_mempool_populate_iova()``
+* ``rte_mempool_populate_iova_tab()``
+* ``rte_eal_using_iova_addrs()``
+* ``rte_mem_virt2iova()``
+* ``rte_dump_iovamem_layout()``
+* ``rte_eal_get_iovamem_layout()``
+* ``rte_eal_get_iovamem_size()``
+* ``rte_malloc_virt2iova()``
+* ``rte_mem_phy2iova()``
 
 Shared Library Versions
 ---
-- 
2.11.0



[dpdk-dev] [PATCH v6 00/12] Infrastructure to detect iova mapping on the bus

2017-08-14 Thread Santosh Shukla
v6:
Sending v5 series rebased on top of version: 17.11-rc0.

v5:
Introducing RTE_PCI_DRV_IOVA_AS_VA flag for autodetection of iova va mapping.
If a PCI driver demand for IOVA as VA scheme then the driver can add it in the
PCI driver registration function.

Algorithm to select IOVA as VA for PCI bus case:
 0. If no device bound then return with RTE_IOVA_DC mapping mode,
 else goto 1).
 1. Look for device attached to vfio kdrv and has .drv_flag set
 to RTE_PCI_DRV_IOVA_AS_VA.
 2. Look for any device attached to UIO class of driver.
 3. Check for vfio-noiommu mode enabled.

 If 2) & 3) is false and 1) is true then select
 mapping scheme as RTE_IOVA_VA. Otherwise use default
 mapping scheme (RTE_IOVA_PA).

That way, Bus can truly autodetect the iova mapping mode for
a device Or a set of the device.

Patch series rebased on version-17.08-rc2:
'67c4b6db68e199247b5dbd63f560582640b180bf'.

v5 --> v6:
- Added api info in eal's versiom.map (release DPDK_v17.11).

v4 --> v5:
- Change DPDK_17.08 to DPDK_17.11 in _version.map.
- Reworded bus api description (suggested by Hemant).
- Added reviewed-by from Maxime in v5.
- Added acked-by from Hemant for pci and bus patches.

v3 --> v4:
- Re-introduced RTE_IOVA_DEC mode (Suggested by Hemant [5]).
- Renamed flag to RTE_PCI_DRV_IOVA_AS_VA (Suggested by Maxime).
- Reworded WARNING message(suggested by Maxime[7]).
- Created a separate patch for rte_pci_get_iommu_class (suggested by Maxime[]).
- Added VFIO_PRESENT ifdef build fix.

v2 --> v3:
- Removed rte_mempool_virt2phy (suggested by Olivier [4])

v1 --> v2:
- Removed override eal option i.e. (--iova-mode=<>) Because we have means to
   truly autodetect the iova mode.
- Introduced RTE_PCI_DRV_NEED_IOVA_VA drv_flag (Suggested by Maxime [3]).
- Using NEED_IOVA_VA drv_flag in autodetection logic.
- Removed Linux version check macro in vfio code, As per Maxime feedback.
- Moved rte_pci_match API from local to global.

Patch Summary:
0) 1st: Introducing a new flag in rte_pci_drv
1) 2nd: declare rte_pci_match api in pci header. Required for autodetection in
follow up patches.
2) 3rd: declare rte_pci_get_iommu_class.
3) 4nd - 5th: autodetection mapping infrastructure for Linux/bsdapp.
4) 6th: Introduces global bus API named rte_bus_get_iommu_class.
5) 7th: iova mode helper API.
6) 8th - 9th: Calls rte_bus_get_iommu_class API for Linux/bsdapp and returns
their iova mode.
7) 10th: Check iova mode and accordingly map vfio.dma_map to _pa or _va.
8) 11th - 12th: Check for IOVA_VA mode in below APIs
 - rte_mem_virt2phy
 - rte_malloc_virt2phy

Test History:
- Tested for x86/XL710 40G NIC card for both modes (iova_va/pa).
- Tested for arm64/thunderx vNIC Integrated NIC for both modes
- Tested for arm64/Octeontx integrated NICs for only
   Iova_va mode(It supports only one mode.)
- Ran standalone tests like mempool_autotest, mbuf_autotest.
- Verified for Doxygen.

Work History:
For v1, Refer [1].
For v2, Refer [2].
For v3, Refer [9].
For v4, refer [10].

Checkpatch result:
* Debug message - WARNING: line over 80 characters

Thanks.,

[1] https://www.mail-archive.com/dev@dpdk.org/msg67438.html
[2] https://www.mail-archive.com/dev@dpdk.org/msg70674.html
[3] https://www.mail-archive.com/dev@dpdk.org/msg70279.html
[4] https://www.mail-archive.com/dev@dpdk.org/msg70692.html
[5] http://dpdk.org/ml/archives/dev/2017-July/071282.html
[6] http://dpdk.org/ml/archives/dev/2017-July/070951.html
[7] http://dpdk.org/ml/archives/dev/2017-July/070941.html
[8] http://dpdk.org/ml/archives/dev/2017-July/070952.html
[9] http://dpdk.org/ml/archives/dev/2017-July/070918.html
[10] http://dpdk.org/ml/archives/dev/2017-July/071754.html

Santosh Shukla (12):
  eal/pci: introduce PCI driver iova as va flag
  eal/pci: export match function
  eal/pci: get iommu class
  bsdapp/eal_pci: get iommu class
  linuxapp/eal_pci: get iommu class
  bus: get iommu class
  eal: introduce iova mode helper api
  linuxapp/eal: auto detect iova mode
  bsdapp/eal: auto detect iova mapping mode
  linuxapp/eal_vfio: honor iova mode before mapping
  linuxapp/eal_memory: honor iova mode in virt2phy
  eal/rte_malloc: honor iova mode in virt2phy

 lib/librte_eal/bsdapp/eal/eal.c | 20 --
 lib/librte_eal/bsdapp/eal/eal_pci.c | 10 +++
 lib/librte_eal/bsdapp/eal/rte_eal_version.map   | 10 +++
 lib/librte_eal/common/eal_common_bus.c  | 23 ++
 lib/librte_eal/common/eal_common_pci.c  | 11 +--
 lib/librte_eal/common/include/rte_bus.h | 35 +
 lib/librte_eal/common/include/rte_eal.h | 12 
 lib/librte_eal/common/include/rte_pci.h | 28 
 lib/librte_eal/common/rte_malloc.c  |  9 ++-
 lib/librte_eal/linuxapp/eal/eal.c   | 21 --
 lib/librte_eal/linuxapp/eal/eal_memory.c|  3 +
 lib/librte_eal/linuxapp/eal/eal_pci.c   | 95 +
 lib/librte_eal/linuxapp/eal/eal_vfio.c  | 29 +++-
 lib/l

[dpdk-dev] [PATCH v6 01/12] eal/pci: introduce PCI driver iova as va flag

2017-08-14 Thread Santosh Shukla
Introducing RTE_PCI_DRV_IOVA_AS_VA flag. Flag used when driver needs
to operate in iova=va mode.

Why driver need iova=va mapping?

On NPU style co-processors like Octeontx, the buffer recycling has been
done in HW, unlike SW model. Here is the data flow:
1) On control path, Fill the HW mempool with buffers(iova as pa address)
2) on rx_burst, HW gives you IOVA address(iova as pa address)
3) As application expects VA to operate on it, rx_burst() needs to
convert to _va from _pa. Which is very expensive.
Instead of that if iova as va mapping, we can avoid the cost of
converting with help of IOMMU/SMMU.

Signed-off-by: Santosh Shukla 
Signed-off-by: Jerin Jacob 
Reviewed-by: Maxime Coquelin 
---
 lib/librte_eal/common/include/rte_pci.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/librte_eal/common/include/rte_pci.h 
b/lib/librte_eal/common/include/rte_pci.h
index 8b123391c..743392f91 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -202,6 +202,8 @@ struct rte_pci_bus {
 #define RTE_PCI_DRV_INTR_RMV 0x0010
 /** Device driver needs to keep mapped resources if unsupported dev detected */
 #define RTE_PCI_DRV_KEEP_MAPPED_RES 0x0020
+/** Device driver supports iova as va */
+#define RTE_PCI_DRV_IOVA_AS_VA 0X0040
 
 /**
  * A structure describing a PCI mapping.
-- 
2.11.0



[dpdk-dev] [PATCH v6 02/12] eal/pci: export match function

2017-08-14 Thread Santosh Shukla
Export rte_pci_match() function as it needed in the followup patch.

Signed-off-by: Santosh Shukla 
Signed-off-by: Jerin Jacob 
Acked-by: Maxime Coquelin 
---
 lib/librte_eal/bsdapp/eal/rte_eal_version.map   |  7 +++
 lib/librte_eal/common/eal_common_pci.c  | 10 +-
 lib/librte_eal/common/include/rte_pci.h | 15 +++
 lib/librte_eal/linuxapp/eal/rte_eal_version.map |  7 +++
 4 files changed, 30 insertions(+), 9 deletions(-)

diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map 
b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
index aac6fd776..c819e3084 100644
--- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map
+++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
@@ -237,3 +237,10 @@ EXPERIMENTAL {
rte_service_unregister;
 
 } DPDK_17.08;
+
+DPDK_17.11 {
+   global:
+
+   rte_pci_match;
+
+} DPDK_17.08;
diff --git a/lib/librte_eal/common/eal_common_pci.c 
b/lib/librte_eal/common/eal_common_pci.c
index 52fd38cdd..3b7d0a0ee 100644
--- a/lib/librte_eal/common/eal_common_pci.c
+++ b/lib/librte_eal/common/eal_common_pci.c
@@ -150,16 +150,8 @@ pci_unmap_resource(void *requested_addr, size_t size)
 
 /*
  * Match the PCI Driver and Device using the ID Table
- *
- * @param pci_drv
- * PCI driver from which ID table would be extracted
- * @param pci_dev
- * PCI device to match against the driver
- * @return
- * 1 for successful match
- * 0 for unsuccessful match
  */
-static int
+int
 rte_pci_match(const struct rte_pci_driver *pci_drv,
  const struct rte_pci_device *pci_dev)
 {
diff --git a/lib/librte_eal/common/include/rte_pci.h 
b/lib/librte_eal/common/include/rte_pci.h
index 743392f91..47f0532e4 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -368,6 +368,21 @@ int rte_pci_scan(void);
 int
 rte_pci_probe(void);
 
+/*
+ * Match the PCI Driver and Device using the ID Table
+ *
+ * @param pci_drv
+ *  PCI driver from which ID table would be extracted
+ * @param pci_dev
+ *  PCI device to match against the driver
+ * @return
+ *  1 for successful match
+ *  0 for unsuccessful match
+ */
+int
+rte_pci_match(const struct rte_pci_driver *pci_drv,
+ const struct rte_pci_device *pci_dev);
+
 /**
  * Map the PCI device resources in user space virtual memory address
  *
diff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map 
b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
index 3a8f15406..a15b382ff 100644
--- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map
+++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
@@ -242,3 +242,10 @@ EXPERIMENTAL {
rte_service_unregister;
 
 } DPDK_17.08;
+
+DPDK_17.11 {
+   global:
+
+   rte_pci_match;
+
+} DPDK_17.08;
-- 
2.11.0



[dpdk-dev] [PATCH v6 03/12] eal/pci: get iommu class

2017-08-14 Thread Santosh Shukla
Introducing rte_pci_get_iommu_class API which helps to get iommu class
of PCI device on the bus and returns preferred iova mapping mode for
PCI bus.

Signed-off-by: Santosh Shukla 
Signed-off-by: Jerin Jacob 
Reviewed-by: Maxime Coquelin 
---
 lib/librte_eal/common/include/rte_bus.h | 10 ++
 lib/librte_eal/common/include/rte_pci.h | 11 +++
 2 files changed, 21 insertions(+)

diff --git a/lib/librte_eal/common/include/rte_bus.h 
b/lib/librte_eal/common/include/rte_bus.h
index c79368d3c..9e40687e5 100644
--- a/lib/librte_eal/common/include/rte_bus.h
+++ b/lib/librte_eal/common/include/rte_bus.h
@@ -55,6 +55,16 @@ extern "C" {
 /** Double linked list of buses */
 TAILQ_HEAD(rte_bus_list, rte_bus);
 
+
+/**
+ * IOVA mapping mode.
+ */
+enum rte_iova_mode {
+   RTE_IOVA_DC = 0,/* Don't care mode */
+   RTE_IOVA_PA = (1 << 0),
+   RTE_IOVA_VA = (1 << 1)
+};
+
 /**
  * Bus specific scan for devices attached on the bus.
  * For each bus object, the scan would be responsible for finding devices and
diff --git a/lib/librte_eal/common/include/rte_pci.h 
b/lib/librte_eal/common/include/rte_pci.h
index 47f0532e4..a67d77f22 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -383,6 +383,17 @@ int
 rte_pci_match(const struct rte_pci_driver *pci_drv,
  const struct rte_pci_device *pci_dev);
 
+
+/**
+ * Get iommu class of PCI devices on the bus.
+ * And return their preferred iova mapping mode.
+ *
+ * @return
+ *   - enum rte_iova_mode.
+ */
+enum rte_iova_mode
+rte_pci_get_iommu_class(void);
+
 /**
  * Map the PCI device resources in user space virtual memory address
  *
-- 
2.11.0



[dpdk-dev] [PATCH v6 05/12] linuxapp/eal_pci: get iommu class

2017-08-14 Thread Santosh Shukla
Get iommu class of PCI device on the bus and returns preferred iova
mapping mode for that bus.

Algorithm for iova scheme selection for PCI bus:
0. If no device bound then return with RTE_IOVA_DC mapping mode,
else goto 1).
1. Look for device attached to vfio kdrv and has .drv_flag set
to RTE_PCI_DRV_IOVA_AS_VA.
2. Look for any device attached to UIO class of driver.
3. Check for vfio-noiommu mode enabled.

If 2) & 3) is false and 1) is true then select
mapping scheme as RTE_IOVA_VA. Otherwise use default
mapping scheme (RTE_IOVA_PA).

Signed-off-by: Santosh Shukla 
Signed-off-by: Jerin Jacob 
Reviewed-by: Maxime Coquelin 
Acked-by: Hemant Agrawal 
---
 lib/librte_eal/linuxapp/eal/eal_pci.c   | 95 +
 lib/librte_eal/linuxapp/eal/eal_vfio.c  | 19 +
 lib/librte_eal/linuxapp/eal/eal_vfio.h  |  4 ++
 lib/librte_eal/linuxapp/eal/rte_eal_version.map |  1 +
 4 files changed, 119 insertions(+)

diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c 
b/lib/librte_eal/linuxapp/eal/eal_pci.c
index 8951ce742..9725fd493 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
@@ -45,6 +45,7 @@
 #include "eal_filesystem.h"
 #include "eal_private.h"
 #include "eal_pci_init.h"
+#include "eal_vfio.h"
 
 /**
  * @file
@@ -487,6 +488,100 @@ rte_pci_scan(void)
return -1;
 }
 
+/*
+ * Is pci device bound to any kdrv
+ */
+static inline int
+pci_device_is_bound(void)
+{
+   struct rte_pci_device *dev = NULL;
+   int ret = 0;
+
+   FOREACH_DEVICE_ON_PCIBUS(dev) {
+   if (dev->kdrv == RTE_KDRV_UNKNOWN ||
+   dev->kdrv == RTE_KDRV_NONE) {
+   continue;
+   } else {
+   ret = 1;
+   break;
+   }
+   }
+   return ret;
+}
+
+/*
+ * Any one of the device bound to uio
+ */
+static inline int
+pci_device_bound_uio(void)
+{
+   struct rte_pci_device *dev = NULL;
+
+   FOREACH_DEVICE_ON_PCIBUS(dev) {
+   if (dev->kdrv == RTE_KDRV_IGB_UIO ||
+  dev->kdrv == RTE_KDRV_UIO_GENERIC) {
+   return 1;
+   }
+   }
+   return 0;
+}
+
+/*
+ * Any one of the device has iova as va
+ */
+static inline int
+pci_device_has_iova_va(void)
+{
+   struct rte_pci_device *dev = NULL;
+   struct rte_pci_driver *drv = NULL;
+
+   FOREACH_DRIVER_ON_PCIBUS(drv) {
+   if (drv && drv->drv_flags & RTE_PCI_DRV_IOVA_AS_VA) {
+   FOREACH_DEVICE_ON_PCIBUS(dev) {
+   if (dev->kdrv == RTE_KDRV_VFIO &&
+   rte_pci_match(drv, dev))
+   return 1;
+   }
+   }
+   }
+   return 0;
+}
+
+/*
+ * Get iommu class of PCI devices on the bus.
+ */
+enum rte_iova_mode
+rte_pci_get_iommu_class(void)
+{
+   bool is_bound;
+   bool is_vfio_noiommu_enabled = true;
+   bool has_iova_va;
+   bool is_bound_uio;
+
+   is_bound = pci_device_is_bound();
+   if (!is_bound)
+   return RTE_IOVA_DC;
+
+   has_iova_va = pci_device_has_iova_va();
+   is_bound_uio = pci_device_bound_uio();
+#ifdef VFIO_PRESENT
+   is_vfio_noiommu_enabled = vfio_noiommu_is_enabled() == 1 ? 1 : 0;
+#endif
+
+   if (has_iova_va && !is_bound_uio && !is_vfio_noiommu_enabled)
+   return RTE_IOVA_VA;
+
+   if (has_iova_va) {
+   RTE_LOG(WARNING, EAL, "Some devices want iova as va but pa will 
be used because.. ");
+   if (is_vfio_noiommu_enabled)
+   RTE_LOG(WARNING, EAL, "vfio-noiommu mode configured\n");
+   if (is_bound_uio)
+   RTE_LOG(WARNING, EAL, "few device bound to UIO\n");
+   }
+
+   return RTE_IOVA_PA;
+}
+
 /* Read PCI config space. */
 int rte_pci_read_config(const struct rte_pci_device *device,
void *buf, size_t len, off_t offset)
diff --git a/lib/librte_eal/linuxapp/eal/eal_vfio.c 
b/lib/librte_eal/linuxapp/eal/eal_vfio.c
index 946df7e31..c8a97b7e7 100644
--- a/lib/librte_eal/linuxapp/eal/eal_vfio.c
+++ b/lib/librte_eal/linuxapp/eal/eal_vfio.c
@@ -816,4 +816,23 @@ vfio_noiommu_dma_map(int __rte_unused vfio_container_fd)
return 0;
 }
 
+int
+vfio_noiommu_is_enabled(void)
+{
+   int fd, ret, cnt __rte_unused;
+   char c;
+
+   ret = -1;
+   fd = open(VFIO_NOIOMMU_MODE, O_RDONLY);
+   if (fd < 0)
+   return -1;
+
+   cnt = read(fd, &c, 1);
+   if (c == 'Y')
+   ret = 1;
+
+   close(fd);
+   return ret;
+}
+
 #endif
diff --git a/lib/librte_eal/linuxapp/eal/eal_vfio.h 
b/lib/librte_eal/linuxapp/eal/eal_vfio.h
index 5ff63e5d7..26ea8e119 100644
--- a/lib/librte_eal/linuxapp/eal/eal_vfio.h
+++ b/lib/librte_eal/linuxapp/eal/eal_vfio.h
@@ -150,6 +150,8 @@ struct vfio_config {
 #define VFIO_NOIOMMU_GROUP_FMT "/dev/vfio

[dpdk-dev] [PATCH v6 04/12] bsdapp/eal_pci: get iommu class

2017-08-14 Thread Santosh Shukla
Bsdapp case returns default iova mode.

Signed-off-by: Santosh Shukla 
Signed-off-by: Jerin Jacob 
Reviewed-by: Maxime Coquelin 
---
 lib/librte_eal/bsdapp/eal/eal_pci.c   | 10 ++
 lib/librte_eal/bsdapp/eal/rte_eal_version.map |  1 +
 2 files changed, 11 insertions(+)

diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c 
b/lib/librte_eal/bsdapp/eal/eal_pci.c
index 04eacdcc7..e2c252320 100644
--- a/lib/librte_eal/bsdapp/eal/eal_pci.c
+++ b/lib/librte_eal/bsdapp/eal/eal_pci.c
@@ -403,6 +403,16 @@ rte_pci_scan(void)
return -1;
 }
 
+/*
+ * Get iommu class of pci devices on the bus.
+ */
+enum rte_iova_mode
+rte_pci_get_iommu_class(void)
+{
+   /* Supports only RTE_KDRV_NIC_UIO */
+   return RTE_IOVA_PA;
+}
+
 int
 pci_update_device(const struct rte_pci_addr *addr)
 {
diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map 
b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
index c819e3084..1fdcfb460 100644
--- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map
+++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
@@ -242,5 +242,6 @@ DPDK_17.11 {
global:
 
rte_pci_match;
+   rte_pci_get_iommu_class;
 
 } DPDK_17.08;
-- 
2.11.0



[dpdk-dev] [PATCH v6 06/12] bus: get iommu class

2017-08-14 Thread Santosh Shukla
API(rte_bus_get_iommu_class) helps to automatically detect and select
appropriate iova mapping scheme for iommu capable device on that bus.

Algorithm for iova scheme selection for bus:
0. Iterate through bus_list.
1. Collect each bus iova mode value and update into 'mode' var.
2. Mode selection scheme is:
if mode == 0 then iova mode is _pa,
if mode == 1 then iova mode is _pa,
if mode == 2 then iova mode is _va,
if mode == 3 then iova mode ia _pa.

So mode !=2  will be default iova mode (_pa).

Signed-off-by: Santosh Shukla 
Signed-off-by: Jerin Jacob 
Reviewed-by: Maxime Coquelin 
Acked-by: Hemant Agrawal 
---
 lib/librte_eal/bsdapp/eal/rte_eal_version.map   |  1 +
 lib/librte_eal/common/eal_common_bus.c  | 23 +++
 lib/librte_eal/common/eal_common_pci.c  |  1 +
 lib/librte_eal/common/include/rte_bus.h | 25 +
 lib/librte_eal/linuxapp/eal/rte_eal_version.map |  1 +
 5 files changed, 51 insertions(+)

diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map 
b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
index 1fdcfb460..9942f47aa 100644
--- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map
+++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
@@ -243,5 +243,6 @@ DPDK_17.11 {
 
rte_pci_match;
rte_pci_get_iommu_class;
+   rte_bus_get_iommu_class;
 
 } DPDK_17.08;
diff --git a/lib/librte_eal/common/eal_common_bus.c 
b/lib/librte_eal/common/eal_common_bus.c
index 08bec2d93..a30a8982e 100644
--- a/lib/librte_eal/common/eal_common_bus.c
+++ b/lib/librte_eal/common/eal_common_bus.c
@@ -222,3 +222,26 @@ rte_bus_find_by_device_name(const char *str)
c[0] = '\0';
return rte_bus_find(NULL, bus_can_parse, name);
 }
+
+
+/*
+ * Get iommu class of devices on the bus.
+ */
+enum rte_iova_mode
+rte_bus_get_iommu_class(void)
+{
+   int mode = RTE_IOVA_DC;
+   struct rte_bus *bus;
+
+   TAILQ_FOREACH(bus, &rte_bus_list, next) {
+
+   if (bus->get_iommu_class)
+   mode |= bus->get_iommu_class();
+   }
+
+   if (mode != RTE_IOVA_VA) {
+   /* Use default IOVA mode */
+   mode = RTE_IOVA_PA;
+   }
+   return mode;
+}
diff --git a/lib/librte_eal/common/eal_common_pci.c 
b/lib/librte_eal/common/eal_common_pci.c
index 3b7d0a0ee..0f0e4b93b 100644
--- a/lib/librte_eal/common/eal_common_pci.c
+++ b/lib/librte_eal/common/eal_common_pci.c
@@ -564,6 +564,7 @@ struct rte_pci_bus rte_pci_bus = {
.plug = pci_plug,
.unplug = pci_unplug,
.parse = pci_parse,
+   .get_iommu_class = rte_pci_get_iommu_class,
},
.device_list = TAILQ_HEAD_INITIALIZER(rte_pci_bus.device_list),
.driver_list = TAILQ_HEAD_INITIALIZER(rte_pci_bus.driver_list),
diff --git a/lib/librte_eal/common/include/rte_bus.h 
b/lib/librte_eal/common/include/rte_bus.h
index 9e40687e5..70a291a4d 100644
--- a/lib/librte_eal/common/include/rte_bus.h
+++ b/lib/librte_eal/common/include/rte_bus.h
@@ -178,6 +178,20 @@ struct rte_bus_conf {
enum rte_bus_scan_mode scan_mode; /**< Scan policy. */
 };
 
+
+/**
+ * Get common iommu class of the all the devices on the bus. The bus may
+ * check that those devices are attached to iommu driver.
+ * If no devices are attached to the bus. The bus may return with don't care
+ * (_DC) value.
+ * Otherwise, The bus will return appropriate _pa or _va iova mode.
+ *
+ * @return
+ *  enum rte_iova_mode value.
+ */
+typedef enum rte_iova_mode (*rte_bus_get_iommu_class_t)(void);
+
+
 /**
  * A structure describing a generic bus.
  */
@@ -191,6 +205,7 @@ struct rte_bus {
rte_bus_unplug_t unplug; /**< Remove single device from driver */
rte_bus_parse_t parse;   /**< Parse a device name */
struct rte_bus_conf conf;/**< Bus configuration */
+   rte_bus_get_iommu_class_t get_iommu_class; /**< Get iommu class */
 };
 
 /**
@@ -290,6 +305,16 @@ struct rte_bus *rte_bus_find_by_device(const struct 
rte_device *dev);
  */
 struct rte_bus *rte_bus_find_by_name(const char *busname);
 
+
+/**
+ * Get the common iommu class of devices bound on to buses available in the
+ * system. The default mode is PA.
+ *
+ * @return
+ * enum rte_iova_mode value.
+ */
+enum rte_iova_mode rte_bus_get_iommu_class(void);
+
 /**
  * Helper for Bus registration.
  * The constructor has higher priority than PMD constructors.
diff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map 
b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
index 40420ded3..f35031746 100644
--- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map
+++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
@@ -248,5 +248,6 @@ DPDK_17.11 {
 
rte_pci_match;
rte_pci_get_iommu_class;
+   rte_bus_get_iommu_class;
 
 } DPDK_17.08;
-- 
2.11.0



[dpdk-dev] [PATCH v6 07/12] eal: introduce iova mode helper api

2017-08-14 Thread Santosh Shukla
Introducing rte_eal_iova_mode() helper API. This API
used by non-eal library for detecting iova mode.

Signed-off-by: Santosh Shukla 
Signed-off-by: Jerin Jacob 
Reviewed-by: Maxime Coquelin 
---
 lib/librte_eal/bsdapp/eal/eal.c |  6 ++
 lib/librte_eal/bsdapp/eal/rte_eal_version.map   |  1 +
 lib/librte_eal/common/include/rte_eal.h | 12 
 lib/librte_eal/linuxapp/eal/eal.c   |  6 ++
 lib/librte_eal/linuxapp/eal/rte_eal_version.map |  1 +
 5 files changed, 26 insertions(+)

diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c
index 5fa598842..07e72203f 100644
--- a/lib/librte_eal/bsdapp/eal/eal.c
+++ b/lib/librte_eal/bsdapp/eal/eal.c
@@ -119,6 +119,12 @@ rte_eal_get_configuration(void)
return &rte_config;
 }
 
+enum rte_iova_mode
+rte_eal_iova_mode(void)
+{
+   return rte_eal_get_configuration()->iova_mode;
+}
+
 /* parse a sysfs (or other) file containing one integer value */
 int
 eal_parse_sysfs_value(const char *filename, unsigned long *val)
diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map 
b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
index 9942f47aa..1a63f3f05 100644
--- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map
+++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
@@ -244,5 +244,6 @@ DPDK_17.11 {
rte_pci_match;
rte_pci_get_iommu_class;
rte_bus_get_iommu_class;
+   rte_eal_iova_mode;
 
 } DPDK_17.08;
diff --git a/lib/librte_eal/common/include/rte_eal.h 
b/lib/librte_eal/common/include/rte_eal.h
index 0e7363d77..932dc1a96 100644
--- a/lib/librte_eal/common/include/rte_eal.h
+++ b/lib/librte_eal/common/include/rte_eal.h
@@ -45,6 +45,7 @@
 
 #include 
 #include 
+#include 
 
 #ifdef __cplusplus
 extern "C" {
@@ -87,6 +88,9 @@ struct rte_config {
/** Primary or secondary configuration */
enum rte_proc_type_t process_type;
 
+   /** PA or VA mapping mode */
+   enum rte_iova_mode iova_mode;
+
/**
 * Pointer to memory configuration, which may be shared across multiple
 * DPDK instances
@@ -287,6 +291,14 @@ static inline int rte_gettid(void)
return RTE_PER_LCORE(_thread_id);
 }
 
+/**
+ * Get the iova mode
+ *
+ * @return
+ *   enum rte_iova_mode value.
+ */
+enum rte_iova_mode rte_eal_iova_mode(void);
+
 #define RTE_INIT(func) \
 static void __attribute__((constructor, used)) func(void)
 
diff --git a/lib/librte_eal/linuxapp/eal/eal.c 
b/lib/librte_eal/linuxapp/eal/eal.c
index 48f12f44c..febbafdb3 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -128,6 +128,12 @@ rte_eal_get_configuration(void)
return &rte_config;
 }
 
+enum rte_iova_mode
+rte_eal_iova_mode(void)
+{
+   return rte_eal_get_configuration()->iova_mode;
+}
+
 /* parse a sysfs (or other) file containing one integer value */
 int
 eal_parse_sysfs_value(const char *filename, unsigned long *val)
diff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map 
b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
index f35031746..c99f1ed44 100644
--- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map
+++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
@@ -249,5 +249,6 @@ DPDK_17.11 {
rte_pci_match;
rte_pci_get_iommu_class;
rte_bus_get_iommu_class;
+   rte_eal_iova_mode;
 
 } DPDK_17.08;
-- 
2.11.0



[dpdk-dev] [PATCH v6 08/12] linuxapp/eal: auto detect iova mode

2017-08-14 Thread Santosh Shukla
- Moving late bus scanning to up..just after eal_parsing.
- Auto detect iova mapping mode, based on the result of
  rte_bus_scan_iommu_class.

Signed-off-by: Santosh Shukla 
Signed-off-by: Jerin Jacob 
Reviewed-by: Maxime Coquelin 
---
 lib/librte_eal/linuxapp/eal/eal.c | 15 +--
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/lib/librte_eal/linuxapp/eal/eal.c 
b/lib/librte_eal/linuxapp/eal/eal.c
index febbafdb3..5382f6c00 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -798,6 +798,15 @@ rte_eal_init(int argc, char **argv)
return -1;
}
 
+   if (rte_bus_scan()) {
+   rte_eal_init_alert("Cannot scan the buses for devices\n");
+   rte_errno = ENODEV;
+   return -1;
+   }
+
+   /* autodetect the iova mapping mode (default is iova_pa) */
+   rte_eal_get_configuration()->iova_mode = rte_bus_get_iommu_class();
+
if (internal_config.no_hugetlbfs == 0 &&
internal_config.process_type != RTE_PROC_SECONDARY &&
internal_config.xen_dom0_support == 0 &&
@@ -900,12 +909,6 @@ rte_eal_init(int argc, char **argv)
return -1;
}
 
-   if (rte_bus_scan()) {
-   rte_eal_init_alert("Cannot scan the buses for devices\n");
-   rte_errno = ENODEV;
-   return -1;
-   }
-
RTE_LCORE_FOREACH_SLAVE(i) {
 
/*
-- 
2.11.0



[dpdk-dev] [PATCH v6 09/12] bsdapp/eal: auto detect iova mapping mode

2017-08-14 Thread Santosh Shukla
- Moving late bus scanning to up..just after eal_parsing.
- Mapping mode would be default for bsdapp. It supports
  only one pass through mode (RTE_KDRV_NIC_UIO)

Signed-off-by: Santosh Shukla 
Signed-off-by: Jerin Jacob 
Reviewed-by: Maxime Coquelin 
---
 lib/librte_eal/bsdapp/eal/eal.c | 14 --
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c
index 07e72203f..53ad87b95 100644
--- a/lib/librte_eal/bsdapp/eal/eal.c
+++ b/lib/librte_eal/bsdapp/eal/eal.c
@@ -540,6 +540,14 @@ rte_eal_init(int argc, char **argv)
rte_atomic32_clear(&run_once);
return -1;
}
+   if (rte_bus_scan()) {
+   rte_eal_init_alert("Cannot scan the buses for devices\n");
+   rte_errno = ENODEV;
+   return -1;
+   }
+
+   /* autodetect the iova mapping mode (default is iova_pa) */
+   rte_eal_get_configuration()->iova_mode = rte_bus_get_iommu_class();
 
if (internal_config.no_hugetlbfs == 0 &&
internal_config.process_type != RTE_PROC_SECONDARY &&
@@ -625,12 +633,6 @@ rte_eal_init(int argc, char **argv)
return -1;
}
 
-   if (rte_bus_scan()) {
-   rte_eal_init_alert("Cannot scan the buses for devices\n");
-   rte_errno = ENODEV;
-   return -1;
-   }
-
RTE_LCORE_FOREACH_SLAVE(i) {
 
/*
-- 
2.11.0



[dpdk-dev] [PATCH v6 10/12] linuxapp/eal_vfio: honor iova mode before mapping

2017-08-14 Thread Santosh Shukla
Check iova mode and accordingly map iova to pa or va.

Signed-off-by: Santosh Shukla 
Signed-off-by: Jerin Jacob 
Reviewed-by: Maxime Coquelin 
---
 lib/librte_eal/linuxapp/eal/eal_vfio.c | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/lib/librte_eal/linuxapp/eal/eal_vfio.c 
b/lib/librte_eal/linuxapp/eal/eal_vfio.c
index c8a97b7e7..b32cd09a2 100644
--- a/lib/librte_eal/linuxapp/eal/eal_vfio.c
+++ b/lib/librte_eal/linuxapp/eal/eal_vfio.c
@@ -706,7 +706,10 @@ vfio_type1_dma_map(int vfio_container_fd)
dma_map.argsz = sizeof(struct vfio_iommu_type1_dma_map);
dma_map.vaddr = ms[i].addr_64;
dma_map.size = ms[i].len;
-   dma_map.iova = ms[i].phys_addr;
+   if (rte_eal_iova_mode() == RTE_IOVA_VA)
+   dma_map.iova = dma_map.vaddr;
+   else
+   dma_map.iova = ms[i].phys_addr;
dma_map.flags = VFIO_DMA_MAP_FLAG_READ | 
VFIO_DMA_MAP_FLAG_WRITE;
 
ret = ioctl(vfio_container_fd, VFIO_IOMMU_MAP_DMA, &dma_map);
@@ -792,7 +795,10 @@ vfio_spapr_dma_map(int vfio_container_fd)
dma_map.argsz = sizeof(struct vfio_iommu_type1_dma_map);
dma_map.vaddr = ms[i].addr_64;
dma_map.size = ms[i].len;
-   dma_map.iova = ms[i].phys_addr;
+   if (rte_eal_iova_mode() == RTE_IOVA_VA)
+   dma_map.iova = dma_map.vaddr;
+   else
+   dma_map.iova = ms[i].phys_addr;
dma_map.flags = VFIO_DMA_MAP_FLAG_READ |
 VFIO_DMA_MAP_FLAG_WRITE;
 
-- 
2.11.0



[dpdk-dev] [PATCH v6 11/12] linuxapp/eal_memory: honor iova mode in virt2phy

2017-08-14 Thread Santosh Shukla
Check iova mode and accordingly return phy addr.

Signed-off-by: Santosh Shukla 
Signed-off-by: Jerin Jacob 
Reviewed-by: Maxime Coquelin 
---
 lib/librte_eal/linuxapp/eal/eal_memory.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c 
b/lib/librte_eal/linuxapp/eal/eal_memory.c
index 52791282f..2d9d7c2dc 100644
--- a/lib/librte_eal/linuxapp/eal/eal_memory.c
+++ b/lib/librte_eal/linuxapp/eal/eal_memory.c
@@ -139,6 +139,9 @@ rte_mem_virt2phy(const void *virtaddr)
int page_size;
off_t offset;
 
+   if (rte_eal_iova_mode() == RTE_IOVA_VA)
+   return (uintptr_t)virtaddr;
+
/* when using dom0, /proc/self/pagemap always returns 0, check in
 * dpdk memory by browsing the memsegs */
if (rte_xen_dom0_supported()) {
-- 
2.11.0



[dpdk-dev] [PATCH v6 12/12] eal/rte_malloc: honor iova mode in virt2phy

2017-08-14 Thread Santosh Shukla
Check iova mode and accordingly return phy addr.

Signed-off-by: Santosh Shukla 
Signed-off-by: Jerin Jacob 
Reviewed-by: Maxime Coquelin 
---
 lib/librte_eal/common/rte_malloc.c | 9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/lib/librte_eal/common/rte_malloc.c 
b/lib/librte_eal/common/rte_malloc.c
index 5c0627bf4..d65c05a4d 100644
--- a/lib/librte_eal/common/rte_malloc.c
+++ b/lib/librte_eal/common/rte_malloc.c
@@ -251,10 +251,17 @@ rte_malloc_set_limit(__rte_unused const char *type,
 phys_addr_t
 rte_malloc_virt2phy(const void *addr)
 {
+   phys_addr_t paddr;
const struct malloc_elem *elem = malloc_elem_from_data(addr);
if (elem == NULL)
return RTE_BAD_PHYS_ADDR;
if (elem->ms->phys_addr == RTE_BAD_PHYS_ADDR)
return RTE_BAD_PHYS_ADDR;
-   return elem->ms->phys_addr + ((uintptr_t)addr - 
(uintptr_t)elem->ms->addr);
+
+   if (rte_eal_iova_mode() == RTE_IOVA_VA)
+   paddr = (uintptr_t)addr;
+   else
+   paddr = elem->ms->phys_addr +
+   ((uintptr_t)addr - (uintptr_t)elem->ms->addr);
+   return paddr;
 }
-- 
2.11.0



[dpdk-dev] Regarding changing RTE_RING_SZ_MASK to 0x7FFFFFFF

2017-08-14 Thread Venkatesh Nuthula
Hi all,

  I am a newbie to DPDK and in one of the applications I am building , I am
trying to capture more than 150M packets and save them to file. I noticed
that with packet count > 134M, the check 'count > RTE_RING_SZ_MASK' fails
as RTE_RING_SZ_MASK is set to 0x0FFF. So I tried changing
RTE_RING_SZ_MASK to 0x7FFF and it took me past the check
'count > RTE_RING_SZ_MASK' and the DPDK booted successfully. No error
messages. But when I try to save the packets captured in memory pool into
the file, I notice that it fails(my application exits without any error
message) to write beyond a number of packets.

I noticed that this failure to write packets happens only when I change the
RTE_RING_SZ_MASK to 0x7FFF from original value 0x0FFF. I have below
questions to understand this further.



*1) Why is RTE_RING_SZ_MASK set to 0x0FFF. Why are the 4 bits left
unused? Is it because ring size shouldn't exceed 2 power 32?2) If yes to
above question, can anybody please explain why ring size can't exceed 2
power 32 as ssize_t can hold more than 2 power 32?  *

*3) What should be the approach if we want to capture more than
200M(200,000,000) packets? *

Thanks in Advance
venky


Re: [dpdk-dev] [PATCH v2] eal: add counter size for efd clean

2017-08-14 Thread Tan, Jianfeng



On 8/13/2017 8:03 AM, Jingjing Wu wrote:

For virtual device, the rte_intr_handle struct is
initialized by the virtual device driver, including
the event fd assignment. If the event fd need to be
read for clean, an argument is required for the proper
event fd read.

This patch adds efd_counter_size in rte_intr_handle
struct to tell the rx interrupt process know the read
size.


remove "know".



Signed-off-by: Jingjing Wu 


Besides, looks good to me.

Reviewed-by: Jianfeng Tan 

Thanks,
Jianfeng


---

v2 change:
  - fix typo and reword commit log

  drivers/net/virtio/virtio_user/virtio_user_dev.c  |  2 ++
  lib/librte_eal/linuxapp/eal/eal_interrupts.c  | 19 ---
  .../linuxapp/eal/include/exec-env/rte_interrupts.h|  1 +
  3 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c 
b/drivers/net/virtio/virtio_user/virtio_user_dev.c
index 7941271..906d7a2 100644
--- a/drivers/net/virtio/virtio_user/virtio_user_dev.c
+++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c
@@ -270,6 +270,8 @@ virtio_user_fill_intr_handle(struct virtio_user_dev *dev)
eth_dev->intr_handle->nb_efd = dev->max_queue_pairs;
eth_dev->intr_handle->max_intr = dev->max_queue_pairs + 1;
eth_dev->intr_handle->type = RTE_INTR_HANDLE_VDEV;
+   /* For virtio vdev, no need to read counter for clean */
+   eth_dev->intr_handle->efd_counter_size = 0;
if (dev->vhostfd >= 0)
eth_dev->intr_handle->fd = dev->vhostfd;
  
diff --git a/lib/librte_eal/linuxapp/eal/eal_interrupts.c b/lib/librte_eal/linuxapp/eal/eal_interrupts.c

index 3e9ac41..7de39c3 100644
--- a/lib/librte_eal/linuxapp/eal/eal_interrupts.c
+++ b/lib/librte_eal/linuxapp/eal/eal_interrupts.c
@@ -914,7 +914,7 @@ static void
  eal_intr_proc_rxtx_intr(int fd, const struct rte_intr_handle *intr_handle)
  {
union rte_intr_read_buffer buf;
-   int bytes_read = 1;
+   int bytes_read = 0;
int nbytes;
  
  	switch (intr_handle->type) {

@@ -930,11 +930,9 @@ eal_intr_proc_rxtx_intr(int fd, const struct 
rte_intr_handle *intr_handle)
break;
  #endif
case RTE_INTR_HANDLE_VDEV:
-   /* for vdev, fd points to:
-* a. eventfd which does not need to read out;
-* b. datapath fd which needs PMD to read out.
-*/
-   return;
+   bytes_read = intr_handle->efd_counter_size;
+   /* For vdev, number of bytes to read is set by driver */
+   break;
case RTE_INTR_HANDLE_EXT:
return;
default:
@@ -947,6 +945,8 @@ eal_intr_proc_rxtx_intr(int fd, const struct 
rte_intr_handle *intr_handle)
 * read out to clear the ready-to-be-read flag
 * for epoll_wait.
 */
+   if (bytes_read == 0)
+   return;
do {
nbytes = read(fd, &buf, bytes_read);
if (nbytes < 0) {
@@ -1206,7 +1206,12 @@ rte_intr_efd_enable(struct rte_intr_handle *intr_handle, 
uint32_t nb_efd)
intr_handle->nb_efd   = n;
intr_handle->max_intr = NB_OTHER_INTR + n;
} else if (intr_handle->type == RTE_INTR_HANDLE_VDEV) {
-   /* do nothing, and let vdev driver to initialize this struct */
+   /* only check, initialization would be done in vdev driver.*/
+   if (intr_handle->efd_counter_size >
+   sizeof(union rte_intr_read_buffer)) {
+   RTE_LOG(ERR, EAL, "the efd_counter_size is oversized");
+   return -EINVAL;
+   }
} else {
intr_handle->efds[0]  = intr_handle->fd;
intr_handle->nb_efd   = RTE_MIN(nb_efd, 1U);
diff --git a/lib/librte_eal/linuxapp/eal/include/exec-env/rte_interrupts.h 
b/lib/librte_eal/linuxapp/eal/include/exec-env/rte_interrupts.h
index 6daffeb..fd4ea6c 100644
--- a/lib/librte_eal/linuxapp/eal/include/exec-env/rte_interrupts.h
+++ b/lib/librte_eal/linuxapp/eal/include/exec-env/rte_interrupts.h
@@ -93,6 +93,7 @@ struct rte_intr_handle {
enum rte_intr_handle_type type;  /**< handle type */
uint32_t max_intr; /**< max interrupt requested */
uint32_t nb_efd;   /**< number of available efd(event fd) */
+   uint8_t efd_counter_size;  /**< size of efd counter, used for vdev 
*/
int efds[RTE_MAX_RXTX_INTR_VEC_ID];  /**< intr vectors/efds mapping */
struct rte_epoll_event elist[RTE_MAX_RXTX_INTR_VEC_ID];
   /**< intr vector epoll event */




Re: [dpdk-dev] [RFC] Add RIB library

2017-08-14 Thread Vladimir Medvedkin
2017-08-14 13:51 GMT+03:00 Bruce Richardson :

> On Tue, Jul 11, 2017 at 07:33:04PM +, Medvedkin Vladimir wrote:
> > Hi,
> >
> > I want to introduce new library for ip routing lookup that have some
> advantages
> > over current LPM library. In short:
> >  - Increases the speed of control plane operations against lpm such
> as
> >adding/deleting routes
> >  - Adds abstraction from dataplane algorythms, so it is possible to
> add
> >different ip route lookup algorythms such as
> DXR/poptrie/lpc-trie/etc
> >in addition to current dir24_8
> >  - It is possible to keep user defined application specific
> additional
> >information in struct rte_rib_v4_node which represents route
> entry.
> >It can be next hop/set of next hops (i.e. active and feasible),
> >pointers to link rte_rib_v4_node based on some criteria (i.e.
> next_hop),
> >plenty of additional control plane information.
> >  - For dir24_8 implementation it is possible to remove
> rte_lpm_tbl_entry.depth
> >field that helps to save 6 bits.
> >  - Also new dir24_8 implementation supports different next_hop sizes
> >(1/2/4/8 bytes per next hop)
> >
> > It would be nice to hear your opinion. The draft is below.
> >
> > Medvedkin Vladimir (1):
> >   lib/rib: Add Routing Information Base library
> >
>
> On reading this patch and then having discussion with you offline, it
> appears there are two major new elements in this patchset:
>
> 1. a re-implementation of LPM, with the major advantage of having a
> flexible data-size
> 2. a separate control plane structure that is designed to fit on top off
> possibly multiple lookup structures for the data plane
>
> Is this correct?
>
Correct

>
> For the first part, I don't think we should carry about two separate LPM
> implementations, but rather look to take the improvements in your
> version back into the existing lib. [Or else replace the existing one,
> but I prefer pulling the new stuff into it, so as to keep backward
> compatibility]
>

> For the second part, perhaps you could expand a bit more on the thought
> here, and explain what all different data plane implementations would
> fit under it. Would, for instance a hash-lookup work? In that case, what
> would the data plane APIs be, and the control plane ones.
>

 I'm not sure for _all_ data plane implementations, but from my point of
view compressed prefix trie (rte_rib structure) could be useful at least
for dir24_8, dxr, bitmap handling. Concerning to hash lookup, it depends on
algorithm (array of hash tables indexed by mask length, unrolling prefix to
number of /32).
Perhaps it is better to waive the abstraction and make LPM as primary
struct that keeps rte_rib inside (instead of rules_tbl[ ]).
In that case rte_rib becomes side structure and it's API only for working
with a trie. LPM's API remains the same (except next_hop size and LPM
creation).


> Thanks,
> /Bruce
>



-- 
Regards,
Vladimir


[dpdk-dev] [PATCH] net/i40e: fix PF notify issue when VF is not up

2017-08-14 Thread Xiaoyun Li
This patch stops PF from sending message to VF when VF's ARQ and ATQ
isn't enabled, namely VF isn't up and modifies VF state to active when
VF reset is completed.

Fixes: 4861cde46116 ("i40e: new poll mode driver")
Cc: sta...@dpdk.org

Signed-off-by: Xiaoyun Li 
---
 drivers/net/i40e/i40e_pf.c | 21 +++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/drivers/net/i40e/i40e_pf.c b/drivers/net/i40e/i40e_pf.c
index 100f8dc..c40f40a 100644
--- a/drivers/net/i40e/i40e_pf.c
+++ b/drivers/net/i40e/i40e_pf.c
@@ -167,6 +167,9 @@ i40e_pf_host_vf_reset(struct i40e_pf_vf *vf, bool 
do_hw_reset)
PMD_DRV_LOG(ERR, "VF reset timeout");
return -ETIMEDOUT;
}
+
+   vf->state = I40E_VF_ACTIVE;
+
/* This is not first time to do reset, do cleanup job first */
if (vf->vsi) {
/* Disable queues */
@@ -1224,8 +1227,22 @@ i40e_notify_vf_link_status(struct rte_eth_dev *dev, 
struct i40e_pf_vf *vf)
break;
}
 
-   i40e_pf_host_send_msg_to_vf(vf, VIRTCHNL_OP_EVENT,
-   I40E_SUCCESS, (uint8_t *)&event, sizeof(event));
+   uint32_t tval, rval;
+   uint16_t vf_id;
+   struct i40e_hw *hw;
+
+   hw = I40E_PF_TO_HW(vf->pf);
+   vf_id = vf->vf_idx;
+
+   tval = I40E_READ_REG(hw, I40E_VF_ATQLEN(vf_id));
+   rval = I40E_READ_REG(hw, I40E_VF_ARQLEN(vf_id));
+
+   if (tval & I40E_VF_ATQLEN_ATQLEN_MASK ||
+   tval & I40E_VF_ATQLEN_ATQENABLE_MASK ||
+   rval & I40E_VF_ARQLEN_ARQLEN_MASK ||
+   rval & I40E_VF_ARQLEN_ARQENABLE_MASK)
+   i40e_pf_host_send_msg_to_vf(vf, VIRTCHNL_OP_EVENT,
+   I40E_SUCCESS, (uint8_t *)&event, sizeof(event));
 }
 
 void
-- 
2.7.4



Re: [dpdk-dev] [PATCH 4/5] eal/armv8: define architecture specific rdtsc hz

2017-08-14 Thread Jianbo Liu
On 13 August 2017 at 15:03, Jerin Jacob  wrote:
> Use cntvct_el0 system register to get the system counter frequency.
>
> If the system is configured with RTE_ARM_EAL_RDTSC_USE_PMU then
> return 0(let the common code calibrate the tsc frequency).
>
> CC: Jianbo Liu 
> Signed-off-by: Jerin Jacob 
> ---
>  .../common/include/arch/arm/rte_cycles_64.h| 30 
> ++
>  1 file changed, 30 insertions(+)
>
> diff --git a/lib/librte_eal/common/include/arch/arm/rte_cycles_64.h 
> b/lib/librte_eal/common/include/arch/arm/rte_cycles_64.h
> index 154576910..5b95cb67d 100644
> --- a/lib/librte_eal/common/include/arch/arm/rte_cycles_64.h
> +++ b/lib/librte_eal/common/include/arch/arm/rte_cycles_64.h
> @@ -58,6 +58,23 @@ rte_rdtsc(void)
> asm volatile("mrs %0, cntvct_el0" : "=r" (tsc));
> return tsc;
>  }
> +
> +/**
> + * Get the number of rdtsc cycles in one second if the architecture supports.
> + *
> + * @return
> + *   The number of rdtsc cycles in one second. Return zero if the 
> architecture
> + *   support is not available.
> + */
> +static inline uint64_t
> +rte_rdtsc_arch_hz(void)
> +{
> +   uint64_t freq;
> +
> +   asm volatile("mrs %0, cntfrq_el0" : "=r" (freq));
> +   return freq;
> +}
> +
>  #else
>  /**
>   * This is an alternative method to enable rte_rdtsc() with high resolution
> @@ -85,6 +102,19 @@ rte_rdtsc(void)
> asm volatile("mrs %0, pmccntr_el0" : "=r"(tsc));
> return tsc;
>  }
> +
> +/**
> + * Get the number of rdtsc cycles in one second if the architecture supports.
> + *
> + * @return
> + *   The number of rdtsc cycles in one second. Return zero if the 
> architecture
> + *   support is not available.
> + */
> +static inline uint64_t
> +rte_rdtsc_arch_hz(void)
> +{
> +   return 0;
> +}
>  #endif
>
>  static inline uint64_t
> --
> 2.14.0
>

Acked-by: Jianbo Liu 


[dpdk-dev] [PATCH] doc: add i40e firmware upgrade guide

2017-08-14 Thread Qiming Yang
This patch adds one link to DPDK i40e doc, which is for
users on how to upgrade firmware.

Signed-off-by: Qiming Yang 
---
 doc/guides/nics/i40e.rst | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/doc/guides/nics/i40e.rst b/doc/guides/nics/i40e.rst
index bc200d3..606375d 100644
--- a/doc/guides/nics/i40e.rst
+++ b/doc/guides/nics/i40e.rst
@@ -78,6 +78,8 @@ Prerequisites
 - To get better performance on Intel platforms, please follow the "How to get 
best performance with NICs on Intel platforms"
   section of the :ref:`Getting Started Guide for Linux `.
 
+- Upgrade the NVM/FW version follow the `Intel® Ethernet NVM Update Tool Quick 
Usage Guide for Linux
+  
`_
 if need.
 
 Pre-Installation Configuration
 --
-- 
2.7.4



Re: [dpdk-dev] [PATCH] net/i40e: fix PF notify issue when VF is not up

2017-08-14 Thread Xing, Beilei

> -Original Message-
> From: Li, Xiaoyun
> Sent: Tuesday, August 15, 2017 11:34 AM
> To: Xing, Beilei 
> Cc: Wu, Jingjing ; dev@dpdk.org; Li, Xiaoyun
> ; sta...@dpdk.org
> Subject: [PATCH] net/i40e: fix PF notify issue when VF is not up
> 
> This patch stops PF from sending message to VF when VF's ARQ and ATQ isn't

Abbreviation is not easy to understand, how about changing ARQ and ATQ with 
admin queue?

> enabled, namely VF isn't up and modifies VF state to active when VF reset is
> completed.
> 
> Fixes: 4861cde46116 ("i40e: new poll mode driver")
> Cc: sta...@dpdk.org
> 
> Signed-off-by: Xiaoyun Li 
> ---
>  drivers/net/i40e/i40e_pf.c | 21 +++--
>  1 file changed, 19 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/i40e/i40e_pf.c b/drivers/net/i40e/i40e_pf.c index
> 100f8dc..c40f40a 100644
> --- a/drivers/net/i40e/i40e_pf.c
> +++ b/drivers/net/i40e/i40e_pf.c
> @@ -167,6 +167,9 @@ i40e_pf_host_vf_reset(struct i40e_pf_vf *vf, bool
> do_hw_reset)
>   PMD_DRV_LOG(ERR, "VF reset timeout");
>   return -ETIMEDOUT;
>   }
> +
> + vf->state = I40E_VF_ACTIVE;
> +
>   /* This is not first time to do reset, do cleanup job first */
>   if (vf->vsi) {
>   /* Disable queues */
> @@ -1224,8 +1227,22 @@ i40e_notify_vf_link_status(struct rte_eth_dev
> *dev, struct i40e_pf_vf *vf)
>   break;
>   }
> 
> - i40e_pf_host_send_msg_to_vf(vf, VIRTCHNL_OP_EVENT,
> - I40E_SUCCESS, (uint8_t *)&event, sizeof(event));
> + uint32_t tval, rval;
> + uint16_t vf_id;
> + struct i40e_hw *hw;

Move the above variable up to the begin of the function.

> +
> + hw = I40E_PF_TO_HW(vf->pf);
> + vf_id = vf->vf_idx;
> +
> + tval = I40E_READ_REG(hw, I40E_VF_ATQLEN(vf_id));
> + rval = I40E_READ_REG(hw, I40E_VF_ARQLEN(vf_id));
> +
> + if (tval & I40E_VF_ATQLEN_ATQLEN_MASK ||
> + tval & I40E_VF_ATQLEN_ATQENABLE_MASK ||
> + rval & I40E_VF_ARQLEN_ARQLEN_MASK ||
> + rval & I40E_VF_ARQLEN_ARQENABLE_MASK)
> + i40e_pf_host_send_msg_to_vf(vf, VIRTCHNL_OP_EVENT,
> + I40E_SUCCESS, (uint8_t *)&event, sizeof(event));
>  }
> 
>  void
> --
> 2.7.4



Re: [dpdk-dev] [PATCH 1/2] app/testpmd: support the heavywight mode GRO

2017-08-14 Thread Jiayu Hu
Hi Ferruh,

On Thu, Aug 10, 2017 at 10:50:02AM +0100, Ferruh Yigit wrote:
> On 8/10/2017 3:50 AM, Jiayu Hu wrote:
> > The GRO library provides two reassembly modes: lightweight mode and
> > heavyweight mode. This patch is to support the heavyweight mode in
> > csum forwarding engine.
> > 
> > With the command "gro (heavymode|lightmode) (on|off) ", users
> > can select the lightweight mode or the heavyweight mode to use. With
> > the command "gro flush interval ", users can set the interval of
> > flushing GROed packets from the reassembly tables for the heavyweight
> > mode.
> > 
> > Signed-off-by: Jiayu Hu 
> > ---
> >  app/test-pmd/cmdline.c  | 79 
> > ++---
> >  app/test-pmd/config.c   | 33 +
> >  app/test-pmd/csumonly.c | 29 ++
> >  app/test-pmd/testpmd.c  | 17 +++
> >  app/test-pmd/testpmd.h  | 12 +++-
> >  5 files changed, 147 insertions(+), 23 deletions(-)
> > 
> > diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
> > index cd8c358..3224ce1 100644
> > --- a/app/test-pmd/cmdline.c
> > +++ b/app/test-pmd/cmdline.c
> > @@ -423,7 +423,7 @@ static void cmd_help_long_parsed(void *parsed_result,
> > "tso show (portid)"
> > "Display the status of TCP Segmentation 
> > Offload.\n\n"
> >  
> > -   "gro (on|off) (port_id)"
> > +   "gro (heavymode|lightmode) (on|off) (port_id)\n"
> 
> Not specific / limited to gro, but I have a few testpmd usability questions:
> 
> 1) to update some settings, there are two root level commands already:
> a) set ... (like: "set fwd mac", "set promisc #P on")
> b) port config ... (like: "port config#P speed auto duplex auto")
> 
> I don't know what it difference between above two, but thinking as "port
> config" is to configure ports and "set" is to set rest of testpmd config
> makes sense to me. (but "set vf .." and "set port .."  doesn't fit to
> this statement)
> 
> Instead of adding "gro" root level command, why not add this under "port
> config", like: "port config #P gro on" ? (or "set port #P gro on")

Yes, using 'gro' as root command will make the usage of testpmd inconsistent.
I will change the GSO command in the next patch. Besides, there are other root
commands, like 'tso', and maybe we need to change them too.

> 
> 
> 2) Should each configuration set have a corresponding show command?
> 
> How a user can see the current gro setting?
> Do we need a "show port gro" ?

Yes, I will add one in the next patch.

> 
> 
> 3) Where to place #P in the command:
> There are inconsistencies about where to put it, like:
> "port config #P l2-tunnel enable"
> "port config mtu #P value"
> "port #P rxq #Q start"
> 
> or
> 
> "show port info #P"
> "show port #P rss-hash ip4 key"
> 
> It can be good to define a place for it for consistency.

Make sense.

> 
> 
> 4) Using "port" keyword in some commands before port_id:
> Like: "set link-down port #P", "reset port #P mirror-rule value"
> 
> Mostly we don't have it:
> "show txq info #P #Q", "set bonding mode #M #P", "set stat_qmap rx #P
> #Q", "vlan set strip on #P"
> 
> It can be good to define one or other.

Agree, and I will add "port" to GRO related commands.

Thanks,
Jiayu

> 
> And I guess having need to use "port" keyword can be an indication that
> command should move under "port" command:
> "reset port #P mirror-rule #id" can be "port reset #P mirror-rule #id"
> 
> 
> Thanks,
> ferruh


[dpdk-dev] [PATCH v4 0/7] Infrastructure to support octeontx HW mempool manager

2017-08-14 Thread Santosh Shukla
v4:
Include 
- mempool deprecation changes, refer [1], 
- patches are rebased against v17.11-rc0.

v3:
In order to support octeontx HW mempool manager, the common mempool layer must
meet below condition.
- Object start address should be block size (total elem size) aligned.
- Object must have the physically contiguous address within the pool.

And right now mempool doesn't support both.

Patchset adds infrastrucure to support both condition in a _generic_ way.
Proposed solution won't effect existing mempool drivers or its functionality.

Summary:
Introducing capability flag. Now mempool drivers can advertise their
capabilities to common mempool layer(at the pool creation time).
Handlers are introduced in order to support capability flag.

Flags:
* MEMPOOL_F_CAPA_PHYS_CONTIG - If flag is set then Detect whether the object
has the physically contiguous address with in a hugepage.

* MEMPOOL_F_POOL_BLK_SZ_ALIGNED - If flag is set then make sure that object
addresses are block size aligned.

API:
Two handles are introduced:
* rte_mempool_ops_get_capability - advertise mempool manager capability.
* rte_mempool_ops_update_range - Update start and end address range to
HW mempool manager.

v3 --> v4:
* [01 - 02 - 03/07] mempool deprecation notice changes.
* [04 - 05 - 06 - 07/07] are v3 patches.

v2 --> v3:
(Note: v3 work is based on deprecation notice [1], It's for 17.11)
* Changed _version.map from 17.08 to 17.11.
* build fixes reported by stv_sys.
* Patchset rebased on upstream commit: da94a999.


v1 --> v2 :
* [01/06] Per deprecation notice [1], Changed rte_mempool 'flag'
  data type from int to unsigned int and removed flag param
  from _xmem_size/usage api.
* [02/06] Incorporated review feedback from v1 [2] (Suggested by Olivier)
* [03/06] Renamed flag to MEMPOOL_F_CAPA_PHYS_CONTIG
  and comment reworded. (Suggested by Olivier per v1 [3])
* [04/06] added new mempool arg in xmem_size/usage. (Suggested by Olivier)
* [05/06] patch description changed.
- Removed elseif brakcet mix
- removed sanity check for alignment
- removed extra var delta
- Removed __rte_unused from xmem_usage/size and added _BLK_SZ_ALIGN 
check.
(Suggeted by Olivier per v1[4])
* [06/06] Added RTE_FUNC_PTR_OR_RET in rte_mempool_ops_update_ops.

Checkpatch status:
* WARNING: line over 80 characters
Noticed for debug messages.

Work history:
For v1, refer [5].

Thanks.

[1] deprecation notice v2: http://dpdk.org/dev/patchwork/patch/27079/
[2] v1: http://dpdk.org/dev/patchwork/patch/25603/
[3] v1: http://dpdk.org/dev/patchwork/patch/25604/
[4] v1: http://dpdk.org/dev/patchwork/patch/25605/
[5] v1: 
http://dev.dpdk.narkive.com/Qcu55Lgz/dpdk-dev-patch-0-4-infrastructure-to-support-octeontx-hw-mempool-manager


Santosh Shukla (7):
  mempool: fix flags data type
  mempool: add mempool arg in xmem size and usage
  doc: remove mempool api change notice
  mempool: get the mempool capability
  mempool: detect physical contiguous object in pool
  mempool: introduce block size align flag
  mempool: update range info to pool

 doc/guides/rel_notes/deprecation.rst   |  9 
 doc/guides/rel_notes/release_17_11.rst |  7 +++
 drivers/net/xenvirt/rte_mempool_gntalloc.c |  5 +-
 lib/librte_mempool/rte_mempool.c   | 42 ++---
 lib/librte_mempool/rte_mempool.h   | 75 ++
 lib/librte_mempool/rte_mempool_ops.c   | 27 +++
 lib/librte_mempool/rte_mempool_version.map |  8 
 test/test/test_mempool.c   | 22 -
 test/test/test_mempool_perf.c  |  4 +-
 9 files changed, 148 insertions(+), 51 deletions(-)

-- 
2.11.0



[dpdk-dev] [PATCH v4 2/7] mempool: add mempool arg in xmem size and usage

2017-08-14 Thread Santosh Shukla
xmem_size and xmem_usage need to know the status of mp->flag.
Following patch will make use of that.

Signed-off-by: Santosh Shukla 
---
 drivers/net/xenvirt/rte_mempool_gntalloc.c |  5 +++--
 lib/librte_mempool/rte_mempool.c   | 10 ++
 lib/librte_mempool/rte_mempool.h   |  8 ++--
 test/test/test_mempool.c   |  4 ++--
 4 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/drivers/net/xenvirt/rte_mempool_gntalloc.c 
b/drivers/net/xenvirt/rte_mempool_gntalloc.c
index 73e82f808..ee0bda459 100644
--- a/drivers/net/xenvirt/rte_mempool_gntalloc.c
+++ b/drivers/net/xenvirt/rte_mempool_gntalloc.c
@@ -114,7 +114,7 @@ _create_mempool(const char *name, unsigned elt_num, 
unsigned elt_size,
pg_shift = rte_bsf32(pg_sz);
 
rte_mempool_calc_obj_size(elt_size, flags, &objsz);
-   sz = rte_mempool_xmem_size(elt_num, objsz.total_size, pg_shift);
+   sz = rte_mempool_xmem_size(elt_num, objsz.total_size, pg_shift, NULL);
pg_num = sz >> pg_shift;
 
pa_arr = calloc(pg_num, sizeof(pa_arr[0]));
@@ -162,7 +162,8 @@ _create_mempool(const char *name, unsigned elt_num, 
unsigned elt_size,
 * Check that allocated size is big enough to hold elt_num
 * objects and a calcualte how many bytes are actually required.
 */
-   usz = rte_mempool_xmem_usage(va, elt_num, objsz.total_size, pa_arr, 
pg_num, pg_shift);
+   usz = rte_mempool_xmem_usage(va, elt_num, objsz.total_size, pa_arr,
+pg_num, pg_shift, NULL);
if (usz < 0) {
mp = NULL;
i = pg_num;
diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c
index 237665c65..f95c01c00 100644
--- a/lib/librte_mempool/rte_mempool.c
+++ b/lib/librte_mempool/rte_mempool.c
@@ -238,7 +238,8 @@ rte_mempool_calc_obj_size(uint32_t elt_size, uint32_t flags,
  * Calculate maximum amount of memory required to store given number of 
objects.
  */
 size_t
-rte_mempool_xmem_size(uint32_t elt_num, size_t total_elt_sz, uint32_t pg_shift)
+rte_mempool_xmem_size(uint32_t elt_num, size_t total_elt_sz, uint32_t pg_shift,
+ __rte_unused const struct rte_mempool *mp)
 {
size_t obj_per_page, pg_num, pg_sz;
 
@@ -264,13 +265,14 @@ rte_mempool_xmem_size(uint32_t elt_num, size_t 
total_elt_sz, uint32_t pg_shift)
 ssize_t
 rte_mempool_xmem_usage(__rte_unused void *vaddr, uint32_t elt_num,
size_t total_elt_sz, const phys_addr_t paddr[], uint32_t pg_num,
-   uint32_t pg_shift)
+   uint32_t pg_shift, __rte_unused const struct rte_mempool *mp)
 {
uint32_t elt_cnt = 0;
phys_addr_t start, end;
uint32_t paddr_idx;
size_t pg_sz = (size_t)1 << pg_shift;
 
+
/* if paddr is NULL, assume contiguous memory */
if (paddr == NULL) {
start = 0;
@@ -543,7 +545,7 @@ rte_mempool_populate_default(struct rte_mempool *mp)
 
total_elt_sz = mp->header_size + mp->elt_size + mp->trailer_size;
for (mz_id = 0, n = mp->size; n > 0; mz_id++, n -= ret) {
-   size = rte_mempool_xmem_size(n, total_elt_sz, pg_shift);
+   size = rte_mempool_xmem_size(n, total_elt_sz, pg_shift, mp);
 
ret = snprintf(mz_name, sizeof(mz_name),
RTE_MEMPOOL_MZ_FORMAT "_%d", mp->name, mz_id);
@@ -600,7 +602,7 @@ get_anon_size(const struct rte_mempool *mp)
pg_sz = getpagesize();
pg_shift = rte_bsf32(pg_sz);
total_elt_sz = mp->header_size + mp->elt_size + mp->trailer_size;
-   size = rte_mempool_xmem_size(mp->size, total_elt_sz, pg_shift);
+   size = rte_mempool_xmem_size(mp->size, total_elt_sz, pg_shift, mp);
 
return size;
 }
diff --git a/lib/librte_mempool/rte_mempool.h b/lib/librte_mempool/rte_mempool.h
index bd7be2319..74e91d34f 100644
--- a/lib/librte_mempool/rte_mempool.h
+++ b/lib/librte_mempool/rte_mempool.h
@@ -1476,11 +1476,13 @@ uint32_t rte_mempool_calc_obj_size(uint32_t elt_size, 
uint32_t flags,
  *   by rte_mempool_calc_obj_size().
  * @param pg_shift
  *   LOG2 of the physical pages size. If set to 0, ignore page boundaries.
+ * @param mp
+ *  A pointer to the mempool structure.
  * @return
  *   Required memory size aligned at page boundary.
  */
 size_t rte_mempool_xmem_size(uint32_t elt_num, size_t total_elt_sz,
-   uint32_t pg_shift);
+   uint32_t pg_shift, const struct rte_mempool *mp);
 
 /**
  * Get the size of memory required to store mempool elements.
@@ -1503,6 +1505,8 @@ size_t rte_mempool_xmem_size(uint32_t elt_num, size_t 
total_elt_sz,
  *   Number of elements in the paddr array.
  * @param pg_shift
  *   LOG2 of the physical pages size.
+ * @param mp
+ *  A pointer to the mempool structure.
  * @return
  *   On success, the number of bytes needed to store given number of
  *   objects, aligned to the given page size. If the provided memory
@@ -1511,7 +1515,7 @@ size_t rte_mempool_xmem_size(uint32_t e

[dpdk-dev] [PATCH v4 1/7] mempool: fix flags data type

2017-08-14 Thread Santosh Shukla
mp->flags is int and mempool API updates unsigned int
value in 'flags', so fix the 'flags' data type.

Patch also does mp->flags cleanup like:
* Remove redundant 'flags' API description from
  - __rte_mempool_generic_put
  - __rte_mempool_generic_get

* Remove unused 'flags' param from
  - rte_mempool_generic_put
  - rte_mempool_generic_get

* Fix mempool var data types int mempool.c
  - mz_flags is int, Change it to unsigned int.

Fixes: af75078fec ("first public release")
Fixes: 454a0a7009 ("mempool: use cache in single producer or consumer mode")
Fixes: d6f78df6fe ("mempool: use bit flags for multi consumers and producers")
Fixes: d1d914ebbc ("mempool: allocate in several memory chunks by default")

Signed-off-by: Santosh Shukla 
---
 lib/librte_mempool/rte_mempool.c |  4 ++--
 lib/librte_mempool/rte_mempool.h | 23 +--
 test/test/test_mempool.c | 18 +-
 test/test/test_mempool_perf.c|  4 ++--
 4 files changed, 18 insertions(+), 31 deletions(-)

diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c
index 6fc3c9c7c..237665c65 100644
--- a/lib/librte_mempool/rte_mempool.c
+++ b/lib/librte_mempool/rte_mempool.c
@@ -515,7 +515,7 @@ rte_mempool_populate_virt(struct rte_mempool *mp, char 
*addr,
 int
 rte_mempool_populate_default(struct rte_mempool *mp)
 {
-   int mz_flags = RTE_MEMZONE_1GB|RTE_MEMZONE_SIZE_HINT_ONLY;
+   unsigned int mz_flags = RTE_MEMZONE_1GB|RTE_MEMZONE_SIZE_HINT_ONLY;
char mz_name[RTE_MEMZONE_NAMESIZE];
const struct rte_memzone *mz;
size_t size, total_elt_sz, align, pg_sz, pg_shift;
@@ -742,7 +742,7 @@ rte_mempool_create_empty(const char *name, unsigned n, 
unsigned elt_size,
struct rte_tailq_entry *te = NULL;
const struct rte_memzone *mz = NULL;
size_t mempool_size;
-   int mz_flags = RTE_MEMZONE_1GB|RTE_MEMZONE_SIZE_HINT_ONLY;
+   unsigned int mz_flags = RTE_MEMZONE_1GB|RTE_MEMZONE_SIZE_HINT_ONLY;
struct rte_mempool_objsz objsz;
unsigned lcore_id;
int ret;
diff --git a/lib/librte_mempool/rte_mempool.h b/lib/librte_mempool/rte_mempool.h
index 76b5b3b15..bd7be2319 100644
--- a/lib/librte_mempool/rte_mempool.h
+++ b/lib/librte_mempool/rte_mempool.h
@@ -226,7 +226,7 @@ struct rte_mempool {
};
void *pool_config;   /**< optional args for ops alloc. */
const struct rte_memzone *mz;/**< Memzone where pool is alloc'd. */
-   int flags;   /**< Flags of the mempool. */
+   unsigned int flags;  /**< Flags of the mempool. */
int socket_id;   /**< Socket id passed at create. */
uint32_t size;   /**< Max size of the mempool. */
uint32_t cache_size;
@@ -1034,9 +1034,6 @@ rte_mempool_default_cache(struct rte_mempool *mp, 
unsigned lcore_id)
  *   positive.
  * @param cache
  *   A pointer to a mempool cache structure. May be NULL if not needed.
- * @param flags
- *   The flags used for the mempool creation.
- *   Single-producer (MEMPOOL_F_SP_PUT flag) or multi-producers.
  */
 static __rte_always_inline void
 __mempool_generic_put(struct rte_mempool *mp, void * const *obj_table,
@@ -1096,14 +1093,10 @@ __mempool_generic_put(struct rte_mempool *mp, void * 
const *obj_table,
  *   The number of objects to add in the mempool from the obj_table.
  * @param cache
  *   A pointer to a mempool cache structure. May be NULL if not needed.
- * @param flags
- *   The flags used for the mempool creation.
- *   Single-producer (MEMPOOL_F_SP_PUT flag) or multi-producers.
  */
 static __rte_always_inline void
 rte_mempool_generic_put(struct rte_mempool *mp, void * const *obj_table,
-   unsigned n, struct rte_mempool_cache *cache,
-   __rte_unused int flags)
+   unsigned n, struct rte_mempool_cache *cache)
 {
__mempool_check_cookies(mp, obj_table, n, 0);
__mempool_generic_put(mp, obj_table, n, cache);
@@ -1129,7 +1122,7 @@ rte_mempool_put_bulk(struct rte_mempool *mp, void * const 
*obj_table,
 {
struct rte_mempool_cache *cache;
cache = rte_mempool_default_cache(mp, rte_lcore_id());
-   rte_mempool_generic_put(mp, obj_table, n, cache, mp->flags);
+   rte_mempool_generic_put(mp, obj_table, n, cache);
 }
 
 /**
@@ -1160,9 +1153,6 @@ rte_mempool_put(struct rte_mempool *mp, void *obj)
  *   The number of objects to get, must be strictly positive.
  * @param cache
  *   A pointer to a mempool cache structure. May be NULL if not needed.
- * @param flags
- *   The flags used for the mempool creation.
- *   Single-consumer (MEMPOOL_F_SC_GET flag) or multi-consumers.
  * @return
  *   - >=0: Success; number of objects supplied.
  *   - <0: Error; code of ring dequeue function.
@@ -1241,16 +1231,13 @@ __mempool_generic_get(struct rte_mempool *mp, void 
**obj_table,
  *   The number of objects to get from mempool to obj_table.
  * @param ca

[dpdk-dev] [PATCH v4 3/7] doc: remove mempool api change notice

2017-08-14 Thread Santosh Shukla
Removed mempool api change deprecation notice and
updated change info in release_17.11.

Signed-off-by: Santosh Shukla 
---
 doc/guides/rel_notes/deprecation.rst   | 9 -
 doc/guides/rel_notes/release_17_11.rst | 7 +++
 2 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/doc/guides/rel_notes/deprecation.rst 
b/doc/guides/rel_notes/deprecation.rst
index 3362f3350..0e4cb1f95 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -44,15 +44,6 @@ Deprecation Notices
   PKT_RX_QINQ_STRIPPED, that are better described. The old flags and
   their behavior will be kept until 17.08 and will be removed in 17.11.
 
-* mempool: The following will be modified in 17.11:
-
-  - ``rte_mempool_xmem_size`` and ``rte_mempool_xmem_usage`` need to know
-the mempool flag status so adding new param rte_mempool in those API.
-  - Removing __rte_unused int flag param from ``rte_mempool_generic_put``
-and ``rte_mempool_generic_get`` API.
-  - ``rte_mempool`` flags data type will changed from int to
-unsigned int.
-
 * ethdev: Tx offloads will no longer be enabled by default in 17.11.
   Instead, the ``rte_eth_txmode`` structure will be extended with
   bit field to enable each Tx offload.
diff --git a/doc/guides/rel_notes/release_17_11.rst 
b/doc/guides/rel_notes/release_17_11.rst
index 170f4f916..055ba10a4 100644
--- a/doc/guides/rel_notes/release_17_11.rst
+++ b/doc/guides/rel_notes/release_17_11.rst
@@ -110,6 +110,13 @@ API Changes
Also, make sure to start the actual text at the margin.
=
 
+* **The following changes made in mempool library**
+
+  * Moved ``flag`` datatype from int to unsigned int for ``rte_mempool``.
+  * Removed ``__rte_unused int flag`` param from ``rte_mempool_generic_put``
+and ``rte_mempool_generic_get`` API.
+  * Added ``rte_mempool`` param in ``rte_mempool_xmem_size`` and
+``rte_mempool_xmem_usage``.
 
 ABI Changes
 ---
-- 
2.11.0



[dpdk-dev] [PATCH v4 5/7] mempool: detect physical contiguous object in pool

2017-08-14 Thread Santosh Shukla
The memory area containing all the objects must be physically
contiguous.
Introducing MEMPOOL_F_CAPA_PHYS_CONTIG flag for such use-case.

The flag useful to detect whether pool area has sufficient space
to fit all objects. If not then return -ENOSPC.
This way, we make sure that all object within a pool is contiguous.

Signed-off-by: Santosh Shukla 
Signed-off-by: Jerin Jacob 
---
 lib/librte_mempool/rte_mempool.c | 8 
 lib/librte_mempool/rte_mempool.h | 1 +
 2 files changed, 9 insertions(+)

diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c
index d518c53de..19e5e6ddf 100644
--- a/lib/librte_mempool/rte_mempool.c
+++ b/lib/librte_mempool/rte_mempool.c
@@ -370,6 +370,14 @@ rte_mempool_populate_phys(struct rte_mempool *mp, char 
*vaddr,
 
total_elt_sz = mp->header_size + mp->elt_size + mp->trailer_size;
 
+   /* Detect pool area has sufficient space for elements */
+   if (mp->flags & MEMPOOL_F_CAPA_PHYS_CONTIG) {
+   if (len < total_elt_sz * mp->size) {
+   RTE_LOG(ERR, MEMPOOL, "pool area %" PRIx64 " not 
enough\n", (uint64_t)len);
+   return -ENOSPC;
+   }
+   }
+
memhdr = rte_zmalloc("MEMPOOL_MEMHDR", sizeof(*memhdr), 0);
if (memhdr == NULL)
return -ENOMEM;
diff --git a/lib/librte_mempool/rte_mempool.h b/lib/librte_mempool/rte_mempool.h
index bc4a1dac7..a4bfdb56e 100644
--- a/lib/librte_mempool/rte_mempool.h
+++ b/lib/librte_mempool/rte_mempool.h
@@ -265,6 +265,7 @@ struct rte_mempool {
 #define MEMPOOL_F_SC_GET 0x0008 /**< Default get is 
"single-consumer".*/
 #define MEMPOOL_F_POOL_CREATED   0x0010 /**< Internal: pool is created. */
 #define MEMPOOL_F_NO_PHYS_CONTIG 0x0020 /**< Don't need physically contiguous 
objs. */
+#define MEMPOOL_F_CAPA_PHYS_CONTIG 0x0040 /**< Detect physcially contiguous 
objs */
 
 /**
  * @internal When debug is enabled, store some statistics.
-- 
2.11.0



[dpdk-dev] [PATCH v4 6/7] mempool: introduce block size align flag

2017-08-14 Thread Santosh Shukla
Some mempool hw like octeontx/fpa block, demands block size
(/total_elem_sz) aligned object start address.

Introducing an MEMPOOL_F_POOL_BLK_SZ_ALIGNED flag.
If this flag is set:
- Align object start address to a multiple of total_elt_sz.
- Allocate one additional object. Additional object is needed to make
  sure that requested 'n' object gets correctly populated. Example:

- Let's say that we get 'x' size of memory chunk from memzone.
- And application has requested 'n' object from mempool.
- Ideally, we start using objects at start address 0 to...(x-block_sz)
  for n obj.
- Not necessarily first object address i.e. 0 is aligned to block_sz.
- So we derive 'offset' value for block_sz alignment purpose i.e..'off'.
- That 'off' makes sure that start address of object is blk_sz
  aligned.
- Calculating 'off' may end up sacrificing first block_sz area of
  memzone area x. So total number of the object which can fit in the
  pool area is n-1, Which is incorrect behavior.

Therefore we request one additional object (/block_sz area) from memzone
when F_BLK_SZ_ALIGNED flag is set.

Signed-off-by: Santosh Shukla 
Signed-off-by: Jerin Jacob 
---
 lib/librte_mempool/rte_mempool.c | 16 +---
 lib/librte_mempool/rte_mempool.h |  1 +
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c
index 19e5e6ddf..7610f0d1f 100644
--- a/lib/librte_mempool/rte_mempool.c
+++ b/lib/librte_mempool/rte_mempool.c
@@ -239,10 +239,14 @@ rte_mempool_calc_obj_size(uint32_t elt_size, uint32_t 
flags,
  */
 size_t
 rte_mempool_xmem_size(uint32_t elt_num, size_t total_elt_sz, uint32_t pg_shift,
- __rte_unused const struct rte_mempool *mp)
+ const struct rte_mempool *mp)
 {
size_t obj_per_page, pg_num, pg_sz;
 
+   if (mp && mp->flags & MEMPOOL_F_POOL_BLK_SZ_ALIGNED)
+   /* alignment need one additional object */
+   elt_num += 1;
+
if (total_elt_sz == 0)
return 0;
 
@@ -265,13 +269,16 @@ rte_mempool_xmem_size(uint32_t elt_num, size_t 
total_elt_sz, uint32_t pg_shift,
 ssize_t
 rte_mempool_xmem_usage(__rte_unused void *vaddr, uint32_t elt_num,
size_t total_elt_sz, const phys_addr_t paddr[], uint32_t pg_num,
-   uint32_t pg_shift, __rte_unused const struct rte_mempool *mp)
+   uint32_t pg_shift, const struct rte_mempool *mp)
 {
uint32_t elt_cnt = 0;
phys_addr_t start, end;
uint32_t paddr_idx;
size_t pg_sz = (size_t)1 << pg_shift;
 
+   if (mp && mp->flags & MEMPOOL_F_POOL_BLK_SZ_ALIGNED)
+   /* alignment need one additional object */
+   elt_num += 1;
 
/* if paddr is NULL, assume contiguous memory */
if (paddr == NULL) {
@@ -389,7 +396,10 @@ rte_mempool_populate_phys(struct rte_mempool *mp, char 
*vaddr,
memhdr->free_cb = free_cb;
memhdr->opaque = opaque;
 
-   if (mp->flags & MEMPOOL_F_NO_CACHE_ALIGN)
+   if (mp->flags & MEMPOOL_F_POOL_BLK_SZ_ALIGNED)
+   /* align object start address to a multiple of total_elt_sz */
+   off = total_elt_sz - ((uintptr_t)vaddr % total_elt_sz);
+   else if (mp->flags & MEMPOOL_F_NO_CACHE_ALIGN)
off = RTE_PTR_ALIGN_CEIL(vaddr, 8) - vaddr;
else
off = RTE_PTR_ALIGN_CEIL(vaddr, RTE_CACHE_LINE_SIZE) - vaddr;
diff --git a/lib/librte_mempool/rte_mempool.h b/lib/librte_mempool/rte_mempool.h
index a4bfdb56e..d7c2416f4 100644
--- a/lib/librte_mempool/rte_mempool.h
+++ b/lib/librte_mempool/rte_mempool.h
@@ -266,6 +266,7 @@ struct rte_mempool {
 #define MEMPOOL_F_POOL_CREATED   0x0010 /**< Internal: pool is created. */
 #define MEMPOOL_F_NO_PHYS_CONTIG 0x0020 /**< Don't need physically contiguous 
objs. */
 #define MEMPOOL_F_CAPA_PHYS_CONTIG 0x0040 /**< Detect physcially contiguous 
objs */
+#define MEMPOOL_F_POOL_BLK_SZ_ALIGNED 0x0080 /**< Align obj start address to 
total elem size */
 
 /**
  * @internal When debug is enabled, store some statistics.
-- 
2.11.0



[dpdk-dev] [PATCH v4 4/7] mempool: get the mempool capability

2017-08-14 Thread Santosh Shukla
Allow mempool to advertise its capability.
A handler been introduced called rte_mempool_ops_get_capabilities.
- Upon ->get_capabilities call, mempool driver will advertise
capability by updating to 'mp->flags'.

Signed-off-by: Santosh Shukla 
Signed-off-by: Jerin Jacob 
---
 lib/librte_mempool/rte_mempool.c   |  5 +
 lib/librte_mempool/rte_mempool.h   | 20 
 lib/librte_mempool/rte_mempool_ops.c   | 14 ++
 lib/librte_mempool/rte_mempool_version.map |  7 +++
 4 files changed, 46 insertions(+)

diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c
index f95c01c00..d518c53de 100644
--- a/lib/librte_mempool/rte_mempool.c
+++ b/lib/librte_mempool/rte_mempool.c
@@ -529,6 +529,11 @@ rte_mempool_populate_default(struct rte_mempool *mp)
if (mp->nb_mem_chunks != 0)
return -EEXIST;
 
+   /* Get mempool capability */
+   ret = rte_mempool_ops_get_capabilities(mp);
+   if (ret)
+   RTE_LOG(DEBUG, MEMPOOL, "get_capability not supported for 
%s\n", mp->name);
+
if (rte_xen_dom0_supported()) {
pg_sz = RTE_PGSIZE_2M;
pg_shift = rte_bsf32(pg_sz);
diff --git a/lib/librte_mempool/rte_mempool.h b/lib/librte_mempool/rte_mempool.h
index 74e91d34f..bc4a1dac7 100644
--- a/lib/librte_mempool/rte_mempool.h
+++ b/lib/librte_mempool/rte_mempool.h
@@ -389,6 +389,12 @@ typedef int (*rte_mempool_dequeue_t)(struct rte_mempool 
*mp,
  */
 typedef unsigned (*rte_mempool_get_count)(const struct rte_mempool *mp);
 
+/**
+ * Get the mempool capability.
+ */
+typedef int (*rte_mempool_get_capabilities_t)(struct rte_mempool *mp);
+
+
 /** Structure defining mempool operations structure */
 struct rte_mempool_ops {
char name[RTE_MEMPOOL_OPS_NAMESIZE]; /**< Name of mempool ops struct. */
@@ -397,6 +403,7 @@ struct rte_mempool_ops {
rte_mempool_enqueue_t enqueue;   /**< Enqueue an object. */
rte_mempool_dequeue_t dequeue;   /**< Dequeue an object. */
rte_mempool_get_count get_count; /**< Get qty of available objs. */
+   rte_mempool_get_capabilities_t get_capabilities; /**< Get capability */
 } __rte_cache_aligned;
 
 #define RTE_MEMPOOL_MAX_OPS_IDX 16  /**< Max registered ops structs */
@@ -508,6 +515,19 @@ rte_mempool_ops_enqueue_bulk(struct rte_mempool *mp, void 
* const *obj_table,
 unsigned
 rte_mempool_ops_get_count(const struct rte_mempool *mp);
 
+
+/**
+ * @internal wrapper for mempool_ops get_capabilities callback.
+ *
+ * @param mp
+ *   Pointer to the memory pool.
+ * @return
+ *   - 0: Success; Capability updated to mp->flags
+ *   - <0: Error; code of capability function.
+ */
+int
+rte_mempool_ops_get_capabilities(struct rte_mempool *mp);
+
 /**
  * @internal wrapper for mempool_ops free callback.
  *
diff --git a/lib/librte_mempool/rte_mempool_ops.c 
b/lib/librte_mempool/rte_mempool_ops.c
index 5f24de250..31a73cc9a 100644
--- a/lib/librte_mempool/rte_mempool_ops.c
+++ b/lib/librte_mempool/rte_mempool_ops.c
@@ -37,6 +37,7 @@
 
 #include 
 #include 
+#include 
 
 /* indirect jump table to support external memory pools. */
 struct rte_mempool_ops_table rte_mempool_ops_table = {
@@ -85,6 +86,7 @@ rte_mempool_register_ops(const struct rte_mempool_ops *h)
ops->enqueue = h->enqueue;
ops->dequeue = h->dequeue;
ops->get_count = h->get_count;
+   ops->get_capabilities = h->get_capabilities;
 
rte_spinlock_unlock(&rte_mempool_ops_table.sl);
 
@@ -123,6 +125,18 @@ rte_mempool_ops_get_count(const struct rte_mempool *mp)
return ops->get_count(mp);
 }
 
+/* wrapper to get external mempool capability. */
+int
+rte_mempool_ops_get_capabilities(struct rte_mempool *mp)
+{
+   struct rte_mempool_ops *ops;
+
+   ops = rte_mempool_get_ops(mp->ops_index);
+
+   RTE_FUNC_PTR_OR_ERR_RET(ops->get_capabilities, -ENOTSUP);
+   return ops->get_capabilities(mp);
+}
+
 /* sets mempool ops previously registered by rte_mempool_register_ops. */
 int
 rte_mempool_set_ops_byname(struct rte_mempool *mp, const char *name,
diff --git a/lib/librte_mempool/rte_mempool_version.map 
b/lib/librte_mempool/rte_mempool_version.map
index f9c079447..3c3471507 100644
--- a/lib/librte_mempool/rte_mempool_version.map
+++ b/lib/librte_mempool/rte_mempool_version.map
@@ -41,3 +41,10 @@ DPDK_16.07 {
rte_mempool_set_ops_byname;
 
 } DPDK_2.0;
+
+DPDK_17.11 {
+   global:
+
+   rte_mempool_ops_get_capabilities;
+
+} DPDK_16.07;
-- 
2.11.0



[dpdk-dev] [PATCH v4 7/7] mempool: update range info to pool

2017-08-14 Thread Santosh Shukla
HW pool manager e.g. Octeontx SoC demands s/w to program start and end
address of pool. Currently, there is no such handle in external mempool.
Introducing rte_mempool_update_range handle which will let HW(pool
manager)
know when common layer selects hugepage:
For each hugepage - update its start/end address to HW pool manager.

Signed-off-by: Santosh Shukla 
Signed-off-by: Jerin Jacob 
---
 lib/librte_mempool/rte_mempool.c   |  3 +++
 lib/librte_mempool/rte_mempool.h   | 22 ++
 lib/librte_mempool/rte_mempool_ops.c   | 13 +
 lib/librte_mempool/rte_mempool_version.map |  1 +
 4 files changed, 39 insertions(+)

diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c
index 7610f0d1f..df7996df8 100644
--- a/lib/librte_mempool/rte_mempool.c
+++ b/lib/librte_mempool/rte_mempool.c
@@ -363,6 +363,9 @@ rte_mempool_populate_phys(struct rte_mempool *mp, char 
*vaddr,
struct rte_mempool_memhdr *memhdr;
int ret;
 
+   /* update range info to mempool */
+   rte_mempool_ops_update_range(mp, vaddr, paddr, len);
+
/* create the internal ring if not already done */
if ((mp->flags & MEMPOOL_F_POOL_CREATED) == 0) {
ret = rte_mempool_ops_alloc(mp);
diff --git a/lib/librte_mempool/rte_mempool.h b/lib/librte_mempool/rte_mempool.h
index d7c2416f4..b59a522cd 100644
--- a/lib/librte_mempool/rte_mempool.h
+++ b/lib/librte_mempool/rte_mempool.h
@@ -396,6 +396,11 @@ typedef unsigned (*rte_mempool_get_count)(const struct 
rte_mempool *mp);
  */
 typedef int (*rte_mempool_get_capabilities_t)(struct rte_mempool *mp);
 
+/**
+ * Update range info to mempool.
+ */
+typedef void (*rte_mempool_update_range_t)(const struct rte_mempool *mp,
+   char *vaddr, phys_addr_t paddr, size_t len);
 
 /** Structure defining mempool operations structure */
 struct rte_mempool_ops {
@@ -406,6 +411,7 @@ struct rte_mempool_ops {
rte_mempool_dequeue_t dequeue;   /**< Dequeue an object. */
rte_mempool_get_count get_count; /**< Get qty of available objs. */
rte_mempool_get_capabilities_t get_capabilities; /**< Get capability */
+   rte_mempool_update_range_t update_range; /**< Update range to mempool */
 } __rte_cache_aligned;
 
 #define RTE_MEMPOOL_MAX_OPS_IDX 16  /**< Max registered ops structs */
@@ -531,6 +537,22 @@ int
 rte_mempool_ops_get_capabilities(struct rte_mempool *mp);
 
 /**
+ * @internal wrapper for mempool_ops update_range callback.
+ *
+ * @param mp
+ *   Pointer to the memory pool.
+ * @param vaddr
+ *   Pointer to the buffer virtual address
+ * @param paddr
+ *   Pointer to the buffer physical address
+ * @param len
+ *   Pool size
+ */
+void
+rte_mempool_ops_update_range(const struct rte_mempool *mp,
+   char *vaddr, phys_addr_t paddr, size_t len);
+
+/**
  * @internal wrapper for mempool_ops free callback.
  *
  * @param mp
diff --git a/lib/librte_mempool/rte_mempool_ops.c 
b/lib/librte_mempool/rte_mempool_ops.c
index 31a73cc9a..7bb52b3ca 100644
--- a/lib/librte_mempool/rte_mempool_ops.c
+++ b/lib/librte_mempool/rte_mempool_ops.c
@@ -87,6 +87,7 @@ rte_mempool_register_ops(const struct rte_mempool_ops *h)
ops->dequeue = h->dequeue;
ops->get_count = h->get_count;
ops->get_capabilities = h->get_capabilities;
+   ops->update_range = h->update_range;
 
rte_spinlock_unlock(&rte_mempool_ops_table.sl);
 
@@ -137,6 +138,18 @@ rte_mempool_ops_get_capabilities(struct rte_mempool *mp)
return ops->get_capabilities(mp);
 }
 
+/* wrapper to update range info to external mempool */
+void
+rte_mempool_ops_update_range(const struct rte_mempool *mp, char *vaddr,
+phys_addr_t paddr, size_t len)
+{
+   struct rte_mempool_ops *ops;
+
+   ops = rte_mempool_get_ops(mp->ops_index);
+   RTE_FUNC_PTR_OR_RET(ops->update_range);
+   ops->update_range(mp, vaddr, paddr, len);
+}
+
 /* sets mempool ops previously registered by rte_mempool_register_ops. */
 int
 rte_mempool_set_ops_byname(struct rte_mempool *mp, const char *name,
diff --git a/lib/librte_mempool/rte_mempool_version.map 
b/lib/librte_mempool/rte_mempool_version.map
index 3c3471507..2663001c3 100644
--- a/lib/librte_mempool/rte_mempool_version.map
+++ b/lib/librte_mempool/rte_mempool_version.map
@@ -46,5 +46,6 @@ DPDK_17.11 {
global:
 
rte_mempool_ops_get_capabilities;
+   rte_mempool_ops_update_range;
 
 } DPDK_16.07;
-- 
2.11.0



[dpdk-dev] [RFC PATCH v2 0/4] IPSec Inline and look aside crypto offload

2017-08-14 Thread Akhil Goyal
This patchet showcases the definition and usage of the rte_security
APIs described in the RFC v1 sent earlier.

The data path and configuration path is similar to what was proposed in
version 1. However, rte_security_configure API is removed, as it looked
redundant.

Also the rte_security.x files are placed inside the lib/librte_cryptodev/
as the APIs are defined with the help of crypto APIs and it makes more sense
to extend the cryptodev library instead of a separate library which perform
similar actions.

Some of the parameters of the APIs are also modified for better usability.
The parameter ``dev_name`` is removed as the appropriate device(crypto/eth)
can be obtained by using the action type.

The patchset is still in work in progress state and there may be some changes
and cleanup in the next version. This is just to enable others to work
in parallel on the crypto offloading using ethernet devices.

This patchset include the definition of rte_security APIs in patch 1,
changes required in cryptodev in patch 2, sample driver implementation
in patch 3 and ipsec-secgw application changes in patch 4.

Akhil Goyal (4):
  RFC2: rte_security: API definitions
  cryptodev: entend cryptodev to support security APIs
  crypto/dpaa2_sec: add support for protocol offload ipsec
  example/ipsec-secgw: add support for offloading crypto op

 drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 368 -
 drivers/crypto/dpaa2_sec/dpaa2_sec_priv.h   |  33 +++
 examples/ipsec-secgw/ipsec.c| 125 ++---
 examples/ipsec-secgw/ipsec.h|  13 +-
 examples/ipsec-secgw/sa.c   | 142 +++---
 lib/librte_cryptodev/Makefile   |   3 +-
 lib/librte_cryptodev/rte_crypto_sym.h   |  15 +
 lib/librte_cryptodev/rte_cryptodev.h|  20 +-
 lib/librte_cryptodev/rte_cryptodev_pmd.h|  35 +++
 lib/librte_cryptodev/rte_security.c | 171 
 lib/librte_cryptodev/rte_security.h | 409 
 11 files changed, 1243 insertions(+), 91 deletions(-)
 create mode 100644 lib/librte_cryptodev/rte_security.c
 create mode 100644 lib/librte_cryptodev/rte_security.h

-- 
2.9.3



[dpdk-dev] [RFC PATCH 1/4] rte_security: API definitions

2017-08-14 Thread Akhil Goyal
Detailed description is added in the coverletter

Signed-off-by: Akhil Goyal 
---
 lib/librte_cryptodev/rte_security.c | 171 +++
 lib/librte_cryptodev/rte_security.h | 409 
 2 files changed, 580 insertions(+)
 create mode 100644 lib/librte_cryptodev/rte_security.c
 create mode 100644 lib/librte_cryptodev/rte_security.h

diff --git a/lib/librte_cryptodev/rte_security.c 
b/lib/librte_cryptodev/rte_security.c
new file mode 100644
index 000..7c73c93
--- /dev/null
+++ b/lib/librte_cryptodev/rte_security.c
@@ -0,0 +1,171 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright 2017 NXP.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in
+ *   the documentation and/or other materials provided with the
+ *   distribution.
+ * * Neither the name of NXP nor the names of its
+ *   contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "rte_crypto.h"
+#include "rte_cryptodev_pmd.h"
+#include "rte_security.h"
+#include "rte_ethdev.h"
+#include "rte_cryptodev.h"
+
+
+struct rte_security_session *
+rte_security_session_create(struct rte_mempool *mp)
+{
+   struct rte_security_session *sess;
+
+   /* Allocate a session structure from the session pool */
+   if (rte_mempool_get(mp, (void *)&sess)) {
+   CDEV_LOG_ERR("couldn't get object from session mempool");
+   return NULL;
+   }
+
+   /* Clear device session pointer */
+   memset(sess, 0, (sizeof(void *) *
+   RTE_MAX(rte_eth_dev_count(), rte_cryptodev_count(;
+
+   return sess;
+}
+
+int
+rte_security_session_init(uint16_t dev_id,
+ struct rte_security_session *sess,
+ struct rte_security_sess_conf *conf,
+ struct rte_mempool *mp)
+{
+   struct rte_cryptodev *cdev = NULL;
+   struct rte_eth_dev *dev = NULL;
+   uint8_t index;
+   int ret;
+
+   if (sess == NULL || conf == NULL)
+   return -EINVAL;
+
+   switch (conf->action_type) {
+   case RTE_SECURITY_SESS_CRYPTO_PROTO_OFFLOAD:
+   if (!rte_cryptodev_pmd_is_valid_dev(dev_id))
+   return -EINVAL;
+   cdev = rte_cryptodev_pmd_get_dev(dev_id);
+   index = cdev->driver_id;
+   if (sess->sess_private_data[index] == NULL) {
+   ret = cdev->sec_ops->session_configure(cdev, conf, 
sess, mp);
+   if (ret < 0) {
+   CDEV_LOG_ERR(
+   "cdev_id %d failed to configure session 
details",
+   dev_id);
+   return ret;
+   }
+   }
+   break;
+   case RTE_SECURITY_SESS_ETH_INLINE_CRYPTO:
+   case RTE_SECURITY_SESS_ETH_PROTO_OFFLOAD:
+   dev = &rte_eth_devices[dev_id];
+   index = dev->data->port_id;
+   if (sess->sess_private_data[index] == NULL) {
+// ret = dev->sec_ops->session_configure(dev, conf, sess, 
mp);
+// if (ret < 0) {
+// CDEV_LOG_ERR(
+// "dev_id %d failed to configure session 
details",
+// dev_id);
+// return ret;
+// }
+   }
+   break;
+   default:
+   return -EINVAL;
+   }
+
+   return 0;
+}
+
+int
+rte_security_se

[dpdk-dev] [RFC PATCH 3/4] crypto/dpaa2_sec: add support for protocol offload ipsec

2017-08-14 Thread Akhil Goyal
driver implementation to support rte_security APIs

Signed-off-by: Akhil Goyal 
---
 drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 368 +++-
 drivers/crypto/dpaa2_sec/dpaa2_sec_priv.h   |  33 +++
 2 files changed, 399 insertions(+), 2 deletions(-)

diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c 
b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
index e0f6cfc..45f41d5 100644
--- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
+++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
@@ -73,12 +73,46 @@
 #define FLE_POOL_NUM_BUFS  32000
 #define FLE_POOL_BUF_SIZE  256
 #define FLE_POOL_CACHE_SIZE512
+#define SEC_FLC_DHR_OUTBOUND   -114
+#define SEC_FLC_DHR_INBOUND0
 
 enum rta_sec_era rta_sec_era = RTA_SEC_ERA_8;
 
 static uint8_t cryptodev_driver_id;
 
 static inline int
+build_proto_fd(dpaa2_sec_session *sess,
+  struct rte_crypto_op *op,
+  struct qbman_fd *fd, uint16_t bpid)
+{
+   struct rte_crypto_sym_op *sym_op = op->sym;
+   struct ctxt_priv *priv = sess->ctxt;
+   struct sec_flow_context *flc;
+   struct rte_mbuf *mbuf = sym_op->m_src;
+
+   if (likely(bpid < MAX_BPID)) {
+   DPAA2_SET_FD_BPID(fd, bpid);
+   } else {
+   DPAA2_SET_FD_IVP(fd);
+   }
+
+   /* Save the shared descriptor */
+   flc = &priv->flc_desc[0].flc;
+
+   DPAA2_SET_FD_ADDR(fd, DPAA2_MBUF_VADDR_TO_IOVA(sym_op->m_src));
+   DPAA2_SET_FD_OFFSET(fd, sym_op->m_src->data_off + 
sym_op->m_src->l2_len);
+   DPAA2_SET_FD_LEN(fd, sym_op->m_src->pkt_len - sym_op->m_src->l2_len);
+   DPAA2_SET_FD_FLC(fd, ((uint64_t)flc));
+
+   /* save physical address of mbuf */
+   op->sym->aead.digest.phys_addr = mbuf->buf_physaddr;
+   mbuf->buf_physaddr = (uint64_t)op;
+
+   return 0;
+}
+
+
+static inline int
 build_authenc_gcm_fd(dpaa2_sec_session *sess,
 struct rte_crypto_op *op,
 struct qbman_fd *fd, uint16_t bpid)
@@ -565,6 +599,9 @@ build_sec_fd(dpaa2_sec_session *sess, struct rte_crypto_op 
*op,
case DPAA2_SEC_CIPHER_HASH:
ret = build_authenc_fd(sess, op, fd, bpid);
break;
+   case DPAA2_SEC_IPSEC:
+   ret = build_proto_fd(sess, op, fd, bpid);
+   break;
case DPAA2_SEC_HASH_CIPHER:
default:
RTE_LOG(ERR, PMD, "error: Unsupported session\n");
@@ -649,12 +686,44 @@ dpaa2_sec_enqueue_burst(void *qp, struct rte_crypto_op 
**ops,
 }
 
 static inline struct rte_crypto_op *
-sec_fd_to_mbuf(const struct qbman_fd *fd)
+sec_simple_fd_to_mbuf(const struct qbman_fd *fd, __rte_unused uint8_t id)
+{
+   struct rte_crypto_op *op;
+   uint16_t len = DPAA2_GET_FD_LEN(fd);
+   uint16_t diff = 0;
+   dpaa2_sec_session *sess_priv;
+
+   struct rte_mbuf *mbuf = DPAA2_INLINE_MBUF_FROM_BUF(
+   DPAA2_IOVA_TO_VADDR(DPAA2_GET_FD_ADDR(fd)),
+   rte_dpaa2_bpid_info[DPAA2_GET_FD_BPID(fd)].meta_data_size);
+
+   op = (struct rte_crypto_op *)mbuf->buf_physaddr;
+   mbuf->buf_physaddr = op->sym->aead.digest.phys_addr;
+   op->sym->aead.digest.phys_addr = 0L;
+
+   sess_priv = (dpaa2_sec_session *)get_sec_session_private_data(
+   op->sym->sec_session, id);
+   if (sess_priv->dir == DIR_ENC)
+   mbuf->data_off += SEC_FLC_DHR_OUTBOUND;
+   else
+   mbuf->data_off += SEC_FLC_DHR_INBOUND;
+   diff = len - mbuf->pkt_len;
+   mbuf->pkt_len += diff;
+   mbuf->data_len += diff;
+
+   return op;
+}
+
+static inline struct rte_crypto_op *
+sec_fd_to_mbuf(const struct qbman_fd *fd, uint8_t driver_id)
 {
struct qbman_fle *fle;
struct rte_crypto_op *op;
struct ctxt_priv *priv;
 
+   if (DPAA2_FD_GET_FORMAT(fd) == qbman_fd_single)
+   return sec_simple_fd_to_mbuf(fd, driver_id);
+
fle = (struct qbman_fle *)DPAA2_IOVA_TO_VADDR(DPAA2_GET_FD_ADDR(fd));
 
PMD_RX_LOG(DEBUG, "FLE addr = %x - %x, offset = %x",
@@ -701,6 +770,7 @@ dpaa2_sec_dequeue_burst(void *qp, struct rte_crypto_op 
**ops,
 {
/* Function is responsible to receive frames for a given device and VQ*/
struct dpaa2_sec_qp *dpaa2_qp = (struct dpaa2_sec_qp *)qp;
+   struct rte_cryptodev *dev = (struct rte_cryptodev 
*)(dpaa2_qp->rx_vq.dev);
struct qbman_result *dq_storage;
uint32_t fqid = dpaa2_qp->rx_vq.fqid;
int ret, num_rx = 0;
@@ -770,7 +840,7 @@ dpaa2_sec_dequeue_burst(void *qp, struct rte_crypto_op 
**ops,
}
 
fd = qbman_result_DQ_fd(dq_storage);
-   ops[num_rx] = sec_fd_to_mbuf(fd);
+   ops[num_rx] = sec_fd_to_mbuf(fd, dev->driver_id);
 
if (unlikely(fd->simple.frc)) {
/* TODO Parse SEC errors */
@@ -1547,6 +1617,293 @@ dpaa2_sec_set_session_parameters(struct rte_cryptodev 
*dev,
 }
 
 static int
+dpaa2_sec_set_ipsec_

[dpdk-dev] [RFC PATCH 2/4] cryptodev: entend cryptodev to support security APIs

2017-08-14 Thread Akhil Goyal
cryptodev library is extended to support security APIs
Similar changes needs to be done for ether devices also
to support security APIs

Signed-off-by: Akhil Goyal 
---
 lib/librte_cryptodev/Makefile|  3 ++-
 lib/librte_cryptodev/rte_crypto_sym.h| 15 ++
 lib/librte_cryptodev/rte_cryptodev.h | 20 ++
 lib/librte_cryptodev/rte_cryptodev_pmd.h | 35 
 4 files changed, 58 insertions(+), 15 deletions(-)

diff --git a/lib/librte_cryptodev/Makefile b/lib/librte_cryptodev/Makefile
index 6ac331b..376a275 100644
--- a/lib/librte_cryptodev/Makefile
+++ b/lib/librte_cryptodev/Makefile
@@ -41,7 +41,7 @@ CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
 
 # library source files
-SRCS-y += rte_cryptodev.c rte_cryptodev_pmd.c
+SRCS-y += rte_cryptodev.c rte_cryptodev_pmd.c rte_security.c
 
 # export include files
 SYMLINK-y-include += rte_crypto.h
@@ -50,6 +50,7 @@ SYMLINK-y-include += rte_cryptodev.h
 SYMLINK-y-include += rte_cryptodev_pmd.h
 SYMLINK-y-include += rte_cryptodev_vdev.h
 SYMLINK-y-include += rte_cryptodev_pci.h
+SYMLINK-y-include += rte_security.h
 
 # versioning export map
 EXPORT_MAP := rte_cryptodev_version.map
diff --git a/lib/librte_cryptodev/rte_crypto_sym.h 
b/lib/librte_cryptodev/rte_crypto_sym.h
index 0ceaa91..d804e70 100644
--- a/lib/librte_cryptodev/rte_crypto_sym.h
+++ b/lib/librte_cryptodev/rte_crypto_sym.h
@@ -53,6 +53,19 @@ extern "C" {
 #include 
 #include 
 
+/**
+ * Crypto parameters range description
+ */
+struct rte_crypto_param_range {
+   uint16_t min;   /**< minimum size */
+   uint16_t max;   /**< maximum size */
+   uint16_t increment;
+   /**< if a range of sizes are supported,
+* this parameter is used to indicate
+* increments in byte size that are supported
+* between the minimum and maximum
+*/
+};
 
 /** Symmetric Cipher Algorithms */
 enum rte_crypto_cipher_algorithm {
@@ -505,6 +518,8 @@ struct rte_crypto_sym_op {
/**< Handle for the initialised session context */
struct rte_crypto_sym_xform *xform;
/**< Session-less API crypto operation parameters */
+   struct rte_security_session *sec_session;
+   /**< Handle for the initialised security session context */
};
 
RTE_STD_C11
diff --git a/lib/librte_cryptodev/rte_cryptodev.h 
b/lib/librte_cryptodev/rte_cryptodev.h
index 7ec9c4b..2a544e9 100644
--- a/lib/librte_cryptodev/rte_cryptodev.h
+++ b/lib/librte_cryptodev/rte_cryptodev.h
@@ -47,6 +47,7 @@ extern "C" {
 
 #include "rte_kvargs.h"
 #include "rte_crypto.h"
+#include "rte_security.h"
 #include "rte_dev.h"
 #include 
 #include 
@@ -114,20 +115,6 @@ extern const char **rte_cyptodev_names;
(phys_addr_t)((c)->phys_addr + (o))
 
 /**
- * Crypto parameters range description
- */
-struct rte_crypto_param_range {
-   uint16_t min;   /**< minimum size */
-   uint16_t max;   /**< maximum size */
-   uint16_t increment;
-   /**< if a range of sizes are supported,
-* this parameter is used to indicate
-* increments in byte size that are supported
-* between the minimum and maximum
-*/
-};
-
-/**
  * Symmetric Crypto Capability
  */
 struct rte_cryptodev_symmetric_capability {
@@ -376,6 +363,9 @@ struct rte_cryptodev_info {
const struct rte_cryptodev_capabilities *capabilities;
/**< Array of devices supported capabilities */
 
+   const struct rte_security_capabilities *sec_capabilities;
+   /**< Array of devices supported security capabilities */
+
unsigned max_nb_queue_pairs;
/**< Maximum number of queues pairs supported by device. */
 
@@ -745,6 +735,8 @@ struct rte_cryptodev {
/**< Pointer to device data */
struct rte_cryptodev_ops *dev_ops;
/**< Functions exported by PMD */
+   struct rte_security_ops *sec_ops;
+   /**< Security functions exported by PMD */
uint64_t feature_flags;
/**< Supported features */
struct rte_device *device;
diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h 
b/lib/librte_cryptodev/rte_cryptodev_pmd.h
index c983eb2..219fba6 100644
--- a/lib/librte_cryptodev/rte_cryptodev_pmd.h
+++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h
@@ -357,6 +357,41 @@ struct rte_cryptodev_ops {
/**< Detach session from queue pair. */
 };
 
+/**
+ * Configure a security session on a device.
+ *
+ * @param  dev Crypto device pointer
+ * @param  confSecurity session configuration
+ * @param  sessPointer to Security private session structure
+ * @param  mp  Mempool where the private session is allocated
+ *
+ * @return
+ *  - Returns 0 if private session structure have been created successfully.
+ *  - Returns -EINVAL if input parameters are invalid.
+ *  - Returns -ENOTSUP if crypto device does not support the crypto transform.
+ *  - Returns -ENOMEM if the p

[dpdk-dev] [RFC PATCH 4/4] example/ipsec-secgw: add support for offloading crypto op

2017-08-14 Thread Akhil Goyal
ipsec-secgw application is modified so that it can support
following type of actions for crypto operations
1. full protocol offload using crypto devices.
2. inline ipsec using ethernet devices to perform crypto operations
3. full protocol offload using ethernet devices.
4. non protocol offload

action type 1 is implemented as part of this patch.
action type 2 and 3 will be added as part of the original RFC in this
thread. action type 4 is already supported.

Signed-off-by: Akhil Goyal 
---
 examples/ipsec-secgw/ipsec.c | 125 +
 examples/ipsec-secgw/ipsec.h |  13 +++-
 examples/ipsec-secgw/sa.c| 142 ---
 3 files changed, 206 insertions(+), 74 deletions(-)

diff --git a/examples/ipsec-secgw/ipsec.c b/examples/ipsec-secgw/ipsec.c
index 0afb9d6..c8fde1c 100644
--- a/examples/ipsec-secgw/ipsec.c
+++ b/examples/ipsec-secgw/ipsec.c
@@ -37,6 +37,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -71,22 +72,40 @@ create_session(struct ipsec_ctx *ipsec_ctx, struct ipsec_sa 
*sa)
ipsec_ctx->tbl[cdev_id_qp].id,
ipsec_ctx->tbl[cdev_id_qp].qp);
 
-   sa->crypto_session = rte_cryptodev_sym_session_create(
-   ipsec_ctx->session_pool);
-   rte_cryptodev_sym_session_init(ipsec_ctx->tbl[cdev_id_qp].id,
-   sa->crypto_session, sa->xforms,
-   ipsec_ctx->session_pool);
-
-   rte_cryptodev_info_get(ipsec_ctx->tbl[cdev_id_qp].id, &cdev_info);
-   if (cdev_info.sym.max_nb_sessions_per_qp > 0) {
-   ret = rte_cryptodev_queue_pair_attach_sym_session(
-   ipsec_ctx->tbl[cdev_id_qp].id,
-   ipsec_ctx->tbl[cdev_id_qp].qp,
-   sa->crypto_session);
+   if (sa->type == RTE_SECURITY_SESS_NONE) {
+   sa->crypto_session = rte_cryptodev_sym_session_create(
+   ipsec_ctx->session_pool);
+   rte_cryptodev_sym_session_init(ipsec_ctx->tbl[cdev_id_qp].id,
+   sa->crypto_session, sa->xforms,
+   ipsec_ctx->session_pool);
+
+   rte_cryptodev_info_get(ipsec_ctx->tbl[cdev_id_qp].id, 
&cdev_info);
+   if (cdev_info.sym.max_nb_sessions_per_qp > 0) {
+   ret = rte_cryptodev_queue_pair_attach_sym_session(
+   ipsec_ctx->tbl[cdev_id_qp].id,
+   ipsec_ctx->tbl[cdev_id_qp].qp,
+   sa->crypto_session);
+   if (ret < 0) {
+   RTE_LOG(ERR, IPSEC,
+   "Session cannot be attached to qp %u ",
+   ipsec_ctx->tbl[cdev_id_qp].qp);
+   return -1;
+   }
+   }
+   } else {
+   struct rte_security_sess_conf sess_conf;
+
+   sa->sec_session = rte_security_session_create(
+   ipsec_ctx->session_pool);
+   sess_conf.action_type = sa->type;
+   sess_conf.protocol = RTE_SEC_CONF_IPSEC;
+   sess_conf.ipsec_xform = sa->sec_xform;
+
+   ret = rte_security_session_init(sa->portid, sa->sec_session,
+   &sess_conf, ipsec_ctx->session_pool);
if (ret < 0) {
-   RTE_LOG(ERR, IPSEC,
-   "Session cannot be attached to qp %u ",
-   ipsec_ctx->tbl[cdev_id_qp].qp);
+   RTE_LOG(ERR, IPSEC, "SEC Session init failed: err: %d",
+   ret);
return -1;
}
}
@@ -125,6 +144,7 @@ ipsec_enqueue(ipsec_xform_fn xform_func, struct ipsec_ctx 
*ipsec_ctx,
 {
int32_t ret = 0, i;
struct ipsec_mbuf_metadata *priv;
+   struct rte_crypto_sym_op *sym_cop;
struct ipsec_sa *sa;
 
for (i = 0; i < nb_pkts; i++) {
@@ -140,24 +160,50 @@ ipsec_enqueue(ipsec_xform_fn xform_func, struct ipsec_ctx 
*ipsec_ctx,
sa = sas[i];
priv->sa = sa;
 
-   priv->cop.type = RTE_CRYPTO_OP_TYPE_SYMMETRIC;
-   priv->cop.status = RTE_CRYPTO_OP_STATUS_NOT_PROCESSED;
-
-   rte_prefetch0(&priv->sym_cop);
-
-   if ((unlikely(sa->crypto_session == NULL)) &&
-   create_session(ipsec_ctx, sa)) {
-   rte_pktmbuf_free(pkts[i]);
-   continue;
-   }
-
-   rte_crypto_op_attach_sym_session(&priv->cop,
-   sa->crypto_session);
-
-   ret = xform_func(pkts[i], sa, &priv->cop);
-   if (unlikely(ret)) {
-

Re: [dpdk-dev] [PATCH] crypto/openssl: performance improvements

2017-08-14 Thread Akhil Goyal

On 8/14/2017 7:47 PM, De Lara Guarch, Pablo wrote:

Hi Akhil,


-Original Message-
From: Akhil Goyal [mailto:akhil.go...@nxp.com]
Sent: Friday, July 28, 2017 12:08 PM
To: dev@dpdk.org; Doherty, Declan 
Cc: De Lara Guarch, Pablo ;
hemant.agra...@nxp.com; Akhil Goyal 
Subject: [PATCH] crypto/openssl: performance improvements

key and algo are added in the openssl ctx during session initialization
instead of adding it for each packet.

Also in case of HMAC the openssl APIs HMAC_XXX give better performance
for all HMAC cases.

Signed-off-by: Akhil Goyal 


Thanks for the patch, nice optimization!
Could you split this into two patches, as you are doing two different things 
here?
One for the first sentence and another one for the second sentence.
Also, as you do that, could you rename the title to be more explicit?
Like: crypto/openssl: initialize cipher key at session init

Finally, I was looking at GCM, and I think it could benefit from this.
I will send a separate patch for it, unless you want to integrate it in this 
patchset yourself.



Ok I would split the patches.
For GCM I will try to incorporate in this patchset, if I get some 
performance improvement, or I would send a different patch later if some 
issue comes.


Thanks,
Akhil