DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/mlx5: fix matching on eCPRI
@ 2021-08-09 14:26 Dmitry Kozlyuk
  2021-08-10  6:22 ` Matan Azrad
  2021-08-17  9:49 ` Raslan Darawsheh
  0 siblings, 2 replies; 3+ messages in thread
From: Dmitry Kozlyuk @ 2021-08-09 14:26 UTC (permalink / raw)
  To: dev; +Cc: bingz, stable, Matan Azrad, Shahaf Shuler, Viacheslav Ovsiienko

When an ETH or VLAN flow item directly preceding ECPRI (i. e. a pattern
for eCPRI over Ethernet) did not specify the eCPRI protocol, matches
were not restricted to eCPRI traffic. For example, "eth / ecpri / end"
pattern behaved as "eth / end". Implicitly add Ethernet type condition,
so that "eth / ecpri / end" behaves as "eth type is 0xAEFE / end".

Fixes: daa38a8924a0 ("net/mlx5: add flow translation of eCPRI header")
Cc: bingz@nvidia.com
Cc: stable@dpdk.org

Signed-off-by: Dmitry Kozlyuk <dkozlyuk@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow_dv.c | 26 ++++++++++++++++++++++----
 1 file changed, 22 insertions(+), 4 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 31d857030f..5bb6d89a3f 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -9976,12 +9976,13 @@ flow_dv_translate_item_gtp_psc(void *matcher, void *key,
  *   Flow matcher value.
  * @param[in] item
  *   Flow pattern to translate.
- * @param[in] samples
- *   Sample IDs to be used in the matching.
+ * @param[in] last_item
+ *   Last item flags.
  */
 static void
 flow_dv_translate_item_ecpri(struct rte_eth_dev *dev, void *matcher,
-			     void *key, const struct rte_flow_item *item)
+			     void *key, const struct rte_flow_item *item,
+			     uint64_t last_item)
 {
 	struct mlx5_priv *priv = dev->data->dev_private;
 	const struct rte_flow_item_ecpri *ecpri_m = item->mask;
@@ -9994,6 +9995,22 @@ flow_dv_translate_item_ecpri(struct rte_eth_dev *dev, void *matcher,
 	void *dw_m;
 	void *dw_v;
 
+	/*
+	 * In case of eCPRI over Ethernet, if EtherType is not specified,
+	 * match on eCPRI EtherType implicitly.
+	 */
+	if (last_item & MLX5_FLOW_LAYER_OUTER_L2) {
+		void *hdrs_m, *hdrs_v, *l2m, *l2v;
+
+		hdrs_m = MLX5_ADDR_OF(fte_match_param, matcher, outer_headers);
+		hdrs_v = MLX5_ADDR_OF(fte_match_param, key, outer_headers);
+		l2m = MLX5_ADDR_OF(fte_match_set_lyr_2_4, hdrs_m, ethertype);
+		l2v = MLX5_ADDR_OF(fte_match_set_lyr_2_4, hdrs_v, ethertype);
+		if (*(uint16_t *)l2m == 0 && *(uint16_t *)l2v == 0) {
+			*(uint16_t *)l2m = UINT16_MAX;
+			*(uint16_t *)l2v = RTE_BE16(RTE_ETHER_TYPE_ECPRI);
+		}
+	}
 	if (!ecpri_v)
 		return;
 	if (!ecpri_m)
@@ -13474,7 +13491,8 @@ flow_dv_translate(struct rte_eth_dev *dev,
 						"cannot create eCPRI parser");
 			}
 			flow_dv_translate_item_ecpri(dev, match_mask,
-						     match_value, items);
+						     match_value, items,
+						     last_item);
 			/* No other protocol should follow eCPRI layer. */
 			last_item = MLX5_FLOW_LAYER_ECPRI;
 			break;
-- 
2.25.1


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

* Re: [dpdk-dev] [PATCH] net/mlx5: fix matching on eCPRI
  2021-08-09 14:26 [dpdk-dev] [PATCH] net/mlx5: fix matching on eCPRI Dmitry Kozlyuk
@ 2021-08-10  6:22 ` Matan Azrad
  2021-08-17  9:49 ` Raslan Darawsheh
  1 sibling, 0 replies; 3+ messages in thread
From: Matan Azrad @ 2021-08-10  6:22 UTC (permalink / raw)
  To: Dmitry Kozlyuk, dev; +Cc: Bing Zhao, stable, Shahaf Shuler, Slava Ovsiienko



From: Dmitry Kozlyuk
> When an ETH or VLAN flow item directly preceding ECPRI (i. e. a pattern for
> eCPRI over Ethernet) did not specify the eCPRI protocol, matches were not
> restricted to eCPRI traffic. For example, "eth / ecpri / end"
> pattern behaved as "eth / end". Implicitly add Ethernet type condition, so
> that "eth / ecpri / end" behaves as "eth type is 0xAEFE / end".
> 
> Fixes: daa38a8924a0 ("net/mlx5: add flow translation of eCPRI header")
> Cc: bingz@nvidia.com
> Cc: stable@dpdk.org
> 
> Signed-off-by: Dmitry Kozlyuk <dkozlyuk@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>


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

* Re: [dpdk-dev] [PATCH] net/mlx5: fix matching on eCPRI
  2021-08-09 14:26 [dpdk-dev] [PATCH] net/mlx5: fix matching on eCPRI Dmitry Kozlyuk
  2021-08-10  6:22 ` Matan Azrad
@ 2021-08-17  9:49 ` Raslan Darawsheh
  1 sibling, 0 replies; 3+ messages in thread
From: Raslan Darawsheh @ 2021-08-17  9:49 UTC (permalink / raw)
  To: Dmitry Kozlyuk, dev
  Cc: Bing Zhao, stable, Matan Azrad, Shahaf Shuler, Slava Ovsiienko

Hi,

> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Dmitry Kozlyuk
> Sent: Monday, August 9, 2021 5:27 PM
> To: dev@dpdk.org
> Cc: Bing Zhao <bingz@nvidia.com>; stable@dpdk.org; Matan Azrad
> <matan@nvidia.com>; Shahaf Shuler <shahafs@nvidia.com>; Slava
> Ovsiienko <viacheslavo@nvidia.com>
> Subject: [dpdk-dev] [PATCH] net/mlx5: fix matching on eCPRI
> 
> When an ETH or VLAN flow item directly preceding ECPRI (i. e. a pattern for
> eCPRI over Ethernet) did not specify the eCPRI protocol, matches were not
> restricted to eCPRI traffic. For example, "eth / ecpri / end"
> pattern behaved as "eth / end". Implicitly add Ethernet type condition, so
> that "eth / ecpri / end" behaves as "eth type is 0xAEFE / end".
> 
> Fixes: daa38a8924a0 ("net/mlx5: add flow translation of eCPRI header")
> Cc: bingz@nvidia.com
> Cc: stable@dpdk.org
> 
> Signed-off-by: Dmitry Kozlyuk <dkozlyuk@nvidia.com>

Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh

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

end of thread, other threads:[~2021-08-17  9:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-09 14:26 [dpdk-dev] [PATCH] net/mlx5: fix matching on eCPRI Dmitry Kozlyuk
2021-08-10  6:22 ` Matan Azrad
2021-08-17  9:49 ` Raslan Darawsheh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).