net/mlx5: change non failing function return values
These functions return int although they are not supposed to fail,
resulting in unnecessary checks in their callers.
Some are returning error where is should be a boolean.
Tomasz Duszynski [Thu, 15 Mar 2018 12:12:21 +0000 (13:12 +0100)]
net/mrvl: fix Rx descriptors number
Since filling hardware buffer pool (bpool) is Rx related
constant describing maximum number of rx descriptors
instead of maximum number of Tx descriptors should be used.
Fixes: 0ddc9b815b11 ("net/mrvl: add net PMD skeleton") Cc: stable@dpdk.org Signed-off-by: Marcin Wojtas <mw@semihalf.com> Signed-off-by: Tomasz Duszynski <tdu@semihalf.com>
Vipin Varghese [Mon, 12 Mar 2018 21:53:52 +0000 (03:23 +0530)]
net/tap: allow user MAC to be passed as args
Allow TAP PMD to pass user desired MAC address as argument.
The argument value is processed as string delimited by ':',
is parsed and converted to HEX MAC address after validation.
Use new rte_eth_linkstatus_get/set helper functions to handle link
status update.
This driver was not doing atomic update of link status information.
And the return value was different than others.
The hardware also does not do autonegotiation (at least on Linux).
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Many drivers are all doing copy/paste of the same code to atomically
update the link status. Reduce duplication, and allow for future
changes by having common function for this.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
To handle atomic update of link status (64 bit), every driver
was doing its own version using cmpset.
Atomic exchange is a useful primitive in its own right;
therefore make it a EAL routine.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com> Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Chas Williams [Wed, 17 Jan 2018 15:04:57 +0000 (10:04 -0500)]
net/vmxnet3: keep consistent link status
Bonding may examine the link properties to ensure that matching interfaces
are bound together. If the link is going to have fixed properties,
these need to remain consistent regardless of the link_status or the
state of the adapter.
Signed-off-by: Chas Williams <chas3@att.com> Acked-by: Shrikrishna Khare <skhare@vmware.com>
Chas Williams [Wed, 17 Jan 2018 15:04:56 +0000 (10:04 -0500)]
net/vmxnet3: set the queue shared buffer at start
If a reconfiguration happens, queuedesc is reallocated. Any queues that
are preserved point to the previous queuedesc since the queues are only
configured during queue setup. Delay configuration of the shared queue
pointers until device start when queuedesc is no longer changing.
Fixes: 8618d19b52b1 ("net/vmxnet3: reallocate shared memzone on re-config") Cc: stable@dpdk.org Signed-off-by: Chas Williams <chas3@att.com> Acked-by: Shrikrishna Khare <skhare@vmware.com>
Glue object files are looked up in RTE_EAL_PMD_PATH by default when set and
should be installed in this directory.
During startup, EAL attempts to load them automatically like other plug-ins
found there. While normally harmless, dlopen() fails when rdma-core is not
installed, EAL interprets this as a fatal error and terminates the
application.
This patch requests glue objects to be installed in a different directory
to prevent their automatic loading by EAL since they are PMD helpers, not
actual DPDK plug-ins.
Fan Zhang [Thu, 8 Mar 2018 12:17:52 +0000 (12:17 +0000)]
net/i40e: fix link update no wait
In i40e_dev_link_update() the driver obtains the link status
info via admin queue command despite of "no_wait" flag. This
requires relatively long time and may be a problem to some
application such as ovs-dpdk.
(https://bugzilla.redhat.com/show_bug.cgi?id=1551761).
This patch aims to fix the problem by using a different
approach of obtaining link status for i40e NIC without waiting.
Instead of getting the link status via admin queue command,
this patch reads the link status registers to accelerate the
procedure.
Fixes: 263333bbb7a9 ("i40e: fix link status timeout") Cc: stable@dpdk.org Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com> Signed-off-by: Andrey Chilikin <andrey.chilikin@intel.com> Reviewed-by: Eelco Chaudron <echaudro@redhat.com> Tested-by: Eelco Chaudron <echaudro@redhat.com> Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
Ilya Maximets [Mon, 26 Feb 2018 08:39:00 +0000 (09:39 +0100)]
vhost: add note about sockets in server mode
From time to time, someone sends patches about unlinking existing
sockets when registering a vhost user in server mode.
A recent example:
http://dpdk.org/ml/archives/dev/2018-February/090025.html
This problem has been discussed many times, and it was made clear that
the library should not unlink files given by the application in order
to avoid possible security problems, such as removing random files
used by other programs.
One of the first discussions:
http://dpdk.org/ml/archives/dev/2015-December/030326.html
To avoid such patches in the future, it was decided to add a comment
that explains what is happening and tries to describe the reasoning.
Signed-off-by: Ilya Maximets <i.maximets@samsung.com> Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Hyong Youb Kim [Thu, 8 Mar 2018 02:46:59 +0000 (18:46 -0800)]
net/enic: support Rx queue interrupts
Enable rx queue interrupts if the app requests them, and vNIC has
enough interrupt resources. Use interrupt vector 0 for link status and
errors. Use vector 1 for rx queue 0, vector 2 for rx queue 1, and so
on. So, with n rx queues, vNIC needs to have at n + 1 interrupts.
For VIC, enabling and disabling rx queue interrupts are simply
mask/unmask operations. VIC's credit based interrupt moderation is not
used, as the app wants to explicitly control when to enable/disable
interrupts.
This version requires MSI-X (vfio-pci). Sharing one interrupt for link
status and rx queues is possible, but is rather complex and has no
user demands.
Signed-off-by: Hyong Youb Kim <hyonkim@cisco.com> Reviewed-by: John Daley <johndale@cisco.com>
Hyong Youb Kim [Thu, 8 Mar 2018 02:46:58 +0000 (18:46 -0800)]
net/enic: allocate stats DMA buffer upfront during probe
The driver provides a DMA buffer to the firmware when it requests port
stats. The NIC then fills that buffer with latest stats. Currently,
the driver allocates the DMA buffer the first time it requests stats
and saves it for later use. This can lead to crashes when
primary/secondary processes are involved. For example, the following
sequence crashes the secondary process.
1. Start a primary app that does not call rte_eth_stats_get()
2. dpdk-procinfo -- --stats
dpdk-procinfo crashes while trying to allocate the stats DMA buffer
because the alloc function pointer (vdev.alloc_consistent) is valid
only in the primary process, not in the secondary process.
Overwriting the alloc function pointer in the secondary process is not
an option, as it will simply make the pointer invalid in the primary
process. Instead, allocate the DMA buffer during probe so that only
the primary process does both allocate and free. This allows the
secondary process to dump stats as well.
Fixes: 9913fbb91df0 ("enic/base: common code") Cc: stable@dpdk.org Signed-off-by: Hyong Youb Kim <hyonkim@cisco.com> Reviewed-by: John Daley <johndale@cisco.com>
Hyong Youb Kim [Thu, 8 Mar 2018 02:46:56 +0000 (18:46 -0800)]
net/enic: remove VLAN filter handler
VIC does not support VLAN filtering at the moment. The firmware does
accept the filter add/del commands and returns success. But, they are
no-ops. To avoid confusion, remove the filter set handler so the app
sees an error instead of silent failure.
Also during the device configure time, enicpmd_vlan_offload_set would
not print a warning message about unsupported VLAN filtering, because
the caller specifies only ETH_VLAN_STRIP_MASK. This is wrong, as we
should attempt to apply all requested offloads at the configure
time. So, pass all VLAN offload masks, which triggers a warning
message about VLAN filtering, if requested.
Finally, enicpmd_vlan_offload_set should check both mask and
rxmode.offloads, not just mask.
Signed-off-by: Hyong Youb Kim <hyonkim@cisco.com> Reviewed-by: John Daley <johndale@cisco.com>
Hyong Youb Kim [Thu, 8 Mar 2018 02:46:55 +0000 (18:46 -0800)]
net/enic: heed the requested max Rx packet size
Currently, enic completely ignores the requested max Rx packet size
(rxmode.max_rx_pkt_len). The desired behavior is that the NIC hardware
drops packets larger than the requested size, even though they are
still smaller than MTU.
Cisco VIC does not have such a feature. But, we can accomplish a
similar (not same) effect by reducing the size of posted receive
buffers. Packets larger than the posted size get truncated, and the
receive handler drops them. This is also how the kernel enic driver
enforces the Rx side MTU.
This workaround works only when scatter mode is *not* used. When
scatter is used, there is currently no way to support
rxmode.max_rx_pkt_len, as the NIC always receives packets up to MTU.
For posterity, add a copious amount of comments regarding the
hardware's drop/receive behavior with respect to max/current MTU.
Signed-off-by: Hyong Youb Kim <hyonkim@cisco.com> Reviewed-by: John Daley <johndale@cisco.com>
Hyong Youb Kim [Thu, 8 Mar 2018 02:46:54 +0000 (18:46 -0800)]
net/enic: allow to change RSS settings
Currently, when more than 1 receive queues are configured, the driver
always enables RSS with the driver's own default hash type, key, and
RETA. The user is unable to change any of the RSS settings. Address
this by implementing the ethdev RSS API as follows.
Correctly report the RETA size, key size, and supported hash types
through rte_eth_dev_info.
During dev_configure(), initialize RSS according to the device's
mq_mode and rss_conf. Start with the default RETA, and use the default
key unless a custom key is provided.
Add the RETA and rss_conf query/set handlers to let the user change
RSS settings after the initial configuration. The hardware is able to
change hash type, key, and RETA individually. So, the handlers change
only the affected settings.
Refactor/rename several functions in order to make their intentions
clear. For example, remove all traces of RSS from
enicpmd_vlan_offload_set() as it is confusing.
Signed-off-by: Hyong Youb Kim <hyonkim@cisco.com> Reviewed-by: John Daley <johndale@cisco.com>
Roman Zhukov [Tue, 6 Mar 2018 15:24:58 +0000 (15:24 +0000)]
net/sfc: avoid creation of ineffective flow rules
Despite being versatile, the hardware support for filtering has a number
of special properties which must be taken into account. Namely, there is
a known set of valid filters which don't take any effect despite being
accepted by the hardware.
The combinations of match flags and field values which can describe the
exceptional filters are as follows:
- ETHER_TYPE or ETHER_TYPE | LOC_MAC with IPv4 or IPv6 EtherType
- ETHER_TYPE | IP_PROTO or ETHER_TYPE | IP_PROTO | LOC_MAC with UDP or
TCP IP protocol value
- The same combinations with OUTER_VID and/or INNER_VID
These exceptional filters can be expressed in terms of RTE flow rules.
If the user creates such a flow rule, no traffic will hit the underlying
filter, and no errors will be reported.
This patch adds a means to prevent such ineffective flow rules from
being created.
Signed-off-by: Roman Zhukov <roman.zhukov@oktetlabs.ru> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com> Reviewed-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Roman Zhukov [Tue, 6 Mar 2018 15:24:57 +0000 (15:24 +0000)]
net/sfc: multiply of specs with an unknown destination MAC
To filter all traffic, need to create two hardware filter specifications
with both unknown unicast and unknown multicast destination MAC address
match flags.
In terms of RTE flow API, this would require adding multiple flow rules
with corresponding ETH items. In order to avoid such a complication, the
patch implements a mechanism to auto-complete an underlying filter
representation of a flow rule in order to create additional filter
specifications featuring the missing match flags.
Signed-off-by: Roman Zhukov <roman.zhukov@oktetlabs.ru> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com> Reviewed-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Roman Zhukov [Tue, 6 Mar 2018 15:24:56 +0000 (15:24 +0000)]
net/sfc: multiply of specs w/o inner frame destination MAC
Knowledge of a network identifier is not sufficient to construct a
workable hardware filter for encapsulated traffic. It's obligatory to
specify one of the match flags associated with inner frame destination
MAC. If the address is unknown, then one needs to specify either unknown
unicast or unknown multicast destination match flag.
In terms of RTE flow API, this would require adding multiple flow rules
with corresponding ETH items besides the tunnel item. In order to avoid
such a complication, the patch implements a mechanism to auto-complete
an underlying filter representation of a flow rule in order to create
additional filter specifications featuring the missing match flags.
Signed-off-by: Roman Zhukov <roman.zhukov@oktetlabs.ru> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com> Reviewed-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Roman Zhukov [Tue, 6 Mar 2018 15:24:55 +0000 (15:24 +0000)]
net/sfc: multiply of specs with an unknown EtherType
Hardware filter specification for encapsulated traffic must contain
EtherType. In terms of RTE flow API, this would require L3 item to be
used in the flow rule. In the simplest case, if the user needs to filter
encapsulated traffic without knowledge of exact EtherType, they will
have to create multiple variants of the flow rule featuring all possible
L3 items (IPv4, IPv6), respectively. In order to hide the gory details
and avoid such a complication, this patch implements a mechanism to
auto-complete the filter specifications if need be.
Signed-off-by: Roman Zhukov <roman.zhukov@oktetlabs.ru> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com> Reviewed-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Roman Zhukov [Tue, 6 Mar 2018 15:24:54 +0000 (15:24 +0000)]
net/sfc: add infrastructure to make many filters from flow
Not all flow rules can be expressed in one hardware filter, so some flow
rules have to be expressed in terms of multiple hardware filters. This
patch provides a means to produce a filter spec template from the flow
rule which then can be used to produce a set of fully elaborated specs
to be inserted.
Signed-off-by: Roman Zhukov <roman.zhukov@oktetlabs.ru> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com> Reviewed-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Roman Zhukov [Tue, 6 Mar 2018 15:24:53 +0000 (15:24 +0000)]
net/sfc: support inner frame ETH in flow API filters
Support destination MAC address match in inner frames.
Signed-off-by: Roman Zhukov <roman.zhukov@oktetlabs.ru> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com> Reviewed-by: Ivan Malov <ivan.malov@oktetlabs.ru> Reviewed-by: Andy Moreton <amoreton@solarflare.com>
Roman Zhukov [Tue, 6 Mar 2018 15:24:52 +0000 (15:24 +0000)]
net/sfc: support GENEVE in flow API filters
Exact match of virtual network identifier is supported by parser.
IP protocol match are enforced to UDP.
Only Ethernet protocol type is supported.
Signed-off-by: Roman Zhukov <roman.zhukov@oktetlabs.ru> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com> Reviewed-by: Ivan Malov <ivan.malov@oktetlabs.ru> Reviewed-by: Andy Moreton <amoreton@solarflare.com>
Roman Zhukov [Tue, 6 Mar 2018 15:24:51 +0000 (15:24 +0000)]
net/sfc: support NVGRE in flow API filters
Exact match of virtual subnet ID is supported by parser.
IP protocol match are enforced to GRE.
Signed-off-by: Roman Zhukov <roman.zhukov@oktetlabs.ru> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com> Reviewed-by: Ivan Malov <ivan.malov@oktetlabs.ru> Reviewed-by: Andy Moreton <amoreton@solarflare.com>
Roman Zhukov [Tue, 6 Mar 2018 15:24:50 +0000 (15:24 +0000)]
net/sfc: support VXLAN in flow API filters
Exact match of VXLAN network identifier is supported by parser.
IP protocol match are enforced to UDP.
Signed-off-by: Roman Zhukov <roman.zhukov@oktetlabs.ru> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com> Reviewed-by: Ivan Malov <ivan.malov@oktetlabs.ru> Reviewed-by: Andy Moreton <amoreton@solarflare.com>
Roman Zhukov [Tue, 6 Mar 2018 15:24:49 +0000 (15:24 +0000)]
net/sfc/base: distinguish filters for encapsulated packets
Add filter match flag to distinguish filters applied only to
encapsulated packets.
Match flags set should allow to determine whether a filter
is supported or not. The problem is that if specification
has supported set outer match flags and specified
encapsulation without any inner flags, check says that it
is supported, and filter insertion is performed. However,
there is no filtering of the encapsulated traffic. A new
flag is added to solve this problem and separate the
filters for the encapsulated packets.
Signed-off-by: Roman Zhukov <roman.zhukov@oktetlabs.ru> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com> Reviewed-by: Andy Moreton <amoreton@solarflare.com> Reviewed-by: Mark Spender <mspender@solarflare.com>
Roman Zhukov [Tue, 6 Mar 2018 15:24:47 +0000 (15:24 +0000)]
net/sfc/base: support VNI/VSID and inner frame local MAC
This supports VNI/VSID and inner frame local MAC fields to
match in VXLAN, GENEVE, or NVGRE packets.
Signed-off-by: Roman Zhukov <roman.zhukov@oktetlabs.ru> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com> Reviewed-by: Andy Moreton <amoreton@solarflare.com>
Roman Zhukov [Tue, 6 Mar 2018 15:24:46 +0000 (15:24 +0000)]
net/sfc/base: support filters for encapsulated packets
This adds filters for encapsulated packets to the list
returned by ef10_filter_supported_filters().
Signed-off-by: Roman Zhukov <roman.zhukov@oktetlabs.ru> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com> Reviewed-by: Andy Moreton <amoreton@solarflare.com>
Rahul Lakkireddy [Wed, 28 Feb 2018 18:04:52 +0000 (23:34 +0530)]
net/cxgbe: rework and use 32-bit port capability
The new code uses the new 32-bit Port Capabilities exclusively and
only translates to/from the old 16-bit Port Capabilities at the last
point possible when talking to older Firmware.
For the old versus new Firmware issue, we use the new FW_PARAMS_CMD[PFVF,
CAPS32] command to tell the Firmware that we want Asynchronous Port Status
updates to use the new 32-bit version of the Port Information message. If
we get an error, we know we're dealing with older Firmware, and if not,
we'll start getting th new 32-bit Port Capability message formats.
Also, refactor t4_handle_fw_rpl() to handle new 32-bit Port Capability
replies from firmware in t4_handle_get_port_info().
Original work by Surendra Mobiya <surendra@chelsio.com>
Kumar Sanghvi [Wed, 28 Feb 2018 18:04:50 +0000 (23:34 +0530)]
net/cxgbe: update link Forward Error Correction (FEC)
Normally, firmware reads various Forward Error Correction parameters
from a Transceiver Module i2c EPROM and uses a couple of IEEE Standards
(802.3bj for 100Gb/s and 802.3by for 25Gb/s) to interpret those
parameters and come up with supported and default FEC settings.
Firmware then sends these FEC parameters to the Host Driver which gives
the Host Administrator an opportunity to change them if necessary in
order to establish a Link with a Switch which may have made a
non-standard FEC decision.
This commit recognizes "auto" as a discrete FEC mode which can be
used to explicitly select the IEEE 802.3 standard based FEC selection.
Original work by Surendra Mobiya <surendra@chelsio.com>
Kumar Sanghvi [Wed, 28 Feb 2018 18:04:48 +0000 (23:34 +0530)]
net/cxgbe: support updating RSS hash configuration and key
Add firmware API for updating RSS hash configuration and key. Move
RSS hash configuration from cxgb4_write_rss() to a separate function
cxgbe_write_rss_conf().
Also, rename cxgb4_write_rss() to cxgbe_write_rss() for consistency.
Original work by Surendra Mobiya <surendra@chelsio.com>
Matan Azrad [Tue, 27 Feb 2018 14:22:03 +0000 (14:22 +0000)]
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.
ethdev: remove versioning of filter control function
In 18.02 release the ABI of ethdev component was changed.
To keep compatibility with previous versions of the library
the versioning of rte_eth_dev_filter_ctrl function was implemented.
As soon as deprecation note was issued in 18.02 release, there is
no need to keep compatibility with previous versions.
Remove the versioning of rte_eth_dev_filter_ctrl function.
The current code compares two strings upto the length of 1st string
(searched name). If the 1st string is prefix of 2nd string (existing name),
the string comparison returns the port_id of earliest prefix matches.
This patch fixes the bug by using strcmp instead of strncmp.
Fixes: 9c5b8d8b9fe ("ethdev: clean port id retrieval when attaching") Cc: stable@dpdk.org Signed-off-by: Mohammad Abdul Awal <mohammad.abdul.awal@intel.com> Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Pascal Mazon [Mon, 26 Feb 2018 08:01:10 +0000 (09:01 +0100)]
net/qede: fix alloc from socket 0
In case osal_dma_alloc_coherent() or osal_dma_alloc_coherent_aligned() are
called from a management thread, core_id turn out to be LCORE_ID_ANY, and
the resulting socket for alloc will be socket 0.
This is not desirable when using a NIC from socket 1 which might very
likely be configured to use memory from that socket only.
In that case, allocation will fail.
To address this, use master lcore instead when called from mgmt thread.
The associated socket should have memory available.
Alejandro Lucero [Thu, 22 Feb 2018 11:30:39 +0000 (11:30 +0000)]
net/nfp: fix barrier location
The barrier needs to be after reading the DD bit. It has not been
a problem because the potential reads which can not happen before
reading the DD bit seem to be far enough, so the compiler is not
rescheduling them. However, a refactoring could make this problem
to arise.