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 465E2A3160 for ; Thu, 10 Oct 2019 15:30:23 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 85BC71E9AA; Thu, 10 Oct 2019 15:30:22 +0200 (CEST) Received: from mail-qt1-f195.google.com (mail-qt1-f195.google.com [209.85.160.195]) by dpdk.org (Postfix) with ESMTP id 527B01E9A4 for ; Thu, 10 Oct 2019 15:30:21 +0200 (CEST) Received: by mail-qt1-f195.google.com with SMTP id 3so8738598qta.1 for ; Thu, 10 Oct 2019 06:30:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=P0h14sc55pmockKqURNSZ7ObnNXsdi6Aum7E7KlYPvI=; b=Hlp72XTu+pd7sqTr80K+peejs3wWhD8750HyDAnznjiGD/OZrFOzSVFwiTyEu+Q8/Z 6VBOdS+13cM8ECrCXBihsd7iKj9e1L/LMG4WyWrtZaJTNnaqGk6h6itGGxD3sbLNgGCr ZCbM/tINCM5CX+qB8Hy33EWqSEOEGQi+eCXaFdb7dlfE4LwyxubJ5ZWUvvg4RchZFP9U E1GuTx5CxVJlHqiYDyUHJZu6awMwoZHom+Qx/p89UtdQDbaN7HQwbA3OFa2eJoQ+Dw6n DtMXeaWz+Ao8EG5fovZwdVY1RMBt9Hg/1gZGpKMbLweGxPALykdddWVgaprAi8tABSJH fG6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=P0h14sc55pmockKqURNSZ7ObnNXsdi6Aum7E7KlYPvI=; b=CQI6dTdVO/QxbW3PC46l3CDACjRWKycjRERN2lCTcGQL/MOa7VUyP9NqKw/0f2iWyX 9dKycnainzvNplWQN9A0ZDyLjPOZZPvnvtMh9RPvD6mvwAXQqLSvtXdy7hX6q+2UChxR ClgEJxIFyxzFBapyeRbUgnDZpDd25dMYaGZRQZC0cmEsq5EgZcOvw6E/v3z1kxy0yKQL 4hY4cj+nMoMa2FDsBsPM1rSm8JE9SdWdeTFeRw6IPpEd5Pqlx+Ar65coEx6ujil+szKA ab5fQmx/lK9X/gUBC0ltNj5wOQptNcWLem6NOVZ65HY9jEtq8Tj8MGx9K8UKdzxe+bJ3 0qLQ== X-Gm-Message-State: APjAAAWSaXGLCZf2D3TATJReo4ky+UnckSIboL2LmSk67Dpju1zGrjJh FBIRKAMl5UnIaA6LU5HL4Qc= X-Google-Smtp-Source: APXvYqx8VPL3zLhwY6n1MBdQaJY99dmiTmebMzvLTuNorYLnPkMQf5XvWJqx8TK6A7gsIQ65Ac7qCw== X-Received: by 2002:ad4:40cc:: with SMTP id x12mr10090226qvp.1.1570714220585; Thu, 10 Oct 2019 06:30:20 -0700 (PDT) Received: from [192.168.1.21] ([107.77.240.81]) by smtp.gmail.com with ESMTPSA id c185sm2845842qkg.74.2019.10.10.06.30.18 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 10 Oct 2019 06:30:19 -0700 (PDT) To: kkanas@marvell.com, dev@dpdk.org, david.marchand@redhat.com, Chas Williams Cc: danielx.t.mrzyglod@intel.com References: <8c50261a-4bed-3669-21f5-066c526378e6@linux.intel.com> <20191010082705.22109-1-kkanas@marvell.com> From: Chas Williams <3chas3@gmail.com> Message-ID: Date: Thu, 10 Oct 2019 09:30:17 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20191010082705.22109-1-kkanas@marvell.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [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" On 10/10/19 4:27 AM, kkanas@marvell.com wrote: > 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; This change doesn't look right. Did you really want to do this, put the code outside of the case statement? > 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) >