Commit 2394b4e6 authored by Valentin Longchamp's avatar Valentin Longchamp Committed by Khalid Elmously

net/ethernet/freescale: rework quiesce/activate for ucc_geth

BugLink: https://bugs.launchpad.net/bugs/1883918

[ Upstream commit 79dde73c ]

ugeth_quiesce/activate are used to halt the controller when there is a
link change that requires to reconfigure the mac.

The previous implementation called netif_device_detach(). This however
causes the initial activation of the netdevice to fail precisely because
it's detached. For details, see [1].

A possible workaround was the revert of commit
net: linkwatch: add check for netdevice being present to linkwatch_do_dev
However, the check introduced in the above commit is correct and shall be
kept.

The netif_device_detach() is thus replaced with
netif_tx_stop_all_queues() that prevents any tranmission. This allows to
perform mac config change required by the link change, without detaching
the corresponding netdevice and thus not preventing its initial
activation.

[1] https://lists.openwall.net/netdev/2020/01/08/201Signed-off-by: default avatarValentin Longchamp <valentin@longchamp.me>
Acked-by: default avatarMatteo Ghidoni <matteo.ghidoni@ch.abb.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
Signed-off-by: default avatarKhalid Elmously <khalid.elmously@canonical.com>
parent 8dd692a3
...@@ -45,6 +45,7 @@ ...@@ -45,6 +45,7 @@
#include <asm/ucc.h> #include <asm/ucc.h>
#include <asm/ucc_fast.h> #include <asm/ucc_fast.h>
#include <asm/machdep.h> #include <asm/machdep.h>
#include <net/sch_generic.h>
#include "ucc_geth.h" #include "ucc_geth.h"
...@@ -1551,11 +1552,8 @@ static int ugeth_disable(struct ucc_geth_private *ugeth, enum comm_dir mode) ...@@ -1551,11 +1552,8 @@ static int ugeth_disable(struct ucc_geth_private *ugeth, enum comm_dir mode)
static void ugeth_quiesce(struct ucc_geth_private *ugeth) static void ugeth_quiesce(struct ucc_geth_private *ugeth)
{ {
/* Prevent any further xmits, plus detach the device. */ /* Prevent any further xmits */
netif_device_detach(ugeth->ndev); netif_tx_stop_all_queues(ugeth->ndev);
/* Wait for any current xmits to finish. */
netif_tx_disable(ugeth->ndev);
/* Disable the interrupt to avoid NAPI rescheduling. */ /* Disable the interrupt to avoid NAPI rescheduling. */
disable_irq(ugeth->ug_info->uf_info.irq); disable_irq(ugeth->ug_info->uf_info.irq);
...@@ -1568,7 +1566,10 @@ static void ugeth_activate(struct ucc_geth_private *ugeth) ...@@ -1568,7 +1566,10 @@ static void ugeth_activate(struct ucc_geth_private *ugeth)
{ {
napi_enable(&ugeth->napi); napi_enable(&ugeth->napi);
enable_irq(ugeth->ug_info->uf_info.irq); enable_irq(ugeth->ug_info->uf_info.irq);
netif_device_attach(ugeth->ndev);
/* allow to xmit again */
netif_tx_wake_all_queues(ugeth->ndev);
__netdev_watchdog_up(ugeth->ndev);
} }
/* Called every time the controller might need to be made /* Called every time the controller might need to be made
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment