2017-03-27 11:05:24

by Jisheng Zhang

[permalink] [raw]
Subject: [PATCH] net: mvneta: set rx mode during resume if interface is running

I found a bug by:

0. boot and start dhcp client
1. echo mem > /sys/power/state
2. resume back immediately
3. don't touch dhcp client to renew the lease
4. ping the gateway. No acks

Usually, after step2, the DHCP lease isn't expired, so in theory we
should resume all back. But in fact, it doesn't. It turns out
the rx mode isn't resumed correctly. This patch fixes it by adding
mvneta_set_rx_mode(dev) in the resume hook if interface is running.

Signed-off-by: Jisheng Zhang <[email protected]>
---
drivers/net/ethernet/marvell/mvneta.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
index aebbc5399a06..cc126204dc4d 100644
--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
@@ -4449,8 +4449,11 @@ static int mvneta_resume(struct device *device)
mvneta_fixed_link_update(pp, dev->phydev);

netif_device_attach(dev);
- if (netif_running(dev))
+ if (netif_running(dev)) {
mvneta_open(dev);
+ mvneta_set_rx_mode(dev);
+ }
+
return 0;
}
#endif
--
2.11.0


2017-03-27 23:15:41

by David Miller

[permalink] [raw]
Subject: Re: [PATCH] net: mvneta: set rx mode during resume if interface is running

From: Jisheng Zhang <[email protected]>
Date: Mon, 27 Mar 2017 18:59:05 +0800

> I found a bug by:
>
> 0. boot and start dhcp client
> 1. echo mem > /sys/power/state
> 2. resume back immediately
> 3. don't touch dhcp client to renew the lease
> 4. ping the gateway. No acks
>
> Usually, after step2, the DHCP lease isn't expired, so in theory we
> should resume all back. But in fact, it doesn't. It turns out
> the rx mode isn't resumed correctly. This patch fixes it by adding
> mvneta_set_rx_mode(dev) in the resume hook if interface is running.
>
> Signed-off-by: Jisheng Zhang <[email protected]>

This doesn't apply cleanly to the net tree, please respin.

2017-03-28 02:32:43

by Jisheng Zhang

[permalink] [raw]
Subject: Re: [PATCH] net: mvneta: set rx mode during resume if interface is running

Dear David,

On Mon, 27 Mar 2017 16:15:34 -0700 David Miller wrote:

> From: Jisheng Zhang <[email protected]>
> Date: Mon, 27 Mar 2017 18:59:05 +0800
>
> > I found a bug by:
> >
> > 0. boot and start dhcp client
> > 1. echo mem > /sys/power/state
> > 2. resume back immediately
> > 3. don't touch dhcp client to renew the lease
> > 4. ping the gateway. No acks
> >
> > Usually, after step2, the DHCP lease isn't expired, so in theory we
> > should resume all back. But in fact, it doesn't. It turns out
> > the rx mode isn't resumed correctly. This patch fixes it by adding
> > mvneta_set_rx_mode(dev) in the resume hook if interface is running.
> >
> > Signed-off-by: Jisheng Zhang <[email protected]>
>
> This doesn't apply cleanly to the net tree, please respin.

This patch is generated against net-next, for mvneta suspend/resume support
is added into net-next recently. I did need to use the "[PATCH net-next]" for
the patch title, will take care in the future.

Sorry for confusion,
Jisheng