| 1659 | } |
| 1660 | |
| 1661 | int |
| 1662 | rte_flow_configure(uint16_t port_id, |
| 1663 | const struct rte_flow_port_attr *port_attr, |
| 1664 | uint16_t nb_queue, |
| 1665 | const struct rte_flow_queue_attr *queue_attr[], |
| 1666 | struct rte_flow_error *error) |
| 1667 | { |
| 1668 | struct rte_eth_dev *dev = &rte_eth_devices[port_id]; |
| 1669 | const struct rte_flow_ops *ops = rte_flow_ops_get(port_id, error); |
| 1670 | int ret; |
| 1671 | |
| 1672 | if (unlikely(!ops)) |
| 1673 | return -rte_errno; |
| 1674 | if (dev->data->dev_configured == 0) { |
| 1675 | RTE_FLOW_LOG(INFO, |
| 1676 | "Device with port_id=%"PRIu16" is not configured.\n", |
| 1677 | port_id); |
| 1678 | goto error; |
| 1679 | } |
| 1680 | if (dev->data->dev_started != 0) { |
| 1681 | RTE_FLOW_LOG(INFO, |
| 1682 | "Device with port_id=%"PRIu16" already started.\n", |
| 1683 | port_id); |
| 1684 | goto error; |
| 1685 | } |
| 1686 | if (port_attr == NULL) { |
| 1687 | RTE_FLOW_LOG(ERR, "Port %"PRIu16" info is NULL.\n", port_id); |
| 1688 | goto error; |
| 1689 | } |
| 1690 | if (queue_attr == NULL) { |
| 1691 | RTE_FLOW_LOG(ERR, "Port %"PRIu16" queue info is NULL.\n", port_id); |
| 1692 | goto error; |
| 1693 | } |
| 1694 | if ((port_attr->flags & RTE_FLOW_PORT_FLAG_SHARE_INDIRECT) && |
| 1695 | !rte_eth_dev_is_valid_port(port_attr->host_port_id)) { |
| 1696 | return rte_flow_error_set(error, ENODEV, |
| 1697 | RTE_FLOW_ERROR_TYPE_UNSPECIFIED, |
| 1698 | NULL, rte_strerror(ENODEV)); |
| 1699 | } |
| 1700 | if (likely(!!ops->configure)) { |
| 1701 | ret = ops->configure(dev, port_attr, nb_queue, queue_attr, error); |
| 1702 | if (ret == 0) |
| 1703 | dev->data->flow_configured = 1; |
| 1704 | ret = flow_err(port_id, ret, error); |
| 1705 | |
| 1706 | rte_flow_trace_configure(port_id, port_attr, nb_queue, queue_attr, ret); |
| 1707 | |
| 1708 | return ret; |
| 1709 | } |
| 1710 | return rte_flow_error_set(error, ENOTSUP, |
| 1711 | RTE_FLOW_ERROR_TYPE_UNSPECIFIED, |
| 1712 | NULL, rte_strerror(ENOTSUP)); |
| 1713 | error: |
| 1714 | return rte_flow_error_set(error, EINVAL, |
| 1715 | RTE_FLOW_ERROR_TYPE_UNSPECIFIED, |
| 1716 | NULL, rte_strerror(EINVAL)); |
| 1717 | } |
| 1718 |
no test coverage detected