[dpdk-dev] [discuss]emulated e1000 device with qemu is not showing nic stats correctly

2015-02-06 Thread Srinivasreddy R
Hi ,

I have emulated  virtual e1000  device  using qemu  .

I have binded to igb_uio . and run PacketGen  .

Now I am able to receive and transmit packets on the device .

But PacketGen is not showing  Tx/Rx  Rate .

I have put  printed  struct rte_eth_stats after fetching nic stats . except
tx, rx packet count all the other  fields are zeroes .

I am facing the same issue with my dpdk application .



Is it a bug / known issue  ? . I have used dpdk1.7.

Have any faced it earlier .


qemu:

qemu-system-x86_64   -device e1000  ..



on the VM :


# lspci

00.03.0 Ethernet controller: Intel Corporation 82540EM Gigabit Ethernet
Controller (rev 03)



my dpdk app eal_inti  :



EAL: core 1 is ready  (tid=2b7fe700)

EAL: PCI device .00.03.0 on NUMA socket -1

EAL: probe driver: 8086:100e rte_em_pmd

EAL: PCI memory mapped at 0x7f602c96e000



dpdk_nic_bind.py --status

Network devices using DPDK-compatible driver



:00:03:0 '82540EM Gigabit Ethernet controller' drv=igb_uio unused=





Thanks

Srinivas.


[dpdk-dev] [PATCH] vhost: notify guest to fill buffer when there is no buffer

2015-02-06 Thread Linhaifeng


On 2015/2/6 13:54, Xu, Qian Q wrote:
> Haifeng
> Are you using the latest dpdk branch with vhost-user patches? I have never 
> met the issue.
> When is the vhost sample crashed? When you start VM or when you run sth in 
> VM? Is your qemu 2.2? How about your memory info? Could you give more details 
> about your steps? 
> 
> 
Hi,Xu
what is sth means?

I use the dpdk branch of a09f3e4c50467512970519943d26d9c5753584e0 and qemu 
branch of v2.2.0.

Here is my host information:
linux-mRFnwZ:/mnt/sdc/linhf/dpdk-vhost-user/dpdk # free
 total   used   free sharedbuffers cached
Mem:  82450600   22555172   59895428  015061323205304
-/+ buffers/cache:   17843736   64606864
Swap:0  0  0
linux-mRFnwZ:/mnt/sdc/linhf/dpdk-vhost-user/dpdk # cat /proc/meminfo |grep Huge
AnonHugePages: 20480 kB
HugePages_Total:8192
HugePages_Free: 7052
HugePages_Rsvd:  396
HugePages_Surp:0
Hugepagesize:   2048 kB
linux-mRFnwZ:/mnt/sdc/linhf/dpdk-vhost-user/dpdk # uname -a
Linux linux-mRFnwZ 3.0.93-0.8-default #1 SMP Tue Aug 27 08:44:18 UTC 2013 
(70ed288) x86_64 x86_64 x86_64 GNU/Linux

Here is my guest infomation:
SUSE 11 SP3 with kernel 3.0.76-0.8-default


step:
umount /dev/hugepages/
rmmod igb_uio
rmmod rte_kni

mount -t hugetlbfs nodev /dev/hugepages -o pagesize=2M
echo 8192 > /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages

export RTE_SDK=/mnt/sdc/linhf/dpdk-vhost-user/dpdk
export RTE_TARGET=x86_64-native-linuxapp-gcc

modprobe uio
insmod ${RTE_SDK}/x86_64-native-linuxapp-gcc/kmod/igb_uio.ko
dpdk_nic_bind.py -b igb_uio 02:00.0 02:00.1

rmmod vhost_net
modprobe cuse
insmod ${RTE_SDK}/lib/librte_vhost/eventfd_link/eventfd_link.ko

${RTE_SDK}/examples/vhost/build/app/vhost-switch -c 0x300 -n 4 --huge-dir 
/dev/hugepages -m 2048 -- -p 0x1 --vm2vm 2 --mergeable 0 --zero-copy 0


qemu-system-x86_64 -name vm1 -enable-kvm -smp 2 -m 1024 \
-object memory-backend-file,id=mem,size=1024M,mem-path=/dev/hugepages,share=on 
-numa node,memdev=mem \
-chardev socket,id=chr0,path=/mnt/sdc/linhf/dpdk-vhost-user/vhost-net  \
-netdev type=vhost-user,id=net0,chardev=chr0 -device 
virtio-net-pci,netdev=net0,mac=00:00:00:00:00:01,csum=off,gso=off,guest_tso4=off,guest_tso6=off,guest_ecn=off
 \
-chardev socket,id=chr1,path=/mnt/sdc/linhf/dpdk-vhost-user/vhost-net  \
-netdev type=vhost-user,id=net1,chardev=chr1 -device 
virtio-net-pci,netdev=net1,mac=00:00:00:00:00:02,csum=off,gso=off,guest_tso4=off,guest_tso6=off,guest_ecn=off
 \
-drive file=/mnt/sdc/linhf/vm1.img -vnc :0
qemu-system-x86_64: -netdev type=vhost-user,id=net0,chardev=chr0: chardev 
"chr0" went up

qemu-system-x86_64: -netdev type=vhost-user,id=net1,chardev=chr1: chardev 
"chr1" went up


EAL: Detected lcore 0 as core 0 on socket 1
EAL: Detected lcore 1 as core 1 on socket 1
EAL: Detected lcore 2 as core 9 on socket 1
EAL: Detected lcore 3 as core 10 on socket 1
EAL: Detected lcore 4 as core 0 on socket 0
EAL: Detected lcore 5 as core 1 on socket 0
EAL: Detected lcore 6 as core 9 on socket 0
EAL: Detected lcore 7 as core 10 on socket 0
EAL: Detected lcore 8 as core 0 on socket 1
EAL: Detected lcore 9 as core 1 on socket 1
EAL: Detected lcore 10 as core 9 on socket 1
EAL: Detected lcore 11 as core 10 on socket 1
EAL: Detected lcore 12 as core 0 on socket 0
EAL: Detected lcore 13 as core 1 on socket 0
EAL: Detected lcore 14 as core 9 on socket 0
EAL: Detected lcore 15 as core 10 on socket 0
EAL: Support maximum 128 logical core(s) by configuration.
EAL: Detected 16 lcore(s)
EAL: Setting up memory...
EAL: Ask a virtual area of 0x2 bytes
EAL: Virtual area found at 0x7f3b5740 (size = 0x2)
EAL: Ask a virtual area of 0x20 bytes
EAL: Virtual area found at 0x7f3b5700 (size = 0x20)
EAL: Ask a virtual area of 0x1ffe0 bytes
EAL: Virtual area found at 0x7f395700 (size = 0x1ffe0)
EAL: Requesting 1024 pages of size 2MB from socket 1
EAL: WARNING: clock_gettime cannot use CLOCK_MONOTONIC_RAW and HPET is not 
available - clock timings may be less accurate.
EAL: TSC frequency is ~2400234 KHz
EAL: Master core 8 is ready (tid=5a596800)
EAL: Core 9 is ready (tid=58d34700)
EAL: PCI device :02:00.0 on NUMA socket -1
EAL:   probe driver: 8086:10fb rte_ixgbe_pmd
EAL:   PCI memory mapped at 0x7f3b5720
EAL:   PCI memory mapped at 0x7f3b5728
PMD: eth_ixgbe_dev_init(): MAC: 2, PHY: 17, SFP+: 5
PMD: eth_ixgbe_dev_init(): port 0 vendorID=0x8086 deviceID=0x10fb
EAL: PCI device :02:00.1 on NUMA socket -1
EAL:   probe driver: 8086:10fb rte_ixgbe_pmd
EAL:   PCI memory mapped at 0x7f3b57284000
EAL:   PCI memory mapped at 0x7f3b57304000
PMD: eth_ixgbe_dev_init(): MAC: 2, PHY: 1
PMD: eth_ixgbe_dev_init(): port 1 vendorID=0x8086 deviceID=0x10fb
pf queue num: 0, configured vmdq pool num: 64, each vmdq pool has 2 queues
PMD: ixgbe_dev_rx_queue_setup(): sw_ring=0x7f3957aebbc0 hw_ring=0x7f3b57028580 
dma_addr=0xedf428580
PMD: ixgbe_dev_rx_queue_setup(): Rx Burst 

[dpdk-dev] [PATCH v3] maintainers: claim hash and lpm libraries

2015-02-06 Thread Bruce Richardson
Signed-off-by: Bruce Richardson 
---
 MAINTAINERS | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 7a2c3ba..99cb6b7 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -278,12 +278,14 @@ F: examples/l3fwd-acl/
 F: doc/guides/sample_app_ug/l3_forward_access_ctrl.rst

 Hashes
+M: Bruce Richardson 
 F: lib/librte_hash/
 F: doc/guides/prog_guide/hash_lib.rst
 F: app/test/test_hash*
 F: app/test/test_func_reentrancy.c

 LPM
+M: Bruce Richardson 
 F: lib/librte_lpm/
 F: doc/guides/prog_guide/lpm*
 F: app/test/test_lpm*
-- 
2.1.0



[dpdk-dev] [PATCH v2] maintainers: claim hash and lpm libraries

2015-02-06 Thread Bruce Richardson
Signed-off-by: Bruce Richardson 

remove me from cfgfile
---
 MAINTAINERS | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 7a2c3ba..99cb6b7 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -278,12 +278,14 @@ F: examples/l3fwd-acl/
 F: doc/guides/sample_app_ug/l3_forward_access_ctrl.rst

 Hashes
+M: Bruce Richardson 
 F: lib/librte_hash/
 F: doc/guides/prog_guide/hash_lib.rst
 F: app/test/test_hash*
 F: app/test/test_func_reentrancy.c

 LPM
+M: Bruce Richardson 
 F: lib/librte_lpm/
 F: doc/guides/prog_guide/lpm*
 F: app/test/test_lpm*
-- 
2.1.0



[dpdk-dev] [PATCH] maintainers: claim hash, lpm and cfgfile libraries

2015-02-06 Thread Bruce Richardson
On Fri, Feb 06, 2015 at 01:57:07PM +, Bruce Richardson wrote:
> Signed-off-by: Bruce Richardson 
Self-NAK this version - Cristian has already claimed cfgfile and I'm happy to
let him have it :-)

> ---
>  MAINTAINERS | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 7a2c3ba..cf6baff 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -278,12 +278,14 @@ F: examples/l3fwd-acl/
>  F: doc/guides/sample_app_ug/l3_forward_access_ctrl.rst
>  
>  Hashes
> +M: Bruce Richardson 
>  F: lib/librte_hash/
>  F: doc/guides/prog_guide/hash_lib.rst
>  F: app/test/test_hash*
>  F: app/test/test_func_reentrancy.c
>  
>  LPM
> +M: Bruce Richardson 
>  F: lib/librte_lpm/
>  F: doc/guides/prog_guide/lpm*
>  F: app/test/test_lpm*
> @@ -301,6 +303,7 @@ Other libraries
>  ---
>  
>  Configuration file
> +M: Bruce Richardson 
>  F: lib/librte_cfgfile/
>  
>  Interactive command line
> -- 
> 2.1.0
> 


[dpdk-dev] [PATCH v4 16/17] ring: add sched_yield to avoid spin forever

2015-02-06 Thread Olivier MATZ
Hi,

On 02/02/2015 03:02 AM, Cunming Liang wrote:
> Add a sched_yield() syscall if the thread spins for too long, waiting other 
> thread to finish its operations on the ring.
> That gives pre-empted thread a chance to proceed and finish with ring 
> enqnue/dequeue operation.
> The purpose is to reduce contention on the ring.
> 
> Signed-off-by: Cunming Liang 
> ---
>  lib/librte_ring/rte_ring.h | 35 +--
>  1 file changed, 29 insertions(+), 6 deletions(-)
> 
> diff --git a/lib/librte_ring/rte_ring.h b/lib/librte_ring/rte_ring.h
> index 39bacdd..c402c73 100644
> --- a/lib/librte_ring/rte_ring.h
> +++ b/lib/librte_ring/rte_ring.h
> @@ -126,6 +126,7 @@ struct rte_ring_debug_stats {
>  
>  #define RTE_RING_NAMESIZE 32 /**< The maximum length of a ring name. */
>  #define RTE_RING_MZ_PREFIX "RG_"
> +#define RTE_RING_PAUSE_REP 0x100  /**< yield after num of times pause. */
>  
>  /**
>   * An RTE ring structure.
> @@ -410,7 +411,7 @@ __rte_ring_mp_do_enqueue(struct rte_ring *r, void * const 
> *obj_table,
>   uint32_t cons_tail, free_entries;
>   const unsigned max = n;
>   int success;
> - unsigned i;
> + unsigned i, rep;
>   uint32_t mask = r->prod.mask;
>   int ret;
>  
> @@ -468,8 +469,19 @@ __rte_ring_mp_do_enqueue(struct rte_ring *r, void * 
> const *obj_table,
>* If there are other enqueues in progress that preceded us,
>* we need to wait for them to complete
>*/
> - while (unlikely(r->prod.tail != prod_head))
> - rte_pause();
> + do {
> + /* avoid spin too long waiting for other thread finish */
> + for (rep = RTE_RING_PAUSE_REP;
> +  rep != 0 && r->prod.tail != prod_head; rep--)
> + rte_pause();
> +
> + /*
> +  * It gives pre-empted thread a chance to proceed and
> +  * finish with ring enqnue operation.
> +  */
> + if (rep == 0)
> + sched_yield();
> + } while (rep == 0);
>  
>   r->prod.tail = prod_next;
>   return ret;
> @@ -589,7 +601,7 @@ __rte_ring_mc_do_dequeue(struct rte_ring *r, void 
> **obj_table,
>   uint32_t cons_next, entries;
>   const unsigned max = n;
>   int success;
> - unsigned i;
> + unsigned i, rep;
>   uint32_t mask = r->prod.mask;
>  
>   /* move cons.head atomically */
> @@ -634,8 +646,19 @@ __rte_ring_mc_do_dequeue(struct rte_ring *r, void 
> **obj_table,
>* If there are other dequeues in progress that preceded us,
>* we need to wait for them to complete
>*/
> - while (unlikely(r->cons.tail != cons_head))
> - rte_pause();
> + do {
> + /* avoid spin too long waiting for other thread finish */
> + for (rep = RTE_RING_PAUSE_REP;
> +  rep != 0 && r->cons.tail != cons_head; rep--)
> + rte_pause();
> +
> + /*
> +  * It gives pre-empted thread a chance to proceed and
> +  * finish with ring denqnue operation.
> +  */
> + if (rep == 0)
> + sched_yield();
> + } while (rep == 0);
>  
>   __RING_STAT_ADD(r, deq_success, n);
>   r->cons.tail = cons_next;
> 

The ring library was designed with the assumption that the code is not
preemptable. The code is lock-less but not wait-less. Actually, if the
code is preempted at a bad moment, it can spin forever until it's
unscheduled.

I wonder if adding a sched_yield() may not penalize the current
implementations that only use one pthread per core? Even if there
is only one pthread in the scheduler queue for this CPU, calling
the scheduler code may cost thousands of cycles.

Also, where does this value "RTE_RING_PAUSE_REP 0x100" comes from?
Why 0x100 is better than 42 or than 1?

I think it could be good to check if there is a performance impact
with this change, especially where there is a lot of contention on
the ring. If it has an impact, what about adding a compile or runtime
option?


Regards,
Olivier


[dpdk-dev] [PATCH v3 2/5] app: New reorder unit test

2015-02-06 Thread Sergio Gonzalez Monroy
Adding new reorder unit test for the test app.
The command to run the unit test from the test shell is: reorder_autotest

Signed-off-by: Reshma Pattan 
Signed-off-by: Sergio Gonzalez Monroy 
---
 app/test/Makefile   |   2 +
 app/test/test_reorder.c | 393 
 mk/rte.app.mk   |   4 +
 3 files changed, 399 insertions(+)
 create mode 100644 app/test/test_reorder.c

diff --git a/app/test/Makefile b/app/test/Makefile
index 4311f96..24b27d7 100644
--- a/app/test/Makefile
+++ b/app/test/Makefile
@@ -124,6 +124,8 @@ SRCS-$(CONFIG_RTE_LIBRTE_IVSHMEM) += test_ivshmem.c
 SRCS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR) += test_distributor.c
 SRCS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR) += test_distributor_perf.c

+SRCS-$(CONFIG_RTE_LIBRTE_REORDER) += test_reorder.c
+
 SRCS-y += test_devargs.c
 SRCS-y += virtual_pmd.c
 SRCS-y += packet_burst_generator.c
diff --git a/app/test/test_reorder.c b/app/test/test_reorder.c
new file mode 100644
index 000..61cf8d3
--- /dev/null
+++ b/app/test/test_reorder.c
@@ -0,0 +1,393 @@
+/*-
+ *   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 "test.h"
+#include "stdio.h"
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "test.h"
+
+#define BURST 32
+#define REORDER_BUFFER_SIZE 16384
+#define NUM_MBUFS (2*REORDER_BUFFER_SIZE)
+#define REORDER_BUFFER_SIZE_INVALID 2049
+#define MBUF_SIZE (2048 + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM)
+
+struct reorder_unittest_params {
+   struct rte_mempool *p;
+   struct rte_reorder_buffer *b;
+};
+
+static struct reorder_unittest_params default_params  = {
+   .p = NULL,
+   .b = NULL
+};
+
+static struct reorder_unittest_params *test_params = _params;
+
+static int
+test_reorder_create(void)
+{
+   struct rte_reorder_buffer *b = NULL;
+
+   b = rte_reorder_create(NULL, rte_socket_id(), REORDER_BUFFER_SIZE);
+   TEST_ASSERT((b == NULL) && (rte_errno == EINVAL),
+   "No error on create() with NULL name");
+
+   b = rte_reorder_create("PKT", rte_socket_id(), 
REORDER_BUFFER_SIZE_INVALID);
+   TEST_ASSERT((b == NULL) && (rte_errno == EINVAL),
+   "No error on create() with invalid buffer size param.");
+
+   b = rte_reorder_create("PKT_RO1", rte_socket_id(), REORDER_BUFFER_SIZE);
+   printf("DEBUG: b= %p, orig_b= %p\n", b, test_params->b);
+   TEST_ASSERT_EQUAL(b, test_params->b,
+   "New reorder instance created with already existing 
name");
+
+   return 0;
+}
+
+static int
+test_reorder_init(void)
+{
+   struct rte_reorder_buffer *b = NULL;
+   unsigned int size;
+   /*
+* The minimum memory area size that should be passed to library is,
+* sizeof(struct rte_reorder_buffer) + (2 * size * sizeof(struct 
rte_mbuf *));
+* Otherwise error will be thrown
+*/
+
+   size = 100;
+   b = rte_reorder_init(b, size, "PKT1", REORDER_BUFFER_SIZE);
+   TEST_ASSERT((b == NULL) && (rte_errno == EINVAL),
+   "No error on init with NULL buffer.");
+
+   b = rte_malloc(NULL, size, 0);
+   b = rte_reorder_init(b, size, "PKT1", REORDER_BUFFER_SIZE);
+   TEST_ASSERT((b == NULL) && (rte_errno == EINVAL),
+   "No 

[dpdk-dev] [PATCH v3 1/5] reorder: new reorder library

2015-02-06 Thread Sergio Gonzalez Monroy
This library provides reordering capability for out of order mbufs based
on a sequence number in the mbuf structure.

Signed-off-by: Reshma Pattan 
Signed-off-by: Richardson Bruce 
Signed-off-by: Sergio Gonzalez Monroy 
---
 config/common_bsdapp   |   5 +
 config/common_linuxapp |   5 +
 lib/Makefile   |   1 +
 lib/librte_eal/common/include/rte_tailq_elem.h |   2 +
 lib/librte_mbuf/rte_mbuf.h |   3 +
 lib/librte_reorder/Makefile|  50 +++
 lib/librte_reorder/rte_reorder.c   | 416 +
 lib/librte_reorder/rte_reorder.h   | 181 +++
 8 files changed, 663 insertions(+)
 create mode 100644 lib/librte_reorder/Makefile
 create mode 100644 lib/librte_reorder/rte_reorder.c
 create mode 100644 lib/librte_reorder/rte_reorder.h

diff --git a/config/common_bsdapp b/config/common_bsdapp
index 9177db1..e3e0e94 100644
--- a/config/common_bsdapp
+++ b/config/common_bsdapp
@@ -334,6 +334,11 @@ CONFIG_RTE_SCHED_PORT_N_GRINDERS=8
 CONFIG_RTE_LIBRTE_DISTRIBUTOR=y

 #
+# Compile the reorder library
+#
+CONFIG_RTE_LIBRTE_REORDER=y
+
+#
 # Compile librte_port
 #
 CONFIG_RTE_LIBRTE_PORT=y
diff --git a/config/common_linuxapp b/config/common_linuxapp
index 2f9643b..b5ec730 100644
--- a/config/common_linuxapp
+++ b/config/common_linuxapp
@@ -342,6 +342,11 @@ CONFIG_RTE_SCHED_PORT_N_GRINDERS=8
 CONFIG_RTE_LIBRTE_DISTRIBUTOR=y

 #
+# Compile the reorder library
+#
+CONFIG_RTE_LIBRTE_REORDER=y
+
+#
 # Compile librte_port
 #
 CONFIG_RTE_LIBRTE_PORT=y
diff --git a/lib/Makefile b/lib/Makefile
index 0ffc982..5919d32 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -65,6 +65,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR) += librte_distributor
 DIRS-$(CONFIG_RTE_LIBRTE_PORT) += librte_port
 DIRS-$(CONFIG_RTE_LIBRTE_TABLE) += librte_table
 DIRS-$(CONFIG_RTE_LIBRTE_PIPELINE) += librte_pipeline
+DIRS-$(CONFIG_RTE_LIBRTE_REORDER) += librte_reorder

 ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y)
 DIRS-$(CONFIG_RTE_LIBRTE_KNI) += librte_kni
diff --git a/lib/librte_eal/common/include/rte_tailq_elem.h 
b/lib/librte_eal/common/include/rte_tailq_elem.h
index f74fc7c..3013869 100644
--- a/lib/librte_eal/common/include/rte_tailq_elem.h
+++ b/lib/librte_eal/common/include/rte_tailq_elem.h
@@ -84,6 +84,8 @@ rte_tailq_elem(RTE_TAILQ_ACL, "RTE_ACL")

 rte_tailq_elem(RTE_TAILQ_DISTRIBUTOR, "RTE_DISTRIBUTOR")

+rte_tailq_elem(RTE_TAILQ_REORDER, "RTE_REORDER")
+
 rte_tailq_end(RTE_TAILQ_NUM)

 #undef rte_tailq_elem
diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index 16059c6..ed27eb8 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -262,6 +262,9 @@ struct rte_mbuf {
uint32_t usr; /**< User defined tags. See 
@rte_distributor_process */
} hash;   /**< hash information */

+   /* sequence number - field used in distributor and reorder library */
+   uint32_t seqn;
+
/* second cache line - fields only used in slow path or on TX */
MARKER cacheline1 __rte_cache_aligned;

diff --git a/lib/librte_reorder/Makefile b/lib/librte_reorder/Makefile
new file mode 100644
index 000..12b916f
--- /dev/null
+++ b/lib/librte_reorder/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 

[dpdk-dev] [PATCH v3 0/5] New Reorder Library

2015-02-06 Thread Sergio Gonzalez Monroy
This series introduces the new reorder library along with unit tests,
sample app and a new entry in the programmers guide describing the library.

The library provides reordering of mbufs based on their sequence number.

As mention in the patch describing the library, one use case is the
packet distributor.
The distributor receives packets, assigns them a sequence number and sends
them to the workers.
The workers process those packets and return them to the distributor.
The distributor collects out-of-order packets from the workers and uses
this library to reorder the packets based on the sequence number they
were assigned.

v3:
 - fix copyright date
 - add option to sample app to disable reordering
 - add packet ordering sample guide entry

v2:
 - add programmers guide entry describing the library
 - use malloc instead of memzone to allocate memory
 - modify create and init implementation, init takes a reorder buffer as input
   and create reserves memory and call init.
 - update unit tests

Sergio Gonzalez Monroy (5):
  reorder: new reorder library
  app: New reorder unit test
  examples: new sample app packet_ordering
  doc: new reorder library description
  doc: new packet ordering app description

 app/test/Makefile  |   2 +
 app/test/test_reorder.c| 393 ++
 config/common_bsdapp   |   5 +
 config/common_linuxapp |   5 +
 doc/guides/prog_guide/index.rst|   1 +
 doc/guides/prog_guide/reorder_lib.rst  | 115 
 doc/guides/sample_app_ug/index.rst |   1 +
 doc/guides/sample_app_ug/packet_ordering.rst   | 102 
 examples/packet_ordering/Makefile  |  50 ++
 examples/packet_ordering/main.c| 695 +
 lib/Makefile   |   1 +
 lib/librte_eal/common/include/rte_tailq_elem.h |   2 +
 lib/librte_mbuf/rte_mbuf.h |   3 +
 lib/librte_reorder/Makefile|  50 ++
 lib/librte_reorder/rte_reorder.c   | 416 +++
 lib/librte_reorder/rte_reorder.h   | 181 +++
 mk/rte.app.mk  |   4 +
 17 files changed, 2026 insertions(+)
 create mode 100644 app/test/test_reorder.c
 create mode 100644 doc/guides/prog_guide/reorder_lib.rst
 create mode 100644 doc/guides/sample_app_ug/packet_ordering.rst
 create mode 100644 examples/packet_ordering/Makefile
 create mode 100644 examples/packet_ordering/main.c
 create mode 100644 lib/librte_reorder/Makefile
 create mode 100644 lib/librte_reorder/rte_reorder.c
 create mode 100644 lib/librte_reorder/rte_reorder.h

-- 
1.9.3



[dpdk-dev] [PATCH v2] maintainers: claim FreeBSD EAL and distributor

2015-02-06 Thread De Lara Guarch, Pablo


> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Bruce Richardson
> Sent: Friday, February 06, 2015 1:56 PM
> To: dev at dpdk.org
> Subject: [dpdk-dev] [PATCH v2] maintainers: claim FreeBSD EAL and
> distributor
> 
> Signed-off-by: Bruce Richardson 

Acked-by: Pablo de Lara 



[dpdk-dev] [PATCH v4 00/17] support multi-pthread per core

2015-02-06 Thread Robert Sanford
On Fri, Feb 6, 2015 at 10:47 AM, Olivier MATZ wrote:

> Hi,
>
> On 02/02/2015 03:02 AM, Cunming Liang wrote:
> > v4 changes:
> >   new patch fixing strnlen() invalid return in 32bit icc [03/17]
> >   update and add more comments on sched_yield() [16/17]
> >
> > v3 changes:
> >   new patch adding sched_yield() in rte_ring to avoid long spin [16/17]
> >
> > v2 changes:
> >   add '-' support for EAL option '--lcores' [02/17]
> >
> > The patch series contain the enhancements of EAL and fixes for libraries
> > to run multi-pthreads(either EAL or non-EAL thread) per physical core.
> > Two major changes list as below:
> > - Extend the core affinity of each EAL thread to 1:n.
> >   Each lcore stands for a EAL thread rather than a logical core.
> >   The change adds new EAL option to allow static lcore to cpuset
> assginment.
> >   Then a lcore(EAL thread) affinity to a cpuset, original 1:1 mapping is
> the special case.
> > - Fix the libraries to allow running on any non-EAL thread.
> >   It fix the gaps running libraries in non-EAL thread(dynamic created by
> user).
> >   Each fix libraries take care the case of rte_lcore_id() >=
> RTE_MAX_LCORE.
>
> Sorry if I missed something, but after reading the mailing list threads
> about this subject, I cannot find an explanation about what problem
> this series try to solve.
>
> Can you give some details about which use-case require to have multiple
> pthreads per cpu? What are the advantage of doing so?
>
> Regards,
> Olivier
>


http://dpdk.org/ml/archives/dev/2014-December/009838.html


[dpdk-dev] [PATCH] maintainers: claim hash, lpm and cfgfile libraries

2015-02-06 Thread De Lara Guarch, Pablo


> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Bruce Richardson
> Sent: Friday, February 06, 2015 1:57 PM
> To: dev at dpdk.org
> Subject: [dpdk-dev] [PATCH] maintainers: claim hash, lpm and cfgfile libraries
> 
> Signed-off-by: Bruce Richardson 

Acked-by: Pablo de Lara 




[dpdk-dev] [PATCH] testpmd: remove incorrect parameter limits in help command line

2015-02-06 Thread Pablo de Lara
Ring threshold parameters an RX/TX queue (pthresh, wthresh and hthresh)
had an incorrect range of values shown in help command line.

Signed-off-by: Pablo de Lara 
---
 app/test-pmd/parameters.c |   18 ++
 1 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
index c7105ca..e66153d 100644
--- a/app/test-pmd/parameters.c
+++ b/app/test-pmd/parameters.c
@@ -171,20 +171,14 @@ usage(char* progname)
printf("  --txd=N: set the number of descriptors in TX rings to N.\n");
printf("  --burst=N: set the number of packets per burst to N.\n");
printf("  --mbcache=N: set the cache of mbuf memory pool to N.\n");
-   printf("  --rxpt=N: set prefetch threshold register of RX rings to N "
-  "(0 <= N <= 16).\n");
-   printf("  --rxht=N: set the host threshold register of RX rings to N "
-  "(0 <= N <= 16).\n");
+   printf("  --rxpt=N: set prefetch threshold register of RX rings to 
N.\n");
+   printf("  --rxht=N: set the host threshold register of RX rings to 
N.\n");
printf("  --rxfreet=N: set the free threshold of RX descriptors to N "
   "(0 <= N < value of rxd).\n");
-   printf("  --rxwt=N: set the write-back threshold register of RX rings "
-  "to N (0 <= N <= 16).\n");
-   printf("  --txpt=N: set the prefetch threshold register of TX rings "
-  "to N (0 <= N <= 16).\n");
-   printf("  --txht=N: set the nhost threshold register of TX rings to N "
-  "(0 <= N <= 16).\n");
-   printf("  --txwt=N: set the write-back threshold register of TX rings "
-  "to N (0 <= N <= 16).\n");
+   printf("  --rxwt=N: set the write-back threshold register of RX rings 
to N.\n");
+   printf("  --txpt=N: set the prefetch threshold register of TX rings to 
N.\n");
+   printf("  --txht=N: set the nhost threshold register of TX rings to 
N.\n");
+   printf("  --txwt=N: set the write-back threshold register of TX rings 
to N.\n");
printf("  --txfreet=N: set the transmit free threshold of TX rings to N 
"
   "(0 <= N <= value of txd).\n");
printf("  --txrst=N: set the transmit RS bit threshold of TX rings to N 
"
-- 
1.7.4.1



[dpdk-dev] [PATCH] testpmd: remove duplicated parameter parsing

2015-02-06 Thread Pablo de Lara
Several parameters were being parsed twice in testpmd,
so this patch gets rid of the second parsing.

Signed-off-by: Pablo de Lara 
---
 app/test-pmd/parameters.c |   56 -
 1 files changed, 0 insertions(+), 56 deletions(-)

diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
index adf3203..c7105ca 100644
--- a/app/test-pmd/parameters.c
+++ b/app/test-pmd/parameters.c
@@ -819,20 +819,6 @@ launch_args_parse(int argc, char** argv)
  " >= 1 && <= %d\n", n,
  (int) MAX_QUEUE_ID);
}
-   if (!strcmp(lgopts[opt_idx].name, "rxd")) {
-   n = atoi(optarg);
-   if (n > 0)
-   nb_rxd = (uint16_t) n;
-   else
-   rte_exit(EXIT_FAILURE, "rxd must be > 
0\n");
-   }
-   if (!strcmp(lgopts[opt_idx].name, "txd")) {
-   n = atoi(optarg);
-   if (n > 0)
-   nb_txd = (uint16_t) n;
-   else
-   rte_exit(EXIT_FAILURE, "txd must be in 
> 0\n");
-   }
if (!strcmp(lgopts[opt_idx].name, "burst")) {
n = atoi(optarg);
if ((n >= 1) && (n <= MAX_PKT_BURST))
@@ -852,27 +838,6 @@ launch_args_parse(int argc, char** argv)
 "mbcache must be >= 0 and <= 
%d\n",
 RTE_MEMPOOL_CACHE_MAX_SIZE);
}
-   if (!strcmp(lgopts[opt_idx].name, "txpt")) {
-   n = atoi(optarg);
-   if (n >= 0)
-   tx_thresh.pthresh = (uint8_t)n;
-   else
-   rte_exit(EXIT_FAILURE, "txpt must be >= 
0\n");
-   }
-   if (!strcmp(lgopts[opt_idx].name, "txht")) {
-   n = atoi(optarg);
-   if (n >= 0)
-   tx_thresh.hthresh = (uint8_t)n;
-   else
-   rte_exit(EXIT_FAILURE, "txht must be >= 
0\n");
-   }
-   if (!strcmp(lgopts[opt_idx].name, "txwt")) {
-   n = atoi(optarg);
-   if (n >= 0)
-   tx_thresh.wthresh = (uint8_t)n;
-   else
-   rte_exit(EXIT_FAILURE, "txwt must be >= 
0\n");
-   }
if (!strcmp(lgopts[opt_idx].name, "txfreet")) {
n = atoi(optarg);
if (n >= 0)
@@ -896,27 +861,6 @@ launch_args_parse(int argc, char** argv)
rte_exit(EXIT_FAILURE,
 "txqflags must be >= 0\n");
}
-   if (!strcmp(lgopts[opt_idx].name, "rxpt")) {
-   n = atoi(optarg);
-   if (n >= 0)
-   rx_thresh.pthresh = (uint8_t)n;
-   else
-   rte_exit(EXIT_FAILURE, "rxpt must be >= 
0\n");
-   }
-   if (!strcmp(lgopts[opt_idx].name, "rxht")) {
-   n = atoi(optarg);
-   if (n >= 0)
-   rx_thresh.hthresh = (uint8_t)n;
-   else
-   rte_exit(EXIT_FAILURE, "rxht must be >= 
0\n");
-   }
-   if (!strcmp(lgopts[opt_idx].name, "rxwt")) {
-   n = atoi(optarg);
-   if (n >= 0)
-   rx_thresh.wthresh = (uint8_t)n;
-   else
-   rte_exit(EXIT_FAILURE, "rxwt must be >= 
0\n");
-   }
if (!strcmp(lgopts[opt_idx].name, "rxd")) {
n = atoi(optarg);
if (n > 0) {
-- 
1.7.4.1



[dpdk-dev] [PATCH] maintainers: claim hash, lpm and cfgfile libraries

2015-02-06 Thread Bruce Richardson
Signed-off-by: Bruce Richardson 
---
 MAINTAINERS | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 7a2c3ba..cf6baff 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -278,12 +278,14 @@ F: examples/l3fwd-acl/
 F: doc/guides/sample_app_ug/l3_forward_access_ctrl.rst

 Hashes
+M: Bruce Richardson 
 F: lib/librte_hash/
 F: doc/guides/prog_guide/hash_lib.rst
 F: app/test/test_hash*
 F: app/test/test_func_reentrancy.c

 LPM
+M: Bruce Richardson 
 F: lib/librte_lpm/
 F: doc/guides/prog_guide/lpm*
 F: app/test/test_lpm*
@@ -301,6 +303,7 @@ Other libraries
 ---

 Configuration file
+M: Bruce Richardson 
 F: lib/librte_cfgfile/

 Interactive command line
-- 
2.1.0



[dpdk-dev] [PATCH v2] maintainers: claim FreeBSD EAL and distributor

2015-02-06 Thread Bruce Richardson
Signed-off-by: Bruce Richardson 
---
 MAINTAINERS | 4 
 1 file changed, 4 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 9a63714..7a2c3ba 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -120,14 +120,17 @@ F: examples/vhost_xen/
 F: doc/guides/prog_guide/intel_dpdk_xen_based_packet_switch_sol.rst

 FreeBSD EAL (with overlaps)
+M: Bruce Richardson 
 F: lib/librte_eal/bsdapp/Makefile
 F: lib/librte_eal/bsdapp/eal/
 F: doc/guides/freebsd_gsg/

 FreeBSD contigmem
+M: Bruce Richardson 
 F: lib/librte_eal/bsdapp/contigmem/

 FreeBSD UIO
+M: Bruce Richardson 
 F: lib/librte_eal/bsdapp/nic_uio/


@@ -234,6 +237,7 @@ F: examples/ip_reassembly/
 F: doc/guides/sample_app_ug/ip_reassembly.rst

 Distributor
+M: Bruce Richardson 
 F: lib/librte_distributor/
 F: doc/guides/prog_guide/packet_distrib_lib.rst
 F: app/test/test_distributor*
-- 
2.1.0



[dpdk-dev] [PATCH] maintainers: claim FreeBSD EAL and distributor

2015-02-06 Thread Bruce Richardson
On Fri, Feb 06, 2015 at 01:51:46PM +, Bruce Richardson wrote:
> ---
>  MAINTAINERS | 4 
>  1 file changed, 4 insertions(+)

Forgot sign-off :-(, will send v2 now, with it.
/Bruce

> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 9a63714..7a2c3ba 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -120,14 +120,17 @@ F: examples/vhost_xen/
>  F: doc/guides/prog_guide/intel_dpdk_xen_based_packet_switch_sol.rst
>  
>  FreeBSD EAL (with overlaps)
> +M: Bruce Richardson 
>  F: lib/librte_eal/bsdapp/Makefile
>  F: lib/librte_eal/bsdapp/eal/
>  F: doc/guides/freebsd_gsg/
>  
>  FreeBSD contigmem
> +M: Bruce Richardson 
>  F: lib/librte_eal/bsdapp/contigmem/
>  
>  FreeBSD UIO
> +M: Bruce Richardson 
>  F: lib/librte_eal/bsdapp/nic_uio/
>  
>  
> @@ -234,6 +237,7 @@ F: examples/ip_reassembly/
>  F: doc/guides/sample_app_ug/ip_reassembly.rst
>  
>  Distributor
> +M: Bruce Richardson 
>  F: lib/librte_distributor/
>  F: doc/guides/prog_guide/packet_distrib_lib.rst
>  F: app/test/test_distributor*
> -- 
> 2.1.0
> 


[dpdk-dev] [PATCH] maintainers: claim FreeBSD EAL and distributor

2015-02-06 Thread Bruce Richardson
---
 MAINTAINERS | 4 
 1 file changed, 4 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 9a63714..7a2c3ba 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -120,14 +120,17 @@ F: examples/vhost_xen/
 F: doc/guides/prog_guide/intel_dpdk_xen_based_packet_switch_sol.rst

 FreeBSD EAL (with overlaps)
+M: Bruce Richardson 
 F: lib/librte_eal/bsdapp/Makefile
 F: lib/librte_eal/bsdapp/eal/
 F: doc/guides/freebsd_gsg/

 FreeBSD contigmem
+M: Bruce Richardson 
 F: lib/librte_eal/bsdapp/contigmem/

 FreeBSD UIO
+M: Bruce Richardson 
 F: lib/librte_eal/bsdapp/nic_uio/


@@ -234,6 +237,7 @@ F: examples/ip_reassembly/
 F: doc/guides/sample_app_ug/ip_reassembly.rst

 Distributor
+M: Bruce Richardson 
 F: lib/librte_distributor/
 F: doc/guides/prog_guide/packet_distrib_lib.rst
 F: app/test/test_distributor*
-- 
2.1.0



[dpdk-dev] [PATCH] ixgbe: fix vector PMD chained mbuf receive

2015-02-06 Thread Bruce Richardson
When the vector pmd was receiving a mix of packets of various sizes,
some of which were split across multiple mbufs, there was an issue
with reassembly of the jumbo frames. This was due to a skipped increment
when using "continue" in a while loop. Changing the loop to a "for"
loop fixes this problem, by ensuring the increment is always performed.

Reported-by: Prashant Upadhyaya 
Reported-by: Martin Weiser 
Signed-off-by: Bruce Richardson 
Tested-by: Martin Weiser 
---
 lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c 
b/lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c
index b54cb19..dfaccee 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c
+++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c
@@ -402,10 +402,10 @@ reassemble_packets(struct igb_rx_queue *rxq, struct 
rte_mbuf **rx_bufs,
struct rte_mbuf *pkts[RTE_IXGBE_VPMD_RX_BURST]; /*finished pkts*/
struct rte_mbuf *start = rxq->pkt_first_seg;
struct rte_mbuf *end =  rxq->pkt_last_seg;
-   unsigned pkt_idx = 0, buf_idx = 0;
+   unsigned pkt_idx, buf_idx;


-   while (buf_idx < nb_bufs) {
+   for (buf_idx = 0, pkt_idx = 0; buf_idx < nb_bufs; buf_idx++) {
if (end != NULL) {
/* processing a split packet */
end->next = rx_bufs[buf_idx];
@@ -448,7 +448,6 @@ reassemble_packets(struct igb_rx_queue *rxq, struct 
rte_mbuf **rx_bufs,
rx_bufs[buf_idx]->data_len += rxq->crc_len;
rx_bufs[buf_idx]->pkt_len += rxq->crc_len;
}
-   buf_idx++;
}

/* save the partial packet for next time */
-- 
2.1.0



[dpdk-dev] [PATCH v6 2/2] librte_pmd_null: Support port hotplug function

2015-02-06 Thread Tetsuya Mukawa
This patch adds port hotplug support to null PMD.

v6:
 - Fix a paramter of rte_eth_dev_free().
v4:
- Fix commit title.

Signed-off-by: Tetsuya Mukawa 
---
 lib/librte_pmd_null/rte_eth_null.c | 32 
 1 file changed, 32 insertions(+)

diff --git a/lib/librte_pmd_null/rte_eth_null.c 
b/lib/librte_pmd_null/rte_eth_null.c
index c54e90b..6add7ce 100644
--- a/lib/librte_pmd_null/rte_eth_null.c
+++ b/lib/librte_pmd_null/rte_eth_null.c
@@ -292,6 +292,13 @@ eth_stats_reset(struct rte_eth_dev *dev)
}
 }

+static struct eth_driver rte_null_pmd = {
+   .pci_drv = {
+   .name = "rte_null_pmd",
+   .drv_flags = RTE_PCI_DRV_DETACHABLE,
+   },
+};
+
 static void
 eth_queue_release(void *q)
 {
@@ -382,10 +389,12 @@ eth_dev_null_create(const char *name __rte_unused,
data->nb_tx_queues = (uint16_t)nb_tx_queues;
data->dev_link = pmd_link;
data->mac_addrs = _addr;
+   strncpy(data->name, eth_dev->data->name, strlen(eth_dev->data->name));

eth_dev->data = data;
eth_dev->dev_ops = 
eth_dev->pci_dev = pci_dev;
+   eth_dev->driver = _null_pmd;

/* finally assign rx and tx ops */
if (packet_copy) {
@@ -476,10 +485,33 @@ rte_pmd_null_devinit(const char *name, const char *params)
return eth_dev_null_create(name, numa_node, packet_size, packet_copy);
 }

+static int
+rte_pmd_null_devuninit(const char *name, const char *params __rte_unused)
+{
+   struct rte_eth_dev *eth_dev = NULL;
+
+   RTE_LOG(INFO, PMD, "Closing null ethdev on numa socket %u\n",
+   rte_socket_id());
+
+   /* reserve an ethdev entry */
+   eth_dev = rte_eth_dev_allocated(name);
+   if (eth_dev == NULL)
+   return -1;
+
+   rte_free(eth_dev->data->dev_private);
+   rte_free(eth_dev->data);
+   rte_free(eth_dev->pci_dev);
+
+   rte_eth_dev_free(eth_dev);
+
+   return 0;
+}
+
 static struct rte_driver pmd_null_drv = {
.name = "eth_null",
.type = PMD_VDEV,
.init = rte_pmd_null_devinit,
+   .uninit = rte_pmd_null_devuninit,
 };

 PMD_REGISTER_DRIVER(pmd_null_drv);
-- 
1.9.1



[dpdk-dev] [PATCH v6 1/2] librte_pmd_null: Add null PMD

2015-02-06 Thread Tetsuya Mukawa
'null PMD' is a driver of the virtual device particulary designed to measure
performance of DPDK PMDs. When an application call rx, null PMD just allocates
mbufs and returns those. Also tx, the PMD just frees mbufs.

The PMD has following options.
- size: specify packe size allocated by RX. Default packet size is 64.
- copy: specify 1 or 0 to enable or disable copy while RX and TX.
Default value is 0(disbaled).
This option is used for emulating more realistic data transfer.
Copy size is equal to packet size.

To use the PMD, enable CONFIG_RTE_BUILD_SHARED_LIB in config file. Then
compile the PMD as shared library. The library can be linked using '-d'
option when an application invokes.

Here is an example.
$ sudo ./testpmd -c f -n 4 -d librte_pmd_null.so \
--vdev 'eth_null0' --vdev 'eth_null1' -- -i --no-flush-rx

If testpmd is compiled with CONFIG_RTE_BUILD_SHARED_LIB, it may need to
specify more libraries using '-d' option.

v4:
 - Fix memory leak.
   (Thanks to Iremonger, Bernard)

Signed-off-by: Tetsuya Mukawa 
---
 config/common_bsdapp   |   5 +
 config/common_linuxapp |   5 +
 lib/Makefile   |   1 +
 lib/librte_pmd_null/Makefile   |  58 +
 lib/librte_pmd_null/rte_eth_null.c | 485 +
 5 files changed, 554 insertions(+)
 create mode 100644 lib/librte_pmd_null/Makefile
 create mode 100644 lib/librte_pmd_null/rte_eth_null.c

diff --git a/config/common_bsdapp b/config/common_bsdapp
index 9177db1..fa849be 100644
--- a/config/common_bsdapp
+++ b/config/common_bsdapp
@@ -224,6 +224,11 @@ CONFIG_RTE_LIBRTE_PMD_PCAP=y
 CONFIG_RTE_LIBRTE_PMD_BOND=y

 #
+# Compile null PMD
+#
+CONFIG_RTE_LIBRTE_PMD_NULL=y
+
+#
 # Do prefetch of packet data within PMD driver receive function
 #
 CONFIG_RTE_PMD_PACKET_PREFETCH=y
diff --git a/config/common_linuxapp b/config/common_linuxapp
index 27d05be..456fbfe 100644
--- a/config/common_linuxapp
+++ b/config/common_linuxapp
@@ -237,6 +237,11 @@ CONFIG_RTE_LIBRTE_PMD_AF_PACKET=y
 CONFIG_RTE_LIBRTE_PMD_XENVIRT=n

 #
+# Compile null PMD
+#
+CONFIG_RTE_LIBRTE_PMD_NULL=y
+
+#
 # Do prefetch of packet data within PMD driver receive function
 #
 CONFIG_RTE_PMD_PACKET_PREFETCH=y
diff --git a/lib/Makefile b/lib/Makefile
index 0ffc982..d246c53 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -52,6 +52,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += librte_pmd_virtio
 DIRS-$(CONFIG_RTE_LIBRTE_VMXNET3_PMD) += librte_pmd_vmxnet3
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += librte_pmd_xenvirt
 DIRS-$(CONFIG_RTE_LIBRTE_VHOST) += librte_vhost
+DIRS-$(CONFIG_RTE_LIBRTE_PMD_NULL) += librte_pmd_null
 DIRS-$(CONFIG_RTE_LIBRTE_HASH) += librte_hash
 DIRS-$(CONFIG_RTE_LIBRTE_LPM) += librte_lpm
 DIRS-$(CONFIG_RTE_LIBRTE_ACL) += librte_acl
diff --git a/lib/librte_pmd_null/Makefile b/lib/librte_pmd_null/Makefile
new file mode 100644
index 000..0ec4db9
--- /dev/null
+++ b/lib/librte_pmd_null/Makefile
@@ -0,0 +1,58 @@
+#   BSD LICENSE
+#
+#   Copyright (C) IGEL Co.,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 IGEL Co.,Ltd. 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_null.a
+
+CFLAGS += -O3
+CFLAGS += $(WERROR_FLAGS)
+
+#
+# all source are stored in SRCS-y
+#
+SRCS-$(CONFIG_RTE_LIBRTE_PMD_NULL) += rte_eth_null.c
+
+#
+# Export include files
+#
+SYMLINK-y-include +=
+
+# this lib depends upon:
+DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_NULL) += lib/librte_mbuf

[dpdk-dev] ixgbe:about latency

2015-02-06 Thread Linhaifeng
Hi,

I used l2fwd to test ixgbe PMD's latency (packet length is 64 bytes)
found an interesting thing that latency is about 22us when tx bits rate is 4M
and latency is 103us when tx bits rate is 5M.

Who can tell me why?Is it a bug?

Thank you very much!

-- 
Regards,
Haifeng



[dpdk-dev] [PATCH] MAINTAINERS: claim IP fragmentation and ACL

2015-02-06 Thread Gonzalez Monroy, Sergio
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Konstantin
> Ananyev
> Sent: Friday, February 6, 2015 12:36 PM
> To: dev at dpdk.org
> Subject: [dpdk-dev] [PATCH] MAINTAINERS: claim IP fragmentation and ACL
> 
> Signed-off-by: Konstantin Ananyev 
> ---
>  MAINTAINERS | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 9a63714..e5abe7d 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -226,6 +226,7 @@ Network headers
>  F: lib/librte_net/
> 
>  IP fragmentation & reassembly
> +M: Konstantin Ananyev 
>  F: lib/librte_ip_frag/
>  F: doc/guides/prog_guide/ip_fragment_reassembly_lib.rst
>  F: examples/ip_fragmentation/
> @@ -266,6 +267,7 @@ Algorithms
>  --
> 
>  ACL
> +M: Konstantin Ananyev 
>  F: lib/librte_acl/
>  F: doc/guides/prog_guide/packet_classif_access_ctrl.rst
>  F: app/test-acl/
> --
> 1.8.5.3

Acked-by: Sergio Gonzalez Monroy 



[dpdk-dev] [PATCH] MAINTAINERS: claim metering, sched and pkt framework

2015-02-06 Thread Gonzalez Monroy, Sergio
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Cristian Dumitrescu
> Sent: Wednesday, February 4, 2015 3:53 PM
> To: dev at dpdk.org
> Subject: [dpdk-dev] [PATCH] MAINTAINERS: claim metering, sched and pkt
> framework
> 
> As original author of these DPDK components, I am volunteering to maintain
> them going forward:
> - Traffic Metering
> - Hierarchical Scheduler
> - Packet Framework
> - Configuration File
> 
> Signed-off-by: Cristian Dumitrescu 
> ---
>  MAINTAINERS | 4 
>  1 file changed, 4 insertions(+)
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 9a63714..cc3823c 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -241,6 +241,7 @@ F: examples/distributor/
>  F: doc/guides/sample_app_ug/dist_app.rst
> 
>  Hierarchical scheduler
> +M: Cristian Dumitrescu 
>  F: lib/librte_sched/
>  F: doc/guides/prog_guide/qos_framework.rst
>  F: app/test/test_red.c
> @@ -251,6 +252,7 @@ F: doc/guides/sample_app_ug/qos_scheduler.rst
> 
>  Packet Framework
>  
> +M: Cristian Dumitrescu 
>  F: lib/librte_pipeline/
>  F: lib/librte_port/
>  F: lib/librte_table/
> @@ -286,6 +288,7 @@ F: app/test/test_lpm*
>  F: app/test/test_func_reentrancy.c
> 
>  Traffic metering
> +M: Cristian Dumitrescu 
>  F: lib/librte_meter/
>  F: doc/guides/sample_app_ug/qos_scheduler.rst
>  F: app/test/test_meter.c
> @@ -297,6 +300,7 @@ Other libraries
>  ---
> 
>  Configuration file
> +M: Cristian Dumitrescu 
>  F: lib/librte_cfgfile/
> 
>  Interactive command line
> --
> 1.9.3

Acked-by: Sergio Gonzalez Monroy 


[dpdk-dev] [PATCH] MAINTAINERS: claim IP fragmentation and ACL

2015-02-06 Thread Konstantin Ananyev
Signed-off-by: Konstantin Ananyev 
---
 MAINTAINERS | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 9a63714..e5abe7d 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -226,6 +226,7 @@ Network headers
 F: lib/librte_net/

 IP fragmentation & reassembly
+M: Konstantin Ananyev 
 F: lib/librte_ip_frag/
 F: doc/guides/prog_guide/ip_fragment_reassembly_lib.rst
 F: examples/ip_fragmentation/
@@ -266,6 +267,7 @@ Algorithms
 --

 ACL
+M: Konstantin Ananyev 
 F: lib/librte_acl/
 F: doc/guides/prog_guide/packet_classif_access_ctrl.rst
 F: app/test-acl/
-- 
1.8.5.3



[dpdk-dev] [RFC PATCH] rte_timer: Fix rte_timer_reset return value

2015-02-06 Thread Robert Sanford
Hi Olivier,

Thanks for reviewing this patch.
Please see my responses to your comments, below.

I also have one request for you. You probably use git almost every day. For
people who only use git maybe once per year, could you please show us the
exact sequence of commands that you run to prepare a patch series? We know
there are man pages and online documents, etc, but it would be an extremely
valuable jumpstart if you just give us a snippet of your shell history
showing the exact commands that you run to prepare and email a patch
series. I would much rather spend time getting the code right, and less
time learning (by trial and error) the nuances of git apply, add, commit,
format-patch, send-email, etc.


>   /* now check that we get the right number of callbacks */
> >   if (lcore_id == rte_get_master_lcore()) {
> > + if ((my_collisions = rte_atomic32_read()) != 0)
> > + printf("- %d timer reset collisions (OK)\n",
> my_collisions);
>
> That's not very important, but I think avoiding affectation + comparison
> at the same time is clearer:
>
>   my_collisions = rte_atomic32_read();
>   if (my_collisions != 0) {
> ...
>

Yes, I will change this.


> > @@ -311,6 +323,13 @@ timer_stress2_main_loop(__attribute__((unused))
> void *arg)
> >   /* now check that we get the right number of callbacks */
> >   if (lcore_id == rte_get_master_lcore()) {
> >   rte_timer_manage();
> > +
> > + /* clean up statics, in case we run again */
> > + rte_free(timers);
> > + timers = 0;
>
> timers = NULL is better than timers = 0 as it's a pointer.
>

Yes, I will change this.


> > + ready = 0;
>
> The lines above should go in another patch as it fixes another problem
> (+ a memory leek).
> "testpmd: allow to restart timer stress tests"
>

Yes, I will split it into two patches: rte_timer and test_timer. But, I
don't see much benefit in splitting test_timer.c changes into separate
patches for each bug discovered.


> > diff --git a/lib/librte_timer/rte_timer.c b/lib/librte_timer/rte_timer.c
> > index 269a992..d18abf5 100644
> > --- a/lib/librte_timer/rte_timer.c
> > +++ b/lib/librte_timer/rte_timer.c
> > @@ -424,10 +424,8 @@ rte_timer_reset(struct rte_timer *tim, uint64_t
> ticks,
> >   else
> >   period = 0;
> >
> > - __rte_timer_reset(tim,  cur_time + ticks, period, tim_lcore,
> > + return __rte_timer_reset(tim,  cur_time + ticks, period, tim_lcore,
> > fct, arg, 0);
> > -
> > - return 0;
> >  }
> >
> >  /* loop until rte_timer_reset() succeed */
> > @@ -437,7 +435,8 @@ rte_timer_reset_sync(struct rte_timer *tim, uint64_t
> ticks,
> >rte_timer_cb_t fct, void *arg)
> >  {
> >   while (rte_timer_reset(tim, ticks, type, tim_lcore,
> > -fct, arg) != 0);
> > +fct, arg) != 0)
> > + rte_pause();
> >  }
>
> Maybe the lines above could go to another patch too.
> "timers: relax cpu in rte_timer_reset_sync()"
>
>
If you mean that we should have one patch for rte_timer_reset() and one for
rte_timer_reset_sync(), my response is: Come on, these are two one-line
fixes in a pair of related and adjacent functions. Let's not go overboard
by splitting them into two patches. :-)

Also, I think the commit log should highlight the fact that
> your patch also fixes rte_timer_reset_sync() that was not
> working at all.
>
>
We said something to that effect: "Change API rte_timer_reset_sync() to
invoke rte_pause() while spin-waiting for rte_timer_reset() to succeed." I
can use different wording if you like.


>
> Thanks!
> Olivier
>

Thank you,
Robert


[dpdk-dev] upper limit on the size of allocation through rte_malloc in dpdk-1.8.0?

2015-02-06 Thread Olivier MATZ
Hi,

On 02/06/2015 12:00 PM, Bruce Richardson wrote:
> On Wed, Feb 04, 2015 at 05:24:58PM +0200, Stefan Puiu wrote:
>> Hi,
>>
>> I'm trying to alter an existing program to use the Intel DPDK. I'm
>> using 1.8.0, compiled by me as a shared library
>> (CONFIG_RTE_BUILD_COMBINE_LIBS=y and CONFIG_RTE_BUILD_SHARED_LIB=y in
>> .config) on Ubuntu 12.04. The program needs to allocate large blocks
>> of memory (between 1 and 4 chunks of 4.5GB, also 1-4 chunks of 2.5
>> GB). I tried changing my C++ code to use an array allocated using
>> rte_malloc() instead of the std::vector I was using beforehand, but it
>> seems the call to rte_malloc() fails. I then made a simple test
>> program using the DPDK that takes a size to allocate and if that
>> fails, tries again with sizes of 100MB less, basically the code below.
>> This is C++ code (well, now that I look it could've been plain C, but
>> I need C++) compiled with g++-4.6 with '-std=gnu++0x':
>>
>> int main(int argc, char **argv)
>> {
>> int ret = rte_eal_init(argc, argv);
>> if (ret < 0)
>> rte_exit(EXIT_FAILURE, "Invalid EAL arguments\n");
>> argc -= ret;
>> argv += ret;
>>
>> [... check argc >= 2]
>> size_t size = strtoul(argv[1], NULL, 10);
>> size_t s = size;
>>
>> for (size_t i = 0; i < 30; ++i) {
>> printf("Trying to allocate %'zu bytes\n", s);
>> buf = rte_malloc("test", s, 0);
>> if (!buf)
>> printf ("Failed!\n");
>> else {
>> printf ("Success!\n");
>> rte_free(buf);
>> break;
>> }
>>
>> s = s - (100 * 1024ULL * 1024ULL);
>> }
>>
>> return 0;
>> }
>>
>> I'm getting:
>> Trying to allocate 4,832,038,656 bytes
>> Failed!
>> Trying to allocate 4,727,181,056 bytes
>> Failed!
>> [...]
>> Trying to allocate 2,944,601,856 bytes
>> Success!
>>
>> It's not always the same value, but usually somewhere around 3GB
>> rte_malloc() succeeds. I'm running on a physical (non-VM) NUMA machine
>> with 2 physical CPUs, each having 64GBs of local memory. The machine
>> also runs Ubuntu 12.04 server. I've created 16384 hugepages of 2MB:
>>
>> echo 16384 > 
>> /sys/devices/system/node/node0/hugepages/hugepages-2048kB/nr_hugepages
>>
>> I'm running the basic app like this:
>>
>> sudo  numactl --membind=0 ~/src/test/dpdk_test/alloc -c 1f -n 4 -w
>> 04:00.0 --socket-mem=16384,0 -- 4832038656
>>
>> I'm trying to run only on NUMA node 0 and only allocate memory from
>> there - that's what the app I'm moving to the DPDK works like (using
>> numactl --membind=x and --cpunodebind=x).
>>
>> Is there an upper limit on the amount of memory rte_malloc() will try
>> to allocate? I tried both after a reboot and when the machine had been
>> running for a while with not much success. Am I missing something?
>> It's a bit weird to be only able to allocate 3GB out of the 32GB
>> assigned to the app...
>>
>> On a related note, what would be a good way to compile the DPDK with
>> debug info (and preferably -O0)? There's quite a web of .mk files used
>> and I haven't figured out where the optimization level / debug options
>> are set.
>>
>> Thanks in advance,
>> Stefan.
> 
> Does your system support 1G pages? I would recommend using a smaller number of
> 1G pages vs the huge number of 2MB pages that you are currently using. There
> may be issues with the allocations failing due to a lack of contiguous blocks
> of memory due to the 2MB pages being spread across memory.

Indeed, rte_malloc() tries to allocate memory which is physically
contiguous. Using 1G pages instead of 2MB pages will probably help
as Bruce suggests. Another idea is to use another allocation method.
It depends on what you want to do with the allocated data (accessed in
dataplane or not), and when you allocate it (in dataplane or not).

For instance, if you want to allocate a large zone at init, you can just
mmap() and anonymous zone in hugetlbfs (your dpdk config need to keep
unused huge pages for this usage).

By the way, I recently noticed that rte_malloc() does not work well
for data larger than 4GB but I had no time to dig into this issue.
There is probably somewhere in the rte_malloc code where 32 bit
addresses are used.

Regards,
Olivier


[dpdk-dev] XL710 what is correct SFP+ connector vendor?

2015-02-06 Thread sothy shan
 Hi!

we are using XL710 4 portx10G. For the connetion can we use SFP+
connector from any vendor? Any specific SFP+ connector to test DPDK?

We have some SFP+ connectoors. when connected, nothing is working.

Thanks for your reponse.

Best regards
Sothy


[dpdk-dev] [RFC PATCH] rte_timer: Fix rte_timer_reset return value

2015-02-06 Thread Olivier MATZ
Hi Robert,

Please see some comments below.

On 02/03/2015 09:42 PM, rsanford2 at gmail.com wrote:
> From: Robert Sanford 
> 
> - API rte_timer_reset() should return -1 when the timer is in the
> RUNNING or CONFIG state. Instead, it ignores the return value of
> internal function __rte_timer_reset() and always returns 0.
> We change rte_timer_reset() to return the value returned by
> __rte_timer_reset().
> 
> - Change API rte_timer_reset_sync() to invoke rte_pause() while
> spin-waiting for rte_timer_reset() to succeed.
> 
> - Enhance timer stress test 2 to report how many timer reset
> collisions occur, i.e., how many times rte_timer_reset() fails
> due to a timer being in the CONFIG state.
> 
> Signed-off-by: Robert Sanford 
> 
> ---
>  app/test/test_timer.c|   25 ++---
>  lib/librte_timer/rte_timer.c |7 +++
>  2 files changed, 25 insertions(+), 7 deletions(-)
> 
> diff --git a/app/test/test_timer.c b/app/test/test_timer.c
> index 4b4800b..2f27f84 100644
> --- a/app/test/test_timer.c
> +++ b/app/test/test_timer.c
> @@ -247,12 +247,15 @@ static int
>  timer_stress2_main_loop(__attribute__((unused)) void *arg)
>  {
>   static struct rte_timer *timers;
> - int i;
> + int i, ret;
>   static volatile int ready = 0;
>   uint64_t delay = rte_get_timer_hz() / 4;
>   unsigned lcore_id = rte_lcore_id();
> + int32_t my_collisions = 0;
> + static rte_atomic32_t collisions = RTE_ATOMIC32_INIT(0);
>  
>   if (lcore_id == rte_get_master_lcore()) {
> + cb_count = 0;
>   timers = rte_malloc(NULL, sizeof(*timers) * NB_STRESS2_TIMERS, 
> 0);
>   if (timers == NULL) {
>   printf("Test Failed\n");
> @@ -268,15 +271,24 @@ timer_stress2_main_loop(__attribute__((unused)) void 
> *arg)
>   }
>  
>   /* have all cores schedule all timers on master lcore */
> - for (i = 0; i < NB_STRESS2_TIMERS; i++)
> - rte_timer_reset([i], delay, SINGLE, 
> rte_get_master_lcore(),
> + for (i = 0; i < NB_STRESS2_TIMERS; i++) {
> + ret = rte_timer_reset([i], delay, SINGLE, 
> rte_get_master_lcore(),
>   timer_stress2_cb, NULL);
> + /* there will be collisions when multiple cores simultaneously
> +  * configure the same timers */
> + if (ret != 0)
> + my_collisions++;
> + }
> + if (my_collisions != 0)
> + rte_atomic32_add(, my_collisions);
>  
>   ready = 0;
>   rte_delay_ms(500);
>  
>   /* now check that we get the right number of callbacks */
>   if (lcore_id == rte_get_master_lcore()) {
> + if ((my_collisions = rte_atomic32_read()) != 0)
> + printf("- %d timer reset collisions (OK)\n", 
> my_collisions);

That's not very important, but I think avoiding affectation + comparison
at the same time is clearer:

  my_collisions = rte_atomic32_read();
  if (my_collisions != 0) {
...

>   rte_timer_manage();
>   if (cb_count != NB_STRESS2_TIMERS) {
>   printf("Test Failed\n");
> @@ -311,6 +323,13 @@ timer_stress2_main_loop(__attribute__((unused)) void 
> *arg)
>   /* now check that we get the right number of callbacks */
>   if (lcore_id == rte_get_master_lcore()) {
>   rte_timer_manage();
> +
> + /* clean up statics, in case we run again */
> + rte_free(timers);
> + timers = 0;

timers = NULL is better than timers = 0 as it's a pointer.

> + ready = 0;

The lines above should go in another patch as it fixes another problem
(+ a memory leek).
"testpmd: allow to restart timer stress tests"


> + rte_atomic32_set(, 0);
> +
>   if (cb_count != NB_STRESS2_TIMERS) {
>   printf("Test Failed\n");
>   printf("- Stress test 2, part 2 failed\n");
> diff --git a/lib/librte_timer/rte_timer.c b/lib/librte_timer/rte_timer.c
> index 269a992..d18abf5 100644
> --- a/lib/librte_timer/rte_timer.c
> +++ b/lib/librte_timer/rte_timer.c
> @@ -424,10 +424,8 @@ rte_timer_reset(struct rte_timer *tim, uint64_t ticks,
>   else
>   period = 0;
>  
> - __rte_timer_reset(tim,  cur_time + ticks, period, tim_lcore,
> + return __rte_timer_reset(tim,  cur_time + ticks, period, tim_lcore,
> fct, arg, 0);
> -
> - return 0;
>  }
>  
>  /* loop until rte_timer_reset() succeed */
> @@ -437,7 +435,8 @@ rte_timer_reset_sync(struct rte_timer *tim, uint64_t 
> ticks,
>rte_timer_cb_t fct, void *arg)
>  {
>   while (rte_timer_reset(tim, ticks, type, tim_lcore,
> -fct, arg) != 0);
> +fct, arg) != 0)
> + rte_pause();
>  }

Maybe the lines above could go to another patch too.
"timers: relax cpu in rte_timer_reset_sync()"

Also, I think the commit log should 

[dpdk-dev] [PATCH] vhost: notify guest to fill buffer when there is no buffer

2015-02-06 Thread Linhaifeng


On 2015/2/4 9:38, Xu, Qian Q wrote:
> 4. Launch the VM1 and VM2 with virtio device, note: you need use qemu 
> version>2.1 to enable the vhost-user server's feature. Old qemu such as 
> 1.5,1.6 didn't support it.
> Below is my VM1 startup command, for your reference, similar for VM2. 
> /home/qemu-2.2.0/x86_64-softmmu/qemu-system-x86_64 -name us-vhost-vm1 -cpu 
> host -enable-kvm -m 2048 -object 
> memory-backend-file,id=mem,size=2048M,mem-path=/mnt/huge,share=on -numa 
> node,memdev=mem -mem-prealloc -smp 2 -drive file=/home/img/dpdk1-vm1.img 
> -chardev socket,id=char0,path=/home/dpdk-vhost/vhost-net -netdev 
> type=vhost-user,id=mynet1,chardev=char0,vhostforce -device 
> virtio-net-pci,mac=00:00:00:00:00:01, -nographic
> 
> 5. Then in the VM, you can have the same operations as before, send packet 
> from virtio1 to virtio2. 
> 
> Pls let me know if any questions, issues. 

Hi xie & xu

When I try to start VM vhost-switch crashed.

VHOST_CONFIG: read message VHOST_USER_SET_MEM_TABLE
VHOST_CONFIG: mapped region 0 fd:19 to 0x sz:0xa off:0x0
VHOST_CONFIG: mmap qemu guest failed.
VHOST_CONFIG: read message VHOST_USER_SET_VRING_NUM
VHOST_CONFIG: read message VHOST_USER_SET_VRING_BASE
VHOST_CONFIG: read message VHOST_USER_SET_VRING_ADDR
run_dpdk_vhost.sh: line 19:  1854 Segmentation fault  
${RTE_SDK}/examples/vhost/build/app/vhost-switch -c 0x300 -n 4 --huge-dir 
/dev/hugepages -m 2048 -- -p 0x1 --vm2vm 2 --mergeable 0 --zero-copy 0



-- 
Regards,
Haifeng



[dpdk-dev] ACL Issue with single field rule and rest with wild card entry

2015-02-06 Thread Ananyev, Konstantin
Hi Varun,

> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Rapelly, Varun
> Sent: Friday, February 06, 2015 7:25 AM
> To: dev at dpdk.org
> Subject: [dpdk-dev] ACL Issue with single field rule and rest with wild card 
> entry
> 
> Hi,
> 
> struct ipv6_5tuple {
>uint8_t proto; /* Protocol, next header. */
>uint32_t src_addr0;  /* IP address of source host. */
>uint32_t src_addr1;  /* IP address of source host. */
>uint32_t src_addr2;  /* IP address of source host. */
>uint32_t src_addr3;  /* IP address of source host. */
> };
> 
> enum {
>PROTO_FIELD_IPV6,
>SRC_FIELD0_IPV6,
>SRC_FIELD1_IPV6,
>SRC_FIELD2_IPV6,
>SRC_FIELD3_IPV6,
>NUM_FIELDS_IPV6
> };
> 
> 
> I'm using the above data to insert in to ACL trie.
> 
> If I'm inserting rules with only different proto fields, [I'm expecting 
> others fields as wild card entries]  then the rules are not matching.
> 
> But if I insert one rule with dummy entries [in the attached file line num 
> 118-125], then the above issue is resolved.

Hmm, it is strange...
I took your source code compiled it, then commented out lines 118-125 and 
recompiled it.
Both binaries produce valid result for me:

1. original code:
ACL: Gen phase for ACL "ACL_example":
runtime memory footprint on socket -1:
single nodes/bytes used: 0/0
quad nodes/vectors/bytes used: 0/0/0
DFA nodes/group64/bytes used: 1/4/4104
match nodes/bytes used: 4/512
total: 6816 bytes
max limit: 18446744073709551615 bytes
ACL: Build phase for ACL "ACL_example":
node limit for tree split: 2048
nodes created: 5
memory consumed: 8388615
ACL: trie 0: number of rules: 4, indexes: 1
rte_acl_classify() returns 0
, res[0]=11


2. code with lines 118-125 commented out:
ACL: Gen phase for ACL "ACL_example":
runtime memory footprint on socket -1:
single nodes/bytes used: 0/0
quad nodes/vectors/bytes used: 0/0/0
DFA nodes/group64/bytes used: 1/4/4104
match nodes/bytes used: 3/384
total: 6688 bytes
max limit: 18446744073709551615 bytes
ACL: Build phase for ACL "ACL_example":
node limit for tree split: 2048
nodes created: 4
memory consumed: 8388615
ACL: trie 0: number of rules: 3, indexes: 1
rte_acl_classify() returns 0
, res[0]=11

Wonder what results are you getting for both cases?

Konstantin

> 
> Please let me know:
> 
> 
> 1.   Can we have rules with only one entry and others as wild card 
> entries?
> 
> 2.   Is there any other way to match wild card entries in a rule?
> 
> Regards,
> Varun



[dpdk-dev] [PATCH v6 1/2] librte_pmd_null: Add null PMD

2015-02-06 Thread Iremonger, Bernard
Hi Tetsuya,

My comments are in line below.

> -Original Message-
> From: Tetsuya Mukawa [mailto:mukawa at igel.co.jp]
> Sent: Friday, February 6, 2015 4:38 AM
> To: dev at dpdk.org
> Cc: Iremonger, Bernard; Tetsuya Mukawa
> Subject: [PATCH v6 1/2] librte_pmd_null: Add null PMD
> 
> 'null PMD' is a driver of the virtual device particulary designed to measure 
> performance of DPDK
> PMDs. When an application call rx, null PMD just allocates mbufs and returns 
> those. Also tx, the PMD
> just frees mbufs.
> 
> The PMD has following options.
> - size: specify packe size allocated by RX. Default packet size is 64.
> - copy: specify 1 or 0 to enable or disable copy while RX and TX.
>   Default value is 0(disbaled).
>   This option is used for emulating more realistic data transfer.
>   Copy size is equal to packet size.
> 
> To use the PMD, enable CONFIG_RTE_BUILD_SHARED_LIB in config file. Then 
> compile the PMD as
> shared library. The library can be linked using '-d'
> option when an application invokes.
> 
> Here is an example.
> $ sudo ./testpmd -c f -n 4 -d librte_pmd_null.so \
>   --vdev 'eth_null0' --vdev 'eth_null1' -- -i --no-flush-rx
> 
> If testpmd is compiled with CONFIG_RTE_BUILD_SHARED_LIB, it may need to 
> specify more libraries
> using '-d' option.
> 
> v4:
>  - Fix memory leak.
>(Thanks to Iremonger, Bernard)
> 
> Signed-off-by: Tetsuya Mukawa 
> ---
>  config/common_bsdapp   |   5 +
>  config/common_linuxapp |   5 +
>  lib/Makefile   |   1 +
>  lib/librte_pmd_null/Makefile   |  58 +
>  lib/librte_pmd_null/rte_eth_null.c | 485 
> +
>  5 files changed, 554 insertions(+)
>  create mode 100644 lib/librte_pmd_null/Makefile  create mode 100644
> lib/librte_pmd_null/rte_eth_null.c
> 
> diff --git a/config/common_bsdapp b/config/common_bsdapp index 
> 9177db1..fa849be 100644
> --- a/config/common_bsdapp
> +++ b/config/common_bsdapp
> @@ -224,6 +224,11 @@ CONFIG_RTE_LIBRTE_PMD_PCAP=y  
> CONFIG_RTE_LIBRTE_PMD_BOND=y
> 
>  #
> +# Compile null PMD
> +#
> +CONFIG_RTE_LIBRTE_PMD_NULL=y
> +
> +#
>  # Do prefetch of packet data within PMD driver receive function  #
> CONFIG_RTE_PMD_PACKET_PREFETCH=y diff --git a/config/common_linuxapp
> b/config/common_linuxapp index 27d05be..456fbfe 100644
> --- a/config/common_linuxapp
> +++ b/config/common_linuxapp
> @@ -237,6 +237,11 @@ CONFIG_RTE_LIBRTE_PMD_AF_PACKET=y
> CONFIG_RTE_LIBRTE_PMD_XENVIRT=n
> 
>  #
> +# Compile null PMD
> +#
> +CONFIG_RTE_LIBRTE_PMD_NULL=y
> +
> +#
>  # Do prefetch of packet data within PMD driver receive function  #
> CONFIG_RTE_PMD_PACKET_PREFETCH=y diff --git a/lib/Makefile b/lib/Makefile 
> index
> 0ffc982..d246c53 100644
> --- a/lib/Makefile
> +++ b/lib/Makefile
> @@ -52,6 +52,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += librte_pmd_virtio
>  DIRS-$(CONFIG_RTE_LIBRTE_VMXNET3_PMD) += librte_pmd_vmxnet3
>  DIRS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += librte_pmd_xenvirt
>  DIRS-$(CONFIG_RTE_LIBRTE_VHOST) += librte_vhost
> +DIRS-$(CONFIG_RTE_LIBRTE_PMD_NULL) += librte_pmd_null
>  DIRS-$(CONFIG_RTE_LIBRTE_HASH) += librte_hash
>  DIRS-$(CONFIG_RTE_LIBRTE_LPM) += librte_lpm
>  DIRS-$(CONFIG_RTE_LIBRTE_ACL) += librte_acl diff --git 
> a/lib/librte_pmd_null/Makefile
> b/lib/librte_pmd_null/Makefile new file mode 100644 index 000..0ec4db9
> --- /dev/null
> +++ b/lib/librte_pmd_null/Makefile
> @@ -0,0 +1,58 @@
> +#   BSD LICENSE
> +#
> +#   Copyright (C) IGEL Co.,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 IGEL Co.,Ltd. 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 

[dpdk-dev] upper limit on the size of allocation through rte_malloc in dpdk-1.8.0?

2015-02-06 Thread Bruce Richardson
On Wed, Feb 04, 2015 at 05:24:58PM +0200, Stefan Puiu wrote:
> Hi,
> 
> I'm trying to alter an existing program to use the Intel DPDK. I'm
> using 1.8.0, compiled by me as a shared library
> (CONFIG_RTE_BUILD_COMBINE_LIBS=y and CONFIG_RTE_BUILD_SHARED_LIB=y in
> .config) on Ubuntu 12.04. The program needs to allocate large blocks
> of memory (between 1 and 4 chunks of 4.5GB, also 1-4 chunks of 2.5
> GB). I tried changing my C++ code to use an array allocated using
> rte_malloc() instead of the std::vector I was using beforehand, but it
> seems the call to rte_malloc() fails. I then made a simple test
> program using the DPDK that takes a size to allocate and if that
> fails, tries again with sizes of 100MB less, basically the code below.
> This is C++ code (well, now that I look it could've been plain C, but
> I need C++) compiled with g++-4.6 with '-std=gnu++0x':
> 
> int main(int argc, char **argv)
> {
> int ret = rte_eal_init(argc, argv);
> if (ret < 0)
> rte_exit(EXIT_FAILURE, "Invalid EAL arguments\n");
> argc -= ret;
> argv += ret;
> 
> [... check argc >= 2]
> size_t size = strtoul(argv[1], NULL, 10);
> size_t s = size;
> 
> for (size_t i = 0; i < 30; ++i) {
> printf("Trying to allocate %'zu bytes\n", s);
> buf = rte_malloc("test", s, 0);
> if (!buf)
> printf ("Failed!\n");
> else {
> printf ("Success!\n");
> rte_free(buf);
> break;
> }
> 
> s = s - (100 * 1024ULL * 1024ULL);
> }
> 
> return 0;
> }
> 
> I'm getting:
> Trying to allocate 4,832,038,656 bytes
> Failed!
> Trying to allocate 4,727,181,056 bytes
> Failed!
> [...]
> Trying to allocate 2,944,601,856 bytes
> Success!
> 
> It's not always the same value, but usually somewhere around 3GB
> rte_malloc() succeeds. I'm running on a physical (non-VM) NUMA machine
> with 2 physical CPUs, each having 64GBs of local memory. The machine
> also runs Ubuntu 12.04 server. I've created 16384 hugepages of 2MB:
> 
> echo 16384 > 
> /sys/devices/system/node/node0/hugepages/hugepages-2048kB/nr_hugepages
> 
> I'm running the basic app like this:
> 
> sudo  numactl --membind=0 ~/src/test/dpdk_test/alloc -c 1f -n 4 -w
> 04:00.0 --socket-mem=16384,0 -- 4832038656
> 
> I'm trying to run only on NUMA node 0 and only allocate memory from
> there - that's what the app I'm moving to the DPDK works like (using
> numactl --membind=x and --cpunodebind=x).
> 
> Is there an upper limit on the amount of memory rte_malloc() will try
> to allocate? I tried both after a reboot and when the machine had been
> running for a while with not much success. Am I missing something?
> It's a bit weird to be only able to allocate 3GB out of the 32GB
> assigned to the app...
> 
> On a related note, what would be a good way to compile the DPDK with
> debug info (and preferably -O0)? There's quite a web of .mk files used
> and I haven't figured out where the optimization level / debug options
> are set.
> 
> Thanks in advance,
> Stefan.

Does your system support 1G pages? I would recommend using a smaller number of
1G pages vs the huge number of 2MB pages that you are currently using. There
may be issues with the allocations failing due to a lack of contiguous blocks
of memory due to the 2MB pages being spread across memory.

Regards,
/Bruce


[dpdk-dev] [PATCH 4/4] bcm: enable BCM poll mode driver in config

2015-02-06 Thread Stephen Hemminger
From: Stephen Hemminger 

Enable BCM poll mode driver in default config.

Signed-off-by: Stephen Hemminger 
---
 config/common_linuxapp | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/config/common_linuxapp b/config/common_linuxapp
index d428f84..86b157d 100644
--- a/config/common_linuxapp
+++ b/config/common_linuxapp
@@ -185,6 +185,16 @@ CONFIG_RTE_LIBRTE_I40E_ITR_INTERVAL=-1
 CONFIG_RTE_LIBRTE_ENIC_PMD=y

 #
+# Compile burst-oriented Broadcom PMD driver
+#
+CONFIG_RTE_LIBRTE_BCM_PMD=y
+CONFIG_RTE_LIBRTE_BCM_DEBUG_INIT=n
+CONFIG_RTE_LIBRTE_BCM_DEBUG=n
+CONFIG_RTE_LIBRTE_BCM_MF_SUPPORT=n
+CONFIG_RTE_LIBRTE_BCM_DEBUG_TX=n
+CONFIG_RTE_LIBRTE_BCM_DEBUG_RX=n
+
+#
 # Compile burst-oriented VIRTIO PMD driver
 #
 CONFIG_RTE_LIBRTE_VIRTIO_PMD=y
-- 
2.1.4



[dpdk-dev] [PATCH 3/4] bcm: new poll mode driver

2015-02-06 Thread Stephen Hemminger
From: Stephen Hemminger 

Add driver for the Broadcom NetXtremeII 10 gigabit devices.

Signed-off-by: Stephen Hemminger 
---
 lib/Makefile| 1 +
 lib/librte_pmd_bcm/Makefile |28 +
 lib/librte_pmd_bcm/bcm.c| 11817 ++
 lib/librte_pmd_bcm/bcm.h|  1998 +
 lib/librte_pmd_bcm/bcm_ethdev.c |   544 ++
 lib/librte_pmd_bcm/bcm_ethdev.h |79 +
 lib/librte_pmd_bcm/bcm_logs.h   |51 +
 lib/librte_pmd_bcm/bcm_rxtx.c   |   487 ++
 lib/librte_pmd_bcm/bcm_rxtx.h   |85 +
 lib/librte_pmd_bcm/bcm_stats.c  |  1619 
 lib/librte_pmd_bcm/bcm_stats.h  |   633 ++
 lib/librte_pmd_bcm/bcm_vfpf.c   |   597 ++
 lib/librte_pmd_bcm/bcm_vfpf.h   |   315 +
 lib/librte_pmd_bcm/debug.c  |   113 +
 lib/librte_pmd_bcm/ecore_fw_defs.h  |   423 ++
 lib/librte_pmd_bcm/ecore_hsi.h  |  6349 
 lib/librte_pmd_bcm/ecore_init.h |   842 +++
 lib/librte_pmd_bcm/ecore_init_ops.h |   886 +++
 lib/librte_pmd_bcm/ecore_mfw_req.h  |   207 +
 lib/librte_pmd_bcm/ecore_reg.h  |  3664 ++
 lib/librte_pmd_bcm/ecore_sp.c   |  5455 ++
 lib/librte_pmd_bcm/ecore_sp.h   |  1796 +
 lib/librte_pmd_bcm/elink.c  | 13378 ++
 lib/librte_pmd_bcm/elink.h  |   610 ++
 24 files changed, 51977 insertions(+)
 create mode 100644 lib/librte_pmd_bcm/Makefile
 create mode 100644 lib/librte_pmd_bcm/bcm.c
 create mode 100644 lib/librte_pmd_bcm/bcm.h
 create mode 100644 lib/librte_pmd_bcm/bcm_ethdev.c
 create mode 100644 lib/librte_pmd_bcm/bcm_ethdev.h
 create mode 100644 lib/librte_pmd_bcm/bcm_logs.h
 create mode 100644 lib/librte_pmd_bcm/bcm_rxtx.c
 create mode 100644 lib/librte_pmd_bcm/bcm_rxtx.h
 create mode 100644 lib/librte_pmd_bcm/bcm_stats.c
 create mode 100644 lib/librte_pmd_bcm/bcm_stats.h
 create mode 100644 lib/librte_pmd_bcm/bcm_vfpf.c
 create mode 100644 lib/librte_pmd_bcm/bcm_vfpf.h
 create mode 100644 lib/librte_pmd_bcm/debug.c
 create mode 100644 lib/librte_pmd_bcm/ecore_fw_defs.h
 create mode 100644 lib/librte_pmd_bcm/ecore_hsi.h
 create mode 100644 lib/librte_pmd_bcm/ecore_init.h
 create mode 100644 lib/librte_pmd_bcm/ecore_init_ops.h
 create mode 100644 lib/librte_pmd_bcm/ecore_mfw_req.h
 create mode 100644 lib/librte_pmd_bcm/ecore_reg.h
 create mode 100644 lib/librte_pmd_bcm/ecore_sp.c
 create mode 100644 lib/librte_pmd_bcm/ecore_sp.h
 create mode 100644 lib/librte_pmd_bcm/elink.c
 create mode 100644 lib/librte_pmd_bcm/elink.h

diff --git a/lib/Makefile b/lib/Makefile
index d617d81..023fc9c 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -45,6 +45,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_E1000_PMD) += librte_pmd_e1000
 DIRS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += librte_pmd_ixgbe
 DIRS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += librte_pmd_i40e
 DIRS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += librte_pmd_enic
+DIRS-$(CONFIG_RTE_LIBRTE_BCM_PMD) += librte_pmd_bcm
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += librte_pmd_bond
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += librte_pmd_ring
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += librte_pmd_pcap
diff --git a/lib/librte_pmd_bcm/Makefile b/lib/librte_pmd_bcm/Makefile
new file mode 100644
index 000..2f3df65
--- /dev/null
+++ b/lib/librte_pmd_bcm/Makefile
@@ -0,0 +1,28 @@
+include $(RTE_SDK)/mk/rte.vars.mk
+
+#
+# library name
+#
+LIB = librte_pmd_bcm.a
+
+CFLAGS += -O3 -g
+CFLAGS += $(WERROR_FLAGS)
+CFLAGS += -DZLIB_CONST
+
+#
+# all source are stored in SRCS-y
+#
+SRCS-$(CONFIG_RTE_LIBRTE_BCM_PMD) += bcm.c
+SRCS-$(CONFIG_RTE_LIBRTE_BCM_PMD) += bcm_rxtx.c
+SRCS-$(CONFIG_RTE_LIBRTE_BCM_PMD) += bcm_stats.c
+SRCS-$(CONFIG_RTE_LIBRTE_BCM_PMD) += bcm_ethdev.c
+SRCS-$(CONFIG_RTE_LIBRTE_BCM_PMD) += ecore_sp.c
+SRCS-$(CONFIG_RTE_LIBRTE_BCM_PMD) += elink.c
+SRCS-$(CONFIG_RTE_LIBRTE_BCM_PMD) += bcm_vfpf.c
+SRCS-$(CONFIG_RTE_LIBRTE_BCM_DEBUG) += debug.c
+
+# this lib depends upon:
+DEPDIRS-$(CONFIG_RTE_LIBRTE_BCM_PMD) += lib/librte_eal lib/librte_ether 
lib/librte_hash
+DEPDIRS-$(CONFIG_RTE_LIBRTE_BCM_PMD) += lib/librte_mempool lib/librte_mbuf
+
+include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_pmd_bcm/bcm.c b/lib/librte_pmd_bcm/bcm.c
new file mode 100644
index 000..26f190e
--- /dev/null
+++ b/lib/librte_pmd_bcm/bcm.c
@@ -0,0 +1,11817 @@
+/*-
+ * Copyright (c) 2007-2013 Broadcom Corporation. All rights reserved.
+ *
+ * Eric Davis
+ * David Christensen 
+ * Gary Zambrano 
+ *
+ * Copyright (c) 2013-2015 Brocade Communications Systems, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the 

[dpdk-dev] [PATCH 2/4] bcm: add BCM pci device ids

2015-02-06 Thread Stephen Hemminger
From: Stephen Hemminger 

Add PCI id's to enable BCM poll mode driver.

Signed-off-by: Stephen Hemminger 
---
 lib/librte_eal/common/include/rte_pci_dev_ids.h | 30 +
 1 file changed, 30 insertions(+)

diff --git a/lib/librte_eal/common/include/rte_pci_dev_ids.h 
b/lib/librte_eal/common/include/rte_pci_dev_ids.h
index c922de9..b53fd93 100644
--- a/lib/librte_eal/common/include/rte_pci_dev_ids.h
+++ b/lib/librte_eal/common/include/rte_pci_dev_ids.h
@@ -132,6 +132,14 @@
 #define RTE_PCI_DEV_ID_DECL_VMXNET3(vend, dev)
 #endif

+#ifndef RTE_PCI_DEV_ID_DECL_BCM
+#define RTE_PCI_DEV_ID_DECL_BCM(vend, dev)
+#endif
+
+#ifndef RTE_PCI_DEV_ID_DECL_BCMVF
+#define RTE_PCI_DEV_ID_DECL_BCMVF(vend, dev)
+#endif
+
 #ifndef PCI_VENDOR_ID_INTEL
 /** Vendor ID used by Intel devices */
 #define PCI_VENDOR_ID_INTEL 0x8086
@@ -147,6 +155,11 @@
 #define PCI_VENDOR_ID_VMWARE 0x15AD
 #endif

+#ifndef PCI_VENDOR_ID_BROADCOM
+/** Vendor ID used by Broadcom devices */
+#define PCI_VENDOR_ID_BROADCOM 0x14E4
+#endif
+
 / Physical EM devices from e1000_hw.h /

 #define E1000_DEV_ID_825420x1000
@@ -526,6 +539,21 @@ RTE_PCI_DEV_ID_DECL_VIRTIO(PCI_VENDOR_ID_QUMRANET, 
QUMRANET_DEV_ID_VIRTIO)

 RTE_PCI_DEV_ID_DECL_VMXNET3(PCI_VENDOR_ID_VMWARE, VMWARE_DEV_ID_VMXNET3)

+/** Broadcom devices **/
+
+/* Broadcom */
+#define BROADCOM_DEV_ID_57711  0x164F
+#define BROADCOM_DEV_ID_57810  0x168E
+#define BROADCOM_DEV_ID_57810_MF   0x16AE
+#define BROADCOM_DEV_ID_57810_VF   0x16AF
+
+RTE_PCI_DEV_ID_DECL_BCM(PCI_VENDOR_ID_BROADCOM, BROADCOM_DEV_ID_57711)
+RTE_PCI_DEV_ID_DECL_BCM(PCI_VENDOR_ID_BROADCOM, BROADCOM_DEV_ID_57810)
+#ifdef RTE_LIBRTE_BCM_MF_SUPPORT
+RTE_PCI_DEV_ID_DECL_BCM(PCI_VENDOR_ID_BROADCOM, BROADCOM_DEV_ID_57810_MF)
+#endif
+RTE_PCI_DEV_ID_DECL_BCMVF(PCI_VENDOR_ID_BROADCOM, BROADCOM_DEV_ID_57810_VF)
+
 /*
  * Undef all RTE_PCI_DEV_ID_DECL_* here.
  */
@@ -538,3 +566,5 @@ RTE_PCI_DEV_ID_DECL_VMXNET3(PCI_VENDOR_ID_VMWARE, 
VMWARE_DEV_ID_VMXNET3)
 #undef RTE_PCI_DEV_ID_DECL_I40EVF
 #undef RTE_PCI_DEV_ID_DECL_VIRTIO
 #undef RTE_PCI_DEV_ID_DECL_VMXNET3
+#undef RTE_PCI_DEV_ID_DECL_BCM
+#undef RTE_PCI_DEV_ID_DECL_BCMVF
-- 
2.1.4



[dpdk-dev] [PATCH 1/4] pci: allow access to PCI config space

2015-02-06 Thread Stephen Hemminger
From: Stephen Hemminger 

Some drivers need ability to access PCI config (for example for power
management). This adds an abstraction to do this; only implemented
on Linux, but should be possible on BSD.

Signed-off-by: Stephen Hemminger 
---
 lib/librte_eal/common/include/rte_pci.h | 29 +
 lib/librte_eal/linuxapp/eal/eal_pci.c   | 15 +
 lib/librte_eal/linuxapp/eal/eal_pci_uio.c   | 10 +
 lib/librte_eal/linuxapp/eal/rte_eal_version.map |  2 ++
 4 files changed, 56 insertions(+)

diff --git a/lib/librte_eal/common/include/rte_pci.h 
b/lib/librte_eal/common/include/rte_pci.h
index 66ed793..a78081f 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -152,6 +152,7 @@ struct rte_pci_device {
uint16_t max_vfs;   /**< sriov enable if not zero */
int numa_node;  /**< NUMA node connection */
struct rte_devargs *devargs;/**< Device user arguments */
+   int config_fd;  /**< PCI config access */
 };

 /** Any PCI device identifier (vendor, device, ...) */
@@ -298,6 +299,34 @@ void rte_eal_pci_register(struct rte_pci_driver *driver);
  */
 void rte_eal_pci_unregister(struct rte_pci_driver *driver);

+/**
+ * Read PCI config space.
+ *
+ * @param device
+ *   A pointer to a rte_pci_device structure describing the device
+ *   to use
+ * @param buf
+ *   A data buffer where the bytes should be read into
+ * @param size
+ *   The length of the data buffer.
+ */
+int rte_eal_pci_read_config(const struct rte_pci_device *device,
+   void *buf, size_t len, off_t offset);
+
+/**
+ * Write PCI config space.
+ *
+ * @param device
+ *   A pointer to a rte_pci_device structure describing the device
+ *   to use
+ * @param buf
+ *   A data buffer containing the bytes should be written
+ * @param size
+ *   The length of the data buffer.
+ */
+int rte_eal_pci_write_config(const struct rte_pci_device *device,
+const void *buf, size_t len, off_t offset);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c 
b/lib/librte_eal/linuxapp/eal/eal_pci.c
index b5f5410..5bcfffa 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
@@ -233,6 +233,7 @@ pci_scan_one(const char *dirname, uint16_t domain, uint8_t 
bus,
dev->addr.bus = bus;
dev->addr.devid = devid;
dev->addr.function = function;
+   dev->config_fd = -1;

/* get vendor id */
snprintf(filename, sizeof(filename), "%s/vendor", dirname);
@@ -592,6 +593,20 @@ rte_eal_pci_probe_one_driver(struct rte_pci_driver *dr, 
struct rte_pci_device *d
return 1;
 }

+/* Read PCI config space. */
+int rte_eal_pci_read_config(const struct rte_pci_device *device,
+   void *buf, size_t len, off_t offset)
+{
+   return pread(device->config_fd, buf, len, offset);
+}
+
+/* Write PCI config space. */
+int rte_eal_pci_write_config(const struct rte_pci_device *device,
+const void *buf, size_t len, off_t offset)
+{
+   return pwrite(device->config_fd, buf, len, offset);
+}
+
 /* Init the PCI EAL subsystem */
 int
 rte_eal_pci_init(void)
diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_uio.c 
b/lib/librte_eal/linuxapp/eal/eal_pci_uio.c
index e53f06b..0396eaa 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci_uio.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci_uio.c
@@ -213,6 +213,7 @@ pci_get_uio_dev(struct rte_pci_device *dev, char *dstbuf,
struct dirent *e;
DIR *dir;
char dirname[PATH_MAX];
+   char filename[PATH_MAX];

/* depending on kernel version, uio can be located in uio/uioX
 * or uio:uioX */
@@ -268,6 +269,15 @@ pci_get_uio_dev(struct rte_pci_device *dev, char *dstbuf,
if (e == NULL)
return -1;

+   /* Open fd for access to PCI config */
+   snprintf(filename, sizeof(filename), "%s/device/config", dirname);
+   dev->config_fd = open(filename, O_RDWR);
+   if (dev->config_fd < 0) {
+   RTE_LOG(ERR, EAL, "%s(): cannot open %s: %s\n",
+   __func__, filename, strerror(errno));
+   return -1;
+   }
+
/* create uio device if we've been asked to */
if (internal_config.create_uio_dev &&
pci_mknod_uio_dev(dstbuf, uio_num) < 0)
diff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map 
b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
index d36286e..626689c 100644
--- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map
+++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
@@ -40,6 +40,8 @@ DPDK_2.0 {
rte_eal_pci_probe;
rte_eal_pci_register;
rte_eal_pci_unregister;
+   rte_eal_pci_read_config;
+   rte_eal_pci_write_config;

[dpdk-dev] [PATCH 0/4] Broadcom 10G NIC Poll Mode Driver

2015-02-06 Thread Stephen Hemminger
From: Stephen Hemminger 

These are the patches to enable supporting the Broadcom
NetExtreme II 10G devices (show up as bnx2x on Linux).

The driver has only been tested on Linux, there maybe issues
with firmware loading and PCI config access on BSD.

Stephen Hemminger (4):
  pci: allow access to PCI config space
  bcm: add BCM pci device ids
  bcm: new poll mode driver
  bcm: enable BCM poll mode driver in config

 config/common_linuxapp  |10 +
 lib/Makefile| 1 +
 lib/librte_eal/common/include/rte_pci.h |29 +
 lib/librte_eal/common/include/rte_pci_dev_ids.h |30 +
 lib/librte_eal/linuxapp/eal/eal_pci.c   |15 +
 lib/librte_eal/linuxapp/eal/eal_pci_uio.c   |10 +
 lib/librte_eal/linuxapp/eal/rte_eal_version.map | 2 +
 lib/librte_pmd_bcm/Makefile |28 +
 lib/librte_pmd_bcm/bcm.c| 11817 +++
 lib/librte_pmd_bcm/bcm.h|  1998 
 lib/librte_pmd_bcm/bcm_ethdev.c |   544 +
 lib/librte_pmd_bcm/bcm_ethdev.h |79 +
 lib/librte_pmd_bcm/bcm_logs.h   |51 +
 lib/librte_pmd_bcm/bcm_rxtx.c   |   487 +
 lib/librte_pmd_bcm/bcm_rxtx.h   |85 +
 lib/librte_pmd_bcm/bcm_stats.c  |  1619 +++
 lib/librte_pmd_bcm/bcm_stats.h  |   633 +
 lib/librte_pmd_bcm/bcm_vfpf.c   |   597 +
 lib/librte_pmd_bcm/bcm_vfpf.h   |   315 +
 lib/librte_pmd_bcm/debug.c  |   113 +
 lib/librte_pmd_bcm/ecore_fw_defs.h  |   423 +
 lib/librte_pmd_bcm/ecore_hsi.h  |  6349 ++
 lib/librte_pmd_bcm/ecore_init.h |   842 ++
 lib/librte_pmd_bcm/ecore_init_ops.h |   886 ++
 lib/librte_pmd_bcm/ecore_mfw_req.h  |   207 +
 lib/librte_pmd_bcm/ecore_reg.h  |  3664 ++
 lib/librte_pmd_bcm/ecore_sp.c   |  5455 +
 lib/librte_pmd_bcm/ecore_sp.h   |  1796 +++
 lib/librte_pmd_bcm/elink.c  | 13378 ++
 lib/librte_pmd_bcm/elink.h  |   610 +
 30 files changed, 52073 insertions(+)
 create mode 100644 lib/librte_pmd_bcm/Makefile
 create mode 100644 lib/librte_pmd_bcm/bcm.c
 create mode 100644 lib/librte_pmd_bcm/bcm.h
 create mode 100644 lib/librte_pmd_bcm/bcm_ethdev.c
 create mode 100644 lib/librte_pmd_bcm/bcm_ethdev.h
 create mode 100644 lib/librte_pmd_bcm/bcm_logs.h
 create mode 100644 lib/librte_pmd_bcm/bcm_rxtx.c
 create mode 100644 lib/librte_pmd_bcm/bcm_rxtx.h
 create mode 100644 lib/librte_pmd_bcm/bcm_stats.c
 create mode 100644 lib/librte_pmd_bcm/bcm_stats.h
 create mode 100644 lib/librte_pmd_bcm/bcm_vfpf.c
 create mode 100644 lib/librte_pmd_bcm/bcm_vfpf.h
 create mode 100644 lib/librte_pmd_bcm/debug.c
 create mode 100644 lib/librte_pmd_bcm/ecore_fw_defs.h
 create mode 100644 lib/librte_pmd_bcm/ecore_hsi.h
 create mode 100644 lib/librte_pmd_bcm/ecore_init.h
 create mode 100644 lib/librte_pmd_bcm/ecore_init_ops.h
 create mode 100644 lib/librte_pmd_bcm/ecore_mfw_req.h
 create mode 100644 lib/librte_pmd_bcm/ecore_reg.h
 create mode 100644 lib/librte_pmd_bcm/ecore_sp.c
 create mode 100644 lib/librte_pmd_bcm/ecore_sp.h
 create mode 100644 lib/librte_pmd_bcm/elink.c
 create mode 100644 lib/librte_pmd_bcm/elink.h

-- 
2.1.4



[dpdk-dev] mmap fails with more than 40000 hugepages

2015-02-06 Thread Damjan Marion (damarion)

> On 06 Feb 2015, at 11:26, De Lara Guarch, Pablo  intel.com> wrote:
> 
> 
> 
>> -Original Message-
>> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Linhaifeng
>> Sent: Friday, February 06, 2015 2:04 AM
>> To: Damjan Marion (damarion); dev at dpdk.org
>> Subject: Re: [dpdk-dev] mmap fails with more than 4 hugepages
>> 
>> 
>> 
>> On 2015/2/5 20:00, Damjan Marion (damarion) wrote:
>>> Hi,
>>> 
>>> I have system with 2 NUMA nodes and 256G RAM total. I noticed that DPDK
>> crashes in rte_eal_init()
>>> when number of available hugepages is around 4 or above.
>>> Everything works fine with lower values (i.e. 3).
>>> 
>>> I also tried with allocating 4 on node0 and 0 on node1, same crash
>> happens.
>>> 
>>> 
>>> Any idea what might be causing this?
>>> 
>>> Thanks,
>>> 
>>> Damjan
>>> 
>> 
>> cat /proc/sys/vm/max_map_count
> 
> I just checked on my board, and having 40k hugepages, you need that value to 
> be over the double of that (a value of 81k should work).
> 
> Let us know if that fixed the problem!

Yes, it works now. Thanks!



[dpdk-dev] mmap fails with more than 40000 hugepages

2015-02-06 Thread De Lara Guarch, Pablo


> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Linhaifeng
> Sent: Friday, February 06, 2015 2:04 AM
> To: Damjan Marion (damarion); dev at dpdk.org
> Subject: Re: [dpdk-dev] mmap fails with more than 4 hugepages
> 
> 
> 
> On 2015/2/5 20:00, Damjan Marion (damarion) wrote:
> > Hi,
> >
> > I have system with 2 NUMA nodes and 256G RAM total. I noticed that DPDK
> crashes in rte_eal_init()
> > when number of available hugepages is around 4 or above.
> > Everything works fine with lower values (i.e. 3).
> >
> > I also tried with allocating 4 on node0 and 0 on node1, same crash
> happens.
> >
> >
> > Any idea what might be causing this?
> >
> > Thanks,
> >
> > Damjan
> >
> 
> cat /proc/sys/vm/max_map_count

I just checked on my board, and having 40k hugepages, you need that value to be 
over the double of that (a value of 81k should work).

Let us know if that fixed the problem!

Pablo
> 
> 
> >
> > $ cat /sys/devices/system/node/node[01]/hugepages/hugepages-
> 2048kB/nr_hugepages
> > 2
> > 2
> >
> > $ grep -i huge /proc/meminfo
> > AnonHugePages:706560 kB
> > HugePages_Total:   4
> > HugePages_Free:4
> > HugePages_Rsvd:0
> > HugePages_Surp:0
> > Hugepagesize:   2048 kB
> >
> >
> > $ sudo ~/src/dpdk/x86_64-native-linuxapp-gcc/app/testpmd -l 5-7 -n 3 --
> socket-mem 512,512
> > EAL: Detected lcore 0 as core 0 on socket 0
> > EAL: Detected lcore 1 as core 1 on socket 0
> > EAL: Detected lcore 2 as core 2 on socket 0
> > EAL: Detected lcore 3 as core 3 on socket 0
> > EAL: Detected lcore 4 as core 4 on socket 0
> > EAL: Detected lcore 5 as core 5 on socket 0
> > EAL: Detected lcore 6 as core 6 on socket 0
> > EAL: Detected lcore 7 as core 7 on socket 0
> > EAL: Detected lcore 8 as core 0 on socket 1
> > EAL: Detected lcore 9 as core 1 on socket 1
> > EAL: Detected lcore 10 as core 2 on socket 1
> > EAL: Detected lcore 11 as core 3 on socket 1
> > EAL: Detected lcore 12 as core 4 on socket 1
> > EAL: Detected lcore 13 as core 5 on socket 1
> > EAL: Detected lcore 14 as core 6 on socket 1
> > EAL: Detected lcore 15 as core 7 on socket 1
> > EAL: Detected lcore 16 as core 0 on socket 0
> > EAL: Detected lcore 17 as core 1 on socket 0
> > EAL: Detected lcore 18 as core 2 on socket 0
> > EAL: Detected lcore 19 as core 3 on socket 0
> > EAL: Detected lcore 20 as core 4 on socket 0
> > EAL: Detected lcore 21 as core 5 on socket 0
> > EAL: Detected lcore 22 as core 6 on socket 0
> > EAL: Detected lcore 23 as core 7 on socket 0
> > EAL: Detected lcore 24 as core 0 on socket 1
> > EAL: Detected lcore 25 as core 1 on socket 1
> > EAL: Detected lcore 26 as core 2 on socket 1
> > EAL: Detected lcore 27 as core 3 on socket 1
> > EAL: Detected lcore 28 as core 4 on socket 1
> > EAL: Detected lcore 29 as core 5 on socket 1
> > EAL: Detected lcore 30 as core 6 on socket 1
> > EAL: Detected lcore 31 as core 7 on socket 1
> > EAL: Support maximum 128 logical core(s) by configuration.
> > EAL: Detected 32 lcore(s)
> > EAL: VFIO modules not all loaded, skip VFIO support...
> > EAL: Setting up memory...
> > EAL: Ask a virtual area of 0x80 bytes
> > EAL: Virtual area found at 0x7fae2a20 (size = 0x80)
> > EAL: Ask a virtual area of 0x760 bytes
> > EAL: Virtual area found at 0x7fae22a0 (size = 0x760)
> > EAL: Ask a virtual area of 0x140 bytes
> > EAL: Virtual area found at 0x7fae2140 (size = 0x140)
> > EAL: Ask a virtual area of 0x20 bytes
> > EAL: Virtual area found at 0x7fae2100 (size = 0x20)
> > EAL: Ask a virtual area of 0x40 bytes
> > EAL: Virtual area found at 0x7fae20a0 (size = 0x40)
> > EAL: Ask a virtual area of 0x20 bytes
> > EAL: Virtual area found at 0x7fae2060 (size = 0x20)
> > EAL: Ask a virtual area of 0x20 bytes
> > EAL: Virtual area found at 0x7fae2020 (size = 0x20)
> > EAL: Ask a virtual area of 0x20 bytes
> > EAL: Virtual area found at 0x7fae1fe0 (size = 0x20)
> > EAL: Ask a virtual area of 0x580 bytes
> > EAL: Virtual area found at 0x7fae1a40 (size = 0x580)
> > EAL: Ask a virtual area of 0x3b20 bytes
> > EAL: Virtual area found at 0x7faddf00 (size = 0x3b20)
> > EAL: Ask a virtual area of 0x40 bytes
> > EAL: Virtual area found at 0x7faddea0 (size = 0x40)
> > EAL: Ask a virtual area of 0x7c0 bytes
> > EAL: Virtual area found at 0x7fadd6c0 (size = 0x7c0)
> > EAL: Ask a virtual area of 0x20 bytes
> > EAL: Virtual area found at 0x7fadd680 (size = 0x20)
> > EAL: Ask a virtual area of 0x20 bytes
> > EAL: Virtual area found at 0x7fadd640 (size = 0x20)
> > EAL: Ask a virtual area of 0x20 bytes
> > EAL: Virtual area found at 0x7fadd600 (size = 0x20)
> > EAL: Ask a virtual area of 0x20 bytes
> > EAL: Virtual area found at 0x7fadd5c0 (size = 0x20)
> > EAL: Ask a virtual area of 0x20 bytes
> > EAL: Virtual area found at 0x7fadd580 

[dpdk-dev] [dts] Bond feature can't running well on 40G i40e NICs

2015-02-06 Thread Declan Doherty
On 05/02/15 02:03, lhffjzh wrote:
> Hi DPDK maintainers,
>
>
>
> We encounter confusion recently which is 40G i40e NICs bond issue, our
> bonding logic as below, the ixgbe bonding is running well both 1.7.1 and
> 1.8.0, but i40e are all failed.
>
>
>
> Create bond port -> config slave ports(tx/rx) -> start slave ports -> add
> slave port into bond port -> start bond port -> tx/rx on bond port
>
>
>
> On 1.7.1, the 40G bonding port always can't be started, them status are down
> and speed are 0.
>
> On 1.8.0, the 40G bonding port start and send network package correctly, but
> can't receive any package with BONDING_MODE_BALANCE
>  349cb9771>  mode and all policies like BALANCE_XMIT_POLICY_LAYER2. In
> BONDING_MODE_ROUND_ROBIN
>  03dc4184f>  mode, bonding port can send/receive a few network packages(less
> than 100) per seconds.
>
>
>
> Could you please help us for this? any clue is welcome.
>
>
>
>
>
> Thanks and Regards,
>
> Haifeng
>
>
>

Hi Haifeng,

We only added support from i40e devices in the 1.8.0 release. In release 
1.7.0/1.7.1 there was no support for LSC interrupts in the i40e PMD 
which was required for that release of the bonding PMD, this is why the 
device cannot be started and will always stay have a link down status, 
as the bonded PMD isn't able to detect the LSC in the slave. From 1.8.0 
support was added for polling of PMD's LSC where interrupts aren't 
supported, but LSC interrupt support for the i40e PMD was also added in 
this release.

I need to investigate this further and see if I can replicate your 
issues. I'll reply as soon as I have further information.


Declan



[dpdk-dev] mmap fails with more than 40000 hugepages

2015-02-06 Thread Linhaifeng


On 2015/2/5 20:00, Damjan Marion (damarion) wrote:
> Hi,
> 
> I have system with 2 NUMA nodes and 256G RAM total. I noticed that DPDK 
> crashes in rte_eal_init()
> when number of available hugepages is around 4 or above.
> Everything works fine with lower values (i.e. 3).
> 
> I also tried with allocating 4 on node0 and 0 on node1, same crash 
> happens.
> 
> 
> Any idea what might be causing this?
> 
> Thanks,
> 
> Damjan
> 

cat /proc/sys/vm/max_map_count


> 
> $ cat 
> /sys/devices/system/node/node[01]/hugepages/hugepages-2048kB/nr_hugepages
> 2
> 2
> 
> $ grep -i huge /proc/meminfo
> AnonHugePages:706560 kB
> HugePages_Total:   4
> HugePages_Free:4
> HugePages_Rsvd:0
> HugePages_Surp:0
> Hugepagesize:   2048 kB
> 
> 
> $ sudo ~/src/dpdk/x86_64-native-linuxapp-gcc/app/testpmd -l 5-7 -n 3 
> --socket-mem 512,512
> EAL: Detected lcore 0 as core 0 on socket 0
> EAL: Detected lcore 1 as core 1 on socket 0
> EAL: Detected lcore 2 as core 2 on socket 0
> EAL: Detected lcore 3 as core 3 on socket 0
> EAL: Detected lcore 4 as core 4 on socket 0
> EAL: Detected lcore 5 as core 5 on socket 0
> EAL: Detected lcore 6 as core 6 on socket 0
> EAL: Detected lcore 7 as core 7 on socket 0
> EAL: Detected lcore 8 as core 0 on socket 1
> EAL: Detected lcore 9 as core 1 on socket 1
> EAL: Detected lcore 10 as core 2 on socket 1
> EAL: Detected lcore 11 as core 3 on socket 1
> EAL: Detected lcore 12 as core 4 on socket 1
> EAL: Detected lcore 13 as core 5 on socket 1
> EAL: Detected lcore 14 as core 6 on socket 1
> EAL: Detected lcore 15 as core 7 on socket 1
> EAL: Detected lcore 16 as core 0 on socket 0
> EAL: Detected lcore 17 as core 1 on socket 0
> EAL: Detected lcore 18 as core 2 on socket 0
> EAL: Detected lcore 19 as core 3 on socket 0
> EAL: Detected lcore 20 as core 4 on socket 0
> EAL: Detected lcore 21 as core 5 on socket 0
> EAL: Detected lcore 22 as core 6 on socket 0
> EAL: Detected lcore 23 as core 7 on socket 0
> EAL: Detected lcore 24 as core 0 on socket 1
> EAL: Detected lcore 25 as core 1 on socket 1
> EAL: Detected lcore 26 as core 2 on socket 1
> EAL: Detected lcore 27 as core 3 on socket 1
> EAL: Detected lcore 28 as core 4 on socket 1
> EAL: Detected lcore 29 as core 5 on socket 1
> EAL: Detected lcore 30 as core 6 on socket 1
> EAL: Detected lcore 31 as core 7 on socket 1
> EAL: Support maximum 128 logical core(s) by configuration.
> EAL: Detected 32 lcore(s)
> EAL: VFIO modules not all loaded, skip VFIO support...
> EAL: Setting up memory...
> EAL: Ask a virtual area of 0x80 bytes
> EAL: Virtual area found at 0x7fae2a20 (size = 0x80)
> EAL: Ask a virtual area of 0x760 bytes
> EAL: Virtual area found at 0x7fae22a0 (size = 0x760)
> EAL: Ask a virtual area of 0x140 bytes
> EAL: Virtual area found at 0x7fae2140 (size = 0x140)
> EAL: Ask a virtual area of 0x20 bytes
> EAL: Virtual area found at 0x7fae2100 (size = 0x20)
> EAL: Ask a virtual area of 0x40 bytes
> EAL: Virtual area found at 0x7fae20a0 (size = 0x40)
> EAL: Ask a virtual area of 0x20 bytes
> EAL: Virtual area found at 0x7fae2060 (size = 0x20)
> EAL: Ask a virtual area of 0x20 bytes
> EAL: Virtual area found at 0x7fae2020 (size = 0x20)
> EAL: Ask a virtual area of 0x20 bytes
> EAL: Virtual area found at 0x7fae1fe0 (size = 0x20)
> EAL: Ask a virtual area of 0x580 bytes
> EAL: Virtual area found at 0x7fae1a40 (size = 0x580)
> EAL: Ask a virtual area of 0x3b20 bytes
> EAL: Virtual area found at 0x7faddf00 (size = 0x3b20)
> EAL: Ask a virtual area of 0x40 bytes
> EAL: Virtual area found at 0x7faddea0 (size = 0x40)
> EAL: Ask a virtual area of 0x7c0 bytes
> EAL: Virtual area found at 0x7fadd6c0 (size = 0x7c0)
> EAL: Ask a virtual area of 0x20 bytes
> EAL: Virtual area found at 0x7fadd680 (size = 0x20)
> EAL: Ask a virtual area of 0x20 bytes
> EAL: Virtual area found at 0x7fadd640 (size = 0x20)
> EAL: Ask a virtual area of 0x20 bytes
> EAL: Virtual area found at 0x7fadd600 (size = 0x20)
> EAL: Ask a virtual area of 0x20 bytes
> EAL: Virtual area found at 0x7fadd5c0 (size = 0x20)
> EAL: Ask a virtual area of 0x20 bytes
> EAL: Virtual area found at 0x7fadd580 (size = 0x20)
> EAL: Ask a virtual area of 0x980 bytes
> EAL: Virtual area found at 0x7fadcbe0 (size = 0x980)
> EAL: Ask a virtual area of 0x1900 bytes
> EAL: Virtual area found at 0x7fadb2c0 (size = 0x1900)
> EAL: Ask a virtual area of 0x2440 bytes
> EAL: Virtual area found at 0x7fad8e60 (size = 0x2440)
> EAL: Ask a virtual area of 0xc80 bytes
> EAL: Virtual area found at 0x7fad81c0 (size = 0xc80)
> EAL: Ask a virtual area of 0x3200 bytes
> EAL: Virtual area found at 0x7fad4fa0 (size = 0x3200)
> EAL: Ask a virtual area of 0x3db80 bytes
> EAL: Virtual area found at 

[dpdk-dev] [PATCH 1/3] maintainers: dispatch more doc

2015-02-06 Thread Olivier MATZ
Hi Thomas,

On 02/04/2015 11:23 PM, Thomas Monjalon wrote:
> Documentation of build system, EAL and ring lib should be covered by
> the maintainers of the respective areas.
> 
> Signed-off-by: Thomas Monjalon 
> ---
>  MAINTAINERS | 6 ++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 12c7c16..f2b697e 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -49,6 +49,10 @@ F: scripts/depdirs-rule.sh
>  F: scripts/gen-build-mk.sh
>  F: scripts/gen-config-h.sh
>  F: scripts/relpath.sh
> +F: doc/build-sdk-quick.txt
> +F: doc/guides/prog_guide/build_app.rst
> +F: doc/guides/prog_guide/dev_kit_*
> +F: doc/guides/prog_guide/ext_app_lib_make_help.rst
>  
>  
>  Environment Abstraction Layer
> @@ -59,6 +63,7 @@ M: Thomas Monjalon 
>  F: lib/librte_eal/common/*
>  F: lib/librte_eal/common/include/*
>  F: lib/librte_eal/common/include/generic/
> +F: doc/guides/prog_guide/env_abstraction_layer.rst
>  F: app/test/test_alarm.c
>  F: app/test/test_atomic.c
>  F: app/test/test_byteorder.c
> @@ -150,6 +155,7 @@ F: app/test/test_func_reentrancy.c
>  Ring queue
>  M: Olivier Matz 
>  F: lib/librte_ring/
> +F: doc/guides/prog_guide/ring_lib.rst
>  F: app/test/test_ring*
>  F: app/test/test_func_reentrancy.c

Acked-by: Olivier Matz 



[dpdk-dev] mmap fails with more than 40000 hugepages

2015-02-06 Thread Linhaifeng

On 2015/2/5 20:00, Damjan Marion (damarion) wrote:
> Hi,
> 
> I have system with 2 NUMA nodes and 256G RAM total. I noticed that DPDK 
> crashes in rte_eal_init()
> when number of available hugepages is around 4 or above.
> Everything works fine with lower values (i.e. 3).
> 
> I also tried with allocating 4 on node0 and 0 on node1, same crash 
> happens.
> 
> 
> Any idea what might be causing this?
> 
> Thanks,
> 
> Damjan
> 

Is there any other process trying to use hugepages?

> 
> $ cat 
> /sys/devices/system/node/node[01]/hugepages/hugepages-2048kB/nr_hugepages
> 2
> 2
> 
> $ grep -i huge /proc/meminfo
> AnonHugePages:706560 kB
> HugePages_Total:   4
> HugePages_Free:4
> HugePages_Rsvd:0
> HugePages_Surp:0
> Hugepagesize:   2048 kB
> 
> 
> $ sudo ~/src/dpdk/x86_64-native-linuxapp-gcc/app/testpmd -l 5-7 -n 3 
> --socket-mem 512,512
> EAL: Detected lcore 0 as core 0 on socket 0
> EAL: Detected lcore 1 as core 1 on socket 0
> EAL: Detected lcore 2 as core 2 on socket 0
> EAL: Detected lcore 3 as core 3 on socket 0
> EAL: Detected lcore 4 as core 4 on socket 0
> EAL: Detected lcore 5 as core 5 on socket 0
> EAL: Detected lcore 6 as core 6 on socket 0
> EAL: Detected lcore 7 as core 7 on socket 0
> EAL: Detected lcore 8 as core 0 on socket 1
> EAL: Detected lcore 9 as core 1 on socket 1
> EAL: Detected lcore 10 as core 2 on socket 1
> EAL: Detected lcore 11 as core 3 on socket 1
> EAL: Detected lcore 12 as core 4 on socket 1
> EAL: Detected lcore 13 as core 5 on socket 1
> EAL: Detected lcore 14 as core 6 on socket 1
> EAL: Detected lcore 15 as core 7 on socket 1
> EAL: Detected lcore 16 as core 0 on socket 0
> EAL: Detected lcore 17 as core 1 on socket 0
> EAL: Detected lcore 18 as core 2 on socket 0
> EAL: Detected lcore 19 as core 3 on socket 0
> EAL: Detected lcore 20 as core 4 on socket 0
> EAL: Detected lcore 21 as core 5 on socket 0
> EAL: Detected lcore 22 as core 6 on socket 0
> EAL: Detected lcore 23 as core 7 on socket 0
> EAL: Detected lcore 24 as core 0 on socket 1
> EAL: Detected lcore 25 as core 1 on socket 1
> EAL: Detected lcore 26 as core 2 on socket 1
> EAL: Detected lcore 27 as core 3 on socket 1
> EAL: Detected lcore 28 as core 4 on socket 1
> EAL: Detected lcore 29 as core 5 on socket 1
> EAL: Detected lcore 30 as core 6 on socket 1
> EAL: Detected lcore 31 as core 7 on socket 1
> EAL: Support maximum 128 logical core(s) by configuration.
> EAL: Detected 32 lcore(s)
> EAL: VFIO modules not all loaded, skip VFIO support...
> EAL: Setting up memory...
> EAL: Ask a virtual area of 0x80 bytes
> EAL: Virtual area found at 0x7fae2a20 (size = 0x80)
> EAL: Ask a virtual area of 0x760 bytes
> EAL: Virtual area found at 0x7fae22a0 (size = 0x760)
> EAL: Ask a virtual area of 0x140 bytes
> EAL: Virtual area found at 0x7fae2140 (size = 0x140)
> EAL: Ask a virtual area of 0x20 bytes
> EAL: Virtual area found at 0x7fae2100 (size = 0x20)
> EAL: Ask a virtual area of 0x40 bytes
> EAL: Virtual area found at 0x7fae20a0 (size = 0x40)
> EAL: Ask a virtual area of 0x20 bytes
> EAL: Virtual area found at 0x7fae2060 (size = 0x20)
> EAL: Ask a virtual area of 0x20 bytes
> EAL: Virtual area found at 0x7fae2020 (size = 0x20)
> EAL: Ask a virtual area of 0x20 bytes
> EAL: Virtual area found at 0x7fae1fe0 (size = 0x20)
> EAL: Ask a virtual area of 0x580 bytes
> EAL: Virtual area found at 0x7fae1a40 (size = 0x580)
> EAL: Ask a virtual area of 0x3b20 bytes
> EAL: Virtual area found at 0x7faddf00 (size = 0x3b20)
> EAL: Ask a virtual area of 0x40 bytes
> EAL: Virtual area found at 0x7faddea0 (size = 0x40)
> EAL: Ask a virtual area of 0x7c0 bytes
> EAL: Virtual area found at 0x7fadd6c0 (size = 0x7c0)
> EAL: Ask a virtual area of 0x20 bytes
> EAL: Virtual area found at 0x7fadd680 (size = 0x20)
> EAL: Ask a virtual area of 0x20 bytes
> EAL: Virtual area found at 0x7fadd640 (size = 0x20)
> EAL: Ask a virtual area of 0x20 bytes
> EAL: Virtual area found at 0x7fadd600 (size = 0x20)
> EAL: Ask a virtual area of 0x20 bytes
> EAL: Virtual area found at 0x7fadd5c0 (size = 0x20)
> EAL: Ask a virtual area of 0x20 bytes
> EAL: Virtual area found at 0x7fadd580 (size = 0x20)
> EAL: Ask a virtual area of 0x980 bytes
> EAL: Virtual area found at 0x7fadcbe0 (size = 0x980)
> EAL: Ask a virtual area of 0x1900 bytes
> EAL: Virtual area found at 0x7fadb2c0 (size = 0x1900)
> EAL: Ask a virtual area of 0x2440 bytes
> EAL: Virtual area found at 0x7fad8e60 (size = 0x2440)
> EAL: Ask a virtual area of 0xc80 bytes
> EAL: Virtual area found at 0x7fad81c0 (size = 0xc80)
> EAL: Ask a virtual area of 0x3200 bytes
> EAL: Virtual area found at 0x7fad4fa0 (size = 0x3200)
> EAL: Ask a virtual area of 0x3db80 bytes
> EAL: Virtual 

[dpdk-dev] [PATCH v2] testpmd: fix port parsing in show port info command

2015-02-06 Thread Olivier MATZ
Hi,

On 02/06/2015 02:29 AM, xuelin.shi at freescale.com wrote:
> From: Xuelin Shi 
> 
> the port number type should be consistent with librte_cmdline,
> else there is potential endian issue.
> 
> Signed-off-by: Xuelin Shi 
> ---
> v2 change:
>  change port type to uint8
>  rephrase patch title
> 
>  app/test-pmd/cmdline.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
> index 590e427..d5f31f2 100644
> --- a/app/test-pmd/cmdline.c
> +++ b/app/test-pmd/cmdline.c
> @@ -5584,7 +5584,7 @@ cmdline_parse_token_string_t cmd_showport_what =
>   TOKEN_STRING_INITIALIZER(struct cmd_showport_result, what,
>"info#stats#xstats#fdir#stat_qmap");
>  cmdline_parse_token_num_t cmd_showport_portnum =
> - TOKEN_NUM_INITIALIZER(struct cmd_showport_result, portnum, INT32);
> + TOKEN_NUM_INITIALIZER(struct cmd_showport_result, portnum, UINT8);
>  
>  cmdline_parse_inst_t cmd_showport = {
>   .f = cmd_showport_parsed,
> 

Acked-by: Olivier Matz 


[dpdk-dev] [PATCH v2] testpmd: fix port parsing in show port info command

2015-02-06 Thread xuelin....@freescale.com
From: Xuelin Shi 

the port number type should be consistent with librte_cmdline,
else there is potential endian issue.

Signed-off-by: Xuelin Shi 
---
v2 change:
 change port type to uint8
 rephrase patch title

 app/test-pmd/cmdline.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 590e427..d5f31f2 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -5584,7 +5584,7 @@ cmdline_parse_token_string_t cmd_showport_what =
TOKEN_STRING_INITIALIZER(struct cmd_showport_result, what,
 "info#stats#xstats#fdir#stat_qmap");
 cmdline_parse_token_num_t cmd_showport_portnum =
-   TOKEN_NUM_INITIALIZER(struct cmd_showport_result, portnum, INT32);
+   TOKEN_NUM_INITIALIZER(struct cmd_showport_result, portnum, UINT8);

 cmdline_parse_inst_t cmd_showport = {
.f = cmd_showport_parsed,
-- 
1.9.1



[dpdk-dev] ACL Issue with single field rule and rest with wild card entry

2015-02-06 Thread Rapelly, Varun
Hi,

struct ipv6_5tuple {
   uint8_t proto; /* Protocol, next header. */
   uint32_t src_addr0;  /* IP address of source host. */
   uint32_t src_addr1;  /* IP address of source host. */
   uint32_t src_addr2;  /* IP address of source host. */
   uint32_t src_addr3;  /* IP address of source host. */
};

enum {
   PROTO_FIELD_IPV6,
   SRC_FIELD0_IPV6,
   SRC_FIELD1_IPV6,
   SRC_FIELD2_IPV6,
   SRC_FIELD3_IPV6,
   NUM_FIELDS_IPV6
};


I'm using the above data to insert in to ACL trie.

If I'm inserting rules with only different proto fields, [I'm expecting others 
fields as wild card entries]  then the rules are not matching.

But if I insert one rule with dummy entries [in the attached file line num 
118-125], then the above issue is resolved.

Please let me know:


1.   Can we have rules with only one entry and others as wild card entries?

2.   Is there any other way to match wild card entries in a rule?

Regards,
Varun

-- next part --
An embedded and charset-unspecified text was scrubbed...
Name: main.c
URL: 
<http://dpdk.org/ml/archives/dev/attachments/20150206/2fb0639e/attachment.c>


[dpdk-dev] [PATCH] vhost: notify guest to fill buffer when there is no buffer

2015-02-06 Thread Xu, Qian Q
Haifeng
Are you using the latest dpdk branch with vhost-user patches? I have never met 
the issue.
When is the vhost sample crashed? When you start VM or when you run sth in VM? 
Is your qemu 2.2? How about your memory info? Could you give more details about 
your steps? 



-Original Message-
From: Linhaifeng [mailto:haifeng@huawei.com] 
Sent: Friday, February 06, 2015 12:02 PM
To: Xu, Qian Q; Xie, Huawei
Cc: lilijun; liuyongan at huawei.com; dev at dpdk.org
Subject: Re: [dpdk-dev] [PATCH] vhost: notify guest to fill buffer when there 
is no buffer



On 2015/2/4 9:38, Xu, Qian Q wrote:
> 4. Launch the VM1 and VM2 with virtio device, note: you need use qemu 
> version>2.1 to enable the vhost-user server's feature. Old qemu such as 
> 1.5,1.6 didn't support it.
> Below is my VM1 startup command, for your reference, similar for VM2. 
> /home/qemu-2.2.0/x86_64-softmmu/qemu-system-x86_64 -name us-vhost-vm1 -cpu 
> host -enable-kvm -m 2048 -object 
> memory-backend-file,id=mem,size=2048M,mem-path=/mnt/huge,share=on -numa 
> node,memdev=mem -mem-prealloc -smp 2 -drive file=/home/img/dpdk1-vm1.img 
> -chardev socket,id=char0,path=/home/dpdk-vhost/vhost-net -netdev 
> type=vhost-user,id=mynet1,chardev=char0,vhostforce -device 
> virtio-net-pci,mac=00:00:00:00:00:01, -nographic
> 
> 5. Then in the VM, you can have the same operations as before, send packet 
> from virtio1 to virtio2. 
> 
> Pls let me know if any questions, issues. 

Hi xie & xu

When I try to start VM vhost-switch crashed.

VHOST_CONFIG: read message VHOST_USER_SET_MEM_TABLE
VHOST_CONFIG: mapped region 0 fd:19 to 0x sz:0xa off:0x0
VHOST_CONFIG: mmap qemu guest failed.
VHOST_CONFIG: read message VHOST_USER_SET_VRING_NUM
VHOST_CONFIG: read message VHOST_USER_SET_VRING_BASE
VHOST_CONFIG: read message VHOST_USER_SET_VRING_ADDR
run_dpdk_vhost.sh: line 19:  1854 Segmentation fault  
${RTE_SDK}/examples/vhost/build/app/vhost-switch -c 0x300 -n 4 --huge-dir 
/dev/hugepages -m 2048 -- -p 0x1 --vm2vm 2 --mergeable 0 --zero-copy 0



-- 
Regards,
Haifeng



[dpdk-dev] [PATCH] fix testpmd show port info error

2015-02-06 Thread Xuelin Shi
Hi Olivier,

Would you please help to review the bottom patch?

Thanks,
Shi Xuelin

-Original Message-
From: dev [mailto:dev-boun...@dpdk.org] On Behalf Of Xuelin Shi
Sent: Thursday, February 05, 2015 17:27
To: dev at dpdk.org
Subject: Re: [dpdk-dev] [PATCH] fix testpmd show port info error

Hi,

Anybody interested in this patch could have a review or comment on it?
I'm new here. Should I send this patch to some specific maintainer to make this 
more efficient?

Thanks,
Shi Xuelin

-Original Message-
From: xuelin.shi at freescale.com [mailto:xuelin@freescale.com] 
Sent: Monday, February 02, 2015 14:52
To: dev at dpdk.org
Cc: Shi Xuelin-B29237
Subject: [PATCH] fix testpmd show port info error

From: Xuelin Shi 

the port number type should be consistent with librte_cmdline, else there is 
potential endian issue.

Signed-off-by: Xuelin Shi 
---
 app/test-pmd/cmdline.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 
4beb404..488ac63 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -5568,7 +5568,7 @@ cmdline_parse_token_string_t cmd_showport_what =
TOKEN_STRING_INITIALIZER(struct cmd_showport_result, what,
 "info#stats#xstats#fdir#stat_qmap");
 cmdline_parse_token_num_t cmd_showport_portnum =
-   TOKEN_NUM_INITIALIZER(struct cmd_showport_result, portnum, INT32);
+   TOKEN_NUM_INITIALIZER(struct cmd_showport_result, portnum, INT8);

 cmdline_parse_inst_t cmd_showport = {
.f = cmd_showport_parsed,
--
1.9.1