[dpdk-dev] Klientskie bazi Tel/Viber/WhatsApp +79133913837 Email: gdrozdov...@gmail.com Skype: prodawez389 ICQ: 6288862 FOTO ONLINE: http://media.xtwind.com/images/2015/10/19/2ba70554b12778c54b6a8ac82

2015-11-05 Thread dev@dpdk.org
Klientskie bazi Tel/Viber/WhatsApp +79133913837 Email: mamontova260 at 
gmail.com Skype: prodawez389 ICQ: 6288862 FOTO ONLINE: 
http://media.xtwind.com/images/2015/10/19/2ba70554b12778c54b6a8ac82a7cc178.png


[dpdk-dev] [PATCH 15/15] armv8: config file update

2015-11-05 Thread Jerin Jacob
disabled CONFIG_RTE_LIBRTE_FM10K_PMD and CONFIG_RTE_LIBRTE_I40E_PMD to fix
the compilation issues due to tmmintrin.h

removed stale CONFIG_RTE_LIBRTE_EAL_HOTPLUG

Signed-off-by: Jerin Jacob 
---
 config/defconfig_arm64-armv8a-linuxapp-gcc   | 3 ++-
 config/defconfig_arm64-thunderx-linuxapp-gcc | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/config/defconfig_arm64-armv8a-linuxapp-gcc 
b/config/defconfig_arm64-armv8a-linuxapp-gcc
index 0314761..49e7056 100644
--- a/config/defconfig_arm64-armv8a-linuxapp-gcc
+++ b/config/defconfig_arm64-armv8a-linuxapp-gcc
@@ -48,7 +48,8 @@ CONFIG_RTE_CACHE_LINE_SIZE=64
 CONFIG_RTE_IXGBE_INC_VECTOR=n
 CONFIG_RTE_LIBRTE_VIRTIO_PMD=n
 CONFIG_RTE_LIBRTE_IVSHMEM=n
-CONFIG_RTE_LIBRTE_EAL_HOTPLUG=n
+CONFIG_RTE_LIBRTE_FM10K_PMD=n
+CONFIG_RTE_LIBRTE_I40E_PMD=n

 CONFIG_RTE_LIBRTE_LPM=n
 CONFIG_RTE_LIBRTE_TABLE=n
diff --git a/config/defconfig_arm64-thunderx-linuxapp-gcc 
b/config/defconfig_arm64-thunderx-linuxapp-gcc
index 10d19ce..6b2048b 100644
--- a/config/defconfig_arm64-thunderx-linuxapp-gcc
+++ b/config/defconfig_arm64-thunderx-linuxapp-gcc
@@ -48,7 +48,8 @@ CONFIG_RTE_CACHE_LINE_SIZE=128
 CONFIG_RTE_IXGBE_INC_VECTOR=n
 CONFIG_RTE_LIBRTE_VIRTIO_PMD=n
 CONFIG_RTE_LIBRTE_IVSHMEM=n
-CONFIG_RTE_LIBRTE_EAL_HOTPLUG=n
+CONFIG_RTE_LIBRTE_FM10K_PMD=n
+CONFIG_RTE_LIBRTE_I40E_PMD=n

 CONFIG_RTE_LIBRTE_LPM=n
 CONFIG_RTE_LIBRTE_TABLE=n
-- 
1.9.3



[dpdk-dev] [PATCH 14/15] eal: arm: define rte_smp_mb(), rte_smp_wmb(), rte_smp_rmb() for arm

2015-11-05 Thread Jerin Jacob
Signed-off-by: Jerin Jacob 
---
 lib/librte_eal/common/include/arch/arm/rte_atomic.h | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/lib/librte_eal/common/include/arch/arm/rte_atomic.h 
b/lib/librte_eal/common/include/arch/arm/rte_atomic.h
index f3f3b6e..454a12b 100644
--- a/lib/librte_eal/common/include/arch/arm/rte_atomic.h
+++ b/lib/librte_eal/common/include/arch/arm/rte_atomic.h
@@ -39,4 +39,10 @@
 #include 
 #endif

+#define rte_smp_mb() rte_mb()
+
+#define rte_smp_wmb() rte_wmb()
+
+#define rte_smp_rmb() rte_rmb()
+
 #endif /* _RTE_ATOMIC_ARM_H_ */
-- 
1.9.3



[dpdk-dev] [PATCH 13/15] eal: introduce rte_smp_*mb() for memory barriers to use between lcores

2015-11-05 Thread Jerin Jacob
This commit introduce rte_smp_mb(), rte_smp_wmb() and rte_smp_rmb(), in
order to enable memory barriers between lcores.
The patch does not provide any functional change for IA, the goal is to
have infrastructure for weakly ordered machines like ARM to work on DPDK.

Signed-off-by: Jerin Jacob 
Acked-by: Konstantin Ananyev 
---
 drivers/net/virtio/virtqueue.h |  8 +++
 drivers/net/xenvirt/rte_eth_xenvirt.c  |  4 ++--
 drivers/net/xenvirt/virtqueue.h|  2 +-
 .../common/include/arch/ppc_64/rte_atomic.h|  6 +
 .../common/include/arch/tile/rte_atomic.h  |  6 +
 .../common/include/arch/x86/rte_atomic.h   |  6 +
 lib/librte_eal/common/include/generic/rte_atomic.h | 27 ++
 lib/librte_ring/rte_ring.h |  8 +++
 8 files changed, 55 insertions(+), 12 deletions(-)

diff --git a/drivers/net/virtio/virtqueue.h b/drivers/net/virtio/virtqueue.h
index 7789411..d233be6 100644
--- a/drivers/net/virtio/virtqueue.h
+++ b/drivers/net/virtio/virtqueue.h
@@ -53,12 +53,10 @@ struct rte_mbuf;
  * accesses through relaxed memory I/O windows, so smp_mb() et al are
  * sufficient.
  *
- * This driver is for virtio_pci on SMP and therefore can assume
- * weaker (compiler barriers)
  */
-#define virtio_mb()rte_mb()
-#define virtio_rmb()   rte_compiler_barrier()
-#define virtio_wmb()   rte_compiler_barrier()
+#define virtio_mb()rte_smp_mb()
+#define virtio_rmb()   rte_smp_rmb()
+#define virtio_wmb()   rte_smp_wmb()

 #ifdef RTE_PMD_PACKET_PREFETCH
 #define rte_packet_prefetch(p)  rte_prefetch1(p)
diff --git a/drivers/net/xenvirt/rte_eth_xenvirt.c 
b/drivers/net/xenvirt/rte_eth_xenvirt.c
index 73e8bce..8c33a02 100644
--- a/drivers/net/xenvirt/rte_eth_xenvirt.c
+++ b/drivers/net/xenvirt/rte_eth_xenvirt.c
@@ -99,7 +99,7 @@ eth_xenvirt_rx(void *q, struct rte_mbuf **rx_pkts, uint16_t 
nb_pkts)

nb_used = VIRTQUEUE_NUSED(rxvq);

-   rte_compiler_barrier(); /* rmb */
+   rte_smp_rmb();
num = (uint16_t)(likely(nb_used <= nb_pkts) ? nb_used : nb_pkts);
num = (uint16_t)(likely(num <= VIRTIO_MBUF_BURST_SZ) ? num : 
VIRTIO_MBUF_BURST_SZ);
if (unlikely(num == 0)) return 0;
@@ -150,7 +150,7 @@ eth_xenvirt_tx(void *tx_queue, struct rte_mbuf **tx_pkts, 
uint16_t nb_pkts)
PMD_TX_LOG(DEBUG, "%d packets to xmit", nb_pkts);
nb_used = VIRTQUEUE_NUSED(txvq);

-   rte_compiler_barrier();   /* rmb */
+   rte_smp_rmb();

num = (uint16_t)(likely(nb_used <= VIRTIO_MBUF_BURST_SZ) ? nb_used : 
VIRTIO_MBUF_BURST_SZ);
num = virtqueue_dequeue_burst(txvq, snd_pkts, len, num);
diff --git a/drivers/net/xenvirt/virtqueue.h b/drivers/net/xenvirt/virtqueue.h
index eff6208..6dcb0ef 100644
--- a/drivers/net/xenvirt/virtqueue.h
+++ b/drivers/net/xenvirt/virtqueue.h
@@ -151,7 +151,7 @@ vq_ring_update_avail(struct virtqueue *vq, uint16_t 
desc_idx)
 */
avail_idx = (uint16_t)(vq->vq_ring.avail->idx & (vq->vq_nentries - 1));
vq->vq_ring.avail->ring[avail_idx] = desc_idx;
-   rte_compiler_barrier();  /* wmb , for IA memory model barrier is 
enough*/
+   rte_smp_wmb();
vq->vq_ring.avail->idx++;
 }

diff --git a/lib/librte_eal/common/include/arch/ppc_64/rte_atomic.h 
b/lib/librte_eal/common/include/arch/ppc_64/rte_atomic.h
index fb7af2b..b8bc2c0 100644
--- a/lib/librte_eal/common/include/arch/ppc_64/rte_atomic.h
+++ b/lib/librte_eal/common/include/arch/ppc_64/rte_atomic.h
@@ -72,6 +72,12 @@ extern "C" {
  */
 #definerte_rmb() {asm volatile("sync" : : : "memory"); }

+#define rte_smp_mb() rte_mb()
+
+#define rte_smp_wmb() rte_compiler_barrier()
+
+#define rte_smp_rmb() rte_compiler_barrier()
+
 /*- 16 bit atomic operations 
-*/
 /* To be compatible with Power7, use GCC built-in functions for 16 bit
  * operations */
diff --git a/lib/librte_eal/common/include/arch/tile/rte_atomic.h 
b/lib/librte_eal/common/include/arch/tile/rte_atomic.h
index 3dc8eb8..28825ff 100644
--- a/lib/librte_eal/common/include/arch/tile/rte_atomic.h
+++ b/lib/librte_eal/common/include/arch/tile/rte_atomic.h
@@ -79,6 +79,12 @@ static inline void rte_rmb(void)
__sync_synchronize();
 }

+#define rte_smp_mb() rte_mb()
+
+#define rte_smp_wmb() rte_compiler_barrier()
+
+#define rte_smp_rmb() rte_compiler_barrier()
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/lib/librte_eal/common/include/arch/x86/rte_atomic.h 
b/lib/librte_eal/common/include/arch/x86/rte_atomic.h
index e93e8ee..41178c7 100644
--- a/lib/librte_eal/common/include/arch/x86/rte_atomic.h
+++ b/lib/librte_eal/common/include/arch/x86/rte_atomic.h
@@ -53,6 +53,12 @@ extern "C" {

 #definerte_rmb() _mm_lfence()

+#define rte_smp_mb() rte_mb()
+
+#define rte_smp_wmb() rte_compiler_barrier()
+
+#define rte_smp_rmb() rte_compiler_barrier()
+
 /*- 16 bit atomic operations 

[dpdk-dev] [PATCH 12/15] maintainers: claim responsibility for ARMv8

2015-11-05 Thread Jerin Jacob
Signed-off-by: Jerin Jacob 
---
 MAINTAINERS | 5 +
 1 file changed, 5 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index a8933eb..c44b328 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -128,6 +128,11 @@ ARM v7
 M: Jan Viktorin 
 F: lib/librte_eal/common/include/arch/arm/

+ARM v8
+M: Jerin Jacob 
+F: lib/librte_eal/common/include/arch/arm/*_64.h
+F: lib/librte_acl/acl_run_neon.*
+
 Intel x86
 M: Bruce Richardson 
 M: Konstantin Ananyev 
-- 
1.9.3



[dpdk-dev] [PATCH 11/15] updated release note for armv8 support for DPDK 2.2

2015-11-05 Thread Jerin Jacob
Signed-off-by: Jerin Jacob 
---
 doc/guides/rel_notes/release_2_2.rst | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/doc/guides/rel_notes/release_2_2.rst 
b/doc/guides/rel_notes/release_2_2.rst
index 43a3a3c..a3587a2 100644
--- a/doc/guides/rel_notes/release_2_2.rst
+++ b/doc/guides/rel_notes/release_2_2.rst
@@ -23,10 +23,11 @@ New Features

 * **Added vhost-user multiple queue support.**

-* **Introduce ARMv7 architecture**
+* **Introduce ARMv7 and ARMv8 architectures**

-  It is now possible to build DPDK for the ARMv7 platform and test with
-  virtual PMD drivers.
+  * It is now possible to build DPDK for the ARMv7 and ARMv8 platforms.
+  * ARMv7 can be tested with virtual PMD drivers.
+  * ARMv8 can be tested with virtual and physical PMD drivers.


 Resolved Issues
-- 
1.9.3



[dpdk-dev] [PATCH 10/15] mk: add support for thunderx machine target based on armv8-a

2015-11-05 Thread Jerin Jacob
Created the new thunderx machine target to address difference
in "cache line size" and "-mcpu=thunderx" vs default armv8-a machine target

Signed-off-by: Jerin Jacob 
---
 config/defconfig_arm64-thunderx-linuxapp-gcc | 55 ++
 mk/machine/thunderx/rte.vars.mk  | 58 
 2 files changed, 113 insertions(+)
 create mode 100644 config/defconfig_arm64-thunderx-linuxapp-gcc
 create mode 100644 mk/machine/thunderx/rte.vars.mk

diff --git a/config/defconfig_arm64-thunderx-linuxapp-gcc 
b/config/defconfig_arm64-thunderx-linuxapp-gcc
new file mode 100644
index 000..10d19ce
--- /dev/null
+++ b/config/defconfig_arm64-thunderx-linuxapp-gcc
@@ -0,0 +1,55 @@
+#   BSD LICENSE
+#
+#   Copyright (C) Cavium networks 2015. 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 Cavium networks 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 "common_linuxapp"
+
+CONFIG_RTE_MACHINE="thunderx"
+
+CONFIG_RTE_ARCH="arm64"
+CONFIG_RTE_ARCH_ARM64=y
+CONFIG_RTE_ARCH_64=y
+CONFIG_RTE_ARCH_ARM_NEON=y
+
+CONFIG_RTE_FORCE_INTRINSICS=y
+
+CONFIG_RTE_TOOLCHAIN="gcc"
+CONFIG_RTE_TOOLCHAIN_GCC=y
+
+CONFIG_RTE_CACHE_LINE_SIZE=128
+
+CONFIG_RTE_IXGBE_INC_VECTOR=n
+CONFIG_RTE_LIBRTE_VIRTIO_PMD=n
+CONFIG_RTE_LIBRTE_IVSHMEM=n
+CONFIG_RTE_LIBRTE_EAL_HOTPLUG=n
+
+CONFIG_RTE_LIBRTE_LPM=n
+CONFIG_RTE_LIBRTE_TABLE=n
+CONFIG_RTE_LIBRTE_PIPELINE=n
diff --git a/mk/machine/thunderx/rte.vars.mk b/mk/machine/thunderx/rte.vars.mk
new file mode 100644
index 000..e49f9e1
--- /dev/null
+++ b/mk/machine/thunderx/rte.vars.mk
@@ -0,0 +1,58 @@
+#   BSD LICENSE
+#
+#   Copyright (C) Cavium networks 2015. 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 Cavium networks 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.
+#
+
+#
+# machine:
+#
+#   - can define ARCH variable (overridden by cmdline value)
+#   - can define CROSS variable (overridden by cmdline value)
+#   - define MACHINE_CFLAGS variable (overridden by cmdline value)
+#   - define MACHINE_LDFLAGS variable (overridden by cmdline value)

[dpdk-dev] [PATCH 09/15] mk: add support for armv8 on top of armv7

2015-11-05 Thread Jerin Jacob
Signed-off-by: Jerin Jacob 
---
 config/defconfig_arm64-armv8a-linuxapp-gcc | 55 
 mk/arch/arm64/rte.vars.mk  | 58 ++
 mk/machine/armv8a/rte.vars.mk  | 58 ++
 3 files changed, 171 insertions(+)
 create mode 100644 config/defconfig_arm64-armv8a-linuxapp-gcc
 create mode 100644 mk/arch/arm64/rte.vars.mk
 create mode 100644 mk/machine/armv8a/rte.vars.mk

diff --git a/config/defconfig_arm64-armv8a-linuxapp-gcc 
b/config/defconfig_arm64-armv8a-linuxapp-gcc
new file mode 100644
index 000..0314761
--- /dev/null
+++ b/config/defconfig_arm64-armv8a-linuxapp-gcc
@@ -0,0 +1,55 @@
+#   BSD LICENSE
+#
+#   Copyright (C) Cavium networks 2015. 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 Cavium networks 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 "common_linuxapp"
+
+CONFIG_RTE_MACHINE="armv8a"
+
+CONFIG_RTE_ARCH="arm64"
+CONFIG_RTE_ARCH_ARM64=y
+CONFIG_RTE_ARCH_64=y
+CONFIG_RTE_ARCH_ARM_NEON=y
+
+CONFIG_RTE_FORCE_INTRINSICS=y
+
+CONFIG_RTE_TOOLCHAIN="gcc"
+CONFIG_RTE_TOOLCHAIN_GCC=y
+
+CONFIG_RTE_CACHE_LINE_SIZE=64
+
+CONFIG_RTE_IXGBE_INC_VECTOR=n
+CONFIG_RTE_LIBRTE_VIRTIO_PMD=n
+CONFIG_RTE_LIBRTE_IVSHMEM=n
+CONFIG_RTE_LIBRTE_EAL_HOTPLUG=n
+
+CONFIG_RTE_LIBRTE_LPM=n
+CONFIG_RTE_LIBRTE_TABLE=n
+CONFIG_RTE_LIBRTE_PIPELINE=n
diff --git a/mk/arch/arm64/rte.vars.mk b/mk/arch/arm64/rte.vars.mk
new file mode 100644
index 000..32e3a5f
--- /dev/null
+++ b/mk/arch/arm64/rte.vars.mk
@@ -0,0 +1,58 @@
+#   BSD LICENSE
+#
+#   Copyright (C) Cavium networks 2015. 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 Cavium networks 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.
+
+#
+# arch:
+#
+#   - define ARCH variable (overridden by cmdline or by previous
+# optional define in machine .mk)
+#   - define CROSS variable (overridden by cmdline or previous define
+# in machine .mk)
+#   - define CPU_CFLAGS variable (overridden by cmdline or previous
+# define in machine .mk)
+#   - define 

[dpdk-dev] [PATCH 08/15] acl: arm64: acl implementation using NEON gcc intrinsic

2015-11-05 Thread Jerin Jacob
verified with testacl and acl_autotest applications on arm64 architecture.

Signed-off-by: Jerin Jacob 
---
 app/test-acl/main.c   |   4 +
 lib/librte_acl/Makefile   |   5 +
 lib/librte_acl/acl.h  |   4 +
 lib/librte_acl/acl_run_neon.c |  46 +++
 lib/librte_acl/acl_run_neon.h | 289 ++
 lib/librte_acl/rte_acl.c  |  25 
 lib/librte_acl/rte_acl.h  |   1 +
 7 files changed, 374 insertions(+)
 create mode 100644 lib/librte_acl/acl_run_neon.c
 create mode 100644 lib/librte_acl/acl_run_neon.h

diff --git a/app/test-acl/main.c b/app/test-acl/main.c
index 72ce83c..0b0c093 100644
--- a/app/test-acl/main.c
+++ b/app/test-acl/main.c
@@ -101,6 +101,10 @@ static const struct acl_alg acl_alg[] = {
.name = "avx2",
.alg = RTE_ACL_CLASSIFY_AVX2,
},
+   {
+   .name = "neon",
+   .alg = RTE_ACL_CLASSIFY_NEON,
+   },
 };

 static struct {
diff --git a/lib/librte_acl/Makefile b/lib/librte_acl/Makefile
index 7a1cf8a..27f91d5 100644
--- a/lib/librte_acl/Makefile
+++ b/lib/librte_acl/Makefile
@@ -48,9 +48,14 @@ SRCS-$(CONFIG_RTE_LIBRTE_ACL) += rte_acl.c
 SRCS-$(CONFIG_RTE_LIBRTE_ACL) += acl_bld.c
 SRCS-$(CONFIG_RTE_LIBRTE_ACL) += acl_gen.c
 SRCS-$(CONFIG_RTE_LIBRTE_ACL) += acl_run_scalar.c
+ifeq ($(CONFIG_RTE_ARCH_ARM64),y)
+SRCS-$(CONFIG_RTE_LIBRTE_ACL) += acl_run_neon.c
+else
 SRCS-$(CONFIG_RTE_LIBRTE_ACL) += acl_run_sse.c
+endif

 CFLAGS_acl_run_sse.o += -msse4.1
+CFLAGS_acl_run_neon.o += -flax-vector-conversions -Wno-maybe-uninitialized

 #
 # If the compiler supports AVX2 instructions,
diff --git a/lib/librte_acl/acl.h b/lib/librte_acl/acl.h
index eb4930c..09d6784 100644
--- a/lib/librte_acl/acl.h
+++ b/lib/librte_acl/acl.h
@@ -230,6 +230,10 @@ int
 rte_acl_classify_avx2(const struct rte_acl_ctx *ctx, const uint8_t **data,
uint32_t *results, uint32_t num, uint32_t categories);

+int
+rte_acl_classify_neon(const struct rte_acl_ctx *ctx, const uint8_t **data,
+   uint32_t *results, uint32_t num, uint32_t categories);
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
diff --git a/lib/librte_acl/acl_run_neon.c b/lib/librte_acl/acl_run_neon.c
new file mode 100644
index 000..b014451
--- /dev/null
+++ b/lib/librte_acl/acl_run_neon.c
@@ -0,0 +1,46 @@
+/*
+ *   BSD LICENSE
+ *
+ *   Copyright (C) Cavium networks Ltd. 2015.
+ *
+ *   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 Cavium networks 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 "acl_run_neon.h"
+
+int
+rte_acl_classify_neon(const struct rte_acl_ctx *ctx, const uint8_t **data,
+ uint32_t *results, uint32_t num, uint32_t categories)
+{
+   if (likely(num >= 8))
+   return search_neon_8(ctx, data, results, num, categories);
+   else if (num >= 4)
+   return search_neon_4(ctx, data, results, num, categories);
+   else
+   return rte_acl_classify_scalar(ctx, data, results, num,
+   categories);
+}
diff --git a/lib/librte_acl/acl_run_neon.h b/lib/librte_acl/acl_run_neon.h
new file mode 100644
index 000..cf7c57f
--- /dev/null
+++ b/lib/librte_acl/acl_run_neon.h
@@ -0,0 +1,289 @@
+/*
+ *   BSD LICENSE
+ *
+ *   Copyright (C) Cavium networks Ltd. 2015.
+ *
+ *   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 

[dpdk-dev] [PATCH 07/15] app: test_cpuflags: test the new cpu flags added for arm64

2015-11-05 Thread Jerin Jacob
Signed-off-by: Jerin Jacob 
---
 app/test/test_cpuflags.c | 26 ++
 1 file changed, 26 insertions(+)

diff --git a/app/test/test_cpuflags.c b/app/test/test_cpuflags.c
index 557458f..e8d0ce7 100644
--- a/app/test/test_cpuflags.c
+++ b/app/test/test_cpuflags.c
@@ -120,6 +120,32 @@ test_cpuflags(void)
CHECK_FOR_FLAG(RTE_CPUFLAG_NEON);
 #endif

+#if defined(RTE_ARCH_ARM64)
+   printf("Check for FP:\t\t");
+   CHECK_FOR_FLAG(RTE_CPUFLAG_FP);
+
+   printf("Check for ASIMD:\t");
+   CHECK_FOR_FLAG(RTE_CPUFLAG_NEON);
+
+   printf("Check for EVTSTRM:\t");
+   CHECK_FOR_FLAG(RTE_CPUFLAG_EVTSTRM);
+
+   printf("Check for AES:\t\t");
+   CHECK_FOR_FLAG(RTE_CPUFLAG_AES);
+
+   printf("Check for PMULL:\t");
+   CHECK_FOR_FLAG(RTE_CPUFLAG_PMULL);
+
+   printf("Check for SHA1:\t\t");
+   CHECK_FOR_FLAG(RTE_CPUFLAG_SHA1);
+
+   printf("Check for SHA2:\t\t");
+   CHECK_FOR_FLAG(RTE_CPUFLAG_SHA2);
+
+   printf("Check for CRC32:\t");
+   CHECK_FOR_FLAG(RTE_CPUFLAG_CRC32);
+#endif
+
 #if defined(RTE_ARCH_X86_64) || defined(RTE_ARCH_I686)
printf("Check for SSE:\t\t");
CHECK_FOR_FLAG(RTE_CPUFLAG_SSE);
-- 
1.9.3



[dpdk-dev] [PATCH 06/15] eal: arm: ret_vector.h improvements

2015-11-05 Thread Jerin Jacob
added the definition of rte_xmm and xmm_t for acl noen implementation.
removed the emulated _mm_* functions

Signed-off-by: Jerin Jacob 
---
 lib/librte_eal/common/include/arch/arm/rte_vect.h | 54 +++
 1 file changed, 15 insertions(+), 39 deletions(-)

diff --git a/lib/librte_eal/common/include/arch/arm/rte_vect.h 
b/lib/librte_eal/common/include/arch/arm/rte_vect.h
index 7d5de97..21cdb4d 100644
--- a/lib/librte_eal/common/include/arch/arm/rte_vect.h
+++ b/lib/librte_eal/common/include/arch/arm/rte_vect.h
@@ -1,7 +1,7 @@
 /*-
  *   BSD LICENSE
  *
- *   Copyright(c) 2015 RehiveTech. All rights reserved.
+ *   Copyright(c) 2015 Cavium Networks. All rights reserved.
  *
  *   Redistribution and use in source and binary forms, with or without
  *   modification, are permitted provided that the following conditions
@@ -13,7 +13,7 @@
  *   notice, this list of conditions and the following disclaimer in
  *   the documentation and/or other materials provided with the
  *   distribution.
- * * Neither the name of RehiveTech nor the names of its
+ * * Neither the name of Cavium Networks nor the names of its
  *   contributors may be used to endorse or promote products derived
  *   from this software without specific prior written permission.
  *
@@ -33,49 +33,25 @@
 #ifndef _RTE_VECT_ARM_H_
 #define _RTE_VECT_ARM_H_

+#include "arm_neon.h"
+
 #ifdef __cplusplus
 extern "C" {
 #endif

-#define XMM_SIZE 16
-#define XMM_MASK (XMM_MASK - 1)
-
-typedef struct {
-   union uint128 {
-   uint8_t uint8[16];
-   uint32_t uint32[4];
-   } val;
-} __m128i;
-
-static inline __m128i
-_mm_set_epi32(uint32_t v0, uint32_t v1, uint32_t v2, uint32_t v3)
-{
-   __m128i res;
-
-   res.val.uint32[0] = v0;
-   res.val.uint32[1] = v1;
-   res.val.uint32[2] = v2;
-   res.val.uint32[3] = v3;
-   return res;
-}
+typedef int32x4_t xmm_t;

-static inline __m128i
-_mm_loadu_si128(__m128i *v)
-{
-   __m128i res;
+#defineXMM_SIZE(sizeof(xmm_t))
+#defineXMM_MASK(XMM_SIZE - 1)

-   res = *v;
-   return res;
-}
-
-static inline __m128i
-_mm_load_si128(__m128i *v)
-{
-   __m128i res;
-
-   res = *v;
-   return res;
-}
+typedef union rte_xmm {
+   xmm_tx;
+   uint8_t  u8[XMM_SIZE / sizeof(uint8_t)];
+   uint16_t u16[XMM_SIZE / sizeof(uint16_t)];
+   uint32_t u32[XMM_SIZE / sizeof(uint32_t)];
+   uint64_t u64[XMM_SIZE / sizeof(uint64_t)];
+   double   pd[XMM_SIZE / sizeof(double)];
+} __attribute__((aligned(16))) rte_xmm_t;

 #ifdef __cplusplus
 }
-- 
1.9.3



[dpdk-dev] [PATCH 05/15] eal: arm64: rte_memcpy_64.h version based on libc memcpy

2015-11-05 Thread Jerin Jacob
Signed-off-by: Jerin Jacob 
---
 .../common/include/arch/arm/rte_memcpy.h   |  4 +
 .../common/include/arch/arm/rte_memcpy_64.h| 93 ++
 2 files changed, 97 insertions(+)
 create mode 100644 lib/librte_eal/common/include/arch/arm/rte_memcpy_64.h

diff --git a/lib/librte_eal/common/include/arch/arm/rte_memcpy.h 
b/lib/librte_eal/common/include/arch/arm/rte_memcpy.h
index d9f5bf1..1d562c3 100644
--- a/lib/librte_eal/common/include/arch/arm/rte_memcpy.h
+++ b/lib/librte_eal/common/include/arch/arm/rte_memcpy.h
@@ -33,6 +33,10 @@
 #ifndef _RTE_MEMCPY_ARM_H_
 #define _RTE_MEMCPY_ARM_H_

+#ifdef RTE_ARCH_64
+#include 
+#else
 #include 
+#endif

 #endif /* _RTE_MEMCPY_ARM_H_ */
diff --git a/lib/librte_eal/common/include/arch/arm/rte_memcpy_64.h 
b/lib/librte_eal/common/include/arch/arm/rte_memcpy_64.h
new file mode 100644
index 000..917cdc1
--- /dev/null
+++ b/lib/librte_eal/common/include/arch/arm/rte_memcpy_64.h
@@ -0,0 +1,93 @@
+/*
+ *   BSD LICENSE
+ *
+ *   Copyright (C) Cavium networks Ltd. 2015.
+ *
+ *   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 Cavium networks 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.
+*/
+
+#ifndef _RTE_MEMCPY_ARM64_H_
+#define _RTE_MEMCPY_ARM64_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include 
+#include 
+
+#include "generic/rte_memcpy.h"
+
+static inline void
+rte_mov16(uint8_t *dst, const uint8_t *src)
+{
+   memcpy(dst, src, 16);
+}
+
+static inline void
+rte_mov32(uint8_t *dst, const uint8_t *src)
+{
+   memcpy(dst, src, 32);
+}
+
+static inline void
+rte_mov48(uint8_t *dst, const uint8_t *src)
+{
+   memcpy(dst, src, 48);
+}
+
+static inline void
+rte_mov64(uint8_t *dst, const uint8_t *src)
+{
+   memcpy(dst, src, 64);
+}
+
+static inline void
+rte_mov128(uint8_t *dst, const uint8_t *src)
+{
+   memcpy(dst, src, 128);
+}
+
+static inline void
+rte_mov256(uint8_t *dst, const uint8_t *src)
+{
+   memcpy(dst, src, 256);
+}
+
+#define rte_memcpy(d, s, n)memcpy((d), (s), (n))
+
+static inline void *
+rte_memcpy_func(void *dst, const void *src, size_t n)
+{
+   return memcpy(dst, src, n);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTE_MEMCPY_ARM_64_H_ */
-- 
1.9.3



[dpdk-dev] [PATCH 04/15] eal: arm64: add armv8-a version of rte_cycles_64.h

2015-11-05 Thread Jerin Jacob
cntcvt_el0 ticks are not based on cpu clk unlike rdtsc in x86.
Its a fixed clock running based at constant speed.
Though its a armv8-a implementer choice, typically it runs at 50 or 100 MHz

Signed-off-by: Jerin Jacob 
---
 .../common/include/arch/arm/rte_cycles.h   |  4 ++
 .../common/include/arch/arm/rte_cycles_64.h| 71 ++
 2 files changed, 75 insertions(+)
 create mode 100644 lib/librte_eal/common/include/arch/arm/rte_cycles_64.h

diff --git a/lib/librte_eal/common/include/arch/arm/rte_cycles.h 
b/lib/librte_eal/common/include/arch/arm/rte_cycles.h
index b2372fa..a8009a0 100644
--- a/lib/librte_eal/common/include/arch/arm/rte_cycles.h
+++ b/lib/librte_eal/common/include/arch/arm/rte_cycles.h
@@ -33,6 +33,10 @@
 #ifndef _RTE_CYCLES_ARM_H_
 #define _RTE_CYCLES_ARM_H_

+#ifdef RTE_ARCH_64
+#include 
+#else
 #include 
+#endif

 #endif /* _RTE_CYCLES_ARM_H_ */
diff --git a/lib/librte_eal/common/include/arch/arm/rte_cycles_64.h 
b/lib/librte_eal/common/include/arch/arm/rte_cycles_64.h
new file mode 100644
index 000..14f2612
--- /dev/null
+++ b/lib/librte_eal/common/include/arch/arm/rte_cycles_64.h
@@ -0,0 +1,71 @@
+/*
+ *   BSD LICENSE
+ *
+ *   Copyright (C) Cavium networks Ltd. 2015.
+ *
+ *   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 Cavium networks 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.
+*/
+
+#ifndef _RTE_CYCLES_ARM64_H_
+#define _RTE_CYCLES_ARM64_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "generic/rte_cycles.h"
+
+/**
+ * Read the time base register.
+ *
+ * @return
+ *   The time base for this lcore.
+ */
+static inline uint64_t
+rte_rdtsc(void)
+{
+   uint64_t tsc;
+
+   asm volatile("mrs %0, cntvct_el0" : "=r" (tsc));
+   return tsc;
+}
+
+static inline uint64_t
+rte_rdtsc_precise(void)
+{
+   rte_mb();
+   return rte_rdtsc();
+}
+
+static inline uint64_t
+rte_get_tsc_cycles(void) { return rte_rdtsc(); }
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTE_CYCLES_ARM64_H_ */
-- 
1.9.3



[dpdk-dev] [PATCH 03/15] eal: arm64: add armv8-a version of rte_prefetch_64.h

2015-11-05 Thread Jerin Jacob
Signed-off-by: Jerin Jacob 
---
 .../common/include/arch/arm/rte_prefetch.h |  4 ++
 .../common/include/arch/arm/rte_prefetch_64.h  | 61 ++
 2 files changed, 65 insertions(+)
 create mode 100644 lib/librte_eal/common/include/arch/arm/rte_prefetch_64.h

diff --git a/lib/librte_eal/common/include/arch/arm/rte_prefetch.h 
b/lib/librte_eal/common/include/arch/arm/rte_prefetch.h
index 1f46697..aa37de5 100644
--- a/lib/librte_eal/common/include/arch/arm/rte_prefetch.h
+++ b/lib/librte_eal/common/include/arch/arm/rte_prefetch.h
@@ -33,6 +33,10 @@
 #ifndef _RTE_PREFETCH_ARM_H_
 #define _RTE_PREFETCH_ARM_H_

+#ifdef RTE_ARCH_64
+#include 
+#else
 #include 
+#endif

 #endif /* _RTE_PREFETCH_ARM_H_ */
diff --git a/lib/librte_eal/common/include/arch/arm/rte_prefetch_64.h 
b/lib/librte_eal/common/include/arch/arm/rte_prefetch_64.h
new file mode 100644
index 000..f9cc62e
--- /dev/null
+++ b/lib/librte_eal/common/include/arch/arm/rte_prefetch_64.h
@@ -0,0 +1,61 @@
+/*
+ *   BSD LICENSE
+ *
+ *   Copyright (C) Cavium networks Ltd. 2015.
+ *
+ *   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 Cavium networks 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.
+ */
+
+#ifndef _RTE_PREFETCH_ARM_64_H_
+#define _RTE_PREFETCH_ARM_64_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "generic/rte_prefetch.h"
+
+static inline void rte_prefetch0(const volatile void *p)
+{
+   asm volatile ("PRFM PLDL1KEEP, [%0]" : : "r" (p));
+}
+
+static inline void rte_prefetch1(const volatile void *p)
+{
+   asm volatile ("PRFM PLDL2KEEP, [%0]" : : "r" (p));
+}
+
+static inline void rte_prefetch2(const volatile void *p)
+{
+   asm volatile ("PRFM PLDL3KEEP, [%0]" : : "r" (p));
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTE_PREFETCH_ARM_64_H_ */
-- 
1.9.3



[dpdk-dev] [PATCH 02/15] eal: arm64: add armv8-a version of rte_cpuflags_64.h

2015-11-05 Thread Jerin Jacob
Signed-off-by: Jerin Jacob 
---
 .../common/include/arch/arm/rte_cpuflags.h |   4 +
 .../common/include/arch/arm/rte_cpuflags_64.h  | 152 +
 2 files changed, 156 insertions(+)
 create mode 100644 lib/librte_eal/common/include/arch/arm/rte_cpuflags_64.h

diff --git a/lib/librte_eal/common/include/arch/arm/rte_cpuflags.h 
b/lib/librte_eal/common/include/arch/arm/rte_cpuflags.h
index 8de78d2..b8f6288 100644
--- a/lib/librte_eal/common/include/arch/arm/rte_cpuflags.h
+++ b/lib/librte_eal/common/include/arch/arm/rte_cpuflags.h
@@ -33,6 +33,10 @@
 #ifndef _RTE_CPUFLAGS_ARM_H_
 #define _RTE_CPUFLAGS_ARM_H_

+#ifdef RTE_ARCH_64
+#include 
+#else
 #include 
+#endif

 #endif /* _RTE_CPUFLAGS_ARM_H_ */
diff --git a/lib/librte_eal/common/include/arch/arm/rte_cpuflags_64.h 
b/lib/librte_eal/common/include/arch/arm/rte_cpuflags_64.h
new file mode 100644
index 000..7bcc12f
--- /dev/null
+++ b/lib/librte_eal/common/include/arch/arm/rte_cpuflags_64.h
@@ -0,0 +1,152 @@
+/*
+ *   BSD LICENSE
+ *
+ *   Copyright (C) Cavium networks Ltd. 2015.
+ *
+ *   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 Cavium networks 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.
+ */
+
+#ifndef _RTE_CPUFLAGS_ARM64_H_
+#define _RTE_CPUFLAGS_ARM64_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "generic/rte_cpuflags.h"
+
+#ifndef AT_HWCAP
+#define AT_HWCAP 16
+#endif
+
+#ifndef AT_HWCAP2
+#define AT_HWCAP2 26
+#endif
+
+#ifndef AT_PLATFORM
+#define AT_PLATFORM 15
+#endif
+
+/* software based registers */
+enum cpu_register_t {
+   REG_HWCAP = 0,
+   REG_HWCAP2,
+   REG_PLATFORM,
+};
+
+/**
+ * Enumeration of all CPU features supported
+ */
+enum rte_cpu_flag_t {
+   RTE_CPUFLAG_FP = 0,
+   RTE_CPUFLAG_NEON,
+   RTE_CPUFLAG_EVTSTRM,
+   RTE_CPUFLAG_AES,
+   RTE_CPUFLAG_PMULL,
+   RTE_CPUFLAG_SHA1,
+   RTE_CPUFLAG_SHA2,
+   RTE_CPUFLAG_CRC32,
+   RTE_CPUFLAG_AARCH64,
+   /* The last item */
+   RTE_CPUFLAG_NUMFLAGS,/**< This should always be the last! */
+};
+
+static const struct feature_entry cpu_feature_table[] = {
+   FEAT_DEF(FP,0x0001, 0, REG_HWCAP,  0)
+   FEAT_DEF(NEON,  0x0001, 0, REG_HWCAP,  1)
+   FEAT_DEF(EVTSTRM,   0x0001, 0, REG_HWCAP,  2)
+   FEAT_DEF(AES,   0x0001, 0, REG_HWCAP,  3)
+   FEAT_DEF(PMULL, 0x0001, 0, REG_HWCAP,  4)
+   FEAT_DEF(SHA1,  0x0001, 0, REG_HWCAP,  5)
+   FEAT_DEF(SHA2,  0x0001, 0, REG_HWCAP,  6)
+   FEAT_DEF(CRC32, 0x0001, 0, REG_HWCAP,  7)
+   FEAT_DEF(AARCH64,   0x0001, 0, REG_PLATFORM, 1)
+};
+
+/*
+ * Read AUXV software register and get cpu features for ARM
+ */
+static inline void
+rte_cpu_get_features(__attribute__((unused)) uint32_t leaf,
+__attribute__((unused)) uint32_t subleaf,
+cpuid_registers_t out)
+{
+   int auxv_fd;
+   Elf64_auxv_t auxv;
+
+   auxv_fd = open("/proc/self/auxv", O_RDONLY);
+   assert(auxv_fd);
+   while (read(auxv_fd, ,
+   sizeof(Elf64_auxv_t)) == sizeof(Elf64_auxv_t)) {
+   if (auxv.a_type == AT_HWCAP) {
+   out[REG_HWCAP] = auxv.a_un.a_val;
+   } else if (auxv.a_type == AT_HWCAP2) {
+   out[REG_HWCAP2] = auxv.a_un.a_val;
+   } else if (auxv.a_type == AT_PLATFORM) {
+ 

[dpdk-dev] [PATCH 01/15] eal: arm64: add armv8-a version of rte_atomic_64.h

2015-11-05 Thread Jerin Jacob
except rte_?wb() functions other functions are used from
RTE_FORCE_INTRINSICS=y scheme

Signed-off-by: Jerin Jacob 
---
 .../common/include/arch/arm/rte_atomic.h   |  4 +
 .../common/include/arch/arm/rte_atomic_64.h| 88 ++
 2 files changed, 92 insertions(+)
 create mode 100644 lib/librte_eal/common/include/arch/arm/rte_atomic_64.h

diff --git a/lib/librte_eal/common/include/arch/arm/rte_atomic.h 
b/lib/librte_eal/common/include/arch/arm/rte_atomic.h
index f4f5783..f3f3b6e 100644
--- a/lib/librte_eal/common/include/arch/arm/rte_atomic.h
+++ b/lib/librte_eal/common/include/arch/arm/rte_atomic.h
@@ -33,6 +33,10 @@
 #ifndef _RTE_ATOMIC_ARM_H_
 #define _RTE_ATOMIC_ARM_H_

+#ifdef RTE_ARCH_64
+#include 
+#else
 #include 
+#endif

 #endif /* _RTE_ATOMIC_ARM_H_ */
diff --git a/lib/librte_eal/common/include/arch/arm/rte_atomic_64.h 
b/lib/librte_eal/common/include/arch/arm/rte_atomic_64.h
new file mode 100644
index 000..671caa7
--- /dev/null
+++ b/lib/librte_eal/common/include/arch/arm/rte_atomic_64.h
@@ -0,0 +1,88 @@
+/*
+ *   BSD LICENSE
+ *
+ *   Copyright (C) Cavium networks Ltd. 2015.
+ *
+ *   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 Cavium networks 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.
+*/
+
+#ifndef _RTE_ATOMIC_ARM64_H_
+#define _RTE_ATOMIC_ARM64_H_
+
+#ifndef RTE_FORCE_INTRINSICS
+#  error Platform must be built with CONFIG_RTE_FORCE_INTRINSICS
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "generic/rte_atomic.h"
+
+#define dmb(opt)  do { asm volatile("dmb " #opt : : : "memory"); } while (0)
+
+/**
+ * General memory barrier.
+ *
+ * Guarantees that the LOAD and STORE operations generated before the
+ * barrier occur before the LOAD and STORE operations generated after.
+ * This function is architecture dependent.
+ */
+static inline void rte_mb(void)
+{
+   dmb(ish);
+}
+
+/**
+ * Write memory barrier.
+ *
+ * Guarantees that the STORE operations generated before the barrier
+ * occur before the STORE operations generated after.
+ * This function is architecture dependent.
+ */
+static inline void rte_wmb(void)
+{
+   dmb(ishst);
+}
+
+/**
+ * Read memory barrier.
+ *
+ * Guarantees that the LOAD operations generated before the barrier
+ * occur before the LOAD operations generated after.
+ * This function is architecture dependent.
+ */
+static inline void rte_rmb(void)
+{
+   dmb(ishld);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTE_ATOMIC_ARM64_H_ */
-- 
1.9.3



[dpdk-dev] [PATCH v2 00/15] DPDK armv8-a support

2015-11-05 Thread Jerin Jacob
This is the v2 patchset for ARMv8 that now sits on top of the v6 patch
(based on upstream 82fb702077f67585d64a07de0080e5cb6a924a72)
of the ARMv7 code by RehiveTech. It adds code into the same arm include
directory, reducing code duplication.

Tested on an ThunderX arm 64-bit arm server board, with PCI slots. Passes 
traffic
between two physical ports on an Intel 82599 dual-port 10Gig NIC. Should
work with many other NICS as long as there is no unaligned access to
device memory but not yet untested.

Compiles igb_uio, kni and all the physical device PMDs.

An entry has been added to the Release notes.

v1..v2

1) included  "Introduce rte_smp_*mb() for memory barriers to use between lcores"
patch ACK by Konstantin in v2 as "eal: introduce rte_smp_*mb() for memory 
barriers to use between lcores"
please superseded the original one

2) defined rte_smp_mb(), rte_smp_wmb(), rte_smp_rmb() for arm
(1) and (2) fixes "Mbuf autotest" stress failure found in version 1

3) fixed white space issues with patch 8,9,10
4) disabled  CONFIG_RTE_LIBRTE_FM10K_PMD, CONFIG_RTE_LIBRTE_I40E_PMD
due to tmmintrin.h depenency or ARM


NOTE:
Part of the work has been taken from David Hunt's v3 patch who was
initiated the armv8 port.


Notes on arm64 kernel configuration:

  Tested on using Ubuntu 14.04 LTS with a 3.18 kernel and igb_uio.
  ARM64 kernels does not have functional resource mapping of PCI memory
  (PCI_MMAP), so the pci driver needs to be patched to enable this. The
  symptom of this is when /sys/bus/pci/devices/:0X:00.Y directory is
  missing the resource0...N files for mmapping the device memory.

  Following patch fixes the PCI resource mapping issue om armv8.
  Its not yet up streamed.We are in the process of up streaming it.

  http://lists.infradead.org/pipermail/linux-arm-kernel/2015-July/358906.html


Jerin Jacob (15):
  eal: arm64: add armv8-a version of rte_atomic_64.h
  eal: arm64: add armv8-a version of rte_cpuflags_64.h
  eal: arm64: add armv8-a version of rte_prefetch_64.h
  eal: arm64: add armv8-a version of rte_cycles_64.h
  eal: arm64: rte_memcpy_64.h version based on libc memcpy
  eal: arm: ret_vector.h improvements
  app: test_cpuflags: test the new cpu flags added for arm64
  acl: arm64: acl implementation using NEON gcc intrinsic
  mk: add support for armv8 on top of armv7
  mk: add support for thunderx machine target based on armv8-a
  updated release note for armv8 support for DPDK 2.2
  maintainers: claim responsibility for ARMv8
  eal: introduce rte_smp_*mb() for memory barriers to use between lcores
  eal: arm: define rte_smp_mb(), rte_smp_wmb(), rte_smp_rmb() for arm
  armv8: config file update

 MAINTAINERS|   5 +
 app/test-acl/main.c|   4 +
 app/test/test_cpuflags.c   |  26 ++
 config/defconfig_arm64-armv8a-linuxapp-gcc |  56 
 config/defconfig_arm64-thunderx-linuxapp-gcc   |  56 
 doc/guides/rel_notes/release_2_2.rst   |   7 +-
 drivers/net/virtio/virtqueue.h |   8 +-
 drivers/net/xenvirt/rte_eth_xenvirt.c  |   4 +-
 drivers/net/xenvirt/virtqueue.h|   2 +-
 lib/librte_acl/Makefile|   5 +
 lib/librte_acl/acl.h   |   4 +
 lib/librte_acl/acl_run_neon.c  |  46 
 lib/librte_acl/acl_run_neon.h  | 289 +
 lib/librte_acl/rte_acl.c   |  25 ++
 lib/librte_acl/rte_acl.h   |   1 +
 .../common/include/arch/arm/rte_atomic.h   |  10 +
 .../common/include/arch/arm/rte_atomic_64.h|  88 +++
 .../common/include/arch/arm/rte_cpuflags.h |   4 +
 .../common/include/arch/arm/rte_cpuflags_64.h  | 152 +++
 .../common/include/arch/arm/rte_cycles.h   |   4 +
 .../common/include/arch/arm/rte_cycles_64.h|  71 +
 .../common/include/arch/arm/rte_memcpy.h   |   4 +
 .../common/include/arch/arm/rte_memcpy_64.h|  93 +++
 .../common/include/arch/arm/rte_prefetch.h |   4 +
 .../common/include/arch/arm/rte_prefetch_64.h  |  61 +
 lib/librte_eal/common/include/arch/arm/rte_vect.h  |  54 ++--
 .../common/include/arch/ppc_64/rte_atomic.h|   6 +
 .../common/include/arch/tile/rte_atomic.h  |   6 +
 .../common/include/arch/x86/rte_atomic.h   |   6 +
 lib/librte_eal/common/include/generic/rte_atomic.h |  27 ++
 lib/librte_ring/rte_ring.h |   8 +-
 mk/arch/arm64/rte.vars.mk  |  58 +
 mk/machine/armv8a/rte.vars.mk  |  58 +
 mk/machine/thunderx/rte.vars.mk|  58 +
 34 files changed, 1256 insertions(+), 54 deletions(-)
 create mode 100644 config/defconfig_arm64-armv8a-linuxapp-gcc
 create mode 100644 config/defconfig_arm64-thunderx-linuxapp-gcc
 create mode 100644 

[dpdk-dev] SR-IOV: API to tell VF from PF

2015-11-05 Thread Ananyev, Konstantin


> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Polehn, Mike A
> Sent: Thursday, November 05, 2015 5:59 PM
> To: Richardson, Bruce; Shaham Fridenberg
> Cc: dev at dpdk.org
> Subject: Re: [dpdk-dev] SR-IOV: API to tell VF from PF
> 
> A VF should support promiscuous mode, however this is different than a PF 
> supporting promiscuous mode.
> 
> What happens to network throughput, which is tied to PCEe throughput, when 
> say when 4 VFs are each in promiscuous mode. It
> should support it, but very negative effect.

In the usual model it is not up to VF/VM to decide what fraction of the total 
device resources it allowed to use.
It is responsibility of the PF/Hypervsior to devide total device bandwidths 
between VFs/VM, 
decide which VF will be a mirror if any, etc.
Konstantin

> 
> Not all NICs are created equal. The program should be able to quarry the 
> device driver and be able to determine if it is the correct NIC
> type is being used. The device driver type should only match to the device 
> type, which should be specific to VF or PF.


> 
> Mike
> 
> -Original Message-
> From: Richardson, Bruce
> Sent: Thursday, November 5, 2015 7:51 AM
> To: Polehn, Mike A; Shaham Fridenberg
> Cc: dev at dpdk.org
> Subject: RE: [dpdk-dev] SR-IOV: API to tell VF from PF
> 
> 
> 
> > -Original Message-
> > From: Polehn, Mike A
> > Sent: Thursday, November 5, 2015 3:43 PM
> > To: Richardson, Bruce ; Shaham Fridenberg
> > 
> > Cc: dev at dpdk.org
> > Subject: RE: [dpdk-dev] SR-IOV: API to tell VF from PF
> >
> > I can think of a very good reason to want to know if the device is VF
> > or PF.
> >
> > The VF has to go through a layer 2 switch, not allowing it to just
> > receive anything coming across the Ehternet.
> >
> > The PF can receive all the packets, including packets with different
> > NIC addresses. This allow the packets to be just data and allows the
> > processing of data without needing to be adjusting each NIC L2 address
> > before sending through to the Ehternet. So data can be moved through a
> > series of NICs between systems without the extra processing. Not doing
> > unnecessary  processing leaves more clock cycles to do high value
> > processing.
> >
> > Mike
> >
> 
> Yes, the capabilities of the different types of devices are different.
> 
> However, is a better solution not to provide the ability to query a NIC if it 
> supports promiscuous mode, rather than set up a specific
> query for a VF? What if (hypothetically) you get a PF that doesn't support 
> promiscuous mode, for instance, or a bifurcated driver
> where the kernel part prevents the userspace part from enabling promiscuous 
> mode? In both these cases have a direct feature query
> works better than asking about PF/VF.
> 
> Regards,
> 
> /Bruce
> 
> > -Original Message-
> > From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Bruce Richardson
> > Sent: Thursday, November 5, 2015 1:51 AM
> > To: Shaham Fridenberg
> > Cc: dev at dpdk.org
> > Subject: Re: [dpdk-dev] SR-IOV: API to tell VF from PF
> >
> > On Thu, Nov 05, 2015 at 09:39:19AM +, Shaham Fridenberg wrote:
> > > Hey all,
> > >
> > > Is there some API to tell VF from PF?
> > >
> > > Only way I found so far is deducing that from driver name in the
> > rte_eth_devices struct.
> > >
> > > Thanks,
> > > Shaham
> >
> > Hi Shaham,
> >
> > yes, checking the driver name is probably the only way to do so.
> > However, why do you need or want to know this? If you want to know the
> > capabilities of a device basing it on a list of known device types is
> > probably not the best way.
> >
> > Regards,
> > /Bruce


[dpdk-dev] [PATCH v2 00/15] DPDK armv8-a support

2015-11-05 Thread Jan Viktorin
Hello Jerin,

I'm sorry, I am quite busy last days so I could not check the code yet.
By the way, I am about to provide an automatic build + autotest check in
qemu for both armv7 and armv8, however, I got stuck with some strange
behaviour of qemu.

However, I've got a note about the form of the v1, v2 patch sets. It is
recommended to send patch series with --thread --no-chain-reply-to [1]
so the actual patches 0001..00015 should be all a reply-to the 
commit and not every single commit a reply to the previous one [2].

In my opinion (however, I don't always do it myself :)), the  patch
of v2 should be a reply-to the  patch of v1... (as described in
[2] for the --no-chain-reply-to option).

Regards
Jan

[1] http://dpdk.org/dev
[2] https://kernel.org/pub/software/scm/git/docs/git-send-email.html

On Thu, 5 Nov 2015 22:08:03 +0530
Jerin Jacob  wrote:

> This is the v2 patchset for ARMv8 that now sits on top of the v6 patch
> (based on upstream 82fb702077f67585d64a07de0080e5cb6a924a72)
> of the ARMv7 code by RehiveTech. It adds code into the same arm include
> directory, reducing code duplication.
> 
> Tested on an ThunderX arm 64-bit arm server board, with PCI slots. Passes 
> traffic
> between two physical ports on an Intel 82599 dual-port 10Gig NIC. Should
> work with many other NICS as long as there is no unaligned access to
> device memory but not yet untested.
> 
> Compiles igb_uio, kni and all the physical device PMDs.
> 
> An entry has been added to the Release notes.
> 
> v1..v2
> 
> 1) included  "Introduce rte_smp_*mb() for memory barriers to use between 
> lcores"
> patch ACK by Konstantin in v2 as "eal: introduce rte_smp_*mb() for memory 
> barriers to use between lcores"
> please superseded the original one
> 
> 2) defined rte_smp_mb(), rte_smp_wmb(), rte_smp_rmb() for arm
> (1) and (2) fixes "Mbuf autotest" stress failure found in version 1
> 
> 3) fixed white space issues with patch 8,9,10
> 4) disabled  CONFIG_RTE_LIBRTE_FM10K_PMD, CONFIG_RTE_LIBRTE_I40E_PMD
> due to tmmintrin.h depenency or ARM
> 
> 
> NOTE:
> Part of the work has been taken from David Hunt's v3 patch who was
> initiated the armv8 port.
> 
> 
> Notes on arm64 kernel configuration:
> 
>   Tested on using Ubuntu 14.04 LTS with a 3.18 kernel and igb_uio.
>   ARM64 kernels does not have functional resource mapping of PCI memory
>   (PCI_MMAP), so the pci driver needs to be patched to enable this. The
>   symptom of this is when /sys/bus/pci/devices/:0X:00.Y directory is
>   missing the resource0...N files for mmapping the device memory.
> 
>   Following patch fixes the PCI resource mapping issue om armv8.
>   Its not yet up streamed.We are in the process of up streaming it.
> 
>   http://lists.infradead.org/pipermail/linux-arm-kernel/2015-July/358906.html
> 
> 
> Jerin Jacob (15):
>   eal: arm64: add armv8-a version of rte_atomic_64.h
>   eal: arm64: add armv8-a version of rte_cpuflags_64.h
>   eal: arm64: add armv8-a version of rte_prefetch_64.h
>   eal: arm64: add armv8-a version of rte_cycles_64.h
>   eal: arm64: rte_memcpy_64.h version based on libc memcpy
>   eal: arm: ret_vector.h improvements
>   app: test_cpuflags: test the new cpu flags added for arm64
>   acl: arm64: acl implementation using NEON gcc intrinsic
>   mk: add support for armv8 on top of armv7
>   mk: add support for thunderx machine target based on armv8-a
>   updated release note for armv8 support for DPDK 2.2
>   maintainers: claim responsibility for ARMv8
>   eal: introduce rte_smp_*mb() for memory barriers to use between lcores
>   eal: arm: define rte_smp_mb(), rte_smp_wmb(), rte_smp_rmb() for arm
>   armv8: config file update
> 
>  MAINTAINERS|   5 +
>  app/test-acl/main.c|   4 +
>  app/test/test_cpuflags.c   |  26 ++
>  config/defconfig_arm64-armv8a-linuxapp-gcc |  56 
>  config/defconfig_arm64-thunderx-linuxapp-gcc   |  56 
>  doc/guides/rel_notes/release_2_2.rst   |   7 +-
>  drivers/net/virtio/virtqueue.h |   8 +-
>  drivers/net/xenvirt/rte_eth_xenvirt.c  |   4 +-
>  drivers/net/xenvirt/virtqueue.h|   2 +-
>  lib/librte_acl/Makefile|   5 +
>  lib/librte_acl/acl.h   |   4 +
>  lib/librte_acl/acl_run_neon.c  |  46 
>  lib/librte_acl/acl_run_neon.h  | 289 
> +
>  lib/librte_acl/rte_acl.c   |  25 ++
>  lib/librte_acl/rte_acl.h   |   1 +
>  .../common/include/arch/arm/rte_atomic.h   |  10 +
>  .../common/include/arch/arm/rte_atomic_64.h|  88 +++
>  .../common/include/arch/arm/rte_cpuflags.h |   4 +
>  .../common/include/arch/arm/rte_cpuflags_64.h  | 152 +++
>  .../common/include/arch/arm/rte_cycles.h   |   4 +
>  

[dpdk-dev] SR-IOV: API to tell VF from PF

2015-11-05 Thread Polehn, Mike A
A VF should support promiscuous mode, however this is different than a PF 
supporting promiscuous mode.

What happens to network throughput, which is tied to PCEe throughput, when say 
when 4 VFs are each in promiscuous mode. It should support it, but very 
negative effect.

Not all NICs are created equal. The program should be able to quarry the device 
driver and be able to determine if it is the correct NIC type is being used. 
The device driver type should only match to the device type, which should be 
specific to VF or PF.

Mike

-Original Message-
From: Richardson, Bruce 
Sent: Thursday, November 5, 2015 7:51 AM
To: Polehn, Mike A; Shaham Fridenberg
Cc: dev at dpdk.org
Subject: RE: [dpdk-dev] SR-IOV: API to tell VF from PF



> -Original Message-
> From: Polehn, Mike A
> Sent: Thursday, November 5, 2015 3:43 PM
> To: Richardson, Bruce ; Shaham Fridenberg 
> 
> Cc: dev at dpdk.org
> Subject: RE: [dpdk-dev] SR-IOV: API to tell VF from PF
> 
> I can think of a very good reason to want to know if the device is VF 
> or PF.
> 
> The VF has to go through a layer 2 switch, not allowing it to just 
> receive anything coming across the Ehternet.
> 
> The PF can receive all the packets, including packets with different 
> NIC addresses. This allow the packets to be just data and allows the 
> processing of data without needing to be adjusting each NIC L2 address 
> before sending through to the Ehternet. So data can be moved through a 
> series of NICs between systems without the extra processing. Not doing 
> unnecessary  processing leaves more clock cycles to do high value 
> processing.
> 
> Mike
> 

Yes, the capabilities of the different types of devices are different.

However, is a better solution not to provide the ability to query a NIC if it 
supports promiscuous mode, rather than set up a specific query for a VF? What 
if (hypothetically) you get a PF that doesn't support promiscuous mode, for 
instance, or a bifurcated driver where the kernel part prevents the userspace 
part from enabling promiscuous mode? In both these cases have a direct feature 
query works better than asking about PF/VF.

Regards,

/Bruce

> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Bruce Richardson
> Sent: Thursday, November 5, 2015 1:51 AM
> To: Shaham Fridenberg
> Cc: dev at dpdk.org
> Subject: Re: [dpdk-dev] SR-IOV: API to tell VF from PF
> 
> On Thu, Nov 05, 2015 at 09:39:19AM +, Shaham Fridenberg wrote:
> > Hey all,
> >
> > Is there some API to tell VF from PF?
> >
> > Only way I found so far is deducing that from driver name in the
> rte_eth_devices struct.
> >
> > Thanks,
> > Shaham
> 
> Hi Shaham,
> 
> yes, checking the driver name is probably the only way to do so. 
> However, why do you need or want to know this? If you want to know the 
> capabilities of a device basing it on a list of known device types is 
> probably not the best way.
> 
> Regards,
> /Bruce


[dpdk-dev] [PATCH] cmdline: increase commandline buffer size to 512

2015-11-05 Thread Nélio Laranjeiro
On Thu, Nov 05, 2015 at 09:58:36AM +, John McNamara wrote:
> Increase commandline buffer size to 512 to allow for longer
> commandlines required by testpmd when dealing with flow
> director and IPv6 addresses.
> 
> Signed-off-by: John McNamara 
> ---
>  lib/librte_cmdline/cmdline_rdline.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/librte_cmdline/cmdline_rdline.h 
> b/lib/librte_cmdline/cmdline_rdline.h
> index b9aad9b..72e2dad 100644
> --- a/lib/librte_cmdline/cmdline_rdline.h
> +++ b/lib/librte_cmdline/cmdline_rdline.h
> @@ -93,7 +93,7 @@ extern "C" {
>  #endif
>  
>  /* configuration */
> -#define RDLINE_BUF_SIZE 256
> +#define RDLINE_BUF_SIZE 512
>  #define RDLINE_PROMPT_SIZE  32
>  #define RDLINE_VT100_BUF_SIZE  8
>  #define RDLINE_HISTORY_BUF_SIZE BUFSIZ
> -- 
> 1.8.1.4
> 

I have faced the same issue.  For some commands this value is still too 
low.  For example,  RETA update can not be used, the command line limits 
he configuration to 34 entries.

See http://dpdk.org/ml/archives/dev/2015-October/024681.html
and particularly 
http://dpdk.org/ml/archives/dev/2015-October/024682.html

It was too late to announce an ABI change so we left out the cmdline 
size update.

Olivier, Thomas, what do you think about this?  It seems this is really 
blocking.

-- 
N?lio Laranjeiro
6WIND


[dpdk-dev] [PATCH 15/15] armv8: config file update

2015-11-05 Thread Hunt, David
On 05/11/2015 16:38, Jerin Jacob wrote:
> disabled CONFIG_RTE_LIBRTE_FM10K_PMD and CONFIG_RTE_LIBRTE_I40E_PMD to fix
> the compilation issues due to tmmintrin.h
>
> removed stale CONFIG_RTE_LIBRTE_EAL_HOTPLUG
--snip--

Jerin,

Each patch in a patch set should compile after its application so as 
not to break 'git disect'. Patch 15/15 fixes a compile issue introduced 
in patch 10, which breaks the compile, so I'd suggest rolling the patch 
15 changes into patch 10 in the set.

Dave



[dpdk-dev] [PATCH 7/7] rte_ether: mark deprecated statistics with attribute

2015-11-05 Thread Stephen Hemminger
Use deprecated attribute to highlight any use of fields that
are marked as going away in the rte_ether device statistics.

Signed-off-by: Stephen Hemminger 
---
 lib/librte_eal/common/include/rte_common.h |  3 +++
 lib/librte_ether/rte_ethdev.h  | 16 
 2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/lib/librte_eal/common/include/rte_common.h 
b/lib/librte_eal/common/include/rte_common.h
index 3121314..f8ca6f3 100644
--- a/lib/librte_eal/common/include/rte_common.h
+++ b/lib/librte_eal/common/include/rte_common.h
@@ -69,6 +69,9 @@ typedef uint32_t unaligned_uint32_t;
 typedef uint16_t unaligned_uint16_t;
 #endif

+/*** Macro to mark functions and fields scheduled for removal */
+#define __rte_deprecated   __attribute__((__deprecated__))
+
 /*** Macros to eliminate unused variable warnings /

 /**
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index f653e37..49a6889 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -198,25 +198,25 @@ struct rte_eth_stats {
/**< Total of RX packets dropped by the HW,
 * because there are no available mbufs (i.e. RX queues are full).
 */
-   uint64_t ibadcrc;
+   uint64_t ibadcrc __rte_deprecated;
/**< Deprecated; Total of RX packets with CRC error. */
-   uint64_t ibadlen;
+   uint64_t ibadlen __rte_deprecated;
/**< Deprecated; Total of RX packets with bad length. */
uint64_t ierrors;   /**< Total number of erroneous received packets. */
uint64_t oerrors;   /**< Total number of failed transmitted packets. */
uint64_t imcasts;   /**< Total number of multicast received packets. */
uint64_t rx_nombuf; /**< Total number of RX mbuf allocation failures. */
-   uint64_t fdirmatch;
+   uint64_t fdirmatch __rte_deprecated;
/**< Deprecated; Total number of RX packets matching a filter. */
-   uint64_t fdirmiss;
+   uint64_t fdirmiss __rte_deprecated;
/**< Deprecated; Total number of RX packets not matching any filter. */
-   uint64_t tx_pause_xon;
+   uint64_t tx_pause_xon __rte_deprecated;
 /**< Deprecated; Total nb. of XON pause frame sent. */
-   uint64_t rx_pause_xon;
+   uint64_t rx_pause_xon  __rte_deprecated;
/**< Deprecated; Total nb. of XON pause frame received. */
-   uint64_t tx_pause_xoff;
+   uint64_t tx_pause_xoff __rte_deprecated;
/**< Deprecated; Total nb. of XOFF pause frame sent. */
-   uint64_t rx_pause_xoff;
+   uint64_t rx_pause_xoff __rte_deprecated;
/**< Deprecated; Total nb. of XOFF pause frame received. */
uint64_t q_ipackets[RTE_ETHDEV_QUEUE_STAT_CNTRS];
/**< Total number of queue RX packets. */
-- 
2.1.4



[dpdk-dev] [PATCH 6/7] test-pmd: remove references to deprecated statistics

2015-11-05 Thread Stephen Hemminger
Some of the statistics are deprecated, so don't test them.

Signed-off-by: Stephen Hemminger 
---
 app/test-pmd/config.c| 22 ++
 app/test-pmd/testpmd.c   | 26 ++
 app/test/test_pmd_perf.c |  7 ++-
 3 files changed, 6 insertions(+), 49 deletions(-)

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 938b456..f21801a 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -154,9 +154,7 @@ nic_stats_display(portid_t port_id)
printf("  RX-packets: %-10"PRIu64" RX-missed: %-10"PRIu64" 
RX-bytes:  "
   "%-"PRIu64"\n",
   stats.ipackets, stats.imissed, stats.ibytes);
-   printf("  RX-badcrc:  %-10"PRIu64" RX-badlen: %-10"PRIu64" 
RX-errors: "
-  "%-"PRIu64"\n",
-  stats.ibadcrc, stats.ibadlen, stats.ierrors);
+   printf("  RX-errors: %-"PRIu64"\n", stats.ierrors);
printf("  RX-nombuf:  %-10"PRIu64"\n",
   stats.rx_nombuf);
printf("  TX-packets: %-10"PRIu64" TX-errors: %-10"PRIu64" 
TX-bytes:  "
@@ -167,9 +165,7 @@ nic_stats_display(portid_t port_id)
printf("  RX-packets:  %10"PRIu64"RX-errors: 
%10"PRIu64
   "RX-bytes: %10"PRIu64"\n",
   stats.ipackets, stats.ierrors, stats.ibytes);
-   printf("  RX-badcrc:   %10"PRIu64"RX-badlen: 
%10"PRIu64
-  "  RX-errors:  %10"PRIu64"\n",
-  stats.ibadcrc, stats.ibadlen, stats.ierrors);
+   printf("  RX-errors:  %10"PRIu64"\n", stats.ierrors);
printf("  RX-nombuf:   %10"PRIu64"\n",
   stats.rx_nombuf);
printf("  TX-packets:  %10"PRIu64"TX-errors: 
%10"PRIu64
@@ -177,12 +173,6 @@ nic_stats_display(portid_t port_id)
   stats.opackets, stats.oerrors, stats.obytes);
}

-   /* stats fdir */
-   if (fdir_conf.mode != RTE_FDIR_MODE_NONE)
-   printf("  Fdirmiss:   %-10"PRIu64" Fdirmatch: %-10"PRIu64"\n",
-  stats.fdirmiss,
-  stats.fdirmatch);
-
if (port->rx_queue_stats_mapping_enabled) {
printf("\n");
for (i = 0; i < RTE_ETHDEV_QUEUE_STAT_CNTRS; i++) {
@@ -201,14 +191,6 @@ nic_stats_display(portid_t port_id)
}
}

-   /* Display statistics of XON/XOFF pause frames, if any. */
-   if ((stats.tx_pause_xon  | stats.rx_pause_xon |
-stats.tx_pause_xoff | stats.rx_pause_xoff) > 0) {
-   printf("  RX-XOFF:%-10"PRIu64" RX-XON:%-10"PRIu64"\n",
-  stats.rx_pause_xoff, stats.rx_pause_xon);
-   printf("  TX-XOFF:%-10"PRIu64" TX-XON:%-10"PRIu64"\n",
-  stats.tx_pause_xoff, stats.tx_pause_xon);
-   }
printf("  %s%s\n",
   nic_stats_border, nic_stats_border);
 }
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 2e302bb..68e0943 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -751,9 +751,7 @@ fwd_port_stats_display(portid_t port_id, struct 
rte_eth_stats *stats)
printf("  Bad-ipcsum: %-14"PRIu64" Bad-l4csum: 
%-14"PRIu64" \n",
   port->rx_bad_ip_csum, port->rx_bad_l4_csum);
if (((stats->ierrors - stats->imissed) + stats->rx_nombuf) > 0) 
{
-   printf("  RX-badcrc:  %-14"PRIu64" RX-badlen:  
%-14"PRIu64
-  "RX-error: %-"PRIu64"\n",
-  stats->ibadcrc, stats->ibadlen, stats->ierrors);
+   printf("  RX-error: %-"PRIu64"\n",  stats->ierrors);
printf("  RX-nombufs: %-14"PRIu64"\n", 
stats->rx_nombuf);
}

@@ -772,9 +770,7 @@ fwd_port_stats_display(portid_t port_id, struct 
rte_eth_stats *stats)
printf("  Bad-ipcsum:%14"PRIu64"
Bad-l4csum:%14"PRIu64"\n",
   port->rx_bad_ip_csum, port->rx_bad_l4_csum);
if (((stats->ierrors - stats->imissed) + stats->rx_nombuf) > 0) 
{
-   printf("  RX-badcrc:  %14"PRIu64"
RX-badlen: %14"PRIu64
-  "RX-error:%"PRIu64"\n",
-  stats->ibadcrc, stats->ibadlen, stats->ierrors);
+   printf("  RX-error:%"PRIu64"\n", stats->ierrors);
printf("  RX-nombufs: %14"PRIu64"\n",
   stats->rx_nombuf);
}
@@ -785,15 +781,6 @@ fwd_port_stats_display(portid_t port_id, struct 
rte_eth_stats *stats)
   (uint64_t) (stats->opackets + port->tx_dropped));
}

-   /* Display statistics of XON/XOFF 

[dpdk-dev] [PATCH 5/7] e1000: don't report deprecated statistics

2015-11-05 Thread Stephen Hemminger
These fields are marked deprecated don't use them.

Signed-off-by: Stephen Hemminger 
---
 drivers/net/e1000/em_ethdev.c  | 12 ++--
 drivers/net/e1000/igb_ethdev.c | 12 ++--
 2 files changed, 4 insertions(+), 20 deletions(-)

diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index 500985d..3e81109 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -911,11 +911,9 @@ eth_em_stats_get(struct rte_eth_dev *dev, struct 
rte_eth_stats *rte_stats)
return;

/* Rx Errors */
-   rte_stats->ibadcrc = stats->crcerrs;
-   rte_stats->ibadlen = stats->rlec + stats->ruc + stats->roc;
rte_stats->imissed = stats->mpc;
-   rte_stats->ierrors = rte_stats->ibadcrc +
-rte_stats->ibadlen +
+   rte_stats->ierrors = stats->crcerrs +
+stats->rlec + stats->ruc + stats->roc +
 rte_stats->imissed +
 stats->rxerrc + stats->algnerrc + stats->cexterr;

@@ -926,12 +924,6 @@ eth_em_stats_get(struct rte_eth_dev *dev, struct 
rte_eth_stats *rte_stats)
rte_stats->opackets = stats->gptc;
rte_stats->ibytes   = stats->gorc;
rte_stats->obytes   = stats->gotc;
-
-   /* XON/XOFF pause frames stats registers */
-   rte_stats->tx_pause_xon  = stats->xontxc;
-   rte_stats->rx_pause_xon  = stats->xonrxc;
-   rte_stats->tx_pause_xoff = stats->xofftxc;
-   rte_stats->rx_pause_xoff = stats->xoffrxc;
 }

 static void
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index 2cb115c..6638247 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -1589,23 +1589,15 @@ eth_igb_stats_get(struct rte_eth_dev *dev, struct 
rte_eth_stats *rte_stats)
return;

/* Rx Errors */
-   rte_stats->ibadcrc = stats->crcerrs;
-   rte_stats->ibadlen = stats->rlec + stats->ruc + stats->roc;
rte_stats->imissed = stats->mpc;
-   rte_stats->ierrors = rte_stats->ibadcrc +
-rte_stats->ibadlen +
+   rte_stats->ierrors = stats->crcerrs +
+stats->rlec + stats->ruc + stats->roc +
 rte_stats->imissed +
 stats->rxerrc + stats->algnerrc + stats->cexterr;

/* Tx Errors */
rte_stats->oerrors = stats->ecol + stats->latecol;

-   /* XON/XOFF pause frames */
-   rte_stats->tx_pause_xon  = stats->xontxc;
-   rte_stats->rx_pause_xon  = stats->xonrxc;
-   rte_stats->tx_pause_xoff = stats->xofftxc;
-   rte_stats->rx_pause_xoff = stats->xoffrxc;
-
rte_stats->ipackets = stats->gprc;
rte_stats->opackets = stats->gptc;
rte_stats->ibytes   = stats->gorc;
-- 
2.1.4



[dpdk-dev] [PATCH 4/7] i40e: don't report deprecated statistics

2015-11-05 Thread Stephen Hemminger
The fields in ethernet statistics that are marked deprecated
should not be filled in.

Signed-off-by: Stephen Hemminger 
---
 drivers/net/i40e/i40e_ethdev.c | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index ddf3d38..c6ee6f9 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -2043,15 +2043,14 @@ i40e_dev_stats_get(struct rte_eth_dev *dev, struct 
rte_eth_stats *stats)
stats->oerrors  = ns->eth.tx_errors +
pf->main_vsi->eth_stats.tx_errors;
stats->imcasts  = pf->main_vsi->eth_stats.rx_multicast;
-   stats->fdirmatch = ns->fd_sb_match;

/* Rx Errors */
-   stats->ibadcrc  = ns->crc_errors;
-   stats->ibadlen  = ns->rx_length_errors + ns->rx_undersize +
-   ns->rx_oversize + ns->rx_fragments + ns->rx_jabber;
stats->imissed  = ns->eth.rx_discards +
pf->main_vsi->eth_stats.rx_discards;
-   stats->ierrors  = stats->ibadcrc + stats->ibadlen + stats->imissed;
+   stats->ierrors  = ns->crc_errors +
+   ns->rx_length_errors + ns->rx_undersize +
+   ns->rx_oversize + ns->rx_fragments + ns->rx_jabber +
+   stats->imissed;

PMD_DRV_LOG(DEBUG, "* PF stats start 
***");
PMD_DRV_LOG(DEBUG, "rx_bytes:%"PRIu64"", ns->eth.rx_bytes);
-- 
2.1.4



[dpdk-dev] [PATCH 3/7] cxgbe: don't report deprecated statistics

2015-11-05 Thread Stephen Hemminger
Some of the ethernet device statistics are marked deprecated
and should not be reported.

Signed-off-by: Stephen Hemminger 
---
 drivers/net/cxgbe/cxgbe_ethdev.c | 10 +++---
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c
index 3ef787d..de46a09 100644
--- a/drivers/net/cxgbe/cxgbe_ethdev.c
+++ b/drivers/net/cxgbe/cxgbe_ethdev.c
@@ -660,18 +660,14 @@ static void cxgbe_dev_stats_get(struct rte_eth_dev 
*eth_dev,
  ps.rx_ovflow2 + ps.rx_ovflow3 +
  ps.rx_trunc0 + ps.rx_trunc1 +
  ps.rx_trunc2 + ps.rx_trunc3;
-   eth_stats->ibadcrc  = ps.rx_fcs_err;
-   eth_stats->ibadlen  = ps.rx_jabber + ps.rx_too_long + ps.rx_runt;
-   eth_stats->ierrors  = ps.rx_symbol_err + eth_stats->ibadcrc +
- eth_stats->ibadlen + ps.rx_len_err +
- eth_stats->imissed;
-   eth_stats->rx_pause_xon  = ps.rx_pause;
+   eth_stats->ierrors  = ps.rx_symbol_err + ps.rx_fcs_err +
+ ps.rx_jabber + ps.rx_too_long + ps.rx_runt +  

+ ps.rx_len_err + eth_stats->imissed;

/* TX Stats */
eth_stats->opackets = ps.tx_frames;
eth_stats->obytes   = ps.tx_octets;
eth_stats->oerrors  = ps.tx_error_frames;
-   eth_stats->tx_pause_xon  = ps.tx_pause;

for (i = 0; i < pi->n_rx_qsets; i++) {
struct sge_eth_rxq *rxq =
-- 
2.1.4



[dpdk-dev] [PATCH 2/7] bond: don't sum deprecated statistics

2015-11-05 Thread Stephen Hemminger
These statistics are marked deprecated, leave them alone.
Also keep track of imissed across all ports.

Signed-off-by: Stephen Hemminger 
---
 drivers/net/bonding/rte_eth_bond_pmd.c | 7 +--
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c 
b/drivers/net/bonding/rte_eth_bond_pmd.c
index bbff664..a9cd9fa 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -1814,16 +1814,11 @@ bond_ethdev_stats_get(struct rte_eth_dev *dev, struct 
rte_eth_stats *stats)
stats->opackets += slave_stats.opackets;
stats->ibytes += slave_stats.ibytes;
stats->obytes += slave_stats.obytes;
+   stats->imissed += slave_stats.imissed;
stats->ierrors += slave_stats.ierrors;
stats->oerrors += slave_stats.oerrors;
stats->imcasts += slave_stats.imcasts;
stats->rx_nombuf += slave_stats.rx_nombuf;
-   stats->fdirmatch += slave_stats.fdirmatch;
-   stats->fdirmiss += slave_stats.fdirmiss;
-   stats->tx_pause_xon += slave_stats.tx_pause_xon;
-   stats->rx_pause_xon += slave_stats.rx_pause_xon;
-   stats->tx_pause_xoff += slave_stats.tx_pause_xoff;
-   stats->rx_pause_xoff += slave_stats.rx_pause_xoff;

for (j = 0; j < RTE_ETHDEV_QUEUE_STAT_CNTRS; j++) {
stats->q_ipackets[j] += slave_stats.q_ipackets[j];
-- 
2.1.4



[dpdk-dev] [PATCH 1/7] ether: don't mark input multicast for deprecation

2015-11-05 Thread Stephen Hemminger
The number of received multicast frames is useful and already
available in many/most drivers. Therefore don't mark it as
deprecated.

Signed-off-by: Stephen Hemminger 
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 1 -
 lib/librte_ether/rte_ethdev.h| 3 +--
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 0b0bbcf..3b71c0c 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -2715,7 +2715,6 @@ ixgbevf_dev_stats_get(struct rte_eth_dev *dev, struct 
rte_eth_stats *stats)
stats->opackets = hw_stats->vfgptc;
stats->obytes = hw_stats->vfgotc;
stats->imcasts = hw_stats->vfmprc;
-   /* stats->imcasts should be removed as imcasts is deprecated */
 }

 static void
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 48a540d..f653e37 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -204,8 +204,7 @@ struct rte_eth_stats {
/**< Deprecated; Total of RX packets with bad length. */
uint64_t ierrors;   /**< Total number of erroneous received packets. */
uint64_t oerrors;   /**< Total number of failed transmitted packets. */
-   uint64_t imcasts;
-   /**< Deprecated; Total number of multicast received packets. */
+   uint64_t imcasts;   /**< Total number of multicast received packets. */
uint64_t rx_nombuf; /**< Total number of RX mbuf allocation failures. */
uint64_t fdirmatch;
/**< Deprecated; Total number of RX packets matching a filter. */
-- 
2.1.4



[dpdk-dev] [PATCH v2 0/7] ethdev: force deprecation of statistics

2015-11-05 Thread Stephen Hemminger
Several fields in ether statistics were tagged with comment that they
were going to be deprecated, but comments don't cause compile warnings.
Instead use Gcc attributes to force the issue.

Of course to do that, all the drivers and tests which are using
those fields have to be fixed first.

The input multicast statistic was listed as deprecated, but I find
it useful, and therefore the first patch is to revive it.

Stephen Hemminger (7):
  ether: don't mark input multicast for deprecation
  bond: don't sum deprecated statistics
  cxgbe: don't report deprecated statistics
  i40e: don't report deprecated statistics
  e1000: don't report deprecated statistics
  test-pmd: remove references to deprecated statistics
  rte_ether: mark deprecated statistics with attribute

 app/test-pmd/config.c  | 22 ++
 app/test-pmd/testpmd.c | 26 ++
 app/test/test_pmd_perf.c   |  7 ++-
 drivers/net/bonding/rte_eth_bond_pmd.c |  7 +--
 drivers/net/cxgbe/cxgbe_ethdev.c   | 10 +++---
 drivers/net/e1000/em_ethdev.c  | 12 ++--
 drivers/net/e1000/igb_ethdev.c | 12 ++--
 drivers/net/i40e/i40e_ethdev.c |  9 -
 drivers/net/ixgbe/ixgbe_ethdev.c   |  1 -
 lib/librte_eal/common/include/rte_common.h |  3 +++
 lib/librte_ether/rte_ethdev.h  | 19 +--
 11 files changed, 30 insertions(+), 98 deletions(-)

-- 
2.1.4



[dpdk-dev] Kлueнmскиe бaзы Tел\Вaцaп\Вaйбeр +79I3з9I3837

2015-11-05 Thread Kлиенmсkиe базы ТeлBацaпBaйбeр +79IЗ39IЗ8з7
K?cku? ?a?? ?e?\Ba???\?a???p +79I??91?837


[dpdk-dev] [PATCH v4 3/3] example: add keep alive sample application

2015-11-05 Thread Tahhan, Maryam
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Remy Horton
> Sent: Thursday, November 5, 2015 11:33 AM
> To: dev at dpdk.org
> Subject: [dpdk-dev] [PATCH v4 3/3] example: add keep alive sample application
> 
> Modified version of l2fwd to demonstrate keep-alive functionality.
> 
> Signed-off-by: Remy Horton 
> ---

Acked-by: Maryam Tahhan 


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

2015-11-05 Thread Tahhan, Maryam
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Remy Horton
> Sent: Thursday, November 5, 2015 11:33 AM
> To: dev at dpdk.org
> Subject: [dpdk-dev] [PATCH v4 1/3] rte: add keep alive functionality
> 
> Adds functions for detecting and reporting the live-ness of LCores, the 
> primary
> requirement of which is minimal overheads for the
> core(s) being checked. Core failures are notified via an application defined
> callback.
> 
> Signed-off-by: Remy Horton 
> ---

Acked-by: Maryam Tahhan 


[dpdk-dev] [PATCH v4 2/3] docs: add keep alive sample app guide & release notes

2015-11-05 Thread Van Haaren, Harry
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Remy Horton
> Subject: [dpdk-dev] [PATCH v4 2/3] docs: add keep alive sample app guide & 
> release notes
> 
> Signed-off-by: Maryam Tahhan 
> Signed-off-by: John J Browne 
> Signed-off-by: Remy Horton 

Acked-by: Harry van Haaren 


[dpdk-dev] [PATCH v4 0/7] add sample ptp slave application

2015-11-05 Thread Thomas Monjalon
2015-11-05 12:46, Mcnamara, John:
> Why is this patchset marked as "Deferred"?
> 
> http://dpdk.org/dev/patchwork/project/dpdk/list/?state=10

Because it is too late to integrate new networking features in 2.2
(except for packet framework).
It will be welcome in the 2.3 timeframe starting in December.


[dpdk-dev] [PATCH 2/5] e1000: use rte_eth_dma_zone_reserve

2015-11-05 Thread Stephen Hemminger
Use common code to handle Xen support at runtime.

Signed-off-by: Stephen Hemminger 
---
 drivers/net/e1000/em_rxtx.c  | 40 ++--
 drivers/net/e1000/igb_rxtx.c | 40 ++--
 2 files changed, 12 insertions(+), 68 deletions(-)

diff --git a/drivers/net/e1000/em_rxtx.c b/drivers/net/e1000/em_rxtx.c
index 03e1bc2..d8fb252 100644
--- a/drivers/net/e1000/em_rxtx.c
+++ b/drivers/net/e1000/em_rxtx.c
@@ -1084,28 +1084,6 @@ eth_em_recv_scattered_pkts(void *rx_queue, struct 
rte_mbuf **rx_pkts,
 #defineEM_MAX_BUF_SIZE 16384
 #define EM_RCTL_FLXBUF_STEP 1024

-static const struct rte_memzone *
-ring_dma_zone_reserve(struct rte_eth_dev *dev, const char *ring_name,
-   uint16_t queue_id, uint32_t ring_size, int socket_id)
-{
-   const struct rte_memzone *mz;
-   char z_name[RTE_MEMZONE_NAMESIZE];
-
-   snprintf(z_name, sizeof(z_name), "%s_%s_%d_%d",
-   dev->driver->pci_drv.name, ring_name, dev->data->port_id,
-   queue_id);
-
-   if ((mz = rte_memzone_lookup(z_name)) != 0)
-   return (mz);
-
-#ifdef RTE_LIBRTE_XEN_DOM0
-   return rte_memzone_reserve_bounded(z_name, ring_size,
-   socket_id, 0, RTE_CACHE_LINE_SIZE, RTE_PGSIZE_2M);
-#else
-   return rte_memzone_reserve(z_name, ring_size, socket_id, 0);
-#endif
-}
-
 static void
 em_tx_queue_release_mbufs(struct em_tx_queue *txq)
 {
@@ -1253,8 +1231,9 @@ eth_em_tx_queue_setup(struct rte_eth_dev *dev,
 * resizing in later calls to the queue setup function.
 */
tsize = sizeof(txq->tx_ring[0]) * E1000_MAX_RING_DESC;
-   if ((tz = ring_dma_zone_reserve(dev, "tx_ring", queue_idx, tsize,
-   socket_id)) == NULL)
+   tz = rte_eth_dma_zone_reserve(dev, "tx_ring", queue_idx, tsize,
+ RTE_CACHE_LINE_SIZE, socket_id);
+   if (tz == NULL)
return (-ENOMEM);

/* Allocate the tx queue data structure. */
@@ -1280,11 +1259,7 @@ eth_em_tx_queue_setup(struct rte_eth_dev *dev,
txq->port_id = dev->data->port_id;

txq->tdt_reg_addr = E1000_PCI_REG_ADDR(hw, E1000_TDT(queue_idx));
-#ifndef RTE_LIBRTE_XEN_DOM0
-   txq->tx_ring_phys_addr = (uint64_t) tz->phys_addr;
-#else
txq->tx_ring_phys_addr = rte_mem_phy2mch(tz->memseg_id, tz->phys_addr);
-#endif
txq->tx_ring = (struct e1000_data_desc *) tz->addr;

PMD_INIT_LOG(DEBUG, "sw_ring=%p hw_ring=%p dma_addr=0x%"PRIx64,
@@ -1380,8 +1355,9 @@ eth_em_rx_queue_setup(struct rte_eth_dev *dev,

/* Allocate RX ring for max possible mumber of hardware descriptors. */
rsize = sizeof(rxq->rx_ring[0]) * E1000_MAX_RING_DESC;
-   if ((rz = ring_dma_zone_reserve(dev, "rx_ring", queue_idx, rsize,
-   socket_id)) == NULL)
+   rz = rte_eth_dma_zone_reserve(dev, "rx_ring", queue_idx, rsize,
+ RTE_CACHE_LINE_SIZE, socket_id);
+   if (rz == NULL)
return (-ENOMEM);

/* Allocate the RX queue data structure. */
@@ -1410,11 +1386,7 @@ eth_em_rx_queue_setup(struct rte_eth_dev *dev,

rxq->rdt_reg_addr = E1000_PCI_REG_ADDR(hw, E1000_RDT(queue_idx));
rxq->rdh_reg_addr = E1000_PCI_REG_ADDR(hw, E1000_RDH(queue_idx));
-#ifndef RTE_LIBRTE_XEN_DOM0
-   rxq->rx_ring_phys_addr = (uint64_t) rz->phys_addr;
-#else
rxq->rx_ring_phys_addr = rte_mem_phy2mch(rz->memseg_id, rz->phys_addr);
-#endif
rxq->rx_ring = (struct e1000_rx_desc *) rz->addr;

PMD_INIT_LOG(DEBUG, "sw_ring=%p hw_ring=%p dma_addr=0x%"PRIx64,
diff --git a/drivers/net/e1000/igb_rxtx.c b/drivers/net/e1000/igb_rxtx.c
index 384e4f1..996e7da 100644
--- a/drivers/net/e1000/igb_rxtx.c
+++ b/drivers/net/e1000/igb_rxtx.c
@@ -1209,28 +1209,6 @@ eth_igb_recv_scattered_pkts(void *rx_queue, struct 
rte_mbuf **rx_pkts,
  * desscriptors should meet the following condition:
  *  (num_ring_desc * sizeof(struct e1000_rx/tx_desc)) % 128 == 0
  */
-static const struct rte_memzone *
-ring_dma_zone_reserve(struct rte_eth_dev *dev, const char *ring_name,
- uint16_t queue_id, uint32_t ring_size, int socket_id)
-{
-   char z_name[RTE_MEMZONE_NAMESIZE];
-   const struct rte_memzone *mz;
-
-   snprintf(z_name, sizeof(z_name), "%s_%s_%d_%d",
-   dev->driver->pci_drv.name, ring_name,
-   dev->data->port_id, queue_id);
-   mz = rte_memzone_lookup(z_name);
-   if (mz)
-   return mz;
-
-#ifdef RTE_LIBRTE_XEN_DOM0
-   return rte_memzone_reserve_bounded(z_name, ring_size,
-   socket_id, 0, E1000_ALIGN, RTE_PGSIZE_2M);
-#else
-   return rte_memzone_reserve_aligned(z_name, ring_size,
-   socket_id, 0, E1000_ALIGN);
-#endif
-}

 static void
 igb_tx_queue_release_mbufs(struct igb_tx_queue *txq)
@@ -1365,8 +1343,8 @@ 

[dpdk-dev] [PATCH 1/5] xen: allow determining DOM0 at runtime

2015-11-05 Thread Stephen Hemminger
Add memory infrastructure for runtime Xen DOM0 support.

Signed-off-by: Stephen Hemminger 
Acked-by: Jijiang Liu 

---
 lib/librte_eal/common/include/rte_memory.h   | 30 -
 lib/librte_eal/linuxapp/eal/eal_memory.c |  7 
 lib/librte_eal/linuxapp/eal/eal_xen_memory.c |  2 +-
 lib/librte_ether/rte_ethdev.c| 24 ++
 lib/librte_ether/rte_ethdev.h| 24 ++
 lib/librte_mempool/rte_mempool.c | 48 
 lib/librte_mempool/rte_mempool.h |  3 +-
 7 files changed, 120 insertions(+), 18 deletions(-)

diff --git a/lib/librte_eal/common/include/rte_memory.h 
b/lib/librte_eal/common/include/rte_memory.h
index 1bed415..067be10 100644
--- a/lib/librte_eal/common/include/rte_memory.h
+++ b/lib/librte_eal/common/include/rte_memory.h
@@ -52,6 +52,8 @@
 extern "C" {
 #endif

+#include 
+
 enum rte_page_sizes {
RTE_PGSIZE_4K= 1ULL << 12,
RTE_PGSIZE_64K   = 1ULL << 16,
@@ -180,6 +182,13 @@ unsigned rte_memory_get_nchannel(void);
 unsigned rte_memory_get_nrank(void);

 #ifdef RTE_LIBRTE_XEN_DOM0
+
+/**< Internal use only - should DOM0 memory mapping be used */
+extern int is_xen_dom0_supported(void);
+
+/**< Internal use only - phys to virt mapping for xen */
+phys_addr_t rte_xen_mem_phy2mch(uint32_t, const phys_addr_t);
+
 /**
  * Return the physical address of elt, which is an element of the pool mp.
  *
@@ -191,7 +200,14 @@ unsigned rte_memory_get_nrank(void);
  * @return
  *   The physical address or error.
  */
-phys_addr_t rte_mem_phy2mch(uint32_t memseg_id, const phys_addr_t phy_addr);
+static inline phys_addr_t
+rte_mem_phy2mch(uint32_t memseg_id, const phys_addr_t phy_addr)
+{
+   if (is_xen_dom0_supported())
+   return rte_xen_mem_phy2mch(memseg_id, phy_addr);
+   else
+   return phy_addr;
+}

 /**
  * Memory init for supporting application running on Xen domain0.
@@ -214,7 +230,19 @@ int rte_xen_dom0_memory_init(void);
  *   negative: error
  */
 int rte_xen_dom0_memory_attach(void);
+#else
+static inline int is_xen_dom0_supported(void)
+{
+   return 0;
+}
+
+static inline phys_addr_t
+rte_mem_phy2mch(uint32_t memseg_id __rte_unused, const phys_addr_t phy_addr)
+{
+   return phy_addr;
+}
 #endif
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c 
b/lib/librte_eal/linuxapp/eal/eal_memory.c
index 657d19f..0de75cd 100644
--- a/lib/librte_eal/linuxapp/eal/eal_memory.c
+++ b/lib/librte_eal/linuxapp/eal/eal_memory.c
@@ -97,6 +97,13 @@
 #include "eal_filesystem.h"
 #include "eal_hugepages.h"

+#ifdef RTE_LIBRTE_XEN_DOM0
+int is_xen_dom0_supported(void)
+{
+   return internal_config.xen_dom0_support;
+}
+#endif
+
 /**
  * @file
  * Huge page mapping under linux
diff --git a/lib/librte_eal/linuxapp/eal/eal_xen_memory.c 
b/lib/librte_eal/linuxapp/eal/eal_xen_memory.c
index d228a9d..7fd9e83 100644
--- a/lib/librte_eal/linuxapp/eal/eal_xen_memory.c
+++ b/lib/librte_eal/linuxapp/eal/eal_xen_memory.c
@@ -156,7 +156,7 @@ get_xen_memory_size(void)
  * Based on physical address to caculate MFN in Xen Dom0.
  */
 phys_addr_t
-rte_mem_phy2mch(uint32_t memseg_id, const phys_addr_t phy_addr)
+rte_xen_mem_phy2mch(uint32_t memseg_id, const phys_addr_t phy_addr)
 {
int mfn_id;
uint64_t mfn, mfn_offset;
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index e0e1dca..756e894 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -2699,6 +2699,30 @@ rte_eth_dev_rx_intr_ctl(uint8_t port_id, int epfd, int 
op, void *data)

return 0;
 }
+ 
+const struct rte_memzone *
+rte_eth_dma_zone_reserve(const struct rte_eth_dev *dev, const char *ring_name,
+uint16_t queue_id, size_t size, unsigned align,
+int socket_id)
+{
+   char z_name[RTE_MEMZONE_NAMESIZE];
+   const struct rte_memzone *mz;
+
+   snprintf(z_name, sizeof(z_name), "%s_%s_%d_%d",
+dev->driver->pci_drv.name, ring_name,
+dev->data->port_id, queue_id);
+
+   mz = rte_memzone_lookup(z_name);
+   if (mz)
+   return mz;
+
+   if (is_xen_dom0_supported())
+   return rte_memzone_reserve_bounded(z_name, size, socket_id,
+  0, align, RTE_PGSIZE_2M);
+   else
+   return rte_memzone_reserve_aligned(z_name, size, socket_id,
+  0, align);
+}

 int
 rte_eth_dev_rx_intr_ctl_q(uint8_t port_id, uint16_t queue_id,
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 48a540d..785f482 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -3768,6 +3768,30 @@ extern int rte_eth_timesync_read_tx_timestamp(uint8_t 
port_id,
 extern void rte_eth_copy_pci_info(struct rte_eth_dev *eth_dev, struct 
rte_pci_device *pci_dev);



[dpdk-dev] [PATCH v3 0/5] Xen DOM0 runtime support

2015-11-05 Thread Stephen Hemminger
Rebase of patches to current Intel drivers in DPDK 2.2-rc1

Stephen Hemminger (5):
  xen: allow determining DOM0 at runtime
  e1000: use rte_eth_dma_zone_reserve
  ixgbe: use rte_eth_dma_zone_reserve
  i40e: use rte_eth_dma_zone_reserve
  fm10k: use rte_eth_dma_zone_reserve

 drivers/net/e1000/em_rxtx.c  | 40 ++--
 drivers/net/e1000/igb_rxtx.c | 40 ++--
 drivers/net/fm10k/fm10k_ethdev.c | 48 ++
 drivers/net/i40e/i40e_ethdev.c   |  9 ---
 drivers/net/i40e/i40e_fdir.c |  5 +-
 drivers/net/i40e/i40e_rxtx.c | 93 +---
 drivers/net/ixgbe/ixgbe_rxtx.c   | 47 ++
 lib/librte_eal/common/include/rte_memory.h   | 30 -
 lib/librte_eal/linuxapp/eal/eal_memory.c |  7 +++
 lib/librte_eal/linuxapp/eal/eal_xen_memory.c |  2 +-
 lib/librte_ether/rte_ethdev.c| 24 +++
 lib/librte_ether/rte_ethdev.h| 24 +++
 lib/librte_mempool/rte_mempool.c | 48 +-
 lib/librte_mempool/rte_mempool.h |  3 +-
 14 files changed, 162 insertions(+), 258 deletions(-)

-- 
2.1.4



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

2015-11-05 Thread Adrien Mazarguil
On Wed, Nov 04, 2015 at 10:39:57AM -0800, Stephen Hemminger wrote:
> On Wed, 4 Nov 2015 11:24:18 +0100
> Adrien Mazarguil  wrote:
> 
> > On Wed, Nov 04, 2015 at 02:19:36AM +0100, Thomas Monjalon wrote:
> > > 2015-11-03 12:00, Bruce Richardson:
> > > > Move the function ptr and port id checking macros to the header file, so
> > > > that they can be used in the static inline functions there. In doxygen
> > > > comments, mark them as for internal use only.
> > > [...]
> > > > +/**
> > > > + * @internal
> > > > + *  Macro to print a message if in debugging mode
> > > > + */
> > > > +#ifdef RTE_LIBRTE_ETHDEV_DEBUG
> > > > +#define RTE_PMD_DEBUG_TRACE(fmt, args...) \
> > > > +   RTE_LOG(ERR, PMD, "%s: " fmt, __func__, ## args)
> > > > +#else
> > > > +#define RTE_PMD_DEBUG_TRACE(fmt, args...)
> > > > +#endif
> > > 
> > > It does not compile because Mellanox drivers are pedantic:
> > > 
> > > In file included from 
> > > /home/thomas/projects/dpdk/dpdk/drivers/net/mlx4/mlx4.c:78:0:
> > > /home/thomas/projects/dpdk/dpdk/x86_64-native-linuxapp-gcc-shared-next/include/rte_ethdev.h:
> > >  At top level:
> > > /home/thomas/projects/dpdk/dpdk/x86_64-native-linuxapp-gcc-shared-next/include/rte_ethdev.h:933:38:
> > >  error: ISO C does not permit named variadic macros 
> > > [-Werror=variadic-macros]
> > >  #define RTE_PMD_DEBUG_TRACE(fmt, args...) \
> > 
> > I suggest something like the following definitions as a pedantic-proof and
> > standard compliant method (one drawback being that it cannot be done with a
> > single macro), see PMD_DRV_LOG() in drivers/net/mlx5/mlx5_utils.h which also
> > automatically appends a line feed:
> > 
> >  #ifdef RTE_LIBRTE_ETHDEV_DEBUG
> > 
> >  #define STRIP(a, b) a
> >  #define OPAREN (
> >  #define CPAREN )
> >  #define COMMA ,
> > 
> >  #define RTE_PMD_DEBUG_TRACE(...) \
> >  RTE_PMD_DEBUG_TRACE_(__VA_ARGS__ STRIP OPAREN, CPAREN)
> > 
> >  #define RTE_PMD_DEBUG_TRACE_(fmt, ...) \
> >  RTE_PMD_DEBUG_TRACE__(fmt COMMA __func__, __VA_ARGS__)
> > 
> >  #define RTE_PMD_DEBUG_TRACE__(...) \
> >  RTE_LOG(ERR, PMD, "%s: " __VA_ARGS__)
> > 
> >  #else /* RTE_LIBRTE_ETHDEV_DEBUG */
> > 
> >  #define RTE_PMD_DEBUG_TRACE(...)
> > 
> >  #endif /* RTE_LIBRTE_ETHDEV_DEBUG */
> > 
> > STRIP() and other helper macros are used to manage the dangling comma issue
> > when __VA_ARGS__ is empty as in the first call below:
> > 
> >  RTE_PMD_DEBUG_TRACE("foo\n");
> >  RTE_PMD_DEBUG_TRACE("foo %u\n", 42);
> 
> That solution is really ugly.

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.

> Why not do something that keeps the expected checks.

Sure but it's not the issue, we're discussing errors related to
-pedantic. I've only made the above suggestion to pass its pedantic
checks. RTE_LOG_DISABLED can be managed with these macros as well.

> diff --git a/lib/librte_eal/common/include/rte_log.h 
> b/lib/librte_eal/common/include/rte_log.h
> index ede0dca..f3a3d34 100644
> --- a/lib/librte_eal/common/include/rte_log.h
> +++ b/lib/librte_eal/common/include/rte_log.h
> @@ -99,6 +99,8 @@ extern struct rte_logs rte_logs;
>  #define RTE_LOG_INFO 7U  /**< Informational.*/
>  #define RTE_LOG_DEBUG8U  /**< Debug-level messages. */
>  
> +#define RTE_LOG_DISABLED 99U /**< Never printed  */
> +
>  /** The default log stream. */
>  extern FILE *eal_default_log_stream;
>  
> diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
> index eee1194..e431f2e 100644
> --- a/lib/librte_ether/rte_ethdev.h
> +++ b/lib/librte_ether/rte_ethdev.h
> @@ -931,6 +931,61 @@ struct rte_eth_dev_callback;
>  /** @internal Structure to keep track of registered callbacks */
>  TAILQ_HEAD(rte_eth_dev_cb_list, rte_eth_dev_callback);
>  
> +/**
> + * @internal
> + *  Macro to print a message if in debugging mode
> + */
> +#ifdef RTE_LIBRTE_ETHDEV_DEBUG
> +#define RTE_PMD_DEBUG_TRACE(fmt, args...) \
> + RTE_LOG(ERR, PMD, "%s: " fmt, __func__, ## args)
> +#else
> +#define RTE_PMD_DEBUG_TRACE(fmt, args...) \
> + RTE_LOG(DISABLED, PMD, "%s: " fmt, __func__, ## args)
> +#endif

My previous message was probably not clear enough about the reason for this
error. With -pedantic, GCC complains about these bits:

- "args..." causing "error: ISO C does not permit named variadic
  macros", as in C function you cannot put an ellipsis directly behind a
  token without a comma.

- ", ## args" for which I can't recall the error, but pasting a comma and
  args is also nonstandard, 

[dpdk-dev] [PATCH v4 0/7] add sample ptp slave application

2015-11-05 Thread Mrzyglod, DanielX T


> -Original Message-
> From: Thomas Monjalon [mailto:thomas.monjalon at 6wind.com]
> 2015-11-05 12:46, Mcnamara, John:
> > Why is this patchset marked as "Deferred"?
> >
> > http://dpdk.org/dev/patchwork/project/dpdk/list/?state=10
> 
> Because it is too late to integrate new networking features in 2.2
> (except for packet framework).
> It will be welcome in the 2.3 timeframe starting in December.

Those patches are basically fixes and supplement  to  
aee686ea17290271d62308b0f559c46e33f6364b

V1 were send on merge window.
V2 were send send at review window.
V2 were Acked but there was Konstantin's request to move common structures.
V3 was send as fast as possible.

>From my point of view it should be added to RC2.



[dpdk-dev] SR-IOV: API to tell VF from PF

2015-11-05 Thread Polehn, Mike A
I can think of a very good reason to want to know if the device is VF or PF. 

The VF has to go through a layer 2 switch, not allowing it to just receive 
anything coming across the Ehternet.

The PF can receive all the packets, including packets with different NIC 
addresses. This allow the packets to be just data and allows the processing of 
data without needing to be adjusting each NIC L2 address before sending through 
to the Ehternet. So data can be moved through a series of NICs between systems 
without the extra processing. Not doing unnecessary  processing leaves more 
clock cycles to do high value processing.

Mike

-Original Message-
From: dev [mailto:dev-boun...@dpdk.org] On Behalf Of Bruce Richardson
Sent: Thursday, November 5, 2015 1:51 AM
To: Shaham Fridenberg
Cc: dev at dpdk.org
Subject: Re: [dpdk-dev] SR-IOV: API to tell VF from PF

On Thu, Nov 05, 2015 at 09:39:19AM +, Shaham Fridenberg wrote:
> Hey all,
> 
> Is there some API to tell VF from PF?
> 
> Only way I found so far is deducing that from driver name in the 
> rte_eth_devices struct.
> 
> Thanks,
> Shaham

Hi Shaham,

yes, checking the driver name is probably the only way to do so. However, why 
do you need or want to know this? If you want to know the capabilities of a 
device basing it on a list of known device types is probably not the best way.

Regards,
/Bruce


[dpdk-dev] [PATCH v6 0/7] support for netronome nfp-6xxx card

2015-11-05 Thread Stephen Hemminger
On Thu, 05 Nov 2015 11:59:59 +0100
Vincent JARDIN  wrote:

> 
> On 05/11/2015 11:43, Alejandro.Lucero wrote:
> > From: "Alejandro.Lucero" 
> >
> > This patchset adds a new PMD for Netronome nfp-6xxx card.
> > Just PCI Virtual Functions supported.
> > Using this PMD requires previous Netronome BSP installation.
> >
> 
> I understand that this PMD needs a kernel driver which is not upstream 
> yet. Am I correct?
>  
> https://git.kernel.org/cgit/linux/kernel/git/davem/net-next.git/tree/drivers/net/ethernet
> 
> 
> Best regards,
>Vincent
> 

Does this driver work with VFIO?


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

2015-11-05 Thread Bruce Richardson
On Thu, Nov 05, 2015 at 04:09:18PM +0100, Adrien Mazarguil wrote:
> On Wed, Nov 04, 2015 at 10:39:57AM -0800, Stephen Hemminger wrote:
> > On Wed, 4 Nov 2015 11:24:18 +0100
> > Adrien Mazarguil  wrote:
> > 
> > > On Wed, Nov 04, 2015 at 02:19:36AM +0100, Thomas Monjalon wrote:
> > > > 2015-11-03 12:00, Bruce Richardson:
> > > > > Move the function ptr and port id checking macros to the header file, 
> > > > > so
> > > > > that they can be used in the static inline functions there. In doxygen
> > > > > comments, mark them as for internal use only.
> > > > [...]
> > > > > +/**
> > > > > + * @internal
> > > > > + *  Macro to print a message if in debugging mode
> > > > > + */
> > > > > +#ifdef RTE_LIBRTE_ETHDEV_DEBUG
> > > > > +#define RTE_PMD_DEBUG_TRACE(fmt, args...) \
> > > > > + RTE_LOG(ERR, PMD, "%s: " fmt, __func__, ## args)
> > > > > +#else
> > > > > +#define RTE_PMD_DEBUG_TRACE(fmt, args...)
> > > > > +#endif
> > > > 
> > > > It does not compile because Mellanox drivers are pedantic:
> > > > 
> > > > In file included from 
> > > > /home/thomas/projects/dpdk/dpdk/drivers/net/mlx4/mlx4.c:78:0:
> > > > /home/thomas/projects/dpdk/dpdk/x86_64-native-linuxapp-gcc-shared-next/include/rte_ethdev.h:
> > > >  At top level:
> > > > /home/thomas/projects/dpdk/dpdk/x86_64-native-linuxapp-gcc-shared-next/include/rte_ethdev.h:933:38:
> > > >  error: ISO C does not permit named variadic macros 
> > > > [-Werror=variadic-macros]
> > > >  #define RTE_PMD_DEBUG_TRACE(fmt, args...) \
> > > 
> > > I suggest something like the following definitions as a pedantic-proof and
> > > standard compliant method (one drawback being that it cannot be done with 
> > > a
> > > single macro), see PMD_DRV_LOG() in drivers/net/mlx5/mlx5_utils.h which 
> > > also
> > > automatically appends a line feed:
> > > 
> > >  #ifdef RTE_LIBRTE_ETHDEV_DEBUG
> > > 
> > >  #define STRIP(a, b) a
> > >  #define OPAREN (
> > >  #define CPAREN )
> > >  #define COMMA ,
> > > 
> > >  #define RTE_PMD_DEBUG_TRACE(...) \
> > >  RTE_PMD_DEBUG_TRACE_(__VA_ARGS__ STRIP OPAREN, CPAREN)
> > > 
> > >  #define RTE_PMD_DEBUG_TRACE_(fmt, ...) \
> > >  RTE_PMD_DEBUG_TRACE__(fmt COMMA __func__, __VA_ARGS__)
> > > 
> > >  #define RTE_PMD_DEBUG_TRACE__(...) \
> > >  RTE_LOG(ERR, PMD, "%s: " __VA_ARGS__)
> > > 
> > >  #else /* RTE_LIBRTE_ETHDEV_DEBUG */
> > > 
> > >  #define RTE_PMD_DEBUG_TRACE(...)
> > > 
> > >  #endif /* RTE_LIBRTE_ETHDEV_DEBUG */
> > > 
> > > STRIP() and other helper macros are used to manage the dangling comma 
> > > issue
> > > when __VA_ARGS__ is empty as in the first call below:
> > > 
> > >  RTE_PMD_DEBUG_TRACE("foo\n");
> > >  RTE_PMD_DEBUG_TRACE("foo %u\n", 42);
> > 
> > That solution is really ugly.
> 
> 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.
> 

+1 to this. I was planning to seeing if a static inline could help here, but
haven't had the chance to try it yet.

> > Why not do something that keeps the expected checks.
> 
> Sure but it's not the issue, we're discussing errors related to
> -pedantic. I've only made the above suggestion to pass its pedantic
> checks. RTE_LOG_DISABLED can be managed with these macros as well.
> 
> > diff --git a/lib/librte_eal/common/include/rte_log.h 
> > b/lib/librte_eal/common/include/rte_log.h
> > index ede0dca..f3a3d34 100644
> > --- a/lib/librte_eal/common/include/rte_log.h
> > +++ b/lib/librte_eal/common/include/rte_log.h
> > @@ -99,6 +99,8 @@ extern struct rte_logs rte_logs;
> >  #define RTE_LOG_INFO 7U  /**< Informational.*/
> >  #define RTE_LOG_DEBUG8U  /**< Debug-level messages. */
> >  
> > +#define RTE_LOG_DISABLED 99U /**< Never printed*/
> > +
> >  /** The default log stream. */
> >  extern FILE *eal_default_log_stream;
> >  
> > diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
> > index eee1194..e431f2e 100644
> > --- a/lib/librte_ether/rte_ethdev.h
> > +++ b/lib/librte_ether/rte_ethdev.h
> > @@ -931,6 +931,61 @@ struct rte_eth_dev_callback;
> >  /** @internal Structure to keep track of registered callbacks */
> >  TAILQ_HEAD(rte_eth_dev_cb_list, rte_eth_dev_callback);
> >  
> > +/**
> > + * @internal
> > + *  Macro to print a message if in debugging mode
> > + */
> > +#ifdef RTE_LIBRTE_ETHDEV_DEBUG
> > +#define RTE_PMD_DEBUG_TRACE(fmt, args...) \
> > +   RTE_LOG(ERR, PMD, "%s: " fmt, __func__, ## args)
> > +#else
> > +#define RTE_PMD_DEBUG_TRACE(fmt, args...) \
> > +   RTE_LOG(DISABLED, PMD, "%s: " fmt, 

[dpdk-dev] [PATCH v5 7/7] doc: add a PTPCLIENT sample guide

2015-11-05 Thread Daniel Mrzyglod
It includes:
 - Add the ptpclient picture with svg format.
 - Add the ptpclient.rst file
 - Change the index.rst file for the above pictures index.

Signed-off-by: Daniel Mrzyglod 
---
 doc/guides/sample_app_ug/img/ptpclient.svg | 520 +
 doc/guides/sample_app_ug/index.rst |   3 +
 doc/guides/sample_app_ug/ptpclient.rst | 306 +
 3 files changed, 829 insertions(+)
 create mode 100644 doc/guides/sample_app_ug/img/ptpclient.svg
 create mode 100644 doc/guides/sample_app_ug/ptpclient.rst

diff --git a/doc/guides/sample_app_ug/img/ptpclient.svg 
b/doc/guides/sample_app_ug/img/ptpclient.svg
new file mode 100644
index 000..55c134e
--- /dev/null
+++ b/doc/guides/sample_app_ug/img/ptpclient.svg
@@ -0,0 +1,520 @@
+
+
+
+http://purl.org/dc/elements/1.1/;
+   xmlns:cc="http://creativecommons.org/ns#;
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#;
+   xmlns:svg="http://www.w3.org/2000/svg;
+   xmlns="http://www.w3.org/2000/svg;
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd;
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape;
+   width="105mm"
+   height="148mm"
+   viewBox="0 0 372.04724 524.40945"
+   id="svg2"
+   version="1.1"
+   inkscape:version="0.91 r13725"
+   sodipodi:docname="drawing3.svg">
+  
+
+  
+
+
+  
+
+
+  
+
+
+  
+
+
+  
+
+
+  
+
+
+  
+
+
+  
+
+
+  
+
+
+  
+
+
+  
+
+
+  
+
+
+  
+
+
+  
+
+
+  
+
+
+  
+
+
+  
+
+
+
+
+
+
+
+
+  
+  
+  
+
+  
+image/svg+xml
+http://purl.org/dc/dcmitype/StillImage; />
+
+  
+
+  
+  
+
+
+
+
+T2
+FOLLOW UP:T1
+
+DELAY REQUEST
+T3
+T4
+T1
+
+DELAY RESPONSE:T4
+time
+
+master
+
+slave
+SYNC
+  
+
diff --git a/doc/guides/sample_app_ug/index.rst 
b/doc/guides/sample_app_ug/index.rst
index 9beedd9..8ae86c0 100644
--- a/doc/guides/sample_app_ug/index.rst
+++ b/doc/guides/sample_app_ug/index.rst
@@ -73,6 +73,7 @@ Sample Applications User Guide
 vm_power_management
 tep_termination
 proc_info
+ptpclient

 **Figures**

@@ -136,6 +137,8 @@ Sample Applications User Guide
 :numref:`figure_overlay_networking` :ref:`figure_overlay_networking`
 :numref:`figure_tep_termination_arch` :ref:`figure_tep_termination_arch`

+:numref:`figure_ptpclient_highlevel` :ref:`figure_ptpclient_highlevel`
+
 **Tables**

 :numref:`table_qos_metering_1` :ref:`table_qos_metering_1`
diff --git a/doc/guides/sample_app_ug/ptpclient.rst 
b/doc/guides/sample_app_ug/ptpclient.rst
new file mode 100644
index 000..6e425b7
--- /dev/null
+++ b/doc/guides/sample_app_ug/ptpclient.rst
@@ -0,0 +1,306 @@
+..  BSD LICENSE
+Copyright(c) 2015 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.
+
+
+PTP Client Sample Application
+=
+
+The PTP (Precision Time Protocol) client sample application is a simple
+example of using the DPDK IEEE1588 API to communicate with a PTP master clock
+to synchronize the time on the NIC and, optionally, on the Linux system.
+
+Note, PTP is a time syncing protocol and cannot be used within DPDK as a
+time-stamping mechanism. See the following for an explanation 

[dpdk-dev] [PATCH v5 6/7] example: PTP client slave minimal implementation

2015-11-05 Thread Daniel Mrzyglod
Add a sample application that acts as a PTP slave using the
DPDK ieee1588 functions.

Signed-off-by: Daniel Mrzyglod 
---
 MAINTAINERS  |   3 +
 doc/guides/rel_notes/release_2_2.rst |   5 +
 examples/Makefile|   1 +
 examples/ptpclient/Makefile  |  56 +++
 examples/ptpclient/ptpclient.c   | 779 +++
 5 files changed, 844 insertions(+)
 create mode 100644 examples/ptpclient/Makefile
 create mode 100644 examples/ptpclient/ptpclient.c

diff --git a/MAINTAINERS b/MAINTAINERS
index c8be5d2..0638665 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -520,3 +520,6 @@ F: examples/tep_termination/
 F: examples/vmdq/
 F: examples/vmdq_dcb/
 F: doc/guides/sample_app_ug/vmdq_dcb_forwarding.rst
+
+M: Daniel Mrzyglod 
+F: examples/ptpclient
diff --git a/doc/guides/rel_notes/release_2_2.rst 
b/doc/guides/rel_notes/release_2_2.rst
index 17b281c..1bfbdd2 100644
--- a/doc/guides/rel_notes/release_2_2.rst
+++ b/doc/guides/rel_notes/release_2_2.rst
@@ -94,6 +94,11 @@ New Features

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

+* **ptpclient: simple PTP slave client.**
+
+  Add a sample application that acts as a PTP slave using the
+  DPDK ieee1588 functions.
+

 Resolved Issues
 ---
diff --git a/examples/Makefile b/examples/Makefile
index b4eddbd..4672534 100644
--- a/examples/Makefile
+++ b/examples/Makefile
@@ -74,5 +74,6 @@ DIRS-$(CONFIG_RTE_LIBRTE_XEN_DOM0) += vhost_xen
 DIRS-y += vmdq
 DIRS-y += vmdq_dcb
 DIRS-$(CONFIG_RTE_LIBRTE_POWER) += vm_power_manager
+DIRS-$(CONFIG_RTE_LIBRTE_IEEE1588) += ptpclient

 include $(RTE_SDK)/mk/rte.extsubdir.mk
diff --git a/examples/ptpclient/Makefile b/examples/ptpclient/Makefile
new file mode 100644
index 000..b77cf71
--- /dev/null
+++ b/examples/ptpclient/Makefile
@@ -0,0 +1,56 @@
+#   BSD LICENSE
+#
+#   Copyright(c) 2015 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 overriddegitn by command line or environment
+RTE_TARGET ?= x86_64-native-linuxapp-gcc
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+# binary name
+APP = ptpclient
+
+# all source are stored in SRCS-y
+SRCS-y := ptpclient.c
+
+CFLAGS += -O3
+CFLAGS += $(WERROR_FLAGS)
+
+# workaround for a gcc bug with noreturn attribute
+# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12603
+ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y)
+CFLAGS_main.o += -Wno-return-type
+endif
+
+include $(RTE_SDK)/mk/rte.extapp.mk
diff --git a/examples/ptpclient/ptpclient.c b/examples/ptpclient/ptpclient.c
new file mode 100644
index 000..2a9698b
--- /dev/null
+++ b/examples/ptpclient/ptpclient.c
@@ -0,0 +1,779 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2015 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 

[dpdk-dev] [PATCH v5 5/7] i40e: add additional ieee1588 support functions

2015-11-05 Thread Daniel Mrzyglod
From: Pablo de Lara 

Add additional functions to support the existing IEEE1588
functionality and to enable getting, setting and adjusting
the device time.

Signed-off-by: Pablo de Lara 
Signed-off-by: Daniel Mrzyglod 
---
 drivers/net/i40e/i40e_ethdev.c | 196 -
 drivers/net/i40e/i40e_ethdev.h |   5 ++
 2 files changed, 181 insertions(+), 20 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index ddf3d38..98d61f9 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -125,11 +125,13 @@
(1UL << RTE_ETH_FLOW_NONFRAG_IPV6_OTHER) | \
(1UL << RTE_ETH_FLOW_L2_PAYLOAD))

-#define I40E_PTP_40GB_INCVAL  0x01ULL
-#define I40E_PTP_10GB_INCVAL  0x03ULL
-#define I40E_PTP_1GB_INCVAL   0x20ULL
-#define I40E_PRTTSYN_TSYNENA  0x8000
-#define I40E_PRTTSYN_TSYNTYPE 0x0e00
+/* Additional timesync values. */
+#define I40E_PTP_40GB_INCVAL 0x01ULL
+#define I40E_PTP_10GB_INCVAL 0x03ULL
+#define I40E_PTP_1GB_INCVAL  0x20ULL
+#define I40E_PRTTSYN_TSYNENA 0x8000
+#define I40E_PRTTSYN_TSYNTYPE0x0e00
+#define I40E_CYCLECOUNTER_MASK   0x

 #define I40E_MAX_PERCENT100
 #define I40E_DEFAULT_DCB_APP_NUM1
@@ -400,11 +402,20 @@ static int i40e_timesync_read_rx_timestamp(struct 
rte_eth_dev *dev,
 static int i40e_timesync_read_tx_timestamp(struct rte_eth_dev *dev,
   struct timespec *timestamp);
 static void i40e_read_stats_registers(struct i40e_pf *pf, struct i40e_hw *hw);
+
+static int i40e_timesync_time_adjust(struct rte_eth_dev *dev, int64_t delta);
+
+static int i40e_timesync_time_get(struct rte_eth_dev *dev,
+ struct timespec *timestamp);
+static int i40e_timesync_time_set(struct rte_eth_dev *dev,
+ struct timespec *timestamp);
+
 static int i40e_dev_rx_queue_intr_enable(struct rte_eth_dev *dev,
 uint16_t queue_id);
 static int i40e_dev_rx_queue_intr_disable(struct rte_eth_dev *dev,
  uint16_t queue_id);

+
 static const struct rte_pci_id pci_id_i40e_map[] = {
 #define RTE_PCI_DEV_ID_DECL_I40E(vend, dev) {RTE_PCI_DEVICE(vend, dev)},
 #include "rte_pci_dev_ids.h"
@@ -469,6 +480,9 @@ static const struct eth_dev_ops i40e_eth_dev_ops = {
.timesync_read_rx_timestamp   = i40e_timesync_read_rx_timestamp,
.timesync_read_tx_timestamp   = i40e_timesync_read_tx_timestamp,
.get_dcb_info = i40e_dev_get_dcb_info,
+   .timesync_time_adjust = i40e_timesync_time_adjust,
+   .timesync_time_get= i40e_timesync_time_get,
+   .timesync_time_set= i40e_timesync_time_set,
 };

 /* store statistics names and its offset in stats structure */
@@ -7738,17 +7752,95 @@ i40e_mirror_rule_reset(struct rte_eth_dev *dev, uint8_t 
sw_id)
return 0;
 }

-static int
-i40e_timesync_enable(struct rte_eth_dev *dev)
+/*
+ * Adds the new cycles (in nanoseconds) to the previous time stored.
+ */
+static uint64_t
+timecounter_cycles_to_ns_time(struct timecounter *tc, uint64_t cycle_tstamp)
+{
+   uint64_t delta = (cycle_tstamp - tc->cycle_last);
+   uint64_t nsec = tc->nsec;
+
+   nsec += delta;
+
+   return nsec;
+}
+
+static uint64_t
+i40e_read_timesync_cyclecounter(struct rte_eth_dev *dev)
 {
struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-   struct rte_eth_link *link = >data->dev_link;
-   uint32_t tsync_ctl_l;
-   uint32_t tsync_ctl_h;
+   uint64_t systim_cycles = 0;
+
+   systim_cycles |= (uint64_t)I40E_READ_REG(hw, I40E_PRTTSYN_TIME_L);
+   systim_cycles |= (uint64_t)I40E_READ_REG(hw, I40E_PRTTSYN_TIME_H)
+   << 32;
+
+   return systim_cycles;
+}
+
+static uint64_t
+timecounter_read_ns_delta(struct rte_eth_dev *dev)
+{
+   uint64_t cycle_now, cycle_delta;
+   struct i40e_adapter *adapter =
+   (struct i40e_adapter *)dev->data->dev_private;
+
+   /* Read cycle counter. */
+   cycle_now = adapter->tc.cc->read(dev);
+
+   /* Calculate the delta since the last timecounter_read_delta(). */
+   cycle_delta = (cycle_now - adapter->tc.cycle_last);
+
+   /* Update time stamp of timecounter_read_delta() call. */
+   adapter->tc.cycle_last = cycle_now;
+
+   /* Delta already in nanoseconds. */
+   return cycle_delta;
+}
+
+static uint64_t
+timecounter_read(struct rte_eth_dev *dev)
+{
+   uint64_t nsec;
+   struct i40e_adapter *adapter =
+   (struct i40e_adapter *)dev->data->dev_private;
+
+   /* Increment time by nanoseconds since last call. */
+   nsec = timecounter_read_ns_delta(dev);
+   nsec += adapter->tc.nsec;
+   adapter->tc.nsec = nsec;
+
+

[dpdk-dev] [PATCH v5 4/7] igb: add additional ieee1588 support functions

2015-11-05 Thread Daniel Mrzyglod
From: Pablo de Lara 

Add additional functions to support the existing IEEE1588
functionality and to enable getting, setting and adjusting
the device time.

Signed-off-by: Pablo de Lara 
Signed-off-by: Daniel Mrzyglod 
---
 drivers/net/e1000/e1000_ethdev.h |   3 +
 drivers/net/e1000/igb_ethdev.c   | 299 +--
 2 files changed, 292 insertions(+), 10 deletions(-)

diff --git a/drivers/net/e1000/e1000_ethdev.h b/drivers/net/e1000/e1000_ethdev.h
index a667a1a..c2b64c7 100644
--- a/drivers/net/e1000/e1000_ethdev.h
+++ b/drivers/net/e1000/e1000_ethdev.h
@@ -33,6 +33,7 @@

 #ifndef _E1000_ETHDEV_H_
 #define _E1000_ETHDEV_H_
+#include 

 /* need update link, bit flag */
 #define E1000_FLAG_NEED_LINK_UPDATE (uint32_t)(1 << 0)
@@ -257,6 +258,8 @@ struct e1000_adapter {
struct e1000_vf_info*vfdata;
struct e1000_filter_info filter;
bool stopped;
+   struct cyclecounter cc;
+   struct timecounter tc;
 };

 #define E1000_DEV_PRIVATE(adapter) \
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index 2cb115c..dcc68b5 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -78,10 +78,11 @@
 #define IGB_8_BIT_MASK   UINT8_MAX

 /* Additional timesync values. */
-#define E1000_ETQF_FILTER_1588 3
-#define E1000_TIMINCA_INCVALUE 1600
-#define E1000_TIMINCA_INIT ((0x02 << E1000_TIMINCA_16NS_SHIFT) \
-   | E1000_TIMINCA_INCVALUE)
+#define E1000_CYCLECOUNTER_MASK  0x
+#define E1000_ETQF_FILTER_1588   3
+#define IGB_82576_TSYNC_SHIFT16
+#define E1000_INCPERIOD_82576(1 << E1000_TIMINCA_16NS_SHIFT)
+#define E1000_INCVALUE_82576 (16 << IGB_82576_TSYNC_SHIFT)
 #define E1000_TSAUXC_DISABLE_SYSTIME 0x8000

 static int  eth_igb_configure(struct rte_eth_dev *dev);
@@ -236,6 +237,11 @@ static int igb_timesync_read_rx_timestamp(struct 
rte_eth_dev *dev,
  uint32_t flags);
 static int igb_timesync_read_tx_timestamp(struct rte_eth_dev *dev,
  struct timespec *timestamp);
+static int igb_timesync_time_adjust(struct rte_eth_dev *dev, int64_t delta);
+static int igb_timesync_time_get(struct rte_eth_dev *dev,
+struct timespec *timestamp);
+static int igb_timesync_time_set(struct rte_eth_dev *dev,
+struct timespec *timestamp);
 static int eth_igb_rx_queue_intr_enable(struct rte_eth_dev *dev,
uint16_t queue_id);
 static int eth_igb_rx_queue_intr_disable(struct rte_eth_dev *dev,
@@ -349,6 +355,9 @@ static const struct eth_dev_ops eth_igb_ops = {
.get_eeprom_length= eth_igb_get_eeprom_length,
.get_eeprom   = eth_igb_get_eeprom,
.set_eeprom   = eth_igb_set_eeprom,
+   .timesync_time_adjust  = igb_timesync_time_adjust,
+   .timesync_time_get = igb_timesync_time_get,
+   .timesync_time_set = igb_timesync_time_set,
 };

 /*
@@ -4182,20 +4191,248 @@ eth_igb_set_mc_addr_list(struct rte_eth_dev *dev,
return 0;
 }

+/*
+ * Register units might not be nanoseconds. This function converts
+ * these units into nanoseconds and adds to the previous time stored.
+ */
+static uint64_t
+timecounter_cycles_to_ns_time(struct timecounter *tc, uint64_t cycle_tstamp)
+{
+   uint64_t delta;
+   uint64_t nsec = tc->nsec, frac = tc->frac;
+
+   delta = (cycle_tstamp - tc->cycle_last) & tc->cc->mask;
+   /*
+* Cycle counts that are correctly converted as they
+* are between -1/2 max cycle count and +1/2 max cycle count.
+*/
+   if (delta > (tc->cc->mask / 2)) {
+   delta = (tc->cycle_last - cycle_tstamp) & tc->cc->mask;
+   nsec -= cyclecounter_cycles_to_ns_backwards(tc->cc, delta,
+   frac);
+   } else {
+   nsec += cyclecounter_cycles_to_ns(tc->cc, delta, tc->mask,
+ );
+   }
+
+   return nsec;
+}
+
+static uint64_t
+igb_read_timesync_cyclecounter(struct rte_eth_dev *dev)
+{
+   struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+   uint64_t systime_cycles = 0;
+
+   switch (hw->mac.type) {
+   case e1000_i210:
+   case e1000_i211:
+   /*
+* Need to read System Time Residue Register to be able
+* to read the other two registers.
+*/
+   E1000_READ_REG(hw, E1000_SYSTIMR);
+   /* SYSTIMEL stores ns and SYSTIMEH stores seconds. */
+   systime_cycles = (uint64_t)E1000_READ_REG(hw, E1000_SYSTIML);
+   systime_cycles += (uint64_t)E1000_READ_REG(hw, E1000_SYSTIMH)
+   * NSEC_PER_SEC;
+   break;
+   case 

[dpdk-dev] [PATCH v5 3/7] ixgbe: add additional ieee1588 support functions

2015-11-05 Thread Daniel Mrzyglod
Add additional functions to support the existing IEEE1588
functionality and to enable getting, setting and adjusting
the device time.

Signed-off-by: Daniel Mrzyglod 
Signed-off-by: Pablo de Lara 
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 272 +--
 drivers/net/ixgbe/ixgbe_ethdev.h |   3 +
 2 files changed, 264 insertions(+), 11 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 0b0bbcf..1c4300e 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -126,10 +126,17 @@
 #define IXGBE_HKEY_MAX_INDEX 10

 /* Additional timesync values. */
-#define IXGBE_TIMINCA_16NS_SHIFT 24
-#define IXGBE_TIMINCA_INCVALUE   1600
-#define IXGBE_TIMINCA_INIT   ((0x02 << IXGBE_TIMINCA_16NS_SHIFT) \
- | IXGBE_TIMINCA_INCVALUE)
+#define NSEC_PER_SEC 10L
+#define IXGBE_INCVAL_10GB0x
+#define IXGBE_INCVAL_1GB 0x4000
+#define IXGBE_INCVAL_100 0x5000
+#define IXGBE_INCVAL_SHIFT_10GB  28
+#define IXGBE_INCVAL_SHIFT_1GB   24
+#define IXGBE_INCVAL_SHIFT_100   21
+#define IXGBE_INCVAL_SHIFT_82599 7
+#define IXGBE_INCPER_SHIFT_82599 24
+
+#define IXGBE_CYCLECOUNTER_MASK   0x

 static int eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev);
 static int eth_ixgbe_dev_uninit(struct rte_eth_dev *eth_dev);
@@ -325,6 +332,11 @@ static int ixgbe_timesync_read_rx_timestamp(struct 
rte_eth_dev *dev,
uint32_t flags);
 static int ixgbe_timesync_read_tx_timestamp(struct rte_eth_dev *dev,
struct timespec *timestamp);
+static int ixgbe_timesync_time_adjust(struct rte_eth_dev *dev, int64_t delta);
+static int ixgbe_timesync_time_get(struct rte_eth_dev *dev,
+  struct timespec *timestamp);
+static int ixgbe_timesync_time_set(struct rte_eth_dev *dev,
+  struct timespec *timestamp);

 /*
  * Define VF Stats MACRO for Non "cleared on read" register
@@ -480,6 +492,9 @@ static const struct eth_dev_ops ixgbe_eth_dev_ops = {
.get_eeprom   = ixgbe_get_eeprom,
.set_eeprom   = ixgbe_set_eeprom,
.get_dcb_info = ixgbe_dev_get_dcb_info,
+   .timesync_time_adjust = ixgbe_timesync_time_adjust,
+   .timesync_time_get= ixgbe_timesync_time_get,
+   .timesync_time_set= ixgbe_timesync_time_set,
 };

 /*
@@ -5608,20 +5623,232 @@ ixgbe_dev_set_mc_addr_list(struct rte_eth_dev *dev,
 ixgbe_dev_addr_list_itr, TRUE);
 }

+/*
+ * Register units might not be nanoseconds. This function converts
+ * these units into nanoseconds and adds to the previous time stored.
+ */
+static uint64_t
+timecounter_cycles_to_ns_time(struct timecounter *tc, uint64_t cycle_tstamp)
+{
+   uint64_t delta;
+   uint64_t nsec = tc->nsec, frac = tc->frac;
+
+   delta = (cycle_tstamp - tc->cycle_last) & tc->cc->mask;
+   /*
+* Cycle counts that are correctly converted as they
+* are between -1/2 max cycle count and +1/2 max cycle count.
+*/
+   if (delta > (tc->cc->mask / 2)) {
+   delta = (tc->cycle_last - cycle_tstamp) & tc->cc->mask;
+   nsec -= cyclecounter_cycles_to_ns_backwards(tc->cc,
+   delta, frac);
+   } else {
+   nsec += cyclecounter_cycles_to_ns(tc->cc, delta, tc->mask,
+ );
+   }
+
+   return nsec;
+}
+
+static uint64_t
+ixgbe_read_timesync_cyclecounter(struct rte_eth_dev *dev)
+{
+   struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+   uint64_t systime_cycles = 0;
+
+   switch (hw->mac.type) {
+   case ixgbe_mac_X550:
+   /* SYSTIMEL stores ns and SYSTIMEH stores seconds. */
+   systime_cycles = (uint64_t)IXGBE_READ_REG(hw, IXGBE_SYSTIML);
+   systime_cycles += (uint64_t)IXGBE_READ_REG(hw, IXGBE_SYSTIMH)
+   * NSEC_PER_SEC;
+   break;
+   default:
+   systime_cycles |= (uint64_t)IXGBE_READ_REG(hw, IXGBE_SYSTIML);
+   systime_cycles |= (uint64_t)IXGBE_READ_REG(hw, IXGBE_SYSTIMH)
+   << 32;
+   }
+
+   return systime_cycles;
+}
+
+/*
+ * Get nanoseconds since the last call of this function.
+ */
+static uint64_t
+timecounter_read_ns_delta(struct rte_eth_dev *dev)
+{
+   struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+   uint64_t cycle_now, cycle_delta;
+   uint64_t ns_offset;
+   struct ixgbe_adapter *adapter =
+   (struct ixgbe_adapter *)dev->data->dev_private;
+
+   /* Read cycle counter. */
+   cycle_now = adapter->tc.cc->read(dev);
+
+   /* Calculate the delta since 

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

2015-11-05 Thread 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 +++
 2 files changed, 106 insertions(+), 1 deletion(-)
 create mode 100644 lib/librte_net/rte_ptp.h

diff --git a/lib/librte_net/Makefile b/lib/librte_net/Makefile
index ad2e482..1d33618 100644
--- a/lib/librte_net/Makefile
+++ b/lib/librte_net/Makefile
@@ -34,7 +34,7 @@ include $(RTE_SDK)/mk/rte.vars.mk
 CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3

 # install includes
-SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include := rte_ip.h rte_tcp.h rte_udp.h 
rte_sctp.h rte_icmp.h rte_arp.h
+SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include := rte_ip.h rte_tcp.h rte_udp.h 
rte_sctp.h rte_icmp.h rte_arp.h rte_ptp.h


 include $(RTE_SDK)/mk/rte.install.mk
diff --git a/lib/librte_net/rte_ptp.h b/lib/librte_net/rte_ptp.h
new file mode 100644
index 000..8a4c83c
--- /dev/null
+++ b/lib/librte_net/rte_ptp.h
@@ -0,0 +1,105 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2015 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.
+ */
+
+#define NSEC_PER_SEC 10L
+
+/*
+ * Structure for cyclecounter IEEE1588 functionality.
+ */
+struct cyclecounter {
+   uint64_t (*read)(struct rte_eth_dev *dev);
+   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;
+};
+
+
+/* Utility functions for PTP/IEEE1588 support. */
+
+static inline uint64_t
+timespec_to_ns(const struct timespec *ts)
+{
+   return ((uint64_t) ts->tv_sec * NSEC_PER_SEC) + ts->tv_nsec;
+}
+
+static inline struct timespec
+ns_to_timespec(uint64_t nsec)
+{
+   struct timespec ts = {0, 0};
+
+   if (nsec == 0)
+   return ts;
+
+   ts.tv_sec = nsec / NSEC_PER_SEC;
+   ts.tv_nsec = nsec % NSEC_PER_SEC;
+
+   return ts;
+}
+
+/*
+ * Converts cycle counter cycles to nanoseconds.
+ */
+static inline uint64_t
+cyclecounter_cycles_to_ns(const struct cyclecounter *cc,
+ uint64_t cycles, uint64_t mask, uint64_t *frac)
+{
+   uint64_t ns;
+
+   /* Add fractional nanoseconds */
+   ns = cycles + *frac;
+   *frac = ns & mask;
+
+   /* Shift to get only nanoseconds. */
+   return ns >> cc->shift;
+}
+
+/*
+ * Like cyclecounter_cycles_to_ns(), but this is used when
+ * computing a time previous to the stored in the cycle counter.
+ */
+static inline uint64_t
+cyclecounter_cycles_to_ns_backwards(const struct cyclecounter *cc,
+  uint64_t cycles, uint64_t frac)
+{
+   return ((cycles - frac) >> cc->shift);
+}
-- 
2.5.0



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

2015-11-05 Thread Daniel Mrzyglod
Add additional functions to support the existing IEEE1588
functionality.

* rte_eth_timesync_settime(), function to set the device clock time.
* rte_eth_timesync_gettime, function to get the device clock time.
* rte_eth_timesync_adjust, function to adjust the device clock time.

Signed-off-by: Daniel Mrzyglod 
---
 doc/guides/rel_notes/release_2_2.rst   |  3 ++
 lib/librte_ether/rte_ethdev.c  | 36 +++
 lib/librte_ether/rte_ethdev.h  | 65 +-
 lib/librte_ether/rte_ether_version.map |  3 ++
 4 files changed, 106 insertions(+), 1 deletion(-)

diff --git a/doc/guides/rel_notes/release_2_2.rst 
b/doc/guides/rel_notes/release_2_2.rst
index 59dda59..17b281c 100644
--- 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()
+

 ABI Changes
 ---
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index e0e1dca..20cf013 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -3193,6 +3193,42 @@ rte_eth_timesync_read_tx_timestamp(uint8_t port_id, 
struct timespec *timestamp)
 }

 int
+rte_eth_timesync_time_adjust(uint8_t port_id, int64_t delta)
+{
+   struct rte_eth_dev *dev;
+
+   VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+   dev = _eth_devices[port_id];
+
+   FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_time_adjust, -ENOTSUP);
+   return (*dev->dev_ops->timesync_time_adjust)(dev, delta);
+}
+
+int
+rte_eth_timesync_time_get(uint8_t port_id, struct timespec *timestamp)
+{
+   struct rte_eth_dev *dev;
+
+   VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+   dev = _eth_devices[port_id];
+
+   FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_time_get, -ENOTSUP);
+   return (*dev->dev_ops->timesync_time_get)(dev, timestamp);
+}
+
+int
+rte_eth_timesync_time_set(uint8_t port_id, struct timespec *timestamp)
+{
+   struct rte_eth_dev *dev;
+
+   VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+   dev = _eth_devices[port_id];
+
+   FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_time_set, -ENOTSUP);
+   return (*dev->dev_ops->timesync_time_set)(dev, timestamp);
+}
+
+int
 rte_eth_dev_get_reg_length(uint8_t port_id)
 {
struct rte_eth_dev *dev;
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 48a540d..585d980 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -1206,6 +1206,17 @@ typedef int (*eth_timesync_read_tx_timestamp_t)(struct 
rte_eth_dev *dev,
struct timespec *timestamp);
 /**< @internal Function used to read a TX IEEE1588/802.1AS timestamp. */

+typedef int (*eth_timesync_time_adjust)(struct rte_eth_dev *dev, int64_t);
+/**< @internal Function used to adjust device clock */
+
+typedef int (*eth_timesync_time_get)(struct rte_eth_dev *dev,
+   struct timespec *timestamp);
+/**< @internal Function used to get time from device clock. */
+
+typedef int (*eth_timesync_time_set)(struct rte_eth_dev *dev,
+   struct timespec *timestamp);
+/**< @internal Function used to get time from device clock */
+
 typedef int (*eth_get_reg_length_t)(struct rte_eth_dev *dev);
 /**< @internal Retrieve device register count  */

@@ -1400,6 +1411,12 @@ struct eth_dev_ops {

/** Get DCB information */
eth_get_dcb_info get_dcb_info;
+   /** Adjust the device clock */
+   eth_timesync_time_adjust timesync_time_adjust;
+   /** Get the device clock timespec */
+   eth_timesync_time_get timesync_time_get;
+   /** Set the device clock timespec */
+   eth_timesync_time_set timesync_time_set;
 };

 /**
@@ -3755,6 +3772,53 @@ extern int rte_eth_timesync_read_tx_timestamp(uint8_t 
port_id,
  struct timespec *timestamp);

 /**
+ * Adjust the timesync clock on an Ethernet device..
+ *
+ * @param port_id
+ *   The port identifier of the Ethernet device.
+ * @param delta
+ *   The adjustment in nanoseconds
+ *
+ * @return
+ *   - 0: Success.
+ *   - -ENODEV: The port ID is invalid.
+ *   - -ENOTSUP: The function is not supported by the Ethernet driver.
+ */
+extern int rte_eth_timesync_time_adjust(uint8_t port_id, int64_t delta);
+
+/**
+ * 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);
+
+
+/**
+ * Set the time of the timesync clock on an Ethernet device.
+ *
+ * 

[dpdk-dev] [PATCH v5 0/7] add sample ptp slave application

2015-11-05 Thread Daniel Mrzyglod
Add a sample application that acts as a PTP slave using the DPDK IEEE1588
functions.

Also add some additional IEEE1588 support functions to enable getting,
setting and adjusting the device time.

V4->v5:
 - rebase to the current master

V3->V4:
Doc:
 - Update documentation for ptpclient
 - fix: put information about ptpaplication in correct place

V2->V3:
PMD:
 - move common structures and functions for PTP protocol to librte_net/rte_ptp.h

V1->V2:
PMDs:
 - add support for e1000
 - add support for ixgbe
 - add support for i40
ethdev:
 - change function names to more proper
Doc:
 - add documentation for ptpclient
sample:
 - add kernel adjustment option
 - add portmask option to provide portmask to aplication
Daniel Mrzyglod (5):
  ethdev: add additional ieee1588 support functions
  net: Add common PTP structures and functions
  ixgbe: add additional ieee1588 support functions
  example: PTP client slave minimal implementation
  doc: add a PTPCLIENT sample guide

Pablo de Lara (2):
  igb: add additional ieee1588 support functions
  i40e: add additional ieee1588 support functions

 MAINTAINERS|   3 +
 doc/guides/rel_notes/release_2_2.rst   |   8 +
 doc/guides/sample_app_ug/img/ptpclient.svg | 520 +++
 doc/guides/sample_app_ug/index.rst |   3 +
 doc/guides/sample_app_ug/ptpclient.rst | 306 +++
 drivers/net/e1000/e1000_ethdev.h   |   3 +
 drivers/net/e1000/igb_ethdev.c | 299 ++-
 drivers/net/i40e/i40e_ethdev.c | 196 +++-
 drivers/net/i40e/i40e_ethdev.h |   5 +
 drivers/net/ixgbe/ixgbe_ethdev.c   | 272 +-
 drivers/net/ixgbe/ixgbe_ethdev.h   |   3 +
 examples/Makefile  |   1 +
 examples/ptpclient/Makefile|  56 +++
 examples/ptpclient/ptpclient.c | 779 +
 lib/librte_ether/rte_ethdev.c  |  36 ++
 lib/librte_ether/rte_ethdev.h  |  65 ++-
 lib/librte_ether/rte_ether_version.map |   3 +
 lib/librte_net/Makefile|   2 +-
 lib/librte_net/rte_ptp.h   | 105 
 19 files changed, 2622 insertions(+), 43 deletions(-)
 create mode 100644 doc/guides/sample_app_ug/img/ptpclient.svg
 create mode 100644 doc/guides/sample_app_ug/ptpclient.rst
 create mode 100644 examples/ptpclient/Makefile
 create mode 100644 examples/ptpclient/ptpclient.c
 create mode 100644 lib/librte_net/rte_ptp.h

-- 
2.5.0



[dpdk-dev] [PATCH 00/12] DPDK armv8-a support

2015-11-05 Thread Hunt, David
On 03/11/2015 16:38, Jerin Jacob wrote:
> On Tue, Nov 03, 2015 at 02:17:38PM +, Hunt, David wrote:

--snip--

>> and then it built fine, and I can run testpmd with my 82599's and run
>> autotests.
>
> I ran autotest, "Mbuf autotest" stress failure is due strong vs weak ordering
> issue. I will send the next version based on new patch being discussed
> on ml.

Jerin,
I've marked my patch-set for the armv8 support as superseded in 
PatchWork. I'm happy for your patch-set to take precedence.
If you're uploading another rev, I'll be sure to give it a test on my 
X-Gene board.
Dave.



[dpdk-dev] [PATCH v5 0/7] add sample ptp slave application

2015-11-05 Thread Mcnamara, John
> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Mrzyglod, DanielX T
> Sent: Thursday, November 5, 2015 2:10 PM
> To: Mrzyglod, DanielX T; dev at dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v5 0/7] add sample ptp slave application


Series Acked-by: John McNamara 




[dpdk-dev] [PATCH v3 0/8] add vhost TX offload support

2015-11-05 Thread Glynn, Michael J
Hi Thomas
Is there anything else needed to get this applied?

Thanks
Mike


-Original Message-
From: dev [mailto:dev-boun...@dpdk.org] On Behalf Of Tan, Jianfeng
Sent: Wednesday, November 4, 2015 11:14 AM
To: Liu, Jijiang; dev at dpdk.org
Subject: Re: [dpdk-dev] [PATCH v3 0/8] add vhost TX offload support



> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Jijiang Liu
> Sent: Wednesday, November 4, 2015 6:54 PM
> To: dev at dpdk.org
> Subject: [dpdk-dev] [PATCH v3 0/8] add vhost TX offload support
> 
> Adds vhost TX offload support.
> 
> The patch set add the negotiation between us-vhost and virtio-net for 
> vhost TX offload(checksum and TSO), and add the TX offload support in 
> the libs and change vhost sample and csum application to test these changes.
> 
> v3 change:
>   rebase latest codes.
> 
.
>  lib/librte_vhost/virtio-net.c  |6 ++-
>  8 files changed, 302 insertions(+), 20 deletions(-)
> 
> --
> 1.7.7.6

Acked-by: Jianfeng Tan 


[dpdk-dev] [PATCH v2] doc: update release notes for ip_pipeline app

2015-11-05 Thread Zhang, Roy Fan


> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Jasvinder Singh
> Sent: Wednesday, November 4, 2015 5:04 PM
> To: dev at dpdk.org
> Subject: [dpdk-dev] [PATCH v2] doc: update release notes for ip_pipeline app
>
> This patch updates the release notes with the features added to ip_pipeline 
> application.
>
> v2:
> *placed the release notes under New Features header
>
> Signed-off-by: Jasvinder Singh 

Acked-by: Fan Zhang 


[dpdk-dev] [PATCH v5 0/7] add sample ptp slave application

2015-11-05 Thread Mrzyglod, DanielX T


> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Daniel Mrzyglod
> Sent: Thursday, November 05, 2015 3:06 PM
> To: dev at dpdk.org
> Subject: [dpdk-dev] [PATCH v5 0/7] add sample ptp slave application
> 
> Add a sample application that acts as a PTP slave using the DPDK IEEE1588
> functions.
> 
> Also add some additional IEEE1588 support functions to enable getting,
> setting and adjusting the device time.
> 
> V4->v5:
>  - rebase to the current master

Previous series was Acked by John McNamara:
http://dpdk.org/ml/archives/dev/2015-November/027666.html


[dpdk-dev] [PATCH v4 0/7] add sample ptp slave application

2015-11-05 Thread Mcnamara, John
> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Daniel Mrzyglod
> Sent: Wednesday, November 4, 2015 10:06 AM
> To: dev at dpdk.org
> Subject: [dpdk-dev] [PATCH v4 0/7] add sample ptp slave application
> 
> Add a sample application that acts as a PTP slave using the DPDK IEEE1588
> functions.
> 
> Also add some additional IEEE1588 support functions to enable getting,
> setting and adjusting the device time.


Patch 5/7 has a merge conflict with another patch that went in very recently so 
it is probably worth rebasing that.

Otherwise,

Series Acked-by: John McNamara 




[dpdk-dev] [PATCH] bonding: fix enumerated type mixed with another type

2015-11-05 Thread De Lara Guarch, Pablo


> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Tomasz Kulasek
> Sent: Thursday, November 05, 2015 10:55 AM
> To: dev at dpdk.org
> Subject: [dpdk-dev] [PATCH] bonding: fix enumerated type mixed with
> another type
> 
> ICC complains about enumerated types being mixed in link bonding driver,
> as ETH_MQ_RX_RSS is an enum type of mq_mode and not a bitmask as it
> was
> being treated.
> 
> Fixes: 734ce47f71e0 ("bonding: support RSS dynamic configuration")
> 
> Signed-off-by: Tomasz Kulasek 

Acked-by: Pablo de Lara 


[dpdk-dev] [PATCH v3 7/7] doc: release note update for fm10k intr mode

2015-11-05 Thread Shaopeng He
Signed-off-by: Shaopeng He 
Acked-by: Jing Chen 
---
 doc/guides/rel_notes/release_2_2.rst | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/doc/guides/rel_notes/release_2_2.rst 
b/doc/guides/rel_notes/release_2_2.rst
index 59dda59..c6d255e 100644
--- a/doc/guides/rel_notes/release_2_2.rst
+++ b/doc/guides/rel_notes/release_2_2.rst
@@ -65,6 +65,8 @@ New Features

 * **Added fm10k VMDQ support.**

+* **Added fm10k Rx interrupt support.**
+
 * **New NIC Boulder Rapid support.**

   Boulder Rapid is a new NIC of Intel's fm10k family.
@@ -187,6 +189,11 @@ Libraries
 Examples
 

+* **l3fwd-power: Fixed memory leak for non-ip packet.**
+
+  Fixed issue in l3fwd-power where, recieving other packet than
+  types of IP and IPv6, the mbuf was not released, and caused
+  a memory leak.

 Other
 ~
-- 
1.9.3



[dpdk-dev] [PATCH v3 6/7] l3fwd-power: fix a memory leak for non-ip packet

2015-11-05 Thread Shaopeng He
Previous l3fwd-power only processes IP and IPv6 packet, other
packet's mbuf is not released, and causes a memory leak.
This patch fixes this issue.

Signed-off-by: Shaopeng He 
Acked-by: Jing Chen 
---
 examples/l3fwd-power/main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c
index 9175989..9c76d9e 100644
--- a/examples/l3fwd-power/main.c
+++ b/examples/l3fwd-power/main.c
@@ -714,7 +714,8 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint8_t portid,
/* We don't currently handle IPv6 packets in LPM mode. */
rte_pktmbuf_free(m);
 #endif
-   }
+   } else
+   rte_pktmbuf_free(m);

 }

-- 
1.9.3



[dpdk-dev] [PATCH v3 5/7] fm10k: make sure default VID available in dev_init

2015-11-05 Thread Shaopeng He
When PF establishes a connection with Switch Manager, it receives
a logic port range from SM, and registers certain logic ports from
that range, then a default VID will be send back from SM. This whole
transaction needs to be finished in dev_init, otherwise, in dev_start
the interrupt setting will be changed according to RX queue number,
and probably will cause this transaction failed.

Signed-off-by: Shaopeng He 
Acked-by: Jing Chen 
---
 drivers/net/fm10k/fm10k_ethdev.c | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index 9b210d7..2cb0b94 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -2786,6 +2786,21 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev)

fm10k_mbx_unlock(hw);

+   /* Make sure default VID is ready before going forward. */
+   if (hw->mac.type == fm10k_mac_pf) {
+   for (i = 0; i < MAX_QUERY_SWITCH_STATE_TIMES; i++) {
+   if (hw->mac.default_vid)
+   break;
+   /* Delay some time to acquire async port VLAN info. */
+   rte_delay_us(WAIT_SWITCH_MSG_US);
+   }
+
+   if (!hw->mac.default_vid) {
+   PMD_INIT_LOG(ERR, "default VID is not ready");
+   return -1;
+   }
+   }
+
/* Add default mac address */
fm10k_MAC_filter_set(dev, hw->mac.addr, true,
MAIN_VSI_POOL_NUMBER);
-- 
1.9.3



[dpdk-dev] [PATCH v3 4/7] fm10k: add rx queue interrupt en/dis functions

2015-11-05 Thread Shaopeng He
Interrupt mode framework has enable/disable functions for individual
rx queue, this patch implements these two functions.

Signed-off-by: Shaopeng He 
Acked-by: Jing Chen 
---
 drivers/net/fm10k/fm10k_ethdev.c | 33 +
 1 file changed, 33 insertions(+)

diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index 4a973e8..9b210d7 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -2186,6 +2186,37 @@ fm10k_dev_disable_intr_vf(struct rte_eth_dev *dev)
 }

 static int
+fm10k_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id)
+{
+   struct fm10k_hw *hw = FM10K_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+
+   /* Enable ITR */
+   if (hw->mac.type == fm10k_mac_pf)
+   FM10K_WRITE_REG(hw, FM10K_ITR(Q2V(dev, queue_id)),
+   FM10K_ITR_AUTOMASK | FM10K_ITR_MASK_CLEAR);
+   else
+   FM10K_WRITE_REG(hw, FM10K_VFITR(Q2V(dev, queue_id)),
+   FM10K_ITR_AUTOMASK | FM10K_ITR_MASK_CLEAR);
+   rte_intr_enable(>pci_dev->intr_handle);
+   return 0;
+}
+
+static int
+fm10k_dev_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id)
+{
+   struct fm10k_hw *hw = FM10K_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+
+   /* Disable ITR */
+   if (hw->mac.type == fm10k_mac_pf)
+   FM10K_WRITE_REG(hw, FM10K_ITR(Q2V(dev, queue_id)),
+   FM10K_ITR_MASK_SET);
+   else
+   FM10K_WRITE_REG(hw, FM10K_VFITR(Q2V(dev, queue_id)),
+   FM10K_ITR_MASK_SET);
+   return 0;
+}
+
+static int
 fm10k_dev_rxq_interrupt_setup(struct rte_eth_dev *dev)
 {
struct fm10k_hw *hw = FM10K_DEV_PRIVATE_TO_HW(dev->data->dev_private);
@@ -2518,6 +2549,8 @@ static const struct eth_dev_ops fm10k_eth_dev_ops = {
.tx_queue_setup = fm10k_tx_queue_setup,
.tx_queue_release   = fm10k_tx_queue_release,
.rx_descriptor_done = fm10k_dev_rx_descriptor_done,
+   .rx_queue_intr_enable   = fm10k_dev_rx_queue_intr_enable,
+   .rx_queue_intr_disable  = fm10k_dev_rx_queue_intr_disable,
.reta_update= fm10k_reta_update,
.reta_query = fm10k_reta_query,
.rss_hash_update= fm10k_rss_hash_update,
-- 
1.9.3



[dpdk-dev] [PATCH v3 3/7] fm10k: remove rx queue interrupts when dev stops

2015-11-05 Thread Shaopeng He
Previous dev_stop function stops the rx/tx queues. This patch adds logic
to disable rx queue interrupt, clean the datapath event and queue/vec map.

Signed-off-by: Shaopeng He 
Acked-by: Jing Chen 
---
 drivers/net/fm10k/fm10k_ethdev.c | 22 ++
 1 file changed, 22 insertions(+)

diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index d5cb233..4a973e8 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -1070,6 +1070,8 @@ fm10k_dev_start(struct rte_eth_dev *dev)
 static void
 fm10k_dev_stop(struct rte_eth_dev *dev)
 {
+   struct fm10k_hw *hw = FM10K_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+   struct rte_intr_handle *intr_handle = >pci_dev->intr_handle;
int i;

PMD_INIT_FUNC_TRACE();
@@ -1081,6 +1083,26 @@ fm10k_dev_stop(struct rte_eth_dev *dev)
if (dev->data->rx_queues)
for (i = 0; i < dev->data->nb_rx_queues; i++)
fm10k_dev_rx_queue_stop(dev, i);
+
+   /* Disable datapath event */
+   if (rte_intr_dp_is_en(intr_handle)) {
+   for (i = 0; i < dev->data->nb_rx_queues; i++) {
+   FM10K_WRITE_REG(hw, FM10K_RXINT(i),
+   3 << FM10K_RXINT_TIMER_SHIFT);
+   if (hw->mac.type == fm10k_mac_pf)
+   FM10K_WRITE_REG(hw, FM10K_ITR(Q2V(dev, i)),
+   FM10K_ITR_MASK_SET);
+   else
+   FM10K_WRITE_REG(hw, FM10K_VFITR(Q2V(dev, i)),
+   FM10K_ITR_MASK_SET);
+   }
+   }
+   /* Clean datapath event and queue/vec mapping */
+   rte_intr_efd_disable(intr_handle);
+   if (intr_handle->intr_vec != NULL) {
+   rte_free(intr_handle->intr_vec);
+   intr_handle->intr_vec = NULL;
+   }
 }

 static void
-- 
1.9.3



[dpdk-dev] [PATCH v3 2/7] fm10k: setup rx queue interrupts for PF and VF

2015-11-05 Thread Shaopeng He
In interrupt mode, each rx queue can have one interrupt to notify the up
layer application when packets are available in that queue. Some queues
also can share one interrupt.
Currently, fm10k needs one separate interrupt for mailbox. So, only those
drivers which support multiple interrupt vectors e.g. vfio-pci can work
in fm10k interrupt mode.
This patch uses the RXINT/INT_MAP registers to map interrupt causes
(rx queue and other events) to vectors, and enable these interrupts
through kernel drivers like vfio-pci.

Signed-off-by: Shaopeng He 
Acked-by: Jing Chen 
---
 drivers/net/fm10k/fm10k.h|   3 ++
 drivers/net/fm10k/fm10k_ethdev.c | 101 ++-
 2 files changed, 93 insertions(+), 11 deletions(-)

diff --git a/drivers/net/fm10k/fm10k.h b/drivers/net/fm10k/fm10k.h
index 65002c9..6729f7f 100644
--- a/drivers/net/fm10k/fm10k.h
+++ b/drivers/net/fm10k/fm10k.h
@@ -129,6 +129,9 @@
 #define RTE_FM10K_TX_MAX_FREE_BUF_SZ64
 #define RTE_FM10K_DESCS_PER_LOOP4

+#define FM10K_MISC_VEC_ID   RTE_INTR_VEC_ZERO_OFFSET
+#define FM10K_RX_VEC_START  RTE_INTR_VEC_RXTX_OFFSET
+
 struct fm10k_macvlan_filter_info {
uint16_t vlan_num;   /* Total VLAN number */
uint16_t mac_num;/* Total mac number */
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index 9a32cf8..d5cb233 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -54,6 +54,8 @@
 /* Number of chars per uint32 type */
 #define CHARS_PER_UINT32 (sizeof(uint32_t))
 #define BIT_MASK_PER_UINT32 ((1 << CHARS_PER_UINT32) - 1)
+/* default 1:1 map from queue ID to interrupt vector ID */
+#define Q2V(dev, queue_id) (dev->pci_dev->intr_handle.intr_vec[queue_id])

 #define FM10K_SIMPLE_TX_FLAG ((uint32_t)ETH_TXQ_FLAGS_NOMULTSEGS | \
ETH_TXQ_FLAGS_NOOFFLOADS)
@@ -112,6 +114,8 @@ struct fm10k_xstats_name_off fm10k_hw_stats_tx_q_strings[] 
= {

 #define FM10K_NB_XSTATS (FM10K_NB_HW_XSTATS + FM10K_MAX_QUEUES_PF * \
(FM10K_NB_RX_Q_XSTATS + FM10K_NB_TX_Q_XSTATS))
+static int
+fm10k_dev_rxq_interrupt_setup(struct rte_eth_dev *dev);

 static void
 fm10k_mbx_initlock(struct fm10k_hw *hw)
@@ -632,6 +636,7 @@ static int
 fm10k_dev_rx_init(struct rte_eth_dev *dev)
 {
struct fm10k_hw *hw = FM10K_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+   struct rte_intr_handle *intr_handle = >pci_dev->intr_handle;
int i, ret;
struct fm10k_rx_queue *rxq;
uint64_t base_addr;
@@ -639,10 +644,23 @@ fm10k_dev_rx_init(struct rte_eth_dev *dev)
uint32_t rxdctl = FM10K_RXDCTL_WRITE_BACK_MIN_DELAY;
uint16_t buf_size;

-   /* Disable RXINT to avoid possible interrupt */
-   for (i = 0; i < hw->mac.max_queues; i++)
+   /* enable RXINT for interrupt mode */
+   i = 0;
+   if (rte_intr_dp_is_en(intr_handle)) {
+   for (; i < dev->data->nb_rx_queues; i++) {
+   FM10K_WRITE_REG(hw, FM10K_RXINT(i), Q2V(dev, i));
+   if (hw->mac.type == fm10k_mac_pf)
+   FM10K_WRITE_REG(hw, FM10K_ITR(Q2V(dev, i)),
+   FM10K_ITR_AUTOMASK | 
FM10K_ITR_MASK_CLEAR);
+   else
+   FM10K_WRITE_REG(hw, FM10K_VFITR(Q2V(dev, i)),
+   FM10K_ITR_AUTOMASK | 
FM10K_ITR_MASK_CLEAR);
+   }
+   }
+   /* Disable other RXINT to avoid possible interrupt */
+   for (; i < hw->mac.max_queues; i++)
FM10K_WRITE_REG(hw, FM10K_RXINT(i),
-   3 << FM10K_RXINT_TIMER_SHIFT);
+   3 << FM10K_RXINT_TIMER_SHIFT);

/* Setup RX queues */
for (i = 0; i < dev->data->nb_rx_queues; ++i) {
@@ -998,6 +1016,9 @@ fm10k_dev_start(struct rte_eth_dev *dev)
return diag;
}

+   if (fm10k_dev_rxq_interrupt_setup(dev))
+   return -EIO;
+
diag = fm10k_dev_rx_init(dev);
if (diag) {
PMD_INIT_LOG(ERR, "RX init failed: %d", diag);
@@ -2053,7 +2074,7 @@ fm10k_dev_enable_intr_pf(struct rte_eth_dev *dev)
uint32_t int_map = FM10K_INT_MAP_IMMEDIATE;

/* Bind all local non-queue interrupt to vector 0 */
-   int_map |= 0;
+   int_map |= FM10K_MISC_VEC_ID;

FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_Mailbox), int_map);
FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_PCIeFault), int_map);
@@ -2084,7 +2105,7 @@ fm10k_dev_disable_intr_pf(struct rte_eth_dev *dev)
struct fm10k_hw *hw = FM10K_DEV_PRIVATE_TO_HW(dev->data->dev_private);
uint32_t int_map = FM10K_INT_MAP_DISABLE;

-   int_map |= 0;
+   int_map |= FM10K_MISC_VEC_ID;

FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_Mailbox), int_map);
FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_PCIeFault), int_map);
@@ -2115,7 +2136,7 @@ 

[dpdk-dev] [PATCH v3 1/7] fm10k: implement rx_descriptor_done function

2015-11-05 Thread Shaopeng He
rx_descriptor_done is used by interrupt mode example application
(l3fwd-power) to check rxd DD bit to decide the RX trend,
then l3fwd-power will adjust the cpu frequency according to
the result.

Signed-off-by: Shaopeng He 
Acked-by: Jing Chen 
---
 drivers/net/fm10k/fm10k.h|  3 +++
 drivers/net/fm10k/fm10k_ethdev.c |  1 +
 drivers/net/fm10k/fm10k_rxtx.c   | 25 +
 3 files changed, 29 insertions(+)

diff --git a/drivers/net/fm10k/fm10k.h b/drivers/net/fm10k/fm10k.h
index 754aa6a..65002c9 100644
--- a/drivers/net/fm10k/fm10k.h
+++ b/drivers/net/fm10k/fm10k.h
@@ -343,6 +343,9 @@ uint16_t fm10k_recv_pkts(void *rx_queue, struct rte_mbuf 
**rx_pkts,
 uint16_t fm10k_recv_scattered_pkts(void *rx_queue,
struct rte_mbuf **rx_pkts, uint16_t nb_pkts);

+int
+fm10k_dev_rx_descriptor_done(void *rx_queue, uint16_t offset);
+
 uint16_t fm10k_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
uint16_t nb_pkts);

diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index cf7ada7..9a32cf8 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -2416,6 +2416,7 @@ static const struct eth_dev_ops fm10k_eth_dev_ops = {
.rx_queue_release   = fm10k_rx_queue_release,
.tx_queue_setup = fm10k_tx_queue_setup,
.tx_queue_release   = fm10k_tx_queue_release,
+   .rx_descriptor_done = fm10k_dev_rx_descriptor_done,
.reta_update= fm10k_reta_update,
.reta_query = fm10k_reta_query,
.rss_hash_update= fm10k_rss_hash_update,
diff --git a/drivers/net/fm10k/fm10k_rxtx.c b/drivers/net/fm10k/fm10k_rxtx.c
index 1bac28d..805bd7d 100644
--- a/drivers/net/fm10k/fm10k_rxtx.c
+++ b/drivers/net/fm10k/fm10k_rxtx.c
@@ -354,6 +354,31 @@ fm10k_recv_scattered_pkts(void *rx_queue, struct rte_mbuf 
**rx_pkts,
return nb_rcv;
 }

+int
+fm10k_dev_rx_descriptor_done(void *rx_queue, uint16_t offset)
+{
+   volatile union fm10k_rx_desc *rxdp;
+   struct fm10k_rx_queue *rxq = rx_queue;
+   uint16_t desc;
+   int ret;
+
+   if (unlikely(offset >= rxq->nb_desc)) {
+   PMD_DRV_LOG(ERR, "Invalid RX queue id %u", offset);
+   return 0;
+   }
+
+   desc = rxq->next_dd + offset;
+   if (desc >= rxq->nb_desc)
+   desc -= rxq->nb_desc;
+
+   rxdp = >hw_ring[desc];
+
+   ret = !!(rxdp->w.status &
+   rte_cpu_to_le_16(FM10K_RXD_STATUS_DD));
+
+   return ret;
+}
+
 static inline void tx_free_descriptors(struct fm10k_tx_queue *q)
 {
uint16_t next_rs, count = 0;
-- 
1.9.3



[dpdk-dev] [PATCH v3 0/7] interrupt mode for fm10k

2015-11-05 Thread Shaopeng He
This patch series adds interrupt mode support for fm10k,
contains four major parts:

1. implement rx_descriptor_done function in fm10k
2. make sure default VID available in dev_init in fm10k
3. fix a memory leak for non-ip packet in l3fwd-power
4. add rx interrupt support in fm10k PF and VF

Changes in v3:
- Rebase to latest code

Changes in v2:
- Reword some comments and commit messages
- Split one big patch into three smaller ones

Shaopeng He (7):
  fm10k: implement rx_descriptor_done function
  fm10k: setup rx queue interrupts for PF and VF
  fm10k: remove rx queue interrupts when dev stops
  fm10k: add rx queue interrupt en/dis functions
  fm10k: make sure default VID available in dev_init
  l3fwd-power: fix a memory leak for non-ip packet
  doc: release note update for fm10k intr mode

 doc/guides/rel_notes/release_2_2.rst |   7 ++
 drivers/net/fm10k/fm10k.h|   6 ++
 drivers/net/fm10k/fm10k_ethdev.c | 172 ---
 drivers/net/fm10k/fm10k_rxtx.c   |  25 +
 examples/l3fwd-power/main.c  |   3 +-
 5 files changed, 201 insertions(+), 12 deletions(-)

-- 
1.9.3



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

2015-11-05 Thread 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().

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

v2: Remove commented code

 drivers/net/i40e/i40e_ethdev.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index a39bd28..7e18ba7 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -2129,14 +2129,14 @@ i40e_dev_xstats_reset(struct rte_eth_dev *dev)
 {
struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-   struct i40e_hw_port_stats *hw_stats = >stats;

-   /* The hw registers are cleared on read */
+   /* Mark PF and VSI stats to update the offset, aka "reset" */
pf->offset_loaded = false;
-   i40e_read_stats_registers(pf, hw);
+   if (pf->main_vsi)
+   pf->main_vsi->offset_loaded = false;

-   /* reset software counters */
-   memset(hw_stats, 0, sizeof(*hw_stats));
+   /* read the stats, reading current register values into offset */
+   i40e_read_stats_registers(pf, hw);
 }

 static int
-- 
1.9.1



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

2015-11-05 Thread 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().

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 
---
 drivers/net/i40e/i40e_ethdev.c | 11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index a39bd28..70c1674 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -2129,14 +2129,15 @@ i40e_dev_xstats_reset(struct rte_eth_dev *dev)
 {
struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-   struct i40e_hw_port_stats *hw_stats = >stats;
+   /*struct i40e_hw_port_stats *hw_stats = >stats;*/

-   /* The hw registers are cleared on read */
+   /* Mark PF and VSI stats to update the offset, aka "reset" */
pf->offset_loaded = false;
-   i40e_read_stats_registers(pf, hw);
+   if (pf->main_vsi)
+   pf->main_vsi->offset_loaded = false;

-   /* reset software counters */
-   memset(hw_stats, 0, sizeof(*hw_stats));
+   /* read the stats, reading current register values into offset */
+   i40e_read_stats_registers(pf, hw);
 }

 static int
-- 
1.9.1



[dpdk-dev] [PATCH v4 0/7] add sample ptp slave application

2015-11-05 Thread Mcnamara, John
> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Daniel Mrzyglod
> Sent: Wednesday, November 4, 2015 10:06 AM
> To: dev at dpdk.org
> Subject: [dpdk-dev] [PATCH v4 0/7] add sample ptp slave application

Hi Thomas,

Why is this patchset marked as "Deferred"?

http://dpdk.org/dev/patchwork/project/dpdk/list/?state=10

John.
-- 



[dpdk-dev] [PATCH v6 0/7] support for netronome nfp-6xxx card

2015-11-05 Thread Vincent JARDIN

On 05/11/2015 11:43, Alejandro.Lucero wrote:
> From: "Alejandro.Lucero" 
>
> This patchset adds a new PMD for Netronome nfp-6xxx card.
> Just PCI Virtual Functions supported.
> Using this PMD requires previous Netronome BSP installation.
>

I understand that this PMD needs a kernel driver which is not upstream 
yet. Am I correct?

https://git.kernel.org/cgit/linux/kernel/git/davem/net-next.git/tree/drivers/net/ethernet


Best regards,
   Vincent



[dpdk-dev] [PATCH] bonding: fix enumerated type mixed with another type

2015-11-05 Thread Tomasz Kulasek
ICC complains about enumerated types being mixed in link bonding driver,
as ETH_MQ_RX_RSS is an enum type of mq_mode and not a bitmask as it was
being treated.

Fixes: 734ce47f71e0 ("bonding: support RSS dynamic configuration")

Signed-off-by: Tomasz Kulasek 
---
 drivers/net/bonding/rte_eth_bond_pmd.c |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c 
b/drivers/net/bonding/rte_eth_bond_pmd.c
index 500a1ee..2ec982b 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -1311,7 +1311,7 @@ slave_configure(struct rte_eth_dev *bonded_eth_dev,
slave_eth_dev->data->dev_conf.intr_conf.lsc = 1;

/* If RSS is enabled for bonding, try to enable it for slaves  */
-   if (bonded_eth_dev->data->dev_conf.rxmode.mq_mode & ETH_MQ_RX_RSS) {
+   if (bonded_eth_dev->data->dev_conf.rxmode.mq_mode & ETH_MQ_RX_RSS_FLAG) 
{
if 
(bonded_eth_dev->data->dev_conf.rx_adv_conf.rss_conf.rss_key_len
!= 0) {

slave_eth_dev->data->dev_conf.rx_adv_conf.rss_conf.rss_key_len =
@@ -1324,7 +1324,8 @@ slave_configure(struct rte_eth_dev *bonded_eth_dev,

slave_eth_dev->data->dev_conf.rx_adv_conf.rss_conf.rss_hf =

bonded_eth_dev->data->dev_conf.rx_adv_conf.rss_conf.rss_hf;
-   slave_eth_dev->data->dev_conf.rxmode.mq_mode |= ETH_MQ_RX_RSS;
+   slave_eth_dev->data->dev_conf.rxmode.mq_mode =
+   bonded_eth_dev->data->dev_conf.rxmode.mq_mode;
}

/* Configure device */
-- 
1.7.9.5



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

2015-11-05 Thread Charles (Chas) Williams
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.




[dpdk-dev] [PATCH v4 3/3] example: add keep alive sample application

2015-11-05 Thread Remy Horton
Modified version of l2fwd to demonstrate keep-alive functionality.

Signed-off-by: Remy Horton 
---
 MAINTAINERS   |   4 +
 examples/l2fwd-keepalive/Makefile |  50 +++
 examples/l2fwd-keepalive/main.c   | 806 ++
 3 files changed, 860 insertions(+)
 create mode 100644 examples/l2fwd-keepalive/Makefile
 create mode 100644 examples/l2fwd-keepalive/main.c

diff --git a/MAINTAINERS b/MAINTAINERS
index c8be5d2..e6e054e 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -520,3 +520,7 @@ F: examples/tep_termination/
 F: examples/vmdq/
 F: examples/vmdq_dcb/
 F: doc/guides/sample_app_ug/vmdq_dcb_forwarding.rst
+
+M: Remy Horton 
+F: examples/l2fwd-keepalive/
+F: doc/guides/sample_app_ug/keep_alive.rst
diff --git a/examples/l2fwd-keepalive/Makefile 
b/examples/l2fwd-keepalive/Makefile
new file mode 100644
index 000..568edcb
--- /dev/null
+++ b/examples/l2fwd-keepalive/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-keepalive
+
+# 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-keepalive/main.c b/examples/l2fwd-keepalive/main.c
new file mode 100644
index 000..8d7b09e
--- /dev/null
+++ b/examples/l2fwd-keepalive/main.c
@@ -0,0 +1,806 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2010-2015 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.
+ */
+
+#include 
+#include 

[dpdk-dev] [PATCH v4 2/3] docs: add keep alive sample app guide & release notes

2015-11-05 Thread Remy Horton
Signed-off-by: Maryam Tahhan 
Signed-off-by: John J Browne 
Signed-off-by: Remy Horton 
---
 doc/guides/rel_notes/release_2_2.rst|   3 +
 doc/guides/sample_app_ug/index.rst  |   1 +
 doc/guides/sample_app_ug/keep_alive.rst | 191 
 3 files changed, 195 insertions(+)
 create mode 100644 doc/guides/sample_app_ug/keep_alive.rst

diff --git a/doc/guides/rel_notes/release_2_2.rst 
b/doc/guides/rel_notes/release_2_2.rst
index 59dda59..9f3c524 100644
--- a/doc/guides/rel_notes/release_2_2.rst
+++ b/doc/guides/rel_notes/release_2_2.rst
@@ -94,6 +94,7 @@ New Features

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

+* **Added keepalive support to EAL.**

 Resolved Issues
 ---
@@ -187,6 +188,8 @@ Libraries
 Examples
 

+* **l2fwd-keepalive: Added keep-alive demonstration.**
+

 Other
 ~
diff --git a/doc/guides/sample_app_ug/index.rst 
b/doc/guides/sample_app_ug/index.rst
index 9beedd9..11b8b14 100644
--- a/doc/guides/sample_app_ug/index.rst
+++ b/doc/guides/sample_app_ug/index.rst
@@ -49,6 +49,7 @@ Sample Applications User Guide
 ipv4_multicast
 ip_reassembly
 kernel_nic_interface
+keep_alive
 l2_forward_job_stats
 l2_forward_real_virtual
 l3_forward
diff --git a/doc/guides/sample_app_ug/keep_alive.rst 
b/doc/guides/sample_app_ug/keep_alive.rst
new file mode 100644
index 000..080811b
--- /dev/null
+++ b/doc/guides/sample_app_ug/keep_alive.rst
@@ -0,0 +1,191 @@
+
+..  BSD LICENSE
+Copyright(c) 2015 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.
+
+Keep Alive Sample Application
+=
+
+The Keep Alive application is a simple example of a
+heartbeat/watchdog for packet processing cores. It demonstrates how
+to detect 'failed' DPDK cores and notify a fault management entity
+of this failure. Its purpose is to ensure the failure of the core
+does not result in a fault that is not detectable by a management
+entity.
+
+
+Overview
+
+
+The application demonstrates how to protect against 'silent outages'
+on packet processing cores. A Keep Alive Monitor Agent Core (master)
+monitors the state of packet processing cores (worker cores) by
+dispatching pings at a regular time interval (default is 5ms) and
+monitoring the state of the cores. Cores states are: Alive, MIA, Dead
+or Buried. MIA indicates a missed ping, and Dead indicates two missed
+pings within the specified time interval. When a core is Dead, a
+callback function is invoked to restart the packet processing core;
+A real life application might use this callback function to notify a
+higher level fault management entity of the core failure in order to
+take the appropriate corrective action.
+
+Note: Only the worker cores are monitored. A local (on the host) mechanism
+or agent to supervise the Keep Alive Monitor Agent Core DPDK core is required
+to detect its failure.
+
+Note: This application is based on the L2 forwarding application. As
+such, the initialization and run-time paths are very similar to those
+of the L2 forwarding application.
+
+Compiling the Application
+-
+
+To compile the application:
+
+#.  Go to the sample application directory:
+
+.. code-block:: console
+
+export RTE_SDK=/path/to/rte_sdk cd ${RTE_SDK}/examples/keep_alive
+
+#.  Set the target (a default target is used if not specified). For example:
+
+.. code-block:: console
+
+export 

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

2015-11-05 Thread Remy Horton
Adds functions for detecting and reporting the live-ness of LCores,
the primary requirement of which is minimal overheads for the
core(s) being checked. Core failures are notified via an application
defined callback.

Signed-off-by: Remy Horton 
---
 lib/librte_eal/bsdapp/eal/Makefile  |   1 +
 lib/librte_eal/bsdapp/eal/rte_eal_version.map   |   6 +-
 lib/librte_eal/common/Makefile  |   2 +-
 lib/librte_eal/common/include/rte_keepalive.h   | 146 
 lib/librte_eal/common/rte_keepalive.c   | 124 
 lib/librte_eal/linuxapp/eal/Makefile|   1 +
 lib/librte_eal/linuxapp/eal/rte_eal_version.map |   6 +-
 7 files changed, 283 insertions(+), 3 deletions(-)
 create mode 100644 lib/librte_eal/common/include/rte_keepalive.h
 create mode 100644 lib/librte_eal/common/rte_keepalive.c

diff --git a/lib/librte_eal/bsdapp/eal/Makefile 
b/lib/librte_eal/bsdapp/eal/Makefile
index a49dcec..65b293f 100644
--- a/lib/librte_eal/bsdapp/eal/Makefile
+++ b/lib/librte_eal/bsdapp/eal/Makefile
@@ -80,6 +80,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_thread.c
 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
+SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += rte_keepalive.c

 CFLAGS_eal.o := -D_GNU_SOURCE
 #CFLAGS_eal_thread.o := -D_GNU_SOURCE
diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map 
b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
index 8b00761..f6c29be 100644
--- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map
+++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
@@ -130,5 +130,9 @@ DPDK_2.2 {
global:

rte_intr_cap_multiple;
+   rte_keepalive_create;
+   rte_keepalive_dispatch_pings;
+   rte_keepalive_register_core;
+   rte_keepalive_mark_alive;

-} DPDK_2.1;
\ No newline at end of file
+} DPDK_2.1;
diff --git a/lib/librte_eal/common/Makefile b/lib/librte_eal/common/Makefile
index 0c43d6a..7f1757a 100644
--- a/lib/librte_eal/common/Makefile
+++ b/lib/librte_eal/common/Makefile
@@ -40,7 +40,7 @@ INC += rte_string_fns.h rte_version.h
 INC += rte_eal_memconfig.h rte_malloc_heap.h
 INC += rte_hexdump.h rte_devargs.h rte_dev.h
 INC += rte_pci_dev_feature_defs.h rte_pci_dev_features.h
-INC += rte_malloc.h
+INC += rte_malloc.h rte_keepalive.h

 ifeq ($(CONFIG_RTE_INSECURE_FUNCTION_WARNING),y)
 INC += rte_warnings.h
diff --git a/lib/librte_eal/common/include/rte_keepalive.h 
b/lib/librte_eal/common/include/rte_keepalive.h
new file mode 100644
index 000..01d4205
--- /dev/null
+++ b/lib/librte_eal/common/include/rte_keepalive.h
@@ -0,0 +1,146 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright 2015 Intel Shannon Ltd. All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in
+ *   the documentation and/or other materials provided with the
+ *   distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ *   contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * @file rte_keepalive.h
+ * DPDK RTE LCore Keepalive Monitor.
+ *
+ **/
+
+#ifndef _KEEPALIVE_H_
+#define _KEEPALIVE_H_
+
+#include 
+
+#ifndef RTE_KEEPALIVE_MAXCORES
+/**
+ * Number of cores to track.
+ * @note Must be larger than the highest core id. */
+#define RTE_KEEPALIVE_MAXCORES RTE_MAX_LCORE
+#endif
+
+
+/**
+ * Keepalive failure callback.
+ *
+ *  Receives a data pointer passed to rte_keepalive_create() and the id of the
+ *  failed core.
+ */
+typedef void (*rte_keepalive_failure_callback_t)(
+   void *data,
+   const int id_core);
+
+
+/**
+ * Keepalive state 

[dpdk-dev] [PATCH v4 0/3] Keepalive monitoring & reporting

2015-11-05 Thread Remy Horton
This patch-set adds functions for detecting and reporting live-ness of
LCores, the primary requirement of which is minimal overheads for the
core(s) being checked. Core failures are notified via an application
defined callback. As an example l2fwd with random failures is used.

Remy Horton (3):
  rte: add keep alive functionality
  docs: add keep alive sample app guide & release notes
  example: add keep alive sample application

 MAINTAINERS |   4 +
 doc/guides/rel_notes/release_2_2.rst|   3 +
 doc/guides/sample_app_ug/index.rst  |   1 +
 doc/guides/sample_app_ug/keep_alive.rst | 191 ++
 examples/l2fwd-keepalive/Makefile   |  50 ++
 examples/l2fwd-keepalive/main.c | 806 
 lib/librte_eal/bsdapp/eal/Makefile  |   1 +
 lib/librte_eal/bsdapp/eal/rte_eal_version.map   |   6 +-
 lib/librte_eal/common/Makefile  |   2 +-
 lib/librte_eal/common/include/rte_keepalive.h   | 146 +
 lib/librte_eal/common/rte_keepalive.c   | 124 
 lib/librte_eal/linuxapp/eal/Makefile|   1 +
 lib/librte_eal/linuxapp/eal/rte_eal_version.map |   6 +-
 13 files changed, 1338 insertions(+), 3 deletions(-)
 create mode 100644 doc/guides/sample_app_ug/keep_alive.rst
 create mode 100644 examples/l2fwd-keepalive/Makefile
 create mode 100644 examples/l2fwd-keepalive/main.c
 create mode 100644 lib/librte_eal/common/include/rte_keepalive.h
 create mode 100644 lib/librte_eal/common/rte_keepalive.c

-- 
1.9.3



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

2015-11-05 Thread Stephen Hemminger
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 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.


[dpdk-dev] [PATCH v2 0/2] Add VHOST PMD

2015-11-05 Thread Tetsuya Mukawa
Hi,

Could someone please review below patch series?

Regards,
Tetsuya

On 2015/11/02 12:58, Tetsuya Mukawa wrote:
> The patch introduces a new PMD. This PMD is implemented as thin wrapper
> of librte_vhost. The patch will work on below patch series.
>  - [PATCH v7 00/28] remove pci driver from vdevs
>
> * Known issue.
> We may see issues while handling RESET_OWNER message.
> These handlings are done in vhost library, so not a part of vhost PMD.
> So far, we are waiting for QEMU fixing.
>
> PATCH v2 changes:
>  - Remove a below patch that fixes vhost library.
>The patch was applied as a separate patch.
>- vhost: fix crash with multiqueue enabled
>  - Fix typos.
>(Thanks to Thomas, Monjalon)
>  - Rebase on latest tree with above bernard's patches.
>
> PATCH v1 changes:
>  - Support vhost multiple queues.
>  - Rebase on "remove pci driver from vdevs".
>  - Optimize RX/TX functions.
>  - Fix resource leaks.
>  - Fix compile issue.
>  - Add patch to fix vhost library.
>
> RFC PATCH v3 changes:
>  - Optimize performance.
>In RX/TX functions, change code to access only per core data.
>  - Add below API to allow user to use vhost library APIs for a port managed
>by vhost PMD. There are a few limitations. See "rte_eth_vhost.h".
> - rte_eth_vhost_portid2vdev()
>To support this functionality, vhost library is also changed.
>Anyway, if users doesn't use vhost PMD, can fully use vhost library APIs.
>  - Add code to support vhost multiple queues.
>Actually, multiple queues functionality is not enabled so far.
>
> RFC PATCH v2 changes:
>  - Fix issues reported by checkpatch.pl
>(Thanks to Stephen Hemminger)
>
>
> Tetsuya Mukawa (2):
>   vhost: Add callback and private data for vhost PMD
>   vhost: Add VHOST PMD
>
>  config/common_linuxapp|   6 +
>  doc/guides/nics/index.rst |   1 +
>  doc/guides/nics/vhost.rst |  82 +++
>  doc/guides/rel_notes/release_2_2.rst  |   2 +
>  drivers/net/Makefile  |   4 +
>  drivers/net/vhost/Makefile|  62 +++
>  drivers/net/vhost/rte_eth_vhost.c | 765 
> ++
>  drivers/net/vhost/rte_eth_vhost.h |  65 +++
>  drivers/net/vhost/rte_pmd_vhost_version.map   |   8 +
>  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 +-
>  mk/rte.app.mk |   8 +-
>  15 files changed, 1072 insertions(+), 13 deletions(-)
>  create mode 100644 doc/guides/nics/vhost.rst
>  create mode 100644 drivers/net/vhost/Makefile
>  create mode 100644 drivers/net/vhost/rte_eth_vhost.c
>  create mode 100644 drivers/net/vhost/rte_eth_vhost.h
>  create mode 100644 drivers/net/vhost/rte_pmd_vhost_version.map
>



[dpdk-dev] i40e: disabling flow control makes XL710 NIC discard all packets

2015-11-05 Thread Martin Weiser
Hi Helin,

I did some more testing and it seems like the issue is triggered when
the 'high_water' and 'low_water' fields of the 'rte_eth_fc_conf'
structure are set to 0 (like in my initial code example).
The following example does not trigger the issue:

struct rte_eth_fc_conf fc_conf;
rte_eth_dev_flow_ctrl_get(pi, _conf);
fc_conf.mode = RTE_FC_NONE;
rte_eth_dev_flow_ctrl_set(pi, _conf);

But when using the following code all packets will be discarded although
the call to rte_eth_dev_flow_ctrl_set does not return an error:

struct rte_eth_fc_conf fc_conf;
rte_eth_dev_flow_ctrl_get(pi, _conf);
fc_conf.mode = RTE_FC_NONE;
fc_conf.low_water = 0;
fc_conf.high_water = 0;
rte_eth_dev_flow_ctrl_set(pi, _conf);

I think the rest of the structure's values should not have any effect as
long as flow control is completely disabled by setting the mode to
RTE_FC_NONE. At least it did not with DPDK 2.1 or for other NIC types.

Regards,
Martin


On 04.11.15 15:32, Zhang, Helin wrote:
> Hi Martin
>
> Thank you very much for reporting the issue!
> Could you help to add more detailed steps and other information?
> We will try to reproduce what have seen in our lab, and then debug.
>
> Regards,
> Helin
>
>> -Original Message-
>> From: Martin Weiser [mailto:martin.weiser at allegro-packets.com]
>> Sent: Wednesday, November 4, 2015 6:17 PM
>> To: Zhang, Helin; dev at dpdk.org
>> Subject: i40e: disabling flow control makes XL710 NIC discard all packets
>>
>> Hi Helin,
>>
>> I have been doing some tests with the current DPDK master to see if the 
>> issues
>> we had with performance and statistics have improved.
>> In our own applications we usually disable flow control using the following 
>> code:
>>
>> struct rte_eth_fc_conf fc_conf = { .mode = RTE_FC_NONE }; int ret =
>> rte_eth_dev_flow_ctrl_set(port_id, _conf);
>>
>> In DPDK 2.1 this did not cause any problems with XL710 NICs but with the 
>> current
>> master the NIC will not receive any packets and they are all counted in 
>> ierrors and
>> imissed.
>> The return value of rte_eth_dev_flow_ctrl_set does not indicate an error so 
>> it
>> seems like something is going wrong here.
>> Regards,
>> Martin



[dpdk-dev] [PATCH] maintainers: Add maintainers for enic PMD

2015-11-05 Thread johndale
Acked-by: Thomas Monjalon 
Signed-off-by: johndale 
---
 MAINTAINERS | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index c8be5d2..f3dd1b8 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -226,6 +226,8 @@ F: drivers/net/cxgbe/
 F: doc/guides/nics/cxgbe.rst

 Cisco enic
+M: John Daley 
+M: Sujith Sankar 
 F: drivers/net/enic/

 Intel e1000
-- 
2.4.3



[dpdk-dev] [PATCH v6 0/7] support for netronome nfp-6xxx card

2015-11-05 Thread Alejandro Lucero
Yes, this is true.

There is a internal Netronome project for upstreaming the netdev kernel
driver along with a BSP driver.
PMD support will be in the BSP.

There is a public github repo with current drivers:

https://github.com/Netronome/nfp-drv-kmods


On Thu, Nov 5, 2015 at 10:59 AM, Vincent JARDIN 
wrote:

>
> On 05/11/2015 11:43, Alejandro.Lucero wrote:
>
>> From: "Alejandro.Lucero" 
>>
>> This patchset adds a new PMD for Netronome nfp-6xxx card.
>> Just PCI Virtual Functions supported.
>> Using this PMD requires previous Netronome BSP installation.
>>
>>
> I understand that this PMD needs a kernel driver which is not upstream
> yet. Am I correct?
>
>
> https://git.kernel.org/cgit/linux/kernel/git/davem/net-next.git/tree/drivers/net/ethernet
>
>
> Best regards,
>   Vincent
>
>


[dpdk-dev] [PATCH] doc: Add missing new line before code block

2015-11-05 Thread Tetsuya Mukawa
Hi Thomas,

Could you please merge below patch?

Thanks,
Tetsuya

On 2015/10/28 18:33, Mcnamara, John wrote:
>
>> -Original Message-
>> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Tetsuya Mukawa
>> Sent: Tuesday, October 20, 2015 3:42 AM
>> To: dev at dpdk.org
>> Subject: [dpdk-dev] [PATCH] doc: Add missing new line before code block
>>
>> The patch adds missing new line to "Managing ABI updates" section.
>>
>> Signed-off-by: Tetsuya Mukawa 
> Acked-by: John McNamara 
>



[dpdk-dev] [PATCH v3 6/8] driver/virtio:enqueue vhost TX offload

2015-11-05 Thread Xu, Qian Q
OK, I will check it tomorrow. 
Another comment is that "Legacy vhost + virtio-pmd" is not the common use case. 
Firstly, in this case, virtio-pmd has no TCP/IP stack, TSO is not very 
meaningful; secondly, we can't get performance benefit from this case compared 
to "Legacy vhost+ legacy virtio". So I'm afraid no customer would like to try 
this case since the fake TSO and poor performance. 


Thanks
Qian


-Original Message-
From: Thomas Monjalon [mailto:thomas.monja...@6wind.com] 
Sent: Thursday, November 05, 2015 5:02 PM
To: Xu, Qian Q
Cc: Liu, Jijiang; dev at dpdk.org; Michael S. Tsirkin
Subject: Re: [dpdk-dev] [PATCH v3 6/8] driver/virtio:enqueue vhost TX offload

2015-11-05 08:49, Xu, Qian Q:
> Test Case 1:  test_dpdk vhost+ virtio-pmd tso 
[...]
> Test Case 2:  test_dpdk vhost+legacy virtio iperf tso
[...]
> Yes please, I'd like to see a test report showing this virtio running with 
> Linux vhost and without vhost.
> We must check that the checksum is well offloaded and sent packets are valids.
> Thanks

Thanks for doing some tests.
I had no doubt it works with DPDK vhost.
Please could you do some tests without vhost and with kernel vhost?
We need to check that the checksum is not missing in such cases.


[dpdk-dev] [PATCH v6 7/7] nfp: adding nic guide

2015-11-05 Thread Alejandro.Lucero
From: "Alejandro.Lucero" 

Signed-off-by: Alejandro.Lucero 
Signed-off-by: Rolf.Neugebauer 
---
 MAINTAINERS   |1 +
 doc/guides/nics/index.rst |1 +
 doc/guides/nics/nfp.rst   |  189 +
 3 files changed, 191 insertions(+)
 create mode 100644 doc/guides/nics/nfp.rst

diff --git a/MAINTAINERS b/MAINTAINERS
index 72abbb2..3129cd2 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -263,6 +263,7 @@ F: doc/guides/nics/mlx5.rst
 Netronome nfp
 M: Alejandro Lucero 
 F: drivers/net/nfp/
+F: doc/guides/nics/nfp.rst

 RedHat virtio
 M: Huawei Xie 
diff --git a/doc/guides/nics/index.rst b/doc/guides/nics/index.rst
index 2d4936d..1a7bffe 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
+nfp
 virtio
 vmxnet3
 pcap_ring
diff --git a/doc/guides/nics/nfp.rst b/doc/guides/nics/nfp.rst
new file mode 100644
index 000..bb2afda
--- /dev/null
+++ b/doc/guides/nics/nfp.rst
@@ -0,0 +1,189 @@
+..  BSD LICENSE
+Copyright(c) 2015 Netronome Systems, Inc. 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.
+
+NFP poll mode driver library
+
+
+Netronome's sixth generation of flow processors pack 216 programmable
+cores and over 100 hardware accelerators that uniquely combine packet,
+flow, security and content processing in a single device that scales
+up to 400 Gbps.
+
+This document explains how to use DPDK with the Netronome Poll Mode
+Driver (PMD) supporting Netronome's Network Flow Processor 6xxx
+(NFP-6xxx).
+
+Currently the driver supports virtual functions (VFs) only.
+
+Dependencies
+
+
+Before using the Netronome's DPDK PMD some NFP-6xxx configuration,
+which is not related to DPDK, is required. The system requires
+installation of **Netronome's BSP (Board Support Package)** which includes
+Linux drivers, programs and libraries.
+
+If you have a NFP-6xxx device you should already have the code and
+documentation for doing this configuration. Contact
+**support at netronome.com** to obtain the latest available firmware.
+
+The NFP Linux kernel drivers (including the required PF driver for the
+NFP) are available on Github at
+**https://github.com/Netronome/nfp-drv-kmods** along with build
+instructions.
+
+Using Netronome?s NFP PMD requires to have the Netronome?s BSP module
+loaded.
+
+Building the software
+-
+
+Netronome's PMD code is provided in the **drivers/net/nfp** directory.
+This PMD is included as part of the DPDK **common_linuxapp configuration**
+file, but it is not enabled by default. If it is enabled without a BSP
+installed in the system, the compilation will fail.
+
+For enabling the PMD, just modifies the **common_linuxapp** file with:
+
+- **CONFIG_RTE_LIBRTE_NFP_PMD=y**
+
+Once DPDK is built all the DPDK apps and examples include support for
+the NFP PMD.
+
+System configuration
+
+
+Using the NFP PMD is not different to using other PMDs. Usual steps are:
+
+#. **Configure hugepages:** All major Linux distributions have the hugepages
+   functionality enabled by default. By default this allows the system uses for
+   working with transparent hugepages. But in this case some hugepages need to
+   be created/reserved for use with the DPDK through the hugetlbfs file system.
+   First the virtual file system 

[dpdk-dev] [PATCH v6 5/7] nfp: adding link functionality

2015-11-05 Thread Alejandro.Lucero
From: "Alejandro.Lucero" 

Signed-off-by: Alejandro.Lucero 
Signed-off-by: Rolf.Neugebauer 
---
 drivers/net/nfp/nfp_net.c |   96 +
 1 file changed, 96 insertions(+)

diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
index b586112..c533dfa 100644
--- a/drivers/net/nfp/nfp_net.c
+++ b/drivers/net/nfp/nfp_net.c
@@ -74,6 +74,7 @@
 static void nfp_net_close(struct rte_eth_dev *dev);
 static int nfp_net_configure(struct rte_eth_dev *dev);
 static int nfp_net_init(struct rte_eth_dev *eth_dev);
+static int nfp_net_link_update(struct rte_eth_dev *dev, int wait_to_complete);
 static int nfp_net_rx_fill_freelist(struct nfp_net_rxq *rxq);
 static uint32_t nfp_net_rx_queue_count(struct rte_eth_dev *dev,
   uint16_t queue_idx);
@@ -226,6 +227,57 @@ ring_dma_zone_reserve(struct rte_eth_dev *dev, const char 
*ring_name,
   NFP_MEMZONE_ALIGN);
 }

+/*
+ * Atomically reads link status information from global structure rte_eth_dev.
+ *
+ * @param dev
+ *   - Pointer to the structure rte_eth_dev to read from.
+ *   - Pointer to the buffer to be saved with the link status.
+ *
+ * @return
+ *   - On success, zero.
+ *   - On failure, negative value.
+ */
+static inline int
+nfp_net_dev_atomic_read_link_status(struct rte_eth_dev *dev,
+   struct rte_eth_link *link)
+{
+   struct rte_eth_link *dst = link;
+   struct rte_eth_link *src = >data->dev_link;
+
+   if (rte_atomic64_cmpset((uint64_t *)dst, *(uint64_t *)dst,
+   *(uint64_t *)src) == 0)
+   return -1;
+
+   return 0;
+}
+
+/*
+ * Atomically writes the link status information into global
+ * structure rte_eth_dev.
+ *
+ * @param dev
+ *   - Pointer to the structure rte_eth_dev to read from.
+ *   - Pointer to the buffer to be saved with the link status.
+ *
+ * @return
+ *   - On success, zero.
+ *   - On failure, negative value.
+ */
+static inline int
+nfp_net_dev_atomic_write_link_status(struct rte_eth_dev *dev,
+struct rte_eth_link *link)
+{
+   struct rte_eth_link *dst = >data->dev_link;
+   struct rte_eth_link *src = link;
+
+   if (rte_atomic64_cmpset((uint64_t *)dst, *(uint64_t *)dst,
+   *(uint64_t *)src) == 0)
+   return -1;
+
+   return 0;
+}
+
 static void
 nfp_net_rx_queue_release_mbufs(struct nfp_net_rxq *rxq)
 {
@@ -682,6 +734,49 @@ nfp_net_close(struct rte_eth_dev *dev)
 */
 }

+/*
+ * return 0 means link status changed, -1 means not changed
+ *
+ * Wait to complete is needed as it can take up to 9 seconds to get the Link
+ * status.
+ */
+static int
+nfp_net_link_update(struct rte_eth_dev *dev, __rte_unused int wait_to_complete)
+{
+   struct nfp_net_hw *hw;
+   struct rte_eth_link link, old;
+   uint32_t nn_link_status;
+
+   PMD_DRV_LOG(DEBUG, "Link update\n");
+
+   hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+
+   memset(, 0, sizeof(old));
+   nfp_net_dev_atomic_read_link_status(dev, );
+
+   nn_link_status = nn_cfg_readl(hw, NFP_NET_CFG_STS);
+
+   memset(, 0, sizeof(struct rte_eth_link));
+
+   if (nn_link_status & NFP_NET_CFG_STS_LINK)
+   link.link_status = 1;
+
+   link.link_duplex = ETH_LINK_FULL_DUPLEX;
+   /* Other cards can limit the tx and rx rate per VF */
+   link.link_speed = ETH_LINK_SPEED_40G;
+
+   if (old.link_status != link.link_status) {
+   nfp_net_dev_atomic_write_link_status(dev, );
+   if (link.link_status)
+   PMD_DRV_LOG(INFO, "NIC Link is Up\n");
+   else
+   PMD_DRV_LOG(INFO, "NIC Link is Down\n");
+   return 0;
+   }
+
+   return -1;
+}
+
 static void
 nfp_net_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
 {
@@ -1888,6 +1983,7 @@ static struct eth_dev_ops nfp_net_eth_dev_ops = {
.dev_start  = nfp_net_start,
.dev_stop   = nfp_net_stop,
.dev_close  = nfp_net_close,
+   .link_update= nfp_net_link_update,
.stats_get  = nfp_net_stats_get,
.stats_reset= nfp_net_stats_reset,
.reta_update= nfp_net_reta_update,
-- 
1.7.9.5



[dpdk-dev] [PATCH v6 4/7] nfp: adding stats

2015-11-05 Thread Alejandro.Lucero
From: "Alejandro.Lucero" 

Signed-off-by: Alejandro.Lucero 
Signed-off-by: Rolf.Neugebauer 
---
 drivers/net/nfp/nfp_net.c |  179 +
 1 file changed, 179 insertions(+)

diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
index 9119ec3..b586112 100644
--- a/drivers/net/nfp/nfp_net.c
+++ b/drivers/net/nfp/nfp_net.c
@@ -90,6 +90,9 @@ static int nfp_net_tx_queue_setup(struct rte_eth_dev *dev, 
uint16_t queue_idx,
  uint16_t nb_desc, unsigned int socket_id,
  const struct rte_eth_txconf *tx_conf);
 static int nfp_net_start(struct rte_eth_dev *dev);
+static void nfp_net_stats_get(struct rte_eth_dev *dev,
+ struct rte_eth_stats *stats);
+static void nfp_net_stats_reset(struct rte_eth_dev *dev);
 static void nfp_net_stop(struct rte_eth_dev *dev);
 static uint16_t nfp_net_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
  uint16_t nb_pkts);
@@ -679,6 +682,177 @@ nfp_net_close(struct rte_eth_dev *dev)
 */
 }

+static void
+nfp_net_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
+{
+   int i;
+   struct nfp_net_hw *hw;
+   struct rte_eth_stats nfp_dev_stats;
+
+   hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+
+   /* RTE_ETHDEV_QUEUE_STAT_CNTRS default value is 16 */
+
+   /* reading per RX ring stats */
+   for (i = 0; i < dev->data->nb_rx_queues; i++) {
+   if (i == RTE_ETHDEV_QUEUE_STAT_CNTRS)
+   break;
+
+   nfp_dev_stats.q_ipackets[i] =
+   nn_cfg_readq(hw, NFP_NET_CFG_RXR_STATS(i));
+
+   nfp_dev_stats.q_ipackets[i] -=
+   hw->eth_stats_base.q_ipackets[i];
+
+   nfp_dev_stats.q_ibytes[i] =
+   nn_cfg_readq(hw, NFP_NET_CFG_RXR_STATS(i) + 0x8);
+
+   nfp_dev_stats.q_ibytes[i] -=
+   hw->eth_stats_base.q_ibytes[i];
+   }
+
+   /* reading per TX ring stats */
+   for (i = 0; i < dev->data->nb_tx_queues; i++) {
+   if (i == RTE_ETHDEV_QUEUE_STAT_CNTRS)
+   break;
+
+   nfp_dev_stats.q_opackets[i] =
+   nn_cfg_readq(hw, NFP_NET_CFG_TXR_STATS(i));
+
+   nfp_dev_stats.q_opackets[i] -=
+   hw->eth_stats_base.q_opackets[i];
+
+   nfp_dev_stats.q_obytes[i] =
+   nn_cfg_readq(hw, NFP_NET_CFG_TXR_STATS(i) + 0x8);
+
+   nfp_dev_stats.q_obytes[i] -=
+   hw->eth_stats_base.q_obytes[i];
+   }
+
+   nfp_dev_stats.ipackets =
+   nn_cfg_readq(hw, NFP_NET_CFG_STATS_RX_FRAMES);
+
+   nfp_dev_stats.ipackets -= hw->eth_stats_base.ipackets;
+
+   nfp_dev_stats.ibytes =
+   nn_cfg_readq(hw, NFP_NET_CFG_STATS_RX_OCTETS);
+
+   nfp_dev_stats.ibytes -= hw->eth_stats_base.ibytes;
+
+   nfp_dev_stats.opackets =
+   nn_cfg_readq(hw, NFP_NET_CFG_STATS_TX_FRAMES);
+
+   nfp_dev_stats.opackets -= hw->eth_stats_base.opackets;
+
+   nfp_dev_stats.obytes =
+   nn_cfg_readq(hw, NFP_NET_CFG_STATS_TX_OCTETS);
+
+   nfp_dev_stats.obytes -= hw->eth_stats_base.obytes;
+
+   nfp_dev_stats.imcasts =
+   nn_cfg_readq(hw, NFP_NET_CFG_STATS_RX_MC_FRAMES);
+
+   nfp_dev_stats.imcasts -= hw->eth_stats_base.imcasts;
+
+   /* reading general device stats */
+   nfp_dev_stats.ierrors =
+   nn_cfg_readq(hw, NFP_NET_CFG_STATS_RX_ERRORS);
+
+   nfp_dev_stats.ierrors -= hw->eth_stats_base.ierrors;
+
+   nfp_dev_stats.oerrors =
+   nn_cfg_readq(hw, NFP_NET_CFG_STATS_TX_ERRORS);
+
+   nfp_dev_stats.oerrors -= hw->eth_stats_base.oerrors;
+
+   /* Multicast frames received */
+   nfp_dev_stats.imcasts =
+   nn_cfg_readq(hw, NFP_NET_CFG_STATS_RX_MC_FRAMES);
+
+   nfp_dev_stats.imcasts -= hw->eth_stats_base.imcasts;
+
+   /* RX ring mbuf allocation failures */
+   nfp_dev_stats.rx_nombuf = dev->data->rx_mbuf_alloc_failed;
+
+   nfp_dev_stats.imissed =
+   nn_cfg_readq(hw, NFP_NET_CFG_STATS_RX_DISCARDS);
+
+   nfp_dev_stats.imissed -= hw->eth_stats_base.imissed;
+
+   if (stats)
+   memcpy(stats, _dev_stats, sizeof(*stats));
+}
+
+static void
+nfp_net_stats_reset(struct rte_eth_dev *dev)
+{
+   int i;
+   struct nfp_net_hw *hw;
+
+   hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+
+   /*
+* hw->eth_stats_base records the per counter starting point.
+* Lets update it now
+*/
+
+   /* reading per RX ring stats */
+   for (i = 0; i < dev->data->nb_rx_queues; i++) {
+   if (i == RTE_ETHDEV_QUEUE_STAT_CNTRS)
+   break;
+
+   hw->eth_stats_base.q_ipackets[i] =
+ 

[dpdk-dev] [PATCH v6 3/7] nfp: adding rss

2015-11-05 Thread Alejandro.Lucero
From: "Alejandro.Lucero" 

Signed-off-by: Alejandro.Lucero 
Signed-off-by: Rolf.Neugebauer 
---
 drivers/net/nfp/nfp_net.c |  218 +
 1 file changed, 218 insertions(+)

diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
index 67eb9fa..9119ec3 100644
--- a/drivers/net/nfp/nfp_net.c
+++ b/drivers/net/nfp/nfp_net.c
@@ -1494,12 +1494,230 @@ xmit_end:
return i;
 }

+/* Update Redirection Table(RETA) of Receive Side Scaling of Ethernet device */
+static int
+nfp_net_reta_update(struct rte_eth_dev *dev,
+   struct rte_eth_rss_reta_entry64 *reta_conf,
+   uint16_t reta_size)
+{
+   uint32_t reta, mask;
+   int i, j;
+   int idx, shift;
+   uint32_t update;
+   struct nfp_net_hw *hw =
+   NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+
+   if (!(hw->ctrl & NFP_NET_CFG_CTRL_RSS))
+   return -EINVAL;
+
+   if (reta_size != NFP_NET_CFG_RSS_ITBL_SZ) {
+   RTE_LOG(ERR, PMD, "The size of hash lookup table configured "
+   "(%d) doesn't match the number hardware can supported "
+   "(%d)\n", reta_size, NFP_NET_CFG_RSS_ITBL_SZ);
+   return -EINVAL;
+   }
+
+   /*
+* Update Redirection Table. There are 128 8bit-entries which can be
+* manage as 32 32bit-entries
+*/
+   for (i = 0; i < reta_size; i += 4) {
+   /* Handling 4 RSS entries per loop */
+   idx = i / RTE_RETA_GROUP_SIZE;
+   shift = i % RTE_RETA_GROUP_SIZE;
+   mask = (uint8_t)((reta_conf[idx].mask >> shift) & 0xF);
+
+   if (!mask)
+   continue;
+
+   reta = 0;
+   /* If all 4 entries were set, don't need read RETA register */
+   if (mask != 0xF)
+   reta = nn_cfg_readl(hw, NFP_NET_CFG_RSS_ITBL + i);
+
+   for (j = 0; j < 4; j++) {
+   if (!(mask & (0x1 << j)))
+   continue;
+   if (mask != 0xF)
+   /* Clearing the entry bits */
+   reta &= ~(0xFF << (8 * j));
+   reta |= reta_conf[idx].reta[shift + j] << (8 * j);
+   }
+   nn_cfg_writel(hw, NFP_NET_CFG_RSS_ITBL + shift, reta);
+   }
+
+   update = NFP_NET_CFG_UPDATE_RSS;
+
+   if (nfp_net_reconfig(hw, hw->ctrl, update) < 0)
+   return -EIO;
+
+   return 0;
+}
+
+ /* Query Redirection Table(RETA) of Receive Side Scaling of Ethernet device. 
*/
+static int
+nfp_net_reta_query(struct rte_eth_dev *dev,
+  struct rte_eth_rss_reta_entry64 *reta_conf,
+  uint16_t reta_size)
+{
+   uint8_t i, j, mask;
+   int idx, shift;
+   uint32_t reta;
+   struct nfp_net_hw *hw;
+
+   hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+
+   if (!(hw->ctrl & NFP_NET_CFG_CTRL_RSS))
+   return -EINVAL;
+
+   if (reta_size != NFP_NET_CFG_RSS_ITBL_SZ) {
+   RTE_LOG(ERR, PMD, "The size of hash lookup table configured "
+   "(%d) doesn't match the number hardware can supported "
+   "(%d)\n", reta_size, NFP_NET_CFG_RSS_ITBL_SZ);
+   return -EINVAL;
+   }
+
+   /*
+* Reading Redirection Table. There are 128 8bit-entries which can be
+* manage as 32 32bit-entries
+*/
+   for (i = 0; i < reta_size; i += 4) {
+   /* Handling 4 RSS entries per loop */
+   idx = i / RTE_RETA_GROUP_SIZE;
+   shift = i % RTE_RETA_GROUP_SIZE;
+   mask = (uint8_t)((reta_conf[idx].mask >> shift) & 0xF);
+
+   if (!mask)
+   continue;
+
+   reta = nn_cfg_readl(hw, NFP_NET_CFG_RSS_ITBL + shift);
+   for (j = 0; j < 4; j++) {
+   if (!(mask & (0x1 << j)))
+   continue;
+   reta_conf->reta[shift + j] =
+   (uint8_t)((reta >> (8 * j)) & 0xF);
+   }
+   }
+   return 0;
+}
+
+static int
+nfp_net_rss_hash_update(struct rte_eth_dev *dev,
+   struct rte_eth_rss_conf *rss_conf)
+{
+   uint32_t update;
+   uint32_t cfg_rss_ctrl = 0;
+   uint8_t key;
+   uint64_t rss_hf;
+   int i;
+   struct nfp_net_hw *hw;
+
+   hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+
+   rss_hf = rss_conf->rss_hf;
+
+   /* Checking if RSS is enabled */
+   if (!(hw->ctrl & NFP_NET_CFG_CTRL_RSS)) {
+   if (rss_hf != 0) { /* Enable RSS? */
+   RTE_LOG(ERR, PMD, "RSS unsupported\n");
+   return -EINVAL;
+   }
+   return 0; /* Nothing to do */
+   

[dpdk-dev] [PATCH v6 2/7] nfp: adding rx/tx functionality

2015-11-05 Thread Alejandro.Lucero
From: "Alejandro.Lucero" 

Signed-off-by: Alejandro.Lucero 
Signed-off-by: Rolf.Neugebauer 
---
 drivers/net/nfp/nfp_net.c |  986 +
 1 file changed, 986 insertions(+)

diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
index 8dd0898..67eb9fa 100644
--- a/drivers/net/nfp/nfp_net.c
+++ b/drivers/net/nfp/nfp_net.c
@@ -74,8 +74,25 @@
 static void nfp_net_close(struct rte_eth_dev *dev);
 static int nfp_net_configure(struct rte_eth_dev *dev);
 static int nfp_net_init(struct rte_eth_dev *eth_dev);
+static int nfp_net_rx_fill_freelist(struct nfp_net_rxq *rxq);
+static uint32_t nfp_net_rx_queue_count(struct rte_eth_dev *dev,
+  uint16_t queue_idx);
+static uint16_t nfp_net_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
+ uint16_t nb_pkts);
+static void nfp_net_rx_queue_release(void *rxq);
+static int nfp_net_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
+ uint16_t nb_desc, unsigned int socket_id,
+ const struct rte_eth_rxconf *rx_conf,
+ struct rte_mempool *mp);
+static int nfp_net_tx_free_bufs(struct nfp_net_txq *txq);
+static void nfp_net_tx_queue_release(void *txq);
+static int nfp_net_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
+ uint16_t nb_desc, unsigned int socket_id,
+ const struct rte_eth_txconf *tx_conf);
 static int nfp_net_start(struct rte_eth_dev *dev);
 static void nfp_net_stop(struct rte_eth_dev *dev);
+static uint16_t nfp_net_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
+ uint16_t nb_pkts);

 /*
  * The offset of the queue controller queues in the PCIe Target. These
@@ -186,6 +203,100 @@ nn_cfg_writeq(struct nfp_net_hw *hw, int off, uint64_t 
val)
nn_writeq(rte_cpu_to_le_64(val), hw->ctrl_bar + off);
 }

+/* Creating memzone for hardware rings. */
+static const struct rte_memzone *
+ring_dma_zone_reserve(struct rte_eth_dev *dev, const char *ring_name,
+ uint16_t queue_id, uint32_t ring_size, int socket_id)
+{
+   char z_name[RTE_MEMZONE_NAMESIZE];
+   const struct rte_memzone *mz;
+
+   snprintf(z_name, sizeof(z_name), "%s_%s_%d_%d",
+dev->driver->pci_drv.name,
+ring_name, dev->data->port_id, queue_id);
+
+   mz = rte_memzone_lookup(z_name);
+   if (mz)
+   return mz;
+
+   return rte_memzone_reserve_aligned(z_name, ring_size, socket_id, 0,
+  NFP_MEMZONE_ALIGN);
+}
+
+static void
+nfp_net_rx_queue_release_mbufs(struct nfp_net_rxq *rxq)
+{
+   unsigned i;
+
+   if (rxq->rxbufs == NULL)
+   return;
+
+   for (i = 0; i < rxq->rx_count; i++) {
+   if (rxq->rxbufs[i].mbuf) {
+   rte_pktmbuf_free_seg(rxq->rxbufs[i].mbuf);
+   rxq->rxbufs[i].mbuf = NULL;
+   }
+   }
+}
+
+static void
+nfp_net_rx_queue_release(void *rx_queue)
+{
+   struct nfp_net_rxq *rxq = rx_queue;
+
+   if (rxq) {
+   nfp_net_rx_queue_release_mbufs(rxq);
+   rte_free(rxq->rxbufs);
+   rte_free(rxq);
+   }
+}
+
+static void
+nfp_net_reset_rx_queue(struct nfp_net_rxq *rxq)
+{
+   nfp_net_rx_queue_release_mbufs(rxq);
+   rxq->wr_p = 0;
+   rxq->rd_p = 0;
+   rxq->nb_rx_hold = 0;
+}
+
+static void
+nfp_net_tx_queue_release_mbufs(struct nfp_net_txq *txq)
+{
+   unsigned i;
+
+   if (txq->txbufs == NULL)
+   return;
+
+   for (i = 0; i < txq->tx_count; i++) {
+   if (txq->txbufs[i].mbuf) {
+   rte_pktmbuf_free_seg(txq->txbufs[i].mbuf);
+   txq->txbufs[i].mbuf = NULL;
+   }
+   }
+}
+
+static void
+nfp_net_tx_queue_release(void *tx_queue)
+{
+   struct nfp_net_txq *txq = tx_queue;
+
+   if (txq) {
+   nfp_net_tx_queue_release_mbufs(txq);
+   rte_free(txq->txbufs);
+   rte_free(txq);
+   }
+}
+
+static void
+nfp_net_reset_tx_queue(struct nfp_net_txq *txq)
+{
+   nfp_net_tx_queue_release_mbufs(txq);
+   txq->wr_p = 0;
+   txq->rd_p = 0;
+   txq->tail = 0;
+}
+
 static int
 __nfp_net_reconfig(struct nfp_net_hw *hw, uint32_t update)
 {
@@ -423,6 +534,18 @@ nfp_net_disable_queues(struct rte_eth_dev *dev)
hw->ctrl = new_ctrl;
 }

+static int
+nfp_net_rx_freelist_setup(struct rte_eth_dev *dev)
+{
+   int i;
+
+   for (i = 0; i < dev->data->nb_rx_queues; i++) {
+   if (nfp_net_rx_fill_freelist(dev->data->rx_queues[i]) < 0)
+   return -1;
+   }
+   return 0;
+}
+
 static void
 nfp_net_params_setup(struct nfp_net_hw *hw)
 {
@@ -451,6 +574,7 @@ nfp_net_start(struct 

[dpdk-dev] [PATCH v6 1/7] nfp: basic initialization

2015-11-05 Thread Alejandro.Lucero
From: "Alejandro.Lucero" 

Signed-off-by: Alejandro.Lucero 
Signed-off-by: Rolf.Neugebauer 
---
 MAINTAINERS  |4 +
 config/common_linuxapp   |6 +
 doc/guides/rel_notes/release_2_2.rst |3 +
 drivers/net/Makefile |1 +
 drivers/net/nfp/Makefile |   88 +
 drivers/net/nfp/nfp_net.c|  694 ++
 drivers/net/nfp/nfp_net_ctrl.h   |  290 ++
 drivers/net/nfp/nfp_net_logs.h   |   75 
 drivers/net/nfp/nfp_net_pmd.h|  434 +
 mk/rte.app.mk|1 +
 10 files changed, 1596 insertions(+)
 create mode 100644 drivers/net/nfp/Makefile
 create mode 100644 drivers/net/nfp/nfp_net.c
 create mode 100644 drivers/net/nfp/nfp_net_ctrl.h
 create mode 100644 drivers/net/nfp/nfp_net_logs.h
 create mode 100644 drivers/net/nfp/nfp_net_pmd.h

diff --git a/MAINTAINERS b/MAINTAINERS
index c8be5d2..72abbb2 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -260,6 +260,10 @@ M: Adrien Mazarguil 
 F: drivers/net/mlx5/
 F: doc/guides/nics/mlx5.rst

+Netronome nfp
+M: Alejandro Lucero 
+F: drivers/net/nfp/
+
 RedHat virtio
 M: Huawei Xie 
 M: Changchun Ouyang 
diff --git a/config/common_linuxapp b/config/common_linuxapp
index 7248262..5eaa680 100644
--- a/config/common_linuxapp
+++ b/config/common_linuxapp
@@ -250,6 +250,12 @@ CONFIG_RTE_LIBRTE_ENIC_PMD=y
 CONFIG_RTE_LIBRTE_ENIC_DEBUG=n

 #
+# Compile burst-oriented Netronome NFP PMD driver
+#
+CONFIG_RTE_LIBRTE_NFP_PMD=n
+CONFIG_RTE_LIBRTE_NFP_DEBUG=n
+
+#
 # Compile burst-oriented VIRTIO PMD driver
 #
 CONFIG_RTE_LIBRTE_VIRTIO_PMD=y
diff --git a/doc/guides/rel_notes/release_2_2.rst 
b/doc/guides/rel_notes/release_2_2.rst
index 59dda59..5431383 100644
--- a/doc/guides/rel_notes/release_2_2.rst
+++ b/doc/guides/rel_notes/release_2_2.rst
@@ -162,6 +162,9 @@ Drivers

   Fixed issue when releasing null control queue.

+* **nfp: adding new PMD for Netronome nfp-6xxx card.**
+
+  Support for using Netronome nfp-6xxx with PCI VFs.

 Libraries
 ~
diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index 6da1ce2..9d5cb78 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -42,6 +42,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += i40e
 DIRS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += ixgbe
 DIRS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += mlx4
 DIRS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += mlx5
+DIRS-$(CONFIG_RTE_LIBRTE_NFP_PMD) += nfp
 DIRS-$(CONFIG_RTE_LIBRTE_MPIPE_PMD) += mpipe
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_NULL) += null
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += pcap
diff --git a/drivers/net/nfp/Makefile b/drivers/net/nfp/Makefile
new file mode 100644
index 000..ef74e27
--- /dev/null
+++ b/drivers/net/nfp/Makefile
@@ -0,0 +1,88 @@
+#   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.
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+#
+# library name
+#
+LIB = librte_pmd_nfp.a
+
+CFLAGS += -O3
+CFLAGS += $(WERROR_FLAGS)
+
+#
+# Add extra flags for base driver files (also known as shared code)
+# to disable warnings
+#
+ifeq ($(CC), icc)
+CFLAGS_BASE_DRIVER = -wd593
+else ifeq ($(CC), clang)
+CFLAGS_BASE_DRIVER += -Wno-sign-compare
+CFLAGS_BASE_DRIVER += -Wno-unused-value
+CFLAGS_BASE_DRIVER += -Wno-unused-parameter
+CFLAGS_BASE_DRIVER += -Wno-strict-aliasing
+CFLAGS_BASE_DRIVER += -Wno-format

[dpdk-dev] [PATCH v6 0/7] support for netronome nfp-6xxx card

2015-11-05 Thread Alejandro.Lucero
From: "Alejandro.Lucero" 

This patchset adds a new PMD for Netronome nfp-6xxx card.
Just PCI Virtual Functions supported.
Using this PMD requires previous Netronome BSP installation.

v6:
 - Making each patch compilable

v5:
 - Splitting up patches by functionality

v4:
 - Getting rid of nfp_uio. Just submitting PMD

v3:
 - Making all patches independent for applying and building
 - changing commits messages following standard

v2:
 - Code style changes based on checkpatch.pl and DPDK style guide
 - Documentation changes using the right rst format
 - Moving the documentation files to a new patch file
 - Adding info to MAINTAINERS and release files

Alejandro.Lucero (7):
  nfp: basic initialization
  nfp: adding rx/tx functionality
  nfp: adding rss
  nfp: adding stats
  nfp: adding link functionality
  nfp: adding extra functionality
  nfp: adding nic guide

 MAINTAINERS  |5 +
 config/common_linuxapp   |6 +
 doc/guides/nics/index.rst|1 +
 doc/guides/nics/nfp.rst  |  189 +++
 doc/guides/rel_notes/release_2_2.rst |3 +
 drivers/net/Makefile |1 +
 drivers/net/nfp/Makefile |   88 ++
 drivers/net/nfp/nfp_net.c| 2364 ++
 drivers/net/nfp/nfp_net_ctrl.h   |  290 +
 drivers/net/nfp/nfp_net_logs.h   |   75 ++
 drivers/net/nfp/nfp_net_pmd.h|  434 +++
 mk/rte.app.mk|1 +
 12 files changed, 3457 insertions(+)
 create mode 100644 doc/guides/nics/nfp.rst
 create mode 100644 drivers/net/nfp/Makefile
 create mode 100644 drivers/net/nfp/nfp_net.c
 create mode 100644 drivers/net/nfp/nfp_net_ctrl.h
 create mode 100644 drivers/net/nfp/nfp_net_logs.h
 create mode 100644 drivers/net/nfp/nfp_net_pmd.h

-- 
1.7.9.5



[dpdk-dev] [RFC PATCH] vhost: remove lockless enqueue to virt ring

2015-11-05 Thread Xie, Huawei
If no objections, would remove the internal cmpset enqueue, should get
some improved performance.

No idea why commit message is lost:
DPDK doesn't support receiving/transmitting packets from/to the same
port/queue.
Vhost pmd wraps vhost device as normal dpdk port. dpdkvhost based
applications/switch
 also treate virtio port and physical port both as ports, and have
their  own
lock implmentation when to enqueue packets to the same port. This patch
removes
the internal lockless vhost enqueue implmentation.
On 11/5/2015 5:38 PM, Huawei Xie wrote:
> Signed-off-by: Huawei Xie 



[dpdk-dev] [PATCH v3 6/8] driver/virtio:enqueue vhost TX offload

2015-11-05 Thread Thomas Monjalon
2015-11-05 08:49, Xu, Qian Q:
> Test Case 1:  test_dpdk vhost+ virtio-pmd tso 
[...]
> Test Case 2:  test_dpdk vhost+legacy virtio iperf tso
[...]
> Yes please, I'd like to see a test report showing this virtio running with 
> Linux vhost and without vhost.
> We must check that the checksum is well offloaded and sent packets are valids.
> Thanks

Thanks for doing some tests.
I had no doubt it works with DPDK vhost.
Please could you do some tests without vhost and with kernel vhost?
We need to check that the checksum is not missing in such cases.


[dpdk-dev] [PATCH] cmdline: increase commandline buffer size to 512

2015-11-05 Thread John McNamara
Increase commandline buffer size to 512 to allow for longer
commandlines required by testpmd when dealing with flow
director and IPv6 addresses.

Signed-off-by: John McNamara 
---
 lib/librte_cmdline/cmdline_rdline.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/librte_cmdline/cmdline_rdline.h 
b/lib/librte_cmdline/cmdline_rdline.h
index b9aad9b..72e2dad 100644
--- a/lib/librte_cmdline/cmdline_rdline.h
+++ b/lib/librte_cmdline/cmdline_rdline.h
@@ -93,7 +93,7 @@ extern "C" {
 #endif

 /* configuration */
-#define RDLINE_BUF_SIZE 256
+#define RDLINE_BUF_SIZE 512
 #define RDLINE_PROMPT_SIZE  32
 #define RDLINE_VT100_BUF_SIZE  8
 #define RDLINE_HISTORY_BUF_SIZE BUFSIZ
-- 
1.8.1.4



[dpdk-dev] SR-IOV: API to tell VF from PF

2015-11-05 Thread Bruce Richardson
On Thu, Nov 05, 2015 at 09:39:19AM +, Shaham Fridenberg wrote:
> Hey all,
> 
> Is there some API to tell VF from PF?
> 
> Only way I found so far is deducing that from driver name in the 
> rte_eth_devices struct.
> 
> Thanks,
> Shaham

Hi Shaham,

yes, checking the driver name is probably the only way to do so. However, why do
you need or want to know this? If you want to know the capabilities of a device
basing it on a list of known device types is probably not the best way.

Regards,
/Bruce


[dpdk-dev] FOSDEM - call for participation

2015-11-05 Thread Dave Neary
Thank you Thomas!

Please note that I made the mistake of leaving some te;mplate from last
year's announcement in the email - my apologies! The correct dates for
the conference and deadlines are in this version:
  https://lists.fosdem.org/pipermail/fosdem/2015-November/002300.html

Thanks,
Dave.

On 11/04/2015 06:29 PM, Thomas Monjalon wrote:
> As every year, at the end of January, the biggest european developers
> conference takes place in Brussels, Belgium.
> 
> This year, there will be an SDN/NFV DevRoom.
> You can submit a talk proposal before November 18.
> 
> Topic examples:
> * SDN controllers - OpenDaylight, OpenContrail, ONOS, Midonet, OVN,
> OpenStack Neutron,Calico, IOvisor, ...
> * Dataplane processing: DPDK, OpenDataplane, netdev, netfilter, ClickRouter
> * Virtual switches: Open vSwitch, Snabb Switch, VDE, Lagopus
> * Open network protocols: OpenFlow, NETCONF, OpenLISP, eBPF, P4, Quagga
> * Management and Orchestration (MANO): Deployment and management of
> network functions, policy enforcement, virtual network functions
> definition - rift.io, Cloudify, OpenMANO, Tacker, ...
> * Open source network functions: Clearwater IMS, FreeSWITCH, OpenSIPS, ...
> * NFV platform features: Service Function Chaining, fault management,
> dataplane acceleration, ...
> 
> The announce by Dave Neary:
> https://lists.fosdem.org/pipermail/fosdem/2015-October/002282.html
> 
> It is also a good opportunity to drink some really good beers ;)
> 

-- 
Dave Neary - NFV/SDN Community Strategy
Open Source and Standards, Red Hat - http://community.redhat.com
Ph: +1-978-399-2182 / Cell: +1-978-799-3338


[dpdk-dev] SR-IOV: API to tell VF from PF

2015-11-05 Thread Shaham Fridenberg
Hey all,

Is there some API to tell VF from PF?

Only way I found so far is deducing that from driver name in the 
rte_eth_devices struct.

Thanks,
Shaham


[dpdk-dev] [PATCH v2] kni: Use utsrelease.h to determine Ubuntu kernel version

2015-11-05 Thread Simon Kågström
On 2015-11-04 19:21, Stephen Hemminger wrote:
> On Wed, 4 Nov 2015 12:29:01 +0100
> Simon K?gstr?m  wrote:
> 
>> On 2015-11-04 11:35, Thomas Monjalon wrote:
>>> 2015-08-20 08:51, Simon Kagstrom:
 -ifeq ($(shell test -f /proc/version_signature && lsb_release -si 
 2>/dev/null),Ubuntu)
 +ifeq ($(shell lsb_release -si 2>/dev/null),Ubuntu)
  MODULE_CFLAGS += -DUBUNTU_RELEASE_CODE=$(shell lsb_release -sr | tr -d .)
 -UBUNTU_KERNEL_CODE := $(shell cut -d' ' -f2 /proc/version_signature | \
 -cut -d'~' -f1 | cut -d- -f1,2 | tr .- $(comma))
 +UBUNTU_KERNEL_CODE := $(shell echo `grep UTS_RELEASE 
 $(RTE_KERNELDIR)/include/generated/utsrelease.h \
 +   | cut -d '"' -f2 | cut -d- -f1,2 | tr .- $(comma)`,1)
  MODULE_CFLAGS += 
 -D"UBUNTU_KERNEL_CODE=UBUNTU_KERNEL_VERSION($(UBUNTU_KERNEL_CODE))"
  endif
>>>
>> So lsb_release will come from the chroot, as it should, but without the
>> patch, the kernel version will not come from the installed kernel
>> headers in the chroot, but the running kernel - which might even not be
>> Ubuntu.
> 
> The danger here is starting to assume the build machine is the same as the
> running image. Using /proc to determine runtime environment is wrong.

Exactly, and our build breaks because of this without the patch. So the
patch removes the check in /proc and instead takes the kernel version
from the kernel headers.

// Simon



[dpdk-dev] BUG: DPDK i40e does not work with VFIO

2015-11-05 Thread Stephen Hemminger
On my machine, i40e will not startup if using VFIO.

PMD: rte_i40evf_pmd_init():  >>
PMD: rte_i40e_pmd_init():  >>
PMD: eth_i40e_dev_init():  >>
PMD: i40e_set_symmetric_hash_enable_per_port(): Symmetric hash has already been 
disabled
PMD: eth_i40e_dev_init(): Failed to init adminq: -54

The normal Linux driver works correctly. Firmware has been updated to the 
latest version.

Like my earlier experience with fm10k, I suspect that Intel never tests i40e 
with IOMMU,
and only tested with igb_uio.


[dpdk-dev] How can I calculate/estimate pps(packet per seocond) and bps(bit per second) in DPDK pktg

2015-11-05 Thread 최익성
 Dear Polehn, Mike A and DPDK experts. 

Thank you very much for your previous advice and answer.

I used the method you proposed.

I dont't understand that the data rate includes preamble and inter-packet gap 
since the preamble and the inter-packet gap are not packet data.

There are significant packet bursts in DPDK packet stream.

I used average value of gps/pps history (128 history).

It works well.

Thank you very much.

Sincerely Yours,

Ick-Sung Choi.


-Original Message-
From: "Polehn, Mike A"mike.a.pol...@intel.com 
To: "???"pnk003 at naver.com; "Wiles, Keith"keith.wiles at 
intel.com; "Van Haaren, Harry"harry.van.haaren at intel.com; "dev 
at dpdk.org"dev at dpdk.org; 
Cc: 
Sent: 2015-11-04 (?) 23:21:54
Subject: RE: [dpdk-dev] How can I calculate/estimate pps(packet per seocond) 
and bps(bit per second) in DPDK pktg









The change in tsc value from rte_rdtsc() needs to be multiplied by the scale to 
convert from clocks to get change in seconds.

For example from below:



elapse_us = (rte_rdtsc() - entry-tsc_first_packet) * flow_time_scale_us;



The bit rate requires the number of bytes passed in the time period then 
adjusted by the overhead of the number of packets transferred in the time 
period.



#define FLOWD_PERF_PACKET_OVERHEAD 24 /* CRC + Preamble + SOF + Interpacket gap 
*/






Bits = (Bytes + (Packets*FLOWD_PERF_PACKET_OVERHEAD)) * 8;

Data_Rate = (((double)Bits) / Time_us) * 1e6;






Integer math is very tricky and often is not any faster than floating point 
math when using multiplies except on the very low performance processors.



Mike





From:
??? [mailto:pnk003 at naver.com]


Sent: Tuesday, November 3, 2015 5:45 PM

To: Polehn, Mike A; Wiles, Keith; Van Haaren, Harry; dev at dpdk.org

Subject: RE: [dpdk-dev] How can I calculate/estimate pps(packet per seocond) 
and bps(bit per second) in DPDK pktg






Dear  Wiles, Keith ,  Van Haaren, Harry,  Polehn, Mike A,  Stephen Hemminger, 
Kyle Larose, and DPDK experts. 



I really appreciate for your precious answers and advices.



I will find and study the corresponding codes and CRC checking.





Last night, I tried to estimate bps and pps by using the following code.





// rte_distributor_process() gets 64 mbufs packets at a time.

// rte_distributor_process() gets packets from Intel? 82599ES 10 Gigabit 
Ethernet 2 port Controller (2 10gbE ports).



int  rte_distributor_process(struct rte_distributor *d, struct rte_mbuf 
**mbufs, unsigned num_mbufs)

{

uint64_t ticks_per_ms = rte_get_tsc_hz()/1000 ;

uint64_t ticks_per_s = rte_get_tsc_hz() ;

uint64_t ticks_per_s_div_8 = rte_get_tsc_hz()/8 ;

uint64_t cur_tsc = 0, last_tsc = 0, sum_len, bps, pps ;



cur_tsc = rte_rdtsc();



sum_len = 0 ; 

for (l=0; l  num_mbufs; l++ ) { sum_len += mbufs[l]-pkt_len ; }



if ((cur_tsc - last_tsc)!=0) { 

   bps = (sum_len * ticks_per_s_div_8 ) / (cur_tsc - last_tsc) ; 

   pps = num_mbufs * ticks_per_s / (cur_tsc - last_tsc) ; 

} else bps = pps = 0 ;



last_tsc = cur_tsc ;

}



I got  max. bit per second = 6,835,440,833 for 20 Gbps 1500 bytes packet 
traffic, and got max. bit per second = 6,808,524,220 for 2 Gbps 1500 bytes 
packet traffic.



I guess there can be packet burst, however the estimated value has too many 
errors.



I will try the methods you proposed. 



Thank you very much.



Sincerely Yours,



Ick-Sung Choi.





-Original Message-

From: "Polehn, Mike A"mike.a.pol...@intel.com


To: "Wiles, Keith"keith.wiles at intel.com; "Van Haaren, 
Harry"harry.van.haaren at intel.com; "???"pnk003 at naver.com; 
"dev at dpdk.org"dev at dpdk.org;


Cc: 

Sent: 2015-11-04 (?) 00:59:34

Subject: RE: [dpdk-dev] How can I calculate/estimate pps(packet per seocond) 
and bps(bit per second) in DPDK pktg



I used the following code snip-it with the i40e device, with 1 second sample 
time had very high accuracy for IPv4 UDP packets:




#define FLOWD_PERF_PACKET_OVERHEAD 24 /* CRC + Preamble + SOF + Interpacket gap 
*/


#define FLOWD_REF_NETWORK_SPEED 10e9 



double Ave_Bytes_per_Packet, Data_Rate, Net_Rate; 

uint64_t Bits; 

uint64_t Bytes = pFlow-flow.n_bytes - pMatch_Prev-flow.n_bytes; 

uint64_t Packets = pFlow-flow.n_packets - pMatch_Prev-flow.n_packets; 

uint64_t Time_us = pFlow-flow.flow_time_us - 
pMatch_Prev-flow.flow_time_us; 



if (Bytes == 0) 

Ave_Bytes_per_Packet = 0.0; 

else 

Ave_Bytes_per_Packet = ((double)Bytes / (double)Packets) + 4.0; 



Bits = (Bytes + (Packets*FLOWD_PERF_PACKET_OVERHEAD)) * 8; 

if (Bits == 0) 

Data_Rate = 0.0; 

else 

Data_Rate = (((double)Bits) / Time_us) * 1e6; 



if (Data_Rate == 0.0) 

Net_Rate = 0.0; 

else 

Net_Rate = Data_Rate / FLOWD_REF_NETWORK_SPEED; 



For packet rate: double pk_rate = (((double)Packets)/ ((double)Time_us)) * 1e6; 



To calculate elapsed time in DPDK app, used CPU counter (will not work if 
counter is being modified):





[dpdk-dev] [PATCH v3 6/8] driver/virtio:enqueue vhost TX offload

2015-11-05 Thread Xu, Qian Q
Tested-by: Qian Xu 

- Test Commit: c4d404d7c1257465176deb5bb8c84e627d2d5eee
- OS/Kernel: Fedora 21/4.1.8
- GCC: gcc (GCC) 4.9.2 20141101 (Red Hat 4.9.2-1)
- CPU: Intel(R) Xeon(R) CPU E5-2699 v3 @ 2.30GHz
- NIC: Intel Corporation 82599ES 10-Gigabit SFI/SFP+ Network Connection (rev 01)
- Target: Intel Corporation 82599ES 10-Gigabit SFI/SFP+ Network Connection (rev 
01)
- Total 2 cases, 2 passed, 0 failed. DPDK vhost + legacy virtio or virtio-pmd 
can work well with TSO. 

Test Case 1:  test_dpdk vhost+ virtio-pmd tso 
==

On host:

1. Start up vhost-switch, mergeable 1 means the jubmo frame feature is enabled. 
vm2vm 0 means only one vm without vm to vm communication::

taskset -c 1-3 /examples/vhost/build/vhost-switch -c 0xf -n 4 
--huge-dir /mnt/huge --socket-mem 1024,1024 -- -p 1 --mergeable 1 --zero-copy 0 
--vm2vm 0 --tso 1 --tx-csum 1


2. Start VM with vhost cuse as backend::

taskset -c 4-6  /home/qxu10/qemu-2.2.0/x86_64-softmmu/qemu-system-x86_64 
-object memory-backend-file, id=mem,size=2048M,mem-path=/mnt/huge,share=on 
-numa node,memdev=mem -mem-prealloc \
-enable-kvm -m 2048 -smp 4 -cpu host -name dpdk1-vm1 \
-drive file=/home/img/dpdk1-vm1.img \
-netdev tap,id=vhost3,ifname=tap_vhost3,vhost=on,script=no \
-device virtio-net pci,netdev=vhost3,mac=52:54:00:00:00:01,id=net3 \
-netdev tap,id=vhost4,ifname=tap_vhost4,vhost=on,script=no \
-device virtio-net-pci,netdev=vhost4,mac=52:54:00:00:00:02,id=net4 \
-netdev tap,id=ipvm1,ifname=tap3,script=/etc/qemu-ifup -device 
rtl8139,netdev=ipvm1,id=net0,mac=00:00:00:00:00:01 \
-localtime -nographic

On guest:

3. ensure the dpdk folder copied to the guest with the same config file and 
build process as host. Then bind 2 virtio devices to igb_uio and start testpmd, 
below is the step for reference::

.//tools/dpdk_nic_bind.py --bind igb_uio 00:03.0 00:04.0

.//x86_64-native-linuxapp-gcc/app/test-pmd/testpmd -c f -n 4 
-- -i --txqflags 0x0f00 --max-pkt-len 9000 

$ >set fwd csum

$ >tso set 1000 0
$ >tso set 1000 1

$ >start tx_first

4.  Send TCP packets to virtio1, and the packet size is 5000, then at the 
virtio side, it will receive 1 packet ant let vhost to do TSO, vhost will let 
NIC do TSO, so at IXIA, we expected 5 packets, each ~1k size, then also capture 
the received packets and check if the checksum is correct.

Result:  All the behavior is expected as step4. So the case is PASS.

Test Case 2:  test_dpdk vhost+legacy virtio iperf tso
===
Hardware config: Connect one physical port(port1) to another physical 
port(port2). Port1 is the NIC port that will do the TSO.
1. Start dpdk vhost sample, the command is same as above case. Port1 is binded 
to igb_uio
2. start VM with 1 virtio
3. let port2 and 1virtio in VM do iperf test, since iperf test will send out 
VIRTIO: ifconfig eth0 1.1.1.2
Port2: ifconfig p2p6 1.1.1.8
Make ping work: ping 1.1.1.8 
Then run iperf server at port2: iperf -s -I 1
Run iperf client at port1: iperf -c 1.1.1.8 -t 60 -I 1

Check the packet size at virtio and port2 to see if there are many 64KB packet, 
if has, then pass. The reason is that vhost/virtio will first negotiate if each 
other supports tso, if supports, then the TCP/IP stack will compose BIG packets 
such as 64KB, since NIC has the TSO capability, vhost will let NIC do the TSO 
work, then at port2, the small packets will be composed to big packets with 
TCP/IP stack.  

Result: there are many 64KB packet in both virtio and port2, so it is pass. 

Thanks
Qian


-Original Message-
From: dev [mailto:dev-boun...@dpdk.org] On Behalf Of Thomas Monjalon
Sent: Wednesday, November 04, 2015 9:18 PM
To: Liu, Jijiang
Cc: dev at dpdk.org; Michael S. Tsirkin
Subject: Re: [dpdk-dev] [PATCH v3 6/8] driver/virtio:enqueue vhost TX offload

2015-11-04 12:52, Liu, Jijiang:
> From: Thomas Monjalon [mailto:thomas.monjalon at 6wind.com]
> > Please could you check that your virtio implementation works with a 
> > vanilla Linux with or without vhost?
> > Thanks
[...]
> Xu Qian can send the test report out.  

Yes please, I'd like to see a test report showing this virtio running with 
Linux vhost and without vhost.
We must check that the checksum is well offloaded and sent packets are valids.
Thanks


  1   2   >