Skip to content

Commit 79dde73

Browse files
chlongvdavem330
authored andcommitted
net/ethernet/freescale: rework quiesce/activate for ucc_geth
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/201 Signed-off-by: Valentin Longchamp <[email protected]> Acked-by: Matteo Ghidoni <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent d3e8e4c commit 79dde73

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

drivers/net/ethernet/freescale/ucc_geth.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
#include <soc/fsl/qe/ucc.h>
4343
#include <soc/fsl/qe/ucc_fast.h>
4444
#include <asm/machdep.h>
45+
#include <net/sch_generic.h>
4546

4647
#include "ucc_geth.h"
4748

@@ -1548,11 +1549,8 @@ static int ugeth_disable(struct ucc_geth_private *ugeth, enum comm_dir mode)
15481549

15491550
static void ugeth_quiesce(struct ucc_geth_private *ugeth)
15501551
{
1551-
/* Prevent any further xmits, plus detach the device. */
1552-
netif_device_detach(ugeth->ndev);
1553-
1554-
/* Wait for any current xmits to finish. */
1555-
netif_tx_disable(ugeth->ndev);
1552+
/* Prevent any further xmits */
1553+
netif_tx_stop_all_queues(ugeth->ndev);
15561554

15571555
/* Disable the interrupt to avoid NAPI rescheduling. */
15581556
disable_irq(ugeth->ug_info->uf_info.irq);
@@ -1565,7 +1563,10 @@ static void ugeth_activate(struct ucc_geth_private *ugeth)
15651563
{
15661564
napi_enable(&ugeth->napi);
15671565
enable_irq(ugeth->ug_info->uf_info.irq);
1568-
netif_device_attach(ugeth->ndev);
1566+
1567+
/* allow to xmit again */
1568+
netif_tx_wake_all_queues(ugeth->ndev);
1569+
__netdev_watchdog_up(ugeth->ndev);
15691570
}
15701571

15711572
/* Called every time the controller might need to be made

0 commit comments

Comments
 (0)