[dpdk-dev] [PATCH v1] testpmd: add new command for show port info
Rami Rosen
roszenrami at gmail.com
Wed Aug 29 07:36:44 CEST 2018
Hi,
Thanks for this patch, this patch is something needed.
It seems to me that adding get_valid_ports() is not necessary, as you have
rte_eth_dev_count_avail(), which is implemented the same; please look
in rte_ethdev.[c,h; and actually, testpmd uses
rte_eth_dev_count_avail(), for example, in attach_port() in testpmd.c.
Besides, it should return uint16_t and not int, as DPDK ports are 16
bits, and count is defined as uint16_t.
+int get_valid_ports(void)
+{
+ portid_t pid;
+ uint16_t count = 0;
+
+ RTE_ETH_FOREACH_DEV(pid) {
+ count ++;
+ }
+ return count;
+}
and in rte_ethdev.c you have:
uint16_t
rte_eth_dev_count_avail(void)
{
uint16_t p;
uint16_t count;
count = 0;
RTE_ETH_FOREACH_DEV(p)
count++;
return count;
}
Regards,
Rami Rosen
More information about the dev
mailing list