[dpdk-dev] [PATCH v3] virtio: Fix vring entry number issue

2014-10-14 Thread Ouyang Changchun
-- V1 change:
  Fix one issue in virtio TX: it needs one more vring descriptor to hold the 
virtio
  header when transmitting packets, it is used later to determine whether to 
free
  more entries from used vring.

  It fixes failing to transmit any packet with 1 segment in the circumstance of 
only
  1 descriptor in the vring free list.

-- V2 change:
  Refine description, 'vring descriptor' is more accurate than 'vring entry';
  Accordingly update test condition (it needs one more descriptor for virtio 
header) to
  put packets to transmit queue.

-- V3 change:
  Resolve compilation issue due to mbuf re-structure.

Signed-off-by: Changchun Ouyang 
---
 lib/librte_pmd_virtio/virtio_rxtx.c | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/lib/librte_pmd_virtio/virtio_rxtx.c 
b/lib/librte_pmd_virtio/virtio_rxtx.c
index 0b10108..ac44c65 100644
--- a/lib/librte_pmd_virtio/virtio_rxtx.c
+++ b/lib/librte_pmd_virtio/virtio_rxtx.c
@@ -699,7 +699,8 @@ virtio_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, 
uint16_t nb_pkts)
num = (uint16_t)(likely(nb_used < VIRTIO_MBUF_BURST_SZ) ? nb_used : 
VIRTIO_MBUF_BURST_SZ);

while (nb_tx < nb_pkts) {
-   int need = tx_pkts[nb_tx]->pkt.nb_segs - txvq->vq_free_cnt;
+   /* Need one more descriptor for virtio header. */
+   int need = tx_pkts[nb_tx]->nb_segs - txvq->vq_free_cnt + 1;
int deq_cnt = RTE_MIN(need, (int)num);

num -= (deq_cnt > 0) ? deq_cnt : 0;
@@ -708,7 +709,12 @@ virtio_xmit_pkts(void *tx_queue, struct rte_mbuf 
**tx_pkts, uint16_t nb_pkts)
deq_cnt--;
}

-   if (tx_pkts[nb_tx]->pkt.nb_segs <= txvq->vq_free_cnt) {
+   need = (int)tx_pkts[nb_tx]->nb_segs - txvq->vq_free_cnt + 1;
+   /*
+* Zero or negative value indicates it has enough free
+* decriptors to transmit.
+*/
+   if (need <= 0) {
txm = tx_pkts[nb_tx];
/* Enqueue Packet buffers */
error = virtqueue_enqueue_xmit(txvq, txm);
-- 
1.8.4.2



[dpdk-dev] [PATCH] Fix librte_pmd_ring: connect primary and secondary ring with correct port.

2014-10-14 Thread Masaru Oki
thank you for reply.

> From my reading, this is really two patches:
> 1. add in a port id to packets received from an eth_ring port
> 2. change the rte_eth_ring_create function to create two sets of rings.
> so perhaps this could be split up into two proposed patches.

yes.

> A ring or a ring-ethdev is a undirectional channel, and
> this is explicitly by design.

Hmm, I missed usage of ring-ethdev?
I want to connect bidirectional port in two DPDK program by ring-ethdev or
other pmd,

at first, I tried to connect port in 1 process.
run DPDK app with command line
--vdev eth_ring0,nodeaction=ring0:0:CREATE,nodeaction=ring0:0:ATTACH

port 0 and port 1 has created and connected (it looks like to me),
and rx and tx queue in both ports shares only one rte_ring in original code
with above command line.
received packet by ANY port if sent packet from ANY port.  so bad.

second, I tried with command line
--vdev eth_ring0,nodeaction=ring00:0:CREATE,nodeaction=ring01:0:CREATE,
nodeaction=ring01:0:ATTACH,nodeaction=ring00:0:ATTACH

It gots log by dpdk:
init (0) eth_ring0
PMD: Initializing pmd_ring for eth_ring0
PMD: Creating rings-backed ethdev on numa socket 0
EAL: memzone_reserve_aligned_thread_unsafe(): memzone
 already exists
RING: Cannot reserve memory
PMD: Creating rings-backed ethdev on numa socket 0
PMD: Creating rings-backed ethdev on numa socket 0

and created THREE ports.  also bad.

How to connected port 0 rx and port1 tx without patch?  (also port 0 tx and
port 1 rx)

by the way, I found wanted code in rte_pmd_ring.c
but it marked as deprecated (and no longer used).



2014-10-14 19:17 GMT+09:00 Bruce Richardson :

> On Tue, Oct 07, 2014 at 11:11:45PM +0900, Masaru OKI wrote:
> > librte_pmd_ring provides created port and attached port.
> > Packet is received from attached port if packet is sent to created port.
> > So, packet is received from created port if packet is sent to attached
> port.
> > It must be need two rings such as "create to attach" and "attach to
> create".
> > But current implementation uses only one ring for rx/tx.
> > It causes incorrect result.
> > Fixed:
> > - Make ring both rx and tx
> > - Connect created (primary) ring and attached (secondary) ring
> > - Correct m->port like librte_pmd_pcap
> >
> > Signed-off-by: Masaru OKI 
>
> From my reading, this is really two patches:
> 1. add in a port id to packets received from an eth_ring port
> 2. change the rte_eth_ring_create function to create two sets of rings.
> so perhaps this could be split up into two proposed patches.
>
> Unfortunately, while I have no issue with the first part, I disagree with
> the second part. A ring or a ring-ethdev is a undirectional channel, and
> this is explicitly by design. When you create or attach to a ring pmd
> instance (or ring ethdev), you get exactly that, an ethdev instance that
> has
> a ring, or set of rings internally. It's up to the application how to use
> those rings. If you need a bidirectional channel, you need to create two
> ring ethdevs, in exactly the same way that if you want bidirectional
> messaging between two cores using rte_rings, you need to create two rings,
> one for each direction.
>
> regards,
> /Bruce
>
> > ---
> >  lib/librte_pmd_ring/rte_eth_ring.c | 36
> +++-
> >  1 file changed, 27 insertions(+), 9 deletions(-)
> >
> > diff --git a/lib/librte_pmd_ring/rte_eth_ring.c
> b/lib/librte_pmd_ring/rte_eth_ring.c
> > index 4f1b6ed..d926d00 100644
> > --- a/lib/librte_pmd_ring/rte_eth_ring.c
> > +++ b/lib/librte_pmd_ring/rte_eth_ring.c
> > @@ -54,6 +54,7 @@ struct ring_queue {
> >   rte_atomic64_t rx_pkts;
> >   rte_atomic64_t tx_pkts;
> >   rte_atomic64_t err_pkts;
> > + uint8_t in_port;
> >  };
> >
> >  struct pmd_internals {
> > @@ -80,10 +81,14 @@ eth_ring_rx(void *q, struct rte_mbuf **bufs,
> uint16_t nb_bufs)
> >   struct ring_queue *r = q;
> >   const uint16_t nb_rx = (uint16_t)rte_ring_dequeue_burst(r->rng,
> >   ptrs, nb_bufs);
> > +uint16_t cnt;
> >   if (r->rng->flags & RING_F_SC_DEQ)
> >   r->rx_pkts.cnt += nb_rx;
> >   else
> >   rte_atomic64_add(&(r->rx_pkts), nb_rx);
> > +for (cnt = 0; cnt < nb_rx; cnt++) {
> > +  bufs[cnt]->port = r->in_port;
> > +}
> >   return nb_rx;
> >  }
> >
> > @@ -129,6 +134,8 @@ eth_rx_queue_setup(struct rte_eth_dev *dev,uint16_t
> rx_queue_id,
> >  {
> >   struct pmd_internals *internals = dev->data->dev_private;
> >   dev->data->rx_queues[rx_queue_id] =
> &internals->rx_ring_queues[rx_queue_id];
> > + internals->rx_ring_queues[rx_queue_id].in_port =
> dev->data->port_id;
> > +
> >   return 0;
> >  }
> >
> > @@ -319,23 +326,34 @@ eth_dev_ring_create(const char *name, const
> unsigned numa_node,
> >   /* rx and tx are so-called from point of view of first port.
> >* They are inverted from the point of view of second port
> >*/
> > - struct rte_ring *rxtx[RT

[dpdk-dev] kernel panic when stop my test demo

2014-10-14 Thread Lilijun
Hi Stephen and all,

I have a same problem as this older email describes on Aug 14, 2013.
Any help will be appreciated.

The details is shown as follows.
The key step implementation of my demo is:
1. Firstly, call rte_eal_init() to do some initialization.
2. Switch the driver of my Intel  82599 NIC from ixgbe.ko to igb_uio.ko
like tools/dpdk_nic_bind.py written in C source code.
3. Configure rte_dev and start it.
4. Do some rx/tx tests.
5. call rte_eth_dev_stop(dpdk_port_id) to stop the hardware as your history 
emails.
6. Switch the driver of the NIC from igb_uio.ko to ixgbe.ko.
7. Kill the demo using commands: kill -9.

Then kernel panics at random points when do something later.
One of them as follows:
general protection fault:  [#1] SMP
 Modules linked in: tun igb_uio(OF) uio mlx4_ib ib_sa
task: 881fd0d6a220 ti: 881fd0cf8000 task.ti: 881fd0cf8000
RIP: 0010:[]  [] 
dcbnl_rtnl_policy+0x1b111f/0x1e3f70
RSP: :881fd0cf9c38  EFLAGS: 00013282
RAX: 819770a0 RBX: 881fe7b49fa0 RCX: 0001
RDX: 8183d851 RSI: 881fe7f20da1 RDI: 819770a0
RBP:  R08:  R09: 
R10: 881fe7f20da0 R11: 881fd0da0310 R12: 881fe811e6c0
R13:  R14: 881fe6d14180 R15: 881fe7af4a20
FS:  () GS:88203fc0() knlGS:
CS:  0010 DS:  ES:  CR0: 8005003b
CR2: 7f2702d3f9e0 CR3: 018ce000 CR4: 07e0
DR0:  DR1:  DR2: 
DR3:  DR6: 0ff0 DR7: 0400
Stack:
 a0235524 881fd0da0300 0008 881fe7f20da0
 881fd0cf9ca0 811b1329 881fe7f20da0 881fd0da0310
 881fd0da0200 81c9be80 881fd0d6a9f0 881fd0d6a220
Call Trace:
 [] ? uio_release+0x34/0x60 [uio]
 [] ? __fput+0xe9/0x270
 [] ? fput+0xe/0x10
 [] ? task_work_run+0xc4/0xe0
 [] ? do_exit+0x2cb/0xa60
 [] ? _raw_spin_unlock_irqrestore+0x1b/0x40
 [] ? do_group_exit+0x3f/0xa0
 [] ? get_signal_to_deliver+0x1d0/0x6e0
 [] ? tun_chr_aio_read+0xa4/0xc0 [tun]
 [] ? do_signal+0x57/0x600
 [] ? kprobe_flush_task+0xd0/0x170
 [] ? finish_task_switch+0x14a/0x170
 [] ? do_notify_resume+0x69/0xb0
 [] ? retint_signal+0x48/0x8c


Thanks,
Jerry



[dpdk-dev] [PATCH] virtio-net-pmd: .gitignore: ignore librte_pmd_virtio.so

2014-10-14 Thread Thomas Monjalon
> >I thought our .gitignore could do with a few entries added alright, I
> >just never expected this one to be top of the list! While I don't think
> >it does any harm, I'm just curious why you think it needs to be added?
> >
> >/Bruce
> 
> I import all my DPDK dependencies as git submodules. When the submodules
> contain unignored files, they get marked as dirty by git, and it makes
> like difficult when it comes to updating my submodule pointers.
> 
> Matthew.

So you cannot update submodules without filling .gitignore?

I'm not a big fan of .gitignore because I like seeing what has been
generated by looking at "git status".
And it's not really needed in DPDK because compilation is often done in
a separate directory.

-- 
Thomas


[dpdk-dev] [PATCH v4 00/10] VM Power Management

2014-10-14 Thread Thomas Monjalon
2014-10-14 12:37, Carew, Alan:
> > > The following patches add two DPDK sample applications and an alternate
> > > implementation of librte_power for use in virtualized environments.
> > > The idea is to provide librte_power functionality from within a VM to 
> > > address
> > > the lack of MSRs to facilitate frequency changes from within a VM.
> > > It is ideally suited for Haswell which provides per core frequency 
> > > scaling.
> > >
> > > The current librte_power affects frequency changes via the acpi-cpufreq
> > > 'userspace' power governor, accessed via sysfs.
> > 
> > Something was preventing me from looking deeper in this big codebase,
> > but I didn't know what sounds weird.
> > Now I realize: the real problem is that virtualization transparency is
> > broken for power management. So the right thing to do is to fix it in
> > KVM. I think all this patchset is a huge workaround.
> > 
> > Did you try to fix it with Qemu/KVM?
> 
> When looking at the libvirt API it would seem to be a natural fit to have
> power management sitting there, so in essence I would agree.
> 
> However with a DPDK solution it would be possible to re-use the message bus
> to pass information like device stats, application state, D-state requests
> etc. to the host and allow for management layer(e.g. OpenStack) to make
> informed decisions.

I think that management informations should be transmitted in a management
channel. Such solution should exist in OpenStack.

> Also, the scope of adding power management to qemu/KVM would be huge;
> while the easier path is not always the best and the problem of power
> management in VMs is both a DPDK problem (given that librte_power only
> worked on the host) and a general virtualization problem that would be
> better solved by those with direct knowledge of Qemu/KVM architecture
> and influence on the direction of the Qemu project.

Being a huge effort is not an argument.
Please check with Qemu community, they'll welcome it.

> As it stands, the host backend is simply an example application that can
> be replaced by a VMM or Orchestration layer, by using Virtio-Serial it has
> obvious leanings to Qemu, but even this could be easily swapped out for
> XenBus, IVSHMEM, IP etc.
> 
> If power management is to be eventually supported by Hypervisors directly
> then we could also enable to option to switch to that environment, currently
> the librte_power implementations (VM or Host) can be selected dynamically
> (environment auto-detection) or explicitly via rte_power_set_env(), adding
> an arbitrary number of environments is relatively easy.

Yes, you are adding a new layer to workaround hypervisor lacks. And this layer
will handle native support when it will exist. But if you implement native
support now, we don't need this extra layer.

> I hope this helps to clarify the approach.

Thanks for your explanation.

-- 
Thomas


[dpdk-dev] [PATCH v4] virtio: Fix vring entry number issue

2014-10-14 Thread Xie, Huawei


> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Ouyang Changchun
> Sent: Tuesday, October 14, 2014 9:04 AM
> To: dev at dpdk.org
> Subject: [dpdk-dev] [PATCH v4] virtio: Fix vring entry number issue
> 
>   Fix one issue in virtio TX: it needs one more vring descriptor to hold the 
> virtio
>   header when transmitting packets, it is used later to determine whether to 
> free
>   more entries from used vring.
>   It fixes failing to transmit any packet with 1 segment in the circumstance 
> of
> only
>   1 descriptor in the vring free list.
> 
> Signed-off-by: Changchun Ouyang 
> Reviewed-by: Olivier Matz 
> ---
> -V4 change:
>   Relocate those changelog and annotation here.
> 
> -V3 change:
>   Resolve compilation issue due to mbuf re-structure.
> 
> -V2 change:
>   Refine description, 'vring descriptor' is more accurate than 'vring entry';
>   Accordingly update test condition (it needs one more descriptor for virtio
> header) to
>   put packets to transmit queue.
> 
> -V1 change:
>   Fix the vring descriptor issue in virtio TX, it needs one more vring 
> descriptor to
> hold the
>   virtio header.
> 
>  lib/librte_pmd_virtio/virtio_rxtx.c | 10 --
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/librte_pmd_virtio/virtio_rxtx.c
> b/lib/librte_pmd_virtio/virtio_rxtx.c
> index 0b10108..ac44c65 100644
> --- a/lib/librte_pmd_virtio/virtio_rxtx.c
> +++ b/lib/librte_pmd_virtio/virtio_rxtx.c
> @@ -699,7 +699,8 @@ virtio_xmit_pkts(void *tx_queue, struct rte_mbuf
> **tx_pkts, uint16_t nb_pkts)
>   num = (uint16_t)(likely(nb_used < VIRTIO_MBUF_BURST_SZ) ? nb_used :
> VIRTIO_MBUF_BURST_SZ);
> 
>   while (nb_tx < nb_pkts) {
> - int need = tx_pkts[nb_tx]->pkt.nb_segs - txvq->vq_free_cnt;
> + /* Need one more descriptor for virtio header. */
> + int need = tx_pkts[nb_tx]->nb_segs - txvq->vq_free_cnt + 1;
>   int deq_cnt = RTE_MIN(need, (int)num);
> 
>   num -= (deq_cnt > 0) ? deq_cnt : 0;
> @@ -708,7 +709,12 @@ virtio_xmit_pkts(void *tx_queue, struct rte_mbuf
> **tx_pkts, uint16_t nb_pkts)
>   deq_cnt--;
>   }
> 
> - if (tx_pkts[nb_tx]->pkt.nb_segs <= txvq->vq_free_cnt) {
> + need = (int)tx_pkts[nb_tx]->nb_segs - txvq->vq_free_cnt + 1;
> + /*
> +  * Zero or negative value indicates it has enough free
> +  * decriptors to transmit.
> +  */
> + if (need <= 0) {
Could we put a branch hint to favor the fast path?
>   txm = tx_pkts[nb_tx];
>   /* Enqueue Packet buffers */
>   error = virtqueue_enqueue_xmit(txvq, txm);
> --
> 1.8.4.2



[dpdk-dev] [PATCH 5/6] i40e: macaddr add/del enhancement

2014-10-14 Thread Thomas Monjalon
2014-09-23 21:14, Chen Jing D:
> + PMD_DRV_LOG(ERR, "VMDQ not %s, can't set mac to pool %u\n",
> + pf->flags | I40E_FLAG_VMDQ ? "configured" : "enabled",
> + pool);
[...]
> - if (ret != I40E_SUCCESS) {
> - PMD_DRV_LOG(ERR, "Failed to write mac address");
> + if (pool > pf->nb_cfg_vmdq_vsi) {
> + PMD_DRV_LOG(ERR, "Pool number %u invalid. Max pool is %u\n",
> + pool, pf->nb_cfg_vmdq_vsi);
[...]
> - PMD_DRV_LOG(ERR, "Failed to add MACVLAN filter");
> + PMD_DRV_LOG(ERR, "Failed to add MACVLAN filter\n");
[...]
> + PMD_DRV_LOG(ERR, "Failed to remove MACVLAN 
> filter\n");

I'm pretty sure you rebased this patch and solved the conflicts without
updating your patch accordingly. Indeed carriage returns have been removed
from logs recently.
Hint: rebase conflicts are really often meaningful ;)

-- 
Thomas


[dpdk-dev] [PATCH 1/6] ether: enhancement for VMDQ support

2014-10-14 Thread Thomas Monjalon
2014-09-23 21:14, Chen Jing D:
> The change includes several parts:
> 1. Clear pool bitmap when trying to remove specific MAC.
> 2. Define RSS, DCB and VMDQ flags to combine rx_mq_mode.
> 3. Use 'struct' to replace 'union', which to expand the rx_adv_conf
>arguments to better support RSS, DCB and VMDQ.
> 4. Fix bug in rte_eth_dev_config_restore function, which will restore
>all MAC address to default pool.
> 5. Define additional 3 arguments for better VMDQ support.
> 
> Signed-off-by: Chen Jing D(Mark) 
> Acked-by: Konstantin Ananyev 
> Acked-by: Jingjing Wu 
> Acked-by: Jijiang Liu 
> Acked-by: Huawei Xie 

Whaou, there were a lot of reviewers!
The patch should be really clean. Let's see :)

> --- a/lib/librte_ether/rte_ethdev.c
> +++ b/lib/librte_ether/rte_ethdev.c
>   /* add address to the hardware */
> - if  (*dev->dev_ops->mac_addr_add)
> + if  (*dev->dev_ops->mac_addr_add &&
> + dev->data->mac_pool_sel[i] & (1ULL << pool))
>   (*dev->dev_ops->mac_addr_add)(dev, &addr, i, pool);

> + /* Update pool bitmap in NIC data structure */
> + dev->data->mac_pool_sel[index] = 0;

Reset is a better word than "Update" in this case.
But do we really need a comment for that?

> +#define ETH_MQ_RX_RSS_FLAG  0x1
> +#define ETH_MQ_RX_DCB_FLAG  0x2
> +#define ETH_MQ_RX_VMDQ_FLAG 0x4

Need a comment to know where these flags can be used.

>  enum rte_eth_rx_mq_mode {
> - ETH_MQ_RX_NONE = 0,  /**< None of DCB,RSS or VMDQ mode */
> -
> - ETH_MQ_RX_RSS,   /**< For RX side, only RSS is on */
> - ETH_MQ_RX_DCB,   /**< For RX side,only DCB is on. */
> - ETH_MQ_RX_DCB_RSS,   /**< Both DCB and RSS enable */
> -
> - ETH_MQ_RX_VMDQ_ONLY, /**< Only VMDQ, no RSS nor DCB */
> - ETH_MQ_RX_VMDQ_RSS,  /**< RSS mode with VMDQ */
> - ETH_MQ_RX_VMDQ_DCB,  /**< Use VMDQ+DCB to route traffic to queues */
> - ETH_MQ_RX_VMDQ_DCB_RSS, /**< Enable both VMDQ and DCB in VMDq */
> + /**< None of DCB,RSS or VMDQ mode */
> + ETH_MQ_RX_NONE = 0,
> +
> + /**< For RX side, only RSS is on */
> + ETH_MQ_RX_RSS = ETH_MQ_RX_RSS_FLAG,
> + /**< For RX side,only DCB is on. */
> + ETH_MQ_RX_DCB = ETH_MQ_RX_DCB_FLAG,
> + /**< Both DCB and RSS enable */
> + ETH_MQ_RX_DCB_RSS = ETH_MQ_RX_RSS_FLAG | ETH_MQ_RX_DCB_FLAG,
> +
> + /**< Only VMDQ, no RSS nor DCB */
> + ETH_MQ_RX_VMDQ_ONLY = ETH_MQ_RX_VMDQ_FLAG,
> + /**< RSS mode with VMDQ */
> + ETH_MQ_RX_VMDQ_RSS = ETH_MQ_RX_RSS_FLAG | ETH_MQ_RX_VMDQ_FLAG,
> + /**< Use VMDQ+DCB to route traffic to queues */
> + ETH_MQ_RX_VMDQ_DCB = ETH_MQ_RX_VMDQ_FLAG | ETH_MQ_RX_DCB_FLAG,
> + /**< Enable both VMDQ and DCB in VMDq */
> + ETH_MQ_RX_VMDQ_DCB_RSS = ETH_MQ_RX_RSS_FLAG | ETH_MQ_RX_DCB_FLAG |
> +  ETH_MQ_RX_VMDQ_FLAG,
>  };

Why not simply remove all these combinations and keep only flags?
Please keep it simple.

> + /**< Specify the queue range belongs to VMDQ pools if VMDQ applicable */
> + uint16_t vmdq_queue_base;
> + uint16_t vmdq_queue_num;

If comment is before, it should be /** not /**<.

> + uint16_t vmdq_pool_base; /** < Specify the start pool ID of VMDQ pools 
> */

There is a typo with the space --^
Please, when writing comments, ask yourself if each word is required
and how it can be shorter.
Example here: /**< first ID of VMDQ pools */

Conclusion: NACK
There are only few typos and minor things but it would help to have more
careful reviews. Having a list of people at the beginning of the patch
didn't help in this case.

Thanks for your attention
-- 
Thomas


[dpdk-dev] [PATCH v5 0/8] link bonding

2014-10-14 Thread De Lara Guarch, Pablo


> -Original Message-
> From: Doherty, Declan
> Sent: Tuesday, October 14, 2014 2:00 PM
> To: dev at dpdk.org
> Cc: Jiajia, SunX; De Lara Guarch, Pablo; thomas.monjalon at 6wind.com;
> Doherty, Declan
> Subject: [PATCH v5 0/8] link bonding
> 
> v5:
> - Fix uninitialized variable in broadcast_tx_burst function which caused a
>   build error in 32-bit build
> - Address unit test issue which is exposed by new test in mode 4/5 patch sets
> 
[..]
> failures in the under lying slave pmd which could lead to leaked mbufs.
> 
> 
> Declan Doherty (8):
>   bond: link status interrupt support
>   bond: removing switch statement from rx burst method
>   bond: fix naming inconsistency in tx_burst_round_robin
>   bond: free mbufs if transmission fails in bonding tx_burst functions
>   test app: adding support for generating variable sized packet
>   testpmd: adding parameter to reconfig method to set socket_id when
> adding new port to portlist
>   bond: lsc polling support
>   bond: unit test test macro refactor
> 
>  app/test-pmd/cmdline.c |   65 +-
>  app/test-pmd/testpmd.c |3 +-
>  app/test-pmd/testpmd.h |2 +-
>  app/test/packet_burst_generator.c  |   25 +-
>  app/test/packet_burst_generator.h  |6 +-
>  app/test/test.h|7 +-
>  app/test/test_link_bonding.c   | 3342 
> ++--
>  app/test/virtual_pmd.c |   96 +-
>  app/test/virtual_pmd.h |   53 +-
>  lib/librte_pmd_bond/rte_eth_bond.h |   80 +
>  lib/librte_pmd_bond/rte_eth_bond_api.c |  319 ++-
>  lib/librte_pmd_bond/rte_eth_bond_args.c|   30 +-
>  lib/librte_pmd_bond/rte_eth_bond_pmd.c |  550 +++--
>  lib/librte_pmd_bond/rte_eth_bond_private.h |   71 +-
>  14 files changed, 2691 insertions(+), 1958 deletions(-)
> 
> --
> 1.7.12.2

Acked-by: Pablo de Lara 



[dpdk-dev] [PATCH v3] virtio: Fix vring entry number issue

2014-10-14 Thread Ouyang, Changchun
Hi Olivier,

Any other comments for this v3 patch?

Thanks and regards,
Changchun

> -Original Message-
> From: Ouyang, Changchun
> Sent: Tuesday, October 14, 2014 11:13 PM
> To: dev at dpdk.org
> Cc: Cao, Waterman; Ouyang, Changchun
> Subject: [PATCH v3] virtio: Fix vring entry number issue
> 
> -- V1 change:
>   Fix one issue in virtio TX: it needs one more vring descriptor to hold the
> virtio
>   header when transmitting packets, it is used later to determine whether to
> free
>   more entries from used vring.
> 
>   It fixes failing to transmit any packet with 1 segment in the circumstance 
> of
> only
>   1 descriptor in the vring free list.
> 
> -- V2 change:
>   Refine description, 'vring descriptor' is more accurate than 'vring entry';
>   Accordingly update test condition (it needs one more descriptor for virtio
> header) to
>   put packets to transmit queue.
> 
> -- V3 change:
>   Resolve compilation issue due to mbuf re-structure.
> 
> Signed-off-by: Changchun Ouyang 
> ---
>  lib/librte_pmd_virtio/virtio_rxtx.c | 10 --
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/librte_pmd_virtio/virtio_rxtx.c
> b/lib/librte_pmd_virtio/virtio_rxtx.c
> index 0b10108..ac44c65 100644
> --- a/lib/librte_pmd_virtio/virtio_rxtx.c
> +++ b/lib/librte_pmd_virtio/virtio_rxtx.c
> @@ -699,7 +699,8 @@ virtio_xmit_pkts(void *tx_queue, struct rte_mbuf
> **tx_pkts, uint16_t nb_pkts)
>   num = (uint16_t)(likely(nb_used < VIRTIO_MBUF_BURST_SZ) ?
> nb_used : VIRTIO_MBUF_BURST_SZ);
> 
>   while (nb_tx < nb_pkts) {
> - int need = tx_pkts[nb_tx]->pkt.nb_segs - txvq-
> >vq_free_cnt;
> + /* Need one more descriptor for virtio header. */
> + int need = tx_pkts[nb_tx]->nb_segs - txvq->vq_free_cnt + 1;
>   int deq_cnt = RTE_MIN(need, (int)num);
> 
>   num -= (deq_cnt > 0) ? deq_cnt : 0;
> @@ -708,7 +709,12 @@ virtio_xmit_pkts(void *tx_queue, struct rte_mbuf
> **tx_pkts, uint16_t nb_pkts)
>   deq_cnt--;
>   }
> 
> - if (tx_pkts[nb_tx]->pkt.nb_segs <= txvq->vq_free_cnt) {
> + need = (int)tx_pkts[nb_tx]->nb_segs - txvq->vq_free_cnt +
> 1;
> + /*
> +  * Zero or negative value indicates it has enough free
> +  * decriptors to transmit.
> +  */
> + if (need <= 0) {
>   txm = tx_pkts[nb_tx];
>   /* Enqueue Packet buffers */
>   error = virtqueue_enqueue_xmit(txvq, txm);
> --
> 1.8.4.2



[dpdk-dev] Bug in IPACL library of DPDK-1.6.0

2014-10-14 Thread Ananyev, Konstantin


> -Original Message-
> From: Karmarkar Suyash [mailto:skarmarkar at sonusnet.com]
> Sent: Tuesday, October 14, 2014 4:07 PM
> To: Ananyev, Konstantin; dev at dpdk.org
> Cc: Dey, Souvik; Patil, PraveenKumar
> Subject: RE: Bug in IPACL library of DPDK-1.6.0
> 
> Hi Konstantin,
> 
> We did even tried with DPDK-1.7.0 version still we faced the same issue.

Then I suppose, I need more information to reproduce it...
See below the code I used, based on your description. 
Does it replicate your problem?

enum
{
   NEXT_HDR_FIELD_IPV6, //8
IPSRC_FIELD0_IPV6,
IPSRC_FIELD1_IPV6,
IPSRC_FIELD2_IPV6,
IPSRC_FIELD3_IPV6,
IPDST_FIELD0_IPV6,
IPDST_FIELD1_IPV6,
IPDST_FIELD2_IPV6,
IPDST_FIELD3_IPV6,
PORTS_FIELD_IPV6,  // src port (16) + dest port (16) => 32
   LIF_GRP_INFO_FIELD_IPV6, //lif group (16) +  lif Id (16)  => 32
   ADDR_CTX_FIELD_IPV6, //addr context (32)
   NUM_FIELDS_IPV6
};



static const struct rte_acl_field_def ipv6_defs[NUM_FIELDS_IPV6] = {
   {
  .type = RTE_ACL_FIELD_TYPE_BITMASK,
  .size = sizeof (uint8_t),
  .field_index = NEXT_HDR_FIELD_IPV6,
  .input_index = NEXT_HDR_FIELD_IPV6,
  .offset = offsetof(struct ipv6_hdr, proto),
   },

///source ip
   {
  .type = RTE_ACL_FIELD_TYPE_BITMASK,
  .size = sizeof (uint32_t),
  .field_index = IPSRC_FIELD0_IPV6,
  .input_index = IPSRC_FIELD0_IPV6,
  .offset = offsetof(struct ipv6_hdr, src_addr),
   },
   {
  .type = RTE_ACL_FIELD_TYPE_BITMASK,
  .size = sizeof (uint32_t),
  .field_index = IPSRC_FIELD1_IPV6,
  .input_index = IPSRC_FIELD1_IPV6,
  .offset = offsetof(struct ipv6_hdr, src_addr) + 1*sizeof (uint32_t),
   },
   {
  .type = RTE_ACL_FIELD_TYPE_BITMASK,
  .size = sizeof (uint32_t),
  .field_index = IPSRC_FIELD2_IPV6,
  .input_index = IPSRC_FIELD2_IPV6,
  .offset = offsetof(struct ipv6_hdr, src_addr) + 2*sizeof (uint32_t),
   },
   {
  .type = RTE_ACL_FIELD_TYPE_BITMASK,
  .size = sizeof (uint32_t),
  .field_index = IPSRC_FIELD3_IPV6,
  .input_index = IPSRC_FIELD3_IPV6,
  .offset = offsetof(struct ipv6_hdr, src_addr) + 3*sizeof (uint32_t),
   },

///destination ip
   {
  .type = RTE_ACL_FIELD_TYPE_BITMASK,
  .size = sizeof (uint32_t),
  .field_index = IPDST_FIELD0_IPV6,
  .input_index = IPDST_FIELD0_IPV6,
  .offset = offsetof(struct ipv6_hdr, dst_addr),
   },
   {
  .type = RTE_ACL_FIELD_TYPE_BITMASK,
  .size = sizeof (uint32_t),
  .field_index = IPDST_FIELD1_IPV6,
  .input_index = IPDST_FIELD1_IPV6,
  .offset = offsetof(struct ipv6_hdr, dst_addr) + 1*sizeof (uint32_t),
   },
   {
  .type = RTE_ACL_FIELD_TYPE_BITMASK,
  .size = sizeof (uint32_t),
  .field_index = IPDST_FIELD2_IPV6,
  .input_index = IPDST_FIELD2_IPV6,
  .offset = offsetof(struct ipv6_hdr, dst_addr) + 2*sizeof (uint32_t),
   },
   {
  .type = RTE_ACL_FIELD_TYPE_BITMASK,
  .size = sizeof (uint32_t),
  .field_index = IPDST_FIELD3_IPV6,
  .input_index = IPDST_FIELD3_IPV6,
  .offset = offsetof(struct ipv6_hdr, dst_addr) + 3*sizeof (uint32_t),
   },

   ///ports
{
  .type = RTE_ACL_FIELD_TYPE_BITMASK,
  .size = sizeof (uint32_t),
  .field_index = PORTS_FIELD_IPV6,
  .input_index = PORTS_FIELD_IPV6,
  .offset = sizeof(struct ipv6_hdr) ,
   },
//LIF grp and addr ctx
   {
  .type = RTE_ACL_FIELD_TYPE_BITMASK,
  .size = sizeof (uint32_t),
  .field_index = LIF_GRP_INFO_FIELD_IPV6,
  .input_index = LIF_GRP_INFO_FIELD_IPV6,
  .offset = sizeof(struct ipv6_hdr) +  sizeof (uint32_t),
   },
   {
  .type = RTE_ACL_FIELD_TYPE_BITMASK,
  .size = sizeof (uint32_t),
  .field_index = ADDR_CTX_FIELD_IPV6,
  .input_index = ADDR_CTX_FIELD_IPV6,
  .offset = sizeof(struct ipv6_hdr) +  2*sizeof (uint32_t),
   }
};

RTE_ACL_RULE_DEF(rule, NUM_FIELDS_IPV6);

static const struct rule rules[] = {
{
.data.userdata = 1,
.data.priority = 1,
.data.category_mask = 1,
.field[NEXT_HDR_FIELD_IPV6].value.u8 = IPPROTO_ICMPV6,
.field[NEXT_HDR_FIELD_IPV6].mask_range.u8 = UINT8_MAX,
},
{
.data.userdata = 2,
.data.priority = 2,
.data.category_mask = 1,
.field[NEXT_HDR_FIELD_IPV6].value.u8 = IPPROTO_ICMPV6,
.field[NEXT_HDR_FIELD_IPV6].mask_range.u8 = UINT8_MAX,
},
};

static const struct {
struct ipv6_hdr hdr;
uint32_t ports;
uint32_t lif_grp;
uint32_t addr_ctx;
} data = {
.hdr = {.proto = IPPROTO_ICMPV6,},
};

static const struct rte_acl_param prm = {
.name = "xz1",
.socket_id = SOCKET_ID_ANY,
.rule_size = RTE_ACL_RULE_SZ(NUM_FIELDS_IPV6),
.max_rule_num = 256,
};

static void
acl_test1(void)
{
int32_t rc;
uint32_t res;
struct rte_acl

[dpdk-dev] Bug in IPACL library of DPDK-1.6.0

2014-10-14 Thread Karmarkar Suyash
Hi Konstantin,

We did even tried with DPDK-1.7.0 version still we faced the same issue.

Regards
Suyash Karmarkar

-Original Message-
From: Ananyev, Konstantin [mailto:konstantin.anan...@intel.com] 
Sent: Tuesday, October 14, 2014 8:15 PM
To: Karmarkar Suyash; dev at dpdk.org
Cc: Dey, Souvik; Patil, PraveenKumar
Subject: RE: Bug in IPACL library of DPDK-1.6.0

> From: Karmarkar Suyash [mailto:skarmarkar at sonusnet.com]
> Sent: Tuesday, October 14, 2014 1:36 PM
> To: Ananyev, Konstantin; dev at dpdk.org
> Cc: Dey, Souvik; Patil, PraveenKumar
> Subject: RE: Bug in IPACL library of DPDK-1.6.0
> 
> There are two user defined ACL rules and they are added with just 
> different priority -
> 
> 1. And all other fields are wild card:
> * SOURCE IP and  DEST IP = wild card (*)
> * LIF_GRP_INFO_FIELD_IPV6 = wild card (*)
> * PORTS = wild card (*)
> 2. Only next header protocol is specified = ICMPv6 (58) 3. Priority is 
> different. But the one with lower priority is returned during lookup.
> 

Hm, I tried what your described - works ok for me.
Are you saying you are still using DPDK 1.6 IPL?
If so, can you upgrade to 1.7 and give it another try?
There was one bug fixed in 1.7 very similar to what you describing:
 http://dpdk.org/ml/archives/dev/2014-June/003198.html

Konstantin


> The structure is -
> 
> enum
> {
>NEXT_HDR_FIELD_IPV4, //8
>IPSRC_FIELD_IPV4,  //src ip (32)
>IPDST_FIELD_IPV4,  //dst ip (32)
>PORTS_FIELD_IPV4,  // src port (16) + dest port (16) => 32
>LIF_GRP_INFO_FIELD_IPV4, //lif group (16) +  lif Id (16)  => 32
>ADDR_CTX_FIELD_IPV4, //addr context (32)
>NUM_FIELDS_IPV4
> };
> 
> 
> 
> struct rte_acl_field_def ipv6_defs[NUM_FIELDS_IPV6] = {
>{
>   .type = RTE_ACL_FIELD_TYPE_BITMASK,
>   .size = sizeof (uint8_t),
>   .field_index = NEXT_HDR_FIELD_IPV6,
>   .input_index = NEXT_HDR_FIELD_IPV6,
>   .offset = offsetof(struct ipv6_hdr, proto),
>},
> 
> ///source ip
>{
>   .type = RTE_ACL_FIELD_TYPE_BITMASK,
>   .size = sizeof (uint32_t),
>   .field_index = IPSRC_FIELD0_IPV6,
>   .input_index = IPSRC_FIELD0_IPV6,
>   .offset = offsetof(struct ipv6_hdr, src_addr),
>},
>{
>   .type = RTE_ACL_FIELD_TYPE_BITMASK,
>   .size = sizeof (uint32_t),
>   .field_index = IPSRC_FIELD1_IPV6,
>   .input_index = IPSRC_FIELD1_IPV6,
>   .offset = offsetof(struct ipv6_hdr, src_addr) + 1*sizeof (uint32_t),
>},
>{
>   .type = RTE_ACL_FIELD_TYPE_BITMASK,
>   .size = sizeof (uint32_t),
>   .field_index = IPSRC_FIELD2_IPV6,
>   .input_index = IPSRC_FIELD2_IPV6,
>   .offset = offsetof(struct ipv6_hdr, src_addr) + 2*sizeof (uint32_t),
>},
>{
>   .type = RTE_ACL_FIELD_TYPE_BITMASK,
>   .size = sizeof (uint32_t),
>   .field_index = IPSRC_FIELD3_IPV6,
>   .input_index = IPSRC_FIELD3_IPV6,
>   .offset = offsetof(struct ipv6_hdr, src_addr) + 3*sizeof (uint32_t),
>},
> 
> ///destination ip
>{
>   .type = RTE_ACL_FIELD_TYPE_BITMASK,
>   .size = sizeof (uint32_t),
>   .field_index = IPDST_FIELD0_IPV6,
>   .input_index = IPDST_FIELD0_IPV6,
>   .offset = offsetof(struct ipv6_hdr, dst_addr),
>},
>{
>   .type = RTE_ACL_FIELD_TYPE_BITMASK,
>   .size = sizeof (uint32_t),
>   .field_index = IPDST_FIELD1_IPV6,
>   .input_index = IPDST_FIELD1_IPV6,
>   .offset = offsetof(struct ipv6_hdr, dst_addr) + 1*sizeof (uint32_t),
>},
>{
>   .type = RTE_ACL_FIELD_TYPE_BITMASK,
>   .size = sizeof (uint32_t),
>   .field_index = IPDST_FIELD2_IPV6,
>   .input_index = IPDST_FIELD2_IPV6,
>   .offset = offsetof(struct ipv6_hdr, dst_addr) + 2*sizeof (uint32_t),
>},
>{
>   .type = RTE_ACL_FIELD_TYPE_BITMASK,
>   .size = sizeof (uint32_t),
>   .field_index = IPDST_FIELD3_IPV6,
>   .input_index = IPDST_FIELD3_IPV6,
>   .offset = offsetof(struct ipv6_hdr, dst_addr) + 3*sizeof (uint32_t),
>},
> 
>///ports
> {
>   .type = RTE_ACL_FIELD_TYPE_BITMASK,
>   .size = sizeof (uint32_t),
>   .field_index = PORTS_FIELD_IPV6,
>   .input_index = PORTS_FIELD_IPV6,
>   .offset = sizeof(struct ipv6_hdr) ,
>},
> //LIF grp and addr ctx
>{
>   .type = RTE_ACL_FIELD_TYPE_BITMASK,
>   .size = sizeof (uint32_t),
>   .field_index = LIF_GRP_INFO_FIELD_IPV6,
>   .input_index = LIF_GRP_INFO_FIELD_IPV6,
>   .offset = sizeof(struct ipv6_hdr) +  sizeof (uint32_t),
>},
>{
>   .type = RTE_ACL_FIELD_TYPE_BITMASK,
>   .size = sizeof (uint32_t),
>   .field_index = ADDR_CTX_FIELD_IPV6,
>   .input_index = ADDR_CTX_FIELD_IPV6,
>   .offset = sizeof(struct ipv6_hdr) +  2*sizeof (uint32_t),
>}
> } ;
> 
> 
> 
> 
> -Original Message-
> From: Ananyev, Konstantin [mailto:konstantin.ananyev at intel.com]
> Sent: Tuesday, October 14, 2014 4:16 PM
> To: Karmarkar Suyash; dev at dpdk.org
> Cc: Dey, Souvik; Patil, PraveenKumar
> Subject:

[dpdk-dev] Bug in IPACL library of DPDK-1.6.0

2014-10-14 Thread Ananyev, Konstantin
> From: Karmarkar Suyash [mailto:skarmarkar at sonusnet.com]
> Sent: Tuesday, October 14, 2014 1:36 PM
> To: Ananyev, Konstantin; dev at dpdk.org
> Cc: Dey, Souvik; Patil, PraveenKumar
> Subject: RE: Bug in IPACL library of DPDK-1.6.0
> 
> There are two user defined ACL rules and they are added with just different 
> priority -
> 
> 1. And all other fields are wild card:
> * SOURCE IP and  DEST IP = wild card (*)
> * LIF_GRP_INFO_FIELD_IPV6 = wild card (*)
> * PORTS = wild card (*)
> 2. Only next header protocol is specified = ICMPv6 (58)
> 3. Priority is different. But the one with lower priority is returned during 
> lookup.
> 

Hm, I tried what your described - works ok for me.
Are you saying you are still using DPDK 1.6 IPL?
If so, can you upgrade to 1.7 and give it another try?
There was one bug fixed in 1.7 very similar to what you describing:
 http://dpdk.org/ml/archives/dev/2014-June/003198.html

Konstantin


> The structure is -
> 
> enum
> {
>NEXT_HDR_FIELD_IPV4, //8
>IPSRC_FIELD_IPV4,  //src ip (32)
>IPDST_FIELD_IPV4,  //dst ip (32)
>PORTS_FIELD_IPV4,  // src port (16) + dest port (16) => 32
>LIF_GRP_INFO_FIELD_IPV4, //lif group (16) +  lif Id (16)  => 32
>ADDR_CTX_FIELD_IPV4, //addr context (32)
>NUM_FIELDS_IPV4
> };
> 
> 
> 
> struct rte_acl_field_def ipv6_defs[NUM_FIELDS_IPV6] = {
>{
>   .type = RTE_ACL_FIELD_TYPE_BITMASK,
>   .size = sizeof (uint8_t),
>   .field_index = NEXT_HDR_FIELD_IPV6,
>   .input_index = NEXT_HDR_FIELD_IPV6,
>   .offset = offsetof(struct ipv6_hdr, proto),
>},
> 
> ///source ip
>{
>   .type = RTE_ACL_FIELD_TYPE_BITMASK,
>   .size = sizeof (uint32_t),
>   .field_index = IPSRC_FIELD0_IPV6,
>   .input_index = IPSRC_FIELD0_IPV6,
>   .offset = offsetof(struct ipv6_hdr, src_addr),
>},
>{
>   .type = RTE_ACL_FIELD_TYPE_BITMASK,
>   .size = sizeof (uint32_t),
>   .field_index = IPSRC_FIELD1_IPV6,
>   .input_index = IPSRC_FIELD1_IPV6,
>   .offset = offsetof(struct ipv6_hdr, src_addr) + 1*sizeof (uint32_t),
>},
>{
>   .type = RTE_ACL_FIELD_TYPE_BITMASK,
>   .size = sizeof (uint32_t),
>   .field_index = IPSRC_FIELD2_IPV6,
>   .input_index = IPSRC_FIELD2_IPV6,
>   .offset = offsetof(struct ipv6_hdr, src_addr) + 2*sizeof (uint32_t),
>},
>{
>   .type = RTE_ACL_FIELD_TYPE_BITMASK,
>   .size = sizeof (uint32_t),
>   .field_index = IPSRC_FIELD3_IPV6,
>   .input_index = IPSRC_FIELD3_IPV6,
>   .offset = offsetof(struct ipv6_hdr, src_addr) + 3*sizeof (uint32_t),
>},
> 
> ///destination ip
>{
>   .type = RTE_ACL_FIELD_TYPE_BITMASK,
>   .size = sizeof (uint32_t),
>   .field_index = IPDST_FIELD0_IPV6,
>   .input_index = IPDST_FIELD0_IPV6,
>   .offset = offsetof(struct ipv6_hdr, dst_addr),
>},
>{
>   .type = RTE_ACL_FIELD_TYPE_BITMASK,
>   .size = sizeof (uint32_t),
>   .field_index = IPDST_FIELD1_IPV6,
>   .input_index = IPDST_FIELD1_IPV6,
>   .offset = offsetof(struct ipv6_hdr, dst_addr) + 1*sizeof (uint32_t),
>},
>{
>   .type = RTE_ACL_FIELD_TYPE_BITMASK,
>   .size = sizeof (uint32_t),
>   .field_index = IPDST_FIELD2_IPV6,
>   .input_index = IPDST_FIELD2_IPV6,
>   .offset = offsetof(struct ipv6_hdr, dst_addr) + 2*sizeof (uint32_t),
>},
>{
>   .type = RTE_ACL_FIELD_TYPE_BITMASK,
>   .size = sizeof (uint32_t),
>   .field_index = IPDST_FIELD3_IPV6,
>   .input_index = IPDST_FIELD3_IPV6,
>   .offset = offsetof(struct ipv6_hdr, dst_addr) + 3*sizeof (uint32_t),
>},
> 
>///ports
> {
>   .type = RTE_ACL_FIELD_TYPE_BITMASK,
>   .size = sizeof (uint32_t),
>   .field_index = PORTS_FIELD_IPV6,
>   .input_index = PORTS_FIELD_IPV6,
>   .offset = sizeof(struct ipv6_hdr) ,
>},
> //LIF grp and addr ctx
>{
>   .type = RTE_ACL_FIELD_TYPE_BITMASK,
>   .size = sizeof (uint32_t),
>   .field_index = LIF_GRP_INFO_FIELD_IPV6,
>   .input_index = LIF_GRP_INFO_FIELD_IPV6,
>   .offset = sizeof(struct ipv6_hdr) +  sizeof (uint32_t),
>},
>{
>   .type = RTE_ACL_FIELD_TYPE_BITMASK,
>   .size = sizeof (uint32_t),
>   .field_index = ADDR_CTX_FIELD_IPV6,
>   .input_index = ADDR_CTX_FIELD_IPV6,
>   .offset = sizeof(struct ipv6_hdr) +  2*sizeof (uint32_t),
>}
> } ;
> 
> 
> 
> 
> -Original Message-
> From: Ananyev, Konstantin [mailto:konstantin.ananyev at intel.com]
> Sent: Tuesday, October 14, 2014 4:16 PM
> To: Karmarkar Suyash; dev at dpdk.org
> Cc: Dey, Souvik; Patil, PraveenKumar
> Subject: RE: Bug in IPACL library of DPDK-1.6.0
> 
> Hi,
> 
> > -Original Message-
> > From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Karmarkar Suyash
> > Sent: Tuesday, October 14, 2014 10:55 AM
> > To: dev at dpdk.org
> > Cc: Dey, Souvik; Patil, PraveenKumar
> > Subject: [dpdk-dev] Bug in IPACL library of DPDK-1.6.0
> >
> > Hello All,
> >
> > If there are t

[dpdk-dev] [PATCH v5 8/8] bond: unit test test macro refactor

2014-10-14 Thread Declan Doherty

Signed-off-by: Declan Doherty 
---
 app/test/test_link_bonding.c | 2574 +-
 1 file changed, 1036 insertions(+), 1538 deletions(-)

diff --git a/app/test/test_link_bonding.c b/app/test/test_link_bonding.c
index c32b685..c4fcaf7 100644
--- a/app/test/test_link_bonding.c
+++ b/app/test/test_link_bonding.c
@@ -31,6 +31,7 @@
  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */

+#include "unistd.h"
 #include 
 #include 
 #include 
@@ -265,7 +266,7 @@ static pthread_cond_t cvar = PTHREAD_COND_INITIALIZER;
 static int
 test_setup(void)
 {
-   int i, retval, nb_mbuf_per_pool;
+   int i, nb_mbuf_per_pool;
struct ether_addr *mac_addr = (struct ether_addr *)slave_mac;

/* Allocate ethernet packet header with space for VLAN header */
@@ -273,10 +274,8 @@ test_setup(void)
test_params->pkt_eth_hdr = malloc(sizeof(struct ether_hdr) +
sizeof(struct vlan_hdr));

-   if (test_params->pkt_eth_hdr == NULL) {
-   printf("ethernet header struct allocation failed!\n");
-   return -1;
-   }
+   TEST_ASSERT_NOT_NULL(test_params->pkt_eth_hdr,
+   "Ethernet header struct allocation failed!");
}

nb_mbuf_per_pool = RTE_TEST_RX_DESC_MAX + DEF_PKT_BURST +
@@ -286,10 +285,8 @@ test_setup(void)
MBUF_SIZE, MBUF_CACHE_SIZE, sizeof(struct 
rte_pktmbuf_pool_private),
rte_pktmbuf_pool_init, NULL, rte_pktmbuf_init, 
NULL,
rte_socket_id(), 0);
-   if (test_params->mbuf_pool == NULL) {
-   printf("rte_mempool_create failed\n");
-   return -1;
-   }
+   TEST_ASSERT_NOT_NULL(test_params->mbuf_pool,
+   "rte_mempool_create failed");
}

/* Create / Initialize virtual eth devs */
@@ -303,20 +300,12 @@ test_setup(void)

test_params->slave_port_ids[i] = 
virtual_ethdev_create(pmd_name,
mac_addr, rte_socket_id(), 1);
-   if (test_params->slave_port_ids[i] < 0) {
-   printf("Failed to create virtual virtual ethdev 
%s\n", pmd_name);
-   return -1;
-   }
+   TEST_ASSERT(test_params->slave_port_ids[i] >= 0,
+   "Failed to create virtual virtual 
ethdev %s", pmd_name);

-   printf("Created virtual ethdev %s\n", pmd_name);
-
-   retval = 
configure_ethdev(test_params->slave_port_ids[i], 1, 0);
-   if (retval != 0) {
-   printf("Failed to configure virtual ethdev 
%s\n", pmd_name);
-   return -1;
-   }
-
-   printf("Configured virtual ethdev %s\n", pmd_name);
+   TEST_ASSERT_SUCCESS(configure_ethdev(
+   test_params->slave_port_ids[i], 1, 0),
+   "Failed to configure virtual ethdev 
%s", pmd_name);
}
slaves_initialized = 1;
}
@@ -350,14 +339,14 @@ test_create_bonded_device(void)
current_slave_count = 
rte_eth_bond_slaves_get(test_params->bonded_port_id,
slaves, RTE_MAX_ETHPORTS);

-   TEST_ASSERT(current_slave_count == 0,
+   TEST_ASSERT_EQUAL(current_slave_count, 0,
"Number of slaves %d is great than expected %d.",
current_slave_count, 0);

current_slave_count = rte_eth_bond_active_slaves_get(
test_params->bonded_port_id, slaves, RTE_MAX_ETHPORTS);

-   TEST_ASSERT(current_slave_count == 0,
+   TEST_ASSERT_EQUAL(current_slave_count, 0,
"Number of active slaves %d is great than expected %d.",
current_slave_count, 0);

@@ -375,30 +364,21 @@ test_create_bonded_device_with_invalid_params(void)
/* Invalid name */
port_id = rte_eth_bond_create(NULL, test_params->bonding_mode,
rte_socket_id());
-   if (port_id >= 0) {
-   printf("Created bonded device unexpectedly.\n");
-   return -1;
-   }
+   TEST_ASSERT(port_id < 0, "Created bonded device unexpectedly");

test_params->bonding_mode = INVALID_BONDING_MODE;

/* Invalid bonding mode */
port_id = rte_eth_bond_create(BONDED_DEV_NAME, 
test_params->bonding_mode,
rte_socket_id());
-   if (port_id >= 0) {
-   printf("Created bonded device unexpectedly.\n");
-   return -1;
-   }
+   TEST_ASSERT(port_id < 0, "Created bonded device u

[dpdk-dev] [PATCH v5 7/8] bond: lsc polling support

2014-10-14 Thread Declan Doherty

Signed-off-by: Declan Doherty 
---
 app/test-pmd/cmdline.c |  63 +
 app/test/test.h|   7 +-
 app/test/test_link_bonding.c   | 258 ---
 app/test/virtual_pmd.c |  17 +-
 app/test/virtual_pmd.h |  48 +++-
 lib/librte_pmd_bond/rte_eth_bond.h |  80 ++
 lib/librte_pmd_bond/rte_eth_bond_api.c | 315 +++
 lib/librte_pmd_bond/rte_eth_bond_args.c|  30 ++-
 lib/librte_pmd_bond/rte_eth_bond_pmd.c | 393 +
 lib/librte_pmd_bond/rte_eth_bond_private.h |  71 --
 10 files changed, 934 insertions(+), 348 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index e9cf53e..490893d 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -439,6 +439,9 @@ static void cmd_help_long_parsed(void *parsed_result,

"set bonding xmit_balance_policy (port_id) 
(l2|l23|l34)\n"
"   Set the transmit balance policy for bonded 
device running in balance mode.\n\n"
+
+   "set bonding mon_period (port_id) (value) \n"
+   "   Set the bonding link status monitoring polling 
period in ms.\n\n"
 #endif

, list_pkt_forwarding_modes()
@@ -3709,6 +3712,65 @@ cmdline_parse_inst_t cmd_set_bond_mac_addr = {
}
 };

+
+/* *** SET LINK STATUS MONITORING POLLING PERIOD ON BONDED DEVICE *** */
+struct cmd_set_bond_mon_period_result {
+   cmdline_fixed_string_t set;
+   cmdline_fixed_string_t bonding;
+   cmdline_fixed_string_t mon_period;
+   uint8_t port_num;
+   uint32_t period_ms;
+};
+
+static void cmd_set_bond_mon_period_parsed(void *parsed_result,
+   __attribute__((unused))  struct cmdline *cl,
+   __attribute__((unused)) void *data)
+{
+   struct cmd_set_bond_mon_period_result *res = parsed_result;
+   int ret;
+
+   if (res->port_num >= nb_ports) {
+   printf("Port id %d must be less than %d\n", res->port_num, 
nb_ports);
+   return;
+   }
+
+   ret = rte_eth_bond_link_monitoring_set(res->port_num, res->period_ms);
+
+   /* check the return value and print it if is < 0 */
+   if (ret < 0)
+   printf("set_bond_mac_addr error: (%s)\n", strerror(-ret));
+}
+
+cmdline_parse_token_string_t cmd_set_bond_mon_period_set =
+   TOKEN_STRING_INITIALIZER(struct cmd_set_bond_mon_period_result,
+   set, "set");
+cmdline_parse_token_string_t cmd_set_bond_mon_period_bonding =
+   TOKEN_STRING_INITIALIZER(struct cmd_set_bond_mon_period_result,
+   bonding, "bonding");
+cmdline_parse_token_string_t cmd_set_bond_mon_period_mon_period =
+   TOKEN_STRING_INITIALIZER(struct cmd_set_bond_mon_period_result,
+   mon_period, "mon_period");
+cmdline_parse_token_num_t cmd_set_bond_mon_period_portnum =
+   TOKEN_NUM_INITIALIZER(struct cmd_set_bond_mon_period_result,
+   port_num, UINT8);
+cmdline_parse_token_num_t cmd_set_bond_mon_period_period_ms =
+   TOKEN_NUM_INITIALIZER(struct cmd_set_bond_mon_period_result,
+   period_ms, UINT32);
+
+cmdline_parse_inst_t cmd_set_bond_mon_period = {
+   .f = cmd_set_bond_mon_period_parsed,
+   .data = (void *) 0,
+   .help_str = "set bonding mon_period (port_id) (period_ms): ",
+   .tokens = {
+   (void *)&cmd_set_bond_mon_period_set,
+   (void *)&cmd_set_bond_mon_period_bonding,
+   (void *)&cmd_set_bond_mon_period_mon_period,
+   (void *)&cmd_set_bond_mon_period_portnum,
+   (void *)&cmd_set_bond_mon_period_period_ms,
+   NULL
+   }
+};
+
 #endif /* RTE_LIBRTE_PMD_BOND */

 /* *** SET FORWARDING MODE *** */
@@ -7457,6 +7519,7 @@ cmdline_parse_ctx_t main_ctx[] = {
(cmdline_parse_inst_t *) &cmd_create_bonded_device,
(cmdline_parse_inst_t *) &cmd_set_bond_mac_addr,
(cmdline_parse_inst_t *) &cmd_set_balance_xmit_policy,
+   (cmdline_parse_inst_t *) &cmd_set_bond_mon_period,
 #endif
(cmdline_parse_inst_t *)&cmd_vlan_offload,
(cmdline_parse_inst_t *)&cmd_vlan_tpid,
diff --git a/app/test/test.h b/app/test/test.h
index 98ab804..24b1640 100644
--- a/app/test/test.h
+++ b/app/test/test.h
@@ -62,14 +62,15 @@

 #define TEST_ASSERT_SUCCESS(val, msg, ...) do {
\
if (!(val == 0)) {  
\
-   printf("TestCase %s() line %d failed: " 
\
-

[dpdk-dev] [PATCH v5 6/8] testpmd: adding parameter to reconfig method to set socket_id when adding new port to portlist

2014-10-14 Thread Declan Doherty

Signed-off-by: Declan Doherty 
---
 app/test-pmd/cmdline.c | 2 +-
 app/test-pmd/testpmd.c | 3 ++-
 app/test-pmd/testpmd.h | 2 +-
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 0b972f9..e9cf53e 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -3618,7 +3618,7 @@ static void cmd_create_bonded_device_parsed(void 
*parsed_result,

/* Update number of ports */
nb_ports = rte_eth_dev_count();
-   reconfig(port_id);
+   reconfig(port_id, res->socket);
rte_eth_promiscuous_enable(port_id);
}

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index f76406f..5740804 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -630,7 +630,7 @@ init_config(void)


 void
-reconfig(portid_t new_port_id)
+reconfig(portid_t new_port_id, unsigned socket_id)
 {
struct rte_port *port;

@@ -649,6 +649,7 @@ reconfig(portid_t new_port_id)
/* set flag to initialize port/queue */
port->need_reconfig = 1;
port->need_reconfig_queues = 1;
+   port->socket_id = socket_id;

init_port_config();
 }
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 9cbfeac..5a3423c 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -457,7 +457,7 @@ void fwd_config_display(void);
 void rxtx_config_display(void);
 void fwd_config_setup(void);
 void set_def_fwd_config(void);
-void reconfig(portid_t new_port_id);
+void reconfig(portid_t new_port_id, unsigned socket_id);
 int init_fwd_streams(void);

 void port_mtu_set(portid_t port_id, uint16_t mtu);
-- 
1.7.12.2



[dpdk-dev] [PATCH v5 5/8] test app: adding support for generating variable sized packet

2014-10-14 Thread Declan Doherty

Signed-off-by: Declan Doherty 
---
 app/test/packet_burst_generator.c | 25 -
 app/test/packet_burst_generator.h |  6 +-
 app/test/test_link_bonding.c  | 14 +-
 3 files changed, 22 insertions(+), 23 deletions(-)

diff --git a/app/test/packet_burst_generator.c 
b/app/test/packet_burst_generator.c
index 9e747a4..b2824dc 100644
--- a/app/test/packet_burst_generator.c
+++ b/app/test/packet_burst_generator.c
@@ -74,8 +74,7 @@ static inline void
 copy_buf_to_pkt(void *buf, unsigned len, struct rte_mbuf *pkt, unsigned offset)
 {
if (offset + len <= pkt->data_len) {
-   rte_memcpy(rte_pktmbuf_mtod(pkt, char *) + offset,
-   buf, (size_t) len);
+   rte_memcpy(rte_pktmbuf_mtod(pkt, char *) + offset, buf, 
(size_t) len);
return;
}
copy_buf_to_pkt_segs(buf, len, pkt, offset);
@@ -191,20 +190,12 @@ initialize_ipv4_header(struct ipv4_hdr *ip_hdr, uint32_t 
src_addr,
  */
 #define RTE_MAX_SEGS_PER_PKT 255 /**< pkt.nb_segs is a 8-bit unsigned char. */

-#define TXONLY_DEF_PACKET_LEN 64
-#define TXONLY_DEF_PACKET_LEN_128 128
-
-uint16_t tx_pkt_length = TXONLY_DEF_PACKET_LEN;
-uint16_t tx_pkt_seg_lengths[RTE_MAX_SEGS_PER_PKT] = {
-   TXONLY_DEF_PACKET_LEN_128,
-};
-
-uint8_t  tx_pkt_nb_segs = 1;

 int
 generate_packet_burst(struct rte_mempool *mp, struct rte_mbuf **pkts_burst,
struct ether_hdr *eth_hdr, uint8_t vlan_enabled, void *ip_hdr,
-   uint8_t ipv4, struct udp_hdr *udp_hdr, int nb_pkt_per_burst)
+   uint8_t ipv4, struct udp_hdr *udp_hdr, int nb_pkt_per_burst,
+   uint8_t pkt_len, uint8_t nb_pkt_segs)
 {
int i, nb_pkt = 0;
size_t eth_hdr_size;
@@ -221,9 +212,9 @@ nomore_mbuf:
break;
}

-   pkt->data_len = tx_pkt_seg_lengths[0];
+   pkt->data_len = pkt_len;
pkt_seg = pkt;
-   for (i = 1; i < tx_pkt_nb_segs; i++) {
+   for (i = 1; i < nb_pkt_segs; i++) {
pkt_seg->next = rte_pktmbuf_alloc(mp);
if (pkt_seg->next == NULL) {
pkt->nb_segs = i;
@@ -231,7 +222,7 @@ nomore_mbuf:
goto nomore_mbuf;
}
pkt_seg = pkt_seg->next;
-   pkt_seg->data_len = tx_pkt_seg_lengths[i];
+   pkt_seg->data_len = pkt_len;
}
pkt_seg->next = NULL; /* Last segment of packet. */

@@ -259,8 +250,8 @@ nomore_mbuf:
 * Complete first mbuf of packet and append it to the
 * burst of packets to be transmitted.
 */
-   pkt->nb_segs = tx_pkt_nb_segs;
-   pkt->pkt_len = tx_pkt_length;
+   pkt->nb_segs = nb_pkt_segs;
+   pkt->pkt_len = pkt_len;
pkt->l2_len = eth_hdr_size;

if (ipv4) {
diff --git a/app/test/packet_burst_generator.h 
b/app/test/packet_burst_generator.h
index 5b3cd6c..f86589e 100644
--- a/app/test/packet_burst_generator.h
+++ b/app/test/packet_burst_generator.h
@@ -47,6 +47,9 @@ extern "C" {
 #define IPV4_ADDR(a, b, c, d)(((a & 0xff) << 24) | ((b & 0xff) << 16) | \
((c & 0xff) << 8) | (d & 0xff))

+#define PACKET_BURST_GEN_PKT_LEN 60
+#define PACKET_BURST_GEN_PKT_LEN_128 128
+

 void
 initialize_eth_header(struct ether_hdr *eth_hdr, struct ether_addr *src_mac,
@@ -68,7 +71,8 @@ initialize_ipv4_header(struct ipv4_hdr *ip_hdr, uint32_t 
src_addr,
 int
 generate_packet_burst(struct rte_mempool *mp, struct rte_mbuf **pkts_burst,
struct ether_hdr *eth_hdr, uint8_t vlan_enabled, void *ip_hdr,
-   uint8_t ipv4, struct udp_hdr *udp_hdr, int nb_pkt_per_burst);
+   uint8_t ipv4, struct udp_hdr *udp_hdr, int nb_pkt_per_burst,
+   uint8_t pkt_len, uint8_t nb_pkt_segs);

 #ifdef __cplusplus
 }
diff --git a/app/test/test_link_bonding.c b/app/test/test_link_bonding.c
index 1a847eb..50355a3 100644
--- a/app/test/test_link_bonding.c
+++ b/app/test/test_link_bonding.c
@@ -1338,7 +1338,8 @@ generate_test_burst(struct rte_mbuf **pkts_burst, 
uint16_t burst_size,
/* Generate burst of packets to transmit */
generated_burst_size = generate_packet_burst(test_params->mbuf_pool,
pkts_burst, test_params->pkt_eth_hdr, vlan, ip_hdr, 
ipv4,
-   test_params->pkt_udp_hdr, burst_size);
+   test_params->pkt_udp_hdr, burst_size, 
PACKET_BURST_GEN_PKT_LEN_128,
+   1);
if (generated_burst_size != burst_size) {
printf("Failed to generate packet burst");
return -1;
@@ -2056,7 +2057,7 @@ test_activebackup_tx_burst(void)
/* Generate a burst of packets to transmit */
generated_burst_size = generate_p

[dpdk-dev] [PATCH v5 4/8] bond: free mbufs if transmission fails in bonding tx_burst functions

2014-10-14 Thread Declan Doherty

Signed-off-by: Declan Doherty 
---
 app/test/test_link_bonding.c   | 393 -
 app/test/virtual_pmd.c |  79 +--
 app/test/virtual_pmd.h |   7 +
 lib/librte_pmd_bond/rte_eth_bond_pmd.c |  83 +--
 4 files changed, 524 insertions(+), 38 deletions(-)

diff --git a/app/test/test_link_bonding.c b/app/test/test_link_bonding.c
index cce32ed..1a847eb 100644
--- a/app/test/test_link_bonding.c
+++ b/app/test/test_link_bonding.c
@@ -663,6 +663,9 @@ enable_bonded_slaves(void)
int i;

for (i = 0; i < test_params->bonded_slave_count; i++) {
+   
virtual_ethdev_tx_burst_fn_set_success(test_params->slave_port_ids[i],
+   1);
+
virtual_ethdev_simulate_link_status_interrupt(
test_params->slave_port_ids[i], 1);
}
@@ -1413,6 +1416,135 @@ test_roundrobin_tx_burst(void)
 }

 static int
+verify_mbufs_ref_count(struct rte_mbuf **mbufs, int nb_mbufs, int val)
+{
+   int i, refcnt;
+
+   for (i = 0; i < nb_mbufs; i++) {
+   refcnt = rte_mbuf_refcnt_read(mbufs[i]);
+   TEST_ASSERT_EQUAL(refcnt, val,
+   "mbuf ref count (%d)is not the expected value (%d)",
+   refcnt, val);
+   }
+   return 0;
+}
+
+
+static void
+free_mbufs(struct rte_mbuf **mbufs, int nb_mbufs)
+{
+   int i;
+
+   for (i = 0; i < nb_mbufs; i++)
+   rte_pktmbuf_free(mbufs[i]);
+}
+
+#define TEST_RR_SLAVE_TX_FAIL_SLAVE_COUNT  (2)
+#define TEST_RR_SLAVE_TX_FAIL_BURST_SIZE   (64)
+#define TEST_RR_SLAVE_TX_FAIL_PACKETS_COUNT(22)
+#define TEST_RR_SLAVE_TX_FAIL_FAILING_SLAVE_IDX(1)
+
+static int
+test_roundrobin_tx_burst_slave_tx_fail(void)
+{
+   struct rte_mbuf *pkt_burst[MAX_PKT_BURST];
+   struct rte_mbuf *expected_tx_fail_pkts[MAX_PKT_BURST];
+
+   struct rte_eth_stats port_stats;
+
+   int i, first_fail_idx, tx_count;
+
+   TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves(
+   BONDING_MODE_ROUND_ROBIN, 0,
+   TEST_RR_SLAVE_TX_FAIL_SLAVE_COUNT, 1),
+   "Failed to intialise bonded device");
+
+   /* Generate test bursts of packets to transmit */
+   TEST_ASSERT_EQUAL(generate_test_burst(pkt_burst,
+   TEST_RR_SLAVE_TX_FAIL_BURST_SIZE, 0, 1, 0, 0, 0),
+   TEST_RR_SLAVE_TX_FAIL_BURST_SIZE,
+   "Failed to generate test packet burst");
+
+   /* Copy references to packets which we expect not to be transmitted */
+   first_fail_idx = (TEST_RR_SLAVE_TX_FAIL_BURST_SIZE -
+   (TEST_RR_SLAVE_TX_FAIL_PACKETS_COUNT *
+   TEST_RR_SLAVE_TX_FAIL_SLAVE_COUNT)) +
+   TEST_RR_SLAVE_TX_FAIL_FAILING_SLAVE_IDX;
+
+   for (i = 0; i < TEST_RR_SLAVE_TX_FAIL_PACKETS_COUNT; i++) {
+   expected_tx_fail_pkts[i] = pkt_burst[first_fail_idx +
+   (i * TEST_RR_SLAVE_TX_FAIL_SLAVE_COUNT)];
+   }
+
+   /* Set virtual slave to only fail transmission of
+* TEST_RR_SLAVE_TX_FAIL_PACKETS_COUNT packets in burst */
+   virtual_ethdev_tx_burst_fn_set_success(
+   
test_params->slave_port_ids[TEST_RR_SLAVE_TX_FAIL_FAILING_SLAVE_IDX],
+   0);
+
+   virtual_ethdev_tx_burst_fn_set_tx_pkt_fail_count(
+   
test_params->slave_port_ids[TEST_RR_SLAVE_TX_FAIL_FAILING_SLAVE_IDX],
+   TEST_RR_SLAVE_TX_FAIL_PACKETS_COUNT);
+
+   tx_count = rte_eth_tx_burst(test_params->bonded_port_id, 0, pkt_burst,
+   TEST_RR_SLAVE_TX_FAIL_BURST_SIZE);
+
+   TEST_ASSERT_EQUAL(tx_count, TEST_RR_SLAVE_TX_FAIL_BURST_SIZE -
+   TEST_RR_SLAVE_TX_FAIL_PACKETS_COUNT,
+   "Transmitted (%d) an unexpected (%d) number of 
packets", tx_count,
+   TEST_RR_SLAVE_TX_FAIL_BURST_SIZE -
+   TEST_RR_SLAVE_TX_FAIL_PACKETS_COUNT);
+
+   /* Verify that failed packet are expected failed packets */
+   for (i = 0; i < TEST_RR_SLAVE_TX_FAIL_PACKETS_COUNT; i++) {
+   TEST_ASSERT_EQUAL(expected_tx_fail_pkts[i], pkt_burst[i + 
tx_count],
+   "expected mbuf (%d) pointer %p not expected 
pointer %p",
+   i, expected_tx_fail_pkts[i], pkt_burst[i + 
tx_count]);
+   }
+
+   /* Verify bonded port tx stats */
+   rte_eth_stats_get(test_params->bonded_port_id, &port_stats);
+
+   TEST_ASSERT_EQUAL(port_stats.opackets,
+   (uint64_t)TEST_RR_SLAVE_TX_FAIL_BURST_SIZE -
+   TEST_RR_SLAVE_TX_FAIL_PACKETS_COUNT,
+   "Bonded Port (%d) opackets value (%u) not as expected 
(%d)",
+   test_params->bonded_port_id, (u

[dpdk-dev] [PATCH v5 3/8] bond: fix naming inconsistency in tx_burst_round_robin

2014-10-14 Thread Declan Doherty

Signed-off-by: Declan Doherty 
---
 lib/librte_pmd_bond/rte_eth_bond_pmd.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/lib/librte_pmd_bond/rte_eth_bond_pmd.c 
b/lib/librte_pmd_bond/rte_eth_bond_pmd.c
index 348e28f..66f1650 100644
--- a/lib/librte_pmd_bond/rte_eth_bond_pmd.c
+++ b/lib/librte_pmd_bond/rte_eth_bond_pmd.c
@@ -92,7 +92,7 @@ static uint16_t
 bond_ethdev_tx_burst_round_robin(void *queue, struct rte_mbuf **bufs,
uint16_t nb_pkts)
 {
-   struct bond_dev_private *dev_private;
+   struct bond_dev_private *internals;
struct bond_tx_queue *bd_tx_q;

struct rte_mbuf *slave_bufs[RTE_MAX_ETHPORTS][nb_pkts];
@@ -107,13 +107,13 @@ bond_ethdev_tx_burst_round_robin(void *queue, struct 
rte_mbuf **bufs,
int i, cs_idx = 0;

bd_tx_q = (struct bond_tx_queue *)queue;
-   dev_private = bd_tx_q->dev_private;
+   internals = bd_tx_q->dev_private;

/* Copy slave list to protect against slave up/down changes during tx
 * bursting */
-   num_of_slaves = dev_private->active_slave_count;
-   memcpy(slaves, dev_private->active_slaves,
-   sizeof(dev_private->active_slaves[0]) * num_of_slaves);
+   num_of_slaves = internals->active_slave_count;
+   memcpy(slaves, internals->active_slaves,
+   sizeof(internals->active_slaves[0]) * num_of_slaves);

if (num_of_slaves < 1)
return num_tx_total;
-- 
1.7.12.2



[dpdk-dev] [PATCH v5 2/8] bond: removing switch statement from rx burst method

2014-10-14 Thread Declan Doherty

Signed-off-by: Declan Doherty 
---
 lib/librte_pmd_bond/rte_eth_bond_pmd.c | 62 +++---
 1 file changed, 35 insertions(+), 27 deletions(-)

diff --git a/lib/librte_pmd_bond/rte_eth_bond_pmd.c 
b/lib/librte_pmd_bond/rte_eth_bond_pmd.c
index aca2dcf..348e28f 100644
--- a/lib/librte_pmd_bond/rte_eth_bond_pmd.c
+++ b/lib/librte_pmd_bond/rte_eth_bond_pmd.c
@@ -59,33 +59,37 @@ bond_ethdev_rx_burst(void *queue, struct rte_mbuf **bufs, 
uint16_t nb_pkts)

internals = bd_rx_q->dev_private;

-   switch (internals->mode) {
-   case BONDING_MODE_ROUND_ROBIN:
-   case BONDING_MODE_BROADCAST:
-   case BONDING_MODE_BALANCE:
-   for (i = 0; i < internals->active_slave_count && nb_pkts; i++) {
-   /* Offset of pointer to *bufs increases as packets are 
received
-* from other slaves */
-   num_rx_slave = 
rte_eth_rx_burst(internals->active_slaves[i],
-   bd_rx_q->queue_id, bufs + num_rx_total, 
nb_pkts);
-   if (num_rx_slave) {
-   num_rx_total += num_rx_slave;
-   nb_pkts -= num_rx_slave;
-   }
+   for (i = 0; i < internals->active_slave_count && nb_pkts; i++) {
+   /* Offset of pointer to *bufs increases as packets are received
+* from other slaves */
+   num_rx_slave = rte_eth_rx_burst(internals->active_slaves[i],
+   bd_rx_q->queue_id, bufs + num_rx_total, 
nb_pkts);
+   if (num_rx_slave) {
+   num_rx_total += num_rx_slave;
+   nb_pkts -= num_rx_slave;
}
-   break;
-   case BONDING_MODE_ACTIVE_BACKUP:
-   num_rx_slave = rte_eth_rx_burst(internals->current_primary_port,
-   bd_rx_q->queue_id, bufs, nb_pkts);
-   if (num_rx_slave)
-   num_rx_total = num_rx_slave;
-   break;
}
+
return num_rx_total;
 }

 static uint16_t
-bond_ethdev_tx_round_robin(void *queue, struct rte_mbuf **bufs,
+bond_ethdev_rx_burst_active_backup(void *queue, struct rte_mbuf **bufs,
+   uint16_t nb_pkts)
+{
+   struct bond_dev_private *internals;
+
+   /* Cast to structure, containing bonded device's port id and queue id */
+   struct bond_rx_queue *bd_rx_q = (struct bond_rx_queue *)queue;
+
+   internals = bd_rx_q->dev_private;
+
+   return rte_eth_rx_burst(internals->current_primary_port,
+   bd_rx_q->queue_id, bufs, nb_pkts);
+}
+
+static uint16_t
+bond_ethdev_tx_burst_round_robin(void *queue, struct rte_mbuf **bufs,
uint16_t nb_pkts)
 {
struct bond_dev_private *dev_private;
@@ -134,7 +138,7 @@ bond_ethdev_tx_round_robin(void *queue, struct rte_mbuf 
**bufs,
 }

 static uint16_t
-bond_ethdev_tx_active_backup(void *queue,
+bond_ethdev_tx_burst_active_backup(void *queue,
struct rte_mbuf **bufs, uint16_t nb_pkts)
 {
struct bond_dev_private *internals;
@@ -270,7 +274,8 @@ xmit_slave_hash(const struct rte_mbuf *buf, uint8_t 
slave_count, uint8_t policy)
 }

 static uint16_t
-bond_ethdev_tx_balance(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
+bond_ethdev_tx_burst_balance(void *queue, struct rte_mbuf **bufs,
+   uint16_t nb_pkts)
 {
struct bond_dev_private *internals;
struct bond_tx_queue *bd_tx_q;
@@ -480,22 +485,25 @@ bond_ethdev_mode_set(struct rte_eth_dev *eth_dev, int 
mode)

switch (mode) {
case BONDING_MODE_ROUND_ROBIN:
-   eth_dev->tx_pkt_burst = bond_ethdev_tx_round_robin;
+   eth_dev->tx_pkt_burst = bond_ethdev_tx_burst_round_robin;
+   eth_dev->rx_pkt_burst = bond_ethdev_rx_burst;
break;
case BONDING_MODE_ACTIVE_BACKUP:
-   eth_dev->tx_pkt_burst = bond_ethdev_tx_active_backup;
+   eth_dev->tx_pkt_burst = bond_ethdev_tx_burst_active_backup;
+   eth_dev->rx_pkt_burst = bond_ethdev_rx_burst_active_backup;
break;
case BONDING_MODE_BALANCE:
-   eth_dev->tx_pkt_burst = bond_ethdev_tx_balance;
+   eth_dev->tx_pkt_burst = bond_ethdev_tx_burst_balance;
+   eth_dev->rx_pkt_burst = bond_ethdev_rx_burst;
break;
case BONDING_MODE_BROADCAST:
eth_dev->tx_pkt_burst = bond_ethdev_tx_burst_broadcast;
+   eth_dev->rx_pkt_burst = bond_ethdev_rx_burst;
break;
default:
return -1;
}

-   eth_dev->rx_pkt_burst = bond_ethdev_rx_burst;
internals->mode = mode;

return 0;
-- 
1.7.12.2



[dpdk-dev] [PATCH v5 1/8] bond: link status interrupt support

2014-10-14 Thread Declan Doherty
Adding support for lsc interrupt from bonded device to link
bonding library with supporting unit tests in the test application.

Signed-off-by: Declan Doherty 
---
 app/test/test_link_bonding.c   | 213 +++--
 lib/librte_pmd_bond/rte_eth_bond_api.c |   4 +
 lib/librte_pmd_bond/rte_eth_bond_pmd.c |   6 +
 3 files changed, 189 insertions(+), 34 deletions(-)

diff --git a/app/test/test_link_bonding.c b/app/test/test_link_bonding.c
index db5b180..cce32ed 100644
--- a/app/test/test_link_bonding.c
+++ b/app/test/test_link_bonding.c
@@ -39,6 +39,7 @@
 #include 
 #include 
 #include 
+#include 

 #include 
 #include 
@@ -224,10 +225,15 @@ static struct rte_eth_txconf tx_conf_default = {
 };

 static int
-configure_ethdev(uint8_t port_id, uint8_t start)
+configure_ethdev(uint8_t port_id, uint8_t start, uint8_t en_isr)
 {
int q_id;

+   if (en_isr)
+   default_pmd_conf.intr_conf.lsc = 1;
+   else
+   default_pmd_conf.intr_conf.lsc = 0;
+
if (rte_eth_dev_configure(port_id, test_params->nb_rx_q,
test_params->nb_tx_q, &default_pmd_conf) != 0) {
goto error;
@@ -312,7 +318,7 @@ test_setup(void)

printf("Created virtual ethdev %s\n", pmd_name);

-   retval = 
configure_ethdev(test_params->slave_port_ids[i], 1);
+   retval = 
configure_ethdev(test_params->slave_port_ids[i], 1, 0);
if (retval != 0) {
printf("Failed to configure virtual ethdev 
%s\n", pmd_name);
return -1;
@@ -341,7 +347,7 @@ test_create_bonded_device(void)
TEST_ASSERT(test_params->bonded_port_id >= 0,
"Failed to create bonded ethdev %s", 
BONDED_DEV_NAME);

-   
TEST_ASSERT_SUCCESS(configure_ethdev(test_params->bonded_port_id, 0),
+   
TEST_ASSERT_SUCCESS(configure_ethdev(test_params->bonded_port_id, 0, 0),
"Failed to configure bonded ethdev %s", 
BONDED_DEV_NAME);
}

@@ -1078,12 +1084,12 @@ test_set_explicit_bonded_mac(void)


 static int
-initialize_bonded_device_with_slaves(uint8_t bonding_mode,
+initialize_bonded_device_with_slaves(uint8_t bonding_mode, uint8_t bond_en_isr,
uint8_t number_of_slaves, uint8_t enable_slave)
 {
/* configure bonded device */
-   TEST_ASSERT_SUCCESS(configure_ethdev(test_params->bonded_port_id, 0),
-   "Failed to configure bonding port (%d) in mode %d "
+   TEST_ASSERT_SUCCESS(configure_ethdev(test_params->bonded_port_id, 0,
+   bond_en_isr), "Failed to configure bonding port (%d) in 
mode %d "
"with (%d) slaves.", test_params->bonded_port_id, 
bonding_mode,
number_of_slaves);

@@ -1116,8 +1122,8 @@ test_adding_slave_after_bonded_device_started(void)
 {
int i;

-   if (initialize_bonded_device_with_slaves(BONDING_MODE_ROUND_ROBIN, 4, 
0) !=
-   0)
+   if (initialize_bonded_device_with_slaves(BONDING_MODE_ROUND_ROBIN, 0, 
4, 0)
+   != 0)
return -1;

/* Enabled slave devices */
@@ -1141,6 +1147,144 @@ test_adding_slave_after_bonded_device_started(void)
return remove_slaves_and_stop_bonded_device();
 }

+#define TEST_STATUS_INTERRUPT_SLAVE_COUNT  4
+#define TEST_LSC_WAIT_TIMEOUT_MS   500
+
+int test_lsc_interupt_count;
+
+static pthread_mutex_t mutex;
+static pthread_cond_t cvar;
+
+static void
+test_bonding_lsc_event_callback(uint8_t port_id __rte_unused,
+   enum rte_eth_event_type type  __rte_unused, void *param 
__rte_unused)
+{
+   pthread_mutex_lock(&mutex);
+   test_lsc_interupt_count++;
+
+   pthread_cond_signal(&cvar);
+   pthread_mutex_unlock(&mutex);
+}
+
+static inline int
+lsc_timeout(int wait_us)
+{
+   int retval = 0;
+
+   struct timespec ts;
+   struct timeval tp;
+
+   gettimeofday(&tp, NULL);
+
+   /* Convert from timeval to timespec */
+   ts.tv_sec  = tp.tv_sec;
+   ts.tv_nsec = tp.tv_usec * 1000;
+   ts.tv_nsec += wait_us * 1000;
+
+   pthread_mutex_lock(&mutex);
+   if (test_lsc_interupt_count < 1)
+   retval = pthread_cond_timedwait(&cvar, &mutex, &ts);
+
+   pthread_mutex_unlock(&mutex);
+
+   return retval;
+}
+
+static int
+test_status_interrupt(void)
+{
+   int slave_count;
+   uint8_t slaves[RTE_MAX_ETHPORTS];
+
+   pthread_mutex_init(&mutex, NULL);
+   pthread_cond_init(&cvar, NULL);
+
+   /* initialized bonding device with T slaves */
+   if (initialize_bonded_device_with_slaves(BONDING_MODE_ROUND_ROBIN, 1,
+   TEST_STATUS_INTERRUPT_SLAVE_COUNT, 1) != 0)
+   return -1;
+
+   test_lsc_interupt_count = 0;
+
+   /* register link status change interrupt callback

[dpdk-dev] [PATCH v5 0/8] link bonding

2014-10-14 Thread Declan Doherty
v5:
- Fix uninitialized variable in broadcast_tx_burst function which caused a
  build error in 32-bit build
- Address unit test issue which is exposed by new test in mode 4/5 patch sets

v4:
- Rebased to account for changes in master.
- Fix for rte_eth_bond_slaves_get() introduced in v3 patch set
- Addressed issue around disabling/enabling link status polling around adding/
  removing slaves devices.

v3 :
- Typo fix for the bond free mbufs patch.
- Rebased to account for changes in the mbuf patches.
- Add support for slave devices which don't support link status interrupts 
- Tidy up the link bonding unit test so that all tests use the new test macros.

v2 :
Addresses issues with the logic around the handling of fail transmissions.
In this version all modes behave in a manner similar to a standard PMD,
returning the number of successfully transmitted mbufs and with the failing
mbufs at the end of bufs array for freeing / retransmission by the 
application software

v1:

This patch set adds support for link status interrupt in the link bonding
pmd. It also contains some patches to tidy up the code structure and to
of the link bonding code and to fix bugs relating to transmission 
failures in the under lying slave pmd which could lead to leaked mbufs. 


Declan Doherty (8):
  bond: link status interrupt support
  bond: removing switch statement from rx burst method
  bond: fix naming inconsistency in tx_burst_round_robin
  bond: free mbufs if transmission fails in bonding tx_burst functions
  test app: adding support for generating variable sized packet
  testpmd: adding parameter to reconfig method to set socket_id when
adding new port to portlist
  bond: lsc polling support
  bond: unit test test macro refactor

 app/test-pmd/cmdline.c |   65 +-
 app/test-pmd/testpmd.c |3 +-
 app/test-pmd/testpmd.h |2 +-
 app/test/packet_burst_generator.c  |   25 +-
 app/test/packet_burst_generator.h  |6 +-
 app/test/test.h|7 +-
 app/test/test_link_bonding.c   | 3342 ++--
 app/test/virtual_pmd.c |   96 +-
 app/test/virtual_pmd.h |   53 +-
 lib/librte_pmd_bond/rte_eth_bond.h |   80 +
 lib/librte_pmd_bond/rte_eth_bond_api.c |  319 ++-
 lib/librte_pmd_bond/rte_eth_bond_args.c|   30 +-
 lib/librte_pmd_bond/rte_eth_bond_pmd.c |  550 +++--
 lib/librte_pmd_bond/rte_eth_bond_private.h |   71 +-
 14 files changed, 2691 insertions(+), 1958 deletions(-)

-- 
1.7.12.2



[dpdk-dev] [PATCH] librte_eal: FreeBSD contigmem prevent possible buffer overrun during module unload.

2014-10-14 Thread Alan Carew
The maximum mount contiguous memory regions for FreeBSD is limited by
RTE_CONTIGMEM_MAX_NUM_BUFS, a pointer to each region is stored in
static void * contigmem_buffers[RTE_CONTIGMEM_MAX_NUM_BUFS]

A user can specify a greater amount via hw.contigmem.num_buffers,
while the allocation logic will prevent this allocation from occuring the logic
in contigmem_unload() will attempt to free hw.contigmem.num_buffers and an
overrun occurs.

This patch limits the freeing to a maximum of RTE_CONTIGMEM_MAX_NUM_BUFS.

Signed-off-by: Alan Carew 
---
 lib/librte_eal/bsdapp/contigmem/contigmem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/librte_eal/bsdapp/contigmem/contigmem.c 
b/lib/librte_eal/bsdapp/contigmem/contigmem.c
index b71474a..b1a23fa 100644
--- a/lib/librte_eal/bsdapp/contigmem/contigmem.c
+++ b/lib/librte_eal/bsdapp/contigmem/contigmem.c
@@ -178,7 +178,7 @@ contigmem_unload()
if (contigmem_eh_tag != NULL)
EVENTHANDLER_DEREGISTER(process_exit, contigmem_eh_tag);

-   for (i = 0; i < contigmem_num_buffers; i++)
+   for (i = 0; i < RTE_CONTIGMEM_MAX_NUM_BUFS; i++)
if (contigmem_buffers[i] != NULL)
contigfree(contigmem_buffers[i], contigmem_buffer_size,
M_CONTIGMEM);
-- 
1.9.3



[dpdk-dev] [PATCH v4 00/10] VM Power Management

2014-10-14 Thread Carew, Alan
Hi Thomas,

> -Original Message-
> From: Thomas Monjalon [mailto:thomas.monjalon at 6wind.com]
> Sent: Monday, October 13, 2014 9:26 PM
> To: Carew, Alan
> Cc: dev at dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v4 00/10] VM Power Management
> 
> Hi Alan,
> 
> 2014-10-12 20:36, Alan Carew:
> > The following patches add two DPDK sample applications and an alternate
> > implementation of librte_power for use in virtualized environments.
> > The idea is to provide librte_power functionality from within a VM to 
> > address
> > the lack of MSRs to facilitate frequency changes from within a VM.
> > It is ideally suited for Haswell which provides per core frequency scaling.
> >
> > The current librte_power affects frequency changes via the acpi-cpufreq
> > 'userspace' power governor, accessed via sysfs.
> 
> Something was preventing me from looking deeper in this big codebase,
> but I didn't know what sounds weird.
> Now I realize: the real problem is that virtualization transparency is
> broken for power management. So the right thing to do is to fix it in
> KVM. I think all this patchset is a huge workaround.
> 
> Did you try to fix it with Qemu/KVM?
> 
> --
> Thomas

When looking at the libvirt API it would seem to be a natural fit to have power 
management sitting there, so in essence I would agree.

However with a DPDK solution it would be possible to re-use the message bus to 
pass information like device stats, application state, D-state requests etc. to 
the host and allow for management layer(e.g. OpenStack) to make informed 
decisions.

Also, the scope of adding power management to qemu/KVM would be huge; while the 
easier path is not always the best and the problem of power management in VMs 
is both a DPDK problem (given that librte_power only worked on the host) and a 
general virtualization problem that would be better solved by those with direct 
knowledge of Qemu/KVM architecture and influence on the direction of the Qemu 
project.

As it stands, the host backend is simply an example application that can be 
replaced by a VMM or Orchestration layer, by using Virtio-Serial it has obvious 
leanings to Qemu, but even this could be easily swapped out for XenBus, 
IVSHMEM, IP etc.

If power management is to be eventually supported by Hypervisors directly then 
we could also enable to option to switch to that environment, currently the 
librte_power implementations (VM or Host) can be selected 
dynamically(environment auto-detection) or explicitly via rte_power_set_env(), 
adding an arbitrary number of environments is relatively easy.

I hope this helps to clarify the approach.


Thanks,
Alan.


[dpdk-dev] Bug in IPACL library of DPDK-1.6.0

2014-10-14 Thread Karmarkar Suyash
There are two user defined ACL rules and they are added with just different 
priority -

1.  And all other fields are wild card:
>   SOURCE IP and  DEST IP = wild card (*)
>   LIF_GRP_INFO_FIELD_IPV6 = wild card (*)
>   PORTS = wild card (*)
2.  Only next header protocol is specified = ICMPv6 (58)
3.  Priority is different. But the one with lower priority is returned 
during lookup.

The structure is -

enum
{
   NEXT_HDR_FIELD_IPV4, //8
   IPSRC_FIELD_IPV4,  //src ip (32)
   IPDST_FIELD_IPV4,  //dst ip (32)
   PORTS_FIELD_IPV4,  // src port (16) + dest port (16) => 32
   LIF_GRP_INFO_FIELD_IPV4, //lif group (16) +  lif Id (16)  => 32
   ADDR_CTX_FIELD_IPV4, //addr context (32)
   NUM_FIELDS_IPV4
};



struct rte_acl_field_def ipv6_defs[NUM_FIELDS_IPV6] = {
   {
  .type = RTE_ACL_FIELD_TYPE_BITMASK,
  .size = sizeof (uint8_t),
  .field_index = NEXT_HDR_FIELD_IPV6,
  .input_index = NEXT_HDR_FIELD_IPV6,
  .offset = offsetof(struct ipv6_hdr, proto),
   },

///source ip
   {
  .type = RTE_ACL_FIELD_TYPE_BITMASK,
  .size = sizeof (uint32_t),
  .field_index = IPSRC_FIELD0_IPV6,
  .input_index = IPSRC_FIELD0_IPV6,
  .offset = offsetof(struct ipv6_hdr, src_addr),
   },
   {
  .type = RTE_ACL_FIELD_TYPE_BITMASK,
  .size = sizeof (uint32_t),
  .field_index = IPSRC_FIELD1_IPV6,
  .input_index = IPSRC_FIELD1_IPV6,
  .offset = offsetof(struct ipv6_hdr, src_addr) + 1*sizeof (uint32_t),
   },
   {
  .type = RTE_ACL_FIELD_TYPE_BITMASK,
  .size = sizeof (uint32_t),
  .field_index = IPSRC_FIELD2_IPV6,
  .input_index = IPSRC_FIELD2_IPV6,
  .offset = offsetof(struct ipv6_hdr, src_addr) + 2*sizeof (uint32_t),
   },
   {
  .type = RTE_ACL_FIELD_TYPE_BITMASK,
  .size = sizeof (uint32_t),
  .field_index = IPSRC_FIELD3_IPV6,
  .input_index = IPSRC_FIELD3_IPV6,
  .offset = offsetof(struct ipv6_hdr, src_addr) + 3*sizeof (uint32_t),
   },

///destination ip
   {
  .type = RTE_ACL_FIELD_TYPE_BITMASK,
  .size = sizeof (uint32_t),
  .field_index = IPDST_FIELD0_IPV6,
  .input_index = IPDST_FIELD0_IPV6,
  .offset = offsetof(struct ipv6_hdr, dst_addr),
   },
   {
  .type = RTE_ACL_FIELD_TYPE_BITMASK,
  .size = sizeof (uint32_t),
  .field_index = IPDST_FIELD1_IPV6,
  .input_index = IPDST_FIELD1_IPV6,
  .offset = offsetof(struct ipv6_hdr, dst_addr) + 1*sizeof (uint32_t),
   },
   {
  .type = RTE_ACL_FIELD_TYPE_BITMASK,
  .size = sizeof (uint32_t),
  .field_index = IPDST_FIELD2_IPV6,
  .input_index = IPDST_FIELD2_IPV6,
  .offset = offsetof(struct ipv6_hdr, dst_addr) + 2*sizeof (uint32_t),
   },
   {
  .type = RTE_ACL_FIELD_TYPE_BITMASK,
  .size = sizeof (uint32_t),
  .field_index = IPDST_FIELD3_IPV6,
  .input_index = IPDST_FIELD3_IPV6,
  .offset = offsetof(struct ipv6_hdr, dst_addr) + 3*sizeof (uint32_t),
   },

   ///ports
{
  .type = RTE_ACL_FIELD_TYPE_BITMASK,
  .size = sizeof (uint32_t),
  .field_index = PORTS_FIELD_IPV6,
  .input_index = PORTS_FIELD_IPV6,
  .offset = sizeof(struct ipv6_hdr) ,
   },
//LIF grp and addr ctx
   {
  .type = RTE_ACL_FIELD_TYPE_BITMASK,
  .size = sizeof (uint32_t),
  .field_index = LIF_GRP_INFO_FIELD_IPV6,
  .input_index = LIF_GRP_INFO_FIELD_IPV6,
  .offset = sizeof(struct ipv6_hdr) +  sizeof (uint32_t),
   },
   {
  .type = RTE_ACL_FIELD_TYPE_BITMASK,
  .size = sizeof (uint32_t),
  .field_index = ADDR_CTX_FIELD_IPV6,
  .input_index = ADDR_CTX_FIELD_IPV6,
  .offset = sizeof(struct ipv6_hdr) +  2*sizeof (uint32_t),
   }
} ;




-Original Message-
From: Ananyev, Konstantin [mailto:konstantin.anan...@intel.com]
Sent: Tuesday, October 14, 2014 4:16 PM
To: Karmarkar Suyash; dev at dpdk.org
Cc: Dey, Souvik; Patil, PraveenKumar
Subject: RE: Bug in IPACL library of DPDK-1.6.0

Hi,

> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Karmarkar Suyash
> Sent: Tuesday, October 14, 2014 10:55 AM
> To: dev at dpdk.org
> Cc: Dey, Souvik; Patil, PraveenKumar
> Subject: [dpdk-dev] Bug in IPACL library of DPDK-1.6.0
>
> Hello All,
>
> If there are two identical IPv6 rules with source and destination IP
> addresses as wild card but with different priority, then during lookup  
> always the rule that is added first in TRIE is returned even though the 
> second rule that has highest priority.
>

Could you provide a bit more details how to reproduce the problem:
- either a rule and trace file to reproduce the problem in testacl 
(classsbench) format -or some simple code snippet.

Thanks
Konstantin

> Regards
> Suyash Karmarkar




[dpdk-dev] virtio UIO / PMD issues in default Ubuntu Cloud Images

2014-10-14 Thread Gonzalez Monroy, Sergio
Hi Matthew,

Could you provide steps to reproduce your issue with virtio non-UIO PMD 
(virtio-net-pmd) using static combined DPDK lib?

Regarding one of your comments:
> It doesn't seem to have a link dependency against any DPDK library that might 
> contain such a symbol, either:
> 
> $ ldd librte_pmd_virtio.so
> linux-vdso.so.1 =>  (0x7fffd61fc000)
> libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x7fa2d971f000)
> /lib64/ld-linux-x86-64.so.2 (0x7fa2d9d0)
>
librte_pmd_virtio.so does depend on DPDK, but ldd won't show it because it was 
not build against DPDK libs which it makes
sense if you are building static lib DPDK.

Thanks,
Sergio

> -Original Message-
> From: Matthew Hall [mailto:mhall at mhcomputing.net]
> Sent: Tuesday, October 14, 2014 9:35 AM
> To: Gonzalez Monroy, Sergio; dev at dpdk.org
> Subject: RE: [dpdk-dev] virtio UIO / PMD issues in default Ubuntu Cloud
> Images
> 
> Yes, I suspected some of your patches were related to this besides just the
> COMBINE_LIBS options. However none of these will fix the issue that the
> virtio non-UIO PMD doesn't work right with a statically linked DPDK, so,
> despite all your fixes I've still got problems getting it all to work right.
> 
> Matthew.
> --
> Sent from my mobile device.
> 
> On October 14, 2014 1:22:56 AM PDT, "Gonzalez Monroy, Sergio"
>  wrote:
> >
> >
> >> -Original Message-
> >> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Matthew Hall
> >> Sent: Tuesday, October 14, 2014 7:34 AM
> >> To: dev at dpdk.org
> >> Subject: Re: [dpdk-dev] virtio UIO / PMD issues in default Ubuntu
> >Cloud
> >> Images
> >>
> >>
> >>
> >> On Mon, Oct 13, 2014 at 11:03:53PM -0700, Matthew Hall wrote:
> >> > Another weird issue... when I tried to compile a DPDK shared lib
> >using
> >> > clang I got this really, really weird error:
> >> >
> >> > /usr/bin/ld: test: hidden symbol `mknod' in
> >> > /usr/lib/x86_64-linux-gnu/libc_nonshared.a(mknod.oS) is referenced
> >by
> >> > DSO
> >> > /usr/bin/ld: final link failed: Bad value
> >>
> >> Note: this specific error seems to be a bug in the behavior of DPDK
> >> compilation when the following two options are enabled
> >simultaneously:
> >>
> >> CONFIG_RTE_BUILD_SHARED_LIB=y
> >> CONFIG_RTE_BUILD_COMBINE_LIBS=y
> >>
> >
> >Hi Matthew,
> >
> >The problem as you point out is that the combined library is not being
> >linked properly, in this case we are not linking against libc when
> >building the shared library.
> >One way of fixing this issue is to use CC instead of LD to do the
> >linking.
> >
> >I have submitted a patch that updates the lib building process which
> >main purpose was to fix this issue but it seems that the removing of
> >CONFIG_RTE_BUILD_COMBINE_LIBS took over its real purpose.
> >Another fix that the patch fixes is linking against other external
> >required libs (ie. libm, librt, etc) when needed, so they would show on
> >ldd if they are required.
> >
> >Please have a look at
> >http://dpdk.org/ml/archives/dev/2014-October/006453.html.
> >I would expect many of your issues to be fixed with that patch and
> >would really appreciate any feedback on it.
> >
> >Thanks,
> >Sergio
> >
> >
> >> I think this is a pretty serious problem for anybody that's packaging
> >or
> >> distributing a complete DPDK because compiling both the static and
> >dynamic
> >> DPDK's at the same time as one another is going to fail with this
> >weird error.
> >>
> >> Matthew.



[dpdk-dev] [PATCH] virtio-net-pmd: .gitignore: ignore librte_pmd_virtio.so

2014-10-14 Thread Stephen Hemminger
On Tue, 14 Oct 2014 10:44:16 +0100
Bruce Richardson  wrote:

> On Tue, Oct 14, 2014 at 07:53:56AM +, Matthew Hall wrote:
> > Signed-off-by: Matthew Hall 
> > ---
> >  .gitignore | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/.gitignore b/.gitignore
> > index e69de29..08d831a 100644
> > --- a/.gitignore
> > +++ b/.gitignore
> > @@ -0,0 +1 @@
> > +librte_pmd_virtio.so
> > -- 
> > 1.9.1
> > 
> 
> I thought our .gitignore could do with a few entries added alright, I just 
> never expected this one to be top of the list! While I don't think it does 
> any harm, I'm just curious why you think it needs to be added?
> 
> /Bruce

Why not add *.so to ignore all built shared libraries


[dpdk-dev] [PATCH 2/3] pmd: add new header containing TCP offload specific definitions

2014-10-14 Thread Thomas Monjalon
Hi Miroslaw,

2014-10-13 10:38, miroslaw.walukiewicz at intel.com:
> From: Miroslaw Walukiewicz 
> 
> The function for computing initial TCP header checksum.
> The file is common for both i40e and ixgbe PMD drivers
> 
> Signed-off-by: Mirek Walukiewicz 
> ---
>  lib/librte_net/Makefile  |3 +
>  lib/librte_net/rte_tcp_off.h |  122 
> ++

There is a work in progress about TSO:
http://thread.gmane.org/gmane.comp.networking.dpdk.devel/2541/focus=2553
This API was discussed and implemented for ixgbe.
Then there was an agreement to rework mbuf in 1.8 version to implement TSO
on top of it. Then it was suggested to rebase his work:
http://dpdk.org/ml/archives/dev/2014-September/006151.html

How does your patchset match with Olivier's work on TSO and ixgbe driver?
I would like to ensure the API works fine for all TSO-capable driver,
this would be a good start.

Thanks
-- 
Thomas


[dpdk-dev] [PATCH] Fix librte_pmd_ring: connect primary and secondary ring with correct port.

2014-10-14 Thread Bruce Richardson
On Tue, Oct 07, 2014 at 11:11:45PM +0900, Masaru OKI wrote:
> librte_pmd_ring provides created port and attached port.
> Packet is received from attached port if packet is sent to created port.
> So, packet is received from created port if packet is sent to attached port.
> It must be need two rings such as "create to attach" and "attach to create".
> But current implementation uses only one ring for rx/tx.
> It causes incorrect result.
> Fixed:
> - Make ring both rx and tx
> - Connect created (primary) ring and attached (secondary) ring
> - Correct m->port like librte_pmd_pcap
> 
> Signed-off-by: Masaru OKI 

>From my reading, this is really two patches:
1. add in a port id to packets received from an eth_ring port
2. change the rte_eth_ring_create function to create two sets of rings.
so perhaps this could be split up into two proposed patches.

Unfortunately, while I have no issue with the first part, I disagree with 
the second part. A ring or a ring-ethdev is a undirectional channel, and 
this is explicitly by design. When you create or attach to a ring pmd 
instance (or ring ethdev), you get exactly that, an ethdev instance that has 
a ring, or set of rings internally. It's up to the application how to use 
those rings. If you need a bidirectional channel, you need to create two 
ring ethdevs, in exactly the same way that if you want bidirectional 
messaging between two cores using rte_rings, you need to create two rings, 
one for each direction.

regards,
/Bruce

> ---
>  lib/librte_pmd_ring/rte_eth_ring.c | 36 +++-
>  1 file changed, 27 insertions(+), 9 deletions(-)
> 
> diff --git a/lib/librte_pmd_ring/rte_eth_ring.c 
> b/lib/librte_pmd_ring/rte_eth_ring.c
> index 4f1b6ed..d926d00 100644
> --- a/lib/librte_pmd_ring/rte_eth_ring.c
> +++ b/lib/librte_pmd_ring/rte_eth_ring.c
> @@ -54,6 +54,7 @@ struct ring_queue {
>   rte_atomic64_t rx_pkts;
>   rte_atomic64_t tx_pkts;
>   rte_atomic64_t err_pkts;
> + uint8_t in_port;
>  };
>  
>  struct pmd_internals {
> @@ -80,10 +81,14 @@ eth_ring_rx(void *q, struct rte_mbuf **bufs, uint16_t 
> nb_bufs)
>   struct ring_queue *r = q;
>   const uint16_t nb_rx = (uint16_t)rte_ring_dequeue_burst(r->rng,
>   ptrs, nb_bufs);
> +uint16_t cnt;
>   if (r->rng->flags & RING_F_SC_DEQ)
>   r->rx_pkts.cnt += nb_rx;
>   else
>   rte_atomic64_add(&(r->rx_pkts), nb_rx);
> +for (cnt = 0; cnt < nb_rx; cnt++) {
> +  bufs[cnt]->port = r->in_port;
> +}
>   return nb_rx;
>  }
>  
> @@ -129,6 +134,8 @@ eth_rx_queue_setup(struct rte_eth_dev *dev,uint16_t 
> rx_queue_id,
>  {
>   struct pmd_internals *internals = dev->data->dev_private;
>   dev->data->rx_queues[rx_queue_id] = 
> &internals->rx_ring_queues[rx_queue_id];
> + internals->rx_ring_queues[rx_queue_id].in_port = dev->data->port_id;
> +
>   return 0;
>  }
>  
> @@ -319,23 +326,34 @@ eth_dev_ring_create(const char *name, const unsigned 
> numa_node,
>   /* rx and tx are so-called from point of view of first port.
>* They are inverted from the point of view of second port
>*/
> - struct rte_ring *rxtx[RTE_PMD_RING_MAX_RX_RINGS];
> + struct rte_ring *rx[RTE_PMD_RING_MAX_RX_RINGS];
> + struct rte_ring *tx[RTE_PMD_RING_MAX_TX_RINGS];
>   unsigned i;
> - char rng_name[RTE_RING_NAMESIZE];
> + char rng_rxname[RTE_RING_NAMESIZE];
> + char rng_txname[RTE_RING_NAMESIZE];
>   unsigned num_rings = RTE_MIN(RTE_PMD_RING_MAX_RX_RINGS,
>   RTE_PMD_RING_MAX_TX_RINGS);
>  
>   for (i = 0; i < num_rings; i++) {
> - snprintf(rng_name, sizeof(rng_name), "ETH_RXTX%u_%s", i, name);
> - rxtx[i] = (action == DEV_CREATE) ?
> - rte_ring_create(rng_name, 1024, numa_node,
> - RING_F_SP_ENQ|RING_F_SC_DEQ) :
> - rte_ring_lookup(rng_name);
> - if (rxtx[i] == NULL)
> + snprintf(rng_rxname, sizeof(rng_rxname),
> + "ETH_RX%u_%s", i, name);
> + snprintf(rng_txname, sizeof(rng_txname),
> + "ETH_TX%u_%s", i, name);
> + rx[i] = (action == DEV_CREATE) ?
> +rte_ring_create(rng_rxname, 1024, numa_node,
> +RING_F_SP_ENQ|RING_F_SC_DEQ) :
> +rte_ring_lookup(rng_txname);
> + if (rx[i] == NULL)
> + return -1;
> + tx[i] = (action == DEV_CREATE) ?
> +rte_ring_create(rng_txname, 1024, numa_node,
> +RING_F_SP_ENQ|RING_F_SC_DEQ) :
> +rte_ring_lookup(rng_rxname);
> + if (tx[i] == NULL)
>   return -1;
>   }
>  
> - if (rte_eth_from_rings(name, rxtx, num_rings, rxtx, num_rings, 
> nu

[dpdk-dev] Bug in IPACL library of DPDK-1.6.0

2014-10-14 Thread Ananyev, Konstantin
Hi,

> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Karmarkar Suyash
> Sent: Tuesday, October 14, 2014 10:55 AM
> To: dev at dpdk.org
> Cc: Dey, Souvik; Patil, PraveenKumar
> Subject: [dpdk-dev] Bug in IPACL library of DPDK-1.6.0
> 
> Hello All,
> 
> If there are two identical IPv6 rules with source and destination IP 
> addresses as wild card but with different priority, then during
> lookup  always the rule that is added first in TRIE is returned even though 
> the second rule that has highest priority.
> 

Could you provide a bit more details how to reproduce the problem:
- either a rule and trace file to reproduce the problem in testacl 
(classsbench) format
-or some simple code snippet.

Thanks
Konstantin

> Regards
> Suyash Karmarkar



[dpdk-dev] [PATCH] virtio-net-pmd: .gitignore: ignore librte_pmd_virtio.so

2014-10-14 Thread Bruce Richardson
On Tue, Oct 14, 2014 at 07:53:56AM +, Matthew Hall wrote:
> Signed-off-by: Matthew Hall 
> ---
>  .gitignore | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/.gitignore b/.gitignore
> index e69de29..08d831a 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -0,0 +1 @@
> +librte_pmd_virtio.so
> -- 
> 1.9.1
> 

I thought our .gitignore could do with a few entries added alright, I just 
never expected this one to be top of the list! While I don't think it does 
any harm, I'm just curious why you think it needs to be added?

/Bruce


[dpdk-dev] Bug in IPACL library of DPDK-1.6.0

2014-10-14 Thread Karmarkar Suyash
Hello All,

If there are two identical IPv6 rules with source and destination IP addresses 
as wild card but with different priority, then during lookup  always the rule 
that is added first in TRIE is returned even though the second rule that has 
highest priority.

Regards
Suyash Karmarkar



[dpdk-dev] [PATCH] virtio-net-pmd: .gitignore: ignore librte_pmd_virtio.so

2014-10-14 Thread Matthew Hall
In the virtio-net-pmd it is done in the same directory. Hence me submitting 
this to try to make it easier for others to use the product.

Also the default DPDK doesn't ignore the build target directories... but I 
already had to fork that one to fix clang compile failures in the examples 
files.

Matthew.
-- 
Sent from my mobile device.

On October 14, 2014 9:09:49 AM PDT, Thomas Monjalon  wrote:
>> >I thought our .gitignore could do with a few entries added alright,
>I
>> >just never expected this one to be top of the list! While I don't
>think
>> >it does any harm, I'm just curious why you think it needs to be
>added?
>> >
>> >/Bruce
>> 
>> I import all my DPDK dependencies as git submodules. When the
>submodules
>> contain unignored files, they get marked as dirty by git, and it
>makes
>> like difficult when it comes to updating my submodule pointers.
>> 
>> Matthew.
>
>So you cannot update submodules without filling .gitignore?
>
>I'm not a big fan of .gitignore because I like seeing what has been
>generated by looking at "git status".
>And it's not really needed in DPDK because compilation is often done in
>a separate directory.



[dpdk-dev] [PATCH] virtio-net-pmd: .gitignore: ignore librte_pmd_virtio.so

2014-10-14 Thread Matthew Hall
Sure, I can put the classic C gitignore entries in there if you guys prefer. I 
was just trying to make the minimum change to get it to work right for my 
environment.
-- 
Sent from my mobile device.

On October 14, 2014 2:52:20 AM PDT, Stephen Hemminger  wrote:
>On Tue, 14 Oct 2014 10:44:16 +0100
>Bruce Richardson  wrote:
>
>> On Tue, Oct 14, 2014 at 07:53:56AM +, Matthew Hall wrote:
>> > Signed-off-by: Matthew Hall 
>> > ---
>> >  .gitignore | 1 +
>> >  1 file changed, 1 insertion(+)
>> > 
>> > diff --git a/.gitignore b/.gitignore
>> > index e69de29..08d831a 100644
>> > --- a/.gitignore
>> > +++ b/.gitignore
>> > @@ -0,0 +1 @@
>> > +librte_pmd_virtio.so
>> > -- 
>> > 1.9.1
>> > 
>> 
>> I thought our .gitignore could do with a few entries added alright, I
>just 
>> never expected this one to be top of the list! While I don't think it
>does 
>> any harm, I'm just curious why you think it needs to be added?
>> 
>> /Bruce
>
>Why not add *.so to ignore all built shared libraries



[dpdk-dev] [PATCH] virtio-net-pmd: .gitignore: ignore librte_pmd_virtio.so

2014-10-14 Thread Matthew Hall
I import all my DPDK dependencies as git submodules. When the submodules 
contain unignored files, they get marked as dirty by git, and it makes like 
difficult when it comes to updating my submodule pointers.

Matthew.
-- 
Sent from my mobile device.

On October 14, 2014 2:44:16 AM PDT, Bruce Richardson  wrote:
>On Tue, Oct 14, 2014 at 07:53:56AM +, Matthew Hall wrote:
>> Signed-off-by: Matthew Hall 
>> ---
>>  .gitignore | 1 +
>>  1 file changed, 1 insertion(+)
>> 
>> diff --git a/.gitignore b/.gitignore
>> index e69de29..08d831a 100644
>> --- a/.gitignore
>> +++ b/.gitignore
>> @@ -0,0 +1 @@
>> +librte_pmd_virtio.so
>> -- 
>> 1.9.1
>> 
>
>I thought our .gitignore could do with a few entries added alright, I
>just 
>never expected this one to be top of the list! While I don't think it
>does 
>any harm, I'm just curious why you think it needs to be added?
>
>/Bruce



[dpdk-dev] [PATCH 0/6] i40e VMDQ support

2014-10-14 Thread Chen, Jing D
Hi Thomas,

Any comments with below patch?

-Original Message-
From: Chen, Jing D 
Sent: Tuesday, September 23, 2014 9:14 PM
To: dev at dpdk.org
Cc: Chen, Jing D
Subject: [PATCH 0/6] i40e VMDQ support

From: "Chen Jing D(Mark)" 

Define extra VMDQ arguments to expand VMDQ configuration. This also
includes change in igb and ixgbe PMD driver. In the meanwhile, fix 2
defects in rte_ether library.

Add full VMDQ support in i40e PMD driver. renamed some functions, setup
VMDQ VSI after it's enabled in application. It also make some improvement
on macaddr add/delete to support setting multiple macaddr for single or
multiple pools.

Finally, change i40e rx/tx_queue_setup and dev_start/stop functions to
configure/switch queues belonging to VMDQ pools.

Chen Jing D(Mark) (6):
  ether: enhancement for VMDQ support
  igb: change for VMDQ arguments expansion
  ixgbe: change for VMDQ arguments expansion
  i40e: add VMDQ support
  i40e: macaddr add/del enhancement
  i40e: Add full VMDQ pools support

 config/common_linuxapp  |1 +
 lib/librte_ether/rte_ethdev.c   |   12 +-
 lib/librte_ether/rte_ethdev.h   |   39 ++-
 lib/librte_pmd_e1000/igb_ethdev.c   |3 +
 lib/librte_pmd_i40e/i40e_ethdev.c   |  509 ++-
 lib/librte_pmd_i40e/i40e_ethdev.h   |   21 ++-
 lib/librte_pmd_i40e/i40e_rxtx.c |  125 +++--
 lib/librte_pmd_ixgbe/ixgbe_ethdev.c |1 +
 8 files changed, 537 insertions(+), 174 deletions(-)

-- 
1.7.7.6



[dpdk-dev] virtio UIO / PMD issues in default Ubuntu Cloud Images

2014-10-14 Thread Gonzalez Monroy, Sergio


> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Matthew Hall
> Sent: Tuesday, October 14, 2014 7:34 AM
> To: dev at dpdk.org
> Subject: Re: [dpdk-dev] virtio UIO / PMD issues in default Ubuntu Cloud
> Images
> 
> 
> 
> On Mon, Oct 13, 2014 at 11:03:53PM -0700, Matthew Hall wrote:
> > Another weird issue... when I tried to compile a DPDK shared lib using
> > clang I got this really, really weird error:
> >
> > /usr/bin/ld: test: hidden symbol `mknod' in
> > /usr/lib/x86_64-linux-gnu/libc_nonshared.a(mknod.oS) is referenced by
> > DSO
> > /usr/bin/ld: final link failed: Bad value
> 
> Note: this specific error seems to be a bug in the behavior of DPDK
> compilation when the following two options are enabled simultaneously:
> 
> CONFIG_RTE_BUILD_SHARED_LIB=y
> CONFIG_RTE_BUILD_COMBINE_LIBS=y
> 

Hi Matthew,

The problem as you point out is that the combined library is not being linked 
properly, 
in this case we are not linking against libc when building the shared library.
One way of fixing this issue is to use CC instead of LD to do the linking.

I have submitted a patch that updates the lib building process which main 
purpose was
to fix this issue but it seems that the removing of 
CONFIG_RTE_BUILD_COMBINE_LIBS
took over its real purpose.
Another fix that the patch fixes is linking against other external required libs
(ie. libm, librt, etc) when needed, so they would show on ldd if they are 
required.

Please have a look at http://dpdk.org/ml/archives/dev/2014-October/006453.html.
I would expect many of your issues to be fixed with that patch and would really
appreciate any feedback on it.

Thanks,
Sergio


> I think this is a pretty serious problem for anybody that's packaging or
> distributing a complete DPDK because compiling both the static and dynamic
> DPDK's at the same time as one another is going to fail with this weird error.
> 
> Matthew.


[dpdk-dev] [PATCH] virtio-net-pmd: .gitignore: ignore librte_pmd_virtio.so

2014-10-14 Thread Matthew Hall
Signed-off-by: Matthew Hall 
---
 .gitignore | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.gitignore b/.gitignore
index e69de29..08d831a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+librte_pmd_virtio.so
-- 
1.9.1



[dpdk-dev] [PATCH 1/3] pmd: add new flag to indicate TX TSO operation on the packet

2014-10-14 Thread Liu, Jijiang


> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of
> miroslaw.walukiewicz at intel.com
> Sent: Monday, October 13, 2014 10:39 PM
> To: dev at dpdk.org
> Subject: [dpdk-dev] [PATCH 1/3] pmd: add new flag to indicate TX TSO operation
> on the packet
> 
> From: Miroslaw Walukiewicz 
> 
> Transmission of TCP packets could be accelerated by HW Transmit Segmentation
> Offload. With TSO packets up to 64K could be transmismitted.
> 
> When this flag is set the PMD drived will enable TCP segmentation.
> 
> The new field tso_segsz is added to indicate how long is TCP TSO segment.
> 
> Signed-off-by: Mirek Walukiewicz 
> ---
>  lib/librte_mbuf/rte_mbuf.h |5 +
>  1 file changed, 5 insertions(+)
> 
> diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h index
> ddadc21..63cbc36 100644
> --- a/lib/librte_mbuf/rte_mbuf.h
> +++ b/lib/librte_mbuf/rte_mbuf.h
> @@ -117,6 +117,9 @@ extern "C" {
>  /* Use final bit of flags to indicate a control mbuf */
>  #define CTRL_MBUF_FLAG   (1ULL << 63) /**< Mbuf contains control data */
> 
> +/* Bit 50 - TSO (TCP Transmit Segmenation Offload) */
> +#define PKT_TX_TCP_TSO   (1ULL << 50) /**< Mbuf needs TSO enabling */


In VxLAN patch set  [PATCH v5 7/8]i40e:support VxLAN Tx checksum offload, the  
bit (1ULL << 50)   in offload flag have already been used.
+#define PKT_TX_VXLAN_CKSUM   (1ULL << 50) /**< TX checksum of VxLAN computed 
by NIC */

>  /**
>   * Bit Mask to indicate what bits required for building TX context
>   */
> @@ -196,6 +199,8 @@ struct rte_mbuf {
>   uint16_t l2_len:7;  /**< L2 (MAC) Header Length. */
>   };
>   };
> + /* field to support TSO segment size */
> + uint32_t tso_segsz;
>  } __rte_cache_aligned;
> 
>  /**



[dpdk-dev] [PATCH v4 0/7] Support configuring hash functions

2014-10-14 Thread Wu, Jingjing
Acked-by: Jingjing Wu 

> -Original Message-
> From: Zhang, Helin
> Sent: Monday, October 13, 2014 2:13 PM
> To: dev at dpdk.org
> Cc: Zhan, Zhaochen; Cao, Waterman; Zhang, Helin
> Subject: [PATCH v4 0/7] Support configuring hash functions
> 
> These patches mainly support configuring hash functions.
> In detail,
>  - It can get or set hash functions.
>  - It can configure symmetric hash functions.
>* Get/set symmetric hash enable per port.
>* Get/set symmetric hash enable per 'PCTYPE'.
>* Get/set filter swap configurations.
>  - 'ethdev' level interfaces are added.
>* 'rte_eth_dev_filter_supported', to check if a filter control
>  is supported on a port.
>* 'rte_eth_dev_filter_ctrl', a common API to execute
>  specific filter control.
>  - Six commands have been implemented in testpmd to support
>testing above.
>* get_sym_hash_ena_per_port
>* set_sym_hash_ena_per_port
>* get_sym_hash_ena_per_pctype
>* set_sym_hash_ena_per_pctype
>* get_filter_swap
>* set_filter_swap
>* get_hash_function
>* set_hash_function
> 
> Note that 'PCTYPE' means 'Packet Classification Type'.
> 
> v4 changes:
> * Fixed a bug in testpmd to support 'set_sym_hash_ena_per_port'.
> 
> Helin Zhang (7):
>   ethdev: add more annotations
>   ethdev: add interfaces and relevant for filter control
>   ethdev: add structures and enum for hash filter control
>   i40e: add hash filter control implementation
>   i40e: add hardware initialization
>   i40e: Use constant random hash keys
>   app/testpmd: add commands to support hash filter control
> 
>  app/test-pmd/cmdline.c| 566
> ++
>  lib/librte_ether/Makefile |   1 +
>  lib/librte_ether/rte_eth_ctrl.h   | 154 +++
>  lib/librte_ether/rte_ethdev.c |  32 +++
>  lib/librte_ether/rte_ethdev.h |  53 +++-
>  lib/librte_pmd_i40e/i40e_ethdev.c | 492
> -
>  6 files changed, 1291 insertions(+), 7 deletions(-)  create mode 100644
> lib/librte_ether/rte_eth_ctrl.h
> 
> --
> 1.8.1.4



[dpdk-dev] virtio UIO / PMD issues in default Ubuntu Cloud Images

2014-10-14 Thread Matthew Hall
Yes, I suspected some of your patches were related to this besides just the 
COMBINE_LIBS options. However none of these will fix the issue that the virtio 
non-UIO PMD doesn't work right with a statically linked DPDK, so, despite all 
your fixes I've still got problems getting it all to work right.

Matthew.
-- 
Sent from my mobile device.

On October 14, 2014 1:22:56 AM PDT, "Gonzalez Monroy, Sergio" 
 wrote:
>
>
>> -Original Message-
>> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Matthew Hall
>> Sent: Tuesday, October 14, 2014 7:34 AM
>> To: dev at dpdk.org
>> Subject: Re: [dpdk-dev] virtio UIO / PMD issues in default Ubuntu
>Cloud
>> Images
>> 
>> 
>> 
>> On Mon, Oct 13, 2014 at 11:03:53PM -0700, Matthew Hall wrote:
>> > Another weird issue... when I tried to compile a DPDK shared lib
>using
>> > clang I got this really, really weird error:
>> >
>> > /usr/bin/ld: test: hidden symbol `mknod' in
>> > /usr/lib/x86_64-linux-gnu/libc_nonshared.a(mknod.oS) is referenced
>by
>> > DSO
>> > /usr/bin/ld: final link failed: Bad value
>> 
>> Note: this specific error seems to be a bug in the behavior of DPDK
>> compilation when the following two options are enabled
>simultaneously:
>> 
>> CONFIG_RTE_BUILD_SHARED_LIB=y
>> CONFIG_RTE_BUILD_COMBINE_LIBS=y
>> 
>
>Hi Matthew,
>
>The problem as you point out is that the combined library is not being
>linked properly, 
>in this case we are not linking against libc when building the shared
>library.
>One way of fixing this issue is to use CC instead of LD to do the
>linking.
>
>I have submitted a patch that updates the lib building process which
>main purpose was
>to fix this issue but it seems that the removing of
>CONFIG_RTE_BUILD_COMBINE_LIBS
>took over its real purpose.
>Another fix that the patch fixes is linking against other external
>required libs
>(ie. libm, librt, etc) when needed, so they would show on ldd if they
>are required.
>
>Please have a look at
>http://dpdk.org/ml/archives/dev/2014-October/006453.html.
>I would expect many of your issues to be fixed with that patch and
>would really
>appreciate any feedback on it.
>
>Thanks,
>Sergio
>
>
>> I think this is a pretty serious problem for anybody that's packaging
>or
>> distributing a complete DPDK because compiling both the static and
>dynamic
>> DPDK's at the same time as one another is going to fail with this
>weird error.
>> 
>> Matthew.



[dpdk-dev] [PATCH v2 1/4] app/test: unit test for rx and tx cycles/packet

2014-10-14 Thread Liang, Cunming


> -Original Message-
> From: De Lara Guarch, Pablo
> Sent: Monday, October 13, 2014 8:56 PM
> To: Liang, Cunming; Neil Horman
> Cc: dev at dpdk.org
> Subject: RE: [dpdk-dev] [PATCH v2 1/4] app/test: unit test for rx and tx
> cycles/packet
> 
> 
> 
> > -Original Message-
> > From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Liang, Cunming
> > Sent: Sunday, October 12, 2014 12:11 PM
> > To: Neil Horman
> > Cc: dev at dpdk.org
> > Subject: Re: [dpdk-dev] [PATCH v2 1/4] app/test: unit test for rx and tx
> > cycles/packet
> >
> > Hi Neil,
> >
> > Very appreciate your comments.
> > I add inline reply, will send v3 asap when we get alignment.
> >
> > BRs,
> > Liang Cunming
> >
> > > -Original Message-
> > > From: Neil Horman [mailto:nhorman at tuxdriver.com]
> > > Sent: Saturday, October 11, 2014 1:52 AM
> > > To: Liang, Cunming
> > > Cc: dev at dpdk.org
> > > Subject: Re: [dpdk-dev] [PATCH v2 1/4] app/test: unit test for rx and tx
> > cycles/packet
> > >
> > > On Fri, Oct 10, 2014 at 08:29:58PM +0800, Cunming Liang wrote:
> > > > It provides unit test to measure cycles/packet in NIC loopback mode.
> > > > It simply gives the average cycles of IO used per packet without test
> > equipment.
> > > > When doing the test, make sure the link is UP.
> > > >
> > > > Usage Example:
> > > > 1. Run unit test app in interactive mode
> > > > app/test -c f -n 4 -- -i
> > > > 2. Run and wait for the result
> > > > pmd_perf_autotest
> > > >
> > > > There's option to choose rx/tx pair, default is vector.
> > > > set_rxtx_mode [vector|scalar|full|hybrid]
> > > > Note: To get acurate scalar fast, please choose 'vector' or 'hybrid' 
> > > > without
> > > INC_VEC=y in config
> > > >
> > > > Signed-off-by: Cunming Liang 
> > > > Acked-by: Bruce Richardson 
> > >
> > > Notes inline
> > >
> > > > ---
> > > >  app/test/Makefile   |1 +
> > > >  app/test/commands.c |   38 +++
> > > >  app/test/packet_burst_generator.c   |4 +-
> > > >  app/test/test.h |4 +
> > > >  app/test/test_pmd_perf.c|  626
> > > +++
> > > >  lib/librte_pmd_ixgbe/ixgbe_ethdev.c |6 +
> > > >  6 files changed, 677 insertions(+), 2 deletions(-)
> > > >  create mode 100644 app/test/test_pmd_perf.c
> > > >
> > > > diff --git a/app/test/Makefile b/app/test/Makefile
> > > > index 6af6d76..ebfa0ba 100644
> > > > --- a/app/test/Makefile
> > > > +++ b/app/test/Makefile
> > > > @@ -56,6 +56,7 @@ SRCS-y += test_memzone.c
> > > >
> > > >  SRCS-y += test_ring.c
> > > >  SRCS-y += test_ring_perf.c
> > > > +SRCS-y += test_pmd_perf.c
> > > >
> > > >  ifeq ($(CONFIG_RTE_LIBRTE_TABLE),y)
> > > >  SRCS-y += test_table.c
> > > > diff --git a/app/test/commands.c b/app/test/commands.c
> > > > index a9e36b1..f1e746e 100644
> > > > --- a/app/test/commands.c
> > > > +++ b/app/test/commands.c
> > > > @@ -310,12 +310,50 @@ cmdline_parse_inst_t cmd_quit = {
> > > >
> > > > +#define NB_ETHPORTS_USED(1)
> > > > +#define NB_SOCKETS  (2)
> > > > +#define MEMPOOL_CACHE_SIZE 250
> > > > +#define MBUF_SIZE (2048 + sizeof(struct rte_mbuf) +
> > > RTE_PKTMBUF_HEADROOM)
> > > Don't you want to size this in accordance with the amount of data your
> > sending
> > > (64 Bytes as noted above)?
> > [Liang, Cunming] The case is designed to measure small packet IO cost with
> > normal mbuf size.
> > Even if decreasing the size, it won't gain significant cycles.
> > >
> > > > +static void
> > > > +print_ethaddr(const char *name, const struct ether_addr *eth_addr)
> > > > +{
> > > > +   printf("%s%02X:%02X:%02X:%02X:%02X:%02X", name,
> > > > +   eth_addr->addr_bytes[0],
> > > > +   eth_addr->addr_bytes[1],
> > > > +   eth_addr->addr_bytes[2],
> > > > +   eth_addr->addr_bytes[3],
> > > > +   eth_addr->addr_bytes[4],
> > > > +   eth_addr->addr_bytes[5]);
> > > > +}
> > > > +
> > > This was copieed from print_ethaddr.  Seems like a good candidate for a
> > common
> > > function in rte_ether.h
> > [Liang, Cunming] Agree with you, some of samples now use it with the same
> > copy.
> > I'll rework it. Adding 'ether_format_addr' in rte_ether.h only for format 
> > the
> > 48bits address output.
> > And leaving other prints for application customization.
> > >
> > >
> > > > +}
> > > > +
> > > > +static void
> > > > +signal_handler(int signum)
> > > > +{
> > > > +   /* When we receive a USR1 signal, print stats */
> > > I think you mean SIGUSR2, below, SIGUSR1 tears the test down and exits
> > the
> > > program
> > [Liang, Cunming] Thanks, it's a typo.
> > >
> > > > +   if (signum == SIGUSR1) {
> > > SIGINT instead.  Thats the common practice.
> > [Liang, Cunming] I understood your opinion.
> > The considerations I'm not using SIGINT instead are:
> > 1. We unset ISIG in c_lflag of term. CRTL+C won't trigger SIGINT in command
> > interactive.
> >   It al

[dpdk-dev] [PATCH v4 4/7] i40e: add hash filter control implementation

2014-10-14 Thread Zhang, Helin
Hi Andrey

Yes, you are right. Actually I tried to rename those macros to more readable. 
For now, I'd like to put those renaming into another patches after all current 
feature patches merged. Thank you very much!

Regards,
Helin

> -Original Message-
> From: Chilikin, Andrey
> Sent: Monday, October 13, 2014 6:23 PM
> To: Zhang, Helin; dev at dpdk.org
> Subject: RE: [dpdk-dev] [PATCH v4 4/7] i40e: add hash filter control
> implementation
> 
> Hi Helin,
> 
> Should we define packet classification types separately and do not reuse bit
> shifts for RSS register as pctypes?
> Packet classification is a global index table which used by RSS Hash Enable
> registers, not vice versa.
> For example, there is no Packet classification named
> "ETH_RSS_NONF_IPV4_UDP_SHIFT" in Table 7-15 of XL710 Datasheet,  it is
> "PCTYPE_NONF_IPV4_UDP", so
> 
> switch (info->pctype) {
>   case PCTYPE_NONF_IPV4_UDP:
>   case PCTYPE_NONF_IPV4_TCP:
>   ...
> Is more clean and readable for me than
> 
> switch (info->pctype) {
>   case ETH_RSS_NONF_IPV4_UDP_SHIFT:
>   case ETH_RSS_NONF_IPV4_TCP_SHIFT:
> 
> We can rerefine ETH_RSS_* using PCTYPE_* though:
> 
> #define ETH_RSS_NONF_IPV4_UDP_SHIFT PCTYPE_NONF_IPV4_UDP and so
> one
> 
> Regards,
> Andrey
> 
> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Helin Zhang
> Sent: Monday, October 13, 2014 7:13 AM
> To: dev at dpdk.org
> Subject: [dpdk-dev] [PATCH v4 4/7] i40e: add hash filter control 
> implementation
> 
> Hash filter control has been implemented for i40e. It includes getting/setting
> - hash function type
> - symmetric hash enable per pctype (packet classification type)
> - symmetric hash enable per port
> - filter swap configuration
> 
> Signed-off-by: Helin Zhang 
> ---
>  lib/librte_pmd_i40e/i40e_ethdev.c | 402
> ++
>  1 file changed, 402 insertions(+)
> 
> diff --git a/lib/librte_pmd_i40e/i40e_ethdev.c
> b/lib/librte_pmd_i40e/i40e_ethdev.c
> index 46c43a7..60b619b 100644
> --- a/lib/librte_pmd_i40e/i40e_ethdev.c
> +++ b/lib/librte_pmd_i40e/i40e_ethdev.c
> @@ -216,6 +216,10 @@ static int i40e_dev_rss_hash_update(struct
> rte_eth_dev *dev,
>   struct rte_eth_rss_conf *rss_conf);  static 
> int
> i40e_dev_rss_hash_conf_get(struct rte_eth_dev *dev,
> struct rte_eth_rss_conf *rss_conf);
> +static int i40e_dev_filter_ctrl(struct rte_eth_dev *dev,
> + enum rte_filter_type filter_type,
> + enum rte_filter_op filter_op,
> + void *arg);
> 
>  /* Default hash key buffer for RSS */
>  static uint32_t rss_key_default[I40E_PFQF_HKEY_MAX_INDEX + 1]; @@
> -267,6 +271,7 @@ static struct eth_dev_ops i40e_eth_dev_ops = {
>   .reta_query   = i40e_dev_rss_reta_query,
>   .rss_hash_update  = i40e_dev_rss_hash_update,
>   .rss_hash_conf_get= i40e_dev_rss_hash_conf_get,
> + .filter_ctrl  = i40e_dev_filter_ctrl,
>  };
> 
>  static struct eth_driver rte_i40e_pmd = { @@ -4162,3 +4167,400 @@
> i40e_pf_config_mq_rx(struct i40e_pf *pf)
> 
>   return 0;
>  }
> +
> +/* Get the symmetric hash enable configurations per PCTYPE */ static
> +int i40e_get_symmetric_hash_enable_per_pctype(struct i40e_hw *hw,
> + struct rte_eth_sym_hash_ena_info *info) {
> + uint32_t reg;
> +
> + switch (info->pctype) {
> + case ETH_RSS_NONF_IPV4_UDP_SHIFT:
> + case ETH_RSS_NONF_IPV4_TCP_SHIFT:
> + case ETH_RSS_NONF_IPV4_SCTP_SHIFT:
> + case ETH_RSS_NONF_IPV4_OTHER_SHIFT:
> + case ETH_RSS_FRAG_IPV4_SHIFT:
> + case ETH_RSS_NONF_IPV6_UDP_SHIFT:
> + case ETH_RSS_NONF_IPV6_TCP_SHIFT:
> + case ETH_RSS_NONF_IPV6_SCTP_SHIFT:
> + case ETH_RSS_NONF_IPV6_OTHER_SHIFT:
> + case ETH_RSS_FRAG_IPV6_SHIFT:
> + case ETH_RSS_L2_PAYLOAD_SHIFT:
> + reg = I40E_READ_REG(hw, I40E_GLQF_HSYM(info->pctype));
> + info->enable = reg & I40E_GLQF_HSYM_SYMH_ENA_MASK ? 1 : 0;
> + break;
> + default:
> + PMD_DRV_LOG(ERR, "PCTYPE[%u] not supported", info->pctype);
> + return -EINVAL;
> + }
> +
> + return 0;
> +}
> +
> +/* Set the symmetric hash enable configurations per PCTYPE */ static
> +int i40e_set_symmetric_hash_enable_per_pctype(struct i40e_hw *hw,
> + const struct rte_eth_sym_hash_ena_info *info) {
> + uint32_t reg;
> +
> + switch (info->pctype) {
> + case ETH_RSS_NONF_IPV4_UDP_SHIFT:
> + case ETH_RSS_NONF_IPV4_TCP_SHIFT:
> + case ETH_RSS_NONF_IPV4_SCTP_SHIFT:
> + case ETH_RSS_NONF_IPV4_OTHER_SHIFT:
> + case ETH_RSS_FRAG_IPV4_SHIFT:
> + case ETH_RSS_NONF_IPV6_UDP_SHIFT:
> + case ETH_RSS_NONF_IPV6_TCP_SHIFT:
> + case ETH_RSS_NONF_IPV6_SCTP_SHIFT:
> + case ETH_RSS_NONF_IPV6_OTHER_SHIFT:
> + case ETH_RSS_FRAG_IPV6_SHIFT:
> + case ETH

[dpdk-dev] Alternatives to RSS on virtio-net devices

2014-10-14 Thread Matthew Hall
Hello,

Having worked around the previously reported bizarre linker issues, I can now 
see this new error:

PMD: virtio_dev_start(): RSS cannot be configured for VirtI/O net devices

If I want to ensure that the flows are sent consistently to the same core on 
virtio-net to prevent surprises, what are my options?

Given these interfaces are probably slower than physical ones, is RX / TX from 
a single core a possibility? Distributor? What are people doing to get it to 
work? Is it better to use some other kind of interface like a fake virtual 
Intel NIC, where the RSS might be supported, instead?

Thanks,
Matthew.