[PATCH] net/ice: fix pattern check logic in FDIR
Junfeng Guo
junfeng.guo at intel.com
Tue Feb 8 05:29:22 CET 2022
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 at dpdk.org
Signed-off-by: Junfeng Guo <junfeng.guo at 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
More information about the stable
mailing list