• Ido Schimmel's avatar
    mlxsw: spectrum_acl: Fix ACL scale regression and firmware errors · 75d8d7a6
    Ido Schimmel authored
    ACLs that reside in the algorithmic TCAM (A-TCAM) in Spectrum-2 and
    newer ASICs can share the same mask if their masks only differ in up to
    8 consecutive bits. For example, consider the following filters:
    
     # tc filter add dev swp1 ingress pref 1 proto ip flower dst_ip 192.0.2.0/24 action drop
     # tc filter add dev swp1 ingress pref 1 proto ip flower dst_ip 198.51.100.128/25 action drop
    
    The second filter can use the same mask as the first (dst_ip/24) with a
    delta of 1 bit.
    
    However, the above only works because the two filters have different
    values in the common unmasked part (dst_ip/24). When entries have the
    same value in the common unmasked part they create undesired collisions
    in the device since many entries now have the same key. This leads to
    firmware errors such as [1] and to a reduced scale.
    
    Fix by adjusting the hash table key to only include the value in the
    common unmasked part. That is, without including the delta bits. That
    way the driver will detect the collision during filter insertion and
    spill the filter into the circuit TCAM (C-TCAM).
    
    Add a test case that fails without the fix and adjust existing cases
    that check C-TCAM spillage according to the above limitation.
    
    [1]
    mlxsw_spectrum2 0000:06:00.0: EMAD reg access failed (tid=3379b18a00003394,reg_id=3027(ptce3),type=write,status=8(resource not available))
    
    Fixes: c22291f7 ("mlxsw: spectrum: acl: Implement delta for ERP")
    Reported-by: default avatarAlexander Zubkov <green@qrator.net>
    Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
    Reviewed-by: default avatarAmit Cohen <amcohen@nvidia.com>
    Tested-by: default avatarAlexander Zubkov <green@qrator.net>
    Signed-off-by: default avatarPetr Machata <petrm@nvidia.com>
    Reviewed-by: default avatarSimon Horman <horms@kernel.org>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    75d8d7a6
spectrum_acl_tcam.h 11 KB