mlxsw: core_acl_flex_keys: Save chosen elements in all blocks per search
authorAmit Cohen <amcohen@nvidia.com>
Tue, 3 Oct 2023 11:25:29 +0000 (13:25 +0200)
committerDavid S. Miller <davem@davemloft.net>
Fri, 6 Oct 2023 10:08:07 +0000 (11:08 +0100)
commit900f4285bbc2661e330036ee0fae046c7b79036b
treed865d765b22ab81136c9c3860d5154ddeced29b2
parent545535fd30dc8eaac96c09d774e8ba57bb247267
mlxsw: core_acl_flex_keys: Save chosen elements in all blocks per search

Currently, mlxsw_afk_picker() chooses which blocks will be used for a
given list of elements, and fills the blocks during the searching - when a
key block is found with most hits, it adds it and removes the elements from
the count of hits. This should be changed as we want to be able to choose
which blocks will be placed in blocks 0 to 5.

To separate between choosing blocks and filling blocks, several pre-changes
are required. Currently, the indication of whether all elements were
found in the chosen blocks is by the structure 'key_info->elusage'. This
structure is updated when block is filled as part of
mlxsw_afk_picker_key_info_add(). A following patch will call this
function only after choosing all the blocks. Add a bitmap called
'elusage_chosen' to store which elements were chosen in the chosen blocks.
Change the condition in the loop to check elements that were chosen, not
elements that were already filled in the blocks.

Signed-off-by: Amit Cohen <amcohen@nvidia.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_keys.c