From owner-freebsd-current@FreeBSD.ORG Mon Dec 4 10:35:51 2006 Return-Path: X-Original-To: freebsd-current@freebsd.org Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9302B16A4AB for ; Mon, 4 Dec 2006 10:35:51 +0000 (UTC) (envelope-from pyunyh@gmail.com) Received: from py-out-1112.google.com (py-out-1112.google.com [64.233.166.177]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4DF5643CA8 for ; Mon, 4 Dec 2006 10:35:18 +0000 (GMT) (envelope-from pyunyh@gmail.com) Received: by py-out-1112.google.com with SMTP id f31so2219860pyh for ; Mon, 04 Dec 2006 02:35:49 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:date:from:to:cc:subject:message-id:reply-to:references:mime-version:content-type:content-disposition:in-reply-to:user-agent; b=IN9uh6yaoK1bLLgV7OEHw3zHT4Kp1XcBqbWvT1sJqoAKEhhM7/JxB21tLcQT3txbCy3jTgm1XdGmJw3QdIo8zMEGsJvMw0kfIPdAMeqlgcZW8aZI9fR4Ns1N4bnhb25OQTqgzQT66ZYG7NWtyvFKSQm4bUN3LSf7Rg//qCefJrA= Received: by 10.35.82.16 with SMTP id j16mr15020862pyl.1165228549485; Mon, 04 Dec 2006 02:35:49 -0800 (PST) Received: from michelle.cdnetworks.co.kr ( [211.53.35.84]) by mx.google.com with ESMTP id a79sm25046627pye.2006.12.04.02.35.45; Mon, 04 Dec 2006 02:35:48 -0800 (PST) Received: from michelle.cdnetworks.co.kr (localhost.cdnetworks.co.kr [127.0.0.1]) by michelle.cdnetworks.co.kr (8.13.5/8.13.5) with ESMTP id kB4AdWqH094123 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 4 Dec 2006 19:39:32 +0900 (KST) (envelope-from pyunyh@gmail.com) Received: (from yongari@localhost) by michelle.cdnetworks.co.kr (8.13.5/8.13.5/Submit) id kB4AdVpe094122; Mon, 4 Dec 2006 19:39:31 +0900 (KST) (envelope-from pyunyh@gmail.com) Date: Mon, 4 Dec 2006 19:39:31 +0900 From: Pyun YongHyeon To: John Baldwin Message-ID: <20061204103931.GB91710@cdnetworks.co.kr> References: <20061128115538.GB66517@cdnetworks.co.kr> <0612011540189.97361@www.mmlab.cse.yzu.edu.tw> <20061201124315.GD79879@cdnetworks.co.kr> <200612011359.07701.jhb@freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200612011359.07701.jhb@freebsd.org> User-Agent: Mutt/1.4.2.1i Cc: Tai-hwa Liang , freebsd-current@freebsd.org Subject: Re: Call for e1000phy(4) testers. X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: pyunyh@gmail.com List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Dec 2006 10:35:51 -0000 On Fri, Dec 01, 2006 at 01:59:07PM -0500, John Baldwin wrote: > On Friday 01 December 2006 07:43, Pyun YongHyeon wrote: > > On Fri, Dec 01, 2006 at 03:46:36PM +0800, Tai-hwa Liang wrote: > > > On Tue, 28 Nov 2006, Pyun YongHyeon wrote: > > > >Hi, > > > > > > > >I had been writing msk(4) for FreeBSD and realized that e1000phy(4) > > > >is buggy on newer Marvell PHYs. For example, manual media selection > > > >didn't work at all and I had to stick to autoselection of the media > > > >type. The Marvell PHYs are widely used on various NICs including > > > >em(4), stge(4), sk(4), msk(4) and nfe(4). Except em(4) which does > > > >not support MII layers, correct operation of e1000phy(4) is very > > > >important to get a good link with link partner and to report link > > > >state changes to upper layers(e.g. dhclinet(8)). > > > > > > Thank you for working on this. > > > > > > >With this patch you should be able to set a media type without > > > >relying on autoselection and it should supports automatic crossover > > > >for all known Marvell PHYs. I've tried hard not to break existing > > > >behaviour(e.g. Fiber transceivers) but I can't verify that as I > > > >don't have any NICs that have Marvell Fiber transceivers. The patch > > > >is somewhat ugly in that it should read a PHY ID register in several > > > >palces. It seems that there is no easy way to avoid the reading until > > > >we have PHY model/revision numbers in mii softc. > > > > > > > >If you are one of users that use stge(4), sk(4), msk(4) and nfe(4) > > > >please test and report any strange things not observed on stock > > > >version. > > > > > > > >Note for nfe(4) users: > > > >It seems that nfe(4) has bugs that it can't send packets on > > > >half-duplex media(I've got "tx v1 error 0x6004"). I guess this comes > > > >from mismatches between PHY and MAC. So you may have to set > > > >full-duplex on nfe(4) until we have a fix for the issue. > > > > > > > >You can get the latest e1000phy(4) driver from the following URL. > > > >http://people.freebsd.org/~yongari/msk/e1000phy.c > > > >http://people.freebsd.org/~yongari/msk/e1000phyreg.h > > > >http://people.freebsd.org/~yongari/msk/miidevs > > > > > > > >OR get a jumbo patch for CURRENT. > > > >http://people.freebsd.org/~yongari/msk/e1000phy.patch > > > > > > I have tried your e1000phy patch as well as msk.diff.HEAD on an Acer > > > Aspire 5583 WXMi laptop: > > > > > > mskc0@pci2:0:0: class=0x020000 card=0x01101025 chip=0x435211ab > > > rev=0x14 hdr=0x00 > > > vendor = 'Marvell Semiconductor (Was: Galileo Technology Ltd)' > > > class = network > > > subclass = ethernet > > > > > > It seems that device_attach always returns 6 regardless > > > hw.pci.enable_msi[x] > > > is 1 or 0: > > > > > > > [...] > > > > > found-> vendor=0x11ab, dev=0x4352, revid=0x14 > > > bus=2, slot=0, func=0 > > > class=02-00-00, hdrtype=0x00, mfdev=0 > > > cmdreg=0x0000, statreg=0x4010, cachelnsz=16 (dwords) > > > lattimer=0x00 (0 ns), mingnt=0x00 (0 ns), maxlat=0x00 (0 ns) > > > intpin=a, irq=10 > > > powerspec 2 supports D0 D1 D2 D3 current D0 > > > VPD Ident: Marvell Yukon 88E8038 Fast Ethernet Controller > > > PN: Yukon 88E8038 > > > EC: Rev. 1.4 > > > MN: Marvell > > > SN: AbCdEfG85BCA0 > > > CP: id 1, BAR16, off 0x3cc > > > RV: 0x7d > > > MSI supports 2 messages, 64 bit > > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > > > > Since Scott said resource allocation problem I'd like to say what > > I don't understand in this message. > > > > The motherboard I have also reports 2 MSI but I'm pretty sure the > > Yukon II hardware support only 1 MSI. If I force to call pci_alloc_msi() > > with 1 MSI it works without problems. At first, I thought my > > motherboard has chipset bug but I see the same 2 MSI message from > > your system. > > > > Does Youkon II really support 2 MSI? > > That's the hardware saying "I support 2 messages", so yes. > That's odd. I've read MSI control register with pci_read_config(). It shows 0x11 as the control register value. As you said, it says the NIC support 2 messages but it could not. AFAIK bit 1-3 of the control register indicates the number of messages it supports which is 0(i.e. 1 message). Bit 4-6 defines number of messages allocated which is 2 so pci_msi_count() returns 2. However FreeBSD should not program MSI control register to support 2 messages as it is not valid for this hardware! I've used the following code in device attach routine. if (pci_find_extcap(dev, PCIY_EXPRESS, ®) == 0) { printf("MSI capability!\n"); reg = pci_read_config(dev, reg + PCIR_MSI_CTRL, 2); printf("MSI control = 0x%04x\n", reg); } What's your opinion? Should I ignore pci_msi_count() and do it myself to determine number of messages supported? > -- > John Baldwin -- Regards, Pyun YongHyeon