patches for DPDK stable branches
 help / color / mirror / Atom feed
* [PATCH] net/ice: fix pattern check for FDIR parser
@ 2021-12-22  8:02 Junfeng Guo
  2021-12-22  8:08 ` [PATCH v2] " Junfeng Guo
  0 siblings, 1 reply; 4+ messages in thread
From: Junfeng Guo @ 2021-12-22  8:02 UTC (permalink / raw)
  To: qi.z.zhang, jingjing.wu, beilei.xing
  Cc: dev, stable, ferruh.yigit, junfeng.guo

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..24278c1217 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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-12-22 10:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-22  8:02 [PATCH] net/ice: fix pattern check for FDIR parser Junfeng Guo
2021-12-22  8:08 ` [PATCH v2] " Junfeng Guo
2021-12-22  8:11   ` [PATCH v3] " Junfeng Guo
2021-12-22 10:44     ` Zhang, Qi Z

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).