| 997 | "pipeline <pipeline_name> table <table_name> delete <file_name>\n"; |
| 998 | |
| 999 | static void |
| 1000 | cmd_pipeline_table_delete(char **tokens, |
| 1001 | uint32_t n_tokens, |
| 1002 | char *out, |
| 1003 | size_t out_size, |
| 1004 | void *obj __rte_unused) |
| 1005 | { |
| 1006 | struct rte_swx_ctl_pipeline *ctl; |
| 1007 | char *pipeline_name, *table_name, *file_name; |
| 1008 | FILE *file = NULL; |
| 1009 | uint32_t file_line_number = 0; |
| 1010 | int status; |
| 1011 | |
| 1012 | if (n_tokens != 6) { |
| 1013 | snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]); |
| 1014 | return; |
| 1015 | } |
| 1016 | |
| 1017 | pipeline_name = tokens[1]; |
| 1018 | ctl = rte_swx_ctl_pipeline_find(pipeline_name); |
| 1019 | if (!ctl) { |
| 1020 | snprintf(out, out_size, MSG_ARG_INVALID, "pipeline_name"); |
| 1021 | return; |
| 1022 | } |
| 1023 | |
| 1024 | table_name = tokens[3]; |
| 1025 | |
| 1026 | file_name = tokens[5]; |
| 1027 | file = fopen(file_name, "r"); |
| 1028 | if (!file) { |
| 1029 | snprintf(out, out_size, "Cannot open file %s.\n", file_name); |
| 1030 | return; |
| 1031 | } |
| 1032 | |
| 1033 | status = pipeline_table_entries_delete(ctl, |
| 1034 | table_name, |
| 1035 | file, |
| 1036 | &file_line_number); |
| 1037 | if (status) |
| 1038 | snprintf(out, out_size, "Invalid entry in file %s at line %u\n", |
| 1039 | file_name, |
| 1040 | file_line_number); |
| 1041 | |
| 1042 | fclose(file); |
| 1043 | } |
| 1044 | |
| 1045 | static int |
| 1046 | pipeline_table_default_entry_add(struct rte_swx_ctl_pipeline *p, |
no test coverage detected