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

Function pipeline_selector_group_members_add

dpdk/examples/pipeline/cli.c:1392–1440  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1390}
1391
1392static int
1393pipeline_selector_group_members_add(struct rte_swx_ctl_pipeline *p,
1394 const char *selector_name,
1395 FILE *file,
1396 uint32_t *file_line_number)
1397{
1398 char *line = NULL;
1399 uint32_t line_id = 0;
1400 int status = 0;
1401
1402 /* Buffer allocation. */
1403 line = malloc(MAX_LINE_SIZE);
1404 if (!line)
1405 return -ENOMEM;
1406
1407 /* File read. */
1408 for (line_id = 1; ; line_id++) {
1409 uint32_t group_id, member_id, weight;
1410 int is_blank_or_comment;
1411
1412 if (fgets(line, MAX_LINE_SIZE, file) == NULL)
1413 break;
1414
1415 status = pipeline_selector_group_member_read(line,
1416 &group_id,
1417 &member_id,
1418 &weight,
1419 &is_blank_or_comment);
1420 if (status) {
1421 if (is_blank_or_comment)
1422 continue;
1423
1424 goto error;
1425 }
1426
1427 status = rte_swx_ctl_pipeline_selector_group_member_add(p,
1428 selector_name,
1429 group_id,
1430 member_id,
1431 weight);
1432 if (status)
1433 goto error;
1434 }
1435
1436error:
1437 free(line);
1438 *file_line_number = line_id;
1439 return status;
1440}
1441
1442static const char cmd_pipeline_selector_group_member_add_help[] =
1443"pipeline <pipeline_name> selector <selector_name> group member add <file_name>";

Calls 4

mallocFunction · 0.85
freeFunction · 0.50

Tested by

no test coverage detected