| 1717 | } |
| 1718 | |
| 1719 | struct rte_flow_pattern_template * |
| 1720 | rte_flow_pattern_template_create(uint16_t port_id, |
| 1721 | const struct rte_flow_pattern_template_attr *template_attr, |
| 1722 | const struct rte_flow_item pattern[], |
| 1723 | struct rte_flow_error *error) |
| 1724 | { |
| 1725 | struct rte_eth_dev *dev = &rte_eth_devices[port_id]; |
| 1726 | const struct rte_flow_ops *ops = rte_flow_ops_get(port_id, error); |
| 1727 | struct rte_flow_pattern_template *template; |
| 1728 | |
| 1729 | if (unlikely(!ops)) |
| 1730 | return NULL; |
| 1731 | if (dev->data->flow_configured == 0) { |
| 1732 | RTE_FLOW_LOG(INFO, |
| 1733 | "Flow engine on port_id=%"PRIu16" is not configured.\n", |
| 1734 | port_id); |
| 1735 | rte_flow_error_set(error, EINVAL, |
| 1736 | RTE_FLOW_ERROR_TYPE_STATE, |
| 1737 | NULL, rte_strerror(EINVAL)); |
| 1738 | return NULL; |
| 1739 | } |
| 1740 | if (template_attr == NULL) { |
| 1741 | RTE_FLOW_LOG(ERR, |
| 1742 | "Port %"PRIu16" template attr is NULL.\n", |
| 1743 | port_id); |
| 1744 | rte_flow_error_set(error, EINVAL, |
| 1745 | RTE_FLOW_ERROR_TYPE_ATTR, |
| 1746 | NULL, rte_strerror(EINVAL)); |
| 1747 | return NULL; |
| 1748 | } |
| 1749 | if (pattern == NULL) { |
| 1750 | RTE_FLOW_LOG(ERR, |
| 1751 | "Port %"PRIu16" pattern is NULL.\n", |
| 1752 | port_id); |
| 1753 | rte_flow_error_set(error, EINVAL, |
| 1754 | RTE_FLOW_ERROR_TYPE_ATTR, |
| 1755 | NULL, rte_strerror(EINVAL)); |
| 1756 | return NULL; |
| 1757 | } |
| 1758 | if (likely(!!ops->pattern_template_create)) { |
| 1759 | template = ops->pattern_template_create(dev, template_attr, |
| 1760 | pattern, error); |
| 1761 | if (template == NULL) |
| 1762 | flow_err(port_id, -rte_errno, error); |
| 1763 | |
| 1764 | rte_flow_trace_pattern_template_create(port_id, template_attr, |
| 1765 | pattern, template); |
| 1766 | |
| 1767 | return template; |
| 1768 | } |
| 1769 | rte_flow_error_set(error, ENOTSUP, |
| 1770 | RTE_FLOW_ERROR_TYPE_UNSPECIFIED, |
| 1771 | NULL, rte_strerror(ENOTSUP)); |
| 1772 | return NULL; |
| 1773 | } |
| 1774 | |
| 1775 | int |
| 1776 | rte_flow_pattern_template_destroy(uint16_t port_id, |
no test coverage detected