| 1899 | } |
| 1900 | |
| 1901 | struct rte_flow_template_table * |
| 1902 | rte_flow_template_table_create(uint16_t port_id, |
| 1903 | const struct rte_flow_template_table_attr *table_attr, |
| 1904 | struct rte_flow_pattern_template *pattern_templates[], |
| 1905 | uint8_t nb_pattern_templates, |
| 1906 | struct rte_flow_actions_template *actions_templates[], |
| 1907 | uint8_t nb_actions_templates, |
| 1908 | struct rte_flow_error *error) |
| 1909 | { |
| 1910 | struct rte_eth_dev *dev = &rte_eth_devices[port_id]; |
| 1911 | const struct rte_flow_ops *ops = rte_flow_ops_get(port_id, error); |
| 1912 | struct rte_flow_template_table *table; |
| 1913 | |
| 1914 | if (unlikely(!ops)) |
| 1915 | return NULL; |
| 1916 | if (dev->data->flow_configured == 0) { |
| 1917 | RTE_FLOW_LOG(INFO, |
| 1918 | "Flow engine on port_id=%"PRIu16" is not configured.\n", |
| 1919 | port_id); |
| 1920 | rte_flow_error_set(error, EINVAL, |
| 1921 | RTE_FLOW_ERROR_TYPE_STATE, |
| 1922 | NULL, rte_strerror(EINVAL)); |
| 1923 | return NULL; |
| 1924 | } |
| 1925 | if (table_attr == NULL) { |
| 1926 | RTE_FLOW_LOG(ERR, |
| 1927 | "Port %"PRIu16" table attr is NULL.\n", |
| 1928 | port_id); |
| 1929 | rte_flow_error_set(error, EINVAL, |
| 1930 | RTE_FLOW_ERROR_TYPE_ATTR, |
| 1931 | NULL, rte_strerror(EINVAL)); |
| 1932 | return NULL; |
| 1933 | } |
| 1934 | if (pattern_templates == NULL) { |
| 1935 | RTE_FLOW_LOG(ERR, |
| 1936 | "Port %"PRIu16" pattern templates is NULL.\n", |
| 1937 | port_id); |
| 1938 | rte_flow_error_set(error, EINVAL, |
| 1939 | RTE_FLOW_ERROR_TYPE_ATTR, |
| 1940 | NULL, rte_strerror(EINVAL)); |
| 1941 | return NULL; |
| 1942 | } |
| 1943 | if (actions_templates == NULL) { |
| 1944 | RTE_FLOW_LOG(ERR, |
| 1945 | "Port %"PRIu16" actions templates is NULL.\n", |
| 1946 | port_id); |
| 1947 | rte_flow_error_set(error, EINVAL, |
| 1948 | RTE_FLOW_ERROR_TYPE_ATTR, |
| 1949 | NULL, rte_strerror(EINVAL)); |
| 1950 | return NULL; |
| 1951 | } |
| 1952 | if (likely(!!ops->template_table_create)) { |
| 1953 | table = ops->template_table_create(dev, table_attr, |
| 1954 | pattern_templates, nb_pattern_templates, |
| 1955 | actions_templates, nb_actions_templates, |
| 1956 | error); |
| 1957 | if (table == NULL) |
| 1958 | flow_err(port_id, -rte_errno, error); |
no test coverage detected