Race condition can appear in the bond_mode_8023ad_periodic_cb()
callback when bonding port is stopped, reconfigured and restarted.
Re-ordered calls in bond_ethdev_start() to have callback alarm set
after slave ports are reconfigured.
Fixes: 2efb58cbab ("bond: new link bonding library")
Cc: stable@dpdk.org
Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
Acked-by: Chas Williams <chas3@att.com>
Calling rte_eth_dev_info_get() on secondary process cause a crash
because eth_dev->device is not set properly.
Fixes: ee27edbe0c ("drivers/net: share vdev data to secondary process")
Cc: stable@dpdk.org
Reported-by: Vipin Varghese <vipin.varghese@intel.com>
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Reviewed-by: Qi Zhang <qi.z.zhang@intel.com>
Setting up the bonding options before calling rte_eth_dev_probing_finish
triggers an invalid port id error because of port state not set, or set
unused
Fixes: fbe90cdd77 ("ethdev: add probing finish function")
Cc: stable@dpdk.org
Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
Acked-by: Chas Williams <chas3@att.com>
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>
When the bond PMD is stopped, the active slave count is reset.
For 802.3ad mode this potentially leaks memory and clears state since
a second sequential activate_slave() will occur when the bond PMD is
restarted and the LSC callback is triggered while the active slave
count is 0. To fix this, don't clear the active slave count when
stopping. Only deactivate_slave() should be used to clear the slaves.
Fixes: 2efb58cbab ("bond: new link bonding library")
Cc: stable@dpdk.org
Signed-off-by: Chas Williams <chas3@att.com>
Add functions to add/remove MAC addresses
Signed-off-by: Alex Kiselev <alex@therouter.net>
Acked-by: Declan Doherty <declan.doherty@intel.com>
Acked-by: Chas Williams <chas3@att.com>
Currently when resetting bond mac address, we are getting the
persisted mac address from slave info considering primary port
as index. But we need to compare the port id from slave info
with the primary port to get the primary slave index and get
the persisted mac address. Without this fix, persisted mac addr
will be zero and rte_eth_dev_default_mac_addr_set will fail.
Fixes: a45b288ef2 ("bond: support link status polling")
Cc: stable@dpdk.org
Signed-off-by: Kiran Kumar <kiran.kokkilagadda@caviumnetworks.com>
When the first ETH_LINK_UP slave is added to a bonding device, it is
immediately activated. If these are polling slaves, there will be a
later link state event, when last_link_status doesn't match link_status.
But because this slave is already activated, the bonding device's link
status isn't updated.
To fix this, we always attempt to update the bonding device's link status
in the link state change callback.
Fixes: 46fb436836 ("bond: add mode 4")
Cc: stable@dpdk.org
Signed-off-by: Chas Williams <chas3@att.com>
rte_eth_bond_8023ad_slave_info() wasn't exported in the original work.
Useful to extract information about the current 802.3ad state.
Fixes: 46fb436836 ("bond: add mode 4")
Cc: stable@dpdk.org
Signed-off-by: Chas Williams <chas3@att.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
The bonding PMD decides to activate\deactivate its slaves according to
the slaves link statuses.
Thus, it registers to the LSC events of the slaves ports and
activates\deactivates them from its LSC callbacks called asynchronously
by the host thread when the slave link status is changed.
In addition, the bonding PMD uses the callback for slave activation
when it tries to start it, this operation is probably called by the
master thread.
Consequently, a slave may be activated in the same time by two
different threads and may cause a lot of optional errors, for example,
slave mempool recreation with the same name causes an error.
Synchronize the critical section in the LSC callback using a special
new spinlock.
Fixes: 414b202343 ("bonding: fix initial link status of slave")
Fixes: a45b288ef2 ("bond: support link status polling")
Cc: stable@dpdk.org
Signed-off-by: Matan Azrad <matan@mellanox.com>
Acked-by: Declan Doherty <declan.doherty@intel.com>
A new hook function is added and called inside the PMDs at the end
of the device probing:
- in primary process, after allocating, init and config
- in secondary process, after attaching and local init
This new function is almost empty for now.
It will be used later to add some post-initialization processing.
For the PMDs calling the helpers rte_eth_dev_create() or
rte_eth_dev_pci_generic_probe(), the hook rte_eth_dev_probing_finish()
is called from here, and not in the PMD itself.
Note that the helper rte_eth_dev_create() could be used more,
especially for vdevs, avoiding some code duplication in PMDs.
Cc: stable@dpdk.org
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Stephen Hemminger <stephen@networkplumber.org>
Add rte_flow_action_count action data structure to enable shared
counters across multiple flows on a single port or across multiple
flows on multiple ports within the same switch domain. Also this enables
multiple count actions to be specified in a single flow action.
This patch also modifies the existing rte_flow_query API to take the
rte_flow_action structure as an input parameter instead of the
rte_flow_action_type enumeration to allow querying a specific action
from a flow rule when multiple actions of the same type are specified.
This patch also contains updates for the bonding, failsafe and mlx5 PMDs
and testpmd application which are affected by this API change.
Signed-off-by: Declan Doherty <declan.doherty@intel.com>
The basic operations for ports enumeration should not be
considered as experimental in DPDK 18.05.
The iterator RTE_ETH_FOREACH_DEV was introduced in DPDK 17.05.
It uses the function the rte_eth_find_next_owned_by() to get
only ownerless ports. Its API can be considered stable.
So the flag experimental is removed from rte_eth_find_next_owned_by().
The flag experimental is removed from rte_eth_dev_count_avail()
which is the new name of the old function rte_eth_dev_count().
The flag experimental is set to rte_eth_dev_count_total()
in the .c file for consistency with the declaration in the .h file.
A lot of internal applications are fixed to not allow experimental API.
Fixes: 8728ccf376 ("fix ethdev ports enumeration")
Fixes: d9a42a69fe ("ethdev: deprecate port count function")
Fixes: e70e26861e ("net/mvpp2: fix build")
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Tested-by: David Marchand <david.marchand@6wind.com>
Ethernet devices which are grouped by bonding PMD, aka slaves, are
sharing the same queues and RSS configurations and their Rx burst
functions must be managed by the bonding PMD according to the bonding
architecture.
So, it makes sense to configure the same flow rules for all the bond
slaves to allow consistency in packet flow management.
Add rte flow support to the bonding PMD to manage all flow
configuration to the bonded slaves.
Signed-off-by: Matan Azrad <matan@mellanox.com>
Acked-by: Declan Doherty <declan.doherty@intel.com>
dpdk-procinfo, as a secondary process, cannot fetch stats for vdev.
This patch enables that by attaching the port from the shared data.
We also fill the eth dev ops, with only some ops works in secondary
process, for example, stats_get().
Note that, we still cannot Rx/Tx packets on the ports which do not
support multi-process.
Reported-by: Signed-off-by: Vipin Varghese <vipin.varghese@intel.com>
Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
Reviewed-by: Qi Zhang <qi.z.zhang@intel.com>
Some DPDK applications wrongly assume these requirements:
- no hotplug, i.e. ports are never detached
- all allocated ports are available to the application
Such application iterates over ports by its own mean.
The most common pattern is to request the port count and
assume ports with index in the range [0..count[ can be used.
There are three consequences when using such wrong design:
- new ports having an index higher than the port count won't be seen
- old ports being detached (RTE_ETH_DEV_UNUSED) can be seen as ghosts
- failsafe sub-devices (RTE_ETH_DEV_DEFERRED) will be seen by the application
Such mistake will be less common with growing hotplug awareness.
All applications and examples inside this repository - except testpmd -
must be fixed to use the iterator RTE_ETH_FOREACH_DEV.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
When creating bond device with mode6, dpdk will create
mempool for arp packets. If free the bond device and
create it with same name, there will be an error. Because
the mempool is not freed when destroying bond device.
Fixes: 06fe78b98c ("bond: add mode 6")
Fixes: ea0c20ea95 ("apps: use helper to create mbuf pools")
Cc: stable@dpdk.org
Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Change the prototype and the behavior of dev_ops->eth_mac_addr_set(): a
return code is added to notify the caller (librte_ether) if an error
occurred in the PMD.
The new default MAC address is now copied in dev->data->mac_addrs[0]
only if the operation is successful.
The patch also updates all the PMDs accordingly.
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
There are several error paths where the bonding device may not start.
Clear dev_started before we return if we take one of these paths.
Fixes: 2efb58cbab ("bond: new link bonding library")
Cc: stable@dpdk.org
Signed-off-by: Chas Williams <chas3@att.com>
Acked-by: Radu Nicolau <radu.nicolau@intel.com>
The pos returned is just the offset of the slab. You need to use this
to offset the bits in the slab.
Fixes: c771e4ef38 ("net/bonding: enable slave VLAN filter")
Cc: stable@dpdk.org
Signed-off-by: Chas Williams <chas3@att.com>
Acked-by: Radu Nicolau <radu.nicolau@intel.com>
Since we have support for the strlcpy function in DPDK, replace all
instances where a string is copied using snprintf.
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Stephen Hemminger <stephen@networkplumber.org>
When a slave is configured make sure that the slave's MTU
matches the bonding's idea of the MTU.
Signed-off-by: Chas Williams <chas3@att.com>
Acked-by: Radu Nicolau <radu.nicolau@intel.com>
primary_slave_port_id is uint16_t which needs to be correctly stored
with the same data type of input parameter in bond_ethdev_configure.
In powerpc, creating bond pmd results in below error due to wrong
cast on input param. This is reproducible, only when using shared
libraries.
sudo -E LD_LIBRARY_PATH=$PWD/$RTE_TARGET/lib $RTE_TARGET/app/testpmd \
-l 0,8 --socket-mem=1024,1024 \
--vdev 'net_tap0,iface=dpdktap0' --vdev 'net_tap1,iface=dpdktap1' \
--vdev 'net_bonding0,mode=1,slave=0,slave=1,primary=0,socket_id=1' \
-d $RTE_TARGET/lib/librte_pmd_tap.so \
-d $RTE_TARGET/lib/librte_mempool_ring.so -- --forward-mode=rxonly
Configuring Port 0 (socket 0)
PMD: net_tap0: 0x70a854070280: TX configured queues number: 1
PMD: net_tap0: 0x70a854070280: RX configured queues number: 1
Port 0: 86:EA:6D:52:3E:DB
Configuring Port 1 (socket 0)
PMD: net_tap1: 0x70a854074300: TX configured queues number: 1
PMD: net_tap1: 0x70a854074300: RX configured queues number: 1
Port 1: 42:9A:B8:49:B6:00
Configuring Port 2 (socket 1)
EAL: Failed to set primary slave port 7424 on bonded device net_bonding0
Fail to configure port 2
EAL: Error - exiting with code: 1
Cause: Start ports failed
Fixes: f8244c6399 ("ethdev: increase port id range")
Cc: stable@dpdk.org
Signed-off-by: Gowrishankar Muthukrishnan <gowrishankar.m@linux.vnet.ibm.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
Wrong function was used for l23 and l34 hashing
slave index was incremented twice.
Fixes: 09150784a7 ("net/bonding: burst mode hash calculation")
Cc: stable@dpdk.org
Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
By making "compat" lib (which consists of a header only) a dependency of
the EAL, we make the header file available to all other libs, drivers and
apps, and thereby make it less work to do ABI versioning.
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Luca Boccassi <bluca@debian.org>
bonding immediately marks the incoming eth device as bonded and doesn't
clear this in later error paths. Delay marking the dev until we are
certain that we are going to add this eth device to the bond group.
Signed-off-by: Chas Williams <chas3@att.com>
Acked-by: Radu Nicolau <radu.nicolau@intel.com>
Create a rte_ethdev_driver.h file and move PMD specific APIs here.
Drivers updated to include this new header file.
There is no update in header content and since ethdev.h included by
ethdev_driver.h, nothing changed from driver point of view, only
logically grouping of APIs. From applications point of view they can't
access to driver specific APIs anymore and they shouldn't.
More PMD specific data structures still remain in ethdev.h because of
inline functions in header use them. Those will be handled separately.
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
Set the MTU for bonding device by calling .mtu_set for all
the slaves. Set the MTU only if all slaves support .mtu_set,
and there is no error returned from any slave.
Signed-off-by: Sharmila Podury <sharmila.podury@att.com>
Acked-by: Declan Doherty <declan.doherty@intel.com>
The pointer to the user parameter of the callback registration is
automatically pass to the callback function.
There is no point to allow changing this user parameter by a caller.
That's why this parameter is always set to NULL by PMDs and set only
in ethdev layer before calling the callback function.
The history is that the user parameter was initially used
by the callback implementation to pass some information
between the application and the driver:
c1ceaf3ad0 ("ethdev: add an argument to internal callback function")
Then a new parameter has been added to leave the user parameter
to its standard usage of context given at registration:
d6af1a13d7 ("ethdev: add return values to callback process API")
The NULL parameter in the internal callback processing function
is now removed. It makes clear that the callback parameter is user
managed and opaque from a DPDK point of view.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Change the xmit_hash functions to handle bursts of packet instead of
single packets at a time, and update the affected tx_burst functions.
Signed-off-by: Declan Doherty <declan.doherty@intel.com>
Signed-off-by: Keith Wiles <keith.wiles@intel.com>
Use rte_eth_dev_default_mac_addr_set() to change a slave MAC address.
mac_address_set() only updates the software copy and does nothing to
update the hardware.
Signed-off-by: Chas Williams <chas3@att.com>
Acked-by: Declan Doherty <declan.doherty@intel.com>
In the function bond_mode_8023ad_enable(), the var i is used as slave
port id to the function bond_mode_8023ad_activate_slave().
This variable is only a index for array internals->active_slaves.
So its need to be fixed and change i to internals->active_slaves[i].
Fixes: 46fb436836 ("bond: add mode 4")
Cc: stable@dpdk.org
Signed-off-by: Jerry Lilijun <jerry.lilijun@huawei.com>
Tested-by: Kyle Larose <klarose@sandvine.com>
Acked-by: Declan Doherty <declan.doherty@intel.com>
In message (http://dpdk.org/ml/archives/dev/2017-November/081557.html)
it was noted that under congestion that the LACPDUs are dropped under
load.
This patch changes the drop logic to re-enqueue the LACPDU to the slaves
control message queue. This will allow resend attempts to be made in
subsequent tx_burst() calls on the bonded device.
Signed-off-by: Declan Doherty <declan.doherty@intel.com>
This patch blocks possibility to set master bonding by
rte_eth_bond_mode_set() in 802.3ad mode, as the API
doesn't prevent this.
Fixes: 6d72657ce3 ("net/bonding: add other aggregator modes")
Cc: stable@dpdk.org
Signed-off-by: Jacek Piasecki <jacekx.piasecki@intel.com>
Reviewed-by: Radu Nicolau <radu.nicolau@intel.com>
Replace the BSD license header with the SPDX tag for files
with only an Intel copyright on them.
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Move the vdev bus from lib/librte_eal to drivers/bus.
As the crypto vdev helper function refers to data structure
in rte_vdev.h, so we move those helper function into drivers/bus
too.
Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
This patch change default aggregator mode to stable
when using rte_eth_bond_create()
Fixes: 6d72657ce3 ("net/bonding: add other aggregator modes")
Cc: stable@dpdk.org
Signed-off-by: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>
Acked-by: Michal Jastrzebski <michalx.k.jastrzebski@intel.com>
The PCI lib defines the types and methods allowing to use PCI elements.
The PCI bus implements a bus driver for PCI devices by constructing
rte_bus elements using the PCI lib.
Move the relevant code out of the EAL to its expected place.
Libraries, drivers, unit tests and applications are updated to use the
new rte_bus_pci.h header when necessary.
Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
The current name conflicts with the librte_pci naming convention.
Additionally, it is easier to use gdb when having prefixed even private
functions.
Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
Result of slaves link properties validation is not used when new slave
is added.
This patch uses the value of link_properties_valid() to determinate if
slave can be used in the bonding. If function fails, error is returned
preventing to add slave with invalid link properties.
Coverity issue: 158661
Fixes: deba8a2f8b ("net/bonding: fix link properties management")
Cc: stable@dpdk.org
Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
PKT_RX_VLAN_PKT and PKT_RX_QINQ_PKT are deprecated for a while.
As explained in [1], these flags were kept to let the applications and
PMDs move to the new flag. There is also a need to support Rx vlan
offload without vlan strip (at least for the ixgbe driver).
This patch renames the old flags for this feature, knowing that some
PMDs were using PKT_RX_VLAN_PKT and PKT_RX_QINQ_PKT to indicate that
the vlan tci has been saved in the mbuf structure.
It is likely that some PMDs do not set the proper flags when doing vlan
offload, and it would be worth making a pass on all of them.
Link: [1] http://dpdk.org/ml/archives/dev/2017-June/067712.html
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>