diff mbox series

[net] r8169: fix data corruption issue on RTL8402

Message ID 41cca6ed-088c-da5d-94bd-4269b2071a9c@gmail.com
State New
Headers show
Series [net] r8169: fix data corruption issue on RTL8402 | expand

Commit Message

Heiner Kallweit Oct. 1, 2020, 7:23 a.m. UTC
Petr reported that after resume from suspend RTL8402 partially
truncates incoming packets, and re-initializing register RxConfig
before the actual chip re-initialization sequence is needed to avoid
the issue.

Reported-by: Petr Tesarik <ptesarik@suse.cz>
Proposed-by: Petr Tesarik <ptesarik@suse.cz>
Tested-by: Petr Tesarik <ptesarik@suse.cz>
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
Hard to provide a Fixes tag because it seems the issue has been
always there. Due to frequent changes in function rtl8169_resume()
we would need a number of different fixes for the stable kernel
versions. That the issue was reported only now indicates that chip
version RTL8402 is rare. Therefore treat this change mainly as an
improvement. This fix version applies from 5.9 after just submitted
fix "r8169: fix handling ether_clk".
---
 drivers/net/ethernet/realtek/r8169_main.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

David Miller Oct. 1, 2020, 7:38 p.m. UTC | #1
From: Heiner Kallweit <hkallweit1@gmail.com>
Date: Thu, 1 Oct 2020 09:23:02 +0200

> Petr reported that after resume from suspend RTL8402 partially
> truncates incoming packets, and re-initializing register RxConfig
> before the actual chip re-initialization sequence is needed to avoid
> the issue.
> 
> Reported-by: Petr Tesarik <ptesarik@suse.cz>
> Proposed-by: Petr Tesarik <ptesarik@suse.cz>
> Tested-by: Petr Tesarik <ptesarik@suse.cz>
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> ---
> Hard to provide a Fixes tag because it seems the issue has been
> always there. Due to frequent changes in function rtl8169_resume()
> we would need a number of different fixes for the stable kernel
> versions. That the issue was reported only now indicates that chip
> version RTL8402 is rare. Therefore treat this change mainly as an
> improvement. This fix version applies from 5.9 after just submitted
> fix "r8169: fix handling ether_clk".

Applied and queued up for -stable.

In the future you can use a Fixes: tag using the root commit of the
entire Linux git tree in situations like this.

Thanks.
diff mbox series

Patch

diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c
index 72351c5b0..0fa99298a 100644
--- a/drivers/net/ethernet/realtek/r8169_main.c
+++ b/drivers/net/ethernet/realtek/r8169_main.c
@@ -4848,6 +4848,10 @@  static int __maybe_unused rtl8169_resume(struct device *device)
 	if (!device_may_wakeup(tp_to_dev(tp)))
 		clk_prepare_enable(tp->clk);
 
+	/* Reportedly at least Asus X453MA truncates packets otherwise */
+	if (tp->mac_version == RTL_GIGA_MAC_VER_37)
+		rtl_init_rxcfg(tp);
+
 	return rtl8169_net_resume(tp);
 }