DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 1/1] net/mlx5: fix modify field action conversion mask
@ 2021-11-08 14:11 Viacheslav Ovsiienko
  2021-11-10  8:50 ` Raslan Darawsheh
  0 siblings, 1 reply; 2+ messages in thread
From: Viacheslav Ovsiienko @ 2021-11-08 14:11 UTC (permalink / raw)
  To: dev; +Cc: rasland, matan, akozyrev

The routine converting RTE flow modify field action into
field driver's presentation did not specify the field mask
correctly and this resulted into wrong conversion for
the actions with shifted fields.

Fixes: 40c8fb1fd3b3 ("net/mlx5: update modify field action")

Signed-off-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow_dv.c | 46 ++++++++++++++++-----------------
 1 file changed, 22 insertions(+), 24 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 842ada2ea9..de7923e288 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -1470,11 +1470,11 @@ mlx5_flow_field_id_to_modify_info
 				info[idx] = (struct field_modify_info){2, 4,
 						MLX5_MODI_OUT_DMAC_15_0};
 				if (width < 16) {
-					mask[idx] = rte_cpu_to_be_16(0xffff >>
+					mask[1] = rte_cpu_to_be_16(0xffff >>
 								 (16 - width));
 					width = 0;
 				} else {
-					mask[idx] = RTE_BE16(0xffff);
+					mask[1] = RTE_BE16(0xffff);
 					width -= 16;
 				}
 				if (!width)
@@ -1483,8 +1483,8 @@ mlx5_flow_field_id_to_modify_info
 			}
 			info[idx] = (struct field_modify_info){4, 0,
 						MLX5_MODI_OUT_DMAC_47_16};
-			mask[idx] = rte_cpu_to_be_32((0xffffffff >>
-						      (32 - width)) << off);
+			mask[0] = rte_cpu_to_be_32((0xffffffff >>
+						    (32 - width)) << off);
 		} else {
 			if (data->offset < 16)
 				info[idx++] = (struct field_modify_info){2, 4,
@@ -1500,11 +1500,11 @@ mlx5_flow_field_id_to_modify_info
 				info[idx] = (struct field_modify_info){2, 4,
 						MLX5_MODI_OUT_SMAC_15_0};
 				if (width < 16) {
-					mask[idx] = rte_cpu_to_be_16(0xffff >>
+					mask[1] = rte_cpu_to_be_16(0xffff >>
 								 (16 - width));
 					width = 0;
 				} else {
-					mask[idx] = RTE_BE16(0xffff);
+					mask[1] = RTE_BE16(0xffff);
 					width -= 16;
 				}
 				if (!width)
@@ -1513,8 +1513,8 @@ mlx5_flow_field_id_to_modify_info
 			}
 			info[idx] = (struct field_modify_info){4, 0,
 						MLX5_MODI_OUT_SMAC_47_16};
-			mask[idx] = rte_cpu_to_be_32((0xffffffff >>
-						      (32 - width)) << off);
+			mask[0] = rte_cpu_to_be_32((0xffffffff >>
+						    (32 - width)) << off);
 		} else {
 			if (data->offset < 16)
 				info[idx++] = (struct field_modify_info){2, 4,
@@ -1582,12 +1582,12 @@ mlx5_flow_field_id_to_modify_info
 				info[idx] = (struct field_modify_info){4, 12,
 						MLX5_MODI_OUT_SIPV6_31_0};
 				if (width < 32) {
-					mask[idx] =
+					mask[3] =
 						rte_cpu_to_be_32(0xffffffff >>
 								 (32 - width));
 					width = 0;
 				} else {
-					mask[idx] = RTE_BE32(0xffffffff);
+					mask[3] = RTE_BE32(0xffffffff);
 					width -= 32;
 				}
 				if (!width)
@@ -1598,12 +1598,12 @@ mlx5_flow_field_id_to_modify_info
 				info[idx] = (struct field_modify_info){4, 8,
 						MLX5_MODI_OUT_SIPV6_63_32};
 				if (width < 32) {
-					mask[idx] =
+					mask[2] =
 						rte_cpu_to_be_32(0xffffffff >>
 								 (32 - width));
 					width = 0;
 				} else {
-					mask[idx] = RTE_BE32(0xffffffff);
+					mask[2] = RTE_BE32(0xffffffff);
 					width -= 32;
 				}
 				if (!width)
@@ -1614,12 +1614,12 @@ mlx5_flow_field_id_to_modify_info
 				info[idx] = (struct field_modify_info){4, 4,
 						MLX5_MODI_OUT_SIPV6_95_64};
 				if (width < 32) {
-					mask[idx] =
+					mask[1] =
 						rte_cpu_to_be_32(0xffffffff >>
 								 (32 - width));
 					width = 0;
 				} else {
-					mask[idx] = RTE_BE32(0xffffffff);
+					mask[1] = RTE_BE32(0xffffffff);
 					width -= 32;
 				}
 				if (!width)
@@ -1628,8 +1628,7 @@ mlx5_flow_field_id_to_modify_info
 			}
 			info[idx] = (struct field_modify_info){4, 0,
 						MLX5_MODI_OUT_SIPV6_127_96};
-			mask[idx] = rte_cpu_to_be_32(0xffffffff >>
-						     (32 - width));
+			mask[0] = rte_cpu_to_be_32(0xffffffff >> (32 - width));
 		} else {
 			if (data->offset < 32)
 				info[idx++] = (struct field_modify_info){4, 12,
@@ -1651,12 +1650,12 @@ mlx5_flow_field_id_to_modify_info
 				info[idx] = (struct field_modify_info){4, 12,
 						MLX5_MODI_OUT_DIPV6_31_0};
 				if (width < 32) {
-					mask[idx] =
+					mask[3] =
 						rte_cpu_to_be_32(0xffffffff >>
 								 (32 - width));
 					width = 0;
 				} else {
-					mask[idx] = RTE_BE32(0xffffffff);
+					mask[3] = RTE_BE32(0xffffffff);
 					width -= 32;
 				}
 				if (!width)
@@ -1667,12 +1666,12 @@ mlx5_flow_field_id_to_modify_info
 				info[idx] = (struct field_modify_info){4, 8,
 						MLX5_MODI_OUT_DIPV6_63_32};
 				if (width < 32) {
-					mask[idx] =
+					mask[2] =
 						rte_cpu_to_be_32(0xffffffff >>
 								 (32 - width));
 					width = 0;
 				} else {
-					mask[idx] = RTE_BE32(0xffffffff);
+					mask[2] = RTE_BE32(0xffffffff);
 					width -= 32;
 				}
 				if (!width)
@@ -1683,12 +1682,12 @@ mlx5_flow_field_id_to_modify_info
 				info[idx] = (struct field_modify_info){4, 4,
 						MLX5_MODI_OUT_DIPV6_95_64};
 				if (width < 32) {
-					mask[idx] =
+					mask[1] =
 						rte_cpu_to_be_32(0xffffffff >>
 								 (32 - width));
 					width = 0;
 				} else {
-					mask[idx] = RTE_BE32(0xffffffff);
+					mask[1] = RTE_BE32(0xffffffff);
 					width -= 32;
 				}
 				if (!width)
@@ -1697,8 +1696,7 @@ mlx5_flow_field_id_to_modify_info
 			}
 			info[idx] = (struct field_modify_info){4, 0,
 						MLX5_MODI_OUT_DIPV6_127_96};
-			mask[idx] = rte_cpu_to_be_32(0xffffffff >>
-						     (32 - width));
+			mask[0] = rte_cpu_to_be_32(0xffffffff >> (32 - width));
 		} else {
 			if (data->offset < 32)
 				info[idx++] = (struct field_modify_info){4, 12,
-- 
2.18.1


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

* Re: [dpdk-dev] [PATCH 1/1] net/mlx5: fix modify field action conversion mask
  2021-11-08 14:11 [dpdk-dev] [PATCH 1/1] net/mlx5: fix modify field action conversion mask Viacheslav Ovsiienko
@ 2021-11-10  8:50 ` Raslan Darawsheh
  0 siblings, 0 replies; 2+ messages in thread
From: Raslan Darawsheh @ 2021-11-10  8:50 UTC (permalink / raw)
  To: Slava Ovsiienko, dev; +Cc: Matan Azrad, Alexander Kozyrev

Hi,
h

> -----Original Message-----
> From: Slava Ovsiienko <viacheslavo@nvidia.com>
> Sent: Monday, November 8, 2021 4:12 PM
> To: dev@dpdk.org
> Cc: Raslan Darawsheh <rasland@nvidia.com>; Matan Azrad
> <matan@nvidia.com>; Alexander Kozyrev <akozyrev@nvidia.com>
> Subject: [PATCH 1/1] net/mlx5: fix modify field action conversion mask
> 
> The routine converting RTE flow modify field action into
> field driver's presentation did not specify the field mask
> correctly and this resulted into wrong conversion for
> the actions with shifted fields.
> 
> Fixes: 40c8fb1fd3b3 ("net/mlx5: update modify field action")
> 
> Signed-off-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>

Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawshe

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

end of thread, other threads:[~2021-11-10  8:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-08 14:11 [dpdk-dev] [PATCH 1/1] net/mlx5: fix modify field action conversion mask Viacheslav Ovsiienko
2021-11-10  8:50 ` 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).