patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH] net/mlx5: fix tunnel PMD flow prioriry
@ 2020-07-16  7:39 Gregory Etelson
  2020-07-16  8:48 ` Ori Kam
  2020-07-20  8:08 ` Raslan Darawsheh
  0 siblings, 2 replies; 3+ messages in thread
From: Gregory Etelson @ 2020-07-16  7:39 UTC (permalink / raw)
  To: dev
  Cc: getelson, matan, rasland, stable, Shahaf Shuler,
	Viacheslav Ovsiienko, Ori Kam, Yongseok Koh

PMD flow priority is different from application flow priority.  Flow
rules with higher match granularity assigned higher PMD priority. Also
PMD splits internally RSS flows according to flow RSS layer.

Final PMD flow rule priority derived from the last match item network
level, after PMD adjusts flow rule, where L4 match gets the highest
priority and L2 the lowest.

The patch adjusts tunnels flow rule priority calculation for PMDs
running verb API.

Introduce MLX5_TUNNEL_PRIO_GET macro.

Fixes: 4a78c88e3bae ("net/mlx5: fix Verbs flow tunnel")
Cc: stable@dpdk.org

Signed-off-by: Gregory Etelson <getelson@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
---
 drivers/net/mlx5/mlx5_flow.h       |  4 ++++
 drivers/net/mlx5/mlx5_flow_dv.c    | 21 +++++++--------------
 drivers/net/mlx5/mlx5_flow_verbs.c |  8 ++++----
 3 files changed, 15 insertions(+), 18 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h
index 43cbda8712..89a827eb45 100644
--- a/drivers/net/mlx5/mlx5_flow.h
+++ b/drivers/net/mlx5/mlx5_flow.h
@@ -516,6 +516,10 @@ struct mlx5_flow_rss_desc {
 	uint16_t queue[]; /**< Destination queues to redirect traffic to. */
 };
 
+/* PMD flow priority for tunnel */
+#define MLX5_TUNNEL_PRIO_GET(rss_desc) \
+	((rss_desc)->level >= 2 ? MLX5_PRIORITY_MAP_L2 : MLX5_PRIORITY_MAP_L4)
+
 
 /** Device flow handle structure for DV mode only. */
 struct mlx5_flow_handle_dv {
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 8b5b6838fa..7944e5d6fd 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -8462,8 +8462,7 @@ __flow_dv_translate(struct rte_eth_dev *dev,
 		case RTE_FLOW_ITEM_TYPE_GRE:
 			flow_dv_translate_item_gre(match_mask, match_value,
 						   items, tunnel);
-			matcher.priority = rss_desc->level >= 2 ?
-				    MLX5_PRIORITY_MAP_L2 : MLX5_PRIORITY_MAP_L4;
+			matcher.priority = MLX5_TUNNEL_PRIO_GET(rss_desc);
 			last_item = MLX5_FLOW_LAYER_GRE;
 			break;
 		case RTE_FLOW_ITEM_TYPE_GRE_KEY:
@@ -8474,37 +8473,32 @@ __flow_dv_translate(struct rte_eth_dev *dev,
 		case RTE_FLOW_ITEM_TYPE_NVGRE:
 			flow_dv_translate_item_nvgre(match_mask, match_value,
 						     items, tunnel);
-			matcher.priority = rss_desc->level >= 2 ?
-				    MLX5_PRIORITY_MAP_L2 : MLX5_PRIORITY_MAP_L4;
+			matcher.priority = MLX5_TUNNEL_PRIO_GET(rss_desc);
 			last_item = MLX5_FLOW_LAYER_GRE;
 			break;
 		case RTE_FLOW_ITEM_TYPE_VXLAN:
 			flow_dv_translate_item_vxlan(match_mask, match_value,
 						     items, tunnel);
-			matcher.priority = rss_desc->level >= 2 ?
-				    MLX5_PRIORITY_MAP_L2 : MLX5_PRIORITY_MAP_L4;
+			matcher.priority = MLX5_TUNNEL_PRIO_GET(rss_desc);
 			last_item = MLX5_FLOW_LAYER_VXLAN;
 			break;
 		case RTE_FLOW_ITEM_TYPE_VXLAN_GPE:
 			flow_dv_translate_item_vxlan_gpe(match_mask,
 							 match_value, items,
 							 tunnel);
-			matcher.priority = rss_desc->level >= 2 ?
-				    MLX5_PRIORITY_MAP_L2 : MLX5_PRIORITY_MAP_L4;
+			matcher.priority = MLX5_TUNNEL_PRIO_GET(rss_desc);
 			last_item = MLX5_FLOW_LAYER_VXLAN_GPE;
 			break;
 		case RTE_FLOW_ITEM_TYPE_GENEVE:
 			flow_dv_translate_item_geneve(match_mask, match_value,
 						      items, tunnel);
-			matcher.priority = rss_desc->level >= 2 ?
-				    MLX5_PRIORITY_MAP_L2 : MLX5_PRIORITY_MAP_L4;
+			matcher.priority = MLX5_TUNNEL_PRIO_GET(rss_desc);
 			last_item = MLX5_FLOW_LAYER_GENEVE;
 			break;
 		case RTE_FLOW_ITEM_TYPE_MPLS:
 			flow_dv_translate_item_mpls(match_mask, match_value,
 						    items, last_item, tunnel);
-			matcher.priority = rss_desc->level >= 2 ?
-				    MLX5_PRIORITY_MAP_L2 : MLX5_PRIORITY_MAP_L4;
+			matcher.priority = MLX5_TUNNEL_PRIO_GET(rss_desc);
 			last_item = MLX5_FLOW_LAYER_MPLS;
 			break;
 		case RTE_FLOW_ITEM_TYPE_MARK:
@@ -8546,8 +8540,7 @@ __flow_dv_translate(struct rte_eth_dev *dev,
 		case RTE_FLOW_ITEM_TYPE_GTP:
 			flow_dv_translate_item_gtp(match_mask, match_value,
 						   items, tunnel);
-			matcher.priority = rss_desc->level >= 2 ?
-				    MLX5_PRIORITY_MAP_L2 : MLX5_PRIORITY_MAP_L4;
+			matcher.priority = MLX5_TUNNEL_PRIO_GET(rss_desc);
 			last_item = MLX5_FLOW_LAYER_GTP;
 			break;
 		default:
diff --git a/drivers/net/mlx5/mlx5_flow_verbs.c b/drivers/net/mlx5/mlx5_flow_verbs.c
index 781c97fd2e..602375d062 100644
--- a/drivers/net/mlx5/mlx5_flow_verbs.c
+++ b/drivers/net/mlx5/mlx5_flow_verbs.c
@@ -1723,25 +1723,25 @@ flow_verbs_translate(struct rte_eth_dev *dev,
 		case RTE_FLOW_ITEM_TYPE_VXLAN:
 			flow_verbs_translate_item_vxlan(dev_flow, items,
 							item_flags);
-			subpriority = MLX5_PRIORITY_MAP_L2;
+			subpriority = MLX5_TUNNEL_PRIO_GET(rss_desc);
 			item_flags |= MLX5_FLOW_LAYER_VXLAN;
 			break;
 		case RTE_FLOW_ITEM_TYPE_VXLAN_GPE:
 			flow_verbs_translate_item_vxlan_gpe(dev_flow, items,
 							    item_flags);
-			subpriority = MLX5_PRIORITY_MAP_L2;
+			subpriority = MLX5_TUNNEL_PRIO_GET(rss_desc);
 			item_flags |= MLX5_FLOW_LAYER_VXLAN_GPE;
 			break;
 		case RTE_FLOW_ITEM_TYPE_GRE:
 			flow_verbs_translate_item_gre(dev_flow, items,
 						      item_flags);
-			subpriority = MLX5_PRIORITY_MAP_L2;
+			subpriority = MLX5_TUNNEL_PRIO_GET(rss_desc);
 			item_flags |= MLX5_FLOW_LAYER_GRE;
 			break;
 		case RTE_FLOW_ITEM_TYPE_MPLS:
 			flow_verbs_translate_item_mpls(dev_flow, items,
 						       item_flags);
-			subpriority = MLX5_PRIORITY_MAP_L2;
+			subpriority = MLX5_TUNNEL_PRIO_GET(rss_desc);
 			item_flags |= MLX5_FLOW_LAYER_MPLS;
 			break;
 		default:
-- 
2.25.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-stable] [PATCH] net/mlx5: fix tunnel PMD flow prioriry
  2020-07-16  7:39 [dpdk-stable] [PATCH] net/mlx5: fix tunnel PMD flow prioriry Gregory Etelson
@ 2020-07-16  8:48 ` Ori Kam
  2020-07-20  8:08 ` Raslan Darawsheh
  1 sibling, 0 replies; 3+ messages in thread
From: Ori Kam @ 2020-07-16  8:48 UTC (permalink / raw)
  To: Gregory Etelson, dev
  Cc: Matan Azrad, Raslan Darawsheh, stable, Shahaf Shuler,
	Slava Ovsiienko, Yongseok Koh



> -----Original Message-----
> From: Gregory Etelson <getelson@mellanox.com>
> Sent: Thursday, July 16, 2020 10:40 AM
> Subject: [PATCH] net/mlx5: fix tunnel PMD flow prioriry
> 
> PMD flow priority is different from application flow priority.  Flow
> rules with higher match granularity assigned higher PMD priority. Also
> PMD splits internally RSS flows according to flow RSS layer.
> 
> Final PMD flow rule priority derived from the last match item network
> level, after PMD adjusts flow rule, where L4 match gets the highest
> priority and L2 the lowest.
> 
> The patch adjusts tunnels flow rule priority calculation for PMDs
> running verb API.
> 
> Introduce MLX5_TUNNEL_PRIO_GET macro.
> 
> Fixes: 4a78c88e3bae ("net/mlx5: fix Verbs flow tunnel")
> Cc: stable@dpdk.org
> 

Acked-by: Ori Kam <orika@mellanox.com>
Thanks,
Ori



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-stable] [PATCH] net/mlx5: fix tunnel PMD flow prioriry
  2020-07-16  7:39 [dpdk-stable] [PATCH] net/mlx5: fix tunnel PMD flow prioriry Gregory Etelson
  2020-07-16  8:48 ` Ori Kam
@ 2020-07-20  8:08 ` Raslan Darawsheh
  1 sibling, 0 replies; 3+ messages in thread
From: Raslan Darawsheh @ 2020-07-20  8:08 UTC (permalink / raw)
  To: Gregory Etelson, dev
  Cc: Matan Azrad, stable, Shahaf Shuler, Slava Ovsiienko, Ori Kam,
	Yongseok Koh

Hi,

> -----Original Message-----
> From: Gregory Etelson <getelson@mellanox.com>
> Sent: Thursday, July 16, 2020 10:40 AM
> To: dev@dpdk.org
> Cc: Gregory Etelson <getelson@mellanox.com>; Matan Azrad
> <matan@mellanox.com>; Raslan Darawsheh <rasland@mellanox.com>;
> stable@dpdk.org; Shahaf Shuler <shahafs@mellanox.com>; Slava Ovsiienko
> <viacheslavo@mellanox.com>; Ori Kam <orika@mellanox.com>; Yongseok
> Koh <yskoh@mellanox.com>
> Subject: [PATCH] net/mlx5: fix tunnel PMD flow prioriry
> 
> PMD flow priority is different from application flow priority.  Flow
> rules with higher match granularity assigned higher PMD priority. Also
> PMD splits internally RSS flows according to flow RSS layer.
> 
> Final PMD flow rule priority derived from the last match item network
> level, after PMD adjusts flow rule, where L4 match gets the highest
> priority and L2 the lowest.
> 
> The patch adjusts tunnels flow rule priority calculation for PMDs
> running verb API.
> 
> Introduce MLX5_TUNNEL_PRIO_GET macro.
> 
> Fixes: 4a78c88e3bae ("net/mlx5: fix Verbs flow tunnel")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Gregory Etelson <getelson@mellanox.com>
> Acked-by: Matan Azrad <matan@mellanox.com>
> ---
>  drivers/net/mlx5/mlx5_flow.h       |  4 ++++
>  drivers/net/mlx5/mlx5_flow_dv.c    | 21 +++++++--------------
>  drivers/net/mlx5/mlx5_flow_verbs.c |  8 ++++----
>  3 files changed, 15 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h
> index 43cbda8712..89a827eb45 100644
> --- a/drivers/net/mlx5/mlx5_flow.h
> +++ b/drivers/net/mlx5/mlx5_flow.h
> @@ -516,6 +516,10 @@ struct mlx5_flow_rss_desc {
>  	uint16_t queue[]; /**< Destination queues to redirect traffic to. */
>  };
> 
> +/* PMD flow priority for tunnel */
> +#define MLX5_TUNNEL_PRIO_GET(rss_desc) \
> +	((rss_desc)->level >= 2 ? MLX5_PRIORITY_MAP_L2 :
> MLX5_PRIORITY_MAP_L4)
> +
> 
>  /** Device flow handle structure for DV mode only. */
>  struct mlx5_flow_handle_dv {
> diff --git a/drivers/net/mlx5/mlx5_flow_dv.c
> b/drivers/net/mlx5/mlx5_flow_dv.c
> index 8b5b6838fa..7944e5d6fd 100644
> --- a/drivers/net/mlx5/mlx5_flow_dv.c
> +++ b/drivers/net/mlx5/mlx5_flow_dv.c
> @@ -8462,8 +8462,7 @@ __flow_dv_translate(struct rte_eth_dev *dev,
>  		case RTE_FLOW_ITEM_TYPE_GRE:
>  			flow_dv_translate_item_gre(match_mask,
> match_value,
>  						   items, tunnel);
> -			matcher.priority = rss_desc->level >= 2 ?
> -				    MLX5_PRIORITY_MAP_L2 :
> MLX5_PRIORITY_MAP_L4;
> +			matcher.priority =
> MLX5_TUNNEL_PRIO_GET(rss_desc);
>  			last_item = MLX5_FLOW_LAYER_GRE;
>  			break;
>  		case RTE_FLOW_ITEM_TYPE_GRE_KEY:
> @@ -8474,37 +8473,32 @@ __flow_dv_translate(struct rte_eth_dev *dev,
>  		case RTE_FLOW_ITEM_TYPE_NVGRE:
>  			flow_dv_translate_item_nvgre(match_mask,
> match_value,
>  						     items, tunnel);
> -			matcher.priority = rss_desc->level >= 2 ?
> -				    MLX5_PRIORITY_MAP_L2 :
> MLX5_PRIORITY_MAP_L4;
> +			matcher.priority =
> MLX5_TUNNEL_PRIO_GET(rss_desc);
>  			last_item = MLX5_FLOW_LAYER_GRE;
>  			break;
>  		case RTE_FLOW_ITEM_TYPE_VXLAN:
>  			flow_dv_translate_item_vxlan(match_mask,
> match_value,
>  						     items, tunnel);
> -			matcher.priority = rss_desc->level >= 2 ?
> -				    MLX5_PRIORITY_MAP_L2 :
> MLX5_PRIORITY_MAP_L4;
> +			matcher.priority =
> MLX5_TUNNEL_PRIO_GET(rss_desc);
>  			last_item = MLX5_FLOW_LAYER_VXLAN;
>  			break;
>  		case RTE_FLOW_ITEM_TYPE_VXLAN_GPE:
>  			flow_dv_translate_item_vxlan_gpe(match_mask,
>  							 match_value, items,
>  							 tunnel);
> -			matcher.priority = rss_desc->level >= 2 ?
> -				    MLX5_PRIORITY_MAP_L2 :
> MLX5_PRIORITY_MAP_L4;
> +			matcher.priority =
> MLX5_TUNNEL_PRIO_GET(rss_desc);
>  			last_item = MLX5_FLOW_LAYER_VXLAN_GPE;
>  			break;
>  		case RTE_FLOW_ITEM_TYPE_GENEVE:
>  			flow_dv_translate_item_geneve(match_mask,
> match_value,
>  						      items, tunnel);
> -			matcher.priority = rss_desc->level >= 2 ?
> -				    MLX5_PRIORITY_MAP_L2 :
> MLX5_PRIORITY_MAP_L4;
> +			matcher.priority =
> MLX5_TUNNEL_PRIO_GET(rss_desc);
>  			last_item = MLX5_FLOW_LAYER_GENEVE;
>  			break;
>  		case RTE_FLOW_ITEM_TYPE_MPLS:
>  			flow_dv_translate_item_mpls(match_mask,
> match_value,
>  						    items, last_item, tunnel);
> -			matcher.priority = rss_desc->level >= 2 ?
> -				    MLX5_PRIORITY_MAP_L2 :
> MLX5_PRIORITY_MAP_L4;
> +			matcher.priority =
> MLX5_TUNNEL_PRIO_GET(rss_desc);
>  			last_item = MLX5_FLOW_LAYER_MPLS;
>  			break;
>  		case RTE_FLOW_ITEM_TYPE_MARK:
> @@ -8546,8 +8540,7 @@ __flow_dv_translate(struct rte_eth_dev *dev,
>  		case RTE_FLOW_ITEM_TYPE_GTP:
>  			flow_dv_translate_item_gtp(match_mask,
> match_value,
>  						   items, tunnel);
> -			matcher.priority = rss_desc->level >= 2 ?
> -				    MLX5_PRIORITY_MAP_L2 :
> MLX5_PRIORITY_MAP_L4;
> +			matcher.priority =
> MLX5_TUNNEL_PRIO_GET(rss_desc);
>  			last_item = MLX5_FLOW_LAYER_GTP;
>  			break;
>  		default:
> diff --git a/drivers/net/mlx5/mlx5_flow_verbs.c
> b/drivers/net/mlx5/mlx5_flow_verbs.c
> index 781c97fd2e..602375d062 100644
> --- a/drivers/net/mlx5/mlx5_flow_verbs.c
> +++ b/drivers/net/mlx5/mlx5_flow_verbs.c
> @@ -1723,25 +1723,25 @@ flow_verbs_translate(struct rte_eth_dev *dev,
>  		case RTE_FLOW_ITEM_TYPE_VXLAN:
>  			flow_verbs_translate_item_vxlan(dev_flow, items,
>  							item_flags);
> -			subpriority = MLX5_PRIORITY_MAP_L2;
> +			subpriority = MLX5_TUNNEL_PRIO_GET(rss_desc);
>  			item_flags |= MLX5_FLOW_LAYER_VXLAN;
>  			break;
>  		case RTE_FLOW_ITEM_TYPE_VXLAN_GPE:
>  			flow_verbs_translate_item_vxlan_gpe(dev_flow,
> items,
>  							    item_flags);
> -			subpriority = MLX5_PRIORITY_MAP_L2;
> +			subpriority = MLX5_TUNNEL_PRIO_GET(rss_desc);
>  			item_flags |= MLX5_FLOW_LAYER_VXLAN_GPE;
>  			break;
>  		case RTE_FLOW_ITEM_TYPE_GRE:
>  			flow_verbs_translate_item_gre(dev_flow, items,
>  						      item_flags);
> -			subpriority = MLX5_PRIORITY_MAP_L2;
> +			subpriority = MLX5_TUNNEL_PRIO_GET(rss_desc);
>  			item_flags |= MLX5_FLOW_LAYER_GRE;
>  			break;
>  		case RTE_FLOW_ITEM_TYPE_MPLS:
>  			flow_verbs_translate_item_mpls(dev_flow, items,
>  						       item_flags);
> -			subpriority = MLX5_PRIORITY_MAP_L2;
> +			subpriority = MLX5_TUNNEL_PRIO_GET(rss_desc);
>  			item_flags |= MLX5_FLOW_LAYER_MPLS;
>  			break;
>  		default:
> --
> 2.25.1


Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-07-20  8:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-16  7:39 [dpdk-stable] [PATCH] net/mlx5: fix tunnel PMD flow prioriry Gregory Etelson
2020-07-16  8:48 ` Ori Kam
2020-07-20  8:08 ` Raslan Darawsheh

patches for DPDK stable branches

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/stable/0 stable/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 stable stable/ https://inbox.dpdk.org/stable \
		stable@dpdk.org
	public-inbox-index stable

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.stable


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git