• Amit Cohen's avatar
    mlxsw: Edit IPv6 key blocks to use one less block for multicast forwarding · 92953e7a
    Amit Cohen authored
    Two ACL regions that are configured by the driver during initialization are
    the ones used for IPv4 and IPv6 multicast forwarding. Entries residing
    in these two regions match on the {SIP, DIP, VRID} key elements.
    
    Currently for IPv6 region, 9 key blocks are used:
    * 4 for SIP - 'ipv4_1', 'ipv6_{3,4,5}'
    * 4 for DIP - 'ipv4_0', 'ipv6_{0,1,2/2b}'
    * 1 for VRID - 'ipv4_4b'
    
    This can be improved by reducing the amount key blocks needed for
    the IPv6 region to 8. It is possible to use key blocks that mix subsets of
    the VRID element with subsets of the DIP element.
    The following key blocks can be used:
    * 4 for SIP - 'ipv4_1', 'ipv6_{3,4,5}'
    * 1 for subset of DIP - 'ipv4_0'
    * 3 for the rest of DIP and subsets of VRID - 'ipv6_{0,1,2/2b}'
    
    To make this happen, add VRID sub-elements as part of existing keys -
    'ipv6_{0,1,2/2b}'. Note that one of the sub-elements is called
    VRID_ROUTER_MSB and does not contain bit numbers like the rest, as for
    Spectrum < 4 this element represents bits 8-10 and for Spectrum-4 it
    represents bits 8-11.
    
    Breaking VRID into 3 sub-elements makes the driver use one less block in
    IPv6 region for multicast forwarding. The sub-elements can be filled in
    blocks that are used for destination IP.
    
    The algorithm in the driver that chooses which key blocks will be used is
    lazy and not the optimal one. It searches the block that contains the most
    elements that are required, chooses it, removes the elements that appear
    in the chosen block and starts again searching the block that contains the
    most elements.
    
    When key block 'ipv4_4' is defined, the algorithm might choose it, as it
    contains 2 sub-elements of VRID, then 8 blocks must be chosen for SIP and
    DIP and we get 9 blocks to match on {SIP, DIP, VRID}. That is why we had to
    remove key block 'ipv4_4' in a previous patch and use key block that
    contains one field for VRID.
    
    This improvement was tested and indeed 8 blocks are used instead of 9.
    Signed-off-by: default avatarAmit Cohen <amcohen@nvidia.com>
    Reviewed-by: default avatarIdo Schimmel <idosch@nvidia.com>
    Signed-off-by: default avatarPetr Machata <petrm@nvidia.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    92953e7a
spectrum_acl_flex_keys.c 14.1 KB