summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
2018-11-12eal/x86: remove unused memcpy fileThomas Monjalon
The use of rte_memcpy_ptr was removed in revert below, but it was missing removing the file arch/x86/rte_memcpy.c. Fixes: d35cc1fe6a7a ("eal/x86: revert select optimized memcpy at run-time") Cc: stable@dpdk.org Signed-off-by: Thomas Monjalon <thomas@monjalon.net> Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
2018-11-12devargs: do not replace already inserted deviceThomas Monjalon
The devargs of a device can be replaced by a newly allocated one when trying to probe again the same device (multi-process or multi-ports scenarios). This is breaking some pointer references. It can be avoided by copying the new content, freeing the new devargs, and returning the already inserted pointer. Signed-off-by: Thomas Monjalon <thomas@monjalon.net> Tested-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Tested-by: Qi Zhang <qi.z.zhang@intel.com> Tested-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
2018-11-07mem: fix DMA mask width sanity checkAlejandro Lucero
Current code has different max DMA mask width values for 32 and 64 bits systems. IOMMU hardware could report a higher supported width than current MAX_DMA_MASK_BITS when RTE_ARCH_64 is not defined. This is actually true with a 32 bits kernel running in a 64 bits server with IOMMU hardware. This could also be a problem with embedded systems using an IOMMU designed for 64 bits in a 32 bits system. This patch leaves a single max DMA mask width which will make sure the mask width is within the range for 64 bits variables used for DMA mask. This also will avoid wrong values because any value higher than 64 bits is likely wrong. Fixes: 223b7f1d5ef6 ("mem: add function for checking memseg IOVA") Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com> Acked-by: Anatoly Burakov <anatoly.burakov@intel.com> Tested-by: Ferruh Yigit <ferruh.yigit@intel.com>
2018-11-07mem: fix use after free in legacy mem initAnatoly Burakov
Adding an additional failure path in DMA mask check has exposed an issue where `hugepage` pointer may point to memory that has already been unmapped, but pointer value is still not NULL, so failure handler will attempt to unmap it second time if DMA mask check fails. Fix it by setting `hugepage` pointer to NULL once it is no longer needed. Coverity issue: 325730 Fixes: 165c89b84538 ("mem: use DMA mask check for legacy memory") Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
2018-11-06version: 18.11-rc2v18.11-rc2Thomas Monjalon
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
2018-11-06ip_frag: use key length for key comparisonKonstantin Ananyev
Right now reassembly code relies on src_dst[] being all zeroes to determine is it free/occupied entry in the fragments table. This is suboptimal and error prone - user can crash DPDK ip_reassembly app by something like the following scapy script: x=Ether(src=...,dst=...)/IP(dst='0.0.0.0',src='0.0.0.0',id=0)/('X'*1000) frags=fragment(x, fragsize=500) sendp(frags, iface=...) To overcome that issue and reduce overhead of 'key invalidate' and 'key is empty' operations - add key_len into keys comparision procedure. Fixes: 4f1a8f633862 ("ip_frag: add IPv6 reassembly") Cc: stable@dpdk.org Reported-by: Ryan E Hall <ryan.e.hall@intel.com> Reported-by: Alexander V Gutkin <alexander.v.gutkin@intel.com> Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
2018-11-06ip_frag: check fragment length of incoming packetKonstantin Ananyev
Under some conditions ill-formed fragments might cause reassembly code to corrupt mbufs and/or crash. Let say the following fragments sequence: <ofs=0,len=100, flags=MF> <ofs=96,len=100, flags=MF> <ofs=200,len=0,flags=MF> <ofs=200,len=100,flags=0> can trigger the problem. To overcome such situation, added check that fragment length of incoming value is greater than zero. Fixes: 601e279df074 ("ip_frag: move fragmentation/reassembly headers into a library") Fixes: 4f1a8f633862 ("ip_frag: add IPv6 reassembly") Cc: stable@dpdk.org Reported-by: Ryan E Hall <ryan.e.hall@intel.com> Reported-by: Alexander V Gutkin <alexander.v.gutkin@intel.com> Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
2018-11-06vhost: fix possible out of bound accessFerruh Yigit
Fixes: d7280c9fffcb ("vhost: support selective datapath") Cc: stable@dpdk.org Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com> Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
2018-11-06service: fix possible null accessFerruh Yigit
Fixes: 21698354c832 ("service: introduce service cores concept") Cc: stable@dpdk.org Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com> Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
2018-11-06lib: fix shifting 32-bit signed variable 31 timesFerruh Yigit
Fix cppcheck warning by marking variable as unsigned. Fixes: dc276b5780c2 ("acl: new library") Fixes: 986ff526fb84 ("net: add CRC computation API") Cc: stable@dpdk.org Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
2018-11-06ethdev: remove experimental tag for iterator APIThomas Monjalon
After removing the function rte_eth_dev_attach(), there are two replacement solutions possible: one using probe event notification, and one using a new iterator. So the application can get the new probed ports either asynchronously or synchronously. The iterator API is new in DPDK 18.11 so they got the experimental tag by policy. It causes an issue for strict applications which do not use experimental functions, and want to use the synchronous method. The replacement for removed API should not be experimental. That's why the experimental status of the ethdev iterator is removed. Signed-off-by: Thomas Monjalon <thomas@monjalon.net> Acked-by: Kevin Traynor <ktraynor@redhat.com> Tested-by: Kevin Traynor <ktraynor@redhat.com>
2018-11-06eal: remove experimental tag for probe/removeThomas Monjalon
The functions rte_dev_probe() and rte_dev_remove() are new in DPDK 18.11 so they got the experimental tag by policy. However they are too much basic functions for being skipped by strict applications which do not use experimental functions. The alternative is to use rte_eal_hotplug_add() and rte_eal_hotplug_remove(), but their API requires the application to parse the devargs string in order to provide bus name, device name and driver arguments. The new function rte_dev_probe() is really simpler to use and more flexible by accepting any devargs string. Let's encourage applications to use it. The old functions rte_eal_hotplug_* may be deprecated later. Signed-off-by: Thomas Monjalon <thomas@monjalon.net> Acked-by: Kevin Traynor <ktraynor@redhat.com> Tested-by: Kevin Traynor <ktraynor@redhat.com>
2018-11-06malloc: fix invalid argument handlingAnatoly Burakov
When adding memory to an external heap, do not go to unlock failure handler because the memory hotplug lock hasn't been taken out yet. Fixes: 7d75c31014f7 ("malloc: allow adding memory to named heaps") Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
2018-11-05vhost/crypto: fix inferred misuse of enumFan Zhang
Fix inffered misuse of enum rte_crypto_cipher_algorithm and rte_crypto_auth_algorithm Coverity issue: 277202 Fixes: e80a98708166 ("vhost/crypto: add session message handler") Cc: stable@dpdk.org Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com> Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2018-11-05ethdev: fix redundant function pointer checkFerruh Yigit
RTE_FUNC_PTR_OR_ERR_RET() already does the `ethdev_uninit` NULL check. Fixes: e489007a411c ("ethdev: add generic create/destroy ethdev APIs") Cc: stable@dpdk.org Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com> Acked-by: Thomas Monjalon <thomas@monjalon.net>
2018-11-05vhost: advertize packed ring layout supportMaxime Coquelin
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com> Reviewed-by: Jens Freimann <jfreimann@redhat.com> Reviewed-by: Tiwei Bie <tiwei.bie@intel.com>
2018-11-05vhost: add packed ring support to vring base requestsMaxime Coquelin
For packed ring layout, we need save avail index and its wrap counter value. At restore time, the used index and its wrap counter are set to available's ones, as the ring procressing is stopped at vring base get time. Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com> Reviewed-by: Jens Freimann <jfreimann@redhat.com> Reviewed-by: Tiwei Bie <tiwei.bie@intel.com>
2018-11-05net: fix build with pedanticShahaf Shuler
The following error popped when compiling with -pedantic: In file included from drivers/net/mlx5/mlx5_flow_dv.c:28:0: include/rte_gre.h:20:2: error: type of bit-field 'res2' is a GCC extension [-Werror=pedantic] uint16_t res2:4; /**< Reserved */ Fixing by adding the __extension__ attribute. Fixes: 894f71a3805d ("net: add GRE header structure") Cc: stable@dpdk.org Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2018-11-05ring/c11: move atomic load of head above the loopGavin Hu
In __rte_ring_move_prod_head, move the __atomic_load_n up and out of the do {} while loop as upon failure the old_head will be updated, another load is costly and not necessary. This helps a little on the latency,about 1~5%. Test result with the patch(two cores): SP/SC bulk enq/dequeue (size: 8): 5.64 MP/MC bulk enq/dequeue (size: 8): 9.58 SP/SC bulk enq/dequeue (size: 32): 1.98 MP/MC bulk enq/dequeue (size: 32): 2.30 Fixes: 39368ebfc606 ("ring: introduce C11 memory model barrier option") Cc: stable@dpdk.org Signed-off-by: Gavin Hu <gavin.hu@arm.com> Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com> Reviewed-by: Steve Capper <steve.capper@arm.com> Reviewed-by: Ola Liljedahl <ola.liljedahl@arm.com> Reviewed-by: Jia He <justin.he@arm.com> Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com> Tested-by: Jerin Jacob <jerin.jacob@caviumnetworks.com> Acked-by: Olivier Matz <olivier.matz@6wind.com>
2018-11-05ring/c11: synchronize load and store of the tailGavin Hu
Synchronize the load-acquire of the tail and the store-release within update_tail, the store release ensures all the ring operations, enqueue or dequeue, are seen by the observers on the other side as soon as they see the updated tail. The load-acquire is needed here as the data dependency is not a reliable way for ordering as the compiler might break it by saving to temporary values to boost performance. When computing the free_entries and avail_entries, use atomic semantics to load the heads and tails instead. The patch was benchmarked with test/ring_perf_autotest and it decreases the enqueue/dequeue latency by 5% ~ 27.6% with two lcores, the real gains are dependent on the number of lcores, depth of the ring, SPSC or MPMC. For 1 lcore, it also improves a little, about 3 ~ 4%. It is a big improvement, in case of MPMC, with two lcores and ring size of 32, it saves latency up to (3.26-2.36)/3.26 = 27.6%. This patch is a bug fix, while the improvement is a bonus. In our analysis the improvement comes from the cacheline pre-filling after hoisting load- acquire from _atomic_compare_exchange_n up above. The test command: $sudo ./test/test/test -l 16-19,44-47,72-75,100-103 -n 4 --socket-mem=\ 1024 -- -i Test result with this patch(two cores): SP/SC bulk enq/dequeue (size: 8): 5.86 MP/MC bulk enq/dequeue (size: 8): 10.15 SP/SC bulk enq/dequeue (size: 32): 1.94 MP/MC bulk enq/dequeue (size: 32): 2.36 In comparison of the test result without this patch: SP/SC bulk enq/dequeue (size: 8): 6.67 MP/MC bulk enq/dequeue (size: 8): 13.12 SP/SC bulk enq/dequeue (size: 32): 2.04 MP/MC bulk enq/dequeue (size: 32): 3.26 Fixes: 39368ebfc6 ("ring: introduce C11 memory model barrier option") Cc: stable@dpdk.org Signed-off-by: Gavin Hu <gavin.hu@arm.com> Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com> Reviewed-by: Steve Capper <steve.capper@arm.com> Reviewed-by: Ola Liljedahl <ola.liljedahl@arm.com> Reviewed-by: Jia He <justin.he@arm.com> Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com> Tested-by: Jerin Jacob <jerin.jacob@caviumnetworks.com> Acked-by: Olivier Matz <olivier.matz@6wind.com>
2018-11-02compressdev: fix op allocationFiona Trahe
Fixed bad logic in rte_comp_op_alloc() checking return value from rte_comp_op_raw_bulk_alloc(). This could have resulted in a seg-fault in error case. Made rte_comp_ob_bulk_alloc() code consistent with rte_comp_op_alloc(). Fixes: 96086db5a369 ("compressdev: add operation management") Cc: stable@dpdk.org Reported-by: Sabyasachi Sengupta <sabyasg@hpe.com> Signed-off-by: Fiona Trahe <fiona.trahe@intel.com> Acked-by: Shally Verma <shally.verma@caviumnetworks.com>
2018-11-02compressdev: clarify usage of op structureFiona Trahe
Add note on usage of op structure and when it can be accessed and freed. Fixes: 63f4bfd5328b ("compressdev: add enqueue/dequeue functions") Cc: stable@dpdk.org Signed-off-by: Fiona Trahe <fiona.trahe@intel.com> Acked-by: Shally Verma <shally.verma@caviumnetworks.com>
2018-11-05mem: add thread unsafe version for DMA mask checkAlejandro Lucero
During memory initialization calling rte_mem_check_dma_mask leads to a deadlock because memory_hotplug_lock is locked by a writer, the current code in execution, and rte_memseg_walk tries to lock as a reader. This patch adds a thread_unsafe version which will call the final function specifying the memory_hotplug_lock does not need to be acquired. The patch also modified rte_mem_check_dma_mask as a intermediate step which will call the final function as before, implying memory_hotplug_lock will be acquired. PMDs should always use the version acquiring the lock with the thread_unsafe one being just for internal EAL memory code. Fixes: 223b7f1d5ef6 ("mem: add function for checking memseg IOVA") Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com> Tested-by: Ferruh Yigit <ferruh.yigit@intel.com>
2018-11-05mem: use DMA mask check for legacy memoryAlejandro Lucero
If a device reports addressing limitations through a dma mask, the IOVAs for mapped memory needs to be checked out for ensuring correct functionality. Previous patches introduced this DMA check for main memory code currently being used but other options like legacy memory and the no hugepages option need to be also considered. This patch adds the DMA check for those cases. Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com> Tested-by: Ferruh Yigit <ferruh.yigit@intel.com>
2018-11-05malloc: modify error message for DMA mask checkAlejandro Lucero
If DMA mask checks shows mapped memory out of the supported range specified by the DMA mask, nothing can be done but return an error an report the error. This can imply the app not being executed at all or precluding dynamic memory allocation once the app is running. In any case, we can advice the user to force IOVA as PA if currently IOVA being VA and user being root. Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com> Tested-by: Ferruh Yigit <ferruh.yigit@intel.com>
2018-11-05mem: add function for setting DMA maskAlejandro Lucero
This patch adds the possibility of setting a dma mask to be used once the memory initialization is done. This is currently needed when IOVA mode is set by PCI related code and an x86 IOMMU hardware unit is present. Current code calls rte_mem_check_dma_mask but it is wrong to do so at that point because the memory has not been initialized yet. Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com> Tested-by: Ferruh Yigit <ferruh.yigit@intel.com>
2018-11-05mem: rename DMA mask check with proper prefixAlejandro Lucero
Current name rte_eal_check_dma_mask does not follow the naming used in the rest of the file. Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com> Tested-by: Ferruh Yigit <ferruh.yigit@intel.com>
2018-11-05malloc: fix DMA mask checkAlejandro Lucero
The param needs to be the maskbits and not the mask. Fixes: 223b7f1d5ef6 ("mem: add function for checking memseg IOVA") Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com> Tested-by: Ferruh Yigit <ferruh.yigit@intel.com>
2018-11-04eal: fix build with gcc 9.0Ferruh Yigit
build error: In function ‘eal_plugin_add’, .../lib/librte_eal/common/eal_common_options.c:225:2: error: ‘strncpy’ output may be truncated copying 4095 bytes from a string of length 4095 [-Werror=stringop-truncation] strncpy(solib->name, path, PATH_MAX-1); strncpy may result a not null-terminated string, replaced it with strlcpy Fixes: f9a08f650211 ("eal: add support for shared object drivers") Cc: stable@dpdk.org Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
2018-11-04eal: fix error string functionJerin Jacob
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>
2018-11-02eal/linux: handle UIO read failure in interrupt handlerLuca Boccassi
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>
2018-11-02eal: fix memory leak on multi-process hotplug rollbackDarek Stojaczyk
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>
2018-10-31eal: fix IPC memory leak on device hotplugDarek Stojaczyk
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>
2018-10-29version: 18.11-rc1v18.11-rc1Thomas Monjalon
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
2018-10-29lib: reduce global variable usageFerruh Yigit
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>
2018-10-29fix global variable issuesFerruh Yigit
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>
2018-10-29add missing static keyword to globalsFerruh Yigit
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>
2018-10-29vfio: share default container in multi-processDarek Stojaczyk
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>
2018-10-29vfio: fix read of freed memory on getting container fdDarek Stojaczyk
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>
2018-10-29vfio: cleanup getting group fdDariusz Stojaczyk
Factor out duplicated code. Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com> Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
2018-10-29vfio: check if group fd is already openDariusz Stojaczyk
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>
2018-10-29eal: force IOVA to a particular modeEric Zhang
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>
2018-10-28eal: add --iova-mode optionSantosh Shukla
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>
2018-10-28vfio: fix sPAPR IOMMU mappingTakeshi Yoshimura
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>
2018-10-28mem: use address hint for mapping hugepagesAlejandro Lucero
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>
2018-10-28mem: add function for checking memseg IOVAAlejandro Lucero
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>
2018-10-28malloc: check size hint when reserving the biggest elementDarek Stojaczyk
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>
2018-10-28eal/linux: fix memory leak of logidZiye Yang
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>
2018-10-28ip_frag: fix overflow in key comparisonLi Han
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>
2018-10-27build: change default driver installation directoryLuca Boccassi
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>