Skip to content

Commit

Permalink
net/mlx5: fix RSS queue type validation
Browse files Browse the repository at this point in the history
[ upstream commit 7656336 ]

When the RSS queues' types are not uniformed, i.e, mixed with normal Rx
queue and hairpin queue, PMD accept this flow after commit[1] instead of
rejecting it.

This because commit[1] creates Rx queue object as DevX type via DevX API
instead of IBV type via Verbs, in which the latter will check the queues'
type when creating Verbs ind table but the former doesn't check when
creating DevX ind table.

However, in any case, logically PMD should check whether the input
configuration of RSS action is reasonable or not, which should
include queues' type check as well as the others.

So add the check of RSS queues' type in validation function to fix issue.

[1]:
commit 6deb19e ("net/mlx5: separate Rx queue object creations")

Fixes: 63bd162 ("net/mlx5: support RSS on hairpin")

Signed-off-by: Xiaoyu Min <jackmin@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
  • Loading branch information
jackmin authored and bluca committed Nov 24, 2020
1 parent 7d36191 commit 5dddc14
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions drivers/net/mlx5/mlx5_flow.c
Original file line number Diff line number Diff line change
Expand Up @@ -1121,6 +1121,7 @@ mlx5_flow_validate_action_rss(const struct rte_flow_action *action,
struct mlx5_priv *priv = dev->data->dev_private;
const struct rte_flow_action_rss *rss = action->conf;
int tunnel = !!(item_flags & MLX5_FLOW_LAYER_TUNNEL);
enum mlx5_rxq_type rxq_type = MLX5_RXQ_TYPE_UNDEFINED;
unsigned int i;

if (action_flags & MLX5_FLOW_FATE_ACTIONS)
Expand Down Expand Up @@ -1179,6 +1180,8 @@ mlx5_flow_validate_action_rss(const struct rte_flow_action *action,
RTE_FLOW_ERROR_TYPE_ACTION_CONF,
NULL, "No queues configured");
for (i = 0; i != rss->queue_num; ++i) {
struct mlx5_rxq_ctrl *rxq_ctrl;

if (rss->queue[i] >= priv->rxqs_n)
return rte_flow_error_set
(error, EINVAL,
Expand All @@ -1188,6 +1191,15 @@ mlx5_flow_validate_action_rss(const struct rte_flow_action *action,
return rte_flow_error_set
(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION_CONF,
&rss->queue[i], "queue is not configured");
rxq_ctrl = container_of((*priv->rxqs)[rss->queue[i]],
struct mlx5_rxq_ctrl, rxq);
if (i == 0)
rxq_type = rxq_ctrl->type;
if (rxq_type != rxq_ctrl->type)
return rte_flow_error_set
(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION_CONF,
&rss->queue[i],
"combining hairpin and regular RSS queues is not supported");
}
if (attr->egress)
return rte_flow_error_set(error, ENOTSUP,
Expand Down

0 comments on commit 5dddc14

Please sign in to comment.