dpdk.git
8 years agovhost: fix off-by-one error on descriptor number check
Maxime Coquelin [Mon, 25 Jul 2016 14:09:58 +0000 (16:09 +0200)]
vhost: fix off-by-one error on descriptor number check

nr_desc is not an index but the number of descriptors,
so can be equal to the virtqueue size.

Fixes: a436f53ebfeb ("vhost: avoid dead loop chain")

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agotimer: fix corruption with reset
Hiroyuki Mikita [Sun, 17 Jul 2016 18:08:00 +0000 (03:08 +0900)]
timer: fix corruption with reset

When timer_cb resets another running timer on the same lcore,
the list of expired timers is chained to the pending-list.
This commit prevents a running timer from being reset
by not its own timer_cb.

Fixes: a4b7a5a45cf5 ("timer: fix race condition")

Signed-off-by: Hiroyuki Mikita <h.mikita89@gmail.com>
Acked-by: Robert Sanford <rsanford@akamai.com>
8 years agotimer: remove unnecessary list insertion
Hiroyuki Mikita [Sun, 17 Jul 2016 17:35:50 +0000 (02:35 +0900)]
timer: remove unnecessary list insertion

When timer_set_running_state() fails in rte_timer_manage(),
the failed timer is put back on pending-list.
In this case, another core tries to reset or stop the timer.
It does not need to be on pending-list.

Fixes: a4b7a5a45cf5 ("timer: fix race condition")

Signed-off-by: Hiroyuki Mikita <h.mikita89@gmail.com>
Acked-by: Robert Sanford <rsanford@akamai.com>
8 years agotimer: fix pending-list manipulation
Hiroyuki Mikita [Sun, 17 Jul 2016 14:35:39 +0000 (23:35 +0900)]
timer: fix pending-list manipulation

This commit fixes incorrect pending-list manipulation
when getting list of expired timers in rte_timer_manage().

When timer_get_prev_entries() sets pending_head on prev,
the pending-list is broken.
The next of pending_head always becomes NULL.
In this depth level, it is not need to manipulate the list.

Fixes: 9b15ba895b9f ("timer: use a skip list")

Signed-off-by: Hiroyuki Mikita <h.mikita89@gmail.com>
Acked-by: Robert Sanford <rsanford@akamai.com>
8 years agoring: fix single consumer dequeue performance
Jerin Jacob [Sun, 24 Jul 2016 17:07:40 +0000 (22:37 +0530)]
ring: fix single consumer dequeue performance

Use of rte_smb_wmb() instead of rte_smb_rmb() in sc dequeue function
creates the additional overhead of waiting for all the STOREs
to be completed to local buffer from ring buffer memory.
The sc dequeue function demands only LOAD-STORE barrier where LOADs
from ring buffer memory needs to be completed before tail pointer update.
Changing to rte_smb_rmb() to enable the required LOAD-STORE barrier.

Fixes: ecc7d10e448e ("ring: guarantee dequeue ordering before tail update")

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
8 years agomk: fix link with glibc < 2.17
Thomas Monjalon [Mon, 25 Jul 2016 10:10:55 +0000 (12:10 +0200)]
mk: fix link with glibc < 2.17

There is a dependency on librt with old glibc.
The -lrt option was added everywhere it is needed but was also
added in some applications makefiles as the first link option.
The problem is this option is really useful only if added after
the objects or libraries using it (except if using --whole-archive).
And the -lrt options put after were removed to avoid duplicates.

It was resulting in errors linking test application:
eal_timer.c:(.text+0x128): undefined reference to `clock_gettime'
eal_timer.c:(.text+0x166): undefined reference to `clock_gettime'
eal_alarm.c:(.text+0xda): undefined reference to `clock_gettime'
eal_alarm.c:(.text+0x211): undefined reference to `clock_gettime'

It is fixed by removing superfluous -lrt in app makefiles.

Fixes: 281948b4753e ("mk: fix missing librt dependencies")
Fixes: 2f6414f4baf1 ("mk: fix static link with glibc < 2.17")

Reported-by: Piotr Azarewicz <piotrx.t.azarewicz@intel.com>
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
8 years agomk: fix build with clang < 3.5
Ferruh Yigit [Mon, 25 Jul 2016 12:55:49 +0000 (13:55 +0100)]
mk: fix build with clang < 3.5

clang version < 3.5 doesn't support -z linker option,
and some FreeBSD box still has clang versions < 3.5 as default version.

compile error:
clang: error: unknown argument: '-z'

Fixes: fd591c4c4e35 ("mk: check shared library dependencies")

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Tested-by: Bruce Richardson <bruce.richardson@intel.com>
8 years agomk: fix clang version query
Ferruh Yigit [Mon, 25 Jul 2016 12:55:48 +0000 (13:55 +0100)]
mk: fix clang version query

-dumpversion is for gcc compatibility and doesn't return actual clang
version. -dumpversion only returns 4.2.1 for a long time.

Fixes: 2ef6eea891e5 ("mk: add clang toolchain")

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Tested-by: Bruce Richardson <bruce.richardson@intel.com>
8 years agoversion: 16.07-rc4
Thomas Monjalon [Fri, 22 Jul 2016 20:41:56 +0000 (22:41 +0200)]
version: 16.07-rc4

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
8 years agomaintainers: add git tree for virtio/vhost
Yuanhan Liu [Tue, 19 Jul 2016 04:17:49 +0000 (12:17 +0800)]
maintainers: add git tree for virtio/vhost

Add a git tree line for the virtio/vhost section, to make an explicit
statement that the developers are suggested to make patches based on
that tree.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
8 years agomaintainers: split networking and crypto drivers
Thomas Monjalon [Wed, 20 Jul 2016 10:34:45 +0000 (12:34 +0200)]
maintainers: split networking and crypto drivers

There are now 2 different sections for drivers/net/ and drivers/crypto/.
It makes possible to declare some dedicated git trees.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
8 years agounify tools naming
Thomas Monjalon [Wed, 20 Jul 2016 13:38:54 +0000 (15:38 +0200)]
unify tools naming

The following tools may be installed system-wide.
It may be cleaner and more convenient to find them with the same
dpdk- prefix (especially for autocompletion).
Moreover, the script dpdk_nic_bind.py deserves a new name because it is
not restricted to NICs and can be used for e.g. crypto.

These files are renamed:
pmdinfogen       -> dpdk-pmdinfogen
pmdinfo.py       -> dpdk-pmdinfo.py
dpdk_pdump       -> dpdk-pdump
dpdk_proc_info   -> dpdk-procinfo
dpdk_nic_bind.py -> dpdk-devbind.py
setup.sh         -> dpdk-setup.sh

The tools pmdinfogen, pmdinfo.py and dpdk_pdump are new in 16.07.

The scripts dpdk_nic_bind.py and setup.sh may have been used with
previous releases by end users. That's why a symbolic link still
provide the old name in the installed tools directory.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agodoc: update sphinx installation instructions
John McNamara [Sun, 17 Jul 2016 13:19:08 +0000 (14:19 +0100)]
doc: update sphinx installation instructions

Update the Sphinx installation instructions in the documentation
contributors guide to reflect the fact that in the 1.4+ versions
of Sphinx the ReadTheDocs theme must also be installed. Previously,
in version 1.3.x, it was installed by default.

Also change 'yum' to 'dnf' for package installations.

Signed-off-by: John McNamara <john.mcnamara@intel.com>
8 years agodoc: fix sphinx highlighting warnings
John McNamara [Sun, 17 Jul 2016 13:11:54 +0000 (14:11 +0100)]
doc: fix sphinx highlighting warnings

Fix warnings raised by Python Sphinx 1.4.5:

    guides/sample_app_ug/ip_pipeline.rst:334:
    WARNING: Could not lex literal_block as "ini". Highlighting skipped.

    guides/sample_app_ug/l2_forward_real_virtual.rst:467:
    WARNING: Could not lex literal_block as "c". Highlighting skipped.

    guides/sample_app_ug/l3_forward.rst:293:
    WARNING: Could not lex literal_block as "c". Highlighting skipped.

    guides/sample_app_ug/vm_power_management.rst:162:
    WARNING: Could not lex literal_block as "xml". Highlighting skipped.

These warnings arise from invalid syntax in code-block directives.

Fixes: f1e779ec5b50 ("doc: update ip pipeline app guide")
Fixes: d0dff9ba445e ("doc: sample application user guide")
Fixes: c75f4e6a7a2b ("doc: add vm power mgmt app")

Signed-off-by: John McNamara <john.mcnamara@intel.com>
8 years agodoc: fix release notes for 16.07
John McNamara [Tue, 19 Jul 2016 13:16:35 +0000 (14:16 +0100)]
doc: fix release notes for 16.07

Fix grammar, spelling and formatting of DPDK 16.07 release notes.

Signed-off-by: John McNamara <john.mcnamara@intel.com>
8 years agodoc: add cryptodev shared library version to release notes
Pablo de Lara [Wed, 20 Jul 2016 12:31:12 +0000 (13:31 +0100)]
doc: add cryptodev shared library version to release notes

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agodoc: add flow bifurcation howto on Linux
Jingjing Wu [Tue, 19 Jul 2016 03:31:10 +0000 (11:31 +0800)]
doc: add flow bifurcation howto on Linux

Flow Bifurcation is a mechanism which uses features of advanced
Ethernet devices to split traffic between queues. It provides
the capability to let the kernel driver and DPDK driver co-exist
and take advantage of both.

It is achieved by using SR-IOV and the NIC's advanced filtering. This
patch describes Flow Bifurcation and adds the user guide for ixgbe
and i40e NICs.

Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
8 years agodoc: add VM live migration image
Bernard Iremonger [Mon, 18 Jul 2016 14:30:27 +0000 (15:30 +0100)]
doc: add VM live migration image

This patch adds an image of the Live Migration of a VM using vhost_user
on the host, test configuration.

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Reviewed-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
8 years agodoc: add VM live migration howto with vhost-user
Bernard Iremonger [Mon, 18 Jul 2016 14:30:26 +0000 (15:30 +0100)]
doc: add VM live migration howto with vhost-user

This patch describes the procedure to be be followed to perform
Live Migration of a VM with Virtio PMD running on a host which
is running the vhost_user sample application (vhost-switch).

It includes sample host and VM scripts used in the procedure.

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Reviewed-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
8 years agodoc: add VF live migration image
Bernard Iremonger [Tue, 19 Jul 2016 15:09:29 +0000 (16:09 +0100)]
doc: add VF live migration image

This patch adds an image of the Live Migration for
virtio and sriov test configuration.

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
8 years agodoc: add VF live migration howto with bonded virtio
Bernard Iremonger [Tue, 19 Jul 2016 15:09:28 +0000 (16:09 +0100)]
doc: add VF live migration howto with bonded virtio

This patch describes the procedure to be be followed
to perform Live Migration of a VM with Virtio and VF PMD's
using the bonding PMD.

It includes sample host and VM scripts used in the procedure,
and a sample switch configuration.

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
8 years agodoc: fix vhost setup in tep_termination guide
Mark Kavanagh [Thu, 21 Jul 2016 13:10:13 +0000 (14:10 +0100)]
doc: fix vhost setup in tep_termination guide

- Fix vhost setup flags
- Add minor edits to improve readability and consistency

Signed-off-by: Mark Kavanagh <mark.b.kavanagh@intel.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
8 years agodoc: note a pitfall on vhost reconnect feature
Yuanhan Liu [Tue, 19 Jul 2016 04:17:48 +0000 (12:17 +0800)]
doc: note a pitfall on vhost reconnect feature

The vhost feature negotiation only happens at virtio reset stage, say
when a virtio-net device is firstly initiated, or when DPDK virtio PMD
initiates. That means, if vhost APP restarts after the negotiation and
reconnects, the feature negotiation process will not be triggered again,
meaning the info is lost. To make reconnect work, QEMU simply saves
the negotiated features before the restart and restores it afterwards.

Therefore, the vhost supported features must be exactly the same before
and after the restart. For example, if TSO is disabled and then enabled,
nothing will work and undefined issues might happen.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
8 years agodoc: update release notes and guide for enic
John Daley [Thu, 21 Jul 2016 09:11:58 +0000 (02:11 -0700)]
doc: update release notes and guide for enic

Signed-off-by: John Daley <johndale@cisco.com>
8 years agodoc: fix macro name in mempool guide
Shreyansh Jain [Mon, 18 Jul 2016 11:33:00 +0000 (17:03 +0530)]
doc: fix macro name in mempool guide

Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
8 years agoexamples/l2fwd-ivshmem: fix build with icc
Ferruh Yigit [Fri, 22 Jul 2016 14:13:36 +0000 (15:13 +0100)]
examples/l2fwd-ivshmem: fix build with icc

icc version 16.0.2, compile error:

examples/l2fwd-ivshmem/host/host.c(157):
error #3656: variable "total_vm_packets_dropped"
             may be used before its value is set
        total_vm_packets_dropped += ctrl->vm_ports[portid].stats.dropped;
        ^

Fixes: 6aa497249172 ("examples/l2fwd-ivshmem: import sample application")

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
8 years agoapp/pdump: cleanup rings upon failures
Reshma Pattan [Fri, 22 Jul 2016 13:44:04 +0000 (14:44 +0100)]
app/pdump: cleanup rings upon failures

Function create_mp_ring_vdev() for failure cases exits without
freeing the created rte rings, because of this, pdump tool cannot be
rerun successfully. Added rte ring cleanup logic upon failures.

Fixes: caa7028276b8 ("app/pdump: add tool for packet capturing")

Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
8 years agonet/i40e: fix unsafe tailq element removal
Pablo de Lara [Fri, 22 Jul 2016 14:02:02 +0000 (15:02 +0100)]
net/i40e: fix unsafe tailq element removal

i40e driver was removing elements when iterating tailq lists
with TAILQ_FOREACH macro, which is not safe.
It is especially visible since the memory is zeroed on free
(commit ea0bddbd14e6).

Instead, TAILQ_FOREACH_SAFE macro is used when removing/freeing
these elements.

Fixes: 4861cde46116 ("i40e: new poll mode driver")
Fixes: 440499cf5376 ("net/i40e: support floating VEB")

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agoeal: add tailq safe iterator macro
Pablo de Lara [Fri, 22 Jul 2016 14:02:01 +0000 (15:02 +0100)]
eal: add tailq safe iterator macro

Removing/freeing elements elements within a TAILQ_FOREACH loop is not safe.
FreeBSD defines TAILQ_FOREACH_SAFE macro, which permits
these operations safely.
This patch defines this macro for Linux systems, where it is not defined.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agomem: fix check of physical address retrieval
Michal Jastrzebski [Fri, 22 Jul 2016 14:33:50 +0000 (16:33 +0200)]
mem: fix check of physical address retrieval

In rte_mem_virt2phy: Value returned from a function and indicating the
number of bytes was ignored. This could cause a wrong pfn (page frame
number) mask read from pagemap file.
When read returns less than the number of sizeof(uint64_t) bytes,
function rte_mem_virt2phy returns error.

Coverity issue: 13212
Fixes: 40b966a211ab ("ivshmem: library changes for mmaping using ivshmem")

Signed-off-by: Michal Jastrzebski <michalx.k.jastrzebski@intel.com>
8 years agoscripts: validate ABI faster with parallel make jobs
Neil Horman [Wed, 20 Jul 2016 19:02:17 +0000 (15:02 -0400)]
scripts: validate ABI faster with parallel make jobs

John Mcnamara and I were discussing enhancing the validate_abi script to
build the dpdk tree faster with multiple jobs.
Theres no reason not to do it, so this implements that requirement.

It uses a DPDK_MAKE_JOBS variable that can be set by the user to limit
the job count.  By default the job count is set to the number of online
cpus.

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
8 years agoexamples/ip_pipeline: fix performance with default config
Sankar Chokkalingam [Mon, 18 Jul 2016 18:23:26 +0000 (11:23 -0700)]
examples/ip_pipeline: fix performance with default config

In TM, the read size should be lesser than the write size to improve
performance.
This enables the TM ports to push maximum packets to the output port.

This fix changes the burst_read value from 64 to 24 in default_tm_params.

Signed-off-by: Sankar Chokkalingam <sankarx.chokkalingam@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
8 years agoexamples/ip_pipeline: fix IPv6 flow classification
Sankar Chokkalingam [Mon, 18 Jul 2016 18:15:43 +0000 (11:15 -0700)]
examples/ip_pipeline: fix IPv6 flow classification

IP Pipeline application with the configuration for Flow Classification
IPV6 did not instantiate.
Parse error in section "PIPELINE1": entry "dma_src_mask" too long

The dma_src_mask check in pipeline_passthrough_parse_args() is wrong.

This fix increases the length of dma_src_mask by 1 for NULL termination
and corrected the validation of dma_src_mask length.
This fix is also propagated to pipeline_fc_parse_args() for key_mask_str
validation.

Signed-off-by: Sankar Chokkalingam <sankarx.chokkalingam@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
8 years agoexamples/ip_pipeline: fix action flow bulk command
Sankar Chokkalingam [Mon, 18 Jul 2016 17:32:58 +0000 (10:32 -0700)]
examples/ip_pipeline: fix action flow bulk command

Error while executing action flow bulk command
pipeline> p 1 action flow bulk ./config/action.txt
Command "action flow bulk" failed
pipeline>

The flow action entries are added successfully.
But the return value is not computed correctly.
Due to this, the error message appears on CLI.

The return value is computed with rsp->n_flows after rsp pointer is freed.
This fix computes the return value before rsp pointer is freed.

Signed-off-by: Sankar Chokkalingam <sankarx.chokkalingam@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
8 years agoexamples/performance-thread: add missing braces
Pablo de Lara [Mon, 18 Jul 2016 11:20:25 +0000 (12:20 +0100)]
examples/performance-thread: add missing braces

pthread_detach() function was returning 0 even when not calling
lthread_detach(), due to missing braces in conditional
(extra indentation was applied, giving a hint this is the correct fix).

Fixes: 433ba6228f9a ("examples/performance-thread: add pthread_shim app")

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Tested-by: John McNamara <john.mcnamara@intel.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
8 years agoexamples/vhost: fix performance
Jianfeng Tan [Thu, 21 Jul 2016 00:42:45 +0000 (00:42 +0000)]
examples/vhost: fix performance

We find significant perfermance drop introduced by below commit,
when vhost example is started with --mergeable 0 and inside vm,
kernel virtio-net driver is used to do ip based forwarding.

The commit, 859b480d5afd ("vhost: add guest offload setting"), adds
support for VIRTIO_NET_F_GUEST_TSO4 and VIRTIO_NET_F_GUEST_TSO6,
in vhost lib. But inside vhost example, the way to disable tso only
excludes the direction from virtio to vhost, but not the opposite
direction. When mergeable is disabled, it triggers big_packets path
of virtio-net driver to prepare to receive possible big packets with
size of 64K. Because mergeable is off, for each entry of avail ring,
virtio driver uses 19 desc chained together, with one desc pointing
to header, other 18 desc pointing to 4K-sized pages. But QEMU only
creates 256 desc entries for each vq, which results in that only 13
packets can be received. VM kernel can quickly handle those packets
and go to sleep (HLT).

As QEMU has no option to set the desc entries of a vq, so here,
we disable VIRTIO_NET_F_GUEST_TSO4 and VIRTIO_NET_F_GUEST_TSO6
with VIRTIO_NET_F_HOST_TSO4 and VIRTIO_NET_F_HOST_TSO6 when we
disable tso of vhost example, to avoid VM kernel virtio driver
go into big_packets path.

Fixes: 9fd72e3cbd29 ("examples/vhost: add virtio offload")

Reported-by: Qian Xu <qian.q.xu@intel.com>
Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
Tested-by: Qian Xu <qian.q.xu@intel.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agoexamples/ipsec-secgw: call start function
Hemant Agrawal [Thu, 21 Jul 2016 10:54:04 +0000 (16:24 +0530)]
examples/ipsec-secgw: call start function

The usual device sequence is configure, queue setup and start.
Crypto device should be started before use.

Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agoexamples/l2fwd-crypto: call start function
Hemant Agrawal [Thu, 21 Jul 2016 10:54:03 +0000 (16:24 +0530)]
examples/l2fwd-crypto: call start function

The usual device sequence is configure, queue setup and start.
Crypto device should be started before use.

Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agoexamples/ipsec-secgw: fix build with gcc 4.5
Sergio Gonzalez Monroy [Tue, 19 Jul 2016 11:06:00 +0000 (12:06 +0100)]
examples/ipsec-secgw: fix build with gcc 4.5

GCC 4.5.x does not handle well initializing anonymous union and/or
structs.

To make the compiler happy we name those anonymous union/struct.

Fixes: 906257e965b7 ("examples/ipsec-secgw: support IPv6")

Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
8 years agocryptodev: fix memory leak in parameter parsing
Pablo de Lara [Mon, 18 Jul 2016 13:21:04 +0000 (14:21 +0100)]
cryptodev: fix memory leak in parameter parsing

When parsing the parameters for virtual device initialization,
rte_kvargs structure was being freed only if there was an error,
not when parsing was successful.

Coverity issue: 124568
Fixes: f3e764fa2fb7 ("cryptodev: uninline parameter parsing")

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Reshma Pattan <reshma.pattan@intel.com>
8 years agonet/virtio-user: fix inconsistent name
Jianfeng Tan [Fri, 22 Jul 2016 02:24:47 +0000 (02:24 +0000)]
net/virtio-user: fix inconsistent name

The commit cb6696d22023 ("drivers: update registration macro usage")
changes the name from virtio-user to virtio_user, because hyphen
cannot be used in a C symbol name. However, this commit does not
update the strings in docs and source code, which could lead to
failure to start this device as per the docs.

This patch updates related strings in the docs and source code.

Fixes: cb6696d22023 ("drivers: update registration macro usage")

Reported-by: Tiwei Bie <tiwei.bie@intel.com>
Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agonet/fm10k: fix RSS hash config
Xiao Wang [Thu, 21 Jul 2016 08:24:30 +0000 (16:24 +0800)]
net/fm10k: fix RSS hash config

Sometimes app just wants to update the RSS hash function and no RSS key
update is needed, but fm10k pmd will return EINVAL for this case.

If the rss_key is NULL, we don't need to check the rss_key_len.

Fixes: 57033cdf8fdc ("fm10k: add PF RSS")

Reported-by: Xueqin Lin <xueqin.lin@intel.com>
Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
8 years agonet/i40e: fix out-of-bounds writes in vector Rx
Sergey Dyasly [Thu, 21 Jul 2016 11:03:38 +0000 (14:03 +0300)]
net/i40e: fix out-of-bounds writes in vector Rx

Rx loop inside _recv_raw_pkts_vec() ignores nb_pkts argument and always
tries to receive RTE_I40E_VPMD_RX_BURST (32) packets. This is a violation
of rte_eth_rx_burst() API and can lead to memory corruption (out-of-bounds
writes to struct rte_mbuf **rx_pkts) if nb_pkts is less than 32.

Fix this by actually using nb_pkts inside the loop.

Fixes: 9ed94e5bb04e ("i40e: add vector Rx")

Signed-off-by: Sergey Dyasly <s.dyasly@samsung.com>
Acked-by: Ilya Maximets <i.maximets@samsung.com>
Acked-by: Adam Bynes <adambynes@outlook.com>
8 years agonet/i40e: fix speed capabilities
Ido Barnea [Thu, 21 Jul 2016 23:25:31 +0000 (01:25 +0200)]
net/i40e: fix speed capabilities

Signed-off-by: Ido Barnea <ibarnea@cisco.com>
Acked-by: Jingjing Wu <jingjing.wu@intel.com>
8 years agonet/ixgbe/base: fix C++ build
Ido Barnea [Thu, 21 Jul 2016 23:20:35 +0000 (01:20 +0200)]
net/ixgbe/base: fix C++ build

Signed-off-by: Ido Barnea <ibarnea@cisco.com>
8 years agonet/enic: heed VLAN strip flag
John Daley [Tue, 19 Jul 2016 22:43:45 +0000 (15:43 -0700)]
net/enic: heed VLAN strip flag

The configure function enicpmd_dev_configure() was not paying attention
to the rxmode VLAN strip bit. Set the VLAN strip mode according to the bit.

Fixes: fefed3d1e62c ("enic: new driver")

Signed-off-by: John Daley <johndale@cisco.com>
Reviewed-by: David Harton <dharton@cisco.com>
Tested-by: David Harton <dharton@cisco.com>
8 years agonet/enic: fix possible Rx corruption
John Daley [Tue, 19 Jul 2016 22:42:43 +0000 (15:42 -0700)]
net/enic: fix possible Rx corruption

Initialize the mbuf data offset to RTE_PKTMBUF_HEADROOM as the
enic takes ownership of them. If allocated mbufs had some offset
other than RTE_PKTMBUF_HEADROOM, the application would read mbuf
data starting at the wrong place and misinterpret the packet.

Fixes: 856d7ba7ed22 ("net/enic: support scattered Rx")

Reviewed-by: Nelson Escobar <neescoba@cisco.com>
Signed-off-by: John Daley <johndale@cisco.com>
8 years agonet/ena: fix icc build
Ferruh Yigit [Tue, 19 Jul 2016 09:33:03 +0000 (10:33 +0100)]
net/ena: fix icc build

drivers/net/ena/base/ena_com.c(346):
error #3656: variable "dev_node" may be used before its value is set
                ENA_MEM_ALLOC_COHERENT_NODE(ena_dev->dmadev,
                ^

drivers/net/ena/base/ena_com.c(399):
error #3656: variable "prev_node" may be used before its value is set
        ENA_MEM_ALLOC_COHERENT_NODE(ena_dev->dmadev,
        ^

Fixes: 3d3edc265fc8 ("net/ena: make coherent memory allocation NUMA-aware")

Reported-by: Eoin Breen <eoin.breen@intel.com>
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Jan Medala <jan@semihalf.com>
8 years agonet/bnx2x: fix mempool name length
Rasesh Mody [Wed, 20 Jul 2016 19:09:34 +0000 (12:09 -0700)]
net/bnx2x: fix mempool name length

This patch fixes following error:
   EAL: Detected 36 lcore(s)
   EAL: Probing VFIO support...
   PMD: bnxt_rte_pmd_init() called for (null)
   EAL: PCI device 0000:08:00.0 on NUMA socket 0
   EAL:   probe driver: 14e4:16a1 rte_bnx2x_pmd
   EAL: PCI device 0000:08:00.1 on NUMA socket 0
   EAL:   probe driver: 14e4:16a1 rte_bnx2x_pmd
   Lcore 0: RX port 0
   Lcore 1: RX port 1
   Initializing port 0... EAL: Error - exiting with code: 1
     Cause: Cannot configure device: err=-6, port=0

Fixes: 540a2110 ("bnx2x: driver core")
Fixes: 85cf0079 ("mem: avoid memzone/mempool/ring name truncation")

Signed-off-by: Rasesh Mody <rasesh.mody@qlogic.com>
8 years agonet/bnx2x: disable fast path interrupts
Rasesh Mody [Wed, 20 Jul 2016 19:09:33 +0000 (12:09 -0700)]
net/bnx2x: disable fast path interrupts

Disable fastpath interrupts and remove unneeded delay in
bnx2x_interrupt_action(). This patch fixes and prevents performance
degradation (upto 50% drop) for BNX2X PMD.

Fixes: 540a2110 ("bnx2x: driver core")

Signed-off-by: Rasesh Mody <rasesh.mody@qlogic.com>
8 years agonet/virtio: fix crash on null dereference
Yuanhan Liu [Tue, 19 Jul 2016 02:39:53 +0000 (10:39 +0800)]
net/virtio: fix crash on null dereference

The rxq/txq for the queue_release callback could be NULL, say when
rte_eth_dev_configure() fails that the queue is not setup at all.

Do a simple NULL check would fix the crash issue.

Fixes: 01ad44fd374f ("net/virtio: split Rx/Tx queue")

Reported-by: Olivier Matz <olivier.matz@6wind.com>
Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agonet/virtio: fix packet corruption
Olivier Matz [Tue, 19 Jul 2016 12:31:59 +0000 (14:31 +0200)]
net/virtio: fix packet corruption

The support of virtio-user changed the way the mbuf dma address is
retrieved, using a physical address in case of virtio-pci and a virtual
address in case of virtio-user.

This change introduced some possible memory corruption in packets,
replacing:
  m->buf_physaddr + RTE_PKTMBUF_HEADROOM
by:
  m->buf_physaddr + m->data_off     (through a macro)

This patch fixes this issue, restoring the original behavior.

By the way, it also rework the macros, adding a "VIRTIO_" prefix and
API comments.

Fixes: f24f8f9fee8a ("net/virtio: allow virtual address to fill vring descriptors")

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Jianfeng Tan <jianfeng.tan@intel.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agovhost: fix unregistering in client mode
Ilya Maximets [Thu, 21 Jul 2016 12:55:36 +0000 (15:55 +0300)]
vhost: fix unregistering in client mode

Currently while calling of 'rte_vhost_driver_unregister()' connection
to QEMU will not be closed. This leads to inability to register driver
again and reconnect to same virtual machine.

This scenario is reproducible with OVS. While executing of the following
command vhost port will be re-created (will be executed
'rte_vhost_driver_register()' followed by 'rte_vhost_driver_unregister()')
network will be broken and QEMU possibly will crash:

ovs-vsctl set Interface vhost1 ofport_request=15

Fix this by closing all established connections on driver unregister and
removing of pending connections from reconnection list.

Fixes: 64ab701c3d1e ("vhost: add vhost-user client mode")

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agovhost: fix connect hang in client mode
Ilya Maximets [Thu, 21 Jul 2016 13:19:35 +0000 (16:19 +0300)]
vhost: fix connect hang in client mode

If something abnormal happened to QEMU, 'connect()' can block calling
thread (e.g. main thread of OVS) forever or for a really long time.
This can break whole application or block the reconnection thread.

Example with OVS:

ovs_rcu(urcu2)|WARN|blocked 512000 ms waiting for main to quiesce
(gdb) bt
#0  connect () from /lib64/libpthread.so.0
#1  vhost_user_create_client (vsocket=0xa816e0)
#2  rte_vhost_driver_register
#3  netdev_dpdk_vhost_user_construct
#4  netdev_open (name=0xa664b0 "vhost1")
[...]
#11 main

Fix that by setting non-blocking mode for client sockets for connection.

Fixes: 64ab701c3d1e ("vhost: add vhost-user client mode")

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agoethdev: fix overwriting driver-specific stats
Remy Horton [Tue, 19 Jul 2016 11:05:17 +0000 (12:05 +0100)]
ethdev: fix overwriting driver-specific stats

After doing a driver callout to fill in the driver specific
parts of struct rte_eth_stats, rte_eth_stats_get() overwrites
the rx_nombuf member regardless of whether the driver itself
has assigned a value. Any driver-assigned value should take
priority.

Fixes: af75078fece3 ("first public release")

Signed-off-by: Remy Horton <remy.horton@intel.com>
8 years agoapp/test: increase memory allocated for greedy autotests
Thomas Monjalon [Tue, 19 Jul 2016 17:15:34 +0000 (19:15 +0200)]
app/test: increase memory allocated for greedy autotests

The autotest lists, requirements and distribution needs a big rework
to reduce the amount of cores and memory required.
The root cause is not addressed yet.

This patch just increase some memory allocation for some greedy tests
which often fail because of memory fragmentation:
LPM6 and reentrancy tests in groups 3 and 6 respectively.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Tested-by: Olivier Matz <olivier.matz@6wind.com>
8 years agoapp/test: disable filtering with stripped binary
Thomas Monjalon [Tue, 19 Jul 2016 16:43:19 +0000 (18:43 +0200)]
app/test: disable filtering with stripped binary

The unavailable tests are filtered out by autotest by looking for
the symbols in the binary:

PCI autotest:                  Skipped [Not Available]       [00m 00s]
Malloc autotest:               Success                       [00m 00s]

It results to skip everything if the binary has no symbol (stripped):

PCI autotest:                  Skipped [Not Available]       [00m 00s]
Malloc autotest:               Skipped [Not Available]       [00m 00s]

This case is handled by getting back to the old behaviour if the binary
has no symbol information:

PCI autotest:                  Fail [Not found]              [00m 00s]
Malloc autotest:               Success                       [00m 00s]

Fixes: d553c8f2b1a2 ("app/test: filter out unavailable tests")

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Tested-by: Olivier Matz <olivier.matz@6wind.com>
8 years agoapp/test: fix mempool freeing
Santosh Shukla [Thu, 21 Jul 2016 11:49:47 +0000 (17:19 +0530)]
app/test: fix mempool freeing

test_mempool func not using pointer variable 'mp_ext' and incorrectly
freed. So removing ptr var. Now freeing mp_stack var.

Fixes: ea151eb48a04 ("app/test: migrate custom mempool handler to stack handler")

Signed-off-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
8 years agoapp/test: fix ring size
Jerin Jacob [Mon, 18 Jul 2016 05:55:54 +0000 (11:25 +0530)]
app/test: fix ring size

rte_ring_create expects the size of the ring to
be a power of 2. REFCNT_RING_SIZE value is not
power of 2 in-case if RTE_MAX_LCORE == 96.
Fix it by aligning the size to next power of 2 value.

Fixes: af75078f ("first public release")

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
8 years agoring: guarantee dequeue ordering before tail update
Juhamatti Kuusisaari [Fri, 15 Jul 2016 04:39:51 +0000 (07:39 +0300)]
ring: guarantee dequeue ordering before tail update

Consumer queue dequeuing must be guaranteed to be done fully before
the tail is updated. This is not guaranteed with a read barrier,
changed to a write barrier just before tail update which in practice
guarantees correct order of reads and writes.

Signed-off-by: Juhamatti Kuusisaari <juhamatti.kuusisaari@coriant.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
8 years agomempool: fix missing registration of free function
Zoltan Kiss [Wed, 20 Jul 2016 17:14:00 +0000 (18:14 +0100)]
mempool: fix missing registration of free function

The new mempool handler interface forgets to register the free() function
of the ops. Introduced in this patch:

Fixes: 449c49b93a6b ("mempool: support handler operations")

Signed-off-by: Zoltan Kiss <zoltan.kiss@schaman.hu>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
8 years agomempool: adjust name size in related data types
Zoltan Kiss [Wed, 20 Jul 2016 17:16:38 +0000 (18:16 +0100)]
mempool: adjust name size in related data types

A recent patch brought up an issue about the size of the 'name' fields:

85cf0079 mem: avoid memzone/mempool/ring name truncation

These relations should be observed:

1. Each ring creates a memzone with a prefixed name:
RTE_RING_NAMESIZE <= RTE_MEMZONE_NAMESIZE - strlen(RTE_RING_MZ_PREFIX)

2. There are some mempool handlers which create a ring with a prefixed
name:
RTE_MEMPOOL_NAMESIZE <= RTE_RING_NAMESIZE - strlen(RTE_MEMPOOL_MZ_PREFIX)

3. A mempool can create up to RTE_MAX_MEMZONE pre and postfixed memzones:
sprintf(postfix, "_%d", RTE_MAX_MEMZONE)
RTE_MEMPOOL_NAMESIZE <= RTE_MEMZONE_NAMESIZE -
strlen(RTE_MEMPOOL_MZ_PREFIX) - strlen(postfix)

Setting all of them to 32 hides this restriction from the application.
This patch decreases the mempool and ring string size to accommodate for
these prefixes, but it doesn't apply the 3rd constraint. Applications
relying on these constants need to be recompiled, otherwise they'll run
into ENAMETOOLONG issues.
The size of the arrays are kept 32 for ABI compatibility, it can be
decreased next time the ABI changes.

Signed-off-by: Zoltan Kiss <zoltan.kiss@schaman.hu>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
8 years agomem: allow full length name
Zoltan Kiss [Wed, 20 Jul 2016 17:16:39 +0000 (18:16 +0100)]
mem: allow full length name

(strlen(name) == sizeof(mz->name) - 1) is a valid case, change the
condition to reflect that.
Move it earlier to avoid lookup with invalid name.
Change errno to ENAMETOOLONG.

Fixes: 85cf0079 ("mem: avoid memzone/mempool/ring name truncation")

Signed-off-by: Zoltan Kiss <zoltan.kiss@schaman.hu>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
8 years agoeal/ppc: fix memory barrier for IBM POWER
Chao Zhu [Fri, 15 Jul 2016 02:30:19 +0000 (10:30 +0800)]
eal/ppc: fix memory barrier for IBM POWER

On weak memory order architecture like POWER, rte_smp_wmb/rte_smp_rmb
need to use CPU instructions, not compiler barrier. This patch fixes
this. Also, to improve performance on PPC64, use light weight sync
instruction instead of sync instruction.

Signed-off-by: Chao Zhu <chaozhu@linux.vnet.ibm.com>
8 years agomk: fix FreeBSD build
Sergio Gonzalez Monroy [Tue, 19 Jul 2016 13:40:37 +0000 (14:40 +0100)]
mk: fix FreeBSD build

The sed syntax of '0,/regexp/' is GNU specific and fails with
non GNU sed in FreeBSD.

To solve the issue we can use awk instead to remove duplicates.

The awk script basically keeps the last config value, while
maintaining order and comments from original config file.

Fixes: b2063f104db7 ("mk: filter duplicate configuration entries")

Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
Acked-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
8 years agomk: fix static link with glibc < 2.17
Thomas Monjalon [Mon, 18 Jul 2016 09:33:52 +0000 (11:33 +0200)]
mk: fix static link with glibc < 2.17

There is an error when linking static EAL library with an application:

eal_alarm.c:(.text+0xd7): undefined reference to `clock_gettime'
eal_alarm.c:(.text+0x20f): undefined reference to `clock_gettime'
eal_timer.c:(.text+0x108): undefined reference to `clock_gettime'
eal_timer.c:(.text+0x146): undefined reference to `clock_gettime'

The function clock_gettime() is in librt for old glibc.

Fixes: 281948b4753e ("mk: fix missing librt dependencies")

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Tested-by: Yongjie Gu <yongjiex.gu@intel.com>
8 years agoversion: 16.07-rc3
Thomas Monjalon [Sat, 16 Jul 2016 14:48:06 +0000 (16:48 +0200)]
version: 16.07-rc3

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
8 years agomaintainers: claim responsibility for KNI
Ferruh Yigit [Thu, 7 Jul 2016 11:00:29 +0000 (12:00 +0100)]
maintainers: claim responsibility for KNI

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
8 years agodoc: fix mailing list address typo
Jeff Shaw [Wed, 13 Jul 2016 11:51:02 +0000 (04:51 -0700)]
doc: fix mailing list address typo

The correct mailing list dev@dpdk.org, not dev@dpkg.org.

Signed-off-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
8 years agodoc: fix consumer/producer mixup in ring guide
Shreyansh Jain [Tue, 12 Jul 2016 09:44:43 +0000 (15:14 +0530)]
doc: fix consumer/producer mixup in ring guide

Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
8 years agodoc: fix grammatical syntax in EAL guide
Shreyansh Jain [Tue, 12 Jul 2016 09:28:26 +0000 (14:58 +0530)]
doc: fix grammatical syntax in EAL guide

Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
8 years agodoc: add pdump shared library version to release notes
Reshma Pattan [Wed, 6 Jul 2016 15:57:40 +0000 (16:57 +0100)]
doc: add pdump shared library version to release notes

Added missing librte_pdump shared library version to release notes.

Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
8 years agodoc: add pcap dependency note to pdump guide
Reshma Pattan [Wed, 6 Jul 2016 15:57:39 +0000 (16:57 +0100)]
doc: add pcap dependency note to pdump guide

Added a missing note about dependencies on libpcap and
CONFIG_RTE_LIBRTE_PMD_PCAP flag that pdump tool has.

Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
8 years agodoc: fix default socket path names in pdump guide
Reshma Pattan [Wed, 13 Jul 2016 16:29:10 +0000 (17:29 +0100)]
doc: fix default socket path names in pdump guide

Fixed default socket path name "/var/run" to "/var/run/.dpdk" and
"$HOME" to "~/.dpdk".

Fixes: 278f945402c5 ("pdump: add new library for packet capture")

Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
8 years agoapp/pdump: add command line options for socket paths
Reshma Pattan [Wed, 13 Jul 2016 16:29:09 +0000 (17:29 +0100)]
app/pdump: add command line options for socket paths

Since users of the pdump library and tool can chose to have their own
server and client paths, it is must for the pdump tool to use the same
server socket path that was used by primary application while
initializing packet capture framework by rte_pdump_init() or
rte_pdump_set_socket_dir() APIs.

To pass the socket path info to pdump tool a new optional command
line options "server-socket-path" and "client-socket-path" are added.

"client-socket-path" is also added, if the users want to have client
sockets in their own defined paths.

Updated pdump tool guide with the new changes.

Fixes: caa7028276b8 ("app/pdump: add tool for packet capturing")

Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
8 years agopdump: fix error handlings
Reshma Pattan [Wed, 13 Jul 2016 16:29:08 +0000 (17:29 +0100)]
pdump: fix error handlings

The changes include
1)If mkdir fails for user passed socket paths log error and return.

2)At some places return value was set to errno and that non-negative number
was returned, but the intention was to return negative value.
So now rte_errno was set to errno and returning the actual negative value
that the APIs has returned.

Fixes: 278f945402c5 ("pdump: add new library for packet capture")

Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
8 years agoip_frag: fix doxygen formatting
Hiroyuki Mikita [Wed, 6 Jul 2016 20:48:45 +0000 (05:48 +0900)]
ip_frag: fix doxygen formatting

This commit fixes some functions missing in API documentation.

Signed-off-by: Hiroyuki Mikita <h.mikita89@gmail.com>
8 years agoexamples/ipsec-secgw: fix inbound crash
Sergio Gonzalez Monroy [Tue, 12 Jul 2016 12:49:35 +0000 (13:49 +0100)]
examples/ipsec-secgw: fix inbound crash

When sending Inbound non IPSec traffic that matches an Inbound Security
Policy set to Protect, the code will check that the SPI of the packet
and the associated Security Association match.

That check should only be done for IPSec packets and results in SEGFAULT
when done on non IPSec packets.

Fixes: 906257e965b7 ("examples/ipsec-secgw: support IPv6")

Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
8 years agoexamples/l2fwd-crypto: improve random key generator
Piotr Azarewicz [Wed, 25 May 2016 13:34:52 +0000 (15:34 +0200)]
examples/l2fwd-crypto: improve random key generator

This patch improve generate_random_key() function by replacing rand()
function with reading from /dev/urandom.

CID 120136 : Calling risky function (DC.WEAK_CRYPTO)
dont_call: rand should not be used for security related applications, as
linear congruential algorithms are too easy to break

Coverity issue: 120136

Signed-off-by: Piotr Azarewicz <piotrx.t.azarewicz@intel.com>
Acked-by: Declan Doherty <declan.doherty@intel.com>
8 years agoexamples/distributor: fix Rx thread logic for zero packet
Reshma Pattan [Thu, 14 Jul 2016 15:48:45 +0000 (16:48 +0100)]
examples/distributor: fix Rx thread logic for zero packet

Zero packets can be returned by rte_eth_rx_burst() and
rte_distributor_returned_pkts() inside lcore_rx(), so
for zero packet scenario instead of proceeding to
next operations we should continue to the next iteration of the
loop to avoid unnecessary processing overhead which is causing
rx packets to be dropped and hence distributor failing to forward the
packets.

Fixes: 07db4a97 ("examples/distributor: new sample app")

Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agoapp/testpmd: remove redundant timer update
Reshma Pattan [Fri, 15 Jul 2016 09:19:10 +0000 (10:19 +0100)]
app/testpmd: remove redundant timer update

Inside flush_fwd_rx_queues removed redundant prev_tsc update with cur_tsc,
as prev_tsc value is always updated with rte_rdtsc() in for loop.

Coverity issue: 127797
Fixes: f487715f36f5 ("app/testpmd: add timeout in Rx queue flushing")

Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agonet/enic: fix crash on error interrupt
Nelson Escobar [Thu, 14 Jul 2016 01:09:17 +0000 (18:09 -0700)]
net/enic: fix crash on error interrupt

When enic's interrupt handler is called indicating an error, it scans
through the receive queues (RQs) on the adapter looking for errors.
But since the inclusion of rx scatter, some of the RQs may not be in
use, and you shouldn't check them for errors.

Fixes: 856d7ba7ed22 ("net/enic: support scattered Rx")

Signed-off-by: Nelson Escobar <neescoba@cisco.com>
Reviewed-by: John Daley <johndale@cisco.com>
8 years agonet/enic: fix calculation of truncated packets
Nelson Escobar [Wed, 13 Jul 2016 16:52:34 +0000 (09:52 -0700)]
net/enic: fix calculation of truncated packets

The calculation of truncated packets didn't take into account packet
errors due to the adapter not having buffers, causing both the
ipackets, and imissed counts to be wrong if such errors occurred.  In
order to properly calculate the number of packets truncated, we need
to subtract the count of errors due to no buffers.

Fixes: c44d9f01adf3 ("net/enic: count truncated packets")

Signed-off-by: Nelson Escobar <neescoba@cisco.com>
8 years agonet/enic: fix queue stop and start
John Daley [Tue, 12 Jul 2016 19:24:47 +0000 (12:24 -0700)]
net/enic: fix queue stop and start

The exported device start and stop functions where not setting the queue
states to RTE_ETH_QUEUE_STATE_STARTED and RTE_ETH_QUEUE_STATE_STOPPED.
After starting the device, the RTE queue stop function would not call
the enic queue stop function since queue was already marked as stopped.

Put queue state updates in the lower level queue start/stop functions
which are called by both device and queue start/stop functions.

Fixes: fefed3d1e62c ("enic: new driver")

Reviewed-by: Nelson Escobar <neescoba@cisco.com>
Signed-off-by: John Daley <johndale@cisco.com>
8 years agonet/enic: fix crash when changing number of queues
John Daley [Sun, 10 Jul 2016 21:15:30 +0000 (14:15 -0700)]
net/enic: fix crash when changing number of queues

The check that all Tx and Rx queues were set up was not
adequate when reconfiguring with a different number of
queues. Only the number of completion queues (CQs) was
being used to make the determination, but the CQ array
is shared between the underlying Rx and Tx queues.

Check that the internal Rx, Tx and CQs are all set up
before completing port configuration.

Fixes: fefed3d1e62c ("enic: new driver")

Signed-off-by: John Daley <johndale@cisco.com>
Reviewed-by: Nelson Escobar <neescoba@cisco.com>
8 years agonet/enic: increment filter failure counter
John Daley [Fri, 8 Jul 2016 22:22:01 +0000 (15:22 -0700)]
net/enic: increment filter failure counter

One instance of a filter add failure was not incrementing the
the fail counter.

Fixes: 4c2c7bf41f5a ("net/enic: fix negative array index write")

Signed-off-by: John Daley <johndale@cisco.com>
8 years agonet/enic: decrement Tx mbuf reference count before recycling
John Daley [Mon, 11 Jul 2016 19:45:01 +0000 (12:45 -0700)]
net/enic: decrement Tx mbuf reference count before recycling

In the burst Tx cleanup function, the reference count in mbufs
returned to the pool should to be decremented before they are
returned. Decrementing is not done by rte_mempool_put_bulk()
so it must be done separately using __rte_pktmbuf_prefree_seg().

Also when returning unsent buffers when the device is stopped
use rte_mbuf_free_seg() instead of rte_mempool_put() so that
reference counts are properly decremented.

Fixes: 36935afbc53c ("net/enic: refactor Tx mbuf recycling")

Reviewed-by: Nelson Escobar <neescoba@cisco.com>
Signed-off-by: John Daley <johndale@cisco.com>
8 years agonet/enic: remove internal driver version
John Daley [Fri, 15 Jul 2016 19:34:53 +0000 (12:34 -0700)]
net/enic: remove internal driver version

The enic PMD code has diverged from code that was once
shared with the enic kernel mode driver for performance
reasons. It is confusing and misleading to print the
internal version number. Remove it.

Fixes: fefed3d1e62c ("enic: new driver")

Signed-off-by: John Daley <johndale@cisco.com>
8 years agonet/mlx5: work around gcc error
Olga Shern [Wed, 13 Jul 2016 14:33:22 +0000 (16:33 +0200)]
net/mlx5: work around gcc error

RHEL 7.1's GCC for POWER8 reports the following error in one rte_memcpy()
macro call by mlx5:

 error: array subscript is above array bounds [-Werror=array-bounds]

It appears to be a GCC bug which can be worked around by making parentheses
more explicit.

Signed-off-by: Olga Shern <olgas@mellanox.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
8 years agonet/fm10k: fix FTAG mode with multiple queues
Xiao Wang [Fri, 15 Jul 2016 10:38:40 +0000 (18:38 +0800)]
net/fm10k: fix FTAG mode with multiple queues

In multi-queue + FTAG use case, we need to turn tx_ftag_en on for all
the Tx queues.

Fixes: 7958b1310d5e ("fm10k: enable FTAG based forwarding")

Reported-by: Ricky Li <ricky.li@intel.com>
Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
8 years agonet/i40e: revert VLAN filtering fix
Jingjing Wu [Wed, 13 Jul 2016 10:27:50 +0000 (18:27 +0800)]
net/i40e: revert VLAN filtering fix

This reverts commit 4761f57d58c6f52543738dbe299f846d62d75895.
Introducing VLAN table by adding VLAN adminq command will cause NIC's
throughput drop obviously. It's a hardware issue.
With this revert, VLAN filtering can only work when promiscuous mode
is disabled.

Reverts: 4761f57d58c6 ("net/i40e: fix VLAN filtering in promiscuous mode")

Reported-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
Acked-by : Jing Chen <jing.d.chen@intel.com>

8 years agonet/virtio-user: fix build with gcc 6
Maxime Coquelin [Tue, 12 Jul 2016 09:30:25 +0000 (11:30 +0200)]
net/virtio-user: fix build with gcc 6

The error is reported using test build script:

$ scripts/test-build.sh x86_64-native-linuxapp-gcc
...
drivers/net/virtio/virtio_user_ethdev.c:345:2: error:
  this ‘if’ clause does not guard... [-Werror=misleading-indentation]
  if (rte_kvargs_count(kvlist, VIRTIO_USER_ARG_PATH) == 1)
    ^~

Fixes: 404bd6bfe360 ("net/virtio-user: fix return value not checked")

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agovhost: fix crash when exceeding file descriptors
Patrik Andersson [Wed, 6 Jul 2016 12:24:58 +0000 (14:24 +0200)]
vhost: fix crash when exceeding file descriptors

Protect against DPDK crash when allocation of listen fd >= 1023.
For events on fd:s >1023, the current implementation will trigger
an abort due to access outside of allocated bit mask.

Corrections would include:

  * Match fdset_add() signature in fd_man.c to fd_man.h
  * Handling of return codes from fdset_add()
  * Addition of check of fd number in fdset_add_fd()

The rationale behind the suggested code change is that,
fdset_event_dispatch() could attempt access outside of the FD_SET
bitmask if there is an event on a file descriptor that in turn
looks up a virtio file descriptor with a value > 1023.
Such an attempt will lead to an abort() and a restart of any
vswitch using DPDK.

A discussion topic exist in the ovs-discuss mailing list that can
provide a little more background:
http://openvswitch.org/pipermail/discuss/2016-February/020243.html

Fixes: 8f972312 ("vhost: support vhost-user")

Signed-off-by: Patrik Andersson <patrik.r.andersson@ericsson.com>
Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agovhost: check ring descriptor address
Ilya Maximets [Fri, 15 Jul 2016 11:15:05 +0000 (14:15 +0300)]
vhost: check ring descriptor address

In current implementation vhost will crash with segmentation fault
if malicious or buggy virtio application breaks addresses of descriptors.

Before commit 0823c1cb0a73 ("vhost: workaround stale vring base")
this crash was reproducible even with normal DPDK application that tries
to change number of virtqueues dynamically inside VM.

Fix that by checking addresses of descriptors before using.

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agovhost: fix used descriptors number of mergeable enqueue
Ilya Maximets [Fri, 15 Jul 2016 11:15:04 +0000 (14:15 +0300)]
vhost: fix used descriptors number of mergeable enqueue

Return value on error changed from '-1' to '0' because it returns
unsigned value and it means number of used descriptors.

Also fixed updating of 'last_used_idx' by using actual number of
used descriptors.

Fixes: 623bc47054d0 ("vhost: do sanity check for ring descriptor length")

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
8 years agovfio: fix coding style
Yong Wang [Thu, 7 Jul 2016 22:26:37 +0000 (15:26 -0700)]
vfio: fix coding style

Signed-off-by: Yong Wang <yongwang@vmware.com>
8 years agovfio: fix PCI resource mapping
Yong Wang [Fri, 15 Jul 2016 00:15:10 +0000 (17:15 -0700)]
vfio: fix PCI resource mapping

The offset of the 2nd mmap() when mapping the region after msix_bar
needs to take region address into consideration as mmap() takes
address that is resource-relative instead of bar-relative.  This is
exposed when binding vmxnet3 to vfio-pci.

Fixes: 90a1633b2347 ("eal/linux: allow to map BARs with MSI-X tables")

Signed-off-by: Yong Wang <yongwang@vmware.com>
Signed-off-by: Ronghua Zhang <rzhang@vmware.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
8 years agomempool: fix empty structure definition
Adrien Mazarguil [Wed, 13 Jul 2016 12:30:41 +0000 (14:30 +0200)]
mempool: fix empty structure definition

This commit addresses the following warning reported by clang, which
happens by default, as long as CONFIG_RTE_LIBRTE_MEMPOOL_DEBUG is disabled:

 warning: empty struct has size 0 in C, size 1 in C++

C and C++ must use the same size for objects to avoid corruption during run
time.

Fixes: 97e7e685bfcd ("mempool: add structure for object trailers")

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
8 years agospinlock: move constructor out of x86 header file
Damjan Marion [Thu, 14 Jul 2016 13:27:29 +0000 (15:27 +0200)]
spinlock: move constructor out of x86 header file

Having constructor function in the header file is generally
a bad idea, as it will eventually be implanted to 3rd party
library.

In this case it causes linking issues with 3rd party libraries
when an application is not linked to dpdk, due to missing
symbol called by constructor.

Fixes: ba7468997ea6 ("spinlock: add HTM lock elision for x86")

Signed-off-by: Damjan Marion <damarion@cisco.com>
Reviewed-by: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
8 years agoapp/test: filter out unavailable tests
Thomas Monjalon [Wed, 13 Jul 2016 16:41:12 +0000 (18:41 +0200)]
app/test: filter out unavailable tests

Some tests can fail to run because they are not compiled.
It has been more visible recently when the PCI test became disabled
in the default configuration because of dependency on libarchive:
    PCI autotest:    Fail [Not found]

The autotest script catch them and do not count them as an error anymore:
    PCI autotest:    Skipped [Not Available]

The commands dump_ring and dump_mempool are removed from the autotest list
because they are some internal commands but not some registered tests.
Thus they cannot be parsed as available test commands.

Suggested-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>