Skip to content

Commit

Permalink
net/bonding: fix stopping non-active slaves
Browse files Browse the repository at this point in the history
[ upstream commit f5e72e8 ]

When stopping a bonded port, all slaves should be stopped. But only
active slaves are stopped.
So fix by stopping all slave ports and later do "deactivate_slave()" for
active slaves.

Fixes: 0911d4e ("net/bonding: fix crash when stopping mode 4 port")

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
  • Loading branch information
LiHuiSong1 authored and kevintraynor committed May 24, 2022
1 parent e856fe9 commit 5a8afc6
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions drivers/net/bonding/rte_eth_bond_pmd.c
Expand Up @@ -2118,18 +2118,20 @@ bond_ethdev_stop(struct rte_eth_dev *eth_dev)
internals->link_status_polling_enabled = 0;
for (i = 0; i < internals->slave_count; i++) {
uint16_t slave_id = internals->slaves[i].port_id;

internals->slaves[i].last_link_status = 0;
ret = rte_eth_dev_stop(slave_id);
if (ret != 0) {
RTE_BOND_LOG(ERR, "Failed to stop device on port %u",
slave_id);
return ret;
}

/* active slaves need to be deactivated. */
if (find_slave_by_id(internals->active_slaves,
internals->active_slave_count, slave_id) !=
internals->active_slave_count) {
internals->slaves[i].last_link_status = 0;
ret = rte_eth_dev_stop(slave_id);
if (ret != 0) {
RTE_BOND_LOG(ERR, "Failed to stop device on port %u",
slave_id);
return ret;
}
internals->active_slave_count)
deactivate_slave(eth_dev, slave_id);
}
}

return 0;
Expand Down

0 comments on commit 5a8afc6

Please sign in to comment.