* Function called by the main lcore of the DPDK process. */
| 301 | * Function called by the main lcore of the DPDK process. |
| 302 | */ |
| 303 | static void |
| 304 | do_packet_forwarding(void) |
| 305 | { |
| 306 | unsigned int port_num = 0; /* indexes the port[] array */ |
| 307 | unsigned int socket_id = rte_socket_id(); |
| 308 | |
| 309 | for (;;) { |
| 310 | struct rte_mbuf *buf[PACKET_READ_SIZE]; |
| 311 | uint16_t rx_count; |
| 312 | |
| 313 | /* read a port */ |
| 314 | rx_count = rte_eth_rx_burst(info->id[port_num], 0, |
| 315 | buf, PACKET_READ_SIZE); |
| 316 | info->rx_stats.rx[port_num] += rx_count; |
| 317 | |
| 318 | /* Now process the NIC packets read */ |
| 319 | if (likely(rx_count > 0)) |
| 320 | process_packets(port_num, buf, rx_count, socket_id); |
| 321 | |
| 322 | /* move to next port */ |
| 323 | if (++port_num == info->num_ports) |
| 324 | port_num = 0; |
| 325 | } |
| 326 | } |
| 327 | |
| 328 | int |
| 329 | main(int argc, char *argv[]) |
no test coverage detected