For devices with 4 or more ports, the size of the ACL rules supported is
narrower, so MAC addresess are not handled there (see [1]). Reject such
rules in the ACL block rather than silently accepting them with missing
filter fields. Those rules can then be passed to other engines which may
be able to accept and correctly implement them.

[1] 
https://github.com/DPDK/dpdk/blob/main/drivers/net/intel/ice/ice_acl_filter.c#L170

Fixes: 40d466fa9f76 ("net/ice: support ACL filter in DCF")
Cc: [email protected]

Signed-off-by: Bruce Richardson <[email protected]>
---
 drivers/net/intel/ice/ice_acl_filter.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/net/intel/ice/ice_acl_filter.c 
b/drivers/net/intel/ice/ice_acl_filter.c
index 0f913126de..931c5469d2 100644
--- a/drivers/net/intel/ice/ice_acl_filter.c
+++ b/drivers/net/intel/ice/ice_acl_filter.c
@@ -998,6 +998,15 @@ ice_acl_parse(struct ice_adapter *ad,
                goto error;
        }
 
+       /* MAC fields are only in the ACL profile with fewer than 4 PFs */
+       if (ad->hw.dev_caps.num_funcs >= 4 &&
+                       (input_set & (ICE_INSET_SMAC | ICE_INSET_DMAC)) != 0) {
+               ret = rte_flow_error_set(error, EINVAL,
+                               RTE_FLOW_ERROR_TYPE_ITEM_SPEC, pattern,
+                               "MAC address match not supported by ACL on this 
device");
+               goto error;
+       }
+
        ret = ice_acl_parse_action(&parsed_actions, filter, error);
        if (ret)
                goto error;
-- 
2.55.0

Reply via email to