* [PATCH] net/ethernet/freescale: rework quiesce/activate for ucc_geth
@ 2020-05-20 15:53 Valentin Longchamp
2020-05-22 22:50 ` David Miller
0 siblings, 1 reply; 3+ messages in thread
From: Valentin Longchamp @ 2020-05-20 15:53 UTC (permalink / raw)
To: linuxppc-dev, netdev, kuba, davem, hkallweit1
Cc: Valentin Longchamp, Matteo Ghidoni
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 <valentin@longchamp.me>
Acked-by: Matteo Ghidoni <matteo.ghidoni@ch.abb.com>
---
drivers/net/ethernet/freescale/ucc_geth.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/freescale/ucc_geth.c b/drivers/net/ethernet/freescale/ucc_geth.c
index 6e5f6dd169b5..552e7554a9f8 100644
--- a/drivers/net/ethernet/freescale/ucc_geth.c
+++ b/drivers/net/ethernet/freescale/ucc_geth.c
@@ -42,6 +42,7 @@
#include <soc/fsl/qe/ucc.h>
#include <soc/fsl/qe/ucc_fast.h>
#include <asm/machdep.h>
+#include <net/sch_generic.h>
#include "ucc_geth.h"
@@ -1548,11 +1549,8 @@ static int ugeth_disable(struct ucc_geth_private *ugeth, enum comm_dir mode)
static void ugeth_quiesce(struct ucc_geth_private *ugeth)
{
- /* Prevent any further xmits, plus detach the device. */
- netif_device_detach(ugeth->ndev);
-
- /* Wait for any current xmits to finish. */
- netif_tx_disable(ugeth->ndev);
+ /* Prevent any further xmits */
+ netif_tx_stop_all_queues(ugeth->ndev);
/* Disable the interrupt to avoid NAPI rescheduling. */
disable_irq(ugeth->ug_info->uf_info.irq);
@@ -1565,7 +1563,10 @@ static void ugeth_activate(struct ucc_geth_private *ugeth)
{
napi_enable(&ugeth->napi);
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
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] net/ethernet/freescale: rework quiesce/activate for ucc_geth
2020-05-20 15:53 [PATCH] net/ethernet/freescale: rework quiesce/activate for ucc_geth Valentin Longchamp
@ 2020-05-22 22:50 ` David Miller
2020-05-26 5:16 ` Valentin Longchamp
0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2020-05-22 22:50 UTC (permalink / raw)
To: valentin; +Cc: linuxppc-dev, netdev, kuba, hkallweit1, matteo.ghidoni
From: Valentin Longchamp <valentin@longchamp.me>
Date: Wed, 20 May 2020 17:53:50 +0200
> 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 <valentin@longchamp.me>
> Acked-by: Matteo Ghidoni <matteo.ghidoni@ch.abb.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] net/ethernet/freescale: rework quiesce/activate for ucc_geth
2020-05-22 22:50 ` David Miller
@ 2020-05-26 5:16 ` Valentin Longchamp
0 siblings, 0 replies; 3+ messages in thread
From: Valentin Longchamp @ 2020-05-26 5:16 UTC (permalink / raw)
To: David Miller; +Cc: linuxppc-dev, netdev, kuba, hkallweit1, matteo.ghidoni
Le 23.05.2020 à 00:50, David Miller a écrit :
> From: Valentin Longchamp <valentin@longchamp.me>
> Date: Wed, 20 May 2020 17:53:50 +0200
>
>> 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 <valentin@longchamp.me>
>> Acked-by: Matteo Ghidoni <matteo.ghidoni@ch.abb.com>
>
> Applied, thanks.
>
Thanks David.
May I suggest that this get backported to stable until (including) the
4.19 stable release ?
As the above mentioned commit, merged for 4.19,
124eee3f6955 net: linkwatch: add check for netdevice being present to
linkwatch_do_dev
does indeed break the ucc_geth driver, this patch can be considered as a
bugfix that should be taken into account for stable.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-05-26 5:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-20 15:53 [PATCH] net/ethernet/freescale: rework quiesce/activate for ucc_geth Valentin Longchamp
2020-05-22 22:50 ` David Miller
2020-05-26 5:16 ` Valentin Longchamp
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).