[v3] net/ice: fix pattern check logic in FDIR

Message ID 20220208070925.2825528-1-junfeng.guo@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Qi Zhang
Headers
Series [v3] net/ice: fix pattern check logic in FDIR |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/github-robot: build success github build: passed
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS

Commit Message

Junfeng Guo Feb. 8, 2022, 7:09 a.m. UTC
  Mask for IPv4/UDP/TCP/SCTP addr/port are not supported in current
code. Thus we need to check each pattern mask. Only zero-mask and
full-mask are allowed to pass the pattern parse, otherwise will
return failure.

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 | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
  

Comments

Qi Zhang Feb. 11, 2022, 1:08 a.m. UTC | #1
> -----Original Message-----
> From: Guo, Junfeng <junfeng.guo@intel.com>
> Sent: Tuesday, February 8, 2022 3:09 PM
> To: Zhang, Qi Z <qi.z.zhang@intel.com>; Wu, Jingjing
> <jingjing.wu@intel.com>; Xing, Beilei <beilei.xing@intel.com>
> Cc: dev@dpdk.org; stable@dpdk.org; Guo, Junfeng <junfeng.guo@intel.com>
> Subject: [PATCH v3] net/ice: fix pattern check logic in FDIR
> 
> Mask for IPv4/UDP/TCP/SCTP addr/port are not supported in current code.
> Thus we need to check each pattern mask. Only zero-mask and full-mask are
> allowed to pass the pattern parse, otherwise will return failure.
> 
> Fixes: 54be6102ef97 ("net/ice: fix pattern check for FDIR parser")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Junfeng Guo <junfeng.guo@intel.com>

Acked-by: Qi Zhang <qi.z.zhang@intel.com>

Applied to dpdk-next-net-intel.

Thanks
Qi
  

Patch

diff --git a/drivers/net/ice/ice_fdir_filter.c b/drivers/net/ice/ice_fdir_filter.c
index 287032a6a7..ff1cee1195 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_mask->hdr.src_addr &&
 				ipv4_mask->hdr.src_addr != UINT32_MAX)
 				return -rte_errno;
-			if (!ipv4_mask->hdr.dst_addr &&
+			if (ipv4_mask->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_mask->hdr.src_port &&
 				tcp_mask->hdr.src_port != UINT16_MAX)
 				return -rte_errno;
-			if (!tcp_mask->hdr.dst_port &&
+			if (tcp_mask->hdr.dst_port &&
 				tcp_mask->hdr.dst_port != UINT16_MAX)
 				return -rte_errno;
 
@@ -2234,10 +2234,10 @@  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;
 
@@ -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_mask->hdr.src_port &&
 				sctp_mask->hdr.src_port != UINT16_MAX)
 				return -rte_errno;
-			if (!sctp_mask->hdr.dst_port &&
+			if (sctp_mask->hdr.dst_port &&
 				sctp_mask->hdr.dst_port != UINT16_MAX)
 				return -rte_errno;