Currently, the ACL table depth is halved on devices with more than 4
PFs, but the driver still assumes 256 entries are available. The base
code reserves only 50% of the scenario for the NORMAL priority band,
so on an 8-port device adding the 129th rule fails and the flow silently
falls back to the switch engine.

Fix it by deriving the entry limit from the configured depth so the
driver rejects rules beyond the NORMAL band with an explicit error.

Fixes: 17a8fc206178 ("net/ice: fix initialization with 8 ports")
Cc: [email protected]

Signed-off-by: Ciara Loftus <[email protected]>
---
 drivers/net/intel/ice/ice_acl_filter.c | 9 ++++++---
 drivers/net/intel/ice/ice_ethdev.h     | 1 +
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/net/intel/ice/ice_acl_filter.c 
b/drivers/net/intel/ice/ice_acl_filter.c
index 94c9ea89fdc..0f913126ded 100644
--- a/drivers/net/intel/ice/ice_acl_filter.c
+++ b/drivers/net/intel/ice/ice_acl_filter.c
@@ -134,6 +134,9 @@ ice_acl_setup(struct ice_pf *pf)
        if (err)
                return err;
 
+       /* Only the NORMAL priority band (50% of the scenario) is used. */
+       pf->acl.max_entries = params.depth / 2;
+
        return 0;
 }
 
@@ -449,7 +452,7 @@ ice_acl_hw_set_conf(struct ice_pf *pf, struct ice_fdir_fltr 
*input,
        /* For IPV4_OTHER type, should add entry for all types.
         * For IPV4_UDP/TCP/SCTP type, only add entry for each.
         */
-       if (slot_id < MAX_ACL_NORMAL_ENTRIES) {
+       if (slot_id < pf->acl.max_entries) {
                entry_id = ((uint64_t)flow_type << 32) | slot_id;
                ret = ice_flow_add_entry(hw, blk, flow_type,
                                         entry_id, pf->main_vsi->idx,
@@ -463,8 +466,8 @@ ice_acl_hw_set_conf(struct ice_pf *pf, struct ice_fdir_fltr 
*input,
                rule->entry_id[entry_idx] = entry_id;
                pf->acl.hw_entry_id[slot_id] = hw_entry;
        } else {
-               PMD_DRV_LOG(ERR, "Exceed the maximum entry number(%d)"
-                           " HW supported!", MAX_ACL_NORMAL_ENTRIES);
+               PMD_DRV_LOG(ERR, "Exceed the maximum entry number(%u)"
+                           " HW supported!", pf->acl.max_entries);
                rte_bitmap_set(pf->acl.slots, slot_id);
                return -1;
        }
diff --git a/drivers/net/intel/ice/ice_ethdev.h 
b/drivers/net/intel/ice/ice_ethdev.h
index 945e765c2c2..7a3d164143b 100644
--- a/drivers/net/intel/ice/ice_ethdev.h
+++ b/drivers/net/intel/ice/ice_ethdev.h
@@ -498,6 +498,7 @@ struct ice_acl_conf {
  */
 struct ice_acl_info {
        struct rte_bitmap *slots;
+       uint16_t max_entries;
        uint64_t hw_entry_id[MAX_ACL_NORMAL_ENTRIES];
 };
 
-- 
2.43.0

Reply via email to