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 91BECA3160 for ; Fri, 11 Oct 2019 08:36:39 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 154141E957; Fri, 11 Oct 2019 08:36:39 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 9052F1E92B for ; Fri, 11 Oct 2019 08:36:37 +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 x9B6aYqJ031421; Thu, 10 Oct 2019 23:36:35 -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=C0BqC5DLtmnkWwmThSxlHm25mye4rr2b6OrETHHRysg=; b=nX9H5w3uuqOhDhrlb9dXJgkAyEukBp56Y1fC3sfCovFntw63TzNh+7MkLmSjk5Yn73l9 fRbBCS4jd6KOZVRdUPxcTI3+AvUKapnzfCSG8Z8gsxjwlfrEKJeIji0cMwRtAIOKdwls 0/7z1VoGXpgpxKr5z94wNy7e/QcSXYEa6HMA//RBhB1p2lTx3BJg4fcnc9kEK+Lcm9h1 zfge22zHrCF914GXkLZ83ItlKjzdlpgy03O/FbtshS3xgEa6n/150ycczextNa9HeDLA xGnH7c09b78Xzo86dQ/2ZzlD0rss6rXwjO5rILu1eGHCE9EVNxKULtwjGfElYCd7B1CN Ug== Received: from sc-exch01.marvell.com ([199.233.58.181]) by mx0b-0016f401.pphosted.com with ESMTP id 2vhdxc0ggt-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 10 Oct 2019 23:36:35 -0700 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 10 Oct 2019 23:36:13 -0700 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Thu, 10 Oct 2019 23:36:13 -0700 Received: from kk-box-0.marvell.com (unknown [10.95.130.190]) by maili.marvell.com (Postfix) with ESMTP id 4DBFA3F704F; Thu, 10 Oct 2019 23:36:11 -0700 (PDT) From: To: , , , Chas Williams CC: Krzysztof Kanas , Date: Fri, 11 Oct 2019 08:34:55 +0200 Message-ID: <20191011063456.19637-1-kkanas@marvell.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: References: 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-11_04:2019-10-10,2019-10-11 signatures=0 Subject: [dpdk-dev] [PATCH v3] 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 --- v3: * fix incorrect reabse v2: * rebase patch to latest master 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..698311e15c31 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). */ @@ -718,12 +717,12 @@ selection_logic(struct bond_dev_private *internals, uint16_t slave_id) switch (internals->mode4.agg_selection) { case AGG_COUNT: - mode_count_id = max_index(agg_count, slaves_count); - new_agg_id = mode_count_id; + agg_new_idx = max_index(agg_count, slaves_count); + new_agg_id = slaves[agg_new_idx]; 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