• Gregory CLEMENT's avatar
    net: mvneta: Fix the CPU choice in mvneta_percpu_elect · cad5d847
    Gregory CLEMENT authored
    When passing to the management of multiple RX queue, the
    mvneta_percpu_elect function was broken. The use of the modulo can lead
    to elect the wrong cpu. For example with rxq_def=2, if the CPU 2 goes
    offline and then online, we ended with the third RX queue activated in
    the same time on CPU 0 and CPU2, which lead to a kernel crash.
    
    With this fix, we don't try to get "the closer" CPU if the default CPU is
    gone, now we just use CPU 0 which always be there. Thanks to this, the
    code becomes more readable, easier to maintain and more predicable.
    
    Cc: stable@vger.kernel.org
    Fixes: 2dcf75e2 ("net: mvneta: Associate RX queues with each CPU")
    Signed-off-by: default avatarGregory CLEMENT <gregory.clement@free-electrons.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    cad5d847
mvneta.c 102 KB