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: sta...@dpdk.org

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

diff --git a/drivers/net/ice/ice_fdir_filter.c 
b/drivers/net/ice/ice_fdir_filter.c
index 287032a6a7..9e4a0f158f 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,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_spec->hdr.src_port &&
                                udp_mask->hdr.src_port != UINT16_MAX)
                                return -rte_errno;
-                       if (!udp_mask->hdr.dst_port &&
+                       if (udp_spec->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_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

Reply via email to