[dpdk-dev] [PATCH v3] config: remove duplicate configuration information

2016-03-04 Thread Thomas Monjalon
2016-03-04 12:11, Keith Wiles:
> In order to cleanup the configuration files some and reduce
> the number of duplicate configuration information. Add a new
> file called common_base which contains just about all of the
> configuration lines in one place. Then have the common_bsdapp,
> common_linuxapp files include this one file. Then in those OS
> specific files add the delta configuration lines.
> 
> Signed-off-by: Keith Wiles 

It's also fixing the crypto settings which were mispelled for BSD.

Applied with few cosmetic adjustments, thanks.


[dpdk-dev] [PATCH] config: add missing CONFIG_RTE_ARCH_64 configurations

2016-03-04 Thread Thomas Monjalon
2016-03-04 11:03, Keith Wiles:
> Signed-off-by: Keith Wiles 
> ---
>  config/defconfig_x86_64-native-bsdapp-clang | 1 +
>  config/defconfig_x86_64-native-bsdapp-gcc   | 1 +

Until now, the generic 64-bit flag was used only for ARM or Linux,
and was not defined for BSD environment.

Fixes: d05e7115f466 ("mem: support layout of IBM Power")

Applied, thanks


[dpdk-dev] [PATCH 2/2] bnx2x: Determine rx/tx queue sizes sooner

2016-03-04 Thread Rasesh Mody
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Chas Williams
> Sent: Wednesday, December 30, 2015 4:38 PM
> 
> From: "Charles (Chas) Williams" 
> 
> The VF needs to determine the queues sizes before .dev_infos_get so that it
> can hint to the upper layer the proper sizes.  Move
> bnx2x_vf_get_resources() to .eth_dev_init and probe with the guesses from
> bnx2x_init_rte().
> 
> Signed-off-by: Chas Williams <3chas3 at gmail.com>
> ---

Acked-by: Rasesh Mody 

The change looks good.

Thanks!
Rasesh

>  drivers/net/bnx2x/bnx2x.c|  9 ++--
>  drivers/net/bnx2x/bnx2x_ethdev.c | 46 ++
> --
>  drivers/net/bnx2x/bnx2x_vfpf.c   |  2 ++
>  3 files changed, 34 insertions(+), 23 deletions(-)
> 
> diff --git a/drivers/net/bnx2x/bnx2x.c b/drivers/net/bnx2x/bnx2x.c index
> 67af5da..f003875 100644
> --- a/drivers/net/bnx2x/bnx2x.c
> +++ b/drivers/net/bnx2x/bnx2x.c
> @@ -9578,8 +9578,13 @@ static int bnx2x_pci_get_caps(struct bnx2x_softc
> *sc)
> 
>  static void bnx2x_init_rte(struct bnx2x_softc *sc)  {
> - sc->max_tx_queues = 128;
> - sc->max_rx_queues = 128;
> + if (IS_VF(sc)) {
> + sc->max_tx_queues = BNX2X_VF_MAX_QUEUES_PER_VF;
> + sc->max_rx_queues = BNX2X_VF_MAX_QUEUES_PER_VF;
> + } else {
> + sc->max_tx_queues = 128;
> + sc->max_rx_queues = 128;
> + }
>  }
> 
>  #define FW_HEADER_LEN 104
> diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c
> b/drivers/net/bnx2x/bnx2x_ethdev.c
> index 69df02e..fe8cfd0 100644
> --- a/drivers/net/bnx2x/bnx2x_ethdev.c
> +++ b/drivers/net/bnx2x/bnx2x_ethdev.c
> @@ -87,7 +87,6 @@ bnx2x_dev_configure(struct rte_eth_dev *dev)  {
>   struct bnx2x_softc *sc = dev->data->dev_private;
>   int mp_ncpus = sysconf(_SC_NPROCESSORS_CONF);
> - int ret;
> 
>   PMD_INIT_FUNC_TRACE();
> 
> @@ -121,25 +120,6 @@ bnx2x_dev_configure(struct rte_eth_dev *dev)
>   return -ENXIO;
>   }
> 
> - if (IS_VF(sc)) {
> - if (bnx2x_dma_alloc(sc, sizeof(struct bnx2x_vf_mbx_msg),
> -   >vf2pf_mbox_mapping, "vf2pf_mbox",
> -   RTE_CACHE_LINE_SIZE) != 0)
> - return -ENOMEM;
> -
> - sc->vf2pf_mbox = (struct bnx2x_vf_mbx_msg *)sc-
> >vf2pf_mbox_mapping.vaddr;
> - if (bnx2x_dma_alloc(sc, sizeof(struct bnx2x_vf_bulletin),
> -   >pf2vf_bulletin_mapping, "vf2pf_bull",
> -   RTE_CACHE_LINE_SIZE) != 0)
> - return -ENOMEM;
> -
> - sc->pf2vf_bulletin = (struct bnx2x_vf_bulletin *)sc-
> >pf2vf_bulletin_mapping.vaddr;
> -
> - ret = bnx2x_vf_get_resources(sc, sc->num_queues, sc-
> >num_queues);
> - if (ret)
> - return ret;
> - }
> -
>   return 0;
>  }
> 
> @@ -466,6 +446,7 @@ bnx2x_common_dev_init(struct rte_eth_dev
> *eth_dev, int is_vf)
>   ret = bnx2x_attach(sc);
>   if (ret) {
>   PMD_DRV_LOG(ERR, "bnx2x_attach failed (%d)", ret);
> + return ret;
>   }
> 
>   eth_dev->data->mac_addrs = (struct ether_addr *)sc-
> >link_params.mac_addr; @@ -479,7 +460,30 @@
> bnx2x_common_dev_init(struct rte_eth_dev *eth_dev, int is_vf)
>   PMD_DRV_LOG(INFO, "portID=%d vendorID=0x%x deviceID=0x%x",
>   eth_dev->data->port_id, pci_dev->id.vendor_id,
> pci_dev->id.device_id);
> 
> - return ret;
> + if (IS_VF(sc)) {
> + if (bnx2x_dma_alloc(sc, sizeof(struct bnx2x_vf_mbx_msg),
> + >vf2pf_mbox_mapping,
> "vf2pf_mbox",
> + RTE_CACHE_LINE_SIZE) != 0)
> + return -ENOMEM;
> +
> + sc->vf2pf_mbox = (struct bnx2x_vf_mbx_msg *)
> +  sc->vf2pf_mbox_mapping.vaddr;
> +
> + if (bnx2x_dma_alloc(sc, sizeof(struct bnx2x_vf_bulletin),
> + >pf2vf_bulletin_mapping,
> "vf2pf_bull",
> + RTE_CACHE_LINE_SIZE) != 0)
> + return -ENOMEM;
> +
> + sc->pf2vf_bulletin = (struct bnx2x_vf_bulletin *)
> +  sc->pf2vf_bulletin_mapping.vaddr;
> +
> + ret = bnx2x_vf_get_resources(sc, sc->max_tx_queues,
> +  sc->max_rx_queues);
> + if (ret)
> + return ret;
> + }
> +
> + return 0;
>  }
> 
>  static int
> diff --git a/drivers/net/bnx2x/bnx2x_vfpf.c
> b/drivers/net/bnx2x/bnx2x_vfpf.c index 34b6360..bce734f 100644
> --- a/drivers/net/bnx2x/bnx2x_vfpf.c
> +++ b/drivers/net/bnx2x/bnx2x_vfpf.c
> @@ -282,6 +282,8 @@ int bnx2x_vf_get_resources(struct bnx2x_softc *sc,
> uint8_t tx_count, uint8_t rx_
>   sc->igu_sb_cnt  = sc_resp.resc.num_sbs;
>   sc->igu_base_sb = sc_resp.resc.hw_sbs[0] & 0xFF;
>   sc->igu_dsb_id  = -1;
> + 

[dpdk-dev] [PATCH 1/2] bnx2x: fix error handling in bnx2x_loop_obtain_resources()

2016-03-04 Thread Rasesh Mody
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Chas Williams
> Sent: Wednesday, December 30, 2015 4:38 PM
> 
> From: "Charles (Chas) Williams" 
> 
> bnx2x_loop_obtain_resources() returns a struct containing the status and
> the error message.  If bnx2x_do_req4pf() fails, it shouldn't return both of
> these fields set to 0 indicating failure and no error.
> 
> Further, bnx2x_do_req4pf() needs to be able fail and return NO_RESOURCES
> so that bnx2x_loop_obtain_resources() can negotiate reduced resource
> requirments.  This requires additional checking around bnx2x_do_req4pf().
> 
> Signed-off-by: Chas Williams <3chas3 at gmail.com>
> ---

Acked-by: Rasesh Mody 

The change looks good.

Thanks!
Rasesh

>  drivers/net/bnx2x/bnx2x_vfpf.c | 75 +++-
> --
>  1 file changed, 33 insertions(+), 42 deletions(-)
> 
> diff --git a/drivers/net/bnx2x/bnx2x_vfpf.c
> b/drivers/net/bnx2x/bnx2x_vfpf.c index 765cc92..34b6360 100644
> --- a/drivers/net/bnx2x/bnx2x_vfpf.c
> +++ b/drivers/net/bnx2x/bnx2x_vfpf.c
> @@ -122,16 +122,10 @@ bnx2x_do_req4pf(struct bnx2x_softc *sc,
> phys_addr_t phys_addr)
>   break;
>   }
> 
> - if (i == BNX2X_VF_CHANNEL_TRIES) {
> + if (!*status) {
>   PMD_DRV_LOG(ERR, "Response from PF timed
> out");
>   return -EAGAIN;
>   }
> -
> - if (BNX2X_VF_STATUS_SUCCESS != *status) {
> - PMD_DRV_LOG(ERR, "Bad reply from PF : %u",
> - *status);
> - return -EINVAL;
> - }
>   } else {
>   PMD_DRV_LOG(ERR, "status should be zero before
> message"
>   "to pf was sent");
> @@ -193,10 +187,10 @@ struct bnx2x_obtain_status
> bnx2x_loop_obtain_resources(struct bnx2x_softc *sc)
>   do {
>   PMD_DRV_LOG(DEBUG, "trying to get resources");
> 
> - if ( bnx2x_do_req4pf(sc, sc->vf2pf_mbox_mapping.paddr) )
> {
> + if (bnx2x_do_req4pf(sc, sc->vf2pf_mbox_mapping.paddr)) {
>   /* timeout */
>   status.success = 0;
> - status.err_code = 0;
> + status.err_code = -EAGAIN;
>   return status;
>   }
> 
> @@ -310,8 +304,8 @@ void
>  bnx2x_vf_close(struct bnx2x_softc *sc)
>  {
>   struct vf_release_tlv *query;
> + struct vf_common_reply_tlv *reply =
> +>vf2pf_mbox->resp.common_reply;
>   int vf_id = bnx2x_read_vf_id(sc);
> - int ret;
> 
>   if (vf_id >= 0) {
>   query = >vf2pf_mbox->query[0].release;
> @@ -322,11 +316,9 @@ bnx2x_vf_close(struct bnx2x_softc *sc)
>   BNX2X_TLV_APPEND(query, query->first_tlv.length,
> BNX2X_VF_TLV_LIST_END,
>   sizeof(struct channel_list_end_tlv));
> 
> - ret = bnx2x_do_req4pf(sc, sc-
> >vf2pf_mbox_mapping.paddr);
> -
> - if (ret) {
> + bnx2x_do_req4pf(sc, sc->vf2pf_mbox_mapping.paddr);
> + if (reply->status != BNX2X_VF_STATUS_SUCCESS)
>   PMD_DRV_LOG(ERR, "Failed to release VF");
> - }
>   }
>  }
> 
> @@ -335,7 +327,8 @@ int
>  bnx2x_vf_init(struct bnx2x_softc *sc)
>  {
>   struct vf_init_tlv *query;
> - int i, ret;
> + struct vf_common_reply_tlv *reply = >vf2pf_mbox-
> >resp.common_reply;
> + int i;
> 
>   query = >vf2pf_mbox->query[0].init;
>   bnx2x_init_first_tlv(sc, >first_tlv, BNX2X_VF_TLV_INIT, @@
> -352,11 +345,10 @@ bnx2x_vf_init(struct bnx2x_softc *sc)
>   BNX2X_TLV_APPEND(query, query->first_tlv.length,
> BNX2X_VF_TLV_LIST_END,
>   sizeof(struct channel_list_end_tlv));
> 
> - ret = bnx2x_do_req4pf(sc, sc->vf2pf_mbox_mapping.paddr);
> -
> - if (ret) {
> + bnx2x_do_req4pf(sc, sc->vf2pf_mbox_mapping.paddr);
> + if (reply->status != BNX2X_VF_STATUS_SUCCESS) {
>   PMD_DRV_LOG(ERR, "Failed to init VF");
> - return ret;
> + return -EINVAL;
>   }
> 
>   PMD_DRV_LOG(DEBUG, "VF was initialized"); @@ -367,8 +359,9 @@
> void  bnx2x_vf_unload(struct bnx2x_softc *sc)  {
>   struct vf_close_tlv *query;
> + struct vf_common_reply_tlv *reply =
> +>vf2pf_mbox->resp.common_reply;
>   struct vf_q_op_tlv *query_op;
> - int i, vf_id, ret;
> + int i, vf_id;
> 
>   vf_id = bnx2x_read_vf_id(sc);
>   if (vf_id > 0) {
> @@ -384,10 +377,10 @@ bnx2x_vf_unload(struct bnx2x_softc *sc)
>   BNX2X_VF_TLV_LIST_END,
>   sizeof(struct channel_list_end_tlv));
> 
> - ret = bnx2x_do_req4pf(sc, sc-
> >vf2pf_mbox_mapping.paddr);
> - if (ret)
> + bnx2x_do_req4pf(sc, sc-
> >vf2pf_mbox_mapping.paddr);
> + if (reply->status != BNX2X_VF_STATUS_SUCCESS)
>  

[dpdk-dev] [PATCH] lpm: merge tbl24 and tbl8 structures

2016-03-04 Thread Jerin Jacob
On Fri, Mar 04, 2016 at 03:57:43PM +0100, Thomas Monjalon wrote:
> 2015-11-24 14:25, Bruce Richardson:
> > The tbl8 and tbl24 structures were essentially identical except for
> > slightly different names for one or two fields. Merge these two
> > structures into a single structure definition.
> > 
> > Two fields have been renamed as part of this change: the
> > "ext_entry" field in the tbl24 has been renamed to "valid_group" to match
> > the tbl8 value to make the merge easier, and the "tbl8_gindex" field has
> > been renamed to "group_idx". The "valid_group" field now serves two
> > purposes: in a tbl8 it indicates if the group, i.e. the tbl8, is valid,
> > and in a tbl24, it indicates if the "group_idx" is valid, i.e. whether
> > the value is a next_hop or a tbl8 index. [The name "group_idx" was used
> > to make this latter link between the fields clearer]
> > 
> > Suggested-by: Vladimir Medvedkin 
> > Signed-off-by: Bruce Richardson 
> 
> This patch was forgotten.
> Michal, Jerin, maybe you'll have to rebase on top of it.

I wait for Michal to send the next version. I will the v5 rebased on
Michal patch.

Jerin

> 
> Applied, thanks


[dpdk-dev] [PATCH v2 2/2] drivers/net/vmxnet3: add ethdev functions

2016-03-04 Thread Yong Wang
On 3/4/16, 7:25 AM, "Remy Horton"  wrote:


>Implements driver support for setting of MAC address.
>
>Signed-off-by: Remy Horton 

Acked-by: Yong Wang 

mac_hi is not initialized so the upper 16bits are random when calling
VMXNET3_WRITE_BAR1_REG().  The handler of the mac changing ignores
them so it should be fine.


>---
> doc/guides/rel_notes/release_16_04.rst |  4 
> drivers/net/vmxnet3/vmxnet3_ethdev.c   | 19 +++
> 2 files changed, 23 insertions(+)
>
>diff --git a/doc/guides/rel_notes/release_16_04.rst 
>b/doc/guides/rel_notes/release_16_04.rst
>index 4e0112e..39db674 100644
>--- a/doc/guides/rel_notes/release_16_04.rst
>+++ b/doc/guides/rel_notes/release_16_04.rst
>@@ -62,6 +62,10 @@ This section should contain new features added in this 
>release. Sample format:
>   Implemented driver functions for Register dumping, EEPROM dumping, and
>   setting of MAC address.
> 
>+* **vmxnet3: Added ethdev support functions.**
>+
>+  Implemented driver functionality for setting MAC address.
>+
> 
> Resolved Issues
> ---
>diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c 
>b/drivers/net/vmxnet3/vmxnet3_ethdev.c
>index c363bf6..bc83524 100644
>--- a/drivers/net/vmxnet3/vmxnet3_ethdev.c
>+++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c
>@@ -91,6 +91,8 @@ static int vmxnet3_dev_vlan_filter_set(struct rte_eth_dev 
>*dev,
> 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);
>+static void vmxnet3_mac_addr_set(struct rte_eth_dev *dev,
>+   struct ether_addr *mac_addr);
> 
> #if PROCESS_SYS_EVENTS == 1
> static void vmxnet3_process_events(struct vmxnet3_hw *);
>@@ -124,6 +126,7 @@ static const struct eth_dev_ops vmxnet3_eth_dev_ops = {
>   .rx_queue_release = vmxnet3_dev_rx_queue_release,
>   .tx_queue_setup   = vmxnet3_dev_tx_queue_setup,
>   .tx_queue_release = vmxnet3_dev_tx_queue_release,
>+  .mac_addr_set = vmxnet3_mac_addr_set,
> };
> 
> static const struct rte_memzone *
>@@ -922,6 +925,22 @@ vmxnet3_process_events(struct vmxnet3_hw *hw)
> }
> #endif
> 
>+static void vmxnet3_mac_addr_set(struct rte_eth_dev *dev,
>+   struct ether_addr *mac_addr)
>+{
>+  struct vmxnet3_hw *hw = dev->data->dev_private;
>+  uint32_t mac_hi, mac_lo;
>+
>+  if (!is_valid_assigned_ether_addr(mac_addr)) {
>+  PMD_DRV_LOG(ERR, "Tried to set invalid MAC address.");
>+  return;
>+  }
>+  memcpy(_lo, mac_addr, 4);
>+  memcpy(_hi, mac_addr + 4, 2);
>+  VMXNET3_WRITE_BAR1_REG(hw, VMXNET3_REG_MACL, mac_lo);
>+  VMXNET3_WRITE_BAR1_REG(hw, VMXNET3_REG_MACH, mac_hi);
>+}
>+
> static struct rte_driver rte_vmxnet3_driver = {
>   .type = PMD_PDEV,
>   .init = rte_vmxnet3_pmd_init,
>-- 
>2.5.0
>


[dpdk-dev] [PATCH v4] eal: add function to check if primary proc alive

2016-03-04 Thread Thomas Monjalon
I'm looking into details...

2016-02-23 14:10, Harry van Haaren:
>  EAL
>  ~~~
>  
> +* **Added rte_eal_primary_proc_alive() function**
> +
> +  A new function ``rte_eal_primary_proc_alive()`` has been added
> +  to allow the user to detect if a primary process is running.
> +  Use cases for this feature include fault detection, and monitoring
> +  using secondary processes.
>  

A space is missing here (2 lines before next title).

>  Drivers
>  ~~~
[...]
> + *   Copyright 2016 Intel Shannon Ltd. All rights reserved.

I had not noticed before. Intel Shannon Ltd is a separate entity?

[...]
> + * @return
> + *  - If alive, returns one.
> + *  - If dead, returns zero.

Why not use digits?

> + */
> +int rte_eal_primary_proc_alive(const char *config_file_path);
> +
> +

The functions are usually separated by only 1 line,
except in keepalive for an unknown reason.



[dpdk-dev] [PATCH v10 2/2] vhost: Add VHOST PMD

2016-03-04 Thread Tetsuya Mukawa
On 2016/03/04 17:39, Yuanhan Liu wrote:
> On Fri, Mar 04, 2016 at 01:17:42PM +0900, Tetsuya Mukawa wrote:
>> The patch introduces a new PMD. This PMD is implemented as thin wrapper
>> of librte_vhost. It means librte_vhost is also needed to compile the PMD.
>> The vhost messages will be handled only when a port is started. So start
>> a port first, then invoke QEMU.
>>
>> The PMD has 2 parameters.
>>  - iface:  The parameter is used to specify a path to connect to a
>>virtio-net device.
>>  - queues: The parameter is used to specify the number of the queues
>>virtio-net device has.
>>(Default: 1)
>>
>> Here is an example.
>> $ ./testpmd -c f -n 4 --vdev 'eth_vhost0,iface=/tmp/sock0,queues=1' -- -i
>>
>> To connect above testpmd, here is qemu command example.
>>
>> $ qemu-system-x86_64 \
>> 
>> -chardev socket,id=chr0,path=/tmp/sock0 \
>> -netdev vhost-user,id=net0,chardev=chr0,vhostforce,queues=1 \
>> -device virtio-net-pci,netdev=net0,mq=on
>>
>> Signed-off-by: Tetsuya Mukawa 
>> Acked-by: Ferruh Yigit 
> You should carry my Acked-by that I gave few versions before, as well
> as the Reviewed-by and Tested-by from Rich, if my memory serves me
> right. It's also a way to show respects to the reivew/test efforts
> from them.

Sure, I will submit one more patch, and will add them.

>> ---
>>  MAINTAINERS |   4 +
> Mind to add me to the MAINTAINER list as well if you send another
> version? :) If so, don't put my email address wrongly, which you
> have done many times ;-)

Thank you so much for it. And sorry I get wrong your email address.
I will add you in MAINTAINERS in next patch.

Thanks,
Tetsuya

>   --yliu



[dpdk-dev] [PATCH] eal: make hugetlb initialization more robust

2016-03-04 Thread Jianfeng Tan
This patch adds an option, --huge-trybest, to use a recover mechanism to
the case that there are not so many hugepages (declared in sysfs), which
can be used. It relys on a mem access to fault-in hugepages, and if fails
with SIGBUS, recover to previously saved stack environment with
siglongjmp().

Test example:
  a. cgcreate -g hugetlb:/test-subgroup
  b. cgset -r hugetlb.1GB.limit_in_bytes=2147483648 test-subgroup
  c. cgexec -g hugetlb:test-subgroup \
  ./examples/helloworld/build/helloworld -c 0x2 -n 4 --huge-trybest

Signed-off-by: Jianfeng Tan 
Acked-by: Neil Horman 
---
 lib/librte_eal/common/eal_common_options.c |  4 ++
 lib/librte_eal/common/eal_internal_cfg.h   |  1 +
 lib/librte_eal/common/eal_options.h|  2 +
 lib/librte_eal/linuxapp/eal/eal.c  |  1 +
 lib/librte_eal/linuxapp/eal/eal_memory.c   | 95 +++---
 5 files changed, 95 insertions(+), 8 deletions(-)

diff --git a/lib/librte_eal/common/eal_common_options.c 
b/lib/librte_eal/common/eal_common_options.c
index 29942ea..8ff6a2e 100644
--- a/lib/librte_eal/common/eal_common_options.c
+++ b/lib/librte_eal/common/eal_common_options.c
@@ -95,6 +95,7 @@ eal_long_options[] = {
{OPT_VFIO_INTR, 1, NULL, OPT_VFIO_INTR_NUM},
{OPT_VMWARE_TSC_MAP,0, NULL, OPT_VMWARE_TSC_MAP_NUM   },
{OPT_XEN_DOM0,  0, NULL, OPT_XEN_DOM0_NUM },
+   {OPT_HUGE_TRYBEST,  0, NULL, OPT_HUGE_TRYBEST_NUM },
{0, 0, NULL, 0}
 };

@@ -896,6 +897,9 @@ eal_parse_common_option(int opt, const char *optarg,
return -1;
}
break;
+   case OPT_HUGE_TRYBEST_NUM:
+   internal_config.huge_trybest = 1;
+   break;

/* don't know what to do, leave this to caller */
default:
diff --git a/lib/librte_eal/common/eal_internal_cfg.h 
b/lib/librte_eal/common/eal_internal_cfg.h
index 5f1367e..90a3533 100644
--- a/lib/librte_eal/common/eal_internal_cfg.h
+++ b/lib/librte_eal/common/eal_internal_cfg.h
@@ -64,6 +64,7 @@ struct internal_config {
volatile unsigned force_nchannel; /**< force number of channels */
volatile unsigned force_nrank;/**< force number of ranks */
volatile unsigned no_hugetlbfs;   /**< true to disable hugetlbfs */
+   volatile unsigned huge_trybest;   /**< try best to allocate hugepages */
unsigned hugepage_unlink; /**< true to unlink backing files */
volatile unsigned xen_dom0_support; /**< support app running on Xen 
Dom0*/
volatile unsigned no_pci; /**< true to disable PCI */
diff --git a/lib/librte_eal/common/eal_options.h 
b/lib/librte_eal/common/eal_options.h
index a881c62..02397c5 100644
--- a/lib/librte_eal/common/eal_options.h
+++ b/lib/librte_eal/common/eal_options.h
@@ -83,6 +83,8 @@ enum {
OPT_VMWARE_TSC_MAP_NUM,
 #define OPT_XEN_DOM0  "xen-dom0"
OPT_XEN_DOM0_NUM,
+#define OPT_HUGE_TRYBEST  "huge-trybest"
+   OPT_HUGE_TRYBEST_NUM,
OPT_LONG_MAX_NUM
 };

diff --git a/lib/librte_eal/linuxapp/eal/eal.c 
b/lib/librte_eal/linuxapp/eal/eal.c
index ceac435..3e23877 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -343,6 +343,7 @@ eal_usage(const char *prgname)
   "  --"OPT_CREATE_UIO_DEV"Create /dev/uioX (usually done by 
hotplug)\n"
   "  --"OPT_VFIO_INTR" Interrupt mode for VFIO 
(legacy|msi|msix)\n"
   "  --"OPT_XEN_DOM0"  Support running on Xen dom0 without 
hugetlbfs\n"
+  "  --"OPT_HUGE_TRYBEST"  Try best to accommodate hugepages\n"
   "\n");
/* Allow the application to print its usage message too if hook is set 
*/
if ( rte_application_usage_hook ) {
diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c 
b/lib/librte_eal/linuxapp/eal/eal_memory.c
index 5b9132c..1766d7f 100644
--- a/lib/librte_eal/linuxapp/eal/eal_memory.c
+++ b/lib/librte_eal/linuxapp/eal/eal_memory.c
@@ -80,6 +80,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 

 #include 
 #include 
@@ -309,6 +311,12 @@ get_virtual_area(size_t *size, size_t hugepage_sz)
return addr;
 }

+static sigjmp_buf jmpenv;
+
+static void sigbus_handler(int signo __rte_unused)
+{
+   siglongjmp(jmpenv, 1);
+}
 /*
  * Mmap all hugepages of hugepage table: it first open a file in
  * hugetlbfs, then mmap() hugepage_sz data in it. If orig is set, the
@@ -396,7 +404,7 @@ map_all_hugepages(struct hugepage_file *hugepg_tbl,
if (fd < 0) {
RTE_LOG(ERR, EAL, "%s(): open failed: %s\n", __func__,
strerror(errno));
-   return -1;
+   return i;
}

/* map the segment, and populate page tables,
@@ -407,7 +415,7 @@ map_all_hugepages(struct hugepage_file 

[dpdk-dev] [PATCH v3 5/6] virtio: Add support for qtest virtio-net PMD

2016-03-04 Thread Tetsuya Mukawa
On 2016/03/04 15:10, Tan, Jianfeng wrote:
> Hi Tetsuya,
>
> On 3/4/2016 1:05 PM, Tetsuya Mukawa wrote:
>> On 2016/03/04 11:18, Tan, Jianfeng wrote:
>>> Hi Tetsuya,
>>>
>>> Seems that this patch is too long. Is it possible to split into
>>> multiple commits?
>> Hi Jianfeng,
>>
>> Sure, will do.
>>
>>> On 2/22/2016 4:17 PM, Tetsuya Mukawa wrote:
 The patch adds a new virtio-net PMD configuration that allows the
 PMD to
 work on host as if the PMD is in VM.
 Here is new configuration for virtio-net PMD.
- CONFIG_RTE_VIRTIO_VDEV_QTEST
 To use this mode, EAL needs map all hugepages as one file. Also the
 file
 should be mapped between (1 << 31) and (1 << 44). And start address
 should be aligned by EAL memory size.

 To allocate like above, use below options.
--single-file
--range-virtaddr=0x8000-0x1000
--align-memsize
 If a free regions isn't found, EAL will return error.

 To prepare virtio-net device on host, the users need to invoke QEMU
 process in special qtest mode. This mode is mainly used for testing
 QEMU
 devices from outer process. In this mode, no guest runs.
 Here is QEMU command line.

$ qemu-system-x86_64 \
-machine pc-i440fx-1.4,accel=qtest \
-display none -qtest-log /dev/null \
-qtest unix:/tmp/socket,server \
-netdev type=tap,script=/etc/qemu-ifup,id=net0,queues=1 \
-device
 virtio-net-pci,netdev=net0,mq=on,disable-modern=false,addr=3 \
-chardev socket,id=chr1,path=/tmp/ivshmem,server \
-device ivshmem,size=1G,chardev=chr1,vectors=1,addr=4

* Should use qemu-2.5.1, or above.
* QEMU process is needed per port.
* virtio-1.0 device are only supported.
* The vhost backends like vhost-net and vhost-user can be
 specified.
* In most cases, just using above command is enough, but you can
 also
  specify other QEMU virtio-net options.
* Only checked "pc-i440fx-1.4" machine, but may work with other
  machines.
* Should not add "--enable-kvm" to QEMU command line.
>>> Correct me if wrong: all control msgs go through qemu process, e.g.,
>>> tx notifications and rx interrupts need follow frontend-qemu-backend
>>> path. Question: qemu is started without --enable-kvm, as I understand,
>>> ioeventfd, the basis of kickfd/callfd, will not be available. So how
>>> does qemu kick backend or be kicked by backend?
>> Actually, vhost-backend process will receive kickfd and callfd as -1.
>> (Currently, we have a bug in librte_vhost, because the library treats -1
>> as "not initialized state". But actually without "--enable-kvm", -1 will
>> be set by qemu to initialize kickfd and callfd. I will send a patch for
>> the issue with next patch series.)
>
> Yes, we noticed the problem too: librte_vhost judges virtio_is_ready
> by whether both fds are set. But except that, what's kernel's way to
> do the judgement? In addition, it would be better to be a independent
> fix patch.
>

Even if fd is -1, "VHOST_SET_VRING_KICK/CALL" will be issued.
So we can know correct timing.

I have tested current QEMU, and reviewed kernel code to know how kernel
treats it.
And I've fount below.

 - vhost-user backend case.
 "-1" will be set as kickfd and callfd.
 - kernel vhost-net backend case.
 Actually eventfd will be set as kickfd and callfd.

So if backend is vhost-net, vhost-net will use eventfd.

>>
>> In our case, virtio-net driver and vhost-backend driver are PMD. So we
>> don't use kickfd and callfd, right?
>>
>> If you worried about vhost-net case, vhost-net kernel thread will work
>> without ioeventfd and irqfd.
>> In this case, virtio-net PMD can kick the vhost-net by accessing
>> VIRTIO_PCI_QUEUE_NOTIFY register.
>> (vhost-net doesn't need to kick virtio-net driver, because the driver is
>> PMD.)
>
> I ask this question because I think interrupt mode will help the
> scalability. Return to your solution, by accessing
> VIRTIO_PCI_QUEUE_NOTIFY register, virtio-net PMD can only wake up
> qemu, but how does qemu wakes up vhost-net under the case that kickfd
> = callfd = -1.
>

Answer is above.
It seems QEMU will set eventfd for vhost-net case.
Only with vhost-user backend case, QEMU sends "-1" as kickfd and callfd.

 After invoking QEMU, the PMD can connect to QEMU process using unix
 domain sockets. Over these sockets, virtio-net, ivshmem and piix3
 device in QEMU are probed by the PMD.
 Here is example of command line.

$ testpmd -c f -n 1 -m 1024 --no-pci --single-file \
 --range-virtaddr=0x8000-0x1000 --align-memsize \
   
 --vdev="eth_qtest_virtio0,qtest=/tmp/socket,ivshmem=/tmp/ivshmem"\
 -- --disable-hw-vlan --txqflags=0xf00 -i

 Please specify same unix domain sockets and memory size in both QEMU
 and DPDK command lines like above.
 The 

[dpdk-dev] [PATCH v5 0/2] cryptodev API changes

2016-03-04 Thread Thomas Monjalon
2016-03-04 17:43, Trahe, Fiona:
> From: Thomas Monjalon [mailto:thomas.monjalon at 6wind.com]
> > 2016-03-04 17:17, Fiona Trahe:
> > > This patch set separates the symmetric crypto operations from generic
> > operations and then modifies the cryptodev burst API to accept bursts of
> > rte_crypto_op rather than rte_mbufs.
> > >
> > > V5:
> > > - updates .map file
> > > - removes EXPERIMENTAL label from rte_cryptodev.h
> > 
> > Why do you want to remove the experimental label?
> 
> Declan had already removed from the MAINTAINERS file and other places in 
> previous  patches. 
> This one was just forgotten as far as we know, though as Declan is out we 
> can't confirm with him. 
> Do you think we should keep the label ?

I cannot really decide because it's hard to understand the improvements in
a such big patch. It would be easier if the changes were split in several
steps.
Maybe the last step (last patch) would be to remove the flag. Having it in
a separate patch would give the opportunity to detail the reason of the
removal in the commit message.


[dpdk-dev] [PATCH v5 0/2] cryptodev API changes

2016-03-04 Thread Thomas Monjalon
2016-03-04 17:17, Fiona Trahe:
> This patch set separates the symmetric crypto operations from generic 
> operations and then modifies the cryptodev burst API to accept bursts of 
> rte_crypto_op rather than rte_mbufs.
> 
> V5:
> - updates .map file
> - removes EXPERIMENTAL label from rte_cryptodev.h

Why do you want to remove the experimental label?



[dpdk-dev] [PATCH v6 2/2] cryptodev: change burst API to be crypto op oriented

2016-03-04 Thread Fiona Trahe
This patch modifies the crypto burst enqueue/dequeue APIs to operate on bursts
rte_crypto_op's rather than the current implementation which operates on
rte_mbuf bursts, this simplifies the burst processing in the crypto PMDs and the
use of crypto operations in general.

The changes also continues the separatation of the symmetric operation 
parameters
from the more general operation parameters, this will simplify the integration 
of
asymmetric crypto operations in the future.

As well as the changes to the crypto APIs this patch adds functions for managing
rte_crypto_op pools to the cryptodev API. It modifies the existing PMDs, unit
tests and sample application to work with the modified APIs and finally
removes the now unused rte_mbuf_offload library.

Signed-off-by: Declan Doherty 
Signed-off-by: Fiona Trahe 
---
 MAINTAINERS|   4 -
 app/test/test_cryptodev.c  | 804 +++--
 app/test/test_cryptodev.h  |   9 +-
 app/test/test_cryptodev_perf.c | 253 +++
 config/common_bsdapp   |   9 +-
 config/common_linuxapp |   9 +-
 doc/api/doxy-api-index.md  |   1 -
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 171 +++--
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c |  12 +-
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h |   2 +-
 drivers/crypto/qat/qat_crypto.c| 123 ++--
 drivers/crypto/qat/qat_crypto.h|  12 +-
 drivers/crypto/qat/rte_qat_cryptodev.c |   4 +-
 examples/l2fwd-crypto/main.c   | 283 
 lib/Makefile   |   1 -
 lib/librte_cryptodev/rte_crypto.h  | 364 +-
 lib/librte_cryptodev/rte_crypto_sym.h  | 379 +-
 lib/librte_cryptodev/rte_cryptodev.c   |  76 ++
 lib/librte_cryptodev/rte_cryptodev.h   | 115 ++-
 lib/librte_cryptodev/rte_cryptodev_version.map |   5 +-
 lib/librte_mbuf/rte_mbuf.h |   6 -
 lib/librte_mbuf_offload/Makefile   |  52 --
 lib/librte_mbuf_offload/rte_mbuf_offload.c | 100 ---
 lib/librte_mbuf_offload/rte_mbuf_offload.h | 310 
 .../rte_mbuf_offload_version.map   |   7 -
 25 files changed, 1579 insertions(+), 1532 deletions(-)
 delete mode 100644 lib/librte_mbuf_offload/Makefile
 delete mode 100644 lib/librte_mbuf_offload/rte_mbuf_offload.c
 delete mode 100644 lib/librte_mbuf_offload/rte_mbuf_offload.h
 delete mode 100644 lib/librte_mbuf_offload/rte_mbuf_offload_version.map

diff --git a/MAINTAINERS b/MAINTAINERS
index 628bc05..8d84dda 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -222,10 +222,6 @@ F: lib/librte_mbuf/
 F: doc/guides/prog_guide/mbuf_lib.rst
 F: app/test/test_mbuf.c

-Packet buffer offload - EXPERIMENTAL
-M: Declan Doherty 
-F: lib/librte_mbuf_offload/
-
 Ethernet API
 M: Thomas Monjalon 
 F: lib/librte_ether/
diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index 951b443..208fc14 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -35,7 +35,6 @@
 #include 
 #include 
 #include 
-#include 

 #include 
 #include 
@@ -48,7 +47,7 @@ static enum rte_cryptodev_type gbl_cryptodev_type;

 struct crypto_testsuite_params {
struct rte_mempool *mbuf_pool;
-   struct rte_mempool *mbuf_ol_pool;
+   struct rte_mempool *op_mpool;
struct rte_cryptodev_config conf;
struct rte_cryptodev_qp_conf qp_conf;

@@ -62,8 +61,7 @@ struct crypto_unittest_params {

struct rte_cryptodev_sym_session *sess;

-   struct rte_mbuf_offload *ol;
-   struct rte_crypto_sym_op *op;
+   struct rte_crypto_op *op;

struct rte_mbuf *obuf, *ibuf;

@@ -104,7 +102,7 @@ setup_test_string(struct rte_mempool *mpool,
return m;
 }

-#if HEX_DUMP
+#ifdef HEX_DUMP
 static void
 hexdump_mbuf_data(FILE *f, const char *title, struct rte_mbuf *m)
 {
@@ -112,27 +110,29 @@ hexdump_mbuf_data(FILE *f, const char *title, struct 
rte_mbuf *m)
 }
 #endif

-static struct rte_mbuf *
-process_crypto_request(uint8_t dev_id, struct rte_mbuf *ibuf)
+static struct rte_crypto_op *
+process_crypto_request(uint8_t dev_id, struct rte_crypto_op *op)
 {
-   struct rte_mbuf *obuf = NULL;
-#if HEX_DUMP
+#ifdef HEX_DUMP
hexdump_mbuf_data(stdout, "Enqueued Packet", ibuf);
 #endif

-   if (rte_cryptodev_enqueue_burst(dev_id, 0, , 1) != 1) {
+   if (rte_cryptodev_enqueue_burst(dev_id, 0, , 1) != 1) {
printf("Error sending packet for encryption");
return NULL;
}
-   while (rte_cryptodev_dequeue_burst(dev_id, 0, , 1) == 0)
+
+   op = NULL;
+
+   while (rte_cryptodev_dequeue_burst(dev_id, 0, , 1) == 0)
rte_pause();

-#if HEX_DUMP
+#ifdef HEX_DUMP
if (obuf)

[dpdk-dev] [PATCH v6 1/2] cryptodev: API tidy and changes to support future extensions

2016-03-04 Thread Fiona Trahe
This patch splits symmetric specific definitions and
 functions away from the common crypto APIs to facilitate the future extension
 and expansion of the cryptodev framework, in order to allow  asymmetric
 crypto operations to be introduced at a later date, as well as to clean the
 logical structure of the public includes. The patch also introduces the _sym
 prefix to symmetric specific structure and functions to improve clarity in
 the API.

Signed-off-by: Fiona Trahe 
---
 app/test/test_cryptodev.c  | 164 +++---
 app/test/test_cryptodev_perf.c |  79 +--
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c |  44 +-
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c |   6 +-
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h |   4 +-
 drivers/crypto/qat/qat_crypto.c|  51 +-
 drivers/crypto/qat/qat_crypto.h|  10 +-
 drivers/crypto/qat/rte_qat_cryptodev.c |   8 +-
 examples/l2fwd-crypto/main.c   |  33 +-
 lib/librte_cryptodev/Makefile  |   1 +
 lib/librte_cryptodev/rte_crypto.h  | 563 +--
 lib/librte_cryptodev/rte_crypto_sym.h  | 613 +
 lib/librte_cryptodev/rte_cryptodev.c   |  39 +-
 lib/librte_cryptodev/rte_cryptodev.h   |  80 ++-
 lib/librte_cryptodev/rte_cryptodev_pmd.h   |  32 +-
 lib/librte_cryptodev/rte_cryptodev_version.map |   6 +-
 lib/librte_mbuf_offload/rte_mbuf_offload.h |  22 +-
 17 files changed, 915 insertions(+), 840 deletions(-)
 create mode 100644 lib/librte_cryptodev/rte_crypto_sym.h

diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index 62f8fb0..951b443 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -1,7 +1,7 @@
 /*-
  *   BSD LICENSE
  *
- *   Copyright(c) 2015 Intel Corporation. All rights reserved.
+ *   Copyright(c) 2015-2016 Intel Corporation. All rights reserved.
  *
  *   Redistribution and use in source and binary forms, with or without
  *   modification, are permitted provided that the following conditions
@@ -57,13 +57,13 @@ struct crypto_testsuite_params {
 };

 struct crypto_unittest_params {
-   struct rte_crypto_xform cipher_xform;
-   struct rte_crypto_xform auth_xform;
+   struct rte_crypto_sym_xform cipher_xform;
+   struct rte_crypto_sym_xform auth_xform;

-   struct rte_cryptodev_session *sess;
+   struct rte_cryptodev_sym_session *sess;

struct rte_mbuf_offload *ol;
-   struct rte_crypto_op *op;
+   struct rte_crypto_sym_op *op;

struct rte_mbuf *obuf, *ibuf;

@@ -78,7 +78,7 @@ test_AES_CBC_HMAC_SHA512_decrypt_create_session_params(
struct crypto_unittest_params *ut_params);

 static int
-test_AES_CBC_HMAC_SHA512_decrypt_perform(struct rte_cryptodev_session *sess,
+test_AES_CBC_HMAC_SHA512_decrypt_perform(struct rte_cryptodev_sym_session 
*sess,
struct crypto_unittest_params *ut_params,
struct crypto_testsuite_params *ts_param);

@@ -165,7 +165,8 @@ testsuite_setup(void)
ts_params->mbuf_ol_pool = rte_pktmbuf_offload_pool_create(
"MBUF_OFFLOAD_POOL",
NUM_MBUFS, MBUF_CACHE_SIZE,
-   DEFAULT_NUM_XFORMS * sizeof(struct rte_crypto_xform),
+   DEFAULT_NUM_XFORMS *
+   sizeof(struct rte_crypto_sym_xform),
rte_socket_id());
if (ts_params->mbuf_ol_pool == NULL) {
RTE_LOG(ERR, USER1, "Can't create CRYPTO_OP_POOL\n");
@@ -220,7 +221,7 @@ testsuite_setup(void)

ts_params->conf.nb_queue_pairs = info.max_nb_queue_pairs;
ts_params->conf.socket_id = SOCKET_ID_ANY;
-   ts_params->conf.session_mp.nb_objs = info.max_nb_sessions;
+   ts_params->conf.session_mp.nb_objs = info.sym.max_nb_sessions;

TEST_ASSERT_SUCCESS(rte_cryptodev_configure(dev_id,
_params->conf),
@@ -275,7 +276,7 @@ ut_setup(void)
ts_params->conf.nb_queue_pairs = DEFAULT_NUM_QPS_PER_QAT_DEVICE;
ts_params->conf.socket_id = SOCKET_ID_ANY;
ts_params->conf.session_mp.nb_objs =
-   (gbl_cryptodev_type == RTE_CRYPTODEV_QAT_PMD) ?
+   (gbl_cryptodev_type == RTE_CRYPTODEV_QAT_SYM_PMD) ?
DEFAULT_NUM_OPS_INFLIGHT :
DEFAULT_NUM_OPS_INFLIGHT;

@@ -319,7 +320,7 @@ ut_teardown(void)

/* free crypto session structure */
if (ut_params->sess) {
-   rte_cryptodev_session_free(ts_params->valid_devs[0],
+   rte_cryptodev_sym_session_free(ts_params->valid_devs[0],
ut_params->sess);
ut_params->sess = NULL;
}
@@ -464,7 +465,7 @@ 

[dpdk-dev] [PATCH v6 0/2] cryptodev API changes

2016-03-04 Thread Fiona Trahe
This patch set separates the symmetric crypto operations from generic 
operations and then modifies the cryptodev burst API to accept bursts of 
rte_crypto_op rather than rte_mbufs.

v6:
- restore EXPERIMENTAL label to cryptodev. Will handle removal in separate 
thread.
(email subject was incorrect in v5, so v5 hasn't arrived in patchwork, 
therefore v6 is in-reply-to v4 message id)

V5: 
- updates .map file
- removes EXPERIMENTAL label from rte_cryptodev.h

V4:
- Fixes for issues introduced in __rte_crypto_op_raw_bulk_alloc in V3 patcheset.
- Typo fix in cached attribute on rte_crypto_op structure.

V3:
 - Addresses V2 comments
 - Rebased for head


Declan Doherty (1):
  cryptodev: change burst API to be crypto op oriented

Fiona Trahe (1):
  cryptodev: API tidy and changes to support future extensions


 MAINTAINERS|   4 -
 app/test/test_cryptodev.c  | 894 +++--
 app/test/test_cryptodev.h  |   9 +-
 app/test/test_cryptodev_perf.c | 270 ---
 config/common_bsdapp   |   9 +-
 config/common_linuxapp |   9 +-
 doc/api/doxy-api-index.md  |   1 -
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 199 ++---
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c |  18 +-
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h |   6 +-
 drivers/crypto/qat/qat_crypto.c| 150 ++--
 drivers/crypto/qat/qat_crypto.h|  14 +-
 drivers/crypto/qat/rte_qat_cryptodev.c |   8 +-
 examples/l2fwd-crypto/main.c   | 300 ---
 lib/Makefile   |   1 -
 lib/librte_cryptodev/Makefile  |   1 +
 lib/librte_cryptodev/rte_crypto.h  | 819 +++
 lib/librte_cryptodev/rte_crypto_sym.h  | 642 +++
 lib/librte_cryptodev/rte_cryptodev.c   | 115 ++-
 lib/librte_cryptodev/rte_cryptodev.h   | 191 ++---
 lib/librte_cryptodev/rte_cryptodev_pmd.h   |  32 +-
 lib/librte_cryptodev/rte_cryptodev_version.map |   7 +-
 lib/librte_mbuf/rte_mbuf.h |   6 -
 lib/librte_mbuf_offload/Makefile   |  52 --
 lib/librte_mbuf_offload/rte_mbuf_offload.c | 100 ---
 lib/librte_mbuf_offload/rte_mbuf_offload.h | 310 ---
 .../rte_mbuf_offload_version.map   |   7 -
 27 files changed, 2148 insertions(+), 2026 deletions(-)
 create mode 100644 lib/librte_cryptodev/rte_crypto_sym.h
 delete mode 100644 lib/librte_mbuf_offload/Makefile
 delete mode 100644 lib/librte_mbuf_offload/rte_mbuf_offload.c
 delete mode 100644 lib/librte_mbuf_offload/rte_mbuf_offload.h
 delete mode 100644 lib/librte_mbuf_offload/rte_mbuf_offload_version.map

-- 
2.1.0



[dpdk-dev] [PATCH v2] config: remove duplicate configuration information

2016-03-04 Thread Thomas Monjalon
2016-03-04 11:01, Keith Wiles:
> +#
> +# Combine to one single library
> +#
> +CONFIG_RTE_BUILD_COMBINE_LIBS=n

It has been removed.


[dpdk-dev] [PATCH v2] config: remove duplicate configuration information

2016-03-04 Thread Wiles, Keith
>2016-03-04 11:01, Keith Wiles:
>> +#
>> +# Combine to one single library
>> +#
>> +CONFIG_RTE_BUILD_COMBINE_LIBS=n
>
>It has been removed.
>

OK, Will send a new patch. Not sure how I missed it in the diffs :-(

Regards,
Keith






[dpdk-dev] [PATCH] eal: add option --avail-cores to detect lcores

2016-03-04 Thread Jianfeng Tan
This patch adds option, --avail-cores, to use lcores which are available
by calling pthread_getaffinity_np() to narrow down detected cores before
parsing coremask (-c), corelist (-l), and coremap (--lcores).

Test example:
$ taskset 0xc ./examples/helloworld/build/helloworld \
--avail-cores -m 1024

Signed-off-by: Jianfeng Tan 
Acked-by: Neil Horman 
---
 lib/librte_eal/common/eal_common_options.c | 52 ++
 lib/librte_eal/common/eal_options.h|  2 ++
 2 files changed, 54 insertions(+)

diff --git a/lib/librte_eal/common/eal_common_options.c 
b/lib/librte_eal/common/eal_common_options.c
index 29942ea..dc4882d 100644
--- a/lib/librte_eal/common/eal_common_options.c
+++ b/lib/librte_eal/common/eal_common_options.c
@@ -95,6 +95,7 @@ eal_long_options[] = {
{OPT_VFIO_INTR, 1, NULL, OPT_VFIO_INTR_NUM},
{OPT_VMWARE_TSC_MAP,0, NULL, OPT_VMWARE_TSC_MAP_NUM   },
{OPT_XEN_DOM0,  0, NULL, OPT_XEN_DOM0_NUM },
+   {OPT_AVAIL_CORES,   0, NULL, OPT_AVAIL_CORES_NUM  },
{0, 0, NULL, 0}
 };

@@ -681,6 +682,37 @@ err:
 }

 static int
+eal_parse_avail_cores(void)
+{
+   int i, count;
+   pthread_t tid;
+   rte_cpuset_t cpuset;
+   struct rte_config *cfg = rte_eal_get_configuration();
+
+   tid = pthread_self();
+   if (pthread_getaffinity_np(tid, sizeof(rte_cpuset_t), ) != 0)
+   return -1;
+
+   for (i = 0, count = 0; i < RTE_MAX_LCORE; i++) {
+   if (lcore_config[i].detected && !CPU_ISSET(i, )) {
+   RTE_LOG(DEBUG, EAL, "Flag lcore %u as undetected\n", i);
+   lcore_config[i].detected = 0;
+   lcore_config[i].core_index = -1;
+   cfg->lcore_role[i] = ROLE_OFF;
+   count++;
+   }
+   }
+   cfg->lcore_count -= count;
+   if (cfg->lcore_count == 0) {
+   RTE_LOG(ERR, EAL, "No lcores available\n");
+   return -1;
+   }
+
+   return 0;
+}
+
+
+static int
 eal_parse_syslog(const char *facility, struct internal_config *conf)
 {
int i;
@@ -754,6 +786,10 @@ eal_parse_proc_type(const char *arg)
return RTE_PROC_INVALID;
 }

+static int param_coremask;
+static int param_corelist;
+static int param_coremap;
+
 int
 eal_parse_common_option(int opt, const char *optarg,
struct internal_config *conf)
@@ -775,6 +811,7 @@ eal_parse_common_option(int opt, const char *optarg,
break;
/* coremask */
case 'c':
+   param_coremask = 1;
if (eal_parse_coremask(optarg) < 0) {
RTE_LOG(ERR, EAL, "invalid coremask\n");
return -1;
@@ -782,6 +819,7 @@ eal_parse_common_option(int opt, const char *optarg,
break;
/* corelist */
case 'l':
+   param_corelist = 1;
if (eal_parse_corelist(optarg) < 0) {
RTE_LOG(ERR, EAL, "invalid core list\n");
return -1;
@@ -890,12 +928,25 @@ eal_parse_common_option(int opt, const char *optarg,
break;
}
case OPT_LCORES_NUM:
+   param_coremap = 1;
if (eal_parse_lcores(optarg) < 0) {
RTE_LOG(ERR, EAL, "invalid parameter for --"
OPT_LCORES "\n");
return -1;
}
break;
+   case OPT_AVAIL_CORES_NUM:
+   if (param_coremask || param_corelist || param_coremap) {
+   RTE_LOG(ERR, EAL, "should put --" OPT_AVAIL_CORES
+   " before -c, -l and --" OPT_LCORES "\n");
+   return -1;
+   }
+   if (eal_parse_avail_cores() < 0) {
+   RTE_LOG(ERR, EAL, "failed to use --"
+   OPT_AVAIL_CORES "\n");
+   return -1;
+   }
+   break;

/* don't know what to do, leave this to caller */
default:
@@ -990,6 +1041,7 @@ eal_common_usage(void)
   "  ',' is used for single number 
separator.\n"
   "  '( )' can be omitted for single element 
group,\n"
   "  '@' can be omitted if cpus and lcores 
have the same value\n"
+  "  --"OPT_AVAIL_CORES"   Use pthread_getaffinity_np() to 
detect cores to be used\n"
   "  --"OPT_MASTER_LCORE" ID   Core ID that is used as master\n"
   "  -n CHANNELS Number of memory channels\n"
   "  -m MB   Memory to allocate (see also 
--"OPT_SOCKET_MEM")\n"
diff --git a/lib/librte_eal/common/eal_options.h 
b/lib/librte_eal/common/eal_options.h
index a881c62..b2ddea3 

[dpdk-dev] [PATCH v5 0/2] cryptodev API changes

2016-03-04 Thread Trahe, Fiona


> -Original Message-
> From: Thomas Monjalon [mailto:thomas.monjalon at 6wind.com]
> Sent: Friday, March 04, 2016 5:46 PM
> To: Trahe, Fiona
> Cc: dev at dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v5 0/2] cryptodev API changes
> 
> 2016-03-04 17:43, Trahe, Fiona:
> > From: Thomas Monjalon [mailto:thomas.monjalon at 6wind.com]
> > > 2016-03-04 17:17, Fiona Trahe:
> > > > This patch set separates the symmetric crypto operations from
> > > > generic
> > > operations and then modifies the cryptodev burst API to accept
> > > bursts of rte_crypto_op rather than rte_mbufs.
> > > >
> > > > V5:
> > > > - updates .map file
> > > > - removes EXPERIMENTAL label from rte_cryptodev.h
> > >
> > > Why do you want to remove the experimental label?
> >
> > Declan had already removed from the MAINTAINERS file and other places in
> previous  patches.
> > This one was just forgotten as far as we know, though as Declan is out we
> can't confirm with him.
> > Do you think we should keep the label ?
> 
> I cannot really decide because it's hard to understand the improvements in a
> such big patch. It would be easier if the changes were split in several steps.
> Maybe the last step (last patch) would be to remove the flag. Having it in a
> separate patch would give the opportunity to detail the reason of the removal 
> in
> the commit message.

Fair enough.
I'll put the label back in.
And we'll handle later with a separate explicit commit to give people a chance 
to comment.


[dpdk-dev] [PATCH v5 0/2] cryptodev API changes

2016-03-04 Thread Trahe, Fiona

> -Original Message-
> From: Thomas Monjalon [mailto:thomas.monjalon at 6wind.com]
> Sent: Friday, March 04, 2016 5:39 PM
> To: Trahe, Fiona
> Cc: dev at dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v5 0/2] cryptodev API changes
> 
> 2016-03-04 17:17, Fiona Trahe:
> > This patch set separates the symmetric crypto operations from generic
> operations and then modifies the cryptodev burst API to accept bursts of
> rte_crypto_op rather than rte_mbufs.
> >
> > V5:
> > - updates .map file
> > - removes EXPERIMENTAL label from rte_cryptodev.h
> 
> Why do you want to remove the experimental label?

Declan had already removed from the MAINTAINERS file and other places in 
previous  patches. 
This one was just forgotten as far as we know, though as Declan is out we can't 
confirm with him. 
Do you think we should keep the label ?


[dpdk-dev] [PATCH v5 0/2] cryptodev API changes

2016-03-04 Thread Trahe, Fiona


> -Original Message-
> From: Trahe, Fiona
> Sent: Friday, March 04, 2016 5:18 PM
> To: dev at dpdk.org
> Cc: Doherty, Declan; Trahe, Fiona
> Subject: [PATCH v5 0/2] cryptodev API changes
> 
> This patch set separates the symmetric crypto operations from generic
> operations and then modifies the cryptodev burst API to accept bursts of
> rte_crypto_op rather than rte_mbufs.
> 
> V5:
> - updates .map file
> - removes EXPERIMENTAL label from rte_cryptodev.h
> 
> V4:
> - Fixes for issues introduced in __rte_crypto_op_raw_bulk_alloc in V3 
> patcheset.
> - Typo fix in cached attribute on rte_crypto_op structure.
> 
> V3:
>  - Addresses V2 comments
>  - Rebased for head
> 
> 
> Declan Doherty (1):
>   cryptodev: change burst API to be crypto op oriented
> 
> Fiona Trahe (1):
>   cryptodev: API tidy and changes to support future extensions
> 
> 
>  MAINTAINERS|   6 +-
>  app/test/test_cryptodev.c  | 894 
> +++--
>  app/test/test_cryptodev.h  |   9 +-
>  app/test/test_cryptodev_perf.c | 270 ---
>  config/common_bsdapp   |   8 -
>  config/common_linuxapp |   8 -
>  doc/api/doxy-api-index.md  |   1 -
>  drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 199 ++---
>  drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c |  18 +-
>  drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h |   6 +-
>  drivers/crypto/qat/qat_crypto.c| 150 ++--
>  drivers/crypto/qat/qat_crypto.h|  14 +-
>  drivers/crypto/qat/rte_qat_cryptodev.c |   8 +-
>  examples/l2fwd-crypto/main.c   | 300 ---
>  lib/Makefile   |   1 -
>  lib/librte_cryptodev/Makefile  |   1 +
>  lib/librte_cryptodev/rte_crypto.h  | 819 +++
>  lib/librte_cryptodev/rte_crypto_sym.h  | 642 +++
>  lib/librte_cryptodev/rte_cryptodev.c   | 115 ++-
>  lib/librte_cryptodev/rte_cryptodev.h   | 189 ++---
>  lib/librte_cryptodev/rte_cryptodev_pmd.h   |  32 +-
>  lib/librte_cryptodev/rte_cryptodev_version.map |   7 +-
>  lib/librte_mbuf/rte_mbuf.h |   6 -
>  lib/librte_mbuf_offload/Makefile   |  52 --
>  lib/librte_mbuf_offload/rte_mbuf_offload.c | 100 ---
>  lib/librte_mbuf_offload/rte_mbuf_offload.h | 310 ---
>  .../rte_mbuf_offload_version.map   |   7 -
>  27 files changed, 2145 insertions(+), 2027 deletions(-)  create mode 100644
> lib/librte_cryptodev/rte_crypto_sym.h
>  delete mode 100644 lib/librte_mbuf_offload/Makefile  delete mode 100644
> lib/librte_mbuf_offload/rte_mbuf_offload.c
>  delete mode 100644 lib/librte_mbuf_offload/rte_mbuf_offload.h
>  delete mode 100644 lib/librte_mbuf_offload/rte_mbuf_offload_version.map
> 
> --
> 2.1.0

NACK - email subject of patches got screwed up. I'll resend.


[dpdk-dev] [PATCH] bonding: fix crash when no slave devices

2016-03-04 Thread Iremonger, Bernard
Hi Ferruh,
> -Original Message-
> From: Yigit, Ferruh
> Sent: Friday, March 4, 2016 5:14 PM
> To: Iremonger, Bernard ; dev at dpdk.org
> Subject: Re: [dpdk-dev] [PATCH] bonding: fix crash when no slave devices
> 
> On 2/23/2016 12:13 PM, Bernard Iremonger wrote:
> > If a bonded device is created when there are no slave devices there is
> > loop in bond_ethdev_promiscous_enable() which results in a
> > segmentation fault.
> > I have applied a similar fix to bond_ethdev_promiscous_disable() where
> > a similar loop could occur.
> >
> > Fixes: 2efb58cbab6e ("bond: new link bonding library")
> > Signed-off-by: Bernard Iremonger 
> > ---
> >  drivers/net/bonding/rte_eth_bond_pmd.c | 6 --
> >  1 file changed, 4 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c
> > b/drivers/net/bonding/rte_eth_bond_pmd.c
> > index b63c886..78972fc 100644
> > --- a/drivers/net/bonding/rte_eth_bond_pmd.c
> > +++ b/drivers/net/bonding/rte_eth_bond_pmd.c
> > @@ -1870,7 +1870,8 @@ bond_ethdev_promiscuous_enable(struct
> rte_eth_dev *eth_dev)
> > case BONDING_MODE_TLB:
> > case BONDING_MODE_ALB:
> > default:
> > -   rte_eth_promiscuous_enable(internals-
> >current_primary_port);
> > +   if (internals->slave_count > 0)
> > +   rte_eth_promiscuous_enable(internals-
> >current_primary_port);
> > }
> >  }
> >
> > @@ -1898,7 +1899,8 @@ bond_ethdev_promiscuous_disable(struct
> rte_eth_dev *dev)
> > case BONDING_MODE_TLB:
> > case BONDING_MODE_ALB:
> > default:
> > -   rte_eth_promiscuous_disable(internals-
> >current_primary_port);
> > +   if (internals->slave_count > 0)
> > +   rte_eth_promiscuous_disable(internals-
> >current_primary_port);
> > }
> >  }
> >
> >
> Hi Bernard,
> 
> The reason of this crash is when there is no slave, the value of
> current_primary_port is 0, which is valid port_id, is this correct?

Yes.


> Does it make sense, instead of slave_count check, to make default
> current_primary_port value a non valid port_id, like -1, so
> is_valid_port() check catches it to prevents crash? For this and any other
> cases.
> 
> Thanks,
> Ferruh

I will try initializing current_primary_port to -1 and see if this helps.
Thanks for reviewing.

Regards,

Bernard.



[dpdk-dev] [PATCH v5 2/2] This patch modifies the crypto burst enqueue/dequeue APIs to operate on bursts rte_crypto_op's rather than the current implementation which operates on rte_mbuf bursts, this

2016-03-04 Thread Fiona Trahe
The changes also continues the separatation of the symmetric operation 
parameters
from the more general operation parameters, this will simplify the integration 
of
asymmetric crypto operations in the future.

As well as the changes to the crypto APIs this patch adds functions for managing
rte_crypto_op pools to the cryptodev API. It modifies the existing PMDs, unit
tests and sample application to work with the modified APIs and finally
removes the now unused rte_mbuf_offload library.

Signed-off-by: Declan Doherty 
Signed-off-by: Fiona Trahe 
---
 MAINTAINERS|   6 +-
 app/test/test_cryptodev.c  | 804 +++--
 app/test/test_cryptodev.h  |   9 +-
 app/test/test_cryptodev_perf.c | 253 +++
 config/common_bsdapp   |   8 -
 config/common_linuxapp |   8 -
 doc/api/doxy-api-index.md  |   1 -
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 171 +++--
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c |  12 +-
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h |   2 +-
 drivers/crypto/qat/qat_crypto.c| 123 ++--
 drivers/crypto/qat/qat_crypto.h|  12 +-
 drivers/crypto/qat/rte_qat_cryptodev.c |   4 +-
 examples/l2fwd-crypto/main.c   | 283 
 lib/Makefile   |   1 -
 lib/librte_cryptodev/rte_crypto.h  | 364 +-
 lib/librte_cryptodev/rte_crypto_sym.h  | 379 +-
 lib/librte_cryptodev/rte_cryptodev.c   |  76 ++
 lib/librte_cryptodev/rte_cryptodev.h   | 113 ++-
 lib/librte_cryptodev/rte_cryptodev_version.map |   5 +-
 lib/librte_mbuf/rte_mbuf.h |   6 -
 lib/librte_mbuf_offload/Makefile   |  52 --
 lib/librte_mbuf_offload/rte_mbuf_offload.c | 100 ---
 lib/librte_mbuf_offload/rte_mbuf_offload.h | 310 
 .../rte_mbuf_offload_version.map   |   7 -
 25 files changed, 1576 insertions(+), 1533 deletions(-)
 delete mode 100644 lib/librte_mbuf_offload/Makefile
 delete mode 100644 lib/librte_mbuf_offload/rte_mbuf_offload.c
 delete mode 100644 lib/librte_mbuf_offload/rte_mbuf_offload.h
 delete mode 100644 lib/librte_mbuf_offload/rte_mbuf_offload_version.map

diff --git a/MAINTAINERS b/MAINTAINERS
index 628bc05..ad6b45e 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -222,16 +222,12 @@ F: lib/librte_mbuf/
 F: doc/guides/prog_guide/mbuf_lib.rst
 F: app/test/test_mbuf.c

-Packet buffer offload - EXPERIMENTAL
-M: Declan Doherty 
-F: lib/librte_mbuf_offload/
-
 Ethernet API
 M: Thomas Monjalon 
 F: lib/librte_ether/
 F: scripts/test-null.sh

-Crypto API - EXPERIMENTAL
+Crypto API
 M: Declan Doherty 
 F: lib/librte_cryptodev/
 F: app/test/test_cryptodev*
diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index 951b443..208fc14 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -35,7 +35,6 @@
 #include 
 #include 
 #include 
-#include 

 #include 
 #include 
@@ -48,7 +47,7 @@ static enum rte_cryptodev_type gbl_cryptodev_type;

 struct crypto_testsuite_params {
struct rte_mempool *mbuf_pool;
-   struct rte_mempool *mbuf_ol_pool;
+   struct rte_mempool *op_mpool;
struct rte_cryptodev_config conf;
struct rte_cryptodev_qp_conf qp_conf;

@@ -62,8 +61,7 @@ struct crypto_unittest_params {

struct rte_cryptodev_sym_session *sess;

-   struct rte_mbuf_offload *ol;
-   struct rte_crypto_sym_op *op;
+   struct rte_crypto_op *op;

struct rte_mbuf *obuf, *ibuf;

@@ -104,7 +102,7 @@ setup_test_string(struct rte_mempool *mpool,
return m;
 }

-#if HEX_DUMP
+#ifdef HEX_DUMP
 static void
 hexdump_mbuf_data(FILE *f, const char *title, struct rte_mbuf *m)
 {
@@ -112,27 +110,29 @@ hexdump_mbuf_data(FILE *f, const char *title, struct 
rte_mbuf *m)
 }
 #endif

-static struct rte_mbuf *
-process_crypto_request(uint8_t dev_id, struct rte_mbuf *ibuf)
+static struct rte_crypto_op *
+process_crypto_request(uint8_t dev_id, struct rte_crypto_op *op)
 {
-   struct rte_mbuf *obuf = NULL;
-#if HEX_DUMP
+#ifdef HEX_DUMP
hexdump_mbuf_data(stdout, "Enqueued Packet", ibuf);
 #endif

-   if (rte_cryptodev_enqueue_burst(dev_id, 0, , 1) != 1) {
+   if (rte_cryptodev_enqueue_burst(dev_id, 0, , 1) != 1) {
printf("Error sending packet for encryption");
return NULL;
}
-   while (rte_cryptodev_dequeue_burst(dev_id, 0, , 1) == 0)
+
+   op = NULL;
+
+   while (rte_cryptodev_dequeue_burst(dev_id, 0, , 1) == 0)
rte_pause();

-#if HEX_DUMP
+#ifdef HEX_DUMP
if (obuf)
hexdump_mbuf_data(stdout, "Dequeued Packet", obuf);
 #endif

-   return obuf;
+   return op;
 }

 static struct crypto_testsuite_params 

[dpdk-dev] [PATCH v5 1/2] This patch splits symmetric specific definitions and functions away from the common crypto APIs to facilitate the future extension and expansion of the cryptodev framework, i

2016-03-04 Thread Fiona Trahe
Signed-off-by: Fiona Trahe 
---
 app/test/test_cryptodev.c  | 164 +++---
 app/test/test_cryptodev_perf.c |  79 +--
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c |  44 +-
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c |   6 +-
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h |   4 +-
 drivers/crypto/qat/qat_crypto.c|  51 +-
 drivers/crypto/qat/qat_crypto.h|  10 +-
 drivers/crypto/qat/rte_qat_cryptodev.c |   8 +-
 examples/l2fwd-crypto/main.c   |  33 +-
 lib/librte_cryptodev/Makefile  |   1 +
 lib/librte_cryptodev/rte_crypto.h  | 563 +--
 lib/librte_cryptodev/rte_crypto_sym.h  | 613 +
 lib/librte_cryptodev/rte_cryptodev.c   |  39 +-
 lib/librte_cryptodev/rte_cryptodev.h   |  80 ++-
 lib/librte_cryptodev/rte_cryptodev_pmd.h   |  32 +-
 lib/librte_cryptodev/rte_cryptodev_version.map |   6 +-
 lib/librte_mbuf_offload/rte_mbuf_offload.h |  22 +-
 17 files changed, 915 insertions(+), 840 deletions(-)
 create mode 100644 lib/librte_cryptodev/rte_crypto_sym.h

diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index 62f8fb0..951b443 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -1,7 +1,7 @@
 /*-
  *   BSD LICENSE
  *
- *   Copyright(c) 2015 Intel Corporation. All rights reserved.
+ *   Copyright(c) 2015-2016 Intel Corporation. All rights reserved.
  *
  *   Redistribution and use in source and binary forms, with or without
  *   modification, are permitted provided that the following conditions
@@ -57,13 +57,13 @@ struct crypto_testsuite_params {
 };

 struct crypto_unittest_params {
-   struct rte_crypto_xform cipher_xform;
-   struct rte_crypto_xform auth_xform;
+   struct rte_crypto_sym_xform cipher_xform;
+   struct rte_crypto_sym_xform auth_xform;

-   struct rte_cryptodev_session *sess;
+   struct rte_cryptodev_sym_session *sess;

struct rte_mbuf_offload *ol;
-   struct rte_crypto_op *op;
+   struct rte_crypto_sym_op *op;

struct rte_mbuf *obuf, *ibuf;

@@ -78,7 +78,7 @@ test_AES_CBC_HMAC_SHA512_decrypt_create_session_params(
struct crypto_unittest_params *ut_params);

 static int
-test_AES_CBC_HMAC_SHA512_decrypt_perform(struct rte_cryptodev_session *sess,
+test_AES_CBC_HMAC_SHA512_decrypt_perform(struct rte_cryptodev_sym_session 
*sess,
struct crypto_unittest_params *ut_params,
struct crypto_testsuite_params *ts_param);

@@ -165,7 +165,8 @@ testsuite_setup(void)
ts_params->mbuf_ol_pool = rte_pktmbuf_offload_pool_create(
"MBUF_OFFLOAD_POOL",
NUM_MBUFS, MBUF_CACHE_SIZE,
-   DEFAULT_NUM_XFORMS * sizeof(struct rte_crypto_xform),
+   DEFAULT_NUM_XFORMS *
+   sizeof(struct rte_crypto_sym_xform),
rte_socket_id());
if (ts_params->mbuf_ol_pool == NULL) {
RTE_LOG(ERR, USER1, "Can't create CRYPTO_OP_POOL\n");
@@ -220,7 +221,7 @@ testsuite_setup(void)

ts_params->conf.nb_queue_pairs = info.max_nb_queue_pairs;
ts_params->conf.socket_id = SOCKET_ID_ANY;
-   ts_params->conf.session_mp.nb_objs = info.max_nb_sessions;
+   ts_params->conf.session_mp.nb_objs = info.sym.max_nb_sessions;

TEST_ASSERT_SUCCESS(rte_cryptodev_configure(dev_id,
_params->conf),
@@ -275,7 +276,7 @@ ut_setup(void)
ts_params->conf.nb_queue_pairs = DEFAULT_NUM_QPS_PER_QAT_DEVICE;
ts_params->conf.socket_id = SOCKET_ID_ANY;
ts_params->conf.session_mp.nb_objs =
-   (gbl_cryptodev_type == RTE_CRYPTODEV_QAT_PMD) ?
+   (gbl_cryptodev_type == RTE_CRYPTODEV_QAT_SYM_PMD) ?
DEFAULT_NUM_OPS_INFLIGHT :
DEFAULT_NUM_OPS_INFLIGHT;

@@ -319,7 +320,7 @@ ut_teardown(void)

/* free crypto session structure */
if (ut_params->sess) {
-   rte_cryptodev_session_free(ts_params->valid_devs[0],
+   rte_cryptodev_sym_session_free(ts_params->valid_devs[0],
ut_params->sess);
ut_params->sess = NULL;
}
@@ -464,7 +465,7 @@ test_queue_pair_descriptor_setup(void)

rte_cryptodev_info_get(ts_params->valid_devs[0], _info);

-   ts_params->conf.session_mp.nb_objs = dev_info.max_nb_sessions;
+   ts_params->conf.session_mp.nb_objs = dev_info.sym.max_nb_sessions;

TEST_ASSERT_SUCCESS(rte_cryptodev_configure(ts_params->valid_devs[0],
_params->conf), "Failed to configure cryptodev %u",
@@ -766,7 +767,7 @@ 

[dpdk-dev] [PATCH v5 0/2] cryptodev API changes

2016-03-04 Thread Fiona Trahe
This patch set separates the symmetric crypto operations from generic 
operations and then modifies the cryptodev burst API to accept bursts of 
rte_crypto_op rather than rte_mbufs.

V5:
- updates .map file
- removes EXPERIMENTAL label from rte_cryptodev.h

V4:
- Fixes for issues introduced in __rte_crypto_op_raw_bulk_alloc in V3 patcheset.
- Typo fix in cached attribute on rte_crypto_op structure.

V3:
 - Addresses V2 comments
 - Rebased for head


Declan Doherty (1):
  cryptodev: change burst API to be crypto op oriented

Fiona Trahe (1):
  cryptodev: API tidy and changes to support future extensions


 MAINTAINERS|   6 +-
 app/test/test_cryptodev.c  | 894 +++--
 app/test/test_cryptodev.h  |   9 +-
 app/test/test_cryptodev_perf.c | 270 ---
 config/common_bsdapp   |   8 -
 config/common_linuxapp |   8 -
 doc/api/doxy-api-index.md  |   1 -
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 199 ++---
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c |  18 +-
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h |   6 +-
 drivers/crypto/qat/qat_crypto.c| 150 ++--
 drivers/crypto/qat/qat_crypto.h|  14 +-
 drivers/crypto/qat/rte_qat_cryptodev.c |   8 +-
 examples/l2fwd-crypto/main.c   | 300 ---
 lib/Makefile   |   1 -
 lib/librte_cryptodev/Makefile  |   1 +
 lib/librte_cryptodev/rte_crypto.h  | 819 +++
 lib/librte_cryptodev/rte_crypto_sym.h  | 642 +++
 lib/librte_cryptodev/rte_cryptodev.c   | 115 ++-
 lib/librte_cryptodev/rte_cryptodev.h   | 189 ++---
 lib/librte_cryptodev/rte_cryptodev_pmd.h   |  32 +-
 lib/librte_cryptodev/rte_cryptodev_version.map |   7 +-
 lib/librte_mbuf/rte_mbuf.h |   6 -
 lib/librte_mbuf_offload/Makefile   |  52 --
 lib/librte_mbuf_offload/rte_mbuf_offload.c | 100 ---
 lib/librte_mbuf_offload/rte_mbuf_offload.h | 310 ---
 .../rte_mbuf_offload_version.map   |   7 -
 27 files changed, 2145 insertions(+), 2027 deletions(-)
 create mode 100644 lib/librte_cryptodev/rte_crypto_sym.h
 delete mode 100644 lib/librte_mbuf_offload/Makefile
 delete mode 100644 lib/librte_mbuf_offload/rte_mbuf_offload.c
 delete mode 100644 lib/librte_mbuf_offload/rte_mbuf_offload.h
 delete mode 100644 lib/librte_mbuf_offload/rte_mbuf_offload_version.map

-- 
2.1.0



[dpdk-dev] [PATCH] bonding: fix crash when no slave devices

2016-03-04 Thread Ferruh Yigit
On 2/23/2016 12:13 PM, Bernard Iremonger wrote:
> If a bonded device is created when there are no slave devices
> there is loop in bond_ethdev_promiscous_enable() which results
> in a segmentation fault.
> I have applied a similar fix to bond_ethdev_promiscous_disable()
> where a similar loop could occur.
> 
> Fixes: 2efb58cbab6e ("bond: new link bonding library")
> Signed-off-by: Bernard Iremonger 
> ---
>  drivers/net/bonding/rte_eth_bond_pmd.c | 6 --
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c 
> b/drivers/net/bonding/rte_eth_bond_pmd.c
> index b63c886..78972fc 100644
> --- a/drivers/net/bonding/rte_eth_bond_pmd.c
> +++ b/drivers/net/bonding/rte_eth_bond_pmd.c
> @@ -1870,7 +1870,8 @@ bond_ethdev_promiscuous_enable(struct rte_eth_dev 
> *eth_dev)
>   case BONDING_MODE_TLB:
>   case BONDING_MODE_ALB:
>   default:
> - rte_eth_promiscuous_enable(internals->current_primary_port);
> + if (internals->slave_count > 0)
> + 
> rte_eth_promiscuous_enable(internals->current_primary_port);
>   }
>  }
>  
> @@ -1898,7 +1899,8 @@ bond_ethdev_promiscuous_disable(struct rte_eth_dev *dev)
>   case BONDING_MODE_TLB:
>   case BONDING_MODE_ALB:
>   default:
> - rte_eth_promiscuous_disable(internals->current_primary_port);
> + if (internals->slave_count > 0)
> + 
> rte_eth_promiscuous_disable(internals->current_primary_port);
>   }
>  }
>  
> 
Hi Bernard,

The reason of this crash is when there is no slave, the value of
current_primary_port is 0, which is valid port_id, is this correct?

Does it make sense, instead of slave_count check, to make default
current_primary_port value a non valid port_id, like -1, so
is_valid_port() check catches it to prevents crash? For this and any
other cases.

Thanks,
ferruh


[dpdk-dev] [PATCH v2] ethdev: fix byte order inconsistence between fdir flow and mask

2016-03-04 Thread Thomas Monjalon
> > Fixed issue of byte order in ethdev library that the structure for setting 
> > fdir's
> > mask and flow entry is inconsist and made inputs of mask be in big endian.
> > 
> > Fixes: 76c6f89e80d4 ("ixgbe: support new flow director masks")
> > Fixes: 2d4c1a9ea2ac ("ethdev: add new flow director masks")
> > 
> > Reported-by: Yaacov Hazan 
> > Signed-off-by: Jingjing Wu 
> Acked-by: Wenzhuo Lu 

Applied, thanks


[dpdk-dev] [PATCH v10 2/2] vhost: Add VHOST PMD

2016-03-04 Thread Yuanhan Liu
On Fri, Mar 04, 2016 at 01:17:42PM +0900, Tetsuya Mukawa wrote:
> The patch introduces a new PMD. This PMD is implemented as thin wrapper
> of librte_vhost. It means librte_vhost is also needed to compile the PMD.
> The vhost messages will be handled only when a port is started. So start
> a port first, then invoke QEMU.
> 
> The PMD has 2 parameters.
>  - iface:  The parameter is used to specify a path to connect to a
>virtio-net device.
>  - queues: The parameter is used to specify the number of the queues
>virtio-net device has.
>(Default: 1)
> 
> Here is an example.
> $ ./testpmd -c f -n 4 --vdev 'eth_vhost0,iface=/tmp/sock0,queues=1' -- -i
> 
> To connect above testpmd, here is qemu command example.
> 
> $ qemu-system-x86_64 \
> 
> -chardev socket,id=chr0,path=/tmp/sock0 \
> -netdev vhost-user,id=net0,chardev=chr0,vhostforce,queues=1 \
> -device virtio-net-pci,netdev=net0,mq=on
> 
> Signed-off-by: Tetsuya Mukawa 
> Acked-by: Ferruh Yigit 

You should carry my Acked-by that I gave few versions before, as well
as the Reviewed-by and Tested-by from Rich, if my memory serves me
right. It's also a way to show respects to the reivew/test efforts
from them.

> ---
>  MAINTAINERS |   4 +

Mind to add me to the MAINTAINER list as well if you send another
version? :) If so, don't put my email address wrongly, which you
have done many times ;-)

--yliu


[dpdk-dev] [PATCH v2] examples/l3fwd: fix using packet type blindly

2016-03-04 Thread Jianfeng Tan
This patch will work on below patch series.
 - [PATCH v6 00/11] Add API to get packet type info

As a example to use ptype info, l3fwd needs firstly to use
rte_eth_dev_get_ptype_info() API to check if device and/or
its PMD driver will parse and fill the needed packet type;
if not, use the newly added option, --parse-ptype, to
analyze it in the callback softly.

As the mode of EXACT_MATCH uses the 5 tuples to caculate
hash, so we narrow down its scope to:
  a. ip packets with no extensions, and
  b. L4 payload should be either tcp or udp.

Note: this patch does not completely solve the issue, "cannot
run l3fwd on virtio or other devices", because hw_ip_checksum
may be not supported by the devices. Currently we can:
  a. remove this requirements;
  b. wait for virtio front end (pmd) to support it.

Signed-off-by: Jianfeng Tan 
---
v2:
 - Add patchset dependence in commit log.
 - Change hardcoded 0 to RTE_PTYPE_UNKNOWN.
 - More accurate em_parse_type.
 - Add restrictions in EM forwarding functions.
 - Define cb directly to avoid too many function calls when do analyze.
 - Some typo fixed.
 - Change the position to call rte_eth_dev_get_ptype_info
   after rte_eth_dev_start().

 doc/guides/rel_notes/release_16_04.rst  |   5 ++
 doc/guides/sample_app_ug/l3_forward.rst |   6 +-
 examples/l3fwd/l3fwd.h  |  14 
 examples/l3fwd/l3fwd_em.c   | 115 
 examples/l3fwd/l3fwd_em.h   |  10 ++-
 examples/l3fwd/l3fwd_em_hlm_sse.h   |  17 +++--
 examples/l3fwd/l3fwd_em_sse.h   |   9 ++-
 examples/l3fwd/l3fwd_lpm.c  |  71 
 examples/l3fwd/main.c   |  52 +++
 9 files changed, 289 insertions(+), 10 deletions(-)

diff --git a/doc/guides/rel_notes/release_16_04.rst 
b/doc/guides/rel_notes/release_16_04.rst
index 64e913d..4d6260e 100644
--- a/doc/guides/rel_notes/release_16_04.rst
+++ b/doc/guides/rel_notes/release_16_04.rst
@@ -68,6 +68,11 @@ This section should contain bug fixes added to the relevant 
sections. Sample for
   vhost-switch often fails to allocate mbuf when dequeue from vring because it
   wrongly calculates the number of mbufs needed.

+* **examples/l3fwd: Fixed using packet type blindly.**
+
+  l3fwd makes use of packet type information without even query if devices or 
PMDs
+  really set it. For those don't set ptypes, add an option to parse it softly.
+

 EAL
 ~~~
diff --git a/doc/guides/sample_app_ug/l3_forward.rst 
b/doc/guides/sample_app_ug/l3_forward.rst
index 4ce734b..46a1782 100644
--- a/doc/guides/sample_app_ug/l3_forward.rst
+++ b/doc/guides/sample_app_ug/l3_forward.rst
@@ -93,7 +93,7 @@ The application has a number of command line options:

 .. code-block:: console

-./build/l3fwd [EAL options] -- -p PORTMASK [-P]  
--config(port,queue,lcore)[,(port,queue,lcore)] [--enable-jumbo [--max-pkt-len 
PKTLEN]]  [--no-numa][--hash-entry-num][--ipv6]
+./build/l3fwd [EAL options] -- -p PORTMASK [-P]  
--config(port,queue,lcore)[,(port,queue,lcore)] [--enable-jumbo [--max-pkt-len 
PKTLEN]]  [--no-numa][--hash-entry-num][--ipv6] [--parse-ptype]

 where,

@@ -114,6 +114,8 @@ where,

 *   --ipv6: optional, set it if running ipv6 packets

+*   --parse-ptype: optional, set it if use software way to analyze packet type
+
 For example, consider a dual processor socket platform where cores 0-7 and 
16-23 appear on socket 0, while cores 8-15 and 24-31 appear on socket 1.
 Let's say that the programmer wants to use memory from both NUMA nodes, the 
platform has only two ports, one connected to each NUMA node,
 and the programmer wants to use two cores from each processor socket to do the 
packet processing.
@@ -334,6 +336,8 @@ The key code snippet of simple_ipv4_fwd_4pkts() is shown 
below:

 The simple_ipv6_fwd_4pkts() function is similar to the simple_ipv4_fwd_4pkts() 
function.

+Known issue: IP packets with extensions or IP packets which are not TCP/UDP 
cannot work well at this mode.
+
 Packet Forwarding for LPM-based Lookups
 ~~~

diff --git a/examples/l3fwd/l3fwd.h b/examples/l3fwd/l3fwd.h
index da6d369..6ae2454 100644
--- a/examples/l3fwd/l3fwd.h
+++ b/examples/l3fwd/l3fwd.h
@@ -198,6 +198,20 @@ void
 setup_hash(const int socketid);

 int
+em_check_ptype(int portid);
+
+int
+lpm_check_ptype(int portid);
+
+uint16_t
+em_cb_parse_ptype(uint8_t port, uint16_t queue, struct rte_mbuf *pkts[],
+ uint16_t nb_pkts, uint16_t max_pkts, void *user_param);
+
+uint16_t
+lpm_cb_parse_ptype(uint8_t port, uint16_t queue, struct rte_mbuf *pkts[],
+  uint16_t nb_pkts, uint16_t max_pkts, void *user_param);
+
+int
 em_main_loop(__attribute__((unused)) void *dummy);

 int
diff --git a/examples/l3fwd/l3fwd_em.c b/examples/l3fwd/l3fwd_em.c
index f6a65d8..a2d51f0 100644
--- a/examples/l3fwd/l3fwd_em.c
+++ b/examples/l3fwd/l3fwd_em.c
@@ -42,6 +42,7 @@
 #include 
 #include 
 #include 
+#include 

 #include 
 #include 
@@ 

[dpdk-dev] [PATCH] config: remove duplicate configuration information

2016-03-04 Thread Thomas Monjalon
2016-03-04 14:44, Wiles, Keith:
> >>>
> >>>--- a/config/defconfig_x86_64-native-bsdapp-clang
> >>>+++ b/config/defconfig_x86_64-native-bsdapp-clang
> >>>@@ -37,6 +37,7 @@ CONFIG_RTE_MACHINE="native"
> >>>  CONFIG_RTE_ARCH="x86_64"
> >>>  CONFIG_RTE_ARCH_X86_64=y
> >>>  CONFIG_RTE_ARCH_X86=y
> >>>+CONFIG_RTE_ARCH_64=y
> >>>  
> >>>  CONFIG_RTE_TOOLCHAIN="clang"
> >>>  CONFIG_RTE_TOOLCHAIN_CLANG=y
> >>>diff --git a/config/defconfig_x86_64-native-bsdapp-gcc 
> >>>b/config/defconfig_x86_64-native-bsdapp-gcc
> >>>index 5a6a4e8..4ea4433 100644
> >>>--- a/config/defconfig_x86_64-native-bsdapp-gcc
> >>>+++ b/config/defconfig_x86_64-native-bsdapp-gcc
> >>>@@ -37,6 +37,7 @@ CONFIG_RTE_MACHINE="native"
> >>>  CONFIG_RTE_ARCH="x86_64"
> >>>  CONFIG_RTE_ARCH_X86_64=y
> >>>  CONFIG_RTE_ARCH_X86=y
> >>>+CONFIG_RTE_ARCH_64=y
> >>
> >>It should be a totally separate patch.
> >>And there are other places where it is missing.
> 
> I looked in the other defconfig_XXX files and did not see any other places 
> that were missing the CONFIG_RTE_ARCH_64, can you point out those places.

% ls -1 config/defconfig_*64*
config/defconfig_arm64-armv8a-linuxapp-gcc
config/defconfig_arm64-thunderx-linuxapp-gcc
config/defconfig_arm64-xgene1-linuxapp-gcc
config/defconfig_ppc_64-power8-linuxapp-gcc
config/defconfig_x86_64-ivshmem-linuxapp-gcc
config/defconfig_x86_64-ivshmem-linuxapp-icc
config/defconfig_x86_64-native-bsdapp-clang
config/defconfig_x86_64-native-bsdapp-gcc
config/defconfig_x86_64-native-linuxapp-clang
config/defconfig_x86_64-native-linuxapp-gcc
config/defconfig_x86_64-native-linuxapp-icc

% git grep -l RTE_ARCH_64 config
config/defconfig_arm64-armv8a-linuxapp-gcc
config/defconfig_ppc_64-power8-linuxapp-gcc
config/defconfig_tile-tilegx-linuxapp-gcc
config/defconfig_x86_64-native-linuxapp-clang
config/defconfig_x86_64-native-linuxapp-gcc
config/defconfig_x86_64-native-linuxapp-icc

And you've patched:
config/defconfig_x86_64-native-bsdapp-clang
config/defconfig_x86_64-native-bsdapp-gcc

So the missing files seems to be
config/defconfig_arm64-thunderx-linuxapp-gcc
config/defconfig_arm64-xgene1-linuxapp-gcc
config/defconfig_x86_64-ivshmem-linuxapp-gcc
config/defconfig_x86_64-ivshmem-linuxapp-icc

But they include other defconfigs which have ARCH_64.
So you're right, there is no missing file.
Sorry for the confusion


[dpdk-dev] [PATCH] eal/linux: fix compilation error CONFIG_RTE_LIBEAL_USE_HPET

2016-03-04 Thread Thomas Monjalon
2016-02-11 00:05, Vincent JARDIN:
> When CONFIG_RTE_LIBEAL_USE_HPET=y is set, eal_timer.c does not compile
> anymore. Just add simple missing include.
> 
> Signed-off-by: Vincent JARDIN 

It has been fixed in another patch:
http://dpdk.org/browse/dpdk/commit/?id=3560681d68



[dpdk-dev] [PATCH 0/3] sched: patches for 2.2

2016-03-04 Thread Thomas Monjalon
2015-11-29 10:46, Stephen Hemminger:
> This is the last round of sched updates for 2.2. It is based
> on code changes (extensively) tested by QA and used in the vRouter.
> 
> Stephen Hemminger (3):
>   rte_sched: keep track of RED drops
>   rte_sched: introduce reciprocal divide
>   rte_sched: eliminate floating point in calculating byte clock

Cristian, what is the status of this series, please?


[dpdk-dev] [PATCH v3 3/7] drivers/net/bnxt new driver for Broadcom bnxt

2016-03-04 Thread Stephen Hurd
On Fri, Mar 4, 2016 at 3:02 PM, Stephen Hemminger <
stephen at networkplumber.org> wrote:

>
> > New driver for Broadcom bnxt (NexXtreme C-series) devices.>
>
> Looks good, I just have a couple of functionality comments.
>
> 1. Driver does not appear to support Link State interrupt. Not a big
>deal, but would be good to have.
>

Correct, it currently doesn't, but this is on The List of things to do.


> 2. Driver does not support hotplug
>

I haven't looked into enabling this at all yet.


> 3. Since driver does not support scattered receive, it should check
>and error out on enable_scatter (ditto for other features in rxmode).
>This will save pain in future when some application asks device to do
>something it can not do.
>

Good catch, will do.

4. Does driver support SECONDARY process model, it appears secondary
>device will reset hardware.
>

I don't actually know what this is, I'll look into it.

5. Driver does not supper per-receive queue data interrupts.
>This is necessary for power-saving NAPI like code.
>

This is also on The List.

As a somewhat-related process question, should I be submitting this as a
growing patch series until the merge window opens up again, or should I
submit further changes as new patches?  I'm not really sure on this point,
and have been holding off adding the header comment commits until I figured
out the right answer.


[dpdk-dev] [PATCH] lpm: merge tbl24 and tbl8 structures

2016-03-04 Thread Thomas Monjalon
2015-11-24 14:25, Bruce Richardson:
> The tbl8 and tbl24 structures were essentially identical except for
> slightly different names for one or two fields. Merge these two
> structures into a single structure definition.
> 
> Two fields have been renamed as part of this change: the
> "ext_entry" field in the tbl24 has been renamed to "valid_group" to match
> the tbl8 value to make the merge easier, and the "tbl8_gindex" field has
> been renamed to "group_idx". The "valid_group" field now serves two
> purposes: in a tbl8 it indicates if the group, i.e. the tbl8, is valid,
> and in a tbl24, it indicates if the "group_idx" is valid, i.e. whether
> the value is a next_hop or a tbl8 index. [The name "group_idx" was used
> to make this latter link between the fields clearer]
> 
> Suggested-by: Vladimir Medvedkin 
> Signed-off-by: Bruce Richardson 

This patch was forgotten.
Michal, Jerin, maybe you'll have to rebase on top of it.

Applied, thanks


[dpdk-dev] [PATCH v5] mbuf: introduce common functions to get dma address

2016-03-04 Thread Thomas Monjalon
2016-03-04 10:09, Olivier Matz:
> From: Ravi Kerur 
> 
> Macros RTE_MBUF_DATA_DMA_ADDR and RTE_MBUF_DATA_DMA_ADDR_DEFAULT
> are defined in each PMD driver file. Convert macros to inline
> functions and move them to common lib/librte_mbuf/rte_mbuf.h file.
> PMD drivers include rte_mbuf.h file directly/indirectly hence no
> additioanl header file inclusion is necessary.
> 
> Signed-off-by: Ravi Kerur 
> Signed-off-by: Olivier Matz 

Applied, thanks


[dpdk-dev] [PATCH v4 1/2] cryptodev: API tidy and changes to support future extensions

2016-03-04 Thread Thomas Monjalon
2016-02-29 16:52, Declan Doherty:
> From: Fiona Trahe 
> 
> This patch splits symmetric specific definitions and functions away from the
> common crypto APIs to facilitate the future extension and expansion of the
> cryptodev framework, in order to allow  asymmetric crypto operations to be
> introduced at a later date, as well as to clean the logical structure of the
> public includes. The patch also introduces the _sym prefix to symmetric
> specific structure and functions to improve clarity in the API.
> 
> Signed-off-by: Fiona Trahe 
> Signed-off-by: Declan Doherty 

Linking test application fails because you forgot renaming the symbols in .map.



[dpdk-dev] [PATCH] cmdline: include missing cmdline_parse.h

2016-03-04 Thread Thomas Monjalon
2016-03-04 10:05, Olivier MATZ:
> Hi Marc,
> 
> On 03/03/2016 12:52 AM, Marc Sune wrote:
> > cmdline_parse_*.h headers use struct cmdline_token_hdr /
> > cmdline_parse_token_hdr_t which is defined in cmdline_parse.h, but
> > do not include it, forcing manual inclusion.
> > 
> > This commit includes cmdline_parse.h in all cmdline_parse_*.h.
> 
> Acked-by: Olivier Matz 
> 
> Thanks

Applied, thanks


[dpdk-dev] [PATCH v2 2/2] drivers/net/vmxnet3: add ethdev functions

2016-03-04 Thread Remy Horton
Implements driver support for setting of MAC address.

Signed-off-by: Remy Horton 
---
 doc/guides/rel_notes/release_16_04.rst |  4 
 drivers/net/vmxnet3/vmxnet3_ethdev.c   | 19 +++
 2 files changed, 23 insertions(+)

diff --git a/doc/guides/rel_notes/release_16_04.rst 
b/doc/guides/rel_notes/release_16_04.rst
index 4e0112e..39db674 100644
--- a/doc/guides/rel_notes/release_16_04.rst
+++ b/doc/guides/rel_notes/release_16_04.rst
@@ -62,6 +62,10 @@ This section should contain new features added in this 
release. Sample format:
   Implemented driver functions for Register dumping, EEPROM dumping, and
   setting of MAC address.

+* **vmxnet3: Added ethdev support functions.**
+
+  Implemented driver functionality for setting MAC address.
+

 Resolved Issues
 ---
diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c 
b/drivers/net/vmxnet3/vmxnet3_ethdev.c
index c363bf6..bc83524 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethdev.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c
@@ -91,6 +91,8 @@ static int vmxnet3_dev_vlan_filter_set(struct rte_eth_dev 
*dev,
 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);
+static void vmxnet3_mac_addr_set(struct rte_eth_dev *dev,
+struct ether_addr *mac_addr);

 #if PROCESS_SYS_EVENTS == 1
 static void vmxnet3_process_events(struct vmxnet3_hw *);
@@ -124,6 +126,7 @@ static const struct eth_dev_ops vmxnet3_eth_dev_ops = {
.rx_queue_release = vmxnet3_dev_rx_queue_release,
.tx_queue_setup   = vmxnet3_dev_tx_queue_setup,
.tx_queue_release = vmxnet3_dev_tx_queue_release,
+   .mac_addr_set = vmxnet3_mac_addr_set,
 };

 static const struct rte_memzone *
@@ -922,6 +925,22 @@ vmxnet3_process_events(struct vmxnet3_hw *hw)
 }
 #endif

+static void vmxnet3_mac_addr_set(struct rte_eth_dev *dev,
+struct ether_addr *mac_addr)
+{
+   struct vmxnet3_hw *hw = dev->data->dev_private;
+   uint32_t mac_hi, mac_lo;
+
+   if (!is_valid_assigned_ether_addr(mac_addr)) {
+   PMD_DRV_LOG(ERR, "Tried to set invalid MAC address.");
+   return;
+   }
+   memcpy(_lo, mac_addr, 4);
+   memcpy(_hi, mac_addr + 4, 2);
+   VMXNET3_WRITE_BAR1_REG(hw, VMXNET3_REG_MACL, mac_lo);
+   VMXNET3_WRITE_BAR1_REG(hw, VMXNET3_REG_MACH, mac_hi);
+}
+
 static struct rte_driver rte_vmxnet3_driver = {
.type = PMD_PDEV,
.init = rte_vmxnet3_pmd_init,
-- 
2.5.0



[dpdk-dev] [PATCH v2 1/2] drivers/net/i40e: add ethdev functions

2016-03-04 Thread Remy Horton
Implements driver support for dumping of EEPROM and registers,
and the setting of MAC address.

Signed-off-by: Remy Horton 
---
 doc/guides/rel_notes/release_16_04.rst |5 +
 drivers/net/i40e/i40e_ethdev.c |  116 
 drivers/net/i40e/i40e_regs.h   | 1000 
 3 files changed, 1121 insertions(+)
 create mode 100644 drivers/net/i40e/i40e_regs.h

diff --git a/doc/guides/rel_notes/release_16_04.rst 
b/doc/guides/rel_notes/release_16_04.rst
index 9442018..4e0112e 100644
--- a/doc/guides/rel_notes/release_16_04.rst
+++ b/doc/guides/rel_notes/release_16_04.rst
@@ -57,6 +57,11 @@ This section should contain new features added in this 
release. Sample format:

 * **Added vhost-user live migration support.**

+* **i40e: Added ethdev support functions.**
+
+  Implemented driver functions for Register dumping, EEPROM dumping, and
+  setting of MAC address.
+

 Resolved Issues
 ---
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 6241bfc..bee208c 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -61,6 +61,7 @@
 #include "i40e_ethdev.h"
 #include "i40e_rxtx.h"
 #include "i40e_pf.h"
+#include "i40e_regs.h"

 /* Maximun number of MAC addresses */
 #define I40E_NUM_MACADDR_MAX   64
@@ -407,6 +408,18 @@ static int i40e_dev_rx_queue_intr_enable(struct 
rte_eth_dev *dev,
 static int i40e_dev_rx_queue_intr_disable(struct rte_eth_dev *dev,
  uint16_t queue_id);

+static int i40e_get_reg_length(struct rte_eth_dev *dev);
+
+static int i40e_get_regs(struct rte_eth_dev *dev,
+struct rte_dev_reg_info *regs);
+
+static int i40e_get_eeprom_length(struct rte_eth_dev *dev);
+
+static int i40e_get_eeprom(struct rte_eth_dev *dev,
+  struct rte_dev_eeprom_info *eeprom);
+
+static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
+ struct ether_addr *mac_addr);

 static const struct rte_pci_id pci_id_i40e_map[] = {
 #define RTE_PCI_DEV_ID_DECL_I40E(vend, dev) {RTE_PCI_DEVICE(vend, dev)},
@@ -475,6 +488,11 @@ static const struct eth_dev_ops i40e_eth_dev_ops = {
.timesync_adjust_time = i40e_timesync_adjust_time,
.timesync_read_time   = i40e_timesync_read_time,
.timesync_write_time  = i40e_timesync_write_time,
+   .get_reg_length   = i40e_get_reg_length,
+   .get_reg  = i40e_get_regs,
+   .get_eeprom_length= i40e_get_eeprom_length,
+   .get_eeprom   = i40e_get_eeprom,
+   .mac_addr_set = i40e_set_default_mac_addr,
 };

 /* store statistics names and its offset in stats structure */
@@ -8527,3 +8545,101 @@ i40e_dev_rx_queue_intr_disable(struct rte_eth_dev *dev, 
uint16_t queue_id)

return 0;
 }
+
+static int i40e_get_reg_length(__rte_unused struct rte_eth_dev *dev)
+{
+   /* Highest base addr + 32-bit word */
+   return I40E_GLGEN_STAT_CLEAR + 4;
+}
+
+static int i40e_get_regs(struct rte_eth_dev *dev,
+struct rte_dev_reg_info *regs)
+{
+   struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+   uint32_t *ptr_data = regs->data;
+   uint32_t reg_idx, arr_idx, arr_idx2, reg_offset;
+   const struct i40e_reg_info *reg_info;
+
+   /* The first few registers have to be read using AQ operations */
+   reg_idx = 0;
+   while (i40e_regs_adminq[reg_idx].name) {
+   reg_info = _regs_adminq[reg_idx++];
+   for (arr_idx = 0; arr_idx <= reg_info->count1; arr_idx++)
+   for (arr_idx2 = 0;
+   arr_idx2 <= reg_info->count2;
+   arr_idx2++) {
+   reg_offset = arr_idx * reg_info->stride1 +
+   arr_idx2 * reg_info->stride2;
+   ptr_data[reg_offset >> 2] =
+   i40e_read_rx_ctl(hw, reg_offset);
+   }
+   }
+
+   /* The remaining registers can be read using primitives */
+   reg_idx = 0;
+   while (i40e_regs_others[reg_idx].name) {
+   reg_info = _regs_others[reg_idx++];
+   for (arr_idx = 0; arr_idx <= reg_info->count1; arr_idx++)
+   for (arr_idx2 = 0;
+   arr_idx2 <= reg_info->count2;
+   arr_idx2++) {
+   reg_offset = arr_idx * reg_info->stride1 +
+   arr_idx2 * reg_info->stride2;
+   ptr_data[reg_offset >> 2] =
+   I40E_READ_REG(hw, reg_offset);
+   }
+   }
+
+   return 0;
+}
+
+static int i40e_get_eeprom_length(struct rte_eth_dev *dev)

[dpdk-dev] [PATCH v2 0/2] Add missing ethdev driver support

2016-03-04 Thread Remy Horton
Several rte_eth_dev_* functions are currently only supported
by the ixgbe NIC driver. This patchset adds driver support
for some of these functions to the i40e and vmxnet3 drivers.

--

This patchset depends on:
 * http://dpdk.org/dev/patchwork/patch/10654/

v2 changes:
* Rebased to origin/master
* Notes moved release_2_3.rst -> release_16_04.rst
* Removed redundant mac address copy
* Removed empty functions & spurious __rte_unused directives
* Descoped Tx/Rx queue get (too little info)
* Redid i40e register lookup table and i40e reg dumping
* Added error logging
* Added MAC address checks

Remy Horton (2):
  drivers/net/i40e: Add ethdev functions
  drivers/net/vmxnet3: Add ethdev functions

 doc/guides/rel_notes/release_16_04.rst |9 +
 drivers/net/i40e/i40e_ethdev.c |  116 
 drivers/net/i40e/i40e_regs.h   | 1000 
 drivers/net/vmxnet3/vmxnet3_ethdev.c   |   19 +
 4 files changed, 1144 insertions(+)
 create mode 100644 drivers/net/i40e/i40e_regs.h

-- 
2.5.0



[dpdk-dev] [PATCH] lpm: merge tbl24 and tbl8 structures

2016-03-04 Thread Kobylinski, MichalX


> -Original Message-
> From: Jerin Jacob [mailto:jerin.jacob at caviumnetworks.com]
> Sent: Friday, March 4, 2016 4:04 PM
> To: Thomas Monjalon 
> Cc: Richardson, Bruce ; dev at dpdk.org;
> Kobylinski, MichalX 
> Subject: Re: [dpdk-dev] [PATCH] lpm: merge tbl24 and tbl8 structures
> Importance: High
> 
> On Fri, Mar 04, 2016 at 03:57:43PM +0100, Thomas Monjalon wrote:
> > 2015-11-24 14:25, Bruce Richardson:
> > > The tbl8 and tbl24 structures were essentially identical except for
> > > slightly different names for one or two fields. Merge these two
> > > structures into a single structure definition.
> > >
> > > Two fields have been renamed as part of this change: the "ext_entry"
> > > field in the tbl24 has been renamed to "valid_group" to match the
> > > tbl8 value to make the merge easier, and the "tbl8_gindex" field has
> > > been renamed to "group_idx". The "valid_group" field now serves two
> > > purposes: in a tbl8 it indicates if the group, i.e. the tbl8, is
> > > valid, and in a tbl24, it indicates if the "group_idx" is valid,
> > > i.e. whether the value is a next_hop or a tbl8 index. [The name
> > > "group_idx" was used to make this latter link between the fields
> > > clearer]
> > >
> > > Suggested-by: Vladimir Medvedkin 
> > > Signed-off-by: Bruce Richardson 
> >
> > This patch was forgotten.
> > Michal, Jerin, maybe you'll have to rebase on top of it.

ok, I'll rebase on top of it.
> 
> I wait for Michal to send the next version. I will the v5 rebased on Michal 
> patch.
> 
> Jerin
> 
> >
> > Applied, thanks


[dpdk-dev] [PATCH] maintainer: claim responsibility for igb_uio

2016-03-04 Thread Zhang, Helin


> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Ferruh Yigit
> Sent: Friday, March 4, 2016 11:07 PM
> To: dev at dpdk.org
> Subject: [dpdk-dev] [PATCH] maintainer: claim responsibility for igb_uio
> 
> igb_iuo has no maintainer, claim responsibility for igb_uio
> 
> Signed-off-by: Ferruh Yigit 
Acked-by: Helin Zhang 

> ---
>  MAINTAINERS | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 628bc05..e253bf7 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -164,6 +164,7 @@ F: lib/librte_eal/linuxapp/eal/
>  F: doc/guides/linux_gsg/
> 
>  Linux UIO
> +M: Ferruh Yigit 
>  F: lib/librte_eal/linuxapp/igb_uio/
>  F: lib/librte_eal/linuxapp/eal/*uio*
> 
> --
> 2.5.0



[dpdk-dev] [PATCH] maintainer: claim responsibility for igb_uio

2016-03-04 Thread Ferruh Yigit
igb_iuo has no maintainer, claim responsibility for igb_uio

Signed-off-by: Ferruh Yigit 
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 628bc05..e253bf7 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -164,6 +164,7 @@ F: lib/librte_eal/linuxapp/eal/
 F: doc/guides/linux_gsg/

 Linux UIO
+M: Ferruh Yigit 
 F: lib/librte_eal/linuxapp/igb_uio/
 F: lib/librte_eal/linuxapp/eal/*uio*

-- 
2.5.0



[dpdk-dev] [PATCH v3 3/7] drivers/net/bnxt new driver for Broadcom bnxt

2016-03-04 Thread Stephen Hemminger
On Fri,  4 Mar 2016 13:05:24 -0800
Stephen Hurd  wrote:

> New driver for Broadcom bnxt (NexXtreme C-series) devices.
> 
> Standards-compliant 10/25/50G support with 30MPPS full-duplex throughput
> http://www.broadcom.com/press/release.php?id=s923886
> 
> Signed-off-by: Stephen Hurd 
> ---
> v3:
> * Fix incorrect format specifier compilation error on i686
>   (PRIx64 instead of lx for uint64_t) on line 1337
> 
>  drivers/net/bnxt/Makefile |   79 ++
>  drivers/net/bnxt/bnxt.h   |  217 
>  drivers/net/bnxt/bnxt_cpr.c   |  138 +++
>  drivers/net/bnxt/bnxt_cpr.h   |  117 ++
>  drivers/net/bnxt/bnxt_ethdev.c| 1381 ++
>  drivers/net/bnxt/bnxt_filter.c|  175 +++
>  drivers/net/bnxt/bnxt_filter.h|   74 ++
>  drivers/net/bnxt/bnxt_hwrm.c  | 1554 
>  drivers/net/bnxt/bnxt_hwrm.h  |  105 ++
>  drivers/net/bnxt/bnxt_irq.c   |  154 +++
>  drivers/net/bnxt/bnxt_irq.h   |   51 +
>  drivers/net/bnxt/bnxt_ring.c  |  306 +
>  drivers/net/bnxt/bnxt_ring.h  |  104 ++
>  drivers/net/bnxt/bnxt_rxq.c   |  383 ++
>  drivers/net/bnxt/bnxt_rxq.h   |   75 ++
>  drivers/net/bnxt/bnxt_rxr.c   |  369 ++
>  drivers/net/bnxt/bnxt_rxr.h   |   73 ++
>  drivers/net/bnxt/bnxt_stats.c |  190 +++
>  drivers/net/bnxt/bnxt_stats.h |   44 +
>  drivers/net/bnxt/bnxt_txq.c   |  164 +++
>  drivers/net/bnxt/bnxt_txq.h   |   76 ++
>  drivers/net/bnxt/bnxt_txr.c   |  326 +
>  drivers/net/bnxt/bnxt_txr.h   |   71 ++
>  drivers/net/bnxt/bnxt_vnic.c  |  285 +
>  drivers/net/bnxt/bnxt_vnic.h  |   80 ++
>  drivers/net/bnxt/hsi_struct_def_dpdk.h| 1832 
> +
>  drivers/net/bnxt/rte_pmd_bnxt_version.map |4 +
>  27 files changed, 8427 insertions(+)
>  create mode 100644 drivers/net/bnxt/Makefile
>  create mode 100644 drivers/net/bnxt/bnxt.h
>  create mode 100644 drivers/net/bnxt/bnxt_cpr.c
>  create mode 100644 drivers/net/bnxt/bnxt_cpr.h
>  create mode 100644 drivers/net/bnxt/bnxt_ethdev.c
>  create mode 100644 drivers/net/bnxt/bnxt_filter.c
>  create mode 100644 drivers/net/bnxt/bnxt_filter.h
>  create mode 100644 drivers/net/bnxt/bnxt_hwrm.c
>  create mode 100644 drivers/net/bnxt/bnxt_hwrm.h
>  create mode 100644 drivers/net/bnxt/bnxt_irq.c
>  create mode 100644 drivers/net/bnxt/bnxt_irq.h
>  create mode 100644 drivers/net/bnxt/bnxt_ring.c
>  create mode 100644 drivers/net/bnxt/bnxt_ring.h
>  create mode 100644 drivers/net/bnxt/bnxt_rxq.c
>  create mode 100644 drivers/net/bnxt/bnxt_rxq.h
>  create mode 100644 drivers/net/bnxt/bnxt_rxr.c
>  create mode 100644 drivers/net/bnxt/bnxt_rxr.h
>  create mode 100644 drivers/net/bnxt/bnxt_stats.c
>  create mode 100644 drivers/net/bnxt/bnxt_stats.h
>  create mode 100644 drivers/net/bnxt/bnxt_txq.c
>  create mode 100644 drivers/net/bnxt/bnxt_txq.h
>  create mode 100644 drivers/net/bnxt/bnxt_txr.c
>  create mode 100644 drivers/net/bnxt/bnxt_txr.h
>  create mode 100644 drivers/net/bnxt/bnxt_vnic.c
>  create mode 100644 drivers/net/bnxt/bnxt_vnic.h
>  create mode 100644 drivers/net/bnxt/hsi_struct_def_dpdk.h
>  create mode 100644 drivers/net/bnxt/rte_pmd_bnxt_version.map

Looks good, I just have a couple of functionality comments.

1. Driver does not appear to support Link State interrupt. Not a big
   deal, but would be good to have.

2. Driver does not support hotplug

3. Since driver does not support scattered receive, it should check
   and error out on enable_scatter (ditto for other features in rxmode).
   This will save pain in future when some application asks device to do
   something it can not do.

4. Does driver support SECONDARY process model, it appears secondary
   device will reset hardware.

5. Driver does not supper per-receive queue data interrupts.
   This is necessary for power-saving NAPI like code.








[dpdk-dev] [PATCH] config: remove duplicate configuration information

2016-03-04 Thread Wiles, Keith
>>>
>>>--- a/config/defconfig_x86_64-native-bsdapp-clang
>>>+++ b/config/defconfig_x86_64-native-bsdapp-clang
>>>@@ -37,6 +37,7 @@ CONFIG_RTE_MACHINE="native"
>>>  CONFIG_RTE_ARCH="x86_64"
>>>  CONFIG_RTE_ARCH_X86_64=y
>>>  CONFIG_RTE_ARCH_X86=y
>>>+CONFIG_RTE_ARCH_64=y
>>>  
>>>  CONFIG_RTE_TOOLCHAIN="clang"
>>>  CONFIG_RTE_TOOLCHAIN_CLANG=y
>>>diff --git a/config/defconfig_x86_64-native-bsdapp-gcc 
>>>b/config/defconfig_x86_64-native-bsdapp-gcc
>>>index 5a6a4e8..4ea4433 100644
>>>--- a/config/defconfig_x86_64-native-bsdapp-gcc
>>>+++ b/config/defconfig_x86_64-native-bsdapp-gcc
>>>@@ -37,6 +37,7 @@ CONFIG_RTE_MACHINE="native"
>>>  CONFIG_RTE_ARCH="x86_64"
>>>  CONFIG_RTE_ARCH_X86_64=y
>>>  CONFIG_RTE_ARCH_X86=y
>>>+CONFIG_RTE_ARCH_64=y
>>
>>It should be a totally separate patch.
>>And there are other places where it is missing.

I looked in the other defconfig_XXX files and did not see any other places that 
were missing the CONFIG_RTE_ARCH_64, can you point out those places.

>
>


Regards,
Keith






[dpdk-dev] [PATCH] lpm6: fix use after free of lpm in rte_lpm6_create

2016-03-04 Thread Stephen Hemminger
On Fri,  4 Mar 2016 11:31:20 +0100
Christian Ehrhardt  wrote:

> In certain autotests lpm->max_rules turned out to be non initialized.
> That was caused by a failing allocation for lpm->rules_tbl in rte_lpm6_create.
> It then left the function via goto exit with lpm freed, but still a pointer
> value being set.
> 
> In case of an allocation failure it resets lpm to NULL now, to avoid the
> upper layers operate on that already freed memory.
> Along that is also makes the RTE_LOG message of the failed allocation unique.
> ---
>  lib/librte_lpm/rte_lpm6.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/librte_lpm/rte_lpm6.c b/lib/librte_lpm/rte_lpm6.c
> index 6c2b293..48931cc 100644
> --- a/lib/librte_lpm/rte_lpm6.c
> +++ b/lib/librte_lpm/rte_lpm6.c
> @@ -206,8 +206,9 @@ rte_lpm6_create(const char *name, int socket_id,
>   (size_t)rules_size, RTE_CACHE_LINE_SIZE, socket_id);
>  
>   if (lpm->rules_tbl == NULL) {
> - RTE_LOG(ERR, LPM, "LPM memory allocation failed\n");
> + RTE_LOG(ERR, LPM, "LPM rules_tbl allocation failed\n");
>   rte_free(lpm);
> + lpm = NULL;
>   rte_free(te);
>   goto exit;
>   }

Acked-by: Stephen Hemminger 


[dpdk-dev] [dpdk-announce] DPDK Summit China/Asia-Pacific 2016

2016-03-04 Thread O'Driscoll, Tim
We're delighted to announce that the first event in our DPDK Summit series for 
2016, for the China/Asia-Pacific region, will be held on Wednesday May 18th at 
the Renaissance Shanghai Yangtze Hotel, Shanghai, China.

The DPDK community in the China/Asia-Pacific region will meet face-to-face at 
this event and continue a dialogue on the future direction of packet processing 
in a variety of industry segments?including telecom, cloud, enterprise, 
security, financial services, and healthcare. A multitude of technical 
issues?facing the DPDK community will be discussed, with opportunities to learn 
from peers, DPDK architects and developers. This event provides a platform for 
personal networking in the DPDK community making us a productive, cohesive, and 
lively open source community!

Presentations at the event will be delivered mostly in Mandarin, but real-time 
translation into English will be available.

You can register for the event at: https://dpdksummit.com/us/en/registration

To submit an abstract for a presentation at this event, please 
contact?dpdk-china-event at intel.com.


Details of further events in the 2016 DPDK Summit series will follow later, but 
current plans include:

DPDK Summit USA: As discussed at one of our recent community calls, our aim is 
to hold this some time over the summer in the Bay Area. We're working with the 
Linux Foundation event planning team to identify possible dates and locations.

DPDK Userspace: Following the success of last year's event, we'll be holding 
this again in Dublin in October, probably on Oct 20th-21st. 



[dpdk-dev] [PATCH] lpm/lpm6: fix missing free of rules_tbl and lpm

2016-03-04 Thread Christian Ehrhardt
lpm6 autotests failed with the default alloc of 512M Memory.
While >=2500M was a workaround it became clear while debugging that it
had a leak.
One could see a lot of output like:
  LPM Test tests6[i]: FAIL
  LPM: LPM memory allocation failed

It turned out that in rte_lpm6_free
- lpm might not be freed if it didn't find a te (early return)
- lpm->rules_tbl was not freed ever

The first of the two also applies to lpm.
---
 lib/librte_lpm/rte_lpm.c  | 7 ++-
 lib/librte_lpm/rte_lpm6.c | 9 -
 2 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/lib/librte_lpm/rte_lpm.c b/lib/librte_lpm/rte_lpm.c
index cfdf959..941720d 100644
--- a/lib/librte_lpm/rte_lpm.c
+++ b/lib/librte_lpm/rte_lpm.c
@@ -236,13 +236,10 @@ rte_lpm_free(struct rte_lpm *lpm)
if (te->data == (void *) lpm)
break;
}
-   if (te == NULL) {
-   rte_rwlock_write_unlock(RTE_EAL_TAILQ_RWLOCK);
-   return;
+   if (te != NULL) {
+   TAILQ_REMOVE(lpm_list, te, next);
}

-   TAILQ_REMOVE(lpm_list, te, next);
-
rte_rwlock_write_unlock(RTE_EAL_TAILQ_RWLOCK);

rte_free(lpm);
diff --git a/lib/librte_lpm/rte_lpm6.c b/lib/librte_lpm/rte_lpm6.c
index 48931cc..5abfc78 100644
--- a/lib/librte_lpm/rte_lpm6.c
+++ b/lib/librte_lpm/rte_lpm6.c
@@ -278,15 +278,14 @@ rte_lpm6_free(struct rte_lpm6 *lpm)
if (te->data == (void *) lpm)
break;
}
-   if (te == NULL) {
-   rte_rwlock_write_unlock(RTE_EAL_TAILQ_RWLOCK);
-   return;
-   }

-   TAILQ_REMOVE(lpm_list, te, next);
+   if (te != NULL) {
+   TAILQ_REMOVE(lpm_list, te, next);
+   }

rte_rwlock_write_unlock(RTE_EAL_TAILQ_RWLOCK);

+   rte_free(lpm->rules_tbl);
rte_free(lpm);
rte_free(te);
 }
-- 
2.7.0



[dpdk-dev] [PATCH] config: remove duplicate configuration information

2016-03-04 Thread Wiles, Keith
>On 03/03/2016 08:37 PM, Thomas Monjalon wrote:
>>> --- a/config/defconfig_x86_64-native-bsdapp-clang
>>> +++ b/config/defconfig_x86_64-native-bsdapp-clang
>>> @@ -37,6 +37,7 @@ CONFIG_RTE_MACHINE="native"
>>>   CONFIG_RTE_ARCH="x86_64"
>>>   CONFIG_RTE_ARCH_X86_64=y
>>>   CONFIG_RTE_ARCH_X86=y
>>> +CONFIG_RTE_ARCH_64=y
>>>
>>>   CONFIG_RTE_TOOLCHAIN="clang"
>>>   CONFIG_RTE_TOOLCHAIN_CLANG=y
>>> diff --git a/config/defconfig_x86_64-native-bsdapp-gcc 
>>> b/config/defconfig_x86_64-native-bsdapp-gcc
>>> index 5a6a4e8..4ea4433 100644
>>> --- a/config/defconfig_x86_64-native-bsdapp-gcc
>>> +++ b/config/defconfig_x86_64-native-bsdapp-gcc
>>> @@ -37,6 +37,7 @@ CONFIG_RTE_MACHINE="native"
>>>   CONFIG_RTE_ARCH="x86_64"
>>>   CONFIG_RTE_ARCH_X86_64=y
>>>   CONFIG_RTE_ARCH_X86=y
>>> +CONFIG_RTE_ARCH_64=y
>>
>> It should be a totally separate patch.
>> And there are other places where it is missing.
>
>On a related note, perhaps the arch settings should be split to their 
>own files, eg common_x86_64, common_i686 and so on that the defconfig 
>files then include. That should eliminate things like missing 
>CONFIG_RTE_ARCH_64 fairly effectively, and further reduce the 
>duplication in the configs.
>
>I can send a patch to do that once the dust from the common_base move 
>settles if you like the idea.

+1, Sounds reasonable to me.
>
>   - Panu -
>


Regards,
Keith






[dpdk-dev] [PATCH] config: remove duplicate configuration information

2016-03-04 Thread Wiles, Keith
>
>> -Original Message-
>> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Thomas Monjalon
>> Sent: Thursday, March 3, 2016 6:38 PM
>> To: Wiles, Keith 
>> Cc: dev at dpdk.org
>> Subject: Re: [dpdk-dev] [PATCH] config: remove duplicate configuration
>> information
>> 
>> 2016-02-22 07:53, Keith Wiles:
>> > --- /dev/null
>> > +++ b/config/common_base
>> > +CONFIG_RTE_EAL_IGB_UIO=y
>> > +CONFIG_RTE_EAL_VFIO=y
>> 
>> These options should be disabled in the base file
>> and enabled in Linux.
>> 
>> > +CONFIG_RTE_LIBRTE_PMD_AF_PACKET=y
>> 
>> Idem, it should be disabled.
>> 
>> > +CONFIG_RTE_LIBRTE_POWER=y
>> 
>> Idem?
>> 
>> > +CONFIG_RTE_LIBRTE_KNI=y
>> 
>> Should be disabled.
>> 
>> > +CONFIG_RTE_LIBRTE_VHOST=y
>> 
>> Should be disabled.
>
>Any reason this should be disabled? It was changed to =Y in DPDK 2.1.
>
>It means updating scripts/build instructions to set =Y for OVS, no big
>deal but it might catch people out.

I do not see why it can not be disable, unless someone disagrees.
> 
>
>Kevin.
>
>> 
>> > --- a/config/common_bsdapp
>> > +++ b/config/common_bsdapp
>> > +# Compile Environment Abstraction Layer for linux, FreeBSD, OS X, ...
>> > +CONFIG_RTE_LIBRTE_EAL_BSDAPP=y
>> 
>> Please keep the original comment:
>> Compile Environment Abstraction Layer for BSD
>> 
>> > +# Compile Environment Abstraction Layer
>> 
>> Why this comment before disabling UIO and VFIO?
>> 
>> > --- a/config/common_linuxapp
>> > +++ b/config/common_linuxapp
>> > -##
>> > -## machine can define specific variables or action for a specific board
>> > -## RTE_MACHINE values are the directories in mk/machine/
>> > -##
>> > -#CONFIG_RTE_MACHINE="native"
>> > -#
>> > -##
>> > -## define the architecture we compile for.
>> > -## RTE_ARCH values are the directories in mk/arch/
>> > -##
>> > -#CONFIG_RTE_ARCH="x86_64"
>> > -#CONFIG_RTE_ARCH_X86_64=y
>> > -#CONFIG_RTE_ARCH_X86=y
>> > -#
>> > -##
>> > -## The compiler we use.
>> > -## RTE_TOOLCHAIN values are the directories in mk/toolchain/
>> > -##
>> > -#CONFIG_RTE_TOOLCHAIN="gcc"
>> > -#CONFIG_RTE_TOOLCHAIN_GCC=y
>> 
>> Maybe we should keep these comments in common_base?
>> I would remove the values and uncomment CONFIG_RTE_MACHINE, CONFIG_RTE_ARCH
>> and CONFIG_RTE_TOOLCHAIN.
>> 
>> > --- a/config/defconfig_x86_64-native-bsdapp-clang
>> > +++ b/config/defconfig_x86_64-native-bsdapp-clang
>> > @@ -37,6 +37,7 @@ CONFIG_RTE_MACHINE="native"
>> >  CONFIG_RTE_ARCH="x86_64"
>> >  CONFIG_RTE_ARCH_X86_64=y
>> >  CONFIG_RTE_ARCH_X86=y
>> > +CONFIG_RTE_ARCH_64=y
>> >
>> >  CONFIG_RTE_TOOLCHAIN="clang"
>> >  CONFIG_RTE_TOOLCHAIN_CLANG=y
>> > diff --git a/config/defconfig_x86_64-native-bsdapp-gcc
>> b/config/defconfig_x86_64-native-bsdapp-gcc
>> > index 5a6a4e8..4ea4433 100644
>> > --- a/config/defconfig_x86_64-native-bsdapp-gcc
>> > +++ b/config/defconfig_x86_64-native-bsdapp-gcc
>> > @@ -37,6 +37,7 @@ CONFIG_RTE_MACHINE="native"
>> >  CONFIG_RTE_ARCH="x86_64"
>> >  CONFIG_RTE_ARCH_X86_64=y
>> >  CONFIG_RTE_ARCH_X86=y
>> > +CONFIG_RTE_ARCH_64=y
>> 
>> It should be a totally separate patch.
>> And there are other places where it is missing.
>


Regards,
Keith






[dpdk-dev] [PATCH v3 5/6] virtio: Add support for qtest virtio-net PMD

2016-03-04 Thread Tan, Jianfeng
Hi Tetsuya,

On 3/4/2016 1:05 PM, Tetsuya Mukawa wrote:
> On 2016/03/04 11:18, Tan, Jianfeng wrote:
>> Hi Tetsuya,
>>
>> Seems that this patch is too long. Is it possible to split into
>> multiple commits?
> Hi Jianfeng,
>
> Sure, will do.
>
>> On 2/22/2016 4:17 PM, Tetsuya Mukawa wrote:
>>> The patch adds a new virtio-net PMD configuration that allows the PMD to
>>> work on host as if the PMD is in VM.
>>> Here is new configuration for virtio-net PMD.
>>>- CONFIG_RTE_VIRTIO_VDEV_QTEST
>>> To use this mode, EAL needs map all hugepages as one file. Also the file
>>> should be mapped between (1 << 31) and (1 << 44). And start address
>>> should be aligned by EAL memory size.
>>>
>>> To allocate like above, use below options.
>>>--single-file
>>>--range-virtaddr=0x8000-0x1000
>>>--align-memsize
>>> If a free regions isn't found, EAL will return error.
>>>
>>> To prepare virtio-net device on host, the users need to invoke QEMU
>>> process in special qtest mode. This mode is mainly used for testing QEMU
>>> devices from outer process. In this mode, no guest runs.
>>> Here is QEMU command line.
>>>
>>>$ qemu-system-x86_64 \
>>>-machine pc-i440fx-1.4,accel=qtest \
>>>-display none -qtest-log /dev/null \
>>>-qtest unix:/tmp/socket,server \
>>>-netdev type=tap,script=/etc/qemu-ifup,id=net0,queues=1 \
>>>-device
>>> virtio-net-pci,netdev=net0,mq=on,disable-modern=false,addr=3 \
>>>-chardev socket,id=chr1,path=/tmp/ivshmem,server \
>>>-device ivshmem,size=1G,chardev=chr1,vectors=1,addr=4
>>>
>>>* Should use qemu-2.5.1, or above.
>>>* QEMU process is needed per port.
>>>* virtio-1.0 device are only supported.
>>>* The vhost backends like vhost-net and vhost-user can be specified.
>>>* In most cases, just using above command is enough, but you can also
>>>  specify other QEMU virtio-net options.
>>>* Only checked "pc-i440fx-1.4" machine, but may work with other
>>>  machines.
>>>* Should not add "--enable-kvm" to QEMU command line.
>> Correct me if wrong: all control msgs go through qemu process, e.g.,
>> tx notifications and rx interrupts need follow frontend-qemu-backend
>> path. Question: qemu is started without --enable-kvm, as I understand,
>> ioeventfd, the basis of kickfd/callfd, will not be available. So how
>> does qemu kick backend or be kicked by backend?
> Actually, vhost-backend process will receive kickfd and callfd as -1.
> (Currently, we have a bug in librte_vhost, because the library treats -1
> as "not initialized state". But actually without "--enable-kvm", -1 will
> be set by qemu to initialize kickfd and callfd. I will send a patch for
> the issue with next patch series.)

Yes, we noticed the problem too: librte_vhost judges virtio_is_ready by 
whether both fds are set. But except that, what's kernel's way to do the 
judgement? In addition, it would be better to be a independent fix patch.

>
> In our case, virtio-net driver and vhost-backend driver are PMD. So we
> don't use kickfd and callfd, right?
>
> If you worried about vhost-net case, vhost-net kernel thread will work
> without ioeventfd and irqfd.
> In this case, virtio-net PMD can kick the vhost-net by accessing
> VIRTIO_PCI_QUEUE_NOTIFY register.
> (vhost-net doesn't need to kick virtio-net driver, because the driver is
> PMD.)

I ask this question because I think interrupt mode will help the 
scalability. Return to your solution, by accessing 
VIRTIO_PCI_QUEUE_NOTIFY register, virtio-net PMD can only wake up qemu, 
but how does qemu wakes up vhost-net under the case that kickfd = callfd 
= -1.

>
>>> After invoking QEMU, the PMD can connect to QEMU process using unix
>>> domain sockets. Over these sockets, virtio-net, ivshmem and piix3
>>> device in QEMU are probed by the PMD.
>>> Here is example of command line.
>>>
>>>$ testpmd -c f -n 1 -m 1024 --no-pci --single-file \
>>> --range-virtaddr=0x8000-0x1000 --align-memsize \
>>>
>>> --vdev="eth_qtest_virtio0,qtest=/tmp/socket,ivshmem=/tmp/ivshmem"\
>>> -- --disable-hw-vlan --txqflags=0xf00 -i
>>>
>>> Please specify same unix domain sockets and memory size in both QEMU
>>> and DPDK command lines like above.
>>> The share memory size should be power of 2, because ivshmem only
>>> accepts such memory size.
>>>
>>> Signed-off-by: Tetsuya Mukawa 
>>> ---
>>>config/common_linuxapp |1 +
>>>drivers/net/virtio/Makefile|4 +
>>>drivers/net/virtio/qtest.c | 1342
>>> 
>>>drivers/net/virtio/qtest.h |   65 ++
>>>drivers/net/virtio/virtio_ethdev.c |  383 +-
>>>drivers/net/virtio/virtio_pci.c|  364 +-
>>>drivers/net/virtio/virtio_pci.h|5 +-
>>>7 files changed, 2122 insertions(+), 42 deletions(-)
>>>create mode 100644 drivers/net/virtio/qtest.c
>>>create mode 100644 drivers/net/virtio/qtest.h
>>>

[dpdk-dev] [PATCH v3 5/6] virtio: Add support for qtest virtio-net PMD

2016-03-04 Thread Tetsuya Mukawa
On 2016/03/04 11:18, Tan, Jianfeng wrote:
> Hi Tetsuya,
>
> Seems that this patch is too long. Is it possible to split into
> multiple commits?

Hi Jianfeng,

Sure, will do.

>
> On 2/22/2016 4:17 PM, Tetsuya Mukawa wrote:
>> The patch adds a new virtio-net PMD configuration that allows the PMD to
>> work on host as if the PMD is in VM.
>> Here is new configuration for virtio-net PMD.
>>   - CONFIG_RTE_VIRTIO_VDEV_QTEST
>> To use this mode, EAL needs map all hugepages as one file. Also the file
>> should be mapped between (1 << 31) and (1 << 44). And start address
>> should be aligned by EAL memory size.
>>
>> To allocate like above, use below options.
>>   --single-file
>>   --range-virtaddr=0x8000-0x1000
>>   --align-memsize
>> If a free regions isn't found, EAL will return error.
>>
>> To prepare virtio-net device on host, the users need to invoke QEMU
>> process in special qtest mode. This mode is mainly used for testing QEMU
>> devices from outer process. In this mode, no guest runs.
>> Here is QEMU command line.
>>
>>   $ qemu-system-x86_64 \
>>   -machine pc-i440fx-1.4,accel=qtest \
>>   -display none -qtest-log /dev/null \
>>   -qtest unix:/tmp/socket,server \
>>   -netdev type=tap,script=/etc/qemu-ifup,id=net0,queues=1 \
>>   -device
>> virtio-net-pci,netdev=net0,mq=on,disable-modern=false,addr=3 \
>>   -chardev socket,id=chr1,path=/tmp/ivshmem,server \
>>   -device ivshmem,size=1G,chardev=chr1,vectors=1,addr=4
>>
>>   * Should use qemu-2.5.1, or above.
>>   * QEMU process is needed per port.
>>   * virtio-1.0 device are only supported.
>>   * The vhost backends like vhost-net and vhost-user can be specified.
>>   * In most cases, just using above command is enough, but you can also
>> specify other QEMU virtio-net options.
>>   * Only checked "pc-i440fx-1.4" machine, but may work with other
>> machines.
>>   * Should not add "--enable-kvm" to QEMU command line.
>
> Correct me if wrong: all control msgs go through qemu process, e.g.,
> tx notifications and rx interrupts need follow frontend-qemu-backend
> path. Question: qemu is started without --enable-kvm, as I understand,
> ioeventfd, the basis of kickfd/callfd, will not be available. So how
> does qemu kick backend or be kicked by backend?

Actually, vhost-backend process will receive kickfd and callfd as -1.
(Currently, we have a bug in librte_vhost, because the library treats -1
as "not initialized state". But actually without "--enable-kvm", -1 will
be set by qemu to initialize kickfd and callfd. I will send a patch for
the issue with next patch series.)

In our case, virtio-net driver and vhost-backend driver are PMD. So we
don't use kickfd and callfd, right?

If you worried about vhost-net case, vhost-net kernel thread will work
without ioeventfd and irqfd.
In this case, virtio-net PMD can kick the vhost-net by accessing
VIRTIO_PCI_QUEUE_NOTIFY register.
(vhost-net doesn't need to kick virtio-net driver, because the driver is
PMD.)

>
>>
>> After invoking QEMU, the PMD can connect to QEMU process using unix
>> domain sockets. Over these sockets, virtio-net, ivshmem and piix3
>> device in QEMU are probed by the PMD.
>> Here is example of command line.
>>
>>   $ testpmd -c f -n 1 -m 1024 --no-pci --single-file \
>>--range-virtaddr=0x8000-0x1000 --align-memsize \
>>   
>> --vdev="eth_qtest_virtio0,qtest=/tmp/socket,ivshmem=/tmp/ivshmem"\
>>-- --disable-hw-vlan --txqflags=0xf00 -i
>>
>> Please specify same unix domain sockets and memory size in both QEMU
>> and DPDK command lines like above.
>> The share memory size should be power of 2, because ivshmem only
>> accepts such memory size.
>>
>> Signed-off-by: Tetsuya Mukawa 
>> ---
>>   config/common_linuxapp |1 +
>>   drivers/net/virtio/Makefile|4 +
>>   drivers/net/virtio/qtest.c | 1342
>> 
>>   drivers/net/virtio/qtest.h |   65 ++
>>   drivers/net/virtio/virtio_ethdev.c |  383 +-
>>   drivers/net/virtio/virtio_pci.c|  364 +-
>>   drivers/net/virtio/virtio_pci.h|5 +-
>>   7 files changed, 2122 insertions(+), 42 deletions(-)
>>   create mode 100644 drivers/net/virtio/qtest.c
>>   create mode 100644 drivers/net/virtio/qtest.h
>>
>> diff --git a/config/common_linuxapp b/config/common_linuxapp
>> index 452f39c..f6e53bc 100644
>> --- a/config/common_linuxapp
>> +++ b/config/common_linuxapp
>> @@ -533,3 +533,4 @@ CONFIG_RTE_TEST_PMD_RECORD_BURST_STATS=n
>>   # Enable virtio support for container
>>   #
>>   CONFIG_RTE_VIRTIO_VDEV=y
>> +CONFIG_RTE_VIRTIO_VDEV_QTEST=y
>> diff --git a/drivers/net/virtio/Makefile b/drivers/net/virtio/Makefile
>> index ef920f9..6c11378 100644
>> --- a/drivers/net/virtio/Makefile
>> +++ b/drivers/net/virtio/Makefile
>> @@ -56,6 +56,10 @@ ifeq ($(CONFIG_RTE_VIRTIO_VDEV),y)
>>   SRCS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += vhost_embedded.c
>>   endif
>>   +ifeq 

[dpdk-dev] rte_mbuf's packet_type field

2016-03-04 Thread Zoltan Kiss


On 04/03/16 10:58, Ananyev, Konstantin wrote:
> Hi,
>
>> -Original Message-
>> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Olivier MATZ
>> Sent: Friday, March 04, 2016 9:29 AM
>> To: Zoltan Kiss; dev at dpdk.org
>> Subject: Re: [dpdk-dev] rte_mbuf's packet_type field
>>
>> Hi Zoltan,
>>
>> On 03/01/2016 06:15 PM, Zoltan Kiss wrote:
>>> I have a quick question about this field: how do I know if the
>>> underlying PMD supports a particular protocol parsing. Let's say I want
>>> to check for SCTP packets, looking at this field tells me EITHER the
>>> packet is SCTP (or not), OR that the hardware has no idea about SCTP. Is
>>> there a way to figure that support out?
>>
>> I'm not aware of such a feature. I guess you want to avoid to re-check
>> all protocols in software if the hardware supports some of them and
>> did not recognize them? In that case it may be interesting, but it would
>> result in a lot of feature flags.
>
> Nothing in the mainline, but there is a patches in-flight:
> http://dpdk.org/dev/patchwork/patch/10921/

Thanks, this would do it!

Regards,

Zoltan

>
> Konstantin
>
>>
>> Regards,
>> Olivier
>


[dpdk-dev] [PATCH v10 2/2] vhost: Add VHOST PMD

2016-03-04 Thread Tetsuya Mukawa
The patch introduces a new PMD. This PMD is implemented as thin wrapper
of librte_vhost. It means librte_vhost is also needed to compile the PMD.
The vhost messages will be handled only when a port is started. So start
a port first, then invoke QEMU.

The PMD has 2 parameters.
 - iface:  The parameter is used to specify a path to connect to a
   virtio-net device.
 - queues: The parameter is used to specify the number of the queues
   virtio-net device has.
   (Default: 1)

Here is an example.
$ ./testpmd -c f -n 4 --vdev 'eth_vhost0,iface=/tmp/sock0,queues=1' -- -i

To connect above testpmd, here is qemu command example.

$ qemu-system-x86_64 \

-chardev socket,id=chr0,path=/tmp/sock0 \
-netdev vhost-user,id=net0,chardev=chr0,vhostforce,queues=1 \
-device virtio-net-pci,netdev=net0,mq=on

Signed-off-by: Tetsuya Mukawa 
Acked-by: Ferruh Yigit 
---
 MAINTAINERS |   4 +
 config/common_linuxapp  |   6 +
 doc/guides/nics/index.rst   |   1 +
 doc/guides/rel_notes/release_16_04.rst  |   4 +
 drivers/net/Makefile|   1 +
 drivers/net/vhost/Makefile  |  62 ++
 drivers/net/vhost/rte_eth_vhost.c   | 916 
 drivers/net/vhost/rte_eth_vhost.h   | 109 
 drivers/net/vhost/rte_pmd_vhost_version.map |  10 +
 mk/rte.app.mk   |   6 +
 10 files changed, 1119 insertions(+)
 create mode 100644 drivers/net/vhost/Makefile
 create mode 100644 drivers/net/vhost/rte_eth_vhost.c
 create mode 100644 drivers/net/vhost/rte_eth_vhost.h
 create mode 100644 drivers/net/vhost/rte_pmd_vhost_version.map

diff --git a/MAINTAINERS b/MAINTAINERS
index 628bc05..2ec7cd4 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -352,6 +352,10 @@ Null PMD
 M: Tetsuya Mukawa 
 F: drivers/net/null/

+Vhost PMD
+M: Tetsuya Mukawa 
+F: drivers/net/vhost/
+
 Intel AES-NI Multi-Buffer
 M: Declan Doherty 
 F: drivers/crypto/aesni_mb/
diff --git a/config/common_linuxapp b/config/common_linuxapp
index 26df137..4915709 100644
--- a/config/common_linuxapp
+++ b/config/common_linuxapp
@@ -503,6 +503,12 @@ CONFIG_RTE_LIBRTE_VHOST_NUMA=n
 CONFIG_RTE_LIBRTE_VHOST_DEBUG=n

 #
+# Compile vhost PMD
+# To compile, CONFIG_RTE_LIBRTE_VHOST should be enabled.
+#
+CONFIG_RTE_LIBRTE_PMD_VHOST=y
+
+#
 #Compile Xen domain0 support
 #
 CONFIG_RTE_LIBRTE_XEN_DOM0=n
diff --git a/doc/guides/nics/index.rst b/doc/guides/nics/index.rst
index 8618114..6bb79b0 100644
--- a/doc/guides/nics/index.rst
+++ b/doc/guides/nics/index.rst
@@ -48,6 +48,7 @@ Network Interface Controller Drivers
 nfp
 szedata2
 virtio
+vhost
 vmxnet3
 pcap_ring

diff --git a/doc/guides/rel_notes/release_16_04.rst 
b/doc/guides/rel_notes/release_16_04.rst
index 9442018..feae36a 100644
--- a/doc/guides/rel_notes/release_16_04.rst
+++ b/doc/guides/rel_notes/release_16_04.rst
@@ -57,6 +57,10 @@ This section should contain new features added in this 
release. Sample format:

 * **Added vhost-user live migration support.**

+* **Added vhost PMD.**
+
+  Added virtual PMD that wraps librte_vhost.
+

 Resolved Issues
 ---
diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index 0c3393f..ceb2010 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -51,5 +51,6 @@ DIRS-$(CONFIG_RTE_LIBRTE_PMD_SZEDATA2) += szedata2
 DIRS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtio
 DIRS-$(CONFIG_RTE_LIBRTE_VMXNET3_PMD) += vmxnet3
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += xenvirt
+DIRS-$(CONFIG_RTE_LIBRTE_PMD_VHOST) += vhost

 include $(RTE_SDK)/mk/rte.subdir.mk
diff --git a/drivers/net/vhost/Makefile b/drivers/net/vhost/Makefile
new file mode 100644
index 000..f49a69b
--- /dev/null
+++ b/drivers/net/vhost/Makefile
@@ -0,0 +1,62 @@
+#   BSD LICENSE
+#
+#   Copyright (c) 2010-2016 Intel Corporation.
+#   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
+#   

[dpdk-dev] [PATCH v10 1/2] ethdev: Add a new event type to notify a queue state changed event

2016-03-04 Thread Tetsuya Mukawa
This patch adds a below event type.
 - RTE_ETH_EVENT_QUEUE_STATE_CHANGE
This event is used for notifying a queue state changed event.

Signed-off-by: Tetsuya Mukawa 
Acked-by: Ferruh Yigit 
---
 lib/librte_ether/rte_ethdev.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index d53e362..7817d4a 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -2661,6 +2661,8 @@ rte_eth_tx_burst(uint8_t port_id, uint16_t queue_id,
 enum rte_eth_event_type {
RTE_ETH_EVENT_UNKNOWN,  /**< unknown event type */
RTE_ETH_EVENT_INTR_LSC, /**< lsc interrupt event */
+   RTE_ETH_EVENT_QUEUE_STATE_CHANGE,
+   /**< queue state changed interrupt */
RTE_ETH_EVENT_MAX   /**< max value of this enum */
 };

-- 
2.1.4



[dpdk-dev] [PATCH] igb_uio: cast private data to correct struct type

2016-03-04 Thread Ananyev, Konstantin
> Subject: [dpdk-dev] [PATCH] igb_uio: cast private data to correct struct type
> 
> Fixes: af75078fece3 ("first public release")
> 
> This was working fine because addresses of two structs are same:
> 
> struct A {
>   struct B b;
> } a;
> 
> As above sample "a" and "b" has same address.
> 
> Now casting private data back to the correct struct type, to the one
> stored.
> 
> Signed-off-by: Ferruh Yigit 
> ---

Acked-by: Konstantin Ananyev 

> --
> 2.5.0



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

2016-03-04 Thread Tetsuya Mukawa
The patch introduces a new PMD. This PMD is implemented as thin wrapper
of librte_vhost.


PATCH v10 changes:
 - Rebase on latest master.
 - Fix DPDK version number(2.3 to 16.04)
 - Set port id to mbuf while receiving packets.

PATCH v9 changes:
 - Fix a null pointer access issue implemented in v8 patch.

PATCH v8 changes:
 - Manage ether devices list instead of internal structures list.
 - Remove needless NULL checking.
 - Replace "pthread_exit" to "return NULL".
 - Replace rte_panic to RTE_LOG, also add error handling.
 - Remove duplicated lines.
 - Remove needless casting.
 - Follow coding style.
 - Remove needless parenthesis.

PATCH v7 changes:
 - Remove needless parenthesis.
 - Add release note.
 - Remove needless line wraps.
 - Add null pointer check in vring_state_changed().
 - Free queue memory in eth_queue_release().
 - Fix wrong variable name.
 - Fix error handling code of eth_dev_vhost_create() and
   rte_pmd_vhost_devuninit().
 - Remove needless null checking from rte_pmd_vhost_devinit/devuninit().
 - Use port id to create mac address.
 - Add doxygen style comments in "rte_eth_vhost.h".
 - Fix wrong comment in "mk/rte.app.mk".

PATCH v6 changes:
 - Remove rte_vhost_driver_pmd_callback_registe().
 - Support link status interrupt.
 - Support queue state changed interrupt.
 - Add rte_eth_vhost_get_queue_event().
 - Support numa node detection when new device is connected.

PATCH v5 changes:
 - Rebase on latest master.
 - Fix RX/TX routine to count RX/TX bytes.
 - Fix RX/TX routine not to count as error packets if enqueue/dequeue
   cannot send all packets.
 - Fix if-condition checking for multiqueues.
 - Add "static" to pthread variable.
 - Fix format.
 - Change default behavior not to receive queueing event from driver.
 - Split the patch to separate rte_eth_vhost_portid2vdev().

PATCH v4 changes:
 - Rebase on latest DPDK tree.
 - Fix cording style.
 - Fix code not to invoke multiple messaging handling threads.
 - Fix code to handle vdev parameters correctly.
 - Remove needless cast.
 - Remove needless if-condition before rt_free().

PATCH v3 changes:
 - Rebase on latest matser
 - Specify correct queue_id in RX/TX function.

PATCH v2 changes:
 - Remove a below patch that fixes vhost library.
   The patch was applied as a separate patch.
   - vhost: fix crash with multiqueue enabled
 - Fix typos.
   (Thanks to Thomas, Monjalon)
 - Rebase on latest tree with above bernard's patches.

PATCH v1 changes:
 - Support vhost multiple queues.
 - Rebase on "remove pci driver from vdevs".
 - Optimize RX/TX functions.
 - Fix resource leaks.
 - Fix compile issue.
 - Add patch to fix vhost library.

RFC PATCH v3 changes:
 - Optimize performance.
   In RX/TX functions, change code to access only per core data.
 - Add below API to allow user to use vhost library APIs for a port managed
   by vhost PMD. There are a few limitations. See "rte_eth_vhost.h".
- rte_eth_vhost_portid2vdev()
   To support this functionality, vhost library is also changed.
   Anyway, if users doesn't use vhost PMD, can fully use vhost library APIs.
 - Add code to support vhost multiple queues.
   Actually, multiple queues functionality is not enabled so far.

RFC PATCH v2 changes:
 - Fix issues reported by checkpatch.pl
   (Thanks to Stephen Hemminger)



Tetsuya Mukawa (2):
  ethdev: Add a new event type to notify a queue state changed event
  vhost: Add VHOST PMD

 MAINTAINERS |   4 +
 config/common_linuxapp  |   6 +
 doc/guides/nics/index.rst   |   1 +
 doc/guides/rel_notes/release_16_04.rst  |   4 +
 drivers/net/Makefile|   1 +
 drivers/net/vhost/Makefile  |  62 ++
 drivers/net/vhost/rte_eth_vhost.c   | 916 
 drivers/net/vhost/rte_eth_vhost.h   | 109 
 drivers/net/vhost/rte_pmd_vhost_version.map |  10 +
 lib/librte_ether/rte_ethdev.h   |   2 +
 mk/rte.app.mk   |   6 +
 11 files changed, 1121 insertions(+)
 create mode 100644 drivers/net/vhost/Makefile
 create mode 100644 drivers/net/vhost/rte_eth_vhost.c
 create mode 100644 drivers/net/vhost/rte_eth_vhost.h
 create mode 100644 drivers/net/vhost/rte_pmd_vhost_version.map

-- 
2.1.4



[dpdk-dev] [PATCH v6] enic: receive path performance improvements

2016-03-04 Thread John Daley
This is a wholesale replacement of the Enic PMD receive path in order
to improve performance and code clarity. The changes are:
- Simplify and reduce code path length of receive function.
- Put most of the fast-path receive funtions in one file.
- Reduce the number of posted_index updates (pay attention to rx_free_thresh)
- Remove the unneeded container structure around the RQ mbuf ring
- Prefetch next Mbuf and descriptors while processing the current one
- Use a lookup table for converting CQ flags to mbuf flags.

Signed-off-by: John Daley 
---

Fixed compile warning when function parameter is marked as __rte_unused
but is then actually used in the function. Also, removed unused static inline
functions which clang compiler was warning about.

 drivers/net/enic/Makefile   |   1 +
 drivers/net/enic/base/vnic_rq.c |  99 ++-
 drivers/net/enic/base/vnic_rq.h | 147 +---
 drivers/net/enic/enic.h |  16 +-
 drivers/net/enic/enic_ethdev.c  |  27 ++-
 drivers/net/enic/enic_main.c| 321 ++
 drivers/net/enic/enic_res.h |  16 +-
 drivers/net/enic/enic_rx.c  | 378 
 8 files changed, 519 insertions(+), 486 deletions(-)
 create mode 100644 drivers/net/enic/enic_rx.c

diff --git a/drivers/net/enic/Makefile b/drivers/net/enic/Makefile
index f0ee093..f316274 100644
--- a/drivers/net/enic/Makefile
+++ b/drivers/net/enic/Makefile
@@ -53,6 +53,7 @@ VPATH += $(SRCDIR)/src
 #
 SRCS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += enic_ethdev.c
 SRCS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += enic_main.c
+SRCS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += enic_rx.c
 SRCS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += enic_clsf.c
 SRCS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += enic_res.c
 SRCS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += base/vnic_cq.c
diff --git a/drivers/net/enic/base/vnic_rq.c b/drivers/net/enic/base/vnic_rq.c
index 1441604..cb62c5e 100644
--- a/drivers/net/enic/base/vnic_rq.c
+++ b/drivers/net/enic/base/vnic_rq.c
@@ -35,77 +35,21 @@
 #include "vnic_dev.h"
 #include "vnic_rq.h"

-static int vnic_rq_alloc_bufs(struct vnic_rq *rq)
-{
-   struct vnic_rq_buf *buf;
-   unsigned int i, j, count = rq->ring.desc_count;
-   unsigned int blks = VNIC_RQ_BUF_BLKS_NEEDED(count);
-
-   for (i = 0; i < blks; i++) {
-   rq->bufs[i] = kzalloc(VNIC_RQ_BUF_BLK_SZ(count), GFP_ATOMIC);
-   if (!rq->bufs[i])
-   return -ENOMEM;
-   }
-
-   for (i = 0; i < blks; i++) {
-   buf = rq->bufs[i];
-   for (j = 0; j < VNIC_RQ_BUF_BLK_ENTRIES(count); j++) {
-   buf->index = i * VNIC_RQ_BUF_BLK_ENTRIES(count) + j;
-   buf->desc = (u8 *)rq->ring.descs +
-   rq->ring.desc_size * buf->index;
-   if (buf->index + 1 == count) {
-   buf->next = rq->bufs[0];
-   break;
-   } else if (j + 1 == VNIC_RQ_BUF_BLK_ENTRIES(count)) {
-   buf->next = rq->bufs[i + 1];
-   } else {
-   buf->next = buf + 1;
-   buf++;
-   }
-   }
-   }
-
-   rq->to_use = rq->to_clean = rq->bufs[0];
-
-   return 0;
-}
-
-int vnic_rq_mem_size(struct vnic_rq *rq, unsigned int desc_count,
-   unsigned int desc_size)
-{
-   int mem_size = 0;
-
-   mem_size += vnic_dev_desc_ring_size(>ring, desc_count, desc_size);
-
-   mem_size += VNIC_RQ_BUF_BLKS_NEEDED(rq->ring.desc_count) *
-   VNIC_RQ_BUF_BLK_SZ(rq->ring.desc_count);
-
-   return mem_size;
-}
-
 void vnic_rq_free(struct vnic_rq *rq)
 {
struct vnic_dev *vdev;
-   unsigned int i;

vdev = rq->vdev;

vnic_dev_free_desc_ring(vdev, >ring);

-   for (i = 0; i < VNIC_RQ_BUF_BLKS_MAX; i++) {
-   if (rq->bufs[i]) {
-   kfree(rq->bufs[i]);
-   rq->bufs[i] = NULL;
-   }
-   }
-
rq->ctrl = NULL;
 }

 int vnic_rq_alloc(struct vnic_dev *vdev, struct vnic_rq *rq, unsigned int 
index,
unsigned int desc_count, unsigned int desc_size)
 {
-   int err;
+   int rc;
char res_name[NAME_MAX];
static int instance;

@@ -121,18 +65,9 @@ int vnic_rq_alloc(struct vnic_dev *vdev, struct vnic_rq 
*rq, unsigned int index,
vnic_rq_disable(rq);

snprintf(res_name, sizeof(res_name), "%d-rq-%d", instance++, index);
-   err = vnic_dev_alloc_desc_ring(vdev, >ring, desc_count, desc_size,
+   rc = vnic_dev_alloc_desc_ring(vdev, >ring, desc_count, desc_size,
rq->socket_id, res_name);
-   if (err)
-   return err;
-
-   err = vnic_rq_alloc_bufs(rq);
-   if (err) {
-   vnic_rq_free(rq);
-   return err;
-   }
-
-   return 0;
+   return rc;
 }

 void 

[dpdk-dev] [PATCH v3 7/7] doc: add guide for new bnxt driver

2016-03-04 Thread Stephen Hurd
Initial guide for bnxt driver, documents current limitations and
provides information link.

Signed-off-by: Stephen Hurd 
---
 doc/guides/nics/bnxt.rst | 49 
 1 file changed, 49 insertions(+)
 create mode 100644 doc/guides/nics/bnxt.rst

diff --git a/doc/guides/nics/bnxt.rst b/doc/guides/nics/bnxt.rst
new file mode 100644
index 000..fdfa3a6
--- /dev/null
+++ b/doc/guides/nics/bnxt.rst
@@ -0,0 +1,49 @@
+..  BSD LICENSE
+Copyright 2016 Broadcom Limited
+
+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 Broadcom Limited 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.
+
+bnxt poll mode driver library
+=
+
+The bnxt poll mode library (**librte_pmd_bnxt**) implements support for
+**Broadcom NetXtreme? C-Series**.  These adapters support Standards-
+compliant 10/25/50Gbps 30MPPS full-duplex throughput.
+
+Information about this family of adapters can be found in the 
+`NetXtreme? Brand section 
`_
+of the `Broadcom web site `_.
+
+Limitations
+---
+
+With the current driver, allocated mbufs must be large enough to hold
+the entire received frame.  If the mbufs are not large enough, the
+packets will be dropped.  This is most limiting when jumbo frames are
+used.
+
+SR-IOV is not supported.
-- 
1.9.1



[dpdk-dev] [PATCH v3 6/7] doc: Add bnxt to overview table

2016-03-04 Thread Stephen Hurd
Signed-off-by: Stephen Hurd 
---
 doc/guides/nics/overview.rst | 64 ++--
 1 file changed, 32 insertions(+), 32 deletions(-)

diff --git a/doc/guides/nics/overview.rst b/doc/guides/nics/overview.rst
index d4c6ff4..e606bdf 100644
--- a/doc/guides/nics/overview.rst
+++ b/doc/guides/nics/overview.rst
@@ -74,38 +74,38 @@ Most of these differences are summarized below.

 .. table:: Features availability in networking drivers

-    = = = = = = = = = = = = = = = = = = = = = = = = = = = 
= = = =
-   Feature  a b b b c e e i i i i i i i i i i f f m m m n n p r s 
v v v x
-f n n o x 1 n 4 4 4 4 g g x x x x m m l l p f u c i z 
i i m e
-p x x n g 0 i 0 0 0 0 b b g g g g 1 1 x x i p l a n e 
r r x n
-a 2 2 d b 0 c e e e e   v b b b b 0 0 4 5 p   l p g d 
t t n v
-c x x i e 0 . v v   f e e e e k k e a 
i i e i
-k   v n . f f   . v v   .   t 
o o t r
-e   f g .   .   . f f   .   a  
 . 3 t
-t   v   v   v   v   v   2  
 v
-e   e   e   e   e  
 e
-c   c   c   c   c  
 c
-    = = = = = = = = = = = = = = = = = = = = = = = = = = = 
= = = =
-   link status
+    = = = = = = = = = = = = = = = = = = = = = = = = = = = 
= = = = =
+   Feature  a b b b b c e e i i i i i i i i i i f f m m m n n p r 
s v v v x
+f n n n o x 1 n 4 4 4 4 g g x x x x m m l l p f u c i 
z i i m e
+p x x x n g 0 i 0 0 0 0 b b g g g g 1 1 x x i p l a n 
e r r x n
+a 2 2 t d b 0 c e e e e   v b b b b 0 0 4 5 p   l p g 
d t t n v
+c x x   i e 0 . v v   f e e e e k k e 
a i i e i
+k   v   n . f f   . v v   .   
t o o t r
+e   f   g .   .   . f f   .   
a   . 3 t
+t v   v   v   v   v   
2   v
+  e   e   e   e   e
   e
+  c   c   c   c   c
   c
+    = = = = = = = = = = = = = = = = = = = = = = = = = = = 
= = = = =
+   link statusX
link status event
Rx interrupt
-   queue start/stop
-   MTU update
-   jumbo frame
+   queue start/stop   X
+   MTU update X
+   jumbo frameX
scattered Rx
LRO
TSO
-   promiscuous mode
-   allmulticast mode
-   unicast MAC filter
-   multicast MAC filter
-   RSS hash
-   RSS key update
-   RSS reta update
+   promiscuous mode   X
+   allmulticast mode  X
+   unicast MAC filter X
+   multicast MAC filter   X
+   RSS hash   X
+   RSS key update X
+   RSS reta updateX
VMDq
SR-IOV
DCB
-   VLAN filter
+   VLAN filterX
ethertype filter
n-tuple filter
SYN filter
@@ -116,23 +116,23 @@ Most of these differences are summarized below.
flow control
rate limitation
traffic mirroring
-   CRC offload
+   CRC offloadX
VLAN offload
QinQ offload
-   L3 checksum offload
-   L4 checksum offload
+   L3 checksum offloadX
+   L4 checksum offloadX
inner L3 checksum
inner L4 checksum
packet type parsing
timesync
-   basic stats
+   basic statsX
extended stats
-   stats per queue
+   stats per queueX
EEPROM dump
registers dump
multiprocess aware
-   BSD nic_uio
-   Linux UIO
+   BSD nic_uioX
+   Linux UIO  X
Linux VFIO
other kdrv
ARMv7
@@ -140,7 +140,7 @@ Most of these differences are summarized below.
Power8
TILE-Gx
x86-32
-   x86-64
+   x86-64 X
usage doc
design doc
perf doc
-- 
1.9.1



[dpdk-dev] [PATCH v3 5/7] build: add bnxt PMD to build

2016-03-04 Thread Stephen Hurd
Signed-off-by: Stephen Hurd 
---
 config/common_bsdapp   | 5 +
 config/common_linuxapp | 5 +
 drivers/net/Makefile   | 1 +
 mk/rte.app.mk  | 1 +
 4 files changed, 12 insertions(+)

diff --git a/config/common_bsdapp b/config/common_bsdapp
index 696382c..f37c7bb 100644
--- a/config/common_bsdapp
+++ b/config/common_bsdapp
@@ -276,6 +276,11 @@ CONFIG_RTE_LIBRTE_VMXNET3_DEBUG_TX_FREE=n
 CONFIG_RTE_LIBRTE_VMXNET3_DEBUG_DRIVER=n

 #
+# Compile burst-oriented BNXT PMD driver
+#
+CONFIG_RTE_LIBRTE_BNXT_PMD=y
+
+#
 # Compile example software rings based PMD
 #
 CONFIG_RTE_LIBRTE_PMD_RING=y
diff --git a/config/common_linuxapp b/config/common_linuxapp
index f1638db..35f544b 100644
--- a/config/common_linuxapp
+++ b/config/common_linuxapp
@@ -280,6 +280,11 @@ CONFIG_RTE_LIBRTE_VMXNET3_DEBUG_TX_FREE=n
 CONFIG_RTE_LIBRTE_VMXNET3_DEBUG_DRIVER=n

 #
+# Compile burst-oriented BNXT PMD driver
+#
+CONFIG_RTE_LIBRTE_BNXT_PMD=y
+
+#
 # Compile example software rings based PMD
 #
 CONFIG_RTE_LIBRTE_PMD_RING=y
diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index 6e4497e..6f0d64b 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -41,6 +41,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_FM10K_PMD) += fm10k
 DIRS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += i40e
 DIRS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += ixgbe
 DIRS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += mlx4
+DIRS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += bnxt
 DIRS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += mlx5
 DIRS-$(CONFIG_RTE_LIBRTE_MPIPE_PMD) += mpipe
 DIRS-$(CONFIG_RTE_LIBRTE_NFP_PMD) += nfp
diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index 8ecab41..2b5153e 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -144,6 +144,7 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_I40E_PMD)   += 
-lrte_pmd_i40e
 _LDLIBS-$(CONFIG_RTE_LIBRTE_FM10K_PMD)  += -lrte_pmd_fm10k
 _LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD)  += -lrte_pmd_ixgbe
 _LDLIBS-$(CONFIG_RTE_LIBRTE_E1000_PMD)  += -lrte_pmd_e1000
+_LDLIBS-$(CONFIG_RTE_LIBRTE_BNXT_PMD)   += -lrte_pmd_bnxt
 _LDLIBS-$(CONFIG_RTE_LIBRTE_MLX4_PMD)   += -lrte_pmd_mlx4
 _LDLIBS-$(CONFIG_RTE_LIBRTE_MLX5_PMD)   += -lrte_pmd_mlx5
 _LDLIBS-$(CONFIG_RTE_LIBRTE_NFP_PMD)+= -lrte_pmd_nfp
-- 
1.9.1



[dpdk-dev] [PATCH v3 4/7] maintainers: claim drivers/net/bnxt

2016-03-04 Thread Stephen Hurd
Claim ownership of new drivers/net/bnxt driver.

Signed-off-by: Stephen Hurd 
---
 MAINTAINERS | 4 
 1 file changed, 4 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 628bc05..6ee6c3c 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -359,6 +359,10 @@ F: drivers/crypto/aesni_mb/
 Intel QuickAssist
 F: drivers/crypto/qat/

+Broadcom bnxt
+M: Stephen Hurd 
+F: drivers/net/bnxt/
+

 Packet processing
 -
-- 
1.9.1



[dpdk-dev] [PATCH v3 3/7] drivers/net/bnxt new driver for Broadcom bnxt

2016-03-04 Thread Stephen Hurd
New driver for Broadcom bnxt (NexXtreme C-series) devices.

Standards-compliant 10/25/50G support with 30MPPS full-duplex throughput
http://www.broadcom.com/press/release.php?id=s923886

Signed-off-by: Stephen Hurd 
---
v3:
* Fix incorrect format specifier compilation error on i686
  (PRIx64 instead of lx for uint64_t) on line 1337

 drivers/net/bnxt/Makefile |   79 ++
 drivers/net/bnxt/bnxt.h   |  217 
 drivers/net/bnxt/bnxt_cpr.c   |  138 +++
 drivers/net/bnxt/bnxt_cpr.h   |  117 ++
 drivers/net/bnxt/bnxt_ethdev.c| 1381 ++
 drivers/net/bnxt/bnxt_filter.c|  175 +++
 drivers/net/bnxt/bnxt_filter.h|   74 ++
 drivers/net/bnxt/bnxt_hwrm.c  | 1554 
 drivers/net/bnxt/bnxt_hwrm.h  |  105 ++
 drivers/net/bnxt/bnxt_irq.c   |  154 +++
 drivers/net/bnxt/bnxt_irq.h   |   51 +
 drivers/net/bnxt/bnxt_ring.c  |  306 +
 drivers/net/bnxt/bnxt_ring.h  |  104 ++
 drivers/net/bnxt/bnxt_rxq.c   |  383 ++
 drivers/net/bnxt/bnxt_rxq.h   |   75 ++
 drivers/net/bnxt/bnxt_rxr.c   |  369 ++
 drivers/net/bnxt/bnxt_rxr.h   |   73 ++
 drivers/net/bnxt/bnxt_stats.c |  190 +++
 drivers/net/bnxt/bnxt_stats.h |   44 +
 drivers/net/bnxt/bnxt_txq.c   |  164 +++
 drivers/net/bnxt/bnxt_txq.h   |   76 ++
 drivers/net/bnxt/bnxt_txr.c   |  326 +
 drivers/net/bnxt/bnxt_txr.h   |   71 ++
 drivers/net/bnxt/bnxt_vnic.c  |  285 +
 drivers/net/bnxt/bnxt_vnic.h  |   80 ++
 drivers/net/bnxt/hsi_struct_def_dpdk.h| 1832 +
 drivers/net/bnxt/rte_pmd_bnxt_version.map |4 +
 27 files changed, 8427 insertions(+)
 create mode 100644 drivers/net/bnxt/Makefile
 create mode 100644 drivers/net/bnxt/bnxt.h
 create mode 100644 drivers/net/bnxt/bnxt_cpr.c
 create mode 100644 drivers/net/bnxt/bnxt_cpr.h
 create mode 100644 drivers/net/bnxt/bnxt_ethdev.c
 create mode 100644 drivers/net/bnxt/bnxt_filter.c
 create mode 100644 drivers/net/bnxt/bnxt_filter.h
 create mode 100644 drivers/net/bnxt/bnxt_hwrm.c
 create mode 100644 drivers/net/bnxt/bnxt_hwrm.h
 create mode 100644 drivers/net/bnxt/bnxt_irq.c
 create mode 100644 drivers/net/bnxt/bnxt_irq.h
 create mode 100644 drivers/net/bnxt/bnxt_ring.c
 create mode 100644 drivers/net/bnxt/bnxt_ring.h
 create mode 100644 drivers/net/bnxt/bnxt_rxq.c
 create mode 100644 drivers/net/bnxt/bnxt_rxq.h
 create mode 100644 drivers/net/bnxt/bnxt_rxr.c
 create mode 100644 drivers/net/bnxt/bnxt_rxr.h
 create mode 100644 drivers/net/bnxt/bnxt_stats.c
 create mode 100644 drivers/net/bnxt/bnxt_stats.h
 create mode 100644 drivers/net/bnxt/bnxt_txq.c
 create mode 100644 drivers/net/bnxt/bnxt_txq.h
 create mode 100644 drivers/net/bnxt/bnxt_txr.c
 create mode 100644 drivers/net/bnxt/bnxt_txr.h
 create mode 100644 drivers/net/bnxt/bnxt_vnic.c
 create mode 100644 drivers/net/bnxt/bnxt_vnic.h
 create mode 100644 drivers/net/bnxt/hsi_struct_def_dpdk.h
 create mode 100644 drivers/net/bnxt/rte_pmd_bnxt_version.map

diff --git a/drivers/net/bnxt/Makefile b/drivers/net/bnxt/Makefile
new file mode 100644
index 000..74de642
--- /dev/null
+++ b/drivers/net/bnxt/Makefile
@@ -0,0 +1,79 @@
+#   BSD LICENSE
+#
+#   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+#   Copyright(c) 2014 6WIND S.A.
+#   Copyright(c) 2015 Broadcom 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, 

[dpdk-dev] [PATCH v3 2/7] lib/librte_eal: Add PCI IDs for Broadcom bnxt

2016-03-04 Thread Stephen Hurd
Add Broadcom Vendor ID and RTE_PCI_DEV_ID_DECL_BNXT() macro.
Add Device IDs for Broadcom bnxt devices.

Signed-off-by: Stephen Hurd 
---
 lib/librte_eal/common/include/rte_pci_dev_ids.h | 45 ++---
 1 file changed, 40 insertions(+), 5 deletions(-)

diff --git a/lib/librte_eal/common/include/rte_pci_dev_ids.h 
b/lib/librte_eal/common/include/rte_pci_dev_ids.h
index d088191..9a8f254 100644
--- a/lib/librte_eal/common/include/rte_pci_dev_ids.h
+++ b/lib/librte_eal/common/include/rte_pci_dev_ids.h
@@ -63,11 +63,11 @@
  * This file contains a list of the PCI device IDs recognised by DPDK, which
  * can be used to fill out an array of structures describing the devices.
  *
- * Currently four families of devices are recognised: those supported by the
- * IGB driver, by EM driver, those supported by the IXGBE driver, and by virtio
- * driver which is a para virtualization driver running in guest virtual 
machine.
- * The inclusion of these in an array built using this file depends on the
- * definition of
+ * Currently five families of devices are recognised: those supported by the
+ * IGB driver, by EM driver, those supported by the IXGBE driver, by BNXT
+ * driver, and by virtio driver which is a para virtualization driver running
+ * in guest virtual machine.  The inclusion of these in an array built using
+ * this file depends on the definition of
  * RTE_PCI_DEV_ID_DECL_EM
  * RTE_PCI_DEV_ID_DECL_IGB
  * RTE_PCI_DEV_ID_DECL_IGBVF
@@ -76,6 +76,7 @@
  * RTE_PCI_DEV_ID_DECL_I40E
  * RTE_PCI_DEV_ID_DECL_I40EVF
  * RTE_PCI_DEV_ID_DECL_VIRTIO
+ * RTE_PCI_DEV_ID_DECL_BNXT
  * at the time when this file is included.
  *
  * In order to populate an array, the user of this file must define this macro:
@@ -167,6 +168,15 @@
 #define PCI_VENDOR_ID_VMWARE 0x15AD
 #endif

+#ifndef PCI_VENDOR_ID_BROADCOM
+/** Vendor ID used by Broadcom devices */
+#define PCI_VENDOR_ID_BROADCOM 0x14E4
+#endif
+
+#ifndef RTE_PCI_DEV_ID_DECL_BNXT
+#define RTE_PCI_DEV_ID_DECL_BNXT(vendor, dev)
+#endif
+
 #ifndef PCI_VENDOR_ID_CISCO
 /** Vendor ID used by Cisco VIC devices */
 #define PCI_VENDOR_ID_CISCO 0x1137
@@ -592,6 +602,30 @@ RTE_PCI_DEV_ID_DECL_VIRTIO(PCI_VENDOR_ID_QUMRANET, 
QUMRANET_DEV_ID_VIRTIO)

 RTE_PCI_DEV_ID_DECL_VMXNET3(PCI_VENDOR_ID_VMWARE, VMWARE_DEV_ID_VMXNET3)

+/** Broadcom BNXT devices **/
+
+#define BROADCOM_DEV_ID_57301  0x16c8
+#define BROADCOM_DEV_ID_57302  0x16c9
+#define BROADCOM_DEV_ID_57304_PF   0x16ca
+#define BROADCOM_DEV_ID_57304_VF   0x16cb
+#define BROADCOM_DEV_ID_57304_MF   0x16cc
+#define BROADCOM_DEV_ID_57402  0x16d0
+#define BROADCOM_DEV_ID_57404  0x16d1
+#define BROADCOM_DEV_ID_57406_PF   0x16d2
+#define BROADCOM_DEV_ID_57406_VF   0x16d3
+#define BROADCOM_DEV_ID_57406_MF   0x16d4
+
+RTE_PCI_DEV_ID_DECL_BNXT(PCI_VENDOR_ID_BROADCOM, BROADCOM_DEV_ID_57301)
+RTE_PCI_DEV_ID_DECL_BNXT(PCI_VENDOR_ID_BROADCOM, BROADCOM_DEV_ID_57302)
+RTE_PCI_DEV_ID_DECL_BNXT(PCI_VENDOR_ID_BROADCOM, BROADCOM_DEV_ID_57304_PF)
+RTE_PCI_DEV_ID_DECL_BNXT(PCI_VENDOR_ID_BROADCOM, BROADCOM_DEV_ID_57304_VF)
+RTE_PCI_DEV_ID_DECL_BNXT(PCI_VENDOR_ID_BROADCOM, BROADCOM_DEV_ID_57304_MF)
+RTE_PCI_DEV_ID_DECL_BNXT(PCI_VENDOR_ID_BROADCOM, BROADCOM_DEV_ID_57402)
+RTE_PCI_DEV_ID_DECL_BNXT(PCI_VENDOR_ID_BROADCOM, BROADCOM_DEV_ID_57404)
+RTE_PCI_DEV_ID_DECL_BNXT(PCI_VENDOR_ID_BROADCOM, BROADCOM_DEV_ID_57406_PF)
+RTE_PCI_DEV_ID_DECL_BNXT(PCI_VENDOR_ID_BROADCOM, BROADCOM_DEV_ID_57406_VF)
+RTE_PCI_DEV_ID_DECL_BNXT(PCI_VENDOR_ID_BROADCOM, BROADCOM_DEV_ID_57406_MF)
+
 /*** Virtual FM10K devices from fm10k_type.h ***/

 #define FM10K_DEV_ID_VF   0x15A5
@@ -665,5 +699,6 @@ RTE_PCI_DEV_ID_DECL_BNX2X(PCI_VENDOR_ID_BROADCOM, 
BNX2X_DEV_ID_57840_MF)
 #undef RTE_PCI_DEV_ID_DECL_I40EVF
 #undef RTE_PCI_DEV_ID_DECL_VIRTIO
 #undef RTE_PCI_DEV_ID_DECL_VMXNET3
+#undef RTE_PCI_DEV_ID_DECL_BNXT
 #undef RTE_PCI_DEV_ID_DECL_FM10K
 #undef RTE_PCI_DEV_ID_DECL_FM10KVF
-- 
1.9.1



[dpdk-dev] [PATCH v3 1/7] lib/librte_ether: Add 2/2.5/25/50Gbps link speeds

2016-03-04 Thread Stephen Hurd
Add additional ETH_LINK_SPEED_* macros for 2, 2.5, 25, and 50 Gbps links

Signed-off-by: Stephen Hurd 
---
 lib/librte_ether/rte_ethdev.h | 4 
 1 file changed, 4 insertions(+)

diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 16da821..cb40bbb 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -254,10 +254,14 @@ struct rte_eth_link {
 #define ETH_LINK_SPEED_10   10  /**< 10 megabits/second. */
 #define ETH_LINK_SPEED_100  100 /**< 100 megabits/second. */
 #define ETH_LINK_SPEED_1000 1000/**< 1 gigabits/second. */
+#define ETH_LINK_SPEED_2000 2000/**< 2 gigabits/second. */
+#define ETH_LINK_SPEED_2500 2500/**< 2.5 gigabits/second. */
 #define ETH_LINK_SPEED_11   /**< 10 gigabits/second. */
 #define ETH_LINK_SPEED_10G  1   /**< alias of 10 gigabits/second. */
 #define ETH_LINK_SPEED_20G  2   /**< 20 gigabits/second. */
+#define ETH_LINK_SPEED_25G  25000  /**< 25 gigabits/second. */
 #define ETH_LINK_SPEED_40G  4   /**< 40 gigabits/second. */
+#define ETH_LINK_SPEED_50G  5   /**< 50 gigabits/second. */

 #define ETH_LINK_AUTONEG_DUPLEX 0   /**< Auto-negotiate duplex. */
 #define ETH_LINK_HALF_DUPLEX1   /**< Half-duplex connection. */
-- 
1.9.1



[dpdk-dev] [PATCH v3 0/7] drivers/net/bnxt: new Broadcom bnxt driver

2016-03-04 Thread Stephen Hurd
New driver for Broadcom NetXtreme-C family of controllers and cards
capable of up to 50Gbps link with 30Mpps throughput.

v2:
* Split into multiple patches
* Add nic guide
* Add features in overview.rst

v3:
* Fix incorrect format specifier compilation error on i686
  (PRIx64 instead of lx for uint64_t)

Stephen Hurd (7):
  lib/librte_ether: Add 2/2.5/25/50Gbps link speeds
  lib/librte_eal: Add PCI IDs for Broadcom bnxt
  drivers/net/bnxt new driver for Broadcom bnxt
  maintainers: claim drivers/net/bnxt
  build: add bnxt PMD to build
  doc: Add bnxt to overview table
  doc: add guide for new bnxt driver

 MAINTAINERS |4 +
 config/common_bsdapp|5 +
 config/common_linuxapp  |5 +
 doc/guides/nics/bnxt.rst|   49 +
 doc/guides/nics/overview.rst|   64 +-
 drivers/net/Makefile|1 +
 drivers/net/bnxt/Makefile   |   79 +
 drivers/net/bnxt/bnxt.h |  217 +++
 drivers/net/bnxt/bnxt_cpr.c |  138 ++
 drivers/net/bnxt/bnxt_cpr.h |  117 ++
 drivers/net/bnxt/bnxt_ethdev.c  | 1381 +
 drivers/net/bnxt/bnxt_filter.c  |  175 +++
 drivers/net/bnxt/bnxt_filter.h  |   74 +
 drivers/net/bnxt/bnxt_hwrm.c| 1554 +++
 drivers/net/bnxt/bnxt_hwrm.h|  105 ++
 drivers/net/bnxt/bnxt_irq.c |  154 ++
 drivers/net/bnxt/bnxt_irq.h |   51 +
 drivers/net/bnxt/bnxt_ring.c|  306 
 drivers/net/bnxt/bnxt_ring.h|  104 ++
 drivers/net/bnxt/bnxt_rxq.c |  383 +
 drivers/net/bnxt/bnxt_rxq.h |   75 +
 drivers/net/bnxt/bnxt_rxr.c |  369 +
 drivers/net/bnxt/bnxt_rxr.h |   73 +
 drivers/net/bnxt/bnxt_stats.c   |  190 +++
 drivers/net/bnxt/bnxt_stats.h   |   44 +
 drivers/net/bnxt/bnxt_txq.c |  164 ++
 drivers/net/bnxt/bnxt_txq.h |   76 +
 drivers/net/bnxt/bnxt_txr.c |  326 
 drivers/net/bnxt/bnxt_txr.h |   71 +
 drivers/net/bnxt/bnxt_vnic.c|  285 
 drivers/net/bnxt/bnxt_vnic.h|   80 +
 drivers/net/bnxt/hsi_struct_def_dpdk.h  | 1832 +++
 drivers/net/bnxt/rte_pmd_bnxt_version.map   |4 +
 lib/librte_eal/common/include/rte_pci_dev_ids.h |   45 +-
 lib/librte_ether/rte_ethdev.h   |4 +
 mk/rte.app.mk   |1 +
 36 files changed, 8568 insertions(+), 37 deletions(-)
 create mode 100644 doc/guides/nics/bnxt.rst
 create mode 100644 drivers/net/bnxt/Makefile
 create mode 100644 drivers/net/bnxt/bnxt.h
 create mode 100644 drivers/net/bnxt/bnxt_cpr.c
 create mode 100644 drivers/net/bnxt/bnxt_cpr.h
 create mode 100644 drivers/net/bnxt/bnxt_ethdev.c
 create mode 100644 drivers/net/bnxt/bnxt_filter.c
 create mode 100644 drivers/net/bnxt/bnxt_filter.h
 create mode 100644 drivers/net/bnxt/bnxt_hwrm.c
 create mode 100644 drivers/net/bnxt/bnxt_hwrm.h
 create mode 100644 drivers/net/bnxt/bnxt_irq.c
 create mode 100644 drivers/net/bnxt/bnxt_irq.h
 create mode 100644 drivers/net/bnxt/bnxt_ring.c
 create mode 100644 drivers/net/bnxt/bnxt_ring.h
 create mode 100644 drivers/net/bnxt/bnxt_rxq.c
 create mode 100644 drivers/net/bnxt/bnxt_rxq.h
 create mode 100644 drivers/net/bnxt/bnxt_rxr.c
 create mode 100644 drivers/net/bnxt/bnxt_rxr.h
 create mode 100644 drivers/net/bnxt/bnxt_stats.c
 create mode 100644 drivers/net/bnxt/bnxt_stats.h
 create mode 100644 drivers/net/bnxt/bnxt_txq.c
 create mode 100644 drivers/net/bnxt/bnxt_txq.h
 create mode 100644 drivers/net/bnxt/bnxt_txr.c
 create mode 100644 drivers/net/bnxt/bnxt_txr.h
 create mode 100644 drivers/net/bnxt/bnxt_vnic.c
 create mode 100644 drivers/net/bnxt/bnxt_vnic.h
 create mode 100644 drivers/net/bnxt/hsi_struct_def_dpdk.h
 create mode 100644 drivers/net/bnxt/rte_pmd_bnxt_version.map

-- 
1.9.1



[dpdk-dev] [PATCH v2 2/2] drivers/net/vmxnet3: add ethdev functions

2016-03-04 Thread Stephen Hemminger
On Fri,  4 Mar 2016 15:25:24 +
Remy Horton  wrote:

> Implements driver support for setting of MAC address.
> 
> Signed-off-by: Remy Horton 
> ---
>  doc/guides/rel_notes/release_16_04.rst |  4 
>  drivers/net/vmxnet3/vmxnet3_ethdev.c   | 19 +++
>  2 files changed, 23 insertions(+)
> 
> diff --git a/doc/guides/rel_notes/release_16_04.rst 
> b/doc/guides/rel_notes/release_16_04.rst
> index 4e0112e..39db674 100644
> --- a/doc/guides/rel_notes/release_16_04.rst
> +++ b/doc/guides/rel_notes/release_16_04.rst
> @@ -62,6 +62,10 @@ This section should contain new features added in this 
> release. Sample format:
>Implemented driver functions for Register dumping, EEPROM dumping, and
>setting of MAC address.
>  
> +* **vmxnet3: Added ethdev support functions.**
> +
> +  Implemented driver functionality for setting MAC address.
> +
>  
>  Resolved Issues
>  ---
> diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c 
> b/drivers/net/vmxnet3/vmxnet3_ethdev.c
> index c363bf6..bc83524 100644
> --- a/drivers/net/vmxnet3/vmxnet3_ethdev.c
> +++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c
> @@ -91,6 +91,8 @@ static int vmxnet3_dev_vlan_filter_set(struct rte_eth_dev 
> *dev,
>  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);
> +static void vmxnet3_mac_addr_set(struct rte_eth_dev *dev,
> +  struct ether_addr *mac_addr);
>  
>  #if PROCESS_SYS_EVENTS == 1
>  static void vmxnet3_process_events(struct vmxnet3_hw *);
> @@ -124,6 +126,7 @@ static const struct eth_dev_ops vmxnet3_eth_dev_ops = {
>   .rx_queue_release = vmxnet3_dev_rx_queue_release,
>   .tx_queue_setup   = vmxnet3_dev_tx_queue_setup,
>   .tx_queue_release = vmxnet3_dev_tx_queue_release,
> + .mac_addr_set = vmxnet3_mac_addr_set,
>  };
>  
>  static const struct rte_memzone *
> @@ -922,6 +925,22 @@ vmxnet3_process_events(struct vmxnet3_hw *hw)
>  }
>  #endif
>  
> +static void vmxnet3_mac_addr_set(struct rte_eth_dev *dev,
> +  struct ether_addr *mac_addr)
> +{
> + struct vmxnet3_hw *hw = dev->data->dev_private;
> + uint32_t mac_hi, mac_lo;
> +
> + if (!is_valid_assigned_ether_addr(mac_addr)) {
> + PMD_DRV_LOG(ERR, "Tried to set invalid MAC address.");
> + return;
> + }
> + memcpy(_lo, mac_addr, 4);
> + memcpy(_hi, mac_addr + 4, 2);
> + VMXNET3_WRITE_BAR1_REG(hw, VMXNET3_REG_MACL, mac_lo);
> + VMXNET3_WRITE_BAR1_REG(hw, VMXNET3_REG_MACH, mac_hi);
> +}
> +
>  static struct rte_driver rte_vmxnet3_driver = {
>   .type = PMD_PDEV,
>   .init = rte_vmxnet3_pmd_init,

The version I posted is simpler and reuses existing code paths.


[dpdk-dev] [PATCH] config: remove duplicate configuration information

2016-03-04 Thread Panu Matilainen
On 03/03/2016 08:37 PM, Thomas Monjalon wrote:
>> --- a/config/defconfig_x86_64-native-bsdapp-clang
>> +++ b/config/defconfig_x86_64-native-bsdapp-clang
>> @@ -37,6 +37,7 @@ CONFIG_RTE_MACHINE="native"
>>   CONFIG_RTE_ARCH="x86_64"
>>   CONFIG_RTE_ARCH_X86_64=y
>>   CONFIG_RTE_ARCH_X86=y
>> +CONFIG_RTE_ARCH_64=y
>>
>>   CONFIG_RTE_TOOLCHAIN="clang"
>>   CONFIG_RTE_TOOLCHAIN_CLANG=y
>> diff --git a/config/defconfig_x86_64-native-bsdapp-gcc 
>> b/config/defconfig_x86_64-native-bsdapp-gcc
>> index 5a6a4e8..4ea4433 100644
>> --- a/config/defconfig_x86_64-native-bsdapp-gcc
>> +++ b/config/defconfig_x86_64-native-bsdapp-gcc
>> @@ -37,6 +37,7 @@ CONFIG_RTE_MACHINE="native"
>>   CONFIG_RTE_ARCH="x86_64"
>>   CONFIG_RTE_ARCH_X86_64=y
>>   CONFIG_RTE_ARCH_X86=y
>> +CONFIG_RTE_ARCH_64=y
>
> It should be a totally separate patch.
> And there are other places where it is missing.

On a related note, perhaps the arch settings should be split to their 
own files, eg common_x86_64, common_i686 and so on that the defconfig 
files then include. That should eliminate things like missing 
CONFIG_RTE_ARCH_64 fairly effectively, and further reduce the 
duplication in the configs.

I can send a patch to do that once the dust from the common_base move 
settles if you like the idea.

- Panu -


[dpdk-dev] [PATCH v3] config: remove duplicate configuration information

2016-03-04 Thread Keith Wiles
In order to cleanup the configuration files some and reduce
the number of duplicate configuration information. Add a new
file called common_base which contains just about all of the
configuration lines in one place. Then have the common_bsdapp,
common_linuxapp files include this one file. Then in those OS
specific files add the delta configuration lines.

Signed-off-by: Keith Wiles 
---
 config/common_base | 519 +
 config/common_bsdapp   | 436 +
 config/common_linuxapp | 460 +--
 3 files changed, 528 insertions(+), 887 deletions(-)
 create mode 100644 config/common_base

diff --git a/config/common_base b/config/common_base
new file mode 100644
index 000..0d30cd0
--- /dev/null
+++ b/config/common_base
@@ -0,0 +1,519 @@
+#   BSD LICENSE
+#
+#   Copyright(c) 2010-2016 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.
+#
+
+#
+# The following three configs are for reference only and should be
+# enabled in the correct defconfig_XXX file(s).
+#
+
+
+#
+# machine can define specific variables or action for a specific board
+# RTE_MACHINE values are the directories in mk/machine/
+#
+CONFIG_RTE_MACHINE=
+
+#
+# define the architecture we compile for.
+# RTE_ARCH values are the directories in mk/arch/
+#
+CONFIG_RTE_ARCH=
+
+#
+# The compiler we use.
+# RTE_TOOLCHAIN values are the directories in mk/toolchain/
+#
+CONFIG_RTE_TOOLCHAIN=
+
+
+
+#
+# Use intrinsics or assembly code for key routines
+#
+CONFIG_RTE_FORCE_INTRINSICS=n
+
+#
+# Machine forces strict alignment constraints.
+#
+CONFIG_RTE_ARCH_STRICT_ALIGN=n
+
+#
+# Compile to share library
+#
+CONFIG_RTE_BUILD_SHARED_LIB=n
+
+#
+# Use newest code breaking previous ABI
+#
+CONFIG_RTE_NEXT_ABI=y
+
+#
+# Machine's cache line size
+#
+CONFIG_RTE_CACHE_LINE_SIZE=64
+
+#
+# Compile Environment Abstraction Layer
+#
+CONFIG_RTE_LIBRTE_EAL=y
+CONFIG_RTE_MAX_LCORE=128
+CONFIG_RTE_MAX_NUMA_NODES=8
+CONFIG_RTE_MAX_MEMSEG=256
+CONFIG_RTE_MAX_MEMZONE=2560
+CONFIG_RTE_MAX_TAILQ=32
+CONFIG_RTE_LOG_LEVEL=8
+CONFIG_RTE_LOG_HISTORY=256
+CONFIG_RTE_LIBEAL_USE_HPET=n
+CONFIG_RTE_EAL_ALLOW_INV_SOCKET_ID=n
+CONFIG_RTE_EAL_ALWAYS_PANIC_ON_ERROR=n
+CONFIG_RTE_EAL_IGB_UIO=n
+CONFIG_RTE_EAL_VFIO=n
+CONFIG_RTE_MALLOC_DEBUG=n
+
+# Default driver path (or "" to disable)
+CONFIG_RTE_EAL_PMD_PATH=""
+
+#
+# Special configurations in PCI Config Space for high performance
+#
+CONFIG_RTE_PCI_CONFIG=n
+CONFIG_RTE_PCI_EXTENDED_TAG=""
+CONFIG_RTE_PCI_MAX_READ_REQUEST_SIZE=0
+
+#
+# Compile Environment Abstraction Layer to support Vmware TSC map
+#
+CONFIG_RTE_LIBRTE_EAL_VMWARE_TSC_MAP_SUPPORT=y
+
+#
+# Compile the argument parser library
+#
+CONFIG_RTE_LIBRTE_KVARGS=y
+
+#
+# Compile generic ethernet library
+#
+CONFIG_RTE_LIBRTE_ETHER=y
+CONFIG_RTE_LIBRTE_ETHDEV_DEBUG=n
+CONFIG_RTE_MAX_ETHPORTS=32
+CONFIG_RTE_MAX_QUEUES_PER_PORT=1024
+CONFIG_RTE_LIBRTE_IEEE1588=n
+CONFIG_RTE_ETHDEV_QUEUE_STAT_CNTRS=16
+CONFIG_RTE_ETHDEV_RXTX_CALLBACKS=y
+
+#
+# Support NIC bypass logic
+#
+CONFIG_RTE_NIC_BYPASS=n
+
+#
+# Compile burst-oriented IGB & EM PMD drivers
+#
+CONFIG_RTE_LIBRTE_EM_PMD=y
+CONFIG_RTE_LIBRTE_IGB_PMD=y
+CONFIG_RTE_LIBRTE_E1000_DEBUG_INIT=n
+CONFIG_RTE_LIBRTE_E1000_DEBUG_RX=n
+CONFIG_RTE_LIBRTE_E1000_DEBUG_TX=n
+CONFIG_RTE_LIBRTE_E1000_DEBUG_TX_FREE=n

[dpdk-dev] FOSDEM videos

2016-03-04 Thread Thomas Monjalon
The videos of the conference FOSDEM 2016 are available.
This is my list of DPDK related talks:

* Saying again that "Userspace is not slow"
https://fosdem.org/2016/schedule/event/linux_petascale_storage/

* OPNFV
https://fosdem.org/2016/schedule/event/telco_on_free_software/

* DPDK and OVS
https://fosdem.org/2016/schedule/event/n00b_dpdk/
https://fosdem.org/2016/schedule/event/ovs_dpdk/

* Low latency switch with DPDK
https://fosdem.org/2016/schedule/event/virt_iaas_real_time_cloud/

* MoonGen
https://fosdem.org/2016/schedule/event/moongen/



[dpdk-dev] ixgbe TX function selection

2016-03-04 Thread Zoltan Kiss


On 04/03/16 01:47, Lu, Wenzhuo wrote:
> Hi Zoltan,
>
>> -Original Message-
>> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Zoltan Kiss
>> Sent: Wednesday, March 2, 2016 3:19 AM
>> To: dev at dpdk.org
>> Subject: [dpdk-dev] ixgbe TX function selection
>>
>> Hi,
>>
>> I've noticed that ixgbe_set_tx_function() selects the non-SG function even if
> Thanks for let us know the problem. But I don't catch your point. Do you 
> really mean TX here? After a quick look at the code, I don?t find the 
> SG/non-SG functions for TX. Do I miss something?

The simple code path doesn't handle multisegmented packets. 
ixgbe_txq_vec_setup() and ixgbe_xmit_pkts_simple() doesn't even check 
the next pointer of the mbuf, just put the first one on the descriptor 
ring, and when TX completion happens, the memory is leaked because it 
just sets ->next to NULL, and calls rte_mempool_put[_bulk]
ixgbe_xmit_pkts() puts all the segments on the descriptor ring, 
therefore when the descriptors are released they are released as well.
This is what these functions supposed to do, but my point is it's very 
easy to send a multisegmented packet to the simple code path.


>
>> (dev->data->scattered_rx == 1). That seems a bit dangerous, as you can turn
>> that on inadvertently when you don't set max_rx_pkt_len and buffer size in
>> certain ways. I've learnt it in the hard way, as my segmented packets were
>> leaking memory on the TX path, which doesn't cries if you send out segmented
>> packets.
> Which one will cause problem? SG or non-SG packets? And where does the memory 
> leak happen?
>
>> How should this case be treated? Assert on the non-SG TX side for the 'next'
>> pointer? Or turning on SG if RX has it? It doesn't seem to be a solid way as 
>> other
>> interfaces still can have SG turned on.
>>
>> Regards,
>>
>> Zoltan


[dpdk-dev] [PATCH v2] igb_uio: use macros for array size calculation

2016-03-04 Thread Ananyev, Konstantin


> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Ferruh Yigit
> Sent: Friday, March 04, 2016 11:21 AM
> To: dev at dpdk.org
> Subject: [dpdk-dev] [PATCH v2] igb_uio: use macros for array size calculation
> 
> Minor code cleanup.
> Remove array size calculations and remove unnecessary assignment.
> 
> Signed-off-by: Ferruh Yigit 
> ---

Acked-by: Konstantin Ananyev 

>  lib/librte_eal/linuxapp/igb_uio/igb_uio.c | 8 
>  1 file changed, 4 insertions(+), 4 deletions(-)


[dpdk-dev] [PATCH] config: remove duplicate configuration information

2016-03-04 Thread Panu Matilainen
On 03/04/2016 11:28 AM, Traynor, Kevin wrote:
>
>> -Original Message-
>> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Thomas Monjalon
>> Sent: Thursday, March 3, 2016 6:38 PM
>> To: Wiles, Keith 
>> Cc: dev at dpdk.org
>> Subject: Re: [dpdk-dev] [PATCH] config: remove duplicate configuration
>> information
>>
>> 2016-02-22 07:53, Keith Wiles:
>>> --- /dev/null
>>> +++ b/config/common_base
>>> +CONFIG_RTE_EAL_IGB_UIO=y
>>> +CONFIG_RTE_EAL_VFIO=y
>>
>> These options should be disabled in the base file
>> and enabled in Linux.
^

>>
>>> +CONFIG_RTE_LIBRTE_PMD_AF_PACKET=y
>>
>> Idem, it should be disabled.
>>
>>> +CONFIG_RTE_LIBRTE_POWER=y
>>
>> Idem?
>>
>>> +CONFIG_RTE_LIBRTE_KNI=y
>>
>> Should be disabled.
>>
>>> +CONFIG_RTE_LIBRTE_VHOST=y
>>
>> Should be disabled.
>
> Any reason this should be disabled? It was changed to =Y in DPDK 2.1.

That's what I first thought too, but I think Thomas meant "disable in 
common_base, enable in Linux config" for all these.

- Panu -



[dpdk-dev] [PATCH] config: remove duplicate configuration information

2016-03-04 Thread Panu Matilainen
On 03/03/2016 08:37 PM, Thomas Monjalon wrote:
> 2016-02-22 07:53, Keith Wiles:
>> --- /dev/null
>> +++ b/config/common_base
>> +CONFIG_RTE_EAL_IGB_UIO=y
>> +CONFIG_RTE_EAL_VFIO=y
>
> These options should be disabled in the base file
> and enabled in Linux.
>
>> +CONFIG_RTE_LIBRTE_PMD_AF_PACKET=y
>
> Idem, it should be disabled.
>
>> +CONFIG_RTE_LIBRTE_POWER=y
>
> Idem?
>
>> +CONFIG_RTE_LIBRTE_KNI=y
>
> Should be disabled.

Ditto for CONFIG_RTE_KNI_KMOD.

- Panu -



[dpdk-dev] [PATCH] lpm6: fix use after free of lpm in rte_lpm6_create

2016-03-04 Thread Christian Ehrhardt
In certain autotests lpm->max_rules turned out to be non initialized.
That was caused by a failing allocation for lpm->rules_tbl in rte_lpm6_create.
It then left the function via goto exit with lpm freed, but still a pointer
value being set.

In case of an allocation failure it resets lpm to NULL now, to avoid the
upper layers operate on that already freed memory.
Along that is also makes the RTE_LOG message of the failed allocation unique.
---
 lib/librte_lpm/rte_lpm6.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/librte_lpm/rte_lpm6.c b/lib/librte_lpm/rte_lpm6.c
index 6c2b293..48931cc 100644
--- a/lib/librte_lpm/rte_lpm6.c
+++ b/lib/librte_lpm/rte_lpm6.c
@@ -206,8 +206,9 @@ rte_lpm6_create(const char *name, int socket_id,
(size_t)rules_size, RTE_CACHE_LINE_SIZE, socket_id);

if (lpm->rules_tbl == NULL) {
-   RTE_LOG(ERR, LPM, "LPM memory allocation failed\n");
+   RTE_LOG(ERR, LPM, "LPM rules_tbl allocation failed\n");
rte_free(lpm);
+   lpm = NULL;
rte_free(te);
goto exit;
}
-- 
2.7.0



[dpdk-dev] [PATCH] config: remove duplicate configuration information

2016-03-04 Thread Thomas Monjalon
2016-03-04 09:58, Traynor, Kevin:
> From: Panu Matilainen [mailto:pmatilai at redhat.com]
> > On 03/04/2016 11:28 AM, Traynor, Kevin wrote:
> > > From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Thomas Monjalon
> > >> 2016-02-22 07:53, Keith Wiles:
> > >>> +CONFIG_RTE_LIBRTE_VHOST=y
> > >>
> > >> Should be disabled.
> > >
> > > Any reason this should be disabled? It was changed to =Y in DPDK 2.1.
> > 
> > That's what I first thought too, but I think Thomas meant "disable in
> > common_base, enable in Linux config" for all these.
> > 
> > - Panu -
> 
> Ah, ok - got it, that makes sense. thanks.

Yes, this patch should not change the default settings.
Just defining a common base without specific features.


[dpdk-dev] [PATCH v2] igb_uio: use macros for array size calculation

2016-03-04 Thread Ferruh Yigit
Minor code cleanup.
Remove array size calculations and remove unnecessary assignment.

Signed-off-by: Ferruh Yigit 
---
 lib/librte_eal/linuxapp/igb_uio/igb_uio.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/librte_eal/linuxapp/igb_uio/igb_uio.c 
b/lib/librte_eal/linuxapp/igb_uio/igb_uio.c
index 3374e44..a3ad912 100644
--- a/lib/librte_eal/linuxapp/igb_uio/igb_uio.c
+++ b/lib/librte_eal/linuxapp/igb_uio/igb_uio.c
@@ -58,7 +58,7 @@ struct rte_uio_pci_dev {
enum rte_intr_mode mode;
 };

-static char *intr_mode = NULL;
+static char *intr_mode;
 static enum rte_intr_mode igbuio_intr_mode_preferred = RTE_INTR_MODE_MSIX;

 /* sriov sysfs */
@@ -332,7 +332,7 @@ igbuio_pci_setup_iomem(struct pci_dev *dev, struct uio_info 
*info,
unsigned long addr, len;
void *internal_addr;

-   if (sizeof(info->mem) / sizeof(info->mem[0]) <= n)
+   if (n >= ARRAY_SIZE(info->mem))
return -EINVAL;

addr = pci_resource_start(dev, pci_bar);
@@ -357,7 +357,7 @@ igbuio_pci_setup_ioport(struct pci_dev *dev, struct 
uio_info *info,
 {
unsigned long addr, len;

-   if (sizeof(info->port) / sizeof(info->port[0]) <= n)
+   if (n >= ARRAY_SIZE(info->port))
return -EINVAL;

addr = pci_resource_start(dev, pci_bar);
@@ -402,7 +402,7 @@ igbuio_setup_bars(struct pci_dev *dev, struct uio_info 
*info)
iom = 0;
iop = 0;

-   for (i = 0; i != sizeof(bar_names) / sizeof(bar_names[0]); i++) {
+   for (i = 0; i < ARRAY_SIZE(bar_names); i++) {
if (pci_resource_len(dev, i) != 0 &&
pci_resource_start(dev, i) != 0) {
flags = pci_resource_flags(dev, i);
-- 
2.5.0



[dpdk-dev] [PATCH] config: add missing CONFIG_RTE_ARCH_64 configurations

2016-03-04 Thread Keith Wiles
Signed-off-by: Keith Wiles 
---
 config/defconfig_x86_64-native-bsdapp-clang | 1 +
 config/defconfig_x86_64-native-bsdapp-gcc   | 1 +
 2 files changed, 2 insertions(+)

diff --git a/config/defconfig_x86_64-native-bsdapp-clang 
b/config/defconfig_x86_64-native-bsdapp-clang
index d2baf2c..8b870b3 100644
--- a/config/defconfig_x86_64-native-bsdapp-clang
+++ b/config/defconfig_x86_64-native-bsdapp-clang
@@ -37,6 +37,7 @@ CONFIG_RTE_MACHINE="native"
 CONFIG_RTE_ARCH="x86_64"
 CONFIG_RTE_ARCH_X86_64=y
 CONFIG_RTE_ARCH_X86=y
+CONFIG_RTE_ARCH_64=y

 CONFIG_RTE_TOOLCHAIN="clang"
 CONFIG_RTE_TOOLCHAIN_CLANG=y
diff --git a/config/defconfig_x86_64-native-bsdapp-gcc 
b/config/defconfig_x86_64-native-bsdapp-gcc
index 5a6a4e8..4ea4433 100644
--- a/config/defconfig_x86_64-native-bsdapp-gcc
+++ b/config/defconfig_x86_64-native-bsdapp-gcc
@@ -37,6 +37,7 @@ CONFIG_RTE_MACHINE="native"
 CONFIG_RTE_ARCH="x86_64"
 CONFIG_RTE_ARCH_X86_64=y
 CONFIG_RTE_ARCH_X86=y
+CONFIG_RTE_ARCH_64=y

 CONFIG_RTE_TOOLCHAIN="gcc"
 CONFIG_RTE_TOOLCHAIN_GCC=y
-- 
2.7.0



[dpdk-dev] [PATCH v2] config: remove duplicate configuration information

2016-03-04 Thread Keith Wiles
In order to cleanup the configuration files some and reduce
the number of duplicate configuration information. Add a new
file called common_base which contains just about all of the
configuration lines in one place. Then have the common_bsdapp,
common_linuxapp files include this one file. Then in those OS
specific files add the delta configuration lines.

Signed-off-by: Keith Wiles 
---

v2 - split out ARCH_64 missing defines into new patch.
 Turned off linux specific items in common_base and enable them
 in common_linux file.

 config/common_base | 524 +
 config/common_bsdapp   | 436 +---
 config/common_linuxapp | 460 +--
 3 files changed, 533 insertions(+), 887 deletions(-)
 create mode 100644 config/common_base

diff --git a/config/common_base b/config/common_base
new file mode 100644
index 000..7ce0bd8
--- /dev/null
+++ b/config/common_base
@@ -0,0 +1,524 @@
+#   BSD LICENSE
+#
+#   Copyright(c) 2010-2016 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.
+#
+
+#
+# The following three configs are for reference only and should be
+# enabled in the correct defconfig_XXX file(s).
+#
+
+
+#
+# machine can define specific variables or action for a specific board
+# RTE_MACHINE values are the directories in mk/machine/
+#
+CONFIG_RTE_MACHINE=
+
+#
+# define the architecture we compile for.
+# RTE_ARCH values are the directories in mk/arch/
+#
+CONFIG_RTE_ARCH=
+
+#
+# The compiler we use.
+# RTE_TOOLCHAIN values are the directories in mk/toolchain/
+#
+CONFIG_RTE_TOOLCHAIN=
+
+
+
+#
+# Use intrinsics or assembly code for key routines
+#
+CONFIG_RTE_FORCE_INTRINSICS=n
+
+#
+# Machine forces strict alignment constraints.
+#
+CONFIG_RTE_ARCH_STRICT_ALIGN=n
+
+#
+# Compile to share library
+#
+CONFIG_RTE_BUILD_SHARED_LIB=n
+
+#
+# Combine to one single library
+#
+CONFIG_RTE_BUILD_COMBINE_LIBS=n
+
+#
+# Use newest code breaking previous ABI
+#
+CONFIG_RTE_NEXT_ABI=y
+
+#
+# Machine's cache line size
+#
+CONFIG_RTE_CACHE_LINE_SIZE=64
+
+#
+# Compile Environment Abstraction Layer
+#
+CONFIG_RTE_LIBRTE_EAL=y
+CONFIG_RTE_MAX_LCORE=128
+CONFIG_RTE_MAX_NUMA_NODES=8
+CONFIG_RTE_MAX_MEMSEG=256
+CONFIG_RTE_MAX_MEMZONE=2560
+CONFIG_RTE_MAX_TAILQ=32
+CONFIG_RTE_LOG_LEVEL=8
+CONFIG_RTE_LOG_HISTORY=256
+CONFIG_RTE_LIBEAL_USE_HPET=n
+CONFIG_RTE_EAL_ALLOW_INV_SOCKET_ID=n
+CONFIG_RTE_EAL_ALWAYS_PANIC_ON_ERROR=n
+CONFIG_RTE_EAL_IGB_UIO=n
+CONFIG_RTE_EAL_VFIO=n
+CONFIG_RTE_MALLOC_DEBUG=n
+
+# Default driver path (or "" to disable)
+CONFIG_RTE_EAL_PMD_PATH=""
+
+#
+# Special configurations in PCI Config Space for high performance
+#
+CONFIG_RTE_PCI_CONFIG=n
+CONFIG_RTE_PCI_EXTENDED_TAG=""
+CONFIG_RTE_PCI_MAX_READ_REQUEST_SIZE=0
+
+#
+# Compile Environment Abstraction Layer to support Vmware TSC map
+#
+CONFIG_RTE_LIBRTE_EAL_VMWARE_TSC_MAP_SUPPORT=y
+
+#
+# Compile the argument parser library
+#
+CONFIG_RTE_LIBRTE_KVARGS=y
+
+#
+# Compile generic ethernet library
+#
+CONFIG_RTE_LIBRTE_ETHER=y
+CONFIG_RTE_LIBRTE_ETHDEV_DEBUG=n
+CONFIG_RTE_MAX_ETHPORTS=32
+CONFIG_RTE_MAX_QUEUES_PER_PORT=1024
+CONFIG_RTE_LIBRTE_IEEE1588=n
+CONFIG_RTE_ETHDEV_QUEUE_STAT_CNTRS=16
+CONFIG_RTE_ETHDEV_RXTX_CALLBACKS=y
+
+#
+# Support NIC bypass logic
+#
+CONFIG_RTE_NIC_BYPASS=n
+
+#
+# Compile burst-oriented IGB & EM PMD drivers
+#

[dpdk-dev] rte_mbuf's packet_type field

2016-03-04 Thread Ananyev, Konstantin
Hi,

> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Olivier MATZ
> Sent: Friday, March 04, 2016 9:29 AM
> To: Zoltan Kiss; dev at dpdk.org
> Subject: Re: [dpdk-dev] rte_mbuf's packet_type field
> 
> Hi Zoltan,
> 
> On 03/01/2016 06:15 PM, Zoltan Kiss wrote:
> > I have a quick question about this field: how do I know if the
> > underlying PMD supports a particular protocol parsing. Let's say I want
> > to check for SCTP packets, looking at this field tells me EITHER the
> > packet is SCTP (or not), OR that the hardware has no idea about SCTP. Is
> > there a way to figure that support out?
> 
> I'm not aware of such a feature. I guess you want to avoid to re-check
> all protocols in software if the hardware supports some of them and
> did not recognize them? In that case it may be interesting, but it would
> result in a lot of feature flags.

Nothing in the mainline, but there is a patches in-flight:
http://dpdk.org/dev/patchwork/patch/10921/

Konstantin

> 
> Regards,
> Olivier



[dpdk-dev] [PATCH v7 5/5] ixgbe: support VxLAN & NVGRE TX checksum off-load

2016-03-04 Thread Wenzhuo Lu
The patch add VxLAN & NVGRE TX checksum off-load. When the flag of
outer IP header checksum offload is set, we'll set the context
descriptor to enable this checksum off-load.

Also update release note for VxLAN & NVGRE checksum off-load support.

Signed-off-by: Wenzhuo Lu 
---
 doc/guides/rel_notes/release_16_04.rst |  9 ++
 drivers/net/ixgbe/ixgbe_ethdev.c   |  4 +++
 drivers/net/ixgbe/ixgbe_rxtx.c | 56 +++---
 drivers/net/ixgbe/ixgbe_rxtx.h |  6 +++-
 4 files changed, 63 insertions(+), 12 deletions(-)

diff --git a/doc/guides/rel_notes/release_16_04.rst 
b/doc/guides/rel_notes/release_16_04.rst
index 8273817..a17c2fb 100644
--- a/doc/guides/rel_notes/release_16_04.rst
+++ b/doc/guides/rel_notes/release_16_04.rst
@@ -46,6 +46,15 @@ This section should contain new features added in this 
release. Sample format:

 * **Added vhost-user live migration support.**

+* **Added support for VxLAN & NVGRE checksum off-load on X550.**
+
+  * Added support for VxLAN & NVGRE RX/TX checksum off-load on
+X550. RX/TX checksum off-load is provided on both inner and
+outer IP header and TCP header.
+  * Added functions to support VxLAN port configuration. The
+default VxLAN port number is 4789 but this can be updated
+programmatically.
+

 Resolved Issues
 ---
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 4722ea4..71606fb 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -2811,6 +2811,10 @@ ixgbe_dev_info_get(struct rte_eth_dev *dev, struct 
rte_eth_dev_info *dev_info)
DEV_TX_OFFLOAD_SCTP_CKSUM  |
DEV_TX_OFFLOAD_TCP_TSO;

+   if (hw->mac.type == ixgbe_mac_X550 ||
+   hw->mac.type == ixgbe_mac_X550EM_x)
+   dev_info->tx_offload_capa |= DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM;
+
dev_info->default_rxconf = (struct rte_eth_rxconf) {
.rx_thresh = {
.pthresh = IXGBE_DEFAULT_RX_PTHRESH,
diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c
index 6b913ee..c2c71de 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx.c
+++ b/drivers/net/ixgbe/ixgbe_rxtx.c
@@ -85,7 +85,8 @@
PKT_TX_VLAN_PKT |\
PKT_TX_IP_CKSUM |\
PKT_TX_L4_MASK | \
-   PKT_TX_TCP_SEG)
+   PKT_TX_TCP_SEG | \
+   PKT_TX_OUTER_IP_CKSUM)

 static inline struct rte_mbuf *
 rte_rxmbuf_alloc(struct rte_mempool *mp)
@@ -364,9 +365,11 @@ ixgbe_set_xmit_ctx(struct ixgbe_tx_queue *txq,
uint32_t ctx_idx;
uint32_t vlan_macip_lens;
union ixgbe_tx_offload tx_offload_mask;
+   uint32_t seqnum_seed = 0;

ctx_idx = txq->ctx_curr;
-   tx_offload_mask.data = 0;
+   tx_offload_mask.data[0] = 0;
+   tx_offload_mask.data[1] = 0;
type_tucmd_mlhl = 0;

/* Specify which HW CTX to upload. */
@@ -430,18 +433,35 @@ ixgbe_set_xmit_ctx(struct ixgbe_tx_queue *txq,
}
}

+   if (ol_flags & PKT_TX_OUTER_IP_CKSUM) {
+   tx_offload_mask.outer_l2_len |= ~0;
+   tx_offload_mask.outer_l3_len |= ~0;
+   tx_offload_mask.l2_len |= ~0;
+   seqnum_seed |= tx_offload.outer_l3_len
+  << IXGBE_ADVTXD_OUTER_IPLEN;
+   seqnum_seed |= tx_offload.l2_len
+  << IXGBE_ADVTXD_TUNNEL_LEN;
+   }
+
txq->ctx_cache[ctx_idx].flags = ol_flags;
-   txq->ctx_cache[ctx_idx].tx_offload.data  =
-   tx_offload_mask.data & tx_offload.data;
+   txq->ctx_cache[ctx_idx].tx_offload.data[0]  =
+   tx_offload_mask.data[0] & tx_offload.data[0];
+   txq->ctx_cache[ctx_idx].tx_offload.data[1]  =
+   tx_offload_mask.data[1] & tx_offload.data[1];
txq->ctx_cache[ctx_idx].tx_offload_mask= tx_offload_mask;

ctx_txd->type_tucmd_mlhl = rte_cpu_to_le_32(type_tucmd_mlhl);
vlan_macip_lens = tx_offload.l3_len;
-   vlan_macip_lens |= (tx_offload.l2_len << IXGBE_ADVTXD_MACLEN_SHIFT);
+   if (ol_flags & PKT_TX_OUTER_IP_CKSUM)
+   vlan_macip_lens |= (tx_offload.outer_l2_len <<
+   IXGBE_ADVTXD_MACLEN_SHIFT);
+   else
+   vlan_macip_lens |= (tx_offload.l2_len <<
+   IXGBE_ADVTXD_MACLEN_SHIFT);
vlan_macip_lens |= ((uint32_t)tx_offload.vlan_tci << 
IXGBE_ADVTXD_VLAN_SHIFT);
ctx_txd->vlan_macip_lens = rte_cpu_to_le_32(vlan_macip_lens);
ctx_txd->mss_l4len_idx   = rte_cpu_to_le_32(mss_l4len_idx);
-   ctx_txd->seqnum_seed = 0;
+   ctx_txd->seqnum_seed = seqnum_seed;
 }

 /*
@@ -454,16 +474,24 @@ what_advctx_update(struct ixgbe_tx_queue *txq, uint64_t 
flags,
 {
/* If match with the current used context */
if 

[dpdk-dev] [PATCH v7 4/5] ixgbe: support VxLAN & NVGRE RX checksum off-load

2016-03-04 Thread Wenzhuo Lu
X550 will do VxLAN & NVGRE RX checksum off-load automatically.
This patch exposes the result of the checksum off-load.

Signed-off-by: Wenzhuo Lu 
---
 drivers/net/ixgbe/ixgbe_ethdev.c |  4 
 drivers/net/ixgbe/ixgbe_rxtx.c   | 11 ++-
 lib/librte_ether/rte_ethdev.h|  1 +
 lib/librte_mbuf/rte_mbuf.c   |  2 +-
 lib/librte_mbuf/rte_mbuf.h   |  2 +-
 5 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 25e2e38..4722ea4 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -2799,6 +2799,10 @@ ixgbe_dev_info_get(struct rte_eth_dev *dev, struct 
rte_eth_dev_info *dev_info)
!RTE_ETH_DEV_SRIOV(dev).active)
dev_info->rx_offload_capa |= DEV_RX_OFFLOAD_TCP_LRO;

+   if (hw->mac.type == ixgbe_mac_X550 ||
+   hw->mac.type == ixgbe_mac_X550EM_x)
+   dev_info->rx_offload_capa |= DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM;
+
dev_info->tx_offload_capa =
DEV_TX_OFFLOAD_VLAN_INSERT |
DEV_TX_OFFLOAD_IPV4_CKSUM  |
diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c
index e95e6b7..6b913ee 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx.c
+++ b/drivers/net/ixgbe/ixgbe_rxtx.c
@@ -1003,6 +1003,8 @@ rx_desc_status_to_pkt_flags(uint32_t rx_status)
 static inline uint64_t
 rx_desc_error_to_pkt_flags(uint32_t rx_status)
 {
+   uint64_t pkt_flags;
+
/*
 * Bit 31: IPE, IPv4 checksum error
 * Bit 30: L4I, L4I integrity error
@@ -1011,8 +1013,15 @@ rx_desc_error_to_pkt_flags(uint32_t rx_status)
0,  PKT_RX_L4_CKSUM_BAD, PKT_RX_IP_CKSUM_BAD,
PKT_RX_IP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD
};
-   return error_to_pkt_flags_map[(rx_status >>
+   pkt_flags = error_to_pkt_flags_map[(rx_status >>
IXGBE_RXDADV_ERR_CKSUM_BIT) & IXGBE_RXDADV_ERR_CKSUM_MSK];
+
+   if ((rx_status & IXGBE_RXD_STAT_OUTERIPCS) &&
+   (rx_status & IXGBE_RXDADV_ERR_OUTERIPER)) {
+   pkt_flags |= PKT_RX_EIP_CKSUM_BAD;
+   }
+
+   return pkt_flags;
 }

 /*
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index f1f96c1..e7e7a66 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -810,6 +810,7 @@ struct rte_eth_conf {
 #define DEV_RX_OFFLOAD_TCP_CKSUM   0x0008
 #define DEV_RX_OFFLOAD_TCP_LRO 0x0010
 #define DEV_RX_OFFLOAD_QINQ_STRIP  0x0020
+#define DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM 0x0040

 /**
  * TX offload capabilities of a device.
diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c
index c18b438..dc0467c 100644
--- a/lib/librte_mbuf/rte_mbuf.c
+++ b/lib/librte_mbuf/rte_mbuf.c
@@ -253,7 +253,7 @@ const char *rte_get_rx_ol_flag_name(uint64_t mask)
case PKT_RX_FDIR: return "PKT_RX_FDIR";
case PKT_RX_L4_CKSUM_BAD: return "PKT_RX_L4_CKSUM_BAD";
case PKT_RX_IP_CKSUM_BAD: return "PKT_RX_IP_CKSUM_BAD";
-   /* case PKT_RX_EIP_CKSUM_BAD: return "PKT_RX_EIP_CKSUM_BAD"; */
+   case PKT_RX_EIP_CKSUM_BAD: return "PKT_RX_EIP_CKSUM_BAD";
/* case PKT_RX_OVERSIZE: return "PKT_RX_OVERSIZE"; */
/* case PKT_RX_HBUF_OVERFLOW: return "PKT_RX_HBUF_OVERFLOW"; */
/* case PKT_RX_RECIP_ERR: return "PKT_RX_RECIP_ERR"; */
diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index c973e9b..c4e7e25 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -88,7 +88,7 @@ extern "C" {
 #define PKT_RX_FDIR  (1ULL << 2)  /**< RX packet with FDIR match 
indicate. */
 #define PKT_RX_L4_CKSUM_BAD  (1ULL << 3)  /**< L4 cksum of RX pkt. is not OK. 
*/
 #define PKT_RX_IP_CKSUM_BAD  (1ULL << 4)  /**< IP cksum of RX pkt. is not OK. 
*/
-#define PKT_RX_EIP_CKSUM_BAD (0ULL << 0)  /**< External IP header checksum 
error. */
+#define PKT_RX_EIP_CKSUM_BAD (1ULL << 5)  /**< External IP header checksum 
error. */
 #define PKT_RX_OVERSIZE  (0ULL << 0)  /**< Num of desc of an RX pkt 
oversize. */
 #define PKT_RX_HBUF_OVERFLOW (0ULL << 0)  /**< Header buffer overflow. */
 #define PKT_RX_RECIP_ERR (0ULL << 0)  /**< Hardware processing error. */
-- 
1.9.3



[dpdk-dev] [PATCH v7 3/5] ixgbe: support UDP tunnel port config

2016-03-04 Thread Wenzhuo Lu
Add UDP tunnel port add/del support on ixgbe. Now only
support VxLAN port configuration.
Although according to the specification the VxLAN port has
a default value 4789, it can be changed. We support VxLAN
port configuration to meet the change.
Note, the default value of VxLAN port in ixgbe NICs is 0. So
please set it when using VxLAN off-load.

Signed-off-by: Wenzhuo Lu 
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 123 +++
 1 file changed, 123 insertions(+)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 3e6fe86..25e2e38 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -337,6 +337,10 @@ static int ixgbe_timesync_read_time(struct rte_eth_dev 
*dev,
   struct timespec *timestamp);
 static int ixgbe_timesync_write_time(struct rte_eth_dev *dev,
   const struct timespec *timestamp);
+static int ixgbe_dev_udp_tunnel_port_add(struct rte_eth_dev *dev,
+struct rte_eth_udp_tunnel *udp_tunnel);
+static int ixgbe_dev_udp_tunnel_port_del(struct rte_eth_dev *dev,
+struct rte_eth_udp_tunnel *udp_tunnel);

 /*
  * Define VF Stats MACRO for Non "cleared on read" register
@@ -495,6 +499,10 @@ static const struct eth_dev_ops ixgbe_eth_dev_ops = {
.timesync_adjust_time = ixgbe_timesync_adjust_time,
.timesync_read_time   = ixgbe_timesync_read_time,
.timesync_write_time  = ixgbe_timesync_write_time,
+   .udp_tunnel_add   = ixgbe_dev_udp_tunnel_port_add,
+   .udp_tunnel_del   = ixgbe_dev_udp_tunnel_port_del,
+   .udp_tunnel_port_add  = ixgbe_dev_udp_tunnel_port_add,
+   .udp_tunnel_port_del  = ixgbe_dev_udp_tunnel_port_del,
 };

 /*
@@ -6191,6 +6199,121 @@ ixgbe_dev_get_dcb_info(struct rte_eth_dev *dev,
return 0;
 }

+static int
+ixgbe_update_vxlan_port(struct ixgbe_hw *hw,
+   uint16_t port)
+{
+   IXGBE_WRITE_REG(hw, IXGBE_VXLANCTRL, port);
+   IXGBE_WRITE_FLUSH(hw);
+
+   return 0;
+}
+
+/* There's only one register for VxLAN UDP port.
+ * So, we cannot add several ports. Will update it.
+ */
+static int
+ixgbe_add_vxlan_port(struct ixgbe_hw *hw,
+uint16_t port)
+{
+   if (port == 0) {
+   PMD_DRV_LOG(ERR, "Add VxLAN port 0 is not allowed.");
+   return -EINVAL;
+   }
+
+   return ixgbe_update_vxlan_port(hw, port);
+}
+
+/* We cannot delete the VxLAN port. For there's a register for VxLAN
+ * UDP port, it must have a value.
+ * So, will reset it to the original value 0.
+ */
+static int
+ixgbe_del_vxlan_port(struct ixgbe_hw *hw,
+uint16_t port)
+{
+   uint16_t cur_port;
+
+   cur_port = (uint16_t)IXGBE_READ_REG(hw, IXGBE_VXLANCTRL);
+
+   if (cur_port != port) {
+   PMD_DRV_LOG(ERR, "Port %u does not exist.", port);
+   return -EINVAL;
+   }
+
+   return ixgbe_update_vxlan_port(hw, 0);
+}
+
+/* Add UDP tunneling port */
+static int
+ixgbe_dev_udp_tunnel_port_add(struct rte_eth_dev *dev,
+ struct rte_eth_udp_tunnel *udp_tunnel)
+{
+   int ret = 0;
+   struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+
+   if (hw->mac.type != ixgbe_mac_X550 &&
+   hw->mac.type != ixgbe_mac_X550EM_x) {
+   return -ENOTSUP;
+   }
+
+   if (udp_tunnel == NULL)
+   return -EINVAL;
+
+   switch (udp_tunnel->prot_type) {
+   case RTE_TUNNEL_TYPE_VXLAN:
+   ret = ixgbe_add_vxlan_port(hw, udp_tunnel->udp_port);
+   break;
+
+   case RTE_TUNNEL_TYPE_GENEVE:
+   case RTE_TUNNEL_TYPE_TEREDO:
+   PMD_DRV_LOG(ERR, "Tunnel type is not supported now.");
+   ret = -EINVAL;
+   break;
+
+   default:
+   PMD_DRV_LOG(ERR, "Invalid tunnel type");
+   ret = -EINVAL;
+   break;
+   }
+
+   return ret;
+}
+
+/* Remove UDP tunneling port */
+static int
+ixgbe_dev_udp_tunnel_port_del(struct rte_eth_dev *dev,
+ struct rte_eth_udp_tunnel *udp_tunnel)
+{
+   int ret = 0;
+   struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+
+   if (hw->mac.type != ixgbe_mac_X550 &&
+   hw->mac.type != ixgbe_mac_X550EM_x) {
+   return -ENOTSUP;
+   }
+
+   if (udp_tunnel == NULL)
+   return -EINVAL;
+
+   switch (udp_tunnel->prot_type) {
+   case RTE_TUNNEL_TYPE_VXLAN:
+   ret = ixgbe_del_vxlan_port(hw, udp_tunnel->udp_port);
+   break;
+   case RTE_TUNNEL_TYPE_GENEVE:
+   case RTE_TUNNEL_TYPE_TEREDO:
+   PMD_DRV_LOG(ERR, "Tunnel type is not supported now.");
+   ret = -EINVAL;
+   break;
+   default:
+   PMD_DRV_LOG(ERR, 

[dpdk-dev] [PATCH v7 2/5] i40e: rename the tunnel port config functions

2016-03-04 Thread Wenzhuo Lu
As the names of tunnel port config functions are not
accurate, change them from tunnel_add/del to
tunnel_port_add/del.
And support both the old and new rte ops.

Signed-off-by: Wenzhuo Lu 
---
 drivers/net/i40e/i40e_ethdev.c | 22 --
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index ef24122..3cc9384 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -369,10 +369,10 @@ static int i40e_dev_rss_hash_update(struct rte_eth_dev 
*dev,
struct rte_eth_rss_conf *rss_conf);
 static int i40e_dev_rss_hash_conf_get(struct rte_eth_dev *dev,
  struct rte_eth_rss_conf *rss_conf);
-static int i40e_dev_udp_tunnel_add(struct rte_eth_dev *dev,
-   struct rte_eth_udp_tunnel *udp_tunnel);
-static int i40e_dev_udp_tunnel_del(struct rte_eth_dev *dev,
-   struct rte_eth_udp_tunnel *udp_tunnel);
+static int i40e_dev_udp_tunnel_port_add(struct rte_eth_dev *dev,
+   struct rte_eth_udp_tunnel *udp_tunnel);
+static int i40e_dev_udp_tunnel_port_del(struct rte_eth_dev *dev,
+   struct rte_eth_udp_tunnel *udp_tunnel);
 static int i40e_ethertype_filter_set(struct i40e_pf *pf,
struct rte_eth_ethertype_filter *filter,
bool add);
@@ -467,8 +467,10 @@ static const struct eth_dev_ops i40e_eth_dev_ops = {
.reta_query   = i40e_dev_rss_reta_query,
.rss_hash_update  = i40e_dev_rss_hash_update,
.rss_hash_conf_get= i40e_dev_rss_hash_conf_get,
-   .udp_tunnel_add   = i40e_dev_udp_tunnel_add,
-   .udp_tunnel_del   = i40e_dev_udp_tunnel_del,
+   .udp_tunnel_add   = i40e_dev_udp_tunnel_port_add,
+   .udp_tunnel_del   = i40e_dev_udp_tunnel_port_del,
+   .udp_tunnel_port_add  = i40e_dev_udp_tunnel_port_add,
+   .udp_tunnel_port_del  = i40e_dev_udp_tunnel_port_del,
.filter_ctrl  = i40e_dev_filter_ctrl,
.rxq_info_get = i40e_rxq_info_get,
.txq_info_get = i40e_txq_info_get,
@@ -5976,8 +5978,8 @@ i40e_del_vxlan_port(struct i40e_pf *pf, uint16_t port)

 /* Add UDP tunneling port */
 static int
-i40e_dev_udp_tunnel_add(struct rte_eth_dev *dev,
-   struct rte_eth_udp_tunnel *udp_tunnel)
+i40e_dev_udp_tunnel_port_add(struct rte_eth_dev *dev,
+struct rte_eth_udp_tunnel *udp_tunnel)
 {
int ret = 0;
struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
@@ -6007,8 +6009,8 @@ i40e_dev_udp_tunnel_add(struct rte_eth_dev *dev,

 /* Remove UDP tunneling port */
 static int
-i40e_dev_udp_tunnel_del(struct rte_eth_dev *dev,
-   struct rte_eth_udp_tunnel *udp_tunnel)
+i40e_dev_udp_tunnel_port_del(struct rte_eth_dev *dev,
+struct rte_eth_udp_tunnel *udp_tunnel)
 {
int ret = 0;
struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
-- 
1.9.3



[dpdk-dev] [PATCH v7 1/5] lib/librte_ether: change function name of tunnel port config

2016-03-04 Thread Wenzhuo Lu
The names of function for tunnel port configuration are not
accurate. They're tunnel_add/del, better change them to
tunnel_port_add/del.
As it may be an ABI change if change the names directly, the
new functions are added but not remove the old ones. The old
ones will be removed in the next release after an ABI change
announcement.

Signed-off-by: Wenzhuo Lu 
---
 app/test-pmd/cmdline.c |  6 +++--
 examples/tep_termination/vxlan_setup.c |  2 +-
 lib/librte_ether/rte_ethdev.c  | 45 ++
 lib/librte_ether/rte_ethdev.h  | 18 ++
 lib/librte_ether/rte_ether_version.map |  2 ++
 5 files changed, 70 insertions(+), 3 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 52e9f5f..0fae655 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -6782,9 +6782,11 @@ cmd_tunnel_udp_config_parsed(void *parsed_result,
tunnel_udp.prot_type = RTE_TUNNEL_TYPE_VXLAN;

if (!strcmp(res->what, "add"))
-   ret = rte_eth_dev_udp_tunnel_add(res->port_id, _udp);
+   ret = rte_eth_dev_udp_tunnel_port_add(res->port_id,
+ _udp);
else
-   ret = rte_eth_dev_udp_tunnel_delete(res->port_id, _udp);
+   ret = rte_eth_dev_udp_tunnel_port_delete(res->port_id,
+_udp);

if (ret < 0)
printf("udp tunneling add error: (%s)\n", strerror(-ret));
diff --git a/examples/tep_termination/vxlan_setup.c 
b/examples/tep_termination/vxlan_setup.c
index 51ad133..8836603 100644
--- a/examples/tep_termination/vxlan_setup.c
+++ b/examples/tep_termination/vxlan_setup.c
@@ -191,7 +191,7 @@ vxlan_port_init(uint8_t port, struct rte_mempool *mbuf_pool)
/* Configure UDP port for UDP tunneling */
tunnel_udp.udp_port = udp_port;
tunnel_udp.prot_type = RTE_TUNNEL_TYPE_VXLAN;
-   retval = rte_eth_dev_udp_tunnel_add(port, _udp);
+   retval = rte_eth_dev_udp_tunnel_port_add(port, _udp);
if (retval < 0)
return retval;
rte_eth_macaddr_get(port, _eth_addr[port]);
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 1257965..937b348 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -1949,6 +1949,28 @@ rte_eth_dev_udp_tunnel_add(uint8_t port_id,
 }

 int
+rte_eth_dev_udp_tunnel_port_add(uint8_t port_id,
+   struct rte_eth_udp_tunnel *udp_tunnel)
+{
+   struct rte_eth_dev *dev;
+
+   RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+   if (udp_tunnel == NULL) {
+   RTE_PMD_DEBUG_TRACE("Invalid udp_tunnel parameter\n");
+   return -EINVAL;
+   }
+
+   if (udp_tunnel->prot_type >= RTE_TUNNEL_TYPE_MAX) {
+   RTE_PMD_DEBUG_TRACE("Invalid tunnel type\n");
+   return -EINVAL;
+   }
+
+   dev = _eth_devices[port_id];
+   RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->udp_tunnel_port_add, -ENOTSUP);
+   return (*dev->dev_ops->udp_tunnel_port_add)(dev, udp_tunnel);
+}
+
+int
 rte_eth_dev_udp_tunnel_delete(uint8_t port_id,
  struct rte_eth_udp_tunnel *udp_tunnel)
 {
@@ -1972,6 +1994,29 @@ rte_eth_dev_udp_tunnel_delete(uint8_t port_id,
 }

 int
+rte_eth_dev_udp_tunnel_port_delete(uint8_t port_id,
+  struct rte_eth_udp_tunnel *udp_tunnel)
+{
+   struct rte_eth_dev *dev;
+
+   RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+   dev = _eth_devices[port_id];
+
+   if (udp_tunnel == NULL) {
+   RTE_PMD_DEBUG_TRACE("Invalid udp_tunnel parameter\n");
+   return -EINVAL;
+   }
+
+   if (udp_tunnel->prot_type >= RTE_TUNNEL_TYPE_MAX) {
+   RTE_PMD_DEBUG_TRACE("Invalid tunnel type\n");
+   return -EINVAL;
+   }
+
+   RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->udp_tunnel_port_del, -ENOTSUP);
+   return (*dev->dev_ops->udp_tunnel_port_del)(dev, udp_tunnel);
+}
+
+int
 rte_eth_led_on(uint8_t port_id)
 {
struct rte_eth_dev *dev;
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 16da821..f1f96c1 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -1261,6 +1261,14 @@ typedef int (*eth_set_eeprom_t)(struct rte_eth_dev *dev,
struct rte_dev_eeprom_info *info);
 /**< @internal Program eeprom data  */

+typedef int (*eth_udp_tunnel_port_add_t)(struct rte_eth_dev *dev,
+struct rte_eth_udp_tunnel *tunnel_udp);
+/**< @internal Add tunneling UDP port */
+
+typedef int (*eth_udp_tunnel_port_del_t)(struct rte_eth_dev *dev,
+struct rte_eth_udp_tunnel *tunnel_udp);
+/**< @internal Delete tunneling UDP port */
+
 #ifdef RTE_NIC_BYPASS

 enum {
@@ -1443,6 

[dpdk-dev] [PATCH v7 0/5] Support VxLAN & NVGRE checksum off-load on X550

2016-03-04 Thread Wenzhuo Lu
This patch set add the VxLAN & NVGRE checksum off-load support.
Both RX and TX checksum off-load can be used for VxLAN & NVGRE.
And the VxLAN port can be set, it's implemented in this patch
set either.

v2:
- Update release note.

v3:
- Update RX/TX offload capability.
- Reuse PKT_RX_EIP_CKSUM_BAD but not add a new one.
- Correct the tunnel len for TX, and remove the useless out_l2_len.
- Don't set the tunnel type for TX, and remove the unused ol_flag_nvgre.

v4:
- Fix the issue that not setting the MAC length correctly.

v5:
- Change the behavior of VxLAN port add/del to make it align with i40e.

v6:
- Fix x86_64-native-linuxapp-gcc-shared compile error.

v7:
- Change the return value from hardcode to macro.

Wenzhuo Lu (5):
  lib/librte_ether: change function name of tunnel port config
  i40e: rename the tunnel port config functions
  ixgbe: support UDP tunnel port config
  ixgbe: support VxLAN &  NVGRE RX checksum off-load
  ixgbe: support VxLAN &  NVGRE TX checksum off-load

 app/test-pmd/cmdline.c |   6 +-
 doc/guides/rel_notes/release_16_04.rst |   9 +++
 drivers/net/i40e/i40e_ethdev.c |  22 +++---
 drivers/net/ixgbe/ixgbe_ethdev.c   | 131 +
 drivers/net/ixgbe/ixgbe_rxtx.c |  67 ++---
 drivers/net/ixgbe/ixgbe_rxtx.h |   6 +-
 examples/tep_termination/vxlan_setup.c |   2 +-
 lib/librte_ether/rte_ethdev.c  |  45 +++
 lib/librte_ether/rte_ethdev.h  |  19 +
 lib/librte_ether/rte_ether_version.map |   2 +
 lib/librte_mbuf/rte_mbuf.c |   2 +-
 lib/librte_mbuf/rte_mbuf.h |   2 +-
 12 files changed, 285 insertions(+), 28 deletions(-)

Acked-by: Konstantin Ananyev 

-- 
1.9.3



[dpdk-dev] [PATCH v2 1/7] vhost: refactor rte_vhost_dequeue_burst

2016-03-04 Thread Yuanhan Liu
On Thu, Mar 03, 2016 at 05:40:14PM +, Xie, Huawei wrote:
> On 2/18/2016 9:48 PM, Yuanhan Liu wrote:
> > The current rte_vhost_dequeue_burst() implementation is a bit messy
> [...]
> > +
> >  uint16_t
> >  rte_vhost_dequeue_burst(struct virtio_net *dev, uint16_t queue_id,
> > struct rte_mempool *mbuf_pool, struct rte_mbuf **pkts, uint16_t count)
> >  {
> > -   struct rte_mbuf *m, *prev;
> > struct vhost_virtqueue *vq;
> > -   struct vring_desc *desc;
> > -   uint64_t vb_addr = 0;
> > -   uint64_t vb_net_hdr_addr = 0;
> > -   uint32_t head[MAX_PKT_BURST];
> > +   uint32_t desc_indexes[MAX_PKT_BURST];
> 
> indices

http://dictionary.reference.com/browse/index

index
noun, plural indexes, indices 

> 
> 
> > uint32_t used_idx;
> > uint32_t i;
> > -   uint16_t free_entries, entry_success = 0;
> > +   uint16_t free_entries;
> > uint16_t avail_idx;
> > -   struct virtio_net_hdr *hdr = NULL;
> > +   struct rte_mbuf *m;
> >  
> > if (unlikely(!is_valid_virt_queue_idx(queue_id, 1, dev->virt_qp_nb))) {
> > RTE_LOG(ERR, VHOST_DATA,
> > @@ -730,197 +813,49 @@ rte_vhost_dequeue_burst(struct virtio_net *dev, 
> > uint16_t queue_id,
> > return 0;
> >  
> > -   if (entry_success < (free_entries - 1)) {
> > -   /* Prefetch descriptor index. */
> > -   rte_prefetch0(>desc[head[entry_success+1]]);
> > -   rte_prefetch0(>used->ring[(used_idx + 1) & 
> > (vq->size - 1)]);
> > -   }
> 
> Why is this prefetch silently dropped in the patch?

Oops, good catching. Will fix it. Thanks.


> > break;
> > +   pkts[i] = m;
> >  
> > -   m->nb_segs = seg_num;
> > -   if ((hdr->flags != 0) || (hdr->gso_type != 
> > VIRTIO_NET_HDR_GSO_NONE))
> > -   vhost_dequeue_offload(hdr, m);
> > -
> > -   pkts[entry_success] = m;
> > -   vq->last_used_idx++;
> > -   entry_success++;
> > +   used_idx = vq->last_used_idx++ & (vq->size - 1);
> > +   vq->used->ring[used_idx].id  = desc_indexes[i];
> > +   vq->used->ring[used_idx].len = 0;
> 
> What is the correct value for ring[used_idx].len,  the packet length or 0?

Good question. I didn't notice that before. Sounds buggy to me. However,
that's from the old code. Will check it.

--yliu


[dpdk-dev] rte_mbuf's packet_type field

2016-03-04 Thread Olivier MATZ
Hi Zoltan,

On 03/01/2016 06:15 PM, Zoltan Kiss wrote:
> I have a quick question about this field: how do I know if the
> underlying PMD supports a particular protocol parsing. Let's say I want
> to check for SCTP packets, looking at this field tells me EITHER the
> packet is SCTP (or not), OR that the hardware has no idea about SCTP. Is
> there a way to figure that support out?

I'm not aware of such a feature. I guess you want to avoid to re-check
all protocols in software if the hardware supports some of them and
did not recognize them? In that case it may be interesting, but it would
result in a lot of feature flags.

Regards,
Olivier



[dpdk-dev] [PATCH v2 1/7] vhost: refactor rte_vhost_dequeue_burst

2016-03-04 Thread Yuanhan Liu
On Thu, Mar 03, 2016 at 04:21:19PM +, Xie, Huawei wrote:
> On 2/18/2016 9:48 PM, Yuanhan Liu wrote:
> > The current rte_vhost_dequeue_burst() implementation is a bit messy
> > and logic twisted. And you could see repeat code here and there: it
> > invokes rte_pktmbuf_alloc() three times at three different places!
> >
> > However, rte_vhost_dequeue_burst() acutally does a simple job: copy
> > the packet data from vring desc to mbuf. What's tricky here is:
> >
> > - desc buff could be chained (by desc->next field), so that you need
> >   fetch next one if current is wholly drained.
> >
> > - One mbuf could not be big enough to hold all desc buff, hence you
> >   need to chain the mbuf as well, by the mbuf->next field.
> >
> > Even though, the logic could be simple. Here is the pseudo code.
> >
> > while (this_desc_is_not_drained_totally || has_next_desc) {
> > if (this_desc_has_drained_totally) {
> > this_desc = next_desc();
> > }
> >
> > if (mbuf_has_no_room) {
> > mbuf = allocate_a_new_mbuf();
> > }
> >
> > COPY(mbuf, desc);
> > }
> >
> > And this is how I refactored rte_vhost_dequeue_burst.
> >
> > Note that the old patch does a special handling for skipping virtio
> > header. However, that could be simply done by adjusting desc_avail
> > and desc_offset var:
> >
> > desc_avail  = desc->len - vq->vhost_hlen;
> > desc_offset = vq->vhost_hlen;
> >
> > This refactor makes the code much more readable (IMO), yet it reduces
> > binary code size (nearly 2K).
> >
> > Signed-off-by: Yuanhan Liu 
> > ---
> >
> > v2: - fix potential NULL dereference bug of var "prev" and "head"
> > ---
> >  lib/librte_vhost/vhost_rxtx.c | 297 
> > +-
> >  1 file changed, 116 insertions(+), 181 deletions(-)
> >
> > diff --git a/lib/librte_vhost/vhost_rxtx.c b/lib/librte_vhost/vhost_rxtx.c
> > index 5e7e5b1..d5cd0fa 100644
> > --- a/lib/librte_vhost/vhost_rxtx.c
> > +++ b/lib/librte_vhost/vhost_rxtx.c
> > @@ -702,21 +702,104 @@ vhost_dequeue_offload(struct virtio_net_hdr *hdr, 
> > struct rte_mbuf *m)
> > }
> >  }
> >  
> > +static inline struct rte_mbuf *
> > +copy_desc_to_mbuf(struct virtio_net *dev, struct vhost_virtqueue *vq,
> > + uint16_t desc_idx, struct rte_mempool *mbuf_pool)
> > +{
> > +   struct vring_desc *desc;
> > +   uint64_t desc_addr;
> > +   uint32_t desc_avail, desc_offset;
> > +   uint32_t mbuf_avail, mbuf_offset;
> > +   uint32_t cpy_len;
> > +   struct rte_mbuf *head = NULL;
> > +   struct rte_mbuf *cur = NULL, *prev = NULL;
> > +   struct virtio_net_hdr *hdr;
> > +
> > +   desc = >desc[desc_idx];
> > +   desc_addr = gpa_to_vva(dev, desc->addr);
> > +   rte_prefetch0((void *)(uintptr_t)desc_addr);
> > +
> > +   /* Retrieve virtio net header */
> > +   hdr = (struct virtio_net_hdr *)((uintptr_t)desc_addr);
> > +   desc_avail  = desc->len - vq->vhost_hlen;
> 
> There is a serious bug here, desc->len - vq->vhost_len could overflow.
> VM could easily create this case. Let us fix it here.

Nope, this issue has been there since the beginning, and this patch
is a refactor: we should not bring any functional changes. Therefore,
we should not fix it here.

And actually, it's been fixed in the 6th patch in this series:

[PATCH v2 6/7] vhost: do sanity check for desc->len

--yliu


[dpdk-dev] [PATCH v3 3/6] EAL: Add new EAL "--range-virtaddr" option

2016-03-04 Thread Tan, Jianfeng
Hi Tetsuya,

On 2/22/2016 4:17 PM, Tetsuya Mukawa wrote:
> The option specifies how to mmap EAL memory.
> If the option is specified like '--range-virtaddr=-',
> EAL will check /proc/maps, then tries to find free region between addr1
> and addr2. If a region is found, EAL will treat it as if 'base-virtaddr'
> is specified. Because of this, the option will not work with
> '--base-virtaddr'.
>
> Signed-off-by: Tetsuya Mukawa 
> ---
>   lib/librte_eal/common/eal_common_options.c |  9 
>   lib/librte_eal/common/eal_internal_cfg.h   |  2 +
>   lib/librte_eal/common/eal_options.h|  2 +
>   lib/librte_eal/linuxapp/eal/eal.c  | 39 ++
>   lib/librte_eal/linuxapp/eal/eal_memory.c   | 82 
> +-
>   5 files changed, 133 insertions(+), 1 deletion(-)
>
> diff --git a/lib/librte_eal/common/eal_common_options.c 
> b/lib/librte_eal/common/eal_common_options.c
> index 65bccbd..3b4f789 100644
> --- a/lib/librte_eal/common/eal_common_options.c
> +++ b/lib/librte_eal/common/eal_common_options.c
> @@ -74,6 +74,7 @@ eal_short_options[] =
>   const struct option
>   eal_long_options[] = {
>   {OPT_BASE_VIRTADDR, 1, NULL, OPT_BASE_VIRTADDR_NUM},
> + {OPT_RANGE_VIRTADDR,1, NULL, OPT_RANGE_VIRTADDR_NUM   },
>   {OPT_CREATE_UIO_DEV,0, NULL, OPT_CREATE_UIO_DEV_NUM   },
>   {OPT_FILE_PREFIX,   1, NULL, OPT_FILE_PREFIX_NUM  },
>   {OPT_HELP,  0, NULL, OPT_HELP_NUM },
> @@ -137,6 +138,8 @@ eal_reset_internal_config(struct internal_config 
> *internal_cfg)
>   for (i = 0; i < MAX_HUGEPAGE_SIZES; i++)
>   internal_cfg->hugepage_info[i].lock_descriptor = -1;
>   internal_cfg->base_virtaddr = 0;
> + internal_cfg->range_virtaddr_start = 0;
> + internal_cfg->range_virtaddr_end = 0;
>   
>   internal_cfg->syslog_facility = LOG_DAEMON;
>   /* default value from build option */
> @@ -985,6 +988,12 @@ eal_check_common_options(struct internal_config 
> *internal_cfg)
>   return -1;
>   }
>   
> + if (internal_cfg->base_virtaddr && internal_cfg->range_virtaddr_end) {
> + RTE_LOG(ERR, EAL, "Option --"OPT_RANGE_VIRTADDR" cannot "
> + "be specified together with --"OPT_BASE_VIRTADDR"\n");
> + return -1;
> + }
> +
>   return 0;
>   }
>   
> diff --git a/lib/librte_eal/common/eal_internal_cfg.h 
> b/lib/librte_eal/common/eal_internal_cfg.h
> index 9117ed9..0734630 100644
> --- a/lib/librte_eal/common/eal_internal_cfg.h
> +++ b/lib/librte_eal/common/eal_internal_cfg.h
> @@ -78,6 +78,8 @@ struct internal_config {
>   volatile unsigned force_sockets;
>   volatile uint64_t socket_mem[RTE_MAX_NUMA_NODES]; /**< amount of memory 
> per socket */
>   uintptr_t base_virtaddr;  /**< base address to try and reserve 
> memory from */
> + uintptr_t range_virtaddr_start;   /**< start address of mappable region 
> */
> + uintptr_t range_virtaddr_end; /**< end address of mappable region */
>   volatile int syslog_facility; /**< facility passed to openlog() */
>   volatile uint32_t log_level;  /**< default log level */
>   /** default interrupt mode for VFIO */
> diff --git a/lib/librte_eal/common/eal_options.h 
> b/lib/librte_eal/common/eal_options.h
> index e5da14a..8e4cf1d 100644
> --- a/lib/librte_eal/common/eal_options.h
> +++ b/lib/librte_eal/common/eal_options.h
> @@ -47,6 +47,8 @@ enum {
>   OPT_LONG_MIN_NUM = 256,
>   #define OPT_BASE_VIRTADDR "base-virtaddr"
>   OPT_BASE_VIRTADDR_NUM,
> +#define OPT_RANGE_VIRTADDR"range-virtaddr"
> + OPT_RANGE_VIRTADDR_NUM,
>   #define OPT_CREATE_UIO_DEV"create-uio-dev"
>   OPT_CREATE_UIO_DEV_NUM,
>   #define OPT_FILE_PREFIX   "file-prefix"
> diff --git a/lib/librte_eal/linuxapp/eal/eal.c 
> b/lib/librte_eal/linuxapp/eal/eal.c
> index 82f34f7..80f1995 100644
> --- a/lib/librte_eal/linuxapp/eal/eal.c
> +++ b/lib/librte_eal/linuxapp/eal/eal.c
> @@ -444,6 +444,35 @@ eal_parse_base_virtaddr(const char *arg)
>   }
>   
>   static int
> +eal_parse_range_virtaddr(const char *range)
> +{
> + char *p, *endptr;
> + uint64_t tmp_start, tmp_end;
> +
> + p = strchr(range, '-');
> + if (p == NULL)
> + return -1;
> + *p++ = '\0';
> +
> + errno = 0;
> + tmp_start = strtoul(range, , 0);
> + if ((errno != 0) || endptr == NULL || (*endptr != '\0'))
> + return -1;
> +
> + tmp_end = strtoul(p, , 0);
> + if ((errno != 0) || endptr == NULL || (*endptr != '\0'))
> + return -1;
> +
> + if (tmp_start >= tmp_end)
> + return -1;
> +
> + internal_config.range_virtaddr_start = tmp_start;
> + internal_config.range_virtaddr_end = tmp_end;
> +
> + return 0;
> +}
> +
> +static int
>   eal_parse_vfio_intr(const char *mode)
>   {
>   unsigned i;
> @@ -604,6 +633,16 @@ eal_parse_args(int argc, char **argv)
>   }
>

[dpdk-dev] [PATCH 3/3] virtio: optimize transmit enqueue

2016-03-04 Thread Stephen Hemminger
All the error checks in virtqueue_enqueue_xmit are already done
by the caller. Therefore they can be removed to improve performance.

Signed-off-by: Stephen Hemminger 
---
 drivers/net/virtio/virtio_rxtx.c | 23 ++-
 1 file changed, 2 insertions(+), 21 deletions(-)

diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c
index 0f12e64..1c0b6eb 100644
--- a/drivers/net/virtio/virtio_rxtx.c
+++ b/drivers/net/virtio/virtio_rxtx.c
@@ -208,7 +208,7 @@ virtqueue_enqueue_recv_refill(struct virtqueue *vq, struct 
rte_mbuf *cookie)
return 0;
 }

-static int
+static inline void
 virtqueue_enqueue_xmit(struct virtqueue *txvq, struct rte_mbuf *cookie,
   uint16_t needed, int use_indirect, int can_push)
 {
@@ -219,14 +219,7 @@ virtqueue_enqueue_xmit(struct virtqueue *txvq, struct 
rte_mbuf *cookie,
uint16_t head_size = txvq->hw->vtnet_hdr_size;
unsigned long offs;

-   if (unlikely(txvq->vq_free_cnt == 0))
-   return -ENOSPC;
-   if (unlikely(txvq->vq_free_cnt < needed))
-   return -EMSGSIZE;
head_idx = txvq->vq_desc_head_idx;
-   if (unlikely(head_idx >= txvq->vq_nentries))
-   return -EFAULT;
-
idx = head_idx;
dxp = >vq_descx[idx];
dxp->cookie = (void *)cookie;
@@ -288,8 +281,6 @@ virtqueue_enqueue_xmit(struct virtqueue *txvq, struct 
rte_mbuf *cookie,
txvq->vq_desc_tail_idx = idx;
txvq->vq_free_cnt = (uint16_t)(txvq->vq_free_cnt - needed);
vq_update_avail_ring(txvq, head_idx);
-
-   return 0;
 }

 static inline struct rte_mbuf *
@@ -931,17 +922,7 @@ virtio_xmit_pkts(void *tx_queue, struct rte_mbuf 
**tx_pkts, uint16_t nb_pkts)
}

/* Enqueue Packet buffers */
-   error = virtqueue_enqueue_xmit(txvq, txm, slots,
-  use_indirect, can_push);
-   if (unlikely(error)) {
-   if (error == ENOSPC)
-   PMD_TX_LOG(ERR, "virtqueue_enqueue Free count = 
0");
-   else if (error == EMSGSIZE)
-   PMD_TX_LOG(ERR, "virtqueue_enqueue Free count < 
1");
-   else
-   PMD_TX_LOG(ERR, "virtqueue_enqueue error: %d", 
error);
-   break;
-   }
+   virtqueue_enqueue_xmit(txvq, txm, slots, use_indirect, 
can_push);

txvq->bytes += txm->pkt_len;
virtio_update_packet_stats(txvq, txm);
-- 
2.1.4



[dpdk-dev] [PATCH 2/3] virtio: use any layout on transmit

2016-03-04 Thread Stephen Hemminger
Virtio supports a feature that allows sender to put transmit
header prepended to data.  It requires that the mbuf be writeable, correct
alignment, and the feature has been negotiatied.  If all this works out,
then it will be the optimum way to transmit a single segment packet.

Signed-off-by: Stephen Hemminger 
---
 drivers/net/virtio/virtio_rxtx.c | 73 +---
 1 file changed, 46 insertions(+), 27 deletions(-)

diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c
index 5fe3eec..0f12e64 100644
--- a/drivers/net/virtio/virtio_rxtx.c
+++ b/drivers/net/virtio/virtio_rxtx.c
@@ -210,13 +210,13 @@ virtqueue_enqueue_recv_refill(struct virtqueue *vq, 
struct rte_mbuf *cookie)

 static int
 virtqueue_enqueue_xmit(struct virtqueue *txvq, struct rte_mbuf *cookie,
-  int use_indirect)
+  uint16_t needed, int use_indirect, int can_push)
 {
struct vq_desc_extra *dxp;
struct vring_desc *start_dp;
uint16_t seg_num = cookie->nb_segs;
-   uint16_t needed = use_indirect ? 1 : 1 + seg_num;
uint16_t head_idx, idx;
+   uint16_t head_size = txvq->hw->vtnet_hdr_size;
unsigned long offs;

if (unlikely(txvq->vq_free_cnt == 0))
@@ -234,7 +234,12 @@ virtqueue_enqueue_xmit(struct virtqueue *txvq, struct 
rte_mbuf *cookie,

start_dp = txvq->vq_ring.desc;

-   if (use_indirect) {
+   if (can_push) {
+   /* put on zero'd transmit header (no offloads) */
+   void *hdr = rte_pktmbuf_prepend(cookie, head_size);
+
+   memset(hdr, 0, head_size);
+   } else if (use_indirect) {
/* setup tx ring slot to point to indirect
 * descriptor list stored in reserved region.
 *
@@ -252,7 +257,7 @@ virtqueue_enqueue_xmit(struct virtqueue *txvq, struct 
rte_mbuf *cookie,

/* loop below will fill in rest of the indirect elements */
start_dp = txr[idx].tx_indir;
-   idx = 0;
+   idx = 1;
} else {
/* setup first tx ring slot to point to header
 * stored in reserved region.
@@ -263,22 +268,20 @@ virtqueue_enqueue_xmit(struct virtqueue *txvq, struct 
rte_mbuf *cookie,
start_dp[idx].addr  = txvq->virtio_net_hdr_mem + offs;
start_dp[idx].len   = txvq->hw->vtnet_hdr_size;
start_dp[idx].flags = VRING_DESC_F_NEXT;
+   idx = start_dp[idx].next;
}

-   for (; ((seg_num > 0) && (cookie != NULL)); seg_num--) {
-   idx = start_dp[idx].next;
+   do {
start_dp[idx].addr  = rte_mbuf_data_dma_addr(cookie);
start_dp[idx].len   = cookie->data_len;
-   start_dp[idx].flags = VRING_DESC_F_NEXT;
-   cookie = cookie->next;
-   }
+   start_dp[idx].flags = cookie->next ? VRING_DESC_F_NEXT : 0;
+   idx = start_dp[idx].next;
+   } while ((cookie = cookie->next) != NULL);

start_dp[idx].flags &= ~VRING_DESC_F_NEXT;

if (use_indirect)
idx = txvq->vq_ring.desc[head_idx].next;
-   else
-   idx = start_dp[idx].next;

txvq->vq_desc_head_idx = idx;
if (txvq->vq_desc_head_idx == VQ_RING_DESC_CHAIN_END)
@@ -859,10 +862,13 @@ virtio_recv_mergeable_pkts(void *rx_queue,
return nb_rx;
 }

+
 uint16_t
 virtio_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 {
struct virtqueue *txvq = tx_queue;
+   struct virtio_hw *hw = txvq->hw;
+   uint16_t hdr_size = hw->vtnet_hdr_size;
uint16_t nb_used, nb_tx;
int error;

@@ -878,14 +884,35 @@ virtio_xmit_pkts(void *tx_queue, struct rte_mbuf 
**tx_pkts, uint16_t nb_pkts)

for (nb_tx = 0; nb_tx < nb_pkts; nb_tx++) {
struct rte_mbuf *txm = tx_pkts[nb_tx];
-   int use_indirect, slots, need;
+   int can_push = 0, use_indirect = 0, slots, need;

-   use_indirect = vtpci_with_feature(txvq->hw,
- VIRTIO_RING_F_INDIRECT_DESC)
-   && (txm->nb_segs < VIRTIO_MAX_TX_INDIRECT);
+   /* Do VLAN tag insertion */
+   if (unlikely(txm->ol_flags & PKT_TX_VLAN_PKT)) {
+   error = rte_vlan_insert();
+   if (unlikely(error)) {
+   rte_pktmbuf_free(txm);
+   continue;
+   }
+   }

-   /* How many main ring entries are needed to this Tx? */
-   slots = use_indirect ? 1 : 1 + txm->nb_segs;
+   /* optimize ring usage */
+   if (vtpci_with_feature(hw, VIRTIO_F_ANY_LAYOUT) &&
+   rte_mbuf_refcnt_read(txm) == 1 &&
+   txm->nb_segs == 1 &&
+   rte_pktmbuf_headroom(txm) >= 

[dpdk-dev] [PATCH 1/3] virtio: use indirect ring elements

2016-03-04 Thread Stephen Hemminger
The virtio ring in QEMU/KVM is usually limited to 256 entries
and the normal way that virtio driver was queuing mbufs required
nsegs + 1 ring elements. By using the indirect ring element feature
if available, each packet will take only one ring slot even for
multi-segment packets.

Signed-off-by: Stephen Hemminger 
---
 drivers/net/virtio/virtio_ethdev.c | 44 +---
 drivers/net/virtio/virtio_rxtx.c   | 69 +-
 drivers/net/virtio/virtqueue.h | 19 +++
 3 files changed, 104 insertions(+), 28 deletions(-)

diff --git a/drivers/net/virtio/virtio_ethdev.c 
b/drivers/net/virtio/virtio_ethdev.c
index caa970c..95c2203 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -387,27 +387,47 @@ int virtio_dev_queue_setup(struct rte_eth_dev *dev,
vq->virtio_net_hdr_mem = 0;

if (queue_type == VTNET_TQ) {
+   const struct rte_memzone *hdr_mz;
+   struct virtio_tx_region *txr;
+   unsigned int i;
+
/*
 * For each xmit packet, allocate a virtio_net_hdr
+* and indirect ring elements
 */
snprintf(vq_name, sizeof(vq_name), "port%d_tvq%d_hdrzone",
-   dev->data->port_id, queue_idx);
-   vq->virtio_net_hdr_mz = rte_memzone_reserve_aligned(vq_name,
-   vq_size * hw->vtnet_hdr_size,
-   socket_id, 0, RTE_CACHE_LINE_SIZE);
-   if (vq->virtio_net_hdr_mz == NULL) {
+dev->data->port_id, queue_idx);
+   hdr_mz = rte_memzone_reserve_aligned(vq_name,
+vq_size * sizeof(*txr),
+socket_id, 0,
+RTE_CACHE_LINE_SIZE);
+   if (hdr_mz == NULL) {
if (rte_errno == EEXIST)
-   vq->virtio_net_hdr_mz =
-   rte_memzone_lookup(vq_name);
-   if (vq->virtio_net_hdr_mz == NULL) {
+   hdr_mz = rte_memzone_lookup(vq_name);
+   if (hdr_mz == NULL) {
rte_free(vq);
return -ENOMEM;
}
}
-   vq->virtio_net_hdr_mem =
-   vq->virtio_net_hdr_mz->phys_addr;
-   memset(vq->virtio_net_hdr_mz->addr, 0,
-   vq_size * hw->vtnet_hdr_size);
+   vq->virtio_net_hdr_mz = hdr_mz;
+   vq->virtio_net_hdr_mem = hdr_mz->phys_addr;
+
+   txr = hdr_mz->addr;
+   memset(txr, 0, vq_size * sizeof(*txr));
+   for (i = 0; i < vq_size; i++) {
+   struct vring_desc *start_dp = txr[i].tx_indir;
+
+   vring_desc_init(start_dp, RTE_DIM(txr[i].tx_indir));
+
+   /* first indirect descriptor is always the tx header */
+   start_dp->addr = vq->virtio_net_hdr_mem
+   + i * sizeof(*txr)
+   + offsetof(struct virtio_tx_region, tx_hdr);
+
+   start_dp->len = vq->hw->vtnet_hdr_size;
+   start_dp->flags = VRING_DESC_F_NEXT;
+   }
+
} else if (queue_type == VTNET_CQ) {
/* Allocate a page for control vq command, data and status */
snprintf(vq_name, sizeof(vq_name), "port%d_cvq_hdrzone",
diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c
index e96352c..5fe3eec 100644
--- a/drivers/net/virtio/virtio_rxtx.c
+++ b/drivers/net/virtio/virtio_rxtx.c
@@ -209,14 +209,15 @@ virtqueue_enqueue_recv_refill(struct virtqueue *vq, 
struct rte_mbuf *cookie)
 }

 static int
-virtqueue_enqueue_xmit(struct virtqueue *txvq, struct rte_mbuf *cookie)
+virtqueue_enqueue_xmit(struct virtqueue *txvq, struct rte_mbuf *cookie,
+  int use_indirect)
 {
struct vq_desc_extra *dxp;
struct vring_desc *start_dp;
uint16_t seg_num = cookie->nb_segs;
-   uint16_t needed = 1 + seg_num;
+   uint16_t needed = use_indirect ? 1 : 1 + seg_num;
uint16_t head_idx, idx;
-   size_t head_size = txvq->hw->vtnet_hdr_size;
+   unsigned long offs;

if (unlikely(txvq->vq_free_cnt == 0))
return -ENOSPC;
@@ -232,10 +233,37 @@ virtqueue_enqueue_xmit(struct virtqueue *txvq, struct 
rte_mbuf *cookie)
dxp->ndescs = needed;

start_dp = txvq->vq_ring.desc;
-   start_dp[idx].addr =
-   txvq->virtio_net_hdr_mem + idx * head_size;
-   start_dp[idx].len = head_size;
-   start_dp[idx].flags = VRING_DESC_F_NEXT;
+
+   if (use_indirect) {
+   /* setup tx ring slot to point to 

[dpdk-dev] [PATCH 0/3 v3] virtio: Tx performance improvements

2016-03-04 Thread Stephen Hemminger
This patch series uses virtio negotiated features to allow for
more packets to be queued to host even though the default QEMU/KVM
virtio queue is very small 256 elements.

Stephen Hemminger (3):
  virtio: use indirect ring elements
  virtio: use any layout on transmit
  virtio: optimize transmit enqueue

 drivers/net/virtio/virtio_ethdev.c |  44 
 drivers/net/virtio/virtio_rxtx.c   | 133 -
 drivers/net/virtio/virtqueue.h |  19 ++
 3 files changed, 136 insertions(+), 60 deletions(-)

-- 
2.1.4



[dpdk-dev] [PATCH 1/3] add tx crc disable flag

2016-03-04 Thread Olivier MATZ
Hi Paul,

On 02/15/2016 05:55 PM, Paul Emmerich wrote:
> Signed-off-by: Paul Emmerich 
> ---
>  lib/librte_mbuf/rte_mbuf.c | 1 +
>  lib/librte_mbuf/rte_mbuf.h | 6 ++
>  2 files changed, 7 insertions(+)
> 
> diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c
> index f506517..744fb4e 100644
> --- a/lib/librte_mbuf/rte_mbuf.c
> +++ b/lib/librte_mbuf/rte_mbuf.c
> @@ -270,6 +270,7 @@ const char *rte_get_rx_ol_flag_name(uint64_t mask)
>  const char *rte_get_tx_ol_flag_name(uint64_t mask)
>  {
>   switch (mask) {
> + case PKT_TX_NO_CRC_CSUM: return "PKT_TX_NO_CRC_CSUM";
>   case PKT_TX_VLAN_PKT: return "PKT_TX_VLAN_PKT";
>   case PKT_TX_IP_CKSUM: return "PKT_TX_IP_CKSUM";
>   case PKT_TX_TCP_CKSUM: return "PKT_TX_TCP_CKSUM";
> diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
> index ab6de67..096d84a 100644
> --- a/lib/librte_mbuf/rte_mbuf.h
> +++ b/lib/librte_mbuf/rte_mbuf.h
> @@ -106,6 +106,12 @@ extern "C" {
>  /* add new TX flags here */
>  
>  /**
> + * Disable CRC checksum offload
> + */
> +#define PKT_TX_NO_CRC_CSUM   (1ULL << 49)
> +
> +
> +/**
>   * TCP segmentation offload. To enable this offload feature for a
>   * packet to be transmitted on hardware supporting TSO:
>   *  - set the PKT_TX_TCP_SEG flag in mbuf->ol_flags (this flag implies
> 

The patch does not apply properly. It seems you've done it on a version
that is more than 6 months old. Could you please rebase it?

My second question concerns the behavior of this flag when it is not
supported by the driver. Shouldn't we have a feature flag saying "this
driver supports CRC stripping"?

Also, I think "PKT_TX_STRIP_CRC" would be a better name.

Regards,
Olivier


[dpdk-dev] [PATCH v3 5/6] virtio: Add support for qtest virtio-net PMD

2016-03-04 Thread Tan, Jianfeng
Hi Tetsuya,

Seems that this patch is too long. Is it possible to split into multiple 
commits?

On 2/22/2016 4:17 PM, Tetsuya Mukawa wrote:
> The patch adds a new virtio-net PMD configuration that allows the PMD to
> work on host as if the PMD is in VM.
> Here is new configuration for virtio-net PMD.
>   - CONFIG_RTE_VIRTIO_VDEV_QTEST
> To use this mode, EAL needs map all hugepages as one file. Also the file
> should be mapped between (1 << 31) and (1 << 44). And start address
> should be aligned by EAL memory size.
>
> To allocate like above, use below options.
>   --single-file
>   --range-virtaddr=0x8000-0x1000
>   --align-memsize
> If a free regions isn't found, EAL will return error.
>
> To prepare virtio-net device on host, the users need to invoke QEMU
> process in special qtest mode. This mode is mainly used for testing QEMU
> devices from outer process. In this mode, no guest runs.
> Here is QEMU command line.
>
>   $ qemu-system-x86_64 \
>   -machine pc-i440fx-1.4,accel=qtest \
>   -display none -qtest-log /dev/null \
>   -qtest unix:/tmp/socket,server \
>   -netdev type=tap,script=/etc/qemu-ifup,id=net0,queues=1 \
>   -device virtio-net-pci,netdev=net0,mq=on,disable-modern=false,addr=3 \
>   -chardev socket,id=chr1,path=/tmp/ivshmem,server \
>   -device ivshmem,size=1G,chardev=chr1,vectors=1,addr=4
>
>   * Should use qemu-2.5.1, or above.
>   * QEMU process is needed per port.
>   * virtio-1.0 device are only supported.
>   * The vhost backends like vhost-net and vhost-user can be specified.
>   * In most cases, just using above command is enough, but you can also
> specify other QEMU virtio-net options.
>   * Only checked "pc-i440fx-1.4" machine, but may work with other
> machines.
>   * Should not add "--enable-kvm" to QEMU command line.

Correct me if wrong: all control msgs go through qemu process, e.g., tx 
notifications and rx interrupts need follow frontend-qemu-backend path. 
Question: qemu is started without --enable-kvm, as I understand, 
ioeventfd, the basis of kickfd/callfd, will not be available. So how 
does qemu kick backend or be kicked by backend?

>
> After invoking QEMU, the PMD can connect to QEMU process using unix
> domain sockets. Over these sockets, virtio-net, ivshmem and piix3
> device in QEMU are probed by the PMD.
> Here is example of command line.
>
>   $ testpmd -c f -n 1 -m 1024 --no-pci --single-file \
>--range-virtaddr=0x8000-0x1000 --align-memsize \
>--vdev="eth_qtest_virtio0,qtest=/tmp/socket,ivshmem=/tmp/ivshmem"\
>-- --disable-hw-vlan --txqflags=0xf00 -i
>
> Please specify same unix domain sockets and memory size in both QEMU
> and DPDK command lines like above.
> The share memory size should be power of 2, because ivshmem only
> accepts such memory size.
>
> Signed-off-by: Tetsuya Mukawa 
> ---
>   config/common_linuxapp |1 +
>   drivers/net/virtio/Makefile|4 +
>   drivers/net/virtio/qtest.c | 1342 
> 
>   drivers/net/virtio/qtest.h |   65 ++
>   drivers/net/virtio/virtio_ethdev.c |  383 +-
>   drivers/net/virtio/virtio_pci.c|  364 +-
>   drivers/net/virtio/virtio_pci.h|5 +-
>   7 files changed, 2122 insertions(+), 42 deletions(-)
>   create mode 100644 drivers/net/virtio/qtest.c
>   create mode 100644 drivers/net/virtio/qtest.h
>
> diff --git a/config/common_linuxapp b/config/common_linuxapp
> index 452f39c..f6e53bc 100644
> --- a/config/common_linuxapp
> +++ b/config/common_linuxapp
> @@ -533,3 +533,4 @@ CONFIG_RTE_TEST_PMD_RECORD_BURST_STATS=n
>   # Enable virtio support for container
>   #
>   CONFIG_RTE_VIRTIO_VDEV=y
> +CONFIG_RTE_VIRTIO_VDEV_QTEST=y
> diff --git a/drivers/net/virtio/Makefile b/drivers/net/virtio/Makefile
> index ef920f9..6c11378 100644
> --- a/drivers/net/virtio/Makefile
> +++ b/drivers/net/virtio/Makefile
> @@ -56,6 +56,10 @@ ifeq ($(CONFIG_RTE_VIRTIO_VDEV),y)
>   SRCS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += vhost_embedded.c
>   endif
>   
> +ifeq ($(CONFIG_RTE_VIRTIO_VDEV_QTEST),y)
> + SRCS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += qtest.c
> +endif
> +
>   # this lib depends upon:
>   DEPDIRS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += lib/librte_eal lib/librte_ether
>   DEPDIRS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += lib/librte_mempool 
> lib/librte_mbuf
> diff --git a/drivers/net/virtio/qtest.c b/drivers/net/virtio/qtest.c
> new file mode 100644
> index 000..061aab5
> --- /dev/null
> +++ b/drivers/net/virtio/qtest.c
> @@ -0,0 +1,1342 @@
> +/*-
> + *   BSD LICENSE
> + *
> + *   Copyright(c) 2016 IGEL Co., Ltd. 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 

[dpdk-dev] [PATCH v2 0/5] virtio: Tx performance improvements

2016-03-04 Thread Stephen Hemminger
On Fri, 4 Mar 2016 06:18:17 +
"Xie, Huawei"  wrote:

> On 1/14/2016 9:49 PM, Xie, Huawei wrote:
> > On 1/6/2016 8:04 PM, Thomas Monjalon wrote:
> >> 2016-01-05 08:10, Xie, Huawei:
> >>> On 10/26/2015 10:06 PM, Xie, Huawei wrote:
>  On 10/19/2015 1:16 PM, Stephen Hemminger wrote:
> > This is a tested version of the virtio Tx performance improvements
> > that I posted earlier on the list, and described at the DPDK Userspace
> > meeting in Dublin. Together they get a 25% performance improvement for
> > both small packet and large multi-segment packet case when testing
> > from DPDK guest application to Linux KVM host.
> >
> > Stephen Hemminger (5):
> >   virtio: clean up space checks on xmit
> >   virtio: don't use unlikely for normal tx stuff
> >   virtio: use indirect ring elements
> >   virtio: use any layout on transmit
> >   virtio: optimize transmit enqueue
>  There is one open why merge-able header is used in tx path. Since old
>  implementation is also using the merge-able header in tx path if this
>  feature is negotiated, i choose to ack the patch and address this later
>  if not now.
> 
>  Acked-by: Huawei Xie 
> >>> Thomas:

Resending them now. I don't understand the issue with merge-able header.
Virtio negotiation is symmetric, if receiver is using merge-able header
then the transmitter needs to send it also.


[dpdk-dev] [PATCH v2 1/7] vhost: refactor rte_vhost_dequeue_burst

2016-03-04 Thread Yuanhan Liu
On Thu, Mar 03, 2016 at 04:30:42PM +, Xie, Huawei wrote:
> On 2/18/2016 9:48 PM, Yuanhan Liu wrote:
> > +   mbuf_avail  = 0;
> > +   mbuf_offset = 0;
> > +   while (desc_avail || (desc->flags & VRING_DESC_F_NEXT) != 0) {
> > +   /* This desc reachs to its end, get the next one */
> > +   if (desc_avail == 0) {
> > +   desc = >desc[desc->next];
> > +
> > +   desc_addr = gpa_to_vva(dev, desc->addr);
> > +   rte_prefetch0((void *)(uintptr_t)desc_addr);
> > +
> > +   desc_offset = 0;
> > +   desc_avail  = desc->len;
> > +
> > +   PRINT_PACKET(dev, (uintptr_t)desc_addr, desc->len, 0);
> > +   }
> > +
> > +   /*
> > +* This mbuf reachs to its end, get a new one
> > +* to hold more data.
> > +*/
> > +   if (mbuf_avail == 0) {
> > +   cur = rte_pktmbuf_alloc(mbuf_pool);
> > +   if (unlikely(!cur)) {
> > +   RTE_LOG(ERR, VHOST_DATA, "Failed to "
> > +   "allocate memory for mbuf.\n");
> > +   if (head)
> > +   rte_pktmbuf_free(head);
> > +   return NULL;
> > +   }
> 
> We could always allocate the head mbuf before the loop, then we save the
> following branch and make the code more streamlined.
> It reminds me that this change prevents the possibility of mbuf bulk
> allocation, one solution is we pass the head mbuf from an additional
> parameter.

Yep, that's also something I have thought of.

> Btw, put unlikely before the check of mbuf_avail and checks elsewhere.

I don't think so. It would benifit for the small packets. What if,
however, when TSO or jumbo frame is enabled that we have big packets?

--yliu


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

2016-03-04 Thread Tetsuya Mukawa
On 2016/03/02 11:24, Qiu, Michael wrote:
> On 3/1/2016 10:19 AM, Tetsuya Mukawa wrote:
>> On 2016/03/01 11:00, Qiu, Michael wrote:
>>> On 2/26/2016 4:36 PM, Tetsuya Mukawa wrote:
 On 2016/02/26 13:29, Tetsuya Mukawa wrote:
> [...]
>
> BTW, I have set the frontend mergeable off.
> I have checked below cases.
>  - Case1: Disable mergeable feature in virtio-net PMD.
>  - Case2: Disable mergeable feature in virtio-net PMD and use
> '--txqflags=0xf01' option to use simple ring deploying.
> Both cases,  I still cannot see the drop.
>
> Anyway, I will send a few patch-series to determine the cause of drop.
> So, could you please apply them and check the performance to determine
> which cause the drop?
 Hi Michael,

 I may find what causes the drop.
 Could you please restart testpmd on guest when you see the drop, then
 check performance again?

 I guess the drop will occur only first time when testpmd on guest and
 host is connected.
 Here are rough steps.

 1. Start testpmd on host
 2. Start QEMU
 3. Start testpmd on guest

 Then you will see the drop.
 Probably, if testpmd on guest is restarted, then you don't see the drop
 again.

 4. Type 'quit' on guest.
 5. Start testpmd on guest again.
>> Hi Michael,
>>
>> I am sorry that above was caused by my miss configuration.
>> So please ignore it.
>> If you can have time today, could you please check v7 and v8 performance?
> Hi, Tetsuya
>
> I have tried the qemu case but seems it does not have any difference,
> maybe my configuration is wrong.
>
> What I used to test is container case from Jianfeng.  And I make a
> mistake that V6 compiled by GCC 5.3, but V9 with GCC 4.8, after using
> the same compiler, the performance almost the same.


Hi Michael,

Sorry for late replying. And thanks for your checking.

Thanks,
Tetsuya

> Thanks,
> Michael
>
>
>> Thanks,
>> Tetsuya
>>
>>> OK, I will help to tested today.
>>>
>>> Thanks,
>>> Michael



[dpdk-dev] [PATCH v2 1/7] vhost: refactor rte_vhost_dequeue_burst

2016-03-04 Thread Yuanhan Liu
On Thu, Mar 03, 2016 at 05:19:42PM +, Xie, Huawei wrote:
> On 2/18/2016 9:48 PM, Yuanhan Liu wrote:
> > [...]
> CCed changchun, the author for the chained handling of desc and mbuf.
> The change makes the code more readable, but i think the following
> commit message is simple and enough.

Hmm.., my commit log tells a full story:

- What is the issue? (messy/logic twisted code)

- What the code does? (And what are the challenges: few tricky places)

- What's the proposed solution to fix it. (the below pseudo code)

And you suggest me to get rid of the first 2 items and leave 3rd item
(a solution) only?

--yliu

> >
> > while (this_desc_is_not_drained_totally || has_next_desc) {
> > if (this_desc_has_drained_totally) {
> > this_desc = next_desc();
> > }
> >
> > if (mbuf_has_no_room) {
> > mbuf = allocate_a_new_mbuf();
> > }
> >
> > COPY(mbuf, desc);
> > }
> >
> > [...]
> >
> > This refactor makes the code much more readable (IMO), yet it reduces
> > binary code size (nearly 2K).
> I guess the reduced binary code size comes from reduced inline calls to
> mbuf allocation.
> 


  1   2   >