Commit Graph

25 Commits

Author SHA1 Message Date
Bruce Richardson
adf93ca564 build: increase readability via shortcut variables
Define variables for "is_linux", "is_freebsd" and "is_windows"
to make the code shorter for comparisons and more readable.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
Acked-by: Luca Boccassi <bluca@debian.org>
2019-04-17 18:09:52 +02:00
Stephen Hemminger
cc7cd517b1 net/vdev_netvsc: fix device cast
The return value from bus->find_device is a rte_device
which is not safe to cast to a rte_vdev_device structure.
It doesn't really matter since only being checked for NULL
but static checkers might find a bug here.

Fixes: 56252de779 ("net/vdev_netvsc: add automatic probing")
Cc: stable@dpdk.org

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Matan Azrad <matan@mellanox.com>
2019-03-29 17:25:31 +01:00
Stephen Hemminger
08078fda3c net/vdev_netvsc: get rid of unnecessary debug log message
If vdev_netvsc is run with debug logging enabled, then the
log output will fill with:
	net_vdev_netvsc: interface lo is non-ethernet device

Remove the message since it is not useful.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Matan Azrad <matan@mellanox.com>
2018-12-13 16:31:06 +00:00
Agalya Babu RadhaKrishnan
477f0d38b4 net/vdev_netvsc: disable in FreeBSD build with meson
Disabled vdev_netvsc build in FreeBSD because it is not supported.
Added changes to enable vdev_netvsc build if it is Linux OS and
disable in FreeBSD.

Fixes: 9fc43dbfd6 ("net/vdev_netvsc: add in meson build")

Signed-off-by: Agalya Babu RadhaKrishnan <agalyax.babu.radhakrishnan@intel.com>
Acked-by: Stephen Hemminger <sthemmin@microsoft.com>
2018-10-27 18:03:33 +02:00
Ferruh Yigit
9631253ffa drivers/net: fix log type string
Syntax for log type string is "pmd.<subsystem>.<driver>[.<pmd_local>]"

Fixes: 3e92fd4e4e ("net/bnxt: use dynamic log type")
Fixes: d7f4562ab1 ("net/bonding: convert to dynamic logging")
Fixes: 6086ab3bb3 ("net/vdev_netvsc: introduce Hyper-V platform driver")
Fixes: 7db274b9ad ("doc: describe dynamic logging format")
Fixes: a10a988a0b ("net/dpaa2: support dynamic logging")
Cc: stable@dpdk.org

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
2018-10-11 18:53:49 +02:00
Luca Boccassi
9fc43dbfd6 net/vdev_netvsc: add in meson build
Signed-off-by: Luca Boccassi <bluca@debian.org>
2018-09-18 22:49:39 +02:00
Matan Azrad
83d63f0903 net/vdev_netvsc: fix automatic probing
The vdev_netvsc driver allows an automatic probe in Hyper-V VM systems
unless it was already specified by the EAL command line.

The detection of a specified NetVSC device is wrongly done by comparing
the vdev_netvsc driver name to all the vdev devices names, including
the suffix device index. Thus, if the user specifies the vdev_netvsc
device by adding an index to the device name, the comparison fails.
Consequently, the vdev_netvsc driver may automatically probe NetVSC
devices, despite the NetVSC device that was specified by the EAL command
line.

Compare the vdev_netvsc driver name to the devices names without the
index.

Fixes: 56252de779 ("net/vdev_netvsc: add automatic probing")
Cc: stable@dpdk.org

Signed-off-by: Matan Azrad <matan@mellanox.com>
2018-05-23 00:35:01 +02:00
Andy Green
d7a13d2d1c net/vdev_netvsc: replace strncpy by strlcpy
Continue snprintf to strlcpy conversions started by commit
c022cb400e ("convert snprintf to strlcpy").

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
Andy Green
2e4d2e563f net/vdev_netvsc: readlink inputs cannot be aliased
drivers/net/vdev_netvsc/vdev_netvsc.c:335:2:error:
passing argument 2 to restrict-qualified parameter aliases with argument 1
  ret = readlink(buf, buf, size);
  ^~~

Fixes: e7dc5d7bec ("net/vdev_netvsc: implement core functionality")
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
Matan Azrad
4205da3a47 net/vdev_netvsc: prefer netvsc devices in scan
There is an option to run a non-netvsc device as a netvsc device only
when the "force" parameter is set to 1 in the EAL command line.
Consequently, more than one device may be found to be matching the
"mac" parameter specifying the device.

Prefer netvsc devices to be scanned before any non-netvsc device, even
when the "force" parameter is set.

Cc: stable@dpdk.org

Signed-off-by: Matan Azrad <matan@mellanox.com>
2018-04-27 17:34:42 +01:00
Matan Azrad
118d2f8096 net/vdev_netvsc: add check for specifying by 1 way
There are now 2 ways to specify a netvsc device by the EAL command
line - either by the interface name or by the MAC address.

The user should not specify a netvsc device using more than 1 way,
Thus, if a device is specified in more than 1 way, the driver stops
to probe it.

Validate it in the driver initialization.

Cc: stable@dpdk.org

Signed-off-by: Matan Azrad <matan@mellanox.com>
2018-04-27 17:34:42 +01:00
Matan Azrad
0b39cc820a net/vdev_netvsc: remove specified devices IP check
If the netvsc driver starts in blacklist mode, it does not
automatically probe IP associated netvsc devices. Therefore, the only
way to probe them is to specify them by the EAL command line, using the
"force" parameter to skip the IP check in the driver.

>From now on, the user does not need to add the "force" parameter if he
specifies an IP associated netvsc device by the EAL command line, and the
responsibility of the IP check is now in the user's hands.

However, in the absence of any specification, the driver still skips IP
associated netvsc devices.

Cc: stable@dpdk.org

Signed-off-by: Matan Azrad <matan@mellanox.com>
2018-04-27 17:34:42 +01:00
Ophir Munk
519fb2858e net/vdev_netvsc: shorten devices names
Prior to this commit the vdev_netvsc PMD was creating tap and failsafe
devices with long names, such as "net_tap_net_vdev_netvsc0" or
"net_failsafe_net_vdev_netvsc0".
This commits creates tap and failsafe devices with short names such as
"net_tap_netvsc0" or "net_failsafe_netvsc0".

Signed-off-by: Ophir Munk <ophirmu@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
2018-04-27 17:34:42 +01:00
Gaetan Rivet
b65ecf1993 devargs: rename legacy API
The previous symbols were deprecated for two releases.
They are now marked as such and cannot be used anymore.

They are replaced by ones respecting the new namespace that are marked
experimental.

As a result, eth_dev attach and detach are slightly reworked to follow
the changes.

Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
2018-04-25 04:00:37 +02:00
Gaetan Rivet
efbeaee040 net/vdev_netvsc: do not reference devargs list
This list should not be used by drivers.
Use the public API instead.

Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
2018-04-25 03:58:11 +02:00
Shahaf Shuler
5feecc57d9 align SPDX Mellanox copyrights
Aligning Mellanox SPDX copyrights to a single format.
In addition replace to SPDX licence files which were missed.

Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2018-04-11 01:47:47 +02:00
Matan Azrad
b0c0efb4fd net/vdev_netvsc: fix routed devices probing
NetVSC netdevices which are already routed should not be probed because
they are used for management purposes by the HyperV.

The corrupted code got the routed devices from the system file
/proc/net/route and wrongly parsed only the odd lines, so devices which
their routes were in even lines, were considered as unrouted devices
and were probed.

Use linux netlink lib to detect the routed NetVSC devices instead of
file parsing.

Fixes: 31182fadfb ("net/vdev_netvsc: skip routed netvsc probing")
Cc: stable@dpdk.org

Suggested-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Matan Azrad <matan@mellanox.com>
2018-03-30 14:08:43 +02:00
Matan Azrad
f99b4b07a6 net/vdev_netvsc: fix device detection error check
The vdev_netvsc driver does periodic detection of PCI devices matched
to the netvsc existed interfaces.

When it finds a match, the PCI address is written to the pipe of the
associated fail-safe PMD instance and a positive value is returned to
the periodic check which is wrongly considered as error.

Change the check to consider only a negative value as error.

Fixes: e7dc5d7bec ("net/vdev_netvsc: implement core functionality")

Signed-off-by: Matan Azrad <matan@mellanox.com>
2018-02-05 19:56:04 +01:00
Neil Horman
a6ec31597a mk: add experimental tag check
Add checks during build to ensure that all symbols in the EXPERIMENTAL
version map section have __experimental tags on their definitions, and
enable the warnings needed to announce their use.  Also add an
ALLOW_EXPERIMENTAL_APIS define to allow individual libraries and files
to declare the acceptability of experimental api usage

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
2018-01-29 23:35:29 +01:00
Ophir Munk
788203582c net/vdev_netvsc: fix build without C11 and pedantic
Remove CFLAGS -std=c11 and -pedantic in order to guarantee
a successful vdev_netvsc compilation on old Linux distributions.
Otherwise old GCC compilers may complain as follows:
cc1: error: unrecognized command line option -std=c11

Fixes: 6086ab3bb3 ("net/vdev_netvsc: introduce Hyper-V platform driver")

Signed-off-by: Ophir Munk <ophirmu@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
2018-01-24 19:06:31 +01:00
Matan Azrad
56252de779 net/vdev_netvsc: add automatic probing
Using DPDK in Hyper-V VM systems requires vdev_netvsc driver to pair
the NetVSC netdev device with the same MAC address PCI device by
fail-safe PMD.

Add vdev_netvsc custom scan in vdev bus to allow automatic probing in
Hyper-V VM systems unless it was already specified by command line.

Add "ignore" parameter to disable this auto-detection.

Signed-off-by: Matan Azrad <matan@mellanox.com>
2018-01-21 15:51:52 +01:00
Matan Azrad
658dea3a5e net/vdev_netvsc: add force parameter
This parameter allows specifying any non-NetVSC interface or routed
NetVSC interfaces to use with tap sub-devices for development purposes.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Signed-off-by: Matan Azrad <matan@mellanox.com>
2018-01-21 15:51:52 +01:00
Matan Azrad
31182fadfb net/vdev_netvsc: skip routed netvsc probing
NetVSC netdevices which are already routed should not be probed because
they are used for management purposes by the HyperV.

prevent routed netvsc devices probing.

Signed-off-by: Raslan Darawsheh <rasland@mellanox.com>
Signed-off-by: Matan Azrad <matan@mellanox.com>
2018-01-21 15:51:52 +01:00
Matan Azrad
e7dc5d7bec net/vdev_netvsc: implement core functionality
As described in more details in the attached documentation (see patch
contents), this virtual device driver manages NetVSC interfaces in virtual
machines hosted by Hyper-V/Azure platforms.

This driver does not manage traffic nor Ethernet devices directly; it acts
as a thin configuration layer that automatically instantiates and controls
fail-safe PMD instances combining tap and PCI sub-devices, so that each
NetVSC interface is exposed as a single consolidated port to DPDK
applications.

PCI sub-devices being hot-pluggable (e.g. during VM migration),
applications automatically benefit from increased throughput when present
and automatic fallback on NetVSC otherwise without interruption thanks to
fail-safe's hot-plug handling.

Once initialized, the sole job of the vdev_netvsc driver is to regularly
scan for PCI devices to associate with NetVSC interfaces and feed their
addresses to corresponding fail-safe instances.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Signed-off-by: Matan Azrad <matan@mellanox.com>
2018-01-21 15:51:52 +01:00
Matan Azrad
6086ab3bb3 net/vdev_netvsc: introduce Hyper-V platform driver
This patch lays the groundwork for this driver (draft documentation,
copyright notices, code base skeleton and build system hooks). While it can
be successfully compiled and invoked, it's an empty shell at this stage.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Signed-off-by: Matan Azrad <matan@mellanox.com>
2018-01-21 15:51:52 +01:00