Commit Graph

19 Commits

Author SHA1 Message Date
Eric Kinzie
6cfc6a4f0d net/bonding: inherit maximum Rx packet length
Instead of a hard-coded maximum receive length, allow the bonded interface
to inherit this limit from the slave interfaces.  This allows
an application that uses jumbo frames to pass realistic values to
rte_eth_dev_configure without causing an error.

Before the bonding interface is configured, allow slaves with any
max_rx_pktlen to be added and remember the lowest of these values as
a candidate value.  During dev_configure, set the bond device's
max_rx_pktlen to the candidate value.  After this point only slaves
with a max_rx_pktlen greater or equal to that of the bonding device
can be added.

If all slaves are removed, the bond device's pktlen is cleared.

Signed-off-by: Eric Kinzie <ehkinzie@gmail.com>
Acked-by: Declan Doherty <declan.doherty@intel.com>
2016-06-20 18:36:47 +02:00
Mauricio Vasquez B
1414dabc1b ethdev: use dedicated macro to check port id
The RTE_ETH_VALID_PORTID_OR_ERR_RET macro is used in some places
to check if a port id is valid or not. This commit makes use of it in
some new parts of the code.

Signed-off-by: Mauricio Vasquez B <mauricio.vasquezbernal@studenti.polito.it>
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
2016-05-24 15:30:08 +02:00
Thomas Monjalon
50705e8e3c eal: add assert macro for debug
The macro RTE_VERIFY always checks a condition.
It is optimized with "unlikely" hint.
While this macro is well suited for test applications, it is preferred
in libraries and examples to enable such check in debug mode.
That's why the macro RTE_ASSERT is introduced to call RTE_VERIFY only
if built with debug logs enabled.

A lot of assert macros were duplicated and enabled with a specific flag.
Removing these #ifdef allows to test these code branches more easily
and avoid dead code pitfalls.

The ENA_ASSERT is kept (in debug mode only) because it has more
parameters to log.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
2016-05-02 15:31:17 +02:00
Thomas Monjalon
09419f235e ethdev: use constants for link state
Define and use ETH_LINK_UP and ETH_LINK_DOWN where appropriate.

Signed-off-by: Marc Sune <marcdevel@gmail.com>
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
2016-04-01 21:38:34 +02:00
Bernard Iremonger
e0665f9809 bonding: fix current primary port
The current_primary_port is initialised to an invalid value
during bonded device creation.
It must be set to a valid value later.
This fix sets it to a valid value when the first slave port
is added to the bonding device.

Fixes: 2efb58cbab ("bond: new link bonding library")

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2016-03-25 19:03:48 +01:00
Bernard Iremonger
2186fff367 bonding: fix crash when no slave device
If a bonded device is created when there are no slave devices
there is a loop in bond_ethdev_promiscuous_enable() which results
in a segmentation fault.

The solution is to initialise the current_primary_port to an
invalid port value when the bonded port is created.

Fixes: 2efb58cbab ("bond: new link bonding library")

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
2016-03-16 19:05:47 +01:00
Eric Kinzie
7a7122edf1 bonding: do not activate slave twice
The current code for detecting link during slave addition can cause a
slave interface to be activated twice -- once during slave_configure()
and again at the end of __eth_bond_slave_add_lock_free().  This will
either cause the active slave count to be incorrect or will cause the
802.3ad activation function to panic.  Ensure that the interface is not
activated more than once.

Fixes: 46fb436836 ("bond: add mode 4")

Signed-off-by: Eric Kinzie <ekinzie@brocade.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Declan Doherty <declan.doherty@intel.com>
2016-03-16 19:05:47 +01:00
Eric Kinzie
8997a10bfc bonding: fix active slaves with no primary
If the link state of a slave is "up" when added, it is added to the list
of active slaves but, even if it is the only slave, is not selected as
the primary interface.  Generally, handling of link state interrupts
selects an interface to be primary, but only if the active count is zero.
This change avoids the situation where there are active slaves but
no primary.

Fixes: 2efb58cbab ("bond: new link bonding library")

Signed-off-by: Eric Kinzie <ekinzie@brocade.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Declan Doherty <declan.doherty@intel.com>
2016-03-16 19:05:47 +01:00
Bernard Iremonger
df3e8ad73f bonding: fix detach of slave devices
Ensure that a bonded slave device is not detached,
until it is removed from the bonded device.

Fixes: 2efb58cbab ("bond: new link bonding library")
Fixes: a45b288ef2 ("bond: support link status polling")
Fixes: 494adb7f63 ("ethdev: add device fields from PCI layer")
Fixes: b1fb53a39d ("ethdev: remove some PCI specific handling")

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Declan Doherty <declan.doherty@intel.com>
2016-03-16 19:05:47 +01:00
Bernard Iremonger
6e02723754 bonding: fix detach of bonded device
Check that the bonded device has no slaves before detaching it.

Fixes: 8d30fe7fa7 ("bonding: support port hotplug")

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Declan Doherty <declan.doherty@intel.com>
2016-03-16 19:05:47 +01:00
Bernard Iremonger
71ba84b1cc bonding: remove fake pci interface
remove pci_dev, pci_drv, rte_bond_pmd and pci_id_table.
handle numa_node for vdevs
handle RTE_ETH_DEV_INTR_LSC for vdevs
rename the function valid_bonded_device to check_for_bonded_device
remove branches on pci_dev

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>
2015-11-03 18:48:24 +01:00
Bernard Iremonger
8fb9e2bbf9 drivers: copy fake PCI device info to ethdev data
Initialise dev_flags, driver, kdrv, drv_name and numa_node fields
in eth_dev data.

for the following vdevs:
null
ring
pcap
af_packet
xenvirt
mpipe
bonding

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2015-11-03 18:39:42 +01:00
Tomasz Kulasek
734ce47f71 bonding: support RSS dynamic configuration
Bonding device implements independent management of RSS settings. It
stores its own copies of settings i.e. RETA, RSS hash function and RSS
key. It’s required to ensure consistency.

1) RSS hash function set for bonding device is maximal set of RSS hash
functions supported by all bonded devices. That mean, to have RSS support
for bonding, all slaves should be RSS-capable.

2) RSS key is propagated over the slaves "as is".

3) RETA for bonding is an internal table managed by bonding API, and is
used as a pattern to set up slaves. Its size is GCD of all RETA sizes, so
it can be easily used as a pattern providing expected behavior, even if
slaves RETA sizes are different.

Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>
Acked-by: Declan Doherty <declan.doherty@intel.com>
2015-11-01 18:10:48 +01:00
Bernard Iremonger
c45c8bd9b9 bonding: fix device initialisation error handling
If the name parameter to rte_eth_bond_create() was NULL,
there was a segmentation fault because eth_dev was also NULL.
Add error handling of mac_addrs memory allocation.
Add call to rte_eth_dev_release_port() in error handling.

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Tested-by: Marvin Liu <yong.liu@intel.com>
Acked-by: Michal Jastrzebski <michalx.k.jastrzebski@intel.com>
2015-08-10 02:05:42 +02:00
Bernard Iremonger
8d30fe7fa7 bonding: support port hotplug
This patch depends on the Port Hotplug Framework.
It implements the rte_dev_uninit_t() function for the link bonding pmd.

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Declan Doherty <declan.doherty@intel.com>
2015-07-27 19:20:44 +02:00
Stephen Hemminger
fa8cc60774 bonding: fix name and port validation
Cleanup the code in bonding that checks ports.
  * Use standard rte_eth_dev_is_valid_port
  * Change name of driver string to avoid variable namespace conflicts
  * Get rid of unnecessary string comparison stuff. A simple pointer
    check is enough here.
  * Get rid of unnecessary assignment of driver_name, it is already
    done by common code.
  * Don't generate unnecessary log messages on error.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Declan Doherty <declan.doherty@intel.com>
2015-07-20 02:47:38 +02:00
Stephen Hemminger
3379b158b2 bonding: initialize backpointer from pci device to driver
Add missing initialization of to pci_dev driver
The link from pci_dev back to the ethernet driver was not being set.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2015-06-29 12:13:37 +02:00
Stephen Hemminger
e46e3ba5f0 bonding: remove useless memset
Remove 2 unneeded memset's.  The info area is already cleared rte_eth_dev_info_get
and the statistics buffer is cleared by rte_eth_stats_get

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
2015-06-04 10:46:45 +02:00
Bruce Richardson
3eb6bdd89e bond: move to drivers/net/
Move bonded ethdev pmd to drivers/net

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
2015-05-22 15:51:38 +02:00