From nobody@FreeBSD.org  Thu Jun 23 10:30:28 2011
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (unknown [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 93B741065679
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 23 Jun 2011 10:30:28 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [69.147.83.34])
	by mx1.freebsd.org (Postfix) with ESMTP id 8391F8FC17
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 23 Jun 2011 10:30:28 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.4/8.14.4) with ESMTP id p5NAUSd9041684
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 23 Jun 2011 10:30:28 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.4/8.14.4/Submit) id p5NAUS32041683;
	Thu, 23 Jun 2011 10:30:28 GMT
	(envelope-from nobody)
Message-Id: <201106231030.p5NAUS32041683@red.freebsd.org>
Date: Thu, 23 Jun 2011 10:30:28 GMT
From: "Majdi S. Abbas" <msa@latt.net>
To: freebsd-gnats-submit@FreeBSD.org
Subject: re0 driver quit working on Acer AO751h between 8.0 and 8.2 (also 9.0)
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         158201
>Category:       kern
>Synopsis:       [re] re0 driver quit working on Acer AO751h between 8.0 and 8.2 (also 9.0) [regression]
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    yongari
>State:          feedback
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jun 23 10:40:08 UTC 2011
>Closed-Date:    
>Last-Modified:  Fri Dec 09 23:21:39 UTC 2011
>Originator:     Majdi S. Abbas
>Release:        8.2-RELEASE or 9.0-CURRENT
>Organization:
Lattice, L.L.C.
>Environment:
FreeBSD 9.0-CURRENT #1: Wed Jun 22 14:55:31 MST 2011
    root@:/usr/src/sys/i386/compile/AO751h i386
>Description:
The re driver worked on this machine in 8.0.

Sometime between then and 8.2-RELEASE, it stopped working.  It still doesn't work in -HEAD (as of 22-JUN-2011.)

Relevant dmesg output:

re0: <RealTek 810xE PCIe 10/100baseTX> port 0x2000-0x20ff mem 0xd0110000-0xd0110fff,0xd0100000-0xd010ffff at device 0.0 on pci2
re0: Using 1 MSI-X message
re0: turning off MSI enable bit.
re0: Chip rev. 0x24800000
re0: MAC rev. 0x00400000
miibus0: <MII bus> on re0
rlphy0: <RTL8201L 10/100 media interface> PHY 1 on miibus0
rlphy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto, auto-flow
re0: Ethernet address: 00:23:8b:e5:63:3e

re0: link state changed to UP

After boot, if one attempts to use the interface (in this case via dhclient),
the interface sits there and flaps and hits watchdog resets

re0: link state changed to DOWN
re0: link state changed to UP
re0: watchdog timeout
re0: link state changed to DOWN
re0: link state changed to UP
re0: watchdog timeout
re0: link state changed to DOWN
re0: link state changed to UP
>How-To-Repeat:
Attempt to use attached re0 interface on 8.2 or -HEAD on a host with following card:

re0@pci0:2:0:0:	class=0x020000 card=0x02441025 chip=0x813610ec rev=0x02 hdr=0x00

Here's the config for this build, but this occurs with GENERIC as well:

# Acer Aspire AO751h config

cpu		I686_CPU
ident		AO751h

#makeoptions	DEBUG=-g		# Build kernel with gdb(1) debug symbols

options 	SCHED_ULE		# ULE scheduler
options 	PREEMPTION		# Enable kernel thread preemption
options 	INET			# InterNETworking
options 	INET6			# IPv6 communications protocols
options 	SCTP			# Stream Control Transmission Protocol
options 	FFS			# Berkeley Fast Filesystem
options 	SOFTUPDATES		# Enable FFS soft updates support
options 	UFS_ACL			# Support for access control lists
options 	UFS_DIRHASH		# Improve performance on big directories
options 	UFS_GJOURNAL		# Enable gjournal-based UFS journaling
options 	NFSCLIENT		# Network Filesystem Client
options 	NFSSERVER		# Network Filesystem Server
options 	NFSLOCKD		# Network Lock Manager
options 	NFS_ROOT		# NFS usable as /, requires NFSCLIENT
options 	MSDOSFS			# MSDOS Filesystem
options 	CD9660			# ISO 9660 Filesystem
options 	PROCFS			# Process filesystem (requires PSEUDOFS)
options 	PSEUDOFS		# Pseudo-filesystem framework
options 	GEOM_PART_GPT		# GUID Partition Tables.
options 	GEOM_LABEL		# Provides labelization
options 	COMPAT_43TTY		# BSD 4.3 TTY compat (sgtty)
options 	SCSI_DELAY=5000		# Delay (in ms) before probing SCSI
options 	KTRACE			# ktrace(1) support
options 	STACK			# stack(9) support
options 	SYSVSHM			# SYSV-style shared memory
options 	SYSVMSG			# SYSV-style message queues
options 	SYSVSEM			# SYSV-style semaphores
options 	P1003_1B_SEMAPHORES	# POSIX-style semaphores
options 	_KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions
options 	PRINTF_BUFR_SIZE=128	# Prevent printf output being interspersed.
options 	KBD_INSTALL_CDEV	# install a CDEV entry in /dev
options 	HWPMC_HOOKS		# Necessary kernel hooks for hwpmc(4)
options 	AUDIT			# Security event auditing
options 	MAC			# TrustedBSD MAC Framework
options 	FLOWTABLE		# per-cpu routing cache
#options 	KDTRACE_HOOKS		# Kernel DTrace hooks
options 	INCLUDE_CONFIG_FILE     # Include this file in kernel

options 	KDB			# Kernel debugger related code
options 	KDB_TRACE		# Print a stack trace for a panic

# To make an SMP kernel, the next two lines are needed
options 	SMP			# Symmetric MultiProcessor Kernel
device		apic			# I/O APIC

# CPU frequency control
device		cpufreq

# Bus support.
device		acpi
device		pci

# ATA and ATAPI devices
device		ata
device		atadisk		# ATA disk drives
options 	ATA_STATIC_ID	# Static device numbering

# SCSI peripherals
device		scbus		# SCSI bus (required for SCSI)
device		da		# Direct Access (disks)
device		sa		# Sequential Access (tape etc)
device		cd		# CD
device		pass		# Passthrough device (direct SCSI access)
device		ses		# SCSI Environmental Services (and SAF-TE)

# atkbdc0 controls both the keyboard and the PS/2 mouse
device		atkbdc		# AT keyboard controller
device		atkbd		# AT keyboard
device		psm		# PS/2 mouse

device		kbdmux		# keyboard multiplexer

device		vga		# VGA video card driver

device		splash		# Splash screen and screen saver support

# syscons is the default console driver, resembling an SCO console
device		sc

# Power management support (see NOTES for more options)
device		apm
# Add suspend/resume support for the i8254.
device		pmtimer

# Serial (COM) ports
device		uart		# Generic UART driver

# Parallel port
device		ppbus		# Parallel port bus (required)

# PCI Ethernet NICs that use the common MII bus controller code.
# NOTE: Be sure to keep the 'device miibus' line in order to use these NICs!
device		miibus		# MII bus support
device		re		# RealTek 8139C+/8169/8169S/8110S
device		rl		# RealTek 8129/8139

# Wireless NIC cards
device		wlan		# 802.11 support
options 	IEEE80211_DEBUG	# enable debug msgs
options 	IEEE80211_AMPDU_AGE # age frames in AMPDU reorder q's
options 	IEEE80211_SUPPORT_MESH	# enable 802.11s draft support
device		wlan_wep	# 802.11 WEP support
device		wlan_ccmp	# 802.11 CCMP support
device		wlan_tkip	# 802.11 TKIP support
device		wlan_amrr	# AMRR transmit rate control algorithm
device		ath		# Atheros pci/cardbus NIC's
device		ath_hal		# pci/cardbus chip support
options 	AH_SUPPORT_AR5416	# enable AR5416 tx/rx descriptors
device		ath_rate_sample	# SampleRate tx rate control for ath

# Pseudo devices.
device		loop		# Network loopback
device		random		# Entropy device
device		ether		# Ethernet support
device		vlan		# 802.1Q VLAN support
device		tun		# Packet tunnel.
device		pty		# BSD-style compatibility pseudo ttys
device		md		# Memory "disks"
device		gif		# IPv6 and IPv4 tunneling
device		faith		# IPv6-to-IPv4 relaying (translation)
device		firmware	# firmware assist module

# The `bpf' device enables the Berkeley Packet Filter.
# Be aware of the administrative consequences of enabling this!
# Note that 'bpf' is required for DHCP.
device		bpf		# Berkeley packet filter

# USB support
options 	USB_DEBUG	# enable debug msgs
device		uhci		# UHCI PCI->USB interface
device		ehci		# EHCI PCI->USB interface (USB 2.0)
device		usb		# USB Bus (required)
device		uhid		# "Human Interface Devices"
device		ukbd		# Keyboard
device		ulpt		# Printer
device		umass		# Disks/Mass storage - Requires scbus and da
device		ums		# Mouse
# USB Serial devices
device		u3g		# USB-based 3G modems (Option, Huawei, Sierra)
device		uftdi		# For FTDI usb serial adapters
device		uplcom		# Prolific PL-2303 serial adapters
# USB Wireless
device		rum		# Ralink Technology RT2501USB wireless NICs
device		uath		# Atheros AR5523 wireless NICs
device		ural		# Ralink Technology RT2500USB wireless NICs
device		zyd		# ZyDAS zb1211/zb1211b wireless NICs

device		dcons		# Dumb console driver
device		dcons_crom	# Configuration ROM for dcons
>Fix:


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-i386->freebsd-net 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Mon Jul 4 02:15:29 UTC 2011 
Responsible-Changed-Why:  
reclassify. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=158201 
State-Changed-From-To: open->feedback 
State-Changed-By: yongari 
State-Changed-When: Tue Jul 5 00:34:34 UTC 2011 
State-Changed-Why:  
There had been a lot of re(4) changes since 8.0-RELEASE so it's 
hard to know which commit broke your controller. I made a small 
patch with wild guess so I can't guarantee it would work but could 
you give it try? You can get the diff at the following URL. 
http://people.freebsd.org/~yongari/re/re.macsleep.diff 

http://www.freebsd.org/cgi/query-pr.cgi?pr=158201 
Responsible-Changed-From-To: freebsd-net->yongari 
Responsible-Changed-By: yongari 
Responsible-Changed-When: Tue Jul 5 00:35:48 UTC 2011 
Responsible-Changed-Why:  
Grab. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=158201 

From: "Majdi S. Abbas" <msa@latt.net>
To: yongari@FreeBSD.org, bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/158201: [re] re0 driver quit working on Acer AO751h between
 8.0 and 8.2 (also 9.0) [regression]
Date: Mon, 11 Jul 2011 14:26:45 -0700

 On Tue, Jul 05, 2011 at 12:35:43AM +0000, yongari@FreeBSD.org wrote:
 > Synopsis: [re] re0 driver quit working on Acer AO751h between 
 > 8.0 and 8.2 (also 9.0) [regression]
 > 
 > State-Changed-From-To: open->feedback
 > State-Changed-By: yongari
 > State-Changed-When: Tue Jul 5 00:34:34 UTC 2011
 > State-Changed-Why: 
 > There had been a lot of re(4) changes since 8.0-RELEASE so it's
 > hard to know which commit broke your controller. I made a small
 > patch with wild guess so I can't guarantee it would work but could
 > you give it try? You can get the diff at the following URL.
 > http://people.freebsd.org/~yongari/re/re.macsleep.diff
 
 	Thanks!
 
 	Patch applied and kernel rebuilt, no change in behavior.
 
 	--msa
State-Changed-From-To: feedback->open 
State-Changed-By: yongari 
State-Changed-When: Tue Sep 6 00:54:45 UTC 2011 
State-Changed-Why:  
Feedback received. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=158201 
State-Changed-From-To: open->feedback 
State-Changed-By: yongari 
State-Changed-When: Fri Dec 9 23:21:03 UTC 2011 
State-Changed-Why:  
I still have no clue yet but I vaguely guess it could be related 
with PCIe ASPM.  The ASPM was disabled HEAD so it would be good to 
know whether that change makes any difference on the box. 

http://svnweb.freebsd.org/base/head/sys/pci/if_rlreg.h?r1=227590&r2=227593&view=patch 
http://svnweb.freebsd.org/base/head/sys/dev/re/if_re.c?r1=227591&r2=227593&view=patch 

Please apply above patch and let me know how it goes. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=158201 
>Unformatted:
