Flow director masks the inner destination MAC address per byte, but the
parser only accepts masks that cover either the whole address or none
of it.

Accept masks where each byte is either fully masked or unmasked.

Fixes: ea0f9067b2cf ("net/ixgbe: reimplement FDIR parser")

Signed-off-by: Anatoly Burakov <[email protected]>
---
 drivers/net/intel/ixgbe/ixgbe_flow_fdir.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/net/intel/ixgbe/ixgbe_flow_fdir.c 
b/drivers/net/intel/ixgbe/ixgbe_flow_fdir.c
index 0a7e96a030d..5e9f8593e51 100644
--- a/drivers/net/intel/ixgbe/ixgbe_flow_fdir.c
+++ b/drivers/net/intel/ixgbe/ixgbe_flow_fdir.c
@@ -845,6 +845,7 @@ ixgbe_validate_fdir_tunnel_inner_eth(const void *ctx 
__rte_unused,
                                     struct rte_flow_error *error)
 {
        const struct rte_flow_item_eth *eth_mask = ci_flow_item_mask(item);
+       uint8_t i;
 
        if (eth_mask->hdr.ether_type != 0) {
                return rte_flow_error_set(error, EINVAL,
@@ -859,11 +860,13 @@ ixgbe_validate_fdir_tunnel_inner_eth(const void *ctx 
__rte_unused,
                                "Masking not supported for src MAC address");
        }
 
-       /* dst addr must be either fully masked or fully unmasked */
-       if (!CI_FIELD_IS_ZERO_OR_MASKED(&eth_mask->hdr.dst_addr)) {
-               return rte_flow_error_set(error, EINVAL,
-                               RTE_FLOW_ERROR_TYPE_ITEM, item,
-                               "Partial masks not supported for dst MAC 
address");
+       /* Each destination MAC byte must be fully masked or fully unmasked. */
+       for (i = 0; i < RTE_ETHER_ADDR_LEN; i++) {
+               if 
(!CI_FIELD_IS_ZERO_OR_MASKED(&eth_mask->hdr.dst_addr.addr_bytes[i])) {
+                       return rte_flow_error_set(error, EINVAL,
+                                       RTE_FLOW_ERROR_TYPE_ITEM, item,
+                                       "Partial dst MAC byte masks not 
supported");
+               }
        }
 
        return 0;
-- 
2.52.0

Reply via email to