Commit Graph

5918 Commits

Author SHA1 Message Date
Asim Jamshed
44415a62e6 fib: fix headers for C++ support
This patch allows C++ programs to use librte_fib library routines.
Previously C++ programs were not able to link this library and programs
would fail to get linked. With this patch compilation and linking
will be successful.

Fixes: 39e9272484 ("fib: add FIB library")
Fixes: 40d41a8a7b ("fib: support IPv6")
Cc: stable@dpdk.org

Signed-off-by: Asim Jamshed <asim.jamshed@gmail.com>
Signed-off-by: Saikrishna Edupuganti <saikrishna.edupuganti@intel.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
Acked-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
2020-04-10 05:00:47 -04:00
Andrzej Ostruszka
10c69730a4 lpm6: make IPv6 address immutable
None of the public functions modify IPv6 address passed.  So their
parameters are made const - with the exception of bulk functions.
This exception is due to compatibility problems - some compilers report
problems with const-casting of array of arrays.

Previously only lookup and add were updated to have addresses passed as
const so I'm adding this fixline.

Fixes: d82927d2f8 ("lpm6: make IPv6 address immutable")
Cc: stable@dpdk.org

Signed-off-by: Andrzej Ostruszka <aostruszka@marvell.com>
Acked-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
2020-03-31 21:45:43 +02:00
Thomas Monjalon
5f60d38b5a eal: clean make and meson files
Clean up indent and line ordering in Makefile and meson.build
for consistency in linux/ and freebsd/ directories.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: David Marchand <david.marchand@redhat.com>
2020-03-31 13:08:55 +02:00
Thomas Monjalon
a083f8cc77 eal: move OS-specific sub-directories
Since the kernel modules are moved to kernel/ directory,
there is no need anymore for the sub-directory eal/ in
linux/, freebsd/ and windows/.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: David Marchand <david.marchand@redhat.com>
2020-03-31 13:08:55 +02:00
Thomas Monjalon
9c1e0dc39a eal: move common header files
The EAL API (with doxygen documentation) is moved from
common/include/ to include/, which makes more clear that
it is the global API for all environments and architectures.

Note that the arch-specific and OS-specific include files are not
in this global include directory, but include/generic/ should
cover the doxygen documentation for them.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: David Marchand <david.marchand@redhat.com>
2020-03-31 13:08:55 +02:00
Thomas Monjalon
df3ff6be2b eal: simplify meson build of common directory
The variable common_sources allows to change the list of common files
from an arch-specific or OS-specific meson file.
For consistency and least surprise principle, this variable is removed.
Now the list of common sources is defined only in common/meson.build.
As a consequence, the temporary list of files which are currently supported
on Windows, is moved from windows/eal/meson.build.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: David Marchand <david.marchand@redhat.com>
2020-03-31 13:08:55 +02:00
Thomas Monjalon
a1b6cda16a eal: move arch-specific header files
The arch-specific directories arm, ppc and x86 in common/include/arch/
are moved as include/ sub-directories of respective arch directories:
	- arm/include/
	- ppc/include/
	- x86/include/

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: David Christensen <drc@linux.vnet.ibm.com>
Acked-by: David Marchand <david.marchand@redhat.com>
2020-03-31 13:08:55 +02:00
Thomas Monjalon
2a1991799e eal: move arch-specific C files
The arch-specific directories arm, ppc and x86 in common/arch/
are moved at the same level as the OS-specific directories.
It makes more clear that EAL is covering a matrix combining OS and arch.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: David Christensen <drc@linux.vnet.ibm.com>
Acked-by: David Marchand <david.marchand@redhat.com>
2020-03-31 13:08:55 +02:00
Thomas Monjalon
dd45ed7e74 build: rename ppc sub-directories
The directories ppc_64 are renamed as ppc in
	- config/
	- lib/librte_eal/common/arch/
	- lib/librte_eal/common/include/arch/

The EAL directories are not really renamed, but symbolically linked,
because they will be moved with their new name in the next commits.

If ppc_32 needs to be supported, it can be in the same directory.
The arch directories arm and x86 are already covering both 32 and 64-bit
sub-architectures.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: David Christensen <drc@linux.vnet.ibm.com>
Acked-by: David Marchand <david.marchand@redhat.com>
2020-03-31 13:08:55 +02:00
Thomas Monjalon
4448a202b6 eal: remove useless makefiles
When moving files to the directory kernel/,
the file BSDmakefile.meson was left in eal/.

Also the intermediate makefiles in linux/ and freebsd/ became useless.

Fixes: acaa9ee991 ("move kernel modules directories")
Cc: stable@dpdk.org

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: David Marchand <david.marchand@redhat.com>
2020-03-31 13:08:55 +02:00
Alexander Kozyrev
759a6a221e mbuf: optimize memory loads during freeing
Introduction of pinned external buffers doubled memory loads in the
rte_pktmbuf_prefree_seg() function. Analysis of the generated assembly
code shows unnecessary load of the pool field of the rte_mbuf structure.
Here is the snippet of the assembly for "if (!RTE_MBUF_DIRECT(m))":
Before the change the code was:
	movq  0x18(%rbx), %rax // load the ol_flags field
	test %r13, %rax	       // check if ol_flags equals to 0x60...0
	jz 0x9a8718 <Block 2>  // jump out to "if (m->next != NULL)"
After the change the code became:
	movq  0x18(%rbx), %rax // load ol_flags
	test %r14, %rax	       // check if ol_flags equals to 0x60...0
	jnz 0x9bea38 <Block 2> // jump in to "if (!RTE_MBUF_HAS_EXTBUF(m)"
	movq  0x48(%rbx), %rax // load the pool field
	jmp 0x9bea78 <Block 7> // jump out to "if (m->next != NULL)"
Look like this absolutely unneeded memory load of the pool field is an
optimization for the external buffer case in GCC (4.8.5), since Clang
generates the same assembly for both before and after the change versions.
Plus, GCC favors the external buffer case over the simple case.
This assembly code layout causes the performance degradation because the
rte_pktmbuf_prefree_seg() function is a part of a very hot path.
Workaround this compilation issue by moving the check for pinned buffer
apart from the check for external buffer and restore the initial code
flow that favors the direct mbuf case over the external one.

Fixes: 6ef1107ad4 ("mbuf: detach mbuf with pinned external buffer")
Cc: stable@dpdk.org

Signed-off-by: Alexander Kozyrev <akozyrev@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
2020-03-31 02:57:42 +02:00
Yunjian Wang
ffcf831454 kvargs: fix buffer overflow when parsing list
When the input string is "key=[", the ending '\0' is replaced
by a ',', leading to a heap buffer overflow.

Check the content of ctx1 to avoid this problem.

Fixes: cc0579f233 ("kvargs: support list value")
Cc: stable@dpdk.org

Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
2020-03-27 17:03:46 +01:00
Ferruh Yigit
241e67bfec log: add API to check if a logtype can log in a given level
This is a helper function in case components would like to do more work
than just logging a message based on log level, like for example
collecting some stats if the log type is DEBUG etc..

A few existing relevant usage converted to this new API.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Hyong Youb Kim <hyonkim@cisco.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Reviewed-by: Andrzej Ostruszka <aostruszka@marvell.com>
Acked-by: David Marchand <david.marchand@redhat.com>
2020-03-27 11:20:08 +01:00
Anatoly Burakov
4236694f0a mem: preallocate VA space in no-huge mode
When --no-huge mode is used, the memory is currently allocated with
mmap(NULL, ...). This is fine in most cases, but can fail in cases
where DPDK is run on a machine with an IOMMU that is of more limited
address width than that of a VA, because we're not specifying the
address hint for mmap() call.

Fix it by preallocating VA space before mapping it.

Cc: stable@dpdk.org

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Tested-by: David Marchand <david.marchand@redhat.com>
Tested-by: Jun W Zhou <junx.w.zhou@intel.com>
2020-03-27 11:04:09 +01:00
Anatoly Burakov
d1c7c0cdf7 vfio: map contiguous areas in one go
Currently, when we are creating DMA mappings for memory that's
either external or is backed by hugepages in IOVA as PA mode, we
assume that each page is necessarily discontiguous. This may not
actually be the case, especially for external memory, where the
user is able to create their own IOVA table and make it
contiguous. This is a problem because VFIO has a limited number
of DMA mappings, and it does not appear to concatenate them and
treats each mapping as separate, even when they cover adjacent
areas.

Fix this so that we always map contiguous memory in a single
chunk, as opposed to mapping each segment separately.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Ray Kinsella <ray.kinsella@intel.com>
2020-03-27 10:09:22 +01:00
Mit Matelske
bcf789da73 eal/freebsd: fix queuing duplicate alarm callbacks
The source callback list grows infinitely when more than alarm
is queued.

This fix recognizes that an alarm interrupt in FreeBSD should never
have more than one callback on its list, so if
rte_intr_callback_register() is called with an interrupt handle type
of RTE_INTR_HANDLE_ALARM, so if such an interrupt type already has a
non-empty list, then a new callback is not created, but the kevent
timer is restarted properly.

Fixes: 23150bd8d8 ("eal/bsd: add interrupt thread")
Cc: stable@dpdk.org

Signed-off-by: Mit Matelske <mit@pt.net>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2020-03-25 13:56:13 +01:00
Jerin Jacob
a7f895740c eal: store control thread CPU affinity in TLS
_cpuset TLS variable stores the CPU affinity of eal thread.
Populate the _cpuset TLS variable for control thread to

1) Make rte_thread_get_affinity() and eal_thread_dump_affinity
functional with control thread.
2) Quick access to cpu affinity.

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
2020-03-24 13:44:41 +01:00
Phil Yang
3ba51478a3 ring: fix unaligned memory access on aarch32
The 32-bit arm machine doesn't support unaligned memory access. It
will cause a bus error on aarch32 with the custom element size ring.

Thread 1 "test" received signal SIGBUS, Bus error.
__rte_ring_enqueue_elems_64 (n=1, obj_table=0xf5edfe41, prod_head=0, \
r=0xf5edfb80) at /build/dpdk/build/include/rte_ring_elem.h:177
177                             ring[idx++] = obj[i++];

Fixes: cc4b218790 ("ring: support configurable element size")

Signed-off-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
2020-03-19 16:18:09 +01:00
Stephen Hemminger
897358cc1e ethdev: fix spelling
Minor spelling errors found by aspell and codespell

Fixes: 1daa338058 ("ethdev: validate offloads set by PMD")
Fixes: 81f9db8ecc ("ethdev: add vlan offload support")
Fixes: c8231c63dd ("ethdev: insert Rx callback as head of list")
Cc: stable@dpdk.org

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2020-03-18 10:21:42 +01:00
Xiao Zhang
ecbc857013 ethdev: add PFCP header to flow API
This patch adds the new flow item RTE_FLOW_ITEM_TYPE_PFCP to flow API to
match a PFCP header.
Add sample PFCP rules for testpmd guide. Since Session Endpoint
Identifier (SEID) only will be present in PFCP Session header and PFCP
Session headers shall be identified when the S field is equal to 1, when
create rules for PFCP Session header with certain SEID the S field need
be set 1.

Signed-off-by: Xiao Zhang <xiao.zhang@intel.com>
Acked-by: Ori Kam <orika@mellanox.com>
2020-03-18 10:21:42 +01:00
Dmitry Kozlyuk
4816484bab build: support MinGW-w64 with Meson
MinGW-w64 linker does not mimic MS linker options, so the build system
must differentiate between linkers on Windows. Use GNU linker options
with GCC and MS linker options with Clang.

MinGW-w64 by default uses MSVCRT stdio, which does not comply to ANSI,
most notably its formatting and string handling functions. MinGW-w64
support for the Universal CRT (UCRT) is ongoing, but the toolchain
provides its own standard-complying implementation of stdio. The latter
is used in the patch to support formatting in DPDK.

Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
Tested-by: William Tu <u9012063@gmail.com>
Tested-by: Pallavi Kadam <pallavi.kadam@intel.com>
2020-03-18 01:20:39 +01:00
Dmitry Kozlyuk
f3874012c6 eal/windows: support building with MinGW-w64
Disable bundled getopt implementation and GNU extensions shim when
building in GNU environment.

Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
Tested-by: William Tu <u9012063@gmail.com>
Tested-by: Pallavi Kadam <pallavi.kadam@intel.com>
Acked-by: Pallavi Kadam <pallavi.kadam@intel.com>
2020-03-18 01:20:08 +01:00
Dmitry Kozlyuk
78542ed2c7 eal/windows: use lowercase filenames for system headers
Mixed case in Windows header names causes errors when cross-compiling
from Linux with case-sensitive filesystem using MinGW, because MinGW
distribution provides all platform SDK headers in lowercase. The change
does not affect Windows native builds on case-insensitive filesystems
(NTFS default).

Reported-by: Narcisa Vasile <navasile@microsoft.com>
Reported-by: William Tu <u9012063@gmail.com>
Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
Tested-by: William Tu <u9012063@gmail.com>
Tested-by: Pallavi Kadam <pallavi.kadam@intel.com>
Acked-by: Pallavi Kadam <pallavi.kadam@intel.com>
2020-03-18 01:19:56 +01:00
Dmitry Kozlyuk
abc61614f8 eal: introduce portable format attribute
When using __attribute__((format(...)) on functions, GCC on Windows
assumes MS-specific format string by default, even if the underlying
stdio implementation is ANSI-compliant (either MS Unicersal CRT
or MinGW implementation). Wrap attribute into a macro that forces
GNU-specific format string when using GCC.

Use this new attribute for logging and panic messages in EAL
and for output strings in cmdline library.

Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
Tested-by: William Tu <u9012063@gmail.com>
Tested-by: Pallavi Kadam <pallavi.kadam@intel.com>
2020-03-18 01:19:16 +01:00
Thomas Monjalon
0c9a5735a9 eal: fix compiler detection in public headers
RTE_TOOLCHAIN_* macros are defining the target compiler.
Some API may be used in a host application like pmdinfogen.
That's why the the public headers should check the effective compiler
in use instead of the target compiler.

Detecting the compiler with macros is easy, except for __GNUC__
which is defined in all compilers supporting some GNU compatibility.

It is improved by defining RTE_CC_CLANG, RTE_CC_ICC and RTE_CC_GCC.
The extra macro RTE_CC_IS_GNU is defined to 0 or 1 in GCC case,
so it can be used simply with #if.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
2020-03-18 00:59:17 +01:00
David Christensen
61669ecb92 pci: fix build on ppc
The include file rte_debug.h is pulled into x86 builds through the
following callchain:

lib/librte_eal/common/include/generic/rte_cycles.h:17,
lib/librte_eal/common/include/arch/x86/rte_cycles.h:13,
lib/librte_eal/common/include/arch/x86/rte_spinlock.h:18,
lib/librte_eal/common/include/arch/x86/rte_rwlock.h:13,

The PPC specific version of the same callchain does not include
rte_debug.h.  Add rte_debug.h back into the C files that require it.

Fixes: 0dcba52562 ("pci: remove unneeded includes in public header file")
Cc: stable@dpdk.org

Signed-off-by: David Christensen <drc@linux.vnet.ibm.com>
Tested-by: David Wilder <dwilder@us.ibm.com>
Acked-by: David Marchand <david.marchand@redhat.com>
2020-03-17 14:53:48 +01:00
Bruce Richardson
034e7d87ba pci: fix build on FreeBSD
When removing the extra headers from rte_pci.h stdlib should have been
removed instead of stdio, since off_t is missing for BSD builds when just
including stdlib.h

Fixes: 0dcba52562 ("pci: remove unneeded includes in public header file")
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
2020-03-17 10:10:15 +01:00
Bruce Richardson
0dcba52562 pci: remove unneeded includes in public header file
The rte_pci.h file includes more header files than are actually needed,
which means that all users of it also include those headers. This patch
removes the unneeded headers - adding them elsewhere where other components
were requiring them but not including them directly.

Fixes: c752998b5e ("pci: introduce library and driver")
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
2020-03-16 15:45:45 +01:00
Ciara Power
341a793eb1 telemetry: fix port stats retrieval
The ep struct is used to track what type of stats are required by the
client. For PORT_STATS type, it contains the lists of port and metric
ids to query, and the number of ids in each list.

The ep struct has values set (num of port and metric ids) when a request
for port stats values by name is received. However, after this value
assignment, the struct is reset to all 0 values, meaning the number of
port and metric ids required now both show as 0, and the client will not
receive the requested data in response. To fix this issue, the memset
call is now moved above the ep struct value assignment.

Fixes: 4080e46c80 ("telemetry: support global metrics")
Cc: stable@dpdk.org

Signed-off-by: Ciara Power <ciara.power@intel.com>
Reviewed-by: Kevin Laatz <kevin.laatz@intel.com>
2020-03-13 13:57:04 +01:00
Harry van Haaren
33666b448f service: fix crash on exit
This commit releases all service cores from their role,
returning them to ROLE_RTE on rte_service_finalize().

This fixes an issue relating to the service cores causing
a race-condition on rte_eal_cleanup(), where the service core
could still be executing while the main thread has already
free-d the service memory, leading to a segfault.

Fixes: da23f0aa87 ("service: fix memory leak with new function")
Cc: stable@dpdk.org

Reported-by: David Marchand <david.marchand@redhat.com>
Reported-by: Aaron Conole <aconole@redhat.com>
Signed-off-by: David Marchand <david.marchand@redhat.com>
Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
Acked-by: Aaron Conole <aconole@redhat.com>
2020-03-13 13:56:46 +01:00
David Marchand
8a4baf06c1 mem: mark pages as not accessed when reserving VA
When the memory allocator reserves virtual addresses, it still does not
know what they will be used for.
Besides, huge areas are reserved for memory hotplug in multiprocess
setups. But most of the pages are unused in the whole life of the
processes.

Change protection mode to PROT_NONE when only reserving VA.
The memory allocator already switches to the right mode when making use
of it.

It also has the nice effect of getting those pages skipped by the kernel
when calling mlockall() or when a coredump gets generated.

Cc: stable@dpdk.org

Suggested-by: Andrea Arcangeli <aarcange@redhat.com>
Signed-off-by: David Marchand <david.marchand@redhat.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Acked-by: Aaron Conole <aconole@redhat.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
2020-03-13 13:53:12 +01:00
Haifeng Lin
754b6166f5 eal/arm64: fix precise TSC
In order to get more accurate the cntvct_el0 reading,
SW must invoke isb.

Fixes: ccad39ea07 ("eal/arm: add cpu cycle operations for ARMv8")
Cc: stable@dpdk.org

Reviewed-by: Gavin Hu <gavin.hu@arm.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
Signed-off-by: Haifeng Lin <haifeng.lin@huawei.com>
2020-03-13 13:52:04 +01:00
David Marchand
d635f81c56 eal/arm64: remove internal macros
No need to export dsb and dmb.
EAL memory barriers are the public API.

%s/\<\(d.b\)\>(\([^()]*\))$/asm volatile("\1 \2" : : : "memory")/

Signed-off-by: David Marchand <david.marchand@redhat.com>
Reviewed-by: Gavin Hu <gavin.hu@arm.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2020-03-13 13:44:44 +01:00
Sunil Kumar Kori
2299c8d8e7 eal: fix log message print for regex
If user passes log-level eal parameter to enable log level based on regex
then in case of error message is being printed for pattern match instead of
regex. Following is the warning message thrown:

Compiling C object 'lib/76b5a35@@rte_eal@sta/librte_eal_common_eal_common_options.c.o'.
In function ‘eal_parse_log_level’,
   inlined from ‘eal_parse_common_option’ at ../lib/librte_eal/common/eal_common_options.c:1418:7:
../lib/librte_eal/common/eal_common_options.c:1053:4: warning: ‘%s’ directive argument is null [-Wformat-overflow=]
 1053 |    fprintf(stderr, "cannot set log level %s,%d\n",
      |    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1054 |     pattern, priority);
      |     ~~~~~~~~~~~~~~~~~~

Fixes: 7f0bb634a1 ("log: add ability to match log type with globbing")
Cc: stable@dpdk.org

Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Acked-by: David Marchand <david.marchand@redhat.com>
Reviewed-by: Jerin Jacob <jerinj@marvell.com>
2020-03-13 13:44:44 +01:00
Haiyue Wang
8d93a03170 eal: fix 32-bit structure marker
Use the 32bit typedef for structure 4B alignment marking.

Fixes: 2b393160a4 ("eal: introduce structure markers")
Cc: stable@dpdk.org

Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
Acked-by: Xiaolong Ye <xiaolong.ye@intel.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2020-03-13 13:44:44 +01:00
Hemant Agrawal
08ab4769c2 add top-level SPDX license tag
This patch adds top level SPDX license identifiers for some of the DPDK
source and scripts, where the copyright owners have not yet agreed to
replace the full BSD-3 license plate.

This patch also add SPDX license tag for a file with no
previous license plates. (DPDK is BSD-3)

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
2020-02-22 16:11:53 +01:00
Dmitry Kozlyuk
6c45dff00a eal/windows: fix out-of-memory check in asprintf
Check vsnprintf() result to prevent calling malloc() with negative size.
Check actual malloc() result and terminate asprintf() with documented
error code to prevent the use of NULL pointer.

Fixes: e8428a9d8 ("eal/windows: add some basic functions and macros")

Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
Acked-by: Ranjit Menon <ranjit.menon@intel.com>
2020-02-21 17:54:56 +01:00
Ciara Power
888683110d ethdev: add comment to warn of ABI breakage
If a function is added to the eth_dev_ops struct before
tx_descriptor_status function, this will cause ABI breakage. This is due
to static inline functions using this function, and some other functions
above it in the struct, so they cannot change position. A comment is
added to inform developers of this possible breakage.

Signed-off-by: Ciara Power <ciara.power@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
2020-02-19 13:51:06 +01:00
Konstantin Ananyev
b38aaf1733 ipsec: fix use of uninitialized variable
Defects reported by coverity scan
uninit_use_in_call: Using uninitialized element of array clen when
calling cpu_crypto_bulk.

Coverity issue: 354233, 354234
Fixes: 957394f726 ("ipsec: support CPU crypto mode")

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
2020-02-20 11:16:46 +01:00
Stephen Hemminger
d82927d2f8 lpm6: make IPv6 address immutable
Both the table setup and lookup do no modify their arguments.
Therefore the parameter should be constant.

This is not actually an API breakage since programs can be
recompiled without change. This is not an ABI breakage because
old programs will still run.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-02-16 20:45:46 +01:00
Honnappa Nagarahalli
ae122e5079 ring: fix API documentation
Correct the documentation for obj_table in rte_ring_xxx_elem APIs.

Fixes: cc4b218790 ("ring: support configurable element size")

Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Reviewed-by: Gavin Hu <gavin.hu@arm.com>
2020-02-15 16:41:33 +01:00
Adrian Moreno
4f37df14c4 vhost: protect log address translation in IOTLB update
Currently, the log address translation only  happens in the vhost-user's
translate_ring_addresses(). However, the IOTLB update handler is not
checking if it was mapped to re-trigger that translation.

Since the log address mapping could fail, check it on iotlb updates.
Also, check it on vring_translate() so we do not dirty pages if the
logging address is not yet ready.

Additionally, properly protect the accesses to the iotlb structures.

Fixes: fbda9f1459 ("vhost: translate incoming log address to GPA")
Cc: stable@dpdk.org

Signed-off-by: Adrian Moreno <amorenoz@redhat.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
2020-02-14 12:42:13 +01:00
Jin Yu
c47edd040a vhost: fix inflight resubmit check
The frontend may not send the get_inflight_fd and
set_inflight_fd although we negotiate the protocol
feature. When we meet this situation just return OK.

Fixes: ad0a4ae491 ("vhost: checkout resubmit inflight information")
Cc: stable@dpdk.org

Signed-off-by: Jin Yu <jin.yu@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
2020-02-14 12:42:13 +01:00
Maxime Coquelin
966f89d998 vhost: check message header size read
This patch adds a check to ensure the read size of
the Vhost-user message header is not smaller than
the expected size.

In case of unexpected read size, report an error
and close file descriptors passed with the message,
if any.

Fixes: 8f972312b8 ("vhost: support vhost-user")
Cc: stable@dpdk.org

Reported-by: Ilja Van Sprundel <ivansprundel@ioactive.com>
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: Tiwei Bie <tiwei.bie@intel.com>
2020-02-14 12:42:13 +01:00
Marcin Smoczynski
32f9289dd4 cryptodev: fix doxygen of CPU crypto API
Add missing doxygen comment of rte_crypto_mbuf_to_vec's fields.

Fixes: 7adf992fb9 ("cryptodev: introduce CPU crypto API")

Signed-off-by: Marcin Smoczynski <marcinx.smoczynski@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
2020-02-13 12:41:04 +01:00
Ciara Power
f42c9ac5b6 lib: fix unnecessary double negation
An equality expression already returns either 0 or 1.
There is no need to use double negation for these cases.

Fixes: ea672a8b16 ("mbuf: remove the rte_pktmbuf structure")
Fixes: a0fd91cefc ("mempool: rename functions with confusing names")
Cc: stable@dpdk.org

Signed-off-by: Ciara Power <ciara.power@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
2020-02-14 17:39:46 +01:00
Scott Wasson
eab71b8463 kni: fix not contiguous FIFO
KNI requires FIFO to be physically contiguous, with existing
'rte_memzone_reserve()' API this is not guaranteed by default and as a
result KNI rings and packet delivery may be broken if reserved memory
is not physically contiguous.

Fixing it by providing 'RTE_MEMZONE_IOVA_CONTIG' flag to ask physically
contiguous memory.

Bugzilla ID: 389
Fixes: 23fa86e529 ("memzone: enable IOVA-contiguous reserving")
Cc: stable@dpdk.org

Signed-off-by: Scott Wasson <scott_wasson@affirmednetworks.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
2020-02-14 11:59:01 +01:00
Konstantin Ananyev
dbed2c9ef8 acl: fix 32-bit match for range field
ACL build phase for range fields that are bigger then
16 bits might generate wrong trie.
For more details please refer to:
https://bugs.dpdk.org/show_bug.cgi?id=307

Bugzilla ID: 307
Fixes: dc276b5780 ("acl: new library")
Cc: stable@dpdk.org

Reported-by: Ido Goshen <ido@cgstowernetworks.com>
Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
2020-02-13 14:43:56 +01:00
Pallavi Kadam
1c806ae5c3 eal/windows: support command line options parsing
Adding specific logic for eal.c to support parsing on
Windows.

Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Signed-off-by: Antara Ganesh Kolar <antara.ganesh.kolar@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
Reviewed-by: Keith Wiles <keith.wiles@intel.com>
Reviewed-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
Tested-by: Narcisa Ana Maria Vasile <narcisa.vasile@microsoft.com>
Acked-by: Narcisa Ana Maria Vasile <narcisa.vasile@microsoft.com>
2020-02-12 22:50:29 +01:00
Pallavi Kadam
b30ceb91af eal/windows: support more common files
Added support for additional common files in meson build
to expand Windows EAL and to support the lcore parsing
feature on Windows.

Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Signed-off-by: Antara Ganesh Kolar <antara.ganesh.kolar@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
Reviewed-by: Keith Wiles <keith.wiles@intel.com>
Reviewed-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
Tested-by: Narcisa Ana Maria Vasile <narcisa.vasile@microsoft.com>
Acked-by: Narcisa Ana Maria Vasile <narcisa.vasile@microsoft.com>
2020-02-12 22:50:29 +01:00