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 5B684A0353; Wed, 13 Nov 2019 09:23:46 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id AAF0F1BED8; Wed, 13 Nov 2019 09:23:45 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id B9CCE1BED7 for ; Wed, 13 Nov 2019 09:23:44 +0100 (CET) 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 xAD8K2DR029060; Wed, 13 Nov 2019 00:23:43 -0800 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=wGWK64KoKgaVBofxJhVkKJke46fPBO+sD3V0IJ9U6E8=; b=AUBato7x9aZN7VeHCr/HZOAcM0Ft2WbpE6fDpkE3EIYU/gGTNBFLBdLeDsuiHuQbqE9D MU/DFpHeDxr1Fh0Z+PD26ycO7f0bcMUV458G2P7HfcwJ61a52MKRSkQjsIRyQhl8oq/c A275uPaUf0fSU8PD5S4aM6lA/hdq1l38ATmpX0fCiMUCg89WhaDV1eLlGSP7lM9ORydH lX0KK8djHnEbW/BmItMyoQ/fMJZzuJ+cH0LoDT710E5GKsvRqSMcAn3BAk2WU78tgtDR a5gc2wGDSJBKz0M5gytleLANFyR5b2zb/drKzevQppMOWd4+PBwFiDKmS7mJLKT8LgmC 3A== Received: from sc-exch02.marvell.com ([199.233.58.182]) by mx0b-0016f401.pphosted.com with ESMTP id 2w5wury098-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 13 Nov 2019 00:23:42 -0800 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Wed, 13 Nov 2019 00:23:31 -0800 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; Wed, 13 Nov 2019 00:23:31 -0800 Received: from kk-box-0.marvell.com (unknown [10.95.130.81]) by maili.marvell.com (Postfix) with ESMTP id B64003F703F; Wed, 13 Nov 2019 00:23:29 -0800 (PST) From: To: , , , Chas Williams CC: Krzysztof Kanas , Date: Wed, 13 Nov 2019 09:22:24 +0100 Message-ID: <20191113082224.24066-1-kkanas@marvell.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <2320f934-d755-13e0-3b61-9117913e7bd0@gmail.com> References: <2320f934-d755-13e0-3b61-9117913e7bd0@gmail.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,18.0.572 definitions=2019-11-13_01:2019-11-13,2019-11-13 signatures=0 Subject: [dpdk-dev] [PATCH v4] 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. The new_agg_id should be chosen as slave_id from slaves table in different selection modes. Fixes: 6d72657ce379 ("net/bonding: add other aggregator modes") Cc: danielx.t.mrzyglod@intel.com Signed-off-by: Krzysztof Kanas --- v4: * add fix for new_agg_id in AGG_COUNT and AGG_STABLE agg_selection v3: * fix incorrect reabse v2: * rebase patch to latest maste --- drivers/net/bonding/rte_eth_bond_8023ad.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.c b/drivers/net/bonding/rte_eth_bond_8023ad.c index 7d8da2b318f5..19e2e880a808 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,22 +717,22 @@ 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) - new_agg_id = slave_id; + new_agg_id = slaves[slave_id]; else new_agg_id = slaves[default_slave]; break; default: if (default_slave == slaves_count) - new_agg_id = slave_id; + new_agg_id = slaves[slave_id]; else new_agg_id = slaves[default_slave]; break; -- 2.21.0