Packets dequeued from the shared ring. 8< */
| 267 | |
| 268 | /* Packets dequeued from the shared ring. 8< */ |
| 269 | static inline void |
| 270 | handle_packets(struct rte_hash *h, struct rte_mbuf **bufs, uint16_t num_packets) |
| 271 | { |
| 272 | struct rte_ipv4_hdr *ipv4_hdr; |
| 273 | uint32_t ipv4_dst_ip[PKT_READ_SIZE]; |
| 274 | const void *key_ptrs[PKT_READ_SIZE]; |
| 275 | unsigned int i; |
| 276 | int32_t positions[PKT_READ_SIZE] = {0}; |
| 277 | |
| 278 | for (i = 0; i < num_packets; i++) { |
| 279 | /* Handle IPv4 header.*/ |
| 280 | ipv4_hdr = rte_pktmbuf_mtod_offset(bufs[i], |
| 281 | struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); |
| 282 | ipv4_dst_ip[i] = ipv4_hdr->dst_addr; |
| 283 | key_ptrs[i] = &ipv4_dst_ip[i]; |
| 284 | } |
| 285 | /* Check if packets belongs to any flows handled by this node */ |
| 286 | rte_hash_lookup_bulk(h, key_ptrs, num_packets, positions); |
| 287 | |
| 288 | for (i = 0; i < num_packets; i++) { |
| 289 | if (likely(positions[i] >= 0)) { |
| 290 | filter_stats->passed++; |
| 291 | transmit_packet(bufs[i]); |
| 292 | } else { |
| 293 | filter_stats->drop++; |
| 294 | /* Drop packet, as flow is not handled by this node */ |
| 295 | rte_pktmbuf_free(bufs[i]); |
| 296 | } |
| 297 | } |
| 298 | } |
| 299 | /* >8 End of packets dequeuing. */ |
| 300 | |
| 301 | /* |
no test coverage detected