Instead of capturing, it tracks interface statistics */
| 480 | |
| 481 | /* Instead of capturing, it tracks interface statistics */ |
| 482 | static void statistics_loop(void) |
| 483 | { |
| 484 | struct rte_eth_stats stats; |
| 485 | char name[RTE_ETH_NAME_MAX_LEN]; |
| 486 | uint16_t p; |
| 487 | int r; |
| 488 | |
| 489 | printf("%-15s %10s %10s\n", |
| 490 | "Interface", "Received", "Dropped"); |
| 491 | |
| 492 | while (!__atomic_load_n(&quit_signal, __ATOMIC_RELAXED)) { |
| 493 | RTE_ETH_FOREACH_DEV(p) { |
| 494 | if (rte_eth_dev_get_name_by_port(p, name) < 0) |
| 495 | continue; |
| 496 | |
| 497 | r = rte_eth_stats_get(p, &stats); |
| 498 | if (r < 0) { |
| 499 | fprintf(stderr, |
| 500 | "stats_get for port %u failed: %d (%s)\n", |
| 501 | p, r, strerror(-r)); |
| 502 | return; |
| 503 | } |
| 504 | |
| 505 | printf("%-15s %10"PRIu64" %10"PRIu64"\n", |
| 506 | name, stats.ipackets, |
| 507 | stats.imissed + stats.ierrors + stats.rx_nombuf); |
| 508 | } |
| 509 | sleep(1); |
| 510 | } |
| 511 | } |
| 512 | |
| 513 | static void |
| 514 | cleanup_pdump_resources(void) |
no test coverage detected