[dpdk-dev] Set interfaces to bind

2015-11-10 Thread Victor Detoni
Hi,

is there some way to pin what port I want to use? For example, eth0 is my
port 1 and eth1 is my port 0?

Thanks
Victor


[dpdk-dev] [PATCH v6 00/10] Add installation rules for dpdk files

2015-11-10 Thread Arevalo, Mario Alfredo C
Hi Aaron,


I have been working on series of patches in order to improve 
the installation process of dpdk, I sent my first version at 
sep 18.

http://dpdk.org/ml/archives/dev/2015-September/023761.html

I have been received feedback from different developers as
Olivier, Bruce, Panu etc... and I have been taking note about it
and I have been improving the patches in each serie, at this
moment I haven't gotten a final answer, however I'm going to continue
working. :)

Mario.
Thanks.

From: Aaron Conole [acon...@redhat.com]
Sent: Tuesday, November 10, 2015 9:18 AM
To: Arevalo, Mario Alfredo C
Cc: dev at dpdk.org; Venegas Munoz, Jos C; Richardson, Bruce
Subject: Re: [dpdk-dev] [PATCH v6 00/10] Add installation rules for dpdk files

Hi Mario,

Mario Carrillo  writes:
> DPDK package lacks of a mechanism to install libraries, headers
> applications, kernel modules and sdk files to a file system tree.
> This patch set allows to install files based on the next
> proposal:
> http://www.freedesktop.org/software/systemd/man/file-hierarchy.html

I'm not sure what this patch holds, given the following proposal:

http://dpdk.org/ml/archives/dev/2015-November/02.html

-Aaron


[dpdk-dev] [PATCH v3 1/2] vhost: Add callback and private data for vhost PMD

2015-11-10 Thread Tetsuya Mukawa
On 2015/11/10 19:05, Panu Matilainen wrote:
> On 11/10/2015 11:48 AM, Tetsuya Mukawa wrote:
>> On 2015/11/10 16:16, Panu Matilainen wrote:
>>> On 11/10/2015 05:13 AM, Tetsuya Mukawa wrote:
 On 2015/11/10 3:16, Aaron Conole wrote:
> Greetings,
>
> Tetsuya Mukawa  writes:
>> These variables are needed to be able to manage one of virtio
>> devices
>> using both vhost library APIs and vhost PMD.
>> For example, if vhost PMD uses current callback handler and private
>> data
>> provided by vhost library, A DPDK application that links vhost
>> library
>> cannot use some of vhost library APIs. To avoid it, callback and
>> private
>> data for vhost PMD are needed.
>>
>> Signed-off-by: Tetsuya Mukawa 
>> ---
>>lib/librte_vhost/rte_vhost_version.map|  6 +++
>>lib/librte_vhost/rte_virtio_net.h |  3 ++
>>lib/librte_vhost/vhost_user/virtio-net-user.c | 13 +++
>>lib/librte_vhost/virtio-net.c | 56
>> +--
>>lib/librte_vhost/virtio-net.h |  4 +-
>>5 files changed, 70 insertions(+), 12 deletions(-)
>>
>> diff --git a/lib/librte_vhost/rte_vhost_version.map
>> b/lib/librte_vhost/rte_vhost_version.map
>> index 3d8709e..00a9ce5 100644
>> --- a/lib/librte_vhost/rte_vhost_version.map
>> +++ b/lib/librte_vhost/rte_vhost_version.map
>> @@ -20,3 +20,9 @@ DPDK_2.1 {
>>rte_vhost_driver_unregister;
>>
>>} DPDK_2.0;
>> +
>> +DPDK_2.2 {
>> +global:
>> +
>> +rte_vhost_driver_pmd_callback_register;
>> +} DPDK_2.1;
>> diff --git a/lib/librte_vhost/rte_virtio_net.h
>> b/lib/librte_vhost/rte_virtio_net.h
>> index 5687452..3ef6e58 100644
>> --- a/lib/librte_vhost/rte_virtio_net.h
>> +++ b/lib/librte_vhost/rte_virtio_net.h
>> @@ -128,6 +128,7 @@ struct virtio_net {
>>charifname[IF_NAME_SZ];/**< Name of the tap
>> device or socket path. */
>>uint32_tvirt_qp_nb;/**< number of queue pair we
>> have allocated */
>>void*priv;/**< private context */
>> +void*pmd_priv;/**< private context for vhost
>> PMD */
>>struct vhost_virtqueue*virtqueue[VHOST_MAX_QUEUE_PAIRS *
>> 2];/**< Contains all virtqueue information. */
>>} __rte_cache_aligned;
> Sorry if I'm missing something, but this is an ABI breaker, isn't
> it? I
> think this needs the RTE_NEXT_ABI tag around it.

 Hi Aaron,

 Thanks for reviewing. Yes, your are correct.
 I guess I can implement vhost PMD without this variable, so I will
 remove it.
>>>
>>> No need to.
>>>
>>> The librte_vhost ABI has already been broken during the DPDK 2.2 cycle
>>> by the multiqueue changes, but that's okay since it was announced
>>> during 2.1 cycle (in commit 3c848bd7b1c6f4f681b833322a748fdefbb5fb2d).
>>>
>>> What is missing right now is bumping the library version, and that
>>> must happen before 2.2 is released.
>>>
>>>  - Panu -
>>>
>>>
>>
>> Hi Panu,
>>
>> Thank you so much. Let me make sure what you mean.
>> I guess I need to add RTE_NEXT_ABI tags where pmd_priv is used. This is
>> because we don't break DPDK-2.1 ABI.
>> Anyway, the tag will be removed when DPDK-2.2 is released, then we can
>> use vhost PMD.
>> Is this correct?
>
> Not quite. Because the ABI has already been broken between 2.1 and
> 2.2, you can ride the same wave without messing with NEXT_ABI and such.
>
> Like said, librte_vhost is pending a LIBABIVER bump to 2, but that is
> regardless of this patch.
>
> - Panu -
>

Thanks. I can clearly understand.

Tetsuya



[dpdk-dev] [PATCH] i40e: fix compilation error on icc 2015

2015-11-10 Thread Thomas Monjalon
> > Fix for the following error on icc 2015, due to incorrect type:
> > drivers/net/i40e/i40e_fdir.c(1376): error #188: enumerated type mixed with
> > another type
> > case RTE_ETH_FDIR_FILTER_INPUT_SET_SELECT:
> >  ^
> > 
> > Fixes: 98f05570 ("i40e: configure input fields for RSS or flow director")
> > 
> > Signed-off-by: Pablo de Lara 
> Acked-by: Helin Zhang 

Applied, thanks


[dpdk-dev] [PATCH v3 1/2] vhost: Add callback and private data for vhost PMD

2015-11-10 Thread Tetsuya Mukawa
On 2015/11/10 16:16, Panu Matilainen wrote:
> On 11/10/2015 05:13 AM, Tetsuya Mukawa wrote:
>> On 2015/11/10 3:16, Aaron Conole wrote:
>>> Greetings,
>>>
>>> Tetsuya Mukawa  writes:
 These variables are needed to be able to manage one of virtio devices
 using both vhost library APIs and vhost PMD.
 For example, if vhost PMD uses current callback handler and private
 data
 provided by vhost library, A DPDK application that links vhost library
 cannot use some of vhost library APIs. To avoid it, callback and
 private
 data for vhost PMD are needed.

 Signed-off-by: Tetsuya Mukawa 
 ---
   lib/librte_vhost/rte_vhost_version.map|  6 +++
   lib/librte_vhost/rte_virtio_net.h |  3 ++
   lib/librte_vhost/vhost_user/virtio-net-user.c | 13 +++
   lib/librte_vhost/virtio-net.c | 56
 +--
   lib/librte_vhost/virtio-net.h |  4 +-
   5 files changed, 70 insertions(+), 12 deletions(-)

 diff --git a/lib/librte_vhost/rte_vhost_version.map
 b/lib/librte_vhost/rte_vhost_version.map
 index 3d8709e..00a9ce5 100644
 --- a/lib/librte_vhost/rte_vhost_version.map
 +++ b/lib/librte_vhost/rte_vhost_version.map
 @@ -20,3 +20,9 @@ DPDK_2.1 {
   rte_vhost_driver_unregister;

   } DPDK_2.0;
 +
 +DPDK_2.2 {
 +global:
 +
 +rte_vhost_driver_pmd_callback_register;
 +} DPDK_2.1;
 diff --git a/lib/librte_vhost/rte_virtio_net.h
 b/lib/librte_vhost/rte_virtio_net.h
 index 5687452..3ef6e58 100644
 --- a/lib/librte_vhost/rte_virtio_net.h
 +++ b/lib/librte_vhost/rte_virtio_net.h
 @@ -128,6 +128,7 @@ struct virtio_net {
   charifname[IF_NAME_SZ];/**< Name of the tap
 device or socket path. */
   uint32_tvirt_qp_nb;/**< number of queue pair we
 have allocated */
   void*priv;/**< private context */
 +void*pmd_priv;/**< private context for vhost
 PMD */
   struct vhost_virtqueue*virtqueue[VHOST_MAX_QUEUE_PAIRS *
 2];/**< Contains all virtqueue information. */
   } __rte_cache_aligned;
>>> Sorry if I'm missing something, but this is an ABI breaker, isn't it? I
>>> think this needs the RTE_NEXT_ABI tag around it.
>>
>> Hi Aaron,
>>
>> Thanks for reviewing. Yes, your are correct.
>> I guess I can implement vhost PMD without this variable, so I will
>> remove it.
>
> No need to.
>
> The librte_vhost ABI has already been broken during the DPDK 2.2 cycle
> by the multiqueue changes, but that's okay since it was announced
> during 2.1 cycle (in commit 3c848bd7b1c6f4f681b833322a748fdefbb5fb2d).
>
> What is missing right now is bumping the library version, and that
> must happen before 2.2 is released.
>
> - Panu -
>
>

Hi Panu,

Thank you so much. Let me make sure what you mean.
I guess I need to add RTE_NEXT_ABI tags where pmd_priv is used. This is
because we don't break DPDK-2.1 ABI.
Anyway, the tag will be removed when DPDK-2.2 is released, then we can
use vhost PMD.
Is this correct?

Thanks,
Tetsuya



[dpdk-dev] [PATCH v6 02/10] ethdev: make error checking macros public

2015-11-10 Thread Adrien Mazarguil
On Tue, Nov 10, 2015 at 05:32:35PM +, Declan Doherty wrote:
> Move the function pointer and port id checking macros to rte_ethdev and
> rte_dev header files, so that they can be used in the static inline
> functions there. Also replace the RTE_LOG call within
> RTE_PMD_DEBUG_TRACE so this macro can be built with the -pedantic flag
> 
> Signed-off-by: Declan Doherty 

Acked-by: Adrien Mazarguil 

-- 
Adrien Mazarguil
6WIND


[dpdk-dev] DPDK ArmV7 autotests

2015-11-10 Thread Jerin Jacob
On Tue, Nov 10, 2015 at 11:30:30AM +0100, Thomas Monjalon wrote:
> 2015-11-10 10:22, Hunt, David:
> > On 09/11/2015 17:46, Jan Viktorin wrote:
> >  > Here is the log. You an see, that many tests fail just because
> >  > of the missing hugetlb support. This is strange as I modified the
> >  > autotest_runner.py to inject "--no-huge --no-pci" options when it
> >  > detects armv7 architecture.
> > 
> > I think publishing these test results to the mailing list confuses 
> > matters somewhat. The tests are not tuned for armv7, and there are many 
> > false negatives, giving the impression that the results are worse than 
> > they actually should be.
> > 
> > The tests need to be analysed to see if they respect the --no-huge and 
> > --no-pci flags correctly, I suspect some tests are being run even though 
> > these flags are enabled.
> > 
> > I believe enough of the tests pass to allow the initial version of the 
> > patch set to be accepted. We can look at the failing cases later, and 
> > improve the test suite as time goes on.
> 
> I agree.
> The unit tests are know to require some refactoring.
> I suggest to continue ARM integration while checking how to fix the

Make sense.

> unit tests later. Maybe that Declan has some ideas or plans about the tests.

I have tried autotest on armv8, results looks very promising.

Few more features need for armv8 port like lpm, optimized hash,
removing x86 dependencies from examples directory etc.
But these needs change in the common code
so IMO have existing code as base port and common code
changes we will add step by step otherwise it will be difficult manage.

root at arm64:/export/dpdk-armv8# python app/test/autotest.py  build/app/test
build
build/app/test -c f -n 4

Test name  Test result  Test
Total

Start group_1: Success   [00m 02s]
Timer autotest:Success   [00m 41s]
Debug autotest:Success   [00m 00s]
Errno autotest:Success   [00m 00s]
Meter autotest:Success   [00m 00s]
Common autotest:   Success   [00m 01s]
Dump log history:  Success   [00m 00s]
Dump rings:Success   [00m 00s]
Dump mempools: Success   [00m 00s][00m 46s]
Start group_2: Success   [00m 02s]
Memory autotest:   Success   [00m 01s]
Read/write lock autotest:  Success   [00m 00s]
Logs autotest: Success   [00m 00s]
CPU flags autotest:Success   [00m 00s]
Version autotest:  Success   [00m 00s]
EAL filesystem autotest:   Success   [00m 00s]
EAL flags autotest:Fail(failes on x86 too)   [00m 00s]
Hash autotest: Success   [05m 04s][05m 55s]
Start group_3: Success   [00m 02s]
LPM autotest:  Fail [Not found]  [00m 00s]
IVSHMEM autotest:  Fail [Not found](NA for arm64)[00m 00s]
Memcpy autotest:   Success   [00m 21s]
Memzone autotest:  Success   [00m 00s]
String autotest:   Success   [00m 00s]
Alarm autotest:Fail(failes on x86 too)   [00m 00s][06m 20s]
Start group_4: Success   [00m 02s]
PCI autotest:  Success   [00m 00s]
Malloc autotest:   Success   [00m 00s]
Multi-process autotest:Fail(failes on x86 too)   [00m 03s]
Mbuf autotest: Success   [01m 04s]
Per-lcore autotest:Success   [00m 05s]
Ring autotest: Success   [00m 02s][07m 37s]
Start group_5: Success   [00m 02s]
Spinlock autotest: Success   [00m 15s]
Byte order autotest:   Success   [00m 00s]
TAILQ autotest:Success   [00m 00s]
Command-line autotest: Success   [00m 00s]
Interrupts autotest:   Success   [00m 08s][08m 03s]
Start group_6: Success   [00m 02s]
Function reentrancy autotest:  Success   [00m 00s]
Mempool autotest:  Success   [00m 08s]
Atomics autotest:  Success   [00m 00s]
Prefetch autotest: Success   [00m 00s]
Red 

[dpdk-dev] [PATCH v3 2/4] ethdev: move error checking macros to header

2015-11-10 Thread Adrien Mazarguil
On Tue, Nov 10, 2015 at 04:21:10PM +, Richardson, Bruce wrote:
> 
> 
> > -Original Message-
> > From: Adrien Mazarguil [mailto:adrien.mazarguil at 6wind.com]
> > Sent: Tuesday, November 10, 2015 4:08 PM
> > To: Richardson, Bruce 
> > Cc: Stephen Hemminger ; Thomas Monjalon
> > ; dev at dpdk.org
> > Subject: Re: [dpdk-dev] [PATCH v3 2/4] ethdev: move error checking macros
> > to header
> > 
> > On Mon, Nov 09, 2015 at 02:02:28PM +, Richardson, Bruce wrote:
> > [...]
> > > > From: Adrien Mazarguil [mailto:adrien.mazarguil at 6wind.com]
> > [...]
> > > > Untested but I guess modifying that function accordingly would look
> > like:
> > > >
> > > >  static inline void
> > > >  rte_pmd_debug_trace(const char *func_name, const char *fmt, ...)  {
> > > >  va_list ap;
> > > >  va_start(ap, fmt);
> > > >
> > > >  static __thread char buffer[vsnprintf(NULL, 0, fmt, ap)];
> > > >
> > > >  va_end(ap);
> > > >  va_start(ap, fmt);
> > > >  vsnprintf(buffer, sizeof(buffer), fmt, ap);
> > > >  va_end(ap);
> > > >  rte_log(RTE_LOG_ERR, RTE_LOGTYPE_PMD, "%s: %s", func_name,
> > > > buffer);  }
> > > >
> > >
> > > Looks a much better option.
> > >
> > > From this, though, I assume then that we are only looking to support the
> > -pedantic flag in conjuction with c99 mode or above. Supporting -pedantic
> > with the pre-gcc-5 versions won't allow that to work though, as variably
> > sized arrays only came in with c99, and were gnu extensions before that.
> > 
> > Right, -pedantic must follow a given standard such as -std=gnu99 otherwise
> > it's meaningless.
> > 
> > However pre-GCC 5 is fine for most if not all features we use, see:
> > 
> >  https://gcc.gnu.org/c99status.html
> > 
> > Mixed code and declarations are supported since GCC 3.0, __VA_ARGS__ in
> > macros since GCC 2.95 and variable length arrays since GCC 0.9, so as long
> > as we use a version that implements -std=gnu99 (or -std=c99 to be really
> > pedantic), it's fine.
> > 
> > Besides DPDK already uses C99 extensively, even a few C11 features (such
> > as
> > embedded anonymous struct definitions) currently supported in C99 mode as
> > compiler extensions. I think we can safely ignore compilers that don't
> > support common C99 features.
> > 
> > --
> > Adrien Mazarguil
> > 6WIND
> 
> Actually my point was slightly different. 
> If we are supporting "-pedantic" in header files because "we don't know what 
> compiler flags users are going to pass when", then we need to support it in 
> C90 mode to do the job properly. If you take gcc 4.8 and compile some code 
> with "-pedantic" as the only C-flag you are going to get lots of errors 
> because it will default to C90 mode with pedantic, which means no varargs 
> macros at all. 

Agreed, exported headers should actually be C90 compliant for these reasons
but C99 would be a start. I didn't know GCC 5 switched to C99 by default
(don't worry, I do not intend to go back to C90).

> This limits the usefulness of supporting pedantic flag at all in our header 
> files, since we only support it in certain situations with non-latest 
> compilers.

I won't deny this, as the goal is partly to appease pedantic people like
myself. Using standard methods for doing things should be preferred over
extensions for compatibility with the unknown, unless there is no other way.

-- 
Adrien Mazarguil
6WIND


[dpdk-dev] [PATCH v3] i40e: fix resetting of stats

2015-11-10 Thread Thomas Monjalon
2015-11-09 10:22, Harry van Haaren:
> This patch fixes a bug where only some of the statistics were being
> reset when calling rte_eth_stats_reset() or rte_eth_xstats_reset().
> As both the stats reset and xstats reset do the same, refactor away
> the duplicated function.
> 
> This patch marks the VSI to update its offset, causing the stats be
> look like they are reset.
> 
> Fixes: 9aace75fc82e ("i40e: fix statistics")
> 
> Signed-off-by: Harry van Haaren 
> Acked-by: Maryam Tahhan 

Applied, thanks



[dpdk-dev] [PATCH v6 10/10] l2fwd-crypto: crypto

2015-11-10 Thread Declan Doherty
This patch creates a new sample applicaiton based off the l2fwd
application which performs specified crypto operations on IP packet
payloads which are forwarding.

Acked-by: Sergio Gonzalez Monroy 
Signed-off-by: Declan Doherty 
---
 MAINTAINERS|1 +
 examples/l2fwd-crypto/Makefile |   50 ++
 examples/l2fwd-crypto/main.c   | 1473 
 3 files changed, 1524 insertions(+)
 create mode 100644 examples/l2fwd-crypto/Makefile
 create mode 100644 examples/l2fwd-crypto/main.c

diff --git a/MAINTAINERS b/MAINTAINERS
index 1f72f8c..fa85e55 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -206,6 +206,7 @@ F: lib/librte_cryptodev
 F: docs/guides/cryptodevs
 F: app/test/test_cryptodev.c
 F: app/test/test_cryptodev_perf.c
+F: examples/l2fwd-crypto

 Drivers
 ---
diff --git a/examples/l2fwd-crypto/Makefile b/examples/l2fwd-crypto/Makefile
new file mode 100644
index 000..e8224ca
--- /dev/null
+++ b/examples/l2fwd-crypto/Makefile
@@ -0,0 +1,50 @@
+#   BSD LICENSE
+#
+#   Copyright(c) 2010-2014 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.
+
+ifeq ($(RTE_SDK),)
+$(error "Please define RTE_SDK environment variable")
+endif
+
+# Default target, can be overridden by command line or environment
+RTE_TARGET ?= x86_64-native-linuxapp-gcc
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+# binary name
+APP = l2fwd-crypto
+
+# all source are stored in SRCS-y
+SRCS-y := main.c
+
+CFLAGS += -O3
+CFLAGS += $(WERROR_FLAGS)
+
+include $(RTE_SDK)/mk/rte.extapp.mk
diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c
new file mode 100644
index 000..10ec513
--- /dev/null
+++ b/examples/l2fwd-crypto/main.c
@@ -0,0 +1,1473 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2010-2014 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 

[dpdk-dev] [PATCH v6 09/10] app/test: add cryptodev unit and performance tests

2015-11-10 Thread Declan Doherty
unit tests are run by using cryptodev_qat_autotest or
cryptodev_aesni_autotest from the test apps interactive console.

performance tests are run by using the cryptodev_qat_perftest or
cryptodev_aesni_mb_perftest command from the test apps interactive
console.

If you which to run the tests on a QAT device there must be one
bound to igb_uio kernel driver.

Signed-off-by: Declan Doherty 
Signed-off-by: John Griffin 
Signed-off-by: Des O Dea 
Signed-off-by: Fiona Trahe 

Acked-by: Sergio Gonzalez Monroy 
Signed-off-by: Declan Doherty 
---
 MAINTAINERS  |2 +
 app/test/Makefile|4 +
 app/test/test.c  |   92 +-
 app/test/test.h  |   34 +-
 app/test/test_cryptodev.c| 1986 
 app/test/test_cryptodev.h|   68 ++
 app/test/test_cryptodev_perf.c   | 2062 ++
 app/test/test_link_bonding.c |6 +-
 app/test/test_link_bonding_mode4.c   |7 +-
 app/test/test_link_bonding_rssconf.c |7 +-
 10 files changed, 4219 insertions(+), 49 deletions(-)
 create mode 100644 app/test/test_cryptodev.c
 create mode 100644 app/test/test_cryptodev.h
 create mode 100644 app/test/test_cryptodev_perf.c

diff --git a/MAINTAINERS b/MAINTAINERS
index 2d5808c..1f72f8c 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -204,6 +204,8 @@ Crypto API
 M: Declan Doherty 
 F: lib/librte_cryptodev
 F: docs/guides/cryptodevs
+F: app/test/test_cryptodev.c
+F: app/test/test_cryptodev_perf.c

 Drivers
 ---
diff --git a/app/test/Makefile b/app/test/Makefile
index de63235..ec33e1a 100644
--- a/app/test/Makefile
+++ b/app/test/Makefile
@@ -149,6 +149,10 @@ endif

 SRCS-$(CONFIG_RTE_LIBRTE_PMD_RING) += test_pmd_ring.c
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_RING) += test_pmd_ring_perf.c
+
+SRCS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += test_cryptodev_perf.c
+SRCS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += test_cryptodev.c
+
 SRCS-$(CONFIG_RTE_LIBRTE_KVARGS) += test_kvargs.c

 CFLAGS += -O3
diff --git a/app/test/test.c b/app/test/test.c
index b94199a..f35b304 100644
--- a/app/test/test.c
+++ b/app/test/test.c
@@ -159,51 +159,81 @@ main(int argc, char **argv)
 int
 unit_test_suite_runner(struct unit_test_suite *suite)
 {
-   int retval, i = 0;
+   int test_success;
+   unsigned total = 0, executed = 0, skipped = 0, succeeded = 0, failed = 
0;

if (suite->suite_name)
-   printf("Test Suite : %s\n", suite->suite_name);
+   printf(" + 
--- +\n");
+   printf(" + Test Suite : %s\n", suite->suite_name);

if (suite->setup)
if (suite->setup() != 0)
-   return -1;
-
-   while (suite->unit_test_cases[i].testcase) {
-   /* Run test case setup */
-   if (suite->unit_test_cases[i].setup) {
-   retval = suite->unit_test_cases[i].setup();
-   if (retval != 0)
-   return retval;
-   }
+   goto suite_summary;

-   /* Run test case */
-   if (suite->unit_test_cases[i].testcase() == 0) {
-   printf("TestCase %2d: %s\n", i,
-   suite->unit_test_cases[i].success_msg ?
-   suite->unit_test_cases[i].success_msg :
-   "passed");
-   }
-   else {
-   printf("TestCase %2d: %s\n", i, 
suite->unit_test_cases[i].fail_msg ?
-   suite->unit_test_cases[i].fail_msg :
-   "failed");
-   return -1;
+   printf(" + --- 
+\n");
+
+   while (suite->unit_test_cases[total].testcase) {
+   if (!suite->unit_test_cases[total].enabled) {
+   skipped++;
+   total++;
+   continue;
+   } else {
+   executed++;
}

-   /* Run test case teardown */
-   if (suite->unit_test_cases[i].teardown) {
-   retval = suite->unit_test_cases[i].teardown();
-   if (retval != 0)
-   return retval;
+   /* run test case setup */
+   if (suite->unit_test_cases[total].setup)
+   test_success = suite->unit_test_cases[total].setup();
+   else
+   test_success = TEST_SUCCESS;
+
+   if (test_success == TEST_SUCCESS) {
+   /* run the test case */
+   test_success = suite->unit_test_cases[total].testcase();
+   if (test_success == TEST_SUCCESS)
+   succeeded++;
+ 

[dpdk-dev] [PATCH v6 08/10] aesni_mb_pmd: Initial implementation of multi buffer based crypto device

2015-11-10 Thread Declan Doherty
This patch provides the initial implementation of the AES-NI multi-buffer
based crypto poll mode driver using DPDK's new cryptodev framework.

This PMD is dependent on Intel's multibuffer library, see the whitepaper
"Fast Multi-buffer IPsec Implementations on Intel? Architecture
Processors", see ref 1 for details on the library's design and ref 2 to
download the library itself. This initial implementation is limited to
supporting the chained operations of "hash then cipher" or "cipher then
hash" for the following cipher and hash algorithms:

Cipher algorithms:
  - RTE_CRYPTO_CIPHER_AES128_CBC
  - RTE_CRYPTO_CIPHER_AES256_CBC
  - RTE_CRYPTO_CIPHER_AES512_CBC

Hash algorithms:
  - RTE_CRYPTO_AUTH_SHA1_HMAC
  - RTE_CRYPTO_AUTH_SHA256_HMAC
  - RTE_CRYPTO_AUTH_SHA512_HMAC
  - RTE_CRYPTO_AUTH_AES_XCBC_MAC

Important Note:
Due to the fact that the multi-buffer library is designed for
accelerating IPsec crypto oepration, the digest's generated for the HMAC
functions are truncated to lengths specified by IPsec RFC's, ie RFC2404
for using HMAC-SHA-1 with IPsec specifies that the digest is truncate
from 20 to 12 bytes.

Build instructions:
To build DPKD with the AESNI_MB_PMD the user is required to download
(ref 2) and compile the multi-buffer library on there user system before
building DPDK. The environmental variable AESNI_MULTI_BUFFER_LIB_PATH
must be exported with the path where you extracted and built the multi
buffer library and finally set CONFIG_RTE_LIBRTE_PMD_AESNI_MB=y in
config/common_linuxapp.

Current status: It's doesn't support crypto operation
across chained mbufs, or cipher only or hash only operations.

ref 1:
https://www-ssl.intel.com/content/www/us/en/intelligent-systems/intel-technology/fast-multi-buffer-ipsec-implementations-ia-processors-p

ref 2: https://downloadcenter.intel.com/download/22972

Acked-by: Sergio Gonzalez Monroy 
Signed-off-by: Declan Doherty 
---
 MAINTAINERS|   3 +
 config/common_bsdapp   |   7 +
 config/common_linuxapp |   7 +
 doc/guides/cryptodevs/aesni_mb.rst |  76 +++
 doc/guides/cryptodevs/index.rst|   1 +
 drivers/crypto/Makefile|   1 +
 drivers/crypto/aesni_mb/Makefile   |  63 ++
 drivers/crypto/aesni_mb/aesni_mb_ops.h | 210 +++
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 669 +
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c | 298 +
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h | 229 +++
 drivers/crypto/aesni_mb/rte_pmd_aesni_version.map  |   3 +
 mk/rte.app.mk  |   4 +
 13 files changed, 1571 insertions(+)
 create mode 100644 doc/guides/cryptodevs/aesni_mb.rst
 create mode 100644 drivers/crypto/aesni_mb/Makefile
 create mode 100644 drivers/crypto/aesni_mb/aesni_mb_ops.h
 create mode 100644 drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
 create mode 100644 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c
 create mode 100644 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h
 create mode 100644 drivers/crypto/aesni_mb/rte_pmd_aesni_version.map

diff --git a/MAINTAINERS b/MAINTAINERS
index 73d9578..2d5808c 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -303,6 +303,9 @@ Null PMD
 M: Tetsuya Mukawa 
 F: drivers/net/null/

+Crypto AES-NI Multi-Buffer PMD
+M: Declan Doherty 
+F: driver/crypto/aesni_mb

 Packet processing
 -
diff --git a/config/common_bsdapp b/config/common_bsdapp
index 0068b20..a18e817 100644
--- a/config/common_bsdapp
+++ b/config/common_bsdapp
@@ -168,6 +168,13 @@ CONFIG_RTE_LIBRTE_QAT_DEBUG_DRIVER=n
 #
 CONFIG_RTE_MAX_QAT_SESSIONS=200

+
+#
+# Compile PMD for AESNI backed device
+#
+CONFIG_RTE_LIBRTE_PMD_AESNI_MB=n
+CONFIG_RTE_LIBRTE_AESNI_MB_DEBUG=n
+
 #
 # Support NIC bypass logic
 #
diff --git a/config/common_linuxapp b/config/common_linuxapp
index b29d3dd..d9c8c5c 100644
--- a/config/common_linuxapp
+++ b/config/common_linuxapp
@@ -166,6 +166,13 @@ CONFIG_RTE_LIBRTE_PMD_QAT_DEBUG_DRIVER=n
 #
 CONFIG_RTE_QAT_PMD_MAX_NB_SESSIONS=2048

+# Compile PMD for AESNI backed device
+#
+CONFIG_RTE_LIBRTE_PMD_AESNI_MB=n
+CONFIG_RTE_LIBRTE_PMD_AESNI_MB_DEBUG=n
+CONFIG_RTE_AESNI_MB_PMD_MAX_NB_QUEUE_PAIRS=8
+CONFIG_RTE_AESNI_MB_PMD_MAX_NB_SESSIONS=2048
+
 #
 # Support NIC bypass logic
 #
diff --git a/doc/guides/cryptodevs/aesni_mb.rst 
b/doc/guides/cryptodevs/aesni_mb.rst
new file mode 100644
index 000..826b632
--- /dev/null
+++ b/doc/guides/cryptodevs/aesni_mb.rst
@@ -0,0 +1,76 @@
+..  BSD LICENSE
+Copyright(c) 2015 Intel Corporation. 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 

[dpdk-dev] [PATCH v6 07/10] qat_crypto_pmd: Addition of a new QAT DPDK PMD.

2015-11-10 Thread Declan Doherty
This patch adds a PMD for the Intel Quick Assist Technology DH895xxC
hardware accelerator.

This patch depends on a QAT PF driver for device initialization. See
the file docs/guides/cryptodevs/qat.rst for configuration details

This patch supports a limited subset of QAT device functionality,
currently supporting chaining of cipher and hash operations for the
following algorithmsd:

Cipher algorithms:
  - RTE_CRYPTO_CIPHER_AES128_CBC
  - RTE_CRYPTO_CIPHER_AES256_CBC
  - RTE_CRYPTO_CIPHER_AES512_CBC

Hash algorithms:
  - RTE_CRYPTO_AUTH_SHA1_HMAC
  - RTE_CRYPTO_AUTH_SHA256_HMAC
  - RTE_CRYPTO_AUTH_SHA512_HMAC
  - RTE_CRYPTO_AUTH_AES_XCBC_MAC

Some limitation on this patchset which shall be contributed in a
subsequent release:
 - Chained mbufs are not supported.
 - Hash only is not supported.
 - Cipher only is not supported.
 - Only in-place is currently supported (destination address is
   the same as source address).
 - Only supports session-oriented API implementation (session-less
   APIs are not supported).

Signed-off-by: Declan Doherty 
Signed-off-by: John Griffin 
Signed-off-by: Des O Dea 
Signed-off-by: Fiona Trahe 

Acked-by: Sergio Gonzalez Monroy 
Signed-off-by: Declan Doherty 
---
 config/common_bsdapp   |  14 +
 config/common_linuxapp |  14 +
 doc/guides/cryptodevs/index.rst|  42 ++
 doc/guides/cryptodevs/qat.rst  | 194 +++
 doc/guides/index.rst   |   1 +
 drivers/Makefile   |   1 +
 drivers/crypto/Makefile|  37 ++
 drivers/crypto/qat/Makefile|  63 +++
 .../qat/qat_adf/adf_transport_access_macros.h  | 174 ++
 drivers/crypto/qat/qat_adf/icp_qat_fw.h| 316 +++
 drivers/crypto/qat/qat_adf/icp_qat_fw_la.h | 404 ++
 drivers/crypto/qat/qat_adf/icp_qat_hw.h| 306 +++
 drivers/crypto/qat/qat_adf/qat_algs.h  | 125 +
 drivers/crypto/qat/qat_adf/qat_algs_build_desc.c   | 601 +
 drivers/crypto/qat/qat_crypto.c| 561 +++
 drivers/crypto/qat/qat_crypto.h| 124 +
 drivers/crypto/qat/qat_logs.h  |  78 +++
 drivers/crypto/qat/qat_qp.c| 429 +++
 drivers/crypto/qat/rte_pmd_qat_version.map |   3 +
 drivers/crypto/qat/rte_qat_cryptodev.c | 137 +
 lib/librte_mbuf_offload/rte_mbuf_offload.h |   9 +-
 mk/rte.app.mk  |   3 +
 22 files changed, 3628 insertions(+), 8 deletions(-)
 create mode 100644 doc/guides/cryptodevs/index.rst
 create mode 100644 doc/guides/cryptodevs/qat.rst
 create mode 100644 drivers/crypto/Makefile
 create mode 100644 drivers/crypto/qat/Makefile
 create mode 100644 drivers/crypto/qat/qat_adf/adf_transport_access_macros.h
 create mode 100644 drivers/crypto/qat/qat_adf/icp_qat_fw.h
 create mode 100644 drivers/crypto/qat/qat_adf/icp_qat_fw_la.h
 create mode 100644 drivers/crypto/qat/qat_adf/icp_qat_hw.h
 create mode 100644 drivers/crypto/qat/qat_adf/qat_algs.h
 create mode 100644 drivers/crypto/qat/qat_adf/qat_algs_build_desc.c
 create mode 100644 drivers/crypto/qat/qat_crypto.c
 create mode 100644 drivers/crypto/qat/qat_crypto.h
 create mode 100644 drivers/crypto/qat/qat_logs.h
 create mode 100644 drivers/crypto/qat/qat_qp.c
 create mode 100644 drivers/crypto/qat/rte_pmd_qat_version.map
 create mode 100644 drivers/crypto/qat/rte_qat_cryptodev.c

diff --git a/config/common_bsdapp b/config/common_bsdapp
index ba2533a..0068b20 100644
--- a/config/common_bsdapp
+++ b/config/common_bsdapp
@@ -155,6 +155,20 @@ CONFIG_RTE_CRYPTO_MAX_DEVS=64
 CONFIG_RTE_CRYPTODEV_NAME_LEN=64

 #
+# Compile PMD for QuickAssist based devices
+#
+CONFIG_RTE_LIBRTE_PMD_QAT=n
+CONFIG_RTE_LIBRTE_QAT_DEBUG_INIT=n
+CONFIG_RTE_LIBRTE_QAT_DEBUG_TX=n
+CONFIG_RTE_LIBRTE_QAT_DEBUG_RX=n
+CONFIG_RTE_LIBRTE_QAT_DEBUG_DRIVER=n
+#
+# Number of sessions to create in the session memory pool
+# on a single QuickAssist device.
+#
+CONFIG_RTE_MAX_QAT_SESSIONS=200
+
+#
 # Support NIC bypass logic
 #
 CONFIG_RTE_NIC_BYPASS=n
diff --git a/config/common_linuxapp b/config/common_linuxapp
index 4c52f78..b29d3dd 100644
--- a/config/common_linuxapp
+++ b/config/common_linuxapp
@@ -153,6 +153,20 @@ CONFIG_RTE_CRYPTO_MAX_DEVS=64
 CONFIG_RTE_CRYPTODEV_NAME_LEN=64

 #
+# Compile PMD for QuickAssist based devices
+#
+CONFIG_RTE_LIBRTE_PMD_QAT=n
+CONFIG_RTE_LIBRTE_PMD_QAT_DEBUG_INIT=n
+CONFIG_RTE_LIBRTE_PMD_QAT_DEBUG_TX=n
+CONFIG_RTE_LIBRTE_PMD_QAT_DEBUG_RX=n
+CONFIG_RTE_LIBRTE_PMD_QAT_DEBUG_DRIVER=n
+#
+# Number of sessions to create in the session memory pool
+# on a single QuickAssist device.
+#
+CONFIG_RTE_QAT_PMD_MAX_NB_SESSIONS=2048
+
+#
 # Support NIC bypass logic
 #
 CONFIG_RTE_NIC_BYPASS=n
diff --git a/doc/guides/cryptodevs/index.rst 

[dpdk-dev] [PATCH v6 06/10] mbuf_offload: library to support attaching offloads to a mbuf

2015-11-10 Thread Declan Doherty
This library add support for adding a chain of offload operations to a
mbuf. It contains the definition of the rte_mbuf_offload structure as
well as helper functions for attaching  offloads to mbufs and a mempool
management functions.

This initial implementation supports attaching multiple offload
operations to a single mbuf, but only a single offload operation of a
specific type can be attach to that mbuf.

Signed-off-by: Declan Doherty 
Acked-by: Konstantin Ananyev 
---
 MAINTAINERS|   4 +
 config/common_bsdapp   |   6 +
 config/common_linuxapp |   6 +
 lib/Makefile   |   1 +
 lib/librte_mbuf/rte_mbuf.h |   6 +
 lib/librte_mbuf_offload/Makefile   |  52 
 lib/librte_mbuf_offload/rte_mbuf_offload.c | 100 +++
 lib/librte_mbuf_offload/rte_mbuf_offload.h | 291 +
 .../rte_mbuf_offload_version.map   |   7 +
 mk/rte.app.mk  |   1 +
 10 files changed, 474 insertions(+)
 create mode 100644 lib/librte_mbuf_offload/Makefile
 create mode 100644 lib/librte_mbuf_offload/rte_mbuf_offload.c
 create mode 100644 lib/librte_mbuf_offload/rte_mbuf_offload.h
 create mode 100644 lib/librte_mbuf_offload/rte_mbuf_offload_version.map

diff --git a/MAINTAINERS b/MAINTAINERS
index 68c6d74..73d9578 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -191,6 +191,10 @@ F: lib/librte_mbuf/
 F: doc/guides/prog_guide/mbuf_lib.rst
 F: app/test/test_mbuf.c

+Packet buffer offload
+M: Declan Doherty 
+F: lib/librte_mbuf_offload/
+
 Ethernet API
 M: Thomas Monjalon 
 F: lib/librte_ether/
diff --git a/config/common_bsdapp b/config/common_bsdapp
index 8803350..ba2533a 100644
--- a/config/common_bsdapp
+++ b/config/common_bsdapp
@@ -332,6 +332,12 @@ CONFIG_RTE_MBUF_REFCNT_ATOMIC=y
 CONFIG_RTE_PKTMBUF_HEADROOM=128

 #
+# Compile librte_mbuf_offload
+#
+CONFIG_RTE_LIBRTE_MBUF_OFFLOAD=y
+CONFIG_RTE_LIBRTE_MBUF_OFFLOAD_DEBUG=n
+
+#
 # Compile librte_timer
 #
 CONFIG_RTE_LIBRTE_TIMER=y
diff --git a/config/common_linuxapp b/config/common_linuxapp
index 815bea3..4c52f78 100644
--- a/config/common_linuxapp
+++ b/config/common_linuxapp
@@ -340,6 +340,12 @@ CONFIG_RTE_MBUF_REFCNT_ATOMIC=y
 CONFIG_RTE_PKTMBUF_HEADROOM=128

 #
+# Compile librte_mbuf_offload
+#
+CONFIG_RTE_LIBRTE_MBUF_OFFLOAD=y
+CONFIG_RTE_LIBRTE_MBUF_OFFLOAD_DEBUG=n
+
+#
 # Compile librte_timer
 #
 CONFIG_RTE_LIBRTE_TIMER=y
diff --git a/lib/Makefile b/lib/Makefile
index 4c5c1b4..ef172ea 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -36,6 +36,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_EAL) += librte_eal
 DIRS-$(CONFIG_RTE_LIBRTE_RING) += librte_ring
 DIRS-$(CONFIG_RTE_LIBRTE_MEMPOOL) += librte_mempool
 DIRS-$(CONFIG_RTE_LIBRTE_MBUF) += librte_mbuf
+DIRS-$(CONFIG_RTE_LIBRTE_MBUF_OFFLOAD) += librte_mbuf_offload
 DIRS-$(CONFIG_RTE_LIBRTE_TIMER) += librte_timer
 DIRS-$(CONFIG_RTE_LIBRTE_CFGFILE) += librte_cfgfile
 DIRS-$(CONFIG_RTE_LIBRTE_CMDLINE) += librte_cmdline
diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index ef1ee26..0b6741a 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -728,6 +728,9 @@ typedef uint8_t  MARKER8[0];  /**< generic marker with 1B 
alignment */
 typedef uint64_t MARKER64[0]; /**< marker that allows us to overwrite 8 bytes
* with a single assignment */

+/** Opaque rte_mbuf_offload  structure declarations */
+struct rte_mbuf_offload;
+
 /**
  * The generic rte_mbuf, containing a packet mbuf.
  */
@@ -841,6 +844,9 @@ struct rte_mbuf {

/** Timesync flags for use with IEEE1588. */
uint16_t timesync;
+
+   /* Chain of off-load operations to perform on mbuf */
+   struct rte_mbuf_offload *offload_ops;
 } __rte_cache_aligned;

 static inline uint16_t rte_pktmbuf_priv_size(struct rte_mempool *mp);
diff --git a/lib/librte_mbuf_offload/Makefile b/lib/librte_mbuf_offload/Makefile
new file mode 100644
index 000..acdb449
--- /dev/null
+++ b/lib/librte_mbuf_offload/Makefile
@@ -0,0 +1,52 @@
+#   BSD LICENSE
+#
+#   Copyright(c) 2015 Intel Corporation. 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 

[dpdk-dev] [PATCH v6 05/10] cryptodev: Initial DPDK Crypto APIs and device framework release

2015-11-10 Thread Declan Doherty
This patch contains the initial proposed APIs and device framework for
integrating crypto packet processing into DPDK.

features include:
 - Crypto device configuration / management APIs
 - Definitions of supported cipher algorithms and operations.
 - Definitions of supported hash/authentication algorithms and
   operations.
 - Crypto session management APIs
 - Crypto operation data structures and APIs allocation of crypto
   operation structure used to specify the crypto operations to
   be performed  on a particular mbuf.
 - Extension of mbuf to contain crypto operation data pointer and
   extra flags.
 - Burst enqueue / dequeue APIs for processing of crypto operations.

changes from RFC:
 - Session management API changes to support specification of crypto
   transform(xform) chains using linked list of xforms.
 - Changes to the crypto operation struct as a result of session
   management changes.
 - Some movement of common MACROS shared by cryptodevs and ethdevs to
   common headers

Signed-off-by: Des O Dea 
Signed-off-by: John Griffin 
Signed-off-by: Fiona Trahe 
Signed-off-by: Declan Doherty 

Acked-by: Sergio Gonzalez Monroy 
Signed-off-by: Declan Doherty 
---
 MAINTAINERS|4 +
 config/common_bsdapp   |   10 +-
 config/common_linuxapp |   10 +-
 doc/api/doxy-api-index.md  |1 +
 doc/api/doxy-api.conf  |1 +
 lib/Makefile   |1 +
 lib/librte_cryptodev/Makefile  |   60 ++
 lib/librte_cryptodev/rte_crypto.h  |  613 +
 lib/librte_cryptodev/rte_cryptodev.c   | 1092 
 lib/librte_cryptodev/rte_cryptodev.h   |  649 ++
 lib/librte_cryptodev/rte_cryptodev_pmd.h   |  549 
 lib/librte_cryptodev/rte_cryptodev_version.map |   41 +
 lib/librte_eal/common/include/rte_log.h|1 +
 mk/rte.app.mk  |1 +
 14 files changed, 3031 insertions(+), 2 deletions(-)
 create mode 100644 lib/librte_cryptodev/Makefile
 create mode 100644 lib/librte_cryptodev/rte_crypto.h
 create mode 100644 lib/librte_cryptodev/rte_cryptodev.c
 create mode 100644 lib/librte_cryptodev/rte_cryptodev.h
 create mode 100644 lib/librte_cryptodev/rte_cryptodev_pmd.h
 create mode 100644 lib/librte_cryptodev/rte_cryptodev_version.map

diff --git a/MAINTAINERS b/MAINTAINERS
index c8be5d2..68c6d74 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -196,6 +196,10 @@ M: Thomas Monjalon 
 F: lib/librte_ether/
 F: scripts/test-null.sh

+Crypto API
+M: Declan Doherty 
+F: lib/librte_cryptodev
+F: docs/guides/cryptodevs

 Drivers
 ---
diff --git a/config/common_bsdapp b/config/common_bsdapp
index fba29e5..8803350 100644
--- a/config/common_bsdapp
+++ b/config/common_bsdapp
@@ -1,6 +1,6 @@
 #   BSD LICENSE
 #
-#   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+#   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
 #   All rights reserved.
 #
 #   Redistribution and use in source and binary forms, with or without
@@ -147,6 +147,14 @@ CONFIG_RTE_ETHDEV_QUEUE_STAT_CNTRS=16
 CONFIG_RTE_ETHDEV_RXTX_CALLBACKS=y

 #
+# Compile generic Crypto device library
+#
+CONFIG_RTE_LIBRTE_CRYPTODEV=y
+CONFIG_RTE_LIBRTE_CRYPTODEV_DEBUG=n
+CONFIG_RTE_CRYPTO_MAX_DEVS=64
+CONFIG_RTE_CRYPTODEV_NAME_LEN=64
+
+#
 # Support NIC bypass logic
 #
 CONFIG_RTE_NIC_BYPASS=n
diff --git a/config/common_linuxapp b/config/common_linuxapp
index 7248262..815bea3 100644
--- a/config/common_linuxapp
+++ b/config/common_linuxapp
@@ -1,6 +1,6 @@
 #   BSD LICENSE
 #
-#   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+#   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
 #   All rights reserved.
 #
 #   Redistribution and use in source and binary forms, with or without
@@ -145,6 +145,14 @@ CONFIG_RTE_ETHDEV_QUEUE_STAT_CNTRS=16
 CONFIG_RTE_ETHDEV_RXTX_CALLBACKS=y

 #
+# Compile generic Crypto device library
+#
+CONFIG_RTE_LIBRTE_CRYPTODEV=y
+CONFIG_RTE_LIBRTE_CRYPTODEV_DEBUG=n
+CONFIG_RTE_CRYPTO_MAX_DEVS=64
+CONFIG_RTE_CRYPTODEV_NAME_LEN=64
+
+#
 # Support NIC bypass logic
 #
 CONFIG_RTE_NIC_BYPASS=n
diff --git a/doc/api/doxy-api-index.md b/doc/api/doxy-api-index.md
index 72ac3c4..bdb6130 100644
--- a/doc/api/doxy-api-index.md
+++ b/doc/api/doxy-api-index.md
@@ -39,6 +39,7 @@ There are many libraries, so their headers may be grouped by 
topics:
   [dev](@ref rte_dev.h),
   [ethdev] (@ref rte_ethdev.h),
   [ethctrl](@ref rte_eth_ctrl.h),
+  [cryptodev]  (@ref rte_cryptodev.h),
   [devargs](@ref rte_devargs.h),
   [bond]   (@ref rte_eth_bond.h),
   [vhost]  (@ref rte_virtio_net.h),
diff --git a/doc/api/doxy-api.conf b/doc/api/doxy-api.conf
index cfb4627..7244b8f 100644
--- a/doc/api/doxy-api.conf
+++ b/doc/api/doxy-api.conf
@@ -37,6 +37,7 @@ INPUT

[dpdk-dev] [PATCH v6 04/10] mbuf: add new marcos to get the physical address of data

2015-11-10 Thread Declan Doherty
Acked-by: Sergio Gonzalez Monroy 
Signed-off-by: Declan Doherty 
---
 lib/librte_mbuf/rte_mbuf.h | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index 4a93189..ef1ee26 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -1622,6 +1622,29 @@ static inline struct rte_mbuf 
*rte_pktmbuf_lastseg(struct rte_mbuf *m)
 #define rte_pktmbuf_mtod(m, t) rte_pktmbuf_mtod_offset(m, t, 0)

 /**
+ * A macro that returns the physical address that points to an offset of the
+ * start of the data in the mbuf
+ *
+ * @param m
+ *   The packet mbuf.
+ * @param o
+ *   The offset into the data to calculate address from.
+ */
+#define rte_pktmbuf_mtophys_offset(m, o) \
+   (phys_addr_t)((m)->buf_physaddr + (m)->data_off + (o))
+
+/**
+ * A macro that returns the physical address that points to the start of the
+ * data in the mbuf
+ *
+ * @param m
+ *   The packet mbuf.
+ * @param o
+ *   The offset into the data to calculate address from.
+ */
+#define rte_pktmbuf_mtophys(m) rte_pktmbuf_mtophys_offset(m, 0)
+
+/**
  * A macro that returns the length of the packet.
  *
  * The value can be read or assigned.
-- 
2.4.3



[dpdk-dev] [PATCH v6 03/10] eal: add __rte_packed /__rte_aligned macros

2015-11-10 Thread Declan Doherty
Adding a new marco for specifing __aligned__ attribute, and updating the
current __rte_cache_aligned macro to use it.

Also adding a new macro to specify the __packed__ attribute

Acked-by: Sergio Gonzalez Monroy 
Signed-off-by: Declan Doherty 
---
 lib/librte_eal/common/include/rte_memory.h | 14 --
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/lib/librte_eal/common/include/rte_memory.h 
b/lib/librte_eal/common/include/rte_memory.h
index 1bed415..18fd952 100644
--- a/lib/librte_eal/common/include/rte_memory.h
+++ b/lib/librte_eal/common/include/rte_memory.h
@@ -76,9 +76,19 @@ enum rte_page_sizes {
 /**< Return the first cache-aligned value greater or equal to size. */

 /**
+ * Force alignment
+ */
+#define __rte_aligned(a) __attribute__((__aligned__(a)))
+
+/**
  * Force alignment to cache line.
  */
-#define __rte_cache_aligned __attribute__((__aligned__(RTE_CACHE_LINE_SIZE)))
+#define __rte_cache_aligned __rte_aligned(RTE_CACHE_LINE_SIZE)
+
+/**
+ * Force a structure to be packed
+ */
+#define __rte_packed __attribute__((__packed__))

 typedef uint64_t phys_addr_t; /**< Physical address definition. */
 #define RTE_BAD_PHYS_ADDR ((phys_addr_t)-1)
@@ -104,7 +114,7 @@ struct rte_memseg {
 /**< store segment MFNs */
uint64_t mfn[DOM0_NUM_MEMBLOCK];
 #endif
-} __attribute__((__packed__));
+} __rte_packed;

 /**
  * Lock page in physical memory and prevent from swapping.
-- 
2.4.3



[dpdk-dev] [PATCH v6 02/10] ethdev: make error checking macros public

2015-11-10 Thread Declan Doherty
Move the function pointer and port id checking macros to rte_ethdev and
rte_dev header files, so that they can be used in the static inline
functions there. Also replace the RTE_LOG call within
RTE_PMD_DEBUG_TRACE so this macro can be built with the -pedantic flag

Signed-off-by: Declan Doherty 
---
 lib/librte_eal/common/include/rte_dev.h | 53 
 lib/librte_ether/rte_ethdev.c   | 54 -
 lib/librte_ether/rte_ethdev.h   | 26 
 3 files changed, 79 insertions(+), 54 deletions(-)

diff --git a/lib/librte_eal/common/include/rte_dev.h 
b/lib/librte_eal/common/include/rte_dev.h
index f601d21..f1b5507 100644
--- a/lib/librte_eal/common/include/rte_dev.h
+++ b/lib/librte_eal/common/include/rte_dev.h
@@ -46,8 +46,61 @@
 extern "C" {
 #endif

+#include 
 #include 

+#include 
+
+__attribute__((format(printf, 2, 0)))
+static inline void
+rte_pmd_debug_trace(const char *func_name, const char *fmt, ...)
+{
+   va_list ap;
+
+   va_start(ap, fmt);
+
+   char buffer[vsnprintf(NULL, 0, fmt, ap) + 1];
+
+   va_end(ap);
+
+   va_start(ap, fmt);
+   vsnprintf(buffer, sizeof(buffer), fmt, ap);
+   va_end(ap);
+
+   rte_log(RTE_LOG_ERR, RTE_LOGTYPE_PMD, "%s: %s", func_name, buffer);
+}
+
+/* Macros for checking for restricting functions to primary instance only */
+#define RTE_PROC_PRIMARY_OR_ERR_RET(retval) do { \
+   if (rte_eal_process_type() != RTE_PROC_PRIMARY) { \
+   RTE_PMD_DEBUG_TRACE("Cannot run in secondary processes\n"); \
+   return retval; \
+   } \
+} while (0)
+
+#define RTE_PROC_PRIMARY_OR_RET() do { \
+   if (rte_eal_process_type() != RTE_PROC_PRIMARY) { \
+   RTE_PMD_DEBUG_TRACE("Cannot run in secondary processes\n"); \
+   return; \
+   } \
+} while (0)
+
+/* Macros to check for invalid function pointers */
+#define RTE_FUNC_PTR_OR_ERR_RET(func, retval) do { \
+   if ((func) == NULL) { \
+   RTE_PMD_DEBUG_TRACE("Function not supported\n"); \
+   return retval; \
+   } \
+} while (0)
+
+#define RTE_FUNC_PTR_OR_RET(func) do { \
+   if ((func) == NULL) { \
+   RTE_PMD_DEBUG_TRACE("Function not supported\n"); \
+   return; \
+   } \
+} while (0)
+
+
 /** Double linked list of device drivers. */
 TAILQ_HEAD(rte_driver_list, rte_driver);

diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 3bb25e4..d3c8aba 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -69,60 +69,6 @@
 #include "rte_ether.h"
 #include "rte_ethdev.h"

-#ifdef RTE_LIBRTE_ETHDEV_DEBUG
-#define RTE_PMD_DEBUG_TRACE(fmt, args...) do { \
-   RTE_LOG(ERR, PMD, "%s: " fmt, __func__, ## args); \
-   } while (0)
-#else
-#define RTE_PMD_DEBUG_TRACE(fmt, args...)
-#endif
-
-/* Macros for checking for restricting functions to primary instance only */
-#define RTE_PROC_PRIMARY_OR_ERR_RET(retval) do { \
-   if (rte_eal_process_type() != RTE_PROC_PRIMARY) { \
-   RTE_PMD_DEBUG_TRACE("Cannot run in secondary processes\n"); \
-   return (retval); \
-   } \
-} while (0)
-
-#define RTE_PROC_PRIMARY_OR_RET() do { \
-   if (rte_eal_process_type() != RTE_PROC_PRIMARY) { \
-   RTE_PMD_DEBUG_TRACE("Cannot run in secondary processes\n"); \
-   return; \
-   } \
-} while (0)
-
-/* Macros to check for invalid function pointers in dev_ops structure */
-#define RTE_FUNC_PTR_OR_ERR_RET(func, retval) do { \
-   if ((func) == NULL) { \
-   RTE_PMD_DEBUG_TRACE("Function not supported\n"); \
-   return (retval); \
-   } \
-} while (0)
-
-#define RTE_FUNC_PTR_OR_RET(func) do { \
-   if ((func) == NULL) { \
-   RTE_PMD_DEBUG_TRACE("Function not supported\n"); \
-   return; \
-   } \
-} while (0)
-
-/* Macros to check for valid port */
-#define RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, retval) do { \
-   if (!rte_eth_dev_is_valid_port(port_id)) {  \
-   RTE_PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); \
-   return retval; \
-   } \
-} while (0)
-
-#define RTE_ETH_VALID_PORTID_OR_RET(port_id) do { \
-   if (!rte_eth_dev_is_valid_port(port_id)) { \
-   RTE_PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); \
-   return; \
-   } \
-} while (0)
-
-
 static const char *MZ_RTE_ETH_DEV_DATA = "rte_eth_dev_data";
 struct rte_eth_dev rte_eth_devices[RTE_MAX_ETHPORTS];
 static struct rte_eth_dev_data *rte_eth_dev_data;
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 48a540d..9b07a0b 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -172,6 +172,8 @@ extern "C" {

 #include 

+#include 
+
 /* Use this macro to check if LRO API is supported */
 #define RTE_ETHDEV_HAS_LRO_SUPPORT

@@ -931,6 +933,30 @@ struct 

[dpdk-dev] [PATCH v6 01/10] ethdev: rename macros to have RTE_ prefix

2015-11-10 Thread Declan Doherty
The macros to check that the function pointers and port ids are valid
for an ethdev are potentially useful to have in a common headers for
use with all PMDs. However, since they would then become externally
visible, we apply the RTE_ & RTE_ETH_ prefix to them as approtiate.

Signed-off-by: Declan Doherty 
Acked-by: Bruce Richardson 
---
 lib/librte_ether/rte_ethdev.c | 595 +-
 1 file changed, 298 insertions(+), 297 deletions(-)

diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index e0e1dca..3bb25e4 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -70,58 +70,59 @@
 #include "rte_ethdev.h"

 #ifdef RTE_LIBRTE_ETHDEV_DEBUG
-#define PMD_DEBUG_TRACE(fmt, args...) do {\
+#define RTE_PMD_DEBUG_TRACE(fmt, args...) do { \
RTE_LOG(ERR, PMD, "%s: " fmt, __func__, ## args); \
} while (0)
 #else
-#define PMD_DEBUG_TRACE(fmt, args...)
+#define RTE_PMD_DEBUG_TRACE(fmt, args...)
 #endif

 /* Macros for checking for restricting functions to primary instance only */
-#define PROC_PRIMARY_OR_ERR_RET(retval) do { \
+#define RTE_PROC_PRIMARY_OR_ERR_RET(retval) do { \
if (rte_eal_process_type() != RTE_PROC_PRIMARY) { \
-   PMD_DEBUG_TRACE("Cannot run in secondary processes\n"); \
+   RTE_PMD_DEBUG_TRACE("Cannot run in secondary processes\n"); \
return (retval); \
} \
 } while (0)

-#define PROC_PRIMARY_OR_RET() do { \
+#define RTE_PROC_PRIMARY_OR_RET() do { \
if (rte_eal_process_type() != RTE_PROC_PRIMARY) { \
-   PMD_DEBUG_TRACE("Cannot run in secondary processes\n"); \
+   RTE_PMD_DEBUG_TRACE("Cannot run in secondary processes\n"); \
return; \
} \
 } while (0)

 /* Macros to check for invalid function pointers in dev_ops structure */
-#define FUNC_PTR_OR_ERR_RET(func, retval) do { \
+#define RTE_FUNC_PTR_OR_ERR_RET(func, retval) do { \
if ((func) == NULL) { \
-   PMD_DEBUG_TRACE("Function not supported\n"); \
+   RTE_PMD_DEBUG_TRACE("Function not supported\n"); \
return (retval); \
} \
 } while (0)

-#define FUNC_PTR_OR_RET(func) do { \
+#define RTE_FUNC_PTR_OR_RET(func) do { \
if ((func) == NULL) { \
-   PMD_DEBUG_TRACE("Function not supported\n"); \
+   RTE_PMD_DEBUG_TRACE("Function not supported\n"); \
return; \
} \
 } while (0)

 /* Macros to check for valid port */
-#define VALID_PORTID_OR_ERR_RET(port_id, retval) do {  \
-   if (!rte_eth_dev_is_valid_port(port_id)) {  \
-   PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); \
-   return retval;  \
-   }   \
+#define RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, retval) do { \
+   if (!rte_eth_dev_is_valid_port(port_id)) {  \
+   RTE_PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); \
+   return retval; \
+   } \
 } while (0)

-#define VALID_PORTID_OR_RET(port_id) do {  \
-   if (!rte_eth_dev_is_valid_port(port_id)) {  \
-   PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); \
-   return; \
-   }   \
+#define RTE_ETH_VALID_PORTID_OR_RET(port_id) do { \
+   if (!rte_eth_dev_is_valid_port(port_id)) { \
+   RTE_PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); \
+   return; \
+   } \
 } while (0)

+
 static const char *MZ_RTE_ETH_DEV_DATA = "rte_eth_dev_data";
 struct rte_eth_dev rte_eth_devices[RTE_MAX_ETHPORTS];
 static struct rte_eth_dev_data *rte_eth_dev_data;
@@ -244,7 +245,7 @@ rte_eth_dev_allocate(const char *name, enum 
rte_eth_dev_type type)

port_id = rte_eth_dev_find_free_port();
if (port_id == RTE_MAX_ETHPORTS) {
-   PMD_DEBUG_TRACE("Reached maximum number of Ethernet ports\n");
+   RTE_PMD_DEBUG_TRACE("Reached maximum number of Ethernet 
ports\n");
return NULL;
}

@@ -252,7 +253,7 @@ rte_eth_dev_allocate(const char *name, enum 
rte_eth_dev_type type)
rte_eth_dev_data_alloc();

if (rte_eth_dev_allocated(name) != NULL) {
-   PMD_DEBUG_TRACE("Ethernet Device with name %s already 
allocated!\n",
+   RTE_PMD_DEBUG_TRACE("Ethernet Device with name %s already 
allocated!\n",
name);
return NULL;
}
@@ -339,7 +340,7 @@ rte_eth_dev_init(struct rte_pci_driver *pci_drv,
if (diag == 0)
return 0;

-   PMD_DEBUG_TRACE("driver %s: eth_dev_init(vendor_id=0x%u device_id=0x%x) 
failed\n",
+   RTE_PMD_DEBUG_TRACE("driver %s: eth_dev_init(vendor_id=0x%u 
device_id=0x%x) 

[dpdk-dev] [PATCH 1/2] doc: announce ABI change for cmdline buffer size

2015-11-10 Thread Mcnamara, John


> -Original Message-
> From: Nelio Laranjeiro [mailto:nelio.laranjeiro at 6wind.com]
> Sent: Monday, November 9, 2015 4:48 PM
> To: dev at dpdk.org
> Cc: olivier.matz at 6wind.com; thomas.monjalon at 6wind.com; Mcnamara, John; 
> Lu,
> Wenzhuo
> Subject: [PATCH 1/2] doc: announce ABI change for cmdline buffer size
> 
> Current buffer size are not enough for a few testpmd commands.
> 
> Signed-off-by: Nelio Laranjeiro 

Acked-by: John McNamara 



[dpdk-dev] [PATCH] app/testpmd: fix icmp echo tx queues

2015-11-10 Thread Thomas Monjalon
> > icmp echo forward engine relies on the core rank rather than the number of
> > queues available.
> > This fix is still wrong, because if we set a nb-rxq > nb-txq, then we will 
> > use
> > an invalid txq, but with this, we are aligned on other fwd engines.
> > 
> > Signed-off-by: David Marchand 
> 
> Acked-by: Pablo de Lara 

Applied, thanks


[dpdk-dev] [PATCH v2] igbvf: fix vlan filtering

2015-11-10 Thread Thomas Monjalon
> > From: Julien Meunier 
> > 
> > Once posted through mailbox, we must check for nack from the PF and
> > report an error in this case.
> > 
> > Signed-off-by: Julien Meunier 
> > Signed-off-by: David Marchand 
> Acked-by: Wenzhuo Lu 

Applied, thanks



[dpdk-dev] [PATCH v3 2/4] ethdev: move error checking macros to header

2015-11-10 Thread Adrien Mazarguil
On Mon, Nov 09, 2015 at 02:02:28PM +, Richardson, Bruce wrote:
[...]
> > From: Adrien Mazarguil [mailto:adrien.mazarguil at 6wind.com]
[...]
> > Untested but I guess modifying that function accordingly would look like:
> > 
> >  static inline void
> >  rte_pmd_debug_trace(const char *func_name, const char *fmt, ...)
> >  {
> >  va_list ap;
> >  va_start(ap, fmt);
> > 
> >  static __thread char buffer[vsnprintf(NULL, 0, fmt, ap)];
> > 
> >  va_end(ap);
> >  va_start(ap, fmt);
> >  vsnprintf(buffer, sizeof(buffer), fmt, ap);
> >  va_end(ap);
> >  rte_log(RTE_LOG_ERR, RTE_LOGTYPE_PMD, "%s: %s", func_name,
> > buffer);
> >  }
> > 
> 
> Looks a much better option.
> 
> From this, though, I assume then that we are only looking to support the 
> -pedantic flag in conjuction with c99 mode or above. Supporting -pedantic 
> with the pre-gcc-5 versions won't allow that to work though, as variably 
> sized arrays only came in with c99, and were gnu extensions before that.

Right, -pedantic must follow a given standard such as -std=gnu99 otherwise
it's meaningless.

However pre-GCC 5 is fine for most if not all features we use, see:

 https://gcc.gnu.org/c99status.html

Mixed code and declarations are supported since GCC 3.0, __VA_ARGS__ in
macros since GCC 2.95 and variable length arrays since GCC 0.9, so as long
as we use a version that implements -std=gnu99 (or -std=c99 to be really
pedantic), it's fine.

Besides DPDK already uses C99 extensively, even a few C11 features (such as
embedded anonymous struct definitions) currently supported in C99 mode as
compiler extensions. I think we can safely ignore compilers that don't
support common C99 features.

-- 
Adrien Mazarguil
6WIND


[dpdk-dev] [PATCH] enic: fix vlan filtering

2015-11-10 Thread Thomas Monjalon
2015-10-31 17:04, Sujith Sankar:
> On 30/10/15 9:43 pm, "David Marchand"  wrote:
> >From: Julien Meunier 
> >
> >Report an error when something went wrong.
> >
> >Signed-off-by: Julien Meunier 
> >Signed-off-by: David Marchand 
> Acked.

Applied, thanks


[dpdk-dev] [PATCH v5 02/10] ethdev: make error checking macros public

2015-11-10 Thread Declan Doherty
On 10/11/15 15:50, Adrien Mazarguil wrote:
> On Mon, Nov 09, 2015 at 08:34:11PM +, Declan Doherty wrote:
>> Move the function pointer and port id checking macros to rte_ethdev and
>> rte_dev header files, so that they can be used in the static inline
>> functions there. Also replace the RTE_LOG call within
>> RTE_PMD_DEBUG_TRACE so this macro can be built with the -pedantic flag
>>
>> Signed-off-by: Declan Doherty 
>> ---
>>   lib/librte_eal/common/include/rte_dev.h | 52 
>> +++
>>   lib/librte_ether/rte_ethdev.c   | 54 
>> -
>>   lib/librte_ether/rte_ethdev.h   | 26 
>>   3 files changed, 78 insertions(+), 54 deletions(-)
>>
>> diff --git a/lib/librte_eal/common/include/rte_dev.h 
>> b/lib/librte_eal/common/include/rte_dev.h
>> index f601d21..fd09b3d 100644
>> --- a/lib/librte_eal/common/include/rte_dev.h
>> +++ b/lib/librte_eal/common/include/rte_dev.h
>> @@ -46,8 +46,60 @@
>>   extern "C" {
>>   #endif
>>
>> +#include 
>>   #include 
>>
>> +#include 
>> +
>> +__attribute__((format(printf, 2, 0)))
>> +static inline void
>> +rte_pmd_debug_trace(const char *func_name, const char *fmt, ...)
>> +{
>> +va_list ap;
>> +
>> +va_start(ap, fmt);
>
> I suggest adding an empty line here since we're mixing code and
> declarations.
>

sure no problem.

>> +char buffer[vsnprintf(NULL, 0, fmt, ap)];
>
> I forgot an extra byte for trailing '\0' in my original comment, the above
> line should read:
>
>   char buffer[vsnprintf(NULL, 0, fmt, ap) + 1];
>
> Otherwise the last character will be missing. Did you test that function?
>

I didn't notice the truncation in the log message, I was just missing 
and "!" in the log message and didn't miss it. I'll push a new version 
with this fix.

>> +
>> +va_end(ap);
>> +
>> +va_start(ap, fmt);
>> +vsnprintf(buffer, sizeof(buffer), fmt, ap);
>> +va_end(ap);
>> +
>> +rte_log(RTE_LOG_ERR, RTE_LOGTYPE_PMD, "%s: %s", func_name, buffer);
>> +}
>> +

>> --
>> 2.4.3
>>
>



[dpdk-dev] [PATCH v3] i40e: fix the issue of not freeing memzone

2015-11-10 Thread Thomas Monjalon
Helin,
There is a compilation error.

2015-11-09 09:20, Helin Zhang:
> + mem->zone = (const void *)mz;
> + PMD_DRV_LOG(DEBUG, "memzone %s allocated with physical address: %p",
> + mz->name, mem->pa);

error: format ?%p? expects argument of type ?void *?, but argument 6 has type 
?u64 {aka long unsigned int}?



[dpdk-dev] [PATCH v5 02/10] ethdev: make error checking macros public

2015-11-10 Thread Adrien Mazarguil
On Mon, Nov 09, 2015 at 08:34:11PM +, Declan Doherty wrote:
> Move the function pointer and port id checking macros to rte_ethdev and
> rte_dev header files, so that they can be used in the static inline
> functions there. Also replace the RTE_LOG call within
> RTE_PMD_DEBUG_TRACE so this macro can be built with the -pedantic flag
> 
> Signed-off-by: Declan Doherty 
> ---
>  lib/librte_eal/common/include/rte_dev.h | 52 +++
>  lib/librte_ether/rte_ethdev.c   | 54 
> -
>  lib/librte_ether/rte_ethdev.h   | 26 
>  3 files changed, 78 insertions(+), 54 deletions(-)
> 
> diff --git a/lib/librte_eal/common/include/rte_dev.h 
> b/lib/librte_eal/common/include/rte_dev.h
> index f601d21..fd09b3d 100644
> --- a/lib/librte_eal/common/include/rte_dev.h
> +++ b/lib/librte_eal/common/include/rte_dev.h
> @@ -46,8 +46,60 @@
>  extern "C" {
>  #endif
>  
> +#include 
>  #include 
>  
> +#include 
> +
> +__attribute__((format(printf, 2, 0)))
> +static inline void
> +rte_pmd_debug_trace(const char *func_name, const char *fmt, ...)
> +{
> + va_list ap;
> +
> + va_start(ap, fmt);

I suggest adding an empty line here since we're mixing code and
declarations.

> + char buffer[vsnprintf(NULL, 0, fmt, ap)];

I forgot an extra byte for trailing '\0' in my original comment, the above
line should read:

 char buffer[vsnprintf(NULL, 0, fmt, ap) + 1];

Otherwise the last character will be missing. Did you test that function?

> +
> + va_end(ap);
> +
> + va_start(ap, fmt);
> + vsnprintf(buffer, sizeof(buffer), fmt, ap);
> + va_end(ap);
> +
> + rte_log(RTE_LOG_ERR, RTE_LOGTYPE_PMD, "%s: %s", func_name, buffer);
> +}
> +
> +/* Macros for checking for restricting functions to primary instance only */
> +#define RTE_PROC_PRIMARY_OR_ERR_RET(retval) do { \
> + if (rte_eal_process_type() != RTE_PROC_PRIMARY) { \
> + RTE_PMD_DEBUG_TRACE("Cannot run in secondary processes\n"); \
> + return retval; \
> + } \
> +} while (0)
> +
> +#define RTE_PROC_PRIMARY_OR_RET() do { \
> + if (rte_eal_process_type() != RTE_PROC_PRIMARY) { \
> + RTE_PMD_DEBUG_TRACE("Cannot run in secondary processes\n"); \
> + return; \
> + } \
> +} while (0)
> +
> +/* Macros to check for invalid function pointers */
> +#define RTE_FUNC_PTR_OR_ERR_RET(func, retval) do { \
> + if ((func) == NULL) { \
> + RTE_PMD_DEBUG_TRACE("Function not supported\n"); \
> + return retval; \
> + } \
> +} while (0)
> +
> +#define RTE_FUNC_PTR_OR_RET(func) do { \
> + if ((func) == NULL) { \
> + RTE_PMD_DEBUG_TRACE("Function not supported\n"); \
> + return; \
> + } \
> +} while (0)
> +
> +
>  /** Double linked list of device drivers. */
>  TAILQ_HEAD(rte_driver_list, rte_driver);
>  
> diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
> index 7387f65..d3c8aba 100644
> --- a/lib/librte_ether/rte_ethdev.c
> +++ b/lib/librte_ether/rte_ethdev.c
> @@ -69,60 +69,6 @@
>  #include "rte_ether.h"
>  #include "rte_ethdev.h"
>  
> -#ifdef RTE_LIBRTE_ETHDEV_DEBUG
> -#define RTE_PMD_DEBUG_TRACE(fmt, args...) do {do { \
> - RTE_LOG(ERR, PMD, "%s: " fmt, __func__, ## args); \
> - } while (0)
> -#else
> -#define RTE_PMD_DEBUG_TRACE(fmt, args...)
> -#endif
> -
> -/* Macros for checking for restricting functions to primary instance only */
> -#define RTE_PROC_PRIMARY_OR_ERR_RET(retval) do { \
> - if (rte_eal_process_type() != RTE_PROC_PRIMARY) { \
> - RTE_PMD_DEBUG_TRACE("Cannot run in secondary processes\n"); \
> - return (retval); \
> - } \
> -} while (0)
> -
> -#define RTE_PROC_PRIMARY_OR_RET() do { \
> - if (rte_eal_process_type() != RTE_PROC_PRIMARY) { \
> - RTE_PMD_DEBUG_TRACE("Cannot run in secondary processes\n"); \
> - return; \
> - } \
> -} while (0)
> -
> -/* Macros to check for invalid function pointers in dev_ops structure */
> -#define RTE_FUNC_PTR_OR_ERR_RET(func, retval) do { \
> - if ((func) == NULL) { \
> - RTE_PMD_DEBUG_TRACE("Function not supported\n"); \
> - return (retval); \
> - } \
> -} while (0)
> -
> -#define RTE_FUNC_PTR_OR_RET(func) do { \
> - if ((func) == NULL) { \
> - RTE_PMD_DEBUG_TRACE("Function not supported\n"); \
> - return; \
> - } \
> -} while (0)
> -
> -/* Macros to check for valid port */
> -#define RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, retval) do { \
> - if (!rte_eth_dev_is_valid_port(port_id)) {  \
> - RTE_PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); \
> - return retval; \
> - } \
> -} while (0)
> -
> -#define RTE_ETH_VALID_PORTID_OR_RET(port_id) do { \
> - if (!rte_eth_dev_is_valid_port(port_id)) { \
> - RTE_PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); \
> - return; \
> - } \
> -} 

[dpdk-dev] [PATCH] i40e: fix for default flexible payload registers settings

2015-11-10 Thread Thomas Monjalon
2015-09-30 10:16, Andrey Chilikin:
> This patch applies new default values to flexible payload configuration for 
> flow director filter
> 
> Signed-off-by: Andrey Chilikin 

Helin, could you review please?


[dpdk-dev] [v2 1/1] librte_ether: fix coverity errors in rte_eth_copy_pci_info

2015-11-10 Thread Thomas Monjalon
2015-11-06 17:20, Bernard Iremonger:
> add return statement to if branch
> 
> Dereferencing NULL pointer reported by Coverity, CID 119256.
> Dereferencing NULL pointer reported by Coverity, CID 119257.
> 
> Signed-off-by: Bernard Iremonger 

Fixes: 494adb7f63f2 ("ethdev: add device fields from PCI layer")

Applied, thanks



[dpdk-dev] [PATCH] app/testpmd: fix wrong fdir help and doc

2015-11-10 Thread Thomas Monjalon
> > After implementing the fdir new modes for x550, the CLIs are modified.
> > Forgot to update the related help info and doc.
> > 
> > Fixes: 53b2bb9b7ea7 ("app/testpmd: new flow director commands")
> > Signed-off-by: Wenzhuo Lu 
> 
> Acked-by: Pablo de Lara 

Applied, thanks


[dpdk-dev] [PATCH v4 2/2] eal: add support for driver directory concept

2015-11-10 Thread Panu Matilainen
Add support for directories as arguments to -d for loading all drivers
from a given directory. Additionally a default driver directory can be
set in build-time configuration, in which case it will be always be used
when EAL is initialized.

This simplifies usage in shared library configuration significantly over
manually loading individual drivers with -d, and allows distros to
establish a drop-in driver directory for seamless integration
with 3rd party drivers etc.

Suggested-by: Thomas Monjalon 
Suggested-by: David Marchand 
Signed-off-by: Panu Matilainen 
---
 config/common_bsdapp   |  3 ++
 config/common_linuxapp |  3 ++
 lib/librte_eal/common/eal_common_options.c | 74 --
 3 files changed, 75 insertions(+), 5 deletions(-)

diff --git a/config/common_bsdapp b/config/common_bsdapp
index fba29e5..7df0763 100644
--- a/config/common_bsdapp
+++ b/config/common_bsdapp
@@ -108,6 +108,9 @@ CONFIG_RTE_EAL_ALLOW_INV_SOCKET_ID=n
 CONFIG_RTE_EAL_ALWAYS_PANIC_ON_ERROR=n
 CONFIG_RTE_MALLOC_DEBUG=n

+# Default driver path (or "" to disable)
+CONFIG_RTE_EAL_PMD_PATH=""
+
 #
 # FreeBSD contiguous memory driver settings
 #
diff --git a/config/common_linuxapp b/config/common_linuxapp
index 7248262..52173d5 100644
--- a/config/common_linuxapp
+++ b/config/common_linuxapp
@@ -111,6 +111,9 @@ CONFIG_RTE_EAL_IGB_UIO=y
 CONFIG_RTE_EAL_VFIO=y
 CONFIG_RTE_MALLOC_DEBUG=n

+# Default driver path (or "" to disable)
+CONFIG_RTE_EAL_PMD_PATH=""
+
 #
 # Special configurations in PCI Config Space for high performance
 #
diff --git a/lib/librte_eal/common/eal_common_options.c 
b/lib/librte_eal/common/eal_common_options.c
index ae0187a..a2c3d91 100644
--- a/lib/librte_eal/common/eal_common_options.c
+++ b/lib/librte_eal/common/eal_common_options.c
@@ -40,6 +40,9 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 

 #include 
 #include 
@@ -109,6 +112,9 @@ struct shared_driver {
 static struct shared_driver_list solib_list =
 TAILQ_HEAD_INITIALIZER(solib_list);

+/* Default path of external loadable drivers */
+static const char *default_solib_dir = RTE_EAL_PMD_PATH;
+
 static int master_lcore_parsed;
 static int mem_parsed;

@@ -167,18 +173,75 @@ eal_plugin_add(const char *path)
return 0;
 }

+static int
+eal_plugindir_init(const char *path)
+{
+   DIR *d = NULL;
+   struct dirent *dent = NULL;
+   char sopath[PATH_MAX];
+
+   if (path == NULL || *path == '\0')
+   return 0;
+
+   d = opendir(path);
+   if (d == NULL) {
+   RTE_LOG(ERR, EAL, "failed to open directory %s: %s\n",
+   path, strerror(errno));
+   return -1;
+   }
+
+   while ((dent = readdir(d)) != NULL) {
+   if (dent->d_type != DT_REG && dent->d_type != DT_LNK)
+   continue;
+
+   snprintf(sopath, PATH_MAX-1, "%s/%s", path, dent->d_name);
+   sopath[PATH_MAX-1] = 0;
+
+   if (eal_plugin_add(sopath) == -1)
+   break;
+   }
+
+   closedir(d);
+   /* XXX this ignores failures from readdir() itself */
+   return (dent == NULL) ? 0 : -1;
+}
+
 int
 eal_plugins_init(void)
 {
struct shared_driver *solib = NULL;

+   if (*default_solib_dir != '\0')
+   eal_plugin_add(default_solib_dir);
+
TAILQ_FOREACH(solib, _list, next) {
-   RTE_LOG(DEBUG, EAL, "open shared lib %s\n", solib->name);
-   solib->lib_handle = dlopen(solib->name, RTLD_NOW);
-   if (solib->lib_handle == NULL) {
-   RTE_LOG(ERR, EAL, "%s\n", dlerror());
+   struct stat sb;
+   if (stat(solib->name, ) == -1) {
+   RTE_LOG(ERR, EAL, "Invalid plugin specified: %s: %s\n",
+   solib->name, strerror(errno));
return -1;
}
+
+   switch (sb.st_mode & S_IFMT) {
+   case S_IFDIR:
+   if (eal_plugindir_init(solib->name) == -1) {
+   RTE_LOG(ERR, EAL,
+   "Cannot init plugin directory %s\n",
+   solib->name);
+   return -1;
+   }
+   break;
+   case S_IFREG:
+   RTE_LOG(DEBUG, EAL, "open shared lib %s\n",
+   solib->name);
+   solib->lib_handle = dlopen(solib->name, RTLD_NOW);
+   if (solib->lib_handle == NULL) {
+   RTE_LOG(ERR, EAL, "%s\n", dlerror());
+   return -1;
+   }
+   break;
+   }
+
}
return 0;
 }
@@ -952,7 +1015,8 @@ eal_common_usage(void)
   "  --"OPT_PROC_TYPE" Type of this process 

[dpdk-dev] [PATCH v4 1/2] eal: move plugin loading to eal/common

2015-11-10 Thread Panu Matilainen
There's no good reason to limit plugins to Linux, make it available
on FreeBSD too. Refactor the plugin code from Linux EAL to common
helper functions, also check for and fail on errors during initialization.

Signed-off-by: Panu Matilainen 
---
 lib/librte_eal/bsdapp/eal/eal.c|  3 ++
 lib/librte_eal/common/eal_common_options.c | 55 ++
 lib/librte_eal/common/eal_options.h|  1 +
 lib/librte_eal/linuxapp/eal/eal.c  | 40 ++
 4 files changed, 61 insertions(+), 38 deletions(-)

diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c
index b64bbfc..a34e61d 100644
--- a/lib/librte_eal/bsdapp/eal/eal.c
+++ b/lib/librte_eal/bsdapp/eal/eal.c
@@ -571,6 +571,9 @@ rte_eal_init(int argc, char **argv)

rte_eal_mcfg_complete();

+   if (eal_plugins_init() < 0)
+   rte_panic("Cannot init plugins\n");
+
eal_thread_init_master(rte_config.master_lcore);

ret = eal_thread_dump_affinity(cpuset, RTE_CPU_AFFINITY_STR_LEN);
diff --git a/lib/librte_eal/common/eal_common_options.c 
b/lib/librte_eal/common/eal_common_options.c
index 79db608..ae0187a 100644
--- a/lib/librte_eal/common/eal_common_options.c
+++ b/lib/librte_eal/common/eal_common_options.c
@@ -39,6 +39,7 @@
 #include 
 #include 
 #include 
+#include 

 #include 
 #include 
@@ -94,6 +95,20 @@ eal_long_options[] = {
{0, 0, NULL, 0}
 };

+TAILQ_HEAD(shared_driver_list, shared_driver);
+
+/* Definition for shared object drivers. */
+struct shared_driver {
+   TAILQ_ENTRY(shared_driver) next;
+
+   charname[PATH_MAX];
+   void*   lib_handle;
+};
+
+/* List of external loadable drivers */
+static struct shared_driver_list solib_list =
+TAILQ_HEAD_INITIALIZER(solib_list);
+
 static int master_lcore_parsed;
 static int mem_parsed;

@@ -134,6 +149,40 @@ eal_reset_internal_config(struct internal_config 
*internal_cfg)
internal_cfg->create_uio_dev = 0;
 }

+static int
+eal_plugin_add(const char *path)
+{
+   struct shared_driver *solib;
+
+   solib = malloc(sizeof(*solib));
+   if (solib == NULL) {
+   RTE_LOG(ERR, EAL, "malloc(solib) failed\n");
+   return -1;
+   }
+   memset(solib, 0, sizeof(*solib));
+   strncpy(solib->name, path, PATH_MAX-1);
+   solib->name[PATH_MAX-1] = 0;
+   TAILQ_INSERT_TAIL(_list, solib, next);
+
+   return 0;
+}
+
+int
+eal_plugins_init(void)
+{
+   struct shared_driver *solib = NULL;
+
+   TAILQ_FOREACH(solib, _list, next) {
+   RTE_LOG(DEBUG, EAL, "open shared lib %s\n", solib->name);
+   solib->lib_handle = dlopen(solib->name, RTLD_NOW);
+   if (solib->lib_handle == NULL) {
+   RTE_LOG(ERR, EAL, "%s\n", dlerror());
+   return -1;
+   }
+   }
+   return 0;
+}
+
 /*
  * Parse the coremask given as argument (hexadecimal string) and fill
  * the global configuration (core role and core count) with the parsed
@@ -713,6 +762,11 @@ eal_parse_common_option(int opt, const char *optarg,
 * even if info or warning messages are disabled */
RTE_LOG(CRIT, EAL, "RTE Version: '%s'\n", rte_version());
break;
+   /* force loading of external driver */
+   case 'd':
+   if (eal_plugin_add(optarg) == -1)
+   return -1;
+   break;

/* long options */
case OPT_HUGE_UNLINK_NUM:
@@ -898,6 +952,7 @@ eal_common_usage(void)
   "  --"OPT_PROC_TYPE" Type of this process 
(primary|secondary|auto)\n"
   "  --"OPT_SYSLOG"Set syslog facility\n"
   "  --"OPT_LOG_LEVEL" Set default log level\n"
+  "  -d LIB.so   Add driver (can be used multiple times)\n"
   "  -v  Display version information on startup\n"
   "  -h, --help  This help\n"
   "\nEAL options for DEBUG use only:\n"
diff --git a/lib/librte_eal/common/eal_options.h 
b/lib/librte_eal/common/eal_options.h
index 4245fd5..a881c62 100644
--- a/lib/librte_eal/common/eal_options.h
+++ b/lib/librte_eal/common/eal_options.h
@@ -95,5 +95,6 @@ int eal_adjust_config(struct internal_config *internal_cfg);
 int eal_check_common_options(struct internal_config *internal_cfg);
 void eal_common_usage(void);
 enum rte_proc_type_t eal_proc_type_detect(void);
+int eal_plugins_init(void);

 #endif /* EAL_OPTIONS_H */
diff --git a/lib/librte_eal/linuxapp/eal/eal.c 
b/lib/librte_eal/linuxapp/eal/eal.c
index 18fe19b..06536f2 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -43,7 +43,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -90,20 +89,6 @@
 /* Allow the application to print its usage message too if set */
 static rte_usage_hook_t

[dpdk-dev] [PATCH v4 0/2] Add support for driver directories

2015-11-10 Thread Panu Matilainen
This mini-series adds support for driver directory concept
based on idea by Thomas Monjalon back in February:
http://dpdk.org/ml/archives/dev/2015-February/013285.html

In the process FreeBSD also gains plugin support (but untested).

v4: - introduce error-early behavior for invalid plugin paths
- support directories via the existing -d option instead of adding new

v3: - merge the first commits

v2: - move code to eal/common
- add bsd support

Panu Matilainen (2):
  eal: move plugin loading to eal/common
  eal: add support for driver directory concept

 config/common_bsdapp   |   3 +
 config/common_linuxapp |   3 +
 lib/librte_eal/bsdapp/eal/eal.c|   3 +
 lib/librte_eal/common/eal_common_options.c | 119 +
 lib/librte_eal/common/eal_options.h|   1 +
 lib/librte_eal/linuxapp/eal/eal.c  |  40 +-
 6 files changed, 131 insertions(+), 38 deletions(-)

-- 
2.5.0



[dpdk-dev] [PATCH] app/testpmd: fix icmp echo tx queues

2015-11-10 Thread Thomas Monjalon
2015-10-29 09:47, David Marchand:
> icmp echo forward engine relies on the core rank rather than the number of
> queues available.
> This fix is still wrong, because if we set a nb-rxq > nb-txq, then we will use
> an invalid txq, but with this, we are aligned on other fwd engines.
> 
> Signed-off-by: David Marchand 
[...]
> - fs->tx_queue = lc_id;
> + fs->tx_queue = rxq;

Pablo, any opinion?


[dpdk-dev] [PATCH v3 2/4] ethdev: move error checking macros to header

2015-11-10 Thread Richardson, Bruce


> -Original Message-
> From: Adrien Mazarguil [mailto:adrien.mazarguil at 6wind.com]
> Sent: Tuesday, November 10, 2015 4:08 PM
> To: Richardson, Bruce 
> Cc: Stephen Hemminger ; Thomas Monjalon
> ; dev at dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v3 2/4] ethdev: move error checking macros
> to header
> 
> On Mon, Nov 09, 2015 at 02:02:28PM +, Richardson, Bruce wrote:
> [...]
> > > From: Adrien Mazarguil [mailto:adrien.mazarguil at 6wind.com]
> [...]
> > > Untested but I guess modifying that function accordingly would look
> like:
> > >
> > >  static inline void
> > >  rte_pmd_debug_trace(const char *func_name, const char *fmt, ...)  {
> > >  va_list ap;
> > >  va_start(ap, fmt);
> > >
> > >  static __thread char buffer[vsnprintf(NULL, 0, fmt, ap)];
> > >
> > >  va_end(ap);
> > >va_start(ap, fmt);
> > >  vsnprintf(buffer, sizeof(buffer), fmt, ap);
> > >va_end(ap);
> > >  rte_log(RTE_LOG_ERR, RTE_LOGTYPE_PMD, "%s: %s", func_name,
> > > buffer);  }
> > >
> >
> > Looks a much better option.
> >
> > From this, though, I assume then that we are only looking to support the
> -pedantic flag in conjuction with c99 mode or above. Supporting -pedantic
> with the pre-gcc-5 versions won't allow that to work though, as variably
> sized arrays only came in with c99, and were gnu extensions before that.
> 
> Right, -pedantic must follow a given standard such as -std=gnu99 otherwise
> it's meaningless.
> 
> However pre-GCC 5 is fine for most if not all features we use, see:
> 
>  https://gcc.gnu.org/c99status.html
> 
> Mixed code and declarations are supported since GCC 3.0, __VA_ARGS__ in
> macros since GCC 2.95 and variable length arrays since GCC 0.9, so as long
> as we use a version that implements -std=gnu99 (or -std=c99 to be really
> pedantic), it's fine.
> 
> Besides DPDK already uses C99 extensively, even a few C11 features (such
> as
> embedded anonymous struct definitions) currently supported in C99 mode as
> compiler extensions. I think we can safely ignore compilers that don't
> support common C99 features.
> 
> --
> Adrien Mazarguil
> 6WIND

Actually my point was slightly different. 
If we are supporting "-pedantic" in header files because "we don't know what 
compiler flags users are going to pass when", then we need to support it in C90 
mode to do the job properly. If you take gcc 4.8 and compile some code with 
"-pedantic" as the only C-flag you are going to get lots of errors because it 
will default to C90 mode with pedantic, which means no varargs macros at all. 
This limits the usefulness of supporting pedantic flag at all in our header 
files, since we only support it in certain situations with non-latest compilers.

/Bruce


[dpdk-dev] [PATCH] app/testpmd: fix icmp echo tx queues

2015-11-10 Thread De Lara Guarch, Pablo
Hi,

> -Original Message-
> From: David Marchand [mailto:david.marchand at 6wind.com]
> Sent: Thursday, October 29, 2015 8:47 AM
> To: dev at dpdk.org
> Cc: De Lara Guarch, Pablo
> Subject: [PATCH] app/testpmd: fix icmp echo tx queues
> 
> icmp echo forward engine relies on the core rank rather than the number of
> queues available.
> This fix is still wrong, because if we set a nb-rxq > nb-txq, then we will use
> an invalid txq, but with this, we are aligned on other fwd engines.
> 
> Signed-off-by: David Marchand 
> ---
>  app/test-pmd/config.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
> index cf2aa6e..314215c 100644
> --- a/app/test-pmd/config.c
> +++ b/app/test-pmd/config.c
> @@ -1278,7 +1278,7 @@ icmp_echo_config_setup(void)
>   fs->rx_port = fwd_ports_ids[rxp];
>   fs->rx_queue = rxq;
>   fs->tx_port = fs->rx_port;
> - fs->tx_queue = lc_id;
> + fs->tx_queue = rxq;
>   fs->peer_addr = fs->tx_port;
>   if (verbose_level > 0)
>   printf("  stream=%d port=%d rxq=%d
> txq=%d\n",
> --
> 1.9.1

Acked-by: Pablo de Lara 


[dpdk-dev] support for X552/X557-AT 10GBase-T devices

2015-11-10 Thread Aws Ismail
I am wondering if there is support for such device in the ixgbe PMD.

the dpdk nic bind script seems to see them correctly but when running
testpmd with those ports, they always come with link status down.

>From the dpdk_nic_bind script (snip):

Network devices using DPDK-compatible driver

:03:00.0 'Ethernet Connection X552/X557-AT 10GBASE-T' drv=igb_uio unused=
:03:00.1 'Ethernet Connection X552/X557-AT 10GBASE-T' drv=igb_uio unused=

And I am starting testpmd with this command line:

./testpmd -c 0x7  -n 4 -- -i

I have enabled all the ixgbe debugging messages and I have noticed
this messages when testpmd starts:

PMD: ixgbe_device_supports_autoneg_fc(): Device 15ad does not support
flow control autoneg

I am using the latest dpdk on master branch as of today.


[dpdk-dev] [PATCH v4 0/2] Add support for driver directories

2015-11-10 Thread David Marchand
Hello,

On Tue, Nov 10, 2015 at 3:28 PM, Panu Matilainen 
wrote:

> This mini-series adds support for driver directory concept
> based on idea by Thomas Monjalon back in February:
> http://dpdk.org/ml/archives/dev/2015-February/013285.html
>
> In the process FreeBSD also gains plugin support (but untested).
>
> v4: - introduce error-early behavior for invalid plugin paths
> - support directories via the existing -d option instead of adding new
>
> v3: - merge the first commits
>
> v2: - move code to eal/common
> - add bsd support
>
> Panu Matilainen (2):
>   eal: move plugin loading to eal/common
>   eal: add support for driver directory concept


checkpatch complains for some indent problem (Thomas, can you fix this ?),
but the rest looks good to me.

Acked-by: David Marchand 

Thanks Panu.

-- 
David Marchand


[dpdk-dev] [dpdk-users] Why packet_type is zero?

2015-11-10 Thread Thomas Monjalon
Thanks for reporting.

2015-11-10 15:46, Arseniy Zaostrovnykh:
> Is the pcap driver obsolete?

No

> L3fwd example(http://dpdk.org/doc/guides/sample_app_ug/l3_forward.html) 
> check the mbuf field packet_type, and in the zero case (which is a 
> default value, as far as I know) it does nothing. At the same time, only 
> few drivers even mention this field:
> 
> dpdk-2.1.0 $ grep packet_type drivers -Rl
>  drivers/net/enic/enic_main.c
>  drivers/net/e1000/igb_rxtx.c
>  drivers/net/ixgbe/ixgbe_rxtx.c
>  drivers/net/mlx4/mlx4.c
>  drivers/net/i40e/i40e_rxtx.c
>  drivers/net/mpipe/mpipe_tilegx.c
>  drivers/net/vmxnet3/vmxnet3_rxtx.c
>  drivers/net/fm10k/fm10k_rxtx.c
>  drivers/net/cxgbe/sge.c
> 
> And a PCap driver (drivers/net/pcap/rte_eth_pcap.c) specifically, does 
> not alter the field, so L3fwd application drops all packets.

The zero value is acceptable.
#define RTE_PTYPE_UNKNOWN   0x

Maybe a fix is required in the l3fwd example?
Or maybe it should be explicit that it works with only few drivers.

More generally, the packet type is not mandatory for drivers.
At a time we were talking about implementing a generic callback to
fill it. Or it can be filled in an application fallback with parsing.



[dpdk-dev] [PATCH] ixgbe: fix crc-strip enable changing rx bytes

2015-11-10 Thread Van Haaren, Harry
Hi Stephen,

> From: Stephen Hemminger [mailto:shemming at brocade.com]
> Subject: Re: [PATCH] ixgbe: fix crc-strip enable changing rx bytes
> 
> Harry van Haaren  wrote:
> > 
> > This patch reads the CRC strip register, and when enabled adds 4 bytes
> > to the total bytes recieved counter for each received packet.
> > 
> 
> NAK.
> 
> The CRC should never be part of rx/tx statistics.
> 
> The problem with putting CRC in statistics is the behavior introduces a
> device and setting dependency. This is a disaster for generic programs (like 
> vRouter)
> that want to work across multiple hardware and virtual NIC's.
> 
> Also, Linux, BSD, and Unix do not include CRC in reported bytes for network
> interfaces.
> 
> Please fix up my original patch to work for both settings, or I can do it.

I understand your point that generic programs should not require knowledge of 
if CRC bytes are included in the packet-size or not, and agree that this should 
be consistent in DPDK / Linux / BSD etc.

I will rework the PMDs to report byte counters without CRC bytes, and mark this 
patch as superseded.

-Harry


[dpdk-dev] [PATCH v3 6/6] doc: update 2.2 release notes

2015-11-10 Thread Matej Vido
Add szedata2 PMD to 2.2 release notes.

Signed-off-by: Matej Vido 
---
 doc/guides/rel_notes/release_2_2.rst | 4 
 1 file changed, 4 insertions(+)

diff --git a/doc/guides/rel_notes/release_2_2.rst 
b/doc/guides/rel_notes/release_2_2.rst
index ca8471b..2ae9ba3 100644
--- a/doc/guides/rel_notes/release_2_2.rst
+++ b/doc/guides/rel_notes/release_2_2.rst
@@ -90,6 +90,10 @@ New Features

 * **Added port hotplug support to xenvirt.**

+* **Added virtual szedata2 driver for COMBO cards.**
+
+  Added virtual PMD for COMBO-100G and COMBO-80G cards.
+  PMD is disabled in default configuration.

 Resolved Issues
 ---
-- 
1.9.1



[dpdk-dev] [PATCH v3 5/6] doc: add documentation for szedata2 PMD

2015-11-10 Thread Matej Vido
v3:
Edit formatting.
Add links.

Signed-off-by: Matej Vido 
---
 doc/guides/nics/index.rst|   1 +
 doc/guides/nics/szedata2.rst | 127 +++
 doc/guides/prog_guide/source_org.rst |   1 +
 3 files changed, 129 insertions(+)
 create mode 100644 doc/guides/nics/szedata2.rst

diff --git a/doc/guides/nics/index.rst b/doc/guides/nics/index.rst
index 2d4936d..0a0b724 100644
--- a/doc/guides/nics/index.rst
+++ b/doc/guides/nics/index.rst
@@ -46,6 +46,7 @@ Network Interface Controller Drivers
 intel_vf
 mlx4
 mlx5
+szedata2
 virtio
 vmxnet3
 pcap_ring
diff --git a/doc/guides/nics/szedata2.rst b/doc/guides/nics/szedata2.rst
new file mode 100644
index 000..b952b46
--- /dev/null
+++ b/doc/guides/nics/szedata2.rst
@@ -0,0 +1,127 @@
+..  BSD LICENSE
+Copyright 2015 CESNET
+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 CESNET 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.
+
+SZEDATA2 poll mode driver library
+=
+
+The SZEDATA2 poll mode driver library implements support for cards from COMBO
+family (**COMBO-80G**, **COMBO-100G**).
+The SZEDATA2 PMD is virtual PMD which uses interface provided by libsze2
+library to communicate with COMBO cards over sze2 layer.
+
+More information about family of
+`COMBO cards `_
+and used technology
+(`NetCOPE platform `_) can be
+found on the `Liberouter website `_.
+
+.. note::
+
+   This driver has external dependencies.
+   Therefore it is disabled in default configuration files.
+   It can be enabled by setting ``CONFIG_RTE_LIBRTE_PMD_SZEDATA2=y``
+   and recompiling.
+
+Prerequisities
+--
+
+This PMD requires kernel modules which are responsible for initialization and
+allocation of resources needed for sze2 layer function.
+Communication between PMD and kernel modules is mediated by libsze2 library.
+These kernel modules and library are not part of DPDK and must be installed
+separately:
+
+*  **libsze2 library**
+
+   The library provides API for initialization of sze2 transfers, receiving and
+   transmitting data segments.
+
+*  **Kernel modules**
+
+   * combov3
+   * szedata2_cv3
+
+   Kernel modules manage initialization of hardware, allocation and
+   sharing of resources for user space applications:
+
+Information about getting the dependencies can be found `here
+`_.
+
+
+Using the SZEDATA2 PMD
+--
+
+SZEDATA2 PMD can be created by passing ``--vdev=`` option to EAL in the
+following format:
+
+.. code-block:: console
+
+   --vdev 'DEVICE,dev_path=PATH,rx_ifaces=RX_MASK,tx_ifaces=TX_MASK'
+
+``DEVICE`` and options ``dev_path``, ``rx_ifaces``, ``tx_ifaces`` are mandatory
+and must be separated by commas.
+
+*  ``DEVICE``: contains prefix ``eth_szedata2`` followed by numbers or letters,
+   must be unique for each virtual device
+
+*  ``dev_path``: Defines path to szedata2 device.
+   Value is valid path to szedata2 device. Example:
+
+   .. code-block:: console
+
+  dev_path=/dev/szedataII0
+
+*  ``rx_ifaces``: Defines which receive channels will be used.
+   For each channel is created one queue. Value is mask for selecting which
+   receive channels are required. Example:
+
+   .. code-block:: console
+
+  rx_ifaces=0x3
+
+*  ``tx_ifaces``: Defines which transmit channels will be used.
+   For 

[dpdk-dev] [PATCH v3 4/6] szedata2: add support for scattered packets in RX

2015-11-10 Thread Matej Vido
Add new RX function for handling scattered packets.

Signed-off-by: Matej Vido 
---
 drivers/net/szedata2/rte_eth_szedata2.c | 351 +++-
 1 file changed, 349 insertions(+), 2 deletions(-)

diff --git a/drivers/net/szedata2/rte_eth_szedata2.c 
b/drivers/net/szedata2/rte_eth_szedata2.c
index 3213a20..22c99e4 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.c
+++ b/drivers/net/szedata2/rte_eth_szedata2.c
@@ -359,6 +359,338 @@ eth_szedata2_rx(void *queue,
 }

 static uint16_t
+eth_szedata2_rx_scattered(void *queue,
+   struct rte_mbuf **bufs,
+   uint16_t nb_pkts)
+{
+   unsigned int i;
+   struct rte_mbuf *mbuf;
+   struct szedata2_rx_queue *sze_q = queue;
+   struct rte_pktmbuf_pool_private *mbp_priv;
+   uint16_t num_rx = 0;
+   uint16_t buf_size;
+   uint16_t sg_size;
+   uint16_t hw_size;
+   uint16_t packet_size;
+   uint64_t num_bytes = 0;
+   struct szedata *sze = sze_q->sze;
+   uint8_t *header_ptr = NULL; /* header of packet */
+   uint8_t *packet_ptr1 = NULL;
+   uint8_t *packet_ptr2 = NULL;
+   uint16_t packet_len1 = 0;
+   uint16_t packet_len2 = 0;
+   uint16_t hw_data_align;
+
+   if (unlikely(sze_q->sze == NULL || nb_pkts == 0))
+   return 0;
+
+   /*
+* Reads the given number of packets from szedata2 channel given
+* by queue and copies the packet data into a newly allocated mbuf
+* to return.
+*/
+   for (i = 0; i < nb_pkts; i++) {
+   const struct szedata_lock *ct_rx_lck_backup;
+   unsigned int ct_rx_rem_bytes_backup;
+   unsigned char *ct_rx_cur_ptr_backup;
+
+   /* get the next sze packet */
+   if (sze->ct_rx_lck != NULL && !sze->ct_rx_rem_bytes &&
+   sze->ct_rx_lck->next == NULL) {
+   /* unlock old data */
+   szedata_rx_unlock_data(sze_q->sze, sze->ct_rx_lck_orig);
+   sze->ct_rx_lck_orig = NULL;
+   sze->ct_rx_lck = NULL;
+   }
+
+   /*
+* Store items from sze structure which can be changed
+* before mbuf allocating. Use these items in case of mbuf
+* allocating failure.
+*/
+   ct_rx_lck_backup = sze->ct_rx_lck;
+   ct_rx_rem_bytes_backup = sze->ct_rx_rem_bytes;
+   ct_rx_cur_ptr_backup = sze->ct_rx_cur_ptr;
+
+   if (!sze->ct_rx_rem_bytes && sze->ct_rx_lck_orig == NULL) {
+   /* nothing to read, lock new data */
+   sze->ct_rx_lck = szedata_rx_lock_data(sze_q->sze, ~0U);
+   sze->ct_rx_lck_orig = sze->ct_rx_lck;
+
+   /*
+* Backup items from sze structure must be updated
+* after locking to contain pointers to new locks.
+*/
+   ct_rx_lck_backup = sze->ct_rx_lck;
+   ct_rx_rem_bytes_backup = sze->ct_rx_rem_bytes;
+   ct_rx_cur_ptr_backup = sze->ct_rx_cur_ptr;
+
+   if (sze->ct_rx_lck == NULL)
+   /* nothing to lock */
+   break;
+
+   sze->ct_rx_cur_ptr = sze->ct_rx_lck->start;
+   sze->ct_rx_rem_bytes = sze->ct_rx_lck->len;
+
+   if (!sze->ct_rx_rem_bytes)
+   break;
+   }
+
+   if (sze->ct_rx_rem_bytes < RTE_SZE2_PACKET_HEADER_SIZE) {
+   /*
+* cut in header - copy parts of header to merge buffer
+*/
+   if (sze->ct_rx_lck->next == NULL)
+   break;
+
+   /* copy first part of header */
+   rte_memcpy(sze->ct_rx_buffer, sze->ct_rx_cur_ptr,
+   sze->ct_rx_rem_bytes);
+
+   /* copy second part of header */
+   sze->ct_rx_lck = sze->ct_rx_lck->next;
+   sze->ct_rx_cur_ptr = sze->ct_rx_lck->start;
+   rte_memcpy(sze->ct_rx_buffer + sze->ct_rx_rem_bytes,
+   sze->ct_rx_cur_ptr,
+   RTE_SZE2_PACKET_HEADER_SIZE -
+   sze->ct_rx_rem_bytes);
+
+   sze->ct_rx_cur_ptr += RTE_SZE2_PACKET_HEADER_SIZE -
+   sze->ct_rx_rem_bytes;
+   sze->ct_rx_rem_bytes = sze->ct_rx_lck->len -
+   RTE_SZE2_PACKET_HEADER_SIZE +
+   sze->ct_rx_rem_bytes;
+
+   header_ptr = (uint8_t *)sze->ct_rx_buffer;
+   } else {
+   /* not 

[dpdk-dev] [PATCH v3 3/6] szedata2: add TX function

2015-11-10 Thread Matej Vido
TX function handles scattered and non-scattered packets.

Signed-off-by: Matej Vido 
---
 drivers/net/szedata2/rte_eth_szedata2.c | 216 +++-
 1 file changed, 215 insertions(+), 1 deletion(-)

diff --git a/drivers/net/szedata2/rte_eth_szedata2.c 
b/drivers/net/szedata2/rte_eth_szedata2.c
index 785ac88..3213a20 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.c
+++ b/drivers/net/szedata2/rte_eth_szedata2.c
@@ -358,6 +358,220 @@ eth_szedata2_rx(void *queue,
return num_rx;
 }

+static uint16_t
+eth_szedata2_tx(void *queue,
+   struct rte_mbuf **bufs,
+   uint16_t nb_pkts)
+{
+   struct rte_mbuf *mbuf;
+   struct szedata2_tx_queue *sze_q = queue;
+   uint16_t num_tx = 0;
+   uint64_t num_bytes = 0;
+
+   const struct szedata_lock *lck;
+   uint32_t lock_size;
+   uint32_t lock_size2;
+   void *dst;
+   uint32_t pkt_len;
+   uint32_t hwpkt_len;
+   uint32_t unlock_size;
+   uint32_t rem_len;
+   uint8_t mbuf_segs;
+   uint16_t pkt_left = nb_pkts;
+
+   if (sze_q->sze == NULL || nb_pkts == 0)
+   return 0;
+
+   while (pkt_left > 0) {
+   unlock_size = 0;
+   lck = szedata_tx_lock_data(sze_q->sze,
+   RTE_ETH_SZEDATA2_TX_LOCK_SIZE,
+   sze_q->tx_channel);
+   if (lck == NULL)
+   continue;
+
+   dst = lck->start;
+   lock_size = lck->len;
+   lock_size2 = lck->next ? lck->next->len : 0;
+
+next_packet:
+   mbuf = bufs[nb_pkts - pkt_left];
+
+   pkt_len = mbuf->pkt_len;
+   mbuf_segs = mbuf->nb_segs;
+
+   hwpkt_len = RTE_SZE2_PACKET_HEADER_SIZE_ALIGNED +
+   RTE_SZE2_ALIGN8(pkt_len);
+
+   if (lock_size + lock_size2 < hwpkt_len) {
+   szedata_tx_unlock_data(sze_q->sze, lck, unlock_size);
+   continue;
+   }
+
+   num_bytes += pkt_len;
+
+   if (lock_size > hwpkt_len) {
+   void *tmp_dst;
+
+   rem_len = 0;
+
+   /* write packet length at first 2 bytes in 8B header */
+   *((uint16_t *)dst) = htole16(
+   RTE_SZE2_PACKET_HEADER_SIZE_ALIGNED +
+   pkt_len);
+   *(((uint16_t *)dst) + 1) = htole16(0);
+
+   /* copy packet from mbuf */
+   tmp_dst = ((uint8_t *)(dst)) +
+   RTE_SZE2_PACKET_HEADER_SIZE_ALIGNED;
+   if (mbuf_segs == 1) {
+   /*
+* non-scattered packet,
+* transmit from one mbuf
+*/
+   rte_memcpy(tmp_dst,
+   rte_pktmbuf_mtod(mbuf, const void *),
+   pkt_len);
+   } else {
+   /* scattered packet, transmit from more mbufs */
+   struct rte_mbuf *m = mbuf;
+   while (m) {
+   rte_memcpy(tmp_dst,
+   rte_pktmbuf_mtod(m,
+   const void *),
+   m->data_len);
+   tmp_dst = ((uint8_t *)(tmp_dst)) +
+   m->data_len;
+   m = m->next;
+   }
+   }
+
+
+   dst = ((uint8_t *)dst) + hwpkt_len;
+   unlock_size += hwpkt_len;
+   lock_size -= hwpkt_len;
+
+   rte_pktmbuf_free(mbuf);
+   num_tx++;
+   pkt_left--;
+   if (pkt_left == 0) {
+   szedata_tx_unlock_data(sze_q->sze, lck,
+   unlock_size);
+   break;
+   }
+   goto next_packet;
+   } else if (lock_size + lock_size2 >= hwpkt_len) {
+   void *tmp_dst;
+   uint16_t write_len;
+
+   /* write packet length at first 2 bytes in 8B header */
+   *((uint16_t *)dst) =
+   htole16(RTE_SZE2_PACKET_HEADER_SIZE_ALIGNED +
+   pkt_len);
+   *(((uint16_t *)dst) + 1) = htole16(0);
+
+   /*
+* If the raw packet (pkt_len) is smaller than lock_size
+* get 

[dpdk-dev] [PATCH v3 2/6] szedata2: add non-scattered RX function

2015-11-10 Thread Matej Vido
Signed-off-by: Matej Vido 
---
 drivers/net/szedata2/rte_eth_szedata2.c | 235 +++-
 1 file changed, 234 insertions(+), 1 deletion(-)

diff --git a/drivers/net/szedata2/rte_eth_szedata2.c 
b/drivers/net/szedata2/rte_eth_szedata2.c
index 7edaefc..785ac88 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.c
+++ b/drivers/net/szedata2/rte_eth_szedata2.c
@@ -125,6 +125,239 @@ count_ones(uint32_t num)
return (((num + (num >> 4)) & 0xF0F0F0F) * 0x1010101) >> 24; /* count */
 }

+static uint16_t
+eth_szedata2_rx(void *queue,
+   struct rte_mbuf **bufs,
+   uint16_t nb_pkts)
+{
+   unsigned int i;
+   struct rte_mbuf *mbuf;
+   struct szedata2_rx_queue *sze_q = queue;
+   struct rte_pktmbuf_pool_private *mbp_priv;
+   uint16_t num_rx = 0;
+   uint16_t buf_size;
+   uint16_t sg_size;
+   uint16_t hw_size;
+   uint16_t packet_size;
+   uint64_t num_bytes = 0;
+   struct szedata *sze = sze_q->sze;
+   uint8_t *header_ptr = NULL; /* header of packet */
+   uint8_t *packet_ptr1 = NULL;
+   uint8_t *packet_ptr2 = NULL;
+   uint16_t packet_len1 = 0;
+   uint16_t packet_len2 = 0;
+   uint16_t hw_data_align;
+
+   if (unlikely(sze_q->sze == NULL || nb_pkts == 0))
+   return 0;
+
+   /*
+* Reads the given number of packets from szedata2 channel given
+* by queue and copies the packet data into a newly allocated mbuf
+* to return.
+*/
+   for (i = 0; i < nb_pkts; i++) {
+   mbuf = rte_pktmbuf_alloc(sze_q->mb_pool);
+
+   if (unlikely(mbuf == NULL))
+   break;
+
+   /* get the next sze packet */
+   if (sze->ct_rx_lck != NULL && !sze->ct_rx_rem_bytes &&
+   sze->ct_rx_lck->next == NULL) {
+   /* unlock old data */
+   szedata_rx_unlock_data(sze_q->sze, sze->ct_rx_lck_orig);
+   sze->ct_rx_lck_orig = NULL;
+   sze->ct_rx_lck = NULL;
+   }
+
+   if (!sze->ct_rx_rem_bytes && sze->ct_rx_lck_orig == NULL) {
+   /* nothing to read, lock new data */
+   sze->ct_rx_lck = szedata_rx_lock_data(sze_q->sze, ~0U);
+   sze->ct_rx_lck_orig = sze->ct_rx_lck;
+
+   if (sze->ct_rx_lck == NULL) {
+   /* nothing to lock */
+   rte_pktmbuf_free(mbuf);
+   break;
+   }
+
+   sze->ct_rx_cur_ptr = sze->ct_rx_lck->start;
+   sze->ct_rx_rem_bytes = sze->ct_rx_lck->len;
+
+   if (!sze->ct_rx_rem_bytes) {
+   rte_pktmbuf_free(mbuf);
+   break;
+   }
+   }
+
+   if (sze->ct_rx_rem_bytes < RTE_SZE2_PACKET_HEADER_SIZE) {
+   /*
+* cut in header
+* copy parts of header to merge buffer
+*/
+   if (sze->ct_rx_lck->next == NULL) {
+   rte_pktmbuf_free(mbuf);
+   break;
+   }
+
+   /* copy first part of header */
+   rte_memcpy(sze->ct_rx_buffer, sze->ct_rx_cur_ptr,
+   sze->ct_rx_rem_bytes);
+
+   /* copy second part of header */
+   sze->ct_rx_lck = sze->ct_rx_lck->next;
+   sze->ct_rx_cur_ptr = sze->ct_rx_lck->start;
+   rte_memcpy(sze->ct_rx_buffer + sze->ct_rx_rem_bytes,
+   sze->ct_rx_cur_ptr,
+   RTE_SZE2_PACKET_HEADER_SIZE -
+   sze->ct_rx_rem_bytes);
+
+   sze->ct_rx_cur_ptr += RTE_SZE2_PACKET_HEADER_SIZE -
+   sze->ct_rx_rem_bytes;
+   sze->ct_rx_rem_bytes = sze->ct_rx_lck->len -
+   RTE_SZE2_PACKET_HEADER_SIZE +
+   sze->ct_rx_rem_bytes;
+
+   header_ptr = (uint8_t *)sze->ct_rx_buffer;
+   } else {
+   /* not cut */
+   header_ptr = (uint8_t *)sze->ct_rx_cur_ptr;
+   sze->ct_rx_cur_ptr += RTE_SZE2_PACKET_HEADER_SIZE;
+   sze->ct_rx_rem_bytes -= RTE_SZE2_PACKET_HEADER_SIZE;
+   }
+
+   sg_size = le16toh(*((uint16_t *)header_ptr));
+   hw_size = le16toh(*(((uint16_t *)header_ptr) + 1));
+   packet_size = sg_size -
+   RTE_SZE2_ALIGN8(RTE_SZE2_PACKET_HEADER_SIZE + hw_size);
+
+
+   /* checks if packet all 

[dpdk-dev] [PATCH v3 1/6] szedata2: add new poll mode driver

2015-11-10 Thread Matej Vido
Add virtual PMD which communicates with COMBO cards through sze2
layer using libsze2 library.

Since link_speed is uint16_t, there can not be used number for 100G
speed, therefore link_speed is set to ETH_LINK_SPEED_10G until the
type of link_speed is solved.

v3:
Fix checkpatch.pl issues.
Move RX, TX functions to separate patches.

v2:
Code cleanup.
Fix error handling by initialization of rx, tx dma channels.
Add uninit function.

Signed-off-by: Matej Vido 
---
 config/common_bsdapp  |   5 +
 config/common_linuxapp|   5 +
 drivers/net/Makefile  |   1 +
 drivers/net/szedata2/Makefile |  62 ++
 drivers/net/szedata2/rte_eth_szedata2.c   | 830 ++
 drivers/net/szedata2/rte_eth_szedata2.h   | 102 +++
 drivers/net/szedata2/rte_pmd_szedata2_version.map |   3 +
 mk/rte.app.mk |   3 +
 8 files changed, 1011 insertions(+)
 create mode 100644 drivers/net/szedata2/Makefile
 create mode 100644 drivers/net/szedata2/rte_eth_szedata2.c
 create mode 100644 drivers/net/szedata2/rte_eth_szedata2.h
 create mode 100644 drivers/net/szedata2/rte_pmd_szedata2_version.map

diff --git a/config/common_bsdapp b/config/common_bsdapp
index fba29e5..cd856ad 100644
--- a/config/common_bsdapp
+++ b/config/common_bsdapp
@@ -284,6 +284,11 @@ CONFIG_RTE_PMD_RING_MAX_TX_RINGS=16
 CONFIG_RTE_LIBRTE_PMD_PCAP=y

 #
+# Compile software PMD backed by SZEDATA2 device
+#
+CONFIG_RTE_LIBRTE_PMD_SZEDATA2=n
+
+#
 # Compile link bonding PMD library
 #
 CONFIG_RTE_LIBRTE_PMD_BOND=y
diff --git a/config/common_linuxapp b/config/common_linuxapp
index 7248262..fef5bde 100644
--- a/config/common_linuxapp
+++ b/config/common_linuxapp
@@ -282,6 +282,11 @@ CONFIG_RTE_PMD_RING_MAX_TX_RINGS=16
 CONFIG_RTE_LIBRTE_PMD_PCAP=n

 #
+# Compile software PMD backed by SZEDATA2 device
+#
+CONFIG_RTE_LIBRTE_PMD_SZEDATA2=n
+
+#
 # Compile link bonding PMD library
 #
 CONFIG_RTE_LIBRTE_PMD_BOND=y
diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index 6da1ce2..e05d2e5 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -49,6 +49,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += ring
 DIRS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtio
 DIRS-$(CONFIG_RTE_LIBRTE_VMXNET3_PMD) += vmxnet3
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += xenvirt
+DIRS-$(CONFIG_RTE_LIBRTE_PMD_SZEDATA2) += szedata2

 include $(RTE_SDK)/mk/rte.sharelib.mk
 include $(RTE_SDK)/mk/rte.subdir.mk
diff --git a/drivers/net/szedata2/Makefile b/drivers/net/szedata2/Makefile
new file mode 100644
index 000..c3c42e5
--- /dev/null
+++ b/drivers/net/szedata2/Makefile
@@ -0,0 +1,62 @@
+#   BSD LICENSE
+#
+#   Copyright (c) 2015 CESNET
+#   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 CESNET 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 $(RTE_SDK)/mk/rte.vars.mk
+
+#
+# library name
+#
+LIB = librte_pmd_szedata2.a
+
+CFLAGS += -O3
+CFLAGS += $(WERROR_FLAGS)
+
+EXPORT_MAP := rte_pmd_szedata2_version.map
+
+LIBABIVER := 1
+
+#
+# all source are stored in SRCS-y
+#
+SRCS-$(CONFIG_RTE_LIBRTE_PMD_SZEDATA2) += rte_eth_szedata2.c
+
+#
+# Export include files
+#
+SYMLINK-y-include +=
+
+# this lib depends upon:
+DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_SZEDATA2) += lib/librte_mbuf
+DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_SZEDATA2) += lib/librte_ether
+DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_SZEDATA2) += lib/librte_malloc
+DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_SZEDATA2) += lib/librte_kvargs
+
+include 

[dpdk-dev] [PATCH v3 0/6] Virtual PMD using sze2 layer for COMBO cards

2015-11-10 Thread Matej Vido
This is virtual PMD which communicates with COMBO-80G and COMBO-100G
cards through sze2 layer. Communication with COMBO card is managed
through interface provided by libsze2 library and kernel modules
(combov3, szedata2_cv3).

To compile and use PMD, it is necessary to have libsze2 library installed and
kernel modules (combov3, szedata2_cv3) loaded.
Therefore in default configuration PMD compilation is disabled. To compile
szedata2 PMD, it is necessary to enable CONFIG_RTE_LIBRTE_PMD_SZEDATA2=y.

v3:
Fix checkpatch.pl issues.
Edit documentation.
Introduce RX and TX in separate patches.

v2:
code cleanup
add handling scattered packets
update release notes

Matej Vido (6):
  szedata2: add new poll mode driver
  szedata2: add non-scattered RX function
  szedata2: add TX function
  szedata2: add support for scattered packets in RX
  doc: add documentation for szedata2 PMD
  doc: update 2.2 release notes

 config/common_bsdapp  |5 +
 config/common_linuxapp|5 +
 doc/guides/nics/index.rst |1 +
 doc/guides/nics/szedata2.rst  |  127 ++
 doc/guides/prog_guide/source_org.rst  |1 +
 doc/guides/rel_notes/release_2_2.rst  |4 +
 drivers/net/Makefile  |1 +
 drivers/net/szedata2/Makefile |   62 +
 drivers/net/szedata2/rte_eth_szedata2.c   | 1624 +
 drivers/net/szedata2/rte_eth_szedata2.h   |  102 ++
 drivers/net/szedata2/rte_pmd_szedata2_version.map |3 +
 mk/rte.app.mk |3 +
 12 files changed, 1938 insertions(+)
 create mode 100644 doc/guides/nics/szedata2.rst
 create mode 100644 drivers/net/szedata2/Makefile
 create mode 100644 drivers/net/szedata2/rte_eth_szedata2.c
 create mode 100644 drivers/net/szedata2/rte_eth_szedata2.h
 create mode 100644 drivers/net/szedata2/rte_pmd_szedata2_version.map

-- 
1.9.1



[dpdk-dev] [PATCH v5 1/7] ethdev: add additional ieee1588 support functions

2015-11-10 Thread Liu, Yong
Hi Thomas& John,
Some update from validation team.

> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Mcnamara, John
> Sent: Tuesday, November 10, 2015 10:12 PM
> To: Thomas Monjalon
> Cc: dev at dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v5 1/7] ethdev: add additional ieee1588
> support functions
> 
> > -Original Message-
> > From: Thomas Monjalon [mailto:thomas.monjalon at 6wind.com]
> > Sent: Tuesday, November 10, 2015 11:58 AM
> > To: Mcnamara, John
> > Cc: Mrzyglod, DanielX T; dev at dpdk.org
> > Subject: Re: [dpdk-dev] [PATCH v5 1/7] ethdev: add additional ieee1588
> > support functions
> >
> > 2015-11-10 11:36, Mcnamara, John:
> > > From: Thomas Monjalon
> > > > I'll try to fix it now to be sure it will be one of the first series
> > > > ready for the 2.3 cycle.
> > >
> > > These comments are minor and could be fixed now.
> >
> > After having a closer look in the drivers change, it seems to be
> > restricted to the PTP functions of the Intel drivers.
> > So you can ask to the Intel validation team if they are OK to add it in
> > RC2.
> > I think it would be a wrong idea because we need to stop moving the
> ethdev
> > and drivers code, and focus on other DPDK areas for the RC2.
> 
> Hi Thomas,
> 
> Ok. I'll ask the validation team to evaluate the effect of the patches.
> 
> 

For our validation team's view, in this patch set implemented some APIs which 
used to support Precision Time Protocol.
The sample based those APIs can work as real ptp client. We have verified it 
work fine with linux ptp server.




[dpdk-dev] [PATCH v5 1/7] ethdev: add additional ieee1588 support functions

2015-11-10 Thread Thomas Monjalon
2015-11-10 14:12, Mcnamara, John:
> My preference would be for verb_noun but I think noun_verb was used for 
> consistency with the rest of the Ethdev API (although that isn't quite 
> consistent either). And yes, read() would be more consistent with the 
> timesync API while get() is more consistent with the rest of the Ethdev API. 
> I think it would be best, in this case, to try maintain self-consistency and 
> use rte_eth_timesync_read_time().

Yes, self consistency seems a good option.


[dpdk-dev] [PATCH v4 1/3] rte: add keep alive functionality

2015-11-10 Thread Thomas Monjalon
Hi,

2015-11-05 11:32, Remy Horton:
> +/**
> + * @param *ptr_timer Triggering timer (unused)
> + * @param *ptr_data  Data pointer (keepalive structure)
> + */
> +void rte_keepalive_dispatch_pings(void *ptr_timer, void *ptr_data);

There is no description for this function.
Why ptr_timer is unused?

> +#ifdef KEEPALIVE_DEBUG_MSGS
> +static void
> +print_trace(const char *msg, struct rte_keepalive *keepcfg, int idx_core)
> +{
> + printf("%sLast seen %" PRId64  "ms ago.\n",
> + msg,
> + ((rte_rdtsc() - keepcfg->last_alive[idx_core])*1000)
> + / rte_get_tsc_hz()
> +   );
> +}
> +#else
> +static void
> +print_trace(__attribute__((unused)) const char *msg,
> + __attribute__((unused)) struct rte_keepalive *keepcfg,
> + __attribute__((unused)) int idx_core)
> +{
> +}
> +#endif

This function will never be tested and do not use rte_log.
Please remove it and use the logging functions.



[dpdk-dev] [PATCH v3 5/6] doc: add documentation for szedata2 PMD

2015-11-10 Thread Mcnamara, John
> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Matej Vido
> Sent: Tuesday, November 10, 2015 2:18 PM
> To: dev at dpdk.org
> Subject: [dpdk-dev] [PATCH v3 5/6] doc: add documentation for szedata2 PMD
> 
> v3:
> Edit formatting.
> Add links.
> 
> Signed-off-by: Matej Vido 

Acked-by: John McNamara 



[dpdk-dev] [PATCH v2] ethdev: Prefetch driver variable structure

2015-11-10 Thread Polehn, Mike A
Adds ethdev driver prefetch of variable structure to CPU cache 0
while calling into tx or rx device driver operation.

RFC 2544 test of NIC task test measurement points show improvement
of lower latency and/or better packet throughput indicating clock
cycles saved.

Signed-off-by: Mike A. Polehn 
---
lib/librte_ether/rte_ethdev.h | 16 +---
1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 48a540d..f1c35de 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -2458,12 +2458,17 @@ rte_eth_rx_burst(uint8_t port_id, uint16_t queue_id,
  struct rte_mbuf **rx_pkts, const uint16_t nb_pkts)
{
  struct rte_eth_dev *dev;
+  int16_t nb_rx;
   dev = _eth_devices[port_id];
-  int16_t nb_rx = (*dev->rx_pkt_burst)(dev->data->rx_queues[queue_id],
-rx_pkts, nb_pkts);
+  { /* limit scope of rxq variable */
+ /* rxq is going to be immediately used, prefetch it */
+ void *rxq = dev->data->rx_queues[queue_id];
+ rte_prefetch0(rxq);
+ nb_rx = (*dev->rx_pkt_burst)(rxq, rx_pkts, nb_pkts);
+  }
#ifdef RTE_ETHDEV_RXTX_CALLBACKS
  struct rte_eth_rxtx_callback *cb = dev->post_rx_burst_cbs[queue_id];
@@ -2600,6 +2605,7 @@ rte_eth_tx_burst(uint8_t port_id, uint16_t queue_id,
  struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
{
  struct rte_eth_dev *dev;
+  void *txq;
   dev = _eth_devices[port_id];
@@ -2615,7 +2621,11 @@ rte_eth_tx_burst(uint8_t port_id, uint16_t queue_id,
  }
#endif
-  return (*dev->tx_pkt_burst)(dev->data->tx_queues[queue_id], tx_pkts, 
nb_pkts);
+  /* txq is going to be immediately used, prefetch it */
+  txq = dev->data->tx_queues[queue_id];
+  rte_prefetch0(txq);
+
+  return (*dev->tx_pkt_burst)(txq, tx_pkts, nb_pkts);
}
#endif
--
2.6.0



[dpdk-dev] [PATCH v5 1/7] ethdev: add additional ieee1588 support functions

2015-11-10 Thread Mcnamara, John
> -Original Message-
> From: Thomas Monjalon [mailto:thomas.monjalon at 6wind.com]
> Sent: Tuesday, November 10, 2015 11:58 AM
> To: Mcnamara, John
> Cc: Mrzyglod, DanielX T; dev at dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v5 1/7] ethdev: add additional ieee1588
> support functions
> 
> 2015-11-10 11:36, Mcnamara, John:
> > From: Thomas Monjalon
> > > I'll try to fix it now to be sure it will be one of the first series
> > > ready for the 2.3 cycle.
> >
> > These comments are minor and could be fixed now.
> 
> After having a closer look in the drivers change, it seems to be
> restricted to the PTP functions of the Intel drivers.
> So you can ask to the Intel validation team if they are OK to add it in
> RC2.
> I think it would be a wrong idea because we need to stop moving the ethdev
> and drivers code, and focus on other DPDK areas for the RC2.

Hi Thomas,

Ok. I'll ask the validation team to evaluate the effect of the patches.


> 
> > > > +extern int rte_eth_timesync_time_get(uint8_t port_id,
> > > > + struct timespec *time);
> > >
> > > How is it different from rte_eth_timesync_read_rx_timestamp() and
> > > rte_eth_timesync_read_tx_timestamp()?
> > >
> > > Why repeating the word time? Why not rte_eth_timesync_get()?
> >
> > In the context of PTP there is a difference between the time (os or NIC)
> and the timestamp (either in the mbuf, a register or as part of the
> payload).
> 
> Do you think we can make it clear in the definition of these functions?

Yes. I think that could be made clearer. I'll fix that and the others.


> 
> More wording comments:
> - rte_eth_timesync_time_get
> - rte_eth_timesync_read_rx_timestamp
> Why is it "get" in a case and "read" in another?
> Why the verb is at the end in the first and before the complement in the
> latter?

My preference would be for verb_noun but I think noun_verb was used for 
consistency with the rest of the Ethdev API (although that isn't quite 
consistent either). And yes, read() would be more consistent with the timesync 
API while get() is more consistent with the rest of the Ethdev API. I think it 
would be best, in this case, to try maintain self-consistency and use 
rte_eth_timesync_read_time().


John.
-- 



[dpdk-dev] [PATCHv7 0/2] ixgbe: fix TX hang when RS distance exceeds HW limit

2015-11-10 Thread De Lara Guarch, Pablo


> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Konstantin
> Ananyev
> Sent: Tuesday, November 10, 2015 1:48 PM
> To: dev at dpdk.org
> Subject: [dpdk-dev] [PATCHv7 0/2] ixgbe: fix TX hang when RS distance
> exceeds HW limit
> 
> First patch contains changes in testpmd that allow to reproduce the issue.
> Second patch is the actual fix.
> 
> Konstantin Ananyev (2):
>   testpmd: add ability to split outgoing packets
>   ixgbe: fix TX hang when RS distance exceeds HW limit
> 
>  app/test-pmd/cmdline.c  |  57 +-
>  app/test-pmd/config.c   |  61 +++
>  app/test-pmd/csumonly.c | 163
> +++-
>  app/test-pmd/testpmd.c  |   3 +
>  app/test-pmd/testpmd.h  |  10 ++
>  app/test-pmd/txonly.c   |  13 ++-
>  app/test/test_pmd_perf.c|   8 +-
>  doc/guides/rel_notes/release_2_2.rst|   7 ++
>  doc/guides/testpmd_app_ug/testpmd_funcs.rst |  21 +++-
>  drivers/net/ixgbe/ixgbe_rxtx.c  |  32 +-
>  10 files changed, 357 insertions(+), 18 deletions(-)
> 
> --
> 1.8.3.1

Series-acked-by: Pablo de Lara 


[dpdk-dev] [PATCH v2] devargs: add blacklisting by linux interface name

2015-11-10 Thread Charles (Chas) Williams
On Thu, 2015-11-05 at 11:23 -0800, Stephen Hemminger wrote:
> On Thu, 05 Nov 2015 11:39:04 -0500
> "Charles (Chas) Williams" <3chas3 at gmail.com> wrote:
> 
> > On Wed, 2015-11-04 at 23:40 +0100, Thomas Monjalon wrote:
> > > 2015-10-14 09:41, Charles  Williams:  
> > > > On Tue, 2015-10-13 at 14:49 +0200, Olivier MATZ wrote:  
> > > > > For PCI devices that have several interfaces (I think it's the case 
> > > > > for
> > > > > some Mellanox boards), maybe we should not store the interface name?  
> > > > 
> > > > I am not sure what you mean here.  If a device has multiple ethernet
> > > > interfaces, then it should a have seperate PCI device address space for
> > > > each interface (I dont know of any DPDK drivers that don't make this
> > > > assumption as well).  
> > > 
> > > mlx4 and cxgbe?  
> > 
> > OK, I see now.  I don't know of a way to tell if a device has multiple
> > ports just from the pci vendor/device id without maintaining some
> > sort of table.
> > 
> > Do these devices have multiple interfaces listed in their
> > /sys/devices/.../net diretory?  If so, matching one of the listed
> > interfaces can just blacklist the whole device similar to blacklisting
> > by the device id.
> 
> Devices with multiple ports are supposed to report the port via 
> /sys/class/net/xxx/portid

But I want to find the ports associated by the PCI devices.


> But you aren't going to be able to blacklist only one port of these devices.
> The two drivers would be fighting over registers and IRQ management.
> Plus kernel bind/unbind is by PCI id.

I understand that.  Blacklisting an interface on a multiple port device
would be essentially the same as blacklist by the PCI device id.  You
can't split the PCI device.  I just need to find the list of ports
associated with a single PCI device.




[dpdk-dev] [PATCHv7 2/2] ixgbe: fix TX hang when RS distance exceeds HW limit

2015-11-10 Thread Konstantin Ananyev
One of the ways to reproduce the issue:

testpmd  -- -i --txqflags=0
testpmd> set fwd txonly
testpmd> set txpkts 
64,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4
testpmd> set txsplit rand
testpmd> start

After some time TX on ixgbe queue will hang,
and all packet transmission on that queue will stop.

This bug was first reported and investigated by
Vlad Zolotarov :
"We can reproduce this issue when stressed the xmit path with a lot of highly
fragmented TCP frames (packets with up to 33 fragments with non-headers
fragments as small as 4 bytes) with all offload features enabled."

The root cause is that ixgbe_xmit_pkts() in some cases violates the HW rule
that the distance between TDs with RS bit set should not exceed 40 TDs.

>From the latest 82599 spec update:
"When WTHRESH is set to zero, the software device driver should set the RS bit
in the Tx descriptors with the EOP bit set and at least once in the 40
descriptors."

The fix is to make sure that the distance between TDs with RS bit set
would never exceed HW limit.
As part of that fix, tx_rs_thresh for ixgbe PMD is not allowed to be greater
then to 32 to comply with HW restrictions.

With that fix slight slowdown for the full-featured ixgbe TX path
might be observed (from our testing - up to 4%).

ixgbe simple TX path is unaffected by that patch.

Reported-by: Vlad Zolotarov 
Signed-off-by: Konstantin Ananyev 
---
 app/test/test_pmd_perf.c |  8 
 doc/guides/rel_notes/release_2_2.rst |  7 +++
 drivers/net/ixgbe/ixgbe_rxtx.c   | 32 +++-
 3 files changed, 38 insertions(+), 9 deletions(-)

v5 changes:
- rework the patch to avoid setting RS bit on every EOP descriptor
 (while that approach is valid, it causes significant slowdown
  on the TX path: up to 25%).

v6 changes:
- fix pmd_perf_autotest
- fix error description
- update RN

v7 changes:
- move vN changes after the changed file list

diff --git a/app/test/test_pmd_perf.c b/app/test/test_pmd_perf.c
index 1fd6843..ef9262c 100644
--- a/app/test/test_pmd_perf.c
+++ b/app/test/test_pmd_perf.c
@@ -841,10 +841,10 @@ test_set_rxtx_conf(cmdline_fixed_string_t mode)
port_conf.rxmode.enable_scatter = 0;
return 0;
} else if (!strcmp(mode, "scalar")) {
-   /* bulk alloc rx, simple tx */
-   tx_conf.txq_flags = 0xf01;
-   tx_conf.tx_rs_thresh = 128;
-   tx_conf.tx_free_thresh = 128;
+   /* bulk alloc rx, full-featured tx */
+   tx_conf.txq_flags = 0;
+   tx_conf.tx_rs_thresh = 32;
+   tx_conf.tx_free_thresh = 32;
port_conf.rxmode.hw_ip_checksum = 1;
port_conf.rxmode.enable_scatter = 0;
return 0;
diff --git a/doc/guides/rel_notes/release_2_2.rst 
b/doc/guides/rel_notes/release_2_2.rst
index 59dda59..62e225b 100644
--- a/doc/guides/rel_notes/release_2_2.rst
+++ b/doc/guides/rel_notes/release_2_2.rst
@@ -134,6 +134,13 @@ Drivers

   VF needs the PF interrupt support initialized even if not started.

+* **ixgbe: Fixed TX hang when RS distance exceeds HW limit.**
+
+  Fixed an issue when TX queue can hang when a lot of highly fragmented
+  packets have to be sent.
+  As part of that fix, tx_rs_thresh for ixgbe PMD is not allowed to be greater
+  then to 32 to comply with HW restrictions.
+
 * **i40e: Fixed base driver allocation when not using first numa node.**

   Fixed i40e issue that occurred when a DPDK application didn't initialize
diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c
index 5561195..ca6fb69 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx.c
+++ b/drivers/net/ixgbe/ixgbe_rxtx.c
@@ -572,7 +572,7 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
struct ixgbe_tx_entry *sw_ring;
struct ixgbe_tx_entry *txe, *txn;
volatile union ixgbe_adv_tx_desc *txr;
-   volatile union ixgbe_adv_tx_desc *txd;
+   volatile union ixgbe_adv_tx_desc *txd, *txp;
struct rte_mbuf *tx_pkt;
struct rte_mbuf *m_seg;
uint64_t buf_dma_addr;
@@ -595,6 +595,7 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
txr = txq->tx_ring;
tx_id   = txq->tx_tail;
txe = _ring[tx_id];
+   txp = NULL;

/* Determine if the descriptor ring needs to be cleaned. */
if (txq->nb_tx_free < txq->tx_free_thresh)
@@ -638,6 +639,12 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 */
nb_used = (uint16_t)(tx_pkt->nb_segs + new_ctx);

+   if (txp != NULL &&
+   nb_used + txq->nb_tx_used >= txq->tx_rs_thresh)
+   /* set RS on the previous packet in the burst */
+   txp->read.cmd_type_len |=
+   rte_cpu_to_le_32(IXGBE_TXD_CMD_RS);
+
/*
 * The number of descriptors that must be 

[dpdk-dev] [PATCHv7 1/2] testpmd: add ability to split outgoing packets

2015-11-10 Thread Konstantin Ananyev
For CSUM forwarding mode add ability to copy & split outgoing packet
into the new mbuf that consists of multiple segments.
For TXONLY and CSUM forwarding modes add ability to make number of
segments in the outgoing packet to vary on a per packet basis.
Number of segments and size of each segment is controlled by
'set txpkts' command.
Split policy is controlled by 'set txsplit' command.
Possible values are: on | off | rand.
Tha allows to increase test coverage for TX PMD codepaths.

Signed-off-by: Konstantin Ananyev 
---
 app/test-pmd/cmdline.c  |  57 +-
 app/test-pmd/config.c   |  61 +++
 app/test-pmd/csumonly.c | 163 +++-
 app/test-pmd/testpmd.c  |   3 +
 app/test-pmd/testpmd.h  |  10 ++
 app/test-pmd/txonly.c   |  13 ++-
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  21 +++-
 7 files changed, 319 insertions(+), 9 deletions(-)

v6 changes:
- fix typos
- testpmd guide: fix invalid command description

v7 changes:
- move vN changes after the changed file list

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index c637198..a92fe0b 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -199,7 +199,7 @@ static void cmd_help_long_parsed(void *parsed_result,
"clear port (info|stats|xstats|fdir|stat_qmap) 
(port_id|all)\n"
"Clear information for port_id, or all.\n\n"

-   "show config (rxtx|cores|fwd)\n"
+   "show config (rxtx|cores|fwd|txpkts)\n"
"Display the given configuration.\n\n"

"read rxd (port_id) (queue_id) (rxd_id)\n"
@@ -246,7 +246,12 @@ static void cmd_help_long_parsed(void *parsed_result,

"set txpkts (x[,y]*)\n"
"Set the length of each segment of TXONLY"
-   " packets.\n\n"
+   " and optionally CSUM packets.\n\n"
+
+   "set txsplit (off|on|rand)\n"
+   "Set the split policy for the TX packets."
+   " Right now only applicable for CSUM and TXONLY"
+   " modes\n\n"

"set corelist (x[,y]*)\n"
"Set the list of forwarding cores.\n\n"
@@ -2621,6 +2626,47 @@ cmdline_parse_inst_t cmd_set_txpkts = {
},
 };

+/* *** SET COPY AND SPLIT POLICY ON TX PACKETS *** */
+
+struct cmd_set_txsplit_result {
+   cmdline_fixed_string_t cmd_keyword;
+   cmdline_fixed_string_t txsplit;
+   cmdline_fixed_string_t mode;
+};
+
+static void
+cmd_set_txsplit_parsed(void *parsed_result,
+ __attribute__((unused)) struct cmdline *cl,
+ __attribute__((unused)) void *data)
+{
+   struct cmd_set_txsplit_result *res;
+
+   res = parsed_result;
+   set_tx_pkt_split(res->mode);
+}
+
+cmdline_parse_token_string_t cmd_set_txsplit_keyword =
+   TOKEN_STRING_INITIALIZER(struct cmd_set_txsplit_result,
+cmd_keyword, "set");
+cmdline_parse_token_string_t cmd_set_txsplit_name =
+   TOKEN_STRING_INITIALIZER(struct cmd_set_txsplit_result,
+txsplit, "txsplit");
+cmdline_parse_token_string_t cmd_set_txsplit_mode =
+   TOKEN_STRING_INITIALIZER(struct cmd_set_txsplit_result,
+mode, NULL);
+
+cmdline_parse_inst_t cmd_set_txsplit = {
+   .f = cmd_set_txsplit_parsed,
+   .data = NULL,
+   .help_str = "set txsplit on|off|rand",
+   .tokens = {
+   (void *)_set_txsplit_keyword,
+   (void *)_set_txsplit_name,
+   (void *)_set_txsplit_mode,
+   NULL,
+   },
+};
+
 /* *** ADD/REMOVE ALL VLAN IDENTIFIERS TO/FROM A PORT VLAN RX FILTER *** */
 struct cmd_rx_vlan_filter_all_result {
cmdline_fixed_string_t rx_vlan;
@@ -5233,6 +5279,8 @@ static void cmd_showcfg_parsed(void *parsed_result,
fwd_lcores_config_display();
else if (!strcmp(res->what, "fwd"))
fwd_config_display();
+   else if (!strcmp(res->what, "txpkts"))
+   show_tx_pkt_segments();
 }

 cmdline_parse_token_string_t cmd_showcfg_show =
@@ -5241,12 +5289,12 @@ cmdline_parse_token_string_t cmd_showcfg_port =
TOKEN_STRING_INITIALIZER(struct cmd_showcfg_result, cfg, "config");
 cmdline_parse_token_string_t cmd_showcfg_what =
TOKEN_STRING_INITIALIZER(struct cmd_showcfg_result, what,
-"rxtx#cores#fwd");
+"rxtx#cores#fwd#txpkts");

 cmdline_parse_inst_t cmd_showcfg = {
.f = cmd_showcfg_parsed,
.data = NULL,
-   .help_str = "show config rxtx|cores|fwd",
+   .help_str = "show config rxtx|cores|fwd|txpkts",
.tokens = {
(void 

[dpdk-dev] [PATCHv7 0/2] ixgbe: fix TX hang when RS distance exceeds HW limit

2015-11-10 Thread Konstantin Ananyev
First patch contains changes in testpmd that allow to reproduce the issue.
Second patch is the actual fix.

Konstantin Ananyev (2):
  testpmd: add ability to split outgoing packets
  ixgbe: fix TX hang when RS distance exceeds HW limit

 app/test-pmd/cmdline.c  |  57 +-
 app/test-pmd/config.c   |  61 +++
 app/test-pmd/csumonly.c | 163 +++-
 app/test-pmd/testpmd.c  |   3 +
 app/test-pmd/testpmd.h  |  10 ++
 app/test-pmd/txonly.c   |  13 ++-
 app/test/test_pmd_perf.c|   8 +-
 doc/guides/rel_notes/release_2_2.rst|   7 ++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  21 +++-
 drivers/net/ixgbe/ixgbe_rxtx.c  |  32 +-
 10 files changed, 357 insertions(+), 18 deletions(-)

-- 
1.8.3.1



[dpdk-dev] [PATCH v2] l3fwd: fix lookup burst size for ipv6

2015-11-10 Thread Pattan, Reshma


> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Pablo de Lara
> Sent: Tuesday, November 3, 2015 8:14 PM
> To: dev at dpdk.org
> Subject: [dpdk-dev] [PATCH v2] l3fwd: fix lookup burst size for ipv6
> 
> Lookup burst size was changed for exact match from 4 to 8, for both ipv4 and
> ipv6, but actually only
> 4 keys were being looked up for ipv6, instead of 8, causing random
> segmentation faults.
> 
> Fixes: 80fcb4d4 ("examples/l3fwd: increase lookup burst size to 8")
> 
> Signed-off-by: Pablo de Lara 
> ---
> Changes in v2:
>  - Include update in release notes
> 
>  doc/guides/rel_notes/release_2_2.rst | 4 
>  examples/l3fwd/main.c| 2 +-
>  2 files changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/doc/guides/rel_notes/release_2_2.rst
> b/doc/guides/rel_notes/release_2_2.rst
> index b39a78a..0172354 100644
> --- a/doc/guides/rel_notes/release_2_2.rst
> +++ b/doc/guides/rel_notes/release_2_2.rst
> @@ -143,6 +143,10 @@ Libraries
>  Examples
>  
> 
> +* **l3fwd: fix lookup burst size for ipv6.**
> +
> +  Fixed issue where app crashes if ipv6 is used, due to a wrong  lookup
> + burst size.
> 
>  Other
>  ~
> diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c index
> 1f3e5c6..74703b0 100644
> --- a/examples/l3fwd/main.c
> +++ b/examples/l3fwd/main.c
> @@ -1005,7 +1005,7 @@ simple_ipv6_fwd_8pkts(struct rte_mbuf *m[8],
> uint8_t portid, struct lcore_conf *
>   const void *key_array[8] = {[0], [1], [2], [3],
>   [4], [5], [6], [7]};
> 
> - rte_hash_lookup_multi(qconf->ipv6_lookup_struct, _array[0], 4,
> ret);
> + rte_hash_lookup_multi(qconf->ipv6_lookup_struct, _array[0], 8,
> +ret);
>   dst_port[0] = (uint8_t) ((ret[0] < 0) ? 
> portid:ipv6_l3fwd_out_if[ret[0]]);
>   dst_port[1] = (uint8_t) ((ret[1] < 0) ? 
> portid:ipv6_l3fwd_out_if[ret[1]]);
>   dst_port[2] = (uint8_t) ((ret[2] < 0) ? 
> portid:ipv6_l3fwd_out_if[ret[2]]);
> --
> 2.4.3

Acked-by: Reshma Pattan


[dpdk-dev] [PATCH v5 1/7] ethdev: add additional ieee1588 support functions

2015-11-10 Thread Thomas Monjalon
2015-11-10 11:36, Mcnamara, John:
> From: Thomas Monjalon
> > I'll try to fix it now to be sure it will be one of the first series ready
> > for the 2.3 cycle.
> 
> These comments are minor and could be fixed now.

After having a closer look in the drivers change, it seems to be restricted to
the PTP functions of the Intel drivers.
So you can ask to the Intel validation team if they are OK to add it in RC2.
I think it would be a wrong idea because we need to stop moving the ethdev and
drivers code, and focus on other DPDK areas for the RC2.

> > > +extern int rte_eth_timesync_time_get(uint8_t port_id,
> > > +   struct timespec *time);
> > 
> > How is it different from rte_eth_timesync_read_rx_timestamp() and
> > rte_eth_timesync_read_tx_timestamp()?
> > 
> > Why repeating the word time? Why not rte_eth_timesync_get()?
> 
> In the context of PTP there is a difference between the time (os or NIC) and 
> the timestamp (either in the mbuf, a register or as part of the payload).

Do you think we can make it clear in the definition of these functions?

More wording comments:
- rte_eth_timesync_time_get
- rte_eth_timesync_read_rx_timestamp
Why is it "get" in a case and "read" in another?
Why the verb is at the end in the first and before the complement in the latter?



[dpdk-dev] [PATCH] vhost: make destroy callback on VHOST_USER_RESET_OWNER

2015-11-10 Thread Tetsuya Mukawa
On 2015/11/10 11:25, Yuanhan Liu wrote:
> On Mon, Nov 09, 2015 at 06:15:13PM -0800, Rich Lane wrote:
>> QEMU sends this message first when shutting down. There was previously no way
>> for the dataplane to know that the virtio_net instance had become unusable 
>> and
>> it would segfault when trying to do RX/TX.
>>
>> Signed-off-by: Rich Lane 
> Thanks. Even I have same patch in my patch queue (I have some other
> issues to fix), you got my ack.
>
> Acked-by: Yuanhan Liu 
>
>   --yliu
>

Hi Liu and Rich,

How about saving "dev->ifname" while processing reset_owner like
"dev->device_fh"?
It was only set when connection is established.
But so far, it will be cleared when reset_owner message comes.
Probably it should be cleared when unix domain socket connection is closed.

Thanks,
Tetsuya

>> ---
>>  lib/librte_vhost/virtio-net.c | 3 +++
>>  1 file changed, 3 insertions(+)
>>
>> diff --git a/lib/librte_vhost/virtio-net.c b/lib/librte_vhost/virtio-net.c
>> index 14278de..39a6a5e 100644
>> --- a/lib/librte_vhost/virtio-net.c
>> +++ b/lib/librte_vhost/virtio-net.c
>> @@ -436,6 +436,9 @@ reset_owner(struct vhost_device_ctx ctx)
>>  if (dev == NULL)
>>  return -1;
>>  
>> +if (dev->flags & VIRTIO_DEV_RUNNING)
>> +notify_ops->destroy_device(dev);
>> +
>>  device_fh = dev->device_fh;
>>  cleanup_device(dev);
>>  init_device(dev);
>> -- 
>> 1.9.1



[dpdk-dev] [PATCH 3/3] vhost: Add VHOST PMD

2015-11-10 Thread Tetsuya Mukawa
On 2015/11/10 7:25, Stephen Hemminger wrote:
> On Tue, 27 Oct 2015 15:12:55 +0900
> Tetsuya Mukawa  wrote:
>
>> The patch introduces a new PMD. This PMD is implemented as thin wrapper
>> of librte_vhost. It means librte_vhost is also needed to compile the PMD.
>> The vhost messages will be handled only when a port is started. So start
>> a port first, then invoke QEMU.
>>
>> The PMD has 2 parameters.
>>  - iface:  The parameter is used to specify a path to connect to a
>>virtio-net device.
>>  - queues: The parameter is used to specify the number of the queues
>>virtio-net device has.
>>(Default: 1)
>>
>> Here is an example.
>> $ ./testpmd -c f -n 4 --vdev 'eth_vhost0,iface=/tmp/sock0,queues=1' -- -i
>>
>> To connect above testpmd, here is qemu command example.
>>
>> $ qemu-system-x86_64 \
>> 
>> -chardev socket,id=chr0,path=/tmp/sock0 \
>> -netdev vhost-user,id=net0,chardev=chr0,vhostforce,queues=1 \
>> -device virtio-net-pci,netdev=net0
>>
>> Signed-off-by: Tetsuya Mukawa 
> Brocade developed a much simpler vhost PMD, without all the atomics and
> locking.
>

Hi Stephen,

With your PMD, it seems we need to call some vhost library APIs before
start sending and receiving.
It means we need to manage virtio-net device connections in DPDK
application anyway.

Also, I guess all PMDs should provide feature to be replaced by one of
other PMD without heavy modification for DPDK application.
This is because I tried to manage virtio-net device connections in vhost
PMD.

Thanks,
Tetsuya

> /*-
>  *   BSD LICENSE
>  *
>  *   Copyright (C) Brocade Communications Systems, Inc.
>  *   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 Brocade Communications Systems, Inc.
>  *   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 "../librte_vhost/rte_virtio_net.h"
> #include "../librte_vhost/virtio-net.h"
>
> struct pmd_internals;
>
> struct vhost_queue {
>   struct pmd_internals *internals;
>
>   struct rte_mempool *mb_pool;
>
>   uint64_tpkts;
>   uint64_tbytes;
> };
>
> struct pmd_internals {
>   struct virtio_net *dev;
>   unsigned numa_node;
>   struct eth_driver *eth_drv;
>
>   unsigned nb_rx_queues;
>   unsigned nb_tx_queues;
>
>   struct vhost_queue rx_queues[1];
>   struct vhost_queue tx_queues[1];
>   uint8_t port_id;
> };
>
>
> static const char *drivername = "Vhost PMD";
>
> static struct rte_eth_link pmd_link = {
>   .link_speed = 1,
>   .link_duplex = ETH_LINK_FULL_DUPLEX,
>   .link_status = 0
> };
>
> static uint16_t
> eth_vhost_rx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs)
> {
>   int ret, i;
>   struct vhost_queue *h = q;
>
>   ret = rte_vhost_dequeue_burst(h->internals->dev,
>   VIRTIO_TXQ, h->mb_pool, bufs, nb_bufs);
>
>   for (i = 0; i < ret ; i++) {
>   struct rte_mbuf *m = bufs[i];
>
>   m->port = h->internals->port_id;
>   ++h->pkts;
>   h->bytes += rte_pktmbuf_pkt_len(m);
>   }
>   return ret;
> }
>
> static uint16_t
> eth_vhost_tx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs)
> {
>   int ret, i;
>   struct vhost_queue *h = q;
>
>   ret = rte_vhost_enqueue_burst(h->internals->dev,
>   VIRTIO_RXQ, bufs, nb_bufs);
>
>   for (i = 

[dpdk-dev] [PATCH v5 2/7] net: Add common PTP structures and functions

2015-11-10 Thread Thomas Monjalon
2015-11-05 15:06, Daniel Mrzyglod:
> This patch add common functions and structures used for PTP processing.
> 
> Signed-off-by: Daniel Mrzyglod 
> ---
>  lib/librte_net/Makefile  |   2 +-
>  lib/librte_net/rte_ptp.h | 105 
> +++

The library librte_net gather some structures and functions for network 
headers/layers
parsing.
These PTP functions looks really generic. Why not add them in EAL?
Maybe they could benefit from specific implementations in the arch/ directory.

> +/*
> + * Structure for cyclecounter IEEE1588 functionality.
> + */
> +struct cyclecounter {
> + uint64_t (*read)(struct rte_eth_dev *dev);

This field is not used.
Please avoid using a reference to ethdev here.

> + uint64_t mask;
> + uint32_t shift;
> +};
> +
> +/*
> + * Structure to hold and calculate Unix epoch time.
> + */
> +struct timecounter {
> + struct cyclecounter *cc;
> + uint64_t cycle_last;
> + uint64_t nsec;
> + uint64_t mask;
> + uint64_t frac;
> +};

This structure is not used.

It is not clear what these structures are for, and what means each field.
When adding a new field in an API, it must be commented in doxygen.

> +static inline uint64_t
> +timespec_to_ns(const struct timespec *ts)
[...]
> +static inline struct timespec
> +ns_to_timespec(uint64_t nsec)
[...]
> +static inline uint64_t
> +cyclecounter_cycles_to_ns(const struct cyclecounter *cc,
> +   uint64_t cycles, uint64_t mask, uint64_t *frac)
[...]
> +static inline uint64_t
> +cyclecounter_cycles_to_ns_backwards(const struct cyclecounter *cc,
> +uint64_t cycles, uint64_t frac)

They must be prefixed with rte_ with full doxygen comments.


[dpdk-dev] [PATCH v6 00/10] Add installation rules for dpdk files

2015-11-10 Thread Aaron Conole
Hi Mario,

Mario Carrillo  writes:
> DPDK package lacks of a mechanism to install libraries, headers
> applications, kernel modules and sdk files to a file system tree.
> This patch set allows to install files based on the next
> proposal:
> http://www.freedesktop.org/software/systemd/man/file-hierarchy.html

I'm not sure what this patch holds, given the following proposal:

http://dpdk.org/ml/archives/dev/2015-November/02.html

-Aaron


[dpdk-dev] [PATCH v3 2/2] vhost: Add VHOST PMD

2015-11-10 Thread Tetsuya Mukawa
On 2015/11/10 7:22, Stephen Hemminger wrote:
> On Mon,  9 Nov 2015 14:17:01 +0900
> Tetsuya Mukawa  wrote:
>
>> +rte_atomic32_set(>while_queuing, 1);
>> +
>> +if (unlikely(rte_atomic32_read(>allow_queuing) == 0))
>> +goto out;
> You special 2 variable custom locking here is buggy.
> If you hit second atomic test, you will leave while_queuing set.

Hi Stephen,

Thanks for reviewing.
I clear while_queuing like below.

+out:
+   rte_atomic32_set(>while_queuing, 0);
+
+   return nb_rx;
+}

Thanks,
tetsuya



[dpdk-dev] [PATCH v3 1/2] vhost: Add callback and private data for vhost PMD

2015-11-10 Thread Tetsuya Mukawa
On 2015/11/10 3:16, Aaron Conole wrote:
> Greetings,
>
> Tetsuya Mukawa  writes:
>> These variables are needed to be able to manage one of virtio devices
>> using both vhost library APIs and vhost PMD.
>> For example, if vhost PMD uses current callback handler and private data
>> provided by vhost library, A DPDK application that links vhost library
>> cannot use some of vhost library APIs. To avoid it, callback and private
>> data for vhost PMD are needed.
>>
>> Signed-off-by: Tetsuya Mukawa 
>> ---
>>  lib/librte_vhost/rte_vhost_version.map|  6 +++
>>  lib/librte_vhost/rte_virtio_net.h |  3 ++
>>  lib/librte_vhost/vhost_user/virtio-net-user.c | 13 +++
>>  lib/librte_vhost/virtio-net.c | 56 
>> +--
>>  lib/librte_vhost/virtio-net.h |  4 +-
>>  5 files changed, 70 insertions(+), 12 deletions(-)
>>
>> diff --git a/lib/librte_vhost/rte_vhost_version.map 
>> b/lib/librte_vhost/rte_vhost_version.map
>> index 3d8709e..00a9ce5 100644
>> --- a/lib/librte_vhost/rte_vhost_version.map
>> +++ b/lib/librte_vhost/rte_vhost_version.map
>> @@ -20,3 +20,9 @@ DPDK_2.1 {
>>  rte_vhost_driver_unregister;
>>  
>>  } DPDK_2.0;
>> +
>> +DPDK_2.2 {
>> +global:
>> +
>> +rte_vhost_driver_pmd_callback_register;
>> +} DPDK_2.1;
>> diff --git a/lib/librte_vhost/rte_virtio_net.h 
>> b/lib/librte_vhost/rte_virtio_net.h
>> index 5687452..3ef6e58 100644
>> --- a/lib/librte_vhost/rte_virtio_net.h
>> +++ b/lib/librte_vhost/rte_virtio_net.h
>> @@ -128,6 +128,7 @@ struct virtio_net {
>>  charifname[IF_NAME_SZ]; /**< Name of the tap 
>> device or socket path. */
>>  uint32_tvirt_qp_nb; /**< number of queue pair we 
>> have allocated */
>>  void*priv;  /**< private context */
>> +void*pmd_priv;  /**< private context for vhost 
>> PMD */
>>  struct vhost_virtqueue  *virtqueue[VHOST_MAX_QUEUE_PAIRS * 2];  /**< 
>> Contains all virtqueue information. */
>>  } __rte_cache_aligned;
> Sorry if I'm missing something, but this is an ABI breaker, isn't it? I
> think this needs the RTE_NEXT_ABI tag around it.

Hi Aaron,

Thanks for reviewing. Yes, your are correct.
I guess I can implement vhost PMD without this variable, so I will
remove it.

Thanks,
Tetsuya



[dpdk-dev] [PATCH] vhost: make destroy callback on VHOST_USER_RESET_OWNER

2015-11-10 Thread Yuanhan Liu
On Tue, Nov 10, 2015 at 12:51:42PM +0900, Tetsuya Mukawa wrote:
> On 2015/11/10 11:25, Yuanhan Liu wrote:
> > On Mon, Nov 09, 2015 at 06:15:13PM -0800, Rich Lane wrote:
> >> QEMU sends this message first when shutting down. There was previously no 
> >> way
> >> for the dataplane to know that the virtio_net instance had become unusable 
> >> and
> >> it would segfault when trying to do RX/TX.
> >>
> >> Signed-off-by: Rich Lane 
> > Thanks. Even I have same patch in my patch queue (I have some other
> > issues to fix), you got my ack.
> >
> > Acked-by: Yuanhan Liu 
> >
> > --yliu
> >
> 
> Hi Liu and Rich,
> 
> How about saving "dev->ifname" while processing reset_owner like
> "dev->device_fh"?
> It was only set when connection is established.
> But so far, it will be cleared when reset_owner message comes.
> Probably it should be cleared when unix domain socket connection is closed.

Yes, you are right, and I was thinking (and doing) same stuff. And we
may need save few more fields.

(For Thomas, this patch is still needed).

--yliu
> 
> >> ---
> >>  lib/librte_vhost/virtio-net.c | 3 +++
> >>  1 file changed, 3 insertions(+)
> >>
> >> diff --git a/lib/librte_vhost/virtio-net.c b/lib/librte_vhost/virtio-net.c
> >> index 14278de..39a6a5e 100644
> >> --- a/lib/librte_vhost/virtio-net.c
> >> +++ b/lib/librte_vhost/virtio-net.c
> >> @@ -436,6 +436,9 @@ reset_owner(struct vhost_device_ctx ctx)
> >>if (dev == NULL)
> >>return -1;
> >>  
> >> +  if (dev->flags & VIRTIO_DEV_RUNNING)
> >> +  notify_ops->destroy_device(dev);
> >> +
> >>device_fh = dev->device_fh;
> >>cleanup_device(dev);
> >>init_device(dev);
> >> -- 
> >> 1.9.1


[dpdk-dev] [PATCH v3 1/2] vhost: Add callback and private data for vhost PMD

2015-11-10 Thread Panu Matilainen
On 11/10/2015 11:48 AM, Tetsuya Mukawa wrote:
> On 2015/11/10 16:16, Panu Matilainen wrote:
>> On 11/10/2015 05:13 AM, Tetsuya Mukawa wrote:
>>> On 2015/11/10 3:16, Aaron Conole wrote:
 Greetings,

 Tetsuya Mukawa  writes:
> These variables are needed to be able to manage one of virtio devices
> using both vhost library APIs and vhost PMD.
> For example, if vhost PMD uses current callback handler and private
> data
> provided by vhost library, A DPDK application that links vhost library
> cannot use some of vhost library APIs. To avoid it, callback and
> private
> data for vhost PMD are needed.
>
> Signed-off-by: Tetsuya Mukawa 
> ---
>lib/librte_vhost/rte_vhost_version.map|  6 +++
>lib/librte_vhost/rte_virtio_net.h |  3 ++
>lib/librte_vhost/vhost_user/virtio-net-user.c | 13 +++
>lib/librte_vhost/virtio-net.c | 56
> +--
>lib/librte_vhost/virtio-net.h |  4 +-
>5 files changed, 70 insertions(+), 12 deletions(-)
>
> diff --git a/lib/librte_vhost/rte_vhost_version.map
> b/lib/librte_vhost/rte_vhost_version.map
> index 3d8709e..00a9ce5 100644
> --- a/lib/librte_vhost/rte_vhost_version.map
> +++ b/lib/librte_vhost/rte_vhost_version.map
> @@ -20,3 +20,9 @@ DPDK_2.1 {
>rte_vhost_driver_unregister;
>
>} DPDK_2.0;
> +
> +DPDK_2.2 {
> +global:
> +
> +rte_vhost_driver_pmd_callback_register;
> +} DPDK_2.1;
> diff --git a/lib/librte_vhost/rte_virtio_net.h
> b/lib/librte_vhost/rte_virtio_net.h
> index 5687452..3ef6e58 100644
> --- a/lib/librte_vhost/rte_virtio_net.h
> +++ b/lib/librte_vhost/rte_virtio_net.h
> @@ -128,6 +128,7 @@ struct virtio_net {
>charifname[IF_NAME_SZ];/**< Name of the tap
> device or socket path. */
>uint32_tvirt_qp_nb;/**< number of queue pair we
> have allocated */
>void*priv;/**< private context */
> +void*pmd_priv;/**< private context for vhost
> PMD */
>struct vhost_virtqueue*virtqueue[VHOST_MAX_QUEUE_PAIRS *
> 2];/**< Contains all virtqueue information. */
>} __rte_cache_aligned;
 Sorry if I'm missing something, but this is an ABI breaker, isn't it? I
 think this needs the RTE_NEXT_ABI tag around it.
>>>
>>> Hi Aaron,
>>>
>>> Thanks for reviewing. Yes, your are correct.
>>> I guess I can implement vhost PMD without this variable, so I will
>>> remove it.
>>
>> No need to.
>>
>> The librte_vhost ABI has already been broken during the DPDK 2.2 cycle
>> by the multiqueue changes, but that's okay since it was announced
>> during 2.1 cycle (in commit 3c848bd7b1c6f4f681b833322a748fdefbb5fb2d).
>>
>> What is missing right now is bumping the library version, and that
>> must happen before 2.2 is released.
>>
>>  - Panu -
>>
>>
>
> Hi Panu,
>
> Thank you so much. Let me make sure what you mean.
> I guess I need to add RTE_NEXT_ABI tags where pmd_priv is used. This is
> because we don't break DPDK-2.1 ABI.
> Anyway, the tag will be removed when DPDK-2.2 is released, then we can
> use vhost PMD.
> Is this correct?

Not quite. Because the ABI has already been broken between 2.1 and 2.2, 
you can ride the same wave without messing with NEXT_ABI and such.

Like said, librte_vhost is pending a LIBABIVER bump to 2, but that is 
regardless of this patch.

- Panu -



[dpdk-dev] [PATCH v5 1/7] ethdev: add additional ieee1588 support functions

2015-11-10 Thread Thomas Monjalon
Hi,

Sorry for not having followed closer this series.
It was submitted at the last minute and got too few comments.
I'll try to fix it now to be sure it will be one of the first series
ready for the 2.3 cycle.

2015-11-05 15:06, Daniel Mrzyglod:
> --- a/doc/guides/rel_notes/release_2_2.rst
> +++ b/doc/guides/rel_notes/release_2_2.rst
> @@ -222,6 +222,9 @@ API Changes
>  
>  * The devargs union field virtual is renamed to virt for C++ compatibility.
>  
> +* Add new functions in ethdev to support IEEE1588: 
> rte_eth_timesync_time_adjust()
> +  rte_eth_timesync_time_get(), rte_eth_timesync_time_set()

No need to add an entry in API changes for new functions.

> +/**
> + * Read the time from the timesync clock on an Ethernet device.
> + *
> + * @param port_id
> + *   The port identifier of the Ethernet device.
> + * @param time
> + *   Pointer to the timespec struct.
> + *
> + * @return
> + *   - 0: Success.
> + */
> +extern int rte_eth_timesync_time_get(uint8_t port_id,
> +   struct timespec *time);

How is it different from rte_eth_timesync_read_rx_timestamp() and
rte_eth_timesync_read_tx_timestamp()?

Why repeating the word time? Why not rte_eth_timesync_get()?

Not related to this patch, but in rte_eth_timesync_read_rx_timestamp(),
the flags parameter breaks the API layer separation with drivers:
 * @param flags
 *   Device specific flags. Used to pass the RX timesync register index to
 *   i40e. Unused in igb/ixgbe, pass 0 instead.


[dpdk-dev] [PATCH] doc: announce ABI change for struct rte_eth_tunnel_filter_conf

2015-11-10 Thread Jingjing Wu
Signed-off-by: Jingjing Wu 
---
 doc/guides/rel_notes/deprecation.rst | 5 +
 1 file changed, 5 insertions(+)

diff --git a/doc/guides/rel_notes/deprecation.rst 
b/doc/guides/rel_notes/deprecation.rst
index 549ecb9..57c8b7a 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -32,3 +32,8 @@ Deprecation Notices
   and table action handlers will be updated:
   the pipeline parameter will be added, the packets mask parameter will be
   either removed (for input port action handler) or made input-only.
+
+* ABI changes are planned for rte_eth_tunnel_filter_conf. Change the fields
+  of outer_mac and inner_mac from pointer to struct in order to keep the
+  code's readability. The release 2.2 does not contain these ABI changes, but
+  release 2.3 will, and no backwards compatibility is planned.
-- 
2.4.0



[dpdk-dev] [PATCH v5 1/7] ethdev: add additional ieee1588 support functions

2015-11-10 Thread Mcnamara, John


> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Thomas Monjalon
> Sent: Tuesday, November 10, 2015 11:04 AM
> To: Mrzyglod, DanielX T
> Cc: dev at dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v5 1/7] ethdev: add additional ieee1588
> support functions
> 
> Hi,
> 
> Sorry for not having followed closer this series.
> It was submitted at the last minute and got too few comments.

Hi,

The V2 version was submitted on the last day of the merge window but the API 
was available in the V1. Comments could have been made then.



> I'll try to fix it now to be sure it will be one of the first series ready
> for the 2.3 cycle.

These comments are minor and could be fixed now.


> 
> 2015-11-05 15:06, Daniel Mrzyglod:
> > --- a/doc/guides/rel_notes/release_2_2.rst
> > +++ b/doc/guides/rel_notes/release_2_2.rst
> > @@ -222,6 +222,9 @@ API Changes
> >
> >  * The devargs union field virtual is renamed to virt for C++
> compatibility.
> >
> > +* Add new functions in ethdev to support IEEE1588:
> > +rte_eth_timesync_time_adjust()
> > +  rte_eth_timesync_time_get(), rte_eth_timesync_time_set()
> 
> No need to add an entry in API changes for new functions.

OK. We can remove it now or I can remove it in the final release note edit.


> 
> > +/**
> > + * Read the time from the timesync clock on an Ethernet device.
> > + *
> > + * @param port_id
> > + *   The port identifier of the Ethernet device.
> > + * @param time
> > + *   Pointer to the timespec struct.
> > + *
> > + * @return
> > + *   - 0: Success.
> > + */
> > +extern int rte_eth_timesync_time_get(uint8_t port_id,
> > + struct timespec *time);
> 
> How is it different from rte_eth_timesync_read_rx_timestamp() and
> rte_eth_timesync_read_tx_timestamp()?
> 
> Why repeating the word time? Why not rte_eth_timesync_get()?


In the context of PTP there is a difference between the time (os or NIC) and 
the timestamp (either in the mbuf, a register or as part of the payload). 



> Not related to this patch, but in rte_eth_timesync_read_rx_timestamp(),
> the flags parameter breaks the API layer separation with drivers:
>  * @param flags
>  *   Device specific flags. Used to pass the RX timesync register index to
>  *   i40e. Unused in igb/ixgbe, pass 0 instead.


Yes. Unfortunately i40e has 4 RX registers and this information needs to be 
passed down to the function is some way. I'd imagine that some other nics might 
need similar config. I asked for feedback on this in the 2.1 cycle from other 
nic maintainers but didn't get any. The kernel uses a struct hwtstamp_config 
that I was initially going to use but didn't.


John


[dpdk-dev] DPDK ArmV7 autotests

2015-11-10 Thread Thomas Monjalon
2015-11-10 10:22, Hunt, David:
> On 09/11/2015 17:46, Jan Viktorin wrote:
>  > Here is the log. You an see, that many tests fail just because
>  > of the missing hugetlb support. This is strange as I modified the
>  > autotest_runner.py to inject "--no-huge --no-pci" options when it
>  > detects armv7 architecture.
> 
> I think publishing these test results to the mailing list confuses 
> matters somewhat. The tests are not tuned for armv7, and there are many 
> false negatives, giving the impression that the results are worse than 
> they actually should be.
> 
> The tests need to be analysed to see if they respect the --no-huge and 
> --no-pci flags correctly, I suspect some tests are being run even though 
> these flags are enabled.
> 
> I believe enough of the tests pass to allow the initial version of the 
> patch set to be accepted. We can look at the failing cases later, and 
> improve the test suite as time goes on.

I agree.
The unit tests are know to require some refactoring.
I suggest to continue ARM integration while checking how to fix the
unit tests later. Maybe that Declan has some ideas or plans about the tests.


[dpdk-dev] [PATCH] doc: announce ABI change for struct rte_eth_fdir_flow

2015-11-10 Thread Jingjing Wu
Signed-off-by: Jingjing Wu 
---
 doc/guides/rel_notes/deprecation.rst | 4 
 1 file changed, 4 insertions(+)

diff --git a/doc/guides/rel_notes/deprecation.rst 
b/doc/guides/rel_notes/deprecation.rst
index 549ecb9..1a4614d 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -32,3 +32,7 @@ Deprecation Notices
   and table action handlers will be updated:
   the pipeline parameter will be added, the packets mask parameter will be
   either removed (for input port action handler) or made input-only.
+
+* ABI changes are planned for struct rte_eth_fdir_flow in order to support
+  extend flow director's input set. The release 2.2 does not contain these ABI
+  changes, but release 2.3 will, and no backwards compatibility is planned.
-- 
2.4.0



[dpdk-dev] [PATCH v6 10/10] doc: Add information about new installation rules

2015-11-10 Thread Mario Carrillo
Information about variables and rules behaviour is added to
documentation.

Signed-off-by: Mario Carrillo 
---
 doc/build-sdk-quick.txt   | 22 +++-
 doc/guides/freebsd_gsg/build_dpdk.rst | 39 +++
 doc/guides/linux_gsg/build_dpdk.rst   | 39 +++
 3 files changed, 99 insertions(+), 1 deletion(-)

diff --git a/doc/build-sdk-quick.txt b/doc/build-sdk-quick.txt
index bf18b48..1c40dd7 100644
--- a/doc/build-sdk-quick.txt
+++ b/doc/build-sdk-quick.txt
@@ -5,10 +5,21 @@ Build commands
all  same as build (default rule)
buildbuild in a configured directory
cleanremove files but keep configuration
-   install  build many targets (wildcard allowed) and install in 
DESTDIR
+   install  if T is defined, build a target and install in DESTDIR
+ else call install-fhs target
uninstallremove all installed targets
examples build examples for given targets (T=)
examples_clean   clean examples for given targets (T=)
+Install commands
+install  if T is defined, build a target and install in DESTDIR
+ else call install-fhs  target
+install-headers  install headers files
+install-bin  install app files a dpdk tools
+install-lib  install libraries
+install-doc  install documentation
+install-mod  install modules
+install-sdk  install headers, makefiles, scripts,examples, tools 
and config files
+install-fhs  install libraries, modules, app files, nic bind files 
and documentation
 Build variables
EXTRA_CPPFLAGS   preprocessor options
EXTRA_CFLAGS compiler options
@@ -23,3 +34,12 @@ Build variables
T target template (install default: *) - used with config or 
install
format: 
templates in config/defconfig_*
+Install variables
+RTE_PREFIX /usr/local by default it can be overridden
+BIN_DIR $(RTE_PREFIX)/bin by default it can be overridden
+INCLUDE_DIR $(RTE_PREFIX)/include by default it can be overridden
+LIB_DIR $(RTE_PREFIX)/lib by default it can be overridden
+DOC_DIR $(RTE_PREFIX)/share/doc/dpdk by default it can be 
overridden
+DATA_DIR$(RTE_PREFIX)/shareby default it can be overridden
+KMOD_DIR/lib/modules/$(uname -r)/extra/drivers/dpdk  for linux
+/boot/modules for BSD by default, they can be 
overridden
diff --git a/doc/guides/freebsd_gsg/build_dpdk.rst 
b/doc/guides/freebsd_gsg/build_dpdk.rst
index 8eff599..7d3e098 100644
--- a/doc/guides/freebsd_gsg/build_dpdk.rst
+++ b/doc/guides/freebsd_gsg/build_dpdk.rst
@@ -136,6 +136,45 @@ The DPDK is composed of several directories:

 *   config, tools, scripts, mk: Framework-related makefiles, scripts and 
configuration

+
+Build and install DPDK using a file hierarchy
+-
+
+Following the next steps is possible configure, build and install  specific 
files
+according to a file hierarchy and a group of variables.
+
+.. code-block:: console
+
+   make config T=
+   make
+   make 
+
++--++
+|  install target  |  Description  
 |
++==++
+|install   |if T is not defined will call install-fhs install  
 |
++--++
+|install-headers   |install headers files where 
INCLUDE_DIR=$(RTE_PREFIX)/include/dpdk  |
++--++
+|install-bin   |install app files a dpdk tools where 
BIN_DIR=$(RTE_PREFIX)/bin  |
++--++
+|install-lib   |install libraries LIB_DIR=$(RTE_PREFIX)/lib
 |
++--++
+|install-doc   |install documentation DOC_DIR=$(RTE_PREFIX)/share/doc/dpdk 
 |
++--++
+|install-mod   |install modules if RTE_EXEC_ENV=linuxapp then  
 |
+|  |KMOD_DIR=/lib/modules/$(uname -r)/extra/drivers/dpdk else 
KMOD_DIR=/boot/modules|

[dpdk-dev] [PATCH v6 09/10] mk: Add new install rule

2015-11-10 Thread Mario Carrillo
If "T" variable is defined, the installation process will have the
current behaviour, else install rule will be called.

Signed-off-by: Mario Carrillo 
---
 mk/rte.sdkinstall.mk | 12 +++-
 mk/rte.sdkroot.mk|  4 ++--
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/mk/rte.sdkinstall.mk b/mk/rte.sdkinstall.mk
index 6593e37..784629e 100644
--- a/mk/rte.sdkinstall.mk
+++ b/mk/rte.sdkinstall.mk
@@ -40,7 +40,6 @@ endif
 # target name or a name containing jokers "*". Example:
 # x86_64-native-*-gcc
 ifndef T
-T=*
 ifneq (,$(wildcard $(RTE_OUTPUT)/.config))
 RTE_PREFIX ?= /usr/local
 INCLUDE_DIR ?= $(RTE_PREFIX)/include/dpdk
@@ -194,6 +193,17 @@ install-sdk: install-headers
 .PHONY: install-fhs
 install-fhs: install-lib install-bin install-doc install-mod
 #
+# if "T" var is defined, mbuild rule will be called, else
+# install-fhs rule will be called.
+#
+.PHONY: install
+install:
+ifdef T
+install: mbuild
+else
+install: install-fhs
+endif
+#
 # uninstall: remove all built sdk
 #
 UNINSTALL_TARGETS := $(addsuffix _uninstall,\
diff --git a/mk/rte.sdkroot.mk b/mk/rte.sdkroot.mk
index 1b619b7..2f8f64a 100644
--- a/mk/rte.sdkroot.mk
+++ b/mk/rte.sdkroot.mk
@@ -97,9 +97,9 @@ test fast_test ring_test mempool_test perf_test coverage:
 testall:
$(Q)$(MAKE) -f $(RTE_SDK)/mk/rte.sdktestall.mk $@

-.PHONY: mbuild install-headers install-bin install-lib install-mod \
+.PHONY: mbuild install install-headers install-bin install-lib install-mod \
 install-doc install-sdk install-fhs uninstall
-mbuild install-headers install-bin install-lib install-mod install-doc \
+mbuild install install-headers install-bin install-lib install-mod install-doc 
\
 install-sdk install-fhs uninstall:
$(Q)$(MAKE) -f $(RTE_SDK)/mk/rte.sdkinstall.mk $@

-- 
2.6.1.120.g24a00ef



[dpdk-dev] [PATCH v6 08/10] mk: Rename install rule as mbuild rule

2015-11-10 Thread Mario Carrillo
"install" with the current dpdk behaviour change its name.

Signed-off-by: Mario Carrillo 
---
 mk/rte.sdkinstall.mk | 8 
 mk/rte.sdkroot.mk| 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/mk/rte.sdkinstall.mk b/mk/rte.sdkinstall.mk
index 3e87d72..6593e37 100644
--- a/mk/rte.sdkinstall.mk
+++ b/mk/rte.sdkinstall.mk
@@ -70,13 +70,13 @@ endif
 #
 INSTALL_CONFIGS := $(patsubst $(RTE_SRCDIR)/config/defconfig_%,%,\
$(wildcard $(RTE_SRCDIR)/config/defconfig_$(T)))
-INSTALL_TARGETS := $(addsuffix _install,\
+INSTALL_TARGETS := $(addsuffix _mbuild,\
$(filter-out %~,$(INSTALL_CONFIGS)))

-.PHONY: install
-install: $(INSTALL_TARGETS)
+.PHONY: mbuild
+mbuild: $(INSTALL_TARGETS)

-%_install:
+%_mbuild:
@echo == Installing $*
$(Q)if [ ! -f $(BUILD_DIR)/$*/.config ]; then \
$(MAKE) config T=$* O=$(BUILD_DIR)/$*; \
diff --git a/mk/rte.sdkroot.mk b/mk/rte.sdkroot.mk
index dd5f399..1b619b7 100644
--- a/mk/rte.sdkroot.mk
+++ b/mk/rte.sdkroot.mk
@@ -97,9 +97,9 @@ test fast_test ring_test mempool_test perf_test coverage:
 testall:
$(Q)$(MAKE) -f $(RTE_SDK)/mk/rte.sdktestall.mk $@

-.PHONY: install install-headers install-bin install-lib install-mod \
+.PHONY: mbuild install-headers install-bin install-lib install-mod \
 install-doc install-sdk install-fhs uninstall
-install install-headers install-bin install-lib install-mod install-doc \
+mbuild install-headers install-bin install-lib install-mod install-doc \
 install-sdk install-fhs uninstall:
$(Q)$(MAKE) -f $(RTE_SDK)/mk/rte.sdkinstall.mk $@

-- 
2.6.1.120.g24a00ef



[dpdk-dev] [PATCH v6 07/10] mk: Add rule for installing runtime files

2015-11-10 Thread Mario Carrillo
Add hierarchy-file support to the DPDK libraries, modules,
binary files, nic bind file, cpu layout file and documentation,
when invoking "make install-fhs" (filesystem hierarchy standard)
runtime files will be by default installed in:
$(DESTDIR)/$(BIN_DIR) where BIN_DIR=$(RTE_PREFIX)/usr/bin (binary files)
$(DESTDIR)/$(DOC_DIR) where DOC_DIR=$(RTE_PREFIX)/usr/share/doc/dpdk
(documentation)
$(DESTDIR)/$(LIB_DIR) where  LIB_DIR=$(RTE_PREFIX)/usr/lib
$(DESTDIR)/$(KMOD_DIR) (modules)
if RTE_EXEC_ENV=linuxapp then
KMOD_DIR=/lib/modules/$(uname -r)/extra/drivers/dpdk
else KMOD_DIR=/boot/modules
and RTE_PREFIX=/usr/local
All directory variables mentioned above can be overridden.
This hierarchy is based on:
http://www.freedesktop.org/software/systemd/man/file-hierarchy.html

Signed-off-by: Mario Carrillo 
---
 mk/rte.sdkinstall.mk | 5 +
 mk/rte.sdkroot.mk| 4 ++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/mk/rte.sdkinstall.mk b/mk/rte.sdkinstall.mk
index 2e2207b..3e87d72 100644
--- a/mk/rte.sdkinstall.mk
+++ b/mk/rte.sdkinstall.mk
@@ -189,6 +189,11 @@ install-sdk: install-headers
cp -f $(RTE_SDK)/build/.config $(DESTDIR)/$(DATA_DIR)/config; \
echo installing: $(RTE_OUTPUT)/.config
 #
+# install runtime files
+#
+.PHONY: install-fhs
+install-fhs: install-lib install-bin install-doc install-mod
+#
 # uninstall: remove all built sdk
 #
 UNINSTALL_TARGETS := $(addsuffix _uninstall,\
diff --git a/mk/rte.sdkroot.mk b/mk/rte.sdkroot.mk
index 6fac88a..dd5f399 100644
--- a/mk/rte.sdkroot.mk
+++ b/mk/rte.sdkroot.mk
@@ -98,9 +98,9 @@ testall:
$(Q)$(MAKE) -f $(RTE_SDK)/mk/rte.sdktestall.mk $@

 .PHONY: install install-headers install-bin install-lib install-mod \
-install-doc install-sdk uninstall
+install-doc install-sdk install-fhs uninstall
 install install-headers install-bin install-lib install-mod install-doc \
-install-sdk uninstall:
+install-sdk install-fhs uninstall:
$(Q)$(MAKE) -f $(RTE_SDK)/mk/rte.sdkinstall.mk $@

 .PHONY: doc help
-- 
2.6.1.120.g24a00ef



[dpdk-dev] [PATCH v6 06/10] mk: Add rule for installing sdk files

2015-11-10 Thread Mario Carrillo
Add hierarchy-file support to the DPDK makefiles, scripts,
examples, tools, config files and headers,
when invoking "make install-sdk" makefiles, scripts,
examples, tools, config files will be installed in:
$(DESTDIR)/$(SDK_DIR)
and headers will be installed in:
$(DESTDIR)/$(INCLUDE_DIR)
where SDK_DIR=$(RTE_PREFIX)/share/dpdk,
INCLUDE_DIR=$(RTE_PREFIX)/include/dpdk
RTE_PREFIX=/usr/local by default, you can override RTE_PREFIX, SDK_DIR
and INCLUDE_DIR vars.
This hierarchy is based on:
http://www.freedesktop.org/software/systemd/man/file-hierarchy.html

Signed-off-by: Mario Carrillo 
---
 mk/rte.sdkinstall.mk | 20 
 mk/rte.sdkroot.mk|  5 +++--
 2 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/mk/rte.sdkinstall.mk b/mk/rte.sdkinstall.mk
index be7b88e..2e2207b 100644
--- a/mk/rte.sdkinstall.mk
+++ b/mk/rte.sdkinstall.mk
@@ -47,6 +47,7 @@ INCLUDE_DIR ?= $(RTE_PREFIX)/include/dpdk
 BIN_DIR ?= $(RTE_PREFIX)/bin
 LIB_DIR ?= $(RTE_PREFIX)/lib
 DOC_DIR ?= $(RTE_PREFIX)/share/doc/dpdk
+DATA_DIR ?= $(RTE_PREFIX)/share/dpdk
 HSLINKS := $(shell find  $(RTE_OUTPUT)/include/ -name *.h)
 BINARY_FILES := $(patsubst %.map,,$(wildcard $(RTE_OUTPUT)/app/*))
 NIC_FILES := $(wildcard $(RTE_SDK)/tools/*.py)
@@ -169,6 +170,25 @@ install-doc:
done \
fi
 #
+# install sdk files in /usr/local/share/dpdk by default
+# where RTE_PREFIX and DATA_DIR can be overridden.
+#
+.PHONY: install-sdk
+install-sdk: install-headers
+   @echo == Installing sdk files
+   @[ -d $(DESTDIR)/$(DATA_DIR) ] || mkdir -p $(DESTDIR)/$(DATA_DIR); \
+   cp -rf $(RTE_SDK)/mk $(DESTDIR)/$(DATA_DIR); \
+   echo installing: $(RTE_SDK)/mk; \
+   cp -rf $(RTE_SDK)/scripts $(DESTDIR)/$(DATA_DIR); \
+   echo installing: $(RTE_SDK)/scripts; \
+   cp -rf $(RTE_SDK)/examples $(DESTDIR)/$(DATA_DIR); \
+   echo installing: $(RTE_SDK)/examples; \
+   cp -rf $(RTE_SDK)/tools $(DESTDIR)/$(DATA_DIR); \
+   echo installing: $(RTE_SDK)/scripts
+   @[ -d $(DESTDIR)/$(DATA_DIR)/config ] || mkdir -p 
$(DESTDIR)/$(DATA_DIR)/config; \
+   cp -f $(RTE_SDK)/build/.config $(DESTDIR)/$(DATA_DIR)/config; \
+   echo installing: $(RTE_OUTPUT)/.config
+#
 # uninstall: remove all built sdk
 #
 UNINSTALL_TARGETS := $(addsuffix _uninstall,\
diff --git a/mk/rte.sdkroot.mk b/mk/rte.sdkroot.mk
index f56341d..6fac88a 100644
--- a/mk/rte.sdkroot.mk
+++ b/mk/rte.sdkroot.mk
@@ -98,8 +98,9 @@ testall:
$(Q)$(MAKE) -f $(RTE_SDK)/mk/rte.sdktestall.mk $@

 .PHONY: install install-headers install-bin install-lib install-mod \
-install-doc uninstall
-install install-headers install-bin install-lib install-mod install-doc 
uninstall:
+install-doc install-sdk uninstall
+install install-headers install-bin install-lib install-mod install-doc \
+install-sdk uninstall:
$(Q)$(MAKE) -f $(RTE_SDK)/mk/rte.sdkinstall.mk $@

 .PHONY: doc help
-- 
2.6.1.120.g24a00ef



[dpdk-dev] [PATCH v6 05/10] mk: Add rule for installing documentation

2015-11-10 Thread Mario Carrillo
Add hierarchy-file support to the DPDK documentation,
when invoking "make install-doc" documentation files will
be installed in: $(DESTDIR)/$(DOC_DIR) where
DOC_DIR=$(RTE_PREFIX)/share/doc/dpdk and RTE_PREFIX=/usr/local by
default, you can
override RTE_PREFIX and DOC_DIR vars.
This hierarchy is based on:
http://www.freedesktop.org/software/systemd/man/file-hierarchy.html

Signed-off-by: Mario Carrillo 
---
 mk/rte.sdkinstall.mk | 16 
 mk/rte.sdkroot.mk|  5 +++--
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/mk/rte.sdkinstall.mk b/mk/rte.sdkinstall.mk
index 2ba8a52..be7b88e 100644
--- a/mk/rte.sdkinstall.mk
+++ b/mk/rte.sdkinstall.mk
@@ -46,10 +46,12 @@ RTE_PREFIX ?= /usr/local
 INCLUDE_DIR ?= $(RTE_PREFIX)/include/dpdk
 BIN_DIR ?= $(RTE_PREFIX)/bin
 LIB_DIR ?= $(RTE_PREFIX)/lib
+DOC_DIR ?= $(RTE_PREFIX)/share/doc/dpdk
 HSLINKS := $(shell find  $(RTE_OUTPUT)/include/ -name *.h)
 BINARY_FILES := $(patsubst %.map,,$(wildcard $(RTE_OUTPUT)/app/*))
 NIC_FILES := $(wildcard $(RTE_SDK)/tools/*.py)
 LIBS := $(wildcard $(RTE_OUTPUT)/lib/*)
+DOCS := $(wildcard $(RTE_SDK)/doc/*)
 MODULES := $(wildcard $(RTE_OUTPUT)/kmod/*)
 BINARY_FILES += $(NIC_FILES)
 include $(RTE_OUTPUT)/.config
@@ -153,6 +155,20 @@ install-mod:
done \
fi
 #
+# install documentation in /usr/local/share/doc/dpdk
+# by default, DOC_DIR can be overriden.
+#
+.PHONY: install-doc
+install-doc:
+   @echo == Installing documentation
+   @if [ ! -z "${DOCS}" ]; then \
+   [ -d $(DESTDIR)/$(DOC_DIR) ] || mkdir -p $(DESTDIR)/$(DOC_DIR); \
+   for DOC in ${DOCS}; do \
+   cp -rf $$DOC ${DESTDIR}/${DOC_DIR}; \
+   echo installing: $$DOC; \
+   done \
+   fi
+#
 # uninstall: remove all built sdk
 #
 UNINSTALL_TARGETS := $(addsuffix _uninstall,\
diff --git a/mk/rte.sdkroot.mk b/mk/rte.sdkroot.mk
index e652218..f56341d 100644
--- a/mk/rte.sdkroot.mk
+++ b/mk/rte.sdkroot.mk
@@ -97,8 +97,9 @@ test fast_test ring_test mempool_test perf_test coverage:
 testall:
$(Q)$(MAKE) -f $(RTE_SDK)/mk/rte.sdktestall.mk $@

-.PHONY: install install-headers install-bin install-lib install-mod uninstall
-install install-headers install-bin install-lib install-mod uninstall:
+.PHONY: install install-headers install-bin install-lib install-mod \
+install-doc uninstall
+install install-headers install-bin install-lib install-mod install-doc 
uninstall:
$(Q)$(MAKE) -f $(RTE_SDK)/mk/rte.sdkinstall.mk $@

 .PHONY: doc help
-- 
2.6.1.120.g24a00ef



[dpdk-dev] [PATCH v6 04/10] mk: Add rule for installing modules

2015-11-10 Thread Mario Carrillo
Add hierarchy-file support to the DPDK modules,
when invoking "make install-mod" modules will be
installed in: $(DESTDIR)/$(KMOD_DIR)
if RTE_EXEC_ENV=linuxapp then
KMOD_DIR=/lib/modules/$(uname -r)/extra/drivers/dpdk
else KMOD_DIR=/boot/modules
by default, you can override KMOD_DIR var.
This hierarchy is based on:
http://www.freedesktop.org/software/systemd/man/file-hierarchy.html

Signed-off-by: Mario Carrillo 
---
 mk/rte.sdkinstall.mk | 24 
 mk/rte.sdkroot.mk|  4 ++--
 2 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/mk/rte.sdkinstall.mk b/mk/rte.sdkinstall.mk
index 4f06591..2ba8a52 100644
--- a/mk/rte.sdkinstall.mk
+++ b/mk/rte.sdkinstall.mk
@@ -50,7 +50,15 @@ HSLINKS := $(shell find  $(RTE_OUTPUT)/include/ -name *.h)
 BINARY_FILES := $(patsubst %.map,,$(wildcard $(RTE_OUTPUT)/app/*))
 NIC_FILES := $(wildcard $(RTE_SDK)/tools/*.py)
 LIBS := $(wildcard $(RTE_OUTPUT)/lib/*)
+MODULES := $(wildcard $(RTE_OUTPUT)/kmod/*)
 BINARY_FILES += $(NIC_FILES)
+include $(RTE_OUTPUT)/.config
+RTE_EXEC_ENV := $(CONFIG_RTE_EXEC_ENV:"%"=%)
+ifeq ($(RTE_EXEC_ENV),linuxapp)
+KMOD_DIR ?= /lib/modules/$(shell uname -r)/extra/drivers/dpdk
+else
+KMOD_DIR ?= /boot/modules
+endif
 endif
 endif

@@ -129,6 +137,22 @@ install-lib:
done \
fi
 #
+# if RTE_EXEC_ENV=linuxapp modules install in:
+# /lib/modules/$(uname -r)/extra/drivers/dpdk
+# else /boot/modules/ by default
+# KERNEL_DIR can be overridden.
+#
+.PHONY: install-mod
+install-mod:
+   @echo == Installing modules
+   @if [ ! -z "${MODULES}" ]; then \
+   [ -d $(DESTDIR)/$(KMOD_DIR) ] || mkdir -p $(DESTDIR)/$(KMOD_DIR); \
+   for MOD in ${MODULES}; do \
+   cp -rf $$MOD ${DESTDIR}/${KMOD_DIR}; \
+   echo installing: $$MOD; \
+   done \
+   fi
+#
 # uninstall: remove all built sdk
 #
 UNINSTALL_TARGETS := $(addsuffix _uninstall,\
diff --git a/mk/rte.sdkroot.mk b/mk/rte.sdkroot.mk
index 7a72c9b..e652218 100644
--- a/mk/rte.sdkroot.mk
+++ b/mk/rte.sdkroot.mk
@@ -97,8 +97,8 @@ test fast_test ring_test mempool_test perf_test coverage:
 testall:
$(Q)$(MAKE) -f $(RTE_SDK)/mk/rte.sdktestall.mk $@

-.PHONY: install install-headers install-bin install-lib uninstall
-install install-headers install-bin install-lib uninstall:
+.PHONY: install install-headers install-bin install-lib install-mod uninstall
+install install-headers install-bin install-lib install-mod uninstall:
$(Q)$(MAKE) -f $(RTE_SDK)/mk/rte.sdkinstall.mk $@

 .PHONY: doc help
-- 
2.6.1.120.g24a00ef



[dpdk-dev] [PATCH v6 03/10] mk: Add rule for installing libraries

2015-11-10 Thread Mario Carrillo
Add hierarchy-file support to the DPDK libraries,
when invoking "make install-lib" libraries will
be installed in: $(DESTDIR)/$(LIB_DIR)
where LIB_DIR=$(RTE_PREFIX)/usr/lib RTE_PREFIX=/usr/local by default,
you can override RTE_PREFIX and LIB_DIR vars.
This hierarchy is based on:
http://www.freedesktop.org/software/systemd/man/file-hierarchy.html

Signed-off-by: Mario Carrillo 
---
 mk/rte.sdkinstall.mk | 16 
 mk/rte.sdkroot.mk|  4 ++--
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/mk/rte.sdkinstall.mk b/mk/rte.sdkinstall.mk
index 94fb945..4f06591 100644
--- a/mk/rte.sdkinstall.mk
+++ b/mk/rte.sdkinstall.mk
@@ -45,9 +45,11 @@ ifneq (,$(wildcard $(RTE_OUTPUT)/.config))
 RTE_PREFIX ?= /usr/local
 INCLUDE_DIR ?= $(RTE_PREFIX)/include/dpdk
 BIN_DIR ?= $(RTE_PREFIX)/bin
+LIB_DIR ?= $(RTE_PREFIX)/lib
 HSLINKS := $(shell find  $(RTE_OUTPUT)/include/ -name *.h)
 BINARY_FILES := $(patsubst %.map,,$(wildcard $(RTE_OUTPUT)/app/*))
 NIC_FILES := $(wildcard $(RTE_SDK)/tools/*.py)
+LIBS := $(wildcard $(RTE_OUTPUT)/lib/*)
 BINARY_FILES += $(NIC_FILES)
 endif
 endif
@@ -113,6 +115,20 @@ install-bin:
done \
fi
 #
+# install libs in /usr/local/lib by default
+# RTE_PREFIX and LIB_DIR can be overridden.
+#
+.PHONY: install-lib
+install-lib:
+   @echo == Installing libraries
+   @if [ ! -z "${LIBS}" ]; then \
+   [ -d $(DESTDIR)/$(LIB_DIR) ] || mkdir -p $(DESTDIR)/$(LIB_DIR); \
+   for LIB in ${LIBS}; do \
+   cp -rf $$LIB ${DESTDIR}/${LIB_DIR}; \
+   echo installing: $$LIB; \
+   done \
+   fi
+#
 # uninstall: remove all built sdk
 #
 UNINSTALL_TARGETS := $(addsuffix _uninstall,\
diff --git a/mk/rte.sdkroot.mk b/mk/rte.sdkroot.mk
index 24eaa60..7a72c9b 100644
--- a/mk/rte.sdkroot.mk
+++ b/mk/rte.sdkroot.mk
@@ -97,8 +97,8 @@ test fast_test ring_test mempool_test perf_test coverage:
 testall:
$(Q)$(MAKE) -f $(RTE_SDK)/mk/rte.sdktestall.mk $@

-.PHONY: install install-headers install-bin uninstall
-install install-headers install-bin uninstall:
+.PHONY: install install-headers install-bin install-lib uninstall
+install install-headers install-bin install-lib uninstall:
$(Q)$(MAKE) -f $(RTE_SDK)/mk/rte.sdkinstall.mk $@

 .PHONY: doc help
-- 
2.6.1.120.g24a00ef



[dpdk-dev] [PATCH v6 02/10] mk: Add rule for installing app files

2015-11-10 Thread Mario Carrillo
Add hierarchy-file support to the DPDK app files,
nic bind file and cpu layout file
when invoking "make install-bin" app files will
be installed in: $(DESTDIR)/$(BIN_DIR)
where BIN_DIR=$(RTE_PREFIX)/usr/local/bin and RTE_PREFIX=/usr/local by
default, you can override RTE_PREFIX and BIN_DIR vars.
This hierarchy is based on:
http://www.freedesktop.org/software/systemd/man/file-hierarchy.html

Signed-off-by: Mario Carrillo 
---
 mk/rte.sdkinstall.mk | 18 ++
 mk/rte.sdkroot.mk|  4 ++--
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/mk/rte.sdkinstall.mk b/mk/rte.sdkinstall.mk
index 2daae1d..94fb945 100644
--- a/mk/rte.sdkinstall.mk
+++ b/mk/rte.sdkinstall.mk
@@ -44,7 +44,11 @@ T=*
 ifneq (,$(wildcard $(RTE_OUTPUT)/.config))
 RTE_PREFIX ?= /usr/local
 INCLUDE_DIR ?= $(RTE_PREFIX)/include/dpdk
+BIN_DIR ?= $(RTE_PREFIX)/bin
 HSLINKS := $(shell find  $(RTE_OUTPUT)/include/ -name *.h)
+BINARY_FILES := $(patsubst %.map,,$(wildcard $(RTE_OUTPUT)/app/*))
+NIC_FILES := $(wildcard $(RTE_SDK)/tools/*.py)
+BINARY_FILES += $(NIC_FILES)
 endif
 endif

@@ -95,6 +99,20 @@ install-headers:
done \
fi
 #
+# install app files in /usr/local/bin by default
+# RTE_PREFIX and BIN_DIR can be overridden.
+#
+.PHONY: install-bin
+install-bin:
+   @echo == Installing app files;
+   @if [ ! -z "${BINARY_FILES}" ]; then \
+   [ -d $(DESTDIR)/$(BIN_DIR) ] || mkdir -p $(DESTDIR)/$(BIN_DIR); \
+   for BIN_FILE in ${BINARY_FILES}; do \
+   cp -rf $$BIN_FILE ${DESTDIR}/${BIN_DIR}; \
+   echo installing: $$BIN_FILE; \
+   done \
+   fi
+#
 # uninstall: remove all built sdk
 #
 UNINSTALL_TARGETS := $(addsuffix _uninstall,\
diff --git a/mk/rte.sdkroot.mk b/mk/rte.sdkroot.mk
index 8477a2b..24eaa60 100644
--- a/mk/rte.sdkroot.mk
+++ b/mk/rte.sdkroot.mk
@@ -97,8 +97,8 @@ test fast_test ring_test mempool_test perf_test coverage:
 testall:
$(Q)$(MAKE) -f $(RTE_SDK)/mk/rte.sdktestall.mk $@

-.PHONY: install install-headers uninstall
-install install-headers uninstall:
+.PHONY: install install-headers install-bin uninstall
+install install-headers install-bin uninstall:
$(Q)$(MAKE) -f $(RTE_SDK)/mk/rte.sdkinstall.mk $@

 .PHONY: doc help
-- 
2.6.1.120.g24a00ef



[dpdk-dev] [PATCH v6 01/10] mk: Add rule for installing headers

2015-11-10 Thread Mario Carrillo
Add hierarchy-file support to the DPDK headers,
when invoking "make install-headers" headers will
be installed in: $(DESTDIR)/$(INCLUDE_DIR)
where INCLUDE_DIR=$(RTE_PREFIX)/include/dpdk and RTE_PREFIX=/usr/local
by default, you can override RTE_PREFIX and INCLUDE_DIR vars.
This hierarchy is based on:
http://www.freedesktop.org/software/systemd/man/file-hierarchy.html

Signed-off-by: Mario Carrillo 
---
 mk/rte.sdkinstall.mk | 21 +
 mk/rte.sdkroot.mk|  4 ++--
 2 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/mk/rte.sdkinstall.mk b/mk/rte.sdkinstall.mk
index 86c98a5..2daae1d 100644
--- a/mk/rte.sdkinstall.mk
+++ b/mk/rte.sdkinstall.mk
@@ -41,6 +41,11 @@ endif
 # x86_64-native-*-gcc
 ifndef T
 T=*
+ifneq (,$(wildcard $(RTE_OUTPUT)/.config))
+RTE_PREFIX ?= /usr/local
+INCLUDE_DIR ?= $(RTE_PREFIX)/include/dpdk
+HSLINKS := $(shell find  $(RTE_OUTPUT)/include/ -name *.h)
+endif
 endif

 #
@@ -74,6 +79,22 @@ install: $(INSTALL_TARGETS)
$(Q)$(MAKE) all O=$(BUILD_DIR)/$*

 #
+# install headers in /usr/local/include/dpdk by default
+# RTE_PREFIX and INCLUDE_DIR can be overridden.
+#
+.PHONY: install-headers
+install-headers:
+   @echo == Installing headers;
+   @if [ ! -z "${HSLINKS}" ]; then \
+   for HSLINK in ${HSLINKS}; do \
+   HEADER=$$(readlink -f $$HSLINK); \
+   HEADER_DIR=$$(dirname $$HSLINK | sed 's/.*include\/*//'); \
+   [ -d $(DESTDIR)/$(INCLUDE_DIR)/$$HEADER_DIR ] || mkdir -p 
$(DESTDIR)/$(INCLUDE_DIR)/$$HEADER_DIR; \
+   cp -rf $$HEADER ${DESTDIR}/${INCLUDE_DIR}/$$HEADER_DIR; \
+   echo installing: $$HEADER; \
+   done \
+   fi
+#
 # uninstall: remove all built sdk
 #
 UNINSTALL_TARGETS := $(addsuffix _uninstall,\
diff --git a/mk/rte.sdkroot.mk b/mk/rte.sdkroot.mk
index e8423b0..8477a2b 100644
--- a/mk/rte.sdkroot.mk
+++ b/mk/rte.sdkroot.mk
@@ -97,8 +97,8 @@ test fast_test ring_test mempool_test perf_test coverage:
 testall:
$(Q)$(MAKE) -f $(RTE_SDK)/mk/rte.sdktestall.mk $@

-.PHONY: install uninstall
-install uninstall:
+.PHONY: install install-headers uninstall
+install install-headers uninstall:
$(Q)$(MAKE) -f $(RTE_SDK)/mk/rte.sdkinstall.mk $@

 .PHONY: doc help
-- 
2.6.1.120.g24a00ef



[dpdk-dev] [PATCH v6 00/10] Add installation rules for dpdk files

2015-11-10 Thread Mario Carrillo
DPDK package lacks of a mechanism to install libraries, headers
applications, kernel modules and sdk files to a file system tree.
This patch set allows to install files based on the next
proposal:
http://www.freedesktop.org/software/systemd/man/file-hierarchy.html

v6:
When "make install" is invoked if "T" variable is defined,
the installation process will have the current
behaviour, else "install-fhs" rule will be called.

Using rules support is possible to do the next steps:

make config T=
make
make 

Modify the makefile target to specify the files
that will be installed using a rule:

* make install-bin (install app files)(dafault path BIN_DIR=$(RTE_PREFIX)/bin).

* make install-headers (install headers)(dafault path 
INCLUDE_DIR=$(RTE_PREFIX)/include/dpdk).

* make install-lib (install libraries)(dafault path LIB_DIR=$(RTE_PREFIX)/lib).

* make install-doc (install documentation)(dafault path 
DOC_DIR=$(RTE_PREFIX)/share/doc/dpdk).

* make install-mod (install modules)(dafault path if RTE_EXEC_ENV=linuxapp then
KMOD_DIR=/lib/modules/$(uname -r)/extra/drivers/dpdk else 
KMOD_DIR=/boot/modules).

* make install-sdk (install headers, makefiles, scripts,examples, tools and
config files) (default path DATA_DIR=$(RTE_PREFIX)/share/dpdk).

* make install-fhs (install  libraries, modules, app files,
nic bind files and documentation).

* make install (if T is defined current behaviour, else it will call 
install-fhs rule )

where RTE_PREFIX=/usr/local by default.

Also you can use the DESTDIR var.
All directory variables mentioned above can be overridden
(BIN_DIR, LIB_DIR, INCLUDE_DIR, DOC_DIR, KMOD_DIR, RTE_PREFIX and DATA_DIR).

Furthermore this information is added to documentation.


v5:

When "make install" is invoked if "T" variable is defined,
the installation process will have the current
behaviour, else "install-fhs" rule will be called.

Using rules support is possible to do the next steps:

make config T=
make
make 

Modify the makefile target to specify the files
that will be installed using a rule:

* make install-bin (install app files)(dafault path BIN_DIR=$(RTE_PREFIX)/bin).

* make install-headers (install headers)(dafault path 
INCLUDE_DIR=$(RTE_PREFIX)/include/dpdk).

* make install-lib (install libraries)(dafault path LIB_DIR=$(RTE_PREFIX)/lib).

* make install-doc (install documentation)(dafault path 
DOC_DIR=$(RTE_PREFIX)/share/doc/dpdk).

* make install-mod (install modules)(dafault path if RTE_EXEC_ENV=linuxapp then
KMOD_DIR=/lib/modules/$(uname -r)/extra/drivers/dpdk else 
KMOD_DIR=/boot/modules).

* make install-sdk (install headers, makefiles, scripts,examples, tools and
config files) (default path DATA_DIR=$(RTE_PREFIX)/share/dpdk).

* make install-fhs (install  libraries, modules, app files,
nic bind files and documentation).

* make install (if T is defined current behaviour, else it will call 
install-fhs rule )

where RTE_PREFIX=/usr/local by default.

Also you can use the DESTDIR var.
All directory variables mentioned above can be overridden
(BIN_DIR, LIB_DIR, INCLUDE_DIR, DOC_DIR, KMOD_DIR, RTE_PREFIX and DATA_DIR).

Furthermore this information is added to documentation (build-sdk-quick.txt 
file)

v4:

Add instalation rules for dpdk files.

DPDK package lacks of a mechanism to install libraries, headers
applications, kernel modules and sdk files to a file system tree.

This patch set allows to install files according to the next
proposal:
http://www.freedesktop.org/software/systemd/man/file-hierarchy.html
And this patch set does not affect the current dpdk behavior.

Using rules support is possible to do the next steps:
make config T=TARGET
make
make INSTALL-TARGET



Modify the makefile target to specify the files 
that will be installed using a rule:

* make install-bin (install app files)(dafault path BIN_DIR=/usr/bin).

* make install-headers (install headers)(dafault path 
INCLUDE_DIR=/usr/include/dpdk).

* make install-lib (install libraries)(dafault path if the architecture is 64 
bits
is LIB_DIR=/usr/lib64 else LIB_DIR=/usr/lib).

* make install-doc (install documentation)(dafault path 
DOC_DIR=/usr/share/doc/dpdk).

* make install-mod (install modules)(dafault path if RTE_EXEC_ENV=linuxapp then 
KERNEL_DIR=/lib/modules/$(uname -r)/extra/drivers/dpdk else 
KERNEL_DIR=/boot/modules).

* make install-sdk (install headers, makefiles, scripts,examples, tools and 
config files) (default path DATA_DIR=/usr/share/dpdk). 

* make install-fhs (install  libraries, modules, app files, 
nic bind files and documentation).

Also you can use the DESTDIR variable.
All directory variables mentioned above can be overridden
(BIN_DIR, LIB_DIR, INCLUDE_DIR, DOC_DIR, KERNEL_DIR and DATA_DIR).

v3:

Modify the makefile target to specify the files 
that will be installed using a rule:

make install-bin (install app files)(dafault 

[dpdk-dev] URGENT please help. Issue on ixgbe_tx_free_bufs version 2.0.0

2015-11-10 Thread Bruce Richardson
On Tue, Nov 10, 2015 at 01:35:21AM -0300, Ariel Rodriguez wrote:
> Dear dpdk experts.
> 
> Im having a recurrent segmentation fault under the
> function ixgbe_tx_free_bufs (ixgbe_rxtx.c:150) (i enable -g3 -O0).
> 
> Surfing the core dump i find out this:
> 
> txep = &(txq->sw_ring[txq->tx_next_dd - (txq->tx_rs_thresh - 1)]);
> 
> txq->tx_next_dd = 31
> txq->txq->tx_rs_thresh=32
> 
> Obviosly txep points out to the first element but
> 
> *(txep).mbuf == INVALID MBUF ADDRESS
> 
> The same applies to
> 
> *(txep+1).mbuf ; *(txep +2).mbuf;*(txep+3).mbuf
> 
> from *(txep+4) .mbuf to *(txep+31).mbuf seems to be valid because im able
> to derefence the mbuf's
> 
> 
> Note:
> 
> I disable CONFIG_RTE_IXGBE_INC_VECTOR because i gets similiar behavior , I
> thought the problem would disappear disabling that feature.
> 
> 
> the program always  runs well up to 4 or 5 hours and then crash ... always
> in the same line.
> 
> this is the backtrace of the program:
> 
> #0  0x00677a64 in rte_atomic16_read (v=0x47dc14c18b14) at
> /opt/dpdk-2.0.0/x86_64-native-linuxapp-gcc/include/generic/rte_atomic.h:151
> #1  0x00677c1d in rte_mbuf_refcnt_read (m=0x47dc14c18b00) at
> /opt/dpdk-2.0.0/x86_64-native-linuxapp-gcc/include/rte_mbuf.h:411
> #2  0x0067a13c in __rte_pktmbuf_prefree_seg (m=0x47dc14c18b00) at
> /opt/dpdk-2.0.0/x86_64-native-linuxapp-gcc/include/rte_mbuf.h:778
> #3  rte_pktmbuf_free_seg (m=0x47dc14c18b00) at
> /opt/dpdk-2.0.0/x86_64-native-linuxapp-gcc/include/rte_mbuf.h:810
> #4  ixgbe_tx_free_bufs (txq=0x7ffb40ae52c0) at
> /opt/dpdk-2.0.0/lib/librte_pmd_ixgbe/ixgbe_rxtx.c:150
> #5  tx_xmit_pkts (tx_queue=0x7ffb40ae52c0, tx_pkts=0x64534770 ,
> nb_pkts=32) at /opt/dpdk-2.0.0/lib/librte_pmd_ixgbe/ixgbe_rxtx.c:256
> #6  0x0067c6f3 in ixgbe_xmit_pkts_simple (tx_queue=0x7ffb40ae52c0,
> tx_pkts=0x64534570 , nb_pkts=80) at
> /opt/dpdk-2.0.0/lib/librte_pmd_ixgbe/ixgbe_rxtx.c:343
> #7  0x004ec93d in rte_eth_tx_burst (port_id=1 '\001', queue_id=0,
> tx_pkts=0x64534570 , nb_pkts=144) at
> /opt/dpdk-2.0.0/x86_64-native-linuxapp-gcc/include/rte_ethdev.h:2572
>
Hi,

I'd like a bit more information to help debug your problem:
* what application are you running when you see this crash? If it's an app of 
your
own making, can you reproduce the crash using one of the standard DPDK apps, or
example apps, e.g. testpmd, l2fwd, etc.

* Can you also try to verify if the crash occurs with the latest DPDK code 
available
in git from dpdk.org?

Regards,
/Bruce


[dpdk-dev] [PATCH v2 06/11] bnx2x: FreeBSD enablement

2015-11-10 Thread Bruce Richardson
On Mon, Nov 09, 2015 at 03:56:21PM -0800, Rasesh Mody wrote:
> Compile tested.
> 
> Signed-off-by: Rasesh Mody 
> ---
>  doc/guides/nics/bnx2x.rst|   16 
>  drivers/net/bnx2x/bnx2x.c|9 +
>  drivers/net/bnx2x/bnx2x.h|   23 +++
>  drivers/net/bnx2x/ecore_sp.h |6 ++
>  4 files changed, 54 insertions(+)
> 
> diff --git a/doc/guides/nics/bnx2x.rst b/doc/guides/nics/bnx2x.rst
> index 613a2b7..b70de04 100644
> --- a/doc/guides/nics/bnx2x.rst
> +++ b/doc/guides/nics/bnx2x.rst
> @@ -141,6 +141,14 @@ command:
> cd 
> make config T=x86_64-native-linuxapp-clang install
>  
> +To compile BNX2X PMD for Linux i686 gcc target, run the following "make"
> +command:
> +
> +.. code-block:: console
> +
> +   cd 
> +   make config T=i686-native-linuxapp-gcc install
> +

Minor nit, I think this block belongs in the next patch.



[dpdk-dev] [PATCH v5 02/10] ethdev: make error checking macros public

2015-11-10 Thread Bruce Richardson
On Mon, Nov 09, 2015 at 08:34:11PM +, Declan Doherty wrote:
> Move the function pointer and port id checking macros to rte_ethdev and
> rte_dev header files, so that they can be used in the static inline
> functions there. Also replace the RTE_LOG call within
> RTE_PMD_DEBUG_TRACE so this macro can be built with the -pedantic flag
> 
> Signed-off-by: Declan Doherty 

Thanks, Declan. I'll rebase my other patchset that was very similar to this on
top of this patch and your previous one.

Acked-by: Bruce Richardson 

> ---
>  lib/librte_eal/common/include/rte_dev.h | 52 +++
>  lib/librte_ether/rte_ethdev.c   | 54 
> -
>  lib/librte_ether/rte_ethdev.h   | 26 
>  3 files changed, 78 insertions(+), 54 deletions(-)
> 
> diff --git a/lib/librte_eal/common/include/rte_dev.h 
> b/lib/librte_eal/common/include/rte_dev.h
> index f601d21..fd09b3d 100644
> --- a/lib/librte_eal/common/include/rte_dev.h
> +++ b/lib/librte_eal/common/include/rte_dev.h
> @@ -46,8 +46,60 @@
>  extern "C" {
>  #endif
>  
> +#include 
>  #include 
>  
> +#include 
> +
> +__attribute__((format(printf, 2, 0)))
> +static inline void
> +rte_pmd_debug_trace(const char *func_name, const char *fmt, ...)
> +{
> + va_list ap;
> +
> + va_start(ap, fmt);
> + char buffer[vsnprintf(NULL, 0, fmt, ap)];
> +
> + va_end(ap);
> +
> + va_start(ap, fmt);
> + vsnprintf(buffer, sizeof(buffer), fmt, ap);
> + va_end(ap);
> +
> + rte_log(RTE_LOG_ERR, RTE_LOGTYPE_PMD, "%s: %s", func_name, buffer);
> +}
> +
> +/* Macros for checking for restricting functions to primary instance only */
> +#define RTE_PROC_PRIMARY_OR_ERR_RET(retval) do { \
> + if (rte_eal_process_type() != RTE_PROC_PRIMARY) { \
> + RTE_PMD_DEBUG_TRACE("Cannot run in secondary processes\n"); \
> + return retval; \
> + } \
> +} while (0)
> +
> +#define RTE_PROC_PRIMARY_OR_RET() do { \
> + if (rte_eal_process_type() != RTE_PROC_PRIMARY) { \
> + RTE_PMD_DEBUG_TRACE("Cannot run in secondary processes\n"); \
> + return; \
> + } \
> +} while (0)
> +
> +/* Macros to check for invalid function pointers */
> +#define RTE_FUNC_PTR_OR_ERR_RET(func, retval) do { \
> + if ((func) == NULL) { \
> + RTE_PMD_DEBUG_TRACE("Function not supported\n"); \
> + return retval; \
> + } \
> +} while (0)
> +
> +#define RTE_FUNC_PTR_OR_RET(func) do { \
> + if ((func) == NULL) { \
> + RTE_PMD_DEBUG_TRACE("Function not supported\n"); \
> + return; \
> + } \
> +} while (0)
> +
> +
>  /** Double linked list of device drivers. */
>  TAILQ_HEAD(rte_driver_list, rte_driver);
>  
> diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
> index 7387f65..d3c8aba 100644
> --- a/lib/librte_ether/rte_ethdev.c
> +++ b/lib/librte_ether/rte_ethdev.c
> @@ -69,60 +69,6 @@
>  #include "rte_ether.h"
>  #include "rte_ethdev.h"
>  
> -#ifdef RTE_LIBRTE_ETHDEV_DEBUG
> -#define RTE_PMD_DEBUG_TRACE(fmt, args...) do {do { \
> - RTE_LOG(ERR, PMD, "%s: " fmt, __func__, ## args); \
> - } while (0)
> -#else
> -#define RTE_PMD_DEBUG_TRACE(fmt, args...)
> -#endif
> -
> -/* Macros for checking for restricting functions to primary instance only */
> -#define RTE_PROC_PRIMARY_OR_ERR_RET(retval) do { \
> - if (rte_eal_process_type() != RTE_PROC_PRIMARY) { \
> - RTE_PMD_DEBUG_TRACE("Cannot run in secondary processes\n"); \
> - return (retval); \
> - } \
> -} while (0)
> -
> -#define RTE_PROC_PRIMARY_OR_RET() do { \
> - if (rte_eal_process_type() != RTE_PROC_PRIMARY) { \
> - RTE_PMD_DEBUG_TRACE("Cannot run in secondary processes\n"); \
> - return; \
> - } \
> -} while (0)
> -
> -/* Macros to check for invalid function pointers in dev_ops structure */
> -#define RTE_FUNC_PTR_OR_ERR_RET(func, retval) do { \
> - if ((func) == NULL) { \
> - RTE_PMD_DEBUG_TRACE("Function not supported\n"); \
> - return (retval); \
> - } \
> -} while (0)
> -
> -#define RTE_FUNC_PTR_OR_RET(func) do { \
> - if ((func) == NULL) { \
> - RTE_PMD_DEBUG_TRACE("Function not supported\n"); \
> - return; \
> - } \
> -} while (0)
> -
> -/* Macros to check for valid port */
> -#define RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, retval) do { \
> - if (!rte_eth_dev_is_valid_port(port_id)) {  \
> - RTE_PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); \
> - return retval; \
> - } \
> -} while (0)
> -
> -#define RTE_ETH_VALID_PORTID_OR_RET(port_id) do { \
> - if (!rte_eth_dev_is_valid_port(port_id)) { \
> - RTE_PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); \
> - return; \
> - } \
> -} while (0)
> -
> -
>  static const char *MZ_RTE_ETH_DEV_DATA = "rte_eth_dev_data";
>  struct rte_eth_dev rte_eth_devices[RTE_MAX_ETHPORTS];
>  static 

[dpdk-dev] [PATCH v3 2/4] ethdev: move error checking macros to header

2015-11-10 Thread Declan Doherty
On 09/11/15 14:02, Richardson, Bruce wrote:
>
>
>> -Original Message-
>> From: Adrien Mazarguil [mailto:adrien.mazarguil at 6wind.com]
>> Sent: Monday, November 9, 2015 1:39 PM
>> To: Richardson, Bruce 
>> Cc: Stephen Hemminger ; Thomas Monjalon
>> ; dev at dpdk.org
>> Subject: Re: [dpdk-dev] [PATCH v3 2/4] ethdev: move error checking macros
>> to header
>>
>> On Fri, Nov 06, 2015 at 05:22:27PM +, Bruce Richardson wrote:
>>> On Fri, Nov 06, 2015 at 05:10:07PM +, Bruce Richardson wrote:
 On Thu, Nov 05, 2015 at 04:09:18PM +0100, Adrien Mazarguil wrote:
>
> I won't argue against this as it's obviously more complex than the
>> original
> method, however note that users of the RTE_PMD_DEBUG_TRACE() macro
>> do not
> have to modify their code. They shouldn't care about the
>> implementation.
>
> Also note that we can do much cleaner code if we drop the all macros
> implementation using a (much easier to debug) static inline
>> function,
> only perhaps with a wrapper macro that provides __LINE__, __func__
>> and
> __FILE__ as arguments. Nontrival code shouldn't be done in macros
>> anyway.
>
 Getting something working with __FILE__ and probably __LINE__ would be
>> easy enough
 with a helper macro, but __func__ is not so easy as it's not a
>> preprocessor symbol
 [since the pre-processor has no idea what function you are in].

 However, using func, here is the best I've come up with so far. It's
>> not that
 pretty, but it's probably easier to work with than the macro version.

   #ifdef RTE_LIBRTE_ETHDEV_DEBUG
   -#define RTE_PMD_DEBUG_TRACE(fmt, args...) \
   -   RTE_LOG(ERR, PMD, "%s: " fmt, __func__, ## args)
   +#define RTE_PMD_DEBUG_TRACE(...) \
   +   rte_pmd_debug_trace(__func__, __VA_ARGS__)
   +
   +static inline void
   +rte_pmd_debug_trace(const char *func_name, const char *fmt, ...)
   +{
   +   static __thread char buffer[128];
   +   char *out_buf = buffer;
   +   unsigned count;
   +   va_list ap;
   +
   +   count = snprintf(buffer, sizeof(buffer), "%s: %s", func_name,
>> fmt);
   +   if (count >= sizeof(buffer)) { // truncated output
   +   char *new_buf = malloc(count + 1);
   +   if (new_buf == NULL) // no memory, just print 128
>> chars
   +   goto print_buffer;
   +   snprintf(new_buf, count + 1, "%s: %s", func_name,
>> fmt);
   +   va_start(ap, fmt);
   +   rte_vlog(RTE_LOG_ERR, RTE_LOGTYPE_PMD, buffer, ap);
   +   va_end(ap);
   +   free(new_buf);
   +   return;
   +   }
   +
   +print_buffer:
   +   va_start(ap, fmt);
   +   rte_vlog(RTE_LOG_ERR, RTE_LOGTYPE_PMD, out_buf, ap);
   +   va_end(ap);
   +}
#else
#define RTE_PMD_DEBUG_TRACE(fmt, args...)
#endif

 Comments or improvements?
>>
>> Such a function shouldn't malloc() anything. The entire line should fit on
>> the stack (crashing is fine if it does not, then it's probably a bug). We
>> did something in two passes along these lines in mlx5_defs.h (not pretty
>> but
>> quite useful):
>>
>>   /* Allocate a buffer on the stack and fill it with a printf format
>> string. */
>>   #define MKSTR(name, ...) \
>>   char name[snprintf(NULL, 0, __VA_ARGS__) + 1]; \
>>   \
>>   snprintf(name, sizeof(name), __VA_ARGS__)
>>
>> Untested but I guess modifying that function accordingly would look like:
>>
>>   static inline void
>>   rte_pmd_debug_trace(const char *func_name, const char *fmt, ...)
>>   {
>>   va_list ap;
>>   va_start(ap, fmt);
>>
>>   static __thread char buffer[vsnprintf(NULL, 0, fmt, ap)];
>>
>>   va_end(ap);
>>   va_start(ap, fmt);
>>   vsnprintf(buffer, sizeof(buffer), fmt, ap);
>>   va_end(ap);
>>   rte_log(RTE_LOG_ERR, RTE_LOGTYPE_PMD, "%s: %s", func_name,
>> buffer);
>>   }
>>
>
> Looks a much better option.
>
>  From this, though, I assume then that we are only looking to support the 
> -pedantic flag in conjuction with c99 mode or above. Supporting -pedantic 
> with the pre-gcc-5 versions won't allow that to work though, as variably 
> sized arrays only came in with c99, and were gnu extensions before that.
>
> Regards,
> /Bruce
>

I had made some similar changes in the cryptodev patch set to allow 
these macros to be shared between the ethdev and cryptodev, but I wasn't 
aware of the -pedantic build issues. I've incorporate the changes from 
patch 1 & 2 discussed here into the cryptodev patch set. See patch 2/10 
(http://dpdk.org/ml/archives/dev/2015-November/027888.html) for the 
implementation of the rte_pmf_debug_trace function. Any comments or 
ack's are welcome :)

Declan



[dpdk-dev] [PATCH v5 01/10] ethdev: rename macros to have RTE_ prefix

2015-11-10 Thread Bruce Richardson
On Mon, Nov 09, 2015 at 08:34:10PM +, Declan Doherty wrote:
> The macros to check that the function pointers and port ids are valid
> for an ethdev are potentially useful to have in a common headers for
> use with all PMDs. However, since they would then become externally
> visible, we apply the RTE_ & RTE_ETH_ prefix to them as approtiate.

Typo: appropriate

> 
> Signed-off-by: Declan Doherty 

Acked-by: Bruce Richardson 



[dpdk-dev] [PATCH] i40e: fix compilation error on icc 2015

2015-11-10 Thread Zhang, Helin


> -Original Message-
> From: De Lara Guarch, Pablo
> Sent: Tuesday, November 10, 2015 6:20 PM
> To: Zhang, Helin
> Cc: dev at dpdk.org; De Lara Guarch, Pablo
> Subject: [PATCH] i40e: fix compilation error on icc 2015
> 
> Fix for the following error on icc 2015, due to incorrect type:
> drivers/net/i40e/i40e_fdir.c(1376): error #188: enumerated type mixed with
> another type
> case RTE_ETH_FDIR_FILTER_INPUT_SET_SELECT:
>  ^
> 
> Fixes: 98f05570 ("i40e: configure input fields for RSS or flow director")
> 
> Signed-off-by: Pablo de Lara 
Acked-by: Helin Zhang 


[dpdk-dev] [PATCH] vhost: make destroy callback on VHOST_USER_RESET_OWNER

2015-11-10 Thread Yuanhan Liu
On Mon, Nov 09, 2015 at 06:15:13PM -0800, Rich Lane wrote:
> QEMU sends this message first when shutting down. There was previously no way
> for the dataplane to know that the virtio_net instance had become unusable and
> it would segfault when trying to do RX/TX.
> 
> Signed-off-by: Rich Lane 

Thanks. Even I have same patch in my patch queue (I have some other
issues to fix), you got my ack.

Acked-by: Yuanhan Liu 

--yliu


> ---
>  lib/librte_vhost/virtio-net.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/lib/librte_vhost/virtio-net.c b/lib/librte_vhost/virtio-net.c
> index 14278de..39a6a5e 100644
> --- a/lib/librte_vhost/virtio-net.c
> +++ b/lib/librte_vhost/virtio-net.c
> @@ -436,6 +436,9 @@ reset_owner(struct vhost_device_ctx ctx)
>   if (dev == NULL)
>   return -1;
>  
> + if (dev->flags & VIRTIO_DEV_RUNNING)
> + notify_ops->destroy_device(dev);
> +
>   device_fh = dev->device_fh;
>   cleanup_device(dev);
>   init_device(dev);
> -- 
> 1.9.1


[dpdk-dev] DPDK ArmV7 autotests

2015-11-10 Thread Hunt, David
On 09/11/2015 17:46, Jan Viktorin wrote:
 > Here is the log. You an see, that many tests fail just because
 > of the missing hugetlb support. This is strange as I modified the
 > autotest_runner.py to inject "--no-huge --no-pci" options when it
 > detects armv7 architecture.

I think publishing these test results to the mailing list confuses 
matters somewhat. The tests are not tuned for armv7, and there are many 
false negatives, giving the impression that the results are worse than 
they actually should be.

The tests need to be analysed to see if they respect the --no-huge and 
--no-pci flags correctly, I suspect some tests are being run even though 
these flags are enabled.

I believe enough of the tests pass to allow the initial version of the 
patch set to be accepted. We can look at the failing cases later, and 
improve the test suite as time goes on.

Thanks,
Dave.


[dpdk-dev] [PATCH] i40e: fix compilation error on icc 2015

2015-11-10 Thread Pablo de Lara
Fix for the following error on icc 2015, due to incorrect type:
drivers/net/i40e/i40e_fdir.c(1376): error #188: enumerated type mixed with 
another type
case RTE_ETH_FDIR_FILTER_INPUT_SET_SELECT:
 ^

Fixes: 98f05570 ("i40e: configure input fields for RSS or flow director")

Signed-off-by: Pablo de Lara 
---
 drivers/net/i40e/i40e_fdir.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c
index 7b1aa6e..23f8a30 100644
--- a/drivers/net/i40e/i40e_fdir.c
+++ b/drivers/net/i40e/i40e_fdir.c
@@ -1361,7 +1361,7 @@ i40e_fdir_stats_get(struct rte_eth_dev *dev, struct 
rte_eth_fdir_stats *stat)

 static int
 i40e_fdir_filter_set(struct rte_eth_dev *dev,
-struct rte_eth_hash_filter_info *info)
+struct rte_eth_fdir_filter_info *info)
 {
struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
struct i40e_hw *hw = I40E_PF_TO_HW(pf);
@@ -1428,7 +1428,7 @@ i40e_fdir_ctrl_func(struct rte_eth_dev *dev,
break;
case RTE_ETH_FILTER_SET:
ret = i40e_fdir_filter_set(dev,
-   (struct rte_eth_hash_filter_info *)arg);
+   (struct rte_eth_fdir_filter_info *)arg);
break;
case RTE_ETH_FILTER_STATS:
i40e_fdir_stats_get(dev, (struct rte_eth_fdir_stats *)arg);
-- 
2.5.0



[dpdk-dev] [PATCH] eal: add architecture specific rte_cpuflags.c files

2015-11-10 Thread Ferruh Yigit
Move cpu_feature_table array from arch specific rte_cpuflags.h files to
new arch specific rte_cpuflags.c files.

Main motivation is to escape from static variable declarations in
header files. cpu_feature_table has many copies in final binary, even
exist in some object files that does not use this variable at all.

And this can be a sample to create architecture specific source files
and move some functions which are not performance sensitive from
architecture header files to source files.

Signed-off-by: Ferruh Yigit 
---
 lib/librte_eal/bsdapp/eal/Makefile |   6 +
 lib/librte_eal/bsdapp/eal/rte_eal_version.map  |   3 +-
 lib/librte_eal/common/arch/ppc_64/rte_cpuflags.c   |  70 +++
 lib/librte_eal/common/arch/tile/rte_cpuflags.c |  36 ++
 lib/librte_eal/common/arch/x86/rte_cpuflags.c  | 128 +
 .../common/include/arch/ppc_64/rte_cpuflags.h  |  39 +--
 .../common/include/arch/tile/rte_cpuflags.h|   5 +-
 .../common/include/arch/x86/rte_cpuflags.h |  96 +---
 lib/librte_eal/linuxapp/eal/Makefile   |   6 +
 lib/librte_eal/linuxapp/eal/rte_eal_version.map|   3 +-
 10 files changed, 256 insertions(+), 136 deletions(-)
 create mode 100644 lib/librte_eal/common/arch/ppc_64/rte_cpuflags.c
 create mode 100644 lib/librte_eal/common/arch/tile/rte_cpuflags.c
 create mode 100644 lib/librte_eal/common/arch/x86/rte_cpuflags.c

diff --git a/lib/librte_eal/bsdapp/eal/Makefile 
b/lib/librte_eal/bsdapp/eal/Makefile
index a49dcec..089d066 100644
--- a/lib/librte_eal/bsdapp/eal/Makefile
+++ b/lib/librte_eal/bsdapp/eal/Makefile
@@ -33,7 +33,9 @@ include $(RTE_SDK)/mk/rte.vars.mk

 LIB = librte_eal.a

+ARCH_DIR ?= $(RTE_ARCH)
 VPATH += $(RTE_SDK)/lib/librte_eal/common
+VPATH += $(RTE_SDK)/lib/librte_eal/common/arch/$(ARCH_DIR)

 CFLAGS += -I$(SRCDIR)/include
 CFLAGS += -I$(RTE_SDK)/lib/librte_eal/common
@@ -81,6 +83,9 @@ SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += rte_malloc.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += malloc_elem.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += malloc_heap.c

+# from arch dir
+SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += rte_cpuflags.c
+
 CFLAGS_eal.o := -D_GNU_SOURCE
 #CFLAGS_eal_thread.o := -D_GNU_SOURCE
 CFLAGS_eal_log.o := -D_GNU_SOURCE
@@ -99,5 +104,6 @@ SYMLINK-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP)-include/exec-env := \
$(addprefix include/exec-env/,$(INC))

 DEPDIRS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += lib/librte_eal/common
+DEPDIRS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += 
lib/librte_eal/common/arch/$(ARCH_DIR)

 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map 
b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
index 8b00761..a07626e 100644
--- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map
+++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
@@ -130,5 +130,6 @@ DPDK_2.2 {
global:

rte_intr_cap_multiple;
+   cpu_feature_table;

-} DPDK_2.1;
\ No newline at end of file
+} DPDK_2.1;
diff --git a/lib/librte_eal/common/arch/ppc_64/rte_cpuflags.c 
b/lib/librte_eal/common/arch/ppc_64/rte_cpuflags.c
new file mode 100644
index 000..c5c7ec0
--- /dev/null
+++ b/lib/librte_eal/common/arch/ppc_64/rte_cpuflags.c
@@ -0,0 +1,70 @@
+/*
+ *   BSD LICENSE
+ *
+ *   Copyright (C) IBM Corporation 2014.
+ *
+ *   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 IBM 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.
+*/
+
+#include "rte_cpuflags.h"
+
+const struct feature_entry cpu_feature_table[] = {
+  

[dpdk-dev] [PATCH v2 0/2] fix compile issues on ICC

2015-11-10 Thread De Lara Guarch, Pablo
Hi Helin,

> -Original Message-
> From: Zhang, Helin
> Sent: Monday, November 09, 2015 2:46 AM
> To: dev at dpdk.org
> Cc: De Lara Guarch, Pablo; Zhang, Helin
> Subject: [PATCH v2 0/2] fix compile issues on ICC
> 
> It fixes compile issues for i40e, and testpmd on ICC 13.0.0.
> 
> v2 changes:
> Corrected the variable/function type, to replace casting.
> 
> Helin Zhang (2):
>   i40e: fix ICC compile issue
>   app/testpmd: fix ICC compile issue
> 
>  app/test-pmd/cmdline.c |  4 ++--
>  drivers/net/i40e/i40e_ethdev.c | 34 +++---
>  2 files changed, 21 insertions(+), 17 deletions(-)
> 
> --
> 1.8.1.4

Sorry, I missed that you should add a "Fixes" line on each patch.

Thanks,
Pablo


[dpdk-dev] [PATCH v3 1/2] vhost: Add callback and private data for vhost PMD

2015-11-10 Thread Panu Matilainen
On 11/10/2015 05:13 AM, Tetsuya Mukawa wrote:
> On 2015/11/10 3:16, Aaron Conole wrote:
>> Greetings,
>>
>> Tetsuya Mukawa  writes:
>>> These variables are needed to be able to manage one of virtio devices
>>> using both vhost library APIs and vhost PMD.
>>> For example, if vhost PMD uses current callback handler and private data
>>> provided by vhost library, A DPDK application that links vhost library
>>> cannot use some of vhost library APIs. To avoid it, callback and private
>>> data for vhost PMD are needed.
>>>
>>> Signed-off-by: Tetsuya Mukawa 
>>> ---
>>>   lib/librte_vhost/rte_vhost_version.map|  6 +++
>>>   lib/librte_vhost/rte_virtio_net.h |  3 ++
>>>   lib/librte_vhost/vhost_user/virtio-net-user.c | 13 +++
>>>   lib/librte_vhost/virtio-net.c | 56 
>>> +--
>>>   lib/librte_vhost/virtio-net.h |  4 +-
>>>   5 files changed, 70 insertions(+), 12 deletions(-)
>>>
>>> diff --git a/lib/librte_vhost/rte_vhost_version.map 
>>> b/lib/librte_vhost/rte_vhost_version.map
>>> index 3d8709e..00a9ce5 100644
>>> --- a/lib/librte_vhost/rte_vhost_version.map
>>> +++ b/lib/librte_vhost/rte_vhost_version.map
>>> @@ -20,3 +20,9 @@ DPDK_2.1 {
>>> rte_vhost_driver_unregister;
>>>
>>>   } DPDK_2.0;
>>> +
>>> +DPDK_2.2 {
>>> +   global:
>>> +
>>> +   rte_vhost_driver_pmd_callback_register;
>>> +} DPDK_2.1;
>>> diff --git a/lib/librte_vhost/rte_virtio_net.h 
>>> b/lib/librte_vhost/rte_virtio_net.h
>>> index 5687452..3ef6e58 100644
>>> --- a/lib/librte_vhost/rte_virtio_net.h
>>> +++ b/lib/librte_vhost/rte_virtio_net.h
>>> @@ -128,6 +128,7 @@ struct virtio_net {
>>> charifname[IF_NAME_SZ]; /**< Name of the tap 
>>> device or socket path. */
>>> uint32_tvirt_qp_nb; /**< number of queue pair we 
>>> have allocated */
>>> void*priv;  /**< private context */
>>> +   void*pmd_priv;  /**< private context for vhost 
>>> PMD */
>>> struct vhost_virtqueue  *virtqueue[VHOST_MAX_QUEUE_PAIRS * 2];  /**< 
>>> Contains all virtqueue information. */
>>>   } __rte_cache_aligned;
>> Sorry if I'm missing something, but this is an ABI breaker, isn't it? I
>> think this needs the RTE_NEXT_ABI tag around it.
>
> Hi Aaron,
>
> Thanks for reviewing. Yes, your are correct.
> I guess I can implement vhost PMD without this variable, so I will
> remove it.

No need to.

The librte_vhost ABI has already been broken during the DPDK 2.2 cycle 
by the multiqueue changes, but that's okay since it was announced during 
2.1 cycle (in commit 3c848bd7b1c6f4f681b833322a748fdefbb5fb2d).

What is missing right now is bumping the library version, and that must 
happen before 2.2 is released.

- Panu -




[dpdk-dev] [PATCH v2] ethdev: Prefetch driver variable structure

2015-11-10 Thread Stephen Hemminger
On Tue, 10 Nov 2015 14:17:41 +
"Polehn, Mike A"  wrote:

> Adds ethdev driver prefetch of variable structure to CPU cache 0
> while calling into tx or rx device driver operation.
> 
> RFC 2544 test of NIC task test measurement points show improvement
> of lower latency and/or better packet throughput indicating clock
> cycles saved.
> 
> Signed-off-by: Mike A. Polehn 

Good idea, but lots of whitespace issues.
Please also check your mail client..


ERROR: patch seems to be corrupt (line wrapped?)
#80: FILE: lib/librte_ether/rte_ethdev.h:2457:
,

WARNING: please, no spaces at the start of a line
#84: FILE: lib/librte_ether/rte_ethdev.h:2460:
+  int16_t nb_rx;$

WARNING: please, no spaces at the start of a line
#89: FILE: lib/librte_ether/rte_ethdev.h:2462:
+  { /* limit scope of rxq variable */$

ERROR: code indent should use tabs where possible
#90: FILE: lib/librte_ether/rte_ethdev.h:2463:
+ /* rxq is going to be immediately used, prefetch it */$

ERROR: code indent should use tabs where possible
#91: FILE: lib/librte_ether/rte_ethdev.h:2464:
+ void *rxq =3D dev->data->rx_queues[queue_id];$

WARNING: please, no spaces at the start of a line
#91: FILE: lib/librte_ether/rte_ethdev.h:2464:
+ void *rxq =3D dev->data->rx_queues[queue_id];$

ERROR: spaces required around that '=' (ctx:WxV)
#91: FILE: lib/librte_ether/rte_ethdev.h:2464:
+ void *rxq =3D dev->data->rx_queues[queue_id];
^

ERROR: code indent should use tabs where possible
#92: FILE: lib/librte_ether/rte_ethdev.h:2465:
+ rte_prefetch0(rxq);$

WARNING: Missing a blank line after declarations
#92: FILE: lib/librte_ether/rte_ethdev.h:2465:
+ void *rxq =3D dev->data->rx_queues[queue_id];
+ rte_prefetch0(rxq);

WARNING: please, no spaces at the start of a line
#92: FILE: lib/librte_ether/rte_ethdev.h:2465:
+ rte_prefetch0(rxq);$

ERROR: code indent should use tabs where possible
#93: FILE: lib/librte_ether/rte_ethdev.h:2466:
+ nb_rx =3D (*dev->rx_pkt_burst)(rxq, rx_pkts, nb_pkts);$

WARNING: please, no spaces at the start of a line
#93: FILE: lib/librte_ether/rte_ethdev.h:2466:
+ nb_rx =3D (*dev->rx_pkt_burst)(rxq, rx_pkts, nb_pkts);$

WARNING: space prohibited between function name and open parenthesis '('
#93: FILE: lib/librte_ether/rte_ethdev.h:2466:
+ nb_rx =3D (*dev->rx_pkt_burst)(rxq, rx_pkts, nb_pkts);

ERROR: spaces required around that '=' (ctx:WxV)
#93: FILE: lib/librte_ether/rte_ethdev.h:2466:
+ nb_rx =3D (*dev->rx_pkt_burst)(rxq, rx_pkts, nb_pkts);
^

WARNING: please, no spaces at the start of a line
#94: FILE: lib/librte_ether/rte_ethdev.h:2467:
+  }$

WARNING: please, no spaces at the start of a line
#102: FILE: lib/librte_ether/rte_ethdev.h:2607:
+  void *txq;$

WARNING: please, no spaces at the start of a line
#110: FILE: lib/librte_ether/rte_ethdev.h:2624:
+  txq =3D dev->data->tx_queues[queue_id];$

ERROR: spaces required around that '=' (ctx:WxV)
#110: FILE: lib/librte_ether/rte_ethdev.h:2624:
+  txq =3D dev->data->tx_queues[queue_id];
   ^

WARNING: please, no spaces at the start of a line
#111: FILE: lib/librte_ether/rte_ethdev.h:2625:
+  rte_prefetch0(txq);$

WARNING: please, no spaces at the start of a line
#113: FILE: lib/librte_ether/rte_ethdev.h:2627:
+  return (*dev->tx_pkt_burst)(txq, tx_pkts, nb_pkts);$

total: 8 errors, 12 warnings, 38 lines checked


[dpdk-dev] [PATCH] vhost: eventfd_link's minor number shall be specified

2015-11-10 Thread Chi, Xiaobo (Nokia - CN/Hangzhou)
Hi, Liu,
thanks for your comments and guide. I will send a v2 soon. 

Brgs,
Xiaobo Chi

-Original Message-
From: EXT Yuanhan Liu [mailto:yuanhan@linux.intel.com] 
Sent: Monday, November 09, 2015 8:58 PM
To: Chi, Xiaobo (Nokia - CN/Hangzhou)
Cc: dev at dpdk.org
Subject: Re: [dpdk-dev] [PATCH] vhost: eventfd_link's minor number shall be 
specified

On Mon, Nov 09, 2015 at 10:19:54AM +, Chi, Xiaobo (Nokia - CN/Hangzhou) 
wrote:
> Hi,
> 
> And following is a test by me, we can see that if I firstly insert my 
> kmod_test.ko, then insert eventfd_link.ko, error will happen with hint " 
> Device or resource busy". This is because the default minor device number, 0, 
> has been occupied by my kmod_test.ko .

Good to know and thanks for the explanation. It's well explained, and
you should put them (including below example) to commit log. With the
detailed issue explanation, and steps to reproduce, it just gives
your patch more chance to get reviewed (and merged).

And, don't forget to title your patch with "vhost: fix ..." preifx.

FYI, there is another custom for a fix patch in DPDK community: adding
an extra line like following to indicate the latest commit introduces
such bug:

Fixes: 62dbd2ffea9a ("ethdev: add more flow director modes")


Which is generated with following git alias (check http://dpdk.org/dev
for more information):

[alias]
 fixline = log -1 --abbrev=12 --format='Fixes: %h (\"%s\")'


So, would you please send v2?

--yliu

> 
> root at distro:~/test$ lsmod
> Module  Size  Used by
> kmod_test927  0 
> vboxsf 35930  4 
> vboxguest 222130  1 vboxsf
> microcode  10315  0 
> autofs425051  0 
> root at distro:~/test$ modinfo kmod_test
> modinfo: ERROR: Module kmod_test not found.
> root at distro:~/test$ modinfo kmod_test.ko
> filename:   /root/test/kmod_test.ko
> alias:  devname:test
> description:my test
> author: Xiaobo Chi
> license:GPL v2
> version:0.0.1
> srcversion: C2BDEBC81A17F8197C7C44A
> depends:
> vermagic:   3.18.9-pc64-distro.git-v1.7 SMP mod_unload 
> root at distro:~/test$ dmesg -c
> root at distro:~/test$ ls
> eventfd_link.ko  kmod_test.ko kmod_test.mod.o  mainMakefile   
> Module.symvers
> kmod_test.c  kmod_test.mod.c  kmod_test.o  main.c  modules.order
> root at distro:~/test$ insmod ./eventfd_link.ko 
> insmod: ERROR: could not insert module ./eventfd_link.ko: Device or resource 
> busy
> root at distro:~/test$ dmesg -c
> 
> brgs,
> Xiaobo Chi
> 
> 
> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of EXT Chi, Xiaobo 
> (Nokia - CN/Hangzhou)
> Sent: Monday, November 09, 2015 6:03 PM
> To: EXT Yuanhan Liu
> Cc: dev at dpdk.org; changchun.ouyang at intel.com
> Subject: Re: [dpdk-dev] [PATCH] vhost: eventfd_link's minor number shall be 
> specified
> 
> Hi,
> For miscdevices, the major device_no is same, so the minor device_no should 
> be set to ditinguish different misc devices;  if not set the minor, it may 
> fail while insmod due to the default minor value, 0, has been used by other 
> miscdevice. MISC_DYNAMIC_MINOR means to let Linux kernel dynamically assign 
> one minor devide number while loading.
> You can refer to the kni_misc.c
> 
> Brgs,
> Chi Xiaobo
> 
> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of EXT Yuanhan Liu
> Sent: Monday, November 09, 2015 12:23 PM
> To: Chi, Xiaobo (Nokia - CN/Hangzhou)
> Cc: dev at dpdk.org; changchun.ouyang at intel.com
> Subject: Re: [dpdk-dev] [PATCH] vhost: eventfd_link's minor number shall be 
> specified
> 
> On Fri, Nov 06, 2015 at 02:04:37PM +0800, Xiaobo Chi wrote:
> >  eventfd_link_misc's minor number shall be MISC_DYNAMIC_MINOR to let Linux 
> > kernel dynamically assign one while loading.
> 
> For such (fix) patch, I'd like to see what exact issue your patch fixes.
> 
> And if it fixes an issue, you'd better title your patch with something
> like "vhost: fix ...", so that it's likely Thomas will put it into
> high priority.
> 
>   --yliu
> 
> > 
> > Signed-off-by: Xiaobo Chi 
> > ---
> >  lib/librte_vhost/eventfd_link/eventfd_link.c | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/lib/librte_vhost/eventfd_link/eventfd_link.c 
> > b/lib/librte_vhost/eventfd_link/eventfd_link.c
> > index c54a938..4b05b5a 100644
> > --- a/lib/librte_vhost/eventfd_link/eventfd_link.c
> > +++ b/lib/librte_vhost/eventfd_link/eventfd_link.c
> > @@ -249,6 +249,7 @@ static const struct file_operations eventfd_link_fops = 
> > {
> >  
> >  
> >  static struct miscdevice eventfd_link_misc = {
> > +   .minor = MISC_DYNAMIC_MINOR,
> > .name = "eventfd-link",
> > .fops = _link_fops,
> >  };
> > -- 
> > 1.9.4.msysgit.2


[dpdk-dev] URGENT please help. Issue on ixgbe_tx_free_bufs version 2.0.0

2015-11-10 Thread Ariel Rodriguez
Dear dpdk experts.

Im having a recurrent segmentation fault under the
function ixgbe_tx_free_bufs (ixgbe_rxtx.c:150) (i enable -g3 -O0).

Surfing the core dump i find out this:

txep = &(txq->sw_ring[txq->tx_next_dd - (txq->tx_rs_thresh - 1)]);

txq->tx_next_dd = 31
txq->txq->tx_rs_thresh=32

Obviosly txep points out to the first element but

*(txep).mbuf == INVALID MBUF ADDRESS

The same applies to

*(txep+1).mbuf ; *(txep +2).mbuf;*(txep+3).mbuf

from *(txep+4) .mbuf to *(txep+31).mbuf seems to be valid because im able
to derefence the mbuf's


Note:

I disable CONFIG_RTE_IXGBE_INC_VECTOR because i gets similiar behavior , I
thought the problem would disappear disabling that feature.


the program always  runs well up to 4 or 5 hours and then crash ... always
in the same line.

this is the backtrace of the program:

#0  0x00677a64 in rte_atomic16_read (v=0x47dc14c18b14) at
/opt/dpdk-2.0.0/x86_64-native-linuxapp-gcc/include/generic/rte_atomic.h:151
#1  0x00677c1d in rte_mbuf_refcnt_read (m=0x47dc14c18b00) at
/opt/dpdk-2.0.0/x86_64-native-linuxapp-gcc/include/rte_mbuf.h:411
#2  0x0067a13c in __rte_pktmbuf_prefree_seg (m=0x47dc14c18b00) at
/opt/dpdk-2.0.0/x86_64-native-linuxapp-gcc/include/rte_mbuf.h:778
#3  rte_pktmbuf_free_seg (m=0x47dc14c18b00) at
/opt/dpdk-2.0.0/x86_64-native-linuxapp-gcc/include/rte_mbuf.h:810
#4  ixgbe_tx_free_bufs (txq=0x7ffb40ae52c0) at
/opt/dpdk-2.0.0/lib/librte_pmd_ixgbe/ixgbe_rxtx.c:150
#5  tx_xmit_pkts (tx_queue=0x7ffb40ae52c0, tx_pkts=0x64534770 ,
nb_pkts=32) at /opt/dpdk-2.0.0/lib/librte_pmd_ixgbe/ixgbe_rxtx.c:256
#6  0x0067c6f3 in ixgbe_xmit_pkts_simple (tx_queue=0x7ffb40ae52c0,
tx_pkts=0x64534570 , nb_pkts=80) at
/opt/dpdk-2.0.0/lib/librte_pmd_ixgbe/ixgbe_rxtx.c:343
#7  0x004ec93d in rte_eth_tx_burst (port_id=1 '\001', queue_id=0,
tx_pkts=0x64534570 , nb_pkts=144) at
/opt/dpdk-2.0.0/x86_64-native-linuxapp-gcc/include/rte_ethdev.h:2572


frame 5 tx queue:

print *txq

{tx_ring = 0x7ffd9d3f1880, tx_ring_phys_addr = 79947569280, sw_ring =
0x7ffb40ae1280, tdt_reg_addr = 0x7fff0002a018, nb_tx_desc = 1024, tx_tail =
1008, tx_free_thresh = 32, tx_rs_thresh = 32, nb_tx_used = 0,
  last_desc_cleaned = 1023, nb_tx_free = 15, tx_next_dd = 31, tx_next_rs =
1023, queue_id = 0, reg_idx = 0, port_id = 1 '\001', pthresh = 32 ' ',
hthresh = 0 '\000', wthresh = 0 '\000', txq_flags = 3841, ctx_curr = 0,
ctx_cache = {{
  flags = 0, tx_offload = {data = 0, {l2_len = 0, l3_len = 0, l4_len =
0, tso_segsz = 0, vlan_tci = 0}}, tx_offload_mask = {data = 0, {l2_len = 0,
l3_len = 0, l4_len = 0, tso_segsz = 0, vlan_tci = 0}}}, {flags = 0,
tx_offload = {
data = 0, {l2_len = 0, l3_len = 0, l4_len = 0, tso_segsz = 0,
vlan_tci = 0}}, tx_offload_mask = {data = 0, {l2_len = 0, l3_len = 0,
l4_len = 0, tso_segsz = 0, vlan_tci = 0, ops = 0x7616d0 ,
  tx_deferred_start = 0 '\000'}



Please help me !!!

Regards.

Ariel Rodriguez.