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

Function softnic_thread_init

dpdk/drivers/net/softnic/rte_eth_softnic_thread.c:33–89  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31}
32
33int
34softnic_thread_init(struct pmd_internals *softnic)
35{
36 uint32_t i;
37
38 for (i = 0; i < RTE_MAX_LCORE; i++) {
39 char ring_name[NAME_MAX];
40 struct rte_ring *msgq_req, *msgq_rsp;
41 struct softnic_thread *t = &softnic->thread[i];
42 struct softnic_thread_data *t_data = &softnic->thread_data[i];
43 uint32_t cpu_id = rte_lcore_to_socket_id(i);
44
45 /* MSGQs */
46 snprintf(ring_name, sizeof(ring_name), "%s-TH%u-REQ",
47 softnic->params.name,
48 i);
49
50 msgq_req = rte_ring_create(ring_name,
51 THREAD_MSGQ_SIZE,
52 cpu_id,
53 RING_F_SP_ENQ | RING_F_SC_DEQ);
54
55 if (msgq_req == NULL) {
56 softnic_thread_free(softnic);
57 return -1;
58 }
59
60 snprintf(ring_name, sizeof(ring_name), "%s-TH%u-RSP",
61 softnic->params.name,
62 i);
63
64 msgq_rsp = rte_ring_create(ring_name,
65 THREAD_MSGQ_SIZE,
66 cpu_id,
67 RING_F_SP_ENQ | RING_F_SC_DEQ);
68
69 if (msgq_rsp == NULL) {
70 softnic_thread_free(softnic);
71 return -1;
72 }
73
74 /* Main thread records */
75 t->msgq_req = msgq_req;
76 t->msgq_rsp = msgq_rsp;
77 t->service_id = UINT32_MAX;
78
79 /* Data plane thread records */
80 t_data->n_pipelines = 0;
81 t_data->msgq_req = msgq_req;
82 t_data->msgq_rsp = msgq_rsp;
83 t_data->timer_period =
84 (rte_get_tsc_hz() * THREAD_TIMER_PERIOD_MS) / 1000;
85 t_data->time_next = rte_get_tsc_cycles() + t_data->timer_period;
86 }
87
88 return 0;
89}
90

Callers 1

pmd_initFunction · 0.85

Calls 6

rte_lcore_to_socket_idFunction · 0.85
snprintfFunction · 0.85
rte_ring_createFunction · 0.85
softnic_thread_freeFunction · 0.85
rte_get_tsc_hzFunction · 0.85
rte_get_tsc_cyclesFunction · 0.50

Tested by

no test coverage detected