MCPcopy Create free account
hub / github.com/F-Stack/f-stack / ethdev_show

Function ethdev_show

dpdk/examples/pipeline/cli.c:389–438  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

387}
388
389static void
390ethdev_show(uint16_t port_id, char **out, size_t *out_size)
391{
392 char name[RTE_ETH_NAME_MAX_LEN];
393 struct rte_eth_dev_info info;
394 struct rte_eth_stats stats;
395 struct rte_ether_addr addr;
396 struct rte_eth_link link;
397 uint32_t length;
398 uint16_t mtu = 0;
399
400 if (!rte_eth_dev_is_valid_port(port_id))
401 return;
402
403 rte_eth_dev_get_name_by_port(port_id, name);
404 rte_eth_dev_info_get(port_id, &info);
405 rte_eth_stats_get(port_id, &stats);
406 rte_eth_macaddr_get(port_id, &addr);
407 rte_eth_link_get(port_id, &link);
408 rte_eth_dev_get_mtu(port_id, &mtu);
409
410 snprintf(*out, *out_size,
411 "%s: flags=<%s> mtu %u\n"
412 "\tether " RTE_ETHER_ADDR_PRT_FMT " rxqueues %u txqueues %u\n"
413 "\tport# %u speed %s\n"
414 "\tRX packets %" PRIu64" bytes %" PRIu64"\n"
415 "\tRX errors %" PRIu64" missed %" PRIu64" no-mbuf %" PRIu64"\n"
416 "\tTX packets %" PRIu64" bytes %" PRIu64"\n"
417 "\tTX errors %" PRIu64"\n\n",
418 name,
419 link.link_status ? "UP" : "DOWN",
420 mtu,
421 RTE_ETHER_ADDR_BYTES(&addr),
422 info.nb_rx_queues,
423 info.nb_tx_queues,
424 port_id,
425 rte_eth_link_speed_to_str(link.link_speed),
426 stats.ipackets,
427 stats.ibytes,
428 stats.ierrors,
429 stats.imissed,
430 stats.rx_nombuf,
431 stats.opackets,
432 stats.obytes,
433 stats.oerrors);
434
435 length = strlen(*out);
436 *out_size -= length;
437 *out += length;
438}
439
440
441static char cmd_ethdev_show_help[] =

Callers 1

cmd_ethdev_showFunction · 0.70

Calls 9

rte_eth_dev_info_getFunction · 0.85
rte_eth_stats_getFunction · 0.85
rte_eth_macaddr_getFunction · 0.85
rte_eth_link_getFunction · 0.85
rte_eth_dev_get_mtuFunction · 0.85
snprintfFunction · 0.85

Tested by

no test coverage detected