| 762 | } |
| 763 | |
| 764 | static void |
| 765 | ntb_stats_clear(void) |
| 766 | { |
| 767 | int nb_ids, i; |
| 768 | uint32_t *ids; |
| 769 | |
| 770 | /* Clear NTB dev stats */ |
| 771 | nb_ids = rte_rawdev_xstats_names_get(dev_id, NULL, 0); |
| 772 | if (nb_ids <= 0) { |
| 773 | printf("Error: Cannot get count of xstats\n"); |
| 774 | return; |
| 775 | } |
| 776 | ids = malloc(sizeof(uint32_t) * nb_ids); |
| 777 | if (ids == NULL) { |
| 778 | printf("Cannot allocate memory for statistics IDs\n"); |
| 779 | return; |
| 780 | } |
| 781 | for (i = 0; i < nb_ids; i++) |
| 782 | ids[i] = i; |
| 783 | rte_rawdev_xstats_reset(dev_id, ids, nb_ids); |
| 784 | printf("\n statistics for NTB port %d cleared\n", dev_id); |
| 785 | |
| 786 | /* Clear Ethdev stats if have any */ |
| 787 | if (fwd_mode == IOFWD && eth_port_id != RTE_MAX_ETHPORTS) { |
| 788 | rte_eth_stats_reset(eth_port_id); |
| 789 | printf("\n statistics for ETH port %d cleared\n", eth_port_id); |
| 790 | } |
| 791 | } |
| 792 | |
| 793 | static inline void |
| 794 | ntb_calculate_throughput(uint16_t port) { |
no test coverage detected