| 129 | |
| 130 | |
| 131 | static int |
| 132 | test_get_stats(int port) |
| 133 | { |
| 134 | struct rte_eth_stats stats; |
| 135 | struct rte_mbuf buf, *pbuf = &buf; |
| 136 | |
| 137 | printf("Testing ring PMD stats_get port %d\n", port); |
| 138 | |
| 139 | /* check stats of RXTX port, should all be zero */ |
| 140 | |
| 141 | rte_eth_stats_get(port, &stats); |
| 142 | if (stats.ipackets != 0 || stats.opackets != 0 || |
| 143 | stats.ibytes != 0 || stats.obytes != 0 || |
| 144 | stats.ierrors != 0 || stats.oerrors != 0) { |
| 145 | printf("Error: port %d stats are not zero\n", port); |
| 146 | return -1; |
| 147 | } |
| 148 | |
| 149 | /* send and receive 1 packet and check for stats update */ |
| 150 | if (rte_eth_tx_burst(port, 0, &pbuf, 1) != 1) { |
| 151 | printf("Error sending packet to port %d\n", port); |
| 152 | return -1; |
| 153 | } |
| 154 | |
| 155 | if (rte_eth_rx_burst(port, 0, &pbuf, 1) != 1) { |
| 156 | printf("Error receiving packet from port %d\n", port); |
| 157 | return -1; |
| 158 | } |
| 159 | |
| 160 | rte_eth_stats_get(port, &stats); |
| 161 | if (stats.ipackets != 1 || stats.opackets != 1 || |
| 162 | stats.ibytes != 0 || stats.obytes != 0 || |
| 163 | stats.ierrors != 0 || stats.oerrors != 0) { |
| 164 | printf("Error: port %d stats are not as expected\n", port); |
| 165 | return -1; |
| 166 | } |
| 167 | return 0; |
| 168 | } |
| 169 | |
| 170 | static int |
| 171 | test_stats_reset(int port) |
no test coverage detected