net/mlx5: block RSS action without Rx queues

Message ID 1548145344-37890-1-git-send-email-dekelp@mellanox.com (mailing list archive)
State Accepted, archived
Delegated to: Shahaf Shuler
Headers
Series net/mlx5: block RSS action without Rx queues |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Dekel Peled Jan. 22, 2019, 8:22 a.m. UTC
  This patch modifies function mlx5_flow_validate_action_rss(), to
prevent the setting of rule with rss action, but without specifying
any queues.
For example:
flow create 0 ingress pattern end actions rss queues end / end

Signed-off-by: Dekel Peled <dekelp@mellanox.com>
---
 drivers/net/mlx5/mlx5_flow.c | 4 ++++
 1 file changed, 4 insertions(+)
  

Comments

Shahaf Shuler Jan. 24, 2019, 11:15 a.m. UTC | #1
Tuesday, January 22, 2019 10:22 AM, Dekel Peled:
> Subject: [dpdk-dev] [PATCH] net/mlx5: block RSS action without Rx queues
> 
> This patch modifies function mlx5_flow_validate_action_rss(), to prevent the
> setting of rule with rss action, but without specifying any queues.
> For example:
> flow create 0 ingress pattern end actions rss queues end / end
> 
> Signed-off-by: Dekel Peled <dekelp@mellanox.com>

Applied to next-net-mlx, thanks.
  

Patch

diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index f91aecd..11213e2 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -947,6 +947,10 @@  uint32_t mlx5_flow_adjust_priority(struct rte_eth_dev *dev, int32_t priority,
 		return rte_flow_error_set(error, EINVAL,
 					  RTE_FLOW_ERROR_TYPE_ACTION_CONF,
 					  NULL, "No Rx queues configured");
+	if (!rss->queue_num)
+		return rte_flow_error_set(error, EINVAL,
+					  RTE_FLOW_ERROR_TYPE_ACTION_CONF,
+					  NULL, "No queues configured");
 	for (i = 0; i != rss->queue_num; ++i) {
 		if (!(*priv->rxqs)[rss->queue[i]])
 			return rte_flow_error_set