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

Function swq_create

dpdk/examples/ip_pipeline/swq.c:37–76  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35}
36
37struct swq *
38swq_create(const char *name, struct swq_params *params)
39{
40 struct swq *swq;
41 struct rte_ring *r;
42 unsigned int flags = RING_F_SP_ENQ | RING_F_SC_DEQ;
43
44 /* Check input params */
45 if ((name == NULL) ||
46 swq_find(name) ||
47 (params == NULL) ||
48 (params->size == 0))
49 return NULL;
50
51 /* Resource create */
52 r = rte_ring_create(
53 name,
54 params->size,
55 params->cpu_id,
56 flags);
57
58 if (r == NULL)
59 return NULL;
60
61 /* Node allocation */
62 swq = calloc(1, sizeof(struct swq));
63 if (swq == NULL) {
64 rte_ring_free(r);
65 return NULL;
66 }
67
68 /* Node fill in */
69 strlcpy(swq->name, name, sizeof(swq->name));
70 swq->r = r;
71
72 /* Node add to list */
73 TAILQ_INSERT_TAIL(&swq_list, swq, node);
74
75 return swq;
76}

Callers 1

cmd_swqFunction · 0.85

Calls 5

swq_findFunction · 0.85
rte_ring_createFunction · 0.85
callocFunction · 0.85
rte_ring_freeFunction · 0.85
strlcpyFunction · 0.50

Tested by

no test coverage detected