This fixes the following compile error with musl libc:
drivers/bus/fslmc/qbman/include/compat.h:41:10: error:
'stdout' undeclared (first use in this function)
fflush(stdout); \
^~~~~~
Fixes: 531b17a780 ("bus/fslmc: add QBMAN driver to bus")
Cc: stable@dpdk.org
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Fixes following build error with musl libc:
In file included from drivers/bus/fslmc/qbman/qbman_debug.c:6:
drivers/bus/fslmc/qbman/include/compat.h:21:10: fatal error:
error.h: No such file or directory
#include <error.h>
^~~~~~~~~
Apparently it is not used anywere in qbman so simply remove the include.
Fixes: 531b17a780 ("bus/fslmc: add QBMAN driver to bus")
Cc: stable@dpdk.org
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
The DPDK APIs expose 3 different modes to work with memory used for DMA:
1. Use the DPDK owned memory (backed by the DPDK provided hugepages).
This memory is allocated by the DPDK libraries, included in the DPDK
memory system (memseg lists) and automatically DMA mapped by the DPDK
layers.
2. Use memory allocated by the user and register to the DPDK memory
systems. Upon registration of memory, the DPDK layers will DMA map it
to all needed devices. After registration, allocation of this memory
will be done with rte_*malloc APIs.
3. Use memory allocated by the user and not registered to the DPDK memory
system. This is for users who wants to have tight control on this
memory (e.g. avoid the rte_malloc header).
The user should create a memory, register it through rte_extmem_register
API, and call DMA map function in order to register such memory to
the different devices.
The scope of the patch focus on #3 above.
Currently the only way to map external memory is through VFIO
(rte_vfio_dma_map). While VFIO is common, there are other vendors
which use different ways to map memory (e.g. Mellanox and NXP).
The work in this patch moves the DMA mapping to vendor agnostic APIs.
Device level DMA map and unmap APIs were added. Implementation of those
APIs was done currently only for PCI devices.
For PCI bus devices, the pci driver can expose its own map and unmap
functions to be used for the mapping. In case the driver doesn't provide
any, the memory will be mapped, if possible, to IOMMU through VFIO APIs.
Application usage with those APIs is quite simple:
* allocate memory
* call rte_extmem_register on the memory chunk.
* take a device, and query its rte_device.
* call the device specific mapping function for this device.
Future work will deprecate the rte_vfio_dma_map and rte_vfio_dma_unmap
APIs, leaving the rte device APIs as the preferred option for the user.
Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Gaetan Rivet <gaetan.rivet@6wind.com>
The fman device list need to be accessed across processes.
The hw device structures should be allocated with rte_calloc
instead of calloc. The rte_calloc is not available at the
time of bus scan, so better prepare the device list at probe.
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
A reference to qman_fq_lookup_table need to be saved in each
fq, so that it is retrieved while in running secondary process.
Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>
Current value of 'fmbm_rfsdm' register (0x010CE3F0) doesn't include
the bit to drop colored (red) packets. New value (0x010EE3F0) fixes
this.
Check with 'fmbm_rffc' register of fm_port_bmi_regs.
Fixes: 6d6b4f49a1 ("bus/dpaa: add FMAN hardware operations")
Cc: stable@dpdk.org
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
The fslmc bus code was duplicating the device name and
doing extra initialization. The code can be simplified
to just use the device name directly.
Compile tested only; do not have this hardware.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
When fslmc is built as part of a general distribution, the
bus code will log errors when other devices are present.
This could confuse users it is not an error.
Fixes: 50245be05d ("bus/fslmc: support device blacklisting")
Cc: stable@dpdk.org
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: Ilya Maximets <i.maximets@samsung.com>
The secondary mapping function was duplicating the code
used to search the uio_resource list.
Skip the unwinding since map failure already makes device
unusable.
Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
Need to remember primary channel in secondary process.
Then use it to iterate over subchannels in secondary
process mapping setup.
Fixes: 831dba47bd ("bus/vmbus: add Hyper-V virtual bus support")
Cc: stable@dpdk.org
Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
If vmbus is run on older kernel (without all the uio mappings),
then the bus driver should stop when it hits the missing mappings
rather than recording the empty values.
Fixes: 831dba47bd ("bus/vmbus: add Hyper-V virtual bus support")
Cc: stable@dpdk.org
Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
The code was testing the result of mmap incorrectly.
I.e the test that a local pointer is not MAP_FAILED would
always succeed and therefore hid any potential problems.
Fixes: 831dba47bd ("bus/vmbus: add Hyper-V virtual bus support")
Cc: stable@dpdk.org
Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
The secondary process doesn't correctly map the second
and later resources because it doesn't change the offset.
Fixes: 831dba47bd ("bus/vmbus: add Hyper-V virtual bus support")
Cc: stable@dpdk.org
Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
All drivers should have SPDX on the first line of the source
files in the format
/* SPDX-License-Identifier: ...
Several files used minor modifications which were inconsistent
with the pattern. Fix it to make scanning tools easier.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Rename the macro and all instances in DPDK code, but keep a copy of
the old macro defined for legacy code linking against DPDK
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Rename the macro to make things shorter and more comprehensible. For
both meson and make builds, keep the old macro around for backward
compatibility.
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
The term "linuxapp" is a legacy one, but just calling the subdirectory
"linux" is just clearer for all concerned.
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
In case vdev was already probed, it shouldn't be probed again,
and it should return -EEXIST as error.
There are some checks in vdev_probe() and insert_vdev(),
but a check was missing in vdev_plug().
The check is moved in vdev_probe_all_drivers() which is called
in all code paths.
Fixes: e9d159c3d5 ("eal: allow probing a device again")
Cc: stable@dpdk.org
Signed-off-by: Raslan Darawsheh <rasland@mellanox.com>
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
The log was printing the device name two times,
first one being supposed to be the driver name.
As we don't know yet the driver name, the log is simplified.
Fixes: 9bf4901d1a ("bus/vdev: remove probe with driver name option")
Cc: stable@dpdk.org
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Rami Rosen <ramirose@gmail.com>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
In the original code, when an AFU device probe a driver,
if the first driver in the driver list does not support
this device or some error happens, bus probe returns an error.
With this patch, a device will try to match driver in the driver
list one by one until an appropriate driver is found.
If some error happens, the error is returned. If the current driver
does not support the device, just try the next driver in the list.
If all the drivers in the list are tried and no driver matches,
0 is returned. Otherwise, the error code is returned.
Fixes: 05fa3d4a65 ("bus/ifpga: add Intel FPGA bus library")
Cc: stable@dpdk.org
Signed-off-by: Andy Pei <andy.pei@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Rosen Xu <rosen.xu@intel.com>
Original driver requires users to input "afu_bts" args.
But driver can also work without an explicit "afu_bts" args.
Fixes: 05fa3d4a65 ("bus/ifpga: add Intel FPGA bus library")
Cc: stable@dpdk.org
Signed-off-by: Andy Pei <andy.pei@intel.com>
Acked-by: Rosen Xu <rosen.xu@intel.com>
sprintf function is not secure as it doesn't check the length of string.
More secure function snprintf is used
Fixes: 828d51d8fc ("bus/fslmc: refactor scan and probe functions")
Fixes: c22fab9a6c ("raw/dpaa2_qdma: support configuration APIs")
Fixes: e5cbdfc537 ("crypto/dpaa2_sec: add basic operations")
Fixes: b23d4e898a ("crypto/dpaa2_sec: add per dev mempool to store FLE")
Fixes: 623326dded ("crypto/dpaa2_sec: introduce poll mode driver")
Fixes: e7a45f3cc2 ("crypto/caam_jr: add UIO specific operations")
Fixes: f44bccadd8 ("crypto/caam_jr: add device basic operations")
Fixes: 7e3e2954e0 ("crypto/dpaa_sec: move mempool allocation to config")
Fixes: c3e85bdcc6 ("crypto/dpaa_sec: add crypto driver for NXP DPAA platform")
Cc: stable@dpdk.org
Signed-off-by: Pallantla Poornima <pallantlax.poornima@intel.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
Previously FSLMC bus only supported blacklisting of DPNI (eth),
DPSECI (crypto) devices. With this patch, devices like DPIO,
DPMCP, and other DP* can also be blacklisted/whitelisted.
This is a required condition for secondary processes where the
secondary needs to be passed a mutually exclusive list of
resources as compared the primary and all other secondaries.
This patch also moves the DPIO memory from malloc to hugepage so
that in future in case the DPIO list can be shared, it can be
accessed in secondaries.
Once this patch is done, multi-process cases can be executed by
whitelisting/blacklisting devices in each instance.
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
The I/O threads for DPAA2 take their reference for bpool ID, the
port ID and other info like qdid, from the rte_eth_dev. Further,
to get this data during I/O operation, a reference of the RTE
device is kept in the queue structure (dpaa2_queue).
In case of secondary processes, rte_eth_dev is not same as the
primary process. Thus, the reference goes invalid.
This patch changes the implementation to use the dev_private
rather than the rte_eth_dev as that is shared area across
all the processes.
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
Initial design was to have the buffer pool per process where a
global static array stores the bpids. But, in case of secondary
processes, this would not allow the I/O threads to translate the
bpid in Rx'd packets.
This patch moves the array to a global area (rte_malloc) and in
case of Rx thread not containing a valid reference to the array,
reference is build using the handle avaialble in the dpaa2_queue.
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
Add support in bus and vfio to scan dpdmux type of objects
Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
This is to align with the latest qbman hw library
Signed-off-by: Youri Querry <youri.querry_1@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Add flag in portal init to adjust the qbman memory type,
to decide between legacy portal mode or newly introduced
memory backed portals.
Signed-off-by: Roy Pledge <roy.pledge@nxp.com>
Signed-off-by: Youri Querry <youri.querry_1@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
This patch upgrades and sync the dpdk based qbman code
with new version of qbman flib.
Signed-off-by: Youri Querry <youri.querry_1@nxp.com>
Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Current code expects that bus->parse() would get a string containing
the name of the bus. That is incorrect. bus->parse() is expected
to have strings like:
dpni.1,key=val
dpio.2,key=val
when user passed:
-b fslmc:dpni.1,key=val
This commit fixes this behavior.
Fixes: 50245be05d ("bus/fslmc: support device blacklisting")
Cc: stable@dpdk.org
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
This is just a information. No need to print
it as a error.
Fixes: ce9efbf5bb ("bus/fslmc: support dynamic logging")
Cc: stable@dpdk.org
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Existing code is using the lcore id as the physical core
id. Add code to get the right physical id.
Also, dpaa2 can not support one lcore mapping to multiple cpus,
print err on such cases.
Fixes: ce9efbf5bb ("bus/fslmc: support dynamic logging")
Cc: stable@dpdk.org
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
The code was incorrectly using the cache inhibited access.
It shall use cached enabled access for better performance.
Fixes: 293c0ca94c ("bus/fslmc: support memory backed portals with QBMAN 5.0")
Cc: stable@dpdk.org
Signed-off-by: Youri Querry <youri.querry_1@nxp.com>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
The code was treating the lcore id as physical core id.
The code is updated to use actual physical core value
for any core affinity logic.
Note that DPAA devices are single cluster systems.
Fixes: 5d944582d0 ("bus/dpaa: check portal presence in the caller function")
Cc: stable@dpdk.org
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
With a larger PAGE_SIZE it is possible for the MSI table to very
close to the end of the BAR s.t. when we align the start and end
of the MSI table to the PAGE_SIZE, the end offset of the MSI
table is out of the PCI BAR boundary.
This patch addresses the issue by comparing both the start and the
end offset of the MSI table with the BAR size, and skip the mapping
if it is out of Bar scope.
The patch fixes the debug log as below:
EAL: Skipping BAR0
Signed-off-by: Tone Zhang <tone.zhang@arm.com>
Reviewed-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Reviewed-by: Steve Capper <steve.capper@arm.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
The DPAA bus support code put out messages like:
dpaax: read_memory_node(): Unable to glob device-tree memory node:
(/proc/device-tree/memory[@0-9]*/reg)(3)
dpaax: PA->VA translation not available;
dpaax: Expect performance impact.
These are unnecessary and likely to confuse the end user.
Fix this by doing nothing if bus is empty.
Fixes: 5a7dbb934d ("dpaa: enable dpaax library")
Cc: stable@dpdk.org
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
When using multiple queues, there was a race with the kernel
in setting up the second channel. This regression is due to a kernel change
which does not allow accessing sysfs files for Hyper-V channels that are not opened.
The fix is simple, just move the logic to detect not ready
sub channels earlier in the existing loop.
Fixes: 831dba47bd ("bus/vmbus: add Hyper-V virtual bus support")
Cc: stable@dpdk.org
Reported-by: Mohammed Gamal <mgamal@redhat.com>
Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
Setting up a device that wasn't setup in the primary
process will possibly break the primary process. That's
because the IPC message to retrieve the group fd in the
primary will also *open* that group if it wasn't opened
before. Even though the secondary process closes that fd
soon after as a part of its error handling path, the
primary process leaks it.
What's worse, opening that fd on the primary will
increment the process-local counter of opened groups.
If it was 0 before, then the group will never be added
to the vfio container, nor dpdk memory will be ever
mapped.
This patch moves the proper error checks earlier in the
code to fully prevent setting up devices in secondary
processes that weren't setup in the primary process.
Fixes: 2f4adfad0a ("vfio: add multiprocess support")
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
The pci_resource_by_index called strlen() on uninitialized
memory which would lead to the wrong size of memory allocated
for the path portion of the resource map. This would either cause
excessively large allocation, or worse memory corruption.
Coverity issue: 300868
Fixes: ea9d56226e ("pci: introduce function to map uio resource by index")
Cc: stable@dpdk.org
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
drivers/bus/pci/linux/pci_vfio.c:45:23: error:
‘failure_handle_lock’ defined but not used
Fixes: 8ffe738651 ("vfio: add lock for hot-unplug failure handler")
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
When the sigbus handler be enabled for hot-unplug, whatever hot-unplug
sigbus or origin sigbus occur, the sigbus handler will be invoked and
it will access the bus and device. While in the control path, the vfio
req handler also will process the bus and device, so a protection of
the resources in vfio req handler should be need. This patch add a lock
in vfio req handler when process bus and device resource, to avoid the
synchronization issue when device be hot-unplugged.
Fixes: c115fd000c ("vfio: handle hotplug request notifier")
Signed-off-by: Jeff Guo <jia.guo@intel.com>
If sysfs directory was incorrectly formatted then the vmbus
setup code would leak a directory handle in the error path.
Coverity issue: 302848
Fixes: 831dba47bd ("bus/vmbus: add Hyper-V virtual bus support")
Cc: stable@dpdk.org
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>