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 26757A04BF; Thu, 3 Sep 2020 18:40:52 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 79CD81C0CE; Thu, 3 Sep 2020 18:40:51 +0200 (CEST) Received: from mail-lj1-f196.google.com (mail-lj1-f196.google.com [209.85.208.196]) by dpdk.org (Postfix) with ESMTP id A8F671C0C2 for ; Thu, 3 Sep 2020 18:40:49 +0200 (CEST) Received: by mail-lj1-f196.google.com with SMTP id t23so4545267ljc.3 for ; Thu, 03 Sep 2020 09:40:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=AkVLPBIzEe8YEIS1ZtE4gRSj8soQJYdXsv5tdtBxPKI=; b=FLvJBHmg2y15csviVuYC5bZs6yeoj2WtwYH6hIZr9EEafQ+m7G5544+cHoj7nqcdCX MitIiHAFaUtP7PM8DjSbdS+a3w627ZNkzcYC61O8blCoNvw1eEAYvO4K4NJoFq/dY69m e8Fle7JkA2vbRaiTWwTXsHdGyfzlo2e54UItQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=AkVLPBIzEe8YEIS1ZtE4gRSj8soQJYdXsv5tdtBxPKI=; b=d4oaj7d3rTBuINm86mU2t+X/YG3K2cAl+rgDiyJKKXru6/qXzV79hxkQXPAGxbE1Z5 DnT2VAnidbqAF2V2C8gmfovZW0RmXss2yumYDYB/+BryCpxJt+vcFn+ZSlEHv012o0Ql NIp6Rmsyt3odhFO+QmHxL+X4Wxk9sLq9pooJNkSg0J1k23usVhqfpYsFwML9LpOarCqd 30BGgkZQqk1WGkjSLRDe0xXQ/koYmyBHxYOdqHTiBlFw5UuDujvucdZLQXvtRL1qFM7L zU+W3LLliaDeU2CITqgFyexiEMD3foxVmR5Jh3bftZ84ZxqirKrd9COjbrtbxG0oXFYk lZSQ== X-Gm-Message-State: AOAM530aRLCWZU/QxS6HKDuOutpYTwAw2ZqpUsiIQlNxMMXV2IWtOkQF ApIJDaJcBc4tYl1YqGwcuQiOqT7nDSXBAQ9bSqWqDw== X-Google-Smtp-Source: ABdhPJz3C0jJta3Chelxod2T5G2qDxposYGojZv0WjWsisXWMMIal2Soa/Nw/nDa8xNunMgWT8qkgPkDij72oYV7Vgg= X-Received: by 2002:a2e:3a10:: with SMTP id h16mr1690704lja.193.1599151249216; Thu, 03 Sep 2020 09:40:49 -0700 (PDT) MIME-Version: 1.0 References: <20200901190727.76476-1-dliu@iol.unh.edu> In-Reply-To: From: David Liu Date: Thu, 3 Sep 2020 12:40:13 -0400 Message-ID: To: Ferruh Yigit Cc: dpdk-dev , Lincoln Lavoie , Thomas Monjalon Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] [PATCH V1] testpmd: add eeprom/module eeprom display 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" Yes, that sounds good. What do you think of having the command to be "show port (port_id|all) (module_eeprom|eeprom)"? On Wed, Sep 2, 2020 at 6:00 AM Ferruh Yigit wrote: > On 9/1/2020 8:07 PM, David Liu wrote: > > Change display message. > > Add EEPROM dump command > > "show port eeprom" > > Add module EEPROM dump command > > "show port module_eeprom" > > Commands will dump the content of the > > EEPROM/module EEPROM for the selected port. > > > > Signed-off-by: David Liu > > --- > > app/test-pmd/cmdline.c | 87 ++++++++++++++ > > app/test-pmd/config.c | 126 ++++++++++++++++++++ > > app/test-pmd/testpmd.h | 2 + > > doc/guides/testpmd_app_ug/testpmd_funcs.rst | 14 +++ > > 4 files changed, 229 insertions(+) > > > > diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c > > index a037a55c6..71c98dd96 100644 > > --- a/app/test-pmd/cmdline.c > > +++ b/app/test-pmd/cmdline.c > > @@ -166,6 +166,12 @@ static void cmd_help_long_parsed(void > *parsed_result, > > "show port > (info|stats|summary|xstats|fdir|stat_qmap|dcb_tc|cap) (port_id|all)\n" > > " Display information for port_id, or all.\n\n" > > > > + "show port (port_id) eeprom \n" > > + " Display the EEPROM infomation for given > port_id.\n\n" > > + > > + "show port (port_id) module_eeprom \n" > > + " Display the port moudle EEPROM infomation for > given port_id.\n\n" > > + > > "show port X rss reta (size) (mask0,mask1,...)\n" > > " Display the rss redirection table entry > indicated" > > " by masks on port X. size is used to indicate the" > > @@ -7594,6 +7600,85 @@ cmdline_parse_inst_t cmd_showdevice = { > > NULL, > > }, > > }; > > + > > +/* ** SHOW EEPROM INFO *** */ > > +struct cmd_showeeprom_result { > > + cmdline_fixed_string_t show; > > + cmdline_fixed_string_t port; > > + cmdline_fixed_string_t type; > > + uint16_t portnum; > > +}; > > + > > +static void cmd_showeeprom_parsed(void *parsed_result, > > + __rte_unused struct cmdline *cl, > > + __rte_unused void *data) > > +{ > > + struct cmd_showeeprom_result *res = parsed_result; > > + > > + port_eeprom_display(res->portnum); > > +} > > + > > +cmdline_parse_token_string_t cmd_showeeprom_show = > > + TOKEN_STRING_INITIALIZER(struct cmd_showeeprom_result, show, > "show"); > > +cmdline_parse_token_string_t cmd_showeeprom_port = > > + TOKEN_STRING_INITIALIZER(struct cmd_showeeprom_result, port, > "port"); > > +cmdline_parse_token_num_t cmd_showeeprom_portnum = > > + TOKEN_NUM_INITIALIZER(struct cmd_showeeprom_result, portnum, > UINT16); > > +cmdline_parse_token_string_t cmd_showeeprom_type = > > + TOKEN_STRING_INITIALIZER(struct cmd_showeeprom_result, type, > "eeprom"); > > + > > +cmdline_parse_inst_t cmd_showeeprom = { > > + .f = cmd_showeeprom_parsed, > > + .data = NULL, > > + .help_str = "show port eeprom", > > + .tokens = { > > + (void *)&cmd_showeeprom_show, > > + (void *)&cmd_showeeprom_port, > > + (void *)&cmd_showeeprom_portnum, > > + (void *)&cmd_showeeprom_type, > > + NULL, > > + }, > > +}; > > + > > +/* ** SHOW MODULE EEPROM INFO *** */ > > +struct cmd_showmoduleeeprom_result { > > + cmdline_fixed_string_t show; > > + cmdline_fixed_string_t port; > > + cmdline_fixed_string_t type; > > + uint16_t portnum; > > +}; > > + > > +static void cmd_showmoduleeeprom_parsed(void *parsed_result, > > + __rte_unused struct cmdline *cl, > > + __rte_unused void *data) > > +{ > > + struct cmd_showmoduleeeprom_result *res = parsed_result; > > + > > + port_module_eeprom_display(res->portnum); > > +} > > + > > +cmdline_parse_token_string_t cmd_showmoduleeeprom_show = > > + TOKEN_STRING_INITIALIZER(struct cmd_showmoduleeeprom_result, > show, "show"); > > +cmdline_parse_token_string_t cmd_showmoduleeeprom_port = > > + TOKEN_STRING_INITIALIZER(struct cmd_showmoduleeeprom_result, > port, "port"); > > +cmdline_parse_token_num_t cmd_showmoduleeeprom_portnum = > > + TOKEN_NUM_INITIALIZER(struct cmd_showmoduleeeprom_result, portnum, > UINT16); > > +cmdline_parse_token_string_t cmd_showmoduleeeprom_type = > > + TOKEN_STRING_INITIALIZER(struct cmd_showmoduleeeprom_result, type, > "module_eeprom"); > > + > > +cmdline_parse_inst_t cmd_showmoduleeeprom = { > > + .f = cmd_showmoduleeeprom_parsed, > > + .data = NULL, > > + .help_str = "show port module_eeprom", > > + .tokens = { > > + (void *)&cmd_showmoduleeeprom_show, > > + (void *)&cmd_showmoduleeeprom_port, > > + (void *)&cmd_showmoduleeeprom_portnum, > > + (void *)&cmd_showmoduleeeprom_type, > > + NULL, > > + }, > > +};> + > > Since both commands are simple and related, what do you think merging their > implementation? This reduces the clutter. > Please check '#' usage in the 'TOKEN_STRING_INITIALIZER', and "port > start|stop|close all" implementation can be sample. >