summaryrefslogtreecommitdiff
path: root/drivers/net/mlx5
diff options
context:
space:
mode:
authorViacheslav Ovsiienko <viacheslavo@mellanox.com>2019-11-07 17:09:50 +0000
committerFerruh Yigit <ferruh.yigit@intel.com>2019-11-11 14:23:01 +0100
commit123e69b0253bed292a7307df024e7b8955a0e619 (patch)
treee01611668c67dd1977328ccb0a13d9cb88a9ed9a /drivers/net/mlx5
parente205c95f74f389e3b3008b0e6cc4e1c982a461b9 (diff)
downloaddpdk-123e69b0253bed292a7307df024e7b8955a0e619.zip
dpdk-123e69b0253bed292a7307df024e7b8955a0e619.tar.gz
dpdk-123e69b0253bed292a7307df024e7b8955a0e619.tar.xz
net/mlx5: update flow functions
Update flow creation/destroy functions for future reuse. List operations can be skipped inside functions and done separately out of flow creation. Signed-off-by: Yongseok Koh <yskoh@mellanox.com> Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com> Acked-by: Matan Azrad <matan@mellanox.com>
Diffstat (limited to 'drivers/net/mlx5')
-rw-r--r--drivers/net/mlx5/mlx5_flow.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index d7854be..5898c96 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -2754,7 +2754,10 @@ flow_hairpin_split(struct rte_eth_dev *dev,
* @param dev
* Pointer to Ethernet device.
* @param list
- * Pointer to a TAILQ flow list.
+ * Pointer to a TAILQ flow list. If this parameter NULL,
+ * no list insertion occurred, flow is just created,
+ * this is caller's responsibility to track the
+ * created flow.
* @param[in] attr
* Flow rule attributes.
* @param[in] items
@@ -2899,7 +2902,8 @@ flow_list_create(struct rte_eth_dev *dev, struct mlx5_flows *list,
if (ret < 0)
goto error;
}
- TAILQ_INSERT_TAIL(list, flow, next);
+ if (list)
+ TAILQ_INSERT_TAIL(list, flow, next);
flow_rxq_flags_set(dev, flow);
return flow;
error_before_flow:
@@ -2993,7 +2997,8 @@ mlx5_flow_create(struct rte_eth_dev *dev,
* @param dev
* Pointer to Ethernet device.
* @param list
- * Pointer to a TAILQ flow list.
+ * Pointer to a TAILQ flow list. If this parameter NULL,
+ * there is no flow removal from the list.
* @param[in] flow
* Flow to destroy.
*/
@@ -3013,7 +3018,8 @@ flow_list_destroy(struct rte_eth_dev *dev, struct mlx5_flows *list,
mlx5_flow_id_release(priv->sh->flow_id_pool,
flow->hairpin_flow_id);
flow_drv_destroy(dev, flow);
- TAILQ_REMOVE(list, flow, next);
+ if (list)
+ TAILQ_REMOVE(list, flow, next);
rte_free(flow->fdir);
rte_free(flow);
}