FDIR rules with masks are not supported in current code. Thus add
pattern check for IPv4/UDP/TCP/SCTP addr/port to terminate the FDIR
programming stage.

Fixes: d5eb3e600d9e ("net/iavf: support flow director basic rule")
Cc: sta...@dpdk.org

Signed-off-by: Steve Yang <stevex.y...@intel.com>
---
 drivers/net/iavf/iavf_fdir.c | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/drivers/net/iavf/iavf_fdir.c b/drivers/net/iavf/iavf_fdir.c
index 2e6b3a9097..a397047fdb 100644
--- a/drivers/net/iavf/iavf_fdir.c
+++ b/drivers/net/iavf/iavf_fdir.c
@@ -932,6 +932,14 @@ iavf_fdir_parse_pattern(__rte_unused struct iavf_adapter 
*ad,
                                return -rte_errno;
                        }
 
+                       /* Mask for IPv4 src/dst addrs not supported */
+                       if (ipv4_mask->hdr.src_addr &&
+                               ipv4_mask->hdr.src_addr != UINT32_MAX)
+                               return -rte_errno;
+                       if (ipv4_mask->hdr.dst_addr &&
+                               ipv4_mask->hdr.dst_addr != UINT32_MAX)
+                               return -rte_errno;
+
                        if (ipv4_mask->hdr.type_of_service ==
                            UINT8_MAX) {
                                input_set |= IAVF_INSET_IPV4_TOS;
@@ -1122,6 +1130,14 @@ iavf_fdir_parse_pattern(__rte_unused struct iavf_adapter 
*ad,
                                        return -rte_errno;
                                }
 
+                               /* Mask for UDP src/dst ports not supported */
+                               if (udp_mask->hdr.src_port &&
+                                       udp_mask->hdr.src_port != UINT16_MAX)
+                                       return -rte_errno;
+                               if (udp_mask->hdr.dst_port &&
+                                       udp_mask->hdr.dst_port != UINT16_MAX)
+                                       return -rte_errno;
+
                                if (udp_mask->hdr.src_port == UINT16_MAX) {
                                        input_set |= IAVF_INSET_UDP_SRC_PORT;
                                        VIRTCHNL_ADD_PROTO_HDR_FIELD_BIT(hdr, 
UDP, SRC_PORT);
@@ -1171,6 +1187,14 @@ iavf_fdir_parse_pattern(__rte_unused struct iavf_adapter 
*ad,
                                        return -rte_errno;
                                }
 
+                               /* Mask for TCP src/dst ports not supported */
+                               if (tcp_mask->hdr.src_port &&
+                                       tcp_mask->hdr.src_port != UINT16_MAX)
+                                       return -rte_errno;
+                               if (tcp_mask->hdr.dst_port &&
+                                       tcp_mask->hdr.dst_port != UINT16_MAX)
+                                       return -rte_errno;
+
                                if (tcp_mask->hdr.src_port == UINT16_MAX) {
                                        input_set |= IAVF_INSET_TCP_SRC_PORT;
                                        VIRTCHNL_ADD_PROTO_HDR_FIELD_BIT(hdr, 
TCP, SRC_PORT);
@@ -1214,6 +1238,14 @@ iavf_fdir_parse_pattern(__rte_unused struct iavf_adapter 
*ad,
                                        return -rte_errno;
                                }
 
+                               /* Mask for SCTP src/dst ports not supported */
+                               if (sctp_mask->hdr.src_port &&
+                                       sctp_mask->hdr.src_port != UINT16_MAX)
+                                       return -rte_errno;
+                               if (sctp_mask->hdr.dst_port &&
+                                       sctp_mask->hdr.dst_port != UINT16_MAX)
+                                       return -rte_errno;
+
                                if (sctp_mask->hdr.src_port == UINT16_MAX) {
                                        input_set |= IAVF_INSET_SCTP_SRC_PORT;
                                        VIRTCHNL_ADD_PROTO_HDR_FIELD_BIT(hdr, 
SCTP, SRC_PORT);
-- 
2.25.1

Reply via email to