net/ice: fix pattern check logic in FDIR
PATCH 1/1 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 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.
--- drivers/net/ice/ice_fdir_filter.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
drivers/net/ice/ice_fdir_filter.c +10 -10
@@ -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;
Signature · 1 line
2.25.1
PATCH v2 1/1 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 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.
--- drivers/net/ice/ice_fdir_filter.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/net/ice/ice_fdir_filter.c +8 -8
@@ -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;
Signature · 1 line
2.25.1
PATCH v3 1/1 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.
--- drivers/net/ice/ice_fdir_filter.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/net/ice/ice_fdir_filter.c +8 -8
@@ -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;
Signature · 1 line
2.25.1
Quoted 10 lines
-----Original Message-----
From: Guo, Junfeng <[email protected]>
Sent: Tuesday, February 8, 2022 3:09 PM
To: Zhang, Qi Z <[email protected]>; Wu, Jingjing <[email protected]>; Xing, Beilei <[email protected]>
Cc: [email protected]; [email protected]; Guo, Junfeng <[email protected]>
Subject: [PATCH v3] net/ice: fix pattern check logic in FDIR
Quoted 8 lines
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")Signed-off-by Junfeng Guo <[email protected]>
Applied to dpdk-next-net-intel.
Thanks
Qi