[dpdk-dev] [PATCH v3 10/10] vmxnet3: remove excess inlining

2015-03-06 Thread Yong Wang
On 3/5/15, 4:10 PM, "Stephen Hemminger"  wrote:

>From: Stephen Hemminger 
>
>No reason to inline large functions. Compiler will decide already
>based on optimization level.
>
>Also register array should be const.
>
>Signed-off-by: Stephen Hemminger 

One comment below.

Acked-by: Yong Wang 

>---
> lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c | 10 --
> 1 file changed, 4 insertions(+), 6 deletions(-)
>
>diff --git a/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c
>b/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c
>index f6c3452..cabb505 100644
>--- a/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c
>+++ b/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c
>@@ -84,10 +84,8 @@
> #define RTE_MBUF_DATA_DMA_ADDR_DEFAULT(mb) \
>   (uint64_t) ((mb)->buf_physaddr + RTE_PKTMBUF_HEADROOM)
> 
>-static uint32_t rxprod_reg[2] = {VMXNET3_REG_RXPROD,
>VMXNET3_REG_RXPROD2};
>+static const uint32_t rxprod_reg[2] = {VMXNET3_REG_RXPROD,
>VMXNET3_REG_RXPROD2};
> 
>-static inline int vmxnet3_post_rx_bufs(vmxnet3_rx_queue_t* , uint8_t);
>-static inline void vmxnet3_tq_tx_complete(vmxnet3_tx_queue_t *);
> #ifdef RTE_LIBRTE_VMXNET3_DEBUG_DRIVER_NOT_USED
> static void vmxnet3_rxq_dump(struct vmxnet3_rx_queue *);
> static void vmxnet3_txq_dump(struct vmxnet3_tx_queue *);
>@@ -157,7 +155,7 @@ vmxnet3_txq_dump(struct vmxnet3_tx_queue *txq)
> }
> #endif
> 
>-static inline void
>+static void
> vmxnet3_cmd_ring_release_mbufs(vmxnet3_cmd_ring_t *ring)
> {
>   while (ring->next2comp != ring->next2fill) {
>@@ -296,7 +294,7 @@ vmxnet3_dev_clear_queues(struct rte_eth_dev *dev)
>   }
> }
> 
>-static inline void
>+static void
> vmxnet3_tq_tx_complete(vmxnet3_tx_queue_t *txq)

Since there is only one caller of this routine, inlining it should be
fine. But I have no problem with letting the compiler decide (which
probably will inline it anyway for this particular case).

> {
>   int completed = 0;
>@@ -472,7 +470,7 @@ vmxnet3_xmit_pkts(void *tx_queue, struct rte_mbuf
>**tx_pkts,
>  *  only for LRO.
>  *
>  */
>-static inline int
>+static int
> vmxnet3_post_rx_bufs(vmxnet3_rx_queue_t *rxq, uint8_t ring_id)
> {
>   int err = 0;
>-- 
>2.1.4
>



[dpdk-dev] [PATCH v3 09/10] vmxnet3: add check for jumbo segment

2015-03-06 Thread Yong Wang
On 3/5/15, 4:10 PM, "Stephen Hemminger"  wrote:

>From: Stephen Hemminger 
>
>It is possible that some rogue application might pass a segment
>larger than 16K to the vmxnet3 transmit routine. In which case
>just drop it and increment counter.
>
>Signed-off-by: Stephen Hemminger 

One minor comment below. Otherwise looks good to me.


Acked-by: Yong Wang 

>---
> lib/librte_pmd_vmxnet3/vmxnet3_ring.h |  1 +
> lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c | 18 ++
> 2 files changed, 19 insertions(+)
>
>diff --git a/lib/librte_pmd_vmxnet3/vmxnet3_ring.h
>b/lib/librte_pmd_vmxnet3/vmxnet3_ring.h
>index 55ceadf..5cdcb23 100644
>--- a/lib/librte_pmd_vmxnet3/vmxnet3_ring.h
>+++ b/lib/librte_pmd_vmxnet3/vmxnet3_ring.h
>@@ -126,6 +126,7 @@ struct vmxnet3_txq_stats {
>* different reasons
>*/
>   uint64_tdrop_too_many_segs;
>+  uint64_tdrop_too_big;
>   uint64_tdrop_tso;
>   uint64_ttx_ring_full;
> };
>diff --git a/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c
>b/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c
>index 3bd13ef..f6c3452 100644
>--- a/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c
>+++ b/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c
>@@ -327,6 +327,17 @@ vmxnet3_tq_tx_complete(vmxnet3_tx_queue_t *txq)
>   PMD_TX_LOG(DEBUG, "Processed %d tx comps & command descs.", completed);
> }
> 
>+static inline int
>+vmxnet3_seg_too_big(const struct rte_mbuf *m)
>+{
>+  do {
>+  if (m->data_len > VMXNET3_MAX_TX_BUF_SIZE)
>+  return 1;
>+  } while  ((m = m->next) != NULL);

nit: extra space after "while?.

>+
>+  return 0;
>+}
>+
> uint16_t
> vmxnet3_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
> uint16_t nb_pkts)
>@@ -353,6 +364,13 @@ vmxnet3_xmit_pkts(void *tx_queue, struct rte_mbuf
>**tx_pkts,
>   /* Is this packet execessively fragmented, then drop */
>   if (unlikely(txm->nb_segs > VMXNET3_MAX_TXD_PER_PKT)) {
>   ++txq->stats.drop_too_many_segs;
>+  goto drop;
>+  }
>+
>+  /* Check for case of monster segment */
>+  if (unlikely(vmxnet3_seg_too_big(txm))) {
>+  ++txq->stats.drop_too_big;
>+  drop:
>   ++txq->stats.drop_total;
>   rte_pktmbuf_free(txm);
>   ++nb_tx;
>-- 
>2.1.4
>



[dpdk-dev] [PATCH 1/2] virtio: initialize iopl when device is initialized

2015-03-06 Thread David Marchand
On Fri, Mar 6, 2015 at 5:55 PM, Stephen Hemminger <
stephen at networkplumber.org> wrote:

> No virtio_dev_init is called too late, after interrupt handling
> threads are spawned.
>
> /* Launch threads, called at application init(). */
> int
> rte_eal_init(int argc, char **argv)
> {
> int i, fctret, ret;
> ...
> if (rte_eal_intr_init() < 0)
> rte_panic("Cannot init interrupt-handling thread\n");
> ...
>
> if (rte_eal_dev_init() < 0)
> rte_panic("Cannot init pmd devices\n"
>

There is no "io level" loss when going through fork and/or daemon : this
affirmation contradicts the manual and my test programs.

Now, looking at the problem from scratch, the constructor in virtio pmd
does not call iopl().
It registers a driver with an init function called from rte_eal_dev_init().
So iopl() is not called at "_start" time (in both virtio static or shared
object cases), but in rte_eal_dev_init().

In the end, the fix would be to move rte_eal_intr_init() after
rte_eal_dev_init().

Can you test this ?
Thanks.


-- 
David Marchand


[dpdk-dev] Guest Machine is not Pingable from Host Machine

2015-03-06 Thread Ngo Doan Lap
Hi,
Can you show the log output of OVS? and the ouput of following command
cd path/to/ovs/utilities/
 ./ovs-ofctl show br0
 ./ovs-ofctl dump-flows br0
(Assum that br0 is a bridge name that you had created)

On Fri, Mar 6, 2015 at 10:14 PM, Arkajit Ghosh 
wrote:

> Hi,
>
> Can anyone please suggest how to proceed.
>
>
> Thanks & Regards
> Arkajit Ghosh
>
> -Arkajit Ghosh/DEL/TCS wrote: -
> To: dev at dpdk.org
> From: Arkajit Ghosh/DEL/TCS
> Date: 03/04/2015 12:39PM
> Subject: Guest Machine is not Pingable from Host Machine
>
> Hi Team,
>
> Guest machine is not pingable from Host machine after creating a bridge
> with datapath_type "netdev" in the configuration database and adding  dpdk
> ports. Can anyone please let me know what is the issue.
>
> Thanks in advance.
>
> Thanks & Regards
> Arkajit Ghosh
>
>
> =-=-=
> Notice: The information contained in this e-mail
> message and/or attachments to it may contain
> confidential or privileged information. If you are
> not the intended recipient, any dissemination, use,
> review, distribution, printing or copying of the
> information contained in this e-mail message
> and/or attachments to it are strictly prohibited. If
> you have received this communication in error,
> please notify us by reply e-mail or telephone and
> immediately and permanently delete the message
> and any attachments. Thank you
>
>
>


-- 
Thanks and Best Regards,
Ngo Doan Lap
Mobile: 0977.833.757


[dpdk-dev] [PATCH v3 08/10] vmxnet3: get rid of DEBUG ifdefs

2015-03-06 Thread Yong Wang
On 3/5/15, 4:10 PM, "Stephen Hemminger"  wrote:

>By defining macro as a stub it is possible to get rid of #ifdef's
>in the actual code. Always evaluate the argument (even in the stub)
>so that there are no extra unused variable errors.
>
>Signed-off-by: Stephen Hemminger 

Acked-by: Yong Wang 

>---
> lib/librte_pmd_vmxnet3/vmxnet3_ethdev.h |  6 --
> lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c   | 13 ++---
> 2 files changed, 6 insertions(+), 13 deletions(-)
>
>diff --git a/lib/librte_pmd_vmxnet3/vmxnet3_ethdev.h
>b/lib/librte_pmd_vmxnet3/vmxnet3_ethdev.h
>index 83182e2..1c0d95f 100644
>--- a/lib/librte_pmd_vmxnet3/vmxnet3_ethdev.h
>+++ b/lib/librte_pmd_vmxnet3/vmxnet3_ethdev.h
>@@ -35,9 +35,11 @@
> #define _VMXNET3_ETHDEV_H_
> 
> #ifdef RTE_LIBRTE_VMXNET3_DEBUG_DRIVER
>-#define VMXNET3_ASSERT(x) do { \
>-  if (!(x)) rte_panic("VMXNET3: x"); \
>+#define VMXNET3_ASSERT(x) do {\
>+  if (unlikely(!(x))) rte_panic("VMXNET3: %s\n", #x); \
> } while(0)
>+#else
>+#define VMXNET3_ASSERT(x) do { (void)(x); } while (0)
> #endif
> 
> #define VMXNET3_MAX_MAC_ADDRS 1
>diff --git a/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c
>b/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c
>index 5cf187a..3bd13ef 100644
>--- a/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c
>+++ b/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c
>@@ -307,9 +307,7 @@ vmxnet3_tq_tx_complete(vmxnet3_tx_queue_t *txq)
> 
>   while (tcd->gen == comp_ring->gen) {
>   /* Release cmd_ring descriptor and free mbuf */
>-#ifdef RTE_LIBRTE_VMXNET3_DEBUG_DRIVER
>   VMXNET3_ASSERT(txq->cmd_ring.base[tcd->txdIdx].txd.eop == 1);
>-#endif
> 
>   while (txq->cmd_ring.next2comp != tcd->txdIdx) {
>   mbuf = 
> txq->cmd_ring.buf_info[txq->cmd_ring.next2comp].m;
>@@ -570,6 +568,7 @@ vmxnet3_recv_pkts(void *rx_queue, struct rte_mbuf
>**rx_pkts, uint16_t nb_pkts)
>   uint8_t ring_idx;
>   vmxnet3_rx_queue_t *rxq;
>   Vmxnet3_RxCompDesc *rcd;
>+  Vmxnet3_RxDesc *rxd;
>   vmxnet3_buf_info_t *rbi;
>   struct rte_mbuf *rxm = NULL;
>   struct vmxnet3_hw *hw;
>@@ -596,16 +595,12 @@ vmxnet3_recv_pkts(void *rx_queue, struct rte_mbuf
>**rx_pkts, uint16_t nb_pkts)
>   idx = rcd->rxdIdx;
>   ring_idx = (uint8_t)((rcd->rqID == rxq->qid1) ? 0 : 1);
>   rbi = rxq->cmd_ring[ring_idx].buf_info + idx;
>-
>+  rxd = (Vmxnet3_RxDesc *)rxq->cmd_ring[ring_idx].base + idx;
> 
>   PMD_RX_LOG(DEBUG, "rxd idx: %d ring idx: %d.", idx, ring_idx);
> 
>-#ifdef RTE_LIBRTE_VMXNET3_DEBUG_DRIVER
>-  Vmxnet3_RxDesc *rxd
>-  = (Vmxnet3_RxDesc *)rxq->cmd_ring[ring_idx].base + idx;
>   VMXNET3_ASSERT(rcd->len <= rxd->len);
>   VMXNET3_ASSERT(rbi->m);
>-#endif
> 
>   /* Get the packet buffer pointer from buf_info */
>   rxm = rbi->m;
>@@ -652,10 +647,8 @@ vmxnet3_recv_pkts(void *rx_queue, struct rte_mbuf
>**rx_pkts, uint16_t nb_pkts)
>* the last mbuf of the current packet.
>*/
>   if (rcd->sop) {
>-#ifdef RTE_LIBRTE_VMXNET3_DEBUG_DRIVER
>   VMXNET3_ASSERT(!rxq->start_seg);
>   VMXNET3_ASSERT(rxd->btype == VMXNET3_RXD_BTYPE_HEAD);
>-#endif
> 
>   if (unlikely(rcd->len == 0)) {
>   PMD_RX_LOG(DEBUG,
>@@ -670,10 +663,8 @@ vmxnet3_recv_pkts(void *rx_queue, struct rte_mbuf
>**rx_pkts, uint16_t nb_pkts)
>   } else {
>   struct rte_mbuf *start = rxq->start_seg;
> 
>-#ifdef RTE_LIBRTE_VMXNET3_DEBUG_DRIVER
>   VMXNET3_ASSERT(rxd->btype == VMXNET3_RXD_BTYPE_BODY);
>   VMXNET3_ASSERT(start != NULL);
>-#endif
> 
>   start->pkt_len += rxm->data_len;
>   start->nb_segs++;
>-- 
>2.1.4
>



[dpdk-dev] [PATCH v3 02/10] vmxnet3: enable VLAN filtering

2015-03-06 Thread Yong Wang
On 3/5/15, 4:10 PM, "Stephen Hemminger"  wrote:

>From: Stephen Hemminger 
>
>Support the VLAN filter functionality of the VMXNET3 interface.
>
>Signed-off-by: Stephen Hemminger 

Acked-by: Yong Wang 

>---
> lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c | 105
>+---
> lib/librte_pmd_vmxnet3/vmxnet3_ethdev.h |   4 +-
> lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c   |  31 +-
> 3 files changed, 102 insertions(+), 38 deletions(-)
>
>diff --git a/lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c
>b/lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c
>index 4c882ee..f4c2f12 100644
>--- a/lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c
>+++ b/lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c
>@@ -87,6 +87,12 @@ static void vmxnet3_dev_stats_get(struct rte_eth_dev
>*dev,
>   struct rte_eth_stats *stats);
> static void vmxnet3_dev_info_get(struct rte_eth_dev *dev,
>   struct rte_eth_dev_info *dev_info);
>+static int vmxnet3_dev_vlan_filter_set(struct rte_eth_dev *dev,
>+ uint16_t vid, int on);
>+static void vmxnet3_dev_vlan_offload_set(struct rte_eth_dev *dev, int
>mask);
>+static void vmxnet3_dev_vlan_offload_set_clear(struct rte_eth_dev *dev,
>+  int mask, int clear);
>+
> #if PROCESS_SYS_EVENTS == 1
> static void vmxnet3_process_events(struct vmxnet3_hw *);
> #endif
>@@ -113,6 +119,8 @@ static struct eth_dev_ops vmxnet3_eth_dev_ops = {
>   .link_update  = vmxnet3_dev_link_update,
>   .stats_get= vmxnet3_dev_stats_get,
>   .dev_infos_get= vmxnet3_dev_info_get,
>+  .vlan_filter_set  = vmxnet3_dev_vlan_filter_set,
>+  .vlan_offload_set = vmxnet3_dev_vlan_offload_set,
>   .rx_queue_setup   = vmxnet3_dev_rx_queue_setup,
>   .rx_queue_release = vmxnet3_dev_rx_queue_release,
>   .tx_queue_setup   = vmxnet3_dev_tx_queue_setup,
>@@ -398,7 +406,7 @@ vmxnet3_setup_driver_shared(struct rte_eth_dev *dev)
>   Vmxnet3_DSDevRead *devRead = &shared->devRead;
>   uint32_t *mac_ptr;
>   uint32_t val, i;
>-  int ret;
>+  int ret, mask;
> 
>   shared->magic = VMXNET3_REV1_MAGIC;
>   devRead->misc.driverInfo.version = VMXNET3_DRIVER_VERSION_NUM;
>@@ -470,9 +478,6 @@ vmxnet3_setup_driver_shared(struct rte_eth_dev *dev)
>   if (dev->data->dev_conf.rxmode.hw_ip_checksum)
>   devRead->misc.uptFeatures |= VMXNET3_F_RXCSUM;
> 
>-  if (dev->data->dev_conf.rxmode.hw_vlan_strip)
>-  devRead->misc.uptFeatures |= VMXNET3_F_RXVLAN;
>-
>   if (port_conf.rxmode.mq_mode == ETH_MQ_RX_RSS) {
>   ret = vmxnet3_rss_configure(dev);
>   if (ret != VMXNET3_SUCCESS)
>@@ -484,11 +489,14 @@ vmxnet3_setup_driver_shared(struct rte_eth_dev *dev)
>   devRead->rssConfDesc.confPA  = hw->rss_confPA;
>   }
> 
>-  if (dev->data->dev_conf.rxmode.hw_vlan_filter) {
>-  ret = vmxnet3_vlan_configure(dev);
>-  if (ret != VMXNET3_SUCCESS)
>-  return ret;
>-  }
>+  mask = 0;
>+  if (dev->data->dev_conf.rxmode.hw_vlan_strip)
>+  mask |= ETH_VLAN_STRIP_MASK;
>+
>+  if (dev->data->dev_conf.rxmode.hw_vlan_filter)
>+  mask |= ETH_VLAN_FILTER_MASK;
>+
>+  vmxnet3_dev_vlan_offload_set_clear(dev, mask, 1);
> 
>   PMD_INIT_LOG(DEBUG,
>"Writing MAC Address : %02x:%02x:%02x:%02x:%02x:%02x",
>@@ -720,8 +728,13 @@ static void
> vmxnet3_dev_promiscuous_enable(struct rte_eth_dev *dev)
> {
>   struct vmxnet3_hw *hw = dev->data->dev_private;
>+  uint32_t *vf_table = hw->shared->devRead.rxFilterConf.vfTable;
> 
>+  memset(vf_table, 0, VMXNET3_VFT_TABLE_SIZE);
>   vmxnet3_dev_set_rxmode(hw, VMXNET3_RXM_PROMISC, 1);
>+
>+  VMXNET3_WRITE_BAR1_REG(hw, VMXNET3_REG_CMD,
>+ VMXNET3_CMD_UPDATE_VLAN_FILTERS);
> }
> 
> /* Promiscuous supported only if Vmxnet3_DriverShared is initialized in
>adapter */
>@@ -729,8 +742,12 @@ static void
> vmxnet3_dev_promiscuous_disable(struct rte_eth_dev *dev)
> {
>   struct vmxnet3_hw *hw = dev->data->dev_private;
>+  uint32_t *vf_table = hw->shared->devRead.rxFilterConf.vfTable;
> 
>+  memcpy(vf_table, hw->shadow_vfta, VMXNET3_VFT_TABLE_SIZE);
>   vmxnet3_dev_set_rxmode(hw, VMXNET3_RXM_PROMISC, 0);
>+  VMXNET3_WRITE_BAR1_REG(hw, VMXNET3_REG_CMD,
>+ VMXNET3_CMD_UPDATE_VLAN_FILTERS);
> }
> 
> /* Allmulticast supported only if Vmxnet3_DriverShared is initialized in
>adapter */
>@@ -751,6 +768,76 @@ vmxnet3_dev_allmulticast_disable(struct rte_eth_dev
>*dev)
>   vmxnet3_dev_set_rxmode(hw, VMXNET3_RXM_ALL_MULTI, 0);
> }
> 
>+/* Enable/disable filter on vlan */
>+static int
>+vmxnet3_dev_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vid, int
>on)
>+{
>+  struct vmxnet3_hw *hw = dev->data->dev_private;
>+  struct Vmxnet3_RxFilterConf *rxConf = &hw->shared

[dpdk-dev] Guest Machine is not Pingable from Host Machine

2015-03-06 Thread Arkajit Ghosh
Hi,

Can anyone please suggest how to proceed. 


Thanks & Regards
Arkajit Ghosh

-Arkajit Ghosh/DEL/TCS wrote: -
To: dev at dpdk.org
From: Arkajit Ghosh/DEL/TCS
Date: 03/04/2015 12:39PM
Subject: Guest Machine is not Pingable from Host Machine

Hi Team,

Guest machine is not pingable from Host machine after creating a bridge with 
datapath_type "netdev" in the configuration database and adding  dpdk ports. 
Can anyone please let me know what is the issue.

Thanks in advance. 

Thanks & Regards
Arkajit Ghosh


=-=-=
Notice: The information contained in this e-mail
message and/or attachments to it may contain 
confidential or privileged information. If you are 
not the intended recipient, any dissemination, use, 
review, distribution, printing or copying of the 
information contained in this e-mail message 
and/or attachments to it are strictly prohibited. If 
you have received this communication in error, 
please notify us by reply e-mail or telephone and 
immediately and permanently delete the message 
and any attachments. Thank you




[dpdk-dev] [PATCH] test whether file descriptor is valid before close it

2015-03-06 Thread Huawei Xie
This avoids closing -1 in our case.

Signed-off-by: Huawei Xie 
---
 lib/librte_vhost/virtio-net.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/librte_vhost/virtio-net.c b/lib/librte_vhost/virtio-net.c
index 6917fcf..4672e67 100644
--- a/lib/librte_vhost/virtio-net.c
+++ b/lib/librte_vhost/virtio-net.c
@@ -185,13 +185,13 @@ cleanup_device(struct virtio_net *dev)
}

/* Close any event notifiers opened by device. */
-   if (dev->virtqueue[VIRTIO_RXQ]->callfd)
+   if ((int)dev->virtqueue[VIRTIO_RXQ]->callfd >= 0)
close((int)dev->virtqueue[VIRTIO_RXQ]->callfd);
-   if (dev->virtqueue[VIRTIO_RXQ]->kickfd)
+   if ((int)dev->virtqueue[VIRTIO_RXQ]->kickfd >= 0)
close((int)dev->virtqueue[VIRTIO_RXQ]->kickfd);
-   if (dev->virtqueue[VIRTIO_TXQ]->callfd)
+   if ((int)dev->virtqueue[VIRTIO_TXQ]->callfd >= 0)
close((int)dev->virtqueue[VIRTIO_TXQ]->callfd);
-   if (dev->virtqueue[VIRTIO_TXQ]->kickfd)
+   if ((int)dev->virtqueue[VIRTIO_TXQ]->kickfd >= 0)
close((int)dev->virtqueue[VIRTIO_TXQ]->kickfd);
 }

-- 
1.8.1.4



[dpdk-dev] [PATCH] lib/librte_vhost: exchange kickfd and callfd to avoid confusion

2015-03-06 Thread Huawei Xie
Previous vhost implementation wrongly name kickfd as callfd and callfd as 
kickfd.
It is functional correct, but causes confusion.

Signed-off-by: Huawei Xie 
---
 examples/vhost/main.c |  6 +++---
 lib/librte_vhost/rte_virtio_net.h |  4 ++--
 lib/librte_vhost/vhost_rxtx.c |  6 +++---
 lib/librte_vhost/vhost_user/virtio-net-user.c | 12 ++--
 lib/librte_vhost/virtio-net.c | 12 ++--
 5 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/examples/vhost/main.c b/examples/vhost/main.c
index 334e2fe..61ea671 100644
--- a/examples/vhost/main.c
+++ b/examples/vhost/main.c
@@ -1434,7 +1434,7 @@ put_desc_to_used_list_zcp(struct vhost_virtqueue *vq, 
uint16_t desc_idx)

/* Kick the guest if necessary. */
if (!(vq->avail->flags & VRING_AVAIL_F_NO_INTERRUPT))
-   eventfd_write((int)vq->kickfd, 1);
+   eventfd_write((int)vq->callfd, 1);
 }

 /*
@@ -1627,7 +1627,7 @@ txmbuf_clean_zcp(struct virtio_net *dev, struct vpool 
*vpool)

/* Kick guest if required. */
if (!(vq->avail->flags & VRING_AVAIL_F_NO_INTERRUPT))
-   eventfd_write((int)vq->kickfd, 1);
+   eventfd_write((int)vq->callfd, 1);

return 0;
 }
@@ -1775,7 +1775,7 @@ virtio_dev_rx_zcp(struct virtio_net *dev, struct rte_mbuf 
**pkts,

/* Kick the guest if necessary. */
if (!(vq->avail->flags & VRING_AVAIL_F_NO_INTERRUPT))
-   eventfd_write((int)vq->kickfd, 1);
+   eventfd_write((int)vq->callfd, 1);

return count;
 }
diff --git a/lib/librte_vhost/rte_virtio_net.h 
b/lib/librte_vhost/rte_virtio_net.h
index 611a3d4..2fc1c44 100644
--- a/lib/librte_vhost/rte_virtio_net.h
+++ b/lib/librte_vhost/rte_virtio_net.h
@@ -86,8 +86,8 @@ struct vhost_virtqueue {
uint16_tvhost_hlen; /**< Vhost header 
length (varies depending on RX merge buffers. */
volatile uint16_t   last_used_idx;  /**< Last index used on 
the available ring */
volatile uint16_t   last_used_idx_res;  /**< Used for multiple 
devices reserving buffers. */
-   eventfd_t   callfd; /**< Currently unused 
as polling mode is enabled. */
-   eventfd_t   kickfd; /**< Used to notify the 
guest (trigger interrupt). */
+   eventfd_t   callfd; /**< Used to notify the 
guest (trigger interrupt). */
+   eventfd_t   kickfd; /**< Currently unused 
as polling mode is enabled. */
struct buf_vector   buf_vec[BUF_VECTOR_MAX];/**< for 
scatter RX. */
 } __rte_cache_aligned;

diff --git a/lib/librte_vhost/vhost_rxtx.c b/lib/librte_vhost/vhost_rxtx.c
index c7c9550..535c7a1 100644
--- a/lib/librte_vhost/vhost_rxtx.c
+++ b/lib/librte_vhost/vhost_rxtx.c
@@ -180,7 +180,7 @@ virtio_dev_rx(struct virtio_net *dev, uint16_t queue_id,

/* Kick the guest if necessary. */
if (!(vq->avail->flags & VRING_AVAIL_F_NO_INTERRUPT))
-   eventfd_write((int)vq->kickfd, 1);
+   eventfd_write((int)vq->callfd, 1);
return count;
 }

@@ -507,7 +507,7 @@ virtio_dev_merge_rx(struct virtio_net *dev, uint16_t 
queue_id,

/* Kick the guest if necessary. */
if (!(vq->avail->flags & VRING_AVAIL_F_NO_INTERRUPT))
-   eventfd_write((int)vq->kickfd, 1);
+   eventfd_write((int)vq->callfd, 1);
}

return count;
@@ -725,6 +725,6 @@ rte_vhost_dequeue_burst(struct virtio_net *dev, uint16_t 
queue_id,
vq->used->idx += entry_success;
/* Kick guest if required. */
if (!(vq->avail->flags & VRING_AVAIL_F_NO_INTERRUPT))
-   eventfd_write((int)vq->kickfd, 1);
+   eventfd_write((int)vq->callfd, 1);
return entry_success;
 }
diff --git a/lib/librte_vhost/vhost_user/virtio-net-user.c 
b/lib/librte_vhost/vhost_user/virtio-net-user.c
index 97c5177..e0c7394 100644
--- a/lib/librte_vhost/vhost_user/virtio-net-user.c
+++ b/lib/librte_vhost/vhost_user/virtio-net-user.c
@@ -286,13 +286,13 @@ user_get_vring_base(struct vhost_device_ctx ctx,
 * sent and only sent in vhost_vring_stop.
 * TODO: cleanup the vring, it isn't usable since here.
 */
-   if (((int)dev->virtqueue[VIRTIO_RXQ]->callfd) >= 0) {
-   close(dev->virtqueue[VIRTIO_RXQ]->callfd);
-   dev->virtqueue[VIRTIO_RXQ]->callfd = (eventfd_t)-1;
+   if (((int)dev->virtqueue[VIRTIO_RXQ]->kickfd) >= 0) {
+   close(dev->virtqueue[VIRTIO_RXQ]->kickfd);
+   dev->virtqueue[VIRTIO_RXQ]->kickfd = (eventfd_t)-1;
}
-   if (((int)dev->virtqueue[VIRTIO_TXQ]->callfd) >= 0) {
-   close(dev->virtqueue[VIRTIO_TXQ]->callfd);
-   dev->virtqueue[VIRTIO_TXQ]->callfd = (eventfd_t)-1;
+   if (((int)dev->virtqueue[

[dpdk-dev] [PATCH 5/5] ixgbe: rename igb_* to ixgbe_*

2015-03-06 Thread Stephen Hemminger
To avoid any possible confusion or breakage, rename all the structures
of ixgbe driver to use ixgbe_ rather than igb_ because igb is a
different driver.

Signed-off-by: Stephen Hemminger 
---
 lib/librte_pmd_ixgbe/ixgbe_ethdev.c   |   2 +-
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c | 124 +-
 lib/librte_pmd_ixgbe/ixgbe_rxtx.h |  26 +++
 lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c |  52 +++---
 4 files changed, 102 insertions(+), 102 deletions(-)

diff --git a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c 
b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
index e1504f4..5473858 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
+++ b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
@@ -748,7 +748,7 @@ eth_ixgbe_dev_init(__attribute__((unused)) struct 
eth_driver *eth_drv,
 * RX and TX function.
 */
if (rte_eal_process_type() != RTE_PROC_PRIMARY){
-   struct igb_tx_queue *txq;
+   struct ixgbe_tx_queue *txq;
/* TX queue function in primary, set by last queue initialized
 * Tx queue may not initialized by primary process */
if (eth_dev->data->tx_queues) {
diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c 
b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
index c5ba687..1848a13 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
+++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
@@ -122,9 +122,9 @@ rte_rxmbuf_alloc(struct rte_mempool *mp)
  * Return the total number of buffers freed.
  */
 static inline int __attribute__((always_inline))
-ixgbe_tx_free_bufs(struct igb_tx_queue *txq)
+ixgbe_tx_free_bufs(struct ixgbe_tx_queue *txq)
 {
-   struct igb_tx_entry *txep;
+   struct ixgbe_tx_entry *txep;
uint32_t status;
int i;

@@ -208,11 +208,11 @@ tx1(volatile union ixgbe_adv_tx_desc *txdp, struct 
rte_mbuf **pkts)
  * Copy mbuf pointers to the S/W ring.
  */
 static inline void
-ixgbe_tx_fill_hw_ring(struct igb_tx_queue *txq, struct rte_mbuf **pkts,
+ixgbe_tx_fill_hw_ring(struct ixgbe_tx_queue *txq, struct rte_mbuf **pkts,
  uint16_t nb_pkts)
 {
volatile union ixgbe_adv_tx_desc *txdp = &(txq->tx_ring[txq->tx_tail]);
-   struct igb_tx_entry *txep = &(txq->sw_ring[txq->tx_tail]);
+   struct ixgbe_tx_entry *txep = &(txq->sw_ring[txq->tx_tail]);
const int N_PER_LOOP = 4;
const int N_PER_LOOP_MASK = N_PER_LOOP-1;
int mainpart, leftover;
@@ -244,7 +244,7 @@ static inline uint16_t
 tx_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 uint16_t nb_pkts)
 {
-   struct igb_tx_queue *txq = (struct igb_tx_queue *)tx_queue;
+   struct ixgbe_tx_queue *txq = (struct ixgbe_tx_queue *)tx_queue;
volatile union ixgbe_adv_tx_desc *tx_r = txq->tx_ring;
uint16_t n = 0;

@@ -352,7 +352,7 @@ ixgbe_xmit_pkts_simple(void *tx_queue, struct rte_mbuf 
**tx_pkts,
 }

 static inline void
-ixgbe_set_xmit_ctx(struct igb_tx_queue* txq,
+ixgbe_set_xmit_ctx(struct ixgbe_tx_queue* txq,
volatile struct ixgbe_adv_tx_context_desc *ctx_txd,
uint64_t ol_flags, union ixgbe_tx_offload tx_offload)
 {
@@ -442,7 +442,7 @@ ixgbe_set_xmit_ctx(struct igb_tx_queue* txq,
  * or create a new context descriptor.
  */
 static inline uint32_t
-what_advctx_update(struct igb_tx_queue *txq, uint64_t flags,
+what_advctx_update(struct ixgbe_tx_queue *txq, uint64_t flags,
union ixgbe_tx_offload tx_offload)
 {
/* If match with the current used context */
@@ -498,9 +498,9 @@ tx_desc_ol_flags_to_cmdtype(uint64_t ol_flags)

 /* Reset transmit descriptors after they have been used */
 static inline int
-ixgbe_xmit_cleanup(struct igb_tx_queue *txq)
+ixgbe_xmit_cleanup(struct ixgbe_tx_queue *txq)
 {
-   struct igb_tx_entry *sw_ring = txq->sw_ring;
+   struct ixgbe_tx_entry *sw_ring = txq->sw_ring;
volatile union ixgbe_adv_tx_desc *txr = txq->tx_ring;
uint16_t last_desc_cleaned = txq->last_desc_cleaned;
uint16_t nb_tx_desc = txq->nb_tx_desc;
@@ -559,9 +559,9 @@ uint16_t
 ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
uint16_t nb_pkts)
 {
-   struct igb_tx_queue *txq;
-   struct igb_tx_entry *sw_ring;
-   struct igb_tx_entry *txe, *txn;
+   struct ixgbe_tx_queue *txq;
+   struct ixgbe_tx_entry *sw_ring;
+   struct ixgbe_tx_entry *txe, *txn;
volatile union ixgbe_adv_tx_desc *txr;
volatile union ixgbe_adv_tx_desc *txd;
struct rte_mbuf *tx_pkt;
@@ -938,10 +938,10 @@ rx_desc_error_to_pkt_flags(uint32_t rx_status)
 #error "PMD IXGBE: LOOK_AHEAD must be 8\n"
 #endif
 static inline int
-ixgbe_rx_scan_hw_ring(struct igb_rx_queue *rxq)
+ixgbe_rx_scan_hw_ring(struct ixgbe_rx_queue *rxq)
 {
volatile union ixgbe_adv_rx_desc *rxdp;
-   struct igb_rx_entry *rxep;
+   struct ixgbe_rx_entry *rxep;
struct rte_mbuf *mb;
uint16_t pkt_len;
uint64_t pkt_flags;
@@ -1022,10 +1022,10 @@ ixgbe_rx_scan_hw_ring(struct igb_rx

[dpdk-dev] [PATCH 4/5] ixgbe: rename set_tx_function

2015-03-06 Thread Stephen Hemminger
All global functions in a driver should use the same prefix
to avoid any future name collisions.

Signed-off-by: Stephen Hemminger 
---
 lib/librte_pmd_ixgbe/ixgbe_ethdev.c | 2 +-
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c   | 2 +-
 lib/librte_pmd_ixgbe/ixgbe_rxtx.h   | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c 
b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
index 9bdc046..e1504f4 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
+++ b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
@@ -753,7 +753,7 @@ eth_ixgbe_dev_init(__attribute__((unused)) struct 
eth_driver *eth_drv,
 * Tx queue may not initialized by primary process */
if (eth_dev->data->tx_queues) {
txq = 
eth_dev->data->tx_queues[eth_dev->data->nb_tx_queues-1];
-   set_tx_function(eth_dev, txq);
+   ixgbe_set_tx_function(eth_dev, txq);
} else {
/* Use default TX function if we get here */
PMD_INIT_LOG(INFO, "No TX queues configured yet. "
diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c 
b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
index 0f32296..c5ba687 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
+++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
@@ -1765,7 +1765,7 @@ static const struct ixgbe_txq_ops def_txq_ops = {
  * in dev_init by secondary process when attaching to an existing ethdev.
  */
 void
-set_tx_function(struct rte_eth_dev *dev, struct igb_tx_queue *txq)
+ixgbe_set_tx_function(struct rte_eth_dev *dev, struct igb_tx_queue *txq)
 {
/* Use a simple Tx queue (no offloads, no multi segs) if possible */
if (((txq->txq_flags & IXGBE_SIMPLE_FLAGS) == IXGBE_SIMPLE_FLAGS)
diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx.h 
b/lib/librte_pmd_ixgbe/ixgbe_rxtx.h
index a85839e..42d59f9 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_rxtx.h
+++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx.h
@@ -253,7 +253,7 @@ struct ixgbe_txq_ops {
  * the queue parameters. Used in tx_queue_setup by primary process and then
  * in dev_init by secondary process when attaching to an existing ethdev.
  */
-void set_tx_function(struct rte_eth_dev *dev, struct igb_tx_queue *txq);
+void ixgbe_set_tx_function(struct rte_eth_dev *dev, struct igb_tx_queue *txq);

 #ifdef RTE_IXGBE_INC_VECTOR
 uint16_t ixgbe_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
-- 
2.1.4



[dpdk-dev] [PATCH 3/5] ixgbe: make bulk alloc static

2015-03-06 Thread Stephen Hemminger
Only used in this file, make it static.

Signed-off-by: Stephen Hemminger 
---
 lib/librte_pmd_ixgbe/ixgbe_ethdev.h | 5 -
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c   | 2 +-
 2 files changed, 1 insertion(+), 6 deletions(-)

diff --git a/lib/librte_pmd_ixgbe/ixgbe_ethdev.h 
b/lib/librte_pmd_ixgbe/ixgbe_ethdev.h
index a549f5c..ffe3471 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_ethdev.h
+++ b/lib/librte_pmd_ixgbe/ixgbe_ethdev.h
@@ -341,11 +341,6 @@ void ixgbevf_dev_rxtx_start(struct rte_eth_dev *dev);
 uint16_t ixgbe_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
uint16_t nb_pkts);

-#ifdef RTE_LIBRTE_IXGBE_RX_ALLOW_BULK_ALLOC
-uint16_t ixgbe_recv_pkts_bulk_alloc(void *rx_queue, struct rte_mbuf **rx_pkts,
-   uint16_t nb_pkts);
-#endif
-
 uint16_t ixgbe_recv_scattered_pkts(void *rx_queue,
struct rte_mbuf **rx_pkts, uint16_t nb_pkts);

diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c 
b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
index 8706c1e..0f32296 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
+++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
@@ -1145,7 +1145,7 @@ rx_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 }

 /* split requests into chunks of size RTE_PMD_IXGBE_RX_MAX_BURST */
-uint16_t
+static uint16_t
 ixgbe_recv_pkts_bulk_alloc(void *rx_queue, struct rte_mbuf **rx_pkts,
   uint16_t nb_pkts)
 {
-- 
2.1.4



[dpdk-dev] [PATCH 2/5] ixgbe: make register maps const

2015-03-06 Thread Stephen Hemminger
These are const data structures, just put them in txt segment
rather than having compiler emit code to set them up on the stack.

Signed-off-by: Stephen Hemminger 
---
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c 
b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
index e6aec8f..8706c1e 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
+++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
@@ -860,14 +860,14 @@ rx_desc_hlen_type_rss_to_pkt_flags(uint32_t hl_tp_rs)
 {
uint64_t pkt_flags;

-   static uint64_t ip_pkt_types_map[16] = {
+   static const uint64_t ip_pkt_types_map[16] = {
0, PKT_RX_IPV4_HDR, PKT_RX_IPV4_HDR_EXT, PKT_RX_IPV4_HDR_EXT,
PKT_RX_IPV6_HDR, 0, 0, 0,
PKT_RX_IPV6_HDR_EXT, 0, 0, 0,
PKT_RX_IPV6_HDR_EXT, 0, 0, 0,
};

-   static uint64_t ip_rss_types_map[16] = {
+   static const uint64_t ip_rss_types_map[16] = {
0, PKT_RX_RSS_HASH, PKT_RX_RSS_HASH, PKT_RX_RSS_HASH,
0, PKT_RX_RSS_HASH, 0, PKT_RX_RSS_HASH,
PKT_RX_RSS_HASH, 0, 0, 0,
-- 
2.1.4



[dpdk-dev] [PATCH 1/5] ixgbe: make txq_ops const

2015-03-06 Thread Stephen Hemminger
All virtual function tables should be const so they are put
in text segment rather than data.

Signed-off-by: Stephen Hemminger 
---
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c | 2 +-
 lib/librte_pmd_ixgbe/ixgbe_rxtx.h | 2 +-
 lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c 
b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
index 9ecf3e5..e6aec8f 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
+++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
@@ -1754,7 +1754,7 @@ ixgbe_reset_tx_queue(struct igb_tx_queue *txq)
IXGBE_CTX_NUM * sizeof(struct ixgbe_advctx_info));
 }

-static struct ixgbe_txq_ops def_txq_ops = {
+static const struct ixgbe_txq_ops def_txq_ops = {
.release_mbufs = ixgbe_tx_queue_release_mbufs,
.free_swring = ixgbe_tx_free_swring,
.reset = ixgbe_reset_tx_queue,
diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx.h 
b/lib/librte_pmd_ixgbe/ixgbe_rxtx.h
index 329007c..a85839e 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_rxtx.h
+++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx.h
@@ -211,7 +211,7 @@ struct igb_tx_queue {
uint32_tctx_curr;  /**< Hardware context states. */
/** Hardware context0 history. */
struct ixgbe_advctx_info ctx_cache[IXGBE_CTX_NUM];
-   struct ixgbe_txq_ops *ops;  /**< txq ops */
+   const struct ixgbe_txq_ops *ops;   /**< txq ops */
uint8_t tx_deferred_start; /**< not in global dev start. */
 };

diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c 
b/lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c
index 1f46f0f..11e9f12 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c
+++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c
@@ -723,7 +723,7 @@ ixgbe_reset_tx_queue(struct igb_tx_queue *txq)
IXGBE_CTX_NUM * sizeof(struct ixgbe_advctx_info));
 }

-static struct ixgbe_txq_ops vec_txq_ops = {
+static const struct ixgbe_txq_ops vec_txq_ops = {
.release_mbufs = ixgbe_tx_queue_release_mbufs,
.free_swring = ixgbe_tx_free_swring,
.reset = ixgbe_reset_tx_queue,
-- 
2.1.4



[dpdk-dev] [PATCH 0/5] ixgbe: cleanup patches

2015-03-06 Thread Stephen Hemminger
These are things found while reviewing ixgbe driver.
No bugs or functionality changes, just minor things like naming
and use of const.

Stephen Hemminger (5):
  ixgbe: make txq_ops const
  ixgbe: make register maps const
  ixgbe: make bulk alloc static
  ixgbe: rename set_tx_function
  ixgbe: rename igb_* to ixgbe_*

 lib/librte_pmd_ixgbe/ixgbe_ethdev.c   |   4 +-
 lib/librte_pmd_ixgbe/ixgbe_ethdev.h   |   5 --
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c | 132 +-
 lib/librte_pmd_ixgbe/ixgbe_rxtx.h |  28 
 lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c |  54 +++---
 5 files changed, 109 insertions(+), 114 deletions(-)

-- 
2.1.4



[dpdk-dev] [PATCH v3 10/10] vmxnet3: remove excess inlining

2015-03-06 Thread Stephen Hemminger
On Fri, 6 Mar 2015 23:54:23 +
Yong Wang  wrote:

> Since there is only one caller of this routine, inlining it should be
> fine. But I have no problem with letting the compiler decide (which
> probably will inline it anyway for this particular case).

Sometimes compiler will not inline because of register pressure issues
especially on 32 bit where there aren't enough registers.


[dpdk-dev] [PATCH 2/2] doc: update flow director commands

2015-03-06 Thread Jingjing Wu
Because of the changing of unified flow type, commands for flow
director need to be updated.

Signed-off-by: Jingjing Wu 
---
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 19 ++-
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst 
b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index b6dd5bd..f10352d 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -1441,29 +1441,29 @@ Different NICs may have different capabilities, command 
show port fdir (port_id)

 # Commands to add flow director filters of different flow types.

-flow_director_filter (port_id) (add|del|update) flow 
(ip4|ip4-frag|ip6|ip6-frag)
+flow_director_filter (port_id) (add|del|update) flow 
(ipv4-other|ipv4-frag|ipv6-other|ipv6-frag)
 src (src_ip_address) dst (dst_ip_address) vlan (vlan_value) flexbytes 
(flexbytes_value)
 (drop|fwd) queue (queue_id) fd_id (fd_id_value)

-flow_director_filter (port_id) (add|del|update) flow (udp4|tcp4|udp6|tcp6)
+flow_director_filter (port_id) (add|del|update) flow 
(ipv4-tcp|ipv4-udp|ipv6-tcp|ipv6-udp)
 src (src_ip_address) (src_port) dst (dst_ip_address) (dst_port) vlan 
(vlan_value)
 flexbytes (flexbytes_value) (drop|fwd) queue (queue_id) fd_id (fd_id_value)

-flow_director_filter (port_id) (add|del|update) flow (sctp4|sctp6)
+flow_director_filter (port_id) (add|del|update) flow (ipv4-sctp|ipv6-sctp)
 src (src_ip_address) (src_port) dst (dst_ip_address) (dst_port) tag 
(verification_tag)
 vlan (vlan_value) flexbytes (flexbytes_value) (drop|fwd) queue (queue_id) 
fd_id (fd_id_value)

-For example, to add an udp flow type filter:
+For example, to add an ipv4-udp flow type filter:

 .. code-block:: console

-testpmd> flow_director_filter 0 add flow udp4 src 2.2.2.3 32 dst 2.2.2.5 
33 vlan 0x1 flexbytes (0x88,0x48) fwd queue 1 fd_id 1
+testpmd> flow_director_filter 0 add flow ipv4-udp src 2.2.2.3 32 dst 
2.2.2.5 33 vlan 0x1 flexbytes (0x88,0x48) fwd queue 1 fd_id 1

-For example, add an ip4 flow type filter:
+For example, add an ipv4-other flow type filter:

 .. code-block:: console

-testpmd> flow_director_filter 0 add flow ip4 src 2.2.2.3 dst 2.2.2.5 vlan 
0x1 flexbytes (0x88,0x48) fwd queue 1 fd_id 1
+testpmd> flow_director_filter 0 add flow ipv4-other src 2.2.2.3 dst 
2.2.2.5 vlan 0x1 flexbytes (0x88,0x48) fwd queue 1 fd_id 1

 flush_flow_director
 ~~~
@@ -1497,9 +1497,10 @@ flow_director_flex_mask

 set masks of flow director's flexible payload based on certain flow type:

-flow_director_flex_mask (port_id) flow 
(raw|ip4|ip4-frag|tcp4|udp4|sctp4|ip6|ip6-frag|tcp6|udp6|sctp6|all) (mask)
+flow_director_flex_mask (port_id) flow 
(none|ipv4-other|ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp|
+ipv6-other|ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp|all) (mask)

-Example, to set flow director's udpv4 flex mask on port 0:
+Example, to set flow director's flex mask for all flow type on port 0:

 .. code-block:: console

-- 
1.9.3



[dpdk-dev] [PATCH 1/2] ixgbe: correct the flow types supported

2015-03-06 Thread Jingjing Wu
Ixgbe doesn't support the ipv4-frag and ipv6-frag flow types, remove them.
Ixgbe doesn't support configure flex mask on each kind of flow type, this
patch uses RTE_ETH_FLOW_UNKNOWN to specify global flex mask setting.
This patch also changes the string "raw" to "none" to indicate flex mask
setting unrelated with flow type in testpmd for ixgbe.

Signed-off-by: Jingjing Wu 
---
 app/test-pmd/cmdline.c| 18 +++---
 lib/librte_pmd_ixgbe/ixgbe_fdir.c |  8 +++-
 2 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index c8312be..dce6e4b 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -661,8 +661,7 @@ static void cmd_help_long_parsed(void *parsed_result,
"Set flow director mask.\n\n"

"flow_director_flex_mask (port_id)"
-   " flow 
(raw|ip4|ip4-frag|tcp4|udp4|sctp4|ip6|ip6-frag|tcp6|udp6|sctp6|all)"
-   " flow 
(raw|ipv4-other|ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp|"
+   " flow 
(none|ipv4-other|ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp|"
"ipv6-other|ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp|all)"
" (mask)\n"
"Configure mask of flex payload.\n\n"
@@ -8198,6 +8197,19 @@ cmd_flow_director_flex_mask_parsed(void *parsed_result,
return;
}

+   if (!strcmp(res->flow_type, "none")) {
+   /* means don't specify the flow type */
+   flex_mask.flow_type = RTE_ETH_FLOW_UNKNOWN;
+   for (i = 0; i < RTE_ETH_FLOW_MAX; i++)
+   memset(&port->dev_conf.fdir_conf.flex_conf.flex_mask[i],
+  0, sizeof(struct rte_eth_fdir_flex_mask));
+   port->dev_conf.fdir_conf.flex_conf.nb_flexmasks = 1;
+   
(void)rte_memcpy(&port->dev_conf.fdir_conf.flex_conf.flex_mask[0],
+&flex_mask,
+sizeof(struct rte_eth_fdir_flex_mask));
+   cmd_reconfig_device_queue(res->port_id, 1, 1);
+   return;
+   }
flow_type_mask = fdir_info.flow_types_mask[0];
if (!strcmp(res->flow_type, "all")) {
if (!flow_type_mask) {
@@ -8235,7 +8247,7 @@ cmdline_parse_token_string_t 
cmd_flow_director_flexmask_flow =
 flow, "flow");
 cmdline_parse_token_string_t cmd_flow_director_flexmask_flow_type =
TOKEN_STRING_INITIALIZER(struct cmd_flow_director_flex_mask_result,
-   flow_type, 
"raw#ipv4-other#ipv4-frag#ipv4-tcp#ipv4-udp#ipv4-sctp#"
+   flow_type, 
"none#ipv4-other#ipv4-frag#ipv4-tcp#ipv4-udp#ipv4-sctp#"
"ipv6-other#ipv6-frag#ipv6-tcp#ipv6-udp#ipv6-sctp#all");
 cmdline_parse_token_string_t cmd_flow_director_flexmask_mask =
TOKEN_STRING_INITIALIZER(struct cmd_flow_director_flex_mask_result,
diff --git a/lib/librte_pmd_ixgbe/ixgbe_fdir.c 
b/lib/librte_pmd_ixgbe/ixgbe_fdir.c
index bab1bc9..afc53cb 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_fdir.c
+++ b/lib/librte_pmd_ixgbe/ixgbe_fdir.c
@@ -69,12 +69,10 @@
 #define IXGBE_FDIRCMD_CMD_INTERVAL_US   10

 #define IXGBE_FDIR_FLOW_TYPES ( \
-   (1 << RTE_ETH_FLOW_FRAG_IPV4) | \
(1 << RTE_ETH_FLOW_NONFRAG_IPV4_UDP) | \
(1 << RTE_ETH_FLOW_NONFRAG_IPV4_TCP) | \
(1 << RTE_ETH_FLOW_NONFRAG_IPV4_SCTP) | \
(1 << RTE_ETH_FLOW_NONFRAG_IPV4_OTHER) | \
-   (1 << RTE_ETH_FLOW_FRAG_IPV4) | \
(1 << RTE_ETH_FLOW_NONFRAG_IPV6_UDP) | \
(1 << RTE_ETH_FLOW_NONFRAG_IPV6_TCP) | \
(1 << RTE_ETH_FLOW_NONFRAG_IPV6_SCTP) | \
@@ -410,8 +408,8 @@ ixgbe_set_fdir_flex_conf(struct rte_eth_dev *dev,

for (i = 0; i < conf->nb_flexmasks; i++) {
flex_mask = &conf->flex_mask[i];
-   if (flex_mask->flow_type != RTE_ETH_FLOW_RAW) {
-   PMD_DRV_LOG(ERR, "unsupported flow type.");
+   if (flex_mask->flow_type != RTE_ETH_FLOW_UNKNOWN) {
+   PMD_DRV_LOG(ERR, "flexmask should be set globally.");
return -EINVAL;
}
flexbytes = (uint16_t)(((flex_mask->mask[0] << 8) & 0xFF00) |
@@ -1030,7 +1028,7 @@ ixgbe_fdir_info_get(struct rte_eth_dev *dev, struct 
rte_eth_fdir_info *fdir_info
fdir_info->flex_conf.flex_set[0].src_offset[0] = offset;
fdir_info->flex_conf.flex_set[0].src_offset[1] = offset + 1;
fdir_info->flex_conf.nb_flexmasks = 1;
-   fdir_info->flex_conf.flex_mask[0].flow_type = RTE_ETH_FLOW_RAW;
+   fdir_info->flex_conf.flex_mask[0].flow_type = RTE_ETH_FLOW_UNKNOWN;
fdir_info->flex_conf.flex_mask[0].mask[0] =
(uint8_t)(info->mask.flex_bytes_mask & 0x00FF);
fdir_info->flex_conf.flex_mask[0].mask[1] =
-- 
1.9.3



[dpdk-dev] [PATCH 0/2] correct the flow director based on unified flow type

2015-03-06 Thread Jingjing Wu
Due the unified flow type changes, this patchset updates the commands for flow 
director
and correct the flow types ixgbe supported.

Jingjing Wu (2):
  ixgbe: correct the flow types supported
  doc: update flow director commands

 app/test-pmd/cmdline.c  | 18 +++---
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 19 ++-
 lib/librte_pmd_ixgbe/ixgbe_fdir.c   |  8 +++-
 3 files changed, 28 insertions(+), 17 deletions(-)

-- 
1.9.3



[dpdk-dev] [PATCH 1/2] virtio: initialize iopl when device is initialized

2015-03-06 Thread David Marchand
Hello Stephen,

On Fri, Mar 6, 2015 at 5:20 PM, Stephen Hemminger <
stephen at networkplumber.org> wrote:

> The issue is that virtio has no place it can do iopl() and have the IRQ
> thread
> work. It only shows up on real code where application is daemon, not in a
> toy
> demo or test application.
>
> Right now:
> gcc start
>rte_virtio_pmd_init
>   iopl
> main
> daemon
> fork
> fork
>   Process is now child of init not original process
>
>   rte_eal_init
>  fork (pthread) for irq thread
>irq thread
> (no iopl permssion)
>   program start
>   rte_pmd_virtio_configure
>
>
> So the only place where iopl() can be done in the proper context
> so that the IRQ (and other helper threads in future) have the correct
> permissions is in eal_init.
>

Is eth_virtio_dev_init() not a better place rather than eal ?

I prefer avoiding #ifdef pmd in eal.


-- 
David Marchand


[dpdk-dev] [PATCH v3 2/2] doc: Update for new HW vlan command

2015-03-06 Thread Ouyang Changchun
Update the testpmd doc as there are new HW VLAN commands/options.

Signed-off-by: Changchun Ouyang 
---
 doc/guides/testpmd_app_ug/run_app.rst   | 12 +++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 33 +
 2 files changed, 45 insertions(+)

diff --git a/doc/guides/testpmd_app_ug/run_app.rst 
b/doc/guides/testpmd_app_ug/run_app.rst
index 67f62d2..3898e67 100644
--- a/doc/guides/testpmd_app_ug/run_app.rst
+++ b/doc/guides/testpmd_app_ug/run_app.rst
@@ -262,6 +262,18 @@ They must be separated from the EAL options, shown in the 
previous section, with

 Disable hardware VLAN.

+*   --disable-hw-vlan-filter
+
+Disable hardware VLAN filter.
+
+*   --disable-hw-vlan-strip
+
+Disable hardware VLAN strip.
+
+*   --disable-hw-vlan-extend
+
+Disable hardware VLAN extend.
+
 *   --enable-drop-en

 Enable per-queue packet drop for packets with no descriptors.
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst 
b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index 218835a..b644626 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -896,6 +896,39 @@ Hardware VLAN is on by default.

 The off option is equivalent to the --disable-hw-vlan command-line option.

+port config - VLAN filter
+~
+
+Set hardware VLAN filter on or off for all ports:
+
+port config all hw-vlan-filter (on|off)
+
+Hardware VLAN filter is on by default.
+
+The off option is equivalent to the --disable-hw-vlan-filter command-line 
option.
+
+port config - VLAN strip
+
+
+Set hardware VLAN strip on or off for all ports:
+
+port config all hw-vlan-strip (on|off)
+
+Hardware VLAN strip is on by default.
+
+The off option is equivalent to the --disable-hw-vlan-strip command-line 
option.
+
+port config - VLAN extend
+~
+
+Set hardware VLAN extend on or off for all ports:
+
+port config all hw-vlan-extend (on|off)
+
+Hardware VLAN extend is off by default.
+
+The off option is equivalent to the --disable-hw-vlan-extend command-line 
option.
+
 port config - Drop Packets
 ~~

-- 
1.8.4.2



[dpdk-dev] [PATCH v3 1/2] testpmd: HW vlan command

2015-03-06 Thread Ouyang Changchun
This patch enables testpmd user can config port hw_vlan with more fine 
granularity:
hw vlan filter, hw vlan strip, and hw vlan extend.

Don't remove the original command(hw-vlan) considering that some user still 
want to use
only one command to switch on/off all 3 options.

Signed-off-by: Changchun Ouyang 
Acked-by: Pablo de Lara 
---
 app/test-pmd/cmdline.c| 36 +---
 app/test-pmd/parameters.c | 18 ++
 2 files changed, 51 insertions(+), 3 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 590e427..99cc307 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -584,7 +584,8 @@ static void cmd_help_long_parsed(void *parsed_result,
"port config all max-pkt-len (value)\n"
"Set the max packet length.\n\n"

-   "port config all (crc-strip|rx-cksum|hw-vlan|drop-en)"
+   "port config all 
(crc-strip|rx-cksum|hw-vlan|hw-vlan-filter|"
+   "hw-vlan-strip|hw-vlan-extend|drop-en)"
" (on|off)\n"
"Set crc-strip/rx-checksum/hardware-vlan/drop_en"
" for ports.\n\n"
@@ -1327,6 +1328,33 @@ cmd_config_rx_mode_flag_parsed(void *parsed_result,
printf("Unknown parameter\n");
return;
}
+   } else if (!strcmp(res->name, "hw-vlan-filter")) {
+   if (!strcmp(res->value, "on"))
+   rx_mode.hw_vlan_filter = 1;
+   else if (!strcmp(res->value, "off"))
+   rx_mode.hw_vlan_filter = 0;
+   else {
+   printf("Unknown parameter\n");
+   return;
+   }
+   } else if (!strcmp(res->name, "hw-vlan-strip")) {
+   if (!strcmp(res->value, "on"))
+   rx_mode.hw_vlan_strip  = 1;
+   else if (!strcmp(res->value, "off"))
+   rx_mode.hw_vlan_strip  = 0;
+   else {
+   printf("Unknown parameter\n");
+   return;
+   }
+   } else if (!strcmp(res->name, "hw-vlan-extend")) {
+   if (!strcmp(res->value, "on"))
+   rx_mode.hw_vlan_extend = 1;
+   else if (!strcmp(res->value, "off"))
+   rx_mode.hw_vlan_extend = 0;
+   else {
+   printf("Unknown parameter\n");
+   return;
+   }
} else if (!strcmp(res->name, "drop-en")) {
if (!strcmp(res->value, "on"))
rx_drop_en = 1;
@@ -1355,7 +1383,8 @@ cmdline_parse_token_string_t cmd_config_rx_mode_flag_all =
TOKEN_STRING_INITIALIZER(struct cmd_config_rx_mode_flag, all, "all");
 cmdline_parse_token_string_t cmd_config_rx_mode_flag_name =
TOKEN_STRING_INITIALIZER(struct cmd_config_rx_mode_flag, name,
-   "crc-strip#rx-cksum#hw-vlan");
+   "crc-strip#rx-cksum#hw-vlan#"
+   
"hw-vlan-filter#hw-vlan-strip#hw-vlan-extend");
 cmdline_parse_token_string_t cmd_config_rx_mode_flag_value =
TOKEN_STRING_INITIALIZER(struct cmd_config_rx_mode_flag, value,
"on#off");
@@ -1363,7 +1392,8 @@ cmdline_parse_token_string_t 
cmd_config_rx_mode_flag_value =
 cmdline_parse_inst_t cmd_config_rx_mode_flag = {
.f = cmd_config_rx_mode_flag_parsed,
.data = NULL,
-   .help_str = "port config all crc-strip|rx-cksum|hw-vlan on|off",
+   .help_str = "port config all crc-strip|rx-cksum|hw-vlan|"
+   "hw-vlan-filter|hw-vlan-strip|hw-vlan-extend on|off",
.tokens = {
(void *)&cmd_config_rx_mode_flag_port,
(void *)&cmd_config_rx_mode_flag_keyword,
diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
index adf3203..04dc129 100644
--- a/app/test-pmd/parameters.c
+++ b/app/test-pmd/parameters.c
@@ -157,6 +157,9 @@ usage(char* progname)
printf("  --crc-strip: enable CRC stripping by hardware.\n");
printf("  --enable-rx-cksum: enable rx hardware checksum offload.\n");
printf("  --disable-hw-vlan: disable hardware vlan.\n");
+   printf("  --disable-hw-vlan-filter: disable hardware vlan filter.\n");
+   printf("  --disable-hw-vlan-strip: disable hardware vlan strip.\n");
+   printf("  --disable-hw-vlan-extend: disable hardware vlan extend.\n");
printf("  --enable-drop-en: enable per queue packet drop.\n");
printf("  --disable-rss: disable rss.\n");
printf("  --port-topology=N: set port topology (N: paired (default) or "
@@ -528,6 +531,9 @@ launch_args_parse(int argc, char** argv)
{ "crc-strip",  0, 0, 0 },
{ "en

[dpdk-dev] [PATCH v3 0/2] New HW VLAN command in testpmd

2015-03-06 Thread Ouyang Changchun
This patch enables testpmd user can config port hw_vlan with more fine 
granularity:
hw vlan filter, hw vlan strip, and hw vlan extend;

Update testpmd doc accordingly.

Changchun Ouyang (2):
  testpmd: HW vlan command
  doc: Update for new HW vlan command

 app/test-pmd/cmdline.c  | 36 ++---
 app/test-pmd/parameters.c   | 18 +++
 doc/guides/testpmd_app_ug/run_app.rst   | 12 ++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 33 ++
 4 files changed, 96 insertions(+), 3 deletions(-)

-- 
1.8.4.2



[dpdk-dev] [PATCH v2 2/2] doc: Update for new HW vlan command

2015-03-06 Thread Ouyang Changchun
Update the testpmd doc as there are new HW VLAN commands/options.

Signed-off-by: Changchun Ouyang 
---
 doc/guides/testpmd_app_ug/run_app.rst   | 12 +++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 33 +
 2 files changed, 45 insertions(+)

diff --git a/doc/guides/testpmd_app_ug/run_app.rst 
b/doc/guides/testpmd_app_ug/run_app.rst
index 67f62d2..3898e67 100644
--- a/doc/guides/testpmd_app_ug/run_app.rst
+++ b/doc/guides/testpmd_app_ug/run_app.rst
@@ -262,6 +262,18 @@ They must be separated from the EAL options, shown in the 
previous section, with

 Disable hardware VLAN.

+*   --disable-hw-vlan-filter
+
+Disable hardware VLAN filter.
+
+*   --disable-hw-vlan-strip
+
+Disable hardware VLAN strip.
+
+*   --disable-hw-vlan-extend
+
+Disable hardware VLAN extend.
+
 *   --enable-drop-en

 Enable per-queue packet drop for packets with no descriptors.
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst 
b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index 218835a..b644626 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -896,6 +896,39 @@ Hardware VLAN is on by default.

 The off option is equivalent to the --disable-hw-vlan command-line option.

+port config - VLAN filter
+~
+
+Set hardware VLAN filter on or off for all ports:
+
+port config all hw-vlan-filter (on|off)
+
+Hardware VLAN filter is on by default.
+
+The off option is equivalent to the --disable-hw-vlan-filter command-line 
option.
+
+port config - VLAN strip
+
+
+Set hardware VLAN strip on or off for all ports:
+
+port config all hw-vlan-strip (on|off)
+
+Hardware VLAN strip is on by default.
+
+The off option is equivalent to the --disable-hw-vlan-strip command-line 
option.
+
+port config - VLAN extend
+~
+
+Set hardware VLAN extend on or off for all ports:
+
+port config all hw-vlan-extend (on|off)
+
+Hardware VLAN extend is off by default.
+
+The off option is equivalent to the --disable-hw-vlan-extend command-line 
option.
+
 port config - Drop Packets
 ~~

-- 
1.8.4.2



[dpdk-dev] [PATCH v2 1/2] testpmd: HW vlan command

2015-03-06 Thread Ouyang Changchun
This patch enables testpmd user can config port hw_vlan with more fine 
granularity:
hw vlan filter, hw vlan strip, and hw vlan extend.

Don't remove the original command(hw-vlan) considering that some user still 
want to use
only one command to switch on/off all 3 options.

Signed-off-by: Changchun Ouyang 
Acked-by: Pablo de Lara 
---
 app/test-pmd/cmdline.c| 36 +---
 app/test-pmd/parameters.c | 18 ++
 2 files changed, 51 insertions(+), 3 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 590e427..99cc307 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -584,7 +584,8 @@ static void cmd_help_long_parsed(void *parsed_result,
"port config all max-pkt-len (value)\n"
"Set the max packet length.\n\n"

-   "port config all (crc-strip|rx-cksum|hw-vlan|drop-en)"
+   "port config all 
(crc-strip|rx-cksum|hw-vlan|hw-vlan-filter|"
+   "hw-vlan-strip|hw-vlan-extend|drop-en)"
" (on|off)\n"
"Set crc-strip/rx-checksum/hardware-vlan/drop_en"
" for ports.\n\n"
@@ -1327,6 +1328,33 @@ cmd_config_rx_mode_flag_parsed(void *parsed_result,
printf("Unknown parameter\n");
return;
}
+   } else if (!strcmp(res->name, "hw-vlan-filter")) {
+   if (!strcmp(res->value, "on"))
+   rx_mode.hw_vlan_filter = 1;
+   else if (!strcmp(res->value, "off"))
+   rx_mode.hw_vlan_filter = 0;
+   else {
+   printf("Unknown parameter\n");
+   return;
+   }
+   } else if (!strcmp(res->name, "hw-vlan-strip")) {
+   if (!strcmp(res->value, "on"))
+   rx_mode.hw_vlan_strip  = 1;
+   else if (!strcmp(res->value, "off"))
+   rx_mode.hw_vlan_strip  = 0;
+   else {
+   printf("Unknown parameter\n");
+   return;
+   }
+   } else if (!strcmp(res->name, "hw-vlan-extend")) {
+   if (!strcmp(res->value, "on"))
+   rx_mode.hw_vlan_extend = 1;
+   else if (!strcmp(res->value, "off"))
+   rx_mode.hw_vlan_extend = 0;
+   else {
+   printf("Unknown parameter\n");
+   return;
+   }
} else if (!strcmp(res->name, "drop-en")) {
if (!strcmp(res->value, "on"))
rx_drop_en = 1;
@@ -1355,7 +1383,8 @@ cmdline_parse_token_string_t cmd_config_rx_mode_flag_all =
TOKEN_STRING_INITIALIZER(struct cmd_config_rx_mode_flag, all, "all");
 cmdline_parse_token_string_t cmd_config_rx_mode_flag_name =
TOKEN_STRING_INITIALIZER(struct cmd_config_rx_mode_flag, name,
-   "crc-strip#rx-cksum#hw-vlan");
+   "crc-strip#rx-cksum#hw-vlan#"
+   
"hw-vlan-filter#hw-vlan-strip#hw-vlan-extend");
 cmdline_parse_token_string_t cmd_config_rx_mode_flag_value =
TOKEN_STRING_INITIALIZER(struct cmd_config_rx_mode_flag, value,
"on#off");
@@ -1363,7 +1392,8 @@ cmdline_parse_token_string_t 
cmd_config_rx_mode_flag_value =
 cmdline_parse_inst_t cmd_config_rx_mode_flag = {
.f = cmd_config_rx_mode_flag_parsed,
.data = NULL,
-   .help_str = "port config all crc-strip|rx-cksum|hw-vlan on|off",
+   .help_str = "port config all crc-strip|rx-cksum|hw-vlan|"
+   "hw-vlan-filter|hw-vlan-strip|hw-vlan-extend on|off",
.tokens = {
(void *)&cmd_config_rx_mode_flag_port,
(void *)&cmd_config_rx_mode_flag_keyword,
diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
index adf3203..04dc129 100644
--- a/app/test-pmd/parameters.c
+++ b/app/test-pmd/parameters.c
@@ -157,6 +157,9 @@ usage(char* progname)
printf("  --crc-strip: enable CRC stripping by hardware.\n");
printf("  --enable-rx-cksum: enable rx hardware checksum offload.\n");
printf("  --disable-hw-vlan: disable hardware vlan.\n");
+   printf("  --disable-hw-vlan-filter: disable hardware vlan filter.\n");
+   printf("  --disable-hw-vlan-strip: disable hardware vlan strip.\n");
+   printf("  --disable-hw-vlan-extend: disable hardware vlan extend.\n");
printf("  --enable-drop-en: enable per queue packet drop.\n");
printf("  --disable-rss: disable rss.\n");
printf("  --port-topology=N: set port topology (N: paired (default) or "
@@ -528,6 +531,9 @@ launch_args_parse(int argc, char** argv)
{ "crc-strip",  0, 0, 0 },
{ "en

[dpdk-dev] [PATCH v2 0/2]

2015-03-06 Thread Ouyang Changchun
This patch enables testpmd user can config port hw_vlan with more fine 
granularity:
hw vlan filter, hw vlan strip, and hw vlan extend;

Update testpmd doc accordingly.

Changchun Ouyang (2):
  testpmd: HW vlan command
  doc: Update for new HW vlan command

 app/test-pmd/cmdline.c  | 36 ++---
 app/test-pmd/parameters.c   | 18 +++
 doc/guides/testpmd_app_ug/run_app.rst   | 12 ++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 33 ++
 4 files changed, 96 insertions(+), 3 deletions(-)

-- 
1.8.4.2



[dpdk-dev] [PATCHv2] headers: typeof -> __typeof__ to unbreak C++11 code

2015-03-06 Thread Konstantin Ananyev
v2:
Instead of changing all the affected files,
define 'typeofi' and 'asm' if needed.

When compiling C++11-code or above (--std=c++11), the build fails with
lots of

  rte_eth_ctrl.h:517:3: note: in expansion of macro RTE_ALIGN
(RTE_ALIGN(RTE_ETH_FLOW_MAX, UINT32_BIT)/UINT32_BIT)
^

When reading the GCC info pages, I get the feeling that __typeof__ is
a better choice, and that indeed works when including the headers in
C++ files (--std=c++11).

There are some typeof()s left in C files, the patch only touches the
public API.

Signed-off-by: Simon Kagstrom 
Signed-off-by: Konstantin Ananyev 
---
 lib/librte_eal/common/include/rte_common.h | 9 +
 1 file changed, 9 insertions(+)

diff --git a/lib/librte_eal/common/include/rte_common.h 
b/lib/librte_eal/common/include/rte_common.h
index 8ac940c..1867692 100644
--- a/lib/librte_eal/common/include/rte_common.h
+++ b/lib/librte_eal/common/include/rte_common.h
@@ -51,6 +51,15 @@ extern "C" {
 #include 
 #include 

+#ifndef typeof
+#define typeof __typeof__
+#endif
+
+#ifndef asm
+#define asm __asm__
+#endif
+
+
 /*** Macros to eliminate unused variable warnings /

 /**
-- 
1.8.5.3



[dpdk-dev] [PATCH] librte_pmd_fm10k: Set pointer to NULL after free

2015-03-06 Thread Michael Qiu
It could be a potential not safe issue.

Signed-off-by: Michael Qiu 
---
 lib/librte_pmd_fm10k/fm10k_ethdev.c | 14 +++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/lib/librte_pmd_fm10k/fm10k_ethdev.c 
b/lib/librte_pmd_fm10k/fm10k_ethdev.c
index 07ea1e7..30962d3 100644
--- a/lib/librte_pmd_fm10k/fm10k_ethdev.c
+++ b/lib/librte_pmd_fm10k/fm10k_ethdev.c
@@ -142,9 +142,12 @@ rx_queue_free(struct fm10k_rx_queue *q)
if (q) {
PMD_INIT_LOG(DEBUG, "Freeing rx queue %p", q);
rx_queue_clean(q);
-   if (q->sw_ring)
+   if (q->sw_ring) {
rte_free(q->sw_ring);
+   q->sw_ring = NULL;
+   }
rte_free(q);
+   q = NULL;
}
 }

@@ -225,11 +228,16 @@ tx_queue_free(struct fm10k_tx_queue *q)
if (q) {
PMD_INIT_LOG(DEBUG, "Freeing tx queue %p", q);
tx_queue_clean(q);
-   if (q->rs_tracker.list)
+   if (q->rs_tracker.list) {
rte_free(q->rs_tracker.list);
-   if (q->sw_ring)
+   q->rs_tracker.list = NULL;
+   }
+   if (q->sw_ring) {
rte_free(q->sw_ring);
+   q->sw_ring = NULL;
+   }
rte_free(q);
+   q = NULL;
}
 }

-- 
1.9.3



[dpdk-dev] [PATCH 1/2] virtio: initialize iopl when device is initialized

2015-03-06 Thread Stephen Hemminger
On Fri, 6 Mar 2015 23:04:33 +0100
David Marchand  wrote:

> In the end, the fix would be to move rte_eal_intr_init() after 
> rte_eal_dev_init().


That would work, but was worried it would break other devices.


[dpdk-dev] [PATCH] A fix to work around strict-aliasing rules breaking

2015-03-06 Thread Liang, Cunming
Hi,

On 3/2/2015 5:03 PM, zhihong.wang at intel.com wrote:
> Fixed strict-aliasing rules breaking errors for some GCC version.
>
> Signed-off-by: Zhihong Wang 
> ---
>   .../common/include/arch/x86/rte_memcpy.h   | 44 
> --
>   1 file changed, 24 insertions(+), 20 deletions(-)
>
> diff --git a/lib/librte_eal/common/include/arch/x86/rte_memcpy.h 
> b/lib/librte_eal/common/include/arch/x86/rte_memcpy.h
> index 69a5c6f..f412099 100644
> --- a/lib/librte_eal/common/include/arch/x86/rte_memcpy.h
> +++ b/lib/librte_eal/common/include/arch/x86/rte_memcpy.h
> @@ -195,6 +195,8 @@ rte_mov256blocks(uint8_t *dst, const uint8_t *src, size_t 
> n)
>   static inline void *
>   rte_memcpy(void *dst, const void *src, size_t n)
>   {
> + uintptr_t dstu = (uintptr_t)dst;
> + uintptr_t srcu = (uintptr_t)src;
>   void *ret = dst;
>   int dstofss;
>   int bits;
> @@ -204,22 +206,22 @@ rte_memcpy(void *dst, const void *src, size_t n)
>*/
>   if (n < 16) {
>   if (n & 0x01) {
> - *(uint8_t *)dst = *(const uint8_t *)src;
> - src = (const uint8_t *)src + 1;
> - dst = (uint8_t *)dst + 1;
> + *(uint8_t *)dstu = *(const uint8_t *)srcu;
> + srcu = (uintptr_t)((const uint8_t *)srcu + 1);
> + dstu = (uintptr_t)((uint8_t *)dstu + 1);
>   }
>   if (n & 0x02) {
> - *(uint16_t *)dst = *(const uint16_t *)src;
> - src = (const uint16_t *)src + 1;
> - dst = (uint16_t *)dst + 1;
> + *(uint16_t *)dstu = *(const uint16_t *)srcu;
> + srcu = (uintptr_t)((const uint16_t *)srcu + 1);
> + dstu = (uintptr_t)((uint16_t *)dstu + 1);
>   }
>   if (n & 0x04) {
> - *(uint32_t *)dst = *(const uint32_t *)src;
> - src = (const uint32_t *)src + 1;
> - dst = (uint32_t *)dst + 1;
> + *(uint32_t *)dstu = *(const uint32_t *)srcu;
> + srcu = (uintptr_t)((const uint32_t *)srcu + 1);
> + dstu = (uintptr_t)((uint32_t *)dstu + 1);
>   }
>   if (n & 0x08) {
> - *(uint64_t *)dst = *(const uint64_t *)src;
> + *(uint64_t *)dstu = *(const uint64_t *)srcu;
>   }
>   return ret;
>   }
> @@ -458,6 +460,8 @@ static inline void *
>   rte_memcpy(void *dst, const void *src, size_t n)
>   {
>   __m128i xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, xmm8;
> + uintptr_t dstu = (uintptr_t)dst;
> + uintptr_t srcu = (uintptr_t)src;
>   void *ret = dst;
>   int dstofss;
>   int srcofs;
> @@ -467,22 +471,22 @@ rte_memcpy(void *dst, const void *src, size_t n)
>*/
>   if (n < 16) {
>   if (n & 0x01) {
> - *(uint8_t *)dst = *(const uint8_t *)src;
> - src = (const uint8_t *)src + 1;
> - dst = (uint8_t *)dst + 1;
> + *(uint8_t *)dstu = *(const uint8_t *)srcu;
> + srcu = (uintptr_t)((const uint8_t *)srcu + 1);
> + dstu = (uintptr_t)((uint8_t *)dstu + 1);
>   }
>   if (n & 0x02) {
> - *(uint16_t *)dst = *(const uint16_t *)src;
> - src = (const uint16_t *)src + 1;
> - dst = (uint16_t *)dst + 1;
> + *(uint16_t *)dstu = *(const uint16_t *)srcu;
> + srcu = (uintptr_t)((const uint16_t *)srcu + 1);
> + dstu = (uintptr_t)((uint16_t *)dstu + 1);
>   }
>   if (n & 0x04) {
> - *(uint32_t *)dst = *(const uint32_t *)src;
> - src = (const uint32_t *)src + 1;
> - dst = (uint32_t *)dst + 1;
> + *(uint32_t *)dstu = *(const uint32_t *)srcu;
> + srcu = (uintptr_t)((const uint32_t *)srcu + 1);
> + dstu = (uintptr_t)((uint32_t *)dstu + 1);
>   }
>   if (n & 0x08) {
> - *(uint64_t *)dst = *(const uint64_t *)src;
> + *(uint64_t *)dstu = *(const uint64_t *)srcu;
>   }
>   return ret;
>   }

Acked-by:Cunming Liang mailto:cunming.liang at intel.com>>



[dpdk-dev] [PATCH] app/test-pmd: Fix log issue without nic binded

2015-03-06 Thread De Lara Guarch, Pablo


> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Michael Qiu
> Sent: Monday, March 02, 2015 8:32 AM
> To: dev at dpdk.org
> Subject: [dpdk-dev] [PATCH] app/test-pmd: Fix log issue without nic binded
> 
> As hotplug has been enabled, start the testpmd with no nic binded
> will show one error log "Please stop the ports first":
> 
> Interactive-mode selected
> Please stop the ports first
> Done
> testpmd>
> 
> This issue is cause by the logic of check link status.
> 
> Signed-off-by: Michael Qiu 

Acked-by: Pablo de Lara 


[dpdk-dev] [PATCH] headers: typeof -> __typeof__ to unbreak C++11 code

2015-03-06 Thread Simon Kågström
On 2015-03-06 11:30, Ananyev, Konstantin wrote:
> 
> Hi Simon,
> 
>> -Original Message-
>> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Simon K?gstr?m
>> Sent: Friday, March 06, 2015 8:28 AM
>> To: dev at dpdk.org
>> Subject: Re: [dpdk-dev] [PATCH] headers: typeof -> __typeof__ to unbreak 
>> C++11 code
>>
>> Ping? Konstantins simpler patch is fine for me, but at least one of
>> these two would be very nice to have so that modern C++ code can use DPDK.
>>
> Can you do v2 as suggested, or do you want me to do it?

You wrote that patch (which looks better than mine), so feel free to
submit it!

Thanks,
// Simon




[dpdk-dev] [PATCH 2/2] doc: update release note for fm10k pmd driver

2015-03-06 Thread Chen Jing D(Mark)
From: "Chen Jing D(Mark)" 

Add feature list for fm10k driver.

Signed-off-by: Chen Jing D(Mark) 
---
 doc/guides/rel_notes/new_features.rst |   20 
 1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/doc/guides/rel_notes/new_features.rst 
b/doc/guides/rel_notes/new_features.rst
index 2993b1e..c08d5a8 100644
--- a/doc/guides/rel_notes/new_features.rst
+++ b/doc/guides/rel_notes/new_features.rst
@@ -58,4 +58,24 @@ New Features

 *   Packet Distributor Sample Application

+*   Poll Mode Driver - PCIE host-interface of Intel Ethernet Switch FM1 
Series (librte_pmd_fm10k)
+
+*   Basic Rx/Tx functions for PF/VF
+
+*   Interrupt handling support for PF/VF
+
+*   Per queue start/stop functions for PF/VF
+
+*   Support Mailbox handling between PF/VF and PF/Switch Manager
+
+*   Receive Side Scaling (RSS) for PF/VF
+
+*   Scatter receive function for PF/VF
+
+*   Reta update/query for PF/VF
+
+*   VLAN filter set for PF
+
+*   Link status query for PF/VF.
+
 For further features supported in this release, see Chapter 3 Supported 
Features.
-- 
1.7.7.6



[dpdk-dev] [PATCH 1/2] doc: update programmers guide for fm10k pmd driver

2015-03-06 Thread Chen Jing D(Mark)
From: "Chen Jing D(Mark)" 

DPDK introduced pmd driver for PCIE host-interface of Intel Ethernet
Switch FM1 Series, update programming guide to describe the new
driver and usage.

Signed-off-by: Chen Jing D(Mark) 
---
 .../prog_guide/i40e_ixgbe_igb_virt_func_drv.rst|   37 ++-
 doc/guides/prog_guide/source_org.rst   |1 +
 2 files changed, 36 insertions(+), 2 deletions(-)

diff --git a/doc/guides/prog_guide/i40e_ixgbe_igb_virt_func_drv.rst 
b/doc/guides/prog_guide/i40e_ixgbe_igb_virt_func_drv.rst
index 41e316e..8ea518d 100755
--- a/doc/guides/prog_guide/i40e_ixgbe_igb_virt_func_drv.rst
+++ b/doc/guides/prog_guide/i40e_ixgbe_igb_virt_func_drv.rst
@@ -53,9 +53,10 @@ Refer to Figure 10.

 Therefore, a NIC is logically distributed among multiple virtual machines (as 
shown in Figure 10),
 while still having global data in common to share with the Physical Function 
and other Virtual Functions.
-The DPDK i40evf, igbvf or ixgbevf as a Poll Mode Driver (PMD) serves for the 
Intel? 82576 Gigabit Ethernet Controller,
+The DPDK fm10kvf, i40evf, igbvf or ixgbevf as a Poll Mode Driver (PMD) serves 
for the Intel? 82576 Gigabit Ethernet Controller,
 Intel? Ethernet Controller I350 family, Intel? 82599 10 Gigabit Ethernet 
Controller NIC,
-or Intel? Fortville 10/40 Gigabit Ethernet Controller NIC's virtual PCI 
function.
+Intel? Fortville 10/40 Gigabit Ethernet Controller NIC's virtual PCI 
function,or PCIE host-interface of the Intel Ethernet Switch
+FM1 Series.
 Meanwhile the DPDK Poll Mode Driver (PMD) also supports "Physical Function" of 
such NIC's on the host.

 The DPDK PF/VF Poll Mode Driver (PMD) supports the Layer 2 switch on Intel? 
82576 Gigabit Ethernet Controller,
@@ -93,6 +94,38 @@ and the Physical Function operates on the global resources 
on behalf of the Virt
 For this out-of-band communication, an SR-IOV enabled NIC provides a memory 
buffer for each Virtual Function,
 which is called a "Mailbox".

+
+The PCIE host-interface of Intel Ethernet Switch FM1 Series VF 
infrastructure
+
+
+In a virtualized environment, the programmer can enable a maximum of *64 
Virtual Functions (VF)*
+globally per PCIE host-interface of the Intel Ethernet Switch FM1 Series 
device.
+Each VF can have a maximum of 16 queue pairs.
+The Physical Function in host could be only configured by the Linux* fm10k 
driver
+(in the case of the Linux Kernel-based Virtual Machine [KVM]), DPDK PMD PF 
driver doesn't support it yet.
+
+For example,
+
+*   Using Linux* fm10k driver:
+
+.. code-block:: console
+
+rmmod fm10k (To remove the fm10k module)
+insmod fm0k.ko max_vfs=2,2 (To enable two Virtual Functions per port)
+
+Virtual Function enumeration is performed in the following sequence by the 
Linux* pci driver for a dual-port NIC.
+When you enable the four Virtual Functions with the above command, the four 
enabled functions have a Function#
+represented by (Bus#, Device#, Function#) in sequence starting from 0 to 3.
+However:
+
+*   Virtual Functions 0 and 2 belong to Physical Function 0
+
+*   Virtual Functions 1 and 3 belong to Physical Function 1
+
+.. note::
+
+The above is an important consideration to take into account when 
targeting specific packets to a selected port.
+
 Intel? Fortville 10/40 Gigabit Ethernet Controller VF Infrastructure
 

diff --git a/doc/guides/prog_guide/source_org.rst 
b/doc/guides/prog_guide/source_org.rst
index c66ad16..061f107 100644
--- a/doc/guides/prog_guide/source_org.rst
+++ b/doc/guides/prog_guide/source_org.rst
@@ -81,6 +81,7 @@ The lib directory contains::
 +-- librte_net  # various IP-related headers
 +-- librte_pmd_bond # bonding poll mode driver
 +-- librte_pmd_e1000# 1GbE poll mode drivers (igb and em)
++-- librte_pmd_fm10k# Host interface PMD driver for FM1 Series
 +-- librte_pmd_ixgbe# 10GbE poll mode driver
 +-- librte_pmd_i40e # 40GbE poll mode driver
 +-- librte_pmd_mlx4 # Mellanox ConnectX-3 poll mode driver
-- 
1.7.7.6



[dpdk-dev] [PATCH] testpmd: Fix port validation code of "port stop all" command

2015-03-06 Thread De Lara Guarch, Pablo
Hi Michael,

> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Qiu, Michael
> Sent: Thursday, March 05, 2015 1:33 PM
> To: Tetsuya Mukawa; dev at dpdk.org
> Subject: Re: [dpdk-dev] [PATCH] testpmd: Fix port validation code of "port
> stop all" command
> 
> Hi, Tetsuya and Pablo
> This is not a full fix, I have generate the full fix patch two days ago,

Sorry I did not see this earlier. Did you upstream this patch already?
I acked Tetsuya's patch, as it was simple and works, but I cannot find
this one.

Thanks,
Pablo

> See below:
> 
> diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
> index 49be819..ec53923 100644
> --- a/app/test-pmd/config.c
> +++ b/app/test-pmd/config.c
> @@ -384,6 +384,9 @@ port_infos_display(portid_t port_id)
>  int
>  port_id_is_invalid(portid_t port_id, enum print_warning warning)
>  {
> +   if (port_id == (portid_t)RTE_PORT_ALL)
> +   return 0;
> +
> if (ports[port_id].enabled)
> return 0;
> 
> diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
> index e556b4c..1c4c651 100644
> --- a/app/test-pmd/testpmd.c
> +++ b/app/test-pmd/testpmd.c
> @@ -1326,6 +1326,9 @@ start_port(portid_t pid)
> return -1;
> }
> 
> +   if (port_id_is_invalid(pid, ENABLED_WARN))
> +   return 0;
> +
> if (init_fwd_streams() < 0) {
> printf("Fail from init_fwd_streams()\n");
> return -1;
> @@ -1482,10 +1485,14 @@ stop_port(portid_t pid)
> dcb_test = 0;
> dcb_config = 0;
> }
> +
> +   if (port_id_is_invalid(pid, ENABLED_WARN))
> +   return;
> +
> printf("Stopping ports...\n");
> 
> FOREACH_PORT(pi, ports) {
> -   if (!port_id_is_invalid(pid, DISABLED_WARN) && pid != pi)
> +   if (pid != pi && pid != (portid_t)RTE_PORT_ALL)
> continue;
> 
> port = &ports[pi];
> @@ -1517,10 +1524,13 @@ close_port(portid_t pid)
> return;
> }
> 
> +   if (port_id_is_invalid(pid, ENABLED_WARN))
> +return;
> +
> printf("Closing ports...\n");
> 
> FOREACH_PORT(pi, ports) {
> -   if (!port_id_is_invalid(pid, DISABLED_WARN) && pid != pi)
> +   if (pid != pi && pid != (portid_t)RTE_PORT_ALL)
> continue;
> 
> port = &ports[pi];
> --
> 1.9.3
> 
> Thanks,
> Michael
> 
> On 3/5/2015 3:31 PM, Tetsuya Mukawa wrote:
> > When "port stop all" is executed, the command doesn't work as it should
> > because of wrong port validation. The patch fixes this issue.
> >
> > Reported-by: Pablo de Lara 
> > Signed-off-by: Tetsuya Mukawa 
> > ---
> >  app/test-pmd/testpmd.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
> > index 61291be..bb65342 100644
> > --- a/app/test-pmd/testpmd.c
> > +++ b/app/test-pmd/testpmd.c
> > @@ -1484,7 +1484,7 @@ stop_port(portid_t pid)
> > printf("Stopping ports...\n");
> >
> > FOREACH_PORT(pi, ports) {
> > -   if (!port_id_is_invalid(pid, DISABLED_WARN) && pid != pi)
> > +   if (pid != pi && pid != (portid_t)RTE_PORT_ALL)
> > continue;
> >
> > port = &ports[pi];



[dpdk-dev] [PATCH] lib/librte_vhost: use loop instead of goto

2015-03-06 Thread Huawei Xie
This patch reorder the code a bit to use loop instead of goto.
Besides, remove abudant check 'fd != -1'.

Signed-off-by: Huawei Xie 
---
 lib/librte_vhost/vhost_user/fd_man.c | 26 +++---
 1 file changed, 11 insertions(+), 15 deletions(-)

diff --git a/lib/librte_vhost/vhost_user/fd_man.c 
b/lib/librte_vhost/vhost_user/fd_man.c
index a89b6fe..831c9c1 100644
--- a/lib/librte_vhost/vhost_user/fd_man.c
+++ b/lib/librte_vhost/vhost_user/fd_man.c
@@ -172,23 +172,19 @@ fdset_del(struct fdset *pfdset, int fd)
if (pfdset == NULL || fd == -1)
return;

-again:
-   pthread_mutex_lock(&pfdset->fd_mutex);
+   do {
+   pthread_mutex_lock(&pfdset->fd_mutex);

-   i = fdset_find_fd(pfdset, fd);
-   if (i != -1 && fd != -1) {
-   /* busy indicates r/wcb is executing! */
-   if (pfdset->fd[i].busy == 1) {
-   pthread_mutex_unlock(&pfdset->fd_mutex);
-   goto again;
+   i = fdset_find_fd(pfdset, fd);
+   if (i != -1 && pfdset->fd[i].busy == 0) {
+   /* busy indicates r/wcb is executing! */
+   pfdset->fd[i].fd = -1;
+   pfdset->fd[i].rcb = pfdset->fd[i].wcb = NULL;
+   pfdset->num--;
+   i = -1;
}
-
-   pfdset->fd[i].fd = -1;
-   pfdset->fd[i].rcb = pfdset->fd[i].wcb = NULL;
-   pfdset->num--;
-   }
-
-   pthread_mutex_unlock(&pfdset->fd_mutex);
+   pthread_mutex_unlock(&pfdset->fd_mutex);
+   } while (i != -1);
 }

 /**
-- 
1.8.1.4



[dpdk-dev] [PATCH] lib/librte_vhost: combine select with sleep

2015-03-06 Thread Huawei Xie
combine sleep into select when there is no file descriptors to be monitored.

Signed-off-by: Huawei Xie 
---
 lib/librte_vhost/vhost_user/fd_man.c | 13 +++--
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/lib/librte_vhost/vhost_user/fd_man.c 
b/lib/librte_vhost/vhost_user/fd_man.c
index 63ac4df..a89b6fe 100644
--- a/lib/librte_vhost/vhost_user/fd_man.c
+++ b/lib/librte_vhost/vhost_user/fd_man.c
@@ -211,25 +211,26 @@ fdset_event_dispatch(struct fdset *pfdset)
void *dat;
int fd;
int remove1, remove2;
+   int ret;

if (pfdset == NULL)
return;

while (1) {
+   struct timeval tv;
+   tv.tv_sec = 1;
+   tv.tv_usec = 0;
FD_ZERO(&rfds);
FD_ZERO(&wfds);
pthread_mutex_lock(&pfdset->fd_mutex);

maxfds = fdset_fill(&rfds, &wfds, pfdset);
-   if (maxfds == -1) {
-   pthread_mutex_unlock(&pfdset->fd_mutex);
-   sleep(1);
-   continue;
-   }

pthread_mutex_unlock(&pfdset->fd_mutex);

-   select(maxfds + 1, &rfds, &wfds, NULL, NULL);
+   ret = select(maxfds + 1, &rfds, &wfds, NULL, &tv);
+   if (ret <= 0)
+   continue;

for (i = 0; i < num; i++) {
remove1 = remove2 = 0;
-- 
1.8.1.4



[dpdk-dev] [PATCH] testpmd: Fix port validation code of "port stop all" command

2015-03-06 Thread De Lara Guarch, Pablo


> -Original Message-
> From: Tetsuya Mukawa [mailto:mukawa at igel.co.jp]
> Sent: Thursday, March 05, 2015 7:30 AM
> To: dev at dpdk.org
> Cc: De Lara Guarch, Pablo; Tetsuya Mukawa
> Subject: [PATCH] testpmd: Fix port validation code of "port stop all"
> command
> 
> When "port stop all" is executed, the command doesn't work as it should
> because of wrong port validation. The patch fixes this issue.
> 
> Reported-by: Pablo de Lara 
> Signed-off-by: Tetsuya Mukawa 
> ---
>  app/test-pmd/testpmd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
> index 61291be..bb65342 100644
> --- a/app/test-pmd/testpmd.c
> +++ b/app/test-pmd/testpmd.c
> @@ -1484,7 +1484,7 @@ stop_port(portid_t pid)
>   printf("Stopping ports...\n");
> 
>   FOREACH_PORT(pi, ports) {
> - if (!port_id_is_invalid(pid, DISABLED_WARN) && pid != pi)
> + if (pid != pi && pid != (portid_t)RTE_PORT_ALL)
>   continue;
> 
>   port = &ports[pi];
> --
> 1.9.1

Acked-by: Pablo de Lara 



[dpdk-dev] [PATCH] af_packet: fix minor memory leak of kvlist in dev init

2015-03-06 Thread Mcnamara, John
Superseded by http://dpdk.org/ml/archives/dev/2015-February/014438.html



[dpdk-dev] [PATCH] hash: added rte_hash_clear that clears all keys

2015-03-06 Thread Tomas Vestelind
Hi Bruce!

Oh yea, this patch is quite old :)

I'm currently not working actively with DPDK. If no one else wants to do 
it, I could do the update and add a unit test

/Tomas

On 2015-03-06 12:10, Bruce Richardson wrote:
> On Tue, Aug 12, 2014 at 11:47:57PM +0200, Tomas Vestelind wrote:
>> I added rte_hash_clear which clear the map from all previously added
>> keys.
>>
> This patch is now quite old and needs an update to add the new API to the
> rte_hash_version.map. A unit test for the new function would also be good to
> have. Otherwise patch content looks ok. Is an updated V2 planned?
>
> Regards,
> /Bruce
>
>> Signed-off-by: Tomas Vestelind 
>> ---
>>   lib/librte_hash/rte_hash.c |   14 ++
>>   lib/librte_hash/rte_hash.h |   10 ++
>>   2 files changed, 24 insertions(+)
>>
>> diff --git a/lib/librte_hash/rte_hash.c b/lib/librte_hash/rte_hash.c
>> index 2108c4f..917a6c1 100644
>> --- a/lib/librte_hash/rte_hash.c
>> +++ b/lib/librte_hash/rte_hash.c
>> @@ -507,3 +507,17 @@ rte_hash_keys(const struct rte_hash *h, void *keys)
>>   
>>   return found_keys;
>>   }
>> +
>> +void
>> +rte_hash_clear(const struct rte_hash *h)
>> +{
>> +unsigned int bucket, entry;
>> +
>> +/* Clear all entries by invalidating each signature */
>> +for (bucket = 0; bucket < h->num_buckets; bucket++) {
>> +hash_sig_t *sig = get_sig_tbl_bucket(h, bucket);
>> +for (entry = 0; entry < h->bucket_entries; entry++) {
>> +sig[entry] = NULL_SIGNATURE;
>> +}
>> +}
>> +}
>> diff --git a/lib/librte_hash/rte_hash.h b/lib/librte_hash/rte_hash.h
>> index e0fb28f..b84137e 100644
>> --- a/lib/librte_hash/rte_hash.h
>> +++ b/lib/librte_hash/rte_hash.h
>> @@ -318,6 +318,16 @@ rte_hash_lookup_bulk(const struct rte_hash *h, const 
>> void **keys,
>>*/
>>   unsigned int
>>   rte_hash_keys(const struct rte_hash *h, void *keys);
>> +
>> +/**
>> + * Clear all keys. This operation is not multi-thread safe and should only 
>> be
>> + * called from one thread.
>> + *
>> + * @param h
>> + *   Hash table to clear.
>> + */
>> +void
>> +rte_hash_clear(const struct rte_hash *h);
>>   #ifdef __cplusplus
>>   }
>>   #endif
>> -- 
>> 1.7.10.4
>>
>
>




[dpdk-dev] [PATCH] hash: added rte_hash_clear that clears all keys

2015-03-06 Thread Bruce Richardson
On Fri, Mar 06, 2015 at 01:02:56PM +0100, Tomas Vestelind wrote:
> Hi Bruce!
> 
> Oh yea, this patch is quite old :)
> 
> I'm currently not working actively with DPDK. If no one else wants to do it,
> I could do the update and add a unit test
> 
> /Tomas

Hi Tomas,

no pressure, since there doesn't appear to be pressing interest in this 
enhancement
and since we are now passed feature freeze for 2.0.
However, contributions for our next release are always welcome!

Regards,
/Bruce

> 
> On 2015-03-06 12:10, Bruce Richardson wrote:
> >On Tue, Aug 12, 2014 at 11:47:57PM +0200, Tomas Vestelind wrote:
> >>I added rte_hash_clear which clear the map from all previously added
> >>keys.
> >>
> >This patch is now quite old and needs an update to add the new API to the
> >rte_hash_version.map. A unit test for the new function would also be good to
> >have. Otherwise patch content looks ok. Is an updated V2 planned?
> >
> >Regards,
> >/Bruce
> >
> >>Signed-off-by: Tomas Vestelind 
> >>---
> >>  lib/librte_hash/rte_hash.c |   14 ++
> >>  lib/librte_hash/rte_hash.h |   10 ++
> >>  2 files changed, 24 insertions(+)
> >>
> >>diff --git a/lib/librte_hash/rte_hash.c b/lib/librte_hash/rte_hash.c
> >>index 2108c4f..917a6c1 100644
> >>--- a/lib/librte_hash/rte_hash.c
> >>+++ b/lib/librte_hash/rte_hash.c
> >>@@ -507,3 +507,17 @@ rte_hash_keys(const struct rte_hash *h, void *keys)
> >>  return found_keys;
> >>  }
> >>+
> >>+void
> >>+rte_hash_clear(const struct rte_hash *h)
> >>+{
> >>+unsigned int bucket, entry;
> >>+
> >>+/* Clear all entries by invalidating each signature */
> >>+for (bucket = 0; bucket < h->num_buckets; bucket++) {
> >>+hash_sig_t *sig = get_sig_tbl_bucket(h, bucket);
> >>+for (entry = 0; entry < h->bucket_entries; entry++) {
> >>+sig[entry] = NULL_SIGNATURE;
> >>+}
> >>+}
> >>+}
> >>diff --git a/lib/librte_hash/rte_hash.h b/lib/librte_hash/rte_hash.h
> >>index e0fb28f..b84137e 100644
> >>--- a/lib/librte_hash/rte_hash.h
> >>+++ b/lib/librte_hash/rte_hash.h
> >>@@ -318,6 +318,16 @@ rte_hash_lookup_bulk(const struct rte_hash *h, const 
> >>void **keys,
> >>   */
> >>  unsigned int
> >>  rte_hash_keys(const struct rte_hash *h, void *keys);
> >>+
> >>+/**
> >>+ * Clear all keys. This operation is not multi-thread safe and should only 
> >>be
> >>+ * called from one thread.
> >>+ *
> >>+ * @param h
> >>+ *   Hash table to clear.
> >>+ */
> >>+void
> >>+rte_hash_clear(const struct rte_hash *h);
> >>  #ifdef __cplusplus
> >>  }
> >>  #endif
> >>-- 
> >>1.7.10.4
> >>
> >
> >
> 
> 


[dpdk-dev] [PATCH 2/3 v3] app/test: Fix size_t printf format issue

2015-03-06 Thread Michael Qiu
test_hash.c: In function ?test_crc32_hash_alg_equiv?:
error: format ?%lu? expects argument of type ?long unsigned int?,
but argument 2 has type ?size_t? [-Werror=format]

According to C99, for size_t type should use format "%zu"

Signed-off-by: Michael Qiu 
Acked-by: Bruce Richardson 
---
v3 --> v2:
add acked-by field 
v2 --> v1:
typo fix of "format" in commit log and title

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

diff --git a/app/test/test_hash.c b/app/test/test_hash.c
index 653dd86..c489b8b 100644
--- a/app/test/test_hash.c
+++ b/app/test/test_hash.c
@@ -226,7 +226,7 @@ test_crc32_hash_alg_equiv(void)
if (i == CRC32_ITERATIONS)
return 0;

-   printf("Failed test data (hex, %lu bytes total):\n", data_len);
+   printf("Failed test data (hex, %zu bytes total):\n", data_len);
for (j = 0; j < data_len; j++)
printf("%02X%c", ((uint8_t *)data64)[j],
((j+1) % 16 == 0 || j == data_len - 1) ? '\n' : 
' ');
-- 
1.9.3



[dpdk-dev] [PATCH v2] ixgbe: Fix vf tx issue

2015-03-06 Thread Liang, Cunming
Hi,

On 3/2/2015 8:25 PM, Ouyang Changchun wrote:
> X550 should use the correct macro to set the VFTDT and VFRDT register address.
> This patch fixes the VF TX issue for Sageville.
>
> Signed-off-by: Changchun Ouyang 
> ---
>
> Change in v2
>-- Fix one more mac type: ixgbe_mac_X550EM_x_vf.
>
>   lib/librte_pmd_ixgbe/ixgbe_rxtx.c | 8 ++--
>   1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c 
> b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
> index 3059375..9217cbe 100644
> --- a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
> +++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
> @@ -1935,7 +1935,9 @@ ixgbe_dev_tx_queue_setup(struct rte_eth_dev *dev,
>* Modification to set VFTDT for virtual function if vf is detected
>*/
>   if (hw->mac.type == ixgbe_mac_82599_vf ||
> - hw->mac.type == ixgbe_mac_X540_vf)
> + hw->mac.type == ixgbe_mac_X540_vf ||
> + hw->mac.type == ixgbe_mac_X550_vf ||
> + hw->mac.type == ixgbe_mac_X550EM_x_vf)
>   txq->tdt_reg_addr = IXGBE_PCI_REG_ADDR(hw, 
> IXGBE_VFTDT(queue_idx));
>   else
>   txq->tdt_reg_addr = IXGBE_PCI_REG_ADDR(hw, 
> IXGBE_TDT(txq->reg_idx));
> @@ -2200,7 +2202,9 @@ ixgbe_dev_rx_queue_setup(struct rte_eth_dev *dev,
>* Modified to setup VFRDT for Virtual Function
>*/
>   if (hw->mac.type == ixgbe_mac_82599_vf ||
> - hw->mac.type == ixgbe_mac_X540_vf) {
> + hw->mac.type == ixgbe_mac_X540_vf ||
> + hw->mac.type == ixgbe_mac_X550_vf ||
> + hw->mac.type == ixgbe_mac_X550EM_x_vf) {
>   rxq->rdt_reg_addr =
>   IXGBE_PCI_REG_ADDR(hw, IXGBE_VFRDT(queue_idx));
>   rxq->rdh_reg_addr =

Acked-by:Cunming Liang mailto:cunming.liang at intel.com>>



[dpdk-dev] [PATCH v3 01/10] vmxnet3: fix link state handling

2015-03-06 Thread Sanford, Robert
Hi Stephen,

Have you considered supporting LSC interrupts in vmxnet3?

--
Thanks,
Robert


>From: Stephen Hemminger 
>
>The Intel version of VMXNET3 driver does not handle link state properly.
>The VMXNET3 API returns 1 if connected and 0 if disconnected.
>Also need to return correct value to indicate state change.
>
>Signed-off-by: Stephen Hemminger 
>Acked-by: Yong Wang 
>---
> lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c | 54
>-
> 1 file changed, 39 insertions(+), 15 deletions(-)
>
>diff --git a/lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c
>b/lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c
>index 6068c60..4c882ee 100644
>--- a/lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c
>+++ b/lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c
>@@ -149,9 +149,36 @@ gpa_zone_reserve(struct rte_eth_dev *dev, uint32_t
>size,
>  *   - On success, zero.
>  *   - On failure, negative value.
>  */
>-static inline int
>-rte_vmxnet3_dev_atomic_write_link_status(struct rte_eth_dev *dev,
>-  struct rte_eth_link *link)
>+
>+static int
>+vmxnet3_dev_atomic_read_link_status(struct rte_eth_dev *dev,
>+  struct rte_eth_link *link)
>+{
>+  struct rte_eth_link *dst = link;
>+  struct rte_eth_link *src = &(dev->data->dev_link);
>+
>+  if (rte_atomic64_cmpset((uint64_t *)dst, *(uint64_t *)dst,
>+  *(uint64_t *)src) == 0)
>+  return -1;
>+
>+  return 0;
>+}
>+
>+/**
>+ * Atomically writes the link status information into global
>+ * structure rte_eth_dev.
>+ *
>+ * @param dev
>+ *   - Pointer to the structure rte_eth_dev to write to.
>+ *   - Pointer to the buffer to be saved with the link status.
>+ *
>+ * @return
>+ *   - On success, zero.
>+ *   - On failure, negative value.
>+ */
>+static int
>+vmxnet3_dev_atomic_write_link_status(struct rte_eth_dev *dev,
>+   struct rte_eth_link *link)
> {
>   struct rte_eth_link *dst = &(dev->data->dev_link);
>   struct rte_eth_link *src = link;
>@@ -384,6 +411,7 @@ vmxnet3_setup_driver_shared(struct rte_eth_dev *dev)
>   devRead->misc.driverInfo.vmxnet3RevSpt = 1;
>   devRead->misc.driverInfo.uptVerSpt = 1;
> 
>+  devRead->misc.mtu = rte_le_to_cpu_32(dev->data->mtu);
>   devRead->misc.queueDescPA  = hw->queueDescPA;
>   devRead->misc.queueDescLen = hw->queue_desc_len;
>   devRead->misc.mtu  = hw->cur_mtu;
>@@ -570,7 +598,7 @@ vmxnet3_dev_stop(struct rte_eth_dev *dev)
> 
>   /* Clear recorded link status */
>   memset(&link, 0, sizeof(link));
>-  rte_vmxnet3_dev_atomic_write_link_status(dev, &link);
>+  vmxnet3_dev_atomic_write_link_status(dev, &link);
> }
> 
> /*
>@@ -653,28 +681,24 @@ static int
> vmxnet3_dev_link_update(struct rte_eth_dev *dev, __attribute__((unused))
>int wait_to_complete)
> {
>   struct vmxnet3_hw *hw = dev->data->dev_private;
>-  struct rte_eth_link link;
>+  struct rte_eth_link old, link;
>   uint32_t ret;
> 
>+  memset(&link, 0, sizeof(link));
>+  vmxnet3_dev_atomic_read_link_status(dev, &old);
>+
>   VMXNET3_WRITE_BAR1_REG(hw, VMXNET3_REG_CMD, VMXNET3_CMD_GET_LINK);
>   ret = VMXNET3_READ_BAR1_REG(hw, VMXNET3_REG_CMD);
> 
>-  if (!ret) {
>-  PMD_INIT_LOG(ERR, "Link Status Negative : %s()", __func__);
>-  return -1;
>-  }
>-
>   if (ret & 0x1) {
>   link.link_status = 1;
>   link.link_duplex = ETH_LINK_FULL_DUPLEX;
>   link.link_speed = ETH_LINK_SPEED_1;
>-
>-  rte_vmxnet3_dev_atomic_write_link_status(dev, &link);
>-
>-  return 0;
>   }
> 
>-  return -1;
>+  vmxnet3_dev_atomic_write_link_status(dev, &link);
>+
>+  return (old.link_status == link.link_status) ? -1 : 0;
> }
> 
> /* Updating rxmode through Vmxnet3_DriverShared structure in adapter */
>-- 
>2.1.4
>



[dpdk-dev] [PATCH] librte_lpm: define tbl entry reversely for big endian

2015-03-06 Thread Bruce Richardson
On Thu, Mar 05, 2015 at 02:12:12AM +, Xuelin Shi wrote:
> Hi Bruce,
> 
> Yes, it needs to swap the fields. The bit field is first identified as the 
> uint8_t and then packed.
> 
> Thanks,
> Shi xuelin
> 
Am I right in thinking that this patch set supercedes that for
"lpm: use field access instead of type conversion" 
http://dpdk.org/dev/patchwork/patch/3132/ ?

> > -Original Message-
> > From: Bruce Richardson [mailto:bruce.richardson at intel.com]
> > Sent: Wednesday, March 04, 2015 18:48
> > To: Shi Xuelin-B29237
> > Cc: thomas.monjalon at 6wind.com; dev at dpdk.org
> > Subject: Re: [PATCH] librte_lpm: define tbl entry reversely for big
> > endian
> > 
> > On Wed, Mar 04, 2015 at 02:34:12PM +0800, xuelin.shi at freescale.com wrote:
> > > From: Xuelin Shi 
> > >
> > > This module uses type conversion between struct and int.
> > > Also truncation and comparison is used with this int.
> > > It is not safe for different endian arch.
> > >
> > > Add ifdef for big endian struct to fix this issue.
> > >
> > > Signed-off-by: Xuelin Shi 
> > > ---
> > >  lib/librte_lpm/rte_lpm.h | 19 +++
> > >  1 file changed, 19 insertions(+)
> > >
> > > diff --git a/lib/librte_lpm/rte_lpm.h b/lib/librte_lpm/rte_lpm.h index
> > > 1af150c..08a2859 100644
> > > --- a/lib/librte_lpm/rte_lpm.h
> > > +++ b/lib/librte_lpm/rte_lpm.h
> > > @@ -96,6 +96,7 @@ extern "C" {
> > >  /** Bitmask used to indicate successful lookup */
> > >  #define RTE_LPM_LOOKUP_SUCCESS  0x0100
> > >
> > > +#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
> > >  /** @internal Tbl24 entry structure. */  struct rte_lpm_tbl24_entry {
> > >   /* Stores Next hop or group index (i.e. gindex)into tbl8. */ @@
> > > -117,6 +118,24 @@ struct rte_lpm_tbl8_entry {
> > >   uint8_t valid_group :1; /**< Group validation flag. */
> > >   uint8_t depth   :6; /**< Rule depth. */
> > >  };
> > > +#else
> > > +struct rte_lpm_tbl24_entry {
> > > + uint8_t depth   :6;
> > > + uint8_t ext_entry   :1;
> > > + uint8_t valid   :1;
> > 
> > Since endianness only refers to the order of bytes within a word, do the
> > bitfields within the uint8_t really need to be swapped around too?
> > 
> > /Bruce
> 
> > 
> > > + union {
> > > + uint8_t tbl8_gindex;
> > > + uint8_t next_hop;
> > > + };
> > > +};
> > > +
> > > +struct rte_lpm_tbl8_entry {
> > > + uint8_t depth   :6;
> > > + uint8_t valid_group :1;
> > > + uint8_t valid   :1;
> > > + uint8_t next_hop;
> > > +};
> > > +#endif
> > >
> > >  /** @internal Rule structure. */
> > >  struct rte_lpm_rule {
> > > --
> > > 1.9.1
> > >


[dpdk-dev] [PATCH] librte_eal/common: Fix cast from pointer to integer of different size

2015-03-06 Thread Michael Qiu
./i686-native-linuxapp-gcc/include/rte_memcpy.h:592:23: error:
cast from pointer to integer of different size
[-Werror=pointer-to-int-cast]

  dstofss = 16 - (int)((long long)(void *)dst & 0x0F) + 16;

Type 'long long' is 64-bit in i686 platform while 'void *'
is 32-bit.

Signed-off-by: Michael Qiu 
Signed-off-by: Zhihong Wang 
---
v4 --> v3:
fix dstofss/bits to size_t in rte_memcpy()
v3 --> v2:
make dstofss and srcofs to be type size_t
casting type use uintptr_t

v2 --> v1:
Remove unnecessary casting (void *)

 lib/librte_eal/common/include/arch/x86/rte_memcpy.h | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/lib/librte_eal/common/include/arch/x86/rte_memcpy.h 
b/lib/librte_eal/common/include/arch/x86/rte_memcpy.h
index 7b2d382..6ec4434 100644
--- a/lib/librte_eal/common/include/arch/x86/rte_memcpy.h
+++ b/lib/librte_eal/common/include/arch/x86/rte_memcpy.h
@@ -196,8 +196,8 @@ static inline void *
 rte_memcpy(void *dst, const void *src, size_t n)
 {
void *ret = dst;
-   int dstofss;
-   int bits;
+   size_t dstofss;
+   size_t bits;

/**
 * Copy less than 16 bytes
@@ -271,7 +271,7 @@ COPY_BLOCK_64_BACK31:
/**
 * Make store aligned when copy size exceeds 512 bytes
 */
-   dstofss = 32 - (int)((long long)(void *)dst & 0x1F);
+   dstofss = 32 - ((uintptr_t)dst & 0x1F);
n -= dstofss;
rte_mov32((uint8_t *)dst, (const uint8_t *)src);
src = (const uint8_t *)src + dstofss;
@@ -493,8 +493,8 @@ rte_memcpy(void *dst, const void *src, size_t n)
 {
__m128i xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, xmm8;
void *ret = dst;
-   int dstofss;
-   int srcofs;
+   size_t dstofss;
+   size_t srcofs;

/**
 * Copy less than 16 bytes
@@ -589,12 +589,12 @@ COPY_BLOCK_64_BACK15:
 * unaligned copy functions require up to 15 bytes
 * backwards access.
 */
-   dstofss = 16 - (int)((long long)(void *)dst & 0x0F) + 16;
+   dstofss = 16 - ((uintptr_t)dst & 0x0F) + 16;
n -= dstofss;
rte_mov32((uint8_t *)dst, (const uint8_t *)src);
src = (const uint8_t *)src + dstofss;
dst = (uint8_t *)dst + dstofss;
-   srcofs = (int)((long long)(const void *)src & 0x0F);
+   srcofs = ((uintptr_t)src & 0x0F);

/**
 * For aligned copy
-- 
1.9.3



[dpdk-dev] [PATCH] hash: added rte_hash_clear that clears all keys

2015-03-06 Thread Bruce Richardson
On Tue, Aug 12, 2014 at 11:47:57PM +0200, Tomas Vestelind wrote:
> I added rte_hash_clear which clear the map from all previously added
> keys.
> 
This patch is now quite old and needs an update to add the new API to the
rte_hash_version.map. A unit test for the new function would also be good to
have. Otherwise patch content looks ok. Is an updated V2 planned?

Regards,
/Bruce

> Signed-off-by: Tomas Vestelind 
> ---
>  lib/librte_hash/rte_hash.c |   14 ++
>  lib/librte_hash/rte_hash.h |   10 ++
>  2 files changed, 24 insertions(+)
> 
> diff --git a/lib/librte_hash/rte_hash.c b/lib/librte_hash/rte_hash.c
> index 2108c4f..917a6c1 100644
> --- a/lib/librte_hash/rte_hash.c
> +++ b/lib/librte_hash/rte_hash.c
> @@ -507,3 +507,17 @@ rte_hash_keys(const struct rte_hash *h, void *keys)
>  
>  return found_keys;
>  }
> +
> +void
> +rte_hash_clear(const struct rte_hash *h)
> +{
> +unsigned int bucket, entry;
> +
> +/* Clear all entries by invalidating each signature */
> +for (bucket = 0; bucket < h->num_buckets; bucket++) {
> +hash_sig_t *sig = get_sig_tbl_bucket(h, bucket);
> +for (entry = 0; entry < h->bucket_entries; entry++) {
> +sig[entry] = NULL_SIGNATURE;
> +}
> +}
> +}
> diff --git a/lib/librte_hash/rte_hash.h b/lib/librte_hash/rte_hash.h
> index e0fb28f..b84137e 100644
> --- a/lib/librte_hash/rte_hash.h
> +++ b/lib/librte_hash/rte_hash.h
> @@ -318,6 +318,16 @@ rte_hash_lookup_bulk(const struct rte_hash *h, const 
> void **keys,
>   */
>  unsigned int
>  rte_hash_keys(const struct rte_hash *h, void *keys);
> +
> +/**
> + * Clear all keys. This operation is not multi-thread safe and should only be
> + * called from one thread.
> + *
> + * @param h
> + *   Hash table to clear.
> + */
> +void
> +rte_hash_clear(const struct rte_hash *h);
>  #ifdef __cplusplus
>  }
>  #endif
> -- 
> 1.7.10.4
> 



[dpdk-dev] [PATCH 1/3] BSD: Support Port Hotplug function

2015-03-06 Thread Iremonger, Bernard
> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Tetsuya Mukawa
> Sent: Wednesday, March 4, 2015 3:12 AM
> To: dev at dpdk.org
> Subject: [dpdk-dev] [PATCH 1/3] BSD: Support Port Hotplug function
> 
> This patch adds Hotplug support to BSD.
> 
> Signed-off-by: Tetsuya Mukawa 
> ---
>  lib/librte_eal/bsdapp/eal/eal_pci.c   | 169 
> +-
>  lib/librte_eal/bsdapp/eal/rte_eal_version.map |   6 +
>  lib/librte_eal/common/include/rte_pci.h   |   1 +
>  lib/librte_ether/rte_ethdev.c |   1 +
>  4 files changed, 174 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c 
> b/lib/librte_eal/bsdapp/eal/eal_pci.c
> index 9193f80..fc5a088 100644
> --- a/lib/librte_eal/bsdapp/eal/eal_pci.c
> +++ b/lib/librte_eal/bsdapp/eal/eal_pci.c
> @@ -156,6 +156,26 @@ fail:
>   return NULL;
>  }
> 
> +/* unmap a particular resource */
> +static int
> +pci_unmap_resource(void *requested_addr, size_t size) {
> + if (requested_addr == NULL)
> + return -EINVAL;
> +
> + /* Unmap the PCI memory resource of device */
> + if (munmap(requested_addr, size)) {
> + RTE_LOG(ERR, EAL, "%s(): cannot munmap(%p, 0x%lx): %s\n",
> + __func__, requested_addr, (unsigned long)size,
> + strerror(errno));
> + } else {
> + RTE_LOG(DEBUG, EAL, "  PCI memory unmapped at %p\n",
> + requested_addr);
> + return -EFAULT;
> + }
> + return 0;
> +}
> +
>  static int
>  pci_uio_map_secondary(struct rte_pci_device *dev)  { @@ -270,6 +290,76 @@
> pci_uio_map_resource(struct rte_pci_device *dev)
>   return (0);
>  }
> 
> +static int
> +pci_uio_unmap(struct uio_resource *uio_res) {
> + int ret;
> + unsigned i;
> +
> + if (uio_res == NULL)
> + return -EINVAL;
> +
> + for (i = 0; i != uio_res->nb_maps; i++) {
> + ret = pci_unmap_resource(uio_res->maps[i].addr,
> + (size_t)uio_res->maps[i].size);
> + if (ret < 0)
> + return ret;
> + }
> + return 0;
> +}
> +
> +static struct uio_resource *
> +pci_uio_find_resource(struct rte_pci_device *dev) {
> + struct uio_resource *uio_res;
> +
> + if (dev == NULL)
> + return NULL;
> +
> + TAILQ_FOREACH(uio_res, uio_res_list, next) {
> +
> + /* skip this element if it doesn't match our PCI address */
> + if (!rte_eal_compare_pci_addr(&uio_res->pci_addr, &dev->addr))
> + return uio_res;
> + }
> + return NULL;
> +}
> +
> +/* map the PCI resource of a PCI device in virtual memory */ static int
> +pci_uio_unmap_resource(struct rte_pci_device *dev) {
> + struct uio_resource *uio_res;
> +
> + if (dev == NULL)
> + return -EINVAL;
> +
> + /* find an entry for the device */
> + uio_res = pci_uio_find_resource(dev);
> + if (uio_res == NULL)
> + return -ENODEV;
> +
> + /* secondary processes - just free maps */
> + if (rte_eal_process_type() != RTE_PROC_PRIMARY)
> + return pci_uio_unmap(uio_res);
> +
> + TAILQ_REMOVE(uio_res_list, uio_res, next);
> +
> + /* unmap all resources */
> + pci_uio_unmap(uio_res);
> +
> + /* free_uio resource */
> + rte_free(uio_res);
> +
> + /* close fd if in primary process */
> + close(dev->intr_handle.fd);
> +
> + dev->intr_handle.fd = -1;
> + dev->intr_handle.type = RTE_INTR_HANDLE_UNKNOWN;
> +
> + return 0;
> +}
> +
>  /* Scan one pci sysfs entry, and fill the devices list from it. */  static 
> int  pci_scan_one(int dev_pci_fd,
> struct pci_conf *conf) @@ -307,6 +397,9 @@ pci_scan_one(int dev_pci_fd, 
> struct pci_conf *conf)
>   /* FreeBSD has no NUMA support (yet) */
>   dev->numa_node = 0;
> 
> + /* FreeBSD has only one pass through driver */
> + dev->pt_driver = RTE_PT_NIC_UIO;
> +
>  /* parse resources */
>   switch (conf->pc_hdr & PCIM_HDRTYPE) {
>   case PCIM_HDRTYPE_NORMAL:
> @@ -376,8 +469,8 @@ skipdev:
>   * Scan the content of the PCI bus, and add the devices in the devices
>   * list. Call pci_scan_one() for each pci entry found.
>   */
> -static int
> -pci_scan(void)
> +int
> +rte_eal_pci_scan(void)
>  {
>   int fd = -1;
>   unsigned dev_count = 0;
> @@ -487,6 +580,76 @@ rte_eal_pci_probe_one_driver(struct rte_pci_driver *dr, 
> struct
> rte_pci_device *d
>   return 1;
>  }
> 
> +/*
> + * If vendor/device ID match, call the devuninit() function of the
> + * driver.
> + */
> +int
> +rte_eal_pci_close_one_driver(struct rte_pci_driver *dr,
> + struct rte_pci_device *dev)
> +{
> + struct rte_pci_id *id_table;
> + int ret;
> +
> + if ((dr == NULL) || (dev == NULL))
> + return -EINVAL;
> +
> + for (id_table = dr->id_table ; id_table->vendor_id != 0; id_table++) {
> +
> +  

[dpdk-dev] [PATCH] testpmd: bond port creation did not enable bond port

2015-03-06 Thread De Lara Guarch, Pablo


> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Michal Jastrzebski
> Sent: Friday, March 06, 2015 7:39 AM
> To: dev at dpdk.org
> Subject: [dpdk-dev] [PATCH] testpmd: bond port creation did not enable
> bond port
> 
> When invoking creation of bonded device using:
> create bonded device mode socket in testpmd the bonded port was not
> enabled at the end of cmd_create_bonded_device_parsed function.
> This caused commands 'show port info' and 'show port stats' not working
> properly with bonding device. This patch fixed it.
> 
> Signed-off-by: Michal Jastrzebski 

Acked-by: Pablo de Lara 


[dpdk-dev] [PATCH] headers: typeof -> __typeof__ to unbreak C++11 code

2015-03-06 Thread Ananyev, Konstantin

Hi Simon,

> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Simon K?gstr?m
> Sent: Friday, March 06, 2015 8:28 AM
> To: dev at dpdk.org
> Subject: Re: [dpdk-dev] [PATCH] headers: typeof -> __typeof__ to unbreak 
> C++11 code
> 
> Ping? Konstantins simpler patch is fine for me, but at least one of
> these two would be very nice to have so that modern C++ code can use DPDK.
> 
> // Simon

Can you do v2 as suggested, or do you want me to do it?
Thanks
Konstantin

> 
> On 2015-03-02 08:55, Simon K?gstr?m wrote:
> > On 2015-02-27 17:24, Ananyev, Konstantin wrote:
> >> Actually, I wonder wouldn't something like the one below be sufficient?
> >>
> >> diff --git a/lib/librte_eal/common/include/rte_common.h 
> >> b/lib/librte_eal/common/
> >> index 8ac940c..1867692 100644
> >> --- a/lib/librte_eal/common/include/rte_common.h
> >> +++ b/lib/librte_eal/common/include/rte_common.h
> >> @@ -51,6 +51,15 @@ extern "C" {
> >>  #include 
> >>  #include 
> >>
> >> +#ifndef typeof
> >> +#define typeof __typeof__
> >> +#endif
> >> +
> >> +#ifndef asm
> >> +#define asm __asm__
> >> +#endif
> >
> > Yes, I've tested, and this works with g++ as well.
> >
> > // Simon
> >


[dpdk-dev] [PATCH] lib/librte_vhost: use loop instead of goto

2015-03-06 Thread Ananyev, Konstantin


> -Original Message-
> From: Xie, Huawei
> Sent: Friday, March 06, 2015 5:53 AM
> To: dev at dpdk.org
> Cc: Ananyev, Konstantin; Xie, Huawei
> Subject: [PATCH] lib/librte_vhost: use loop instead of goto
> 
> This patch reorder the code a bit to use loop instead of goto.
> Besides, remove abudant check 'fd != -1'.

Acked-by: Konstantin Ananyev 

> 
> Signed-off-by: Huawei Xie 
> ---
>  lib/librte_vhost/vhost_user/fd_man.c | 26 +++---
>  1 file changed, 11 insertions(+), 15 deletions(-)
> 
> diff --git a/lib/librte_vhost/vhost_user/fd_man.c 
> b/lib/librte_vhost/vhost_user/fd_man.c
> index a89b6fe..831c9c1 100644
> --- a/lib/librte_vhost/vhost_user/fd_man.c
> +++ b/lib/librte_vhost/vhost_user/fd_man.c
> @@ -172,23 +172,19 @@ fdset_del(struct fdset *pfdset, int fd)
>   if (pfdset == NULL || fd == -1)
>   return;
> 
> -again:
> - pthread_mutex_lock(&pfdset->fd_mutex);
> + do {
> + pthread_mutex_lock(&pfdset->fd_mutex);
> 
> - i = fdset_find_fd(pfdset, fd);
> - if (i != -1 && fd != -1) {
> - /* busy indicates r/wcb is executing! */
> - if (pfdset->fd[i].busy == 1) {
> - pthread_mutex_unlock(&pfdset->fd_mutex);
> - goto again;
> + i = fdset_find_fd(pfdset, fd);
> + if (i != -1 && pfdset->fd[i].busy == 0) {
> + /* busy indicates r/wcb is executing! */
> + pfdset->fd[i].fd = -1;
> + pfdset->fd[i].rcb = pfdset->fd[i].wcb = NULL;
> + pfdset->num--;
> + i = -1;
>   }
> -
> - pfdset->fd[i].fd = -1;
> - pfdset->fd[i].rcb = pfdset->fd[i].wcb = NULL;
> - pfdset->num--;
> - }
> -
> - pthread_mutex_unlock(&pfdset->fd_mutex);
> + pthread_mutex_unlock(&pfdset->fd_mutex);
> + } while (i != -1);
>  }
> 
>  /**
> --
> 1.8.1.4



[dpdk-dev] [PATCH] lib/librte_vhost: combine select with sleep

2015-03-06 Thread Ananyev, Konstantin


> -Original Message-
> From: Xie, Huawei
> Sent: Friday, March 06, 2015 5:52 AM
> To: dev at dpdk.org
> Cc: Ananyev, Konstantin; Xie, Huawei
> Subject: [PATCH] lib/librte_vhost: combine select with sleep
> 
> combine sleep into select when there is no file descriptors to be monitored.
> 
> Signed-off-by: Huawei Xie 

Acked-by: Konstantin Ananyev 

> ---
>  lib/librte_vhost/vhost_user/fd_man.c | 13 +++--
>  1 file changed, 7 insertions(+), 6 deletions(-)
> 
> diff --git a/lib/librte_vhost/vhost_user/fd_man.c 
> b/lib/librte_vhost/vhost_user/fd_man.c
> index 63ac4df..a89b6fe 100644
> --- a/lib/librte_vhost/vhost_user/fd_man.c
> +++ b/lib/librte_vhost/vhost_user/fd_man.c
> @@ -211,25 +211,26 @@ fdset_event_dispatch(struct fdset *pfdset)
>   void *dat;
>   int fd;
>   int remove1, remove2;
> + int ret;
> 
>   if (pfdset == NULL)
>   return;
> 
>   while (1) {
> + struct timeval tv;
> + tv.tv_sec = 1;
> + tv.tv_usec = 0;
>   FD_ZERO(&rfds);
>   FD_ZERO(&wfds);
>   pthread_mutex_lock(&pfdset->fd_mutex);
> 
>   maxfds = fdset_fill(&rfds, &wfds, pfdset);
> - if (maxfds == -1) {
> - pthread_mutex_unlock(&pfdset->fd_mutex);
> - sleep(1);
> - continue;
> - }
> 
>   pthread_mutex_unlock(&pfdset->fd_mutex);
> 
> - select(maxfds + 1, &rfds, &wfds, NULL, NULL);
> + ret = select(maxfds + 1, &rfds, &wfds, NULL, &tv);
> + if (ret <= 0)
> + continue;
> 
>   for (i = 0; i < num; i++) {
>   remove1 = remove2 = 0;
> --
> 1.8.1.4



[dpdk-dev] [PATCH] Move mk/rte.extvars.mk to mk/internal/rte.extvars.mk

2015-03-06 Thread Olivier MATZ
Hi Keith,

On 03/04/2015 06:13 PM, Keith Wiles wrote:
> Move the rte.extvars.mk to an internal directory and
> update rte.vars.mk to find the file in the new location.
> 
> Signed-off-by: Keith Wiles 
> ---
>  mk/internal/rte.extvars.mk | 81 
> ++
>  mk/rte.extvars.mk  | 81 
> --
>  mk/rte.vars.mk |  4 +--
>  3 files changed, 83 insertions(+), 83 deletions(-)
>  create mode 100644 mk/internal/rte.extvars.mk
>  delete mode 100644 mk/rte.extvars.mk
> 
> diff --git a/mk/internal/rte.extvars.mk b/mk/internal/rte.extvars.mk
> new file mode 100644
> index 000..3e5a990
> --- /dev/null
> +++ b/mk/internal/rte.extvars.mk
> @@ -0,0 +1,81 @@
> +#   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.
> +
> +#
> +# directory where sources are located
> +#
> +ifdef S
> +ifeq ("$(origin S)", "command line")
> +RTE_SRCDIR := $(abspath $(S))
> +endif
> +endif
> +RTE_SRCDIR  ?= $(CURDIR)
> +export RTE_SRCDIR
> +
> +#
> +# Makefile to call once $(RTE_OUTPUT) is created
> +#
> +ifdef M
> +ifeq ("$(origin M)", "command line")
> +RTE_EXTMK := $(abspath $(M))
> +endif
> +endif
> +RTE_EXTMK ?= $(RTE_SRCDIR)/Makefile
> +export RTE_EXTMK
> +
> +RTE_SDK_BIN := $(RTE_SDK)/$(RTE_TARGET)
> +
> +#
> +# Output files wil go in a separate directory: default output is
> +# $(RTE_SRCDIR)/build
> +# Output dir can be given as command line using "O="
> +#
> +ifdef O
> +ifeq ("$(origin O)", "command line")
> +RTE_OUTPUT := $(abspath $(O))
> +endif
> +endif
> +RTE_OUTPUT ?= $(RTE_SRCDIR)/build
> +export RTE_OUTPUT
> +
> +# if we are building an external application, include SDK
> +# configuration and include project configuration if any
> +include $(RTE_SDK_BIN)/.config
> +ifneq ($(wildcard $(RTE_OUTPUT)/.config),)
> +  include $(RTE_OUTPUT)/.config
> +endif
> +# remove double-quotes from config names
> +RTE_ARCH := $(CONFIG_RTE_ARCH:"%"=%)
> +RTE_MACHINE := $(CONFIG_RTE_MACHINE:"%"=%)
> +RTE_EXEC_ENV := $(CONFIG_RTE_EXEC_ENV:"%"=%)
> +RTE_TOOLCHAIN := $(CONFIG_RTE_TOOLCHAIN:"%"=%)
> +
> +
> diff --git a/mk/rte.extvars.mk b/mk/rte.extvars.mk
> deleted file mode 100644
> index 3e5a990..000
> --- a/mk/rte.extvars.mk
> +++ /dev/null
> @@ -1,81 +0,0 @@
> -#   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, INCLUDIN

[dpdk-dev] [PATCH] headers: typeof -> __typeof__ to unbreak C++11 code

2015-03-06 Thread Simon Kågström
Ping? Konstantins simpler patch is fine for me, but at least one of
these two would be very nice to have so that modern C++ code can use DPDK.

// Simon

On 2015-03-02 08:55, Simon K?gstr?m wrote:
> On 2015-02-27 17:24, Ananyev, Konstantin wrote:
>> Actually, I wonder wouldn't something like the one below be sufficient?
>>
>> diff --git a/lib/librte_eal/common/include/rte_common.h 
>> b/lib/librte_eal/common/
>> index 8ac940c..1867692 100644
>> --- a/lib/librte_eal/common/include/rte_common.h
>> +++ b/lib/librte_eal/common/include/rte_common.h
>> @@ -51,6 +51,15 @@ extern "C" {
>>  #include 
>>  #include 
>>
>> +#ifndef typeof
>> +#define typeof __typeof__
>> +#endif
>> +
>> +#ifndef asm
>> +#define asm __asm__
>> +#endif
> 
> Yes, I've tested, and this works with g++ as well.
> 
> // Simon
> 


[dpdk-dev] [PATCH 2/2] doc: update release note for fm10k pmd driver

2015-03-06 Thread Chen, Jing D
Hi Michael,

> -Original Message-
> From: Qiu, Michael
> Sent: Friday, March 06, 2015 4:07 PM
> To: Chen, Jing D; dev at dpdk.org
> Subject: Re: [dpdk-dev] [PATCH 2/2] doc: update release note for fm10k
> pmd driver
> 
> On 3/6/2015 2:40 PM, Chen Jing D(Mark) wrote:
> > From: "Chen Jing D(Mark)" 
> >
> > Add feature list for fm10k driver.
> >
> > Signed-off-by: Chen Jing D(Mark) 
> > ---
> >  doc/guides/rel_notes/new_features.rst |   20 
> >  1 files changed, 20 insertions(+), 0 deletions(-)
> >
> > diff --git a/doc/guides/rel_notes/new_features.rst
> b/doc/guides/rel_notes/new_features.rst
> > index 2993b1e..c08d5a8 100644
> > --- a/doc/guides/rel_notes/new_features.rst
> > +++ b/doc/guides/rel_notes/new_features.rst
> > @@ -58,4 +58,24 @@ New Features
> >
> >  *   Packet Distributor Sample Application
> >
> > +*   Poll Mode Driver - PCIE host-interface of Intel Ethernet Switch
> FM1 Series (librte_pmd_fm10k)
> > +
> > +*   Basic Rx/Tx functions for PF/VF
> > +
> > +*   Interrupt handling support for PF/VF
> > +
> > +*   Per queue start/stop functions for PF/VF
> > +
> > +*   Support Mailbox handling between PF/VF and PF/Switch Manager
> > +
> > +*   Receive Side Scaling (RSS) for PF/VF
> > +
> > +*   Scatter receive function for PF/VF
> > +
> > +*   Reta update/query for PF/VF
> > +
> > +*   VLAN filter set for PF
> > +
> > +*   Link status query for PF/VF.
> 
> Why only last has '.'? I think should be keep the same style.

Thanks for your comments. 

> 
> Thanks,
> Michael
> > +
> >  For further features supported in this release, see Chapter 3 Supported
> Features.



[dpdk-dev] [PATCH 1/2] virtio: initialize iopl when device is initialized

2015-03-06 Thread Stephen Hemminger
On Fri, 6 Mar 2015 17:33:58 +0100
David Marchand  wrote:

> Is eth_virtio_dev_init() not a better place rather than eal ?
> 
> I prefer avoiding #ifdef pmd in eal.

No virtio_dev_init is called too late, after interrupt handling
threads are spawned.

/* Launch threads, called at application init(). */
int
rte_eal_init(int argc, char **argv)
{
int i, fctret, ret;
...
if (rte_eal_intr_init() < 0)
rte_panic("Cannot init interrupt-handling thread\n");
...

if (rte_eal_dev_init() < 0)
rte_panic("Cannot init pmd devices\n"


[dpdk-dev] Not getting statistics for all queues.

2015-03-06 Thread Gonzalez Monroy, Sergio
On 05/03/2015 10:57, Alexandra Sava wrote:
> ping  :-) ? Any thoughts about this ?
>
Sorry for the delay.

I'm not able to reproduce your issue with testpmd app.
I gather that you are using your own app, have you tried to use testpmd 
to get queue stats?
If so, what command line options did you use?

Sergio
>
> Thanks,
> Alexandra
>
> On 2 March 2015 at 17:00, Alexandra Sava  > wrote:
>
> Hi,
>
> lspci command shows the following:
> /04:00.0 Ethernet controller: Intel Corporation 82599EB 10-Gigabit
> SFI/SFP+ Network Connection (rev 01)
> Subsystem: Hewlett-Packard Company Ethernet 10Gb 2-port 560SFP+
> Adapter/
>
>
> Thanks,
> Alexandra
>
> On 2 March 2015 at 11:15, Gonzalez Monroy, Sergio
>  > wrote:
>
> Hi Alexandra,
>
>
> On 02/03/2015 08:50, Alexandra Sava wrote:
>
> Hi guys,
>
> Did you have a chance to look over my question?
>
>
>
> Thanks,
> Alexandra
>
>
> On 24 February 2015 at 13:14, Alexandra Sava
>  > wrote:
>
> Hi guys,
>
> I'm trying to get statistics per queue (on rx side),
> therefore I'm
> using rte_eth_dev_set_rx_queue_stats_mapping
> function in order to map a particular queue to a stat
> index (Note: I
> have 4 rx queues with the following mapping: queue 0
> -> stat_idx 0;
> queue 1 -> stat_idx 1 , etc).
> The problem is that I only get statistics for the
> first queue (in this
> case, queue 0), the rest of them are 0. Also, the
> statistics for the first
> queue are equal to the total statistics, so
> rte_eth_stats.ipackets
> is equal to rte_eth_stats.q_ipackets[0] and
> rte_eth_stats.ibytes is
> equal to rte_eth_stats.q_ibytes[0].
>
> I'm using dpdk-1.8.0, Ubuntu 12.04, Intel x86_64
> architecture.
>
> Any idea about this issue ?
>
> What NIC are you using?
>
> Sergio
>
>
>
> Thanks,
> Alexandra
>
>
>



[dpdk-dev] [PATCH v3 1/2] testpmd: HW vlan command

2015-03-06 Thread Ouyang, Changchun
Hi Michael,

> -Original Message-
> From: Qiu, Michael
> Sent: Friday, March 6, 2015 4:23 PM
> To: Ouyang, Changchun; dev at dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v3 1/2] testpmd: HW vlan command
> 
> On 3/6/2015 4:11 PM, Ouyang Changchun wrote:
> > This patch enables testpmd user can config port hw_vlan with more fine
> granularity:
> > hw vlan filter, hw vlan strip, and hw vlan extend.
> >
> > Don't remove the original command(hw-vlan) considering that some user
> > still want to use only one command to switch on/off all 3 options.
> >
> > Signed-off-by: Changchun Ouyang 
> > Acked-by: Pablo de Lara 
> > ---
> >  app/test-pmd/cmdline.c| 36
> +---
> >  app/test-pmd/parameters.c | 18 ++
> >  2 files changed, 51 insertions(+), 3 deletions(-)
> >
> > diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index
> > 590e427..99cc307 100644
> > --- a/app/test-pmd/cmdline.c
> > +++ b/app/test-pmd/cmdline.c
> > @@ -584,7 +584,8 @@ static void cmd_help_long_parsed(void
> *parsed_result,
> > "port config all max-pkt-len (value)\n"
> > "Set the max packet length.\n\n"
> >
> > -   "port config all (crc-strip|rx-cksum|hw-vlan|drop-
> en)"
> > +   "port config all (crc-strip|rx-cksum|hw-vlan|hw-vlan-
> filter|"
> > +   "hw-vlan-strip|hw-vlan-extend|drop-en)"
> > " (on|off)\n"
> > "Set crc-strip/rx-checksum/hardware-
> vlan/drop_en"
> > " for ports.\n\n"
> > @@ -1327,6 +1328,33 @@ cmd_config_rx_mode_flag_parsed(void
> *parsed_result,
> > printf("Unknown parameter\n");
> > return;
> > }
> > +   } else if (!strcmp(res->name, "hw-vlan-filter")) {
> > +   if (!strcmp(res->value, "on"))
> > +   rx_mode.hw_vlan_filter = 1;
> > +   else if (!strcmp(res->value, "off"))
> > +   rx_mode.hw_vlan_filter = 0;
> > +   else {
> > +   printf("Unknown parameter\n");
> > +   return;
> > +   }
> > +   } else if (!strcmp(res->name, "hw-vlan-strip")) {
> > +   if (!strcmp(res->value, "on"))
> > +   rx_mode.hw_vlan_strip  = 1;
> > +   else if (!strcmp(res->value, "off"))
> > +   rx_mode.hw_vlan_strip  = 0;
> > +   else {
> > +   printf("Unknown parameter\n");
> > +   return;
> > +   }
> > +   } else if (!strcmp(res->name, "hw-vlan-extend")) {
> > +   if (!strcmp(res->value, "on"))
> > +   rx_mode.hw_vlan_extend = 1;
> > +   else if (!strcmp(res->value, "off"))
> > +   rx_mode.hw_vlan_extend = 0;
> > +   else {
> > +   printf("Unknown parameter\n");
> > +   return;
> > +   }
> > } else if (!strcmp(res->name, "drop-en")) {
> > if (!strcmp(res->value, "on"))
> > rx_drop_en = 1;
> > @@ -1355,7 +1383,8 @@ cmdline_parse_token_string_t
> cmd_config_rx_mode_flag_all =
> > TOKEN_STRING_INITIALIZER(struct cmd_config_rx_mode_flag, all,
> > "all");  cmdline_parse_token_string_t cmd_config_rx_mode_flag_name =
> > TOKEN_STRING_INITIALIZER(struct cmd_config_rx_mode_flag,
> name,
> > -   "crc-strip#rx-cksum#hw-vlan");
> > +   "crc-strip#rx-cksum#hw-vlan#"
> > +   "hw-vlan-filter#hw-vlan-strip#hw-
> vlan-extend");
> >  cmdline_parse_token_string_t cmd_config_rx_mode_flag_value =
> > TOKEN_STRING_INITIALIZER(struct cmd_config_rx_mode_flag, value,
> > "on#off");
> > @@ -1363,7 +1392,8 @@ cmdline_parse_token_string_t
> > cmd_config_rx_mode_flag_value =  cmdline_parse_inst_t
> cmd_config_rx_mode_flag = {
> > .f = cmd_config_rx_mode_flag_parsed,
> > .data = NULL,
> > -   .help_str = "port config all crc-strip|rx-cksum|hw-vlan on|off",
> > +   .help_str = "port config all crc-strip|rx-cksum|hw-vlan|"
> > +   "hw-vlan-filter|hw-vlan-strip|hw-vlan-extend on|off",
> > .tokens = {
> > (void *)&cmd_config_rx_mode_flag_port,
> > (void *)&cmd_config_rx_mode_flag_keyword,
> > diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
> > index adf3203..04dc129 100644
> > --- a/app/test-pmd/parameters.c
> > +++ b/app/test-pmd/parameters.c
> > @@ -157,6 +157,9 @@ usage(char* progname)
> > printf("  --crc-strip: enable CRC stripping by hardware.\n");
> > printf("  --enable-rx-cksum: enable rx hardware checksum
> offload.\n");
> > printf("  --disable-hw-vlan: disable hardware vlan.\n");
> > +   printf("  --disable-hw-vlan-filter: disable hardware vlan filter.\n");
> > +   printf("  --disable-hw-vlan-strip: disable hardware vlan strip.\n");
> > +   printf("  --disabl

[dpdk-dev] [PATCH] testpmd: bond port creation did not enable bond port

2015-03-06 Thread Michal Jastrzebski
When invoking creation of bonded device using:
create bonded device mode socket in testpmd the bonded port was not 
enabled at the end of cmd_create_bonded_device_parsed function.
This caused commands 'show port info' and 'show port stats' not working 
properly with bonding device. This patch fixed it. 

Signed-off-by: Michal Jastrzebski 
---
 app/test-pmd/cmdline.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index c8312be..8b0ac85 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -4050,6 +4050,7 @@ static void cmd_create_bonded_device_parsed(void 
*parsed_result,
nb_ports = rte_eth_dev_count();
reconfig(port_id, res->socket);
rte_eth_promiscuous_enable(port_id);
+   ports[port_id].enabled = 1;
}

 }
-- 
1.7.9.5



[dpdk-dev] [PATCH v3 2/2] doc: Update for new HW vlan command

2015-03-06 Thread Qiu, Michael
On 3/6/2015 4:10 PM, Ouyang Changchun wrote:
> Update the testpmd doc as there are new HW VLAN commands/options.
>
> Signed-off-by: Changchun Ouyang 
> ---

Acked-by: Michael Qiu 

>  doc/guides/testpmd_app_ug/run_app.rst   | 12 +++
>  doc/guides/testpmd_app_ug/testpmd_funcs.rst | 33 
> +
>  2 files changed, 45 insertions(+)
>
> diff --git a/doc/guides/testpmd_app_ug/run_app.rst 
> b/doc/guides/testpmd_app_ug/run_app.rst
> index 67f62d2..3898e67 100644
> --- a/doc/guides/testpmd_app_ug/run_app.rst
> +++ b/doc/guides/testpmd_app_ug/run_app.rst
> @@ -262,6 +262,18 @@ They must be separated from the EAL options, shown in 
> the previous section, with
>  
>  Disable hardware VLAN.
>  
> +*   --disable-hw-vlan-filter
> +
> +Disable hardware VLAN filter.
> +
> +*   --disable-hw-vlan-strip
> +
> +Disable hardware VLAN strip.
> +
> +*   --disable-hw-vlan-extend
> +
> +Disable hardware VLAN extend.
> +
>  *   --enable-drop-en
>  
>  Enable per-queue packet drop for packets with no descriptors.
> diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst 
> b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> index 218835a..b644626 100644
> --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> @@ -896,6 +896,39 @@ Hardware VLAN is on by default.
>  
>  The off option is equivalent to the --disable-hw-vlan command-line option.
>  
> +port config - VLAN filter
> +~
> +
> +Set hardware VLAN filter on or off for all ports:
> +
> +port config all hw-vlan-filter (on|off)
> +
> +Hardware VLAN filter is on by default.
> +
> +The off option is equivalent to the --disable-hw-vlan-filter command-line 
> option.
> +
> +port config - VLAN strip
> +
> +
> +Set hardware VLAN strip on or off for all ports:
> +
> +port config all hw-vlan-strip (on|off)
> +
> +Hardware VLAN strip is on by default.
> +
> +The off option is equivalent to the --disable-hw-vlan-strip command-line 
> option.
> +
> +port config - VLAN extend
> +~
> +
> +Set hardware VLAN extend on or off for all ports:
> +
> +port config all hw-vlan-extend (on|off)
> +
> +Hardware VLAN extend is off by default.
> +
> +The off option is equivalent to the --disable-hw-vlan-extend command-line 
> option.
> +
>  port config - Drop Packets
>  ~~
>  



[dpdk-dev] [PATCH 2/2] virtio: allow running w/o vlan filtering

2015-03-06 Thread Stephen Hemminger
On Fri, 6 Mar 2015 03:39:47 +
"Ouyang, Changchun"  wrote:

> 
> 
> > -Original Message-
> > From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Stephen
> > Hemminger
> > Sent: Friday, March 6, 2015 8:45 AM
> > To: dev at dpdk.org
> > Subject: [dpdk-dev] [PATCH 2/2] virtio: allow running w/o vlan filtering
> > 
> > Vlan filtering is an option, and not a requirement.
> > If host does not support filtering then it can be done in software.
> > 
> 
> The question is that guest only send command, no real action to do the vlan 
> filter. 
> So if both host and guest have no real action for vlan filter, who will do 
> it? 
> 
> Thanks
> Changchun
> 
> 

The virtio driver has features.
Guest can not send commands to host where feature bit not enabled.
Application can call filter_set and check if filter worked or not.

Our code already had to do MAC and VLAN validation of incoming packets
therefore if hardware can't do vlan match, there is no problem.
I would expect other applications would do the same thing.

Failing during configuration is bad. DPDK API should never force
application to play "guess the working configuration" with the device
driver or do string match on "which device is this anyway"



[dpdk-dev] [PATCH v3 1/2] testpmd: HW vlan command

2015-03-06 Thread Qiu, Michael
On 3/6/2015 4:11 PM, Ouyang Changchun wrote:
> This patch enables testpmd user can config port hw_vlan with more fine 
> granularity:
> hw vlan filter, hw vlan strip, and hw vlan extend.
>
> Don't remove the original command(hw-vlan) considering that some user still 
> want to use
> only one command to switch on/off all 3 options.
>
> Signed-off-by: Changchun Ouyang 
> Acked-by: Pablo de Lara 
> ---
>  app/test-pmd/cmdline.c| 36 +---
>  app/test-pmd/parameters.c | 18 ++
>  2 files changed, 51 insertions(+), 3 deletions(-)
>
> diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
> index 590e427..99cc307 100644
> --- a/app/test-pmd/cmdline.c
> +++ b/app/test-pmd/cmdline.c
> @@ -584,7 +584,8 @@ static void cmd_help_long_parsed(void *parsed_result,
>   "port config all max-pkt-len (value)\n"
>   "Set the max packet length.\n\n"
>  
> - "port config all (crc-strip|rx-cksum|hw-vlan|drop-en)"
> + "port config all 
> (crc-strip|rx-cksum|hw-vlan|hw-vlan-filter|"
> + "hw-vlan-strip|hw-vlan-extend|drop-en)"
>   " (on|off)\n"
>   "Set crc-strip/rx-checksum/hardware-vlan/drop_en"
>   " for ports.\n\n"
> @@ -1327,6 +1328,33 @@ cmd_config_rx_mode_flag_parsed(void *parsed_result,
>   printf("Unknown parameter\n");
>   return;
>   }
> + } else if (!strcmp(res->name, "hw-vlan-filter")) {
> + if (!strcmp(res->value, "on"))
> + rx_mode.hw_vlan_filter = 1;
> + else if (!strcmp(res->value, "off"))
> + rx_mode.hw_vlan_filter = 0;
> + else {
> + printf("Unknown parameter\n");
> + return;
> + }
> + } else if (!strcmp(res->name, "hw-vlan-strip")) {
> + if (!strcmp(res->value, "on"))
> + rx_mode.hw_vlan_strip  = 1;
> + else if (!strcmp(res->value, "off"))
> + rx_mode.hw_vlan_strip  = 0;
> + else {
> + printf("Unknown parameter\n");
> + return;
> + }
> + } else if (!strcmp(res->name, "hw-vlan-extend")) {
> + if (!strcmp(res->value, "on"))
> + rx_mode.hw_vlan_extend = 1;
> + else if (!strcmp(res->value, "off"))
> + rx_mode.hw_vlan_extend = 0;
> + else {
> + printf("Unknown parameter\n");
> + return;
> + }
>   } else if (!strcmp(res->name, "drop-en")) {
>   if (!strcmp(res->value, "on"))
>   rx_drop_en = 1;
> @@ -1355,7 +1383,8 @@ cmdline_parse_token_string_t 
> cmd_config_rx_mode_flag_all =
>   TOKEN_STRING_INITIALIZER(struct cmd_config_rx_mode_flag, all, "all");
>  cmdline_parse_token_string_t cmd_config_rx_mode_flag_name =
>   TOKEN_STRING_INITIALIZER(struct cmd_config_rx_mode_flag, name,
> - "crc-strip#rx-cksum#hw-vlan");
> + "crc-strip#rx-cksum#hw-vlan#"
> + 
> "hw-vlan-filter#hw-vlan-strip#hw-vlan-extend");
>  cmdline_parse_token_string_t cmd_config_rx_mode_flag_value =
>   TOKEN_STRING_INITIALIZER(struct cmd_config_rx_mode_flag, value,
>   "on#off");
> @@ -1363,7 +1392,8 @@ cmdline_parse_token_string_t 
> cmd_config_rx_mode_flag_value =
>  cmdline_parse_inst_t cmd_config_rx_mode_flag = {
>   .f = cmd_config_rx_mode_flag_parsed,
>   .data = NULL,
> - .help_str = "port config all crc-strip|rx-cksum|hw-vlan on|off",
> + .help_str = "port config all crc-strip|rx-cksum|hw-vlan|"
> + "hw-vlan-filter|hw-vlan-strip|hw-vlan-extend on|off",
>   .tokens = {
>   (void *)&cmd_config_rx_mode_flag_port,
>   (void *)&cmd_config_rx_mode_flag_keyword,
> diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
> index adf3203..04dc129 100644
> --- a/app/test-pmd/parameters.c
> +++ b/app/test-pmd/parameters.c
> @@ -157,6 +157,9 @@ usage(char* progname)
>   printf("  --crc-strip: enable CRC stripping by hardware.\n");
>   printf("  --enable-rx-cksum: enable rx hardware checksum offload.\n");
>   printf("  --disable-hw-vlan: disable hardware vlan.\n");
> + printf("  --disable-hw-vlan-filter: disable hardware vlan filter.\n");
> + printf("  --disable-hw-vlan-strip: disable hardware vlan strip.\n");
> + printf("  --disable-hw-vlan-extend: disable hardware vlan extend.\n");
>   printf("  --enable-drop-en: enable per queue packet drop.\n");
>   printf("  --disable-rss: disable rss.\n");
>   printf("  --port-topology=N: set port topology (N: paired (default) or "
> @@ -528,6 +531,9 @@ lau

[dpdk-dev] [PATCH 1/2] virtio: initialize iopl when device is initialized

2015-03-06 Thread Stephen Hemminger
On Fri, 6 Mar 2015 03:41:25 +
"Ouyang, Changchun"  wrote:

> 
> 
> > -Original Message-
> > From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Stephen
> > Hemminger
> > Sent: Friday, March 6, 2015 8:45 AM
> > To: dev at dpdk.org
> > Subject: [dpdk-dev] [PATCH 1/2] virtio: initialize iopl when device is 
> > initialized
> > 
> > The virtio driver needs to use in/out instructions therefore it must 
> > initialize
> > using iopl(2) system call. The problem is that virtio initialization 
> > happens very
> > early, and any application that uses daemon() or calls eal_init later in 
> > another
> > context will fail.
> > 
> > The fix is to move the iopl into rte_eal_init.
> > 
> 
> Why need move virtio specific code into rte_eal_init?
> thanks
> Changchun
> 

The issue is that virtio has no place it can do iopl() and have the IRQ thread
work. It only shows up on real code where application is daemon, not in a toy
demo or test application.

Right now:
gcc start
   rte_virtio_pmd_init
  iopl
main
daemon
fork
fork 
  Process is now child of init not original process

  rte_eal_init
 fork (pthread) for irq thread
   irq thread
(no iopl permssion)
  program start
  rte_pmd_virtio_configure


So the only place where iopl() can be done in the proper context
so that the IRQ (and other helper threads in future) have the correct
permissions is in eal_init.


[dpdk-dev] [PATCH v2 0/2]

2015-03-06 Thread Ouyang, Changchun
> -Original Message-
> From: Ouyang, Changchun
> Sent: Friday, March 6, 2015 4:00 PM
> To: dev at dpdk.org
> Cc: Butler, Siobhan A; De Lara Guarch, Pablo; Cao, Waterman; Ouyang,
> Changchun
> Subject: [PATCH v2 0/2]
> 
> This patch enables testpmd user can config port hw_vlan with more fine
> granularity:
> hw vlan filter, hw vlan strip, and hw vlan extend;
> 
> Update testpmd doc accordingly.
> 
> Changchun Ouyang (2):
>   testpmd: HW vlan command
>   doc: Update for new HW vlan command
> 
>  app/test-pmd/cmdline.c  | 36 
> ++---
>  app/test-pmd/parameters.c   | 18 +++
>  doc/guides/testpmd_app_ug/run_app.rst   | 12 ++
>  doc/guides/testpmd_app_ug/testpmd_funcs.rst | 33
> ++
>  4 files changed, 96 insertions(+), 3 deletions(-)
> 
> --
> 1.8.4.2

Self-nack it, due to missing subject.
Will send a v3 patch set.


[dpdk-dev] [PATCH 2/2] doc: update release note for fm10k pmd driver

2015-03-06 Thread Qiu, Michael
On 3/6/2015 2:40 PM, Chen Jing D(Mark) wrote:
> From: "Chen Jing D(Mark)" 
>
> Add feature list for fm10k driver.
>
> Signed-off-by: Chen Jing D(Mark) 
> ---
>  doc/guides/rel_notes/new_features.rst |   20 
>  1 files changed, 20 insertions(+), 0 deletions(-)
>
> diff --git a/doc/guides/rel_notes/new_features.rst 
> b/doc/guides/rel_notes/new_features.rst
> index 2993b1e..c08d5a8 100644
> --- a/doc/guides/rel_notes/new_features.rst
> +++ b/doc/guides/rel_notes/new_features.rst
> @@ -58,4 +58,24 @@ New Features
>  
>  *   Packet Distributor Sample Application
>  
> +*   Poll Mode Driver - PCIE host-interface of Intel Ethernet Switch FM1 
> Series (librte_pmd_fm10k)
> +
> +*   Basic Rx/Tx functions for PF/VF
> +
> +*   Interrupt handling support for PF/VF
> +
> +*   Per queue start/stop functions for PF/VF
> +
> +*   Support Mailbox handling between PF/VF and PF/Switch Manager
> +
> +*   Receive Side Scaling (RSS) for PF/VF
> +
> +*   Scatter receive function for PF/VF
> +
> +*   Reta update/query for PF/VF
> +
> +*   VLAN filter set for PF
> +
> +*   Link status query for PF/VF.

Why only last has '.'? I think should be keep the same style.

Thanks,
Michael
> +
>  For further features supported in this release, see Chapter 3 Supported 
> Features.



[dpdk-dev] [PATCH v1] doc: prog guide update for eal multi-pthread

2015-03-06 Thread Butler, Siobhan A


> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Cunming Liang
> Sent: Monday, February 16, 2015 7:34 AM
> To: dev at dpdk.org
> Subject: [dpdk-dev] [PATCH v1] doc: prog guide update for eal multi-pthread
> 
> The patch add the multi-pthread section under EAL chapter of prog_guide.
> 
> Signed-off-by: Cunming Liang 
> ---
>  doc/guides/prog_guide/env_abstraction_layer.rst | 157
> 
>  1 file changed, 157 insertions(+)
> 
> diff --git a/doc/guides/prog_guide/env_abstraction_layer.rst
> b/doc/guides/prog_guide/env_abstraction_layer.rst
> index 231e266..06bcfae 100644
> --- a/doc/guides/prog_guide/env_abstraction_layer.rst
> +++ b/doc/guides/prog_guide/env_abstraction_layer.rst
> @@ -212,4 +212,161 @@ Memory zones can be reserved with specific start
> address alignment by supplying  The alignment value should be a power of
> two and not less than the cache line size (64 bytes).
>  Memory zones can also be reserved from either 2 MB or 1 GB hugepages,
> provided that both are available on the system.
> 
> +
> +Multiple pthread
> +
> +
> +DPDK usually pin one pthread per core to avoid task switch overhead. It
> +gains performance a lot, but it's not flexible and not always efficient.
> +
> +Power management helps to improve the cpu efficient by limiting the cpu
> runtime frequency.
> +But there's more reasonable motivation to utilize the ineffective idle cycles
> under the full capability of cpu.
> +
> +By OS scheduing and cgroup, to each pthread on specified cpu, it can simply
> assign the cpu quota.
> +It gives another way to improve the cpu efficiency. But the prerequisite is 
> to
> run DPDK execution conext from multiple pthread on one core.
> +
> +For flexibility, it's also useful to allow the pthread affinity not only to 
> a cpu
> but to a cpu set.
> +
> +
> +EAL pthread and lcore Affinity
> +~~
> +
> +In terms of lcore, it stands for an EAL execution unit in the EAL pthread.
> +EAL pthread indicates all the pthreads created/managed by EAL, they
> execute the tasks issued by *remote_launch*.
> +In each EAL pthread, there's a TLS called *_lcore_id* for the unique
> identification.
> +As EAL pthreads usually 1:1 bind to the physical cpu, *_lcore_id* typically
> equals to the cpu id.
> +
> +In multiple pthread case, EAL pthread is no longer always bind to one
> specific physical cpu.
> +It may affinity to a cpuset. Then the *_lcore_id* won't always be the same
> as cpu id.
> +So there's an EAL long option '--lcores' defined to assign the cpu affinity 
> of
> lcores.
> +For a specified lcore id or id group, it allows to set the cpuset for that 
> EAL
> pthread.
> +
> +The format pattern:
> + --lcores='[@cpu_set][,[@cpu_set],...]'
> +
> +'lcore_set' and 'cpu_set' can be a single number, range or a group.
> +
> +A number is a "digit([0-9]+)"; a range is "-"; a group is
> "([,,...])".
> +
> +If not supply a '\@cpu_set', the value of 'cpu_set' uses the same value as
> 'lcore_set'.
> +
> +::
> +
> + For example, "--lcores='1,2@(5-7),(3-5)@(0,2),(0,6),7-8'" which
> means start 9 EAL thread;
> + lcore 0 runs on cpuset 0x41 (cpu 0,6);
> + lcore 1 runs on cpuset 0x2 (cpu 1);
> + lcore 2 runs on cpuset 0xe0 (cpu 5,6,7);
> + lcore 3,4,5 runs on cpuset 0x5 (cpu 0,2);
> + lcore 6 runs on cpuset 0x41 (cpu 0,6);
> + lcore 7 runs on cpuset 0x80 (cpu 7);
> + lcore 8 runs on cpuset 0x100 (cpu 8).
> +
> +By this option, for each given lcore id, the associated cpus can be assigned.
> +It's also compatible with the pattern of corelist('-l') option.
> +
> +non-EAL pthread support
> +~~~
> +
> +It allows to use DPDK execution context in any user pthread(aka. non-EAL
> pthread).
> +
> +In a non-EAL pthread, the *_lcore_id* is always LCORE_ID_ANY which
> means it's not an EAL thread along with a valid *_lcore_id*.
> +Then the libraries won't take *_lcore_id* as unique id. Instead of it,
> +some libraries use another alternative unique id(e.g. tid); some are totaly
> no impact; and some work with some limitation(e.g. timer, mempool).
> +
> +All these impacts are mentioned in :ref:`known_issue_label` section.
> +
> +Public Thread API
> +~
> +
> +There are two public API ``rte_thread_set_affinity()`` and
> ``rte_pthread_get_affinity()`` introduced for threads.
> +When they're used in any pthread context, the Thread Local Storage(TLS)
> will be set/get.
> +
> +Those TLS include *_cpuset* and *_socket_id*:
> +
> +**_cpuset* stores the cpus bitmap to which the pthread affinity.
> +
> +**_socket_id* stores the NUMA node of the cpuset. If the cpus in
> cpuset belong to different NUMA node, the *_socket_id* set to
> SOCKTE_ID_ANY.
> +
> +
> +.. _known_issue_label:
> +
> +Known Issues
> +
> +
> ++ rte_mempool
> +
> +  The rte_mempool uses a per-lcore cache inside mempool.
> +  For non-EAL pthread, ``rte_lcore_id()``

[dpdk-dev] [PATCH 3/3 v3] librte_eal/common: Fix redeclaration of enumerator ‘REG_EAX’

2015-03-06 Thread David Marchand
On Thu, Mar 5, 2015 at 2:57 PM, Michael Qiu  wrote:

> include/rte_cpuflags.h:154:2: error: redeclaration of enumerator ?REG_EAX?
> In file included from /usr/include/signal.h:358:0,
>  from /usr/include/sys/wait.h:30,
>  from /root/dpdk/app/test/test_mp_secondary.c:50:
> /usr/include/sys/ucontext.h:180:3: note: previous definition of ?REG_EAX?
> was here
>
> In i686, from REG_EAX to REG_EDX are all defined in
> /usr/include/sys/ucontext.h
>
> Rename to CPU_REG_EAX to avoid this issue.
>

Thomas,
- title must be fixed
- commit log must be fixed :CPU_REG_EAX -> RTE_REG_EAX

There is still some ambiguity in these macros names to me, but this is the
quickest fix, so :
Acked-by: David Marchand 

-- 
David Marchand


>
> Signed-off-by: Michael Qiu 
> ---
> v3 --> v2:
> Fix signed-off-by field
> v2 --> v1:
> rename CPU_REG_EAX to RTE_REG_EAX
>
>  .../common/include/arch/x86/rte_cpuflags.h | 210
> ++---
>  1 file changed, 105 insertions(+), 105 deletions(-)
>
> diff --git a/lib/librte_eal/common/include/arch/x86/rte_cpuflags.h
> b/lib/librte_eal/common/include/arch/x86/rte_cpuflags.h
> index a58dd7b..dd56553 100644
> --- a/lib/librte_eal/common/include/arch/x86/rte_cpuflags.h
> +++ b/lib/librte_eal/common/include/arch/x86/rte_cpuflags.h
> @@ -151,104 +151,104 @@ enum rte_cpu_flag_t {
>  };
>
>  enum cpu_register_t {
> -   REG_EAX = 0,
> -   REG_EBX,
> -   REG_ECX,
> -   REG_EDX,
> +   RTE_REG_EAX = 0,
> +   RTE_REG_EBX,
> +   RTE_REG_ECX,
> +   RTE_REG_EDX,
>  };
>
>  static const struct feature_entry cpu_feature_table[] = {
> -   FEAT_DEF(SSE3, 0x0001, 0, REG_ECX,  0)
> -   FEAT_DEF(PCLMULQDQ, 0x0001, 0, REG_ECX,  1)
> -   FEAT_DEF(DTES64, 0x0001, 0, REG_ECX,  2)
> -   FEAT_DEF(MONITOR, 0x0001, 0, REG_ECX,  3)
> -   FEAT_DEF(DS_CPL, 0x0001, 0, REG_ECX,  4)
> -   FEAT_DEF(VMX, 0x0001, 0, REG_ECX,  5)
> -   FEAT_DEF(SMX, 0x0001, 0, REG_ECX,  6)
> -   FEAT_DEF(EIST, 0x0001, 0, REG_ECX,  7)
> -   FEAT_DEF(TM2, 0x0001, 0, REG_ECX,  8)
> -   FEAT_DEF(SSSE3, 0x0001, 0, REG_ECX,  9)
> -   FEAT_DEF(CNXT_ID, 0x0001, 0, REG_ECX, 10)
> -   FEAT_DEF(FMA, 0x0001, 0, REG_ECX, 12)
> -   FEAT_DEF(CMPXCHG16B, 0x0001, 0, REG_ECX, 13)
> -   FEAT_DEF(XTPR, 0x0001, 0, REG_ECX, 14)
> -   FEAT_DEF(PDCM, 0x0001, 0, REG_ECX, 15)
> -   FEAT_DEF(PCID, 0x0001, 0, REG_ECX, 17)
> -   FEAT_DEF(DCA, 0x0001, 0, REG_ECX, 18)
> -   FEAT_DEF(SSE4_1, 0x0001, 0, REG_ECX, 19)
> -   FEAT_DEF(SSE4_2, 0x0001, 0, REG_ECX, 20)
> -   FEAT_DEF(X2APIC, 0x0001, 0, REG_ECX, 21)
> -   FEAT_DEF(MOVBE, 0x0001, 0, REG_ECX, 22)
> -   FEAT_DEF(POPCNT, 0x0001, 0, REG_ECX, 23)
> -   FEAT_DEF(TSC_DEADLINE, 0x0001, 0, REG_ECX, 24)
> -   FEAT_DEF(AES, 0x0001, 0, REG_ECX, 25)
> -   FEAT_DEF(XSAVE, 0x0001, 0, REG_ECX, 26)
> -   FEAT_DEF(OSXSAVE, 0x0001, 0, REG_ECX, 27)
> -   FEAT_DEF(AVX, 0x0001, 0, REG_ECX, 28)
> -   FEAT_DEF(F16C, 0x0001, 0, REG_ECX, 29)
> -   FEAT_DEF(RDRAND, 0x0001, 0, REG_ECX, 30)
> -
> -   FEAT_DEF(FPU, 0x0001, 0, REG_EDX,  0)
> -   FEAT_DEF(VME, 0x0001, 0, REG_EDX,  1)
> -   FEAT_DEF(DE, 0x0001, 0, REG_EDX,  2)
> -   FEAT_DEF(PSE, 0x0001, 0, REG_EDX,  3)
> -   FEAT_DEF(TSC, 0x0001, 0, REG_EDX,  4)
> -   FEAT_DEF(MSR, 0x0001, 0, REG_EDX,  5)
> -   FEAT_DEF(PAE, 0x0001, 0, REG_EDX,  6)
> -   FEAT_DEF(MCE, 0x0001, 0, REG_EDX,  7)
> -   FEAT_DEF(CX8, 0x0001, 0, REG_EDX,  8)
> -   FEAT_DEF(APIC, 0x0001, 0, REG_EDX,  9)
> -   FEAT_DEF(SEP, 0x0001, 0, REG_EDX, 11)
> -   FEAT_DEF(MTRR, 0x0001, 0, REG_EDX, 12)
> -   FEAT_DEF(PGE, 0x0001, 0, REG_EDX, 13)
> -   FEAT_DEF(MCA, 0x0001, 0, REG_EDX, 14)
> -   FEAT_DEF(CMOV, 0x0001, 0, REG_EDX, 15)
> -   FEAT_DEF(PAT, 0x0001, 0, REG_EDX, 16)
> -   FEAT_DEF(PSE36, 0x0001, 0, REG_EDX, 17)
> -   FEAT_DEF(PSN, 0x0001, 0, REG_EDX, 18)
> -   FEAT_DEF(CLFSH, 0x0001, 0, REG_EDX, 19)
> -   FEAT_DEF(DS, 0x0001, 0, REG_EDX, 21)
> -   FEAT_DEF(ACPI, 0x0001, 0, REG_EDX, 22)
> -   FEAT_DEF(MMX, 0x0001, 0, REG_EDX, 23)
> -   FEAT_DEF(FXSR, 0x0001, 0, REG_EDX, 24)
> -   FEAT_DEF(SSE, 0x0001, 0, REG_EDX, 25)
> -   FEAT_DEF(SSE2, 0x0001, 0, REG_EDX, 26)
> -   FEAT_DEF(SS, 0x0001, 0, REG_EDX, 27)
> -   FEAT_DEF(HTT, 0x0001, 0, REG_EDX, 28)
> -   FEAT_DEF(TM, 0x0001, 0, REG_EDX, 29)
> -   FEAT_DEF(PBE, 0x0001, 0, REG_EDX, 31)
> -
> -   FEAT_DEF(DIGTEMP, 0x0006, 0, REG_EAX,  0)
> -   FEAT_DEF(TRBOBST, 0x0006, 0, REG_EAX,  1)
> -   FEAT_DEF(ARAT, 0x0006, 0, REG_EAX,  2)
> -   FEAT_DEF(PLN, 0x0006, 0, REG_EAX,  4)
> -   FEAT_DEF(ECMD, 0x00

[dpdk-dev] [PATCH 1/2] virtio: initialize iopl when device is initialized

2015-03-06 Thread Ouyang, Changchun


> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Stephen
> Hemminger
> Sent: Friday, March 6, 2015 8:45 AM
> To: dev at dpdk.org
> Subject: [dpdk-dev] [PATCH 1/2] virtio: initialize iopl when device is 
> initialized
> 
> The virtio driver needs to use in/out instructions therefore it must 
> initialize
> using iopl(2) system call. The problem is that virtio initialization happens 
> very
> early, and any application that uses daemon() or calls eal_init later in 
> another
> context will fail.
> 
> The fix is to move the iopl into rte_eal_init.
> 

Why need move virtio specific code into rte_eal_init?
thanks
Changchun



[dpdk-dev] [PATCH 2/2] virtio: allow running w/o vlan filtering

2015-03-06 Thread Ouyang, Changchun


> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Stephen
> Hemminger
> Sent: Friday, March 6, 2015 8:45 AM
> To: dev at dpdk.org
> Subject: [dpdk-dev] [PATCH 2/2] virtio: allow running w/o vlan filtering
> 
> Vlan filtering is an option, and not a requirement.
> If host does not support filtering then it can be done in software.
> 

The question is that guest only send command, no real action to do the vlan 
filter. 
So if both host and guest have no real action for vlan filter, who will do it? 

Thanks
Changchun




[dpdk-dev] [PATCH 2/3 v2] app/test: Fix size_t printf format issue

2015-03-06 Thread Qiu, Michael
On 3/6/2015 1:28 AM, Thomas Monjalon wrote:
> 2015-03-05 22:00, Michael Qiu:
>> test_hash.c: In function ?test_crc32_hash_alg_equiv?:
>> error: format ?%lu? expects argument of type ?long unsigned int?,
>> but argument 2 has type ?size_t? [-Werror=format]
>>
>> According to C99, for size_t type should use format "%zu"
>>
>> Signed-off-by: Michael Qiu 
> You forgot to add the previous acknowledgement from Bruce.
>
>
OK, I will send out v3 to add previous acknowledgement from Bruce.

Thanks,
Michael


[dpdk-dev] [PATCH 1/3 v2] librte_hash: Fix unsupported instruction `crc32' in i686 platform

2015-03-06 Thread Qiu, Michael
On 3/6/2015 1:11 AM, Thomas Monjalon wrote:
> 2015-03-06 00:55, Michael Qiu:
>> CC rte_hash.o
>> Error: unsupported instruction `crc32'
>>
>> The root cause is that i686 platform does not support 'crc32q'
>> Need make it only available in x86_64 platform
>>
>> Signed-off-by: Michael Qiu 
>> ---
>> v2 --> v1:
>>  Make crc32 instruction only works in X86 platform
>>  lib/librte_hash/rte_hash_crc.h | 12 
>>  1 file changed, 12 insertions(+)
>>
>> diff --git a/lib/librte_hash/rte_hash_crc.h b/lib/librte_hash/rte_hash_crc.h
>> index d28bb2a..c0a789e 100644
>> --- a/lib/librte_hash/rte_hash_crc.h
>> +++ b/lib/librte_hash/rte_hash_crc.h
>> @@ -364,6 +364,7 @@ crc32c_2words(uint64_t data, uint32_t init_val)
>>  return crc;
>>  }
>>  
>> +#if defined RTE_ARCH_I686 || defined RTE_ARCH_X86_64
>>  static inline uint32_t
>>  crc32c_sse42_u32(uint32_t data, uint32_t init_val)
>>  {
>> @@ -373,7 +374,9 @@ crc32c_sse42_u32(uint32_t data, uint32_t init_val)
>>  : [data] "rm" (data));
>>  return init_val;
>>  }
>> +#endif
> Wouldn't it be more elegant to define a stub which returns 0 in #else
> in order to remove #ifdef below?
> Not sure, matter of taste.

It may be not a good idea, see rte_hash_crc_8byte(), if no crc32
support, it will use crc32c_2words(), if we define a stub which returns
0 in #else, then we need always check the return value whether it is
none-zero otherwise need fallback.

Thanks,
Michael
> [...]
>> @@ -455,8 +461,10 @@ rte_hash_crc_init_alg(void)
>>  static inline uint32_t
>>  rte_hash_crc_4byte(uint32_t data, uint32_t init_val)
>>  {
>> +#if defined RTE_ARCH_I686 || defined RTE_ARCH_X86_64
>>  if (likely(crc32_alg & CRC32_SSE42))
>>  return crc32c_sse42_u32(data, init_val);
>> +#endif
>>  
>>  return crc32c_1word(data, init_val);
>>  }
>> @@ -476,11 +484,15 @@ rte_hash_crc_4byte(uint32_t data, uint32_t init_val)
>>  static inline uint32_t
>>  rte_hash_crc_8byte(uint64_t data, uint32_t init_val)
>>  {
>> +#ifdef RTE_ARCH_X86_64
>>  if (likely(crc32_alg == CRC32_SSE42_x64))
>>  return crc32c_sse42_u64(data, init_val);
>> +#endif
>>  
>> +#if defined RTE_ARCH_I686 || defined RTE_ARCH_X86_64
>>  if (likely(crc32_alg & CRC32_SSE42))
>>  return crc32c_sse42_u64_mimic(data, init_val);
>> +#endif
>>  
>>  return crc32c_2words(data, init_val);
>>  }
>>
>
>



[dpdk-dev] [PATCH 1/3 v2] librte_hash: Fix unsupported instruction `crc32' in i686 platform

2015-03-06 Thread Michael Qiu
CC rte_hash.o
Error: unsupported instruction `crc32'

The root cause is that i686 platform does not support 'crc32q'
Need make it only available in x86_64 platform

Signed-off-by: Michael Qiu 
---
v2 --> v1:
 Make crc32 instruction only works in X86 platform
 lib/librte_hash/rte_hash_crc.h | 12 
 1 file changed, 12 insertions(+)

diff --git a/lib/librte_hash/rte_hash_crc.h b/lib/librte_hash/rte_hash_crc.h
index d28bb2a..c0a789e 100644
--- a/lib/librte_hash/rte_hash_crc.h
+++ b/lib/librte_hash/rte_hash_crc.h
@@ -364,6 +364,7 @@ crc32c_2words(uint64_t data, uint32_t init_val)
return crc;
 }

+#if defined RTE_ARCH_I686 || defined RTE_ARCH_X86_64
 static inline uint32_t
 crc32c_sse42_u32(uint32_t data, uint32_t init_val)
 {
@@ -373,7 +374,9 @@ crc32c_sse42_u32(uint32_t data, uint32_t init_val)
: [data] "rm" (data));
return init_val;
 }
+#endif

+#ifdef RTE_ARCH_X86_64
 static inline uint32_t
 crc32c_sse42_u64(uint64_t data, uint64_t init_val)
 {
@@ -383,7 +386,9 @@ crc32c_sse42_u64(uint64_t data, uint64_t init_val)
: [data] "rm" (data));
return init_val;
 }
+#endif

+#if defined RTE_ARCH_I686 || defined RTE_ARCH_X86_64
 static inline uint32_t
 crc32c_sse42_u64_mimic(uint64_t data, uint64_t init_val)
 {
@@ -397,6 +402,7 @@ crc32c_sse42_u64_mimic(uint64_t data, uint64_t init_val)
init_val = crc32c_sse42_u32(d.u32[1], init_val);
return init_val;
 }
+#endif

 #define CRC32_SW(1U << 0)
 #define CRC32_SSE42 (1U << 1)
@@ -455,8 +461,10 @@ rte_hash_crc_init_alg(void)
 static inline uint32_t
 rte_hash_crc_4byte(uint32_t data, uint32_t init_val)
 {
+#if defined RTE_ARCH_I686 || defined RTE_ARCH_X86_64
if (likely(crc32_alg & CRC32_SSE42))
return crc32c_sse42_u32(data, init_val);
+#endif

return crc32c_1word(data, init_val);
 }
@@ -476,11 +484,15 @@ rte_hash_crc_4byte(uint32_t data, uint32_t init_val)
 static inline uint32_t
 rte_hash_crc_8byte(uint64_t data, uint32_t init_val)
 {
+#ifdef RTE_ARCH_X86_64
if (likely(crc32_alg == CRC32_SSE42_x64))
return crc32c_sse42_u64(data, init_val);
+#endif

+#if defined RTE_ARCH_I686 || defined RTE_ARCH_X86_64
if (likely(crc32_alg & CRC32_SSE42))
return crc32c_sse42_u64_mimic(data, init_val);
+#endif

return crc32c_2words(data, init_val);
 }
-- 
1.9.3