| 168 | } |
| 169 | |
| 170 | static int |
| 171 | test_stats_reset(int port) |
| 172 | { |
| 173 | struct rte_eth_stats stats; |
| 174 | struct rte_mbuf buf, *pbuf = &buf; |
| 175 | |
| 176 | printf("Testing ring PMD stats_reset port %d\n", port); |
| 177 | |
| 178 | rte_eth_stats_reset(port); |
| 179 | |
| 180 | /* check stats of RXTX port, should all be zero */ |
| 181 | rte_eth_stats_get(port, &stats); |
| 182 | if (stats.ipackets != 0 || stats.opackets != 0 || |
| 183 | stats.ibytes != 0 || stats.obytes != 0 || |
| 184 | stats.ierrors != 0 || stats.oerrors != 0) { |
| 185 | printf("Error: port %d stats are not zero\n", port); |
| 186 | return -1; |
| 187 | } |
| 188 | |
| 189 | /* send and receive 1 packet and check for stats update */ |
| 190 | if (rte_eth_tx_burst(port, 0, &pbuf, 1) != 1) { |
| 191 | printf("Error sending packet to port %d\n", port); |
| 192 | return -1; |
| 193 | } |
| 194 | |
| 195 | if (rte_eth_rx_burst(port, 0, &pbuf, 1) != 1) { |
| 196 | printf("Error receiving packet from port %d\n", port); |
| 197 | return -1; |
| 198 | } |
| 199 | |
| 200 | rte_eth_stats_get(port, &stats); |
| 201 | if (stats.ipackets != 1 || stats.opackets != 1 || |
| 202 | stats.ibytes != 0 || stats.obytes != 0 || |
| 203 | stats.ierrors != 0 || stats.oerrors != 0) { |
| 204 | printf("Error: port %d stats are not as expected\n", port); |
| 205 | return -1; |
| 206 | } |
| 207 | |
| 208 | rte_eth_stats_reset(port); |
| 209 | |
| 210 | /* check stats of RXTX port, should all be zero */ |
| 211 | rte_eth_stats_get(port, &stats); |
| 212 | if (stats.ipackets != 0 || stats.opackets != 0 || |
| 213 | stats.ibytes != 0 || stats.obytes != 0 || |
| 214 | stats.ierrors != 0 || stats.oerrors != 0) { |
| 215 | printf("Error: port %d stats are not zero\n", port); |
| 216 | return -1; |
| 217 | } |
| 218 | |
| 219 | return 0; |
| 220 | } |
| 221 | |
| 222 | static int |
| 223 | test_pmd_ring_pair_create_attach(void) |
no test coverage detected