[dpdk-dev] [PATCH v2] common/dpaax: move shared sec HW code to common

2019-08-13 Thread Hemant Agrawal
The SEC HW code is being shared by multiple NXP based
drivers. It is better to place it at a common place.
the current users are:
1. DPAA2_SEC
2. DPAA_SEC
3. CAAM_JR


Signed-off-by: Hemant Agrawal 
---
 .../dpaa2_sec/hw => common/dpaax/caamflib}/compat.h   | 0
 .../{crypto/dpaa2_sec/hw => common/dpaax/caamflib}/desc.h | 4 ++--
 .../dpaa2_sec/hw => common/dpaax/caamflib}/desc/algo.h| 2 +-
 .../dpaa2_sec/hw => common/dpaax/caamflib}/desc/common.h  | 2 +-
 .../dpaa2_sec/hw => common/dpaax/caamflib}/desc/ipsec.h   | 2 +-
 .../dpaa2_sec/hw => common/dpaax/caamflib}/desc/pdcp.h| 2 +-
 .../{crypto/dpaa2_sec/hw => common/dpaax/caamflib}/rta.h  | 0
 .../dpaax/caamflib}/rta/fifo_load_store_cmd.h | 0
 .../hw => common/dpaax/caamflib}/rta/header_cmd.h | 0
 .../dpaa2_sec/hw => common/dpaax/caamflib}/rta/jump_cmd.h | 0
 .../dpaa2_sec/hw => common/dpaax/caamflib}/rta/key_cmd.h  | 0
 .../dpaa2_sec/hw => common/dpaax/caamflib}/rta/load_cmd.h | 0
 .../dpaa2_sec/hw => common/dpaax/caamflib}/rta/math_cmd.h | 0
 .../dpaa2_sec/hw => common/dpaax/caamflib}/rta/move_cmd.h | 0
 .../hw => common/dpaax/caamflib}/rta/nfifo_cmd.h  | 0
 .../hw => common/dpaax/caamflib}/rta/operation_cmd.h  | 0
 .../hw => common/dpaax/caamflib}/rta/protocol_cmd.h   | 0
 .../hw => common/dpaax/caamflib}/rta/sec_run_time_asm.h   | 4 ++--
 .../hw => common/dpaax/caamflib}/rta/seq_in_out_ptr_cmd.h | 0
 .../hw => common/dpaax/caamflib}/rta/signature_cmd.h  | 0
 .../hw => common/dpaax/caamflib}/rta/store_cmd.h  | 0
 drivers/crypto/caam_jr/Makefile   | 3 +--
 drivers/crypto/caam_jr/caam_jr.c  | 4 ++--
 drivers/crypto/caam_jr/caam_jr_hw.c   | 5 -
 drivers/crypto/caam_jr/caam_jr_pvt.h  | 2 +-
 drivers/crypto/caam_jr/caam_jr_uio.c  | 5 -
 drivers/crypto/caam_jr/meson.build| 2 +-
 drivers/crypto/dpaa2_sec/Makefile | 1 +
 drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c   | 6 +++---
 drivers/crypto/dpaa2_sec/meson.build  | 2 +-
 drivers/crypto/dpaa_sec/Makefile  | 3 +--
 drivers/crypto/dpaa_sec/dpaa_sec.c| 8 
 drivers/crypto/dpaa_sec/meson.build   | 3 ++-
 33 files changed, 25 insertions(+), 35 deletions(-)
 rename drivers/{crypto/dpaa2_sec/hw => common/dpaax/caamflib}/compat.h (100%)
 rename drivers/{crypto/dpaa2_sec/hw => common/dpaax/caamflib}/desc.h (99%)
 rename drivers/{crypto/dpaa2_sec/hw => common/dpaax/caamflib}/desc/algo.h (99%)
 rename drivers/{crypto/dpaa2_sec/hw => common/dpaax/caamflib}/desc/common.h 
(99%)
 rename drivers/{crypto/dpaa2_sec/hw => common/dpaax/caamflib}/desc/ipsec.h 
(99%)
 rename drivers/{crypto/dpaa2_sec/hw => common/dpaax/caamflib}/desc/pdcp.h (99%)
 rename drivers/{crypto/dpaa2_sec/hw => common/dpaax/caamflib}/rta.h (100%)
 rename drivers/{crypto/dpaa2_sec/hw => 
common/dpaax/caamflib}/rta/fifo_load_store_cmd.h (100%)
 rename drivers/{crypto/dpaa2_sec/hw => common/dpaax/caamflib}/rta/header_cmd.h 
(100%)
 rename drivers/{crypto/dpaa2_sec/hw => common/dpaax/caamflib}/rta/jump_cmd.h 
(100%)
 rename drivers/{crypto/dpaa2_sec/hw => common/dpaax/caamflib}/rta/key_cmd.h 
(100%)
 rename drivers/{crypto/dpaa2_sec/hw => common/dpaax/caamflib}/rta/load_cmd.h 
(100%)
 rename drivers/{crypto/dpaa2_sec/hw => common/dpaax/caamflib}/rta/math_cmd.h 
(100%)
 rename drivers/{crypto/dpaa2_sec/hw => common/dpaax/caamflib}/rta/move_cmd.h 
(100%)
 rename drivers/{crypto/dpaa2_sec/hw => common/dpaax/caamflib}/rta/nfifo_cmd.h 
(100%)
 rename drivers/{crypto/dpaa2_sec/hw => 
common/dpaax/caamflib}/rta/operation_cmd.h (100%)
 rename drivers/{crypto/dpaa2_sec/hw => 
common/dpaax/caamflib}/rta/protocol_cmd.h (100%)
 rename drivers/{crypto/dpaa2_sec/hw => 
common/dpaax/caamflib}/rta/sec_run_time_asm.h (99%)
 rename drivers/{crypto/dpaa2_sec/hw => 
common/dpaax/caamflib}/rta/seq_in_out_ptr_cmd.h (100%)
 rename drivers/{crypto/dpaa2_sec/hw => 
common/dpaax/caamflib}/rta/signature_cmd.h (100%)
 rename drivers/{crypto/dpaa2_sec/hw => common/dpaax/caamflib}/rta/store_cmd.h 
(100%)

diff --git a/drivers/crypto/dpaa2_sec/hw/compat.h 
b/drivers/common/dpaax/caamflib/compat.h
similarity index 100%
rename from drivers/crypto/dpaa2_sec/hw/compat.h
rename to drivers/common/dpaax/caamflib/compat.h
diff --git a/drivers/crypto/dpaa2_sec/hw/desc.h 
b/drivers/common/dpaax/caamflib/desc.h
similarity index 99%
rename from drivers/crypto/dpaa2_sec/hw/desc.h
rename to drivers/common/dpaax/caamflib/desc.h
index 5d99dd8af..5d3bd8ad1 100644
--- a/drivers/crypto/dpaa2_sec/hw/desc.h
+++ b/drivers/common/dpaax/caamflib/desc.h
@@ -13,9 +13,9 @@
 #ifndef __RTA_DESC_H__
 #define __RTA_DESC_H__
 
-/* hw/compat.h is not delivered in kernel */
+/* compat.h is not delivered in kernel */
 #ifndef __KERNEL__
-#include "hw/compat.h"
+#include "compat.h"
 #endif
 
 /* Max siz

Re: [dpdk-dev] [v5] net/i40e: fix vf runtime queues rss config

2019-08-13 Thread Zhang, Xiao



> -Original Message-
> From: Ye, Xiaolong
> Sent: Tuesday, August 13, 2019 2:28 PM
> To: Zhang, Xiao 
> Cc: dev@dpdk.org; Xing, Beilei ; sta...@dpdk.org
> Subject: Re: [dpdk-dev] [v5] net/i40e: fix vf runtime queues rss config
> 
> Hi, Xiao
> 
> On 08/13, Xiao Zhang wrote:
> >I40evf queue can not work properly with kernel pf driver. Eg. when
> >configure 8 queues pair, only 4 queues can receive packets, and half
> >packets will be lost if using 2 queues pair.
> >This issue is caused by misconfiguration of look up table, use aq
> >command to setup the lut to make it work properly.
> 
> So the original code of lookup table configuration is problematic? Can we just
> remove them?

The original code does not work with device X722 VF. For other devices using 
i40evf, the original code works.
The commit message may missed this information.
And the new code only workable for devices capable with AQ command, so we can 
not remove the original code.

> 
> Thanks,
> Xiaolong
> 
> >
> >Fixes: cea7a51c1750 ("i40evf: support RSS")
> >Cc: sta...@dpdk.org
> >
> >Signed-off-by: Xiao Zhang 
> >---
> >v5 fix compile issue
> >v4 move local variable definition to the begin of the function
> >v3 move LUT configuration in to i40evf_configure_rss
> >v2 change for loop format to avoid build patch issue
> >---
> > drivers/net/i40e/i40e_ethdev_vf.c | 32
> >++--
> > 1 file changed, 26 insertions(+), 6 deletions(-)
> >
> >diff --git a/drivers/net/i40e/i40e_ethdev_vf.c
> >b/drivers/net/i40e/i40e_ethdev_vf.c
> >index 308fb98..c77b30c 100644
> >--- a/drivers/net/i40e/i40e_ethdev_vf.c
> >+++ b/drivers/net/i40e/i40e_ethdev_vf.c
> >@@ -2598,7 +2598,10 @@ i40evf_config_rss(struct i40e_vf *vf)
> > struct i40e_hw *hw = I40E_VF_TO_HW(vf);
> > struct rte_eth_rss_conf rss_conf;
> > uint32_t i, j, lut = 0, nb_q = (I40E_VFQF_HLUT_MAX_INDEX + 1) * 4;
> >+uint32_t rss_lut_size = (I40E_VFQF_HLUT1_MAX_INDEX + 1) * 4;
> > uint16_t num;
> >+uint8_t *lut_info;
> >+int ret;
> >
> > if (vf->dev_data->dev_conf.rxmode.mq_mode != ETH_MQ_RX_RSS) {
> > i40evf_disable_rss(vf);
> >@@ -2608,12 +2611,29 @@ i40evf_config_rss(struct i40e_vf *vf)
> >
> > num = RTE_MIN(vf->dev_data->nb_rx_queues,
> I40E_MAX_QP_NUM_PER_VF);
> > /* Fill out the look up table */
> >-for (i = 0, j = 0; i < nb_q; i++, j++) {
> >-if (j >= num)
> >-j = 0;
> >-lut = (lut << 8) | j;
> >-if ((i & 3) == 3)
> >-I40E_WRITE_REG(hw, I40E_VFQF_HLUT(i >> 2), lut);
> >+if (!(vf->flags & I40E_FLAG_RSS_AQ_CAPABLE)) {
> >+for (i = 0, j = 0; i < nb_q; i++, j++) {
> >+if (j >= num)
> >+j = 0;
> >+lut = (lut << 8) | j;
> >+if ((i & 3) == 3)
> >+I40E_WRITE_REG(hw, I40E_VFQF_HLUT(i >> 2),
> lut);
> >+}
> >+} else {
> >+lut_info = rte_zmalloc("i40e_rss_lut", rss_lut_size, 0);
> >+if (!lut_info) {
> >+PMD_DRV_LOG(ERR, "No memory can be allocated");
> >+return -ENOMEM;
> >+}
> >+
> >+for (i = 0; i < rss_lut_size; i++)
> >+lut_info[i] = i % vf->num_queue_pairs;
> >+
> >+ret = i40evf_set_rss_lut(&vf->vsi, lut_info,
> >+ rss_lut_size);
> >+rte_free(lut_info);
> >+if (ret)
> >+return ret;
> > }
> >
> > rss_conf = vf->dev_data->dev_conf.rx_adv_conf.rss_conf;
> >--
> >2.7.4
> >


Re: [dpdk-dev] DPDK failes to initailze on VMXNet3

2019-08-13 Thread vikram T
Additionally the dpdk-devbind.py shows as follows:
[root@vprobe mnt]#
/var/cache/ocsm/dpdk/dpdk-18.11/usertools/dpdk-devbind.py -s

Network devices using DPDK-compatible driver

:03:00.0 'VMXNET3 Ethernet Controller 07b0' drv=igb_uio unused=vmxnet3

Network devices using kernel driver
===
:02:00.0 '82545EM Gigabit Ethernet Controller (Copper) 100f' if=ens32
drv=e1000 unused=igb_uio *Active*

Any pointers would be very helpful
Thanks in Advance

Regards
Vikram

On Tue, Aug 13, 2019 at 9:39 AM vikram T  wrote:

> Hi,
> When initialing the DPDK failed with the Below error on VMXNet3:
>
>
>
>
>
>
>
>
>
> *Aug  9 14:05:34 vprobe rat_dpdk_sniffer[10768]: EAL: Probing VFIO
> support...Aug  9 14:05:34 vprobe rat_dpdk_sniffer[10768]: EAL: PCI device
> :02:00.0 on NUMA socket -1Aug  9 14:05:34 vprobe
> rat_dpdk_sniffer[10768]: EAL:   Invalid NUMA socket, default to 0Aug  9
> 14:05:34 vprobe rat_dpdk_sniffer[10768]: EAL:   probe driver: 8086:100f
> net_e1000_emAug  9 14:05:34 vprobe rat_dpdk_sniffer[10768]: EAL: PCI device
> :03:00.0 on NUMA socket 0Aug  9 14:05:34 vprobe kernel: igb_uio
> :03:00.0: uio device registered with irq 58Aug  9 14:05:34 vprobe
> rat_dpdk_sniffer[10768]: EAL:   probe driver: 15ad:7b0 net_vmxnet3Aug  9
> 14:05:34 vprobe rat_dpdk_sniffer[10768]: PANIC in
> rte_eth_dev_shared_data_prepare():Aug  9 14:05:34 vprobe
> rat_dpdk_sniffer[10768]: Cannot allocate ethdev shared data*
>
> With the BackTrace pointing to :
>
>
>
>
>
>
>
>
>
>
>
>
>
> *(gdb) bt#0  0x754612c7 in raise () from /lib64/libc.so.6#1
>  0x754629b8 in abort () from /lib64/libc.so.6#2  0x004eab34
> in __rte_panic ()#3  0x0050cbf8 in rte_eth_dev_shared_data_prepare
> ()#4  0x0050de1c in rte_eth_dev_allocate ()#5  0x00667025
> in eth_vmxnet3_pci_probe ()#6  0x005b4178 in pci_probe_all_drivers
> ()#7  0x005b42bc in rte_pci_probe ()#8  0x0053642c in
> rte_bus_probe ()#9  0x005242ee in rte_eal_init ()#10
> 0x006c24c7 in rat::dpdk::init (cfg=...) at
> ../../rat/src/sniffer/dpdk_utils.cc:71*
>
> The sample application testpmd was running successfully:
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> *[root@vprobe test-pmd]# ./testpmd -l 0-3 -n 4 -- -i --portmask=0x1
> --nb-cores=2EAL: Detected 16 lcore(s)EAL: Detected 4 NUMA nodesEAL:
> Multi-process socket /var/run/dpdk/rte/mp_socketEAL: No free hugepages
> reported in hugepages-2048kBEAL: No free hugepages reported in
> hugepages-2048kBEAL: Probing VFIO support...EAL: PCI device :02:00.0 on
> NUMA socket -1EAL:   Invalid NUMA socket, default to 0EAL:   probe driver:
> 8086:100f net_e1000_emEAL: PCI device :03:00.0 on NUMA socket 0EAL:
> probe driver: 15ad:7b0 net_vmxnet3Interactive-mode selectedtestpmd: create
> a new mbuf pool : n=171456, size=2176, socket=0testpmd:
> preferred mempool ops selected: ring_mp_mcWarning! port-topology=paired and
> odd forward ports number, the last port will pair with itself.Configuring
> Port 0 (socket 0)Port 0: 00:0C:29:36:B2:F1Checking link
> statuses...Donetestpmd> startio packet forwarding - ports=1 - cores=1 -
> streams=1 - NUMA support enabled, MP allocation mode: nativeLogical Core 1
> (socket 0) forwards packets on 1 streams:  RX P=0/Q=0 (socket 0) -> TX
> P=0/Q=0 (socket 0) peer=02:00:00:00:00:00*
>
> Additionally I observed that on this virtual machine file
> *"/sys/bus/pci/devices/:03:00.0/numa_node"* is set as -1 and when
> sample application are run the programs detects 4 NUMA Nodes.
> But on any other physical machine it is properly set to appropriate
> numa_node.
>
>
> It would be of great help if I get pointers on why the initialization
> fails here.
>
> Regards
> Vikram
>


Re: [dpdk-dev] [v5] net/i40e: fix vf runtime queues rss config

2019-08-13 Thread Ye Xiaolong
On 08/13, Zhang, Xiao wrote:
>
>
>> -Original Message-
>> From: Ye, Xiaolong
>> Sent: Tuesday, August 13, 2019 2:28 PM
>> To: Zhang, Xiao 
>> Cc: dev@dpdk.org; Xing, Beilei ; sta...@dpdk.org
>> Subject: Re: [dpdk-dev] [v5] net/i40e: fix vf runtime queues rss config
>> 
>> Hi, Xiao
>> 
>> On 08/13, Xiao Zhang wrote:
>> >I40evf queue can not work properly with kernel pf driver. Eg. when
>> >configure 8 queues pair, only 4 queues can receive packets, and half
>> >packets will be lost if using 2 queues pair.
>> >This issue is caused by misconfiguration of look up table, use aq
>> >command to setup the lut to make it work properly.
>> 
>> So the original code of lookup table configuration is problematic? Can we 
>> just
>> remove them?
>
>The original code does not work with device X722 VF. For other devices using 
>i40evf, the original code works.
>The commit message may missed this information.
>And the new code only workable for devices capable with AQ command, so we can 
>not remove the original code.

Ok, can you add these info in your commit message and send a new version?

Thanks,
Xiaolong

>
>> 
>> Thanks,
>> Xiaolong
>> 
>> >
>> >Fixes: cea7a51c1750 ("i40evf: support RSS")
>> >Cc: sta...@dpdk.org
>> >
>> >Signed-off-by: Xiao Zhang 
>> >---
>> >v5 fix compile issue
>> >v4 move local variable definition to the begin of the function
>> >v3 move LUT configuration in to i40evf_configure_rss
>> >v2 change for loop format to avoid build patch issue
>> >---
>> > drivers/net/i40e/i40e_ethdev_vf.c | 32
>> >++--
>> > 1 file changed, 26 insertions(+), 6 deletions(-)
>> >
>> >diff --git a/drivers/net/i40e/i40e_ethdev_vf.c
>> >b/drivers/net/i40e/i40e_ethdev_vf.c
>> >index 308fb98..c77b30c 100644
>> >--- a/drivers/net/i40e/i40e_ethdev_vf.c
>> >+++ b/drivers/net/i40e/i40e_ethdev_vf.c
>> >@@ -2598,7 +2598,10 @@ i40evf_config_rss(struct i40e_vf *vf)
>> >struct i40e_hw *hw = I40E_VF_TO_HW(vf);
>> >struct rte_eth_rss_conf rss_conf;
>> >uint32_t i, j, lut = 0, nb_q = (I40E_VFQF_HLUT_MAX_INDEX + 1) * 4;
>> >+   uint32_t rss_lut_size = (I40E_VFQF_HLUT1_MAX_INDEX + 1) * 4;
>> >uint16_t num;
>> >+   uint8_t *lut_info;
>> >+   int ret;
>> >
>> >if (vf->dev_data->dev_conf.rxmode.mq_mode != ETH_MQ_RX_RSS) {
>> >i40evf_disable_rss(vf);
>> >@@ -2608,12 +2611,29 @@ i40evf_config_rss(struct i40e_vf *vf)
>> >
>> >num = RTE_MIN(vf->dev_data->nb_rx_queues,
>> I40E_MAX_QP_NUM_PER_VF);
>> >/* Fill out the look up table */
>> >-   for (i = 0, j = 0; i < nb_q; i++, j++) {
>> >-   if (j >= num)
>> >-   j = 0;
>> >-   lut = (lut << 8) | j;
>> >-   if ((i & 3) == 3)
>> >-   I40E_WRITE_REG(hw, I40E_VFQF_HLUT(i >> 2), lut);
>> >+   if (!(vf->flags & I40E_FLAG_RSS_AQ_CAPABLE)) {
>> >+   for (i = 0, j = 0; i < nb_q; i++, j++) {
>> >+   if (j >= num)
>> >+   j = 0;
>> >+   lut = (lut << 8) | j;
>> >+   if ((i & 3) == 3)
>> >+   I40E_WRITE_REG(hw, I40E_VFQF_HLUT(i >> 2),
>> lut);
>> >+   }
>> >+   } else {
>> >+   lut_info = rte_zmalloc("i40e_rss_lut", rss_lut_size, 0);
>> >+   if (!lut_info) {
>> >+   PMD_DRV_LOG(ERR, "No memory can be allocated");
>> >+   return -ENOMEM;
>> >+   }
>> >+
>> >+   for (i = 0; i < rss_lut_size; i++)
>> >+   lut_info[i] = i % vf->num_queue_pairs;
>> >+
>> >+   ret = i40evf_set_rss_lut(&vf->vsi, lut_info,
>> >+rss_lut_size);
>> >+   rte_free(lut_info);
>> >+   if (ret)
>> >+   return ret;
>> >}
>> >
>> >rss_conf = vf->dev_data->dev_conf.rx_adv_conf.rss_conf;
>> >--
>> >2.7.4
>> >


Re: [dpdk-dev] [PATCH] version: 19.11-rc0

2019-08-13 Thread David Marchand
On Tue, Aug 13, 2019 at 1:17 AM Thomas Monjalon  wrote:
>
> 12/08/2019 13:43, David Marchand:
> > Start a new release cycle with empty release notes.
> >
> > Signed-off-by: David Marchand 
> > ---
> >  VERSION|   2 +-
> >  doc/guides/rel_notes/release_19_11.rst | 214 
> > +
>
> doc/guides/rel_notes/release_19_11.rst: WARNING: document isn't included in 
> any toctree

Indeed, trusted your patch on 19.05-rc0 and the CI did not report any
error (normal when it does not actually build the doc ;-)).
I will send a fix for the CI and respin.


> 1/ the new file must be linked in doc/guides/rel_notes/index.rst
>
> Please compare with the latest release notes, I see two more misses:
> 2/ .. include:: 

It is unused at this point.
Do you want to include it in prevision of future changes?


> 3/ increased lib versions

I'll check.


-- 
David Marchand


Re: [dpdk-dev] [v5] net/i40e: fix vf runtime queues rss config

2019-08-13 Thread Zhang, Xiao



> -Original Message-
> From: Ye, Xiaolong
> Sent: Tuesday, August 13, 2019 3:37 PM
> To: Zhang, Xiao 
> Cc: dev@dpdk.org; Xing, Beilei ; sta...@dpdk.org
> Subject: Re: [dpdk-dev] [v5] net/i40e: fix vf runtime queues rss config
> 
> On 08/13, Zhang, Xiao wrote:
> >
> >
> >> -Original Message-
> >> From: Ye, Xiaolong
> >> Sent: Tuesday, August 13, 2019 2:28 PM
> >> To: Zhang, Xiao 
> >> Cc: dev@dpdk.org; Xing, Beilei ;
> >> sta...@dpdk.org
> >> Subject: Re: [dpdk-dev] [v5] net/i40e: fix vf runtime queues rss
> >> config
> >>
> >> Hi, Xiao
> >>
> >> On 08/13, Xiao Zhang wrote:
> >> >I40evf queue can not work properly with kernel pf driver. Eg. when
> >> >configure 8 queues pair, only 4 queues can receive packets, and half
> >> >packets will be lost if using 2 queues pair.
> >> >This issue is caused by misconfiguration of look up table, use aq
> >> >command to setup the lut to make it work properly.
> >>
> >> So the original code of lookup table configuration is problematic?
> >> Can we just remove them?
> >
> >The original code does not work with device X722 VF. For other devices using
> i40evf, the original code works.
> >The commit message may missed this information.
> >And the new code only workable for devices capable with AQ command, so we
> can not remove the original code.
> 
> Ok, can you add these info in your commit message and send a new version?
> 

Yes, it's ok.

> Thanks,
> Xiaolong
> 
> >
> >>
> >> Thanks,
> >> Xiaolong
> >>
> >> >
> >> >Fixes: cea7a51c1750 ("i40evf: support RSS")
> >> >Cc: sta...@dpdk.org
> >> >
> >> >Signed-off-by: Xiao Zhang 
> >> >---
> >> >v5 fix compile issue
> >> >v4 move local variable definition to the begin of the function
> >> >v3 move LUT configuration in to i40evf_configure_rss
> >> >v2 change for loop format to avoid build patch issue
> >> >---
> >> > drivers/net/i40e/i40e_ethdev_vf.c | 32
> >> >++--
> >> > 1 file changed, 26 insertions(+), 6 deletions(-)
> >> >
> >> >diff --git a/drivers/net/i40e/i40e_ethdev_vf.c
> >> >b/drivers/net/i40e/i40e_ethdev_vf.c
> >> >index 308fb98..c77b30c 100644
> >> >--- a/drivers/net/i40e/i40e_ethdev_vf.c
> >> >+++ b/drivers/net/i40e/i40e_ethdev_vf.c
> >> >@@ -2598,7 +2598,10 @@ i40evf_config_rss(struct i40e_vf *vf)
> >> >  struct i40e_hw *hw = I40E_VF_TO_HW(vf);
> >> >  struct rte_eth_rss_conf rss_conf;
> >> >  uint32_t i, j, lut = 0, nb_q = (I40E_VFQF_HLUT_MAX_INDEX + 1) * 4;
> >> >+ uint32_t rss_lut_size = (I40E_VFQF_HLUT1_MAX_INDEX + 1) * 4;
> >> >  uint16_t num;
> >> >+ uint8_t *lut_info;
> >> >+ int ret;
> >> >
> >> >  if (vf->dev_data->dev_conf.rxmode.mq_mode != ETH_MQ_RX_RSS) {
> >> >  i40evf_disable_rss(vf);
> >> >@@ -2608,12 +2611,29 @@ i40evf_config_rss(struct i40e_vf *vf)
> >> >
> >> >  num = RTE_MIN(vf->dev_data->nb_rx_queues,
> >> I40E_MAX_QP_NUM_PER_VF);
> >> >  /* Fill out the look up table */
> >> >- for (i = 0, j = 0; i < nb_q; i++, j++) {
> >> >- if (j >= num)
> >> >- j = 0;
> >> >- lut = (lut << 8) | j;
> >> >- if ((i & 3) == 3)
> >> >- I40E_WRITE_REG(hw, I40E_VFQF_HLUT(i >> 2), lut);
> >> >+ if (!(vf->flags & I40E_FLAG_RSS_AQ_CAPABLE)) {
> >> >+ for (i = 0, j = 0; i < nb_q; i++, j++) {
> >> >+ if (j >= num)
> >> >+ j = 0;
> >> >+ lut = (lut << 8) | j;
> >> >+ if ((i & 3) == 3)
> >> >+ I40E_WRITE_REG(hw, I40E_VFQF_HLUT(i >> 2),
> >> lut);
> >> >+ }
> >> >+ } else {
> >> >+ lut_info = rte_zmalloc("i40e_rss_lut", rss_lut_size, 0);
> >> >+ if (!lut_info) {
> >> >+ PMD_DRV_LOG(ERR, "No memory can be allocated");
> >> >+ return -ENOMEM;
> >> >+ }
> >> >+
> >> >+ for (i = 0; i < rss_lut_size; i++)
> >> >+ lut_info[i] = i % vf->num_queue_pairs;
> >> >+
> >> >+ ret = i40evf_set_rss_lut(&vf->vsi, lut_info,
> >> >+  rss_lut_size);
> >> >+ rte_free(lut_info);
> >> >+ if (ret)
> >> >+ return ret;
> >> >  }
> >> >
> >> >  rss_conf = vf->dev_data->dev_conf.rx_adv_conf.rss_conf;
> >> >--
> >> >2.7.4
> >> >


Re: [dpdk-dev] [PATCH] version: 19.11-rc0

2019-08-13 Thread Thomas Monjalon
13/08/2019 09:46, David Marchand:
> On Tue, Aug 13, 2019 at 1:17 AM Thomas Monjalon  wrote:
> >
> > 12/08/2019 13:43, David Marchand:
> > > Start a new release cycle with empty release notes.
> > >
> > > Signed-off-by: David Marchand 
> > > ---
> > >  VERSION|   2 +-
> > >  doc/guides/rel_notes/release_19_11.rst | 214 
> > > +
> >
> > doc/guides/rel_notes/release_19_11.rst: WARNING: document isn't included in 
> > any toctree
> 
> Indeed, trusted your patch on 19.05-rc0 and the CI did not report any
> error (normal when it does not actually build the doc ;-)).

Don't trust anyone ;)

> I will send a fix for the CI and respin.
> 
> 
> > 1/ the new file must be linked in doc/guides/rel_notes/index.rst
> >
> > Please compare with the latest release notes, I see two more misses:
> > 2/ .. include:: 
> 
> It is unused at this point.
> Do you want to include it in prevision of future changes?

I think it is good to have, so we can use |reg| or other signs
without wondering why it does not work.
I remember Bruce wanted to have it.

> > 3/ increased lib versions
> 
> I'll check.

Thanks




Re: [dpdk-dev] [RFC PATCH 02/13] add vhost packed ring fast enqueue function

2019-08-13 Thread Liu, Yong
Hi Jason,
Unrolled option effect is highly dependent on compilers. Just tried some 
compilers around my side.
Vhost en-queue/de-queue path is separated into small parts which can assure 
compilers can do unroll optimization.
Since only GCC8 support unroll program, only GCC8 added "#pragma GCC unroll".

GCC8 and Clang shown much less performance gap than ICC and elder GCC. 
Now we have one better performance with fixed batch version code and another 
less performance with auto unrolled version.
What's your option on the choice? Thanks in advance. 

||---|-|--|
| Compiler   | Auto unrolled | Fixed batch | Gap  |
||---|-|--|
| Clang6.0.0 | 13.1M | 13.5M   | 0.4M |
||---|-|--|
| GCC 8.3.0  | 13.9M | 14.4M   | 0.5M |
||---|-|--|
| GCC 7.4.0  | 12.6M | 13.5M   | 0.9M |
||---|-|--|
| ICC 19.0.4.243 | 11.0M | 12.3M   | 1.3M |
||---|-|--|

Regards,
Marvin

> -Original Message-
> From: Jason Wang [mailto:jasow...@redhat.com]
> Sent: Thursday, July 11, 2019 5:55 PM
> To: Liu, Yong ; Bie, Tiwei ;
> maxime.coque...@redhat.com; dev@dpdk.org
> Subject: Re: [dpdk-dev] [RFC PATCH 02/13] add vhost packed ring fast
> enqueue function
> 
> 
> On 2019/7/11 下午5:49, Liu, Yong wrote:
> >
> >> -Original Message-
> >> From: Jason Wang [mailto:jasow...@redhat.com]
> >> Sent: Thursday, July 11, 2019 12:11 PM
> >> To: Liu, Yong ; Bie, Tiwei ;
> >> maxime.coque...@redhat.com; dev@dpdk.org
> >> Subject: Re: [dpdk-dev] [RFC PATCH 02/13] add vhost packed ring fast
> enqueue
> >> function
> >>
> >>
> >> On 2019/7/10 下午3:30, Liu, Yong wrote:
>  -Original Message-
>  From: Jason Wang [mailto:jasow...@redhat.com]
>  Sent: Wednesday, July 10, 2019 12:28 PM
>  To: Liu, Yong ; Bie, Tiwei ;
>  maxime.coque...@redhat.com; dev@dpdk.org
>  Subject: Re: [dpdk-dev] [RFC PATCH 02/13] add vhost packed ring fast
> >> enqueue
>  function
> 
> 
>  On 2019/7/9 上午1:13, Marvin Liu wrote:
> > In fast enqueue function, will first check whether descriptors are
> > cache aligned. Fast enqueue function will check prerequisites in the
> > beginning. Fast enqueue function do not support chained mbufs, normal
> > function will handle that.
> >
> > Signed-off-by: Marvin Liu 
>  Any reason for not letting compiler to unroll the loops?
> 
> >>> Hi Jason,
> >>> I'm not sure about how much compiler can help on unrolling loops as it
> >> can't know how much loops will create in one call.
> >>> After force not using unroll-loop optimization by "-fno-unroll-loops",
> >> virtio_dev_rx_packed function size remained the same.
> >>> So look like gcc unroll-loop optimization do not help here.
> >>
> >> I meant something like "pragma GCC unroll N" just before the loop you
> >> want unrolled.
> >>
> >> Thanks
> >>
> > Hi Jason,
> > Just tired with gcc8.3.0 and master code, only 0.1Mpps performance gain
> with "#pragma GCC unroll".
> > I think this compiler pragma is not helpful in the big loop which
> contained so much functions.
> >
> > Thanks,
> > Marvin
> 
> 
> Yes, it probably need some trick e.g break the big loop into small ones.
> What I want do here is unroll the loop based on
> PACKED_DESC_PER_CACHELINE instead of a hard-coded 4.
> 
> Thanks
> 
> 
> >>> And fast enqueue function not only did unroll loop, it also checked
> cache
> >> alignment which can help performance in another side.
> >>> Regards,
> >>> Marvin
> >>>
>  Thanks
> 


Re: [dpdk-dev] [PATCH 2/6] drivers: add some reasons for meson disabling

2019-08-13 Thread Luca Boccassi
On Tue, 2019-08-13 at 01:03 +0200, Thomas Monjalon wrote:
> Some drivers were missing reasons text for their disabling in meson.
> 
> Signed-off-by: Thomas Monjalon <
> tho...@monjalon.net
> >
> ---
>  drivers/baseband/turbo_sw/meson.build | 1 +
>  drivers/net/memif/meson.build | 5 +++--
>  drivers/raw/ioat/meson.build  | 1 +
>  3 files changed, 5 insertions(+), 2 deletions(-)
> 

Acked-by: Luca Boccassi 

-- 
Kind regards,
Luca Boccassi



Re: [dpdk-dev] [PATCH 1/6] build: remove redundant libs from pkgconfig

2019-08-13 Thread Luca Boccassi
On Tue, 2019-08-13 at 01:03 +0200, Thomas Monjalon wrote:
> As explained in drivers/meson.build,
> "
>   For the find_library() case (but not with dependency()) we also
>   need to specify the "-l" flags in pkgconfig_extra_libs variable
>   too, so that it can be reflected in the pkgconfig output for
>   static builds.
> "
> 
> The commit e30b4e566f47 ("build: improve dependency handling")
> must be followed up with this one in order to remove more
> occurences of pkgconfig_extra_libs redundant with use of
> dependency().
> 
> Fixes: f1debd77efaf ("net/af_xdp: introduce AF_XDP PMD")
> Cc: 
> xiaolong...@intel.com
> 
> Fixes: 3c32e89f68e1 ("compress/isal: add skeleton ISA-L compression
> PMD")
> Cc: 
> lee.d...@intel.com
> 
> Cc: 
> bl...@debian.org
> 
> Cc: 
> sta...@dpdk.org
> 
> 
> Signed-off-by: Thomas Monjalon <
> tho...@monjalon.net
> >
> ---
>  drivers/compress/isal/meson.build | 1 -
>  drivers/net/af_xdp/meson.build| 1 -
>  2 files changed, 2 deletions(-)
> 
> diff --git a/drivers/compress/isal/meson.build
> b/drivers/compress/isal/meson.build
> index 67b5c4aae..25578880d 100644
> --- a/drivers/compress/isal/meson.build
> +++ b/drivers/compress/isal/meson.build
> @@ -10,6 +10,5 @@ endif
>  deps += 'bus_vdev'
>  sources = files('isal_compress_pmd.c', 'isal_compress_pmd_ops.c')
>  ext_deps += dep
> -pkgconfig_extra_libs += '-lisal'
>  
>  allow_experimental_apis = true
> diff --git a/drivers/net/af_xdp/meson.build
> b/drivers/net/af_xdp/meson.build
> index ac679b92b..307aa0e38 100644
> --- a/drivers/net/af_xdp/meson.build
> +++ b/drivers/net/af_xdp/meson.build
> @@ -10,7 +10,6 @@ endif
>  
>  if bpf_dep.found() and cc.has_header('bpf/xsk.h') and
> cc.has_header('linux/if_xdp.h')
>   ext_deps += bpf_dep
> - pkgconfig_extra_libs += '-lbpf'
>  else
>   build = false
>   reason = 'missing dependency, "libbpf"'
> 

Acked-by: Luca Boccassi 

-- 
Kind regards,
Luca Boccassi


Re: [dpdk-dev] [PATCH 3/6] net/mlx: fix meson build with custom dependency path

2019-08-13 Thread Luca Boccassi
On Tue, 2019-08-13 at 01:03 +0200, Thomas Monjalon wrote:
> If rdma-core is not installed in a standard directory of the system,
> it is possible to specify the location of the pkgconfig file via
> an environment variable:
> PKG_CONFIG_PATH=$PKG_CONFIG_PATH:~/rdma-core/build/lib/pkgconfig
> 
> In this case, the dependency may become mandatory to specify
> for the configuration tests (checking dependency symbols or fields).
> 
> Some spacing is also fixed around.
> 
> Fixes: 8e4937640022 ("net/mlx4: add external allocator for Verbs
> object")
> Fixes: 1dd7c7e38c19 ("net/mlx4: support meson build")
> Fixes: 96d7c62a70c7 ("net/mlx5: support meson build")
> Cc: 
> sta...@dpdk.org
> 
> 
> Suggested-by: Luca Boccassi <
> bl...@debian.org
> >
> Signed-off-by: Thomas Monjalon <
> tho...@monjalon.net
> >
> ---
>  drivers/net/mlx4/meson.build | 9 +
>  drivers/net/mlx5/meson.build | 7 ---
>  2 files changed, 9 insertions(+), 7 deletions(-)

Acked-by: Luca Boccassi 

-- 
Kind regards,
Luca Boccassi


Re: [dpdk-dev] [PATCH 5/6] devtools: test compiler availability only once

2019-08-13 Thread Luca Boccassi
On Tue, 2019-08-13 at 01:03 +0200, Thomas Monjalon wrote:
> The compilation test is skipped if the compiler is not available.
> In the case of gcc/arm, it was tested both in the generic function
> "build" and in the cross-compilation section.
> 
> By passing the compiler as argument of the generic function,
> the test with "command" is done only once.
> 
> This small clean-up has the benefit of introducing the compiler
> parameter to be used later in another improvement.
> 
> Signed-off-by: Thomas Monjalon <
> tho...@monjalon.net
> >
> ---
>  devtools/test-meson-builds.sh | 33 -
>  1 file changed, 16 insertions(+), 17 deletions(-)

Acked-by: Luca Boccassi 

-- 
Kind regards,
Luca Boccassi


Re: [dpdk-dev] [dpdk-stable] [PATCH 4/6] net/mlx: fix build with make and recent gcc

2019-08-13 Thread Luca Boccassi
On Tue, 2019-08-13 at 01:03 +0200, Thomas Monjalon wrote:
> With VERBOSE=1, this error was seen in debug mode with gcc 9.1:
> 
> In file included from /tmp/dpdk.auto-config-h.sh.c.w0VWMi:1:
> In file included from rdma-core/build/include/infiniband/mlx5dv.h:47:
> In file included from rdma-core/build/include/infiniband/verbs.h:46:
> In file included from rdma-
> core/build/include/infiniband/verbs_api.h:66:
> In file included from rdma-
> core/build/include/infiniband/ib_user_ioctl_verbs.h:38:
> include/rdma/ib_user_verbs.h:161:28: fatal error:
> zero size arrays are an extension [-Wzero-length-array]
> __aligned_u64 driver_data0;
> ^
> 1 error generated.
> 
> As a result, buildtools/auto-config-h.sh was not generating
> a correct autoconf file, so the compilation was generating such
> error:
> 
> fatal error: redefinition of
> 'mlx5_ib_uapi_flow_action_packet_reformat_type'
> 
> It is fixed by disabling -pedantic option when calling auto-config-
> h.sh
> from the makefile-based system.
> 
> Cc: 
> adrien.mazarg...@6wind.com
> 
> Cc: 
> sta...@dpdk.org
> 
> 
> Signed-off-by: Thomas Monjalon <
> tho...@monjalon.net
> >

Acked-by: Luca Boccassi 

-- 
Kind regards,
Luca Boccassi


Re: [dpdk-dev] [PATCH 6/6] devtools: load target-specific compilation environment

2019-08-13 Thread Luca Boccassi
On Tue, 2019-08-13 at 01:03 +0200, Thomas Monjalon wrote:
> In order to re-use the same test environment as with
> test-build.sh, the configuration file is loaded at each build,
> after adjusting the variable DPDK_TARGET.
> 
> This is especially useful to set the variable PKG_CONFIG_PATH,
> or define some meson options (without -D) in DPDK_MESON_OPTIONS.
> 
> The DPDK_TARGET values can be
> aarch64-*, powerpc64-*, x86_64-*.
> The matching DPDK_TARGET values for test-build.sh are
> arm64-*, ppc_64-*, x86_64-*.
> The advised expressions to use in the common configuration file are:
> if echo $DPDK_TARGET | grep -q '^a.*64-' ; then
> elif echo $DPDK_TARGET | grep -q '^p.*pc.*64' ; then
> elif echo $DPDK_TARGET | grep -q '^x86_64' ; then
> fi
> 
> Signed-off-by: Thomas Monjalon <
> tho...@monjalon.net
> >
> ---
>  devtools/test-meson-builds.sh | 19 ++-
>  1 file changed, 18 insertions(+), 1 deletion(-)

Acked-by: Luca Boccassi 

-- 
Kind regards,
Luca Boccassi


Re: [dpdk-dev] [RFC v2 1/3] ethdev: add the API for getting trace information

2019-08-13 Thread David Marchand
On Tue, Aug 13, 2019 at 5:24 AM Stephen Hemminger
 wrote:
>
> On Tue, 13 Aug 2019 11:06:10 +0800
> Haiyue Wang  wrote:

> >  int rte_eth_tx_queue_info_get(uint16_t port_id, uint16_t queue_id,
> >   struct rte_eth_txq_info *qinfo);
> >
> > +int
> > +rte_eth_trace_info_get(uint16_t port_id, uint16_t queue_id,
> > + enum rte_eth_trace type, char *buf, int sz);
> > +
>
> You didn't run checkpatch, otherwise you would have seen complaints
> about not listing API as experimental.

The checks in checkpatches.sh won't catch this.
But trying to build dpdk as a shared library will.

Example: https://travis-ci.com/david-marchand/dpdk/jobs/224737320


-- 
David Marchand


[dpdk-dev] [PATCH 0/2] IXGBE vPMD changes for aarch64

2019-08-13 Thread Ruifeng Wang
Couple of changes to IXGBE vector PMD on aarch64 platform.
An unnecessary memory barrier was identified and removed.
Also part of processing was replaced with NEON intrinsics.
Both of the changes will help to improve performance.

Ruifeng Wang (2):
  net/ixgbe: remove barrier in vPMD for aarch64
  net/ixgbe: use neon intrinsics to count packet for aarch64

 drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c | 32 -
 1 file changed, 16 insertions(+), 16 deletions(-)

-- 
2.17.1



[dpdk-dev] [PATCH 1/2] net/ixgbe: remove barrier in vPMD for aarch64

2019-08-13 Thread Ruifeng Wang
The memory barrier was intended for descriptor data integrity (see
comments in [1]). However, since NEON loads are atomic, there is
no need for the memory barrier. Remove it accordingly.

Corrected couple of code comments.

In terms of performance, observed slightly higher average throughput
in tests with 82599ES NIC.

[1] http://patches.dpdk.org/patch/18153/

Signed-off-by: Ruifeng Wang 
Reviewed-by: Gavin Hu 
---
 drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c 
b/drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c
index edb138354..86fb3afdb 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c
+++ b/drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c
@@ -214,13 +214,13 @@ _recv_raw_pkts_vec(struct ixgbe_rx_queue *rxq, struct 
rte_mbuf **rx_pkts,
uint32_t var = 0;
uint32_t stat;
 
-   /* B.1 load 1 mbuf point */
+   /* B.1 load 2 mbuf point */
mbp1 = vld1q_u64((uint64_t *)&sw_ring[pos]);
 
/* B.2 copy 2 mbuf point into rx_pkts  */
vst1q_u64((uint64_t *)&rx_pkts[pos], mbp1);
 
-   /* B.1 load 1 mbuf point */
+   /* B.1 load 2 mbuf point */
mbp2 = vld1q_u64((uint64_t *)&sw_ring[pos + 2]);
 
/* A. load 4 pkts descs */
@@ -228,7 +228,6 @@ _recv_raw_pkts_vec(struct ixgbe_rx_queue *rxq, struct 
rte_mbuf **rx_pkts,
descs[1] =  vld1q_u64((uint64_t *)(rxdp + 1));
descs[2] =  vld1q_u64((uint64_t *)(rxdp + 2));
descs[3] =  vld1q_u64((uint64_t *)(rxdp + 3));
-   rte_smp_rmb();
 
/* B.2 copy 2 mbuf point into rx_pkts  */
vst1q_u64((uint64_t *)&rx_pkts[pos + 2], mbp2);
-- 
2.17.1



[dpdk-dev] [PATCH 2/2] net/ixgbe: use neon intrinsics to count packet for aarch64

2019-08-13 Thread Ruifeng Wang
vPMD for aarch64 calculates the number of received packets using a loop.
Change to use NEON intrinsics for calculation. This saves CPU cycles
and has slightly better performance.

Signed-off-by: Ruifeng Wang 
Reviewed-by: Gavin Hu 
---
 drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c | 27 +
 1 file changed, 14 insertions(+), 13 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c 
b/drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c
index 86fb3afdb..eeb825911 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c
+++ b/drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c
@@ -144,6 +144,7 @@ desc_to_olflags_v(uint8x16x2_t sterr_tmp1, uint8x16x2_t 
sterr_tmp2,
 
 #define IXGBE_VPMD_DESC_DD_MASK0x01010101
 #define IXGBE_VPMD_DESC_EOP_MASK   0x02020202
+#define IXGBE_UINT8_BIT(CHAR_BIT * sizeof(uint8_t))
 
 static inline uint16_t
 _recv_raw_pkts_vec(struct ixgbe_rx_queue *rxq, struct rte_mbuf **rx_pkts,
@@ -211,7 +212,6 @@ _recv_raw_pkts_vec(struct ixgbe_rx_queue *rxq, struct 
rte_mbuf **rx_pkts,
uint64x2_t mbp1, mbp2;
uint8x16_t staterr;
uint16x8_t tmp;
-   uint32_t var = 0;
uint32_t stat;
 
/* B.1 load 2 mbuf point */
@@ -256,7 +256,6 @@ _recv_raw_pkts_vec(struct ixgbe_rx_queue *rxq, struct 
rte_mbuf **rx_pkts,
 
/* C.2 get 4 pkts staterr value  */
staterr = vzipq_u8(sterr_tmp1.val[1], sterr_tmp2.val[1]).val[0];
-   stat = vgetq_lane_u32(vreinterpretq_u32_u8(staterr), 0);
 
/* set ol_flags with vlan packet type */
desc_to_olflags_v(sterr_tmp1, sterr_tmp2, staterr,
@@ -282,12 +281,20 @@ _recv_raw_pkts_vec(struct ixgbe_rx_queue *rxq, struct 
rte_mbuf **rx_pkts,
 
/* C* extract and record EOP bit */
if (split_packet) {
+   stat = vgetq_lane_u32(vreinterpretq_u32_u8(staterr), 0);
/* and with mask to extract bits, flipping 1-0 */
*(int *)split_packet = ~stat & IXGBE_VPMD_DESC_EOP_MASK;
 
split_packet += RTE_IXGBE_DESCS_PER_LOOP;
}
 
+   /* C.4 expand DD bit to saturate UINT8 */
+   staterr = vshlq_n_u8(staterr, IXGBE_UINT8_BIT - 1);
+   staterr = vreinterpretq_u8_s8
+   (vshrq_n_s8(vreinterpretq_s8_u8(staterr),
+   IXGBE_UINT8_BIT - 1));
+   stat = ~vgetq_lane_u32(vreinterpretq_u32_u8(staterr), 0);
+
rte_prefetch_non_temporal(rxdp + RTE_IXGBE_DESCS_PER_LOOP);
 
/* D.3 copy final 1,2 data to rx_pkts */
@@ -296,18 +303,12 @@ _recv_raw_pkts_vec(struct ixgbe_rx_queue *rxq, struct 
rte_mbuf **rx_pkts,
vst1q_u8((uint8_t *)&rx_pkts[pos]->rx_descriptor_fields1,
 pkt_mb1);
 
-   stat &= IXGBE_VPMD_DESC_DD_MASK;
-
-   /* C.4 calc avaialbe number of desc */
-   if (likely(stat != IXGBE_VPMD_DESC_DD_MASK)) {
-   while (stat & 0x01) {
-   ++var;
-   stat = stat >> 8;
-   }
-   nb_pkts_recd += var;
-   break;
-   } else {
+   /* C.5 calc available number of desc */
+   if (unlikely(stat == 0)) {
nb_pkts_recd += RTE_IXGBE_DESCS_PER_LOOP;
+   } else {
+   nb_pkts_recd += __builtin_ctz(stat) / IXGBE_UINT8_BIT;
+   break;
}
}
 
-- 
2.17.1



Re: [dpdk-dev] [PATCH] app/test: add unit test cases for mbuf library APIs

2019-08-13 Thread Govindarajan, LavanyaX
Hi,

> -Original Message-
> From: dev [mailto:dev-boun...@dpdk.org] On Behalf Of Govindarajan,
> LavanyaX
> Sent: Monday, July 22, 2019 7:02 PM
> To: Olivier Matz 
> Cc: dev@dpdk.org; Pattan, Reshma ; Richardson,
> Bruce 
> Subject: Re: [dpdk-dev] [PATCH] app/test: add unit test cases for mbuf library
> APIs
> 
> Hi
> 
> > -Original Message-
> > From: Olivier Matz [mailto:olivier.m...@6wind.com]
> > Sent: Monday, June 3, 2019 2:10 PM
> > To: Govindarajan, LavanyaX 
> > Cc: dev@dpdk.org; Pattan, Reshma ;
> > Richardson, Bruce 
> > Subject: Re: [PATCH] app/test: add unit test cases for mbuf library
> > APIs
> >
> > Hi Lavanya,
> >
> > Please find some comments inline.
> >
> > On Mon, Apr 15, 2019 at 01:40:15PM +0100, Lavanya Govindarajan wrote:
> > > added new unit test cases for
> > > rte_validate_tx_offload,
> > > rte_pktmbuf_alloc_bulk,
> > > rte_pktmbuf_read,
> > > rte_pktmbuf_ext_shinfo_init_helper,
> > > rte_pktmbuf_attach_extbuf,
> > > rte_mbuf_ext_refcnt_read,
> > > rte_mbuf_ext_refcnt_update,
> > > rte_mbuf_ext_refcnt_set,
> > > rte_pktmbuf_detach_extbuf
> > >
> > > Signed-off-by: Lavanya Govindarajan
> > > 
> > > ---
> > >  app/test/test_mbuf.c | 820
> > > ++-
> > >  1 file changed, 817 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/app/test/test_mbuf.c b/app/test/test_mbuf.c index
> > > 030385ec5..74259b313 100644
> > > --- a/app/test/test_mbuf.c
> > > +++ b/app/test/test_mbuf.c
> >
> 
> 
> 
> > > +/*
> > > + * Test for allocating a bulk of mbufs
> > > + * define an array with positive sizes for mbufs allocations.
> > > + */
> > > +static int
> > > +test_rte_pktmbuf_alloc_bulk(struct rte_mempool *pktmbuf_pool) {
> > > + int ret = 0;
> > > + unsigned int idx, loop;
> > > + unsigned int alloc_counts[] = {
> > > + 0,
> > > + MEMPOOL_CACHE_SIZE - 1,
> > > + MEMPOOL_CACHE_SIZE,
> > > + MEMPOOL_CACHE_SIZE + 1,
> > > + MEMPOOL_CACHE_SIZE * 1.5,
> > > + MEMPOOL_CACHE_SIZE * 2,
> > > + MEMPOOL_CACHE_SIZE * 2 - 1,
> > > + MEMPOOL_CACHE_SIZE * 2 + 1,
> > > + 89, /* random number */
> > > + MEMPOOL_CACHE_SIZE  /* repeat cache size */
> > > + };
> >
> > instead of testing these particular values, why not testing every
> > values between
> > 0 and NB_MBUF ?
> 
> Testing every value from 0, 1, 2.. NB_MBUF(128 here)  dilutes the purpose of
> testing bulk allocation of mbufs from the same pool.
> Boundary conditions and some random values are targeted which will cover
> major cases.
> 
> The behavior is different for different set of values based on the 
> availability of
> free mbufs in the cache or from the ring.
> 
> 
> 
> > > +/*
> > > + * Test to initialize shared data in external buffer before
> > > +attaching to mbuf
> > > + *  - Allocate mbuf with no data.
> > > + *  - Allocate external buffer with size should be large enough to
> > accommodate
> > > + * rte_mbuf_ext_shared_info.
> > > + *  - Invoke pktmbuf_ext_shinfo_init_helper to initialize shared data.
> > > + *  - Invoke rte_pktmbuf_attach_extbuf to attach external buffer to the
> mbuf.
> > > + *  - Clone another mbuf and attach the same external buffer to it.
> > > + *  - Invoke rte_pktmbuf_detach_extbuf to detach the external
> > > + buffer from
> > mbuf.
> > > + */
> > > +static int
> > > +test_pktmbuf_ext_shinfo_init_helper(struct rte_mempool
> > > +*pktmbuf_pool) {
> > > + struct rte_mbuf *m = NULL;
> > > + struct rte_mbuf *clone = NULL;
> > > + struct rte_mbuf_ext_shared_info *ret_shinfo = NULL;
> > > + rte_iova_t buf_iova;
> > > + void *ext_buf_addr = NULL;
> > > + uint16_t buf_len = EXT_BUF_TEST_DATA_LEN +
> > > + sizeof(struct rte_mbuf_ext_shared_info);
> > > +
> > > + /* alloc a mbuf */
> > > + m = rte_pktmbuf_alloc(pktmbuf_pool);
> > > + if (m == NULL)
> > > + GOTO_FAIL("%s: mbuf allocation failed!\n", __func__);
> > > + if (rte_pktmbuf_pkt_len(m) != 0)
> > > + GOTO_FAIL("%s: Bad packet length\n", __func__);
> > > + rte_mbuf_sanity_check(m, 0);
> > > +
> > > + ext_buf_addr = rte_malloc("External buffer", buf_len,
> > > + RTE_CACHE_LINE_SIZE);
> > > + if (ext_buf_addr == NULL)
> > > + GOTO_FAIL("%s: External buffer allocation failed\n", __func__);
> > > +
> > > + ret_shinfo = rte_pktmbuf_ext_shinfo_init_helper(ext_buf_addr,
> > &buf_len,
> > > + ext_buf_free_callback_fn, ext_buf_addr);
> > > + if (ret_shinfo == NULL)
> > > + GOTO_FAIL("%s: Shared info initialization failed!\n", __func__);
> > > +
> > > + if (rte_mbuf_ext_refcnt_read(ret_shinfo) != 1)
> > > + GOTO_FAIL("%s: External refcount is not 1\n", __func__);
> > > +
> > > + if (rte_mbuf_refcnt_read(m) != 1)
> > > + GOTO_FAIL("%s: Invalid refcnt in mbuf\n", __func__);
> > > +
> > > + buf_iova = rte_mempool_virt2iova(ext_buf_addr);
> > > + rte_pktmbuf_attach_extbuf(m, ext_buf_addr, buf_iova, buf_len,
> > > + 

[dpdk-dev] [PATCH 1/2] net/i40e: desc loading is unnecessarily ordered for aarch64

2019-08-13 Thread Gavin Hu
For x86, the descriptors needs to be loaded in order, so in between two
descriptors loading, there is a compiler barrier in place.[1]
For aarch64, a patch [2] is in place to survive with discontinuous DD bits,
the barriers can be removed to take full advantage of out-of-order
execution.

50% performance gain in the RFC2544 NDR test was measured on ThunderX2.
12.50% performan gain in the RFC2544 NDR test was measured on Ampere
eMAG80 platform.

[1] http://inbox.dpdk.org/users/039ED4275CED7440929022BC67E7061153D71548@
SHSMSX105.ccr.corp.intel.com/
[2] https://mails.dpdk.org/archives/stable/2017-October/003324.html

Fixes: ae0eb310f253 ("net/i40e: implement vector PMD for ARM")
Cc: sta...@dpdk.org

Signed-off-by: Gavin Hu 
Reviewed-by: Ruifeng Wang 
Reviewed-by: Steve Capper 
---
 drivers/net/i40e/i40e_rxtx_vec_neon.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/net/i40e/i40e_rxtx_vec_neon.c 
b/drivers/net/i40e/i40e_rxtx_vec_neon.c
index 83572ef..e9b 100644
--- a/drivers/net/i40e/i40e_rxtx_vec_neon.c
+++ b/drivers/net/i40e/i40e_rxtx_vec_neon.c
@@ -285,7 +285,6 @@ _recv_raw_pkts_vec(struct i40e_rx_queue *rxq, struct 
rte_mbuf **rx_pkts,
/* Read desc statuses backwards to avoid race condition */
/* A.1 load 4 pkts desc */
descs[3] =  vld1q_u64((uint64_t *)(rxdp + 3));
-   rte_rmb();
 
/* B.2 copy 2 mbuf point into rx_pkts  */
vst1q_u64((uint64_t *)&rx_pkts[pos], mbp1);
-- 
2.7.4



[dpdk-dev] [PATCH 2/2] net/i40e: remove compiler barrier for aarch64

2019-08-13 Thread Gavin Hu
As packet length extraction code was simplified,the ordering
was not necessary any more.[1]

2% performance gain was measured on Marvell ThunderX2.
4.3% performance gain was measure on Ampere eMAG80

[1] http://mails.dpdk.org/archives/dev/2016-April/037529.html

Fixes: ae0eb310f253 ("net/i40e: implement vector PMD for ARM")
Cc: sta...@dpdk.org

Signed-off-by: Gavin Hu 
Reviewed-by: Ruifeng Wang 
Reviewed-by: Steve Capper 
---
 drivers/net/i40e/i40e_rxtx_vec_neon.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/net/i40e/i40e_rxtx_vec_neon.c 
b/drivers/net/i40e/i40e_rxtx_vec_neon.c
index e9b..864eb9a 100644
--- a/drivers/net/i40e/i40e_rxtx_vec_neon.c
+++ b/drivers/net/i40e/i40e_rxtx_vec_neon.c
@@ -307,9 +307,6 @@ _recv_raw_pkts_vec(struct i40e_rx_queue *rxq, struct 
rte_mbuf **rx_pkts,
rte_mbuf_prefetch_part2(rx_pkts[pos + 3]);
}
 
-   /* avoid compiler reorder optimization */
-   rte_compiler_barrier();
-
/* pkt 3,4 shift the pktlen field to be 16-bit aligned*/
uint32x4_t len3 = vshlq_u32(vreinterpretq_u32_u64(descs[3]),
len_shl);
-- 
2.7.4



[dpdk-dev] [PATCH 0/2] i40e neon vPMD optiomization for aarch64

2019-08-13 Thread Gavin Hu
Aarch64 neon vPMD survives across discontinuous DD bits, which makes
the ordering for descriptors loading unnecessary.
Similarly, the compiler barrier to order the extraction of packet
length is not needed any more when the extraction was simplified
by anothe patch.

Gavin Hu (2):
  net/i40e: desc loading is unnecessarily ordered for aarch64
  net/i40e: remove compiler barrier for aarch64

 drivers/net/i40e/i40e_rxtx_vec_neon.c | 5 -
 1 file changed, 5 deletions(-)

-- 
2.7.4



Re: [dpdk-dev] [RFC v2 1/3] ethdev: add the API for getting trace information

2019-08-13 Thread Wang, Haiyue
> -Original Message-
> From: David Marchand [mailto:david.march...@redhat.com]
> Sent: Tuesday, August 13, 2019 17:58
> To: Stephen Hemminger ; Wang, Haiyue 
> 
> Cc: dev ; Neil Horman 
> Subject: Re: [dpdk-dev] [RFC v2 1/3] ethdev: add the API for getting trace 
> information
> 
> On Tue, Aug 13, 2019 at 5:24 AM Stephen Hemminger
>  wrote:
> >
> > On Tue, 13 Aug 2019 11:06:10 +0800
> > Haiyue Wang  wrote:
> 
> > >  int rte_eth_tx_queue_info_get(uint16_t port_id, uint16_t queue_id,
> > >   struct rte_eth_txq_info *qinfo);
> > >
> > > +int
> > > +rte_eth_trace_info_get(uint16_t port_id, uint16_t queue_id,
> > > + enum rte_eth_trace type, char *buf, int sz);
> > > +
> >
> > You didn't run checkpatch, otherwise you would have seen complaints
> > about not listing API as experimental.
> 
> The checks in checkpatches.sh won't catch this.
> But trying to build dpdk as a shared library will.
> 
> Example: https://travis-ci.com/david-marchand/dpdk/jobs/224737320
> 
> 

Got it, thanks for sharing, just for a quick RFC, missed something
in detail for making an API.

> --
> David Marchand


[dpdk-dev] [PATCH] doc: fix description of links to EAL options pages

2019-08-13 Thread Dekel Peled
Documentation includes separate pages of EAL command-line options for
Linux and for FreeBSD.
Links to these pages use the same text 'EAL parameters', so it is not
clear which link to use for which environment.

This patch adds the text '(Linux)' and '(FreeBSD)' where relevant, to
clearly identify the links.

Fixes: 3ee567cfec37 ("doc: document all EAL parameters in one place")
Cc: sta...@dpdk.org

Signed-off-by: Dekel Peled 
---
 doc/guides/sample_app_ug/intro.rst| 6 +++---
 doc/guides/testpmd_app_ug/run_app.rst | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/doc/guides/sample_app_ug/intro.rst 
b/doc/guides/sample_app_ug/intro.rst
index 9070419..1b19cd1 100644
--- a/doc/guides/sample_app_ug/intro.rst
+++ b/doc/guides/sample_app_ug/intro.rst
@@ -15,9 +15,9 @@ Running Sample Applications
 
 Some sample applications may have their own command-line parameters described 
in
 their respective guides, however all of them also share the same EAL 
parameters.
-Please refer to  :doc:`../linux_gsg/linux_eal_parameters` or
-:doc:`../freebsd_gsg/freebsd_eal_parameters` for a list of available EAL
-command-line options.
+Please refer to  :doc:`../linux_gsg/linux_eal_parameters` (Linux) or
+:doc:`../freebsd_gsg/freebsd_eal_parameters` (FreeBSD) for a list of available
+EAL command-line options.
 
 
 The DPDK Sample Applications
diff --git a/doc/guides/testpmd_app_ug/run_app.rst 
b/doc/guides/testpmd_app_ug/run_app.rst
index d0d89b3..8b5d823 100644
--- a/doc/guides/testpmd_app_ug/run_app.rst
+++ b/doc/guides/testpmd_app_ug/run_app.rst
@@ -7,9 +7,9 @@ Running the Application
 EAL Command-line Options
 
 
-Please refer to  :doc:`../linux_gsg/linux_eal_parameters` or
-:doc:`../freebsd_gsg/freebsd_eal_parameters` for a list of available EAL
-command-line options.
+Please refer to  :doc:`../linux_gsg/linux_eal_parameters` (Linux) or
+:doc:`../freebsd_gsg/freebsd_eal_parameters` (FreeBSD) for a list of available
+EAL command-line options.
 
 
 Testpmd Command-line Options
-- 
1.8.3.1



[dpdk-dev] [PATCH 0/1] PPC64 buid error in 19.08

2019-08-13 Thread Christian Ehrhardt
A build of recent DPDK 19.08 on all Ubuntu architectures returned this on ppc64:
  ../drivers/net/mlx4/mlx4_rxtx.c: In function ‘mlx4_tx_burst’:
  ../drivers/net/mlx4/mlx4_rxtx.c:919:14: error: incompatible types when
initializing type ‘__vector __bool int’ {aka ‘__vector(4) __bool int’}
using type ‘int’
919 |   bool tso = txq->priv->tso && (buf->ol_flags & PKT_TX_TCP_SEG);
|  ^~~
  ../drivers/net/mlx4/mlx4_rxtx.c:938:7: error: used vector type where scalar
is required
938 |   if (tso) {
|   ^~~

Which reminds everyone of the sad caps-lock story [1] which happened on 18.08.
Back then the fix was [2] and a discussion around ppc64 support state
happened, given that it wasn't even build-tested before release.

We might have to have the same discussion again, but for now I provided
the fix for the build fail on mlx4 implemented the same way as it was
done on mlx5 [2].

[1]: https://mails.dpdk.org/archives/dev/2018-August/110472.html
[2]: 
https://git.dpdk.org/dpdk/commit/?id=725f5dd0bfb50192a2d2341d4cc69084c2c4e03d

Christian Ehrhardt (1):
  net/mlx4: fix build on PPC64

 drivers/net/mlx4/mlx4_utils.h | 10 ++
 1 file changed, 10 insertions(+)

-- 
2.22.0



[dpdk-dev] [PATCH 1/1] net/mlx4: fix build on PPC64

2019-08-13 Thread Christian Ehrhardt
The AltiVec header file breaks boolean type:

error: incompatible types when initializing type
'__vector _bool int' {aka '_vector(4) __bool int'} using type 'int'

If __APPLE_ALTIVEC__ is defined, then bool type is redefined
and conflicts with stdbool.h.

There is no good solution to fix it for the whole project without
breaking something else, so a workaround is inserted in mlx5 PMD.
This workaround is not compatible with C++ but there is no C++ in DPDK.

Related to:
https://git.dpdk.org/dpdk/commit/?id=725f5dd0bfb50192a2d2341d4cc69084c2c4e03d

Change-Id: Iceb058c07086def4176c5ab199ca4dd5018d0340
Signed-off-by: Christian Ehrhardt 
---
 drivers/net/mlx4/mlx4_utils.h | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/drivers/net/mlx4/mlx4_utils.h b/drivers/net/mlx4/mlx4_utils.h
index a49190252..74b9d2ecd 100644
--- a/drivers/net/mlx4/mlx4_utils.h
+++ b/drivers/net/mlx4/mlx4_utils.h
@@ -15,6 +15,16 @@
 
 #include "mlx4.h"
 
+/*
+ * Compilation workaround for PPC64 when AltiVec is fully enabled, e.g. 
std=c11.
+ * Otherwise there would be a type conflict between stdbool and altivec.
+ */
+#if defined(__PPC64__) && !defined(__APPLE_ALTIVEC__)
+#undef bool
+/* redefine as in stdbool.h */
+#define bool _Bool
+#endif
+
 extern int mlx4_logtype;
 
 #ifndef NDEBUG
-- 
2.22.0



[dpdk-dev] [PATCH v2] version: 19.11-rc0

2019-08-13 Thread David Marchand
Start a new release cycle with empty release notes.

Signed-off-by: David Marchand 
---
Changelog since v1:
- added missing reference in index,
- bumped the libraries version to 19.08,
- included isonum,

---
 VERSION|   2 +-
 doc/guides/rel_notes/index.rst |   1 +
 doc/guides/rel_notes/release_19_11.rst | 216 +
 3 files changed, 218 insertions(+), 1 deletion(-)
 create mode 100644 doc/guides/rel_notes/release_19_11.rst

diff --git a/VERSION b/VERSION
index 909cfd6..fff18fc 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-19.08.0
+19.11.0-rc0
diff --git a/doc/guides/rel_notes/index.rst b/doc/guides/rel_notes/index.rst
index adfaf12..26f4a97 100644
--- a/doc/guides/rel_notes/index.rst
+++ b/doc/guides/rel_notes/index.rst
@@ -8,6 +8,7 @@ Release Notes
 :maxdepth: 1
 :numbered:
 
+release_19_11
 release_19_08
 release_19_05
 release_19_02
diff --git a/doc/guides/rel_notes/release_19_11.rst 
b/doc/guides/rel_notes/release_19_11.rst
new file mode 100644
index 000..8490d89
--- /dev/null
+++ b/doc/guides/rel_notes/release_19_11.rst
@@ -0,0 +1,216 @@
+..  SPDX-License-Identifier: BSD-3-Clause
+Copyright 2019 The DPDK contributors
+
+.. include:: 
+
+DPDK Release 19.11
+==
+
+.. **Read this first.**
+
+   The text in the sections below explains how to update the release notes.
+
+   Use proper spelling, capitalization and punctuation in all sections.
+
+   Variable and config names should be quoted as fixed width text:
+   ``LIKE_THIS``.
+
+   Build the docs and view the output file to ensure the changes are correct::
+
+  make doc-guides-html
+
+  xdg-open build/doc/html/guides/rel_notes/release_19_11.html
+
+
+New Features
+
+
+.. This section should contain new features added in this release.
+   Sample format:
+
+   * **Add a title in the past tense with a full stop.**
+
+ Add a short 1-2 sentence description in the past tense.
+ The description should be enough to allow someone scanning
+ the release notes to understand the new feature.
+
+ If the feature adds a lot of sub-features you can use a bullet list
+ like this:
+
+ * Added feature foo to do something.
+ * Enhanced feature bar to do something else.
+
+ Refer to the previous release notes for examples.
+
+ Suggested order in release notes items:
+ * Core libs (EAL, mempool, ring, mbuf, buses)
+ * Device abstraction libs and PMDs
+   - ethdev (lib, PMDs)
+   - cryptodev (lib, PMDs)
+   - eventdev (lib, PMDs)
+   - etc
+ * Other libs
+ * Apps, Examples, Tools (if significant)
+
+ This section is a comment. Do not overwrite or remove it.
+ Also, make sure to start the actual text at the margin.
+ =
+
+
+Removed Items
+-
+
+.. This section should contain removed items in this release. Sample format:
+
+   * Add a short 1-2 sentence description of the removed item
+ in the past tense.
+
+   This section is a comment. Do not overwrite or remove it.
+   Also, make sure to start the actual text at the margin.
+   =
+
+
+API Changes
+---
+
+.. This section should contain API changes. Sample format:
+
+   * sample: Add a short 1-2 sentence description of the API change
+ which was announced in the previous releases and made in this release.
+ Start with a scope label like "ethdev:".
+ Use fixed width quotes for ``function_names`` or ``struct_names``.
+ Use the past tense.
+
+   This section is a comment. Do not overwrite or remove it.
+   Also, make sure to start the actual text at the margin.
+   =
+
+
+ABI Changes
+---
+
+.. This section should contain ABI changes. Sample format:
+
+   * sample: Add a short 1-2 sentence description of the ABI change
+ which was announced in the previous releases and made in this release.
+ Start with a scope label like "ethdev:".
+ Use fixed width quotes for ``function_names`` or ``struct_names``.
+ Use the past tense.
+
+   This section is a comment. Do not overwrite or remove it.
+   Also, make sure to start the actual text at the margin.
+   =
+
+
+Shared Library Versions
+---
+
+.. Update any library version updated in this release
+   and prepend with a ``+`` sign, like this:
+
+ libfoo.so.1
+   + libupdated.so.2
+ libbar.so.1
+
+   This section is a comment. Do not overwrite or remove it.
+   =
+
+The libraries prepended with a plus sign were incremented in this version.
+
+.. code-block:: diff
+
+ librte_acl.so.2
+ librte_bbdev.so.1
+ librte_bitratestats.so.2
+ librte_bpf.so.1
+ librte_bus_dpaa.so.2
+ librte_bus_fslmc

[dpdk-dev] [PATCH 2/2] doc: replace license text with SPDX tag

2019-08-13 Thread Allain Legacy
Replace full license text with SPDX tag.

Signed-off-by: Allain Legacy 
---
 doc/guides/nics/avp.rst | 29 +
 1 file changed, 1 insertion(+), 28 deletions(-)

diff --git a/doc/guides/nics/avp.rst b/doc/guides/nics/avp.rst
index 1fcba66ce..b3dbc2816 100644
--- a/doc/guides/nics/avp.rst
+++ b/doc/guides/nics/avp.rst
@@ -1,32 +1,5 @@
-..  BSD LICENSE
+..  SPDX-License-Identifier: BSD-3-Clause
 Copyright(c) 2017 Wind River Systems, Inc. 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.
 
 AVP Poll Mode Driver
 =
-- 
2.12.1



[dpdk-dev] [PATCH 1/2] test: replace license text with SPDX tag

2019-08-13 Thread Allain Legacy
Replacing full license text with SPDX tag.

Signed-off-by: Allain Legacy 
---
 app/test/test_cfgfile.c | 32 ++--
 1 file changed, 2 insertions(+), 30 deletions(-)

diff --git a/app/test/test_cfgfile.c b/app/test/test_cfgfile.c
index 37435b395..01905920e 100644
--- a/app/test/test_cfgfile.c
+++ b/app/test/test_cfgfile.c
@@ -1,33 +1,5 @@
-/*-
- *   BSD LICENSE
- *
- *   Copyright(c) 2017 Wind River Systems Inc. All rights reserved.
- *
- *   Redistribution and use in source and binary forms, with or without
- *   modification, are permitted provided that the following conditions
- *   are met:
- *
- * * 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.
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2017 Wind River Systems Inc. All rights reserved.
  */
 
 #include 
-- 
2.12.1



Re: [dpdk-dev] [RFC v2 1/3] ethdev: add the API for getting trace information

2019-08-13 Thread Ray Kinsella



On 13/08/2019 04:24, Stephen Hemminger wrote:
> On Tue, 13 Aug 2019 11:06:10 +0800
> Haiyue Wang  wrote:
> 
>> Enhance the PMD to support retrieving trace information like
>> Rx/Tx burst selection etc.
>>
>> Signed-off-by: Haiyue Wang 
>> ---
>>  lib/librte_ethdev/rte_ethdev.c  | 18 ++
>>  lib/librte_ethdev/rte_ethdev.h  |  9 +
>>  lib/librte_ethdev/rte_ethdev_core.h |  4 
>>  3 files changed, 31 insertions(+)
>>
>> diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
>> index 17d183e..6098fad 100644
>> --- a/lib/librte_ethdev/rte_ethdev.c
>> +++ b/lib/librte_ethdev/rte_ethdev.c
>> @@ -4083,6 +4083,24 @@ rte_eth_tx_queue_info_get(uint16_t port_id, uint16_t 
>> queue_id,
>>  }
>>  
>>  int
>> +rte_eth_trace_info_get(uint16_t port_id, uint16_t queue_id,
>> +   enum rte_eth_trace type, char *buf, int sz)
>> +{
>> +struct rte_eth_dev *dev;
>> +
>> +RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
>> +
>> +if (buf == NULL)
>> +return -EINVAL;
>> +
>> +dev = &rte_eth_devices[port_id];
>> +
>> +RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->trace_info_get, -ENOTSUP);
>> +
>> +return dev->dev_ops->trace_info_get(dev, queue_id, type, buf, sz);
> 
> What if queueid is out of bounds?
> 
> The bigger problem is that this information is like a log message
> and unstructured, which makes it device specific and useless for automation.

IMHO - this is much better implemented as a capability bitfield, that
can be queried.

> 
> Why not just keep it in the log like it is now?
> 
>>  int rte_eth_tx_queue_info_get(uint16_t port_id, uint16_t queue_id,
>>  struct rte_eth_txq_info *qinfo);
>>  
>> +int
>> +rte_eth_trace_info_get(uint16_t port_id, uint16_t queue_id,
>> +enum rte_eth_trace type, char *buf, int sz);
>> +
> 
> You didn't run checkpatch, otherwise you would have seen complaints
> about not listing API as experimental.
> 
> Also the API would have to be in the map file as well.
> 
> Docbook comments are also missing.
> 
> 
> 
> 


Re: [dpdk-dev] [PATCH v2] version: 19.11-rc0

2019-08-13 Thread Thomas Monjalon
13/08/2019 14:18, David Marchand:
> Start a new release cycle with empty release notes.
> 
> Signed-off-by: David Marchand 
> ---
> Changelog since v1:
> - added missing reference in index,
> - bumped the libraries version to 19.08,
> - included isonum,

Acked-by: Thomas Monjalon 

Applied, thanks.

Let's start a new release cycle!




[dpdk-dev] [PATCH] ci: add missing dependencies for documentation

2019-08-13 Thread David Marchand
Install missing dependencies so that doc can be generated.
While at it, explicitly configure that we want the doc to be generated.
Missing dependencies are then reported as an error rather than silently
ignored.

Because of these extra dependencies, only build them in dedicated travis
jobs.

Fixes: ad2b2cfb1ea3 ("ci: enable unit tests with Travis")

Signed-off-by: David Marchand 
---
 .ci/linux-build.sh | 8 
 .travis.yml| 7 ++-
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/.ci/linux-build.sh b/.ci/linux-build.sh
index d5ad919..6075c44 100755
--- a/.ci/linux-build.sh
+++ b/.ci/linux-build.sh
@@ -19,14 +19,14 @@ if [ "$AARCH64" = "1" ]; then
 OPTS="$OPTS --cross-file config/arm/arm64_armv8_linux_gcc"
 fi
 
+if [ "$BUILD_DOCS" = "1" ]; then
+OPTS="$OPTS -Denable_docs=true"
+fi
+
 OPTS="$OPTS --default-library=$DEF_LIB"
 meson build --werror -Dexamples=all $OPTS
 ninja -C build
 
-if [ "$BUILD_DOCS" = "1" ]; then
-ninja -C build doc
-fi
-
 if [ "$RUN_TESTS" = "1" ]; then
 sudo meson test -C build --suite fast-tests -t 3
 fi
diff --git a/.travis.yml b/.travis.yml
index 781f9f6..3d6ef29 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -23,6 +23,9 @@ extra_packages: &extra_packages
   - *required_packages
   - [libbsd-dev, libpcap-dev, libcrypto++-dev, libjansson4]
 
+doc_packages: &doc_packages
+  - [doxygen, graphviz, python3-sphinx]
+
 before_install: ./.ci/${TRAVIS_OS_NAME}-setup.sh
 
 env:
@@ -30,7 +33,7 @@ env:
   - DEF_LIB="shared"
   - DEF_LIB="static" OPTS="-Denable_kmods=false"
   - DEF_LIB="shared" OPTS="-Denable_kmods=false"
-  - DEF_LIB="shared" RUN_TESTS=1 BUILD_DOCS=1
+  - DEF_LIB="shared" RUN_TESTS=1
 
 matrix:
   include:
@@ -58,6 +61,7 @@ matrix:
   apt:
 packages:
   - *extra_packages
+  - *doc_packages
   - env: DEF_LIB="static" OPTS="-Denable_kmods=false" EXTRA_PACKAGES=1
 compiler: gcc
 addons:
@@ -88,6 +92,7 @@ matrix:
   apt:
 packages:
   - *extra_packages
+  - *doc_packages
   - env: DEF_LIB="static" OPTS="-Denable_kmods=false" EXTRA_PACKAGES=1
 compiler: clang
 addons:
-- 
1.8.3.1



[dpdk-dev] [v6] net/i40e: fix vf runtime queues rss config

2019-08-13 Thread Xiao Zhang
I40evf queue can not work properly with kernel pf driver for X722 vf. 
Eg. when configure 8 queues pair, only 4 queues can receive packets, 
and half packets will be lost if using 2 queues pair.
This issue is caused by misconfiguration of look up table, the original
code of LUT configuration did not work for X722 vf, use aq command to 
setup the LUT to make it work properly.

Fixes: cea7a51c1750 ("i40evf: support RSS")
Cc: sta...@dpdk.org

Signed-off-by: Xiao Zhang 
---
v6 update commit message
v5 fix compile issue
v4 move local variable definition to the begin of the function
v3 move LUT configuration in to i40evf_configure_rss
v2 change for loop format to avoid build patch issue
---
 drivers/net/i40e/i40e_ethdev_vf.c | 32 ++--
 1 file changed, 26 insertions(+), 6 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev_vf.c 
b/drivers/net/i40e/i40e_ethdev_vf.c
index 308fb98..c77b30c 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -2598,7 +2598,10 @@ i40evf_config_rss(struct i40e_vf *vf)
struct i40e_hw *hw = I40E_VF_TO_HW(vf);
struct rte_eth_rss_conf rss_conf;
uint32_t i, j, lut = 0, nb_q = (I40E_VFQF_HLUT_MAX_INDEX + 1) * 4;
+   uint32_t rss_lut_size = (I40E_VFQF_HLUT1_MAX_INDEX + 1) * 4;
uint16_t num;
+   uint8_t *lut_info;
+   int ret;
 
if (vf->dev_data->dev_conf.rxmode.mq_mode != ETH_MQ_RX_RSS) {
i40evf_disable_rss(vf);
@@ -2608,12 +2611,29 @@ i40evf_config_rss(struct i40e_vf *vf)
 
num = RTE_MIN(vf->dev_data->nb_rx_queues, I40E_MAX_QP_NUM_PER_VF);
/* Fill out the look up table */
-   for (i = 0, j = 0; i < nb_q; i++, j++) {
-   if (j >= num)
-   j = 0;
-   lut = (lut << 8) | j;
-   if ((i & 3) == 3)
-   I40E_WRITE_REG(hw, I40E_VFQF_HLUT(i >> 2), lut);
+   if (!(vf->flags & I40E_FLAG_RSS_AQ_CAPABLE)) {
+   for (i = 0, j = 0; i < nb_q; i++, j++) {
+   if (j >= num)
+   j = 0;
+   lut = (lut << 8) | j;
+   if ((i & 3) == 3)
+   I40E_WRITE_REG(hw, I40E_VFQF_HLUT(i >> 2), lut);
+   }
+   } else {
+   lut_info = rte_zmalloc("i40e_rss_lut", rss_lut_size, 0);
+   if (!lut_info) {
+   PMD_DRV_LOG(ERR, "No memory can be allocated");
+   return -ENOMEM;
+   }
+
+   for (i = 0; i < rss_lut_size; i++)
+   lut_info[i] = i % vf->num_queue_pairs;
+
+   ret = i40evf_set_rss_lut(&vf->vsi, lut_info,
+rss_lut_size);
+   rte_free(lut_info);
+   if (ret)
+   return ret;
}
 
rss_conf = vf->dev_data->dev_conf.rx_adv_conf.rss_conf;
-- 
2.7.4



Re: [dpdk-dev] [PATCH] doc: fix description of links to EAL options pages

2019-08-13 Thread Burakov, Anatoly

On 13-Aug-19 12:25 PM, Dekel Peled wrote:

Documentation includes separate pages of EAL command-line options for
Linux and for FreeBSD.
Links to these pages use the same text 'EAL parameters', so it is not
clear which link to use for which environment.

This patch adds the text '(Linux)' and '(FreeBSD)' where relevant, to
clearly identify the links.

Fixes: 3ee567cfec37 ("doc: document all EAL parameters in one place")
Cc: sta...@dpdk.org

Signed-off-by: Dekel Peled 
---


Acked-by: Anatoly Burakov 

--
Thanks,
Anatoly


[dpdk-dev] [PATCH] net/vmxnet3: remove IP checksum from Tx/Rx offload capa

2019-08-13 Thread Maxime Leroy
The vmxnet3_prep_pkts function set rte_errno to ENOTSUP for any packets
having PKT_TX_IP_CHECKSUM set in ol_flags. But the vmxnet3 has
DEV_TX_OFFLOAD_IPV4_CKSUM set in this tx offload capa.

This issue has been introduced with the new Rx offload
API. DEV_TX_OFFLOAD_IPV4_CKSUM and DEV_RX_OFFLOAD_IPV4_CKSUM has been
added to the tx/rx offloads capa, but the vmxnet3 driver doesn't support
it.

To fix the issue, DEV_TX/RX_OFFLOAD_IPV4_CKSUM needs to be removed from
tx/rx offload capa.

Fixes: 95e4a96ccbf1 ("net/vmxnet3: convert to new Rx offload API")
Cc: llo...@vmware.com
Cc: sta...@dpdk.org

Signed-off-by: Maxime Leroy 
---
 drivers/net/vmxnet3/vmxnet3_ethdev.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c 
b/drivers/net/vmxnet3/vmxnet3_ethdev.c
index 57feb377..9cd5eb65 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethdev.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c
@@ -44,7 +44,6 @@
 
 #define VMXNET3_TX_OFFLOAD_CAP \
(DEV_TX_OFFLOAD_VLAN_INSERT |   \
-DEV_TX_OFFLOAD_IPV4_CKSUM |\
 DEV_TX_OFFLOAD_TCP_CKSUM | \
 DEV_TX_OFFLOAD_UDP_CKSUM | \
 DEV_TX_OFFLOAD_TCP_TSO |   \
@@ -54,7 +53,6 @@
(DEV_RX_OFFLOAD_VLAN_STRIP |\
 DEV_RX_OFFLOAD_VLAN_FILTER |   \
 DEV_RX_OFFLOAD_SCATTER |   \
-DEV_RX_OFFLOAD_IPV4_CKSUM |\
 DEV_RX_OFFLOAD_UDP_CKSUM | \
 DEV_RX_OFFLOAD_TCP_CKSUM | \
 DEV_RX_OFFLOAD_TCP_LRO |   \
-- 
2.11.0



[dpdk-dev] [RFC] ethdev: support hairpin queue

2019-08-13 Thread Ori Kam
This RFC replaces RFC[1].

The hairpin feature (different name can be forward) acts as "bump on the wire",
meaning that a packet that is received from the wire can be modified using
offloaded action and then sent back to the wire without application intervention
which save CPU cycles.

The hairpin is the inverse function of loopback in which application
sends a packet then it is received again by the
application without being sent to the wire.

The hairpin can be used by a number of different NVF, for example load
balancer, gateway and so on.

As can be seen from the hairpin description, hairpin is basically RX queue
connected to TX queue.

During the design phase I was thinking of two ways to implement this
feature the first one is adding a new rte flow action. and the second
one is create a special kind of queue.

The advantages of using the queue approch:
1. More control for the application. queue depth (the memory size that
should be used).
2. Enable QoS. QoS is normaly a parametr of queue, so in this approch it
will be easy to integrate with such system.
3. Native integression with the rte flow API. Just setting the target
queue/rss to hairpin queue, will result that the traffic will be routed
to the hairpin queue.
4. Enable queue offloading.

Each hairpin Rxq can be connected Txq / number of Txqs which can belong to a
different ports assuming the PMD supports it. The same goes the other
way each hairpin Txq can be connected to one or more Rxqs.
This is the reason that both the Txq setup and Rxq setup are getting the
hairpin configuration structure.

>From PMD prespctive the number of Rxq/Txq is the total of standard
queues + hairpin queues.

To configure hairpin queue the user should call
rte_eth_rx_hairpin_queue_setup / rte_eth_tx_hairpin_queue_setup insteed
of the normal queue setup functions.

The hairpin queues are not part of the normal RSS functiosn.

To use the queues the user simply create a flow that points to RSS/queue
actions that are hairpin queues.

[1]
http://inbox.dpdk.org/dev/am4pr05mb3425e55b721a4090fcbe7d80db...@am4pr05mb3425.eurprd05.prod.outlook.com/

Signed-off-by: Ori Kam 
---
 lib/librte_ethdev/rte_ethdev.h | 124 +
 1 file changed, 124 insertions(+)

diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h
index dc6596b..fb54162 100644
--- a/lib/librte_ethdev/rte_ethdev.h
+++ b/lib/librte_ethdev/rte_ethdev.h
@@ -804,6 +804,15 @@ struct rte_eth_txconf {
 };
 
 /**
+ * A structure used to configure hairpin binding..
+ */
+struct rte_eth_hairpin_conf {
+   uint16_t peer_n; /**< The number of peer queues and queues. */
+   uint16_t (*ports)[]; /**< The peer ports. */
+   uint16_t (*queues)[]; /**< The peer queues. */
+};
+
+/**
  * A structure contains information about HW descriptor ring limitations.
  */
 struct rte_eth_desc_lim {
@@ -1013,6 +1022,7 @@ struct rte_eth_conf {
 #define DEV_RX_OFFLOAD_KEEP_CRC0x0001
 #define DEV_RX_OFFLOAD_SCTP_CKSUM  0x0002
 #define DEV_RX_OFFLOAD_OUTER_UDP_CKSUM  0x0004
+#define DEV_RX_OFFLOAD_HAIRPIN 0x0008
 
 #define DEV_RX_OFFLOAD_CHECKSUM (DEV_RX_OFFLOAD_IPV4_CKSUM | \
 DEV_RX_OFFLOAD_UDP_CKSUM | \
@@ -1075,6 +1085,7 @@ struct rte_eth_conf {
  * Application must set PKT_TX_METADATA and mbuf metadata field.
  */
 #define DEV_TX_OFFLOAD_MATCH_METADATA   0x0020
+#define DEV_TX_OFFLOAD_HAIRPIN 0x0040
 
 #define RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP 0x0001
 /**< Device supports Rx queue setup after device started*/
@@ -1769,6 +1780,56 @@ int rte_eth_rx_queue_setup(uint16_t port_id, uint16_t 
rx_queue_id,
struct rte_mempool *mb_pool);
 
 /**
+ * Allocate and set up a hairpin receive queue for an Ethernet device.
+ *
+ * The function set up the selected queue to be used in hairpin.
+ *
+ * @param port_id
+ *   The port identifier of the Ethernet device.
+ * @param rx_queue_id
+ *   The index of the receive queue to set up.
+ *   The value must be in the range [0, nb_rx_queue - 1] previously supplied
+ *   to rte_eth_dev_configure().
+ * @param nb_rx_desc
+ *   The number of receive descriptors to allocate for the receive ring.
+ * @param socket_id
+ *   The *socket_id* argument is the socket identifier in case of NUMA.
+ *   The value can be *SOCKET_ID_ANY* if there is no NUMA constraint for
+ *   the DMA memory allocated for the receive descriptors of the ring.
+ * @param rx_conf
+ *   The pointer to the configuration data to be used for the receive queue.
+ *   NULL value is allowed, in which case default RX configuration
+ *   will be used.
+ *   The *rx_conf* structure contains an *rx_thresh* structure with the values
+ *   of the Prefetch, Host, and Write-Back threshold registers of the receive
+ *   ring.
+ *   In addition it contains the hardware offloads features to activate using
+ *   the DEV_RX_OFFLOAD_* flags.
+ *   If an offloading set in rx_conf->offloads

[dpdk-dev] [PATCH] net/mlx5: fix location of comment line

2019-08-13 Thread Dekel Peled
In struct mlx5_ibv_shared, member esw_drop_action was added between
existing member tx_tbl and the comment line describing it.
This patch moves the comment line to its original location, and fixes
a typo in the comment.

Fixes: 34fa7c0268e7 ("net/mlx5: add drop action to Direct Verbs E-Switch")
Cc: sta...@dpdk.org

Signed-off-by: Dekel Peled 
---
 drivers/net/mlx5/mlx5.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h
index f559f83..1f279dc 100644
--- a/drivers/net/mlx5/mlx5.h
+++ b/drivers/net/mlx5/mlx5.h
@@ -569,8 +569,8 @@ struct mlx5_ibv_shared {
/* RX Direct Rules tables. */
void *tx_domain; /* TX Direct Rules name space handle. */
struct mlx5_flow_tbl_resource tx_tbl[MLX5_MAX_TABLES];
+   /* TX Direct Rules tables. */
void *esw_drop_action; /* Pointer to DR E-Switch drop action. */
-   /* TX Direct Rules tables/ */
LIST_HEAD(matchers, mlx5_flow_dv_matcher) matchers;
LIST_HEAD(encap_decap, mlx5_flow_dv_encap_decap_resource) encaps_decaps;
LIST_HEAD(modify_cmd, mlx5_flow_dv_modify_hdr_resource) modify_cmds;
-- 
1.8.3.1



Re: [dpdk-dev] [PATCH] ci: add missing dependencies for documentation

2019-08-13 Thread Aaron Conole
David Marchand  writes:

> Install missing dependencies so that doc can be generated.
> While at it, explicitly configure that we want the doc to be generated.
> Missing dependencies are then reported as an error rather than silently
> ignored.
>
> Because of these extra dependencies, only build them in dedicated travis
> jobs.
>
> Fixes: ad2b2cfb1ea3 ("ci: enable unit tests with Travis")
>
> Signed-off-by: David Marchand 
> ---

Makes sense.  I didn't see any problems with the doc build - was there
an indication that the dependencies were missing?

Either way:

Acked-by: Aaron Conole 


Re: [dpdk-dev] [PATCH] ci: add missing dependencies for documentation

2019-08-13 Thread David Marchand
On Tue, Aug 13, 2019 at 4:41 PM Aaron Conole  wrote:
>
> David Marchand  writes:
>
> > Install missing dependencies so that doc can be generated.
> > While at it, explicitly configure that we want the doc to be generated.
> > Missing dependencies are then reported as an error rather than silently
> > ignored.
> >
> > Because of these extra dependencies, only build them in dedicated travis
> > jobs.
> >
> > Fixes: ad2b2cfb1ea3 ("ci: enable unit tests with Travis")
> >
> > Signed-off-by: David Marchand 
> > ---
>
> Makes sense.  I didn't see any problems with the doc build - was there
> an indication that the dependencies were missing?

Only a log saying nothing would be built:
https://travis-ci.com/DPDK/dpdk/jobs/224804083#L628


-- 
David Marchand


Re: [dpdk-dev] [v6] net/i40e: fix vf runtime queues rss config

2019-08-13 Thread Ye Xiaolong
On 08/14, Xiao Zhang wrote:
>I40evf queue can not work properly with kernel pf driver for X722 vf. 
>Eg. when configure 8 queues pair, only 4 queues can receive packets, 
>and half packets will be lost if using 2 queues pair.
>This issue is caused by misconfiguration of look up table, the original
>code of LUT configuration did not work for X722 vf, use aq command to 
>setup the LUT to make it work properly.
>
>Fixes: cea7a51c1750 ("i40evf: support RSS")
>Cc: sta...@dpdk.org
>
>Signed-off-by: Xiao Zhang 
>---
>v6 update commit message
>v5 fix compile issue
>v4 move local variable definition to the begin of the function
>v3 move LUT configuration in to i40evf_configure_rss
>v2 change for loop format to avoid build patch issue
>---
> drivers/net/i40e/i40e_ethdev_vf.c | 32 ++--
> 1 file changed, 26 insertions(+), 6 deletions(-)
>
>diff --git a/drivers/net/i40e/i40e_ethdev_vf.c 
>b/drivers/net/i40e/i40e_ethdev_vf.c
>index 308fb98..c77b30c 100644
>--- a/drivers/net/i40e/i40e_ethdev_vf.c
>+++ b/drivers/net/i40e/i40e_ethdev_vf.c
>@@ -2598,7 +2598,10 @@ i40evf_config_rss(struct i40e_vf *vf)
>   struct i40e_hw *hw = I40E_VF_TO_HW(vf);
>   struct rte_eth_rss_conf rss_conf;
>   uint32_t i, j, lut = 0, nb_q = (I40E_VFQF_HLUT_MAX_INDEX + 1) * 4;
>+  uint32_t rss_lut_size = (I40E_VFQF_HLUT1_MAX_INDEX + 1) * 4;
>   uint16_t num;
>+  uint8_t *lut_info;
>+  int ret;
> 
>   if (vf->dev_data->dev_conf.rxmode.mq_mode != ETH_MQ_RX_RSS) {
>   i40evf_disable_rss(vf);
>@@ -2608,12 +2611,29 @@ i40evf_config_rss(struct i40e_vf *vf)
> 
>   num = RTE_MIN(vf->dev_data->nb_rx_queues, I40E_MAX_QP_NUM_PER_VF);
>   /* Fill out the look up table */
>-  for (i = 0, j = 0; i < nb_q; i++, j++) {
>-  if (j >= num)
>-  j = 0;
>-  lut = (lut << 8) | j;
>-  if ((i & 3) == 3)
>-  I40E_WRITE_REG(hw, I40E_VFQF_HLUT(i >> 2), lut);
>+  if (!(vf->flags & I40E_FLAG_RSS_AQ_CAPABLE)) {
>+  for (i = 0, j = 0; i < nb_q; i++, j++) {
>+  if (j >= num)
>+  j = 0;
>+  lut = (lut << 8) | j;
>+  if ((i & 3) == 3)
>+  I40E_WRITE_REG(hw, I40E_VFQF_HLUT(i >> 2), lut);
>+  }
>+  } else {
>+  lut_info = rte_zmalloc("i40e_rss_lut", rss_lut_size, 0);
>+  if (!lut_info) {
>+  PMD_DRV_LOG(ERR, "No memory can be allocated");
>+  return -ENOMEM;
>+  }
>+
>+  for (i = 0; i < rss_lut_size; i++)
>+  lut_info[i] = i % vf->num_queue_pairs;
>+
>+  ret = i40evf_set_rss_lut(&vf->vsi, lut_info,
>+   rss_lut_size);
>+  rte_free(lut_info);
>+  if (ret)
>+  return ret;
>   }
> 
>   rss_conf = vf->dev_data->dev_conf.rx_adv_conf.rss_conf;
>-- 
>2.7.4
>

Applied to dpdk-next-net-intel with Beilei's ack.


[dpdk-dev] [RFC 0/5] ipsec: add inbound SAD

2019-08-13 Thread Vladimir Medvedkin
According to RFC 4301 IPSec implementation needs an inbound SA database (SAD).
For each incoming inbound IPSec-protected packet (ESP or AH) it has to
perform a lookup within it’s SAD.
Lookup should be performed by:
Security Parameters Index (SPI) + destination IP (DIP) + source IP (SIP)
  or SPI + DIP
  or SPI only
and an implementation has to return the “longest” existing match.
These series extend DPDK IPsec library with SAD table implementation that:
- conforms to the RFC requirements above
- can scale up to millions of entries
- supports fast lookups
- supports incremental updates

Initial series provide an API to create/destroy SAD, and to
add/delete/lookup entries within given SAD table.
Under the hood it uses three librte_hash tables each of which contains
an entries for a specific SA type (either it is addressed by SPI only
or SPI+DIP or SPI+DIP+SIP) Also this patch series introduce test-sad
application to measure performance of the library. According to our
measurements on SKX for 1M entries average lookup cost is ~80 cycles,
average add cost ~500 cycles.

Next Steps:
- integration with ipsec-secgw

Vladimir Medvedkin (5):
  ipsec: add inbound SAD API
  ipsec: add SAD create/free API
  ipsec: add SAD add/delete/lookup implementation
  test/ipsec: add ipsec SAD autotests
  app: add test-sad application

 app/Makefile   |   1 +
 app/meson.build|   3 +-
 app/test-sad/Makefile  |  18 +
 app/test-sad/main.c| 420 
 app/test-sad/meson.build   |   6 +
 app/test/Makefile  |   1 +
 app/test/autotest_data.py  |   6 +
 app/test/meson.build   |   1 +
 app/test/test_ipsec_sad.c  | 874 +
 lib/librte_ipsec/Makefile  |   4 +-
 lib/librte_ipsec/ipsec_sad.c   | 478 ++
 lib/librte_ipsec/meson.build   |   6 +-
 lib/librte_ipsec/rte_ipsec_sad.h   | 174 +++
 lib/librte_ipsec/rte_ipsec_version.map |   7 +
 14 files changed, 1994 insertions(+), 5 deletions(-)
 create mode 100644 app/test-sad/Makefile
 create mode 100644 app/test-sad/main.c
 create mode 100644 app/test-sad/meson.build
 create mode 100644 app/test/test_ipsec_sad.c
 create mode 100644 lib/librte_ipsec/ipsec_sad.c
 create mode 100644 lib/librte_ipsec/rte_ipsec_sad.h

-- 
2.7.4



[dpdk-dev] [RFC 1/5] ipsec: add inbound SAD API

2019-08-13 Thread Vladimir Medvedkin
Add inbound security association database (SAD) API
and stub implementation.

Signed-off-by: Vladimir Medvedkin 
---
 lib/librte_ipsec/Makefile  |   2 +
 lib/librte_ipsec/ipsec_sad.c   |  50 ++
 lib/librte_ipsec/meson.build   |   4 +-
 lib/librte_ipsec/rte_ipsec_sad.h   | 174 +
 lib/librte_ipsec/rte_ipsec_version.map |   7 ++
 5 files changed, 235 insertions(+), 2 deletions(-)
 create mode 100644 lib/librte_ipsec/ipsec_sad.c
 create mode 100644 lib/librte_ipsec/rte_ipsec_sad.h

diff --git a/lib/librte_ipsec/Makefile b/lib/librte_ipsec/Makefile
index 22f29d9..5aaab72 100644
--- a/lib/librte_ipsec/Makefile
+++ b/lib/librte_ipsec/Makefile
@@ -21,10 +21,12 @@ SRCS-$(CONFIG_RTE_LIBRTE_IPSEC) += esp_inb.c
 SRCS-$(CONFIG_RTE_LIBRTE_IPSEC) += esp_outb.c
 SRCS-$(CONFIG_RTE_LIBRTE_IPSEC) += sa.c
 SRCS-$(CONFIG_RTE_LIBRTE_IPSEC) += ses.c
+SRCS-$(CONFIG_RTE_LIBRTE_IPSEC) += ipsec_sad.c
 
 # install header files
 SYMLINK-$(CONFIG_RTE_LIBRTE_IPSEC)-include += rte_ipsec.h
 SYMLINK-$(CONFIG_RTE_LIBRTE_IPSEC)-include += rte_ipsec_group.h
 SYMLINK-$(CONFIG_RTE_LIBRTE_IPSEC)-include += rte_ipsec_sa.h
+SYMLINK-$(CONFIG_RTE_LIBRTE_IPSEC)-include += rte_ipsec_sad.h
 
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_ipsec/ipsec_sad.c b/lib/librte_ipsec/ipsec_sad.c
new file mode 100644
index 000..cae46df
--- /dev/null
+++ b/lib/librte_ipsec/ipsec_sad.c
@@ -0,0 +1,50 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#include 
+
+#include "rte_ipsec_sad.h"
+
+int
+rte_ipsec_sad_add(__rte_unused struct rte_ipsec_sad *sad,
+   __rte_unused union rte_ipsec_sad_key *key,
+   __rte_unused int key_type, __rte_unused void *sa)
+{
+   return -ENOTSUP;
+}
+
+int
+rte_ipsec_sad_del(__rte_unused struct rte_ipsec_sad *sad,
+   __rte_unused union rte_ipsec_sad_key *key,
+   __rte_unused int key_type)
+{
+   return -ENOTSUP;
+}
+
+struct rte_ipsec_sad *
+rte_ipsec_sad_create(__rte_unused const char *name,
+   __rte_unused struct rte_ipsec_sad_conf *conf)
+{
+   return NULL;
+}
+
+struct rte_ipsec_sad *
+rte_ipsec_sad_find_existing(__rte_unused const char *name)
+{
+   return NULL;
+}
+
+void
+rte_ipsec_sad_free(__rte_unused struct rte_ipsec_sad *sad)
+{
+   return;
+}
+
+int
+rte_ipsec_sad_lookup(__rte_unused const struct rte_ipsec_sad *sad,
+   __rte_unused const union rte_ipsec_sad_key *keys[],
+   __rte_unused uint32_t n, __rte_unused void *sa[])
+{
+   return -ENOTSUP;
+}
diff --git a/lib/librte_ipsec/meson.build b/lib/librte_ipsec/meson.build
index 7ea0c7d..91b9867 100644
--- a/lib/librte_ipsec/meson.build
+++ b/lib/librte_ipsec/meson.build
@@ -3,8 +3,8 @@
 
 allow_experimental_apis = true
 
-sources = files('esp_inb.c', 'esp_outb.c', 'sa.c', 'ses.c')
+sources = files('esp_inb.c', 'esp_outb.c', 'sa.c', 'ses.c', 'ipsec_sad.c')
 
-headers = files('rte_ipsec.h', 'rte_ipsec_group.h', 'rte_ipsec_sa.h')
+headers = files('rte_ipsec.h', 'rte_ipsec_group.h', 'rte_ipsec_sa.h', 
'rte_ipsec_sad.h')
 
 deps += ['mbuf', 'net', 'cryptodev', 'security']
diff --git a/lib/librte_ipsec/rte_ipsec_sad.h b/lib/librte_ipsec/rte_ipsec_sad.h
new file mode 100644
index 000..d7301f5
--- /dev/null
+++ b/lib/librte_ipsec/rte_ipsec_sad.h
@@ -0,0 +1,174 @@
+
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _RTE_IPSEC_SAD_H_
+#define _RTE_IPSEC_SAD_H_
+
+#include 
+
+/**
+ * @file rte_ipsec_sad.h
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * RTE IPsec security association database (SAD) support.
+ * It is not recommended to include this file directly,
+ * include  instead.
+ * Contains helper functions to lookup and maintain SAD
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct rte_ipsec_sad;
+
+/** Type of key */
+enum {
+   RTE_IPSEC_SAD_SPI_ONLY = 0,
+   RTE_IPSEC_SAD_SPI_DIP,
+   RTE_IPSEC_SAD_SPI_DIP_SIP,
+   RTE_IPSEC_SAD_KEY_TYPE_MASK,
+};
+
+struct rte_ipsec_sadv4_key {
+   uint32_t spi;
+   uint32_t dip;
+   uint32_t sip;
+};
+
+struct rte_ipsec_sadv6_key {
+   uint32_t spi;
+   uint8_t dip[16];
+   uint8_t sip[16];
+};
+
+union rte_ipsec_sad_key {
+   struct rte_ipsec_sadv4_key  v4;
+   struct rte_ipsec_sadv6_key  v6;
+};
+
+#define RTE_IPSEC_SAD_FLAG_IPV40x1
+#define RTE_IPSEC_SAD_FLAG_IPV60x2
+/** Flag to support reader writer concurrency */
+#define RTE_IPSEC_SAD_FLAG_RW_CONCURRENCY  0x4
+
+/** IPsec SAD configuration structure */
+struct rte_ipsec_sad_conf {
+   int socket_id;
+   /** maximum number of SA for each type key */
+   uint32_tmax_sa[RTE_IPSEC_SAD_KEY_TYPE_MASK];
+   uint32_tflags;
+};
+
+/**
+ * Add a rule into the SAD. Could be safely called with concurrent lookups
+ *  if RTE_IPS

[dpdk-dev] [RFC 2/5] ipsec: add SAD create/free API

2019-08-13 Thread Vladimir Medvedkin
Replace rte_ipsec_sad_create(), rte_ipsec_sad_free() and
rte_ipsec_sad_find_existing() API stubs with actual
implementation.

Signed-off-by: Vladimir Medvedkin 
---
 lib/librte_ipsec/Makefile|   2 +-
 lib/librte_ipsec/ipsec_sad.c | 221 +--
 lib/librte_ipsec/meson.build |   2 +-
 3 files changed, 216 insertions(+), 9 deletions(-)

diff --git a/lib/librte_ipsec/Makefile b/lib/librte_ipsec/Makefile
index 5aaab72..81fb999 100644
--- a/lib/librte_ipsec/Makefile
+++ b/lib/librte_ipsec/Makefile
@@ -10,7 +10,7 @@ CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
 CFLAGS += -DALLOW_EXPERIMENTAL_API
 LDLIBS += -lrte_eal -lrte_mempool -lrte_mbuf -lrte_net
-LDLIBS += -lrte_cryptodev -lrte_security
+LDLIBS += -lrte_cryptodev -lrte_security -lrte_hash
 
 EXPORT_MAP := rte_ipsec_version.map
 
diff --git a/lib/librte_ipsec/ipsec_sad.c b/lib/librte_ipsec/ipsec_sad.c
index cae46df..7797628 100644
--- a/lib/librte_ipsec/ipsec_sad.c
+++ b/lib/librte_ipsec/ipsec_sad.c
@@ -2,10 +2,41 @@
  * Copyright(c) 2019 Intel Corporation
  */
 
+#include 
 #include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
 
 #include "rte_ipsec_sad.h"
 
+#define IPSEC_SAD_NAMESIZE 64
+#define SAD_PREFIX "SAD_"
+/* "SAD_" */
+#define SAD_FORMAT SAD_PREFIX "%s"
+
+#define DEFAULT_HASH_FUNC  rte_jhash
+
+struct hash_cnt {
+   uint32_t cnt_2;
+   uint32_t cnt_3;
+};
+
+struct rte_ipsec_sad {
+   char name[IPSEC_SAD_NAMESIZE];
+   struct rte_hash *hash[RTE_IPSEC_SAD_KEY_TYPE_MASK];
+   __extension__ struct hash_cnt cnt_arr[];
+};
+
+TAILQ_HEAD(rte_ipsec_sad_list, rte_tailq_entry);
+static struct rte_tailq_elem rte_ipsec_sad_tailq = {
+   .name = "RTE_IPSEC_SAD",
+};
+EAL_REGISTER_TAILQ(rte_ipsec_sad_tailq)
+
 int
 rte_ipsec_sad_add(__rte_unused struct rte_ipsec_sad *sad,
__rte_unused union rte_ipsec_sad_key *key,
@@ -23,22 +54,198 @@ rte_ipsec_sad_del(__rte_unused struct rte_ipsec_sad *sad,
 }
 
 struct rte_ipsec_sad *
-rte_ipsec_sad_create(__rte_unused const char *name,
-   __rte_unused struct rte_ipsec_sad_conf *conf)
+rte_ipsec_sad_create(const char *name, struct rte_ipsec_sad_conf *conf)
 {
-   return NULL;
+   char hash_name[RTE_HASH_NAMESIZE];
+   struct rte_tailq_entry *te;
+   struct rte_ipsec_sad_list *sad_list;
+   struct rte_ipsec_sad *sad, *tmp_sad = NULL;
+   struct rte_hash_parameters hash_params = {0};
+   int ret;
+   uint32_t sa_sum;
+
+   RTE_BUILD_BUG_ON(RTE_IPSEC_SAD_KEY_TYPE_MASK != 3);
+
+   if ((name == NULL) || (conf == NULL) ||
+   (conf->max_sa[RTE_IPSEC_SAD_SPI_ONLY] == 0) ||
+   (conf->max_sa[RTE_IPSEC_SAD_SPI_DIP] == 0) ||
+   (conf->max_sa[RTE_IPSEC_SAD_SPI_DIP_SIP] == 0) ||
+   /* check that either IPv4 or IPv6 type flags
+* are configured
+*/
+   ((!!(conf->flags & RTE_IPSEC_SAD_FLAG_IPV4) ^
+   !!(conf->flags & RTE_IPSEC_SAD_FLAG_IPV6)) == 0)) {
+   rte_errno = EINVAL;
+   return NULL;
+   }
+
+   /** Init SAD*/
+   sa_sum = conf->max_sa[RTE_IPSEC_SAD_SPI_ONLY] +
+   conf->max_sa[RTE_IPSEC_SAD_SPI_DIP] +
+   conf->max_sa[RTE_IPSEC_SAD_SPI_DIP_SIP];
+   sad = rte_zmalloc_socket(NULL, sizeof(*sad) +
+   (sizeof(struct hash_cnt) * sa_sum),
+   RTE_CACHE_LINE_SIZE, conf->socket_id);
+   if (sad == NULL) {
+   rte_errno = ENOMEM;
+   return NULL;
+   }
+
+   ret = snprintf(sad->name, sizeof(sad->name), SAD_FORMAT, name);
+   if (ret < 0 || ret >= (int)sizeof(sad->name)) {
+   rte_errno = ENAMETOOLONG;
+   return NULL;
+   }
+
+   hash_params.hash_func = DEFAULT_HASH_FUNC;
+   hash_params.hash_func_init_val = rte_rand();
+   hash_params.socket_id = conf->socket_id;
+   hash_params.name = hash_name;
+   if (conf->flags & RTE_IPSEC_SAD_FLAG_RW_CONCURRENCY)
+   hash_params.extra_flag = RTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY;
+
+   /** Init hash[RTE_IPSEC_SAD_SPI_ONLY] for SPI only */
+   ret = snprintf(hash_name, sizeof(hash_name),
+   "sad_%p_1", sad);
+   if (ret < 0 || ret >= (int)sizeof(hash_name)) {
+   rte_errno = ENAMETOOLONG;
+   return NULL;
+   }
+   hash_params.key_len = sizeof(((struct rte_ipsec_sadv4_key *)0)->spi);
+   hash_params.entries = sa_sum;
+   sad->hash[RTE_IPSEC_SAD_SPI_ONLY] = rte_hash_create(&hash_params);
+   if (sad->hash[RTE_IPSEC_SAD_SPI_ONLY] == NULL) {
+   rte_ipsec_sad_free(sad);
+   return NULL;
+   }
+
+   /** Init hash_2 for SPI + DIP */
+   ret = snprintf(hash_name, sizeof(hash_name),
+   "sad_%p_2", sad);
+   if (ret < 0 || ret >= (int)sizeof(

[dpdk-dev] [RFC 5/5] app: add test-sad application

2019-08-13 Thread Vladimir Medvedkin
Usage example and performance evaluation for the ipsec SAD library

Signed-off-by: Vladimir Medvedkin 
---
 app/Makefile |   1 +
 app/meson.build  |   3 +-
 app/test-sad/Makefile|  18 ++
 app/test-sad/main.c  | 420 +++
 app/test-sad/meson.build |   6 +
 5 files changed, 447 insertions(+), 1 deletion(-)
 create mode 100644 app/test-sad/Makefile
 create mode 100644 app/test-sad/main.c
 create mode 100644 app/test-sad/meson.build

diff --git a/app/Makefile b/app/Makefile
index 28acbce..db9d2d5 100644
--- a/app/Makefile
+++ b/app/Makefile
@@ -10,6 +10,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_PDUMP) += pdump
 DIRS-$(CONFIG_RTE_LIBRTE_ACL) += test-acl
 DIRS-$(CONFIG_RTE_LIBRTE_CMDLINE) += test-cmdline
 DIRS-$(CONFIG_RTE_LIBRTE_PIPELINE) += test-pipeline
+DIRS-$(CONFIG_RTE_LIBRTE_IPSEC) += test-sad
 
 ifeq ($(CONFIG_RTE_LIBRTE_BBDEV),y)
 DIRS-$(CONFIG_RTE_TEST_BBDEV) += test-bbdev
diff --git a/app/meson.build b/app/meson.build
index b0e6afb..71109cc 100644
--- a/app/meson.build
+++ b/app/meson.build
@@ -15,7 +15,8 @@ apps = [
'test-crypto-perf',
'test-eventdev',
'test-pipeline',
-   'test-pmd']
+   'test-pmd',
+   'test-sad']
 
 # for BSD only
 lib_execinfo = cc.find_library('execinfo', required: false)
diff --git a/app/test-sad/Makefile b/app/test-sad/Makefile
new file mode 100644
index 000..9b35413
--- /dev/null
+++ b/app/test-sad/Makefile
@@ -0,0 +1,18 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2010-2014 Intel Corporation
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+ifeq ($(CONFIG_RTE_LIBRTE_IPSEC),y)
+
+APP = testsad
+
+CFLAGS += $(WERROR_FLAGS)
+CFLAGS += -DALLOW_EXPERIMENTAL_API
+
+# all source are stored in SRCS-y
+SRCS-y := main.c
+
+include $(RTE_SDK)/mk/rte.app.mk
+
+endif
diff --git a/app/test-sad/main.c b/app/test-sad/main.c
new file mode 100644
index 000..039397f
--- /dev/null
+++ b/app/test-sad/main.c
@@ -0,0 +1,420 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#definePRINT_USAGE_START   "%s [EAL options] --\n"
+
+#define GET_CB_FIELD(in, fd, base, lim, dlm)   do {\
+   unsigned long val;  \
+   char *end_fld;  \
+   errno = 0;  \
+   val = strtoul((in), &end_fld, (base));  \
+   if (errno != 0 || end_fld[0] != (dlm) || val > (lim))   \
+   return -EINVAL; \
+   (fd) = (typeof(fd))val; \
+   (in) = end_fld + 1; \
+} while (0)
+
+#defineDEF_RULE_NUM0x1
+#defineDEF_TUPLES_NUM  0x10
+
+static struct {
+   const char  *prgname;
+   const char  *rules_file;
+   const char  *tuples_file;
+   uint32_tnb_rules;
+   uint32_tnb_tuples;
+   uint32_tnb_rules_32;
+   uint32_tnb_rules_64;
+   uint32_tnb_rules_96;
+   uint32_tnb_tuples_rnd;
+   uint8_t fract_32;
+   uint8_t fract_64;
+   uint8_t fract_96;
+   uint8_t fract_rnd_tuples;
+} config = {
+   .rules_file = NULL,
+   .tuples_file = NULL,
+   .nb_rules = DEF_RULE_NUM,
+   .nb_tuples = DEF_TUPLES_NUM,
+   .nb_rules_32 = 0,
+   .nb_rules_64 = 0,
+   .nb_rules_96 = 0,
+   .nb_tuples_rnd = 0,
+   .fract_32 = 90,
+   .fract_64 = 9,
+   .fract_96 = 1,
+   .fract_rnd_tuples = 0
+};
+
+enum {
+   CB_RULE_SPI,
+   CB_RULE_DIP,
+   CB_RULE_SIP,
+   CB_RULE_LEN,
+   CB_RULE_NUM,
+};
+
+static char line[LINE_MAX];
+struct rule {
+   struct rte_ipsec_sadv4_key tuple;
+   int rule_type;
+};
+
+static struct rule *rules_tbl;
+static struct rule *tuples_tbl;
+
+static int
+parse_distrib(const char *in)
+{
+   int a, b, c;
+
+   GET_CB_FIELD(in, a, 0, UINT8_MAX, '/');
+   GET_CB_FIELD(in, b, 0, UINT8_MAX, '/');
+   GET_CB_FIELD(in, c, 0, UINT8_MAX, 0);
+
+   if ((a + b + c) != 100)
+   return -EINVAL;
+
+   config.fract_32 = a;
+   config.fract_64 = b;
+   config.fract_96 = c;
+
+   return 0;
+}
+
+static void
+print_config(void)
+{
+   fprintf(stdout,
+   "Rules total: %u\n"
+   "Configured rules distribution SPI/SPI_DIP/SIP_DIP_SIP:"
+   "%u/%u/%u\n"
+   "SPI only rules: %u\n"
+   "SPI_DIP  rules: %u\n"
+   "SPI_DIP_SIP rules: %u\n"
+   "Lookup tuples: %u\n"
+   "Configured fraction of random tuples: %u\n"
+   "Random lookup tuples: %u\n",
+ 

[dpdk-dev] [RFC 3/5] ipsec: add SAD add/delete/lookup implementation

2019-08-13 Thread Vladimir Medvedkin
Replace rte_ipsec_sad_add(), rte_ipsec_sad_del() and
rte_ipsec_sad_lookup() stubs with actual implementation.

It uses three librte_hash tables each of which contains
an entries for a specific SA type (either it is addressed by SPI only
or SPI+DIP or SPI+DIP+SIP)

Signed-off-by: Vladimir Medvedkin 
---
 lib/librte_ipsec/ipsec_sad.c | 245 ---
 1 file changed, 233 insertions(+), 12 deletions(-)

diff --git a/lib/librte_ipsec/ipsec_sad.c b/lib/librte_ipsec/ipsec_sad.c
index 7797628..4bf2206 100644
--- a/lib/librte_ipsec/ipsec_sad.c
+++ b/lib/librte_ipsec/ipsec_sad.c
@@ -13,6 +13,13 @@
 
 #include "rte_ipsec_sad.h"
 
+/*
+ * Rules are stored in three hash tables depending on key_type.
+ * Each rule will also be stored in SPI_ONLY table.
+ * for each data entry within this table last two bits are reserved to
+ * indicate presence of entries with the same SPI in DIP and DIP+SIP tables.
+ */
+
 #define IPSEC_SAD_NAMESIZE 64
 #define SAD_PREFIX "SAD_"
 /* "SAD_" */
@@ -37,20 +44,158 @@ static struct rte_tailq_elem rte_ipsec_sad_tailq = {
 };
 EAL_REGISTER_TAILQ(rte_ipsec_sad_tailq)
 
+#define SET_BIT(ptr, bit)  (void *)((uintptr_t)(ptr) | (uintptr_t)(bit))
+#define CLEAR_BIT(ptr, bit)(void *)((uintptr_t)(ptr) & ~(uintptr_t)(bit))
+#define GET_BIT(ptr, bit)  (void *)((uintptr_t)(ptr) & (uintptr_t)(bit))
+
+/*
+ * @internal helper function
+ * Add a rule of type SPI_DIP or SPI_DIP_SIP.
+ * Inserts a rule into an appropriate hash table,
+ * updates the value for a given SPI in SPI_ONLY hash table
+ * reflecting presence of more specific rule type in two LSBs.
+ * Updates a counter that reflects the number of rules whith the same SPI.
+ */
+static inline int
+add_specific(struct rte_ipsec_sad *sad, void *key,
+   int key_type, void *sa)
+{
+   void *tmp_val;
+   int ret, notexist;
+
+   ret = rte_hash_lookup(sad->hash[key_type], key);
+   notexist = (ret == -ENOENT);
+   ret = rte_hash_add_key_data(sad->hash[key_type], key, sa);
+   if (ret != 0)
+   return ret;
+   ret = rte_hash_lookup_data(sad->hash[RTE_IPSEC_SAD_SPI_ONLY],
+   key, &tmp_val);
+   if (ret < 0)
+   tmp_val = NULL;
+   tmp_val = SET_BIT(tmp_val, key_type);
+   ret = rte_hash_add_key_data(sad->hash[RTE_IPSEC_SAD_SPI_ONLY],
+   key, tmp_val);
+   if (ret != 0)
+   return ret;
+   ret = rte_hash_lookup(sad->hash[RTE_IPSEC_SAD_SPI_ONLY], key);
+   if (key_type == RTE_IPSEC_SAD_SPI_DIP)
+   sad->cnt_arr[ret].cnt_2 += notexist;
+   else
+   sad->cnt_arr[ret].cnt_3 += notexist;
+
+   return 0;
+}
+
 int
-rte_ipsec_sad_add(__rte_unused struct rte_ipsec_sad *sad,
-   __rte_unused union rte_ipsec_sad_key *key,
-   __rte_unused int key_type, __rte_unused void *sa)
+rte_ipsec_sad_add(struct rte_ipsec_sad *sad, union rte_ipsec_sad_key *key,
+   int key_type, void *sa)
+{
+   void *tmp_val;
+   int ret;
+
+   if ((sad == NULL) || (key == NULL) || (sa == NULL) ||
+   /* sa must be 4 byte aligned */
+   (GET_BIT(sa, RTE_IPSEC_SAD_KEY_TYPE_MASK) != 0))
+   return -EINVAL;
+
+   /*
+* Rules are stored in three hash tables depending on key_type.
+* All rules will also have an entry in SPI_ONLY table, with entry
+* value's two LSB's also indicating presence of rule with this SPI
+* in other tables.
+*/
+   switch (key_type) {
+   case(RTE_IPSEC_SAD_SPI_ONLY):
+   ret = rte_hash_lookup_data(sad->hash[key_type],
+   key, &tmp_val);
+   if (ret >= 0)
+   tmp_val = SET_BIT(sa, GET_BIT(tmp_val,
+   RTE_IPSEC_SAD_KEY_TYPE_MASK));
+   else
+   tmp_val = sa;
+   ret = rte_hash_add_key_data(sad->hash[key_type],
+   key, tmp_val);
+   return ret;
+   case(RTE_IPSEC_SAD_SPI_DIP):
+   case(RTE_IPSEC_SAD_SPI_DIP_SIP):
+   return add_specific(sad, key, key_type, sa);
+   default:
+   return -EINVAL;
+   }
+}
+
+/*
+ * @internal helper function
+ * Delete a rule of type SPI_DIP or SPI_DIP_SIP.
+ * Deletes an entry from an appropriate hash table and decrements
+ * an entry counter for given SPI.
+ * If entry to remove is the last one with given SPI within the table,
+ * then it will also update related entry in SPI_ONLY table.
+ * Removes an entry from SPI_ONLY hash table if there no rule left
+ * for this SPI in any table.
+ */
+static inline int
+del_specific(struct rte_ipsec_sad *sad, void *key, int key_type)
 {
-   return -ENOTSUP;
+   void *tmp_val;
+   int ret;
+   uint32_t *cnt;
+
+   ret = rte_hash_del_key(sad->hash[key_type], key);
+   if (ret < 0)
+   return ret;
+   

[dpdk-dev] [RFC 4/5] test/ipsec: add ipsec SAD autotests

2019-08-13 Thread Vladimir Medvedkin
Signed-off-by: Vladimir Medvedkin 
---
 app/test/Makefile |   1 +
 app/test/autotest_data.py |   6 +
 app/test/meson.build  |   1 +
 app/test/test_ipsec_sad.c | 874 ++
 4 files changed, 882 insertions(+)
 create mode 100644 app/test/test_ipsec_sad.c

diff --git a/app/test/Makefile b/app/test/Makefile
index 26ba6fe..e4da070 100644
--- a/app/test/Makefile
+++ b/app/test/Makefile
@@ -223,6 +223,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_BPF) += test_bpf.c
 SRCS-$(CONFIG_RTE_LIBRTE_RCU) += test_rcu_qsbr.c test_rcu_qsbr_perf.c
 
 SRCS-$(CONFIG_RTE_LIBRTE_IPSEC) += test_ipsec.c
+SRCS-$(CONFIG_RTE_LIBRTE_IPSEC) += test_ipsec_sad.c
 ifeq ($(CONFIG_RTE_LIBRTE_IPSEC),y)
 LDLIBS += -lrte_ipsec
 endif
diff --git a/app/test/autotest_data.py b/app/test/autotest_data.py
index 7405149..a4f2882 100644
--- a/app/test/autotest_data.py
+++ b/app/test/autotest_data.py
@@ -518,6 +518,12 @@
 "Func":default_autotest,
 "Report":  None,
 },
+{
+"Name":"IPsec_SAD",
+"Command": "ipsec_sad_autotest",
+"Func":default_autotest,
+"Report":  None,
+},
 #
 #Please always keep all dump tests at the end and together!
 #
diff --git a/app/test/meson.build b/app/test/meson.build
index ec40943..b13ec74 100644
--- a/app/test/meson.build
+++ b/app/test/meson.build
@@ -57,6 +57,7 @@ test_sources = files('commands.c',
'test_hash_readwrite_lf.c',
'test_interrupts.c',
'test_ipsec.c',
+   'test_ipsec_sad.c',
'test_kni.c',
'test_kvargs.c',
'test_latencystats.c',
diff --git a/app/test/test_ipsec_sad.c b/app/test/test_ipsec_sad.c
new file mode 100644
index 000..79d6673
--- /dev/null
+++ b/app/test/test_ipsec_sad.c
@@ -0,0 +1,874 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2010-2014 Intel Corporation
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include "test.h"
+#include "test_xmmt_ops.h"
+
+typedef int32_t (*rte_ipsec_sad_test)(void);
+
+static int32_t test_create_invalid(void);
+static int32_t test_multiple_create(void);
+static int32_t test_add_invalid(void);
+static int32_t test_delete_invalid(void);
+static int32_t test_lookup_invalid(void);
+static int32_t test_lookup_basic(void);
+static int32_t test_lookup_adv(void);
+static int32_t test_lookup_order(void);
+
+#define MAX_SA 10
+#define PASS 0
+#define SPI0xdead  /* spi to install */
+#define DIP0xbeef  /* dip to install */
+#define SIP0xf00d  /* sip to install */
+#define BAD0xbad   /* some random value not installed into the table */
+
+/*
+ * Check that rte_ipsec_sad_create fails gracefully for incorrect user input
+ * arguments
+ */
+int32_t
+test_create_invalid(void)
+{
+   struct rte_ipsec_sad *sad = NULL;
+   struct rte_ipsec_sad_conf config;
+
+   config.max_sa[RTE_IPSEC_SAD_SPI_ONLY] = MAX_SA;
+   config.max_sa[RTE_IPSEC_SAD_SPI_DIP] = MAX_SA;
+   config.max_sa[RTE_IPSEC_SAD_SPI_DIP_SIP] = MAX_SA;
+   config.socket_id = SOCKET_ID_ANY;
+   config.flags = RTE_IPSEC_SAD_FLAG_IPV4;
+
+   /* name == NULL */
+   sad = rte_ipsec_sad_create(NULL, &config);
+   RTE_TEST_ASSERT(sad == NULL,
+   "Call succeeded with invalid parameters\n");
+
+   /* max_sa[SPI_ONLY] = 0 */
+   config.max_sa[RTE_IPSEC_SAD_SPI_ONLY] = 0;
+   sad = rte_ipsec_sad_create(__func__, &config);
+   RTE_TEST_ASSERT(sad == NULL,
+   "Call succeeded with invalid parameters\n");
+
+   /* max_sa[SPI_DIP] = 0 */
+   config.max_sa[RTE_IPSEC_SAD_SPI_ONLY] = MAX_SA;
+   config.max_sa[RTE_IPSEC_SAD_SPI_DIP] = 0;
+   sad = rte_ipsec_sad_create(__func__, &config);
+   RTE_TEST_ASSERT(sad == NULL,
+   "Call succeeded with invalid parameters\n");
+
+   /* max_sa[SPI_DIP_SIP] = 0 */
+   config.max_sa[RTE_IPSEC_SAD_SPI_DIP] = MAX_SA;
+   config.max_sa[RTE_IPSEC_SAD_SPI_DIP_SIP] = 0;
+   sad = rte_ipsec_sad_create(__func__, &config);
+   RTE_TEST_ASSERT(sad == NULL,
+   "Call succeeded with invalid parameters\n");
+   config.max_sa[RTE_IPSEC_SAD_SPI_DIP_SIP] = MAX_SA;
+
+   /* socket_id < -1 is invalid */
+   config.max_sa[RTE_IPSEC_SAD_SPI_ONLY] = MAX_SA;
+   config.socket_id = -2;
+   sad = rte_ipsec_sad_create(__func__, &config);
+   RTE_TEST_ASSERT(sad == NULL,
+   "Call succeeded with invalid parameters\n");
+   config.socket_id = SOCKET_ID_ANY;
+
+   /* invalid flags */
+   config.flags = 0;
+   sad = rte_ipsec_sad_create(__func__, &config);
+   RTE_TEST_ASSERT(sad == NULL,
+   "Call succeeded with invalid parameters\n");
+   config.flags = RTE_IPSEC_SAD_FLAG_IPV4|RTE_IPSEC_SAD_FLAG_IPV6;
+   sad = rte_ipsec_sad_create(__func__, &config);
+   RTE_TEST_ASSERT(sad == NULL,
+   "Call succeeded with invalid parameters\n");
+
+   return TEST_SUCCESS;
+}
+
+

[dpdk-dev] [PATCH] pci: remove unnecessary access() check

2019-08-13 Thread Stephen Hemminger
Just open the sysfs file and handle failure, rather than
using access(). This eliminates Coverity warnings about
"time of check versus time of use"; although for this sysfs
file that is not really an issue anyway.

Coverity ID: 347276
Signed-off-by: Stephen Hemminger 
---
 drivers/bus/pci/linux/pci.c | 13 +++--
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c
index 43debaa25114..6c444aa7ae3d 100644
--- a/drivers/bus/pci/linux/pci.c
+++ b/drivers/bus/pci/linux/pci.c
@@ -512,18 +512,19 @@ pci_device_iommu_support_va(const struct rte_pci_device 
*dev)
 "%s/" PCI_PRI_FMT "/iommu/intel-iommu/cap",
 rte_pci_get_sysfs_path(), addr->domain, addr->bus, addr->devid,
 addr->function);
-   if (access(filename, F_OK) == -1) {
-   /* We don't have an Intel IOMMU, assume VA supported*/
-   return true;
-   }
 
-   /* We have an intel IOMMU */
fp = fopen(filename, "r");
if (fp == NULL) {
-   RTE_LOG(ERR, EAL, "%s(): can't open %s\n", __func__, filename);
+   /* We don't have an Intel IOMMU, assume VA supported*/
+   if (errno == ENOENT)
+   return true;
+
+   RTE_LOG(ERR, EAL, "%s(): can't open %s: %s\n",
+   __func__, filename, strerror(errno));
return false;
}
 
+   /* We have an intel IOMMU */
if (fscanf(fp, "%" PRIx64, &vtd_cap_reg) != 1) {
RTE_LOG(ERR, EAL, "%s(): can't read %s\n", __func__, filename);
fclose(fp);
-- 
2.20.1



Re: [dpdk-dev] [RFC] ethdev: support hairpin queue

2019-08-13 Thread Stephen Hemminger
On Tue, 13 Aug 2019 13:37:48 +
Ori Kam  wrote:

> This RFC replaces RFC[1].
> 
> The hairpin feature (different name can be forward) acts as "bump on the 
> wire",
> meaning that a packet that is received from the wire can be modified using
> offloaded action and then sent back to the wire without application 
> intervention
> which save CPU cycles.
> 
> The hairpin is the inverse function of loopback in which application
> sends a packet then it is received again by the
> application without being sent to the wire.
> 
> The hairpin can be used by a number of different NVF, for example load
> balancer, gateway and so on.
> 
> As can be seen from the hairpin description, hairpin is basically RX queue
> connected to TX queue.
> 
> During the design phase I was thinking of two ways to implement this
> feature the first one is adding a new rte flow action. and the second
> one is create a special kind of queue.


Life would be easier for users if the hairpin was an attribute
of queue configuration, not a separate API call.



Re: [dpdk-dev] [PATCH 1/1] net/mlx4: fix build on PPC64

2019-08-13 Thread David Christensen

On 8/13/19 4:28 AM, Christian Ehrhardt wrote:

The AltiVec header file breaks boolean type:

error: incompatible types when initializing type
'__vector _bool int' {aka '_vector(4) __bool int'} using type 'int'

If __APPLE_ALTIVEC__ is defined, then bool type is redefined
and conflicts with stdbool.h.

There is no good solution to fix it for the whole project without
breaking something else, so a workaround is inserted in mlx5 PMD.
This workaround is not compatible with C++ but there is no C++ in DPDK.

Related to:
https://git.dpdk.org/dpdk/commit/?id=725f5dd0bfb50192a2d2341d4cc69084c2c4e03d

Change-Id: Iceb058c07086def4176c5ab199ca4dd5018d0340
Signed-off-by: Christian Ehrhardt 


Tested-by: David Christensen 


Re: [dpdk-dev] [PATCH] buildtools: lighter experimental symbol check

2019-08-13 Thread Neil Horman
On Tue, Aug 13, 2019 at 08:32:44AM +0200, David Marchand wrote:
> On Mon, Aug 12, 2019 at 10:14 PM Neil Horman  wrote:
> >
> > On Mon, Aug 12, 2019 at 09:02:28AM +0200, David Marchand wrote:
> > > Dumping every object file for every symbol is too heavy.
> > > Use a temporary storage.
> > >
> > > Before:
> > > $ rm -rf master && make defconfig O=master
> > > $ time make EXTRA_CFLAGS=-g O=master
> > > [...]
> > > real  2m24.063s
> > > user  1m16.985s
> > > sys   1m46.372s
> > >
> > > After:
> > > $ rm -rf master && make defconfig O=master
> > > $ time make EXTRA_CFLAGS=-g O=master
> > > [...]
> > > real  1m37.110s
> > > user  0m49.417s
> > > sys   0m51.803s
> > >
> > > Signed-off-by: David Marchand 
> > > ---
> > >  buildtools/check-experimental-syms.sh | 15 ---
> > >  1 file changed, 8 insertions(+), 7 deletions(-)
> > >
> > > diff --git a/buildtools/check-experimental-syms.sh 
> > > b/buildtools/check-experimental-syms.sh
> > > index 0f6c62d..47a06fc 100755
> > > --- a/buildtools/check-experimental-syms.sh
> > > +++ b/buildtools/check-experimental-syms.sh
> > > @@ -18,14 +18,15 @@ then
> > >   exit 0
> > >  fi
> > >
> > > +DUMPFILE=$(mktemp -t dpdk.${0##*/}.XXX.objdump)
> > > +trap 'rm -f "$DUMPFILE"' EXIT
> 
> "If a sigspec is EXIT (0) the command arg is executed on exit from the shell."
> 
> > > +objdump -t $OBJFILE >$DUMPFILE
> > > +
> > When does this temporary file get deleted?
> 
> It should be enough?
> 
Yes, thank you, I missed that.

Acked-by: Neil Horman 

> -- 
> David Marchand
> 


Re: [dpdk-dev] [PATCH 2/4] net/bonding: fix LACP fast queue Rx handler

2019-08-13 Thread Chas Williams





On 7/2/19 11:01 AM, Ferruh Yigit wrote:

On 5/16/2019 10:12 AM, David Marchand wrote:

Hello Chas,

On Fri, Apr 19, 2019 at 12:50 AM Chas Williams <3ch...@gmail.com> wrote:


On 4/18/19 3:11 AM, David Marchand wrote:

Hello Chas,

On Fri, Apr 12, 2019 at 4:02 PM Chas Williams <3ch...@gmail.com
> wrote:

 I should have some time this weekend to run these patches through our
 regression system.


Did you manage to run this series through your tests system ?


There were some other issues over the weekend. Hopefully this one.




Any update ?
Thanks.



Reminder of this patchset, if there is no objection in next a few days I will
merge them.

Thanks,
ferruh



OK, I was able to get a clean run for these patches through our regression
system.  I didn't see any failures with these patches applied. Consider
the following:

David Marchand (4):
  net/bonding: fix oob access in LACP mode when sending many packets
  net/bonding: fix LACP fast queue Rx handler
  net/bonding: fix unicast packets filtering when not in promisc
  net/bonding: prefer allmulti to promisc for LACP

Signed-off-by: Chas Williams 

Sorry this took so long!


[dpdk-dev] [PATCH] ethdev: add more protocol support in flow API

2019-08-13 Thread Wang Ying A
Add new protocol header match support as below

RTE_FLOW_ITEM_TYPE_GTP_PSC
- matches a GTP PDU extension header (type is 0x85:
PDU Session Container)
RTE_FLOW_ITEM_TYPE_PPPOES
- matches a PPPoE Session header.
RTE_FLOW_ITEM_TYPE_PPPOED
- matches a PPPoE Discovery stage header.

Change-Id: I9da6f2c32aca5611ab5a7bb2699f2ad6d3071c59
Signed-off-by: Wang Ying A 
---
 app/test-pmd/cmdline_flow.c | 80 +
 doc/guides/prog_guide/rte_flow.rst  | 25 +
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 10 
 lib/librte_ethdev/rte_flow.c|  3 ++
 lib/librte_ethdev/rte_flow.h| 71 +
 5 files changed, 189 insertions(+)

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 495871394..79bce43e7 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -167,6 +167,13 @@ enum index {
ITEM_GTP_TEID,
ITEM_GTPC,
ITEM_GTPU,
+   ITEM_GTP_PSC,
+   ITEM_GTP_PSC_QFI,
+   ITEM_GTP_PSC_PDU_T,
+   ITEM_PPPOES,
+   ITEM_PPPOED,
+   ITEM_PPPOE_SEID,
+   ITEM_PPPOE_PROTO,
ITEM_GENEVE,
ITEM_GENEVE_VNI,
ITEM_GENEVE_PROTO,
@@ -651,6 +658,9 @@ static const enum index next_item[] = {
ITEM_GTP,
ITEM_GTPC,
ITEM_GTPU,
+   ITEM_GTP_PSC,
+   ITEM_PPPOES,
+   ITEM_PPPOED,
ITEM_GENEVE,
ITEM_VXLAN_GPE,
ITEM_ARP_ETH_IPV4,
@@ -831,6 +841,20 @@ static const enum index item_gtp[] = {
ZERO,
 };
 
+static const enum index item_gtp_psc[] = {
+   ITEM_GTP_PSC_QFI,
+   ITEM_GTP_PSC_PDU_T,
+   ITEM_NEXT,
+   ZERO,
+};
+
+static const enum index item_pppoe[] = {
+   ITEM_PPPOE_SEID,
+   ITEM_PPPOE_PROTO,
+   ITEM_NEXT,
+   ZERO,
+};
+
 static const enum index item_geneve[] = {
ITEM_GENEVE_VNI,
ITEM_GENEVE_PROTO,
@@ -2108,6 +2132,56 @@ static const struct token token_list[] = {
.next = NEXT(item_gtp),
.call = parse_vc,
},
+   [ITEM_GTP_PSC] = {
+   .name = "gtp_psc",
+   .help = "match GTP extension header (type is 0x85)",
+   .priv = PRIV_ITEM(GTP_PSC,
+   sizeof(struct rte_flow_item_gtp_psc)),
+   .next = NEXT(item_gtp_psc),
+   .call = parse_vc,
+   },
+   [ITEM_GTP_PSC_QFI] = {
+   .name = "qfi",
+   .help = "QoS flow identifier",
+   .next = NEXT(item_gtp_psc, NEXT_ENTRY(UNSIGNED), item_param),
+   .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_gtp_psc,
+   qfi)),
+   },
+   [ITEM_GTP_PSC_PDU_T] = {
+   .name = "pdu_t",
+   .help = "PDU type",
+   .next = NEXT(item_gtp_psc, NEXT_ENTRY(UNSIGNED), item_param),
+   .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_gtp_psc,
+   pdu_type)),
+   },
+   [ITEM_PPPOES] = {
+   .name = "pppoes",
+   .help = "match PPPoE Session header",
+   .priv = PRIV_ITEM(PPPOES, sizeof(struct rte_flow_item_pppoe)),
+   .next = NEXT(item_pppoe),
+   .call = parse_vc,
+   },
+   [ITEM_PPPOED] = {
+   .name = "pppoed",
+   .help = "match PPPoE Discovery stage header",
+   .priv = PRIV_ITEM(PPPOED, sizeof(struct rte_flow_item_pppoe)),
+   .next = NEXT(item_pppoe),
+   .call = parse_vc,
+   },
+   [ITEM_PPPOE_SEID] = {
+   .name = "seid",
+   .help = "Session identifier",
+   .next = NEXT(item_pppoe, NEXT_ENTRY(UNSIGNED), item_param),
+   .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_pppoe,
+   session_id)),
+   },
+   [ITEM_PPPOE_PROTO] = {
+   .name = "proto_id",
+   .help = "PPPOE protocol identifier",
+   .next = NEXT(item_pppoe, NEXT_ENTRY(UNSIGNED), item_param),
+   .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_pppoe,
+   proto_id)),
+   },
[ITEM_GENEVE] = {
.name = "geneve",
.help = "match GENEVE header",
@@ -5753,6 +5827,12 @@ flow_item_default_mask(const struct rte_flow_item *item)
case RTE_FLOW_ITEM_TYPE_GTP:
mask = &rte_flow_item_gtp_mask;
break;
+   case RTE_FLOW_ITEM_TYPE_GTP_PSC:
+   mask = &rte_flow_item_gtp_psc_mask;
+   break;
+   case RTE_FLOW_ITEM_TYPE_PPPOES:
+   mask = &rte_flow_item_pppoe_mask;
+   break;
case RTE_FLOW_ITEM_TYPE_ESP:
mask = &rte_flow_item_esp_mask;
break;
diff --git a/doc/guides/prog_guide/rte_flow.rst 
b/doc/guid

[dpdk-dev] *rte_vhost_rx_queue_count* should be protected by vq->access_lock

2019-08-13 Thread He Peng

Hi,


We found that *rte_vhost_rx_queue_count* is not protected by vq->access_lock,
and the access to vq->avail->idx is not thread-safe, since at the same time, the 
vq->avail  might be 

set by *vring_invalidate* when some vhost-user messages arrived, such as 
VRING_SET_ADDRESS,
VRING_SET_MEM_TABLE, etc.


Thanks. 






[dpdk-dev] [PATCH v2] ethdev: add more protocol support in flow API

2019-08-13 Thread Wang Ying A
Add new protocol header match support as below

RTE_FLOW_ITEM_TYPE_GTP_PSC
- matches a GTP PDU extension header (type is 0x85:
PDU Session Container)
RTE_FLOW_ITEM_TYPE_PPPOES
- matches a PPPoE Session header.
RTE_FLOW_ITEM_TYPE_PPPOED
- matches a PPPoE Discovery stage header.

Signed-off-by: Wang Ying A 
---
---
v2: Remove Gerrit Change-Id's.
---
 app/test-pmd/cmdline_flow.c | 80 +
 doc/guides/prog_guide/rte_flow.rst  | 25 +
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 10 
 lib/librte_ethdev/rte_flow.c|  3 ++
 lib/librte_ethdev/rte_flow.h| 71 +
 5 files changed, 189 insertions(+)

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 495871394..79bce43e7 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -167,6 +167,13 @@ enum index {
ITEM_GTP_TEID,
ITEM_GTPC,
ITEM_GTPU,
+   ITEM_GTP_PSC,
+   ITEM_GTP_PSC_QFI,
+   ITEM_GTP_PSC_PDU_T,
+   ITEM_PPPOES,
+   ITEM_PPPOED,
+   ITEM_PPPOE_SEID,
+   ITEM_PPPOE_PROTO,
ITEM_GENEVE,
ITEM_GENEVE_VNI,
ITEM_GENEVE_PROTO,
@@ -651,6 +658,9 @@ static const enum index next_item[] = {
ITEM_GTP,
ITEM_GTPC,
ITEM_GTPU,
+   ITEM_GTP_PSC,
+   ITEM_PPPOES,
+   ITEM_PPPOED,
ITEM_GENEVE,
ITEM_VXLAN_GPE,
ITEM_ARP_ETH_IPV4,
@@ -831,6 +841,20 @@ static const enum index item_gtp[] = {
ZERO,
 };
 
+static const enum index item_gtp_psc[] = {
+   ITEM_GTP_PSC_QFI,
+   ITEM_GTP_PSC_PDU_T,
+   ITEM_NEXT,
+   ZERO,
+};
+
+static const enum index item_pppoe[] = {
+   ITEM_PPPOE_SEID,
+   ITEM_PPPOE_PROTO,
+   ITEM_NEXT,
+   ZERO,
+};
+
 static const enum index item_geneve[] = {
ITEM_GENEVE_VNI,
ITEM_GENEVE_PROTO,
@@ -2108,6 +2132,56 @@ static const struct token token_list[] = {
.next = NEXT(item_gtp),
.call = parse_vc,
},
+   [ITEM_GTP_PSC] = {
+   .name = "gtp_psc",
+   .help = "match GTP extension header (type is 0x85)",
+   .priv = PRIV_ITEM(GTP_PSC,
+   sizeof(struct rte_flow_item_gtp_psc)),
+   .next = NEXT(item_gtp_psc),
+   .call = parse_vc,
+   },
+   [ITEM_GTP_PSC_QFI] = {
+   .name = "qfi",
+   .help = "QoS flow identifier",
+   .next = NEXT(item_gtp_psc, NEXT_ENTRY(UNSIGNED), item_param),
+   .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_gtp_psc,
+   qfi)),
+   },
+   [ITEM_GTP_PSC_PDU_T] = {
+   .name = "pdu_t",
+   .help = "PDU type",
+   .next = NEXT(item_gtp_psc, NEXT_ENTRY(UNSIGNED), item_param),
+   .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_gtp_psc,
+   pdu_type)),
+   },
+   [ITEM_PPPOES] = {
+   .name = "pppoes",
+   .help = "match PPPoE Session header",
+   .priv = PRIV_ITEM(PPPOES, sizeof(struct rte_flow_item_pppoe)),
+   .next = NEXT(item_pppoe),
+   .call = parse_vc,
+   },
+   [ITEM_PPPOED] = {
+   .name = "pppoed",
+   .help = "match PPPoE Discovery stage header",
+   .priv = PRIV_ITEM(PPPOED, sizeof(struct rte_flow_item_pppoe)),
+   .next = NEXT(item_pppoe),
+   .call = parse_vc,
+   },
+   [ITEM_PPPOE_SEID] = {
+   .name = "seid",
+   .help = "Session identifier",
+   .next = NEXT(item_pppoe, NEXT_ENTRY(UNSIGNED), item_param),
+   .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_pppoe,
+   session_id)),
+   },
+   [ITEM_PPPOE_PROTO] = {
+   .name = "proto_id",
+   .help = "PPPOE protocol identifier",
+   .next = NEXT(item_pppoe, NEXT_ENTRY(UNSIGNED), item_param),
+   .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_pppoe,
+   proto_id)),
+   },
[ITEM_GENEVE] = {
.name = "geneve",
.help = "match GENEVE header",
@@ -5753,6 +5827,12 @@ flow_item_default_mask(const struct rte_flow_item *item)
case RTE_FLOW_ITEM_TYPE_GTP:
mask = &rte_flow_item_gtp_mask;
break;
+   case RTE_FLOW_ITEM_TYPE_GTP_PSC:
+   mask = &rte_flow_item_gtp_psc_mask;
+   break;
+   case RTE_FLOW_ITEM_TYPE_PPPOES:
+   mask = &rte_flow_item_pppoe_mask;
+   break;
case RTE_FLOW_ITEM_TYPE_ESP:
mask = &rte_flow_item_esp_mask;
break;
diff --git a/doc/guides/prog_guide/rte_flow.rst 
b/doc/guides/prog_guide/

Re: [dpdk-dev] [RFC] ethdev: support hairpin queue

2019-08-13 Thread Ori Kam
Hi Stephen,

> -Original Message-
> From: Stephen Hemminger 
> Sent: Tuesday, August 13, 2019 6:46 PM
> To: Ori Kam 
> Cc: Thomas Monjalon ; ferruh.yi...@intel.com;
> arybche...@solarflare.com; Shahaf Shuler ; Slava
> Ovsiienko ; Alex Rosenbaum
> ; dev@dpdk.org
> Subject: Re: [dpdk-dev] [RFC] ethdev: support hairpin queue
> 
> On Tue, 13 Aug 2019 13:37:48 +
> Ori Kam  wrote:
> 
> > This RFC replaces RFC[1].
> >
> > The hairpin feature (different name can be forward) acts as "bump on the
> wire",
> > meaning that a packet that is received from the wire can be modified using
> > offloaded action and then sent back to the wire without application
> intervention
> > which save CPU cycles.
> >
> > The hairpin is the inverse function of loopback in which application
> > sends a packet then it is received again by the
> > application without being sent to the wire.
> >
> > The hairpin can be used by a number of different NVF, for example load
> > balancer, gateway and so on.
> >
> > As can be seen from the hairpin description, hairpin is basically RX queue
> > connected to TX queue.
> >
> > During the design phase I was thinking of two ways to implement this
> > feature the first one is adding a new rte flow action. and the second
> > one is create a special kind of queue.
> 
> 
> Life would be easier for users if the hairpin was an attribute
> of queue configuration, not a separate API call.

I was thinking about it. the reason that I split the functions is that they use 
different
parameters sets. For example the hairpin queue doesn't need memory region while 
it does need
the hairpin configuration. So in each case hairpin queue / normal queue there 
will be
parameters that are not in use. I think this is less preferred. What do you 
think?

Thanks,
Ori


Re: [dpdk-dev] [RFC] ethdev: support hairpin queue

2019-08-13 Thread Ori Kam



> -Original Message-
> From: Ori Kam
> Sent: Wednesday, August 14, 2019 8:36 AM
> To: Stephen Hemminger 
> Cc: Thomas Monjalon ; ferruh.yi...@intel.com;
> arybche...@solarflare.com; Shahaf Shuler ; Slava
> Ovsiienko ; Alex Rosenbaum
> ; dev@dpdk.org
> Subject: RE: [dpdk-dev] [RFC] ethdev: support hairpin queue
> 
> Hi Stephen,
> 
> > -Original Message-
> > From: Stephen Hemminger 
> > Sent: Tuesday, August 13, 2019 6:46 PM
> > To: Ori Kam 
> > Cc: Thomas Monjalon ; ferruh.yi...@intel.com;
> > arybche...@solarflare.com; Shahaf Shuler ; Slava
> > Ovsiienko ; Alex Rosenbaum
> > ; dev@dpdk.org
> > Subject: Re: [dpdk-dev] [RFC] ethdev: support hairpin queue
> >
> > On Tue, 13 Aug 2019 13:37:48 +
> > Ori Kam  wrote:
> >
> > > This RFC replaces RFC[1].
> > >
> > > The hairpin feature (different name can be forward) acts as "bump on the
> > wire",
> > > meaning that a packet that is received from the wire can be modified using
> > > offloaded action and then sent back to the wire without application
> > intervention
> > > which save CPU cycles.
> > >
> > > The hairpin is the inverse function of loopback in which application
> > > sends a packet then it is received again by the
> > > application without being sent to the wire.
> > >
> > > The hairpin can be used by a number of different NVF, for example load
> > > balancer, gateway and so on.
> > >
> > > As can be seen from the hairpin description, hairpin is basically RX queue
> > > connected to TX queue.
> > >
> > > During the design phase I was thinking of two ways to implement this
> > > feature the first one is adding a new rte flow action. and the second
> > > one is create a special kind of queue.
> >
> >
> > Life would be easier for users if the hairpin was an attribute
> > of queue configuration, not a separate API call.
> 
> I was thinking about it. the reason that I split the functions is that they 
> use
> different
> parameters sets. For example the hairpin queue doesn't need memory region
> while it does need
> the hairpin configuration. So in each case hairpin queue / normal queue there
> will be
> parameters that are not in use. I think this is less preferred. What do you 
> think?
> 

Forgot in my last mail two more reasons I had for this for this:
1. changing to existing function will break API, and will force all 
applications to update date.
2.  2 API are easier to document and explain.
3. the reason stated above that there will be unused parameters in each call.

What do you think?


> Thanks,
> Ori


[dpdk-dev] [PATCH] examples/ntb: fix resource leaks

2019-08-13 Thread Xiaoyun Li
Resource file was not freed or pointed-to in fseek/ftell. This patch
fixed this issue which is found by coverity scan.

Coverity issue: 347277
Fixes: 440af660ff83 ("examples/ntb: fix error handling")
Cc: sta...@dpdk.org

Signed-off-by: Xiaoyun Li 
---
 examples/ntb/ntb_fwd.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/examples/ntb/ntb_fwd.c b/examples/ntb/ntb_fwd.c
index f8c970cdb..bf8a73547 100644
--- a/examples/ntb/ntb_fwd.c
+++ b/examples/ntb/ntb_fwd.c
@@ -127,11 +127,13 @@ cmd_sendfile_parsed(void *parsed_result,
 
if (fseek(file, 0, SEEK_END) < 0) {
printf("Fail to get file size.\n");
+   fclose(file);
return;
}
size = ftell(file);
if (fseek(file, 0, SEEK_SET) < 0) {
printf("Fail to get file size.\n");
+   fclose(file);
return;
}
 
-- 
2.17.1



Re: [dpdk-dev] [PATCH] examples/ntb: fix resource leaks

2019-08-13 Thread Ye Xiaolong
On 08/14, Xiaoyun Li wrote:
>Resource file was not freed or pointed-to in fseek/ftell. This patch
>fixed this issue which is found by coverity scan.
>
>Coverity issue: 347277
>Fixes: 440af660ff83 ("examples/ntb: fix error handling")
>Cc: sta...@dpdk.org
>
>Signed-off-by: Xiaoyun Li 
>---
> examples/ntb/ntb_fwd.c | 2 ++
> 1 file changed, 2 insertions(+)
>
>diff --git a/examples/ntb/ntb_fwd.c b/examples/ntb/ntb_fwd.c
>index f8c970cdb..bf8a73547 100644
>--- a/examples/ntb/ntb_fwd.c
>+++ b/examples/ntb/ntb_fwd.c
>@@ -127,11 +127,13 @@ cmd_sendfile_parsed(void *parsed_result,
> 
>   if (fseek(file, 0, SEEK_END) < 0) {
>   printf("Fail to get file size.\n");
>+  fclose(file);
>   return;
>   }
>   size = ftell(file);
>   if (fseek(file, 0, SEEK_SET) < 0) {
>   printf("Fail to get file size.\n");
>+  fclose(file);
>   return;
>   }
> 
>-- 
>2.17.1
>

Reviewed-by: Xiaolong Ye