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

Function ethdev_show

dpdk/app/graph/ethdev.c:192–243  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

190
191
192static int
193ethdev_show(const char *name)
194{
195 uint16_t mtu = 0, port_id = 0;
196 struct rte_eth_dev_info info;
197 struct rte_eth_stats stats;
198 struct rte_ether_addr addr;
199 struct rte_eth_link link;
200 uint32_t length;
201 int rc;
202
203 rc = rte_eth_dev_get_port_by_name(name, &port_id);
204 if (rc < 0)
205 return rc;
206
207 rte_eth_dev_info_get(port_id, &info);
208 rte_eth_stats_get(port_id, &stats);
209 rte_eth_macaddr_get(port_id, &addr);
210 rte_eth_link_get(port_id, &link);
211 rte_eth_dev_get_mtu(port_id, &mtu);
212
213 length = strlen(conn->msg_out);
214 conn->msg_out += length;
215 snprintf(conn->msg_out, conn->msg_out_len_max,
216 "%s: flags=<%s> mtu %u\n"
217 "\tether " RTE_ETHER_ADDR_PRT_FMT " rxqueues %u txqueues %u\n"
218 "\tport# %u speed %s\n"
219 "\tRX packets %" PRIu64" bytes %" PRIu64"\n"
220 "\tRX errors %" PRIu64" missed %" PRIu64" no-mbuf %" PRIu64"\n"
221 "\tTX packets %" PRIu64" bytes %" PRIu64"\n"
222 "\tTX errors %" PRIu64"\n\n",
223 name,
224 link.link_status ? "UP" : "DOWN",
225 mtu,
226 RTE_ETHER_ADDR_BYTES(&addr),
227 info.nb_rx_queues,
228 info.nb_tx_queues,
229 port_id,
230 rte_eth_link_speed_to_str(link.link_speed),
231 stats.ipackets,
232 stats.ibytes,
233 stats.ierrors,
234 stats.imissed,
235 stats.rx_nombuf,
236 stats.opackets,
237 stats.obytes,
238 stats.oerrors);
239
240 length = strlen(conn->msg_out);
241 conn->msg_out_len_max -= length;
242 return 0;
243}
244
245static int
246ethdev_ip4_addr_add(const char *name, struct ipv4_addr_config *config)

Callers 1

cli_ethdev_showFunction · 0.70

Calls 8

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