NetBSD Problem Report #56312

From www@netbsd.org  Thu Jul 15 19:42:09 2021
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id D57CE1A921F
	for <gnats-bugs@gnats.NetBSD.org>; Thu, 15 Jul 2021 19:42:09 +0000 (UTC)
Message-Id: <20210715194208.9BB551A923A@mollari.NetBSD.org>
Date: Thu, 15 Jul 2021 19:42:08 +0000 (UTC)
From: ralf@rdoering.net
Reply-To: ralf@rdoering.net
To: gnats-bugs@NetBSD.org
Subject: re(4) - card not working reliably - patch attached
X-Send-Pr-Version: www-1.0

>Number:         56312
>Category:       kern
>Synopsis:       re(4) - card not working reliably - patch attached
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jul 15 19:45:00 +0000 2021
>Closed-Date:    Fri Aug 04 17:17:43 +0000 2023
>Last-Modified:  Fri Aug 04 17:17:43 +0000 2023
>Originator:     Ralf Doering
>Release:        9.2
>Organization:
>Environment:
NetBSD nbsd 9.2 NetBSD 9.2 (GENERIC) #0: Wed May 12 13:15:55 UTC 2021  mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/amd64/compile/GENERIC amd64
>Description:
I've got a system with a Realtek based card which did not work reliably. Just after booting with a static IP configuration the system wasn't reachable and could not ping it's gateway. Usually letting tcpdump run for some time got the card into a somewhat working state.

Digging through the logs I found:
[     1.048531] re0 at pci3 dev 0 function 0: RealTek 8168/8111 PCIe Gigabit Ethernet (rev. 0x10)
[     1.048531] re0: interrupting at msix3 vec 0
[     1.048531] re0: Unknown revision (0x50800000)
[     1.048531] re0: Ethernet address c8:d3:ff:35:9f:4b
[     1.048531] re0: using 256 tx descriptors

After reading through the source this "unknown revision" means that default quirks/flags are used in the end instead of chip specific one.

Revision 0x50800000 seems to be RTK_HWREV_8168GU as defined in rtl81x9reg.h, but it is not handled in rtl8169.c. I had a quick look over to the FreeBSD sources, they handle this chip the same as RTK_HWREV_8168H. So the patch to try was quite simple, see patch.

With this compiled in IP is working from the beginning without any tricks.

The card in question according to pcictl is:
  003:00:0: 0x816810ec (0x02000010) [re0]



>How-To-Repeat:
Get my hardware ;)
>Fix:

Index: sys/dev/ic/rtl8169.c
===================================================================
RCS file: /cvsroot/src/sys/dev/ic/rtl8169.c,v
retrieving revision 1.159.2.1
diff -u -r1.159.2.1 rtl8169.c
--- sys/dev/ic/rtl8169.c	28 Jan 2020 11:12:30 -0000	1.159.2.1
+++ sys/dev/ic/rtl8169.c	15 Jul 2021 19:17:58 -0000
@@ -613,6 +613,7 @@
 			    RTKQ_NOJUMBO;
 			break;
 		case RTK_HWREV_8168H:
+		case RTK_HWREV_8168GU:
 		case RTK_HWREV_8168FP:
 			sc->sc_quirk |= RTKQ_DESCV2 | RTKQ_NOEECMD |
 			    RTKQ_MACSTAT | RTKQ_CMDSTOP | RTKQ_PHYWAKE_PM |

>Release-Note:

>Audit-Trail:
From: "Jonathan A. Kollasch" <jakllsch@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/56312 CVS commit: src/sys/dev/ic
Date: Sat, 4 Sep 2021 19:27:43 +0000

 Module Name:	src
 Committed By:	jakllsch
 Date:		Sat Sep  4 19:27:43 UTC 2021

 Modified Files:
 	src/sys/dev/ic: rtl8169.c

 Log Message:
 re(4): misc chip revision support changes
  * remove impossible-to-match chip revision cases
  * bring support for modern chips in line with FreeBSD and OpenBSD
   * adds support for RTL8168GU

 Addresses PR kern/56312.


 To generate a diff of this commit:
 cvs rdiff -u -r1.167 -r1.168 src/sys/dev/ic/rtl8169.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->feedback
State-Changed-By: jakllsch@NetBSD.org
State-Changed-When: Sat, 04 Sep 2021 19:47:01 +0000
State-Changed-Why:
functionally-similar change committed; does it resolve the issue for you?


State-Changed-From-To: feedback->needs-pullups
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Wed, 01 Feb 2023 00:04:24 +0000
State-Changed-Why:
No feedback in over a year, so assume fixed; however, was filed against
-9 so by the usual procedures the fix should go into -9.


State-Changed-From-To: needs-pullups->pending-pullups
State-Changed-By: jakllsch@NetBSD.org
State-Changed-When: Wed, 02 Aug 2023 21:44:08 +0000
State-Changed-Why:
pullup-9 #1705


From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/56312 CVS commit: [netbsd-9] src/sys/dev/ic
Date: Fri, 4 Aug 2023 15:06:50 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Fri Aug  4 15:06:50 UTC 2023

 Modified Files:
 	src/sys/dev/ic [netbsd-9]: rtl8169.c rtl81x9reg.h rtl81x9var.h

 Log Message:
 Pull up following revision(s) (requested by jakllsch in ticket #1705):

 	sys/dev/ic/rtl81x9var.h: revision 1.58
 	sys/dev/ic/rtl81x9reg.h: revision 1.54
 	sys/dev/ic/rtl8169.c: revision 1.167
 	sys/dev/ic/rtl8169.c: revision 1.168

 re(4): misc chip revision support changes
  * remove impossible-to-match chip revision cases
  * bring support for modern chips in line with FreeBSD and OpenBSD
   * adds support for RTL8168GU

 Addresses PR kern/56312.

 - Print chip revision. From OpenBSD.
 - Rename RTK_HWREV_8168_SPIN[123] to RTK_HWREV_8168'B'_SPIN[123].
   Same as other *BSDs.
 - Rename RTK_HWREV_8168G_SPIN4 to RTK_HWREV_8411B. Same as other *BSDs.
 - Add definition of RTK_HWREV_8169_8110SCE.


 To generate a diff of this commit:
 cvs rdiff -u -r1.159.2.1 -r1.159.2.2 src/sys/dev/ic/rtl8169.c
 cvs rdiff -u -r1.50.4.1 -r1.50.4.2 src/sys/dev/ic/rtl81x9reg.h
 cvs rdiff -u -r1.56.18.1 -r1.56.18.2 src/sys/dev/ic/rtl81x9var.h

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: pending-pullups->closed
State-Changed-By: jakllsch@NetBSD.org
State-Changed-When: Fri, 04 Aug 2023 17:17:43 +0000
State-Changed-Why:
pullup completed


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2023 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.