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

Mask for IPv4/UDP/TCP/SCTP addr/port are not supported in current
code. Thus we need to check the pattern with non-zero spec value.
If the spec is non-zero value but its mask is not full-mask, this
Flow Director rule is not supported and will return failed.

Fixes: 54be6102ef97 ("net/ice: fix pattern check for FDIR parser")
Cc: stable@dpdk.org

Signed-off-by: Junfeng Guo <junfeng.guo@intel.com>
---
 drivers/net/ice/ice_fdir_filter.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/net/ice/ice_fdir_filter.c b/drivers/net/ice/ice_fdir_filter.c
index 287032a6a7..a6311b78fe 100644
--- a/drivers/net/ice/ice_fdir_filter.c
+++ b/drivers/net/ice/ice_fdir_filter.c
@@ -2038,10 +2038,10 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad,
 			}
 
 			/* Mask for IPv4 src/dst addrs not supported */
-			if (!ipv4_mask->hdr.src_addr &&
+			if (ipv4_spec->hdr.src_addr &&
 				ipv4_mask->hdr.src_addr != UINT32_MAX)
 				return -rte_errno;
-			if (!ipv4_mask->hdr.dst_addr &&
+			if (ipv4_spec->hdr.dst_addr &&
 				ipv4_mask->hdr.dst_addr != UINT32_MAX)
 				return -rte_errno;
 
@@ -2187,10 +2187,10 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad,
 			}
 
 			/* Mask for TCP src/dst ports not supported */
-			if (!tcp_mask->hdr.src_port &&
+			if (tcp_spec->hdr.src_port &&
 				tcp_mask->hdr.src_port != UINT16_MAX)
 				return -rte_errno;
-			if (!tcp_mask->hdr.dst_port &&
+			if (tcp_spec->hdr.dst_port &&
 				tcp_mask->hdr.dst_port != UINT16_MAX)
 				return -rte_errno;
 
@@ -2234,16 +2234,16 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad,
 			}
 
 			/* Mask for UDP src/dst ports not supported */
-			if (!udp_mask->hdr.src_port &&
+			if (udp_mask->hdr.src_port &&
 				udp_mask->hdr.src_port != UINT16_MAX)
 				return -rte_errno;
-			if (!udp_mask->hdr.dst_port &&
+			if (udp_mask->hdr.dst_port &&
 				udp_mask->hdr.dst_port != UINT16_MAX)
 				return -rte_errno;
 
-			if (udp_mask->hdr.src_port == UINT16_MAX)
+			if (udp_spec->hdr.src_port == UINT16_MAX)
 				*input_set |= ICE_INSET_UDP_SRC_PORT;
-			if (udp_mask->hdr.dst_port == UINT16_MAX)
+			if (udp_spec->hdr.dst_port == UINT16_MAX)
 				*input_set |= ICE_INSET_UDP_DST_PORT;
 
 			/* Get filter info */
@@ -2279,10 +2279,10 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad,
 			}
 
 			/* Mask for SCTP src/dst ports not supported */
-			if (!sctp_mask->hdr.src_port &&
+			if (sctp_spec->hdr.src_port &&
 				sctp_mask->hdr.src_port != UINT16_MAX)
 				return -rte_errno;
-			if (!sctp_mask->hdr.dst_port &&
+			if (sctp_spec->hdr.dst_port &&
 				sctp_mask->hdr.dst_port != UINT16_MAX)
 				return -rte_errno;
 
-- 
2.25.1


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

end of thread, other threads:[~2022-02-11  1:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-08  4:29 [PATCH] net/ice: fix pattern check logic in FDIR Junfeng Guo
2022-02-08  4:34 ` [PATCH v2] " Junfeng Guo
2022-02-08  7:09   ` [PATCH v3] " Junfeng Guo
2022-02-11  1:08     ` 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).