From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id D9334A3160 for ; Thu, 10 Oct 2019 10:28:12 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B68A71E964; Thu, 10 Oct 2019 10:28:10 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 9458E1E95C for ; Thu, 10 Oct 2019 10:28:08 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id x9A8LTPd025710; Thu, 10 Oct 2019 01:28:02 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0818; bh=Do8T1qJxcU3kKn4qNc+HjLOMguxMqSzF79a4+ulvNT0=; b=g6iv2imVlys6zR/yXtr/HNZ3+KjGFPz7rYsLgD0inLxQy5od6WnX9IDnmF7YbmdLw6Gv S8wvjcnsxJMKfXyHznQaqocFKCQkZUA2IIMqSFmZrqGWYo5UAVNHKznNxGyb3y7VlQzF /XwjB99IWOJDpSS1mK1bt3/J1hbIX/p6r6nek4D0UeknpfnX0zQ9O8zFEhQOu73kaQHk EPqkz3ZioM9vgLadq8hkw/nig1xe/NiYtRTRhwMdUFSivtDjVO+bSXLeazLjAlDrw6F9 ZTJQWJP2mV/L9RI3IIN1MiX8EItWRjD19dE15XMCH+dv7t5SAaAcJWOoqxoGQyo1ayPe ow== Received: from sc-exch02.marvell.com ([199.233.58.182]) by mx0b-0016f401.pphosted.com with ESMTP id 2vhdxbv3m6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 10 Oct 2019 01:28:02 -0700 Received: from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 10 Oct 2019 01:28:00 -0700 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Thu, 10 Oct 2019 01:28:00 -0700 Received: from kk-box-0.marvell.com (unknown [10.95.130.190]) by maili.marvell.com (Postfix) with ESMTP id DA2C73F703F; Thu, 10 Oct 2019 01:27:58 -0700 (PDT) From: To: , , Chas Williams CC: Krzysztof Kanas , Date: Thu, 10 Oct 2019 10:27:04 +0200 Message-ID: <20191010082705.22109-1-kkanas@marvell.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <8c50261a-4bed-3669-21f5-066c526378e6@linux.intel.com> References: <8c50261a-4bed-3669-21f5-066c526378e6@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,1.0.8 definitions=2019-10-10_04:2019-10-08,2019-10-10 signatures=0 Subject: [dpdk-dev] [PATCH v2] net/bonding: fix selection logic 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" From: Krzysztof Kanas Arrays agg_count and agg_bandwidth should be indexed by slave_id not by aggregator port_id. Fixes: 6d72657ce379 ("net/bonding: add other aggregator modes") Cc: danielx.t.mrzyglod@intel.com Signed-off-by: Krzysztof Kanas --- drivers/net/bonding/rte_eth_bond_8023ad.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.c b/drivers/net/bonding/rte_eth_bond_8023ad.c index 7d8da2b318f5..5b489b070b09 100644 --- a/drivers/net/bonding/rte_eth_bond_8023ad.c +++ b/drivers/net/bonding/rte_eth_bond_8023ad.c @@ -673,9 +673,8 @@ selection_logic(struct bond_dev_private *internals, uint16_t slave_id) uint64_t agg_bandwidth[RTE_MAX_ETHPORTS] = {0}; uint64_t agg_count[RTE_MAX_ETHPORTS] = {0}; uint16_t default_slave = 0; - uint16_t mode_count_id; - uint16_t mode_band_id; struct rte_eth_link link_info; + uint16_t agg_new_idx = 0; int ret; slaves = internals->active_slaves; @@ -696,8 +695,8 @@ selection_logic(struct bond_dev_private *internals, uint16_t slave_id) slaves[i], rte_strerror(-ret)); continue; } - agg_count[agg->aggregator_port_id] += 1; - agg_bandwidth[agg->aggregator_port_id] += link_info.link_speed; + agg_count[i] += 1; + agg_bandwidth[i] += link_info.link_speed; /* Actors system ID is not checked since all slave device have the same * ID (MAC address). */ @@ -717,13 +716,13 @@ selection_logic(struct bond_dev_private *internals, uint16_t slave_id) } switch (internals->mode4.agg_selection) { + agg_new_idx = max_index(agg_count, slaves_count); + new_agg_id = slaves[agg_new_idx]; case AGG_COUNT: - mode_count_id = max_index(agg_count, slaves_count); - new_agg_id = mode_count_id; break; case AGG_BANDWIDTH: - mode_band_id = max_index(agg_bandwidth, slaves_count); - new_agg_id = mode_band_id; + agg_new_idx = max_index(agg_bandwidth, slaves_count); + new_agg_id = slaves[agg_new_idx]; break; case AGG_STABLE: if (default_slave == slaves_count) -- 2.21.0