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

Function main

dpdk/examples/server_node_efd/efd_node/node.c:305–395  ·  view source on GitHub ↗

* Application main function - loops through * receiving and processing packets. Never returns */

Source from the content-addressed store, hash-verified

303 * receiving and processing packets. Never returns
304 */
305int
306main(int argc, char *argv[])
307{
308 const struct rte_memzone *mz;
309 struct rte_ring *rx_ring;
310 struct rte_hash *h;
311 struct rte_mempool *mp;
312 struct shared_info *info;
313 int need_flush = 0; /* indicates whether we have unsent packets */
314 int retval;
315 void *pkts[PKT_READ_SIZE];
316 uint16_t sent;
317
318 retval = rte_eal_init(argc, argv);
319 if (retval < 0)
320 return -1;
321 argc -= retval;
322 argv += retval;
323
324 if (parse_app_args(argc, argv) < 0)
325 rte_exit(EXIT_FAILURE, "Invalid command-line arguments\n");
326
327 if (rte_eth_dev_count_avail() == 0)
328 rte_exit(EXIT_FAILURE, "No Ethernet ports - bye\n");
329
330 /* Attaching to the server process memory. 8< */
331 rx_ring = rte_ring_lookup(get_rx_queue_name(node_id));
332 if (rx_ring == NULL)
333 rte_exit(EXIT_FAILURE, "Cannot get RX ring - "
334 "is server process running?\n");
335
336 mp = rte_mempool_lookup(PKTMBUF_POOL_NAME);
337 if (mp == NULL)
338 rte_exit(EXIT_FAILURE, "Cannot get mempool for mbufs\n");
339
340 mz = rte_memzone_lookup(MZ_SHARED_INFO);
341 if (mz == NULL)
342 rte_exit(EXIT_FAILURE, "Cannot get port info structure\n");
343 info = mz->addr;
344 tx_stats = &(info->tx_stats[node_id]);
345 filter_stats = &(info->filter_stats[node_id]);
346 /* >8 End of attaching to the server process memory. */
347
348 configure_output_ports(info);
349
350 h = create_hash_table(info);
351
352 populate_hash_table(h, info);
353
354 RTE_LOG(INFO, APP, "Finished Process Init.\n");
355
356 printf("\nNode process %d handling packets\n", node_id);
357 printf("[Press Ctrl-C to quit ...]\n");
358
359 for (;;) {
360 uint16_t rx_pkts = PKT_READ_SIZE;
361 uint16_t port;
362

Callers

nothing calls this directly

Calls 15

rte_exitFunction · 0.85
rte_eth_dev_count_availFunction · 0.85
rte_ring_lookupFunction · 0.85
rte_mempool_lookupFunction · 0.85
rte_memzone_lookupFunction · 0.85
create_hash_tableFunction · 0.85
populate_hash_tableFunction · 0.85
rte_ring_dequeue_bulkFunction · 0.85
rte_ring_countFunction · 0.85
rte_eth_tx_buffer_flushFunction · 0.85
handle_packetsFunction · 0.85
parse_app_argsFunction · 0.70

Tested by

no test coverage detected