From: "Gaëtan Rivet" <gaetan.rivet@6wind.com>
To: Ferruh Yigit <ferruh.yigit@intel.com>
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH v1] testpmd: eeprom display
Date: Fri, 21 Sep 2018 18:13:27 +0200 [thread overview]
Message-ID: <20180921161327.q54z27v2wrt27q4f@bidouze.vm.6wind.com> (raw)
In-Reply-To: <582815f0-926e-8977-c8d1-3d4e1c5e2fd4@intel.com>
On Fri, Sep 21, 2018 at 04:41:10PM +0100, Ferruh Yigit wrote:
> On 9/18/2018 9:59 AM, Gaetan Rivet wrote:
> > The interactive command
> >
> > show port eeprom <id>
> >
> > will dump the content of the EEPROM for the selected port.
> > Dumping eeprom of all ports at once is not supported.
> >
> > Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
>
> <...>
>
> > +void
> > +port_eeprom_display(portid_t port_id)
> > +{
> > + struct rte_eth_dev_module_info minfo;
> > + struct rte_dev_eeprom_info einfo;
> > + char buf[1024];
> > + int ret;
> > +
> > + if (port_id == (portid_t)RTE_PORT_ALL)
> > + return;
> > +
> > + ret = rte_eth_dev_get_module_info(port_id, &minfo);
> > + if (ret) {
> > + printf("Unable to get module info: %d\n", ret);
> > + return;
> > + }
> > +
> > + einfo.offset = 0;
> > + einfo.length = minfo.eeprom_len;
> > + einfo.data = buf;
> > +
> > + ret = rte_eth_dev_get_module_eeprom(port_id, &einfo);
> > + if (ret) {
> > + printf("Unable to get module EEPROM: %d\n", ret);
> > + return;
> > + }
> > +
> > + printf("Port %hhu EEPROM:\n", port_id);
>
> Causing build error [1], there are various formatting used for printing port_id
> [2], do we need this %hhu accuracy, I am for %u since port_id is an unsigned
> value result should be same.
>
> [1]
> printf("Port %hhu EEPROM:\n", port_id);
> ~~~~ ^~~~~~~
> %hu
>
> [2]
> %d, %u, %PRIu8 [wrong], %PRIu16
You're right, no need for %hhu.
I'd prefer myself using PRIu8 only by principle, but I think consistency
is better, and testpmd uses %u more often.
On another note, I think this command was misnamed anyway.
> show port sfp_eeprom 0
is more correct, because we won't get the actual port EEPROM.
I will send a v2, thanks for reading Ferruh.
--
Gaëtan Rivet
6WIND
next prev parent reply other threads:[~2018-09-21 16:13 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-18 8:59 Gaetan Rivet
2018-09-18 11:09 ` Gaëtan Rivet
2018-09-21 15:41 ` Ferruh Yigit
2018-09-21 16:13 ` Gaëtan Rivet [this message]
2018-09-21 16:49 ` Ferruh Yigit
2018-10-05 21:58 ` [dpdk-dev] [PATCH v2] testpmd: sfp " Gaetan Rivet
2018-10-08 10:36 ` Iremonger, Bernard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180921161327.q54z27v2wrt27q4f@bidouze.vm.6wind.com \
--to=gaetan.rivet@6wind.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).