• Tal Gilboa's avatar
    net/mlx5e: Fix wrong indications in DIM due to counter wraparound · f0e6f231
    Tal Gilboa authored
    
    [ Upstream commit 53acd76c ]
    
    DIM (Dynamically-tuned Interrupt Moderation) is a mechanism designed for
    changing the channel interrupt moderation values in order to reduce CPU
    overhead for all traffic types.
    Each iteration of the algorithm, DIM calculates the difference in
    throughput, packet rate and interrupt rate from last iteration in order
    to make a decision. DIM relies on counters for each metric. When these
    counters get to their type's max value they wraparound. In this case
    the delta between 'end' and 'start' samples is negative and when
    translated to unsigned integers - very high. This results in a false
    indication to the algorithm and might result in a wrong decision.
    
    The fix calculates the 'distance' between 'end' and 'start' samples in a
    cyclic way around the relevant type's max value. It can also be viewed as
    an absolute value around the type's max value instead of around 0.
    
    Testing show higher stability in DIM profile selection and no wraparound
    issues.
    
    Fixes: cb3c7fd4 ("net/mlx5e: Support adaptive RX coalescing")
    Signed-off-by: default avatarTal Gilboa <talgi@mellanox.com>
    Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    f0e6f231
en_rx_am.c 9 KB