Processing packets. 8< */
| 255 | |
| 256 | /* Processing packets. 8< */ |
| 257 | static void |
| 258 | process_packets(uint32_t port_num __rte_unused, struct rte_mbuf *pkts[], |
| 259 | uint16_t rx_count, unsigned int socket_id) |
| 260 | { |
| 261 | uint16_t i; |
| 262 | uint8_t node; |
| 263 | efd_value_t data[RTE_EFD_BURST_MAX]; |
| 264 | const void *key_ptrs[RTE_EFD_BURST_MAX]; |
| 265 | |
| 266 | struct rte_ipv4_hdr *ipv4_hdr; |
| 267 | uint32_t ipv4_dst_ip[RTE_EFD_BURST_MAX]; |
| 268 | |
| 269 | for (i = 0; i < rx_count; i++) { |
| 270 | /* Handle IPv4 header.*/ |
| 271 | ipv4_hdr = rte_pktmbuf_mtod_offset(pkts[i], |
| 272 | struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); |
| 273 | ipv4_dst_ip[i] = ipv4_hdr->dst_addr; |
| 274 | key_ptrs[i] = (void *)&ipv4_dst_ip[i]; |
| 275 | } |
| 276 | |
| 277 | rte_efd_lookup_bulk(efd_table, socket_id, rx_count, |
| 278 | (const void **) key_ptrs, data); |
| 279 | for (i = 0; i < rx_count; i++) { |
| 280 | node = (uint8_t) ((uintptr_t)data[i]); |
| 281 | |
| 282 | if (node >= num_nodes) { |
| 283 | /* |
| 284 | * Node is out of range, which means that |
| 285 | * flow has not been inserted |
| 286 | */ |
| 287 | flow_dist_stats.drop++; |
| 288 | rte_pktmbuf_free(pkts[i]); |
| 289 | } else { |
| 290 | flow_dist_stats.distributed++; |
| 291 | enqueue_rx_packet(node, pkts[i]); |
| 292 | } |
| 293 | } |
| 294 | |
| 295 | for (i = 0; i < num_nodes; i++) |
| 296 | flush_rx_queue(i); |
| 297 | } |
| 298 | /* >8 End of process_packets. */ |
| 299 | |
| 300 | /* |
no test coverage detected