| 473 | } |
| 474 | |
| 475 | int |
| 476 | rte_pipeline_table_entry_add(struct rte_pipeline *p, |
| 477 | uint32_t table_id, |
| 478 | void *key, |
| 479 | struct rte_pipeline_table_entry *entry, |
| 480 | int *key_found, |
| 481 | struct rte_pipeline_table_entry **entry_ptr) |
| 482 | { |
| 483 | struct rte_table *table; |
| 484 | |
| 485 | /* Check input arguments */ |
| 486 | if (p == NULL) { |
| 487 | RTE_LOG(ERR, PIPELINE, "%s: pipeline parameter is NULL\n", |
| 488 | __func__); |
| 489 | return -EINVAL; |
| 490 | } |
| 491 | |
| 492 | if (key == NULL) { |
| 493 | RTE_LOG(ERR, PIPELINE, "%s: key parameter is NULL\n", __func__); |
| 494 | return -EINVAL; |
| 495 | } |
| 496 | |
| 497 | if (entry == NULL) { |
| 498 | RTE_LOG(ERR, PIPELINE, "%s: entry parameter is NULL\n", |
| 499 | __func__); |
| 500 | return -EINVAL; |
| 501 | } |
| 502 | |
| 503 | if (table_id >= p->num_tables) { |
| 504 | RTE_LOG(ERR, PIPELINE, |
| 505 | "%s: table_id %d out of range\n", __func__, table_id); |
| 506 | return -EINVAL; |
| 507 | } |
| 508 | |
| 509 | table = &p->tables[table_id]; |
| 510 | |
| 511 | if (table->ops.f_add == NULL) { |
| 512 | RTE_LOG(ERR, PIPELINE, "%s: f_add function pointer NULL\n", |
| 513 | __func__); |
| 514 | return -EINVAL; |
| 515 | } |
| 516 | |
| 517 | if ((entry->action == RTE_PIPELINE_ACTION_TABLE) && |
| 518 | table->table_next_id_valid && |
| 519 | (entry->table_id != table->table_next_id)) { |
| 520 | RTE_LOG(ERR, PIPELINE, |
| 521 | "%s: Tree-like topologies not allowed\n", __func__); |
| 522 | return -EINVAL; |
| 523 | } |
| 524 | |
| 525 | /* Add entry */ |
| 526 | if ((entry->action == RTE_PIPELINE_ACTION_TABLE) && |
| 527 | (table->table_next_id_valid == 0)) { |
| 528 | table->table_next_id = entry->table_id; |
| 529 | table->table_next_id_valid = 1; |
| 530 | } |
| 531 | |
| 532 | return (table->ops.f_add)(table->h_table, key, (void *) entry, |
no outgoing calls