From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 25D69A0507 for ; Thu, 24 Mar 2022 04:01:27 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1F9A842813; Thu, 24 Mar 2022 04:01:27 +0100 (CET) Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by mails.dpdk.org (Postfix) with ESMTP id 87B154280E; Thu, 24 Mar 2022 04:01:24 +0100 (CET) Received: from dggeme756-chm.china.huawei.com (unknown [172.30.72.57]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4KP93F3cVGz1GCyG; Thu, 24 Mar 2022 11:01:13 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by dggeme756-chm.china.huawei.com (10.3.19.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.21; Thu, 24 Mar 2022 11:01:22 +0800 From: "Min Hu (Connor)" To: CC: Huisong Li , , Min Hu , Chas Williams , Radu Nicolau Subject: [PATCH V2 1/4] net/bonding: fix non-active slaves aren't stopped Date: Thu, 24 Mar 2022 11:00:33 +0800 Message-ID: <20220324030036.4761-2-humin29@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20220324030036.4761-1-humin29@huawei.com> References: <20211025063922.34066-1-humin29@huawei.com> <20220324030036.4761-1-humin29@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggeme756-chm.china.huawei.com (10.3.19.102) X-CFilter-Loop: Reflected X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org From: Huisong Li When stopping a bonded port, all slaves should be deactivated. But only active slaves are stopped. So fix it and do "deactivae_slave()" for active slaves. Fixes: 0911d4ec0183 ("net/bonding: fix crash when stopping mode 4 port") Cc: stable@dpdk.org Signed-off-by: Huisong Li Signed-off-by: Min Hu (Connor) --- drivers/net/bonding/rte_eth_bond_pmd.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index b305b6a35b..469dc71170 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -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 deactivate. */ 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; -- 2.33.0