| 1204 | }; |
| 1205 | |
| 1206 | static int |
| 1207 | table_rule_add_bulk_ll(struct table_ll *table, |
| 1208 | struct table_rule_list *list, |
| 1209 | uint32_t *n_rules) |
| 1210 | { |
| 1211 | union table_rule_match_low_level *match_ll = NULL; |
| 1212 | uint8_t *action_ll = NULL; |
| 1213 | void **match_ll_ptr = NULL; |
| 1214 | struct rte_pipeline_table_entry **action_ll_ptr = NULL; |
| 1215 | struct rte_pipeline_table_entry **entries_ptr = NULL; |
| 1216 | int *found = NULL; |
| 1217 | struct table_rule *rule; |
| 1218 | uint32_t n, i; |
| 1219 | int status = 0; |
| 1220 | |
| 1221 | n = 0; |
| 1222 | TAILQ_FOREACH(rule, list, node) |
| 1223 | n++; |
| 1224 | |
| 1225 | /* Memory allocation */ |
| 1226 | match_ll = calloc(n, sizeof(union table_rule_match_low_level)); |
| 1227 | action_ll = calloc(n, TABLE_RULE_ACTION_SIZE_MAX); |
| 1228 | |
| 1229 | match_ll_ptr = calloc(n, sizeof(void *)); |
| 1230 | action_ll_ptr = calloc(n, sizeof(struct rte_pipeline_table_entry *)); |
| 1231 | |
| 1232 | entries_ptr = calloc(n, sizeof(struct rte_pipeline_table_entry *)); |
| 1233 | found = calloc(n, sizeof(int)); |
| 1234 | |
| 1235 | if (match_ll == NULL || |
| 1236 | action_ll == NULL || |
| 1237 | match_ll_ptr == NULL || |
| 1238 | action_ll_ptr == NULL || |
| 1239 | entries_ptr == NULL || |
| 1240 | found == NULL) { |
| 1241 | status = -ENOMEM; |
| 1242 | goto table_rule_add_bulk_ll_free; |
| 1243 | } |
| 1244 | |
| 1245 | /* Init */ |
| 1246 | for (i = 0; i < n; i++) { |
| 1247 | match_ll_ptr[i] = (void *)&match_ll[i]; |
| 1248 | action_ll_ptr[i] = (struct rte_pipeline_table_entry *) |
| 1249 | &action_ll[i * TABLE_RULE_ACTION_SIZE_MAX]; |
| 1250 | } |
| 1251 | |
| 1252 | /* Rule (match, action) conversion */ |
| 1253 | i = 0; |
| 1254 | TAILQ_FOREACH(rule, list, node) { |
| 1255 | status = match_convert(&rule->match, match_ll_ptr[i], 1); |
| 1256 | if (status) |
| 1257 | goto table_rule_add_bulk_ll_free; |
| 1258 | |
| 1259 | status = action_convert(table->a, &rule->action, action_ll_ptr[i]); |
| 1260 | if (status) |
| 1261 | goto table_rule_add_bulk_ll_free; |
| 1262 | |
| 1263 | i++; |
no test coverage detected