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

Function pipeline_table_entries_add

dpdk/examples/pipeline/cli.c:849–896  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

847}
848
849static int
850pipeline_table_entries_add(struct rte_swx_ctl_pipeline *p,
851 const char *table_name,
852 FILE *file,
853 uint32_t *file_line_number)
854{
855 char *line = NULL;
856 uint32_t line_id = 0;
857 int status = 0;
858
859 /* Buffer allocation. */
860 line = malloc(MAX_LINE_SIZE);
861 if (!line)
862 return -ENOMEM;
863
864 /* File read. */
865 for (line_id = 1; ; line_id++) {
866 struct rte_swx_table_entry *entry;
867 int is_blank_or_comment;
868
869 if (fgets(line, MAX_LINE_SIZE, file) == NULL)
870 break;
871
872 entry = rte_swx_ctl_pipeline_table_entry_read(p,
873 table_name,
874 line,
875 &is_blank_or_comment);
876 if (!entry) {
877 if (is_blank_or_comment)
878 continue;
879
880 status = -EINVAL;
881 goto error;
882 }
883
884 status = rte_swx_ctl_pipeline_table_entry_add(p,
885 table_name,
886 entry);
887 table_entry_free(entry);
888 if (status)
889 goto error;
890 }
891
892error:
893 free(line);
894 *file_line_number = line_id;
895 return status;
896}
897
898static const char cmd_pipeline_table_add_help[] =
899"pipeline <pipeline_name> table <table_name> add <file_name>\n";

Callers 1

cmd_pipeline_table_addFunction · 0.70

Calls 5

mallocFunction · 0.85
table_entry_freeFunction · 0.70
freeFunction · 0.50

Tested by

no test coverage detected