net/mlx4: fix queue index check on flow rules
Users are not prevented from creating flow rules targeting nonexistent queues, which silently makes such rules drop-like. While it can be thought as a feature, reporting an error instead is actually far more useful in order to catch common mistakes. Fixes: 078b8b452e6b ("net/mlx4: add RSS flow rule action support") Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
This commit is contained in:
parent
a9b3568e73
commit
e21bdfaa2c
@ -734,6 +734,11 @@ fill:
|
|||||||
if (flow->rss)
|
if (flow->rss)
|
||||||
break;
|
break;
|
||||||
queue = action->conf;
|
queue = action->conf;
|
||||||
|
if (queue->index >= priv->dev->data->nb_rx_queues) {
|
||||||
|
msg = "queue target index beyond number of"
|
||||||
|
" configured Rx queues";
|
||||||
|
goto exit_action_not_supported;
|
||||||
|
}
|
||||||
flow->rss = mlx4_rss_get
|
flow->rss = mlx4_rss_get
|
||||||
(priv, 0, mlx4_rss_hash_key_default, 1,
|
(priv, 0, mlx4_rss_hash_key_default, 1,
|
||||||
&queue->index);
|
&queue->index);
|
||||||
@ -760,6 +765,15 @@ fill:
|
|||||||
ETH_RSS_NONFRAG_IPV6_TCP),
|
ETH_RSS_NONFRAG_IPV6_TCP),
|
||||||
};
|
};
|
||||||
/* Sanity checks. */
|
/* Sanity checks. */
|
||||||
|
for (i = 0; i < rss->num; ++i)
|
||||||
|
if (rss->queue[i] >=
|
||||||
|
priv->dev->data->nb_rx_queues)
|
||||||
|
break;
|
||||||
|
if (i != rss->num) {
|
||||||
|
msg = "queue index target beyond number of"
|
||||||
|
" configured Rx queues";
|
||||||
|
goto exit_action_not_supported;
|
||||||
|
}
|
||||||
if (!rte_is_power_of_2(rss->num)) {
|
if (!rte_is_power_of_2(rss->num)) {
|
||||||
msg = "for RSS, mlx4 requires the number of"
|
msg = "for RSS, mlx4 requires the number of"
|
||||||
" queues to be a power of two";
|
" queues to be a power of two";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user