From e2bea7436061ca2e7e14bfcfdc5870f2555c3965 Mon Sep 17 00:00:00 2001 From: Christian Ehrhardt Date: Mon, 15 Apr 2019 14:36:48 +0200 Subject: New upstream version 18.11.1 Change-Id: Ic52e74a9ed6f3ae06acea4a27357bd7153efc2a3 Signed-off-by: Christian Ehrhardt --- drivers/net/bonding/rte_eth_bond_api.c | 11 ++++++++++- drivers/net/bonding/rte_eth_bond_pmd.c | 6 +++--- 2 files changed, 13 insertions(+), 4 deletions(-) (limited to 'drivers/net/bonding') diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c index 21bcd504..ac084c4f 100644 --- a/drivers/net/bonding/rte_eth_bond_api.c +++ b/drivers/net/bonding/rte_eth_bond_api.c @@ -19,7 +19,10 @@ int check_for_bonded_ethdev(const struct rte_eth_dev *eth_dev) { /* Check valid pointer */ - if (eth_dev->device->driver->name == NULL) + if (eth_dev == NULL || + eth_dev->device == NULL || + eth_dev->device->driver == NULL || + eth_dev->device->driver->name == NULL) return -1; /* return 0 if driver name matches */ @@ -126,6 +129,12 @@ deactivate_slave(struct rte_eth_dev *eth_dev, uint16_t port_id) RTE_ASSERT(active_count < RTE_DIM(internals->active_slaves)); internals->active_slave_count = active_count; + /* Resetting active_slave when reaches to max + * no of slaves in active list + */ + if (internals->active_slave >= active_count) + internals->active_slave = 0; + if (eth_dev->data->dev_started) { if (internals->mode == BONDING_MODE_8023AD) { bond_mode_8023ad_start(eth_dev); diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index 44deaf11..7ed69b38 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -84,7 +84,7 @@ bond_ethdev_rx_burst(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) active_slave = 0; } - if (++internals->active_slave == slave_count) + if (++internals->active_slave >= slave_count) internals->active_slave = 0; return num_rx_total; } @@ -288,7 +288,7 @@ bond_ethdev_rx_burst_8023ad_fast_queue(void *queue, struct rte_mbuf **bufs, active_slave = 0; } - if (++internals->active_slave == slave_count) + if (++internals->active_slave >= slave_count) internals->active_slave = 0; return num_rx_total; @@ -474,7 +474,7 @@ bond_ethdev_rx_burst_8023ad(void *queue, struct rte_mbuf **bufs, idx = 0; } - if (++internals->active_slave == slave_count) + if (++internals->active_slave >= slave_count) internals->active_slave = 0; return num_rx_total; -- cgit 1.2.3-korg