MCPcopy Index your code
hub / github.com/F-Stack/f-stack / init_dispatch_ring

Function init_dispatch_ring

lib/ff_dpdk_if.c:420–462  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

418}
419
420static int
421init_dispatch_ring(void)
422{
423 int j;
424 char name_buf[RTE_RING_NAMESIZE];
425 int queueid;
426
427 unsigned socketid = lcore_conf.socket_id;
428
429 /* Create ring according to ports actually being used. */
430 int nb_ports = ff_global_cfg.dpdk.nb_ports;
431 for (j = 0; j < nb_ports; j++) {
432 uint16_t portid = ff_global_cfg.dpdk.portid_list[j];
433 struct ff_port_cfg *pconf = &ff_global_cfg.dpdk.port_cfgs[portid];
434 int nb_queues = pconf->nb_lcores;
435 if (dispatch_ring[portid] == NULL) {
436 snprintf(name_buf, RTE_RING_NAMESIZE, "ring_ptr_p%d", portid);
437
438 dispatch_ring[portid] = rte_zmalloc(name_buf,
439 sizeof(struct rte_ring *) * nb_queues,
440 RTE_CACHE_LINE_SIZE);
441 if (dispatch_ring[portid] == NULL) {
442 rte_exit(EXIT_FAILURE, "rte_zmalloc(%s (struct rte_ring*)) "
443 "failed\n", name_buf);
444 }
445 }
446
447 for(queueid = 0; queueid < nb_queues; ++queueid) {
448 snprintf(name_buf, RTE_RING_NAMESIZE, "dispatch_ring_p%d_q%d",
449 portid, queueid);
450 dispatch_ring[portid][queueid] = create_ring(name_buf,
451 DISPATCH_RING_SIZE, socketid, RING_F_SC_DEQ);
452
453 if (dispatch_ring[portid][queueid] == NULL)
454 rte_panic("create ring:%s failed!\n", name_buf);
455
456 ff_log(FF_LOG_INFO, FF_LOGTYPE_FSTACK_LIB, "create ring:%s success, %u ring entries are now free!\n",
457 name_buf, rte_ring_free_count(dispatch_ring[portid][queueid]));
458 }
459 }
460
461 return 0;
462}
463
464static void
465ff_msg_init(struct rte_mempool *mp,

Callers 1

ff_dpdk_initFunction · 0.85

Calls 6

snprintfFunction · 0.85
rte_zmallocFunction · 0.85
rte_exitFunction · 0.85
ff_logFunction · 0.85
rte_ring_free_countFunction · 0.85
create_ringFunction · 0.70

Tested by

no test coverage detected