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

Function init_shm_rings

dpdk/examples/server_node_efd/efd_server/init.c:171–197  ·  view source on GitHub ↗

* Set up the DPDK rings which will be used to pass packets, via * pointers, between the multi-process server and node processes. * Each node needs one RX queue. */

Source from the content-addressed store, hash-verified

169 * Each node needs one RX queue.
170 */
171static int
172init_shm_rings(void)
173{
174 unsigned int i;
175 unsigned int socket_id;
176 const char *q_name;
177 const unsigned int ringsize = NODE_QUEUE_RINGSIZE;
178
179 nodes = rte_malloc("node details",
180 sizeof(*nodes) * num_nodes, 0);
181 if (nodes == NULL)
182 rte_exit(EXIT_FAILURE, "Cannot allocate memory for "
183 "node program details\n");
184
185 for (i = 0; i < num_nodes; i++) {
186 /* Create an RX queue for each node */
187 socket_id = rte_socket_id();
188 q_name = get_rx_queue_name(i);
189 nodes[i].rx_q = rte_ring_create(q_name,
190 ringsize, socket_id,
191 RING_F_SP_ENQ | RING_F_SC_DEQ);
192 if (nodes[i].rx_q == NULL)
193 rte_exit(EXIT_FAILURE, "Cannot create rx ring queue "
194 "for node %u\n", i);
195 }
196 return 0;
197}
198
199/*
200 * Create EFD table which will contain all the flows

Callers 1

initFunction · 0.70

Calls 5

rte_mallocFunction · 0.85
rte_exitFunction · 0.85
rte_socket_idFunction · 0.85
rte_ring_createFunction · 0.85
get_rx_queue_nameFunction · 0.50

Tested by

no test coverage detected