[dpdk-dev] [PATCH v1] testpmd: eeprom display
Gaëtan Rivet
gaetan.rivet at 6wind.com
Fri Sep 21 18:13:27 CEST 2018
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 at 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
More information about the dev
mailing list