[V1] testpmd: add eeprom/module eeprom display

Message ID 20200901190727.76476-1-dliu@iol.unh.edu (mailing list archive)
State Changes Requested, archived
Delegated to: Ferruh Yigit
Headers
Series [V1] testpmd: add eeprom/module eeprom display |

Checks

Context Check Description
ci/Performance-Testing fail build patch failure
ci/travis-robot warning Travis build: failed
ci/Intel-compilation fail Compilation issues
ci/checkpatch warning coding style issues

Commit Message

dliu Sept. 1, 2020, 7:07 p.m. UTC
  Change display message.
Add EEPROM dump command
  "show port <port_id> eeprom"
Add module EEPROM dump command
     "show port <port_id> module_eeprom"
Commands will dump the content of the 
EEPROM/module EEPROM for the selected port.

Signed-off-by: David Liu <dliu@iol.unh.edu>
---
 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(+)
  

Comments

Ferruh Yigit Sept. 2, 2020, 10 a.m. UTC | #1
On 9/1/2020 8:07 PM, David Liu wrote:
> Change display message.
> Add EEPROM dump command
>   "show port <port_id> eeprom"
> Add module EEPROM dump command
>      "show port <port_id> module_eeprom"
> Commands will dump the content of the 
> EEPROM/module EEPROM for the selected port.
> 
> Signed-off-by: David Liu <dliu@iol.unh.edu>
> ---
>  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 <port_id> 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 <port_id> 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.
  
dliu Sept. 3, 2020, 4:40 p.m. UTC | #2
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 <ferruh.yigit@intel.com> wrote:

> On 9/1/2020 8:07 PM, David Liu wrote:
> > Change display message.
> > Add EEPROM dump command
> >   "show port <port_id> eeprom"
> > Add module EEPROM dump command
> >      "show port <port_id> module_eeprom"
> > Commands will dump the content of the
> > EEPROM/module EEPROM for the selected port.
> >
> > Signed-off-by: David Liu <dliu@iol.unh.edu>
> > ---
> >  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 <port_id> 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 <port_id> 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.
>
  
Ferruh Yigit Sept. 3, 2020, 6:40 p.m. UTC | #3
On 9/3/2020 5:40 PM, David Liu wrote:

> On Wed, Sep 2, 2020 at 6:00 AM Ferruh Yigit <ferruh.yigit@intel.com
> <mailto:ferruh.yigit@intel.com>> wrote:
> 
>     On 9/1/2020 8:07 PM, David Liu wrote:
>     > Change display message.
>     > Add EEPROM dump command
>     >   "show port <port_id> eeprom"
>     > Add module EEPROM dump command
>     >      "show port <port_id> module_eeprom"
>     > Commands will dump the content of the
>     > EEPROM/module EEPROM for the selected port.
>     >
>     > Signed-off-by: David Liu <dliu@iol.unh.edu <mailto:dliu@iol.unh.edu>>
>     > ---
>     >  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 <port_id> 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 <port_id> 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.
> 
> Yes, that sounds good. What do you think of having the command to be "show port
> (port_id|all) (module_eeprom|eeprom)"?
>

(Please don't top post, bad for archiving, copy/pasted from top of the email)

+1 to "(module_eeprom|eeprom)" part.

Not sure about "(port_id|all)", since this will hexdump the eeprom, I assume the
output will be long and not sure if there will be need to dump all ports at once.

So I suggest start with only "port_id" and "all" support later if there is a
need, unless you already need it.
  

Patch

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 <port_id> 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 <port_id> module_eeprom",
+	.tokens = {
+		(void *)&cmd_showmoduleeeprom_show,
+		(void *)&cmd_showmoduleeeprom_port,
+		(void *)&cmd_showmoduleeeprom_portnum,
+		(void *)&cmd_showmoduleeeprom_type,
+		NULL,
+	},
+};
+
 /* *** SHOW QUEUE INFO *** */
 struct cmd_showqueue_result {
 	cmdline_fixed_string_t show;
@@ -19325,6 +19410,8 @@  cmdline_parse_ctx_t main_ctx[] = {
 	(cmdline_parse_inst_t *)&cmd_load_from_file,
 	(cmdline_parse_inst_t *)&cmd_showport,
 	(cmdline_parse_inst_t *)&cmd_showqueue,
+        (cmdline_parse_inst_t *)&cmd_showeeprom,
+	(cmdline_parse_inst_t *)&cmd_showmoduleeeprom,
 	(cmdline_parse_inst_t *)&cmd_showportall,
 	(cmdline_parse_inst_t *)&cmd_showdevice,
 	(cmdline_parse_inst_t *)&cmd_showcfg,
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 8cf84ccd3..ea026a8eb 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -49,6 +49,7 @@ 
 #include <rte_pmd_bnxt.h>
 #endif
 #include <rte_gro.h>
+#include <rte_hexdump.h>
 
 #include "testpmd.h"
 
@@ -710,6 +711,131 @@  port_summary_display(portid_t port_id)
 		(unsigned int) link.link_speed);
 }
 
+void
+port_eeprom_display(portid_t port_id)
+{
+       struct rte_dev_eeprom_info einfo;
+       int ret;
+
+       if (port_id_is_invalid(port_id, ENABLED_WARN)) {
+               print_valid_ports();
+               return;
+       }
+
+       int len_eeprom = rte_eth_dev_get_eeprom_length(port_id);
+
+       if(len_eeprom < 0) {
+               switch (len_eeprom) {
+               case -ENODEV:
+		       printf("port index %d invalid\n", port_id);
+		       break;
+	       case -ENOTSUP:
+                       printf("operation not supported by device\n");
+                       break;
+               case -EIO:
+		       printf("device is removed\n");
+		       break;
+               default:
+                       printf("Unable to get module EEPROM: %d\n", ret);
+                       break;
+               }
+	       return;
+       }
+
+       char buf[len_eeprom];
+       printf("\nPort: %d\nModule EEPROM:\n", port_id);
+
+       einfo.offset = 0;
+       einfo.length = len_eeprom;
+       einfo.data = buf;
+
+       ret = rte_eth_dev_get_eeprom(port_id, &einfo);
+       if (ret != 0) {
+               switch (ret) {
+               case -ENODEV:
+		       printf("port index %d invalid\n", port_id);
+		       break;
+               case -ENOTSUP:
+                       printf("operation not supported by device\n");
+		       break;
+               case -EIO:
+		       printf("device is removed\n");
+		       break;
+	       default:
+		       printf("Unable to get module EEPROM: %d\n", ret);
+		       break;
+	       }
+	       return;
+       }
+       
+       rte_hexdump(stdout, "hexdump", einfo.data, einfo.length);
+       printf("Finish -- Total EEPROM length: %i bytes\n", len_eeprom);
+}
+
+void
+port_module_eeprom_displao(portid_t port_id)
+{
+       struct rte_eth_dev_module_info minfo;
+       struct rte_dev_eeprom_info einfo;
+       int ret;
+
+       if (port_id_is_invalid(port_id, ENABLED_WARN)) {
+               print_valid_ports();
+               return;
+       }
+
+       ret = rte_eth_dev_get_module_info(port_id, &minfo);
+       if (ret != 0) {
+               switch (ret) {
+               case -ENODEV:
+                       printf("port index %d invalid\n", port_id);
+                       break;
+               case -ENOTSUP:
+                       printf("operation not supported by device\n");
+                       break;
+               case -EIO:
+                       printf("device Iis removed\n");
+                       break;
+               default:
+                       printf("Unable to get module info: %d\n", ret);
+                       break;
+               }
+               return;
+       }
+
+       if (minfo.eeprom_len < 0){
+               printf("invalid module eeprom length");
+               return;
+       }
+
+       char buf[minfo.eeprom_len];
+       einfo.offset = 0;
+       einfo.length = minfo.eeprom_len;
+       einfo.data = buf;
+
+       ret = rte_eth_dev_get_module_eeprom(port_id, &einfo);
+       if (ret != 0) {
+               switch (ret) {
+               case -ENODEV:
+                       printf("port index %d invalid\n", port_id);
+                       break;
+               case -ENOTSUP:
+                       printf("operation not supported by device\n");
+                       break;
+               case -EIO:
+                       printf("device Iis removed\n");
+                       break;
+               default:
+                       printf("Unable to get module EEPROM: %d\n", ret);
+                       break;
+               }
+               return;
+       }
+
+       printf("\nPort: %d\nEEPROM:\n", port_id);
+       rte_hexdump(stdout, "hexdump", einfo.data, einfo.length);
+}
+
 void
 port_offload_cap_display(portid_t port_id)
 {
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 7a7c73f79..e3a0d17e5 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -714,6 +714,8 @@  void nic_stats_mapping_display(portid_t port_id);
 void device_infos_display(const char *identifier);
 void port_infos_display(portid_t port_id);
 void port_summary_display(portid_t port_id);
+void port_eeprom_display(portid_t port_id);
+void port_module_eeprom_display(portid_t port_id);
 void port_summary_header_display(void);
 void port_offload_cap_display(portid_t port_id);
 void rx_queue_infos_display(portid_t port_idi, uint16_t queue_id);
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index 5103ff925..f3e2211ab 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -218,6 +218,20 @@  For example:
      nvgre
      vxlan-gpe
 
+show port eeprom
+~~~~~~~~~~~~~~~~
+
+Display the EEPROM informatioon for given port_id::
+
+   testpmd> show port (port_id) eeprom
+
+show port module eeprom
+~~~~~~~~~~~~~~~~~~~~~~~
+
+Display the module EEPROM informatioon for given port_id::
+
+   testpmd> show port (port_id) module_eeprom
+
 show port rss reta
 ~~~~~~~~~~~~~~~~~~