From patchwork Wed Jul 20 06:39:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "humin (Q)" X-Patchwork-Id: 114062 X-Patchwork-Delegate: andrew.rybchenko@oktetlabs.ru Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id BB399A0032; Wed, 20 Jul 2022 08:39:49 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 957F940697; Wed, 20 Jul 2022 08:39:49 +0200 (CEST) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 23CEF4003C; Wed, 20 Jul 2022 08:39:47 +0200 (CEST) Received: from dggpemm500024.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4LnmGz2G2JzlVm0; Wed, 20 Jul 2022 14:38:03 +0800 (CST) Received: from dggpemm500006.china.huawei.com (7.185.36.236) by dggpemm500024.china.huawei.com (7.185.36.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Wed, 20 Jul 2022 14:39:45 +0800 Received: from kwepemi500012.china.huawei.com (7.221.188.12) by dggpemm500006.china.huawei.com (7.185.36.236) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Wed, 20 Jul 2022 14:39:45 +0800 Received: from kwepemi500012.china.huawei.com ([7.221.188.12]) by kwepemi500012.china.huawei.com ([7.221.188.12]) with mapi id 15.01.2375.024; Wed, 20 Jul 2022 14:39:44 +0800 From: "humin (Q)" To: wangyunjian , "dev@dpdk.org" CC: "chas3@att.com" , Huangshaozhang , "stable@dpdk.org" Subject: =?eucgb2312_cn?b?tPC4tDogW2RwZGstZGV2XSBbUEFUQ0hdIG5ldC9ib25kaW5nOiBmaXgg?= =?eucgb2312_cn?b?ZG91YmxlIGdldCBzbGF2ZSBsaW5rIHN0YXR1cw==?= Thread-Topic: [dpdk-dev] [PATCH] net/bonding: fix double get slave link status Thread-Index: AQHYlqlOk/0ozG+kYEWFmTLJ7jR46a2G2YFA Date: Wed, 20 Jul 2022 06:39:44 +0000 Message-ID: <781607bf0fe0426f9d5882a7b88ccd13@huawei.com> References: <598d08fa7e4da0ba42ba21ed3461ead4f6f9d23f.1657710002.git.wangyunjian@huawei.com> In-Reply-To: <598d08fa7e4da0ba42ba21ed3461ead4f6f9d23f.1657710002.git.wangyunjian@huawei.com> Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.78.23.197] MIME-Version: 1.0 X-CFilter-Loop: Reflected X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Acked-by: Min Hu (Connor) -----邮件原件----- 发件人: wangyunjian 发送时间: 2022年7月13日 19:11 收件人: dev@dpdk.org 抄送: chas3@att.com; humin (Q) ; Huangshaozhang ; wangyunjian ; 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 --- 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 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,