DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] net/mlx5: fix fragmented ptype match
@ 2024-12-19 16:01 Alexander Kozyrev
  2024-12-19 16:05 ` [PATCH v2] net/mlx5/hws: " Alexander Kozyrev
  0 siblings, 1 reply; 2+ messages in thread
From: Alexander Kozyrev @ 2024-12-19 16:01 UTC (permalink / raw)
  To: dev; +Cc: stable, rasland, viacheslavo, dsosnowski, bingz, suanmingm, michaelba

Fragmented PTYPE macthing requires the setting the mask to the exact
RTE_PTYPE_L4_FRAG value to avoid conflicts with other L4 types.
Adding L2 or L3 types to the same mask should be allowed,
but there is a check for the exact value for setting the definer.
This prevents the fragmented packets from matching in case of L2/L3
mask is provided as well. Mask out L2/L3 types when setting L4_FRAG.

Fixes: 761439a20f net/mlx5/hws: support fragmented packet type matching
Cc: stable@dpdk.org

Signed-off-by: Alexander Kozyrev <akozyrev@nvidia.com>
---
 drivers/net/mlx5/hws/mlx5dr_definer.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/mlx5/hws/mlx5dr_definer.c b/drivers/net/mlx5/hws/mlx5dr_definer.c
index e6d3dbfa46..837e0c47bd 100644
--- a/drivers/net/mlx5/hws/mlx5dr_definer.c
+++ b/drivers/net/mlx5/hws/mlx5dr_definer.c
@@ -2205,7 +2205,7 @@ mlx5dr_definer_conv_item_ptype(struct mlx5dr_definer_conv_data *cd,
 		 * Cannot be combined with Layer 4 Types (TCP/UDP).
 		 * The exact value must be specified in the mask.
 		 */
-		if (m->packet_type == RTE_PTYPE_L4_FRAG) {
+		if ((m->packet_type & RTE_PTYPE_L4_MASK) == RTE_PTYPE_L4_FRAG) {
 			fc = &cd->fc[DR_CALC_FNAME(PTYPE_FRAG, false)];
 			fc->item_idx = item_idx;
 			fc->tag_set = &mlx5dr_definer_ptype_frag_set;
@@ -2227,7 +2227,7 @@ mlx5dr_definer_conv_item_ptype(struct mlx5dr_definer_conv_data *cd,
 	}
 
 	if (m->packet_type & RTE_PTYPE_INNER_L4_MASK) {
-		if (m->packet_type == RTE_PTYPE_INNER_L4_FRAG) {
+		if ((m->packet_type & RTE_PTYPE_INNER_L4_MASK) == RTE_PTYPE_INNER_L4_FRAG) {
 			fc = &cd->fc[DR_CALC_FNAME(PTYPE_FRAG, true)];
 			fc->item_idx = item_idx;
 			fc->tag_set = &mlx5dr_definer_ptype_frag_set;
-- 
2.43.5


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

* [PATCH v2] net/mlx5/hws: fix fragmented ptype match
  2024-12-19 16:01 [PATCH] net/mlx5: fix fragmented ptype match Alexander Kozyrev
@ 2024-12-19 16:05 ` Alexander Kozyrev
  0 siblings, 0 replies; 2+ messages in thread
From: Alexander Kozyrev @ 2024-12-19 16:05 UTC (permalink / raw)
  To: dev; +Cc: stable, rasland, viacheslavo, dsosnowski, bingz, suanmingm, michaelba

Fragmented PTYPE matching requires setting the mask to the exact
RTE_PTYPE_L4_FRAG value to avoid conflicts with other L4 types.
Adding L2 or L3 types to the same mask should be allowed,
but there is a check for the exact value for setting the definer.
This prevents the fragmented packets from matching in case of L2/L3
mask is provided as well. Mask out L2/L3 types when setting L4_FRAG.

Fixes: 761439a20f net/mlx5/hws: support fragmented packet type matching
Cc: stable@dpdk.org

Signed-off-by: Alexander Kozyrev <akozyrev@nvidia.com>
---
 drivers/net/mlx5/hws/mlx5dr_definer.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/mlx5/hws/mlx5dr_definer.c b/drivers/net/mlx5/hws/mlx5dr_definer.c
index e6d3dbfa46..837e0c47bd 100644
--- a/drivers/net/mlx5/hws/mlx5dr_definer.c
+++ b/drivers/net/mlx5/hws/mlx5dr_definer.c
@@ -2205,7 +2205,7 @@ mlx5dr_definer_conv_item_ptype(struct mlx5dr_definer_conv_data *cd,
 		 * Cannot be combined with Layer 4 Types (TCP/UDP).
 		 * The exact value must be specified in the mask.
 		 */
-		if (m->packet_type == RTE_PTYPE_L4_FRAG) {
+		if ((m->packet_type & RTE_PTYPE_L4_MASK) == RTE_PTYPE_L4_FRAG) {
 			fc = &cd->fc[DR_CALC_FNAME(PTYPE_FRAG, false)];
 			fc->item_idx = item_idx;
 			fc->tag_set = &mlx5dr_definer_ptype_frag_set;
@@ -2227,7 +2227,7 @@ mlx5dr_definer_conv_item_ptype(struct mlx5dr_definer_conv_data *cd,
 	}
 
 	if (m->packet_type & RTE_PTYPE_INNER_L4_MASK) {
-		if (m->packet_type == RTE_PTYPE_INNER_L4_FRAG) {
+		if ((m->packet_type & RTE_PTYPE_INNER_L4_MASK) == RTE_PTYPE_INNER_L4_FRAG) {
 			fc = &cd->fc[DR_CALC_FNAME(PTYPE_FRAG, true)];
 			fc->item_idx = item_idx;
 			fc->tag_set = &mlx5dr_definer_ptype_frag_set;
-- 
2.43.5


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

end of thread, other threads:[~2024-12-19 16:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-12-19 16:01 [PATCH] net/mlx5: fix fragmented ptype match Alexander Kozyrev
2024-12-19 16:05 ` [PATCH v2] net/mlx5/hws: " Alexander Kozyrev

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).