dpdk.git
6 years agocrypto/mrvl: add missing library dependencies
Tomasz Duszynski [Wed, 21 Mar 2018 09:44:38 +0000 (10:44 +0100)]
crypto/mrvl: add missing library dependencies

While trying to do a shared build one will get linkage error
since a couple of library dependencies are missing from a makefile.

At some point there was a batch update of all PMDs but mrvl crypto was
missed back then.

Necessary makefile changes were introduced in
commit cbc12b0a96f5 ("mk: do not generate LDLIBS from directory dependencies")

Signed-off-by: Tomasz Duszynski <tdu@semihalf.com>
6 years agotest/crypto: add MRVL to hash test cases
Tomasz Duszynski [Wed, 14 Mar 2018 13:12:54 +0000 (14:12 +0100)]
test/crypto: add MRVL to hash test cases

MRVL Crypto PMD supports most of the hash algorithms covered
by test suites thus specific bits should be set in pmd_masks.

Otherwise blockcipher authonly test returns success even though no
real tests have been executed.

Fixes: 84e0ded38ac5 ("test/crypto: add mrvl crypto unit tests")
Cc: stable@dpdk.org
Signed-off-by: Tomasz Duszynski <tdu@semihalf.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
6 years agocryptodev: change argument of driver registration
Fiona Trahe [Fri, 9 Mar 2018 17:44:38 +0000 (17:44 +0000)]
cryptodev: change argument of driver registration

Pass an rte_driver to the RTE_PMD_REGISTER_CRYPTO_DRIVER macro
rather than an unspecified container which holds an rte_driver.
All the macro actually needs is the rte_driver, not the
container holding it.
This paves the way for a later patch in which a driver
will be registered which does not naturally derive from a
container and so avoids having to create an arbitrary container
to pass in the rte_driver.

This patch changes the cryptodev lib macro and all the
PMDs which use it.

Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
Reviewed-by: Akhil Goyal <akhil.goyal@nxp.com>
6 years agocrypto/mrvl: convert license headers to SPDX tags
Tomasz Duszynski [Mon, 12 Mar 2018 07:47:19 +0000 (08:47 +0100)]
crypto/mrvl: convert license headers to SPDX tags

Signed-off-by: Tomasz Duszynski <tdu@semihalf.com>
6 years agovhost: deprecate unsafe GPA translation API
Maxime Coquelin [Wed, 14 Mar 2018 16:31:25 +0000 (17:31 +0100)]
vhost: deprecate unsafe GPA translation API

This patch marks rte_vhost_gpa_to_vva() as deprecated because
it is unsafe. Application relying on this API should move
to the new rte_vhost_va_from_guest_pa() API, and check
returned length to avoid out-of-bound accesses.

This issue has been assigned CVE-2018-1059.

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
6 years agovhost/crypto: move to safe GPA translation API
Maxime Coquelin [Thu, 19 Apr 2018 08:52:33 +0000 (10:52 +0200)]
vhost/crypto: move to safe GPA translation API

This patch uses the new rte_vhost_va_from_guest_pa() API
to ensure all the descriptor buffer is mapped contiguously
in the application virtual address space.

It does not handle buffers discontiguous in host virtual
address space, but only return an error.

This issue has been assigned CVE-2018-1059.

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
6 years agoexamples/vhost_scsi: move to safe GPA translation API
Maxime Coquelin [Wed, 14 Mar 2018 15:46:46 +0000 (16:46 +0100)]
examples/vhost_scsi: move to safe GPA translation API

This patch uses the new rte_vhost_va_from_guest_pa() API
to ensure all the descriptor buffer is mapped contiguously
in the application virtual address space.

As the application did not checked return of previous API,
this patch just print an error if the buffer address isn't in
the vhost memory regions or if it is scattered. Ideally, it
should handle scattered buffers gracefully.

This issue has been assigned CVE-2018-1059.

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
6 years agoexamples/vhost: move to safe GPA translation API
Maxime Coquelin [Tue, 13 Mar 2018 18:43:48 +0000 (19:43 +0100)]
examples/vhost: move to safe GPA translation API

This patch uses the new rte_vhost_va_from_guest_pa() API
to ensure the application doesn't perform out-of-bound
accesses either because of a malicious guest providing an
incorrect descriptor length, or because the buffer is
contiguous in guest physical address space but not in the
host process virtual address space.

This issue has been assigned CVE-2018-1059.

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
6 years agovhost: handle virtually non-contiguous buffers in Rx-mrg
Maxime Coquelin [Thu, 1 Mar 2018 08:36:33 +0000 (09:36 +0100)]
vhost: handle virtually non-contiguous buffers in Rx-mrg

This patch enables the handling of buffers non-contiguous in
process virtual address space in the enqueue path when mergeable
buffers are used.

When virtio-net header doesn't fit in a single chunck, it is
computed in a local variable and copied to the buffer chuncks
afterwards.

For packet content, the copy length is limited to the chunck
size, next chuncks VAs being fetched afterward.

This issue has been assigned CVE-2018-1059.

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
6 years agovhost: handle virtually non-contiguous buffers in Rx
Maxime Coquelin [Thu, 1 Mar 2018 07:47:58 +0000 (08:47 +0100)]
vhost: handle virtually non-contiguous buffers in Rx

This patch enables the handling of buffers non-contiguous in
process virtual address space in the enqueue path when mergeable
buffers aren't used.

When virtio-net header doesn't fit in a single chunck, it is
computed in a local variable and copied to the buffer chuncks
afterwards.

For packet content, the copy length is limited to the chunck
size, next chuncks VAs being fetched afterward.

This issue has been assigned CVE-2018-1059.

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
6 years agovhost: handle virtually non-contiguous buffers in Tx
Maxime Coquelin [Wed, 24 Jan 2018 16:19:29 +0000 (17:19 +0100)]
vhost: handle virtually non-contiguous buffers in Tx

This patch enables the handling of buffers non-contiguous in
process virtual address space in the dequeue path.

When virtio-net header doesn't fit in a single chunck, it is
copied into a local variablei before being processed.

For packet content, the copy length is limited to the chunck
size, next chuncks VAs being fetched afterward.

This issue has been assigned CVE-2018-1059.

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
6 years agovhost: add support for non-contiguous indirect descs tables
Maxime Coquelin [Wed, 24 Jan 2018 10:27:25 +0000 (11:27 +0100)]
vhost: add support for non-contiguous indirect descs tables

This patch adds support for non-contiguous indirect descriptor
tables in VA space.

When it happens, which is unlikely, a table is allocated and the
non-contiguous content is copied into it.

This issue has been assigned CVE-2018-1059.

Reported-by: Yongji Xie <xieyongji@baidu.com>
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
6 years agovhost: ensure all range is mapped when translating QVAs
Maxime Coquelin [Tue, 23 Jan 2018 18:01:45 +0000 (19:01 +0100)]
vhost: ensure all range is mapped when translating QVAs

This patch ensures that all the address range is mapped when
translating addresses from master's addresses (e.g. QEMU host
addressess) to process VAs.

This issue has been assigned CVE-2018-1059.

Reported-by: Yongji Xie <xieyongji@baidu.com>
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
6 years agovhost: introduce safe API for GPA translation
Maxime Coquelin [Tue, 23 Jan 2018 13:37:50 +0000 (14:37 +0100)]
vhost: introduce safe API for GPA translation

This new rte_vhost_va_from_guest_pa API takes an extra len
parameter, used to specify the size of the range to be mapped.
Effective mapped range is returned via len parameter.

This issue has been assigned CVE-2018-1059.

Reported-by: Yongji Xie <xieyongji@baidu.com>
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
6 years agovhost: check all range is mapped when translating GPAs
Maxime Coquelin [Tue, 23 Jan 2018 13:26:02 +0000 (14:26 +0100)]
vhost: check all range is mapped when translating GPAs

There is currently no check done on the length when translating
guest addresses into host virtual addresses. Also, there is no
guanrantee that the guest addresses range is contiguous in
the host virtual address space.

This patch prepares vhost_iova_to_vva() and its callers to
return and check the mapped size. If the mapped size is smaller
than the requested size, the caller handle it as an error.

This issue has been assigned CVE-2018-1059.

Reported-by: Yongji Xie <xieyongji@baidu.com>
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
6 years agovhost: fix indirect descriptors table translation size
Maxime Coquelin [Tue, 23 Jan 2018 08:51:29 +0000 (09:51 +0100)]
vhost: fix indirect descriptors table translation size

This patch fixes the size passed at the indirect descriptor
table translation time, which is the len field of the descriptor,
and not a single descriptor.

This issue has been assigned CVE-2018-1059.

Fixes: 62fdb8255ae7 ("vhost: use the guest IOVA to host VA helper")

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
6 years agoeal/linux: use strlcpy in uevent parsing
Thomas Monjalon [Tue, 17 Apr 2018 12:23:29 +0000 (14:23 +0200)]
eal/linux: use strlcpy in uevent parsing

Support of strlcpy has recently been added to DPDK.

This replacement has been generated by the coccinelle script:
devtools/cocci.sh devtools/cocci/strlcpy.cocci

Fixes: 0d0f478d0483 ("eal/linux: add uevent parse and process")

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
6 years agombuf: improve tunnel Tx offloads API doc
Thomas Monjalon [Thu, 19 Apr 2018 23:53:10 +0000 (01:53 +0200)]
mbuf: improve tunnel Tx offloads API doc

Add few details to remind TSO flag, checksum flags and header lengths.

The doxygen syntax for MPLS-in-UDP is fixed.

Fixes: d95188551fa1 ("mbuf: introduce new Tx offload flag for MPLS-in-UDP")
Cc: stable@dpdk.org
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
6 years agombuf: fix Tx checksum offload API doc
Thomas Monjalon [Thu, 19 Apr 2018 23:39:52 +0000 (01:39 +0200)]
mbuf: fix Tx checksum offload API doc

When introducing rte_eth_tx_prepare(), the constraints on checksum
pre-filling for Tx offloads were relaxed because implemented in
the PMDs with rte_net_intel_cksum_flags_prepare() helper.
As a consequence, these old requirements are removed for:
- PKT_TX_OUTER_IP_CKSUM
- PKT_TX_IP_CKSUM
- PKT_TX_[L4]_CKSUM
- PKT_TX_TCP_SEG

Not sure SCTP offload is properly implemented though.

A reference to rte_eth_tx_prepare() is added in rte_eth_tx_burst() doc.

Fixes: 609dd68ef14f ("mbuf: enhance the API documentation of offload flags")
Fixes: 4fb7e803eb1a ("ethdev: add Tx preparation")
Cc: stable@dpdk.org
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
6 years agomaintainers: fix typo and ordering
Thomas Monjalon [Mon, 23 Apr 2018 01:18:35 +0000 (03:18 +0200)]
maintainers: fix typo and ordering

Fix logical/alphabetical ordering, spacing, and syntax typo.

Fixes: 8fb3b2576025 ("maintainers: call out subtree committers")

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
6 years agocrypto/mrvl: add to meson build
Tomasz Duszynski [Thu, 19 Apr 2018 12:21:14 +0000 (14:21 +0200)]
crypto/mrvl: add to meson build

Add MRVL CRYPTO PMD to meson build system.

Signed-off-by: Tomasz Duszynski <tdu@semihalf.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
6 years agonet/mvpp2: add to meson build
Tomasz Duszynski [Wed, 11 Apr 2018 11:45:07 +0000 (13:45 +0200)]
net/mvpp2: add to meson build

Add support for building MRVL MVPP2 PMD with meson.  To avoid cluttering
the build environment and to keep all relevant settings local to a cross
build we get MUSDK library installation path from a meson option.

Signed-off-by: Tomasz Duszynski <tdu@semihalf.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
6 years agonet/mvpp2: rename version map file to standard
Tomasz Duszynski [Wed, 11 Apr 2018 11:45:06 +0000 (13:45 +0200)]
net/mvpp2: rename version map file to standard

Rename the version file to follow standard naming convention.

Signed-off-by: Tomasz Duszynski <tdu@semihalf.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
6 years agobuild: fix default arm64 instruction level
Jerin Jacob [Mon, 9 Apr 2018 14:39:46 +0000 (20:09 +0530)]
build: fix default arm64 instruction level

The make based build system has crc+crypto instruction
support for the default arm64 build.
http://dpdk.org/browse/dpdk/tree/mk/machine/armv8a/rte.vars.mk#n31

This patch fixes the disparity with meson build flags for armv8.
As a bonus, This patch fixes the following errors with
ip_pipeline example application.

Assembler messages:
Error: selected processor does not support `crc32cx w3,w3,x0'

Fixes: c6e536e38437 ("build: add more implementers IDs and PNs for ARM")

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Tested-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
6 years agorawdev: add to meson build
Bruce Richardson [Wed, 4 Apr 2018 10:12:13 +0000 (11:12 +0100)]
rawdev: add to meson build

Add librte_rawdev to the meson build of DPDK.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Tested-by: Shreyansh Jain <shreyansh.jain@nxp.com>
6 years agodrivers/dpaa: reduce meson dependency lists
Bruce Richardson [Thu, 29 Mar 2018 13:54:36 +0000 (14:54 +0100)]
drivers/dpaa: reduce meson dependency lists

Meson build currently tracks the dependencies between libraries, which
can often make things easier, but has the side-effect of slowing down
the initial meson run if too many duplicated dependencies are provided.
Therefore, we remove dependencies from the dpaa items where other
dependencies already depend on those. This provides a noticable speed-up
in meson configuration runs when lots of sample apps are included in the
build.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Tested-by: Harry van Haaren <harry.van.haaren@intel.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
6 years agoexamples: improve error report for missing meson deps
Bruce Richardson [Thu, 29 Mar 2018 13:54:35 +0000 (14:54 +0100)]
examples: improve error report for missing meson deps

When a required library is missing on a platform, rather than having
meson report an error about the missing variable, catch the problem
earlier and provide a more readable message.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Tested-by: Harry van Haaren <harry.van.haaren@intel.com>
6 years agoexamples: allow building all as part of meson build
Bruce Richardson [Thu, 29 Mar 2018 13:54:34 +0000 (14:54 +0100)]
examples: allow building all as part of meson build

To test building all relevant example applications as part of a build, we
add support for the "all" keyword to be passed to the "examples" build
option. Since not all examples can actually be built on all systems,
we also add support for the "build" option inside the sub-dirs. However,
in case where "all" is not used, and a particular example is requested
to be built, we will error out if building the requested app is not
possible.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Tested-by: Harry van Haaren <harry.van.haaren@intel.com>
6 years agoexamples: disable unsupported examples on BSD build
Bruce Richardson [Thu, 29 Mar 2018 13:54:33 +0000 (14:54 +0100)]
examples: disable unsupported examples on BSD build

When building with meson, set build to false when building unsupported
example apps on FreeBSD.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Tested-by: Harry van Haaren <harry.van.haaren@intel.com>
6 years agoexamples/l2fwd-cat: make build dependent on pqos lib
Bruce Richardson [Thu, 29 Mar 2018 13:54:32 +0000 (14:54 +0100)]
examples/l2fwd-cat: make build dependent on pqos lib

The l2fwd-cat example uses the pqos library to work, so make the meson
build dependent on the presence of that library

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Tested-by: Harry van Haaren <harry.van.haaren@intel.com>
6 years agoexamples: add empty meson files for unsupported ones
Bruce Richardson [Thu, 29 Mar 2018 13:54:31 +0000 (14:54 +0100)]
examples: add empty meson files for unsupported ones

A number of example apps are not supported by the meson build system yet,
but to allow future testing with "-Dexamples=all" we add in a placeholder
meson.build file indicating that the apps should not be built.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Tested-by: Harry van Haaren <harry.van.haaren@intel.com>
6 years agobuild: remove checks for non-optional libraries
Bruce Richardson [Thu, 29 Mar 2018 13:48:47 +0000 (14:48 +0100)]
build: remove checks for non-optional libraries

Unless a library cannot be built for a specific platform (generally
BSD), it will always be available. Therefore remove checks for IP
fragmentation and ACL libraries, since these are built for all
platforms.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
6 years agobuild: clean up building kernel modules using meson
Bruce Richardson [Wed, 4 Apr 2018 16:04:52 +0000 (17:04 +0100)]
build: clean up building kernel modules using meson

The meson.build files for building the kernel modules directory could
be improved now that it is extracted from the EAL. For example, no
global processing is necessary inside the kernel folder, just need to
subdir to the appropriate bsd or linux folder to do the actual work.

To avoid potential race conditions with the BSD module builds when
the kernel build system is creating the dev_if.h and other files,
we serialize the kernel module builds (all 2 of them!) by setting
up each module to depend on all the previous.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Tested-by: Hemant Agrawal <hemant.agrawal@nxp.com>
6 years agobuild: set toolchain info during meson configure
Pavan Nikhilesh [Tue, 3 Apr 2018 11:24:52 +0000 (16:54 +0530)]
build: set toolchain info during meson configure

Meson reports the toolchain using cc.get_id and we can set RTE_TOOLCHAIN,
RTE_TOOLCHAIN_X in dpdk_conf so that it can be used by both x86 and arm.

Suggested-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
6 years agodoc: fix typos in OcteonTx guides
Pavan Nikhilesh [Fri, 20 Apr 2018 09:34:10 +0000 (15:04 +0530)]
doc: fix typos in OcteonTx guides

Fixes: 26cb0a72412f ("doc: add octeontx platform guide")
Fixes: 48191dde6acf ("doc: add octeontx mempool guide")
Cc: stable@dpdk.org
Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
Acked-by: Marko Kovacevic <marko.kovacevic@intel.com>
6 years agodoc: fix a typo in rawdev guide
Jerin Jacob [Sun, 8 Apr 2018 02:23:38 +0000 (07:53 +0530)]
doc: fix a typo in rawdev guide

Fixes: a9bb0c44c775 ("doc: add rawdev library guide and doxygen page")
Cc: stable@dpdk.org
Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Marko Kovacevic <marko.kovacevic@intel.com>
6 years agodoc: fix a typo in the EAL guide
Rami Rosen [Sun, 22 Apr 2018 03:03:37 +0000 (23:03 -0400)]
doc: fix a typo in the EAL guide

This patch fixes a trivial typo in the programmer's guide.

Fixes: 1733be6d3147 ("doc: new eal multi-pthread feature")
Cc: stable@dpdk.org
Signed-off-by: Rami Rosen <rami.rosen@intel.com>
6 years agoapp/pdump: check for ports
Vipin Varghese [Mon, 26 Feb 2018 06:22:38 +0000 (11:52 +0530)]
app/pdump: check for ports

In case of application build with shared library mode unless
option '-d' is passed, poll mode driver for devices is not
initialized. Notifying the user just after rte_eal_init is
pro active way of intimating the user.

Signed-off-by: Vipin Varghese <vipin.varghese@intel.com>
Acked-by: Reshma Pattan <reshma.pattan@intel.com>
6 years agoapp/testpmd: print Rx/Tx offload values on start
Ferruh Yigit [Mon, 12 Mar 2018 17:53:08 +0000 (17:53 +0000)]
app/testpmd: print Rx/Tx offload values on start

Which per port offloads are enabled is not clear. Printing offloads
values at forwarding start.

CRC strip offload value was printed in more verbose manner, it is
removed since Rx/Tx offload values covers it and printing only CRC one
can cause confusion.

Hexadecimal offloads values are not very user friendly but preferred to
not create to much noise during forwarding start.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Yongseok Koh <yskoh@mellanox.com>
6 years agoigb_uio: fix build on Linux < 3.16
Scott Branden [Tue, 17 Apr 2018 17:52:25 +0000 (10:52 -0700)]
igb_uio: fix build on Linux < 3.16

Starting from Linux v3.16 pci_is_bridge() is in linux/pci.h,
 in previous versions it is in drivers/pci/pci.h which is private header.

Fix build error when calling pci_is_bridge by not calling/supporting
pci_is_bridge with kernel versions before 3.16.

Fixes: 6f0841b7701b ("igb_uio: bind error if PCIe bridge")

Reported-by: Ferruh Yigit <ferruh.yigit@intel.com>
Signed-off-by: Scott Branden <scott.branden@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
6 years agonet/mvpp2: fix build
Thomas Monjalon [Thu, 19 Apr 2018 16:02:31 +0000 (18:02 +0200)]
net/mvpp2: fix build

The iterator RTE_ETH_FOREACH_DEV (added in below commit)
requires to enable experimental APIs.

Fixing also the config option rename in the build test.

Fixes: 8728ccf37615 ("fix ethdev ports enumeration")
Fixes: fe93968722af ("net/mrvl: rename PMD as mvpp2")

Reported-by: Ferruh Yigit <ferruh.yigit@intel.com>
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Tested-by: Ferruh Yigit <ferruh.yigit@intel.com>
6 years agobus/fslmc: fix build with clang 3.4
Hemant Agrawal [Thu, 19 Apr 2018 12:32:39 +0000 (18:02 +0530)]
bus/fslmc: fix build with clang 3.4

error: redefinition of typedef 'dma_addr_t' is a C11 feature
[-Werror,-Wtypedef-redefinition]

Fixes: 4bc5ab88dbd6 ("net/dpaa2: fix Tx only mode")
Cc: stable@dpdk.org
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Tested-by: Maxime Coquelin <maxime.coquelin@redhat.com>
6 years agoeventdev: fix build with icc
Pablo de Lara [Tue, 17 Apr 2018 13:13:42 +0000 (14:13 +0100)]
eventdev: fix build with icc

ICC complains about variable being used before its value is set.
Since the variable is only assigned in the for loop,
its declaration is moved inside and is initialized.

lib/librte_eventdev/rte_event_timer_adapter.c(708): error #592:
variable "ret" is used before its value is set
        RTE_SET_USED(ret);

Fixes: 6750b21bd6af ("eventdev: add default software timer adapter")

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Erik Gabriel Carrillo <erik.g.carrillo@intel.com>
6 years agoapp/testpmd: fix build without i40e
Wisam Jaddo [Wed, 18 Apr 2018 15:31:03 +0000 (18:31 +0300)]
app/testpmd: fix build without i40e

Unused variables will appear when setting RTE_LIBRTE_I40E_PMD
to be disabled.

The fix was to move these variables to the I40E_PMD scope,
since only I40E_PMD is using it.

Fixes: a9dbe1802226 ("fix ethdev port id validation")

Signed-off-by: Wisam Jaddo <wisamm@mellanox.com>
6 years agomem: fix leaks of hugedir and replace snprintf
Yangchao Zhou [Wed, 18 Apr 2018 03:09:13 +0000 (11:09 +0800)]
mem: fix leaks of hugedir and replace snprintf

The hugedir returned by get_hugepage_dir is allocated by strdup
 but not released. Replace snprintf with a more suitable strlcpy.

Coverity issue: 272585
Fixes: cb97d93e9d3b ("mem: share hugepage info primary and secondary")

Signed-off-by: Yangchao Zhou <zhouyates@gmail.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
6 years agoeal/x86: force inlining of memcpy sub-functions
Junjie Chen [Thu, 12 Apr 2018 05:16:36 +0000 (13:16 +0800)]
eal/x86: force inlining of memcpy sub-functions

Sometimes gcc does not inline the function despite keyword *inline*,
we observe rte_movX is not inline when doing performance profiling,
so use *always_inline* keyword to force gcc to inline the function.

Signed-off-by: Junjie Chen <junjie.j.chen@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
6 years agopdump: use generic multi-process channel
Jianfeng Tan [Thu, 5 Apr 2018 12:28:37 +0000 (12:28 +0000)]
pdump: use generic multi-process channel

The original code replies on the private channel for primary and
secondary communication. Change to use the generic multi-process
channel.

Note with this change, dpdk-pdump will be not compatible with
old version DPDK applications.

Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
Acked-by: Reshma Pattan <reshma.pattan@intel.com>
6 years agovfio: use generic multi-process channel
Jianfeng Tan [Sun, 15 Apr 2018 15:06:19 +0000 (15:06 +0000)]
vfio: use generic multi-process channel

Previously, vfio uses its own private channel for the secondary
process to get container fd and group fd from the primary process.

This patch changes to use the generic mp channel.

Test:
  1. Bind two NICs to vfio-pci.

  2. Start the primary and secondary process.
    $ (symmetric_mp) -c 2 -- -p 3 --num-procs=2 --proc-id=0
    $ (symmetric_mp) -c 4 --proc-type=auto -- -p 3 \
--num-procs=2 --proc-id=1

Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
6 years agoethdev: deprecate port count function
Thomas Monjalon [Thu, 5 Apr 2018 15:33:22 +0000 (17:33 +0200)]
ethdev: deprecate port count function

Some DPDK applications wrongly assume these requirements:
    - no hotplug, i.e. ports are never detached
    - all allocated ports are available to the application

Such application iterates over ports by its own mean.
The most common pattern is to request the port count and
assume ports with index in the range [0..count[ can be used.

In order to fix this common mistake in all external applications,
the function rte_eth_dev_count is deprecated, while introducing
the new functions rte_eth_dev_count_avail and rte_eth_dev_count_total.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
6 years agofix ethdev port id validation
Thomas Monjalon [Thu, 5 Apr 2018 15:33:21 +0000 (17:33 +0200)]
fix ethdev port id validation

Some DPDK applications wrongly assume these requirements:
    - no hotplug, i.e. ports are never detached
    - all allocated ports are available to the application

Such application assume a valid port index is in the range [0..count[.

There are three consequences when using such wrong design:
    - new ports having an index higher than the port count won't be valid
    - old ports being detached (RTE_ETH_DEV_UNUSED) can be valid

Such mistake will be less common with growing hotplug awareness.
All applications and examples inside this repository - except testpmd -
must be fixed to use the function rte_eth_dev_is_valid_port.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
6 years agofix ethdev ports enumeration
Thomas Monjalon [Thu, 5 Apr 2018 15:33:20 +0000 (17:33 +0200)]
fix ethdev ports enumeration

Some DPDK applications wrongly assume these requirements:
    - no hotplug, i.e. ports are never detached
    - all allocated ports are available to the application

Such application iterates over ports by its own mean.
The most common pattern is to request the port count and
assume ports with index in the range [0..count[ can be used.

There are three consequences when using such wrong design:
    - new ports having an index higher than the port count won't be seen
    - old ports being detached (RTE_ETH_DEV_UNUSED) can be seen as ghosts
    - failsafe sub-devices (RTE_ETH_DEV_DEFERRED) will be seen by the application

Such mistake will be less common with growing hotplug awareness.
All applications and examples inside this repository - except testpmd -
must be fixed to use the iterator RTE_ETH_FOREACH_DEV.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
6 years agoring: relax alignment constraint on ring structure
Olivier Matz [Tue, 3 Apr 2018 13:26:44 +0000 (15:26 +0200)]
ring: relax alignment constraint on ring structure

The initial objective of
commit d9f0d3a1ffd4 ("ring: remove split cacheline build setting")
was to add an empty cache line between the producer and consumer
data (on platform with cache line size = 64B), preventing from
having them on adjacent cache lines.

Following discussion on the mailing list, it appears that this
also imposes an alignment constraint that is not required.

This patch removes the extra alignment constraint and adds the
empty cache lines using padding fields in the structure. The
size of rte_ring structure and the offset of the fields remain
the same on platforms with cache line size = 64B:

  rte_ring = 384
  rte_ring.name = 0
  rte_ring.flags = 32
  rte_ring.memzone = 40
  rte_ring.size = 48
  rte_ring.mask = 52
  rte_ring.prod = 128
  rte_ring.cons = 256

But it has an impact on platform where cache line size is 128B:

  rte_ring = 384        -> 768
  rte_ring.name = 0
  rte_ring.flags = 32
  rte_ring.memzone = 40
  rte_ring.size = 48
  rte_ring.mask = 52
  rte_ring.prod = 128   -> 256
  rte_ring.cons = 256   -> 512

Suggested-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
6 years agoeal: fix signed integers in fbarray
Adrien Mazarguil [Fri, 13 Apr 2018 18:43:01 +0000 (20:43 +0200)]
eal: fix signed integers in fbarray

While debugging startup issues encountered with Clang (see "eal: fix
undefined behavior in fbarray"), I noticed that fbarray stores indices,
sizes and masks on signed integers involved in bitwise operations.

Such operations almost invariably cause undefined behavior with values that
cannot be represented by the result type, as is often the case with
bit-masks and left-shifts.

This patch replaces them with unsigned integers as a safety measure and
promotes a few internal variables to larger types for consistency.

Coverity issue: 272598, 272599
Fixes: c44d09811b40 ("eal: add shared indexed file-backed array")

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
6 years agoeal: fix undefined behavior in fbarray
Adrien Mazarguil [Fri, 13 Apr 2018 18:42:58 +0000 (20:42 +0200)]
eal: fix undefined behavior in fbarray

According to GCC documentation [1], the __builtin_clz() family of functions
yield undefined behavior when fed a zero value. There is one instance in
the fbarray code where this can occur.

Clang (at least version 3.8.0-2ubuntu4) seems much more sensitive to this
than GCC and yields random results when compiling optimized code, as shown
below:

 #include <stdio.h>

 int main(void)
 {
         volatile unsigned long long moo;
         int x;

         moo = 0;
         x = __builtin_clzll(moo);
         printf("%d\n", x);
         return 0;
 }

 $ gcc -O3 -o test test.c && ./test
 63
 $ clang -O3 -o test test.c && ./test
 1742715559
 $ clang -O0 -o test test.c && ./test
 63

Even 63 can be considered an unexpected result given the number of leading
zeroes should be the full width of the underlying type, i.e. 64.

In practice it causes find_next_n() to sometimes return negative values
interpreted as errors by caller functions, which prevents DPDK applications
from starting due to inability to find free memory segments:

 # testpmd [...]
 EAL: Detected 32 lcore(s)
 EAL: Detected 2 NUMA nodes
 EAL: No free hugepages reported in hugepages-1048576kB
 EAL: Multi-process socket /var/run/.rte_unix
 EAL: eal_memalloc_alloc_seg_bulk(): couldn't find suitable memseg_list
 EAL: FATAL: Cannot init memory

 EAL: Cannot init memory

 PANIC in main():
 Cannot init EAL
 4: [./build/app/testpmd(_start+0x29) [0x462289]]
 3: [/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0)
     [0x7f19d54fc830]]
 2: [./build/app/testpmd(main+0x8a3) [0x466193]]
 1: [./build/app/testpmd(__rte_panic+0xd6) [0x4efaa6]]
 Aborted

This problem appears with commit 66cc45e293ed ("mem: replace memseg with
memseg lists") however the root cause is introduced by a prior patch.

[1] https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html

Fixes: c44d09811b40 ("eal: add shared indexed file-backed array")

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
6 years agovhost/crypto: fix build without cryptodev
Fan Zhang [Mon, 16 Apr 2018 14:08:58 +0000 (15:08 +0100)]
vhost/crypto: fix build without cryptodev

Vhost-Crypto shall not be compiled if rte_cryptodev is disabled.
This patch fix this by adding checking to Makefile.

Fixes: d090c7f86a76 ("vhost/crypto: update makefile")

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
6 years agomalloc: fix not unlocking hotplug on fail to init
Anatoly Burakov [Fri, 13 Apr 2018 15:58:39 +0000 (16:58 +0100)]
malloc: fix not unlocking hotplug on fail to init

We lock the hotplug during init, but do not unlock it if we couldn't
register multiprocess callbacks. Add the missing unlock.

Fixes: 07dcbfe0101f ("malloc: support multiprocess memory hotplug")

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
6 years agoipc: fix missing mutex unlocks on failed send
Anatoly Burakov [Fri, 13 Apr 2018 14:16:19 +0000 (15:16 +0100)]
ipc: fix missing mutex unlocks on failed send

Earlier fix for race condition introduced a bug where mutex
wasn't unlocked if message failed to be sent. Fix all of this
by moving locking out of mp_request_sync() altogether.

Fixes: da5957821bdd ("eal: fix race condition in IPC request")
Cc: stable@dpdk.org
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
6 years agoipc: fix missing ignore message name
Anatoly Burakov [Fri, 13 Apr 2018 15:55:44 +0000 (16:55 +0100)]
ipc: fix missing ignore message name

We are trying to notify sender that response from current process
should be ignored, but we didn't specify which request this response
was for. Fix by copying request name from the original message.

Fixes: 579a4ccc345c ("eal: ignore IPC messages until init is complete")

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Jianfeng Tan <jianfeng.tan@intel.com>
6 years agoipc: fix use-after-free in asynchronous requests
Anatoly Burakov [Fri, 13 Apr 2018 11:55:00 +0000 (12:55 +0100)]
ipc: fix use-after-free in asynchronous requests

Previously, we were removing request from the list only if we
have succeeded to send it. This resulted in leaving an invalid
pointer in the request list.

Fix this by only adding new requests to the request list if we
have succeeded in sending them.

Fixes: f05e26051c15 ("eal: add IPC asynchronous request")

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Jianfeng Tan <jianfeng.tan@intel.com>
6 years agoipc: fix use-after-free in synchronous requests
Anatoly Burakov [Fri, 13 Apr 2018 11:54:59 +0000 (12:54 +0100)]
ipc: fix use-after-free in synchronous requests

Previously, we were adding synchronous requests to request list, we
were doing it after checking if request existed. However, we only
removed the request from the request list if we have succeeded in
sending the request. In case of failed request send, we left an
invalid pointer in the request list.

Fix this by only adding request to the list once we succeed in
sending it.

Fixes: 783b6e54971d ("eal: add synchronous multi-process communication")
Cc: stable@dpdk.org
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Jianfeng Tan <jianfeng.tan@intel.com>
6 years agoipc: stop async IPC loop on callback request
Anatoly Burakov [Tue, 10 Apr 2018 15:28:51 +0000 (16:28 +0100)]
ipc: stop async IPC loop on callback request

EAL did not stop processing further asynchronous requests on
encountering a request that should trigger the callback. This
resulted in erasing valid requests but not triggering them.

Fix this by stopping the loop once we have a request that
can trigger the callback. Once triggered, we go back to scanning
the request queue until there are no more callbacks to trigger.

Fixes: f05e26051c15 ("eal: add IPC asynchronous request")

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Jianfeng Tan <jianfeng.tan@intel.com>
6 years agovfio: export functions even when disabled
Anatoly Burakov [Mon, 16 Apr 2018 12:13:56 +0000 (13:13 +0100)]
vfio: export functions even when disabled

Previously, VFIO functions were not compiled in and exported if
VFIO compilation was disabled. Fix this by actually compiling
all of the functions unconditionally, and provide missing
prototypes on Linux.

Fixes: 279b581c897d ("vfio: expose functions")
Fixes: 73a639085938 ("vfio: allow to map other memory regions")
Fixes: 964b2f3bfb07 ("vfio: export some internal functions")

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
6 years agonet/sfc: fix meson build warning with gcc
Ferruh Yigit [Mon, 16 Apr 2018 17:09:29 +0000 (18:09 +0100)]
net/sfc: fix meson build warning with gcc

icc flag is causing build error with gcc, build error:
cc1: warning: unrecognized gcc debugging option: i
cc1: warning: unrecognized gcc debugging option: g
cc1: warning: unrecognized gcc debugging option: -
cc1: warning: unrecognized gcc debugging option: d
cc1: warning: unrecognized gcc debugging option: i
cc1: warning: unrecognized gcc debugging option: s
cc1: warning: unrecognized gcc debugging option: b
cc1: warning: unrecognized gcc debugging option: l
cc1: warning: unrecognized gcc debugging option: e
cc1: warning: unrecognized gcc debugging option:
cc1: warning: unrecognized gcc debugging option: 3
cc1: warning: unrecognized gcc debugging option: 6
cc1: warning: unrecognized gcc debugging option: 5
cc1: warning: unrecognized gcc debugging option: 6
cc1: warning: unrecognized command line option
‘-Wno-address-of-packed-member’

Removing icc flag completely since it is not supported right now.

Fixes: f16d0b36f816 ("drivers/net: fix icc deprecated parameter warning")

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
6 years agonet/ixgbe: fix build when vector driver disabled
Bruce Richardson [Mon, 16 Apr 2018 13:39:11 +0000 (14:39 +0100)]
net/ixgbe: fix build when vector driver disabled

The new functions for Rx and Tx offloads should not be inside the
conditional block for the vector driver, otherwise compile errors occur
when vector driver is disabled. For example:

  ixgbe_ethdev.c:3636:36: error:
implicit declaration of function ‘ixgbe_get_rx_queue_offloads’;

This shows up as an error when doing ARM builds using meson as the vector
driver is not (yet) enabled for those builds.

Fixes: 51215925a32f ("net/ixgbe: convert to new Tx offloads API")
Fixes: ec3b1124d14d ("net/ixgbe: convert to new Rx offloads API")

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
6 years agoapp/eventdev: fix typos in timer adapter options
Pavan Nikhilesh [Mon, 16 Apr 2018 10:46:31 +0000 (16:16 +0530)]
app/eventdev: fix typos in timer adapter options

The options names in code and doc are not the same.

Fixes: 98c6292105d4 ("app/eventdev: add options for event timer adapter")

Suggested-by: Thomas Monjalon <thomas@monjalon.net>
Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
6 years agoapp/eventdev: fix build with gcc 4.8
Pavan Nikhilesh [Mon, 16 Apr 2018 13:13:23 +0000 (18:43 +0530)]
app/eventdev: fix build with gcc 4.8

test_perf_common.c: In function ‘perf_event_timer_producer’:
test_perf_common.c:99:3: error: missing initializer for
 field ‘priority’ of ‘struct <anonymous>’
 [-Werror=missing-field-initializers]
   .ev.sched_type = t->opt->sched_type_list[0],

Fixes: d008f20bce23 ("app/eventdev: add event timer adapter as a producer")

Reported-by: Andrew Rybchenko <arybchenko@solarflare.com>
Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
Tested-by: Andrew Rybchenko <arybchenko@solarflare.com>
6 years agoevent/dpaa: fix integer overflow of max ports
Gowrishankar Muthukrishnan [Fri, 13 Apr 2018 05:06:31 +0000 (10:36 +0530)]
event/dpaa: fix integer overflow of max ports

dev_info->max_event_ports is uint8_t. dpaa_event_dev_info_get assigns
DPAA_EVENT_MAX_EVENT_PORT (which is RTE_MAX_LCORE, upto 256 in ppc64le)
into this variable, which breaks compile in ppc64le.

drivers/event/dpaa/dpaa_eventdev.c: In function ‘dpaa_event_dev_info_get’:
   rte_config.h:23:23: error:
   large integer implicitly truncated to unsigned type [-Werror=overflow]
      #define RTE_MAX_LCORE 256

Fixes: 9caac5dd1e ("event/dpaa: introduce PMD")
Cc: stable@dpdk.org
Signed-off-by: Gowrishankar Muthukrishnan <gowrishankar.m@linux.vnet.ibm.com>
Acked-by: Sunil Kumar Kori <sunil.kori@nxp.com>
6 years agoeventdev: remove stale forward declaration
Rami Rosen [Sat, 14 Apr 2018 00:20:17 +0000 (20:20 -0400)]
eventdev: remove stale forward declaration

This patch removes the decalartion of rte_eventdev_driver from
rte_eventdev.h, as it not used anymore; pci_eventdev_skeleton_pmd
moved to use rte_pci_driver instead of rte_eventdev_driver.

Fixes: 7214438d93e6 ("eventdev: remove PCI dependency from generic structures")
Cc: stable@dpdk.org
Signed-off-by: Rami Rosen <rami.rosen@intel.com>
6 years agoevent/octeontx: add option to use fpavf as chunk pool
Pavan Nikhilesh [Mon, 9 Apr 2018 21:00:34 +0000 (02:30 +0530)]
event/octeontx: add option to use fpavf as chunk pool

Add compile-time configurable option to force TIMvf to use Octeontx
FPAvf pool manager as its chunk pool.
When FPAvf is used as pool manager the TIMvf automatically frees the
chunks to FPAvf through gpool-id.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
6 years agoevent/octeontx: optimize timer adapter resolution parameters
Pavan Nikhilesh [Mon, 9 Apr 2018 21:00:33 +0000 (02:30 +0530)]
event/octeontx: optimize timer adapter resolution parameters

When application sets `RTE_EVENT_TIMER_ADAPTER_F_ADJUST_RES` flag
while creating adapter underlying driver is free to optimize the
resolution for best possible configuration.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
6 years agoevent/octeontx: add burst mode for timer arm
Pavan Nikhilesh [Mon, 9 Apr 2018 21:00:32 +0000 (02:30 +0530)]
event/octeontx: add burst mode for timer arm

Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
6 years agoevent/octeontx: add single producer timer arm variant
Pavan Nikhilesh [Mon, 9 Apr 2018 21:00:31 +0000 (02:30 +0530)]
event/octeontx: add single producer timer arm variant

When application creates the timer adapter by passing
`RTE_EVENT_TIMER_ADAPTER_F_SP_PUT` flag, we can optimize the arm sequence
by removing the locking overhead.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
6 years agoevent/octeontx: add multiproducer timer arm and cancel
Pavan Nikhilesh [Mon, 9 Apr 2018 21:00:30 +0000 (02:30 +0530)]
event/octeontx: add multiproducer timer arm and cancel

Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
6 years agoevent/octeontx: add event timer stats get and reset
Pavan Nikhilesh [Mon, 9 Apr 2018 21:00:29 +0000 (02:30 +0530)]
event/octeontx: add event timer stats get and reset

Add functions to get and reset event timer adapter stats.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
6 years agoevent/octeontx: start and stop timer device
Pavan Nikhilesh [Mon, 9 Apr 2018 21:00:28 +0000 (02:30 +0530)]
event/octeontx: start and stop timer device

When application requests to start the timer adapter through
`rte_event_timer_adapter_start`, Octeontx TIMvf ring does the
following:
- Uses mbox to communicate TIMpf driver about,
  * SCLK frequency used to convert ns<->cycles.
  * program the ring control parameters and start the ring.
  * get the exact cycle at which the TIMvf ring has started which can be
  used to estimate the bucket position.

On `rte_event_timer_adapter_stop` i.e stop, Octeontx TIMvf ring does the
following:
- Use mbox to communicate TIMpf driver about,
  * reset the ring control parameters and stop the ring.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
6 years agoevent/octeontx: create and free timer adapter
Pavan Nikhilesh [Mon, 9 Apr 2018 21:00:27 +0000 (02:30 +0530)]
event/octeontx: create and free timer adapter

When the application requests to create a timer device, Octeontx TIM
create does the following:
- Get the requested TIMvf ring based on adapter_id.
- Verify the config parameters supplied.
- Allocate memory required for
  * Buckets based on min and max timeout supplied.
  * Allocate the chunk pool based on the number of timers.
- Clear the interrupts.

On Free:
- Free the allocated bucket and chunk memory.
- Free private data used by TIMvf.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
6 years agoevent/octeontx: probe timvf PCIe devices
Pavan Nikhilesh [Mon, 9 Apr 2018 21:00:26 +0000 (02:30 +0530)]
event/octeontx: probe timvf PCIe devices

On Octeontx HW, each event timer device is enumerated as separate SRIOV VF
PCIe device.

In order to expose as a event timer device:
On PCIe probe, the driver stores the information associated with the
PCIe device and later when application requests for a event timer device
through `rte_event_timer_adapter_create` the driver infrastructure creates
the timer adapter with earlier probed PCIe VF devices.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
6 years agousertools: add Cavium TIM as an event device
Pavan Nikhilesh [Mon, 9 Apr 2018 21:00:25 +0000 (02:30 +0530)]
usertools: add Cavium TIM as an event device

Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
6 years agoapp/eventdev: add options for event timer adapter
Pavan Nikhilesh [Fri, 6 Apr 2018 15:13:23 +0000 (20:43 +0530)]
app/eventdev: add options for event timer adapter

Add options to configure expiry timeout, max number of timers and number
of event timer adapters through command line parameters.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
Acked-by: Erik Gabriel Carrillo <erik.g.carrillo@intel.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
6 years agoapp/eventdev: add burst mode for event timer adapter
Pavan Nikhilesh [Fri, 6 Apr 2018 15:13:22 +0000 (20:43 +0530)]
app/eventdev: add burst mode for event timer adapter

Add burst mode for event timer adapter that can be selected by passing
--prod_type_timerdev_burst.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
Acked-by: Erik Gabriel Carrillo <erik.g.carrillo@intel.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
6 years agoapp/eventdev: add event timer adapter as a producer
Pavan Nikhilesh [Fri, 6 Apr 2018 15:13:21 +0000 (20:43 +0530)]
app/eventdev: add event timer adapter as a producer

Add event timer adapter as producer option that can be selected by
passing --prod_type_timerdev.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
Acked-by: Erik Gabriel Carrillo <erik.g.carrillo@intel.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
6 years agodoc: add event timer adapter guide
Erik Gabriel Carrillo [Wed, 4 Apr 2018 21:51:13 +0000 (16:51 -0500)]
doc: add event timer adapter guide

Signed-off-by: Erik Gabriel Carrillo <erik.g.carrillo@intel.com>
Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
6 years agotest: add event timer adapter auto-test
Erik Gabriel Carrillo [Wed, 4 Apr 2018 21:51:12 +0000 (16:51 -0500)]
test: add event timer adapter auto-test

Signed-off-by: Erik Gabriel Carrillo <erik.g.carrillo@intel.com>
Acked-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
6 years agoeventdev: add default software timer adapter
Erik Gabriel Carrillo [Wed, 4 Apr 2018 21:51:10 +0000 (16:51 -0500)]
eventdev: add default software timer adapter

If an eventdev PMD does not wish to provide event timer adapter ops
definitions, the library will fall back to a default software
implementation whose entry points are added by this commit.

Signed-off-by: Erik Gabriel Carrillo <erik.g.carrillo@intel.com>
Acked-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
6 years agomk: update timer library order in static build
Erik Gabriel Carrillo [Wed, 4 Apr 2018 21:51:09 +0000 (16:51 -0500)]
mk: update timer library order in static build

The introduction of the event timer adapter library adds a dependency
on the rte_timer library from the rte_eventdev library.  Update the
order so that the timer library comes after the eventdev library in the
linker command when statically linking applications.

Signed-off-by: Erik Gabriel Carrillo <erik.g.carrillo@intel.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
6 years agoeventdev: add timer adapter common code
Erik Gabriel Carrillo [Wed, 4 Apr 2018 21:51:08 +0000 (16:51 -0500)]
eventdev: add timer adapter common code

This commit adds the logic that is shared by all event timer adapter
drivers; the common code handles instance allocation and some
initialization.

Signed-off-by: Erik Gabriel Carrillo <erik.g.carrillo@intel.com>
Acked-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
6 years agoeventdev: convert to SPDX license tag in header
Erik Gabriel Carrillo [Wed, 4 Apr 2018 21:51:07 +0000 (16:51 -0500)]
eventdev: convert to SPDX license tag in header

Signed-off-by: Erik Gabriel Carrillo <erik.g.carrillo@intel.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
6 years agoeventdev: introduce event timer adapter
Erik Gabriel Carrillo [Wed, 4 Apr 2018 21:51:06 +0000 (16:51 -0500)]
eventdev: introduce event timer adapter

Event devices can be coupled with various components to provide
new event sources by using event adapters.  The event timer adapter
is one such adapter; it bridges event devices and timer mechanisms.
This library extends the event-driven programming model by
introducing a new type of event that represents a timer expiration,
and it provides APIs with which adapters can be created or destroyed
and event timers can be armed and canceled.

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
Signed-off-by: Erik Gabriel Carrillo <erik.g.carrillo@intel.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
6 years agoeventdev: fix MP/MC tail updates in event ring
Mattias Rönnblom [Tue, 3 Apr 2018 08:19:03 +0000 (10:19 +0200)]
eventdev: fix MP/MC tail updates in event ring

rte_event_ring enqueue and dequeue tail updates were hardcoded for a
SC/SP configuration.

Fixes: dc39e2f359b5 ("eventdev: add ring structure for events")
Cc: stable@dpdk.org
Signed-off-by: Mattias Rönnblom <hofors@lysator.liu.se>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
6 years agoevent/octeontx: support device stop flush callback
Jerin Jacob [Tue, 20 Mar 2018 11:59:55 +0000 (17:29 +0530)]
event/octeontx: support device stop flush callback

Add support for stop flush callback along with unit test.

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Gage Eads <gage.eads@intel.com>
6 years agoeventdev: add device stop flush callback
Gage Eads [Mon, 2 Apr 2018 18:03:30 +0000 (13:03 -0500)]
eventdev: add device stop flush callback

When an event device is stopped, it drains all event queues and ports.
These events may contain pointers, so to prevent memory leaks eventdev now
supports a user-provided flush callback that is called during the queue
drain process. This callback is stored in process memory, so the callback
must be registered by any process that may call rte_event_dev_stop().

This commit also clarifies the behavior of rte_event_dev_stop().

This follows this mailing list discussion:
http://dpdk.org/ml/archives/dev/2018-January/087484.html

Signed-off-by: Gage Eads <gage.eads@intel.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
6 years agoevent/opdl: fix atomic queue race condition
Liang Ma [Tue, 27 Mar 2018 14:18:12 +0000 (15:18 +0100)]
event/opdl: fix atomic queue race condition

If application link one atomic queue to multiple ports,
and each worker core update flow_id, there will have a
chance to hit race condition issue and lead to double processing
same event. This fix solve the problem and eliminate
the race condition issue.

Fixes: 4236ce9bf5bf ("event/opdl: add OPDL ring infrastructure library")
Cc: stable@dpdk.org
Signed-off-by: Liang Ma <liang.j.ma@intel.com>
Signed-off-by: Peter Mccarthy <peter.mccarthy@intel.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
6 years agoevent/sw: perform partial burst enqueues
Gage Eads [Mon, 12 Mar 2018 14:55:22 +0000 (09:55 -0500)]
event/sw: perform partial burst enqueues

Previously, the sw PMD would enqueue either all or no events, depending on
if enough inflight credits were available for the new events in the burst.
If a port is enqueueing a large burst (i.e. a multiple of the credit update
quanta), this can result in suboptimal performance, and requires an
understanding of the sw PMD implementation (in particular, its credit
scheme) to tune an application's burst size.

This affects software that enqueues large bursts of new events, such as the
ethernet event adapter which uses a 128-deep event buffer, when the input
packet rate is sufficiently high.

This change makes the sw PMD enqueue as many events as it has credits, if
there are any new events in the burst.

Signed-off-by: Gage Eads <gage.eads@intel.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
6 years agoevent/sw: simplify counter assignment
Vipin Varghese [Tue, 27 Feb 2018 21:10:22 +0000 (02:40 +0530)]
event/sw: simplify counter assignment

Counter variable 'out_pkts' had been set to 0, then updated. Current
code change elimates double assignment to direct assignment.

Signed-off-by: Vipin Varghese <vipin.varghese@intel.com>
Acked-by: Kevin Laatz <kevin.laatz@intel.com>
6 years agoevent/sw: move stats code for better cache access
Vipin Varghese [Tue, 27 Feb 2018 20:17:18 +0000 (01:47 +0530)]
event/sw: move stats code for better cache access

variables 'out_pkts_total' and 'out_pkts_total' will be in registers.
Hence shifting the code after the loop, helps the update from registers.

Signed-off-by: Vipin Varghese <vipin.varghese@intel.com>
Acked-by: Kevin Laatz <kevin.laatz@intel.com>
6 years agoevent/sw: add unlikely branch predict
Vipin Varghese [Tue, 27 Feb 2018 20:08:05 +0000 (01:38 +0530)]
event/sw: add unlikely branch predict

For most run cases 'sw->started' holds true. Adding a branch prediction
suggestion to compiler helps as this is first conditional check just
after entering the function.

Signed-off-by: Vipin Varghese <vipin.varghese@intel.com>
Acked-by: Kevin Laatz <kevin.laatz@intel.com>
6 years agoeventdev: add Rx timestamp
Nikhil Rao [Tue, 20 Feb 2018 11:30:54 +0000 (06:30 -0500)]
eventdev: add Rx timestamp

Add timestamp to received packets before enqueuing to
event device if the timestamp is not already set. Adding
timestamp in the Rx adapter avoids additional latency due
to the event device.

Signed-off-by: Nikhil Rao <nikhil.rao@intel.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
6 years agonet/vmxnet3: fill imissed stat
Jon DeVree [Sat, 7 Apr 2018 17:29:52 +0000 (13:29 -0400)]
net/vmxnet3: fill imissed stat

This counter comes from a "hardware" register of the vmxnet3 device and
seems to behave like the MPC (Missed Packet Count) register of the Intel
NICs. So I think this data belongs in the imissed field rather than the
rx_nombuf field.

Signed-off-by: Jon DeVree <nuxi@vault24.org>
Acked-by: Yong Wang <yongwang@vmware.com>
6 years agonet/bnxt: introduce Broadcom Stingray
Scott Branden [Fri, 13 Apr 2018 21:07:54 +0000 (14:07 -0700)]
net/bnxt: introduce Broadcom Stingray

Add support for Stingray PF devices ids:
BCM58802 = 0xd802
BCM58804 = 0xd804
BCM58808 = 0x16f0

Add Broadcom Stingray machine support based on armv8.

For product brief see:
https://www.broadcom.com/products/ethernet-connectivity/controllers/bcm58800

Signed-off-by: Scott Branden <scott.branden@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
6 years agodrivers/net: remove redundant icc flag
Ferruh Yigit [Fri, 13 Apr 2018 22:21:09 +0000 (23:21 +0100)]
drivers/net: remove redundant icc flag

ICC warning #188 already disabled globally via commit [1], no
need individual arguments in PMDs.

[1]
Fixes: 1b80b9c854c3 ("mk: disable icc warning 188")
Cc: stable@dpdk.org
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Tested-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>