DPDK patches and discussions
 help / color / mirror / Atom feed
From: Steve Yang <stevex.yang@intel.com>
To: dev@dpdk.org
Cc: jingjing.wu@intel.com, beilei.xing@intel.com,
	Steve Yang <stevex.yang@intel.com>,
	stable@dpdk.org
Subject: [PATCH v1] net/iavf: fix pattern check for flow director parser
Date: Wed, 10 Aug 2022 06:47:51 +0000	[thread overview]
Message-ID: <20220810064751.484242-1-stevex.yang@intel.com> (raw)

FDIR rules with masks are not supported in current code. Thus add
pattern check for IPv4/UDP/TCP/SCTP addr/port to terminate the FDIR
programming stage.

Fixes: d5eb3e600d9e ("net/iavf: support flow director basic rule")
Cc: stable@dpdk.org

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 drivers/net/iavf/iavf_fdir.c | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/drivers/net/iavf/iavf_fdir.c b/drivers/net/iavf/iavf_fdir.c
index 2e6b3a9097..a397047fdb 100644
--- a/drivers/net/iavf/iavf_fdir.c
+++ b/drivers/net/iavf/iavf_fdir.c
@@ -932,6 +932,14 @@ iavf_fdir_parse_pattern(__rte_unused struct iavf_adapter *ad,
 				return -rte_errno;
 			}
 
+			/* Mask for IPv4 src/dst addrs not supported */
+			if (ipv4_mask->hdr.src_addr &&
+				ipv4_mask->hdr.src_addr != UINT32_MAX)
+				return -rte_errno;
+			if (ipv4_mask->hdr.dst_addr &&
+				ipv4_mask->hdr.dst_addr != UINT32_MAX)
+				return -rte_errno;
+
 			if (ipv4_mask->hdr.type_of_service ==
 			    UINT8_MAX) {
 				input_set |= IAVF_INSET_IPV4_TOS;
@@ -1122,6 +1130,14 @@ iavf_fdir_parse_pattern(__rte_unused struct iavf_adapter *ad,
 					return -rte_errno;
 				}
 
+				/* Mask for UDP src/dst ports not supported */
+				if (udp_mask->hdr.src_port &&
+					udp_mask->hdr.src_port != UINT16_MAX)
+					return -rte_errno;
+				if (udp_mask->hdr.dst_port &&
+					udp_mask->hdr.dst_port != UINT16_MAX)
+					return -rte_errno;
+
 				if (udp_mask->hdr.src_port == UINT16_MAX) {
 					input_set |= IAVF_INSET_UDP_SRC_PORT;
 					VIRTCHNL_ADD_PROTO_HDR_FIELD_BIT(hdr, UDP, SRC_PORT);
@@ -1171,6 +1187,14 @@ iavf_fdir_parse_pattern(__rte_unused struct iavf_adapter *ad,
 					return -rte_errno;
 				}
 
+				/* Mask for TCP src/dst ports not supported */
+				if (tcp_mask->hdr.src_port &&
+					tcp_mask->hdr.src_port != UINT16_MAX)
+					return -rte_errno;
+				if (tcp_mask->hdr.dst_port &&
+					tcp_mask->hdr.dst_port != UINT16_MAX)
+					return -rte_errno;
+
 				if (tcp_mask->hdr.src_port == UINT16_MAX) {
 					input_set |= IAVF_INSET_TCP_SRC_PORT;
 					VIRTCHNL_ADD_PROTO_HDR_FIELD_BIT(hdr, TCP, SRC_PORT);
@@ -1214,6 +1238,14 @@ iavf_fdir_parse_pattern(__rte_unused struct iavf_adapter *ad,
 					return -rte_errno;
 				}
 
+				/* Mask for SCTP src/dst ports not supported */
+				if (sctp_mask->hdr.src_port &&
+					sctp_mask->hdr.src_port != UINT16_MAX)
+					return -rte_errno;
+				if (sctp_mask->hdr.dst_port &&
+					sctp_mask->hdr.dst_port != UINT16_MAX)
+					return -rte_errno;
+
 				if (sctp_mask->hdr.src_port == UINT16_MAX) {
 					input_set |= IAVF_INSET_SCTP_SRC_PORT;
 					VIRTCHNL_ADD_PROTO_HDR_FIELD_BIT(hdr, SCTP, SRC_PORT);
-- 
2.25.1


             reply	other threads:[~2022-08-10  6:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-10  6:47 Steve Yang [this message]
2022-08-12  4:13 ` Zhang, Qi Z

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=20220810064751.484242-1-stevex.yang@intel.com \
    --to=stevex.yang@intel.com \
    --cc=beilei.xing@intel.com \
    --cc=dev@dpdk.org \
    --cc=jingjing.wu@intel.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;
as well as URLs for NNTP newsgroup(s).