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 C4BD042C65; Fri, 9 Jun 2023 03:38:54 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A15D540E01; Fri, 9 Jun 2023 03:38:54 +0200 (CEST) Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by mails.dpdk.org (Postfix) with ESMTP id 6291C40A7D; Fri, 9 Jun 2023 03:38:53 +0200 (CEST) Received: from kwepemm600004.china.huawei.com (unknown [172.30.72.57]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4QckBd3BTVz18M2c; Fri, 9 Jun 2023 09:34:01 +0800 (CST) Received: from [10.67.103.231] (10.67.103.231) by kwepemm600004.china.huawei.com (7.193.23.242) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Fri, 9 Jun 2023 09:38:50 +0800 Message-ID: <595cbf81-d78a-a7f5-3c1b-7c1c70a05fd8@huawei.com> Date: Fri, 9 Jun 2023 09:38:50 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.2.0 Subject: Re: [PATCH] net/bonding: fix iavf bond device query stats To: Stephen Hemminger , Kaiwen Deng CC: , , , , Chas Williams , "Min Hu (Connor)" , Declan Doherty , Daniel Mrzyglod References: <20230608072636.426803-1-kaiwenx.deng@intel.com> <20230608084113.06e6594f@hermes.local> From: "lihuisong (C)" In-Reply-To: <20230608084113.06e6594f@hermes.local> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.67.103.231] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemm600004.china.huawei.com (7.193.23.242) 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 在 2023/6/8 23:41, Stephen Hemminger 写道: > On Thu, 8 Jun 2023 15:26:36 +0800 > Kaiwen Deng wrote: > >> If the rte_eth_stats_get function does not work properly, >> the update function of the slave device does not work >> properly When device is bonded as BONDING_MODE_TLB mode. >> >> This commit adds handling for functions that do not get >> stats properly. >> >> Fixes: 7c76a747e68c ("bond: add mode 5") >> Cc: stable@dpdk.org >> >> Signed-off-by: Kaiwen Deng >> --- >> drivers/net/bonding/rte_eth_bond_pmd.c | 7 ++++++- >> 1 file changed, 6 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c >> index f0c4f7d26b..edce621496 100644 >> --- a/drivers/net/bonding/rte_eth_bond_pmd.c >> +++ b/drivers/net/bonding/rte_eth_bond_pmd.c >> @@ -894,6 +894,7 @@ bond_ethdev_update_tlb_slave_cb(void *arg) >> uint8_t update_stats = 0; >> uint16_t slave_id; >> uint16_t i; >> + int ret; >> >> internals->slave_update_idx++; >> >> @@ -903,7 +904,10 @@ bond_ethdev_update_tlb_slave_cb(void *arg) >> >> for (i = 0; i < internals->active_slave_count; i++) { >> slave_id = internals->active_slaves[i]; >> - rte_eth_stats_get(slave_id, &slave_stats); >> + ret = rte_eth_stats_get(slave_id, &slave_stats); >> + if (ret) >> + goto OUT; >> + >> tx_bytes = slave_stats.obytes - tlb_last_obytets[slave_id]; >> bandwidth_left(slave_id, tx_bytes, >> internals->slave_update_idx, &bwg_array[i]); >> @@ -922,6 +926,7 @@ bond_ethdev_update_tlb_slave_cb(void *arg) >> for (i = 0; i < slave_count; i++) >> internals->tlb_slaves_order[i] = bwg_array[i].slave; >> >> +OUT: >> rte_eal_alarm_set(REORDER_PERIOD_MS * 1000, bond_ethdev_update_tlb_slave_cb, >> (struct bond_dev_private *)internals); >> } > Why is stats get failing on a device, looks like the real bug is there? > Better to fix the buggy driver. Other usages might already be affected. I think this is the case if the driver happens to have an abnormal event and do reset. So here need to handle this fairlure. Additionally, suggest that this API in bond_ethdev_stats_get should do the same things. > Silently ignoring the error without logging is also not good. > Lastly, DPDK coding style is to use lower case for goto labels. +1 > .