MCPcopy Create free account
hub / github.com/F-Stack/f-stack / process_packets

Function process_packets

dpdk/examples/server_node_efd/efd_server/main.c:257–297  ·  view source on GitHub ↗

Processing packets. 8< */

Source from the content-addressed store, hash-verified

255
256/* Processing packets. 8< */
257static void
258process_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/*

Callers 3

do_packet_forwardingFunction · 0.70
process_dispatch_ringFunction · 0.50
main_loopFunction · 0.50

Calls 4

rte_efd_lookup_bulkFunction · 0.85
rte_pktmbuf_freeFunction · 0.85
enqueue_rx_packetFunction · 0.70
flush_rx_queueFunction · 0.70

Tested by

no test coverage detected