| 719 | }; |
| 720 | |
| 721 | int |
| 722 | pipeline_table_create(const char *pipeline_name, |
| 723 | struct table_params *params) |
| 724 | { |
| 725 | char name[NAME_MAX]; |
| 726 | struct rte_pipeline_table_params p; |
| 727 | |
| 728 | union { |
| 729 | struct rte_table_acl_params acl; |
| 730 | struct rte_table_array_params array; |
| 731 | struct rte_table_hash_params hash; |
| 732 | struct rte_table_lpm_params lpm; |
| 733 | struct rte_table_lpm_ipv6_params lpm_ipv6; |
| 734 | } pp; |
| 735 | |
| 736 | struct pipeline *pipeline; |
| 737 | struct table *table; |
| 738 | struct table_action_profile *ap; |
| 739 | struct rte_table_action *action; |
| 740 | uint32_t table_id; |
| 741 | int status; |
| 742 | |
| 743 | memset(&p, 0, sizeof(p)); |
| 744 | memset(&pp, 0, sizeof(pp)); |
| 745 | |
| 746 | /* Check input params */ |
| 747 | if ((pipeline_name == NULL) || |
| 748 | (params == NULL)) |
| 749 | return -1; |
| 750 | |
| 751 | pipeline = pipeline_find(pipeline_name); |
| 752 | if ((pipeline == NULL) || |
| 753 | (pipeline->n_tables >= RTE_PIPELINE_TABLE_MAX)) |
| 754 | return -1; |
| 755 | |
| 756 | ap = NULL; |
| 757 | if (params->action_profile_name) { |
| 758 | ap = table_action_profile_find(params->action_profile_name); |
| 759 | if (ap == NULL) |
| 760 | return -1; |
| 761 | } |
| 762 | |
| 763 | snprintf(name, NAME_MAX, "%s_table%u", |
| 764 | pipeline_name, pipeline->n_tables); |
| 765 | |
| 766 | switch (params->match_type) { |
| 767 | case TABLE_ACL: |
| 768 | { |
| 769 | uint32_t ip_header_offset = params->match.acl.ip_header_offset - |
| 770 | (sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM); |
| 771 | uint32_t i; |
| 772 | |
| 773 | if (params->match.acl.n_rules == 0) |
| 774 | return -1; |
| 775 | |
| 776 | pp.acl.name = name; |
| 777 | pp.acl.n_rules = params->match.acl.n_rules; |
| 778 | if (params->match.acl.ip_version) { |
no test coverage detected