* Validate the queue action. * * @param[in] action * Pointer to the queue action. * @param[in] action_flags * Bit-fields that holds the actions detected until now. * @param[in] dev * Pointer to the Ethernet device structure. * @param[in] attr * Attributes of flow that includes this action. * @param[out] error * Pointer to error structure. * * @return * 0 on success, a neg
| 2135 | * 0 on success, a negative errno value otherwise and rte_errno is set. |
| 2136 | */ |
| 2137 | int |
| 2138 | mlx5_flow_validate_action_queue(const struct rte_flow_action *action, |
| 2139 | uint64_t action_flags, |
| 2140 | struct rte_eth_dev *dev, |
| 2141 | const struct rte_flow_attr *attr, |
| 2142 | struct rte_flow_error *error) |
| 2143 | { |
| 2144 | struct mlx5_priv *priv = dev->data->dev_private; |
| 2145 | const struct rte_flow_action_queue *queue = action->conf; |
| 2146 | |
| 2147 | if (action_flags & MLX5_FLOW_FATE_ACTIONS) |
| 2148 | return rte_flow_error_set(error, EINVAL, |
| 2149 | RTE_FLOW_ERROR_TYPE_ACTION, NULL, |
| 2150 | "can't have 2 fate actions in" |
| 2151 | " same flow"); |
| 2152 | if (attr->egress) |
| 2153 | return rte_flow_error_set(error, ENOTSUP, |
| 2154 | RTE_FLOW_ERROR_TYPE_ATTR_EGRESS, NULL, |
| 2155 | "queue action not supported for egress."); |
| 2156 | if (mlx5_is_external_rxq(dev, queue->index)) |
| 2157 | return 0; |
| 2158 | if (!priv->rxqs_n) |
| 2159 | return rte_flow_error_set(error, EINVAL, |
| 2160 | RTE_FLOW_ERROR_TYPE_ACTION_CONF, |
| 2161 | NULL, "No Rx queues configured"); |
| 2162 | if (queue->index >= priv->rxqs_n) |
| 2163 | return rte_flow_error_set(error, EINVAL, |
| 2164 | RTE_FLOW_ERROR_TYPE_ACTION_CONF, |
| 2165 | &queue->index, |
| 2166 | "queue index out of range"); |
| 2167 | if (mlx5_rxq_get(dev, queue->index) == NULL) |
| 2168 | return rte_flow_error_set(error, EINVAL, |
| 2169 | RTE_FLOW_ERROR_TYPE_ACTION_CONF, |
| 2170 | &queue->index, |
| 2171 | "queue is not configured"); |
| 2172 | return 0; |
| 2173 | } |
| 2174 | |
| 2175 | /** |
| 2176 | * Validate queue numbers for device RSS. |
no test coverage detected