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 79BB942C5C; Thu, 8 Jun 2023 10:09:01 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6ADE541133; Thu, 8 Jun 2023 10:09:01 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mails.dpdk.org (Postfix) with ESMTP id EC807410D3; Thu, 8 Jun 2023 10:08:58 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686211739; x=1717747739; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=Qwetn4uAAS0wrD/IZP+Qa5np76QWjme9gZIEmSB+XP4=; b=hv4pdQWfyrYkELFeuJkfst4psaTTQooh6XxEcNsHg66FTnhrT9XtCtM0 85ozNw2StSdkyQgNUz3Fa4RPnN0jRSDiRvxCzsi9wy4ga3QpVP9KwiiVt AYAFpxpUVM/K6ziIixen6ce4FG72em0tppitqa6/nkFDXpOhTgU5sz1UW Op+Bt55BNxQ3ID89a/Od8SYJvh2x3v0GugCK3qzI5dBtXww/OBn2MCKaw B7agmh7b/UaTCZAxnn3ohKeXxH3C/66B0ulCSzZEqRXgMVnp7TTdrvHaF hYhrlgMdwQN8+6VQLgqtCvwiOv9Lo+YNrDs/96NsLE5uJc30UY0liTaKp Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10734"; a="336872710" X-IronPort-AV: E=Sophos;i="6.00,226,1681196400"; d="scan'208";a="336872710" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jun 2023 01:08:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10734"; a="1040035951" X-IronPort-AV: E=Sophos;i="6.00,226,1681196400"; d="scan'208";a="1040035951" Received: from shwdenpg561.ccr.corp.intel.com (HELO dpdk..) ([10.239.252.3]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jun 2023 01:08:53 -0700 From: Kaiwen Deng To: dev@dpdk.org Cc: stable@dpdk.org, qiming.yang@intel.com, yidingx.zhou@intel.com, Kaiwen Deng , Chas Williams , "Min Hu (Connor)" , Declan Doherty , Daniel Mrzyglod Subject: [PATCH] net/bonding: fix iavf bond device query stats Date: Thu, 8 Jun 2023 15:26:36 +0800 Message-Id: <20230608072636.426803-1-kaiwenx.deng@intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 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); } -- 2.34.1