dpdk.git
6 years agoeal: fix error string function
Jerin Jacob [Fri, 2 Nov 2018 08:11:23 +0000 (08:11 +0000)]
eal: fix error string function

errno_autotest testcase were failed since
commit 5d7b673d5fd6 ("mk: build with _GNU_SOURCE defined by default")
RTE>>errno_autotest
rte_strerror: 'Unknown error 11',
strerror: 'Resource temporarily unavailable'
Test Failed

There are two different version of strerror_t() based on
_GNU_SOURCE definition.

/* XSI-compliant */
int strerror_r(int errnum, char *buf, size_t buflen);

/* GNU-specific */
char *strerror_r(int errnum, char *buf, size_t buflen);

Since the GNU-specific version returns char* the exiting "if"
condition around the strerror_r fails.

Switching back to XSI-compliant version to allow

a) Portable strerror_r() usage as musl c library uses
non GNU speficic version
https://git.musl-libc.org/cgit/musl/tree/src/string/strerror_r.c

b) Based on strerror_r(3) man page, it is possible that GNU-specific
version need not use char *buf to fill error message instead it
can use the immutable static string from the library and return it.

note from strerror_r(3) man page:

The GNU-specific strerror_r() returns a pointer to a string containing
the error message.  This may be either a pointer to a string that the
function stores in buf, or a pointer to some (immutable)
static string (in which case buf is unused).

Fixes: 5d7b673d5fd6 ("mk: build with _GNU_SOURCE defined by default")

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
6 years agomk: disable gcc AVX512F support
Yongseok Koh [Sat, 3 Nov 2018 01:06:32 +0000 (01:06 +0000)]
mk: disable gcc AVX512F support

This is a workaround to prevent a crash, which might be caused by
optimization of newer gcc (7.3.0) on Intel Skylake.

This disables AVX512F support of gcc by adding -mno-avx512f if it is
disabled in DPDK (CONFIG_RTE_ENABLE_AVX512=n).

This does not apply to the meson build as that doesn't have such an option
but always enable AVX512F whenever supported.

Bugzilla ID: 97
Cc: stable@dpdk.org
Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
6 years agoexamples/vm_power: respect maximum CPUs
David Hunt [Wed, 31 Oct 2018 11:50:32 +0000 (11:50 +0000)]
examples/vm_power: respect maximum CPUs

The vm_power_manager app was not respecting the POWER_MGR_MAX_CPUS
during initialisation, so if there were more CPUs than this value (64),
it would lead to buffer overruns of there were more then 64 cores in
the system.

Added in a check during init and un-init to only initialise up to
lcore_id 63.

This raises the question as to why not simply increase the value of
POWER_MGR_MAX_CPUS. Well, it's not that simple, as many of the APIs take
a uint64_t as a parameter for the core mask, and this will not work for
cores greater than 63. So some work needs to be done in the future to
remove this limitation. For now we'll fix the memory corruption.

Also, the patch that this fixes says "allow greater than 64 cores" but
that's not across the entire application, it's only for the out-of-band
monitoring. I'll add a notice for an API change in the next release to
clean this up, i.e. depricate any API calls that use masks.

Fixes: 6453b9284b64 ("examples/vm_power: allow greater than 64 cores")
Cc: stable@dpdk.org
Signed-off-by: David Hunt <david.hunt@intel.com>
6 years agoexamples/multi_process: add sigint handler to server
Raslan Darawsheh [Thu, 27 Sep 2018 11:51:44 +0000 (14:51 +0300)]
examples/multi_process: add sigint handler to server

add sigint handler in the server application to stop and close ports

Signed-off-by: Raslan Darawsheh <rasland@mellanox.com>
6 years agodevtools: add explicit warnings for forbidden tokens
Arnon Warshavsky [Fri, 2 Nov 2018 10:52:21 +0000 (12:52 +0200)]
devtools: add explicit warnings for forbidden tokens

Replace the content of warning in the forbidden tokens script
from using the searched regex into using explicit messages

Signed-off-by: Arnon Warshavsky <arnon@qwilt.com>
6 years agoeal/linux: handle UIO read failure in interrupt handler
Luca Boccassi [Wed, 31 Oct 2018 18:39:45 +0000 (18:39 +0000)]
eal/linux: handle UIO read failure in interrupt handler

If a device is unplugged while an interrupt is pending, the
read call to the uio device to remove it from the poll wait list
can fail resulting in it being continually polled forever. This
change checks for the read failing and if so, unregisters the device
as an interrupt source and causes the wait list to be rebuilt.

This race has been reported and observed in production.

Fixes: 0a45657a6794 ("pci: rework interrupt handling")
Cc: stable@dpdk.org
Signed-off-by: Brian Russell <brussell@brocade.com>
Signed-off-by: Luca Boccassi <bluca@debian.org>
6 years agonet/vmxnet3: fix hot-unplug
Luca Boccassi [Wed, 31 Oct 2018 18:39:44 +0000 (18:39 +0000)]
net/vmxnet3: fix hot-unplug

The vmxnet3 driver can't call back into dev_close(), and possibly
dev_stop(), in dev_uninit().  When dev_uninit() is called, anything
that those routines would want to clean up has already been released.
Further, for complete cleanup, it is necessary to release any of the
queue resources during dev_close().
This allows a vmxnet3 device to be hot-unplugged without leaking
queues.
Also set RTE_ETH_DEV_CLOSE_REMOVE on close so that the port resources
can be deallocated.
Return EBUSY if remove is called before stop.

Fixes: dfaff37fc46d ("vmxnet3: import new vmxnet3 poll mode driver implementation")
Cc: stable@dpdk.org
Signed-off-by: Brian Russell <brussell@brocade.com>
Signed-off-by: Luca Boccassi <bluca@debian.org>
6 years agonet/virtio: register/unregister intr handler on start/stop
Luca Boccassi [Wed, 31 Oct 2018 18:39:43 +0000 (18:39 +0000)]
net/virtio: register/unregister intr handler on start/stop

Register and unregister the virtio interrupt handler when the device is
started and stopped. This allows a virtio device to be hotplugged or
unplugged.

Fixes: c1f86306a026 ("virtio: add new driver")
Cc: stable@dpdk.org
Signed-off-by: Brian Russell <brussell@brocade.com>
Signed-off-by: Luca Boccassi <bluca@debian.org>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
6 years agoeal: fix memory leak on multi-process hotplug rollback
Darek Stojaczyk [Wed, 31 Oct 2018 13:16:53 +0000 (14:16 +0100)]
eal: fix memory leak on multi-process hotplug rollback

Fixes: 244d5130719c ("eal: enable hotplug on multi-process")

Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
6 years agodrivers: remove useless constructor headers
Thomas Monjalon [Sun, 28 Oct 2018 10:47:47 +0000 (11:47 +0100)]
drivers: remove useless constructor headers

A constructor is usually declared with RTE_INIT* macros.
As it is a static function, no need to declare before its definition.
The macro is used directly in the function definition.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
6 years agodevtools: check wrong svg include in guides
Thomas Monjalon [Wed, 31 Oct 2018 16:28:42 +0000 (17:28 +0100)]
devtools: check wrong svg include in guides

Including svg files with the svg extension is a common mistake:
.. figure:: example.svg
must be
.. figure:: example.*
So it will work also when building pdf doc with figures converted
to png files.

A check is added in checkpatches.sh.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Signed-off-by: Arnon Warshavsky <arnon@qwilt.com>
6 years agobus/pci: fix resource mapping override
Qi Zhang [Tue, 30 Oct 2018 15:27:20 +0000 (23:27 +0800)]
bus/pci: fix resource mapping override

When scanning an already plugged device, the virtual address
of mapped PCI resource in rte_pci_device will be overridden
with 0, that may cause driver does not work correctly.
The fix is not to update any rte_pci_device's field if the being
scanned device's driver is already probed.

Bugzilla ID: 85
Fixes: c752998b5e2e ("pci: introduce library and driver")
Cc: stable@dpdk.org
Reported-by: Geoffrey Lv <geoffrey.lv@gmail.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
6 years agoeal: fix IPC memory leak on device hotplug
Darek Stojaczyk [Mon, 29 Oct 2018 11:47:18 +0000 (12:47 +0100)]
eal: fix IPC memory leak on device hotplug

rte_mp_request_sync() says that the caller is responsible
for freeing one of its parameters afterwards. EAL didn't
do that, causing a memory leak.

Fixes: 244d5130719c ("eal: enable hotplug on multi-process")

Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
6 years agodoc: fix PDF build
Dan Gora [Mon, 29 Oct 2018 20:34:54 +0000 (17:34 -0300)]
doc: fix PDF build

Don't use .svg extension on ..figure references.  PDF versions of
the documents use .png images generated from the .svg images.

Fixes: 0ba610ca1d17 ("net/mvpp2: document MTR and TM usage")

Signed-off-by: Dan Gora <dg@adax.com>
6 years agoversion: 18.11-rc1
Thomas Monjalon [Mon, 29 Oct 2018 03:08:26 +0000 (04:08 +0100)]
version: 18.11-rc1

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
6 years agotest/metrics: add unit tests for metrics library
Hari Kumar Vemula [Mon, 8 Oct 2018 13:01:27 +0000 (14:01 +0100)]
test/metrics: add unit tests for metrics library

Unit testcases are added for metrics library
Added metrics unit test to autotest list
Updated meson build file
Updated MAINTAINERSHIP for metrics unit test

Signed-off-by: Hari Kumar Vemula <hari.kumarx.vemula@intel.com>
Reviewed-by: Reshma Pattan <reshma.pattan@intel.com>
Reviewed-by: Remy Horton <remy.horton@intel.com>
Acked-by: Remy Horton <remy.horton@intel.com>
6 years agotest/pmd_ring: restructure and cleanup
Chaitanya Babu Talluri [Wed, 26 Sep 2018 13:11:25 +0000 (14:11 +0100)]
test/pmd_ring: restructure and cleanup

Divided main test to smaller logical tests.
Registered with UT framework.
Added cleanup of the resources else ring creation fails
during consecutive test runs.
Freed the allocated mempool, rings and uninitalized the drivers.

Signed-off-by: Chaitanya Babu Talluri <tallurix.chaitanya.babu@intel.com>
Reviewed-by: Reshma Pattan <reshma.pattan@intel.com>
6 years agotest/timer: reduce duration for race condition case
Jananee Parthasarathy [Sat, 22 Sep 2018 08:57:17 +0000 (09:57 +0100)]
test/timer: reduce duration for race condition case

Reduced test duration for timer_racecond unit test.
This wil help to receive quicker test results.

Signed-off-by: Jananee Parthasarathy <jananeex.m.parthasarathy@intel.com>
6 years agotest: clean up on exit
Anatoly Burakov [Thu, 31 May 2018 16:14:02 +0000 (17:14 +0100)]
test: clean up on exit

The test application didn't call rte_eal_cleanup() on exit, which
caused leftover hugepages and memory leaks when running secondary
processes. Fix this by calling rte_eal_cleanup() on exit.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Reviewed-by: Reshma Pattan <reshma.pattan@intel.com>
Tested-by: Reshma Pattan <reshma.pattan@intel.com>
6 years agotest: disable alarm autotest in FreeBSD
Pallantla Poornima [Wed, 19 Sep 2018 14:39:10 +0000 (15:39 +0100)]
test: disable alarm autotest in FreeBSD

Disabled the alarm_autotest UT in FreeBSD
Interrupts are not supported in FreeBSD.
Alarm API depends on interrupts, so disabled alarm test on FreeBSD.

Signed-off-by: Pallantla Poornima <pallantlax.poornima@intel.com>
Reviewed-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Reshma Pattan <reshma.pattan@intel.com>
6 years agoexamples/service_cores: check cores before run
Vipin Varghese [Fri, 12 Oct 2018 13:14:03 +0000 (18:44 +0530)]
examples/service_cores: check cores before run

The service core samples has varied profiles created to run on specified
lcore count. The patch adds the check before each run, to ensure
example has sufficent lcores to be added as service cores on given run
profile. If sufficent cores are not found, the run is skipped with user
notification.

Signed-off-by: Vipin Varghese <vipin.varghese@intel.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
6 years agoexamples/ipv4_multicast: enable multicast promiscuous
Wei Zhao [Wed, 17 Oct 2018 07:41:26 +0000 (15:41 +0800)]
examples/ipv4_multicast: enable multicast promiscuous

This example has not been enable for receiving multicast
packet, so it will drop multicast packet. Users must send packet
with ether MAC destination address the same as pf port MAC address,
in order to forward packet successfully, but this is an example
for forwarding ipv4 multicastpacket. So calling function
rte_eth_promiscuous_enable() or rte_eth_allmulticast_enable() can
enable promiscuous mode of all multicast packet. And also, DPDK has
rte API function of rte_eth_dev_set_mc_addr_list() for setting
specific multicast filter table for specific multicast IP address,
but this example do not support this configuration, so it need to
be enable multicast promiscuous mode instead.

Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
Tested-by: Dong Wang <dong1.wang@intel.com>
6 years agolib: reduce global variable usage
Ferruh Yigit [Sun, 28 Oct 2018 23:57:41 +0000 (23:57 +0000)]
lib: reduce global variable usage

Some global variables can be eliminated, since they are not part of
public interface, it is free to remove them.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
6 years agofix global variable issues
Ferruh Yigit [Sun, 28 Oct 2018 23:57:40 +0000 (23:57 +0000)]
fix global variable issues

Various fixes related to the global variable usage.

Fixes: 43e610bb8565 ("compress/octeontx: introduce octeontx zip PMD")
Fixes: c378f084d6e3 ("compress/octeontx: add device setup ops")
Fixes: b43ebc65aada ("compress/octeontx: create private xform")
Fixes: b1ce8ebd97ba ("eventdev: add PMD callbacks for eth Rx adapter")
Fixes: 3810ae435783 ("eventdev: add interrupt driven queues to Rx adapter")
Fixes: fefed3d1e62c ("enic: new driver")
Cc: stable@dpdk.org
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Reviewed-by: Nikhil Rao <nikhil.rao@intel.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
6 years agodrivers: prefix global variables with module name
Ferruh Yigit [Sun, 28 Oct 2018 23:57:39 +0000 (23:57 +0000)]
drivers: prefix global variables with module name

Some global variables are defined with generic names, add component name
as prefix to variables to prevent collusion with application variables.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
Acked-by: Tianfei Zhang <tianfei.zhang@intel.com>
6 years agoadd missing static keyword to globals
Ferruh Yigit [Sun, 28 Oct 2018 23:57:38 +0000 (23:57 +0000)]
add missing static keyword to globals

Some global variables can indeed be static, add static keyword to them.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
6 years agobus/pci: propagate probing error codes
Darek Stojaczyk [Fri, 26 Oct 2018 07:54:59 +0000 (09:54 +0200)]
bus/pci: propagate probing error codes

In a couple of places we check its error code against -EEXIST,
but this function returned either -1, 0, or 1.

This gets critical when hotplugging a device in secondary
process, while the same device is already plugged in the
primary. Failing to "hotplug" it in the primary will cause
the secondary to fail as well.

Fixes: e9d159c3d534 ("eal: allow probing a device again")

Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
6 years agovfio: fix interrupt unregister for hotplug notifier
Darek Stojaczyk [Wed, 24 Oct 2018 10:11:31 +0000 (12:11 +0200)]
vfio: fix interrupt unregister for hotplug notifier

This function is documented to return the number of unregistered
callbacks or negative numbers on error, but pci_vfio checks for
ret != 0 to detect failures. Not anymore.

Fixes: c115fd000c32 ("vfio: handle hotplug request notifier")

Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
6 years agovfio: share default container in multi-process
Darek Stojaczyk [Wed, 3 Oct 2018 12:39:25 +0000 (14:39 +0200)]
vfio: share default container in multi-process

So far each process in MP used to have a separate container
and relied on the primary process to register all memsegs.

Mapping external memory via rte_vfio_container_dma_map()
in secondary processes was broken, because the default
(process-local) container had no groups bound. There was
even no way to bind any groups to it, because the container
fd was deeply encapsulated within EAL.

This patch introduces a new SOCKET_REQ_DEFAULT_CONTAINER
message type for MP synchronization, makes all processes
within a MP party use a single default container, and hence
fixes rte_vfio_container_dma_map() for secondary processes.

From what I checked this behavior was always the same, but
started to be invalid/insufficient once mapping external
memory was allowed.

While here, fix up the comment on rte_vfio_get_container_fd().
This function always opens a new container, never reuses
an old one.

Fixes: 73a639085938 ("vfio: allow to map other memory regions")
Cc: stable@dpdk.org
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Anatoly Burakov <anatoly.burakov@intel.com>
6 years agovfio: fix read of freed memory on getting container fd
Darek Stojaczyk [Thu, 25 Oct 2018 10:49:10 +0000 (12:49 +0200)]
vfio: fix read of freed memory on getting container fd

We were reading some memory just after freeing it.

Fixes: 83a73c5fef66 ("vfio: use generic multi-process channel")
Cc: stable@dpdk.org
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
6 years agovfio: cleanup getting group fd
Dariusz Stojaczyk [Mon, 17 Sep 2018 13:46:43 +0000 (15:46 +0200)]
vfio: cleanup getting group fd

Factor out duplicated code.

Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
6 years agovfio: check if group fd is already open
Dariusz Stojaczyk [Mon, 17 Sep 2018 13:46:42 +0000 (15:46 +0200)]
vfio: check if group fd is already open

Always attempt to find already opened fd for an iommu
group as subsequent attempts to open it will fail.

There's no public API to check if a group was already
bound and has a container, so rte_vfio_container_group_bind()
shouldn't fail in such case.

Fixes: ea2dc1066870 ("vfio: add multi container support")
Cc: stable@dpdk.org
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Acked-by: Xiao Wang <xiao.w.wang@intel.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
6 years agobus/pci: compare kernel driver instead of interrupt handler
Alejandro Lucero [Thu, 25 Oct 2018 10:49:28 +0000 (11:49 +0100)]
bus/pci: compare kernel driver instead of interrupt handler

Invoking the right pci read/write functions is based on interrupt
handler type. However, this is not configured for secondary processes
precluding to use those functions.

This patch fixes the issue using the driver name the device is bound
to instead.

Fixes: 632b2d1deeed ("eal: provide functions to access PCI config")
Cc: stable@dpdk.org
Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
6 years agonet/virtio: fix PCI config error handling
Brian Russell [Tue, 28 Aug 2018 10:12:40 +0000 (11:12 +0100)]
net/virtio: fix PCI config error handling

In virtio_read_caps and vtpci_msix_detect, rte_pci_read_config returns
the number of bytes read from PCI config or < 0 on error.
If less than the expected number of bytes are read then log the
failure and return rather than carrying on with garbage.

Fixes: 6ba1f63b5ab0 ("virtio: support specification 1.0")
Cc: stable@dpdk.org
Signed-off-by: Brian Russell <brussell@brocade.com>
Signed-off-by: Luca Boccassi <bluca@debian.org>
Reviewed-by: Tiwei Bie <tiwei.bie@intel.com>
6 years agobus/pci: harmonize return value of config read
Luca Boccassi [Tue, 28 Aug 2018 10:12:39 +0000 (11:12 +0100)]
bus/pci: harmonize return value of config read

On Linux, rte_pci_read_config on success returns the number of read
bytes, but on BSD it returns 0.
Document the return values, and have BSD behave as Linux does.

At least one case (bnx2x PMD) treats 0 as an error, so the change
makes sense also for that.

Signed-off-by: Luca Boccassi <bluca@debian.org>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
6 years agoeal: force IOVA to a particular mode
Eric Zhang [Wed, 3 Oct 2018 20:53:13 +0000 (16:53 -0400)]
eal: force IOVA to a particular mode

This patch uses EAL option "--iova-mode" to force the IOVA mode to a
particular value. There exists virtual devices that are not directly
attached to the PCI bus, and therefore the auto detection of the IOVA
mode based on probing the PCI bus and IOMMU configuration may not
report the required addressing mode. Using the EAL option permits the
mode to be explicitly configured in this scenario.

Signed-off-by: Eric Zhang <eric.zhang@windriver.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
Reviewed-by: Marko Kovacevic <marko.kovacevic@intel.com>
6 years agoeal: add --iova-mode option
Santosh Shukla [Wed, 3 Oct 2018 20:53:12 +0000 (16:53 -0400)]
eal: add --iova-mode option

In the case of user don't want to use bus iova scheme and want
to override.

For that, adding EAL option --iova-mode=<string> where valid input
string is 'pa' or 'va'.

Signed-off-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Signed-off-by: Eric Zhang <eric.zhang@windriver.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
6 years agovfio: fix sPAPR IOMMU mapping
Takeshi Yoshimura [Tue, 7 Aug 2018 02:35:06 +0000 (11:35 +0900)]
vfio: fix sPAPR IOMMU mapping

Commit 73a639085938 ("vfio: allow to map other memory regions")
introduced a bug in sPAPR IOMMU mapping. The commit removed necessary
ioctl with VFIO_IOMMU_SPAPR_REGISTER_MEMORY. Also, vfio_spapr_map_walk
should call vfio_spapr_dma_do_map instead of vfio_spapr_dma_mem_map.

Fixes: 73a639085938 ("vfio: allow to map other memory regions")
Cc: stable@dpdk.org
Signed-off-by: Takeshi Yoshimura <tyos@jp.ibm.com>
6 years agonet/nfp: support IOVA VA mode
Alejandro Lucero [Fri, 5 Oct 2018 12:45:27 +0000 (13:45 +0100)]
net/nfp: support IOVA VA mode

NFP can handle IOVA as VA. It requires to check those IOVAs
being in the supported range what is done during initialization.

Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
6 years agonet/nfp: check hugepage IOVA based on DMA mask
Alejandro Lucero [Fri, 5 Oct 2018 12:45:26 +0000 (13:45 +0100)]
net/nfp: check hugepage IOVA based on DMA mask

NFP devices can not handle DMA addresses requiring more than
40 bits. This patch uses rte_dev_check_dma_mask with 40 bits
and avoids device initialization if memory out of NFP range.

Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
6 years agobus/pci: use IOVA DMA mask check when setting IOVA mode
Alejandro Lucero [Fri, 5 Oct 2018 12:45:25 +0000 (13:45 +0100)]
bus/pci: use IOVA DMA mask check when setting IOVA mode

Currently the code precludes IOVA mode if IOMMU hardware reports
less addressing bits than necessary for full virtual memory range.

Although VT-d emulation currently only supports 39 bits, it could
be iovas for allocated memlory being within that supported range.
This patch allows IOVA mode in such a case adding a call to
rte_eal_check_dma_mask using the reported addressing bits by the
IOMMU hardware.

Indeed, memory initialization code has been modified for using lower
virtual addresses than those used by the kernel for 64 bits processes
by default, and therefore memsegs iovas can use 39 bits or less for
most systems. And this is likely 100% true for VMs.

Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
6 years agobus/pci: check IOMMU addressing limitation just once
Alejandro Lucero [Fri, 5 Oct 2018 12:45:24 +0000 (13:45 +0100)]
bus/pci: check IOMMU addressing limitation just once

Current code checks if IOMMU hardware reports enough addressing
bits for using IOVA mode but it repeats the same check for any
PCI device present. This is not necessary because the IOMMU hardware
is the same for all of them.

This patch only checks the IOMMU using first PCI device found.

Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
6 years agomem: use address hint for mapping hugepages
Alejandro Lucero [Fri, 5 Oct 2018 12:45:23 +0000 (13:45 +0100)]
mem: use address hint for mapping hugepages

Linux kernel uses a really high address as starting address for
serving mmaps calls. If there exist addressing limitations and
IOVA mode is VA, this starting address is likely too high for
those devices. However, it is possible to use a lower address in
the process virtual address space as with 64 bits there is a lot
of available space.

This patch adds an address hint as starting address for 64 bits
systems and increments the hint for next invocations. If the mmap
call does not use the hint address, repeat the mmap call using
the hint address incremented by page size.

Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
Reviewed-by: Anatoly Burakov <anatoly.burakov@intel.com>
6 years agomem: add function for checking memseg IOVA
Alejandro Lucero [Fri, 5 Oct 2018 12:45:22 +0000 (13:45 +0100)]
mem: add function for checking memseg IOVA

A device can suffer addressing limitations. This function checks
memsegs have iovas within the supported range based on dma mask.

PMDs should use this function during initialization if device
suffers addressing limitations, returning an error if this function
returns memsegs out of range.

Another usage is for emulated IOMMU hardware with addressing
limitations.

It is necessary to save the most restricted dma mask for checking out
memory allocated dynamically after initialization.

Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
Reviewed-by: Anatoly Burakov <anatoly.burakov@intel.com>
6 years agobus/vdev: fix devargs after multi-process bus scan
Qi Zhang [Thu, 25 Oct 2018 03:30:36 +0000 (11:30 +0800)]
bus/vdev: fix devargs after multi-process bus scan

It's not necessary to insert device argment to devargs_list
during bus scan, but this happens when we try to attach a
device on secondary process. The patch fix the issue.

Fixes: cdb068f031c6 ("bus/vdev: scan by multi-process channel")
Cc: stable@dpdk.org
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
6 years agomalloc: check size hint when reserving the biggest element
Darek Stojaczyk [Sun, 7 Oct 2018 19:31:47 +0000 (21:31 +0200)]
malloc: check size hint when reserving the biggest element

RTE_MEMZONE_SIZE_HINT_ONLY wasn't checked in any way,
causing size hints to be parsed as hard requirements.
This resulted in some allocations being failed prematurely.

Fixes: 68b6092bd3c7 ("malloc: allow reserving biggest element")
Cc: stable@dpdk.org
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Anatoly Burakov <anatoly.burakov@intel.com>
6 years agoeal/linux: fix memory leak of logid
Ziye Yang [Wed, 12 Sep 2018 01:31:50 +0000 (09:31 +0800)]
eal/linux: fix memory leak of logid

This patch is used to fix the memory leak issue of logid.
We use the ASAN test in SPDK when integrating DPDK and
find this memory leak issue.

Fixes: d8a2bc71dfc2 ("log: remove app path from syslog id")
Cc: stable@dpdk.org
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
6 years agoip_frag: fix overflow in key comparison
Li Han [Thu, 2 Aug 2018 02:01:03 +0000 (22:01 -0400)]
ip_frag: fix overflow in key comparison

in struct ip_frag_key,src_dst[] type is uint64_t.
but "val" which to store the calc restult ,type is uint32_t.
we may lost high 32 bit key. and function return value is int,
but it won't return < 0.

Signed-off-by: Li Han <han.li1@zte.com.cn>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
6 years agodoc: support building HTML guides with meson
Bruce Richardson [Thu, 20 Sep 2018 13:22:08 +0000 (14:22 +0100)]
doc: support building HTML guides with meson

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Luca Boccassi <bluca@debian.org>
Tested-by: Timothy Redaelli <tredaelli@redhat.com>
6 years agobuild: add option to override drivers install directory
Luca Boccassi [Tue, 2 Oct 2018 16:20:46 +0000 (17:20 +0100)]
build: add option to override drivers install directory

Allow users and packagers to override the default dpdk/drivers
subdirectory where the PMDs get installed under $lib.

Signed-off-by: Luca Boccassi <bluca@debian.org>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Timothy Redaelli <tredaelli@redhat.com>
6 years agobuild: change default driver installation directory
Luca Boccassi [Tue, 2 Oct 2018 16:20:45 +0000 (17:20 +0100)]
build: change default driver installation directory

As part of the effort of consolidating the DPDK installation bits and
pieces across distros, set the default directory of lib/ where PMDs get
installed to dpdk/pmds-XX.YY. It's necessary to have a versioned
subdirectory as multiple ABI revisions might be installed at the same
time, so having a fixed name will cause trouble with the autoload
feature.
Small refactor with parsing and saving the major version to a variable,
since it's now used in 3 different places.

Signed-off-by: Luca Boccassi <bluca@debian.org>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Timothy Redaelli <tredaelli@redhat.com>
6 years agonet/vdev_netvsc: disable in FreeBSD build with meson
Agalya Babu RadhaKrishnan [Thu, 4 Oct 2018 14:10:03 +0000 (15:10 +0100)]
net/vdev_netvsc: disable in FreeBSD build with meson

Disabled vdev_netvsc build in FreeBSD because it is not supported.
Added changes to enable vdev_netvsc build if it is Linux OS and
disable in FreeBSD.

Fixes: 9fc43dbfd66e ("net/vdev_netvsc: add in meson build")

Signed-off-by: Agalya Babu RadhaKrishnan <agalyax.babu.radhakrishnan@intel.com>
Acked-by: Stephen Hemminger <sthemmin@microsoft.com>
6 years agonet/tap: disable in FreeBSD build with meson
Agalya Babu RadhaKrishnan [Thu, 4 Oct 2018 14:10:02 +0000 (15:10 +0100)]
net/tap: disable in FreeBSD build with meson

Disabled tap build in FreeBSD because it is not supported
Added changes to enable tap build if it is Linux OS and
disable in FreeBSD.

Fixes: 095cae366804 ("net/tap: add in meson build")

Signed-off-by: Agalya Babu RadhaKrishnan <agalyax.babu.radhakrishnan@intel.com>
Acked-by: Keith Wiles <keith.wiles@intel.com>
6 years agonet/softnic: disable in FreeBSD build with meson
Agalya Babu RadhaKrishnan [Thu, 4 Oct 2018 14:10:01 +0000 (15:10 +0100)]
net/softnic: disable in FreeBSD build with meson

Disabled softnic build in FreeBSD because it is not supported
Added changes to enable softnic build if it is Linux OS and
disable in FreeBSD.

Fixes: 6b2a3900e2fb ("net/softnic: add to meson build")
Cc: stable@dpdk.org
Signed-off-by: Agalya Babu RadhaKrishnan <agalyax.babu.radhakrishnan@intel.com>
Acked-by: Jasvinder Singh <jasvinder.singh@intel.com>
6 years agonet/avp: disable in FreeBSD build with meson
Agalya Babu RadhaKrishnan [Thu, 4 Oct 2018 14:10:00 +0000 (15:10 +0100)]
net/avp: disable in FreeBSD build with meson

Disabled avp build in FreeBSD because it is not supported.
Added changes to enable avp build if it is Linux OS and
disable in FreeBSD.

Fixes: ed71204dd06c ("net/avp: add to meson build")
Cc: stable@dpdk.org
Signed-off-by: Agalya Babu RadhaKrishnan <agalyax.babu.radhakrishnan@intel.com>
Acked-by: Allain Legacy <allain.legacy@windriver.com>
6 years agonet/nfp: disable in FreeBSD build with meson
Agalya Babu RadhaKrishnan [Thu, 4 Oct 2018 14:09:59 +0000 (15:09 +0100)]
net/nfp: disable in FreeBSD build with meson

Disabled nfp build in FreeBSD because it is not supported
Added changes to enable NFP build if it is Linux OS and
disable in FreeBSD.

Fixes: d9b9ca7e0595 ("net/nfp: add to meson build")
Cc: stable@dpdk.org
Signed-off-by: Agalya Babu RadhaKrishnan <agalyax.babu.radhakrishnan@intel.com>
6 years agovfio: disable in FreeBSD build with meson
Agalya Babu RadhaKrishnan [Thu, 4 Oct 2018 14:09:58 +0000 (15:09 +0100)]
vfio: disable in FreeBSD build with meson

FreeBSD compilation was failing through meson build.
RTE_EAL_VFIO is not supported in FreeBSD.
But RTE_EAL_VFIO was enabled for both linux and freebsd.
So RTE_EAL_VFIO is removed from config/rte_config.h and
based on the platform RTE_EAL_VFIO flag is enabled/disabled appropriately.

Fixes: 844514c735 ("eal: build with meson")
Cc: stable@dpdk.org
Signed-off-by: Agalya Babu RadhaKrishnan <agalyax.babu.radhakrishnan@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
6 years agobuildtools: fix build for some mktemp
Ferruh Yigit [Sat, 27 Oct 2018 00:38:15 +0000 (01:38 +0100)]
buildtools: fix build for some mktemp

build error:
== Build drivers/net/tap
mktemp: cannot create temp file /tmp/dpdk.auto-config-h.sh.XXX.c:
Invalid argument
.../buildtools/auto-config-h.sh: line 86: : No such file or directory
.../drivers/net/tap/Makefile:55: recipe for target
   'tap_autoconf.h.new' failed

Above error observed on Wind River Linux 8.0

`mktemp` command in that system has a restrictions to have X in
the template at the end and at least six of them.

Complied to mktemp requirements and add -xc flag to compiler to say
`temp` file is a C file

Fixes: ff37ca5d3773 ("devtools: use a common prefix for temporary files")

Reported-by: Shuai Zhu <shuaix.zhu@intel.com>
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
6 years agodoc: add telemetry how-to
Ciara Power [Sat, 27 Oct 2018 09:17:48 +0000 (10:17 +0100)]
doc: add telemetry how-to

This patch adds all documentation for telemetry.

A description on how to use the Telemetry API with a DPDK
application is given in this document.

It also adds a release notes update for telemetry.

Signed-off-by: Ciara Power <ciara.power@intel.com>
Signed-off-by: Brian Archbold <brian.archbold@intel.com>
Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
Acked-by: Marko Kovacevic <marko.kovacevic@intel.com>
6 years agousertools: add client script for telemetry
Ciara Power [Sat, 27 Oct 2018 09:17:49 +0000 (10:17 +0100)]
usertools: add client script for telemetry

This patch adds a python script which can be used as a demo
client. The script is interactive and will allow the user to
register, request statistics, and unregister.

To run the script, an argument for the client file path must
be passed in: "python telemetry_client.py <file_path>".

This script is useful to see how the Telemetry API for DPDK
is used, and how to make the initial connection.

Signed-off-by: Ciara Power <ciara.power@intel.com>
Signed-off-by: Brian Archbold <brian.archbold@intel.com>
Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
6 years agobuild: add dependency on telemetry to apps with meson
Kevin Laatz [Sat, 27 Oct 2018 09:17:50 +0000 (10:17 +0100)]
build: add dependency on telemetry to apps with meson

This patch adds telemetry as a dependecy to all applications. Without these
changes, the --telemetry flag will not be recognised and applications will
fail to run if they want to enable telemetry.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
6 years agotelemetry: add ability to disable selftest
Ciara Power [Sat, 27 Oct 2018 09:17:47 +0000 (10:17 +0100)]
telemetry: add ability to disable selftest

This patch adds functionality to enable/disable the selftest.

This functionality will be extended in future to make the
enabling/disabling more dynamic and remove this 'hardcoded' approach. We
are temporarily using this approach due to the design changes (vdev vs eal)
made to the library.

Signed-off-by: Ciara Power <ciara.power@intel.com>
Signed-off-by: Brian Archbold <brian.archbold@intel.com>
Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
6 years agotelemetry: format json response when sending stats
Ciara Power [Sat, 27 Oct 2018 09:17:46 +0000 (10:17 +0100)]
telemetry: format json response when sending stats

This patch adds functionality to create a JSON message in
order to send it to a client socket.

When stats are requested by a client, they are retrieved from
the metrics library and encoded in JSON format.

Signed-off-by: Ciara Power <ciara.power@intel.com>
Signed-off-by: Brian Archbold <brian.archbold@intel.com>
Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
6 years agotelemetry: update metrics before sending stats
Ciara Power [Sat, 27 Oct 2018 09:17:45 +0000 (10:17 +0100)]
telemetry: update metrics before sending stats

This patch adds functionality to update the statistics in
the metrics library with values from the ethdev stats.

Values need to be updated before they are encoded into a JSON
message and sent to the client that requested them. The JSON encoding
will be added in a subsequent patch.

Signed-off-by: Ciara Power <ciara.power@intel.com>
Signed-off-by: Brian Archbold <brian.archbold@intel.com>
Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
6 years agotelemetry: add parser for client socket messages
Ciara Power [Sat, 27 Oct 2018 09:17:44 +0000 (10:17 +0100)]
telemetry: add parser for client socket messages

This patch adds the parser file. This is used to parse any
messages that are received on any of the client sockets.

Currently, the unregister functionality works using the parser.
Functionality relating to getting statistic values for certain ports
will be added in a subsequent patch, however the parsing involved
for that command is added in this patch.

Some of the parser code included is in preparation for future
functionality, that is not implemented yet in this patchset.

Signed-off-by: Ciara Power <ciara.power@intel.com>
Signed-off-by: Brian Archbold <brian.archbold@intel.com>
Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
6 years agotelemetry: add client feature and sockets
Ciara Power [Sat, 27 Oct 2018 09:17:43 +0000 (10:17 +0100)]
telemetry: add client feature and sockets

This patch introduces clients to the telemetry API.

When a client makes a connection through the initial telemetry
socket, they can send a message through the socket to be
parsed. Register messages are expected through this socket, to
enable clients to register and have a client socket setup for
future communications.

A TAILQ is used to store all clients information. Using this, the
client sockets are polled for messages, which will later be parsed
and dealt with accordingly.

Functionality that make use of the client sockets were introduced
in this patch also, such as writing to client sockets, and sending
error responses.

Signed-off-by: Ciara Power <ciara.power@intel.com>
Signed-off-by: Brian Archbold <brian.archbold@intel.com>
Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
6 years agotelemetry: add initial connection socket
Ciara Power [Sat, 27 Oct 2018 09:17:42 +0000 (10:17 +0100)]
telemetry: add initial connection socket

This patch adds the telemetry UNIX socket. It is used to
allow connections from external clients.

On the initial connection from a client, ethdev stats are
registered in the metrics library, to allow for their retrieval
at a later stage.

Signed-off-by: Ciara Power <ciara.power@intel.com>
Signed-off-by: Brian Archbold <brian.archbold@intel.com>
Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
6 years agotelemetry: introduce infrastructure
Ciara Power [Sat, 27 Oct 2018 09:17:41 +0000 (10:17 +0100)]
telemetry: introduce infrastructure

This patch adds the infrastructure and initial code for the telemetry
library.

The telemetry init is registered with eal_init(). We can then check to see
if --telemetry was passed as an eal option. If --telemetry was parsed, then
we call telemetry init at the end of eal init.

Control threads are used to get CPU cycles for telemetry, which are
configured in this patch also.

Signed-off-by: Ciara Power <ciara.power@intel.com>
Signed-off-by: Brian Archbold <brian.archbold@intel.com>
Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
6 years agoeal: export function to get runtime directory
Kevin Laatz [Sat, 27 Oct 2018 09:17:40 +0000 (10:17 +0100)]
eal: export function to get runtime directory

This patch makes the eal_get_runtime_dir() API public so it can be used
from outside EAL.

Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
6 years agoeal: add option register infrastructure
Kevin Laatz [Sat, 27 Oct 2018 09:17:39 +0000 (10:17 +0100)]
eal: add option register infrastructure

This commit adds infrastructure to EAL that allows an application to
register it's init function with EAL. This allows libraries to be
initialized at the end of EAL init.

This infrastructure allows libraries that depend on EAL to be initialized
as part of EAL init, removing circular dependency issues.

Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
Acked-by: Gaetan Rivet <gaetan.rivet@6wind.com>
6 years agocommon/qat: fix for invalid response from firmware
Fiona Trahe [Tue, 23 Oct 2018 23:39:42 +0000 (00:39 +0100)]
common/qat: fix for invalid response from firmware

Check that the firmware response has a bit set indicating
it's valid before dereferencing the rest of the response contents.

Fixes: 0bdd36e12245 ("crypto/qat: make dequeue function generic")
Cc: stable@dpdk.org
Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
Acked-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
6 years agocompress/qat: enable dynamic huffman encoding
Fiona Trahe [Fri, 26 Oct 2018 18:18:30 +0000 (19:18 +0100)]
compress/qat: enable dynamic huffman encoding

Enable dynamic huffman encoding in the QAT comp PMD.

Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
Acked-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
6 years agoapp/testpmd: fix QinQ strip display option
Jerin Jacob [Fri, 26 Oct 2018 12:40:32 +0000 (12:40 +0000)]
app/testpmd: fix QinQ strip display option

Fix a typo on DEV_RX_OFFLOAD_QINQ_STRIP selection.

Fixes: 0074d02fca21 ("app/testpmd: convert to new Rx offloads API")
Cc: stable@dpdk.org
Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
6 years agodoc: fix typo in testpmd guide
Yong Wang [Fri, 26 Oct 2018 10:27:03 +0000 (06:27 -0400)]
doc: fix typo in testpmd guide

The forwarding mode mac_swap should be macswap in testpmd guide.

Fixes: e76d7a768ce0 ("doc: fix syntax in testpmd user guide")
Cc: stable@dpdk.org
Signed-off-by: Yong Wang <wang.yong19@zte.com.cn>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
6 years agoethdev: make offload name API non-experimental
Stephen Hemminger [Fri, 19 Oct 2018 17:35:32 +0000 (10:35 -0700)]
ethdev: make offload name API non-experimental

The offload name functions are useful, but since they are
marked experimental they can not be used by upstream projects.
For example, VPP duplicates the same table in its code.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
6 years agonet/bonding: avoid making copy of MAC address
Chas Williams [Thu, 25 Oct 2018 22:04:37 +0000 (18:04 -0400)]
net/bonding: avoid making copy of MAC address

Calling rte_eth_macaddr_get to get a copy of the MAC address causes
a hot spot according to profiling. We can easily get the current
MAC address by just examining the bonded device.

Signed-off-by: Chas Williams <chas3@att.com>
6 years agonet/ena: change version to 1.1.1
Michal Krawczyk [Thu, 25 Oct 2018 17:59:23 +0000 (19:59 +0200)]
net/ena: change version to 1.1.1

Version change is connected with major bug fixes.

Signed-off-by: Michal Krawczyk <mk@semihalf.com>
6 years agonet/ena: fix passing RSS hash to mbuf
Stewart Allen [Thu, 25 Oct 2018 17:59:22 +0000 (19:59 +0200)]
net/ena: fix passing RSS hash to mbuf

The driver was passing to the mbuf Rx queue ID instead of hash received
from the device. Now, the RSS hash from the Rx descriptor is being set.

Fixes: 1173fca25af9 ("ena: add polling-mode driver")
Cc: stable@dpdk.org
Signed-off-by: Stewart Allen <allenste@amazon.com>
Acked-by: Michal Krawczyk <mk@semihalf.com>
6 years agonet/ena: recreate HW IO rings on start and stop
Michal Krawczyk [Thu, 25 Oct 2018 17:59:21 +0000 (19:59 +0200)]
net/ena: recreate HW IO rings on start and stop

On the start the driver was refilling all Rx buffs, but the old ones
were not released. That way running start/stop for a few times was
causing device to run out of descriptors.

To fix the issue, IO rings are now being destroyed on stop, and
recreated on start. That way the device is not losing any descriptors.

Furthermore, there was also memory leak for the Rx mbufs, which were
created on start and not destroyed on stop.

Fixes: eb0ef49dd5d5 ("net/ena: add stop and uninit routines")
Cc: stable@dpdk.org
Signed-off-by: Michal Krawczyk <mk@semihalf.com>
6 years agodrivers/net: use sleep delay by default for Intel NICs
Ilya Maximets [Wed, 10 Oct 2018 14:12:20 +0000 (17:12 +0300)]
drivers/net: use sleep delay by default for Intel NICs

NICs uses different delays up to a second during their
configuration. It makes no sense to busy-wait so long wasting
CPU cycles and preventing any other threads to execute on the
same CPU core. These busy polling are the rudiments that came
from the kernel drivers where you can not sleep in interrupt
context, but as we're in userspace, we're able and should
sleep to allow other threads to run.
Delays never called on rx/tx path, so this should not affect
performance.

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
6 years agoeal: add nanosleep based delay function
Ilya Maximets [Wed, 10 Oct 2018 14:12:19 +0000 (17:12 +0300)]
eal: add nanosleep based delay function

Add a new rte_delay_us_sleep() function that uses nanosleep().
This function can be used by applications to not implement
their own nanosleep() based callback and by internal DPDK
code if CPU non-blocking delay needed.

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
6 years agonet/*/base: allow experimental APIs
Ilya Maximets [Thu, 4 Oct 2018 13:18:35 +0000 (16:18 +0300)]
net/*/base: allow experimental APIs

This functionality was missed while adding new drivers to
the meson build.

Fixes: bfabd06000c0 ("net/avf: support meson build")
Fixes: 30d3d0168301 ("net/qede: add in meson build")

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
6 years agoapp/testpmd: setup attached ports on probe event
Thomas Monjalon [Thu, 25 Oct 2018 15:11:17 +0000 (17:11 +0200)]
app/testpmd: setup attached ports on probe event

After probing is done, each new port must be setup.
The new ports are currently guessed by iterating on ports
matching the devargs string used for probing.

When probing a port, it is possible that one more port probing
get triggered (e.g. PF is automatically probed when probing
a VF representor). Such automatic probing will be caught only on event.

The iterator loop may be replaced by a call from the event callback.
In order to be able to test both modes, a command is added
to choose between iterator and event modes.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
6 years agoapp/testpmd: move ethdev events registration
Thomas Monjalon [Thu, 25 Oct 2018 15:11:16 +0000 (17:11 +0200)]
app/testpmd: move ethdev events registration

The callback for ethdev events was registered on port start,
so it was missing some events.

It is now registered at the beginning of the main function.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
6 years agoapp/testpmd: check not configuring port twice
Thomas Monjalon [Thu, 25 Oct 2018 15:11:15 +0000 (17:11 +0200)]
app/testpmd: check not configuring port twice

It is possible to request probing of a device twice,
and possibly get new ports for this device.
However, the ports which were already probed and setup
must not be setup again. That's why it is checked whether
the port is already part of fwd_ports_ids array at the beginning
of the function setup_attached_port().

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
6 years agoapp/testpmd: merge ports list update functions
Thomas Monjalon [Thu, 25 Oct 2018 15:11:14 +0000 (17:11 +0200)]
app/testpmd: merge ports list update functions

The arrays ports_ids and fwd_ports_ids require the same kind
of update when some ports are removed or added.

The functions update_fwd_ports() and remove_unused_fwd_ports()
are merged in the new function remove_invalid_ports().
The part for adding new port is moved into setup_attached_port().

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
6 years agoapp/testpmd: check not detaching device twice
Thomas Monjalon [Thu, 25 Oct 2018 15:11:13 +0000 (17:11 +0200)]
app/testpmd: check not detaching device twice

The command "port detach" is removing the EAL rte_device
of the ethdev port specified as parameter.
The function name and some comments are updated to make clear
that we are detaching the whole device.

After detaching, the pointer, which maps a port to its device,
is reset. This way, it is possible to check whether a port
is still associated to a (not removed) device.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
6 years agonet/ixgbe: update Tx offload mask
Zhirun Yan [Thu, 25 Oct 2018 14:58:40 +0000 (14:58 +0000)]
net/ixgbe: update Tx offload mask

Tx offload mask is updated in following commit: commit 1037ed842c37
("mbuf: fix Tx offload mask"). Currently, the new added offload
flags are not supported in PMD and application will fail to call
PMD transmit prepare function.

This patch updates IXGBE_TX_OFFFLOAD_MASK.

Fixes: 1037ed842c37 ("mbuf: fix Tx offload mask")
Cc: stable@dpdk.org
Signed-off-by: Zhirun Yan <zhirun.yan@intel.com>
Reviewed-by: Xiaolong Ye <xiaolong.ye@intel.com>
6 years agonet/ixgbe: prevent ic session leak on failure
Vipin Varghese [Fri, 12 Oct 2018 09:53:46 +0000 (15:23 +0530)]
net/ixgbe: prevent ic session leak on failure

For function ixgbe_crypto_create_session, fetches ic_session from the
mempool. But on failure scenarios, the object is not released back to
mempool. Using rte_mempool_put the ic_session is put back to mempool.

Signed-off-by: Vipin Varghese <vipin.varghese@intel.com>
Acked-by: Radu Nicolau <radu.nicolau@intel.com>
6 years agoethdev: fix iterator default behaviour for representors
Thomas Monjalon [Wed, 24 Oct 2018 13:13:21 +0000 (15:13 +0200)]
ethdev: fix iterator default behaviour for representors

The iterator was matching all representors if it was not specified
in the devargs string. It was a wrong default behaviour.

If there is no representor parameter in the devargs, the iterator
should not match any representor port.

The implementation of the default behaviour would be simpler
if a "no match" handler is added to rte_kvargs_process().
As it requires an API breakage, it will be reworked later.

Fixes: a7d3c6271d55 ("ethdev: support representor id as iterator filter")

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
6 years agoethdev: filter destroy event before probed
Thomas Monjalon [Wed, 24 Oct 2018 13:12:32 +0000 (15:12 +0200)]
ethdev: filter destroy event before probed

If a port is being created and rollbacked because of an error,
the event RTE_ETH_EVENT_DESTROY should not be sent.
It makes no sense to receive a destroy event for a port which
was not yet announced via RTE_ETH_EVENT_NEW.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
6 years agonet: support MPLS in software packet type parser
Olivier Matz [Tue, 23 Oct 2018 07:46:49 +0000 (09:46 +0200)]
net: support MPLS in software packet type parser

Add RTE_PTYPE_L2_ETHER_MPLS packet type support in rte_net_get_ptype().

Signed-off-by: Didier Pallard <didier.pallard@6wind.com>
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
6 years agonet: add MPLS header structure
Olivier Matz [Tue, 23 Oct 2018 07:46:48 +0000 (09:46 +0200)]
net: add MPLS header structure

Add the Mpls header structure in librte_net. It will be used by next
patch that adds the support of Mpls L2 layer in the software packet
type parser.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
6 years agoethdev: fix metadata documentation
Dekel Peled [Wed, 24 Oct 2018 06:22:00 +0000 (09:22 +0300)]
ethdev: fix metadata documentation

Previous patch introduced the Tx metadata feature, with unnecessary
restrictions on data entry.

This fix updates the documentation, removing the data entry
restrictions on metadata item.

Fixes: 839b20be0e9b ("ethdev: support metadata as flow rule criteria")

Acked-by: Ori Kam <orika@mellanox.com>
Signed-off-by: Dekel Peled <dekelp@mellanox.com>
6 years agoapp/testpmd: fix metadata API and Tx insertion
Dekel Peled [Wed, 24 Oct 2018 06:21:59 +0000 (09:21 +0300)]
app/testpmd: fix metadata API and Tx insertion

Previous patch introduces the Tx metadata feature, with unnecessary
restrictions on data entry.
It also used the metadata in txonly fwd engine only.

This fix removes the data entry restrictions on metadata item.
It also implements callback function to add the metadata in every
Tx packet, sent by any fwd engine.

Fixes: c18feafa193c ("app/testpmd: support metadata as flow rule item")

Signed-off-by: Dekel Peled <dekelp@mellanox.com>
Acked-by: Ori Kam <orika@mellanox.com>
6 years agoraw/ifpga: check probing error
Rosen Xu [Tue, 23 Oct 2018 01:50:49 +0000 (09:50 +0800)]
raw/ifpga: check probing error

Fixes not checking rte_eal_hotplug_add() return value issue.

Coverity issue: 323508
Fixes: ef1e8ede3da5 ("raw/ifpga: add Intel FPGA bus rawdev driver")
Cc: stable@dpdk.org
Signed-off-by: Rosen Xu <rosen.xu@intel.com>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
6 years agonet/mlx5: close all ports on remove
Ophir Munk [Tue, 23 Oct 2018 18:26:05 +0000 (18:26 +0000)]
net/mlx5: close all ports on remove

With the introduction of representors several eth devices are using
the same rte device (e.g. a PCI bus). When calling port detach on one
eth device it is required that all eth devices belonging to the
same rte device have been closed in advance, then the rte device
itself can be removed/detached.
This commit implements this requirement implicitly by adding a
remove callback to struct rte_pci_driver.
The new behavior can be demonstrated in testpmd.
First we attach a representor 0 using PCI address 0000:08:00.0
testpmd> port attach  0000:08:00.0,representor=[0]
Attaching a new port...
EAL: PCI device 0000:08:00.0 on NUMA socket 0
EAL:   probe driver: 15b3:1013 net_mlx5
Port 0 is attached.
Done
Port 1 is attached.
Done

Port 0 is the master device (PF) - an ethdev of the PCI address.
Port 1 is representor 0 - another ethdev (representing a VF) using the
same PCI address. Next we detach port 1
testpmd> port detach 1
Removing a device...
Port 0 is closed
Port 1 is closed
Now total ports is 0
Done

Since port 0 has been implicitly closed we cannot act on it anymore.
testpmd> port stop 0
Invalid port 0

Signed-off-by: Ophir Munk <ophirmu@mellanox.com>
Acked-by: Shahaf Shuler <shahafs@mellanox.com>
6 years agonet/mlx5: release port on close
Ophir Munk [Tue, 23 Oct 2018 18:26:04 +0000 (18:26 +0000)]
net/mlx5: release port on close

With the introduction of representors several eth devices are using
the same rte device (e.g. a PCI bus). It is therefore required to
release the eth device resources during an eth device close operation
rather than during an rte device removal (detach) operation.
In current version many PMDs are still releasing the eth device as
part of the rte device removal. In order to allow a smooth transition
for all PMDs to behave correctly an ethdev flag RTE_ETH_DEV_CLOSE_REMOVE
is used. When this flag is set it indicates to rte_eth_dev_close() to
call rte_eth_dev_release_port(), so the port is freed during the close
operation.

Signed-off-by: Ophir Munk <ophirmu@mellanox.com>
Acked-by: Shahaf Shuler <shahafs@mellanox.com>
6 years agonet/mlx5: allow multiple probing for representor
Ophir Munk [Tue, 23 Oct 2018 18:26:03 +0000 (18:26 +0000)]
net/mlx5: allow multiple probing for representor

Implement probing of a rte device multiple times, see [1].
Set PCI driver RTE_PCI_DRV_PROBE_AGAIN flag to enable multiple probing
of the PCI device by the PCI common driver.
Consecutive probing requests with a devargs string may contain
repetitive master and representors devices for which eth device should
be created only once. In case an eth device already exists - silently
ignore it.

[1]
commit e9d159c3d534 ("eal: allow probing a device again")

Signed-off-by: Ophir Munk <ophirmu@mellanox.com>
Acked-by: Shahaf Shuler <shahafs@mellanox.com>
6 years agonet/mlx5: fix bit width of item and action flags
Yongseok Koh [Wed, 24 Oct 2018 12:36:15 +0000 (15:36 +0300)]
net/mlx5: fix bit width of item and action flags

Most of the code uses uint64_t for MLX5_FLOW_LAYER_* and
MLX5_FLOW_ACTION_*, but there're some code using uint32_t.

Fixes: 2ed2fe5f0a9c ("net/mlx5: rewrite IP address UDP/TCP port by E-Switch")
Fixes: 57123c00c1b8 ("net/mlx5: add Linux TC flower driver for E-Switch flow")
Fixes: fc2c498ccb94 ("net/mlx5: add Direct Verbs translate items")
Fixes: 3d69434113d1 ("net/mlx5: add Direct Verbs validation function")
Fixes: 84c406e74524 ("net/mlx5: add flow translate function")
Fixes: 23c1d42c7138 ("net/mlx5: split flow validation to dedicated function")

Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
Acked-by: Shahaf Shuler <shahafs@mellanox.com>