Commit Graph

272 Commits

Author SHA1 Message Date
Stephen Hemminger
cd3e20a687 bus/vmbus: handle EOF on IRQ read
This function is not used by netvsc driver yet.
Still the code should handle case where device driver returns
zero (due to rescind).

Coverity issue: 302871
Fixes: 831dba47bd ("bus/vmbus: add Hyper-V virtual bus support")

Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
2018-08-07 14:41:51 +02:00
Stephen Hemminger
5ef90536d7 bus/vmbus: make sure path is null terminated
Use strlcpy rather than strncpy to avoid any issues about
null termination.

Coverity issue 302859
Fixes: 831dba47bd ("bus/vmbus: add Hyper-V virtual bus support")

Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
2018-08-07 14:41:47 +02:00
Stephen Hemminger
bca88be88a bus/vmbus: close directory in error path
Fix bug reported by Coverity where directory being scanned was
not closed in error path (leaking file descriptor).

Coverity issue: 302848
Fixes: 831dba47bd ("bus/vmbus: add Hyper-V virtual bus support")

Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
2018-08-07 14:41:40 +02:00
Stephen Hemminger
530af95a78 bus/vmbus: avoid signalling host on read
Don't signal host that receive ring has been read until all events
have been processed. This reduces the number of guest exits and
therefore improves performance.

Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
2018-08-05 11:03:18 +02:00
Anatoly Burakov
45fdc3ed87 vfio: revert retry logic for MSI-X BAR mapping
This reverts commit d4774a568b.

The patch is incomplete because kernel 4.16+, while being capable
of mapping MSI-X BARs, will also report if such a capability is
available. Without checking this capability, gratuitous errors
are displayed on kernels <4.16 while VFIO is attempting to mmap
MSI-X BAR and fails, which can be confusing to the user.

Fixes: d4774a568b ("vfio: fix workaround of BAR mapping")

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
2018-08-01 17:51:04 +02:00
Rami Rosen
73d1562103 bus/pci: fix a typo
This patch fixes a trivial typo in pci_common.c.

Fixes: 23eaa9059e ("bus/pci: use given name as generic name")
Cc: stable@dpdk.org

Signed-off-by: Rami Rosen <rami.rosen@intel.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
2018-07-26 21:23:16 +02:00
Takeshi Yoshimura
d4774a568b vfio: fix workaround of BAR mapping
Currently, VFIO will try to map around MSI-X table in the BARs. When
MSI-X table (page-aligned) size is equal to (page-aligned) size of BAR,
VFIO will just skip the BAR.

Recent kernel versions will allow VFIO to map the entire BAR containing
MSI-X tables (*), so instead of trying to map around the MSI-X vector
or skipping the BAR entirely if it's not possible, we can now try
mapping the entire BAR first. If mapping the entire BAR doesn't
succeed, fall back to the old behavior of mapping around MSI-X table or
skipping the BAR.

(*): "vfio-pci: Allow mapping MSIX BAR",
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
commit/?id=a32295c612c57990d17fb0f41e7134394b2f35f6

Fixes: 90a1633b23 ("eal/linux: allow to map BARs with MSI-X tables")

Signed-off-by: Takeshi Yoshimura <t.yoshimura8869@gmail.com>
Reviewed-by: Anatoly Burakov <anatoly.burakov@intel.com>
2018-07-26 11:34:08 +02:00
Qi Zhang
ab53203e19 vfio: enable unmapping resource for secondary
Subroutine to unmap VFIO resource is shared by secondary and
primary, and it does not work on the secondary process. Since
for secondary process, it is not necessary to close interrupt
handler, set pci bus mastering and remove vfio_res from
vfio_res_list. So, the patch adds a dedicate function to handle
the situation when a device is unmapped on a secondary process.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Reviewed-by: Anatoly Burakov <anatoly.burakov@intel.com>
2018-07-20 14:26:16 +02:00
Qi Zhang
2a3de3710f vfio: fix PCI address comparison
When use memcmp to compare two PCI address, sizeof(struct rte_pci_addr)
is 4 bytes aligned, and it is 8. While only 7 byte of struct rte_pci_addr
is valid. So compare the 8th byte will cause the unexpected result, which
happens when repeatedly attach/detach a device.

Fixes: 94c0776b1b ("vfio: support hotplug")
Cc: stable@dpdk.org

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Gaetan Rivet <gaetan.rivet@6wind.com>
2018-07-20 14:26:16 +02:00
Thomas Monjalon
c5e4612e72 bus/vmbus: fix build without libuuid
The dependency on libuuid is useless because the required code
is embedded in EAL, see commit 6bc67c497a ("eal: add uuid API").

Fixes: 831dba47bd ("bus/vmbus: add Hyper-V virtual bus support")

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
2018-07-15 23:41:58 +02:00
Stephen Hemminger
4e9c73e96e net/netvsc: add Hyper-V network device
The driver supports Hyper-V networking directly like
virtio for KVM or vmxnet3 for VMware.

This code is based off of the FreeBSD driver. The file and variable
names are kept the same to help with understanding (with most of the
BSD style warts removed).

This version supports the latest NetVSP 6.1 version and
older versions.

Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
2018-07-13 23:48:07 +02:00
Stephen Hemminger
831dba47bd bus/vmbus: add Hyper-V virtual bus support
This patch adds support for an additional bus type Virtual Machine BUS
(VMBUS) on Microsoft Hyper-V in Windows 10, Windows Server 2016
and Azure. Most of this code was extracted from FreeBSD and some of
this is from earlier code donated by Brocade.

Only Linux is supported at present, but the code is split
to allow future FreeBSD and Windows support.

The bus support relies on the uio_hv_generic driver from Linux
kernel 4.16. Multiple queue support requires additional sysfs
interfaces which is in kernel 5.0 (a.k.a 4.17).

Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
2018-07-13 23:48:07 +02:00
Hemant Agrawal
be20a3a423 bus/dpaa: support scatter/gather config
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
2018-07-12 14:42:25 +02:00
Hemant Agrawal
2aaffeee7b drivers: support function name in NXP logs
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2018-07-12 14:41:28 +02:00
Hemant Agrawal
fc0b416e11 bus/fslmc: cleanup unnecessary global variables
Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
2018-07-12 14:41:26 +02:00
Hemant Agrawal
7d9c4dfa4f bus/dpaa: cleanup unnecessary global variables
Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
2018-07-12 14:41:06 +02:00
Nipun Gupta
f40d5a53ec bus/dpaa: make vdqcr configurable
This patch add support for configurable vdqcr exact flag.
This boost the performance, however this can give
side effects for some extra packet fetch. Which has been
taken care in the patch as well.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2018-07-12 14:39:54 +02:00
Akhil Goyal
d6995aa332 bus/dpaa: add API to get MAC address
Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2018-07-12 14:36:22 +02:00
Hemant Agrawal
9abdad12b8 bus/dpaa: optimize fq callback routine
Avoid array of fq as packets are dq only from a single q.

Signed-off-by: Sunil Kumar Kori <sunil.kori@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2018-07-12 14:35:33 +02:00
Hemant Agrawal
0975e5df83 bus/dpaa: fix buffer offset setting in FMAN
The buffer offset was incorrectly being set at 64,
thus not honoring the packet headroom.

Fixes: 6d6b4f49a1 ("bus/dpaa: add FMAN hardware operations")
Cc: stable@dpdk.org

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2018-07-12 14:32:37 +02:00
Hemant Agrawal
28aca20e98 bus/dpaa: fix SVR id fetch location
Otherwise the SVR may not be available for dpaa init.

Fixes: 3b59b73dea ("bus/dpaa: update platform SoC value register routines")
Cc: stable@dpdk.org

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2018-07-12 14:32:13 +02:00
Alok Makhariya
a4f24c3707 bus/dpaa: fix phandle support for Linux 4.16
Fixes: 2183c6f69d ("bus/dpaa: add OF parser for device scanning")
Cc: stable@dpdk.org

Signed-off-by: Alok Makhariya <alok.makhariya@nxp.com>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2018-07-12 14:31:50 +02:00
Thomas Monjalon
f8e9989606 remove useless constructor headers
A constructor is usually declared with RTE_INIT* macros.
As it is a static function, no need to declare before its definition.
The macro is used directly in the function definition.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
2018-07-12 00:00:35 +02:00
Rafal Kozik
4a928ef9f6 bus/pci: enable write combining during mapping
Write combining (WC) increases NIC performance by making better
utilization of PCI bus, but cannot be used by all PMDs.

It will be enabled only if RTE_PCI_DRV_WC_ACTIVATE will be set in
drivers flags. For proper work also igb_uio driver must be loaded with
wc_activate set to 1.

When mapping PCI resources, firstly check if it support WC
and then try to use it.
In case of failure, it will fallback to normal mode.

Signed-off-by: Rafal Kozik <rk@semihalf.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2018-06-30 00:12:58 +02:00
Rafal Kozik
1d20a073fa bus/pci: reference driver structure before mapping
Add pointer to driver structure before calling rte_pci_map_device.
It allows to use driver flags for adjusting configuration.

Signed-off-by: Rafal Kozik <rk@semihalf.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2018-06-30 00:12:58 +02:00
Rami Rosen
e690338a7b bus/pci: remove unused function to detach by address
The function rte_pci_detach() is private to PCI and is
not used anywhere in current code base. Remove dead code.

Signed-off-by: Rami Rosen <rami.rosen@intel.com>
2018-06-27 22:54:08 +02:00
Stephen Hemminger
f3bac43b60 bus/pci: remove unused function to probe by address
The function rte_pci_probe_one is private to PCI and is
not used anywhere in current code base. Remove dead code.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2018-06-27 22:53:55 +02:00
Stephen Hemminger
5417dfc984 bus/pci: remove unused unbind function prototype
Prototype for pci_unbind_kernel_driver exists but no code.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Gaetan Rivet <gaetan.rivet@6wind.com>
2018-06-27 22:53:38 +02:00
Stephen Hemminger
607514e729 bus/pci: make remove function static
Only used in one file, and therefore can be made static.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Gaetan Rivet <gaetan.rivet@6wind.com>
2018-06-27 22:53:34 +02:00
Thomas Monjalon
ce819b8422 bus/dpaa: fix build
The DPAA bus driver is defining some macros without prefix.
So it can conflict with other libraries like libbsd:

	drivers/bus/dpaa/include/compat.h:53:
		error: "__packed" redefined
	/usr/include/bsd/sys/cdefs.h:120:
		note: this is the location of the previous definition

Fixes: 39f373cf01 ("bus/dpaa: add compatibility and helper macros")
Cc: stable@dpdk.org

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2018-06-21 10:27:45 +02:00
Thomas Monjalon
c4c4a0c057 bus/fslmc: fix export of unknown symbol
The function dpdmai_set_tx_queue() is not implemented,
so it is removed from the export map file.

Fixes: 23e8fcb018 ("bus/fslmc: support MC DPDMAI object")

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
2018-05-28 03:23:16 +02:00
Olivier Matz
f83a3d3fa8 use SPDX tag for 6WIND copyrighted files
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
2018-05-25 10:47:06 +02:00
Rosen Xu
bb5c82daa7 bus/ifpga: fix null pointer dereference in scan
Fix ifpga_scan_one() null pointer dereferences issue.

Coverity issue: 279454
Fixes: 05fa3d4a65 ("bus/ifpga: add Intel FPGA bus library")
Cc: stable@dpdk.org

Signed-off-by: Rosen Xu <rosen.xu@intel.com>
2018-05-22 19:16:26 +02:00
Rosen Xu
0898181974 bus/ifpga: fix memory leaks in scan
There are some resource leaks in ifpga_scan_one.
This patch fixes it.

Coverity issue: 279459
Fixes: 05fa3d4a65 ("bus/ifpga: add Intel FPGA bus library")
Cc: stable@dpdk.org

Signed-off-by: Rosen Xu <rosen.xu@intel.com>
2018-05-22 19:16:25 +02:00
Rosen Xu
07b4a8be61 bus/ifpga: fix error check in unplug
The control variable should be afu_dev not dev.

Coverity issue: 279455
Fixes: 05fa3d4a65 ("bus/ifpga: add Intel FPGA bus library")
Cc: stable@dpdk.org

Signed-off-by: Rosen Xu <rosen.xu@intel.com>
2018-05-22 19:15:58 +02:00
Thomas Monjalon
f14b264f65 bus/vdev: replace device list lock by a recursive one
A device like failsafe can manage sub-devices.
When removing such device, it removes its sub-devices
and try to take the same vdev_device_list_lock.
It was causing a deadlock because the lock was not recursive.

Fixes: 35f462839b ("bus/vdev: add lock on device list")

Suggested-by: Anatoly Burakov <anatoly.burakov@intel.com>
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Tested-by: Matan Azrad <matan@mellanox.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
2018-05-22 16:33:48 +02:00
Stephen Hemminger
999951c86b bus/vdev: fix double space in logs
The VDEV_LOG() macro already adds a newline, don't duplicate.

Fixes: d22fcb225c ("bus/vdev: change log type")
Cc: stable@dpdk.org

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2018-05-21 01:23:21 +02:00
Andy Green
52f711f7b8 bus/pci: fix size of driver name buffer
Variable dri_name is a pointer and it is incorrect to use its
size as the buffer size. Caller knows the buffer size and
it is safer to pass it explicitly.

Fixes: fe5f777b53 ("bus/pci: replace strncpy by strlcpy")
Cc: stable@dpdk.org

Signed-off-by: Andy Green <andy@warmcat.com>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
2018-05-15 15:19:13 +02:00
Andy Green
dd6f8d712e bus/dpaa: fix inconsistent struct alignment
The actual descriptor for qm_mr_entry is 64-byte aligned.

But the original code plays a trick, and puts a u8 common
to the three descriptor subtypes in the union afterwards
outside their structure definitions.

Unfortunately since they compose a struct qm_fd with
alignment 8, this trick destroys the ability of the compiler
to understand what has happened, resulting in this kind of
problem:

drivers/bus/dpaa/include/fsl_qman.h:354:3: error:
alignment 1 of ‘struct <anonymous>’ is less than 8 [-Werror=packed-not-aligned]
   } __packed dcern;

on gcc 8 / Fedora 28 out of the box.

This patch moves the u8 verb into the structure definitions
composed into the union, so the alignment of the parent struct
containing the alignment 8 object can also be seen to be
alignment 8 by the compiler.  Uses of .verb are fixed up to use
.ern.verb (the same offset of +0 inside all the structs in
the union).

The final struct layout should be unchanged.

Fixes: c47ff048b9 ("bus/dpaa: add QMAN driver core routines")
Fixes: f6fadc3e63 ("bus/dpaa: add QMAN interface driver")
Cc: stable@dpdk.org

Signed-off-by: Andy Green <andy@warmcat.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Tested-by: Hemant Agrawal <hemant.agrawal@nxp.com>
2018-05-14 23:32:23 +02:00
Andy Green
fe5f777b53 bus/pci: replace strncpy by strlcpy
In function ‘pci_get_kernel_driver_by_path’,
    inlined from ‘pci_scan_one.isra.1’ at
	drivers/bus/pci/linux/pci.c:317:8:
drivers/bus/pci/linux/pci.c:57:3: error:
‘strncpy’ specified bound depends on the length of the source argument
[-Werror=stringop-overflow=]
   strncpy(dri_name, name + 1, strlen(name + 1) + 1);

Fixes: d9a8cd9595 ("pci: add kernel driver type")
Cc: stable@dpdk.org

Signed-off-by: Andy Green <andy@warmcat.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
2018-05-14 23:32:23 +02:00
Shreyansh Jain
7c5efbb126 bus/fslmc: remove dead code
Coverity issue: 268338
Fixes: 828d51d8fc ("bus/fslmc: refactor scan and probe functions")
Cc: stable@dpdk.org

Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
2018-05-14 01:01:04 +02:00
Shreyansh Jain
58b7c9ceed bus/fslmc: fix memory leak and cleanup
Coverity issue: 268327
Fixes: 828d51d8fc ("bus/fslmc: refactor scan and probe functions")
Cc: stable@dpdk.org

Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
2018-05-14 01:01:03 +02:00
Hemant Agrawal
fe33fe37fd bus/dpaa: improve dynamic logging
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2018-05-14 00:37:18 +02:00
Hemant Agrawal
627b677014 bus/fslmc: improve debug logging
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2018-05-14 00:35:53 +02:00
Hemant Agrawal
50245be05d bus/fslmc: support device blacklisting
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2018-05-14 00:35:47 +02:00
Hemant Agrawal
6e0752205b bus/dpaa: support device blacklisting
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2018-05-14 00:34:25 +02:00
Pablo de Lara
4c80789430 bus/fpga: use strlcpy instead of strncpy
Gcc 8 reports a build error:

drivers/bus/ifpga/ifpga_bus.c:161:2: error: ‘strncpy’ specified
bound 256 equals destination size [-Werror=stringop-truncation]
  strncpy(afu_pr_conf.bs_path, path, sizeof(afu_pr_conf.bs_path));
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Fixes: 05fa3d4a65 ("bus/ifpga: add Intel FPGA bus library")

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
2018-05-13 12:06:01 +02:00
Rosen Xu
05fa3d4a65 bus/ifpga: add Intel FPGA bus library
Defined FPGA-BUS for Acceleration Drivers of AFUs

1. FPGA PCI Scan (1st Scan) follows DPDK UIO/VFIO PCI Scan Process,
probe Intel FPGA Rawdev Driver, it will be covered in following patches.

2. AFU Scan(2nd Scan) bind DPDK driver to FPGA Partial-Bitstream.
This scan is trigged by hotplug of IFPGA Rawdev probe, in this scan
the AFUs will be created and their drivers are also probed.

This patch will introduce rte_afu_device which describe the AFU device
listed in the FPGA-BUS.

Signed-off-by: Rosen Xu <rosen.xu@intel.com>
Signed-off-by: Tianfei Zhang <tianfei.zhang@intel.com>
Reviewed-by: Qi Zhang <qi.z.zhang@intel.com>
2018-05-11 17:08:32 +02:00
Hemant Agrawal
48743b0a53 crypto/dpaa2_sec: remove IOVA conversion for fle address
fle is already in virtual addressing mode - no need to perform
address conversion for it.

Fixes: 8d1f3a5d75 ("crypto/dpaa2_sec: support crypto operation")
Cc: stable@dpdk.org

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
2018-05-10 17:46:20 +01:00
Anatoly Burakov
0256386dc4 mem: add argument to memory event callback
It may be useful to pass arbitrary data to the callback (such
as device pointers), so add this to the mem event callback API.

Suggested-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Tested-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Acked-by: Maxime Coquelin <maxime.coquelin@redhat.com>
2018-05-08 22:28:58 +02:00