DPDK patches and discussions
 help / color / mirror / Atom feed
From: Erez Shitrit <erezsh@nvidia.com>
To: <valex@nvidia.com>, <thomas@monjalon.net>, <suanmingm@nvidia.com>,
	"Matan Azrad" <matan@nvidia.com>,
	Viacheslav Ovsiienko <viacheslavo@nvidia.com>,
	 "Ori Kam" <orika@nvidia.com>
Cc: <dev@dpdk.org>
Subject: [PATCH 1/4] net/mlx5/hws: allow relaxed mode in MPLS matching
Date: Sun, 10 Sep 2023 17:03:16 +0300	[thread overview]
Message-ID: <20230910140319.3064208-1-erezsh@nvidia.com> (raw)


Remove the previous constrain on relaxed mode, that way it will be like
all other matching items, can be used in relaxed or non-relaxed mode.

The previous constrain was due to HW limitation that supports MPLS over
specific UDP port, now we give the ability to the user to make sure it
is with the right needs for MPLS matching.

Signed-off-by: Erez Shitrit <erezsh@nvidia.com>
Reviewed-by: Alex Vesker <valex@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/net/mlx5/hws/mlx5dr_definer.c | 45 ++++++++++-----------------
 1 file changed, 17 insertions(+), 28 deletions(-)

diff --git a/drivers/net/mlx5/hws/mlx5dr_definer.c b/drivers/net/mlx5/hws/mlx5dr_definer.c
index 33d0f2d18e..88f22e7f70 100644
--- a/drivers/net/mlx5/hws/mlx5dr_definer.c
+++ b/drivers/net/mlx5/hws/mlx5dr_definer.c
@@ -1320,35 +1320,24 @@ mlx5dr_definer_conv_item_mpls(struct mlx5dr_definer_conv_data *cd,
 		return rte_errno;
 	}
 
-	if (cd->relaxed) {
-		DR_LOG(ERR, "Relaxed mode is not supported");
-		rte_errno = ENOTSUP;
-		return rte_errno;
-	}
-
-	/* Currently support only MPLSoUDP */
-	if (cd->last_item != RTE_FLOW_ITEM_TYPE_UDP &&
-	    cd->last_item != RTE_FLOW_ITEM_TYPE_MPLS) {
-		DR_LOG(ERR, "MPLS supported only after UDP");
-		rte_errno = ENOTSUP;
-		return rte_errno;
-	}
-
-	/* In order to match on MPLS we must match on ip_protocol and l4_dport. */
-	fc = &cd->fc[DR_CALC_FNAME(IP_PROTOCOL, false)];
-	if (!fc->tag_set) {
-		fc->item_idx = item_idx;
-		fc->tag_mask_set = &mlx5dr_definer_ones_set;
-		fc->tag_set = &mlx5dr_definer_udp_protocol_set;
-		DR_CALC_SET(fc, eth_l2, l4_type_bwc, false);
-	}
+	if (!cd->relaxed) {
+		/* In order to match on MPLS we must match on ip_protocol and l4_dport. */
+		fc = &cd->fc[DR_CALC_FNAME(IP_PROTOCOL, false)];
+		if (!fc->tag_set) {
+			fc->item_idx = item_idx;
+			fc->tag_mask_set = &mlx5dr_definer_ones_set;
+			fc->tag_set = &mlx5dr_definer_udp_protocol_set;
+			DR_CALC_SET(fc, eth_l2, l4_type_bwc, false);
+		}
 
-	fc = &cd->fc[DR_CALC_FNAME(L4_DPORT, false)];
-	if (!fc->tag_set) {
-		fc->item_idx = item_idx;
-		fc->tag_mask_set = &mlx5dr_definer_ones_set;
-		fc->tag_set = &mlx5dr_definer_mpls_udp_port_set;
-		DR_CALC_SET(fc, eth_l4, destination_port, false);
+		/* Currently support only MPLSoUDP */
+		fc = &cd->fc[DR_CALC_FNAME(L4_DPORT, false)];
+		if (!fc->tag_set) {
+			fc->item_idx = item_idx;
+			fc->tag_mask_set = &mlx5dr_definer_ones_set;
+			fc->tag_set = &mlx5dr_definer_mpls_udp_port_set;
+			DR_CALC_SET(fc, eth_l4, destination_port, false);
+		}
 	}
 
 	if (m && (!is_mem_zero(m->label_tc_s, 3) || m->ttl)) {
-- 
2.18.2


             reply	other threads:[~2023-09-10 14:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-10 14:03 Erez Shitrit [this message]
2023-09-10 14:03 ` [PATCH 2/4] net/mlx5/hws: allow attaching action template to matcher Erez Shitrit
2023-09-10 14:03 ` [PATCH 3/4] net/mlx5/hws: print syndrome value on error Erez Shitrit
2023-09-10 14:03 ` [PATCH 4/4] net/mlx5/hws: skip process action-template on coll matcher Erez Shitrit
2023-09-19 12:02 ` [PATCH 1/4] net/mlx5/hws: allow relaxed mode in MPLS matching Raslan Darawsheh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230910140319.3064208-1-erezsh@nvidia.com \
    --to=erezsh@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=matan@nvidia.com \
    --cc=orika@nvidia.com \
    --cc=suanmingm@nvidia.com \
    --cc=thomas@monjalon.net \
    --cc=valex@nvidia.com \
    --cc=viacheslavo@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).