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

Function pipeline_table_entries_delete

dpdk/examples/pipeline/cli.c:947–994  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

945}
946
947static int
948pipeline_table_entries_delete(struct rte_swx_ctl_pipeline *p,
949 const char *table_name,
950 FILE *file,
951 uint32_t *file_line_number)
952{
953 char *line = NULL;
954 uint32_t line_id = 0;
955 int status = 0;
956
957 /* Buffer allocation. */
958 line = malloc(MAX_LINE_SIZE);
959 if (!line)
960 return -ENOMEM;
961
962 /* File read. */
963 for (line_id = 1; ; line_id++) {
964 struct rte_swx_table_entry *entry;
965 int is_blank_or_comment;
966
967 if (fgets(line, MAX_LINE_SIZE, file) == NULL)
968 break;
969
970 entry = rte_swx_ctl_pipeline_table_entry_read(p,
971 table_name,
972 line,
973 &is_blank_or_comment);
974 if (!entry) {
975 if (is_blank_or_comment)
976 continue;
977
978 status = -EINVAL;
979 goto error;
980 }
981
982 status = rte_swx_ctl_pipeline_table_entry_delete(p,
983 table_name,
984 entry);
985 table_entry_free(entry);
986 if (status)
987 goto error;
988 }
989
990error:
991 *file_line_number = line_id;
992 free(line);
993 return status;
994}
995
996static const char cmd_pipeline_table_delete_help[] =
997"pipeline <pipeline_name> table <table_name> delete <file_name>\n";

Callers 1

Calls 5

mallocFunction · 0.85
table_entry_freeFunction · 0.70
freeFunction · 0.50

Tested by

no test coverage detected