summaryrefslogtreecommitdiff
path: root/drivers/net/mlx5/mlx5_flow.c
diff options
context:
space:
mode:
authorDekel Peled <dekelp@mellanox.com>2019-01-22 10:21:55 +0200
committerFerruh Yigit <ferruh.yigit@intel.com>2019-01-24 14:53:10 +0100
commitff160dbcba6274bfcb22bbb05155c80c011f996d (patch)
tree14cf6af782338fd45f4a5cda5178997a019403fc /drivers/net/mlx5/mlx5_flow.c
parent0403e37a468df59707ed938cca4a507276a0befb (diff)
downloaddpdk-next-eventdev-ff160dbcba6274bfcb22bbb05155c80c011f996d.zip
dpdk-next-eventdev-ff160dbcba6274bfcb22bbb05155c80c011f996d.tar.gz
dpdk-next-eventdev-ff160dbcba6274bfcb22bbb05155c80c011f996d.tar.xz
net/mlx5: allow port start with zero Rx queue
During port start, function mlx5_ctrl_flow_vlan() is called to create default ingress flow rules. For specific use-cases, a port can be used for Tx only. In such case, number of Rx queues can be set to 0 to save resources, hence the default ingress rules are irrelevant. This patch modifies function mlx5_ctrl_flow_vlan() to avoid the creation of the default ingress rules when number of Rx queues is 0. It also includes update of validation functions for relevant actions, mlx5_flow_validate_action_queue() and mlx5_flow_validate_action_rss(), to prevent creation of flow rules with these actions when number of Rx queues is 0. Signed-off-by: Dekel Peled <dekelp@mellanox.com> Acked-by: Shahaf Shuler <shahafs@mellanox.com>
Diffstat (limited to 'drivers/net/mlx5/mlx5_flow.c')
-rw-r--r--drivers/net/mlx5/mlx5_flow.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index 0fd6ed5..f91aecd 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -846,6 +846,10 @@ mlx5_flow_validate_action_queue(const struct rte_flow_action *action,
RTE_FLOW_ERROR_TYPE_ACTION, NULL,
"can't have 2 fate actions in"
" same flow");
+ if (!priv->rxqs_n)
+ return rte_flow_error_set(error, EINVAL,
+ RTE_FLOW_ERROR_TYPE_ACTION_CONF,
+ NULL, "No Rx queues configured");
if (queue->index >= priv->rxqs_n)
return rte_flow_error_set(error, EINVAL,
RTE_FLOW_ERROR_TYPE_ACTION_CONF,
@@ -939,6 +943,10 @@ mlx5_flow_validate_action_rss(const struct rte_flow_action *action,
&rss->types,
"some RSS protocols are not"
" supported");
+ if (!priv->rxqs_n)
+ return rte_flow_error_set(error, EINVAL,
+ RTE_FLOW_ERROR_TYPE_ACTION_CONF,
+ NULL, "No Rx queues configured");
for (i = 0; i != rss->queue_num; ++i) {
if (!(*priv->rxqs)[rss->queue[i]])
return rte_flow_error_set
@@ -2325,8 +2333,7 @@ mlx5_ctrl_flow_vlan(struct rte_eth_dev *dev,
unsigned int i;
if (!priv->reta_idx_n || !priv->rxqs_n) {
- rte_errno = EINVAL;
- return -rte_errno;
+ return 0;
}
for (i = 0; i != priv->reta_idx_n; ++i)
queue[i] = (*priv->reta_idx)[i];