Skip to content

Commit

Permalink
net/bonding: fix double slave link status query
Browse files Browse the repository at this point in the history
[ upstream commit ac95744076a72c0a150a988cc9042a5422e5041f ]

When link status polling mode is used, the slave link status is
queried twice, which may be inconsistent. To fix this, we can keep
the latest queried link state.

Fixes: a45b288 ("bond: support link status polling")

Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Acked-by: Min Hu (Connor) <humin29@huawei.com>
  • Loading branch information
wyjwang authored and cpaelzer committed Nov 11, 2022
1 parent 10754b6 commit ab83bd4
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions drivers/net/bonding/rte_eth_bond_pmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -2358,9 +2358,6 @@ bond_ethdev_slave_link_status_change_monitor(void *cb_arg)
* event callback */
if (slave_ethdev->data->dev_link.link_status !=
internals->slaves[i].last_link_status) {
internals->slaves[i].last_link_status =
slave_ethdev->data->dev_link.link_status;

bond_ethdev_lsc_event_callback(internals->slaves[i].port_id,
RTE_ETH_EVENT_INTR_LSC,
&bonded_ethdev->data->port_id,
Expand Down Expand Up @@ -2859,7 +2856,7 @@ bond_ethdev_lsc_event_callback(uint16_t port_id, enum rte_eth_event_type type,

uint8_t lsc_flag = 0;
int valid_slave = 0;
uint16_t active_pos;
uint16_t active_pos, slave_idx;
uint16_t i;

if (type != RTE_ETH_EVENT_INTR_LSC || param == NULL)
Expand All @@ -2880,6 +2877,7 @@ bond_ethdev_lsc_event_callback(uint16_t port_id, enum rte_eth_event_type type,
for (i = 0; i < internals->slave_count; i++) {
if (internals->slaves[i].port_id == port_id) {
valid_slave = 1;
slave_idx = i;
break;
}
}
Expand Down Expand Up @@ -2968,6 +2966,7 @@ bond_ethdev_lsc_event_callback(uint16_t port_id, enum rte_eth_event_type type,
* slaves
*/
bond_ethdev_link_update(bonded_eth_dev, 0);
internals->slaves[slave_idx].last_link_status = link.link_status;

if (lsc_flag) {
/* Cancel any possible outstanding interrupts if delays are enabled */
Expand Down

0 comments on commit ab83bd4

Please sign in to comment.