From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 44F4B374 for ; Fri, 30 Jun 2017 17:39:55 +0200 (CEST) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Jun 2017 08:39:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.40,287,1496127600"; d="scan'208";a="121362290" Received: from dwdohert-dpdk.ir.intel.com ([163.33.210.152]) by fmsmga006.fm.intel.com with ESMTP; 30 Jun 2017 08:39:53 -0700 To: RongQiang Xie , jingjing.wu@intel.com Cc: dev@dpdk.org References: <201706300758.v5U7wu8t037841@mse01.zte.com.cn> From: Declan Doherty Message-ID: Date: Fri, 30 Jun 2017 16:39:08 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 MIME-Version: 1.0 In-Reply-To: <201706300758.v5U7wu8t037841@mse01.zte.com.cn> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH] app/testpmd:add bond type description 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: , X-List-Received-Date: Fri, 30 Jun 2017 15:39:56 -0000 On 30/06/17 08:56, RongQiang Xie wrote: > In function cmd_show_bonding_config_parsed() used number represent > the bond type,in order more detailed,add bond type description > otherwise we may confused about the number type. > And also,the primary port just use in mode active backup and tlb, > so,when the mode is active backup or tlb show the primary port info > may be more appropriate. > > Signed-off-by: RongQiang Xie > --- > app/test-pmd/cmdline.c | 17 +++++++++++------ > 1 file changed, 11 insertions(+), 6 deletions(-) > > diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c > index ff8ffd2..45845a4 100644 > --- a/app/test-pmd/cmdline.c > +++ b/app/test-pmd/cmdline.c > @@ -4390,7 +4390,9 @@ static void cmd_show_bonding_config_parsed(void *parsed_result, > printf("\tFailed to get bonding mode for port = %d\n", port_id); > return; > } else > - printf("\tBonding mode: %d\n", bonding_mode); > + printf("\tBonding mode: %d ", bonding_mode); > + printf("[0:Round Robin, 1:Active Backup, 2:Balance, 3:Broadcast, "); > + printf("\n\t\t\t4:802.3AD, 5:Adaptive TLB, 6:Adaptive Load Balancing]\n"); > Good idea, but it would be clearer if we just returned the actual mode string so the user doesn't need to parse it themselves, like below. - } else - printf("\tBonding mode: %d ", bonding_mode); - printf("[0:Round Robin, 1:Active Backup, 2:Balance, 3:Broadcast, "); - printf("\n\t\t\t4:802.3AD, 5:Adaptive TLB, 6:Adaptive Load Balancing]\n"); + } + + printf("\tBonding mode: %d (", bonding_mode); + switch (bonding_mode) { + case BONDING_MODE_ROUND_ROBIN: + printf("round-robin"); + break; + case BONDING_MODE_ACTIVE_BACKUP: + printf("active-backup"); + break; + case BONDING_MODE_BALANCE: + printf("link-aggregation"); + break; + case BONDING_MODE_BROADCAST: + printf("broadcast"); + break; + case BONDING_MODE_8023AD: + printf("link-aggregation-802.3ad"); + break; + case BONDING_MODE_TLB: + printf("transmit-load-balancing"); + break; + case BONDING_MODE_ALB: + printf("adaptive-load-balancing"); + break; + default: + printf("unknown-mode"); + } + printf(")\n"); > if (bonding_mode == BONDING_MODE_BALANCE) { > int balance_xmit_policy; > @@ -4454,12 +4456,15 @@ static void cmd_show_bonding_config_parsed(void *parsed_result, > > } > > - primary_id = rte_eth_bond_primary_get(port_id); > - if (primary_id < 0) { > - printf("\tFailed to get primary slave for port = %d\n", port_id); > - return; > - } else > + if (bonding_mode == BONDING_MODE_ACTIVE_BACKUP || > + bonding_mode == BONDING_MODE_TLB) { > + primary_id = rte_eth_bond_primary_get(port_id); > + if (primary_id < 0) { > + printf("\tFailed to get primary slave for port = %d\n", port_id); > + return; > + } > printf("\tPrimary: [%d]\n", primary_id); > + } > > } > >