From: Junfeng Guo <junfeng.guo@intel.com>
To: qi.z.zhang@intel.com, jingjing.wu@intel.com, beilei.xing@intel.com
Cc: dev@dpdk.org, stable@dpdk.org, ferruh.yigit@intel.com,
junfeng.guo@intel.com
Subject: [PATCH v2] net/ice: fix pattern check for FDIR parser
Date: Wed, 22 Dec 2021 16:08:52 +0800 [thread overview]
Message-ID: <20211222080852.1604018-1-junfeng.guo@intel.com> (raw)
In-Reply-To: <20211222080224.1580328-1-junfeng.guo@intel.com>
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: 1b71ed2cdd5d ("net/ice: refactor flow pattern parser")
Cc: stable@dpdk.org
Signed-off-by: Junfeng Guo <junfeng.guo@intel.com>
---
drivers/net/ice/ice_fdir_filter.c | 32 +++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/drivers/net/ice/ice_fdir_filter.c b/drivers/net/ice/ice_fdir_filter.c
index 13a2ac42df..989b5586b1 100644
--- a/drivers/net/ice/ice_fdir_filter.c
+++ b/drivers/net/ice/ice_fdir_filter.c
@@ -2037,6 +2037,14 @@ ice_fdir_parse_pattern(__rte_unused struct ice_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.dst_addr == UINT32_MAX)
*input_set |= ICE_INSET_IPV4_DST;
if (ipv4_mask->hdr.src_addr == UINT32_MAX)
@@ -2178,6 +2186,14 @@ ice_fdir_parse_pattern(__rte_unused struct ice_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 |= ICE_INSET_TCP_SRC_PORT;
if (tcp_mask->hdr.dst_port == UINT16_MAX)
@@ -2217,6 +2233,14 @@ ice_fdir_parse_pattern(__rte_unused struct ice_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 |= ICE_INSET_UDP_SRC_PORT;
if (udp_mask->hdr.dst_port == UINT16_MAX)
@@ -2254,6 +2278,14 @@ ice_fdir_parse_pattern(__rte_unused struct ice_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 |= ICE_INSET_SCTP_SRC_PORT;
if (sctp_mask->hdr.dst_port == UINT16_MAX)
--
2.25.1
next prev parent reply other threads:[~2021-12-22 8:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-22 8:02 [PATCH] " Junfeng Guo
2021-12-22 8:08 ` Junfeng Guo [this message]
2021-12-22 8:11 ` [PATCH v3] " Junfeng Guo
2021-12-22 10:44 ` 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=20211222080852.1604018-1-junfeng.guo@intel.com \
--to=junfeng.guo@intel.com \
--cc=beilei.xing@intel.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@intel.com \
--cc=jingjing.wu@intel.com \
--cc=qi.z.zhang@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).