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

Function rte_reorder_create

dpdk/lib/reorder/rte_reorder.c:154–208  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

152}
153
154struct rte_reorder_buffer*
155rte_reorder_create(const char *name, unsigned socket_id, unsigned int size)
156{
157 struct rte_reorder_buffer *b = NULL;
158 struct rte_tailq_entry *te, *te_inserted;
159
160 const unsigned int bufsize = rte_reorder_memory_footprint_get(size);
161
162 /* Check user arguments. */
163 if (!rte_is_power_of_2(size)) {
164 RTE_LOG(ERR, REORDER, "Invalid reorder buffer size"
165 " - Not a power of 2\n");
166 rte_errno = EINVAL;
167 return NULL;
168 }
169 if (name == NULL) {
170 RTE_LOG(ERR, REORDER, "Invalid reorder buffer name ptr:"
171 " NULL\n");
172 rte_errno = EINVAL;
173 return NULL;
174 }
175
176 /* allocate tailq entry */
177 te = rte_zmalloc("REORDER_TAILQ_ENTRY", sizeof(*te), 0);
178 if (te == NULL) {
179 RTE_LOG(ERR, REORDER, "Failed to allocate tailq entry\n");
180 rte_errno = ENOMEM;
181 return NULL;
182 }
183
184 /* Allocate memory to store the reorder buffer structure. */
185 b = rte_zmalloc_socket("REORDER_BUFFER", bufsize, 0, socket_id);
186 if (b == NULL) {
187 RTE_LOG(ERR, REORDER, "Memzone allocation failed\n");
188 rte_errno = ENOMEM;
189 rte_free(te);
190 return NULL;
191 } else {
192 if (rte_reorder_init(b, bufsize, name, size) == NULL) {
193 rte_free(b);
194 rte_free(te);
195 return NULL;
196 }
197 te->data = (void *)b;
198 }
199
200 te_inserted = rte_reorder_entry_insert(te);
201 if (te_inserted != te) {
202 rte_free(b);
203 rte_free(te);
204 return te_inserted->data;
205 }
206
207 return b;
208}
209
210void
211rte_reorder_reset(struct rte_reorder_buffer *b)

Callers 8

test_reorder_createFunction · 0.85
test_reorder_freeFunction · 0.85
test_reorder_insertFunction · 0.85
test_reorder_drainFunction · 0.85
test_reorder_set_seqnFunction · 0.85
test_setupFunction · 0.85
mainFunction · 0.85

Calls 7

rte_zmallocFunction · 0.85
rte_zmalloc_socketFunction · 0.85
rte_freeFunction · 0.85
rte_reorder_initFunction · 0.85
rte_reorder_entry_insertFunction · 0.85
rte_is_power_of_2Function · 0.50

Tested by 7

test_reorder_createFunction · 0.68
test_reorder_freeFunction · 0.68
test_reorder_insertFunction · 0.68
test_reorder_drainFunction · 0.68
test_reorder_set_seqnFunction · 0.68
test_setupFunction · 0.68