| 757 | } |
| 758 | |
| 759 | static void |
| 760 | nic_xstats_by_ids_display(uint16_t port_id, uint64_t *ids, int len) |
| 761 | { |
| 762 | struct rte_eth_xstat_name *xstats_names; |
| 763 | uint64_t *values; |
| 764 | int ret, i; |
| 765 | static const char *nic_stats_border = "########################"; |
| 766 | |
| 767 | values = malloc(sizeof(*values) * len); |
| 768 | if (values == NULL) { |
| 769 | printf("Cannot allocate memory for xstats\n"); |
| 770 | return; |
| 771 | } |
| 772 | |
| 773 | xstats_names = malloc(sizeof(struct rte_eth_xstat_name) * len); |
| 774 | if (xstats_names == NULL) { |
| 775 | printf("Cannot allocate memory for xstat names\n"); |
| 776 | free(values); |
| 777 | return; |
| 778 | } |
| 779 | |
| 780 | if (len != rte_eth_xstats_get_names_by_id( |
| 781 | port_id, xstats_names, len, ids)) { |
| 782 | printf("Cannot get xstat names\n"); |
| 783 | goto err; |
| 784 | } |
| 785 | |
| 786 | printf("###### NIC extended statistics for port %-2d #########\n", |
| 787 | port_id); |
| 788 | printf("%s############################\n", nic_stats_border); |
| 789 | ret = rte_eth_xstats_get_by_id(port_id, ids, values, len); |
| 790 | if (ret < 0 || ret > len) { |
| 791 | printf("Cannot get xstats\n"); |
| 792 | goto err; |
| 793 | } |
| 794 | |
| 795 | for (i = 0; i < len; i++) |
| 796 | printf("%s: %"PRIu64"\n", |
| 797 | xstats_names[i].name, |
| 798 | values[i]); |
| 799 | |
| 800 | printf("%s############################\n", nic_stats_border); |
| 801 | err: |
| 802 | free(values); |
| 803 | free(xstats_names); |
| 804 | } |
| 805 | |
| 806 | static void |
| 807 | nic_xstats_display(uint16_t port_id) |
no test coverage detected