From owner-freebsd-amd64@FreeBSD.ORG Tue Oct 12 15:40:07 2010 Return-Path: Delivered-To: freebsd-amd64@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B36631065693 for ; Tue, 12 Oct 2010 15:40:07 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 753A28FC21 for ; Tue, 12 Oct 2010 15:40:07 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id o9CFe74j052940 for ; Tue, 12 Oct 2010 15:40:07 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id o9CFe7eV052939; Tue, 12 Oct 2010 15:40:07 GMT (envelope-from gnats) Resent-Date: Tue, 12 Oct 2010 15:40:07 GMT Resent-Message-Id: <201010121540.o9CFe7eV052939@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-amd64@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Steve Cochran Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7892A106566C for ; Tue, 12 Oct 2010 15:33:26 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id 666DC8FC28 for ; Tue, 12 Oct 2010 15:33:26 +0000 (UTC) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.3/8.14.3) with ESMTP id o9CFXQ1b094253 for ; Tue, 12 Oct 2010 15:33:26 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.3/8.14.3/Submit) id o9CFXPDw094252; Tue, 12 Oct 2010 15:33:25 GMT (envelope-from nobody) Message-Id: <201010121533.o9CFXPDw094252@www.freebsd.org> Date: Tue, 12 Oct 2010 15:33:25 GMT From: Steve Cochran To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 X-Mailman-Approved-At: Mon, 18 Oct 2010 02:30:24 +0000 Cc: Subject: amd64/151409: Problem with Marvell driver, e1000phy.c X-BeenThere: freebsd-amd64@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the AMD64 platform List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Oct 2010 15:40:07 -0000 >Number: 151409 >Category: amd64 >Synopsis: Problem with Marvell driver, e1000phy.c >Confidential: no >Severity: serious >Priority: low >Responsible: freebsd-amd64 >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue Oct 12 15:40:07 UTC 2010 >Closed-Date: >Last-Modified: >Originator: Steve Cochran >Release: 8.1R >Organization: University of Missouri System >Environment: FreeBSD shaggy.netsys.more.net 8.1-RELEASE-p1 FreeBSD 8.1-RELEASE-p1 #12: Sun Oct 10 14:29:31 CDT 2010 root@shaggy.netsys.more.net:/usr/obj/usr/src/sys/GENERIC amd64 >Description: After upgrading from 7.2R to 8.1R I had serious problems with the build-in Ethernet ports on my server. As soon as the OS initialized the port the LEDs looked wrong: activity LED on solid and speed indicator off. It would come up in half-duplex regardless of the setting on the connected switch and any attempt to force full-duplex operation would apparently cause the port to hang completely. Sometimes it would pass traffic in half-duplex mode (but at low speeds and with errors), sometimes it wouldn't pass traffic at all. I couldn't find any mention of similar problems on Google so I compared some kernel files between 7.2 and 8.1 and found that dev/mii/e1000phy.c had some significant differences. I tried iteratively backing out some changes but didn't have much luck building a working driver. I'm not a kernel hacker and know very little about Ethernet drivers or Marvell hardware so I only had a dim idea of what I was doing. Eventually I just modified the driver in 8.1 to match the one from 7.2 ( __FBSDID("$FreeBSD: src/sys/dev/mii/e1000phy.c,v 1.18.2.4.2.1 2009/04/15 03:14:26 kensmith Exp $") ) as much as possible. This finally gave me a working driver. Here are the relevant lines from dmesg. Copyright (c) 1992-2010 The FreeBSD Project. Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994 The Regents of the University of California. All rights reserved. FreeBSD is a registered trademark of The FreeBSD Foundation. FreeBSD 8.1-RELEASE-p1 #12: Sun Oct 10 14:29:31 CDT 2010 root@shaggy.netsys.more.net:/usr/obj/usr/src/sys/GENERIC amd64 Timecounter "i8254" frequency 1193182 Hz quality 0 CPU: Quad-Core AMD Opteron(tm) Processor 1354 (2200.10-MHz K8-class CPU) Origin = "AuthenticAMD" Id = 0x100f23 Family = 10 Model = 2 Stepping = 3 Features=0x178bfbff Features2=0x802009 AMD Features=0xee500800 AMD Features2=0x7ff TSC: P-state invariant real memory = 4294967296 (4096 MB) avail memory = 4110999552 (3920 MB) ACPI APIC Table: <061908 APIC1103> FreeBSD/SMP: Multiprocessor System Detected: 4 CPUs FreeBSD/SMP: 1 package(s) x 4 core(s) cpu0 (BSP): APIC ID: 0 cpu1 (AP): APIC ID: 1 cpu2 (AP): APIC ID: 2 cpu3 (AP): APIC ID: 3 .. nfe0: port 0xb400-0xb407 mem 0xfeaf6000-0xfeaf6fff,0xfeafa800-0xfeafa8ff,0xfeafa400-0xfeafa40f irq 22 at device 8.0 on pci0 miibus0: on nfe0 e1000phy0: PHY 2 on miibus0 e1000phy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT, 1000baseT-FDX, auto nfe0: Ethernet address: 00:e0:81:b5:f1:04 nfe0: [FILTER] nfe0: [FILTER] nfe0: [FILTER] nfe0: [FILTER] nfe0: [FILTER] nfe0: [FILTER] nfe0: [FILTER] nfe0: [FILTER] nfe1: port 0xb080-0xb087 mem 0xfeaf5000-0xfeaf5fff,0xfeafa000-0xfeafa0ff,0xfeaf4c00-0xfeaf4c0f irq 23 at device 9.0 on pci0 miibus1: on nfe1 e1000phy1: PHY 3 on miibus1 e1000phy1: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT, 1000baseT-FDX, auto nfe1: Ethernet address: 00:e0:81:b5:f1:05 nfe1: [FILTER] nfe1: [FILTER] nfe1: [FILTER] nfe1: [FILTER] nfe1: [FILTER] nfe1: [FILTER] nfe1: [FILTER] nfe1: [FILTER] .. >How-To-Repeat: The server showing the problem has a Tyan Tomcat n3400B Opteron motherboard with NVIDIA nForce MCP55 chipset and Marvell 88E1116 Ethernet controller. I assume any server with similar hardware would show the same problem. Given the lack of cries in the mailing lists I'm guessing this isn't all that common a setup. >Fix: I'd submit the working version of e1000phy.c that I came up with but I'm pretty sure I broke support for some newer Marvell chipsets in the process of fixing my own. It is mostly identical to src/sys/dev/mii/e1000phy.c,v 1.18.2.4.2.1 but with the necessary changes to make it work with the 8.1 kernel. >Release-Note: >Audit-Trail: >Unformatted: