DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Manish Kurup <manish.kurup@broadcom.com>
To: dev@dpdk.org
Cc: kishore.padmanabha@broadcom.com,
	Shahaji Bhosle <shahaji.bhosle@broadcom.com>,
	stable@dpdk.org
Subject: [PATCH] net/bnxt: fix ICMP v4/v6 L3 proto match
Date: Mon,  5 Oct 2026 10:17:36 -0500	[thread overview]
Message-ID: <20261005151736.1706210-1-manish.kurup@broadcom.com> (raw)

From: Shahaji Bhosle <shahaji.bhosle@broadcom.com>

Update the L3 protocol computed field for ICMPv4/ICMPv6 as well,
for the case where the flow rule matches on the ICMP header but not
on an explicit IP protocol field.

Fixes: a4d4308ef105 ("net/bnxt: add ICMPv6 parser to ULP")
Cc: stable@dpdk.org

Signed-off-by: Shahaji Bhosle <shahaji.bhosle@broadcom.com>
Signed-off-by: Manish Kurup <manish.kurup@broadcom.com>
---
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.c | 50 +++++++++++++++++++-----
 1 file changed, 41 insertions(+), 9 deletions(-)

diff --git a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c
index 442a795430..fb1dc3f60a 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c
@@ -1976,6 +1976,35 @@ ulp_rte_item_any_handler(const struct rte_flow_item *item __rte_unused,
 	return BNXT_TF_RC_SUCCESS;
 }
 
+/* Function to handle the update of proto header based on field values */
+static void
+ulp_rte_icmp_proto_type_update(struct ulp_rte_parser_params *params,
+			       enum bnxt_ulp_hdr_bit hdr_bit, uint8_t l3_proto)
+{
+	switch (hdr_bit) {
+	case BNXT_ULP_HDR_BIT_I_ICMP:
+		ULP_BITMAP_SET(params->hdr_bitmap.bits, hdr_bit);
+		ULP_COMP_FLD_IDX_WR(params,
+				    BNXT_ULP_CF_IDX_I_L3_FB_PROTO_ID,
+				    1);
+		ULP_COMP_FLD_IDX_WR(params,
+				    BNXT_ULP_CF_IDX_I_L3_PROTO_ID,
+				    l3_proto);
+		break;
+	case BNXT_ULP_HDR_BIT_O_ICMP:
+		ULP_BITMAP_SET(params->hdr_bitmap.bits, hdr_bit);
+		ULP_COMP_FLD_IDX_WR(params,
+				    BNXT_ULP_CF_IDX_O_L3_FB_PROTO_ID,
+				    1);
+		ULP_COMP_FLD_IDX_WR(params,
+				    BNXT_ULP_CF_IDX_O_L3_PROTO_ID,
+				    l3_proto);
+		break;
+	default:
+		break;
+	}
+}
+
 /* Function to handle the parsing of RTE Flow item ICMP Header. */
 int32_t
 ulp_rte_icmp_hdr_handler(const struct rte_flow_item *item,
@@ -1983,7 +2012,7 @@ ulp_rte_icmp_hdr_handler(const struct rte_flow_item *item,
 {
 	const struct rte_flow_item_icmp *icmp_spec = item->spec;
 	const struct rte_flow_item_icmp *icmp_mask = item->mask;
-	struct ulp_rte_hdr_bitmap *hdr_bitmap = &params->hdr_bitmap;
+	enum bnxt_ulp_hdr_bit out_l4 = BNXT_ULP_HDR_BIT_O_ICMP;
 	uint32_t idx = 0;
 	uint32_t size;
 
@@ -2026,11 +2055,12 @@ ulp_rte_icmp_hdr_handler(const struct rte_flow_item *item,
 			      ulp_deference_struct(icmp_mask, hdr.icmp_seq_nb),
 			      ULP_PRSR_ACT_DEFAULT);
 
-	/* Update the hdr_bitmap with ICMP */
 	if (ULP_BITMAP_ISSET(params->cf_bitmap, BNXT_ULP_CF_BIT_IS_TUNNEL))
-		ULP_BITMAP_SET(hdr_bitmap->bits, BNXT_ULP_HDR_BIT_I_ICMP);
-	else
-		ULP_BITMAP_SET(hdr_bitmap->bits, BNXT_ULP_HDR_BIT_O_ICMP);
+		out_l4 = BNXT_ULP_HDR_BIT_I_ICMP;
+
+	/* Update the hdr_bitmap with ICMP */
+	ulp_rte_icmp_proto_type_update(params, out_l4, IPPROTO_ICMP);
+
 	return BNXT_TF_RC_SUCCESS;
 }
 
@@ -2042,6 +2072,7 @@ ulp_rte_icmp6_hdr_handler(const struct rte_flow_item *item,
 	const struct rte_flow_item_icmp6 *icmp_spec = item->spec;
 	const struct rte_flow_item_icmp6 *icmp_mask = item->mask;
 	struct ulp_rte_hdr_bitmap *hdr_bitmap = &params->hdr_bitmap;
+	enum bnxt_ulp_hdr_bit out_l4 = BNXT_ULP_HDR_BIT_O_ICMP;
 	uint32_t idx = 0;
 	uint32_t size;
 
@@ -2077,11 +2108,12 @@ ulp_rte_icmp6_hdr_handler(const struct rte_flow_item *item,
 		return BNXT_TF_RC_ERROR;
 	}
 
-	/* Update the hdr_bitmap with ICMP */
 	if (ULP_BITMAP_ISSET(params->cf_bitmap, BNXT_ULP_CF_BIT_IS_TUNNEL))
-		ULP_BITMAP_SET(hdr_bitmap->bits, BNXT_ULP_HDR_BIT_I_ICMP);
-	else
-		ULP_BITMAP_SET(hdr_bitmap->bits, BNXT_ULP_HDR_BIT_O_ICMP);
+		out_l4 = BNXT_ULP_HDR_BIT_I_ICMP;
+
+	/* Update the hdr_bitmap with ICMP */
+	ulp_rte_icmp_proto_type_update(params, out_l4, IPPROTO_ICMPV6);
+
 	return BNXT_TF_RC_SUCCESS;
 }
 
-- 
2.31.1


                 reply	other threads:[~2026-10-05 15:18 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20261005151736.1706210-1-manish.kurup@broadcom.com \
    --to=manish.kurup@broadcom.com \
    --cc=dev@dpdk.org \
    --cc=kishore.padmanabha@broadcom.com \
    --cc=shahaji.bhosle@broadcom.com \
    --cc=stable@dpdk.org \
    /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