From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.5 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_2 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 45DE4C433E2 for ; Thu, 3 Sep 2020 08:41:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2DD05206C0 for ; Thu, 3 Sep 2020 08:41:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728089AbgICIl2 (ORCPT ); Thu, 3 Sep 2020 04:41:28 -0400 Received: from mx2.suse.de ([195.135.220.15]:48492 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726448AbgICIl1 (ORCPT ); Thu, 3 Sep 2020 04:41:27 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 100D6B706; Thu, 3 Sep 2020 08:41:27 +0000 (UTC) Date: Thu, 3 Sep 2020 10:41:22 +0200 From: Petr Tesarik To: Heiner Kallweit Cc: Realtek linux nic maintainers , netdev@vger.kernel.org Subject: Re: RTL8402 stops working after hibernate/resume Message-ID: <20200903104122.1e90e03c@ezekiel.suse.cz> In-Reply-To: References: <20200715102820.7207f2f8@ezekiel.suse.cz> <20200716105835.32852035@ezekiel.suse.cz> Organization: SUSE Linux, s.r.o. X-Mailer: Claws Mail 3.17.6 (GTK+ 2.24.32; x86_64-suse-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/F0PlOo0hAUR0SqykBSgVWM/"; protocol="application/pgp-signature"; micalg=pgp-sha256 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org --Sig_/F0PlOo0hAUR0SqykBSgVWM/ Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Hi Heiner, this issue was on the back-burner for some time, but I've got some interesting news now. On Sat, 18 Jul 2020 14:07:50 +0200 Heiner Kallweit wrote: >[...] > Maybe the following gives us an idea: > Please do "ethtool -d " after boot and after resume from suspend, > and check for differences. The register dump did not reveal anything of interest - the only differences were in the physical addresses after a device reopen. However, knowing that reloading the driver can fix the issue, I copied the initialization sequence from init_one() to rtl8169_resume() and gave it a try. That works! Then I started removing the initialization calls one by one. This exercise left me with a call to rtl_init_rxcfg(), which simply sets the RxConfig register. In other words, these is the difference between 5.8.4 and my working version: --- linux-orig/drivers/net/ethernet/realtek/r8169_main.c 2020-09-02 22:43:0= 9.361951750 +0200 +++ linux/drivers/net/ethernet/realtek/r8169_main.c 2020-09-03 10:36:23.915= 803703 +0200 @@ -4925,6 +4925,9 @@ =20 clk_prepare_enable(tp->clk); =20 + if (tp->mac_version =3D=3D RTL_GIGA_MAC_VER_37) + RTL_W32(tp, RxConfig, RX128_INT_EN | RX_DMA_BURST); + if (netif_running(tp->dev)) __rtl8169_resume(tp); =20 This is quite surprising, at least when the device is managed by NetworkManager, because then it is closed on wakeup, and the open method should call rtl_init_rxcfg() anyway. So, it might be a timing issue, or incorrect order of register writes. Since I have no idea why the above change fixes my issue, I'm hesitant to post it as a patch. It might break other people's systems... Petr T --Sig_/F0PlOo0hAUR0SqykBSgVWM/ Content-Type: application/pgp-signature Content-Description: Digitální podpis OpenPGP -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEHl2YIZkIo5VO2MxYqlA7ya4PR6cFAl9QrDIACgkQqlA7ya4P R6d0RAf+P+N+LfrA80VunO1YGVUBQghbfGN5Qu04x5z1N2Pxtu+KSpnnN+nnAZSE WXO7aqiVqflPwOEZezD10vFCmdaW7wdOyUSsSzygxj6Kvl/IsTEMVv9xJinvbHIa 3dFl8VNDl4X5m8AG6/eDn3jKxykRuZhz4N7rfUbpUZSDyKs2o0XkRT8rd8QRPZkx I+YwNsFeOa5nHSG8vpob3X2r3oMDy0asy1N6Fd0M9KQ7dcl1NDJ1HRA6UuQU8+Xp Csk6lgh3OZ9JvgSmSwvok1zKoxId9sgfSauLJ/Khw6JDme/CaP1ttwUYN9zmHB6D /eFguthk86nMTxAMg9vrDX8x5EtU7Q== =csjp -----END PGP SIGNATURE----- --Sig_/F0PlOo0hAUR0SqykBSgVWM/--