[dpdk-dev] one worker reading multiple ports

2014-11-21 Thread Newman Poborsky
Nice guess :)  After adding check with rte_mempool_empty(), as soon as I
enable second port for reading, it shows that the mempool is empty. Thank
you for help!

On Fri, Nov 21, 2014 at 3:44 PM, Bruce Richardson <
bruce.richardson at intel.com> wrote:

> On Fri, Nov 21, 2014 at 03:03:25PM +0100, Newman Poborsky wrote:
> > So, since mempool is multi-consumer (by default), if one is used to
> > configure queues on multiple NICs that have different socket owners, then
> > mbuf allocation will fail? But if 2 NICs have the socket owner,
> everything
> > should work fine?  Since I'm talking about 2 ports on the same NIC, they
> > must have the same owner, RX receive should work with RX queues
> configured
> > with the same mempool, right? But it my case it doesn't so I guess I'm
> > missing something.
>
> Actually, the mempools will work with NICs on multiple sockets - it's just
> that performance is likely to suffer due to QPI usage. The mempools being
> on
> one socket or the other is not going to break your application.
>
> >
> > Any idea how can I troubleshoot why allocation fails with one mempool and
> > works fine with each queue having its own mempool?
>
> At a guess, I'd say that your mempools just aren't bit enough. Try
> doubling the
> size of th mempool in the single-pool case and see if it helps things.
>
> /Bruce
>
> >
> > Thank you,
> >
> > Newman
> >
> > On Thu, Nov 20, 2014 at 10:52 PM, Matthew Hall 
> > wrote:
> >
> > > On Thu, Nov 20, 2014 at 05:10:51PM +0100, Newman Poborsky wrote:
> > > > Thank you for your answer.
> > > >
> > > > I just realized that the reason the rte_eth_rx_burst() returns 0 is
> > > because
> > > > inside ixgbe_recv_pkts() this fails:
> > > > nmb = rte_rxmbuf_alloc(rxq->mb_pool);  => nmb is NULL
> > > >
> > > > Does this mean that every RX queue should have its own rte_mempool?
> If
> > > so,
> > > > are there any optimal values for: number of RX descriptors, per-queue
> > > > rte_mempool size, number of hugepages (from what I understand, these
> 3
> > > are
> > > > correlated)?
> > > >
> > > > If I'm wrong, please explain why.
> > > >
> > > > Thanks!
> > > >
> > > > BR,
> > > > Newman
> > >
> > > Newman,
> > >
> > > Mempools are created per NUMA node (ordinarily this means per processor
> > > socket
> > > if sockets > 1).
> > >
> > > When doing Tx / Rx Queue Setup, one should determine the socket which
> owns
> > > the
> > > given PCI NIC, and try to use memory on that same socket to handle
> traffic
> > > for
> > > that NIC and Queues.
> > >
> > > So, for N cards with Q * N Tx / Rx queues, you only need S mempools.
> > >
> > > Then each of the Q * N queues will use the mempool from the socket
> closest
> > > to
> > > the card.
> > >
> > > Matthew.
> > >
>


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

2014-11-21 Thread Zhu, Heqing
Pablo just sent a new patch set. This is a significant effort and it addressed 
a valid technical problem statement. 
I express my support to this feature into the DPDK mainline. 

IMHO, the previous *rejection* reason are not solid. It is important to 
encourage the real contribution like this. 


-Original Message-
From: dev [mailto:dev-boun...@dpdk.org] On Behalf Of O'driscoll, Tim
Sent: Monday, November 10, 2014 10:54 AM
To: Carew, Alan; Thomas Monjalon
Cc: dev at dpdk.org
Subject: Re: [dpdk-dev] [PATCH v4 00/10] VM Power Management

> From: Carew, Alan
> 
> > Did you make any progress in Qemu/KVM community?
> > We need to be sync'ed up with them to be sure we share the same goal.
> > I want also to avoid using a solution which doesn't fit with their plan.
> > Remember that we already had this problem with ivshmem which was 
> > planned to be dropped.
> >
. . .
> 
> Unfortunately, I have not yet received any feedback:
> http://lists.nongnu.org/archive/html/qemu-devel/2014-11/msg01103.html

Just to add to what Alan said above, this capability does not exist in qemu at 
the moment, and based on there having been no feedback on the qemu mailing list 
so far, I think it's reasonable to assume that it will not be implemented in 
the immediate future. The VM Power Management feature has also been designed to 
allow easy migration to a qemu-based solution when this is supported in future. 
Therefore, I'd be in favour of accepting this feature into DPDK now.

It's true that the implementation is a work-around, but there have been similar 
cases in DPDK in the past. One recent example that comes to mind is userspace 
vhost. The original implementation could also be considered a work-around, but 
it met the needs of many in the community. Now, with support for vhost-user in 
qemu 2.1, that implementation is being improved. I'd see VM Power Management 
following a similar path when this capability is supported in qemu.


Tim


[dpdk-dev] [PATCH v2 5/6] DPDK-ENIC PMD interface

2014-11-21 Thread Sujith Sankar
Signed-off-by: Sujith Sankar 
---
 lib/librte_pmd_enic/enic_etherdev.c | 620 
 1 file changed, 620 insertions(+)
 create mode 100644 lib/librte_pmd_enic/enic_etherdev.c

diff --git a/lib/librte_pmd_enic/enic_etherdev.c 
b/lib/librte_pmd_enic/enic_etherdev.c
new file mode 100644
index 000..90003f5
--- /dev/null
+++ b/lib/librte_pmd_enic/enic_etherdev.c
@@ -0,0 +1,620 @@
+/*
+ * Copyright 2008-2014 Cisco Systems, Inc.  All rights reserved.
+ * Copyright 2007 Nuova Systems, Inc.  All rights reserved.
+ *
+ * Copyright (c) 2014, Cisco Systems, Inc. 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ident "$Id$"
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include "vnic_intr.h"
+#include "vnic_cq.h"
+#include "vnic_wq.h"
+#include "vnic_rq.h"
+#include "vnic_enet.h"
+#include "enic.h"
+
+#ifdef RTE_LIBRTE_ENIC_PMD_DEBUG_TRACE
+#define ENICPMD_FUNC_TRACE()\
+   do { \
+   dev_trace(enic, "Entering %s\n", __func__);   \
+   } while (0)
+#else
+#define ENICPMD_FUNC_TRACE()
+#endif
+
+
+/*
+ * The set of PCI devices this driver supports
+ */
+static struct rte_pci_id pci_id_enic_map[] = {
+#define RTE_PCI_DEV_ID_DECL_ENIC(vend, dev) {RTE_PCI_DEVICE(vend, dev)},
+#ifndef PCI_VENDOR_ID_CISCO
+#define PCI_VENDOR_ID_CISCO0x1137
+#endif
+#include "rte_pci_dev_ids.h"
+RTE_PCI_DEV_ID_DECL_ENIC(PCI_VENDOR_ID_CISCO, PCI_DEVICE_ID_CISCO_VIC_ENET)
+RTE_PCI_DEV_ID_DECL_ENIC(PCI_VENDOR_ID_CISCO, PCI_DEVICE_ID_CISCO_VIC_ENET_VF)
+{.vendor_id = 0, /* Sentinal */},
+};
+
+int enicpmd_fdir_remove_perfect_filter(struct rte_eth_dev *eth_dev,
+   struct rte_fdir_filter *fdir_filter,
+   uint16_t soft_id)
+{
+   struct enic *enic = pmd_priv(eth_dev);
+
+   ENICPMD_FUNC_TRACE();
+   return enic_fdir_del_fltr(enic, fdir_filter);
+}
+
+int enicpmd_fdir_add_perfect_filter(struct rte_eth_dev *eth_dev,
+   struct rte_fdir_filter *fdir_filter, uint16_t soft_id,
+   uint8_t queue, uint8_t drop)
+{
+   struct enic *enic = pmd_priv(eth_dev);
+
+   ENICPMD_FUNC_TRACE();
+   return enic_fdir_add_fltr(enic, fdir_filter, (uint16_t)queue, drop);
+}
+
+void enicpmd_fdir_info_get(struct rte_eth_dev *eth_dev,
+   struct rte_eth_fdir *fdir)
+{
+   struct enic *enic = pmd_priv(eth_dev);
+
+   ENICPMD_FUNC_TRACE();
+   *fdir = enic->fdir.stats;
+}
+
+void enicpmd_dev_tx_queue_release(void *txq)
+{
+   ENICPMD_FUNC_TRACE();
+   enic_free_wq(txq);
+}
+
+static int enicpmd_dev_setup_intr(struct enic *enic)
+{
+   int ret;
+   int index;
+
+   ENICPMD_FUNC_TRACE();
+
+   /* Are we done with the init of all the queues? */
+   for (index = 0; index < enic->cq_count; index++) {
+   if (!enic->cq[index].ctrl)
+   break;
+   }
+
+   if (enic->cq_count != index)
+   return 0;
+
+   ret = enic_alloc_intr_resources(enic);
+   if (ret) {
+   dev_err(enic, "alloc intr failed\n");
+   return ret;
+   }
+   enic_init_vnic_resources(enic);
+
+   ret = enic_setup_finish(enic);
+   if (ret)
+   dev_err(enic, "setup could not be finished\n");
+
+   return ret;
+}
+
+int enicpmd_dev_tx_queue_setup(struct rte_eth_dev *eth_dev,
+   uint16_t queue_idx,
+   uint16_t nb_desc,
+   unsigned int socket_id,
+   const struct rte_eth_txconf *tx_conf)
+{
+   int ret;
+   struct enic *enic = pmd_priv(eth_dev);
+
+   ENICPMD_FUNC_TRACE();
+   eth_dev->data->tx_queues[queue_idx] = (void *)>wq[queue_idx];
+
+   ret = 

[dpdk-dev] [PATCH v2 4/6] ENIC PMD specific code

2014-11-21 Thread Sujith Sankar
Signed-off-by: Sujith Sankar 
---
 lib/librte_pmd_enic/enic.h|  158 +
 lib/librte_pmd_enic/enic_clsf.c   |  244 +++
 lib/librte_pmd_enic/enic_compat.h |  142 
 lib/librte_pmd_enic/enic_main.c   | 1328 +
 lib/librte_pmd_enic/enic_res.c|  221 ++
 lib/librte_pmd_enic/enic_res.h|  168 +
 6 files changed, 2261 insertions(+)
 create mode 100644 lib/librte_pmd_enic/enic.h
 create mode 100644 lib/librte_pmd_enic/enic_clsf.c
 create mode 100644 lib/librte_pmd_enic/enic_compat.h
 create mode 100644 lib/librte_pmd_enic/enic_main.c
 create mode 100644 lib/librte_pmd_enic/enic_res.c
 create mode 100644 lib/librte_pmd_enic/enic_res.h

diff --git a/lib/librte_pmd_enic/enic.h b/lib/librte_pmd_enic/enic.h
new file mode 100644
index 000..b72c048
--- /dev/null
+++ b/lib/librte_pmd_enic/enic.h
@@ -0,0 +1,158 @@
+/*
+ * Copyright 2008-2014 Cisco Systems, Inc.  All rights reserved.
+ * Copyright 2007 Nuova Systems, Inc.  All rights reserved.
+ *
+ * Copyright (c) 2014, Cisco Systems, Inc. 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ident "$Id$"
+
+#ifndef _ENIC_H_
+#define _ENIC_H_
+
+#include "vnic_enet.h"
+#include "vnic_dev.h"
+#include "vnic_wq.h"
+#include "vnic_rq.h"
+#include "vnic_cq.h"
+#include "vnic_intr.h"
+#include "vnic_stats.h"
+#include "vnic_nic.h"
+#include "vnic_rss.h"
+#include "enic_res.h"
+
+#define DRV_NAME   "enic_pmd"
+#define DRV_DESCRIPTION"Cisco VIC Ethernet NIC Poll-mode 
Driver"
+#define DRV_VERSION"1.0.0.4"
+#define DRV_COPYRIGHT  "Copyright 2008-2014 Cisco Systems, Inc"
+
+#define ENIC_WQ_MAX8
+#define ENIC_RQ_MAX8
+#define ENIC_CQ_MAX(ENIC_WQ_MAX + ENIC_RQ_MAX)
+#define ENIC_INTR_MAX  (ENIC_CQ_MAX + 2)
+
+#define VLAN_ETH_HLEN   18
+
+#define ENICPMD_SETTING(enic, f) ((enic->config.flags & VENETF_##f) ? 1 : 0)
+
+#define ENICPMD_BDF_LENGTH  13   /* :00:00.0'\0' */
+#define PKT_TX_TCP_UDP_CKSUM0x6000
+#define ENIC_CALC_IP_CKSUM  1
+#define ENIC_CALC_TCP_UDP_CKSUM 2
+#define ENIC_MAX_MTU9000
+#define PAGE_SIZE   4096
+#define PAGE_ROUND_UP(x) \
+   unsigned long)(x)) + PAGE_SIZE-1) & (~(PAGE_SIZE-1)))
+
+#define ENICPMD_VFIO_PATH  "/dev/vfio/vfio"
+/*#define ENIC_DESC_COUNT_MAKE_ODD (x) do{if ((~(x)) & 1) { (x)--; } 
}while(0)*/
+
+#define PCI_DEVICE_ID_CISCO_VIC_ENET 0x0043  /* ethernet vnic */
+#define PCI_DEVICE_ID_CISCO_VIC_ENET_VF  0x0071  /* enet SRIOV VF */
+
+
+#define ENICPMD_FDIR_MAX   64
+
+struct enic_fdir_node {
+   struct rte_fdir_filter filter;
+   u16 fltr_id;
+   u16 rq_index;
+};
+
+struct enic_fdir {
+   struct rte_eth_fdir stats;
+   struct rte_hash *hash;
+   struct enic_fdir_node *nodes[ENICPMD_FDIR_MAX];
+};
+
+/* Per-instance private data structure */
+struct enic {
+   struct enic *next;
+   struct rte_pci_device *pdev;
+   struct vnic_enet_config config;
+   struct vnic_dev_bar bar0;
+   struct vnic_dev *vdev;
+
+   struct rte_eth_dev *rte_dev;
+   struct enic_fdir fdir;
+   char bdf_name[ENICPMD_BDF_LENGTH];
+   int dev_fd;
+   int iommu_group_fd;
+   int vfio_fd;
+   int iommu_groupid;
+   int eventfd;
+   u_int8_t mac_addr[ETH_ALEN];
+   pthread_t err_intr_thread;
+   int promisc;
+   int allmulti;
+   int ig_vlan_strip_en;
+   int link_status;
+   u8 hw_ip_checksum;
+
+   unsigned int flags;
+   unsigned int priv_flags;
+
+   /* work queue */
+   struct vnic_wq wq[ENIC_WQ_MAX];
+   unsigned int 

[dpdk-dev] [PATCH v2 3/6] VNIC common code partially shared with ENIC kernel mode driver

2014-11-21 Thread Sujith Sankar
Signed-off-by: Sujith Sankar 
---
 lib/librte_pmd_enic/vnic/cq_desc.h   |  126 
 lib/librte_pmd_enic/vnic/cq_enet_desc.h  |  261 
 lib/librte_pmd_enic/vnic/rq_enet_desc.h  |   76 +++
 lib/librte_pmd_enic/vnic/vnic_cq.c   |  117 
 lib/librte_pmd_enic/vnic/vnic_cq.h   |  152 +
 lib/librte_pmd_enic/vnic/vnic_dev.c  | 1081 ++
 lib/librte_pmd_enic/vnic/vnic_dev.h  |  202 ++
 lib/librte_pmd_enic/vnic/vnic_devcmd.h   |  774 +
 lib/librte_pmd_enic/vnic/vnic_enet.h |   78 +++
 lib/librte_pmd_enic/vnic/vnic_intr.c |   83 +++
 lib/librte_pmd_enic/vnic/vnic_intr.h |  126 
 lib/librte_pmd_enic/vnic/vnic_nic.h  |   88 +++
 lib/librte_pmd_enic/vnic/vnic_resource.h |   97 +++
 lib/librte_pmd_enic/vnic/vnic_rq.c   |  246 +++
 lib/librte_pmd_enic/vnic/vnic_rq.h   |  282 
 lib/librte_pmd_enic/vnic/vnic_rss.c  |   85 +++
 lib/librte_pmd_enic/vnic/vnic_rss.h  |   61 ++
 lib/librte_pmd_enic/vnic/vnic_stats.h|   86 +++
 lib/librte_pmd_enic/vnic/vnic_wq.c   |  245 +++
 lib/librte_pmd_enic/vnic/vnic_wq.h   |  283 
 lib/librte_pmd_enic/vnic/wq_enet_desc.h  |  114 
 21 files changed, 4663 insertions(+)
 create mode 100644 lib/librte_pmd_enic/vnic/cq_desc.h
 create mode 100644 lib/librte_pmd_enic/vnic/cq_enet_desc.h
 create mode 100644 lib/librte_pmd_enic/vnic/rq_enet_desc.h
 create mode 100644 lib/librte_pmd_enic/vnic/vnic_cq.c
 create mode 100644 lib/librte_pmd_enic/vnic/vnic_cq.h
 create mode 100644 lib/librte_pmd_enic/vnic/vnic_dev.c
 create mode 100644 lib/librte_pmd_enic/vnic/vnic_dev.h
 create mode 100644 lib/librte_pmd_enic/vnic/vnic_devcmd.h
 create mode 100644 lib/librte_pmd_enic/vnic/vnic_enet.h
 create mode 100644 lib/librte_pmd_enic/vnic/vnic_intr.c
 create mode 100644 lib/librte_pmd_enic/vnic/vnic_intr.h
 create mode 100644 lib/librte_pmd_enic/vnic/vnic_nic.h
 create mode 100644 lib/librte_pmd_enic/vnic/vnic_resource.h
 create mode 100644 lib/librte_pmd_enic/vnic/vnic_rq.c
 create mode 100644 lib/librte_pmd_enic/vnic/vnic_rq.h
 create mode 100644 lib/librte_pmd_enic/vnic/vnic_rss.c
 create mode 100644 lib/librte_pmd_enic/vnic/vnic_rss.h
 create mode 100644 lib/librte_pmd_enic/vnic/vnic_stats.h
 create mode 100644 lib/librte_pmd_enic/vnic/vnic_wq.c
 create mode 100644 lib/librte_pmd_enic/vnic/vnic_wq.h
 create mode 100644 lib/librte_pmd_enic/vnic/wq_enet_desc.h

diff --git a/lib/librte_pmd_enic/vnic/cq_desc.h 
b/lib/librte_pmd_enic/vnic/cq_desc.h
new file mode 100644
index 000..7dfb2b6
--- /dev/null
+++ b/lib/librte_pmd_enic/vnic/cq_desc.h
@@ -0,0 +1,126 @@
+/*
+ * Copyright 2008-2010 Cisco Systems, Inc.  All rights reserved.
+ * Copyright 2007 Nuova Systems, Inc.  All rights reserved.
+ *
+ * Copyright (c) 2014, Cisco Systems, Inc. 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ident "$Id: cq_desc.h 129574 2013-04-26 22:11:14Z rfaucett $"
+
+#ifndef _CQ_DESC_H_
+#define _CQ_DESC_H_
+
+/*
+ * Completion queue descriptor types
+ */
+enum cq_desc_types {
+   CQ_DESC_TYPE_WQ_ENET = 0,
+   CQ_DESC_TYPE_DESC_COPY = 1,
+   CQ_DESC_TYPE_WQ_EXCH = 2,
+   CQ_DESC_TYPE_RQ_ENET = 3,
+   CQ_DESC_TYPE_RQ_FCP = 4,
+   CQ_DESC_TYPE_IOMMU_MISS = 5,
+   CQ_DESC_TYPE_SGL = 6,
+   CQ_DESC_TYPE_CLASSIFIER = 7,
+   CQ_DESC_TYPE_TEST = 127,
+};
+
+/* Completion queue descriptor: 16B
+ *
+ * All completion queues have this basic layout.  The
+ * type_specfic area is unique for each completion
+ * queue type.
+ */
+struct cq_desc {
+   __le16 completed_index;
+   __le16 q_number;
+   u8 type_specfic[11];
+   u8 type_color;
+};

[dpdk-dev] [PATCH v2 2/6] ENIC PMD Makefile

2014-11-21 Thread Sujith Sankar
Signed-off-by: Sujith Sankar 
---
 lib/librte_pmd_enic/Makefile | 67 
 1 file changed, 67 insertions(+)
 create mode 100644 lib/librte_pmd_enic/Makefile

diff --git a/lib/librte_pmd_enic/Makefile b/lib/librte_pmd_enic/Makefile
new file mode 100644
index 000..2073cd6
--- /dev/null
+++ b/lib/librte_pmd_enic/Makefile
@@ -0,0 +1,67 @@
+#   BSD LICENSE
+# 
+#   Copyright(c) 2010-2013 Intel Corporation. All rights reserved.
+#   All rights reserved.
+# 
+#   Redistribution and use in source and binary forms, with or without 
+#   modification, are permitted provided that the following conditions 
+#   are met:
+# 
+# * Redistributions of source code must retain the above copyright 
+#   notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright 
+#   notice, this list of conditions and the following disclaimer in 
+#   the documentation and/or other materials provided with the 
+#   distribution.
+# * Neither the name of Intel Corporation nor the names of its 
+#   contributors may be used to endorse or promote products derived 
+#   from this software without specific prior written permission.
+# 
+#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+#   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+#   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 
+#   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
+#   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
+#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
+#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 
+#   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 
+#   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
+#   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
+#   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+# 
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+#
+# library name
+#
+LIB = librte_pmd_enic.a
+
+CFLAGS += -I$(RTE_SDK)/lib/librte_hash/ -I$(RTE_SDK)/lib/librte_pmd_enic/
+CFLAGS += -I$(RTE_SDK)/lib/librte_pmd_enic/vnic/
+CFLAGS += -O3 -Wno-deprecated
+
+VPATH += $(RTE_SDK)/lib/librte_pmd_enic/src
+
+#
+# all source are stored in SRCS-y
+#
+SRCS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += enic_main.c 
+SRCS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += enic_clsf.c 
+SRCS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += vnic/vnic_cq.c 
+SRCS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += vnic/vnic_wq.c 
+SRCS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += vnic/vnic_dev.c 
+SRCS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += vnic/vnic_intr.c 
+SRCS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += vnic/vnic_rq.c 
+SRCS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += enic_etherdev.c
+SRCS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += enic_res.c
+SRCS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += vnic/vnic_rss.c
+
+
+# this lib depends upon:
+DEPDIRS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += lib/librte_eal lib/librte_ether
+DEPDIRS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += lib/librte_mempool lib/librte_mbuf
+DEPDIRS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += lib/librte_net lib/librte_malloc
+
+include $(RTE_SDK)/mk/rte.lib.mk
+
-- 
1.9.1



[dpdk-dev] [PATCH v2 0/2] lib/librte_pmd_i40e: set vlan filter fix

2014-11-21 Thread Xie, Huawei
Hi Thomas:
Do you have issues applying this patch and vhost VMDQ patch?
Without this fix,  the vlan filter set willn't work.

-Huawei

> -Original Message-
> From: Chen, Jing D
> Sent: Monday, November 10, 2014 1:26 AM
> To: Xie, Huawei; dev at dpdk.org
> Subject: RE: [dpdk-dev] [PATCH v2 0/2] lib/librte_pmd_i40e: set vlan filter 
> fix
> 
> 
> 
> > -Original Message-
> > From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Huawei Xie
> > Sent: Monday, November 10, 2014 10:46 AM
> > To: dev at dpdk.org
> > Subject: [dpdk-dev] [PATCH v2 0/2] lib/librte_pmd_i40e: set vlan filter fix
> >
> > This patchset fixes "set vlan filter" issue.
> >
> > v2 changes:
> > * add two macros I40E_VFTA_IDX and I40E_VFTA_BIT for VFTA array
> > operation.
> >
> > Huawei Xie (2):
> >   vlan id set fix
> >   add I40E_VFTA_IDX and I40E_VFTA_BIT macros for VFTA related operation
> >
> >  lib/librte_pmd_i40e/i40e_ethdev.c | 20 ++--
> >  lib/librte_pmd_i40e/i40e_ethdev.h |  9 +
> >  2 files changed, 19 insertions(+), 10 deletions(-)
> >
> > --
> > 1.8.1.4
> 
> Acked-by : Jing Chen 


[dpdk-dev] [PATCH v6 09/22] mbuf: extend fdir field

2014-11-21 Thread Chilikin, Andrey
Me bad, missed wrapping union  :)

Thanks,
Andrey

-Original Message-
From: Ananyev, Konstantin 
Sent: Friday, November 21, 2014 7:35 PM
To: Chilikin, Andrey; Wu, Jingjing; dev at dpdk.org
Subject: RE: [dpdk-dev] [PATCH v6 09/22] mbuf: extend fdir field

Hi Andrey,

> -Original Message-
> From: Chilikin, Andrey
> Sent: Friday, November 21, 2014 5:03 PM
> To: Wu, Jingjing; dev at dpdk.org
> Cc: Ananyev, Konstantin
> Subject: RE: [dpdk-dev] [PATCH v6 09/22] mbuf: extend fdir field
> 
> This patch adds extra 32bits to rte_mbuf::hash

Yes.

>- so 'uint32_t usr' will move to the second cache line?
>

Why is that?
hash is a union, so:
offsetof(struct rte_mbuf, hash.rss) == offsetof(struct rte_mbuf, hash.usr) == 
44 before and after patch.

As there still exists free space before rte_mbuf::userdata, whole 
rte_mbuf::hash stays on the first cache line.
Konstantin


> Regards,
> Andrey
> 
> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Jingjing Wu
> Sent: Friday, November 21, 2014 12:47 AM
> To: dev at dpdk.org
> Subject: [dpdk-dev] [PATCH v6 09/22] mbuf: extend fdir field
> 
> fdir field in rte_mbuf is extened to support flex bytes reported when fdir 
> match.
> 8 flex bytes can be reported in maximum.
> The reported flex bytes are part of flexible payload.
> 
> Signed-off-by: jingjing.wu 
> ---
>  lib/librte_mbuf/rte_mbuf.h | 17 ++---
>  1 file changed, 14 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h 
> index f5f8658..5899e5c 100644
> --- a/lib/librte_mbuf/rte_mbuf.h
> +++ b/lib/librte_mbuf/rte_mbuf.h
> @@ -77,7 +77,7 @@ extern "C" {
>   */
>  #define PKT_RX_VLAN_PKT  (1ULL << 0)  /**< RX packet is a 802.1q VLAN 
> packet. */
>  #define PKT_RX_RSS_HASH  (1ULL << 1)  /**< RX packet with RSS hash 
> result. */
> -#define PKT_RX_FDIR  (1ULL << 2)  /**< RX packet with FDIR infos. */
> +#define PKT_RX_FDIR  (1ULL << 2)  /**< RX packet with FDIR match 
> indicate. */
>  #define PKT_RX_L4_CKSUM_BAD  (1ULL << 3)  /**< L4 cksum of RX pkt. is 
> not OK. */  #define PKT_RX_IP_CKSUM_BAD  (1ULL << 4) /**< IP cksum of 
> RX pkt. is not OK. */  #define PKT_RX_EIP_CKSUM_BAD (0ULL << 0)  /**< 
> External IP header checksum error. */ @@
> -93,6 +93,8 @@ extern "C" {  #define PKT_RX_IEEE1588_TMST (1ULL << 10) 
> /**< RX IEEE1588 L2/L4 timestamped packet.*/  #define 
> PKT_RX_TUNNEL_IPV4_HDR (1ULL << 11) /**< RX tunnel packet with IPv4 
> header.*/  #define PKT_RX_TUNNEL_IPV6_HDR (1ULL <<
> 12) /**< RX tunnel packet with IPv6 header. */
> +#define PKT_RX_FDIR_ID   (1ULL << 13) /**< FD id reported if FDIR match. 
> */
> +#define PKT_RX_FDIR_FLX  (1ULL << 14) /**< Flexible bytes reported if 
> FDIR match. */
> 
>  #define PKT_TX_VLAN_PKT  (1ULL << 55) /**< TX packet is a 802.1q VLAN 
> packet. */
>  #define PKT_TX_IP_CKSUM  (1ULL << 54) /**< IP cksum of TX pkt. computed 
> by NIC. */
> @@ -181,8 +183,17 @@ struct rte_mbuf {
>   union {
>   uint32_t rss; /**< RSS hash result if RSS enabled */
>   struct {
> - uint16_t hash;
> - uint16_t id;
> + union {
> + struct {
> + uint16_t hash;
> + uint16_t id;
> + };
> + uint32_t lo;
> + /**< Second 4 flexible bytes */
> + };
> + uint32_t hi;
> + /**< First 4 flexible bytes or FD ID, dependent on
> +  PKT_RX_FDIR_* flag in ol_flags. */
>   } fdir;   /**< Filter identifier if FDIR enabled */
>   uint32_t sched;   /**< Hierarchical scheduler */
>   uint32_t usr; /**< User defined tags. See 
> @rte_distributor_process */
> --
> 1.8.1.4



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

2014-11-21 Thread Thomas Monjalon
2014-11-21 17:07, Doherty, Declan:
> Hey Thomas, have you had a chance to have a look at this patchset, if you
> have any comments or issues can you let me know asap, as the patch sets for
> link bonding modes 4 & 5 are dependent on this set and I don't want to be
> blocking them from the next release candidate.

Declan, your patchset doesn't touch anything else than the bonding area
(except socket_id parameter in testpmd), it is acked and it has a test
report since today.
You are the author (and implicit maintainer) of bonding, so I consider
I don't need to review this patchset.

Conclusion: yes, it should be applied shortly.

-- 
Thomas


[dpdk-dev] [PATCH v6 09/22] mbuf: extend fdir field

2014-11-21 Thread Ananyev, Konstantin
Hi Andrey,

> -Original Message-
> From: Chilikin, Andrey
> Sent: Friday, November 21, 2014 5:03 PM
> To: Wu, Jingjing; dev at dpdk.org
> Cc: Ananyev, Konstantin
> Subject: RE: [dpdk-dev] [PATCH v6 09/22] mbuf: extend fdir field
> 
> This patch adds extra 32bits to rte_mbuf::hash 

Yes.

>- so 'uint32_t usr' will move to the second cache line?
>

Why is that?
hash is a union, so:
offsetof(struct rte_mbuf, hash.rss) == offsetof(struct rte_mbuf, hash.usr) == 44
before and after patch.

As there still exists free space before rte_mbuf::userdata, whole 
rte_mbuf::hash stays on the first cache line.
Konstantin


> Regards,
> Andrey
> 
> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Jingjing Wu
> Sent: Friday, November 21, 2014 12:47 AM
> To: dev at dpdk.org
> Subject: [dpdk-dev] [PATCH v6 09/22] mbuf: extend fdir field
> 
> fdir field in rte_mbuf is extened to support flex bytes reported when fdir 
> match.
> 8 flex bytes can be reported in maximum.
> The reported flex bytes are part of flexible payload.
> 
> Signed-off-by: jingjing.wu 
> ---
>  lib/librte_mbuf/rte_mbuf.h | 17 ++---
>  1 file changed, 14 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h index 
> f5f8658..5899e5c 100644
> --- a/lib/librte_mbuf/rte_mbuf.h
> +++ b/lib/librte_mbuf/rte_mbuf.h
> @@ -77,7 +77,7 @@ extern "C" {
>   */
>  #define PKT_RX_VLAN_PKT  (1ULL << 0)  /**< RX packet is a 802.1q VLAN 
> packet. */
>  #define PKT_RX_RSS_HASH  (1ULL << 1)  /**< RX packet with RSS hash 
> result. */
> -#define PKT_RX_FDIR  (1ULL << 2)  /**< RX packet with FDIR infos. */
> +#define PKT_RX_FDIR  (1ULL << 2)  /**< RX packet with FDIR match 
> indicate. */
>  #define PKT_RX_L4_CKSUM_BAD  (1ULL << 3)  /**< L4 cksum of RX pkt. is not 
> OK. */  #define PKT_RX_IP_CKSUM_BAD  (1ULL << 4)
> /**< IP cksum of RX pkt. is not OK. */  #define PKT_RX_EIP_CKSUM_BAD (0ULL << 
> 0)  /**< External IP header checksum error. */ @@
> -93,6 +93,8 @@ extern "C" {  #define PKT_RX_IEEE1588_TMST (1ULL << 10) /**< 
> RX IEEE1588 L2/L4 timestamped packet.*/  #define
> PKT_RX_TUNNEL_IPV4_HDR (1ULL << 11) /**< RX tunnel packet with IPv4 header.*/ 
>  #define PKT_RX_TUNNEL_IPV6_HDR (1ULL <<
> 12) /**< RX tunnel packet with IPv6 header. */
> +#define PKT_RX_FDIR_ID   (1ULL << 13) /**< FD id reported if FDIR match. 
> */
> +#define PKT_RX_FDIR_FLX  (1ULL << 14) /**< Flexible bytes reported if 
> FDIR match. */
> 
>  #define PKT_TX_VLAN_PKT  (1ULL << 55) /**< TX packet is a 802.1q VLAN 
> packet. */
>  #define PKT_TX_IP_CKSUM  (1ULL << 54) /**< IP cksum of TX pkt. computed 
> by NIC. */
> @@ -181,8 +183,17 @@ struct rte_mbuf {
>   union {
>   uint32_t rss; /**< RSS hash result if RSS enabled */
>   struct {
> - uint16_t hash;
> - uint16_t id;
> + union {
> + struct {
> + uint16_t hash;
> + uint16_t id;
> + };
> + uint32_t lo;
> + /**< Second 4 flexible bytes */
> + };
> + uint32_t hi;
> + /**< First 4 flexible bytes or FD ID, dependent on
> +  PKT_RX_FDIR_* flag in ol_flags. */
>   } fdir;   /**< Filter identifier if FDIR enabled */
>   uint32_t sched;   /**< Hierarchical scheduler */
>   uint32_t usr; /**< User defined tags. See 
> @rte_distributor_process */
> --
> 1.8.1.4



[dpdk-dev] Q on consolidating linuxapp/bsdapp in eal

2014-11-21 Thread Thomas Monjalon
2014-11-21 10:13, r k:
> Thanks to Thomas for providing some inputs on this.
> 
> I am looking at consolidating common code in linuxapp/bsdapp in
> librte_eal. I have started with header files and had some questions
> related to it.

Sorry, I didn't know you already start working on it.
I'm going to send a patchset with such cleanup because it's needed to
integrate some new options (from old pending patches).

Please wait my patchset to see what remains to clean-up.

Thanks
-- 
Thomas


[dpdk-dev] [PATCH v5 10/10] VM Power Management Unit Tests

2014-11-21 Thread Pablo de Lara
From: Alan Carew 

Updated the unit tests to cover both librte_power implementations as well as
the external API.

Signed-off-by: Alan Carew 
Signed-off-by: Pablo de Lara 
---
 app/test/Makefile  |3 +-
 app/test/autotest_data.py  |   26 ++
 app/test/test_power.c  |  445 +++---
 app/test/test_power_acpi_cpufreq.c |  544 
 app/test/test_power_kvm_vm.c   |  308 
 5 files changed, 917 insertions(+), 409 deletions(-)
 create mode 100644 app/test/test_power_acpi_cpufreq.c
 create mode 100644 app/test/test_power_kvm_vm.c

diff --git a/app/test/Makefile b/app/test/Makefile
index ebfa0ba..4b03f00 100644
--- a/app/test/Makefile
+++ b/app/test/Makefile
@@ -120,7 +120,8 @@ endif

 SRCS-$(CONFIG_RTE_LIBRTE_METER) += test_meter.c
 SRCS-$(CONFIG_RTE_LIBRTE_KNI) += test_kni.c
-SRCS-$(CONFIG_RTE_LIBRTE_POWER) += test_power.c
+SRCS-$(CONFIG_RTE_LIBRTE_POWER) += test_power.c test_power_acpi_cpufreq.c
+SRCS-$(CONFIG_RTE_LIBRTE_POWER) += test_power_kvm_vm.c
 SRCS-y += test_common.c
 SRCS-$(CONFIG_RTE_LIBRTE_IVSHMEM) += test_ivshmem.c

diff --git a/app/test/autotest_data.py b/app/test/autotest_data.py
index 878c72e..618a946 100644
--- a/app/test/autotest_data.py
+++ b/app/test/autotest_data.py
@@ -425,6 +425,32 @@ non_parallel_test_group_list = [
]
 },
 {
+   "Prefix" :  "power_acpi_cpufreq",
+   "Memory" :  all_sockets(512),
+   "Tests" :
+   [
+   {
+"Name" :   "Power ACPI cpufreq autotest",
+"Command" :"power_acpi_cpufreq_autotest",
+"Func" :   default_autotest,
+"Report" : None,
+   },
+   ]
+},
+{
+   "Prefix" :  "power_kvm_vm",
+   "Memory" :  "512",
+   "Tests" :
+   [
+   {
+"Name" :   "Power KVM VM  autotest",
+"Command" :"power_kvm_vm_autotest",
+"Func" :   default_autotest,
+"Report" : None,
+   },
+   ]
+},
+{
"Prefix" :  "lpm6",
"Memory" :  "512",
"Tests" :
diff --git a/app/test/test_power.c b/app/test/test_power.c
index d9eb420..64a2305 100644
--- a/app/test/test_power.c
+++ b/app/test/test_power.c
@@ -41,437 +41,66 @@

 #include 

-#define TEST_POWER_LCORE_ID  2U
-#define TEST_POWER_LCORE_INVALID ((unsigned)RTE_MAX_LCORE)
-#define TEST_POWER_FREQS_NUM_MAX ((unsigned)RTE_MAX_LCORE_FREQS)
-
-#define TEST_POWER_SYSFILE_CUR_FREQ \
-   "/sys/devices/system/cpu/cpu%u/cpufreq/scaling_cur_freq"
-
-static uint32_t total_freq_num;
-static uint32_t freqs[TEST_POWER_FREQS_NUM_MAX];
-
-static int
-check_cur_freq(unsigned lcore_id, uint32_t idx)
-{
-#define TEST_POWER_CONVERT_TO_DECIMAL 10
-   FILE *f;
-   char fullpath[PATH_MAX];
-   char buf[BUFSIZ];
-   uint32_t cur_freq;
-   int ret = -1;
-
-   if (snprintf(fullpath, sizeof(fullpath),
-   TEST_POWER_SYSFILE_CUR_FREQ, lcore_id) < 0) {
-   return 0;
-   }
-   f = fopen(fullpath, "r");
-   if (f == NULL) {
-   return 0;
-   }
-   if (fgets(buf, sizeof(buf), f) == NULL) {
-   goto fail_get_cur_freq;
-   }
-   cur_freq = strtoul(buf, NULL, TEST_POWER_CONVERT_TO_DECIMAL);
-   ret = (freqs[idx] == cur_freq ? 0 : -1);
-
-fail_get_cur_freq:
-   fclose(f);
-
-   return ret;
-}
-
-/* Check rte_power_freqs() */
-static int
-check_power_freqs(void)
-{
-   uint32_t ret;
-
-   total_freq_num = 0;
-   memset(freqs, 0, sizeof(freqs));
-
-   /* test with an invalid lcore id */
-   ret = rte_power_freqs(TEST_POWER_LCORE_INVALID, freqs,
-   TEST_POWER_FREQS_NUM_MAX);
-   if (ret > 0) {
-   printf("Unexpectedly get available freqs successfully on "
-   "lcore %u\n", TEST_POWER_LCORE_INVALID);
-   return -1;
-   }
-
-   /* test with NULL buffer to save available freqs */
-   ret = rte_power_freqs(TEST_POWER_LCORE_ID, NULL,
-   TEST_POWER_FREQS_NUM_MAX);
-   if (ret > 0) {
-   printf("Unexpectedly get available freqs successfully with "
-   "NULL buffer on lcore %u\n", TEST_POWER_LCORE_ID);
-   return -1;
-   }
-
-   /* test of getting zero number of freqs */
-   ret = rte_power_freqs(TEST_POWER_LCORE_ID, freqs, 0);
-   if (ret > 0) {
-   printf("Unexpectedly get available freqs successfully with "
-   "zero buffer size on lcore %u\n", TEST_POWER_LCORE_ID);
-   return -1;
-   }
-
-   /* test with all valid input parameters */
-   ret = rte_power_freqs(TEST_POWER_LCORE_ID, freqs,
-   TEST_POWER_FREQS_NUM_MAX);
-   if (ret == 0 || ret > 

[dpdk-dev] [PATCH v5 09/10] Build system integration for VM Power Management(Guest and Host)

2014-11-21 Thread Pablo de Lara
From: Alan Carew 

librte_power now contains both rte_power_acpi_cpufreq and rte_power_kvm_vm
implementations.

Signed-off-by: Alan Carew 
Signed-off-by: Pablo de Lara 
---
 lib/librte_power/Makefile |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/lib/librte_power/Makefile b/lib/librte_power/Makefile
index 6185812..d672a5a 100644
--- a/lib/librte_power/Makefile
+++ b/lib/librte_power/Makefile
@@ -37,7 +37,8 @@ LIB = librte_power.a
 CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3 -fno-strict-aliasing

 # all source are stored in SRCS-y
-SRCS-$(CONFIG_RTE_LIBRTE_POWER) := rte_power.c
+SRCS-$(CONFIG_RTE_LIBRTE_POWER) := rte_power.c rte_power_acpi_cpufreq.c
+SRCS-$(CONFIG_RTE_LIBRTE_POWER) += rte_power_kvm_vm.c guest_channel.c

 # install this header file
 SYMLINK-$(CONFIG_RTE_LIBRTE_POWER)-include := rte_power.h
-- 
1.7.4.1



[dpdk-dev] [PATCH v5 08/10] Packet format for VM Power Management(Host and Guest).

2014-11-21 Thread Pablo de Lara
From: Alan Carew 

Provides a command packet format for host and guest.

Signed-off-by: Alan Carew 
Signed-off-by: Pablo de Lara 
---
 lib/librte_power/channel_commands.h |   77 +++
 1 files changed, 77 insertions(+), 0 deletions(-)
 create mode 100644 lib/librte_power/channel_commands.h

diff --git a/lib/librte_power/channel_commands.h 
b/lib/librte_power/channel_commands.h
new file mode 100644
index 000..7e78a8b
--- /dev/null
+++ b/lib/librte_power/channel_commands.h
@@ -0,0 +1,77 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in
+ *   the documentation and/or other materials provided with the
+ *   distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ *   contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef CHANNEL_COMMANDS_H_
+#define CHANNEL_COMMANDS_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include 
+
+/* Maximum number of CPUs */
+#define CHANNEL_CMDS_MAX_CPUS64
+#if CHANNEL_CMDS_MAX_CPUS > 64
+#error Maximum number of cores is 64, overflow is guaranteed to \
+   cause problems with VM Power Management
+#endif
+
+/* Maximum number of channels per VM */
+#define CHANNEL_CMDS_MAX_VM_CHANNELS 64
+
+/* Maximum number of channels per VM */
+#define CHANNEL_CMDS_MAX_VM_CHANNELS 64
+
+/* Valid Commands */
+#define CPU_POWER   1
+#define CPU_POWER_CONNECT   2
+
+/* CPU Power Command Scaling */
+#define CPU_POWER_SCALE_UP  1
+#define CPU_POWER_SCALE_DOWN2
+#define CPU_POWER_SCALE_MAX 3
+#define CPU_POWER_SCALE_MIN 4
+
+struct channel_packet {
+   uint64_t resource_id; /**< core_num, device */
+   uint32_t unit;/**< scale down/up/min/max */
+   uint32_t command; /**< Power, IO, etc */
+};
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* CHANNEL_COMMANDS_H_ */
-- 
1.7.4.1



[dpdk-dev] [PATCH v5 07/10] librte_power common interface for Guest and Host

2014-11-21 Thread Pablo de Lara
From: Alan Carew 

Moved the current librte_power implementation to rte_power_acpi_cpufreq, with
renaming of functions only.
Added rte_power_kvm_vm implmentation to support Power Management from a VM.

librte_power now hides the implementation based on the environment used.
A new call rte_power_set_env() can explicidly set the environment, if not
called then auto-detection takes place.

rte_power_kvm_vm is subset of the librte_power APIs, the following is supported:
 rte_power_init(unsigned lcore_id)
 rte_power_exit(unsigned lcore_id)
 rte_power_freq_up(unsigned lcore_id)
 rte_power_freq_down(unsigned lcore_id)
 rte_power_freq_min(unsigned lcore_id)
 rte_power_freq_max(unsigned lcore_id)

The other unsupported APIs return -ENOTSUP

Signed-off-by: Alan Carew 
Signed-off-by: Pablo de Lara 
---
 lib/librte_power/rte_power.c  |  540 -
 lib/librte_power/rte_power.h  |  120 +--
 lib/librte_power/rte_power_acpi_cpufreq.c |  545 +
 lib/librte_power/rte_power_acpi_cpufreq.h |  192 ++
 lib/librte_power/rte_power_common.h   |   39 ++
 lib/librte_power/rte_power_kvm_vm.c   |  135 +++
 lib/librte_power/rte_power_kvm_vm.h   |  179 ++
 7 files changed, 1248 insertions(+), 502 deletions(-)
 create mode 100644 lib/librte_power/rte_power_acpi_cpufreq.c
 create mode 100644 lib/librte_power/rte_power_acpi_cpufreq.h
 create mode 100644 lib/librte_power/rte_power_common.h
 create mode 100644 lib/librte_power/rte_power_kvm_vm.c
 create mode 100644 lib/librte_power/rte_power_kvm_vm.h

diff --git a/lib/librte_power/rte_power.c b/lib/librte_power/rte_power.c
index 856da9a..998ed1c 100644
--- a/lib/librte_power/rte_power.c
+++ b/lib/librte_power/rte_power.c
@@ -31,515 +31,113 @@
  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */

-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include 
 #include 

 #include "rte_power.h"
+#include "rte_power_acpi_cpufreq.h"
+#include "rte_power_kvm_vm.h"
+#include "rte_power_common.h"

-#ifdef RTE_LIBRTE_POWER_DEBUG
-#define POWER_DEBUG_TRACE(fmt, args...) do { \
-   RTE_LOG(ERR, POWER, "%s: " fmt, __func__, ## args); \
-   } while (0)
-#else
-#define POWER_DEBUG_TRACE(fmt, args...)
-#endif
-
-#define FOPEN_OR_ERR_RET(f, retval) do { \
-   if ((f) == NULL) { \
-   RTE_LOG(ERR, POWER, "File not openned\n"); \
-   return (retval); \
-   } \
-} while(0)
-
-#define FOPS_OR_NULL_GOTO(ret, label) do { \
-   if ((ret) == NULL) { \
-   RTE_LOG(ERR, POWER, "fgets returns nothing\n"); \
-   goto label; \
-   } \
-} while(0)
-
-#define FOPS_OR_ERR_GOTO(ret, label) do { \
-   if ((ret) < 0) { \
-   RTE_LOG(ERR, POWER, "File operations failed\n"); \
-   goto label; \
-   } \
-} while(0)
-
-#define STR_SIZE 1024
-#define POWER_CONVERT_TO_DECIMAL 10
+enum power_management_env global_default_env = PM_ENV_NOT_SET;

-#define POWER_GOVERNOR_USERSPACE "userspace"
-#define POWER_SYSFILE_GOVERNOR   \
-   "/sys/devices/system/cpu/cpu%u/cpufreq/scaling_governor"
-#define POWER_SYSFILE_AVAIL_FREQ \
-   "/sys/devices/system/cpu/cpu%u/cpufreq/scaling_available_frequencies"
-#define POWER_SYSFILE_SETSPEED   \
-   "/sys/devices/system/cpu/cpu%u/cpufreq/scaling_setspeed"
+volatile uint32_t global_env_cfg_status = 0;

-enum power_state {
-   POWER_IDLE = 0,
-   POWER_ONGOING,
-   POWER_USED,
-   POWER_UNKNOWN
-};
+/* function pointers */
+rte_power_freqs_t rte_power_freqs  = NULL;
+rte_power_get_freq_t rte_power_get_freq = NULL;
+rte_power_set_freq_t rte_power_set_freq = NULL;
+rte_power_freq_change_t rte_power_freq_up = NULL;
+rte_power_freq_change_t rte_power_freq_down = NULL;
+rte_power_freq_change_t rte_power_freq_max = NULL;
+rte_power_freq_change_t rte_power_freq_min = NULL;

-/**
- * Power info per lcore.
- */
-struct rte_power_info {
-   unsigned lcore_id;   /**< Logical core id */
-   uint32_t freqs[RTE_MAX_LCORE_FREQS]; /**< Frequency array */
-   uint32_t nb_freqs;   /**< number of available freqs */
-   FILE *f; /**< FD of scaling_setspeed */
-   char governor_ori[32];   /**< Original governor name */
-   uint32_t curr_idx;   /**< Freq index in freqs array */
-   volatile uint32_t state; /**< Power in use state */
-} __rte_cache_aligned;
-
-static struct rte_power_info lcore_power_info[RTE_MAX_LCORE];
-
-/**
- * It is to set specific freq for specific logical core, according to the index
- * of supported frequencies.
- */
-static int
-set_freq_internal(struct rte_power_info *pi, uint32_t idx)
+int
+rte_power_set_env(enum power_management_env env)
 {
-   if (idx >= RTE_MAX_LCORE_FREQS || idx >= pi->nb_freqs) {
-   

[dpdk-dev] [PATCH v5 06/10] VM communication channels for VM Power Management(Guest).

2014-11-21 Thread Pablo de Lara
From: Alan Carew 

Allows for the opening of Virtio-Serial devices on a VM, where a DPDK
application can send packets to the host based monitor. The packet formatted is
specified in channel_commands.h
Each device appears as a serial device in path
/dev/virtio-ports/virtio.serial.port.. where each lcore
in a DPDK application has exclusive to a device/channel.
Each channel is opened in non-blocking mode, after a successful open a test
packet is send to the host to ensure the host side is monitoring.

Signed-off-by: Alan Carew 
Signed-off-by: Pablo de Lara 
---
 lib/librte_power/guest_channel.c |  162 ++
 lib/librte_power/guest_channel.h |   89 +
 2 files changed, 251 insertions(+), 0 deletions(-)
 create mode 100644 lib/librte_power/guest_channel.c
 create mode 100644 lib/librte_power/guest_channel.h

diff --git a/lib/librte_power/guest_channel.c b/lib/librte_power/guest_channel.c
new file mode 100644
index 000..2295665
--- /dev/null
+++ b/lib/librte_power/guest_channel.c
@@ -0,0 +1,162 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in
+ *   the documentation and/or other materials provided with the
+ *   distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ *   contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+
+#include 
+#include 
+
+#include "guest_channel.h"
+#include "channel_commands.h"
+
+#define RTE_LOGTYPE_GUEST_CHANNEL RTE_LOGTYPE_USER1
+
+static int global_fds[RTE_MAX_LCORE];
+
+int
+guest_channel_host_connect(const char *path, unsigned lcore_id)
+{
+   int flags, ret;
+   struct channel_packet pkt;
+   char fd_path[PATH_MAX];
+   int fd = -1;
+
+   if (lcore_id >= RTE_MAX_LCORE) {
+   RTE_LOG(ERR, GUEST_CHANNEL, "Channel(%u) is out of range 
0...%d\n",
+   lcore_id, RTE_MAX_LCORE-1);
+   return -1;
+   }
+   /* check if path is already open */
+   if (global_fds[lcore_id] != 0) {
+   RTE_LOG(ERR, GUEST_CHANNEL, "Channel(%u) is already open with 
fd %d\n",
+   lcore_id, global_fds[lcore_id]);
+   return -1;
+   }
+
+   snprintf(fd_path, PATH_MAX, "%s.%u", path, lcore_id);
+   RTE_LOG(INFO, GUEST_CHANNEL, "Opening channel '%s' for lcore %u\n",
+   fd_path, lcore_id);
+   fd = open(fd_path, O_RDWR);
+   if (fd < 0) {
+   RTE_LOG(ERR, GUEST_CHANNEL, "Unable to to connect to '%s' with 
error "
+   "%s\n", fd_path, strerror(errno));
+   return -1;
+   }
+
+   flags = fcntl(fd, F_GETFL, 0);
+   if (flags < 0) {
+   RTE_LOG(ERR, GUEST_CHANNEL, "Failed on fcntl get flags for file 
%s\n",
+   fd_path);
+   goto error;
+   }
+
+   flags |= O_NONBLOCK;
+   if (fcntl(fd, F_SETFL, flags) < 0) {
+   RTE_LOG(ERR, GUEST_CHANNEL, "Failed on setting non-blocking 
mode for "
+   "file %s", fd_path);
+   goto error;
+   }
+   /* QEMU needs a delay after connection */
+   sleep(1);
+
+   /* Send a test packet, this command is ignored by the host, but a 
successful
+* send indicates that the host endpoint is monitoring.
+*/
+   pkt.command = CPU_POWER_CONNECT;
+   global_fds[lcore_id] = 

[dpdk-dev] [PATCH v5 05/10] VM Power Management CLI(Guest).

2014-11-21 Thread Pablo de Lara
From: Alan Carew 

Provides a small sample application(guest_vm_power_mgr) to run on a VM.
The application is run by providing a core mask(-c) and number of memory
channels(-n). The core mask corresponds to the number of lcore channels to
attempt to open. A maximum of 64 channels per VM is allowed. The channels must
be monitored by the host.
After successful initialisation a CPU frequency command can be sent to the host
using:
set_cpu_freq  .

Signed-off-by: Alan Carew 
Signed-off-by: Pablo de Lara 
---
 examples/vm_power_manager/guest_cli/Makefile   |   56 +++
 examples/vm_power_manager/guest_cli/main.c |   87 +++
 examples/vm_power_manager/guest_cli/main.h |   52 +++
 .../guest_cli/vm_power_cli_guest.c |  155 
 .../guest_cli/vm_power_cli_guest.h |   55 +++
 5 files changed, 405 insertions(+), 0 deletions(-)
 create mode 100644 examples/vm_power_manager/guest_cli/Makefile
 create mode 100644 examples/vm_power_manager/guest_cli/main.c
 create mode 100644 examples/vm_power_manager/guest_cli/main.h
 create mode 100644 examples/vm_power_manager/guest_cli/vm_power_cli_guest.c
 create mode 100644 examples/vm_power_manager/guest_cli/vm_power_cli_guest.h

diff --git a/examples/vm_power_manager/guest_cli/Makefile 
b/examples/vm_power_manager/guest_cli/Makefile
new file mode 100644
index 000..0efb8b2
--- /dev/null
+++ b/examples/vm_power_manager/guest_cli/Makefile
@@ -0,0 +1,56 @@
+#   BSD LICENSE
+#
+#   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+#   All rights reserved.
+#
+#   Redistribution and use in source and binary forms, with or without
+#   modification, are permitted provided that the following conditions
+#   are met:
+#
+# * Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in
+#   the documentation and/or other materials provided with the
+#   distribution.
+# * Neither the name of Intel Corporation nor the names of its
+#   contributors may be used to endorse or promote products derived
+#   from this software without specific prior written permission.
+#
+#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+#   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+#   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+#   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+#   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+#   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+#   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+#   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+#   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ifeq ($(RTE_SDK),)
+$(error "Please define RTE_SDK environment variable")
+endif
+
+# Default target, can be overriden by command line or environment
+RTE_TARGET ?= x86_64-native-linuxapp-gcc
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+# binary name
+APP = guest_vm_power_mgr
+
+# all source are stored in SRCS-y
+SRCS-y := main.c vm_power_cli_guest.c
+
+CFLAGS += -O3 -I$(RTE_SDK)/lib/librte_power/
+CFLAGS += $(WERROR_FLAGS)
+
+# workaround for a gcc bug with noreturn attribute
+# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12603
+ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y)
+CFLAGS_main.o += -Wno-return-type
+endif
+
+include $(RTE_SDK)/mk/rte.extapp.mk
diff --git a/examples/vm_power_manager/guest_cli/main.c 
b/examples/vm_power_manager/guest_cli/main.c
new file mode 100644
index 000..1e4767a
--- /dev/null
+++ b/examples/vm_power_manager/guest_cli/main.c
@@ -0,0 +1,87 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in
+ *   the documentation and/or other materials provided with the
+ *   distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ *   contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ *   

[dpdk-dev] [PATCH v5 04/10] VM Power Management application and Makefile.

2014-11-21 Thread Pablo de Lara
From: Alan Carew 

For launching CLI thread and Monitor thread and initialising
resources.
Requires a minimum of two lcores to run, additional cores specified by eal core
mask are not used.

Signed-off-by: Alan Carew 
Signed-off-by: Pablo de Lara 
---
 examples/vm_power_manager/Makefile |   57 +
 examples/vm_power_manager/main.c   |  117 
 examples/vm_power_manager/main.h   |   52 
 3 files changed, 226 insertions(+), 0 deletions(-)
 create mode 100644 examples/vm_power_manager/Makefile
 create mode 100644 examples/vm_power_manager/main.c
 create mode 100644 examples/vm_power_manager/main.h

diff --git a/examples/vm_power_manager/Makefile 
b/examples/vm_power_manager/Makefile
new file mode 100644
index 000..0bf3cfc
--- /dev/null
+++ b/examples/vm_power_manager/Makefile
@@ -0,0 +1,57 @@
+#   BSD LICENSE
+#
+#   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+#   All rights reserved.
+#
+#   Redistribution and use in source and binary forms, with or without
+#   modification, are permitted provided that the following conditions
+#   are met:
+#
+# * Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in
+#   the documentation and/or other materials provided with the
+#   distribution.
+# * Neither the name of Intel Corporation nor the names of its
+#   contributors may be used to endorse or promote products derived
+#   from this software without specific prior written permission.
+#
+#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+#   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+#   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+#   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+#   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+#   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+#   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+#   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+#   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ifeq ($(RTE_SDK),)
+$(error "Please define RTE_SDK environment variable")
+endif
+
+# Default target, can be overriden by command line or environment
+RTE_TARGET ?= x86_64-native-linuxapp-gcc
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+# binary name
+APP = vm_power_mgr
+
+# all source are stored in SRCS-y
+SRCS-y := main.c vm_power_cli.c power_manager.c channel_manager.c
+SRCS-y += channel_monitor.c
+
+CFLAGS += -O3 -lvirt -I$(RTE_SDK)/lib/librte_power/
+CFLAGS += $(WERROR_FLAGS)
+
+# workaround for a gcc bug with noreturn attribute
+# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12603
+ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y)
+CFLAGS_main.o += -Wno-return-type
+endif
+
+include $(RTE_SDK)/mk/rte.extapp.mk
diff --git a/examples/vm_power_manager/main.c b/examples/vm_power_manager/main.c
new file mode 100644
index 000..875274e
--- /dev/null
+++ b/examples/vm_power_manager/main.c
@@ -0,0 +1,117 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in
+ *   the documentation and/or other materials provided with the
+ *   distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ *   contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF 

[dpdk-dev] [PATCH v5 03/10] CPU Frequency Power Management(Host).

2014-11-21 Thread Pablo de Lara
From: Alan Carew 

A wrapper around librte_power(using ACPI cpufreq), providing locking around the
non-threadsafe library, allowing for frequency changes based on core masks and
core numbers from both the CLI thread and epoll monitor thread.

Signed-off-by: Alan Carew 
Signed-off-by: Pablo de Lara 
---
 examples/vm_power_manager/power_manager.c |  244 +
 examples/vm_power_manager/power_manager.h |  188 ++
 2 files changed, 432 insertions(+), 0 deletions(-)
 create mode 100644 examples/vm_power_manager/power_manager.c
 create mode 100644 examples/vm_power_manager/power_manager.h

diff --git a/examples/vm_power_manager/power_manager.c 
b/examples/vm_power_manager/power_manager.c
new file mode 100644
index 000..b7b1fca
--- /dev/null
+++ b/examples/vm_power_manager/power_manager.c
@@ -0,0 +1,244 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in
+ *   the documentation and/or other materials provided with the
+ *   distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ *   contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include "power_manager.h"
+
+#define RTE_LOGTYPE_POWER_MANAGER RTE_LOGTYPE_USER1
+
+#define POWER_SCALE_CORE(DIRECTION, core_num , ret) do { \
+   if (core_num >= POWER_MGR_MAX_CPUS) \
+   return -1; \
+   if (!(global_enabled_cpus & (1ULL << core_num))) \
+   return -1; \
+   rte_spinlock_lock(_core_freq_info[core_num].power_sl); \
+   ret = rte_power_freq_##DIRECTION(core_num); \
+   rte_spinlock_unlock(_core_freq_info[core_num].power_sl); \
+} while (0)
+
+#define POWER_SCALE_MASK(DIRECTION, core_mask, ret) do { \
+   int i; \
+   for (i = 0; core_mask; core_mask &= ~(1 << i++)) { \
+   if ((core_mask >> i) & 1) { \
+   if (!(global_enabled_cpus & (1ULL << i))) \
+   continue; \
+   rte_spinlock_lock(_core_freq_info[i].power_sl); \
+   if (rte_power_freq_##DIRECTION(i) != 1) \
+   ret = -1; \
+   rte_spinlock_unlock(_core_freq_info[i].power_sl); \
+   } \
+   } \
+} while (0)
+
+struct freq_info {
+   rte_spinlock_t power_sl;
+   uint32_t freqs[RTE_MAX_LCORE_FREQS];
+   unsigned num_freqs;
+} __rte_cache_aligned;
+
+static struct freq_info global_core_freq_info[POWER_MGR_MAX_CPUS];
+
+static uint64_t global_enabled_cpus;
+
+#define SYSFS_CPU_PATH "/sys/devices/system/cpu/cpu%u/topology/core_id"
+
+static unsigned
+set_host_cpus_mask(void)
+{
+   char path[PATH_MAX];
+   unsigned i;
+   unsigned num_cpus = 0;
+   for (i = 0; i < POWER_MGR_MAX_CPUS; i++) {
+   snprintf(path, sizeof(path), SYSFS_CPU_PATH, i);
+   if (access(path, F_OK) == 0) {
+   global_enabled_cpus |= 1ULL << i;
+   num_cpus++;
+   } else
+   return num_cpus;
+   }
+   return num_cpus;
+}
+
+int
+power_manager_init(void)
+{
+   unsigned i, num_cpus;
+   uint64_t cpu_mask;
+   int ret = 0;
+
+   num_cpus = set_host_cpus_mask();
+   if (num_cpus == 0) {
+   RTE_LOG(ERR, POWER_MANAGER, "Unable to detected host CPUs, 
please "
+   "ensure that sufficient privileges 

[dpdk-dev] [PATCH v5 02/10] VM Power Management CLI(Host).

2014-11-21 Thread Pablo de Lara
From: Alan Carew 

The CLI is used for administrating the channel monitor and manager and
manually setting the CPU frequency on the host.

Supports the following commands:
 add_vm [Mul-choice STRING]: add_vm|rm_vm , add a VM for subsequent
  operations with the CLI or remove a previously added VM from the VM Power
  Manager

 rm_vm [Mul-choice STRING]: add_vm|rm_vm , add a VM for subsequent
  operations with the CLI or remove a previously added VM from the VM Power
  Manager

 add_channels [Fixed STRING]: add_channels  |all, add
  communication channels for the specified VM, the virtio channels must be
  enabled in the VM configuration(qemu/libvirt) and the associated VM must be
  active.  is a comma-separated list of channel numbers to add, using the
  keyword 'all' will attempt to add all channels for the VM

 set_channel_status [Fixed STRING]:
  set_channel_status  |all enabled|disabled,  enable or disable
  the communication channels in list(comma-seperated) for the specified VM,
  alternatively list can be replaced with keyword 'all'. Disabled channels will
  still receive packets on the host, however the commands they specify will be
  ignored. Set status to 'enabled' to begin processing requests again.

 show_vm [Fixed STRING]: show_vm , prints the information on the
  specified VM(s), the information lists the number of vCPUS, the pinning to
  pCPU(s) as a bit mask, along with any communication channels associated with
  each VM

 show_cpu_freq_mask [Fixed STRING]: show_cpu_freq_mask , Get the current
  frequency for each core specified in the mask

 set_cpu_freq_mask [Fixed STRING]: set_cpu_freq  ,
  Set the current frequency for the cores specified in  by scaling
  each up/down/min/max.

 show_cpu_freq [Fixed STRING]: Get the current frequency for the specified core

 set_cpu_freq [Fixed STRING]: set_cpu_freq  ,
  Set the current frequency for the specified core by scaling up/down/min/max

 quit [Fixed STRING]: close the application

Signed-off-by: Alan Carew 
Signed-off-by: Pablo de Lara 
---
 examples/vm_power_manager/vm_power_cli.c |  669 ++
 examples/vm_power_manager/vm_power_cli.h |   47 ++
 2 files changed, 716 insertions(+), 0 deletions(-)
 create mode 100644 examples/vm_power_manager/vm_power_cli.c
 create mode 100644 examples/vm_power_manager/vm_power_cli.h

diff --git a/examples/vm_power_manager/vm_power_cli.c 
b/examples/vm_power_manager/vm_power_cli.c
new file mode 100644
index 000..e162e88
--- /dev/null
+++ b/examples/vm_power_manager/vm_power_cli.c
@@ -0,0 +1,669 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in
+ *   the documentation and/or other materials provided with the
+ *   distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ *   contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "vm_power_cli.h"
+#include "channel_manager.h"
+#include "channel_monitor.h"
+#include "power_manager.h"
+#include "channel_commands.h"
+
+struct cmd_quit_result {
+   cmdline_fixed_string_t quit;
+};
+
+static void cmd_quit_parsed(__attribute__((unused)) void *parsed_result,
+   struct cmdline *cl,
+   __attribute__((unused)) void *data)
+{
+   channel_monitor_exit();
+   channel_manager_exit();
+   power_manager_exit();
+   

[dpdk-dev] [PATCH v5 01/10] Channel Manager and Monitor for VM Power Management(Host).

2014-11-21 Thread Pablo de Lara
From: Alan Carew 

The manager is responsible for adding communications channels to the Monitor
thread, tracking and reporting VM state and employs the libvirt API for
synchronization with the KVM Hypervisor. The manager interacts with the
Hypervisor to discover the mapping of virtual CPUS(vCPUs) to the host
physical CPUS(pCPUs) and to inspect the VM running state.

The manager provides the following functionality to the CLI:
1) Connect to a libvirtd instance, default: qemu:///system
2) Add a VM to an internal list, each VM is identified by a "name" which must
   correspond a valid libvirt Domain Name.
3) Add communication channels associated with a VM to the epoll based Monitor
   thread.
   The channels must exist and be in the form of:
   /tmp/powermonitor/.. Each channel is a
   Virtio-Serial endpoint configured as an AF_UNIX file socket and opened in
   non-blocking mode.
   Each VM can have a maximum of 64 channels associated with it.
4) Disable or re-enable VM communication channels, channels once added to the
   Monitor thread remain in that threads control, however acting on channel
   requests can be disabled and renabled via CLI.

The monitor is an epoll based infinite loop running in a separate thread that
waits on channel events from VMs and calls the corresponding functions. Channel
definitions from the manager are registered via the epoll event opaque pointer
when calling epoll_ctl(EPOLL_CTL_ADD), this allows for obtaining the channels
file descriptor for reading EPOLLIN events and mapping the vCPU to pCPU(s)
associated with a request from a particular VM.

Signed-off-by: Alan Carew 
Signed-off-by: Pablo de Lara 
---
 examples/vm_power_manager/channel_manager.c |  804 +++
 examples/vm_power_manager/channel_manager.h |  314 +++
 examples/vm_power_manager/channel_monitor.c |  231 
 examples/vm_power_manager/channel_monitor.h |  102 
 4 files changed, 1451 insertions(+), 0 deletions(-)
 create mode 100644 examples/vm_power_manager/channel_manager.c
 create mode 100644 examples/vm_power_manager/channel_manager.h
 create mode 100644 examples/vm_power_manager/channel_monitor.c
 create mode 100644 examples/vm_power_manager/channel_monitor.h

diff --git a/examples/vm_power_manager/channel_manager.c 
b/examples/vm_power_manager/channel_manager.c
new file mode 100644
index 000..a14f191
--- /dev/null
+++ b/examples/vm_power_manager/channel_manager.c
@@ -0,0 +1,804 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in
+ *   the documentation and/or other materials provided with the
+ *   distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ *   contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include "channel_manager.h"
+#include "channel_commands.h"
+#include "channel_monitor.h"
+
+
+#define RTE_LOGTYPE_CHANNEL_MANAGER RTE_LOGTYPE_USER1
+
+#define ITERATIVE_BITMASK_CHECK_64(mask_u64b, i) \
+   for (i = 0; mask_u64b; mask_u64b &= ~(1ULL << i++)) \
+   if ((mask_u64b >> i) & 1) \
+
+/* Global pointer to libvirt connection */
+static virConnectPtr global_vir_conn_ptr;
+
+static unsigned char *global_cpumaps;
+static virVcpuInfo *global_vircpuinfo;
+static size_t global_maplen;
+
+static unsigned global_n_host_cpus;
+

[dpdk-dev] [PATCH v5 00/10] Virtual Machine Power Management

2014-11-21 Thread Pablo de Lara
Virtual Machine Power Management.

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.

General Overview:(more information in each patch that follows).
The VM Power Management solution provides two components:

 1)VM: Allows for the a DPDK application in a VM to reuse the librte_power
 interface. Each lcore opens a Virto-Serial endpoint channel to the host,
 where the re-implementation of librte_power simply forwards the requests for
 frequency change to a host based monitor. The host monitor itself uses
 librte_power.
 Each lcore channel corresponds to a
 serial device '/dev/virtio-ports/virtio.serial.port.poweragent.'
 which is opened in non-blocking mode.
 While each Virtual CPU can be mapped to multiple physical CPUs it is
 recommended that each vCPU should be mapped to a single core only.

 2)Host: The host monitor is managed by a CLI, it allows for adding qemu/KVM
 virtual machines and associated channels to the monitor, manually changing
 CPU frequency, inspecting the state of VMs, vCPU to pCPU pinning and managing
 channels.
 Host channel endpoints are Virto-Serial endpoints configured as AF_UNIX file
 sockets which follow a specific naming convention
 i.e /tmp/powermonitor/.,
 each channel has an 1:1 mapping to a VM endpoint
 i.e. /dev/virtio-ports/virtio.serial.port.poweragent.
 Host channel endpoints are opened in non-blocking mode and are monitored via 
epoll.
 Requests over each channel to change frequency are forwarded to the original
 librte_power.

Channels must be manually configured as qemu-kvm command line arguments or
libvirt domain definition(xml) e.g.

 


  
  


Where multiple channels can be configured by specifying multiple 
elements, by replacing , .
(port number) should be incremented by 1 for each new channel element.
More information on Virtio-Serial can be found here:
http://fedoraproject.org/wiki/Features/VirtioSerial
To enable the Hypervisor creation of channels, the host endpoint directory
must be created with qemu permissions:
mkdir /tmp/powermonitor
chown qemu:qemu /tmp/powermonitor

The host application runs on two separate lcores:
Core N) CLI: For management of Virtual Machines adding channels to Monitor 
thread,
 inspecting state and manually setting CPU frequency [PATCH 02/09]
Core N+1) Monitor Thread: An epoll based infinite loop that waits on channel 
events
 from VMs and calls the corresponding librte_power functions.

A sample application is also provided to run on Virtual Machines, this
application provides a CLI to manually set the frequency of a 
vCPU[PATCH 08/09]

The current l3fwd-power sample application can also be run on a VM.
Changes in V5:
 Fixed default target in sample app Makefiles

Changes in V4:
 Fixed double free of channel during VM shutdown.

Changes in V3:
 Fixed crash in Guest CLI when host application is not running.
 Renamed #defines to be more specific to the module they belong
 Added vCPU pinning via CLI

Changes in V2:
 Runtime selection of librte_power implementations.
 Updated Unit tests to cover librte_power changes.
 PATCH[0/3] was sent twice, again as PATCH[0/4]
 Miscellaneous fixes.

Alan Carew (10):
  Channel Manager and Monitor for VM Power Management(Host).
  VM Power Management CLI(Host).
  CPU Frequency Power Management(Host).
  VM Power Management application and Makefile.
  VM Power Management CLI(Guest).
  VM communication channels for VM Power Management(Guest).
  librte_power common interface for Guest and Host
  Packet format for VM Power Management(Host and Guest).
  Build system integration for VM Power Management(Guest and Host)
  VM Power Management Unit Tests

 app/test/Makefile  |3 +-
 app/test/autotest_data.py  |   26 +
 app/test/test_power.c  |  445 +--
 app/test/test_power_acpi_cpufreq.c |  544 +
 app/test/test_power_kvm_vm.c   |  308 
 examples/vm_power_manager/Makefile |   57 ++
 examples/vm_power_manager/channel_manager.c|  804 
 examples/vm_power_manager/channel_manager.h|  314 
 examples/vm_power_manager/channel_monitor.c|  231 ++
 examples/vm_power_manager/channel_monitor.h|  102 +++
 examples/vm_power_manager/guest_cli/Makefile   |   56 ++
 examples/vm_power_manager/guest_cli/main.c |   87 +++
 examples/vm_power_manager/guest_cli/main.h |   52 ++
 .../guest_cli/vm_power_cli_guest.c |  155 
 

[dpdk-dev] [PATCH v5 4/7] hash: add rte_hash_crc_8byte function

2014-11-21 Thread Yerden Zhumabekov

21.11.2014 17:22, Neil Horman ?:
> On Thu, Nov 20, 2014 at 11:16:34AM +0600, Yerden Zhumabekov wrote:
>> SSE4.2 provides CRC32 intrinsic with 8-byte operand.
>>
>> Signed-off-by: Yerden Zhumabekov 
>> ---
>>  lib/librte_hash/rte_hash_crc.h |   16 
>>  1 file changed, 16 insertions(+)
>>
>> diff --git a/lib/librte_hash/rte_hash_crc.h b/lib/librte_hash/rte_hash_crc.h
>> index cd28833..2c8ec99 100644
>> --- a/lib/librte_hash/rte_hash_crc.h
>> +++ b/lib/librte_hash/rte_hash_crc.h
>> @@ -413,6 +413,22 @@ rte_hash_crc_4byte(uint32_t data, uint32_t init_val)
>>  }
>>  
>>  /**
>> + * Use single crc32 instruction to perform a hash on a 8 byte value.
>> + *
>> + * @param data
>> + *   Data to perform hash on.
>> + * @param init_val
>> + *   Value to initialise hash generator.
>> + * @return
>> + *   32bit calculated hash value.
>> + */
>> +static inline uint32_t
>> +rte_hash_crc_8byte(uint64_t data, uint32_t init_val)
>> +{
>> +return crc32c_sse42_u64(data, init_val);
>> +}
>> +
>> +/**
>>   * Use crc32 instruction to perform a hash.
>>   *
>>   * @param data
>> -- 
>> 1.7.9.5
>>
>>
> I'm sorry, it may be early here, so I may be missing something. The assembly
> implementations look great, but if a user calls rte_hash_crc_8byte on a system
> that doesn't support ss342, how do they wind up getting into the software crc
> implementation given what you have above?
> Neil

After applying patch 4 out of 7 - there's no fall back.  Fall back to SW
crc32 algorithm is in patch 5/7.

Moreover, after patch 5/7  there's a detection if the platform supports
64-bit, otherwise 64-bit operand support is mimicked using two 32-bit
function calls.

-- 
Sincerely,

Yerden Zhumabekov
State Technical Service
Astana, KZ



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

2014-11-21 Thread Doherty, Declan
Hey Thomas, have you had a chance to have a look at this patchset, if you have 
any comments or issues can you let me know asap, as the patch sets for link 
bonding modes 4 & 5 are dependent on this set and I don't want to be blocking 
them from the next release candidate.

Thanks 
Declan

> -Original Message-
> From: De Lara Guarch, Pablo
> Sent: Friday, November 7, 2014 4:41 PM
> To: Doherty, Declan; dev at dpdk.org
> Cc: thomas.monjalon at 6wind.com
> Subject: RE: [PATCH v6 0/8] link bonding
> 
> 
> 
> > -Original Message-
> > From: Doherty, Declan
> > Sent: Friday, November 07, 2014 12:23 PM
> > To: dev at dpdk.org
> > Cc: De Lara Guarch, Pablo; thomas.monjalon at 6wind.com; Doherty, Declan
> > Subject: [PATCH v6 0/8] link bonding
> >
> > v6:
> > - Re-based to dpdk.org addressing associated issues for MBUF_REFCNT
> > - Added details to testpmd user guide for new command to set link status
> > polling interval.
> >
> > 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| 3347 
> > ++-
> >  app/test/virtual_pmd.c  |   96 +-
> >  app/test/virtual_pmd.h  |   53 +-
> >  doc/guides/testpmd_app_ug/testpmd_funcs.rst |   19 +
> >  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 |   28 +-
> >  lib/librte_pmd_bond/rte_eth_bond_pmd.c  |  553 +++--
> >  lib/librte_pmd_bond/rte_eth_bond_private.h  |   71 +-
> >  15 files changed, 2715 insertions(+), 1959 deletions(-)
> >
> > --
> > 1.7.12.2
> 
> Acked-by: Pablo de Lara 


[dpdk-dev] [PATCH v6 09/22] mbuf: extend fdir field

2014-11-21 Thread Chilikin, Andrey
This patch adds extra 32bits to rte_mbuf::hash - so 'uint32_t usr' will move to 
the second cache line?

Regards,
Andrey

-Original Message-
From: dev [mailto:dev-boun...@dpdk.org] On Behalf Of Jingjing Wu
Sent: Friday, November 21, 2014 12:47 AM
To: dev at dpdk.org
Subject: [dpdk-dev] [PATCH v6 09/22] mbuf: extend fdir field

fdir field in rte_mbuf is extened to support flex bytes reported when fdir 
match.
8 flex bytes can be reported in maximum.
The reported flex bytes are part of flexible payload.

Signed-off-by: jingjing.wu 
---
 lib/librte_mbuf/rte_mbuf.h | 17 ++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h index 
f5f8658..5899e5c 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -77,7 +77,7 @@ extern "C" {
  */
 #define PKT_RX_VLAN_PKT  (1ULL << 0)  /**< RX packet is a 802.1q VLAN 
packet. */
 #define PKT_RX_RSS_HASH  (1ULL << 1)  /**< RX packet with RSS hash result. 
*/
-#define PKT_RX_FDIR  (1ULL << 2)  /**< RX packet with FDIR infos. */
+#define PKT_RX_FDIR  (1ULL << 2)  /**< RX packet with FDIR match 
indicate. */
 #define PKT_RX_L4_CKSUM_BAD  (1ULL << 3)  /**< L4 cksum of RX pkt. is not OK. 
*/  #define PKT_RX_IP_CKSUM_BAD  (1ULL << 4)  /**< IP cksum of RX pkt. is not 
OK. */  #define PKT_RX_EIP_CKSUM_BAD (0ULL << 0)  /**< External IP header 
checksum error. */ @@ -93,6 +93,8 @@ extern "C" {  #define PKT_RX_IEEE1588_TMST 
(1ULL << 10) /**< RX IEEE1588 L2/L4 timestamped packet.*/  #define 
PKT_RX_TUNNEL_IPV4_HDR (1ULL << 11) /**< RX tunnel packet with IPv4 header.*/  
#define PKT_RX_TUNNEL_IPV6_HDR (1ULL << 12) /**< RX tunnel packet with IPv6 
header. */
+#define PKT_RX_FDIR_ID   (1ULL << 13) /**< FD id reported if FDIR match. */
+#define PKT_RX_FDIR_FLX  (1ULL << 14) /**< Flexible bytes reported if FDIR 
match. */

 #define PKT_TX_VLAN_PKT  (1ULL << 55) /**< TX packet is a 802.1q VLAN 
packet. */
 #define PKT_TX_IP_CKSUM  (1ULL << 54) /**< IP cksum of TX pkt. computed by 
NIC. */
@@ -181,8 +183,17 @@ struct rte_mbuf {
union {
uint32_t rss; /**< RSS hash result if RSS enabled */
struct {
-   uint16_t hash;
-   uint16_t id;
+   union {
+   struct {
+   uint16_t hash;
+   uint16_t id;
+   };
+   uint32_t lo;
+   /**< Second 4 flexible bytes */
+   };
+   uint32_t hi;
+   /**< First 4 flexible bytes or FD ID, dependent on
+PKT_RX_FDIR_* flag in ol_flags. */
} fdir;   /**< Filter identifier if FDIR enabled */
uint32_t sched;   /**< Hierarchical scheduler */
uint32_t usr; /**< User defined tags. See 
@rte_distributor_process */
--
1.8.1.4



[dpdk-dev] [PATCH v3] i40e: fixed tx packets stats bug

2014-11-21 Thread zhida zang
v3 changes:
-updated commit log
-fixed the bug that stats data can't be cleared

Signed-off-by: Zhida Zang 
---
 lib/librte_pmd_i40e/i40e_ethdev.c | 10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/lib/librte_pmd_i40e/i40e_ethdev.c 
b/lib/librte_pmd_i40e/i40e_ethdev.c
index 4b7a827..c1ea37e 100644
--- a/lib/librte_pmd_i40e/i40e_ethdev.c
+++ b/lib/librte_pmd_i40e/i40e_ethdev.c
@@ -1102,6 +1102,7 @@ i40e_dev_stats_get(struct rte_eth_dev *dev, struct 
rte_eth_stats *stats)
struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
struct i40e_hw_port_stats *ns = >stats; /* new stats */
struct i40e_hw_port_stats *os = >stats_offset; /* old stats */
+   struct i40e_eth_stats *ves = >main_vsi->eth_stats; /* vsi stats */

/* Get statistics of struct i40e_eth_stats */
i40e_stat_update_48(hw, I40E_GLPRT_GORCH(hw->port),
@@ -1277,15 +1278,18 @@ i40e_dev_stats_get(struct rte_eth_dev *dev, struct 
rte_eth_stats *stats)
/* GLPRT_MSPDC not supported */
/* GLPRT_XEC not supported */

-   pf->offset_loaded = true;
-
if (pf->main_vsi)
i40e_update_vsi_stats(pf->main_vsi);

stats->ipackets = ns->eth.rx_unicast + ns->eth.rx_multicast +
ns->eth.rx_broadcast;
-   stats->opackets = ns->eth.tx_unicast + ns->eth.tx_multicast +
+   if (pf->offset_loaded)
+   stats->opackets = ves->tx_unicast + ves->tx_multicast +
+   ves->tx_broadcast;
+   else
+   stats->opackets = ns->eth.tx_unicast + ns->eth.tx_multicast +
ns->eth.tx_broadcast;
+   pf->offset_loaded = true;
stats->ibytes   = ns->eth.rx_bytes;
stats->obytes   = ns->eth.tx_bytes;
stats->oerrors  = ns->eth.tx_errors;
-- 
1.9.3



[dpdk-dev] [PATCH v2 5/6] DPDK-ENIC PMD interface

2014-11-21 Thread Sujith Sankar (ssujith)
Thanks for the comments, Neil.  I shall include those in v3.

Regards,
-Sujith

On 21/11/14 6:54 pm, "Neil Horman"  wrote:

>On Fri, Nov 21, 2014 at 10:03:02PM +0530, Sujith Sankar wrote:
>> Signed-off-by: Sujith Sankar 
>> ---
>>  lib/librte_pmd_enic/enic_etherdev.c | 620
>>
>>  1 file changed, 620 insertions(+)
>>  create mode 100644 lib/librte_pmd_enic/enic_etherdev.c
>> 
>> diff --git a/lib/librte_pmd_enic/enic_etherdev.c
>>b/lib/librte_pmd_enic/enic_etherdev.c
>> new file mode 100644
>> index 000..90003f5
>> --- /dev/null
>> +++ b/lib/librte_pmd_enic/enic_etherdev.c
>> @@ -0,0 +1,620 @@
>> +/*
>> + * Copyright 2008-2014 Cisco Systems, Inc.  All rights reserved.
>> + * Copyright 2007 Nuova Systems, Inc.  All rights reserved.
>> + *
>> + * Copyright (c) 2014, Cisco Systems, Inc.
>> + * All rights reserved.
>> + *
>> + * Redistribution and use in source and binary forms, with or without
>> + * modification, are permitted provided that the following conditions
>> + * are met:
>> + *
>> + * 1. Redistributions of source code must retain the above copyright
>> + * notice, this list of conditions and the following disclaimer.
>> + *
>> + * 2. Redistributions in binary form must reproduce the above copyright
>> + * notice, this list of conditions and the following disclaimer in
>> + * the documentation and/or other materials provided with the
>> + * distribution.
>> + *
>> + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
>> + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
>> + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
>> + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
>> + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
>> + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
>> + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
>> + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
>> + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
>> + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
>> + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
>> + * POSSIBILITY OF SUCH DAMAGE.
>> + *
>> + */
>> +#ident "$Id$"
>> +
>> +#include 
>> +#include 
>> +
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +
>> +#include "vnic_intr.h"
>> +#include "vnic_cq.h"
>> +#include "vnic_wq.h"
>> +#include "vnic_rq.h"
>> +#include "vnic_enet.h"
>> +#include "enic.h"
>> +
>> +#ifdef RTE_LIBRTE_ENIC_PMD_DEBUG_TRACE
>> +#define ENICPMD_FUNC_TRACE()\
>> +do { \
>> +dev_trace(enic, "Entering %s\n", __func__);   \
>> +} while (0)
>You probably want to convert this to use:
>rte_log(RTE_LOG_DEBUG, RTE_LOGTYPE_PMD, ...)
>Currently you have dev_trace defined to printf, which won't work well on
>systems
>that have stdout/err closed.
>
>Also, you don't need the do{}while(0) construct here just don't add the
>semicolon after the rte_log call, and you'll get the same behavior
>
>converting to rte_log will also let you remove the DEBUG_TRACE ifdef as
>you can
>just enable PMD log types and DEBUG log levels via the log api
>
>> +#else
>> +#define ENICPMD_FUNC_TRACE()
>> +#endif
>> +
>> +
>> +/*
>> + * The set of PCI devices this driver supports
>> + */
>> +static struct rte_pci_id pci_id_enic_map[] = {
>> +#define RTE_PCI_DEV_ID_DECL_ENIC(vend, dev) {RTE_PCI_DEVICE(vend,
>>dev)},
>> +#ifndef PCI_VENDOR_ID_CISCO
>> +#define PCI_VENDOR_ID_CISCO 0x1137
>> +#endif
>> +#include "rte_pci_dev_ids.h"
>> +RTE_PCI_DEV_ID_DECL_ENIC(PCI_VENDOR_ID_CISCO,
>>PCI_DEVICE_ID_CISCO_VIC_ENET)
>> +RTE_PCI_DEV_ID_DECL_ENIC(PCI_VENDOR_ID_CISCO,
>>PCI_DEVICE_ID_CISCO_VIC_ENET_VF)
>> +{.vendor_id = 0, /* Sentinal */},
>> +};
>> +
>> +int enicpmd_fdir_remove_perfect_filter(struct rte_eth_dev *eth_dev,
>> +struct rte_fdir_filter *fdir_filter,
>> +uint16_t soft_id)
>> +{
>> +struct enic *enic = pmd_priv(eth_dev);
>> +
>> +ENICPMD_FUNC_TRACE();
>> +return enic_fdir_del_fltr(enic, fdir_filter);
>> +}
>> +
>> +int enicpmd_fdir_add_perfect_filter(struct rte_eth_dev *eth_dev,
>> +struct rte_fdir_filter *fdir_filter, uint16_t soft_id,
>> +uint8_t queue, uint8_t drop)
>> +{
>> +struct enic *enic = pmd_priv(eth_dev);
>> +
>> +ENICPMD_FUNC_TRACE();
>> +return enic_fdir_add_fltr(enic, fdir_filter, (uint16_t)queue, drop);
>> +}
>> +
>> +void enicpmd_fdir_info_get(struct rte_eth_dev *eth_dev,
>> +struct rte_eth_fdir *fdir)
>> +{
>> +struct enic *enic = pmd_priv(eth_dev);
>> +
>> +ENICPMD_FUNC_TRACE();
>> +*fdir = enic->fdir.stats;
>> +}
>> +
>The three functions above should be static, as their exported via the
>device
>structure below.  You don't want people able to call them directly.
>
>> +void enicpmd_dev_tx_queue_release(void *txq)
>> +{
>> +ENICPMD_FUNC_TRACE();
>> +

[dpdk-dev] [PATCH v2 2/6] ENIC PMD Makefile

2014-11-21 Thread Sujith Sankar (ssujith)


On 21/11/14 5:03 pm, "Neil Horman"  wrote:

>On Fri, Nov 21, 2014 at 10:02:59PM +0530, Sujith Sankar wrote:
>> Signed-off-by: Sujith Sankar 
>> ---
>>  lib/librte_pmd_enic/Makefile | 67
>>
>>  1 file changed, 67 insertions(+)
>>  create mode 100644 lib/librte_pmd_enic/Makefile
>> 
>> diff --git a/lib/librte_pmd_enic/Makefile b/lib/librte_pmd_enic/Makefile
>> new file mode 100644
>> index 000..2073cd6
>> --- /dev/null
>> +++ b/lib/librte_pmd_enic/Makefile
>> @@ -0,0 +1,67 @@
>> +#   BSD LICENSE
>> +# 
>> +#   Copyright(c) 2010-2013 Intel Corporation. All rights reserved.
>> +#   All rights reserved.
>> +# 
>This should be (c) Cisco, shouldn't it?
This file was taken from DPDK source and modified.  Hence I thought I
should be retaining the copyright.
Please let me know if this is not right.
>
>> +#   Redistribution and use in source and binary forms, with or without
>> +#   modification, are permitted provided that the following conditions
>> +#   are met:
>> +# 
>> +# * Redistributions of source code must retain the above copyright
>> +#   notice, this list of conditions and the following disclaimer.
>> +# * Redistributions in binary form must reproduce the above
>>copyright 
>> +#   notice, this list of conditions and the following disclaimer
>>in 
>> +#   the documentation and/or other materials provided with the
>> +#   distribution.
>> +# * Neither the name of Intel Corporation nor the names of its
>> +#   contributors may be used to endorse or promote products
>>derived 
>> +#   from this software without specific prior written permission.
>> +# 
>> +#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
>>CONTRIBUTORS 
>> +#   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
>> +#   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
>>FOR 
>> +#   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
>>COPYRIGHT 
>> +#   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
>>INCIDENTAL, 
>> +#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
>> +#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
>>USE, 
>> +#   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
>>ANY 
>> +#   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
>>TORT 
>> +#   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
>>USE 
>> +#   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
>>DAMAGE.
>> +# 
>> +
>> +include $(RTE_SDK)/mk/rte.vars.mk
>> +
>> +#
>> +# library name
>> +#
>> +LIB = librte_pmd_enic.a
>> +
>> +CFLAGS += -I$(RTE_SDK)/lib/librte_hash/
>>-I$(RTE_SDK)/lib/librte_pmd_enic/
>> +CFLAGS += -I$(RTE_SDK)/lib/librte_pmd_enic/vnic/
>> +CFLAGS += -O3 -Wno-deprecated
>> +
>> +VPATH += $(RTE_SDK)/lib/librte_pmd_enic/src
>> +
>> +#
>> +# all source are stored in SRCS-y
>> +#
>> +SRCS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += enic_main.c
>> +SRCS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += enic_clsf.c
>> +SRCS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += vnic/vnic_cq.c
>> +SRCS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += vnic/vnic_wq.c
>> +SRCS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += vnic/vnic_dev.c
>> +SRCS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += vnic/vnic_intr.c
>> +SRCS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += vnic/vnic_rq.c
>> +SRCS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += enic_etherdev.c
>> +SRCS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += enic_res.c
>> +SRCS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += vnic/vnic_rss.c
>> +
>> +
>> +# this lib depends upon:
>> +DEPDIRS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += lib/librte_eal
>>lib/librte_ether
>> +DEPDIRS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += lib/librte_mempool
>>lib/librte_mbuf
>> +DEPDIRS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += lib/librte_net
>>lib/librte_malloc
>> +
>> +include $(RTE_SDK)/mk/rte.lib.mk
>> +
>> -- 
>> 1.9.1
>> 
>> 



[dpdk-dev] [PATCH v2 2/6] ENIC PMD Makefile

2014-11-21 Thread Neil Horman
On Fri, Nov 21, 2014 at 03:35:31PM +, Sujith Sankar (ssujith) wrote:
> 
> 
> On 21/11/14 5:03 pm, "Neil Horman"  wrote:
> 
> >On Fri, Nov 21, 2014 at 10:02:59PM +0530, Sujith Sankar wrote:
> >> Signed-off-by: Sujith Sankar 
> >> ---
> >>  lib/librte_pmd_enic/Makefile | 67
> >>
> >>  1 file changed, 67 insertions(+)
> >>  create mode 100644 lib/librte_pmd_enic/Makefile
> >> 
> >> diff --git a/lib/librte_pmd_enic/Makefile b/lib/librte_pmd_enic/Makefile
> >> new file mode 100644
> >> index 000..2073cd6
> >> --- /dev/null
> >> +++ b/lib/librte_pmd_enic/Makefile
> >> @@ -0,0 +1,67 @@
> >> +#   BSD LICENSE
> >> +# 
> >> +#   Copyright(c) 2010-2013 Intel Corporation. All rights reserved.
> >> +#   All rights reserved.
> >> +# 
> >This should be (c) Cisco, shouldn't it?
> This file was taken from DPDK source and modified.  Hence I thought I
> should be retaining the copyright.
> Please let me know if this is not right.
Given that you've modified it to build ENIC, I would say change the copyright
Neil

> >
> >> +#   Redistribution and use in source and binary forms, with or without
> >> +#   modification, are permitted provided that the following conditions
> >> +#   are met:
> >> +# 
> >> +# * Redistributions of source code must retain the above copyright
> >> +#   notice, this list of conditions and the following disclaimer.
> >> +# * Redistributions in binary form must reproduce the above
> >>copyright 
> >> +#   notice, this list of conditions and the following disclaimer
> >>in 
> >> +#   the documentation and/or other materials provided with the
> >> +#   distribution.
> >> +# * Neither the name of Intel Corporation nor the names of its
> >> +#   contributors may be used to endorse or promote products
> >>derived 
> >> +#   from this software without specific prior written permission.
> >> +# 
> >> +#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
> >>CONTRIBUTORS 
> >> +#   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
> >> +#   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
> >>FOR 
> >> +#   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
> >>COPYRIGHT 
> >> +#   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
> >>INCIDENTAL, 
> >> +#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
> >> +#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
> >>USE, 
> >> +#   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
> >>ANY 
> >> +#   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
> >>TORT 
> >> +#   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
> >>USE 
> >> +#   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
> >>DAMAGE.
> >> +# 
> >> +
> >> +include $(RTE_SDK)/mk/rte.vars.mk
> >> +
> >> +#
> >> +# library name
> >> +#
> >> +LIB = librte_pmd_enic.a
> >> +
> >> +CFLAGS += -I$(RTE_SDK)/lib/librte_hash/
> >>-I$(RTE_SDK)/lib/librte_pmd_enic/
> >> +CFLAGS += -I$(RTE_SDK)/lib/librte_pmd_enic/vnic/
> >> +CFLAGS += -O3 -Wno-deprecated
> >> +
> >> +VPATH += $(RTE_SDK)/lib/librte_pmd_enic/src
> >> +
> >> +#
> >> +# all source are stored in SRCS-y
> >> +#
> >> +SRCS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += enic_main.c
> >> +SRCS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += enic_clsf.c
> >> +SRCS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += vnic/vnic_cq.c
> >> +SRCS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += vnic/vnic_wq.c
> >> +SRCS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += vnic/vnic_dev.c
> >> +SRCS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += vnic/vnic_intr.c
> >> +SRCS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += vnic/vnic_rq.c
> >> +SRCS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += enic_etherdev.c
> >> +SRCS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += enic_res.c
> >> +SRCS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += vnic/vnic_rss.c
> >> +
> >> +
> >> +# this lib depends upon:
> >> +DEPDIRS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += lib/librte_eal
> >>lib/librte_ether
> >> +DEPDIRS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += lib/librte_mempool
> >>lib/librte_mbuf
> >> +DEPDIRS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += lib/librte_net
> >>lib/librte_malloc
> >> +
> >> +include $(RTE_SDK)/mk/rte.lib.mk
> >> +
> >> -- 
> >> 1.9.1
> >> 
> >> 
> 
> 


[dpdk-dev] Next Community Call, Tuesday 2nd December, 8:00 AM GMT

2014-11-21 Thread Neil Horman
On Fri, Nov 21, 2014 at 04:08:53PM +, O'driscoll, Tim wrote:
> We're going to hold our next community call on Tuesday 2nd December. This 
> time, we're going to try a time that's more suitable for participants in 
> Asia, so we're going to hold it at 8:00 AM GMT. The meeting time in a variety 
> of timezones is included below.
> 
> Generally, GoToMeeting worked well last time, although there was a limitation 
> that Neil was unable to present slides as he joined from a Linux system. 
> We'll stick with GoToMeeting again this time as we don't yet have a better 
> solution. Details for joining the GoToMeeting session are included below.
> 
> I'll record the session again and post the video to YouTube afterwards for 
> anybody who can't make it. This seemed to work well last time, and as Kevin 
> pointed out, the audio quality on the recording is good.
> 
> For the agenda, we'd like to discuss the following:
> ? Remaining 2.0 candidate features, especially PCI Hotplug as there's been a 
> lot of discussion on that on the mailing list. Hopefully Tetsuya Mukawa can 
> join us to describe his work on this.
> ? DPDK Test Suite. We hope to announce the release of this next week. 
> Waterman Cao and Yong (Marvin) Liu from our Shanghai team will describe the 
> functionality and benefits of this.
> 
> 
> Meeting Time:
> Dublin (Ireland) Tuesday, December 2, 2014 at 8:00:00 AM GMT UTC 
> Paris (France) Tuesday, December 2, 2014 at 9:00:00 AM CET UTC+1 hour 
> Tel Aviv (Israel) Tuesday, December 2, 2014 at 10:00:00 AM IST UTC+2 hours 
> Moscow (Russia) Tuesday, December 2, 2014 at 11:00:00 AM MSK UTC+3 hours 
> New Delhi (India - Delhi) Tuesday, December 2, 2014 at 1:30:00 PM IST 
> UTC+5:30 hours 
> Shanghai (China - Shanghai Municipality) Tuesday, December 2, 2014 at 4:00:00 
> PM CST UTC+8 hours 
> Tokyo (Japan) Tuesday, December 2, 2014 at 5:00:00 PM JST UTC+9 hours 
> San Francisco (U.S.A. - California) Midnight between Monday, December 1, 2014 
> and Tuesday, December 2, 2014 PST UTC-8 hours 
> Phoenix (U.S.A. - Arizona) Tuesday, December 2, 2014 at 1:00:00 AM MST UTC-7 
> hours 
> New York (U.S.A. - New York) Tuesday, December 2, 2014 at 3:00:00 AM EST 
> UTC-5 hours 
> Ottawa (Canada - Ontario) Tuesday, December 2, 2014 at 3:00:00 AM EST UTC-5 
> hours 
> Corresponding UTC (GMT) Tuesday, December 2, 2014 at 08:00:00
> 
3am EST?  I presume this is made to accomodate Far east participants, correct?
Neil

> 
> GoToMeeting Details:
> To join, follow the meeting link: 
> https://global.gotomeeting.com/join/772753069. This will start the 
> GoToMeeting web viewer. You then have two options for audio:
> 
> 1. To use your computer's audio via a headset, you need to switch to the 
> desktop version of GoToMeeting. You can do this by clicking the GoToMeeting 
> icon on the top right hand side of the web viewer, and then selecting "Switch 
> to the desktop version". The desktop version will need to download and 
> install, so if you plan to use this you may want to get it set up in advance. 
> Once it starts, under the Audio section, you can select "Mic & Speakers". The 
> desktop version is only available for Windows and Mac, so if you're using 
> Linux then you need to use option 2 below.
> 
> 2. You can join using a phone via one of the numbers listed below. The Access 
> Code is 772-753-069. You'll also be asked for an Audio PIN, which is 
> accessible by clicking the phone icon in the GoToMeeting web viewer after 
> you've joined the meeting.
> ? Australia   (Long distance): +61 2 9091 7601  
> ? Austria   (Long distance): +43 (0) 7 2088 1036  
> ? Belgium   (Long distance): +32 (0) 28 08 4345  
> ? Canada   (Long distance): +1 (647) 497-9372  
> ? Denmark   (Long distance): +45 (0) 69 91 89 24  
> ? Finland   (Long distance): +358 (0) 942 45 0382  
> ? France   (Long distance): +33 (0) 170 950 586  
> ? Germany   (Long distance): +49 (0) 692 5736 7206  
> ? Ireland   (Long distance): +353 (0) 15 255 598  
> ? Italy   (Long distance): +39 0 694 80 31 28  
> ? Netherlands   (Long distance): +31 (0) 208 084 055  
> ? New Zealand   (Long distance): +64 (0) 4 974 7243  
> ? Norway   (Long distance): +47 23 96 01 18  
> ? Spain   (Long distance): +34 932 20 0506  
> ? Sweden   (Long distance): +46 (0) 852 500 182  
> ? Switzerland   (Long distance): +41 (0) 435 0824 78  
> ? United Kingdom   (Long distance): +44 (0) 330 221 0098  
> ? United States   (Long distance): +1 (626) 521-0013
> Access Code 772-753-069.   
> 
> Info on downloading the desktop app is available at: 
> http://support.citrixonline.com/en_US/meeting/help_files/G2M010002?title=Download%7D
> Info on the web viewer is available at: 
> http://support.citrixonline.com/en_US/GoToMeeting/help_files/GTM130019?title=Web+Viewer+FAQs
> 
> 
> Thanks,
> Tim


[dpdk-dev] one worker reading multiple ports

2014-11-21 Thread Newman Poborsky
So, since mempool is multi-consumer (by default), if one is used to
configure queues on multiple NICs that have different socket owners, then
mbuf allocation will fail? But if 2 NICs have the socket owner, everything
should work fine?  Since I'm talking about 2 ports on the same NIC, they
must have the same owner, RX receive should work with RX queues configured
with the same mempool, right? But it my case it doesn't so I guess I'm
missing something.

Any idea how can I troubleshoot why allocation fails with one mempool and
works fine with each queue having its own mempool?

Thank you,

Newman

On Thu, Nov 20, 2014 at 10:52 PM, Matthew Hall 
wrote:

> On Thu, Nov 20, 2014 at 05:10:51PM +0100, Newman Poborsky wrote:
> > Thank you for your answer.
> >
> > I just realized that the reason the rte_eth_rx_burst() returns 0 is
> because
> > inside ixgbe_recv_pkts() this fails:
> > nmb = rte_rxmbuf_alloc(rxq->mb_pool);  => nmb is NULL
> >
> > Does this mean that every RX queue should have its own rte_mempool?  If
> so,
> > are there any optimal values for: number of RX descriptors, per-queue
> > rte_mempool size, number of hugepages (from what I understand, these 3
> are
> > correlated)?
> >
> > If I'm wrong, please explain why.
> >
> > Thanks!
> >
> > BR,
> > Newman
>
> Newman,
>
> Mempools are created per NUMA node (ordinarily this means per processor
> socket
> if sockets > 1).
>
> When doing Tx / Rx Queue Setup, one should determine the socket which owns
> the
> given PCI NIC, and try to use memory on that same socket to handle traffic
> for
> that NIC and Queues.
>
> So, for N cards with Q * N Tx / Rx queues, you only need S mempools.
>
> Then each of the Q * N queues will use the mempool from the socket closest
> to
> the card.
>
> Matthew.
>


[dpdk-dev] one worker reading multiple ports

2014-11-21 Thread Bruce Richardson
On Fri, Nov 21, 2014 at 03:03:25PM +0100, Newman Poborsky wrote:
> So, since mempool is multi-consumer (by default), if one is used to
> configure queues on multiple NICs that have different socket owners, then
> mbuf allocation will fail? But if 2 NICs have the socket owner, everything
> should work fine?  Since I'm talking about 2 ports on the same NIC, they
> must have the same owner, RX receive should work with RX queues configured
> with the same mempool, right? But it my case it doesn't so I guess I'm
> missing something.

Actually, the mempools will work with NICs on multiple sockets - it's just
that performance is likely to suffer due to QPI usage. The mempools being on
one socket or the other is not going to break your application.

> 
> Any idea how can I troubleshoot why allocation fails with one mempool and
> works fine with each queue having its own mempool?

At a guess, I'd say that your mempools just aren't bit enough. Try doubling the
size of th mempool in the single-pool case and see if it helps things.

/Bruce

> 
> Thank you,
> 
> Newman
> 
> On Thu, Nov 20, 2014 at 10:52 PM, Matthew Hall 
> wrote:
> 
> > On Thu, Nov 20, 2014 at 05:10:51PM +0100, Newman Poborsky wrote:
> > > Thank you for your answer.
> > >
> > > I just realized that the reason the rte_eth_rx_burst() returns 0 is
> > because
> > > inside ixgbe_recv_pkts() this fails:
> > > nmb = rte_rxmbuf_alloc(rxq->mb_pool);  => nmb is NULL
> > >
> > > Does this mean that every RX queue should have its own rte_mempool?  If
> > so,
> > > are there any optimal values for: number of RX descriptors, per-queue
> > > rte_mempool size, number of hugepages (from what I understand, these 3
> > are
> > > correlated)?
> > >
> > > If I'm wrong, please explain why.
> > >
> > > Thanks!
> > >
> > > BR,
> > > Newman
> >
> > Newman,
> >
> > Mempools are created per NUMA node (ordinarily this means per processor
> > socket
> > if sockets > 1).
> >
> > When doing Tx / Rx Queue Setup, one should determine the socket which owns
> > the
> > given PCI NIC, and try to use memory on that same socket to handle traffic
> > for
> > that NIC and Queues.
> >
> > So, for N cards with Q * N Tx / Rx queues, you only need S mempools.
> >
> > Then each of the Q * N queues will use the mempool from the socket closest
> > to
> > the card.
> >
> > Matthew.
> >


[dpdk-dev] Need help with the correct steps to run testpmd app on Linux VM using VMXNET3 vNICs

2014-11-21 Thread Sandesh Sawant
Just an update on the issue I was facing...

I got what was wrong in the steps which I followed. I shouldn't have bound the 
VNICs to igb_uio driver after replacing vmxnet3 driver. The testpdm app worked 
fine after eliminating that step from the earlier sequence :) Sorry to bother 
you all.

Regards,
Sandesh

From: Sandesh Sawant
Sent: Friday, November 21, 2014 7:06 PM
To: 'dev at dpdk.org'
Subject: Need help with the correct steps to run testpmd app on Linux VM using 
VMXNET3 vNICs

Hello dpdk experts,

I am following the documentation available on dpdk.org & the documentation 
published by Intel to learn how to use DPDK libraries.

I am using dpdk v1.7.1 downloaded from dpdk.org. I wish to run testpmd app 
provided with this release with 2 VMXNET3 vNICs on my setup.
My test setup is a 64-bit Ubunutu 14.04 (3.13.0) Linux VM running on a VMWare 
ESXi-5.5.0 hypervisor on Dell server with Intel Xeon E5-2440.

I followed the following stpes to capture the vmxnet3 vNICs in DPDK (all 
commands run as a root user):

cd /home/sandesh/dpdk/dpdk-1.7.1/
export RTE_SDK=/home/sandesh/dpdk/dpdk-1.7.1/
export RTE_TARGET=build
modprobe uio
insmod build/kmod/igb_uio.ko
modprobe vfio-pci
mkdir -p /mnt/huge
mount -t hugetlbfs nodev /mnt/huge
echo 64 > /sys/devices/system/node/node0/hugepages/hugepages-2048kB/nr_hugepages

tools/dpdk_nic_bind.py --status

Network devices using DPDK-compatible driver



Network devices using kernel driver
===
:02:01.0 '82545EM Gigabit Ethernet Controller (Copper)' if=eth2 drv=e1000 
unused=igb_uio,vfio-pci *Active*
:03:00.0 'VMXNET3 Ethernet Controller' if=eth0 drv=vmxnet3 
unused=igb_uio,vfio-pci *Active*
:0b:00.0 'VMXNET3 Ethernet Controller' if=eth1 drv=vmxnet3 
unused=igb_uio,vfio-pci *Active*

Other network devices
=


Then I bind VMXNET3 vNICs to igb_uio driver:

../dpdk-1.7.1/tools/dpdk_nic_bind.py --bind=igb_uio eth0 eth1

../dpdk-1.7.1/tools/dpdk_nic_bind.py --status

Network devices using DPDK-compatible driver



Network devices using kernel driver
===
:02:01.0 '82545EM Gigabit Ethernet Controller (Copper)' if=eth2 drv=e1000 
unused=igb_uio,vfio-pci *Active*
:03:00.0 'VMXNET3 Ethernet Controller' if=eth0 drv=vmxnet3 
unused=igb_uio,vfio-pci *Active*
:0b:00.0 'VMXNET3 Ethernet Controller' if=eth1 drv=vmxnet3 
unused=igb_uio,vfio-pci *Active*

Other network devices
=



Note: I downloaded vmxnet3-usermap extension 1.2 source from dpdk.org to work 
with VMXNET3.
I got a few compilation errors for the same which I resolved and got the driver 
& .so built.
(I belive these errors in driver code were due to its code not being uptodate 
wrt linux kernel 3.13).

Next I proceeded to replace the orignial vmxnet3 driver with vmxnet3-usermap.ko 
as follows:

cd /home/sandesh/dpdk/vmxnet3-usermap-1.2/
rmmod vmxnet3
insmod vmxnet3-usermap.ko enable_shm=2,2 num_rqs=1,1 num_rxds=512 num_txds=512

and then executed:

../dpdk-1.7.1/build/app/testpmd -c 0xff -n 1 -d librte_pmd_vmxnet3.so -- -i 
--rxq=1 --rxd=512 --txd=512

EAL: Detected lcore 0 as core 0 on socket 0
EAL: Detected lcore 1 as core 1 on socket 0
EAL: Detected lcore 2 as core 2 on socket 0
EAL: Detected lcore 3 as core 3 on socket 0
EAL: Detected lcore 4 as core 0 on socket 0
EAL: Detected lcore 5 as core 1 on socket 0
EAL: Detected lcore 6 as core 2 on socket 0
EAL: Detected lcore 7 as core 3 on socket 0
EAL: Support maximum 64 logical core(s) by configuration.
EAL: Detected 8 lcore(s)
EAL:   unsupported IOMMU type!
EAL: VFIO support could not be initialized
EAL: Setting up memory...
EAL: Ask a virtual area of 0x580 bytes
EAL: Virtual area found at 0x7fb8f700 (size = 0x580)
EAL: Ask a virtual area of 0x40 bytes
EAL: Virtual area found at 0x7fb8f6a0 (size = 0x40)
EAL: Ask a virtual area of 0x240 bytes
EAL: Virtual area found at 0x7fb8f440 (size = 0x240)
EAL: Requesting 64 pages of size 2MB from socket 0
EAL: TSC frequency is ~241 KHz
EAL: open shared lib 
/home/sandesh/dpdk/vmxnet3-usermap-1.2/librte_pmd_vmxnet3.so
librte_pmd_vmxnet3 version 1.2
Copyright 2012-2014 6WIND S.A. provided without warranty.
EAL: Master core 0 is ready (tid=fd716880)
EAL: Core 7 is ready (tid=f09ed700)
EAL: Core 6 is ready (tid=f11ee700)
EAL: Core 5 is ready (tid=f19ef700)
EAL: Core 4 is ready (tid=f21f0700)
EAL: Core 3 is ready (tid=f29f1700)
EAL: Core 2 is ready (tid=f31f2700)
EAL: Core 1 is ready (tid=f39f3700)
EAL: PCI device :02:01.0 on NUMA socket -1
EAL:   probe driver: 8086:100f rte_em_pmd
EAL:   :02:01.0 not managed by UIO driver, skipping
EAL: PCI device :03:00.0 on NUMA socket -1
EAL:   probe driver: 15ad:7b0 rte_vmxnet3_pmd
PMD: eth_vmxnet3_dev_init(): No matching device found
EAL: Error - exiting with code: 1
  Cause: Requested device :03:00.0 cannot be used
root at 

[dpdk-dev] Need help with the correct steps to run testpmd app on Linux VM using VMXNET3 vNICs

2014-11-21 Thread Sandesh Sawant
Hello dpdk experts,

I am following the documentation available on dpdk.org & the documentation 
published by Intel to learn how to use DPDK libraries.

I am using dpdk v1.7.1 downloaded from dpdk.org. I wish to run testpmd app 
provided with this release with 2 VMXNET3 vNICs on my setup.
My test setup is a 64-bit Ubunutu 14.04 (3.13.0) Linux VM running on a VMWare 
ESXi-5.5.0 hypervisor on Dell server with Intel Xeon E5-2440.

I followed the following stpes to capture the vmxnet3 vNICs in DPDK (all 
commands run as a root user):

cd /home/sandesh/dpdk/dpdk-1.7.1/
export RTE_SDK=/home/sandesh/dpdk/dpdk-1.7.1/
export RTE_TARGET=build
modprobe uio
insmod build/kmod/igb_uio.ko
modprobe vfio-pci
mkdir -p /mnt/huge
mount -t hugetlbfs nodev /mnt/huge
echo 64 > /sys/devices/system/node/node0/hugepages/hugepages-2048kB/nr_hugepages

tools/dpdk_nic_bind.py --status

Network devices using DPDK-compatible driver



Network devices using kernel driver
===
:02:01.0 '82545EM Gigabit Ethernet Controller (Copper)' if=eth2 drv=e1000 
unused=igb_uio,vfio-pci *Active*
:03:00.0 'VMXNET3 Ethernet Controller' if=eth0 drv=vmxnet3 
unused=igb_uio,vfio-pci *Active*
:0b:00.0 'VMXNET3 Ethernet Controller' if=eth1 drv=vmxnet3 
unused=igb_uio,vfio-pci *Active*

Other network devices
=


Then I bind VMXNET3 vNICs to igb_uio driver:

../dpdk-1.7.1/tools/dpdk_nic_bind.py --bind=igb_uio eth0 eth1

../dpdk-1.7.1/tools/dpdk_nic_bind.py --status

Network devices using DPDK-compatible driver



Network devices using kernel driver
===
:02:01.0 '82545EM Gigabit Ethernet Controller (Copper)' if=eth2 drv=e1000 
unused=igb_uio,vfio-pci *Active*
:03:00.0 'VMXNET3 Ethernet Controller' if=eth0 drv=vmxnet3 
unused=igb_uio,vfio-pci *Active*
:0b:00.0 'VMXNET3 Ethernet Controller' if=eth1 drv=vmxnet3 
unused=igb_uio,vfio-pci *Active*

Other network devices
=



Note: I downloaded vmxnet3-usermap extension 1.2 source from dpdk.org to work 
with VMXNET3.
I got a few compilation errors for the same which I resolved and got the driver 
& .so built.
(I belive these errors in driver code were due to its code not being uptodate 
wrt linux kernel 3.13).

Next I proceeded to replace the orignial vmxnet3 driver with vmxnet3-usermap.ko 
as follows:

cd /home/sandesh/dpdk/vmxnet3-usermap-1.2/
rmmod vmxnet3
insmod vmxnet3-usermap.ko enable_shm=2,2 num_rqs=1,1 num_rxds=512 num_txds=512

and then executed:

../dpdk-1.7.1/build/app/testpmd -c 0xff -n 1 -d librte_pmd_vmxnet3.so -- -i 
--rxq=1 --rxd=512 --txd=512

EAL: Detected lcore 0 as core 0 on socket 0
EAL: Detected lcore 1 as core 1 on socket 0
EAL: Detected lcore 2 as core 2 on socket 0
EAL: Detected lcore 3 as core 3 on socket 0
EAL: Detected lcore 4 as core 0 on socket 0
EAL: Detected lcore 5 as core 1 on socket 0
EAL: Detected lcore 6 as core 2 on socket 0
EAL: Detected lcore 7 as core 3 on socket 0
EAL: Support maximum 64 logical core(s) by configuration.
EAL: Detected 8 lcore(s)
EAL:   unsupported IOMMU type!
EAL: VFIO support could not be initialized
EAL: Setting up memory...
EAL: Ask a virtual area of 0x580 bytes
EAL: Virtual area found at 0x7fb8f700 (size = 0x580)
EAL: Ask a virtual area of 0x40 bytes
EAL: Virtual area found at 0x7fb8f6a0 (size = 0x40)
EAL: Ask a virtual area of 0x240 bytes
EAL: Virtual area found at 0x7fb8f440 (size = 0x240)
EAL: Requesting 64 pages of size 2MB from socket 0
EAL: TSC frequency is ~241 KHz
EAL: open shared lib 
/home/sandesh/dpdk/vmxnet3-usermap-1.2/librte_pmd_vmxnet3.so
librte_pmd_vmxnet3 version 1.2
Copyright 2012-2014 6WIND S.A. provided without warranty.
EAL: Master core 0 is ready (tid=fd716880)
EAL: Core 7 is ready (tid=f09ed700)
EAL: Core 6 is ready (tid=f11ee700)
EAL: Core 5 is ready (tid=f19ef700)
EAL: Core 4 is ready (tid=f21f0700)
EAL: Core 3 is ready (tid=f29f1700)
EAL: Core 2 is ready (tid=f31f2700)
EAL: Core 1 is ready (tid=f39f3700)
EAL: PCI device :02:01.0 on NUMA socket -1
EAL:   probe driver: 8086:100f rte_em_pmd
EAL:   :02:01.0 not managed by UIO driver, skipping
EAL: PCI device :03:00.0 on NUMA socket -1
EAL:   probe driver: 15ad:7b0 rte_vmxnet3_pmd
PMD: eth_vmxnet3_dev_init(): No matching device found
EAL: Error - exiting with code: 1
  Cause: Requested device :03:00.0 cannot be used
root at pnq1-vm-eng-dhcp13:/home/sandesh/dpdk/vmxnet3-usermap-1.2#


Can someone please point out what I am missing here?
Am I supposed to bind VMXNET3 vNICs to the vmxnet3-usermap driver instead of 
igb_uio driver here?


Note: Earlier when I was not running testpmd without vmxnet3-usermap extension, 
when I was hitting the following error:
dpdk-1.7.1/build/app/testpmd -c 0xff -n 1 -- -i
. 
. 
. 
EAL: PCI device :0b:00.0 on NUMA socket -1
EAL:   probe driver: 15ad:7b0 rte_vmxnet3_pmd
EAL:   

[dpdk-dev] DPDK Community Conference Call - Friday 31st October

2014-11-21 Thread Kevin Wilson
Tim,
Great, thanks! Keep on the good work and recording in the future.

The quality of the Audio is superb!

Kevin

On Fri, Nov 21, 2014 at 1:26 AM, O'driscoll, Tim
 wrote:
> The video is now accessible at: http://youtu.be/AbHQ4YaWY90. Thomas may want 
> to add a link to this from somewhere on the dpdk.org page.
>
>
> Tim
>
>> From: Kevin Wilson [mailto:wkevils at gmail.com]
>>
>> Hi,
>> >I'll post a recording of it soon.
>> Great idea! most welcomed!
>>
>> Kevin
>>
>>
>> On Thu, Nov 20, 2014 at 3:13 PM, O'driscoll, Tim > intel.com>
>> wrote:
>> > Hi Kevin,
>> >
>> >> From: Kevin Wilson [mailto:wkevils at gmail.com]
>> >> > We'll schedule a follow-up call for 2 weeks' time
>> >> Just a short question - is this still intended to be held ?
>> >
>> > We had our second call earlier this week, on Tuesday. I'll post a 
>> > recording of
>> it soon.
>> >
>> > The next call will be in 2 weeks' time, probably on Tuesday December 2nd. I
>> just need to finalise the time before confirming this. We have had a couple 
>> of
>> requests to alternate between a time that's suitable for USA/Europe, and
>> one that's more suitable for Asia. So, the next call will probably be early 
>> in the
>> morning in Europe, afternoon in Asia, and the middle of the night in the USA.
>> >
>> >
>> > Tim


[dpdk-dev] [PATCH v3] i40e: fixed tx packets stats bug

2014-11-21 Thread Liu, Jijiang


> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of zhida zang
> Sent: Friday, November 21, 2014 4:07 PM
> To: dev at dpdk.org
> Subject: [dpdk-dev] [PATCH v3] i40e: fixed tx packets stats bug
> 
> v3 changes:
> -updated commit log
> -fixed the bug that stats data can't be cleared
> 
> Signed-off-by: Zhida Zang 
> ---
>  lib/librte_pmd_i40e/i40e_ethdev.c | 10 +++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/librte_pmd_i40e/i40e_ethdev.c
> b/lib/librte_pmd_i40e/i40e_ethdev.c
> index 4b7a827..c1ea37e 100644
> --- a/lib/librte_pmd_i40e/i40e_ethdev.c
> +++ b/lib/librte_pmd_i40e/i40e_ethdev.c
> @@ -1102,6 +1102,7 @@ i40e_dev_stats_get(struct rte_eth_dev *dev, struct
> rte_eth_stats *stats)
>   struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data-
> >dev_private);
>   struct i40e_hw_port_stats *ns = >stats; /* new stats */
>   struct i40e_hw_port_stats *os = >stats_offset; /* old stats */
> + struct i40e_eth_stats *ves = >main_vsi->eth_stats; /* vsi stats */
> 
>   /* Get statistics of struct i40e_eth_stats */
>   i40e_stat_update_48(hw, I40E_GLPRT_GORCH(hw->port), @@ -1277,15
> +1278,18 @@ i40e_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats
> *stats)
>   /* GLPRT_MSPDC not supported */
>   /* GLPRT_XEC not supported */
> 
> - pf->offset_loaded = true;
> -
>   if (pf->main_vsi)
>   i40e_update_vsi_stats(pf->main_vsi);
> 
>   stats->ipackets = ns->eth.rx_unicast + ns->eth.rx_multicast +
>   ns->eth.rx_broadcast;
> - stats->opackets = ns->eth.tx_unicast + ns->eth.tx_multicast +
> + if (pf->offset_loaded)
> + stats->opackets = ves->tx_unicast + ves->tx_multicast +
> + ves->tx_broadcast;
> + else
> + stats->opackets = ns->eth.tx_unicast + ns->eth.tx_multicast +
>   ns->eth.tx_broadcast;
> + pf->offset_loaded = true;
>   stats->ibytes   = ns->eth.rx_bytes;
>   stats->obytes   = ns->eth.tx_bytes;
>   stats->oerrors  = ns->eth.tx_errors;
> --
> 1.9.3

Acked-by: Jijiang Liu 



[dpdk-dev] [PATCH 1/4] rte_mbuf:add packet types

2014-11-21 Thread Liu, Jijiang
Hi Olivier,


> -Original Message-
> From: Olivier MATZ [mailto:olivier.matz at 6wind.com]
> Sent: Wednesday, November 19, 2014 6:39 PM
> To: Liu, Jijiang; dev at dpdk.org
> Subject: Re: [dpdk-dev] [PATCH 1/4] rte_mbuf:add packet types
> 
> Hi Jijiang,
> 
> On 11/18/2014 08:37 AM, Jijiang Liu wrote:
> > This patch abstracts packet types of L2 packet, Non Tunneled IPv4/6, IP in 
> > IP, IP
> in GRE, MAC in GRE and MAC in UDP, and add 4 MACROS to check packet IP
> header.
> >
> > Signed-off-by: Jijiang Liu 
> > ---
> >   lib/librte_mbuf/rte_mbuf.h |  223
> 
> >   1 files changed, 223 insertions(+), 0 deletions(-)
> >
> > diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
> > index f5f8658..678db0d 100644
> > --- a/lib/librte_mbuf/rte_mbuf.h
> > +++ b/lib/librte_mbuf/rte_mbuf.h
> > @@ -125,6 +125,229 @@ extern "C" {
> >*/
> >   #define PKT_TX_OFFLOAD_MASK (PKT_TX_VLAN_PKT | PKT_TX_IP_CKSUM |
> > PKT_TX_L4_MASK)
> >
> > +/**
> > + * Ethernet packet type
> > + */
> > +enum rte_eth_packet_type {
> > +
> > +   /* undefined packet type, means HW can't recognise it */
> > +   RTE_PTYPE_UNDEF = 0,
> > +
> > +   /* L2 Packet types */
> > +   RTE_PTYPE_PAY2,
> > +   RTE_PTYPE_TimeSync_PAY2, /**< IEEE1588 and 802.1AS */
> > +   RTE_PTYPE_FIP_PAY2,  /**< FCoE Initiation Protocol */
> > +   RTE_PTYPE_LLDP_PAY2, /**< Link Layer Discovery Protocol */
> > +   RTE_PTYPE_ECP_PAY2,  /**< Edge Control Protocol */
> > [...]
> 
> I have one question about the packet_type: it is not clear to me what the
> software can expect, for instance when RTE_PTYPE_IPv4_IPv4 is set. What does
> that mean exactly? Which fields must be valid in the packet to have this type?
> - L2 ethertype
> - Presence of vlan?
> - IP version
> - IP checksum
> - IP header length
> - IP length (compared to packet len)
> - anything about IP options?
The RTE_PTYPE_IPv4_IPv4 means that packet format is MAC, IPV4, IPV4, PAY3. The 
following fields are valid,
L2 ethertype
No VLAN
IPv4,

The RTE_PTYPE_IPv4_GRENAT_MACVLAN_IPv6_ICMP means that the packet format is MAC 
without VLAN, IPv4,GRE or UDP tunneling header, MAC with VLAN, IPv6, ICMP, PAY4
In all the packet types, I omitted MAC part.

> 
> This question applies to all types of course.
> 
> If I want to use packet type in an IP stack, I need to know which fields are
> checked by hardware (and what "checked" means for some of them), so I can do
> the remaining work in my application.
> If I want to write a new PMD (maybe a virtual one, full software), what do I 
> need
> to check in the packet if I want to set the
> RTE_PTYPE_IPv4_IPv4 type?

For RTE_PTYPE_IPv4_IPv4, you just need to check PAY3 directly because you have 
already known the packet format, so you don't need to check if there is VLAN or 
IPv6.

I admit that the RTE_PTYPE_IPv4_IPv4 is little i40e specific. It is not 
standard format.

> I also feel it can be redundant with the current flags ("header is IPv4"
> for instance).

> To me, these types look very "i40e" oriented. If tomorrow (or today ?) we 
> want to
> write a PMD for a hardware that is able to recognize IPv4, but does not do 
> exactly
> the same checks than i40e. It is crucial that what having a packet type set
> means... 

If the packet type can't match these defined packet type, and I think we can 
add a new packet type in rte_eth_packet_type.

>else it will stay an i40e-only mbuf field, which is probably not what we
> want.
It is open if you don't like which name/definition of the packet types,  I can 
change it.

> 
> So, I think if we really want packet types to be integrated in mbuf, we need 
> to:
> - start with a small list (maybe ipv4, ipv6, vxlan tunnels, ...).
Ok, makes sense. But a question is how to map i40e paket type if  the packet 
type is not defined.

For example, if the following packet type are not defined, how to map i40e 
packet type, we will probably omit these for i40e.
/* L2 Packet types */
+   RTE_PTYPE_PAY2,
+   RTE_PTYPE_TimeSync_PAY2, /**< IEEE1588 and 802.1AS */
+   RTE_PTYPE_FIP_PAY2,  /**< FCoE Initiation Protocol */
+   RTE_PTYPE_LLDP_PAY2, /**< Link Layer Discovery Protocol */
+   RTE_PTYPE_ECP_PAY2,  /**< Edge Control Protocol */
+   RTE_PTYPE_EAPOL_PAY2,
+   /**< IEEE 802.1X Extensible Authentication Protocol over LAN */
+   RTE_PTYPE_ARP,
+   RTE_PTYPE_FCOE_PAY3,
+   RTE_PTYPE_FCOE_FCDATA,
+   RTE_PTYPE_FCOE_FCRDY,
+   RTE_PTYPE_FCOE_FCRSP,
+   RTE_PTYPE_FCOE_FCOTHER,
+   RTE_PTYPE_FCOE_VFT,
+   RTE_PTYPE_FCOE_VFT_FCDATA,
+   RTE_PTYPE_FCOE_VFT_FCRDY,
+   RTE_PTYPE_FCOE_VFT_FCRSP,
+   RTE_PTYPE_FCOE_VFT_FCOTHER,
+
> - each type must be well defined: what does having this type means? We
>*need* to know what was checked by the hw.
Current packet name have already had clear meaning, I thought.

> - remove similar things in ol_flags to avoid having a redundant API.

Yes, when 

[dpdk-dev] [PATCH] kni: create KNI interface in current network namespace

2014-11-21 Thread Takayuki Usui
With this patch, KNI interface (e.g. vEth0) is created in the
network namespace where the DPDK application is running.
Otherwise, all interfaces are created in the default namespace
in the host.

Signed-off-by: Takayuki Usui 
---
 lib/librte_eal/linuxapp/kni/kni_misc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/librte_eal/linuxapp/kni/kni_misc.c 
b/lib/librte_eal/linuxapp/kni/kni_misc.c
index ba6..f4a9965 100644
--- a/lib/librte_eal/linuxapp/kni/kni_misc.c
+++ b/lib/librte_eal/linuxapp/kni/kni_misc.c
@@ -354,6 +354,8 @@ kni_ioctl_create(unsigned int ioctl_num, unsigned long 
ioctl_param)
return -EBUSY;
}

+   dev_net_set(net_dev, get_net_ns_by_pid(current->pid));
+
kni = netdev_priv(net_dev);

kni->net_dev = net_dev;
-- 
2.1.3



[dpdk-dev] [PATCH v3] i40e: fixed tx packets stats bug

2014-11-21 Thread Thomas Monjalon
Hi Zhida,

I guess you are not familiar with git, because you removed the
commit log in this version.
Other strange thing, there is no uppercase in your name in the
>From field, which will be converted in author name. French people
cares about uppercases in names ;)
Last thing: new versions should be sent with --in-reply-to option:
http://dpdk.org/dev#send

-- 
Thomas


2014-11-21 16:07, zhida zang:
> v3 changes:
> -updated commit log
> -fixed the bug that stats data can't be cleared
> 
> Signed-off-by: Zhida Zang 
> ---
>  lib/librte_pmd_i40e/i40e_ethdev.c | 10 +++---
>  1 file changed, 7 insertions(+), 3 deletions(-)




[dpdk-dev] [PATCH v6 00/22] Support flow director programming on Fortville

2014-11-21 Thread Ananyev, Konstantin


> From: Wu, Jingjing
> Sent: Friday, November 21, 2014 12:47 AM
> To: dev at dpdk.org
> Cc: Wu, Jingjing; Cao, Min; Ananyev, Konstantin
> Subject: [PATCH v6 00/22] Support flow director programming on Fortville
> 
> The patch set supports flow director on fortville.
> It includes:
>  - set up/tear down fortville resources to support flow director, such as 
> queue and vsi.
>  - support operation to add or delete 8 flow types of the flow director 
> filters, they are ipv4, tcpv4, udpv4, sctpv4, ipv6, tcpv6, udpv6,
> sctpv6.
>  - support flushing flow director table (all filters).
>  - support operation to get flow director information.
>  - match status statistics, FD_ID report.
>  - support operation to configure flexible payload and its mask
>  - support flexible payload involved in comparison and flex bytes report.
> 
> v2 changes:
>  - create real fdir vsi and assign queue 0 pair to it.
>  - check filter status report on the rx queue 0
> 
> v3 changes:
>  - redefine filter APIs to support multi-kind filters
>  - support sctpv4 and sctpv6 type flows
>  - support flexible payload involved in comparison
> 
> v4 changes:
>  - strip the filter APIs definitions from this patch set
>  - extend mbuf field to support flex bytes report.
>  - fix typos.
> 
> v5 changes:
>  - redefine structure rte_eth_fdir_info
>  - add doxygen comments about flexible payload and mbuf extend
>  - fix typos
> 
> v6 changes:
>  - extend structure rte_eth_fdir_info
>  - move the flex payload and mask setting from filter_ctrl api
>to i40e_fdir_configure when start device
>  - change the structure for flex payload and mask setting, and
>add verification of those arguments before HW setting is taken.
>  - change flexpayloads from words to bytes format
>  - add two more flow_types
>  - organize duplicate code lines to macro or function
>  - add and correct doxygen comments
>  - fix the merging error in v5
> 
> Jingjing Wu (22):
>   i40e: set up and initialize flow director
>   i40e: tear down flow director
>   i40e: initialize flexible payload setting
>   ethdev: define structures for adding/deleting flow director
>   i40e: define functions for transition between flow_type and pctype
>   i40e: implement operations to add/delete flow director
>   testpmd: add test commands to add/delete flow director filter
>   i40e: match counter for flow director
>   mbuf: extend fdir field
>   i40e: report flow director match info to mbuf
>   testpmd: print extended fdir info in mbuf
>   i40e: implement operation to flush flow director table
>   testpmd: add test command to flush flow director table
>   ethdev: define structures for getting flow director information
>   i40e: implement operations to get fdir info
>   ethdev: define structures for getting flow director statistics
>   i40e: implement operations to get fdir statistics
>   testpmd: display fdir info
>   ethdev: add flexible payload setting in eth_conf
>   i40e: take flow director flexible payload configuration
>   testpmd: add test command to configure flexible mask
>   testpmd: add test command to configure flexible payload
> 
>  app/test-pmd/cmdline.c|  644 ++
>  app/test-pmd/config.c |  202 +-
>  app/test-pmd/rxonly.c |   14 +-
>  app/test-pmd/testpmd.h|5 +-
>  lib/librte_ether/rte_eth_ctrl.h   |  279 +++-
>  lib/librte_ether/rte_ethdev.h |   11 +-
>  lib/librte_mbuf/rte_mbuf.h|   17 +-
>  lib/librte_pmd_i40e/Makefile  |2 +
>  lib/librte_pmd_i40e/i40e_ethdev.c |  175 -
>  lib/librte_pmd_i40e/i40e_ethdev.h |   93 ++-
>  lib/librte_pmd_i40e/i40e_fdir.c   | 1362 
> +
>  lib/librte_pmd_i40e/i40e_rxtx.c   |  207 +-
>  12 files changed, 2965 insertions(+), 46 deletions(-)
>  create mode 100644 lib/librte_pmd_i40e/i40e_fdir.c
> 
> --
> 1.8.1.4

Acked-by: Konstantin Ananyev 


[dpdk-dev] [PATCH v2 0/6] Cisco Systems Inc. VIC Ethernet PMD - ENIC PMD

2014-11-21 Thread David Marchand
On Fri, Nov 21, 2014 at 10:58 AM, Sujith Sankar (ssujith)  wrote:

>  Hi David,
> Since the kernel version is less than 3.6.0, support for VFIO is not
> there.
> Could you please turn off VFIO in config/common_linuxapp and try with
> IGB_UIO?
>

Arf, stupid me, I thought I had it disabled ...

Sorry for the noise.


-- 
David Marchand


[dpdk-dev] [PATCH v2 0/6] Cisco Systems Inc. VIC Ethernet PMD - ENIC PMD

2014-11-21 Thread David Marchand
Hello Sujith,

I just tried your patchset on my system but I can't get it to build :

$ make config T=x86_64-native-linuxapp-gcc && make
Configuration done
== Build scripts
== Build scripts/testhost
  HOSTCC testhost.o

[snip]

== Build lib/librte_pmd_enic
  CC enic_main.o
../lib/librte_pmd_enic/enic_main.c:43:24: fatal error: linux/vfio.h: No
such file or directory
compilation terminated.
make[3]: *** [enic_main.o] Error 1
make[2]: *** [librte_pmd_enic] Error 2
make[1]: *** [lib] Error 2
make: *** [all] Error 2

Looks like there is a problem with detecting vfio support and/or including
the right header.

$ uname -a
Linux ... 3.2.0-4-amd64 #1 SMP Debian 3.2.60-1+deb7u3 x86_64 GNU/Linux


Regards,
-- 
David Marchand


[dpdk-dev] Q on consolidating linuxapp/bsdapp in eal

2014-11-21 Thread r k
Sure will wait for your patchset. If there is anything other than
cleanup that needs to be looked at please let me know. I can start on
that.

Thanks,
Ravi

On Fri, Nov 21, 2014 at 10:23 AM, Thomas Monjalon
 wrote:
> 2014-11-21 10:13, r k:
>> Thanks to Thomas for providing some inputs on this.
>>
>> I am looking at consolidating common code in linuxapp/bsdapp in
>> librte_eal. I have started with header files and had some questions
>> related to it.
>
> Sorry, I didn't know you already start working on it.
> I'm going to send a patchset with such cleanup because it's needed to
> integrate some new options (from old pending patches).
>
> Please wait my patchset to see what remains to clean-up.
>
> Thanks
> --
> Thomas


[dpdk-dev] Q on consolidating linuxapp/bsdapp in eal

2014-11-21 Thread r k
Hi,

Thanks to Thomas for providing some inputs on this.

I am looking at consolidating common code in linuxapp/bsdapp in
librte_eal. I have started with header files and had some questions
related to it.

1. For some header files for e.g. eal_internal_cfg.h, there are very
minor differences between linux and bsd. In these cases is it ok to
separate out code in header files using
RTE_EXEC_ENV_BSDAPP/RTE_EXEC_ENV_LINUXAPP after moving to common
directory?

2. Files with same names for e.g. rte_lcore.h/rte_per_lcore.h are
present in multiple directories
in librte_eal/common/include
in librte_eal/[linuxapp/bsdapp]/eal/include/exec-env
 Not sure which one is the latest and should be referenced.

Inputs appreciated.

Thanks,
Ravi


[dpdk-dev] [PATCH v2 0/6] Cisco Systems Inc. VIC Ethernet PMD - ENIC PMD

2014-11-21 Thread Sujith Sankar (ssujith)
Hi David,
Since the kernel version is less than 3.6.0, support for VFIO is not there.
Could you please turn off VFIO in config/common_linuxapp and try with IGB_UIO?

Thanks,
-Sujith

From: David Marchand mailto:david.march...@6wind.com>>
Date: Friday, 21 November 2014 3:22 pm
To: "Sujith Sankar (ssujith)" mailto:ssujith at 
cisco.com>>
Cc: "dev at dpdk.org" mailto:dev at 
dpdk.org>>
Subject: Re: [dpdk-dev] [PATCH v2 0/6] Cisco Systems Inc. VIC Ethernet PMD - 
ENIC PMD

Hello Sujith,

I just tried your patchset on my system but I can't get it to build :

$ make config T=x86_64-native-linuxapp-gcc && make
Configuration done
== Build scripts
== Build scripts/testhost
  HOSTCC testhost.o

[snip]

== Build lib/librte_pmd_enic
  CC enic_main.o
../lib/librte_pmd_enic/enic_main.c:43:24: fatal error: linux/vfio.h: No 
such file or directory
compilation terminated.
make[3]: *** [enic_main.o] Error 1
make[2]: *** [librte_pmd_enic] Error 2
make[1]: *** [lib] Error 2
make: *** [all] Error 2

Looks like there is a problem with detecting vfio support and/or including the 
right header.

$ uname -a
Linux ... 3.2.0-4-amd64 #1 SMP Debian 3.2.60-1+deb7u3 x86_64 GNU/Linux


Regards,
--
David Marchand


[dpdk-dev] [PATCH] cmdline: Fix broken functionality in FreeBSD

2014-11-21 Thread Bruce Richardson
On Thu, Nov 20, 2014 at 02:17:13PM +, Sergio Gonzalez Monroy wrote:
> Some features of the cmdline were broken in FreeBSD as a result of
> termios not being compiled.
> 
> Signed-off-by: Sergio Gonzalez Monroy 

Acked-by: Bruce Richardson 

> ---
>  lib/librte_cmdline/cmdline.h|  2 --
>  lib/librte_cmdline/cmdline_socket.c | 10 +-
>  2 files changed, 1 insertion(+), 11 deletions(-)
> 
> diff --git a/lib/librte_cmdline/cmdline.h b/lib/librte_cmdline/cmdline.h
> index 4c28d37..06ae086 100644
> --- a/lib/librte_cmdline/cmdline.h
> +++ b/lib/librte_cmdline/cmdline.h
> @@ -71,9 +71,7 @@ struct cmdline {
>   cmdline_parse_ctx_t *ctx;
>   struct rdline rdl;
>   char prompt[RDLINE_PROMPT_SIZE];
> -#ifdef RTE_EXEC_ENV_LINUXAPP
>   struct termios oldterm;
> -#endif
>  };
>  
>  struct cmdline *cmdline_new(cmdline_parse_ctx_t *ctx, const char *prompt, 
> int s_in, int s_out);
> diff --git a/lib/librte_cmdline/cmdline_socket.c 
> b/lib/librte_cmdline/cmdline_socket.c
> index b51b537..6820b6d 100644
> --- a/lib/librte_cmdline/cmdline_socket.c
> +++ b/lib/librte_cmdline/cmdline_socket.c
> @@ -93,7 +93,6 @@ struct cmdline *
>  cmdline_stdin_new(cmdline_parse_ctx_t *ctx, const char *prompt)
>  {
>   struct cmdline *cl;
> -#ifdef RTE_EXEC_ENV_LINUXAPP
>   struct termios oldterm, term;
>  
>   tcgetattr(0, );
> @@ -101,14 +100,12 @@ cmdline_stdin_new(cmdline_parse_ctx_t *ctx, const char 
> *prompt)
>   term.c_lflag &= ~(ICANON | ECHO | ISIG);
>   tcsetattr(0, TCSANOW, );
>   setbuf(stdin, NULL);
> -#endif
>  
>   cl = cmdline_new(ctx, prompt, 0, 1);
>  
> -#ifdef RTE_EXEC_ENV_LINUXAPP
>   if (cl)
>   memcpy(>oldterm, , sizeof(term));
> -#endif
> +
>   return cl;
>  }
>  
> @@ -118,10 +115,5 @@ cmdline_stdin_exit(struct cmdline *cl)
>   if (!cl)
>   return;
>  
> -#ifdef RTE_EXEC_ENV_LINUXAPP
>   tcsetattr(fileno(stdin), TCSANOW, >oldterm);
> -#else
> - /* silent the compiler */
> - (void)cl;
> -#endif
>  }
> -- 
> 2.1.0
> 


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

2014-11-21 Thread Jiajia, SunX
Tested-by: Jiajia, SunX 
- Tested Commit: f7aaae2fe6f7f9a78eab7313d77e92b934693b5d
- OS: Fedora20 3.11.10-301.fc20.x86_64 and 3.16.6-200.fc20.x86_64
- GCC: gcc version 4.8.2
- CPU: Intel(R) Xeon(R) CPU E5-2680 v2 @ 2.80GHz
- NIC: Intel Corporation 82599ES 10-Gigabit SFI/SFP+ Network Connection 
[8086:10fb]
- Default x86_64-native-linuxapp-gcc configuration
- Total 18 cases, 18 passed, 0 failed

TOPO:
* Connections ports between tester/ixia and DUT
  - TESTER(Or IXIA)---DUT
  - portA--port0
  - portB--port1
  - portC--port2
  - portD--port3
* Connections ports between tester/ixia and switch and DUT
  - TESTER(Or IXIA)---SWITCH
  -   SWITCH-DUT
  - TESTER(Or IXIA)--DUT
  - portA--switch
  -switch--port0
  -switch--port1
  -switch--port2
  - portB--port3


Test Setup#1 for Functional test


Tester has 4 ports(portA--portD), and DUT has 4 ports(port0--port3), then 
connect portA to port0, portB to port1, portC to port2, portD to port3. 


Test Setup#2 for Functional test


Tester has 2 ports(portA--portB), DUT has 4 ports(port0--port3), and a switch 
that supports IEEE 802.3ad Dynamic link aggregation, then connect port0-port2 
to the switch for dynamic link aggregation, connect portA to aggregated 
interface on the switch, connect portB to port3.


- Case: Basic bonding--Create bonded devices and slaves
  Description: 
Use Setup#1.
Create bonded device and add some ports as salve of bonded 
device,
Then removed slaves or added slaves or change the bonding primary 
slave
Or change bonding mode and so on.
  Expected test result:
Verify the basic functions are normal.

- Case: Basic bonding--MAC Address Test
  Description: 
Use Setup#1.
Create bonded device and add some ports as slaves of bonded 
device,
Check that the changes of  the bonded device and slave MAC
  Expected test result:
Verify the behavior of bonded device and slave according to the 
mode.

- Case: Basic bonding--Device Promiscuous Mode Test
  Description: 
Use Setup#1.
Create bonded device and add some ports as slaves of bonded 
device,
Set promiscuous mode on or off, then send packets to the bonded 
device
Or slaves.
  Expected test result:
Verify the RX/TX status of bonded device and slaves according to 
the mode.

- Case: Mode 0(Round Robin) TX/RX test
  Description: 
Use Setup#1.
Create bonded device with mode 0 and add 3 ports as slaves of 
bonded device,
Forward packets between bonded device and unbounded device, start 
to forward,
And send packets to unbound device or slaves.
  Expected test result:
Verify the RX/TX status of bonded device and slaves in mode 0.

- Case: Mode 0(Round Robin) Bring one slave link down
  Description: 
Use Setup#1.
Create bonded device with mode 0 and add 3 ports as slaves of 
bonded device,
Forward packets between bonded device and unbounded device, start 
to forward,
Bring the link on either port 0, 1 or 2 down. And send packets to 
unbound 
device or slaves.
  Expected test result:
Verify the RX/TX status of bonded device and slaves in mode 0.

- Case: Mode 0(Round Robin) Bring all slave links down
  Description: 
Use Setup#1.
Create bonded device with mode 0 and add 3 ports as slaves of 
bonded device,
Forward packets between bonded device and unbounded device, start 
to forward,
Bring the links down on all bonded ports. And send packets to 
unbound 
device or slaves.
  Expected test result:
Verify the RX/TX status of bonded device and slaves in mode 0.

- Case: Mode 1(Active Backup) TX/RX Test
  Description: 
Use Setup#1.
Create bonded device with mode 1 and add 3 ports as slaves of 
bonded device,
Forward packets between bonded device and unbounded device, start 
to forward,
And send packets to unbound device or slaves.
  Expected test result:
Verify the RX/TX status of bonded device and slaves in mode 1.

- Case: Mode 1(Active Backup) Change active slave, RX/TX test
  Description: 
Use Setup#1.
Continuing from previous test case.Change the active slave port 
from port0 
to port1.Verify that the bonded device's MAC has changed to 
slave1's MAC.

testpmd> set bonding primary 1 4 

   Repeat the transmission and reception(TX/RX) test verify 

[dpdk-dev] [PATCH v6 22/22] testpmd: add test command to configure flexible payload

2014-11-21 Thread Jingjing Wu
Test command is added to configure flexible payload

Signed-off-by: jingjing.wu 
---
 app/test-pmd/cmdline.c | 120 +
 app/test-pmd/config.c  |  31 +
 app/test-pmd/testpmd.h |   2 +
 3 files changed, 153 insertions(+)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index bb10b9f..eed28b7 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -714,6 +714,10 @@ static void cmd_help_long_parsed(void *parsed_result,
" flow 
(ip4|ip4-frag|tcp4|udp4|sctp4|ip6|ip6-frag|tcp6|udp6|sctp6|all)"
" (mask)\n"
"Configure mask of flex payload.\n\n"
+
+   "flow_director_flex_payload (port_id)"
+   " (l2|l3|l4) (config)\n"
+   "Configure flex payload selection.\n\n"
);
}
 }
@@ -8264,6 +8268,121 @@ cmdline_parse_inst_t cmd_set_flow_director_flex_mask = {
},
 };

+/* *** deal with flow director flexible payload configuration *** */
+struct cmd_flow_director_flexpayload_result {
+   cmdline_fixed_string_t flow_director_flexpayload;
+   uint8_t port_id;
+   cmdline_fixed_string_t payload_layer;
+   cmdline_fixed_string_t payload_cfg;
+};
+
+static inline int
+parse_offsets(const char *q_arg, uint16_t *offsets, uint16_t max_num)
+{
+   char s[256];
+   const char *p, *p0 = q_arg;
+   char *end;
+   unsigned long int_fld;
+   char *str_fld[max_num];
+   int i;
+   unsigned size;
+   int ret = -1;
+
+   p = strchr(p0, '(');
+   if (p == NULL)
+   return -1;
+   ++p;
+   p0 = strchr(p, ')');
+   if (p0 == NULL)
+   return -1;
+
+   size = p0 - p;
+   if (size >= sizeof(s))
+   return -1;
+
+   snprintf(s, sizeof(s), "%.*s", size, p);
+   ret = rte_strsplit(s, sizeof(s), str_fld, max_num, ',');
+   if (ret < 0 || ret > max_num)
+   return -1;
+   for (i = 0; i < ret; i++) {
+   errno = 0;
+   int_fld = strtoul(str_fld[i], , 0);
+   if (errno != 0 || *end != '\0' || int_fld > UINT16_MAX)
+   return -1;
+   offsets[i] = (uint16_t)int_fld;
+   }
+   return ret;
+}
+
+static void
+cmd_flow_director_flxpld_parsed(void *parsed_result,
+ __attribute__((unused)) struct cmdline *cl,
+ __attribute__((unused)) void *data)
+{
+   struct cmd_flow_director_flexpayload_result *res = parsed_result;
+   struct rte_eth_flex_payload_cfg flex_cfg;
+   struct rte_port *port;
+   int ret = 0;
+
+   if (res->port_id > nb_ports) {
+   printf("Invalid port, range is [0, %d]\n", nb_ports - 1);
+   return;
+   }
+
+   port = [res->port_id];
+   /** Check if the port is not started **/
+   if (port->port_status != RTE_PORT_STOPPED) {
+   printf("Please stop port %d first\n", res->port_id);
+   return;
+   }
+
+   memset(_cfg, 0, sizeof(struct rte_eth_flex_payload_cfg));
+
+   if (!strcmp(res->payload_layer, "l2"))
+   flex_cfg.type = RTE_ETH_L2_PAYLOAD;
+   else if (!strcmp(res->payload_layer, "l3"))
+   flex_cfg.type = RTE_ETH_L3_PAYLOAD;
+   else if (!strcmp(res->payload_layer, "l4"))
+   flex_cfg.type = RTE_ETH_L4_PAYLOAD;
+
+   ret = parse_offsets(res->payload_cfg, flex_cfg.src_offset,
+   RTE_ETH_FDIR_MAX_FLEXLEN);
+   if (ret < 0) {
+   printf("error: Cannot parse flex payload input.\n");
+   return;
+   }
+
+   fdir_set_flex_payload(res->port_id, _cfg);
+   cmd_reconfig_device_queue(res->port_id, 1, 0);
+}
+
+cmdline_parse_token_string_t cmd_flow_director_flexpayload =
+   TOKEN_STRING_INITIALIZER(struct cmd_flow_director_flexpayload_result,
+flow_director_flexpayload,
+"flow_director_flex_payload");
+cmdline_parse_token_num_t cmd_flow_director_flexpayload_port_id =
+   TOKEN_NUM_INITIALIZER(struct cmd_flow_director_flexpayload_result,
+ port_id, UINT8);
+cmdline_parse_token_string_t cmd_flow_director_flexpayload_payload_layer =
+   TOKEN_STRING_INITIALIZER(struct cmd_flow_director_flexpayload_result,
+payload_layer, "l2#l3#l4");
+cmdline_parse_token_string_t cmd_flow_director_flexpayload_payload_cfg =
+   TOKEN_STRING_INITIALIZER(struct cmd_flow_director_flexpayload_result,
+payload_cfg, NULL);
+
+cmdline_parse_inst_t cmd_set_flow_director_flex_payload = {
+   .f = cmd_flow_director_flxpld_parsed,
+   .data = NULL,
+   .help_str = "set flow director's flex payload on NIC",
+   .tokens = {
+   (void *)_flow_director_flexpayload,
+   

[dpdk-dev] [PATCH v6 20/22] i40e: take flow director flexible payload configuration

2014-11-21 Thread Jingjing Wu
configure flexible payload and flex mask in i40e driver
It includes arguments verification and HW setting.

Signed-off-by: jingjing.wu 
---
 lib/librte_pmd_i40e/i40e_fdir.c | 283 
 1 file changed, 283 insertions(+)

diff --git a/lib/librte_pmd_i40e/i40e_fdir.c b/lib/librte_pmd_i40e/i40e_fdir.c
index c452a80..54f3e24 100644
--- a/lib/librte_pmd_i40e/i40e_fdir.c
+++ b/lib/librte_pmd_i40e/i40e_fdir.c
@@ -109,6 +109,13 @@
 #define I40E_FLEX_WORD_MASK(off) (0x80 >> (off))

 static int i40e_fdir_rx_queue_init(struct i40e_rx_queue *rxq);
+static int i40e_check_fdir_flex_conf(
+   const struct rte_eth_fdir_flex_conf *conf);
+static void i40e_set_flx_pld_cfg(struct i40e_pf *pf,
+const struct rte_eth_flex_payload_cfg *cfg);
+static void i40e_set_flex_mask_on_pctype(struct i40e_pf *pf,
+   enum i40e_filter_pctype pctype,
+   const struct rte_eth_fdir_flex_mask *mask_cfg);
 static int i40e_fdir_construct_pkt(struct i40e_pf *pf,
 const struct rte_eth_fdir_input 
*fdir_input,
 unsigned char *raw_pkt);
@@ -364,6 +371,261 @@ i40e_init_flx_pld(struct i40e_pf *pf)
}
 }

+#define I40E_WORD(hi, lo) (uint16_t)hi) << 8) & 0xFF00) | ((lo) & 0xFF))
+
+#define I40E_VALIDATE_FLEX_PIT(flex_pit1, flex_pit2) do { \
+   if ((flex_pit2).src_offset < \
+   (flex_pit1).src_offset + (flex_pit1).size) { \
+   PMD_DRV_LOG(ERR, "src_offset should be not" \
+   " less than than previous offset" \
+   " + previous FSIZE."); \
+   return -EINVAL; \
+   } \
+} while (0)
+
+/*
+ * i40e_srcoff_to_flx_pit - transform the src_offset into flex_pit structure,
+ * and the flex_pit will be sorted by it's src_offset value
+ */
+static inline uint16_t
+i40e_srcoff_to_flx_pit(const uint16_t *src_offset,
+   struct i40e_fdir_flex_pit *flex_pit)
+{
+   uint16_t src_tmp, size, num = 0;
+   uint16_t i, k, j = 0;
+
+   while (j < I40E_FDIR_MAX_FLEX_LEN) {
+   size = 1;
+   for (; j < I40E_FDIR_MAX_FLEX_LEN; j++) {
+   if (src_offset[j + 1] == src_offset[j] + 1)
+   size++;
+   else {
+   src_tmp = src_offset[j] + 1 - size;
+   /* the flex_pit need to be sort by scr_offset */
+   for (i = 0; i < num; i++) {
+   if (src_tmp < flex_pit[i].src_offset)
+   break;
+   }
+   /* if insert required, move backward */
+   for (k = num; k > i; k--)
+   flex_pit[k] = flex_pit[k - 1];
+   /* insert */
+   flex_pit[i].dst_offset = j + 1 - size;
+   flex_pit[i].src_offset = src_tmp;
+   flex_pit[i].size = size;
+   j++;
+   num++;
+   break;
+   }
+   }
+   }
+   return num;
+}
+
+/* i40e_check_fdir_flex_payload -check flex payload configuration arguments */
+static inline int
+i40e_check_fdir_flex_payload(const struct rte_eth_flex_payload_cfg *flex_cfg)
+{
+   struct i40e_fdir_flex_pit flex_pit[I40E_FDIR_MAX_FLEX_LEN];
+   uint16_t num, i;
+
+   for (i = 0; i < I40E_FDIR_MAX_FLEX_LEN; i++) {
+   if (flex_cfg->src_offset[i] >= I40E_MAX_FLX_SOURCE_OFF) {
+   PMD_DRV_LOG(ERR, "exceeds maxmial payload limit.");
+   return -EINVAL;
+   }
+   }
+
+   memset(flex_pit, 0, sizeof(flex_pit));
+   num = i40e_srcoff_to_flx_pit(flex_cfg->src_offset, flex_pit);
+   if (num > I40E_MAX_FLXPLD_FIED) {
+   PMD_DRV_LOG(ERR, "exceeds maxmial number of flex fields.");
+   return -EINVAL;
+   }
+   for (i = 0; i < num; i++) {
+   if (flex_pit[i].size & 0x01 || flex_pit[i].dst_offset & 0x01 ||
+   flex_pit[i].src_offset & 0x01) {
+   PMD_DRV_LOG(ERR, "flexpayload should be measured"
+   " in word");
+   return -EINVAL;
+   }
+   if (i != num - 1)
+   I40E_VALIDATE_FLEX_PIT(flex_pit[i], flex_pit[i + 1]);
+   }
+   return 0;
+}
+
+/*
+ * i40e_check_fdir_flex_conf -check if the flex payload and mask configuration
+ * arguments are valid
+ */
+static int
+i40e_check_fdir_flex_conf(const struct rte_eth_fdir_flex_conf *conf)
+{
+   const struct rte_eth_flex_payload_cfg *flex_cfg;
+   const struct rte_eth_fdir_flex_mask *flex_mask;
+   

[dpdk-dev] [PATCH v6 18/22] testpmd: display fdir info

2014-11-21 Thread Jingjing Wu
display flow director's information, includes
 - statistics
 - configuration
 - capability

Signed-off-by: jingjing.wu 
---
 app/test-pmd/config.c | 141 +-
 1 file changed, 128 insertions(+), 13 deletions(-)

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index b102b72..b7e4412 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -96,6 +96,20 @@

 #include "testpmd.h"

+static const char *flowtype_str[RTE_ETH_FLOW_TYPE_MAX] = {
+   NULL,
+   "udp4",
+   "tcp4",
+   "sctp4",
+   "ip4",
+   "ip4-frag",
+   "udp6",
+   "tcp6",
+   "sctp6",
+   "ip6",
+   "ip6-frag",
+};
+
 static void
 print_ethaddr(const char *name, struct ether_addr *eth_addr)
 {
@@ -1808,29 +1822,130 @@ fdir_remove_signature_filter(portid_t port_id,

 }

+static inline void
+print_fdir_flex_payload(struct rte_eth_fdir_flex_conf *flex_conf)
+{
+   struct rte_eth_flex_payload_cfg *cfg;
+   int i, j;
+
+   for (i = 0; i < flex_conf->nb_payloads; i++) {
+   cfg = _conf->flex_set[i];
+   if (cfg->type == RTE_ETH_L2_PAYLOAD)
+   printf("\nL2_PAYLOAD:  ");
+   else if (cfg->type == RTE_ETH_L3_PAYLOAD)
+   printf("\nL3_PAYLOAD:  ");
+   else if (cfg->type == RTE_ETH_L4_PAYLOAD)
+   printf("\nL4_PAYLOAD:  ");
+   else
+   printf("\nUNKNOWN PAYLOAD(%u):  ", cfg->type);
+   for (j = 0; j < RTE_ETH_FDIR_MAX_FLEXLEN; j++)
+   printf("  %-5u", cfg->src_offset[j]);
+   }
+   printf("\n");
+}
+
+static inline void
+print_fdir_flex_mask(struct rte_eth_fdir_flex_conf *flex_conf)
+{
+   struct rte_eth_fdir_flex_mask *mask;
+   int i, j;
+
+   for (i = 0; i < flex_conf->nb_flexmasks; i++) {
+   mask = _conf->flex_mask[i];
+   printf("\n%s:\t", flowtype_str[mask->flow_type]);
+   for (j = 0; j < RTE_ETH_FDIR_MAX_FLEXLEN; j++)
+   printf(" %02x", mask->mask[j]);
+   }
+   printf("\n");
+}
+
+static inline void
+print_fdir_flow_type(uint32_t flow_types_mask)
+{
+   int i = 0;
+
+   for (i = RTE_ETH_FLOW_TYPE_UDPV4;
+i <= RTE_ETH_FLOW_TYPE_FRAG_IPV6;
+i++) {
+   if (flow_types_mask & (1 << i))
+   printf(" %s", flowtype_str[i]);
+   }
+   printf("\n");
+}
+
 void
 fdir_get_infos(portid_t port_id)
 {
-   struct rte_eth_fdir fdir_infos;
+   struct rte_eth_fdir_stats fdir_stat;
+   struct rte_eth_fdir_info fdir_info;
+   int ret;

static const char *fdir_stats_border = "";

if (port_id_is_invalid(port_id))
return;
-
-   rte_eth_dev_fdir_get_infos(port_id, _infos);
-
+   ret = rte_eth_dev_filter_supported(port_id, RTE_ETH_FILTER_FDIR);
+   if (ret < 0) {
+   /* use the old fdir APIs to get info */
+   struct rte_eth_fdir fdir;
+   memset(, 0, sizeof(fdir));
+   ret = rte_eth_dev_fdir_get_infos(port_id, );
+   if (ret < 0) {
+   printf("\n getting fdir info fails on port %-2d\n",
+   port_id);
+   return;
+   }
+   printf("\n  %s FDIR infos for port %-2d %s\n",
+   fdir_stats_border, port_id, fdir_stats_border);
+   printf("  collision: %-10"PRIu64"  free: %"PRIu64"\n"
+  "  maxhash:   %-10"PRIu64"  maxlen:   %"PRIu64"\n"
+  "  add:   %-10"PRIu64"  remove:   %"PRIu64"\n"
+  "  f_add: %-10"PRIu64"  f_remove: %"PRIu64"\n",
+  (uint64_t)(fdir.collision), (uint64_t)(fdir.free),
+  (uint64_t)(fdir.maxhash), (uint64_t)(fdir.maxlen),
+  fdir.add, fdir.remove, fdir.f_add, fdir.f_remove);
+   printf("  %s%s\n",
+  fdir_stats_border, fdir_stats_border);
+   return;
+   }
+
+   memset(_info, 0, sizeof(fdir_info));
+   rte_eth_dev_filter_ctrl(port_id, RTE_ETH_FILTER_FDIR,
+  RTE_ETH_FILTER_INFO, _info);
+   memset(_stat, 0, sizeof(fdir_stat));
+   rte_eth_dev_filter_ctrl(port_id, RTE_ETH_FILTER_FDIR,
+  RTE_ETH_FILTER_STATS, _stat);
printf("\n  %s FDIR infos for port %-2d %s\n",
   fdir_stats_border, port_id, fdir_stats_border);
-
-   printf("  collision: %-10"PRIu64"  free: %"PRIu64"\n"
-  "  maxhash:   %-10"PRIu64"  maxlen:   %"PRIu64"\n"
-  "  add:   %-10"PRIu64"  remove:   %"PRIu64"\n"
-  "  f_add: %-10"PRIu64"  f_remove: %"PRIu64"\n",
-  (uint64_t)(fdir_infos.collision), 

[dpdk-dev] [PATCH v6 17/22] i40e: implement operations to get fdir statistics

2014-11-21 Thread Jingjing Wu
implement operation to get flow director statistics in i40e pmd driver

Signed-off-by: jingjing.wu 
---
 lib/librte_pmd_i40e/i40e_fdir.c | 27 +++
 1 file changed, 27 insertions(+)

diff --git a/lib/librte_pmd_i40e/i40e_fdir.c b/lib/librte_pmd_i40e/i40e_fdir.c
index 2edb3a6..c452a80 100644
--- a/lib/librte_pmd_i40e/i40e_fdir.c
+++ b/lib/librte_pmd_i40e/i40e_fdir.c
@@ -122,6 +122,8 @@ static int i40e_fdir_filter_programming(struct i40e_pf *pf,
 static int i40e_fdir_flush(struct rte_eth_dev *dev);
 static void i40e_fdir_info_get(struct rte_eth_dev *dev,
   struct rte_eth_fdir_info *fdir);
+static void i40e_fdir_stats_get(struct rte_eth_dev *dev,
+  struct rte_eth_fdir_stats *stat);

 static int
 i40e_fdir_rx_queue_init(struct i40e_rx_queue *rxq)
@@ -1004,6 +1006,28 @@ i40e_fdir_info_get(struct rte_eth_dev *dev, struct 
rte_eth_fdir_info *fdir)
 }

 /*
+ * i40e_fdir_stat_get - get statistics of Flow Director
+ * @pf: ethernet device to get info from
+ * @stat: a pointer to a structure of type *rte_eth_fdir_stats* to be filled 
with
+ *the flow director statistics.
+ */
+static void
+i40e_fdir_stats_get(struct rte_eth_dev *dev, struct rte_eth_fdir_stats *stat)
+{
+   struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+   struct i40e_hw *hw = I40E_PF_TO_HW(pf);
+   uint32_t fdstat;
+
+   fdstat = I40E_READ_REG(hw, I40E_PFQF_FDSTAT);
+   stat->guarant_cnt =
+   (uint32_t)((fdstat & I40E_PFQF_FDSTAT_GUARANT_CNT_MASK) >>
+   I40E_PFQF_FDSTAT_GUARANT_CNT_SHIFT);
+   stat->best_cnt =
+   (uint32_t)((fdstat & I40E_PFQF_FDSTAT_BEST_CNT_MASK) >>
+   I40E_PFQF_FDSTAT_BEST_CNT_SHIFT);
+}
+
+/*
  * i40e_fdir_ctrl_func - deal with all operations on flow director.
  * @pf: board private structure
  * @filter_op:operation will be taken.
@@ -1043,6 +1067,9 @@ i40e_fdir_ctrl_func(struct rte_eth_dev *dev,
case RTE_ETH_FILTER_INFO:
i40e_fdir_info_get(dev, (struct rte_eth_fdir_info *)arg);
break;
+   case RTE_ETH_FILTER_STATS:
+   i40e_fdir_stats_get(dev, (struct rte_eth_fdir_stats *)arg);
+   break;
default:
PMD_DRV_LOG(ERR, "unknown operation %u.", filter_op);
ret = -EINVAL;
-- 
1.8.1.4



[dpdk-dev] [PATCH v6 16/22] ethdev: define structures for getting flow director statistics

2014-11-21 Thread Jingjing Wu
define structures for getting flow director statistics

Signed-off-by: jingjing.wu 
---
 lib/librte_ether/rte_eth_ctrl.h | 20 
 1 file changed, 20 insertions(+)

diff --git a/lib/librte_ether/rte_eth_ctrl.h b/lib/librte_ether/rte_eth_ctrl.h
index b05d9eb..7fa7103 100644
--- a/lib/librte_ether/rte_eth_ctrl.h
+++ b/lib/librte_ether/rte_eth_ctrl.h
@@ -70,6 +70,7 @@ enum rte_filter_op {
RTE_ETH_FILTER_GET,  /**< get filter entry */
RTE_ETH_FILTER_SET,  /**< configurations */
RTE_ETH_FILTER_INFO, /**< retrieve information */
+   RTE_ETH_FILTER_STATS,/**< retrieve statistics */
RTE_ETH_FILTER_OP_MAX
 };

@@ -410,6 +411,25 @@ struct rte_eth_fdir_info {
/**< Max supported size of flex bitmasks in flex_bitmask_unit */
 };

+/**
+ * A structure used to define the statistics of flow director.
+ * It supports RTE_ETH_FILTER_FDIR with RTE_ETH_FILTER_STATS operation.
+ */
+struct rte_eth_fdir_stats {
+   uint32_t collision;/**< Number of filters with collision. */
+   uint32_t free; /**< Number of free filters. */
+   uint32_t maxhash;
+   /**< The lookup hash value of the added filter that updated the value
+  of the MAXLEN field */
+   uint32_t maxlen;   /**< Longest linked list of filters. */
+   uint64_t add;  /**< Number of added filters. */
+   uint64_t remove;   /**< Number of removed filters. */
+   uint64_t f_add;/**< Number of failed added filters. */
+   uint64_t f_remove; /**< Number of failed removed filters. */
+   uint32_t guarant_cnt;  /**< Number of filters in guaranteed spaces. */
+   uint32_t best_cnt; /**< Number of filters in best effort spaces. */
+};
+
 #ifdef __cplusplus
 }
 #endif
-- 
1.8.1.4



[dpdk-dev] [PATCH v6 15/22] i40e: implement operations to get fdir info

2014-11-21 Thread Jingjing Wu
implement operation to get flow director information in i40e pmd driver, 
includes
 - mode
 - supported flow types
 - table space
 - flexible payload size and granularity
 - configured flexible payload and mask information

Signed-off-by: jingjing.wu 
---
 lib/librte_pmd_i40e/i40e_ethdev.h |   1 +
 lib/librte_pmd_i40e/i40e_fdir.c   | 145 ++
 2 files changed, 146 insertions(+)

diff --git a/lib/librte_pmd_i40e/i40e_ethdev.h 
b/lib/librte_pmd_i40e/i40e_ethdev.h
index fbce86a..f3ef65f 100644
--- a/lib/librte_pmd_i40e/i40e_ethdev.h
+++ b/lib/librte_pmd_i40e/i40e_ethdev.h
@@ -67,6 +67,7 @@ enum i40e_flxpld_layer_idx {
 #define I40E_MAX_FLXPLD_FIED3  /* max number of flex payload fields */
 #define I40E_FDIR_BITMASK_NUM_WORD  2  /* max number of bitmask words */
 #define I40E_FDIR_MAX_FLEXWORD_NUM  8  /* max number of flexpayload words */
+#define I40E_FDIR_MAX_FLEX_LEN  16 /* len in bytes of flex payload */

 /* i40e flags */
 #define I40E_FLAG_RSS   (1ULL << 0)
diff --git a/lib/librte_pmd_i40e/i40e_fdir.c b/lib/librte_pmd_i40e/i40e_fdir.c
index 93aa8a1..2edb3a6 100644
--- a/lib/librte_pmd_i40e/i40e_fdir.c
+++ b/lib/librte_pmd_i40e/i40e_fdir.c
@@ -80,8 +80,34 @@
 #define I40E_COUNTER_PF   2
 /* Statistic counter index for one pf */
 #define I40E_COUNTER_INDEX_FDIR(pf_id)   (0 + (pf_id) * I40E_COUNTER_PF)
+#define I40E_MAX_FLX_SOURCE_OFF   480
 #define I40E_FLX_OFFSET_IN_FIELD_VECTOR   50

+#define NONUSE_FLX_PIT_DEST_OFF 63
+#define NONUSE_FLX_PIT_FSIZE1
+#define MK_FLX_PIT(src_offset, fsize, dst_offset) ( \
+   (((src_offset) << I40E_PRTQF_FLX_PIT_SOURCE_OFF_SHIFT) & \
+   I40E_PRTQF_FLX_PIT_SOURCE_OFF_MASK) | \
+   (((fsize) << I40E_PRTQF_FLX_PIT_FSIZE_SHIFT) & \
+   I40E_PRTQF_FLX_PIT_FSIZE_MASK) | \
+   dst_offset) + I40E_FLX_OFFSET_IN_FIELD_VECTOR) << \
+   I40E_PRTQF_FLX_PIT_DEST_OFF_SHIFT) & \
+   I40E_PRTQF_FLX_PIT_DEST_OFF_MASK))
+
+#define I40E_FDIR_FLOW_TYPES ( \
+   (1 << RTE_ETH_FLOW_TYPE_UDPV4) | \
+   (1 << RTE_ETH_FLOW_TYPE_TCPV4) | \
+   (1 << RTE_ETH_FLOW_TYPE_SCTPV4) | \
+   (1 << RTE_ETH_FLOW_TYPE_IPV4_OTHER) | \
+   (1 << RTE_ETH_FLOW_TYPE_FRAG_IPV4) | \
+   (1 << RTE_ETH_FLOW_TYPE_UDPV6) | \
+   (1 << RTE_ETH_FLOW_TYPE_TCPV6) | \
+   (1 << RTE_ETH_FLOW_TYPE_SCTPV6) | \
+   (1 << RTE_ETH_FLOW_TYPE_IPV6_OTHER) | \
+   (1 << RTE_ETH_FLOW_TYPE_FRAG_IPV6))
+
+#define I40E_FLEX_WORD_MASK(off) (0x80 >> (off))
+
 static int i40e_fdir_rx_queue_init(struct i40e_rx_queue *rxq);
 static int i40e_fdir_construct_pkt(struct i40e_pf *pf,
 const struct rte_eth_fdir_input 
*fdir_input,
@@ -94,6 +120,8 @@ static int i40e_fdir_filter_programming(struct i40e_pf *pf,
const struct rte_eth_fdir_filter *filter,
bool add);
 static int i40e_fdir_flush(struct rte_eth_dev *dev);
+static void i40e_fdir_info_get(struct rte_eth_dev *dev,
+  struct rte_eth_fdir_info *fdir);

 static int
 i40e_fdir_rx_queue_init(struct i40e_rx_queue *rxq)
@@ -861,6 +889,120 @@ i40e_fdir_flush(struct rte_eth_dev *dev)
return 0;
 }

+static inline void
+i40e_fdir_info_get_flex_set(struct i40e_pf *pf,
+   struct rte_eth_flex_payload_cfg *flex_set,
+   uint16_t *num)
+{
+   struct i40e_fdir_flex_pit *flex_pit;
+   struct rte_eth_flex_payload_cfg *ptr = flex_set;
+   uint16_t src, dst, size, j, k;
+   uint8_t i, layer_idx;
+
+   for (layer_idx = I40E_FLXPLD_L2_IDX;
+layer_idx <= I40E_FLXPLD_L4_IDX;
+layer_idx++) {
+   if (layer_idx == I40E_FLXPLD_L2_IDX)
+   ptr->type = RTE_ETH_L2_PAYLOAD;
+   else if (layer_idx == I40E_FLXPLD_L3_IDX)
+   ptr->type = RTE_ETH_L3_PAYLOAD;
+   else if (layer_idx == I40E_FLXPLD_L4_IDX)
+   ptr->type = RTE_ETH_L4_PAYLOAD;
+
+   for (i = 0; i < I40E_MAX_FLXPLD_FIED; i++) {
+   flex_pit = >fdir.flex_set[layer_idx *
+   I40E_MAX_FLXPLD_FIED + i];
+   if (flex_pit->size == 0)
+   continue;
+   src = flex_pit->src_offset * sizeof(uint16_t);
+   dst = flex_pit->dst_offset * sizeof(uint16_t);
+   size = flex_pit->size * sizeof(uint16_t);
+   for (j = src, k = dst; j < src + size; j++, k++)
+   ptr->src_offset[k] = j;
+   }
+   (*num)++;
+   ptr++;
+   }
+}
+
+static inline void
+i40e_fdir_info_get_flex_mask(struct i40e_pf *pf,
+   struct rte_eth_fdir_flex_mask *flex_mask,
+   uint16_t *num)
+{
+   struct i40e_fdir_flex_mask 

[dpdk-dev] [PATCH v6 14/22] ethdev: define structures for getting flow director information

2014-11-21 Thread Jingjing Wu
define structures for getting flow director information includes:
 - mode
 - supported flow types
 - table space
 - flexible payload size and granularity
 - configured flexible payload and mask information

Signed-off-by: jingjing.wu 
---
 lib/librte_ether/rte_eth_ctrl.h | 92 -
 lib/librte_ether/rte_ethdev.h   |  9 
 2 files changed, 90 insertions(+), 11 deletions(-)

diff --git a/lib/librte_ether/rte_eth_ctrl.h b/lib/librte_ether/rte_eth_ctrl.h
index 9856842..b05d9eb 100644
--- a/lib/librte_ether/rte_eth_ctrl.h
+++ b/lib/librte_ether/rte_eth_ctrl.h
@@ -69,8 +69,7 @@ enum rte_filter_op {
RTE_ETH_FILTER_FLUSH,/**< flush all entries */
RTE_ETH_FILTER_GET,  /**< get filter entry */
RTE_ETH_FILTER_SET,  /**< configurations */
-   RTE_ETH_FILTER_INFO,
-   /**< get information of filter, such as status or statistics */
+   RTE_ETH_FILTER_INFO, /**< retrieve information */
RTE_ETH_FILTER_OP_MAX
 };

@@ -322,6 +321,95 @@ struct rte_eth_fdir_filter {
struct rte_eth_fdir_action action;  /**< Action taken when match */
 };

+/**
+ * Payload type
+ */
+enum rte_eth_payload_type {
+   RTE_ETH_PAYLOAD_UNKNOWN = 0,
+   RTE_ETH_L2_PAYLOAD,
+   RTE_ETH_L3_PAYLOAD,
+   RTE_ETH_L4_PAYLOAD,
+   RTE_ETH_PAYLOAD_MAX = 8,
+};
+
+/**
+ * A structure used to select bytes extracted from the protocol layers to
+ * flexible payload for filter
+ */
+struct rte_eth_flex_payload_cfg {
+   enum rte_eth_payload_type type;  /**< Payload type */
+   uint16_t src_offset[RTE_ETH_FDIR_MAX_FLEXLEN];
+   /**< Offset in bytes from the beginning of packet's payload
+src_offset[i] indicates the flexbyte i's offset in original
+packet payload. This value should be less than
+flex_payload_limit in struct rte_eth_fdir_info.*/
+};
+
+/**
+ * A structure used to define FDIR masks for flexible payload
+ * for each flow type
+ */
+struct rte_eth_fdir_flex_mask {
+   enum rte_eth_flow_type flow_type;  /**< Flow type */
+   uint8_t mask[RTE_ETH_FDIR_MAX_FLEXLEN];
+   /**< Mask for the whole flexible payload */
+};
+
+/**
+ * A structure used to define all flexible payload related setting
+ * include flexpay load and flex mask
+ */
+struct rte_eth_fdir_flex_conf {
+   uint16_t nb_payloads;  /**< The number of following payload cfg */
+   uint16_t nb_flexmasks; /**< The number of following mask */
+   struct rte_eth_flex_payload_cfg flex_set[RTE_ETH_PAYLOAD_MAX];
+   /**< Flex payload configuration for each payload type */
+   struct rte_eth_fdir_flex_mask flex_mask[RTE_ETH_FLOW_TYPE_MAX];
+   /**< Flex mask configuration for each flow type */
+};
+
+/**
+ *  Flow Director setting modes: none, signature or perfect.
+ */
+enum rte_fdir_mode {
+   RTE_FDIR_MODE_NONE  = 0, /**< Disable FDIR support. */
+   RTE_FDIR_MODE_SIGNATURE, /**< Enable FDIR signature filter mode. */
+   RTE_FDIR_MODE_PERFECT,   /**< Enable FDIR perfect filter mode. */
+};
+
+/**
+ * A structure used to get the information of flow director filter.
+ * It supports RTE_ETH_FILTER_FDIR with RTE_ETH_FILTER_INFO operation.
+ * It includes the mode, flexible payload configuration information,
+ * capabilities and supported flow types, flexible payload characters.
+ * It can be gotten to help taking specific configurations per device.
+ */
+struct rte_eth_fdir_info {
+   enum rte_fdir_mode mode; /**< Flow director mode */
+   struct rte_eth_fdir_flex_conf flex_conf;
+   /**< Flex payload configuration information */
+   uint32_t guarant_spc;  /**< Guaranteed spaces.*/
+   uint32_t best_spc; /**< Best effort spaces.*/
+   uint32_t flow_types_mask[RTE_ETH_FLOW_TYPE_MAX / sizeof(uint32_t)];
+   /**< Bit mask for every supported flow type. */
+   uint32_t max_flexpayload;  /**< Total flex payload in bytes. */
+   uint32_t flex_payload_unit;
+   /**< Flexible payload unit in bytes. Size and alignments of all flex
+payload segments should be multiplies of this value. */
+   uint32_t max_flex_payload_segment_num;
+   /**< Max number of flexible payload continuous segments.
+Each segment should be a multiple of flex_payload_unit.*/
+   uint16_t flex_payload_limit;
+   /**< Maximum src_offset in bytes allowed. It indicates that
+src_offset[i] in struct rte_eth_flex_payload_cfg should be
+less than this value. */
+   uint32_t flex_bitmask_unit;
+   /**< Flex bitmask unit in bytes. Size of flex bitmasks should
+be a multiply of this value. */
+   uint32_t max_flex_bitmask_num;
+   /**< Max supported size of flex bitmasks in flex_bitmask_unit */
+};
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index c29525b..b658cf4 100644
--- 

[dpdk-dev] [PATCH v6 13/22] testpmd: add test command to flush flow director table

2014-11-21 Thread Jingjing Wu
Test command is added to flush flow director table

Signed-off-by: jingjing.wu 
---
 app/test-pmd/cmdline.c | 49 +
 1 file changed, 49 insertions(+)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 91f6388..066769f 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -706,6 +706,9 @@ static void cmd_help_long_parsed(void *parsed_result,
" flexbytes (flexbytes_value) (drop|fwd)"
" queue (queue_id) fd_id (fd_id_value)\n"
"Add/Del a SCTP type flow director filter.\n\n"
+
+   "flush_flow_director (port_id)\n"
+   "Flush all flow director entries of a device.\n\n"
);
}
 }
@@ -8123,6 +8126,51 @@ cmdline_parse_inst_t cmd_add_del_sctp_flow_director = {
},
 };

+struct cmd_flush_flow_director_result {
+   cmdline_fixed_string_t flush_flow_director;
+   uint8_t port_id;
+};
+
+cmdline_parse_token_string_t cmd_flush_flow_director_flush =
+   TOKEN_STRING_INITIALIZER(struct cmd_flush_flow_director_result,
+flush_flow_director, "flush_flow_director");
+cmdline_parse_token_num_t cmd_flush_flow_director_port_id =
+   TOKEN_NUM_INITIALIZER(struct cmd_flush_flow_director_result,
+ port_id, UINT8);
+
+static void
+cmd_flush_flow_director_parsed(void *parsed_result,
+ __attribute__((unused)) struct cmdline *cl,
+ __attribute__((unused)) void *data)
+{
+   struct cmd_flow_director_result *res = parsed_result;
+   int ret = 0;
+
+   ret = rte_eth_dev_filter_supported(res->port_id, RTE_ETH_FILTER_FDIR);
+   if (ret < 0) {
+   printf("flow director is not supported on port %u.\n",
+   res->port_id);
+   return;
+   }
+
+   ret = rte_eth_dev_filter_ctrl(res->port_id, RTE_ETH_FILTER_FDIR,
+   RTE_ETH_FILTER_FLUSH, NULL);
+   if (ret < 0)
+   printf("flow director table flushing error: (%s)\n",
+   strerror(-ret));
+}
+
+cmdline_parse_inst_t cmd_flush_flow_director = {
+   .f = cmd_flush_flow_director_parsed,
+   .data = NULL,
+   .help_str = "flush all flow director entries of a device on NIC",
+   .tokens = {
+   (void *)_flush_flow_director_flush,
+   (void *)_flush_flow_director_port_id,
+   NULL,
+   },
+};
+
 /* 

 */

 /* list of instructions */
@@ -8255,6 +8303,7 @@ cmdline_parse_ctx_t main_ctx[] = {
(cmdline_parse_inst_t *)_add_del_ip_flow_director,
(cmdline_parse_inst_t *)_add_del_udp_flow_director,
(cmdline_parse_inst_t *)_add_del_sctp_flow_director,
+   (cmdline_parse_inst_t *)_flush_flow_director,
NULL,
 };

-- 
1.8.1.4



[dpdk-dev] [PATCH v6 11/22] testpmd: print extended fdir info in mbuf

2014-11-21 Thread Jingjing Wu
Extended fdir info is printed in rxonly fwd engine when fdir match.

Signed-off-by: jingjing.wu 
---
 app/test-pmd/rxonly.c | 14 +++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/app/test-pmd/rxonly.c b/app/test-pmd/rxonly.c
index 9ad1df6..88b65bc 100644
--- a/app/test-pmd/rxonly.c
+++ b/app/test-pmd/rxonly.c
@@ -167,10 +167,18 @@ pkt_burst_receive(struct fwd_stream *fs)
if (ol_flags & PKT_RX_RSS_HASH) {
printf(" - RSS hash=0x%x", (unsigned) mb->hash.rss);
printf(" - RSS queue=0x%x",(unsigned) fs->rx_queue);
+   } else if (ol_flags & PKT_RX_FDIR) {
+   printf(" - FDIR matched ");
+   if (ol_flags & PKT_RX_FDIR_ID)
+   printf("ID=0x%x",
+  mb->hash.fdir.hi);
+   else if (ol_flags & PKT_RX_FDIR_FLX)
+   printf("flex bytes=0x%08x %08x",
+  mb->hash.fdir.hi, mb->hash.fdir.lo);
+   else
+   printf("hash=0x%x ID=0x%x ",
+  mb->hash.fdir.hash, mb->hash.fdir.id);
}
-   else if (ol_flags & PKT_RX_FDIR)
-   printf(" - FDIR hash=0x%x - FDIR id=0x%x ",
-  mb->hash.fdir.hash, mb->hash.fdir.id);
if (ol_flags & PKT_RX_VLAN_PKT)
printf(" - VLAN tci=0x%x", mb->vlan_tci);
if (is_encapsulation) {
-- 
1.8.1.4



[dpdk-dev] [PATCH v6 08/22] i40e: match counter for flow director

2014-11-21 Thread Jingjing Wu
support to get the fdir_match counter

Signed-off-by: jingjing.wu 
---
 lib/librte_pmd_i40e/i40e_ethdev.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/lib/librte_pmd_i40e/i40e_ethdev.c 
b/lib/librte_pmd_i40e/i40e_ethdev.c
index 66286ee..c88eb42 100644
--- a/lib/librte_pmd_i40e/i40e_ethdev.c
+++ b/lib/librte_pmd_i40e/i40e_ethdev.c
@@ -1360,6 +1360,9 @@ i40e_dev_stats_get(struct rte_eth_dev *dev, struct 
rte_eth_stats *stats)
I40E_GLPRT_PTC9522L(hw->port),
pf->offset_loaded, >tx_size_big,
>tx_size_big);
+   i40e_stat_update_32(hw, I40E_GLQF_PCNT(pf->fdir.match_counter_index),
+  pf->offset_loaded,
+  >fd_sb_match, >fd_sb_match);
/* GLPRT_MSPDC not supported */
/* GLPRT_XEC not supported */

@@ -1376,6 +1379,7 @@ i40e_dev_stats_get(struct rte_eth_dev *dev, struct 
rte_eth_stats *stats)
stats->obytes   = ns->eth.tx_bytes;
stats->oerrors  = ns->eth.tx_errors;
stats->imcasts  = ns->eth.rx_multicast;
+   stats->fdirmatch = ns->fd_sb_match;

/* Rx Errors */
stats->ibadcrc  = ns->crc_errors;
@@ -1451,6 +1455,7 @@ i40e_dev_stats_get(struct rte_eth_dev *dev, struct 
rte_eth_stats *stats)
ns->mac_short_packet_dropped);
PMD_DRV_LOG(DEBUG, "checksum_error:   %lu",
ns->checksum_error);
+   PMD_DRV_LOG(DEBUG, "fdir_match:   %lu", ns->fd_sb_match);
PMD_DRV_LOG(DEBUG, "* PF stats end 
");
 }

-- 
1.8.1.4



[dpdk-dev] [PATCH v6 06/22] i40e: implement operations to add/delete flow director

2014-11-21 Thread Jingjing Wu
deal with two operations for flow director
 - RTE_ETH_FILTER_ADD
 - RTE_ETH_FILTER_DELETE
encode the flow inputs to programming packet
sent the packet to filter programming queue and check status on the status 
report queue

Signed-off-by: jingjing.wu 
---
 lib/librte_pmd_i40e/i40e_ethdev.c |   3 +
 lib/librte_pmd_i40e/i40e_ethdev.h |   3 +
 lib/librte_pmd_i40e/i40e_fdir.c   | 518 +-
 3 files changed, 523 insertions(+), 1 deletion(-)

diff --git a/lib/librte_pmd_i40e/i40e_ethdev.c 
b/lib/librte_pmd_i40e/i40e_ethdev.c
index 29b971c..66286ee 100644
--- a/lib/librte_pmd_i40e/i40e_ethdev.c
+++ b/lib/librte_pmd_i40e/i40e_ethdev.c
@@ -5111,6 +5111,9 @@ i40e_dev_filter_ctrl(struct rte_eth_dev *dev,
case RTE_ETH_FILTER_TUNNEL:
ret = i40e_tunnel_filter_handle(dev, filter_op, arg);
break;
+   case RTE_ETH_FILTER_FDIR:
+   ret = i40e_fdir_ctrl_func(dev, filter_op, arg);
+   break;
default:
PMD_DRV_LOG(WARNING, "Filter type (%d) not supported",
filter_type);
diff --git a/lib/librte_pmd_i40e/i40e_ethdev.h 
b/lib/librte_pmd_i40e/i40e_ethdev.h
index cda309a..fbce86a 100644
--- a/lib/librte_pmd_i40e/i40e_ethdev.h
+++ b/lib/librte_pmd_i40e/i40e_ethdev.h
@@ -441,6 +441,9 @@ enum i40e_filter_pctype i40e_flowtype_to_pctype(
enum rte_eth_flow_type flow_type);
 enum rte_eth_flow_type i40e_pctype_to_flowtype(
enum i40e_filter_pctype pctype);
+int i40e_fdir_ctrl_func(struct rte_eth_dev *dev,
+ enum rte_filter_op filter_op,
+ void *arg);

 /* I40E_DEV_PRIVATE_TO */
 #define I40E_DEV_PRIVATE_TO_PF(adapter) \
diff --git a/lib/librte_pmd_i40e/i40e_fdir.c b/lib/librte_pmd_i40e/i40e_fdir.c
index ed61f2a..5205530 100644
--- a/lib/librte_pmd_i40e/i40e_fdir.c
+++ b/lib/librte_pmd_i40e/i40e_fdir.c
@@ -44,6 +44,10 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
+#include 

 #include "i40e_logs.h"
 #include "i40e/i40e_type.h"
@@ -51,8 +55,23 @@
 #include "i40e_rxtx.h"

 #define I40E_FDIR_MZ_NAME  "FDIR_MEMZONE"
-#define I40E_FDIR_PKT_LEN   512
+#ifndef IPV6_ADDR_LEN
+#define IPV6_ADDR_LEN  16
+#endif

+#define I40E_FDIR_PKT_LEN   512
+#define I40E_FDIR_IP_DEFAULT_LEN420
+#define I40E_FDIR_IP_DEFAULT_TTL0x40
+#define I40E_FDIR_IP_DEFAULT_VERSION_IHL0x45
+#define I40E_FDIR_TCP_DEFAULT_DATAOFF   0x50
+#define I40E_FDIR_IPv6_DEFAULT_VTC_FLOW 0x6030
+#define I40E_FDIR_IPv6_DEFAULT_HOP_LIMITS   0xFF
+#define I40E_FDIR_IPv6_PAYLOAD_LEN  380
+#define I40E_FDIR_UDP_DEFAULT_LEN   400
+
+/* Wait count and interval for fdir filter programming */
+#define I40E_FDIR_WAIT_COUNT   10
+#define I40E_FDIR_WAIT_INTERVAL_US 1000

 /* Wait count and interval for fdir filter flush */
 #define I40E_FDIR_FLUSH_RETRY   50
@@ -64,6 +83,16 @@
 #define I40E_FLX_OFFSET_IN_FIELD_VECTOR   50

 static int i40e_fdir_rx_queue_init(struct i40e_rx_queue *rxq);
+static int i40e_fdir_construct_pkt(struct i40e_pf *pf,
+const struct rte_eth_fdir_input 
*fdir_input,
+unsigned char *raw_pkt);
+static int i40e_add_del_fdir_filter(struct rte_eth_dev *dev,
+   const struct rte_eth_fdir_filter *filter,
+   bool add);
+static int i40e_fdir_filter_programming(struct i40e_pf *pf,
+   enum i40e_filter_pctype pctype,
+   const struct rte_eth_fdir_filter *filter,
+   bool add);
 static int i40e_fdir_flush(struct rte_eth_dev *dev);

 static int
@@ -347,6 +376,451 @@ i40e_fdir_configure(struct rte_eth_dev *dev)
return ret;
 }

+static inline void
+i40e_fdir_fill_eth_ip_head(const struct rte_eth_fdir_input *fdir_input,
+  unsigned char *raw_pkt)
+{
+   struct ether_hdr *ether = (struct ether_hdr *)raw_pkt;
+   struct ipv4_hdr *ip;
+   struct ipv6_hdr *ip6;
+   static const uint8_t next_proto[] = {
+   [RTE_ETH_FLOW_TYPE_UDPV4] = IPPROTO_UDP,
+   [RTE_ETH_FLOW_TYPE_TCPV4] = IPPROTO_TCP,
+   [RTE_ETH_FLOW_TYPE_SCTPV4] = IPPROTO_SCTP,
+   [RTE_ETH_FLOW_TYPE_IPV4_OTHER] = IPPROTO_IP,
+   [RTE_ETH_FLOW_TYPE_FRAG_IPV4] = IPPROTO_IP,
+   [RTE_ETH_FLOW_TYPE_UDPV6] = IPPROTO_UDP,
+   [RTE_ETH_FLOW_TYPE_TCPV6] = IPPROTO_TCP,
+   [RTE_ETH_FLOW_TYPE_SCTPV6] = IPPROTO_SCTP,
+   [RTE_ETH_FLOW_TYPE_IPV6_OTHER] = IPPROTO_NONE,
+   [RTE_ETH_FLOW_TYPE_FRAG_IPV6] = IPPROTO_NONE,
+   };
+
+   switch (fdir_input->flow_type) {
+   case RTE_ETH_FLOW_TYPE_UDPV4:
+   case RTE_ETH_FLOW_TYPE_TCPV4:
+   case RTE_ETH_FLOW_TYPE_SCTPV4:

[dpdk-dev] [PATCH v6 05/22] i40e: define functions for transition between flow_type and pctype

2014-11-21 Thread Jingjing Wu
- macros to validate flow_type and pctype
- functions for transition between flow_type and pctype:
  - i40e_flowtype_to_pctype
  - i40e_pctype_to_flowtype

Signed-off-by: jingjing.wu 
---
 lib/librte_pmd_i40e/i40e_ethdev.c | 46 +++
 lib/librte_pmd_i40e/i40e_ethdev.h | 28 
 2 files changed, 74 insertions(+)

diff --git a/lib/librte_pmd_i40e/i40e_ethdev.c 
b/lib/librte_pmd_i40e/i40e_ethdev.c
index e57b9b4..29b971c 100644
--- a/lib/librte_pmd_i40e/i40e_ethdev.c
+++ b/lib/librte_pmd_i40e/i40e_ethdev.c
@@ -5120,3 +5120,49 @@ i40e_dev_filter_ctrl(struct rte_eth_dev *dev,

return ret;
 }
+
+enum i40e_filter_pctype
+i40e_flowtype_to_pctype(enum rte_eth_flow_type flow_type)
+{
+   static const enum i40e_filter_pctype pctype_table[] = {
+   [RTE_ETH_FLOW_TYPE_UDPV4] = I40E_FILTER_PCTYPE_NONF_IPV4_UDP,
+   [RTE_ETH_FLOW_TYPE_TCPV4] = I40E_FILTER_PCTYPE_NONF_IPV4_TCP,
+   [RTE_ETH_FLOW_TYPE_SCTPV4] = I40E_FILTER_PCTYPE_NONF_IPV4_SCTP,
+   [RTE_ETH_FLOW_TYPE_IPV4_OTHER] =
+   I40E_FILTER_PCTYPE_NONF_IPV4_OTHER,
+   [RTE_ETH_FLOW_TYPE_FRAG_IPV4] =
+   I40E_FILTER_PCTYPE_FRAG_IPV4,
+   [RTE_ETH_FLOW_TYPE_UDPV6] = I40E_FILTER_PCTYPE_NONF_IPV6_UDP,
+   [RTE_ETH_FLOW_TYPE_TCPV6] = I40E_FILTER_PCTYPE_NONF_IPV6_TCP,
+   [RTE_ETH_FLOW_TYPE_SCTPV6] = I40E_FILTER_PCTYPE_NONF_IPV6_SCTP,
+   [RTE_ETH_FLOW_TYPE_IPV6_OTHER] =
+   I40E_FILTER_PCTYPE_NONF_IPV6_OTHER,
+   [RTE_ETH_FLOW_TYPE_FRAG_IPV6] =
+   I40E_FILTER_PCTYPE_FRAG_IPV6,
+   };
+
+   return pctype_table[flow_type];
+}
+
+enum rte_eth_flow_type
+i40e_pctype_to_flowtype(enum i40e_filter_pctype pctype)
+{
+   static const enum rte_eth_flow_type flowtype_table[] = {
+   [I40E_FILTER_PCTYPE_NONF_IPV4_UDP] = RTE_ETH_FLOW_TYPE_UDPV4,
+   [I40E_FILTER_PCTYPE_NONF_IPV4_TCP] = RTE_ETH_FLOW_TYPE_TCPV4,
+   [I40E_FILTER_PCTYPE_NONF_IPV4_SCTP] = RTE_ETH_FLOW_TYPE_SCTPV4,
+   [I40E_FILTER_PCTYPE_NONF_IPV4_OTHER] =
+   RTE_ETH_FLOW_TYPE_IPV4_OTHER,
+   [I40E_FILTER_PCTYPE_FRAG_IPV4] =
+   RTE_ETH_FLOW_TYPE_FRAG_IPV4,
+   [I40E_FILTER_PCTYPE_NONF_IPV6_UDP] = RTE_ETH_FLOW_TYPE_UDPV6,
+   [I40E_FILTER_PCTYPE_NONF_IPV6_TCP] = RTE_ETH_FLOW_TYPE_TCPV6,
+   [I40E_FILTER_PCTYPE_NONF_IPV6_SCTP] = RTE_ETH_FLOW_TYPE_SCTPV6,
+   [I40E_FILTER_PCTYPE_NONF_IPV6_OTHER] =
+   RTE_ETH_FLOW_TYPE_IPV6_OTHER,
+   [I40E_FILTER_PCTYPE_FRAG_IPV6] =
+   RTE_ETH_FLOW_TYPE_FRAG_IPV6,
+   };
+
+   return flowtype_table[pctype];
+}
diff --git a/lib/librte_pmd_i40e/i40e_ethdev.h 
b/lib/librte_pmd_i40e/i40e_ethdev.h
index 341599d..cda309a 100644
--- a/lib/librte_pmd_i40e/i40e_ethdev.h
+++ b/lib/librte_pmd_i40e/i40e_ethdev.h
@@ -437,6 +437,10 @@ const struct rte_memzone *i40e_memzone_reserve(const char 
*name,
int socket_id);
 int i40e_fdir_configure(struct rte_eth_dev *dev);
 void i40e_fdir_teardown(struct i40e_pf *pf);
+enum i40e_filter_pctype i40e_flowtype_to_pctype(
+   enum rte_eth_flow_type flow_type);
+enum rte_eth_flow_type i40e_pctype_to_flowtype(
+   enum i40e_filter_pctype pctype);

 /* I40E_DEV_PRIVATE_TO */
 #define I40E_DEV_PRIVATE_TO_PF(adapter) \
@@ -499,4 +503,28 @@ i40e_init_adminq_parameter(struct i40e_hw *hw)
hw->aq.asq_buf_size = I40E_AQ_BUF_SZ;
 }

+#define I40E_VALID_FLOW_TYPE(flow_type) \
+   ((flow_type) == RTE_ETH_FLOW_TYPE_UDPV4 || \
+   (flow_type) == RTE_ETH_FLOW_TYPE_TCPV4 || \
+   (flow_type) == RTE_ETH_FLOW_TYPE_SCTPV4 || \
+   (flow_type) == RTE_ETH_FLOW_TYPE_IPV4_OTHER || \
+   (flow_type) == RTE_ETH_FLOW_TYPE_FRAG_IPV4 || \
+   (flow_type) == RTE_ETH_FLOW_TYPE_UDPV6 || \
+   (flow_type) == RTE_ETH_FLOW_TYPE_TCPV6 || \
+   (flow_type) == RTE_ETH_FLOW_TYPE_SCTPV6 || \
+   (flow_type) == RTE_ETH_FLOW_TYPE_IPV6_OTHER || \
+   (flow_type) == RTE_ETH_FLOW_TYPE_FRAG_IPV6)
+
+#define I40E_VALID_PCTYPE(pctype) \
+   ((pctype) == I40E_FILTER_PCTYPE_NONF_IPV4_UDP || \
+   (pctype) == I40E_FILTER_PCTYPE_NONF_IPV4_TCP || \
+   (pctype) == I40E_FILTER_PCTYPE_NONF_IPV4_SCTP || \
+   (pctype) == I40E_FILTER_PCTYPE_NONF_IPV4_OTHER || \
+   (pctype) == I40E_FILTER_PCTYPE_FRAG_IPV4 || \
+   (pctype) == I40E_FILTER_PCTYPE_NONF_IPV6_UDP || \
+   (pctype) == I40E_FILTER_PCTYPE_NONF_IPV6_TCP || \
+   (pctype) == I40E_FILTER_PCTYPE_NONF_IPV6_SCTP || \
+   (pctype) == I40E_FILTER_PCTYPE_NONF_IPV6_OTHER || \
+   

[dpdk-dev] [PATCH v6 04/22] ethdev: define structures for adding/deleting flow director

2014-11-21 Thread Jingjing Wu
define structures to add or delete flow director filter
  - struct rte_eth_fdir_filter

Signed-off-by: jingjing.wu 
---
 lib/librte_ether/rte_eth_ctrl.h | 167 
 1 file changed, 167 insertions(+)

diff --git a/lib/librte_ether/rte_eth_ctrl.h b/lib/librte_ether/rte_eth_ctrl.h
index 8dd384d..9856842 100644
--- a/lib/librte_ether/rte_eth_ctrl.h
+++ b/lib/librte_ether/rte_eth_ctrl.h
@@ -53,6 +53,7 @@ enum rte_filter_type {
RTE_ETH_FILTER_NONE = 0,
RTE_ETH_FILTER_MACVLAN,
RTE_ETH_FILTER_TUNNEL,
+   RTE_ETH_FILTER_FDIR,
RTE_ETH_FILTER_MAX
 };

@@ -155,6 +156,172 @@ struct rte_eth_tunnel_filter_conf {
uint16_t queue_id;  /** < queue number. */
 };

+#define RTE_ETH_FDIR_MAX_FLEXLEN 16 /** < Max length of flexbytes. */
+
+/**
+ * Flow type
+ */
+enum rte_eth_flow_type {
+   RTE_ETH_FLOW_TYPE_NONE = 0,
+   RTE_ETH_FLOW_TYPE_UDPV4,
+   RTE_ETH_FLOW_TYPE_TCPV4,
+   RTE_ETH_FLOW_TYPE_SCTPV4,
+   RTE_ETH_FLOW_TYPE_IPV4_OTHER,
+   RTE_ETH_FLOW_TYPE_FRAG_IPV4,
+   RTE_ETH_FLOW_TYPE_UDPV6,
+   RTE_ETH_FLOW_TYPE_TCPV6,
+   RTE_ETH_FLOW_TYPE_SCTPV6,
+   RTE_ETH_FLOW_TYPE_IPV6_OTHER,
+   RTE_ETH_FLOW_TYPE_FRAG_IPV6,
+   RTE_ETH_FLOW_TYPE_MAX = 64,
+};
+
+/**
+ * A structure used to define the input for IPV4 flow
+ */
+struct rte_eth_ipv4_flow {
+   uint32_t src_ip;  /**< IPv4 source address to match. */
+   uint32_t dst_ip;  /**< IPv4 destination address to match. */
+};
+
+/**
+ * A structure used to define the input for IPV4 UDP flow
+ */
+struct rte_eth_udpv4_flow {
+   struct rte_eth_ipv4_flow ip; /**< IPv4 fields to match. */
+   uint16_t src_port;   /**< UDP source port to match. */
+   uint16_t dst_port;   /**< UDP destination port to match. */
+};
+
+/**
+ * A structure used to define the input for IPV4 TCP flow
+ */
+struct rte_eth_tcpv4_flow {
+   struct rte_eth_ipv4_flow ip; /**< IPv4 fields to match. */
+   uint16_t src_port;   /**< TCP source port to match. */
+   uint16_t dst_port;   /**< TCP destination port to match. */
+};
+
+/**
+ * A structure used to define the input for IPV4 SCTP flow
+ */
+struct rte_eth_sctpv4_flow {
+   struct rte_eth_ipv4_flow ip; /**< IPv4 fields to match. */
+   uint32_t verify_tag; /**< Verify tag to match */
+};
+
+/**
+ * A structure used to define the input for IPV6 flow
+ */
+struct rte_eth_ipv6_flow {
+   uint32_t src_ip[4];  /**< IPv6 source address to match. */
+   uint32_t dst_ip[4];  /**< IPv6 destination address to match. */
+};
+
+/**
+ * A structure used to define the input for IPV6 UDP flow
+ */
+struct rte_eth_udpv6_flow {
+   struct rte_eth_ipv6_flow ip; /**< IPv6 fields to match. */
+   uint16_t src_port;   /**< UDP source port to match. */
+   uint16_t dst_port;   /**< UDP destination port to match. */
+};
+
+/**
+ * A structure used to define the input for IPV6 TCP flow
+ */
+struct rte_eth_tcpv6_flow {
+   struct rte_eth_ipv6_flow ip; /**< IPv6 fields to match. */
+   uint16_t src_port;   /**< TCP source port to match. */
+   uint16_t dst_port;   /**< TCP destination port to match. */
+};
+
+/**
+ * A structure used to define the input for IPV6 SCTP flow
+ */
+struct rte_eth_sctpv6_flow {
+   struct rte_eth_ipv6_flow ip; /**< IPv6 fields to match. */
+   uint32_t verify_tag; /**< Verify tag to match */
+};
+
+/**
+ * An union contains the inputs for all types of flow
+ */
+union rte_eth_fdir_flow {
+   struct rte_eth_udpv4_flow  udp4_flow;
+   struct rte_eth_tcpv4_flow  tcp4_flow;
+   struct rte_eth_sctpv4_flow sctp4_flow;
+   struct rte_eth_ipv4_flow   ip4_flow;
+   struct rte_eth_udpv6_flow  udp6_flow;
+   struct rte_eth_tcpv6_flow  tcp6_flow;
+   struct rte_eth_sctpv6_flow sctp6_flow;
+   struct rte_eth_ipv6_flow   ip6_flow;
+};
+
+/**
+ * A structure used to contain extend input of flow
+ */
+struct rte_eth_fdir_flow_ext {
+   uint16_t vlan_tci;
+   uint8_t flexbytes[RTE_ETH_FDIR_MAX_FLEXLEN];
+   /**< It is filled by the flexible payload to match. */
+};
+
+/**
+ * A structure used to define the input for a flow director filter entry
+ */
+struct rte_eth_fdir_input {
+   enum rte_eth_flow_type flow_type;  /**< Type of flow */
+   union rte_eth_fdir_flow flow;
+   /**< Flow fields to match, dependent on flow_type */
+   struct rte_eth_fdir_flow_ext flow_ext;
+   /**< Additional fields to match */
+};
+
+/**
+ * Behavior will be taken if FDIR match
+ */
+enum rte_eth_fdir_behavior {
+   RTE_ETH_FDIR_ACCEPT = 0,
+   RTE_ETH_FDIR_REJECT,
+};
+
+/**
+ * Flow director report status
+ * It defines what will be reported if FDIR entry is matched.
+ */
+enum rte_eth_fdir_status {
+   RTE_ETH_FDIR_NO_REPORT_STATUS = 0, /**< Report nothing. */
+   RTE_ETH_FDIR_REPORT_ID,   

[dpdk-dev] [PATCH v6 03/22] i40e: initialize flexible payload setting

2014-11-21 Thread Jingjing Wu
set flexible payload related registers to default value at initialization time.

Signed-off-by: jingjing.wu 
---
 lib/librte_pmd_i40e/i40e_ethdev.c | 36 
 lib/librte_pmd_i40e/i40e_ethdev.h | 35 +++
 lib/librte_pmd_i40e/i40e_fdir.c   | 43 +++
 3 files changed, 114 insertions(+)

diff --git a/lib/librte_pmd_i40e/i40e_ethdev.c 
b/lib/librte_pmd_i40e/i40e_ethdev.c
index ac68540..e57b9b4 100644
--- a/lib/librte_pmd_i40e/i40e_ethdev.c
+++ b/lib/librte_pmd_i40e/i40e_ethdev.c
@@ -333,6 +333,35 @@ static struct rte_driver rte_i40e_driver = {

 PMD_REGISTER_DRIVER(rte_i40e_driver);

+/*
+ * Initialize registers for flexible payload, which should be set by NVM.
+ * This should be removed from code once it is fixed in NVM.
+ */
+#ifndef I40E_GLQF_ORT
+#define I40E_GLQF_ORT(_i)(0x00268900 + ((_i) * 4))
+#endif
+#ifndef I40E_GLQF_PIT
+#define I40E_GLQF_PIT(_i)(0x00268C80 + ((_i) * 4))
+#endif
+
+static inline void i40e_flex_payload_reg_init(struct i40e_hw *hw)
+{
+   I40E_WRITE_REG(hw, I40E_GLQF_ORT(18), 0x0030);
+   I40E_WRITE_REG(hw, I40E_GLQF_ORT(19), 0x0030);
+   I40E_WRITE_REG(hw, I40E_GLQF_ORT(26), 0x002B);
+   I40E_WRITE_REG(hw, I40E_GLQF_ORT(30), 0x002B);
+   I40E_WRITE_REG(hw, I40E_GLQF_ORT(33), 0x00E0);
+   I40E_WRITE_REG(hw, I40E_GLQF_ORT(34), 0x00E3);
+   I40E_WRITE_REG(hw, I40E_GLQF_ORT(35), 0x00E6);
+   I40E_WRITE_REG(hw, I40E_GLQF_ORT(20), 0x0031);
+   I40E_WRITE_REG(hw, I40E_GLQF_ORT(23), 0x0031);
+   I40E_WRITE_REG(hw, I40E_GLQF_ORT(63), 0x002D);
+
+   /* GLQF_PIT Registers */
+   I40E_WRITE_REG(hw, I40E_GLQF_PIT(16), 0x7480);
+   I40E_WRITE_REG(hw, I40E_GLQF_PIT(17), 0x7440);
+}
+
 static int
 eth_i40e_dev_init(__rte_unused struct eth_driver *eth_drv,
   struct rte_eth_dev *dev)
@@ -396,6 +425,13 @@ eth_i40e_dev_init(__rte_unused struct eth_driver *eth_drv,
return ret;
}

+   /*
+* To work around the NVM issue,initialize registers
+* for flexible payload by software.
+* It should be removed once issues are fixed in NVM.
+*/
+   i40e_flex_payload_reg_init(hw);
+
/* Initialize the parameters for adminq */
i40e_init_adminq_parameter(hw);
ret = i40e_init_adminq(hw);
diff --git a/lib/librte_pmd_i40e/i40e_ethdev.h 
b/lib/librte_pmd_i40e/i40e_ethdev.h
index 7ad6501..341599d 100644
--- a/lib/librte_pmd_i40e/i40e_ethdev.h
+++ b/lib/librte_pmd_i40e/i40e_ethdev.h
@@ -57,6 +57,17 @@
 /* Always assign pool 0 to main VSI, VMDQ will start from 1 */
 #define I40E_VMDQ_POOL_BASE   1

+/* index flex payload per layer */
+enum i40e_flxpld_layer_idx {
+   I40E_FLXPLD_L2_IDX= 0,
+   I40E_FLXPLD_L3_IDX= 1,
+   I40E_FLXPLD_L4_IDX= 2,
+   I40E_MAX_FLXPLD_LAYER = 3,
+};
+#define I40E_MAX_FLXPLD_FIED3  /* max number of flex payload fields */
+#define I40E_FDIR_BITMASK_NUM_WORD  2  /* max number of bitmask words */
+#define I40E_FDIR_MAX_FLEXWORD_NUM  8  /* max number of flexpayload words */
+
 /* i40e flags */
 #define I40E_FLAG_RSS   (1ULL << 0)
 #define I40E_FLAG_DCB   (1ULL << 1)
@@ -244,6 +255,24 @@ struct i40e_vmdq_info {
 };

 /*
+ * Structure to store flex pit for flow diretor.
+ */
+struct i40e_fdir_flex_pit {
+   uint8_t src_offset;/* offset in words from the beginning of payload 
*/
+   uint8_t size;  /* size in words */
+   uint8_t dst_offset;/* offset in words of flexible payload */
+};
+
+struct i40e_fdir_flex_mask {
+   uint8_t word_mask;  /**< Bit i enables word i of flexible payload */
+   struct {
+   uint8_t offset;
+   uint16_t mask;
+   } bitmask[I40E_FDIR_BITMASK_NUM_WORD];
+};
+
+#define I40E_FILTER_PCTYPE_MAX 64
+/*
  *  A structure used to define fields of a FDIR related info.
  */
 struct i40e_fdir_info {
@@ -253,6 +282,12 @@ struct i40e_fdir_info {
struct i40e_rx_queue *rxq;
void *prg_pkt; /* memory for fdir program packet */
uint64_t dma_addr; /* physic address of packet memory*/
+   /*
+* the rule how bytes stream is extracted as flexible payload
+* for each payload layer, the setting can up to three elements
+*/
+   struct i40e_fdir_flex_pit flex_set[I40E_MAX_FLXPLD_LAYER * 
I40E_MAX_FLXPLD_FIED];
+   struct i40e_fdir_flex_mask flex_mask[I40E_FILTER_PCTYPE_MAX];
 };

 /*
diff --git a/lib/librte_pmd_i40e/i40e_fdir.c b/lib/librte_pmd_i40e/i40e_fdir.c
index 9b678ce..ed61f2a 100644
--- a/lib/librte_pmd_i40e/i40e_fdir.c
+++ b/lib/librte_pmd_i40e/i40e_fdir.c
@@ -265,6 +265,47 @@ i40e_fdir_empty(struct i40e_hw *hw)
 }

 /*
+ * Initialize the configuration about bytes stream extracted as flexible 
payload
+ * and mask setting
+ */
+static inline void
+i40e_init_flx_pld(struct i40e_pf 

[dpdk-dev] [PATCH v6 02/22] i40e: tear down flow director

2014-11-21 Thread Jingjing Wu
release fortville resources on flow director, includes
 - queue 0 pair release
 - release vsi

Signed-off-by: jingjing.wu 
---
 lib/librte_pmd_i40e/i40e_ethdev.c |  7 +++
 lib/librte_pmd_i40e/i40e_ethdev.h |  1 +
 lib/librte_pmd_i40e/i40e_fdir.c   | 21 +
 3 files changed, 29 insertions(+)

diff --git a/lib/librte_pmd_i40e/i40e_ethdev.c 
b/lib/librte_pmd_i40e/i40e_ethdev.c
index 46115c7..ac68540 100644
--- a/lib/librte_pmd_i40e/i40e_ethdev.c
+++ b/lib/librte_pmd_i40e/i40e_ethdev.c
@@ -521,6 +521,7 @@ eth_i40e_dev_init(__rte_unused struct eth_driver *eth_drv,
 err_mac_alloc:
i40e_vsi_release(pf->main_vsi);
 err_setup_pf_switch:
+   i40e_fdir_teardown(pf);
 err_get_mac_addr:
 err_configure_lan_hmc:
(void)i40e_shutdown_lan_hmc(hw);
@@ -877,11 +878,16 @@ i40e_dev_stop(struct rte_eth_dev *dev)
i40e_vsi_queues_unbind_intr(pf->vmdq[i].vsi);
}

+   if (pf->flags & I40E_FLAG_FDIR) {
+   i40e_vsi_queues_bind_intr(pf->fdir.fdir_vsi);
+   i40e_vsi_enable_queues_intr(pf->fdir.fdir_vsi);
+   }
/* Clear all queues and release memory */
i40e_dev_clear_queues(dev);

/* Set link down */
i40e_dev_set_link_down(dev);
+
 }

 static void
@@ -903,6 +909,7 @@ i40e_dev_close(struct rte_eth_dev *dev)
i40e_shutdown_lan_hmc(hw);

/* release all the existing VSIs and VEBs */
+   i40e_fdir_teardown(pf);
i40e_vsi_release(pf->main_vsi);

/* shutdown the adminq */
diff --git a/lib/librte_pmd_i40e/i40e_ethdev.h 
b/lib/librte_pmd_i40e/i40e_ethdev.h
index e9c714c..7ad6501 100644
--- a/lib/librte_pmd_i40e/i40e_ethdev.h
+++ b/lib/librte_pmd_i40e/i40e_ethdev.h
@@ -401,6 +401,7 @@ const struct rte_memzone *i40e_memzone_reserve(const char 
*name,
uint32_t len,
int socket_id);
 int i40e_fdir_configure(struct rte_eth_dev *dev);
+void i40e_fdir_teardown(struct i40e_pf *pf);

 /* I40E_DEV_PRIVATE_TO */
 #define I40E_DEV_PRIVATE_TO_PF(adapter) \
diff --git a/lib/librte_pmd_i40e/i40e_fdir.c b/lib/librte_pmd_i40e/i40e_fdir.c
index 7708887..9b678ce 100644
--- a/lib/librte_pmd_i40e/i40e_fdir.c
+++ b/lib/librte_pmd_i40e/i40e_fdir.c
@@ -225,6 +225,27 @@ fail_setup_tx:
return err;
 }

+/*
+ * i40e_fdir_teardown - release the Flow Director resources
+ * @pf: board private structure
+ */
+void
+i40e_fdir_teardown(struct i40e_pf *pf)
+{
+   struct i40e_hw *hw = I40E_PF_TO_HW(pf);
+   struct i40e_vsi *vsi;
+
+   vsi = pf->fdir.fdir_vsi;
+   i40e_switch_tx_queue(hw, vsi->base_queue, FALSE);
+   i40e_switch_rx_queue(hw, vsi->base_queue, FALSE);
+   i40e_dev_rx_queue_release(pf->fdir.rxq);
+   pf->fdir.rxq = NULL;
+   i40e_dev_tx_queue_release(pf->fdir.txq);
+   pf->fdir.txq = NULL;
+   i40e_vsi_release(vsi);
+   pf->fdir.fdir_vsi = NULL;
+}
+
 /* check whether the flow director table in empty */
 static inline int
 i40e_fdir_empty(struct i40e_hw *hw)
-- 
1.8.1.4



[dpdk-dev] [PATCH v6 01/22] i40e: set up and initialize flow director

2014-11-21 Thread Jingjing Wu
set up fortville resources to support flow director, includes
 - queue 0 pair allocated and set up for flow director
 - create vsi
 - reserve memzone for flow director programming packet

Signed-off-by: jingjing.wu 
---
 lib/librte_pmd_i40e/Makefile  |   2 +
 lib/librte_pmd_i40e/i40e_ethdev.c |  78 +++--
 lib/librte_pmd_i40e/i40e_ethdev.h |  25 ++-
 lib/librte_pmd_i40e/i40e_fdir.c   | 324 ++
 lib/librte_pmd_i40e/i40e_rxtx.c   | 144 +
 5 files changed, 562 insertions(+), 11 deletions(-)
 create mode 100644 lib/librte_pmd_i40e/i40e_fdir.c

diff --git a/lib/librte_pmd_i40e/Makefile b/lib/librte_pmd_i40e/Makefile
index bd3428f..98e4bdf 100644
--- a/lib/librte_pmd_i40e/Makefile
+++ b/lib/librte_pmd_i40e/Makefile
@@ -91,6 +91,8 @@ SRCS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += i40e_ethdev.c
 SRCS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += i40e_rxtx.c
 SRCS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += i40e_ethdev_vf.c
 SRCS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += i40e_pf.c
+SRCS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += i40e_fdir.c
+
 # this lib depends upon:
 DEPDIRS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += lib/librte_eal lib/librte_ether
 DEPDIRS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += lib/librte_mempool lib/librte_mbuf
diff --git a/lib/librte_pmd_i40e/i40e_ethdev.c 
b/lib/librte_pmd_i40e/i40e_ethdev.c
index 5074262..46115c7 100644
--- a/lib/librte_pmd_i40e/i40e_ethdev.c
+++ b/lib/librte_pmd_i40e/i40e_ethdev.c
@@ -811,6 +811,18 @@ i40e_dev_start(struct rte_eth_dev *dev)
i40e_vsi_enable_queues_intr(pf->vmdq[i].vsi);
}

+   ret = i40e_fdir_configure(dev);
+   if (ret < 0) {
+   PMD_DRV_LOG(ERR, "failed to configure fdir.");
+   goto err_up;
+   }
+
+   /* enable FDIR MSIX interrupt */
+   if (pf->flags & I40E_FLAG_FDIR) {
+   i40e_vsi_queues_bind_intr(pf->fdir.fdir_vsi);
+   i40e_vsi_enable_queues_intr(pf->fdir.fdir_vsi);
+   }
+
/* Enable all queues which have been configured */
ret = i40e_dev_switch_queues(pf, TRUE);
if (ret != I40E_SUCCESS) {
@@ -2818,16 +2830,30 @@ i40e_vsi_setup(struct i40e_pf *pf,
case I40E_VSI_VMDQ2:
vsi->nb_qps = pf->vmdq_nb_qps;
break;
+   case I40E_VSI_FDIR:
+   vsi->nb_qps = pf->fdir_nb_qps;
+   break;
default:
goto fail_mem;
}
-   ret = i40e_res_pool_alloc(>qp_pool, vsi->nb_qps);
-   if (ret < 0) {
-   PMD_DRV_LOG(ERR, "VSI %d allocate queue failed %d",
-   vsi->seid, ret);
-   goto fail_mem;
-   }
-   vsi->base_queue = ret;
+   /*
+* The filter status descriptor is reported in rx queue 0,
+* while the tx queue for fdir filter programming has no
+* such constraints, can be non-zero queues.
+* To simplify it, choose FDIR vsi use queue 0 pair.
+* To make sure it will use queue 0 pair, queue allocation
+* need be done before this function is called
+*/
+   if (type != I40E_VSI_FDIR) {
+   ret = i40e_res_pool_alloc(>qp_pool, vsi->nb_qps);
+   if (ret < 0) {
+   PMD_DRV_LOG(ERR, "VSI %d allocate queue failed 
%d",
+   vsi->seid, ret);
+   goto fail_mem;
+   }
+   vsi->base_queue = ret;
+   } else
+   vsi->base_queue = I40E_FDIR_QUEUE_ID;

/* VF has MSIX interrupt in VF range, don't allocate here */
if (type != I40E_VSI_SRIOV) {
@@ -2996,6 +3022,23 @@ i40e_vsi_setup(struct i40e_pf *pf,
ctxt.info.up_enable_bits = I40E_DEFAULT_TCMAP;
ctxt.info.valid_sections |=
rte_cpu_to_le_16(I40E_AQ_VSI_PROP_SCHED_VALID);
+   } else if (type == I40E_VSI_FDIR) {
+   vsi->uplink_seid = uplink_vsi->uplink_seid;
+   ctxt.pf_num = hw->pf_id;
+   ctxt.vf_num = 0;
+   ctxt.uplink_seid = vsi->uplink_seid;
+   ctxt.connection_type = 0x1; /* regular data port */
+   ctxt.flags = I40E_AQ_VSI_TYPE_PF;
+   ret = i40e_vsi_config_tc_queue_mapping(vsi, ,
+   I40E_DEFAULT_TCMAP);
+   if (ret != I40E_SUCCESS) {
+   PMD_DRV_LOG(ERR, "Failed to configure "
+   "TC queue mapping.");
+   goto fail_msix_alloc;
+   }
+   ctxt.info.up_enable_bits = I40E_DEFAULT_TCMAP;
+   ctxt.info.valid_sections |=
+   rte_cpu_to_le_16(I40E_AQ_VSI_PROP_SCHED_VALID);
} else {
PMD_DRV_LOG(ERR, "VSI: Not support other type VSI yet");
goto fail_msix_alloc;
@@ -3184,8 +3227,16 @@ i40e_pf_setup(struct i40e_pf *pf)

[dpdk-dev] [PATCH v6 00/22] Support flow director programming on Fortville

2014-11-21 Thread Jingjing Wu
The patch set supports flow director on fortville.
It includes:
 - set up/tear down fortville resources to support flow director, such as queue 
and vsi.
 - support operation to add or delete 8 flow types of the flow director 
filters, they are ipv4, tcpv4, udpv4, sctpv4, ipv6, tcpv6, udpv6, sctpv6.
 - support flushing flow director table (all filters).
 - support operation to get flow director information.
 - match status statistics, FD_ID report.
 - support operation to configure flexible payload and its mask
 - support flexible payload involved in comparison and flex bytes report.

v2 changes:
 - create real fdir vsi and assign queue 0 pair to it.
 - check filter status report on the rx queue 0

v3 changes:
 - redefine filter APIs to support multi-kind filters
 - support sctpv4 and sctpv6 type flows
 - support flexible payload involved in comparison

v4 changes:
 - strip the filter APIs definitions from this patch set
 - extend mbuf field to support flex bytes report.
 - fix typos.

v5 changes:
 - redefine structure rte_eth_fdir_info
 - add doxygen comments about flexible payload and mbuf extend
 - fix typos

v6 changes:
 - extend structure rte_eth_fdir_info
 - move the flex payload and mask setting from filter_ctrl api
   to i40e_fdir_configure when start device
 - change the structure for flex payload and mask setting, and
   add verification of those arguments before HW setting is taken.
 - change flexpayloads from words to bytes format
 - add two more flow_types
 - organize duplicate code lines to macro or function
 - add and correct doxygen comments
 - fix the merging error in v5

Jingjing Wu (22):
  i40e: set up and initialize flow director
  i40e: tear down flow director
  i40e: initialize flexible payload setting
  ethdev: define structures for adding/deleting flow director
  i40e: define functions for transition between flow_type and pctype
  i40e: implement operations to add/delete flow director
  testpmd: add test commands to add/delete flow director filter
  i40e: match counter for flow director
  mbuf: extend fdir field
  i40e: report flow director match info to mbuf
  testpmd: print extended fdir info in mbuf
  i40e: implement operation to flush flow director table
  testpmd: add test command to flush flow director table
  ethdev: define structures for getting flow director information
  i40e: implement operations to get fdir info
  ethdev: define structures for getting flow director statistics
  i40e: implement operations to get fdir statistics
  testpmd: display fdir info
  ethdev: add flexible payload setting in eth_conf
  i40e: take flow director flexible payload configuration
  testpmd: add test command to configure flexible mask
  testpmd: add test command to configure flexible payload

 app/test-pmd/cmdline.c|  644 ++
 app/test-pmd/config.c |  202 +-
 app/test-pmd/rxonly.c |   14 +-
 app/test-pmd/testpmd.h|5 +-
 lib/librte_ether/rte_eth_ctrl.h   |  279 +++-
 lib/librte_ether/rte_ethdev.h |   11 +-
 lib/librte_mbuf/rte_mbuf.h|   17 +-
 lib/librte_pmd_i40e/Makefile  |2 +
 lib/librte_pmd_i40e/i40e_ethdev.c |  175 -
 lib/librte_pmd_i40e/i40e_ethdev.h |   93 ++-
 lib/librte_pmd_i40e/i40e_fdir.c   | 1362 +
 lib/librte_pmd_i40e/i40e_rxtx.c   |  207 +-
 12 files changed, 2965 insertions(+), 46 deletions(-)
 create mode 100644 lib/librte_pmd_i40e/i40e_fdir.c

-- 
1.8.1.4



[dpdk-dev] [PATCH v2 2/6] ENIC PMD Makefile

2014-11-21 Thread Neil Horman
On Fri, Nov 21, 2014 at 10:02:59PM +0530, Sujith Sankar wrote:
> Signed-off-by: Sujith Sankar 
> ---
>  lib/librte_pmd_enic/Makefile | 67 
> 
>  1 file changed, 67 insertions(+)
>  create mode 100644 lib/librte_pmd_enic/Makefile
> 
> diff --git a/lib/librte_pmd_enic/Makefile b/lib/librte_pmd_enic/Makefile
> new file mode 100644
> index 000..2073cd6
> --- /dev/null
> +++ b/lib/librte_pmd_enic/Makefile
> @@ -0,0 +1,67 @@
> +#   BSD LICENSE
> +# 
> +#   Copyright(c) 2010-2013 Intel Corporation. All rights reserved.
> +#   All rights reserved.
> +# 
This should be (c) Cisco, shouldn't it?

> +#   Redistribution and use in source and binary forms, with or without 
> +#   modification, are permitted provided that the following conditions 
> +#   are met:
> +# 
> +# * Redistributions of source code must retain the above copyright 
> +#   notice, this list of conditions and the following disclaimer.
> +# * Redistributions in binary form must reproduce the above copyright 
> +#   notice, this list of conditions and the following disclaimer in 
> +#   the documentation and/or other materials provided with the 
> +#   distribution.
> +# * Neither the name of Intel Corporation nor the names of its 
> +#   contributors may be used to endorse or promote products derived 
> +#   from this software without specific prior written permission.
> +# 
> +#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
> +#   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
> +#   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 
> +#   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
> +#   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
> +#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
> +#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 
> +#   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 
> +#   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
> +#   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
> +#   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> +# 
> +
> +include $(RTE_SDK)/mk/rte.vars.mk
> +
> +#
> +# library name
> +#
> +LIB = librte_pmd_enic.a
> +
> +CFLAGS += -I$(RTE_SDK)/lib/librte_hash/ -I$(RTE_SDK)/lib/librte_pmd_enic/
> +CFLAGS += -I$(RTE_SDK)/lib/librte_pmd_enic/vnic/
> +CFLAGS += -O3 -Wno-deprecated
> +
> +VPATH += $(RTE_SDK)/lib/librte_pmd_enic/src
> +
> +#
> +# all source are stored in SRCS-y
> +#
> +SRCS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += enic_main.c 
> +SRCS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += enic_clsf.c 
> +SRCS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += vnic/vnic_cq.c 
> +SRCS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += vnic/vnic_wq.c 
> +SRCS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += vnic/vnic_dev.c 
> +SRCS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += vnic/vnic_intr.c 
> +SRCS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += vnic/vnic_rq.c 
> +SRCS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += enic_etherdev.c
> +SRCS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += enic_res.c
> +SRCS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += vnic/vnic_rss.c
> +
> +
> +# this lib depends upon:
> +DEPDIRS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += lib/librte_eal lib/librte_ether
> +DEPDIRS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += lib/librte_mempool lib/librte_mbuf
> +DEPDIRS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += lib/librte_net lib/librte_malloc
> +
> +include $(RTE_SDK)/mk/rte.lib.mk
> +
> -- 
> 1.9.1
> 
> 


[dpdk-dev] [PATCH v5 4/7] hash: add rte_hash_crc_8byte function

2014-11-21 Thread Neil Horman
On Thu, Nov 20, 2014 at 11:16:34AM +0600, Yerden Zhumabekov wrote:
> SSE4.2 provides CRC32 intrinsic with 8-byte operand.
> 
> Signed-off-by: Yerden Zhumabekov 
> ---
>  lib/librte_hash/rte_hash_crc.h |   16 
>  1 file changed, 16 insertions(+)
> 
> diff --git a/lib/librte_hash/rte_hash_crc.h b/lib/librte_hash/rte_hash_crc.h
> index cd28833..2c8ec99 100644
> --- a/lib/librte_hash/rte_hash_crc.h
> +++ b/lib/librte_hash/rte_hash_crc.h
> @@ -413,6 +413,22 @@ rte_hash_crc_4byte(uint32_t data, uint32_t init_val)
>  }
>  
>  /**
> + * Use single crc32 instruction to perform a hash on a 8 byte value.
> + *
> + * @param data
> + *   Data to perform hash on.
> + * @param init_val
> + *   Value to initialise hash generator.
> + * @return
> + *   32bit calculated hash value.
> + */
> +static inline uint32_t
> +rte_hash_crc_8byte(uint64_t data, uint32_t init_val)
> +{
> + return crc32c_sse42_u64(data, init_val);
> +}
> +
> +/**
>   * Use crc32 instruction to perform a hash.
>   *
>   * @param data
> -- 
> 1.7.9.5
> 
> 

I'm sorry, it may be early here, so I may be missing something. The assembly
implementations look great, but if a user calls rte_hash_crc_8byte on a system
that doesn't support ss342, how do they wind up getting into the software crc
implementation given what you have above?
Neil



[dpdk-dev] [PATCH v8 10/10] app/testpmd:test VxLAN Tx checksum offload

2014-11-21 Thread Liu, Jijiang


> -Original Message-
> From: Olivier MATZ [mailto:olivier.matz at 6wind.com]
> Sent: Friday, November 21, 2014 12:36 AM
> To: Liu, Jijiang
> Cc: Thomas Monjalon; dev
> Subject: Re: [dpdk-dev] [PATCH v8 10/10] app/testpmd:test VxLAN Tx checksum
> offload
> 
> Hi Jijiang,
> 
> On 11/20/2014 08:28 AM, Liu, Jijiang wrote:
> >> The original behavior (without your vxlan patches), which still works
> >> today, is to select inner or outer using the m->l2_len field:
> >>
> >>- checksum outer IP + UDP
> >>  m->l2_len=14 m->l3_len=20
> >>  flags=PKT_TX_IP_CKSUM PKT_TX_UDP_CKSUM
> >>
> >>- checksum inner IP + UDP
> >>  m->l2_len=64 m->l3_len=20
> >>  flags=PKT_TX_IP_CKSUM PKT_TX_UDP_CKSUM
> >>  of course, the packet is valid only if the outer IP checksum is
> >>  already correct and outer UDP checksum is 0
> >>
> >> If i40e does not act like this, it does not follow the previous API.
> >
> > No,  i40e follows this.
In this case, I meant that if the packet with format  outer IP / outer UDP / 
VxLAN / Ether / inner IP / inner UDP / data   is not recognized VXLAN packet, 
it also can work on 40G If it can work on 10G today.

> OK. This is assumption (A):
> To calculate the inner IP + UDP checksum, you don't need VXLAN flag.
> You just acked it.

The VXLAN packet can be recognized after  VXLAN UDP destination port is 
configured on i40e , 
TX checksum offload must not work if you still set  m->l2_len=64 without  the 
PKT_TX_VXLAN_CKSUM flag.
Because we need this PKT_TX_VXLAN/TUNNEL_CKSUM to tell driver to set some 
related tunneling  registers.
 Do you hope that we can use L2 length to check if the packet is tunneling? If 
yes,  I don't think it makes sense.

As to tunneling parameters, for example, 
L4TUNT L4 Tunneling Type parameter

9:10   L4TUNT L4 Tunneling Type (Teredo / GRE header / VXLAN header) indication:
00b - No UDP / GRE tunneling (field must be set to zero if EIPT equals to 
zero)
01b - UDP tunneling header (Any UDP tunneling, VxLAN and Geneve)
10b - GRE tunneling header
   Else - reserved

L4 Tunneling length

12:18 L4TUNLEN L4 Tunneling Length (Teredo / GRE header / VXLAN header) defined 
in Words (field must be set to zero
if L4TUNT equals to zero).
? For standard Teredo headers with no additional header payload it should be 
set to 4 which equals to
8 bytes. If the tunneling header includes proprietary content it should be 
included as well.
? For IP in GRE it should be set to the length of the GRE header.
? For MAC in GRE or MAC in UDP it should be set to the length of the GRE or UDP 
headers plus the inner MAC up to including its last Ethertype.
If the L4TUNT is cleared, this field is ignored and must be set to zero.

Olivier, Thomas
I don't know  if you got intel 40G datasheet,  we all known you are focusing on 
generic concept and programming, I also think it is very important.
But  I think if you can read intel 40G data sheet, you probably understand 
easily what these 40G patches are for and what we are talking about. This is my 
personal opinion.


> >>> 2. only set inner L3/L4 header TX checksum
> >>>  tx_checksum set 0x30 0
> >>>In this case, the PKT_TX_VXLAN_CKSUM flag is set, so driver think
> >>> it is VXLAN
> >> packet, and we don't need to change outer ones because we don't set
> >> outer flags here (PKT_TX_IPV4_CSUM, PKT_TX_UDP_CKSUM).
> 
> Assumption (B):
> To calculate the inner IP + UDP checksum (this is what you wrote "only set 
> inner
> L3/L4 header TX checksum"), you say you set the VXLAN flag.
> This is the opposite of (A).
> 
> >> As explained above, there is no need to set the PKT_TX_VXLAN_CKSUM if
> >> you only want to set the inner L3/L4 checksum.
> >> This was already working like this
> >> before your patches, as long as l2_len and l3_len are set properly in
> >> the mbuf (l2_len should include the outer headers).
> >
> > Does VXLAN TX checksum offload or ordinary L2 packet TX checksum offload
> work?
> > Have you ever tested it on a NIC that supports VXLAN.
> 
> You don't answer the question: which between (A) or (B) is correct.
> 
> I'm sorry I don't understand your question above.
> 
> I have done no test on i40e, because I don't have access to this hardware.
> 
> > The PKT_TX_VXLAN_CKSUM flag meaning just tell driver this is encapsulation
> packet, so driver should set TX checksum offload for the packet using outer 
> l2/l3
> len, inner l2/l3 len and tunneling header length.
> >
> > If you don't like this flag name, I can change it for  PKT_TX_TUNNEL_CKSUM,
> which have more generic meaning.
> 
> The problem is not only the name. After tens of mails, I'm still not able to
> understand the VxLAN checksum API.
> 
> I wanted to rework the csum forward engine code, because it is not understable
> today. I wanted to clarify the API. But sorry I think I'll give up now.
> 
> >> Moreover, PKT_TX_IPV4_CSUM, PKT_TX_UDP_CKSUM, ... are not "outer
> flags".
> >> They are hardware checksum flags, and before your vxland 

[dpdk-dev] [PATCH] i40e: fixed tx stats bug

2014-11-21 Thread Qiu, Michael
Yes, but I think it is better for you to made a v2 patch

Thanks
Michael

-Original Message-
From: Zang, Zhida 
Sent: Thursday, November 20, 2014 9:15 AM
To: Qiu, Michael; dev at dpdk.org
Subject: RE: [dpdk-dev] [PATCH] i40e: fixed tx stats bug

Is that OK that I send another patch with details directly?

-Original Message-
From: Qiu, Michael
Sent: Wednesday, November 19, 2014 17:27
To: Zang, Zhida; dev at dpdk.org
Subject: Re: [dpdk-dev] [PATCH] i40e: fixed tx stats bug

On 11/19/2014 4:43 PM, zhida zang wrote:
> From: zzang 
>
> Fixed tx stats bug in i40e


Would you mind to give more details about this bug in the commit log?

 This can really help reviewer to get the initial idea about your patch without 
go through the code it self.

Thanks,
Michael
>
> Signed-off-by: zzang 
> ---
>  lib/librte_pmd_i40e/i40e_ethdev.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/lib/librte_pmd_i40e/i40e_ethdev.c
> b/lib/librte_pmd_i40e/i40e_ethdev.c
> index 4b7a827..e01590c 100644
> --- a/lib/librte_pmd_i40e/i40e_ethdev.c
> +++ b/lib/librte_pmd_i40e/i40e_ethdev.c
> @@ -1102,6 +1102,7 @@ i40e_dev_stats_get(struct rte_eth_dev *dev, struct 
> rte_eth_stats *stats)
>   struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
>   struct i40e_hw_port_stats *ns = >stats; /* new stats */
>   struct i40e_hw_port_stats *os = >stats_offset; /* old stats */
> + struct i40e_eth_stats *ves = >main_vsi->eth_stats; /* vsi stats 
> +*/
>  
>   /* Get statistics of struct i40e_eth_stats */
>   i40e_stat_update_48(hw, I40E_GLPRT_GORCH(hw->port), @@ -1284,8
> +1285,8 @@ i40e_dev_stats_get(struct rte_eth_dev *dev, struct
> rte_eth_stats *stats)
>  
>   stats->ipackets = ns->eth.rx_unicast + ns->eth.rx_multicast +
>   ns->eth.rx_broadcast;
> - stats->opackets = ns->eth.tx_unicast + ns->eth.tx_multicast +
> - ns->eth.tx_broadcast;
> + stats->opackets = ves->tx_unicast + ves->tx_multicast +
> + ves->tx_broadcast;
>   stats->ibytes   = ns->eth.rx_bytes;
>   stats->obytes   = ns->eth.tx_bytes;
>   stats->oerrors  = ns->eth.tx_errors;