答复: [dpdk-dev] [PATCH] net/bonding: fix double get slave link status

Message ID 781607bf0fe0426f9d5882a7b88ccd13@huawei.com (mailing list archive)
State Not Applicable, archived
Delegated to: Andrew Rybchenko
Headers
Series 答复: [dpdk-dev] [PATCH] net/bonding: fix double get slave link status |

Checks

Context Check Description
ci/Intel-compilation warning apply issues
ci/iol-testing warning apply patch failure

Commit Message

humin (Q) July 20, 2022, 6:39 a.m. UTC
Acked-by: Min Hu (Connor) <humin29@huawei.com>

-----邮件原件-----
发件人: wangyunjian <wangyunjian@huawei.com> 
发送时间: 2022年7月13日 19:11
收件人: dev@dpdk.org
抄送: chas3@att.com; humin (Q) <humin29@huawei.com>; Huangshaozhang <huangshaozhang@huawei.com>; wangyunjian <wangyunjian@huawei.com>; stable@dpdk.org
主题: [dpdk-dev] [PATCH] net/bonding: fix double get slave link status

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

Fixes: a45b288ef21a ("bond: support link status polling")
Cc: stable@dpdk.org

Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
---
 drivers/net/bonding/rte_eth_bond_pmd.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

 	for (i = 0; i < internals->slave_count; i++) {
 		if (internals->slaves[i].port_id == port_id) {
 			valid_slave = 1;
+			slave_idx = i;
 			break;
 		}
 	}
@@ -3000,6 +2998,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 */
--
2.27.0
  

Comments

Ferruh Yigit Aug. 25, 2022, 5:05 p.m. UTC | #1
On 7/20/2022 7:39 AM, humin (Q) wrote:

> -----邮件原件-----
> 发件人: wangyunjian <wangyunjian@huawei.com>
> 发送时间: 2022年7月13日 19:11
> 收件人: dev@dpdk.org
> 抄送: chas3@att.com; humin (Q) <humin29@huawei.com>; Huangshaozhang <huangshaozhang@huawei.com>; wangyunjian <wangyunjian@huawei.com>; stable@dpdk.org
> 主题: [dpdk-dev] [PATCH] net/bonding: fix double get slave link status
> 
> When link status polling mode is using, the slave link status is queried twice, which may be inconsistent. To fix this, we can keep the lastest queried link state.
> 
> Fixes: a45b288ef21a ("bond: support link status polling")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
 >
 > Acked-by: Min Hu (Connor) <humin29@huawei.com>
 >

Applied to dpdk-next-net/main, thanks.
  

Patch

diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index 845e8fd0cf..5c4c47251b 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -2390,9 +2390,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,
@@ -2891,7 +2888,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) @@ -2912,6 +2909,7 @@ bond_ethdev_lsc_event_callback(uint16_t port_id, enum rte_eth_event_type type,