]> git.baikalelectronics.ru Git - kernel.git/commit
net: mvneta: Fix the CPU choice in mvneta_percpu_elect
authorGregory CLEMENT <gregory.clement@free-electrons.com>
Thu, 4 Feb 2016 21:09:24 +0000 (22:09 +0100)
committerDavid S. Miller <davem@davemloft.net>
Sat, 13 Feb 2016 11:02:18 +0000 (06:02 -0500)
commit4e84c9e82f5d50c111e8e5c9efc9801ef1a9f51a
treea1355e0c243c7b4ebbb52c7a0ce3d1c93f7a1edc
parent046e71fa0490ccba36fe5fbb05fff47020e8995d
net: mvneta: Fix the CPU choice in mvneta_percpu_elect

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: b7cfdd0e9916 ("net: mvneta: Associate RX queues with each CPU")
Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/marvell/mvneta.c