From patchwork Mon Feb 18 11:59:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hari Kumar Vemula X-Patchwork-Id: 50346 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B891844BE; Mon, 18 Feb 2019 13:00:21 +0100 (CET) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id 79FF82C54; Mon, 18 Feb 2019 13:00:19 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Feb 2019 04:00:17 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,384,1544515200"; d="scan'208";a="321284505" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by fmsmga005.fm.intel.com with ESMTP; 18 Feb 2019 04:00:15 -0800 Received: from wgcvswdev001.ir.intel.com (wgcvswdev001.ir.intel.com [10.102.246.100]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id x1IC0FHb012042; Mon, 18 Feb 2019 12:00:15 GMT Received: from wgcvswdev001.ir.intel.com (localhost [127.0.0.1]) by wgcvswdev001.ir.intel.com with ESMTP id x1IBxc0J023975; Mon, 18 Feb 2019 11:59:38 GMT Received: (from hvemulax@localhost) by wgcvswdev001.ir.intel.com with ? id x1IBxcRc023971; Mon, 18 Feb 2019 11:59:38 GMT From: Hari Kumar Vemula To: dev@dpdk.org Cc: reshma.pattan@intel.com, radu.nicolau@intel.com, jananeex.m.parthasarathy@intel.com, Hari Kumar Vemula , stable@dpdk.org Date: Mon, 18 Feb 2019 11:59:23 +0000 Message-Id: <1550491163-23616-1-git-send-email-hari.kumarx.vemula@intel.com> X-Mailer: git-send-email 1.7.0.7 In-Reply-To: References: Subject: [dpdk-dev] [PATCH] net/bonding: fix reset active slave X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" test_alb_reply_from_client test fails due to incorrect active slave array's index. This was due to invalid active slave count. Count of internals->active_slave is not updated even when active slave is deactivated. Hence active slave count always keeps incrementing beyond the actual active slaves. Fix is to set the internals->active_slave to starting index 0 whenever it exceeds the number of slaves in active slave list and also update the active slave count during slave de-activation. Fixes: e1110e977648 ("net/bonding: fix Rx slave fairness") Cc: stable@dpdk.org Signed-off-by: Hari Kumar Vemula Acked-by: Radu Nicolau --- drivers/net/bonding/rte_eth_bond_api.c | 6 ++++++ drivers/net/bonding/rte_eth_bond_pmd.c | 6 +++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c index e5e146540..ac084c4fd 100644 --- a/drivers/net/bonding/rte_eth_bond_api.c +++ b/drivers/net/bonding/rte_eth_bond_api.c @@ -129,6 +129,12 @@ deactivate_slave(struct rte_eth_dev *eth_dev, uint16_t port_id) RTE_ASSERT(active_count < RTE_DIM(internals->active_slaves)); internals->active_slave_count = active_count; + /* Resetting active_slave when reaches to max + * no of slaves in active list + */ + if (internals->active_slave >= active_count) + internals->active_slave = 0; + if (eth_dev->data->dev_started) { if (internals->mode == BONDING_MODE_8023AD) { bond_mode_8023ad_start(eth_dev); diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index 23cec2549..319215c0b 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -84,7 +84,7 @@ bond_ethdev_rx_burst(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) active_slave = 0; } - if (++internals->active_slave == slave_count) + if (++internals->active_slave >= slave_count) internals->active_slave = 0; return num_rx_total; } @@ -288,7 +288,7 @@ bond_ethdev_rx_burst_8023ad_fast_queue(void *queue, struct rte_mbuf **bufs, active_slave = 0; } - if (++internals->active_slave == slave_count) + if (++internals->active_slave >= slave_count) internals->active_slave = 0; return num_rx_total; @@ -474,7 +474,7 @@ bond_ethdev_rx_burst_8023ad(void *queue, struct rte_mbuf **bufs, idx = 0; } - if (++internals->active_slave == slave_count) + if (++internals->active_slave >= slave_count) internals->active_slave = 0; return num_rx_total;