[v4,13/34] net/mlx5: add flow table tunnel offload attribute

Message ID 1603842466-19879-14-git-send-email-suanmingm@nvidia.com (mailing list archive)
State Superseded, archived
Delegated to: Raslan Darawsheh
Headers
Series net/mlx5: support multiple-thread flow operations |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Suanming Mou Oct. 27, 2020, 11:47 p.m. UTC
  As flow table is shared between the ports in the same shared IB device,
flow table may be created by one port and released by other port.

Currently, the tunnel offloading active check in flow table release is
based on the port which release the flow table. Since the flow table
create port and release port may have different tunnel offloading
configuration, it will cause invalid tunnel offloading release or
tunnel offloading resource leaks.

Add the flow table tunnel offloading attribute to indicate the flow
table has tunnel offloading resource or not to avoid wrong tunnel
offloading operation.

Signed-off-by: Suanming Mou <suanmingm@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow.h    | 1 +
 drivers/net/mlx5/mlx5_flow_dv.c | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)
  

Patch

diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h
index cc64792..62c5e7c 100644
--- a/drivers/net/mlx5/mlx5_flow.h
+++ b/drivers/net/mlx5/mlx5_flow.h
@@ -538,6 +538,7 @@  struct mlx5_flow_tbl_data_entry {
 	const struct mlx5_flow_tunnel *tunnel;
 	uint32_t group_id;
 	bool external;
+	bool tunnel_offload; /* Tunnel offlod table or not. */
 };
 
 /* Sub rdma-core actions list. */
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 13bc46d..0b4b7ff 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -7986,6 +7986,7 @@  struct field_modify_info modify_tcp[] = {
 	tbl_data->tunnel = tunnel;
 	tbl_data->group_id = group_id;
 	tbl_data->external = external;
+	tbl_data->tunnel_offload = is_tunnel_offload_active(dev);
 	tbl = &tbl_data->tbl;
 	pos = &tbl_data->entry;
 	if (transfer)
@@ -8061,7 +8062,7 @@  struct field_modify_info modify_tcp[] = {
 
 		mlx5_flow_os_destroy_flow_tbl(tbl->obj);
 		tbl->obj = NULL;
-		if (is_tunnel_offload_active(dev) && tbl_data->external) {
+		if (tbl_data->tunnel_offload && tbl_data->external) {
 			struct mlx5_hlist_entry *he;
 			struct mlx5_hlist *tunnel_grp_hash;
 			struct mlx5_flow_tunnel_hub *thub =