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

Function parse_portnuma_config

dpdk/app/test-pmd/parameters.c:295–349  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

293}
294
295static int
296parse_portnuma_config(const char *q_arg)
297{
298 char s[256];
299 const char *p, *p0 = q_arg;
300 char *end;
301 uint8_t i, socket_id;
302 portid_t port_id;
303 unsigned size;
304 enum fieldnames {
305 FLD_PORT = 0,
306 FLD_SOCKET,
307 _NUM_FLD
308 };
309 unsigned long int_fld[_NUM_FLD];
310 char *str_fld[_NUM_FLD];
311
312 /* reset from value set at definition */
313 while ((p = strchr(p0,'(')) != NULL) {
314 ++p;
315 if((p0 = strchr(p,')')) == NULL)
316 return -1;
317
318 size = p0 - p;
319 if(size >= sizeof(s))
320 return -1;
321
322 snprintf(s, sizeof(s), "%.*s", size, p);
323 if (rte_strsplit(s, sizeof(s), str_fld, _NUM_FLD, ',') != _NUM_FLD)
324 return -1;
325 for (i = 0; i < _NUM_FLD; i++) {
326 errno = 0;
327 int_fld[i] = strtoul(str_fld[i], &end, 0);
328 if (errno != 0 || end == str_fld[i] || int_fld[i] > 255)
329 return -1;
330 }
331 port_id = (portid_t)int_fld[FLD_PORT];
332 if (port_id_is_invalid(port_id, ENABLED_WARN) ||
333 port_id == (portid_t)RTE_PORT_ALL) {
334 print_valid_ports();
335 return -1;
336 }
337 socket_id = (uint8_t)int_fld[FLD_SOCKET];
338 if (new_socket_id(socket_id)) {
339 if (num_sockets >= RTE_MAX_NUMA_NODES) {
340 print_invalid_socket_id_error();
341 return -1;
342 }
343 socket_ids[num_sockets++] = socket_id;
344 }
345 port_numa[port_id] = socket_id;
346 }
347
348 return 0;
349}
350
351static int
352parse_ringnuma_config(const char *q_arg)

Callers 1

launch_args_parseFunction · 0.85

Calls 8

strchrFunction · 0.85
snprintfFunction · 0.85
rte_strsplitFunction · 0.85
strtoulFunction · 0.85
port_id_is_invalidFunction · 0.85
print_valid_portsFunction · 0.85
new_socket_idFunction · 0.85

Tested by

no test coverage detected