DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Anatoly Burakov <anatoly.burakov@intel.com>
To: dev@dpdk.org, Vladimir Medvedkin <vladimir.medvedkin@intel.com>,
	Qi Zhang <qi.z.zhang@intel.com>
Subject: [PATCH v1 04/15] net/ixgbe: fix SCTP protocol-only flow parsing
Date: Thu, 30 Apr 2026 12:14:33 +0100	[thread overview]
Message-ID: <dee7cafad6b4cd6ba408fa296a38dbd071b224f6.1777547413.git.anatoly.burakov@intel.com> (raw)
In-Reply-To: <cover.1777547413.git.anatoly.burakov@intel.com>

Currently, `ixgbe_parse_fdir_filter_normal()` checks the MAC type before
checking whether the `RTE_FLOW_ITEM_TYPE_SCTP` item carries a mask. On
`ixgbe_mac_X550`, `ixgbe_mac_X550EM_x`, `ixgbe_mac_X550EM_a` and
`ixgbe_mac_E610`, this makes `item->mask` mandatory and rejects
protocol-only SCTP patterns.

These devices can still match SCTP by protocol without L4 port masks.
Only SCTP port masking is MAC type dependent, but the current check order
makes the protocol-only path available only on older MAC types.

Fix this by checking whether a mask is present first. Keep the MAC type
check only for SCTP port masks, and accept protocol-only SCTP matching on
X550 and E610 as well.

Fixes: 86e19565f5e2 ("net/ixgbe: fix SCTP port support")
Cc: qi.z.zhang@intel.com
Cc: stable@dpdk.org

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 drivers/net/intel/ixgbe/ixgbe_flow.c | 86 ++++++++++++++--------------
 1 file changed, 42 insertions(+), 44 deletions(-)

diff --git a/drivers/net/intel/ixgbe/ixgbe_flow.c b/drivers/net/intel/ixgbe/ixgbe_flow.c
index c3abba4a90..71da5ac72e 100644
--- a/drivers/net/intel/ixgbe/ixgbe_flow.c
+++ b/drivers/net/intel/ixgbe/ixgbe_flow.c
@@ -2180,57 +2180,55 @@ ixgbe_parse_fdir_filter_normal(struct rte_eth_dev *dev,
 			return -rte_errno;
 		}
 
-		/* only some mac types support sctp port */
-		if (hw->mac.type == ixgbe_mac_X550 ||
-		    hw->mac.type == ixgbe_mac_X550EM_x ||
-		    hw->mac.type == ixgbe_mac_X550EM_a ||
-		    hw->mac.type == ixgbe_mac_E610) {
-			/**
-			 * Only care about src & dst ports,
-			 * others should be masked.
-			 */
-			if (!item->mask) {
-				memset(rule, 0, sizeof(struct ixgbe_fdir_rule));
-				rte_flow_error_set(error, EINVAL,
-					RTE_FLOW_ERROR_TYPE_ITEM,
-					item, "Not supported by fdir filter");
-				return -rte_errno;
-			}
-			rule->b_mask = TRUE;
-			sctp_mask = item->mask;
-			if (sctp_mask->hdr.tag ||
-				sctp_mask->hdr.cksum) {
-				memset(rule, 0, sizeof(struct ixgbe_fdir_rule));
-				rte_flow_error_set(error, EINVAL,
-					RTE_FLOW_ERROR_TYPE_ITEM,
-					item, "Not supported by fdir filter");
-				return -rte_errno;
-			}
-			rule->mask.src_port_mask = sctp_mask->hdr.src_port;
-			rule->mask.dst_port_mask = sctp_mask->hdr.dst_port;
+		sctp_mask = item->mask;
+		if (sctp_mask != NULL) {
+			/* only some mac types support sctp port masking */
+			if (hw->mac.type == ixgbe_mac_X550 ||
+			    hw->mac.type == ixgbe_mac_X550EM_x ||
+			    hw->mac.type == ixgbe_mac_X550EM_a ||
+			    hw->mac.type == ixgbe_mac_E610) {
+				/**
+				 * Only care about src & dst ports,
+				 * others should be masked.
+				 */
+				rule->b_mask = TRUE;
+				if (sctp_mask->hdr.tag ||
+				    sctp_mask->hdr.cksum) {
+					memset(rule, 0, sizeof(struct ixgbe_fdir_rule));
+					rte_flow_error_set(error, EINVAL,
+						RTE_FLOW_ERROR_TYPE_ITEM,
+						item, "Not supported by fdir filter");
+					return -rte_errno;
+				}
+				rule->mask.src_port_mask = sctp_mask->hdr.src_port;
+				rule->mask.dst_port_mask = sctp_mask->hdr.dst_port;
 
-			if (item->spec) {
-				rule->b_spec = TRUE;
-				sctp_spec = item->spec;
-				rule->ixgbe_fdir.formatted.src_port =
-					sctp_spec->hdr.src_port;
-				rule->ixgbe_fdir.formatted.dst_port =
-					sctp_spec->hdr.dst_port;
-			}
-		/* others even sctp port is not supported */
-		} else {
-			sctp_mask = item->mask;
-			if (sctp_mask &&
-				(sctp_mask->hdr.src_port ||
-				 sctp_mask->hdr.dst_port ||
-				 sctp_mask->hdr.tag ||
-				 sctp_mask->hdr.cksum)) {
+				if (item->spec) {
+					rule->b_spec = TRUE;
+					sctp_spec = item->spec;
+					rule->ixgbe_fdir.formatted.src_port =
+						sctp_spec->hdr.src_port;
+					rule->ixgbe_fdir.formatted.dst_port =
+						sctp_spec->hdr.dst_port;
+				}
+			/* others even sctp port masking is not supported */
+			} else if (sctp_mask->hdr.src_port ||
+				   sctp_mask->hdr.dst_port ||
+				   sctp_mask->hdr.tag ||
+				   sctp_mask->hdr.cksum) {
 				memset(rule, 0, sizeof(struct ixgbe_fdir_rule));
 				rte_flow_error_set(error, EINVAL,
 					RTE_FLOW_ERROR_TYPE_ITEM,
 					item, "Not supported by fdir filter");
 				return -rte_errno;
 			}
+		} else if (item->spec != NULL) {
+			/* No port mask means protocol-only match; spec is invalid. */
+			memset(rule, 0, sizeof(struct ixgbe_fdir_rule));
+			rte_flow_error_set(error, EINVAL,
+				RTE_FLOW_ERROR_TYPE_ITEM,
+				item, "Not supported by fdir filter");
+			return -rte_errno;
 		}
 
 		item = next_no_fuzzy_pattern(pattern, item);
-- 
2.47.3


  parent reply	other threads:[~2026-04-30 11:15 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-30 11:14 [PATCH v1 00/15] IXGBE fixes and cleanups Anatoly Burakov
2026-04-30 11:14 ` [PATCH v1 01/15] net/ixgbe: fix flows not being scoped to port Anatoly Burakov
2026-04-30 11:14 ` [PATCH v1 02/15] net/ixgbe: fix shared PF pointer in representor Anatoly Burakov
2026-04-30 11:14 ` [PATCH v1 03/15] net/ixgbe: fix non-shared data in IPsec session Anatoly Burakov
2026-05-07 10:50   ` Radu Nicolau
2026-04-30 11:14 ` Anatoly Burakov [this message]
2026-04-30 11:14 ` [PATCH v1 05/15] net/ixgbe: fix L4 protocol mask handling Anatoly Burakov
2026-04-30 11:14 ` [PATCH v1 06/15] net/ixgbe: reset flow state on clear paths Anatoly Burakov
2026-04-30 11:14 ` [PATCH v1 07/15] net/ixgbe: store max VFs in adapter Anatoly Burakov
2026-04-30 11:14 ` [PATCH v1 08/15] net/ixgbe: do not use flow list to count flows Anatoly Burakov
2026-05-06  9:24   ` Bruce Richardson
2026-04-30 11:14 ` [PATCH v1 09/15] net/ixgbe: remove redundant flow tracking lists Anatoly Burakov
2026-04-30 11:14 ` [PATCH v1 10/15] net/ixgbe: reduce FDIR conf macro usage Anatoly Burakov
2026-04-30 11:14 ` [PATCH v1 11/15] net/ixgbe: use adapter in flow-related calls Anatoly Burakov
2026-04-30 11:14 ` [PATCH v1 12/15] net/ixgbe: support protocol-only TCP and UDP rules Anatoly Burakov
2026-04-30 11:14 ` [PATCH v1 13/15] net/ixgbe: write drop queue at init Anatoly Burakov
2026-04-30 11:14 ` [PATCH v1 14/15] net/ixgbe: rely less on global flow state Anatoly Burakov
2026-04-30 11:14 ` [PATCH v1 15/15] net/ixgbe: refactor flow creation Anatoly Burakov
2026-05-06  9:27 ` [PATCH v1 00/15] IXGBE fixes and cleanups Bruce Richardson
2026-05-06 10:27   ` Bruce Richardson

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=dee7cafad6b4cd6ba408fa296a38dbd071b224f6.1777547413.git.anatoly.burakov@intel.com \
    --to=anatoly.burakov@intel.com \
    --cc=dev@dpdk.org \
    --cc=qi.z.zhang@intel.com \
    --cc=vladimir.medvedkin@intel.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