From owner-freebsd-net@FreeBSD.ORG Tue Aug 25 18:26:30 2009 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 740E6106568C for ; Tue, 25 Aug 2009 18:26:30 +0000 (UTC) (envelope-from pyunyh@gmail.com) Received: from wa-out-1112.google.com (wa-out-1112.google.com [209.85.146.176]) by mx1.freebsd.org (Postfix) with ESMTP id 3DBF78FC32 for ; Tue, 25 Aug 2009 18:26:30 +0000 (UTC) Received: by wa-out-1112.google.com with SMTP id m38so801085waf.27 for ; Tue, 25 Aug 2009 11:26:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:received:from:date:to:cc :subject:message-id:reply-to:references:mime-version:content-type :content-disposition:in-reply-to:user-agent; bh=mUZkhX6ti0yy04P4JAEQBbZ+VAE/3pvMnf57JnImgCI=; b=YA/KEpy/b5KE0sjDvnyux4reRuQVj2ZmGNuSFDnvERDHrKD0pDJOuonqDoj0vjW7aQ WEbfIyI52AJBNqME53pMRlpgkZh9zyDxs7G2AVOMdPrlb1+LR8xOBkMXszmR2n/XbuqR jaDWEPtCJuDvs6kHAGDNaWIlAXi+eNpY2S6Zg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:date:to:cc:subject:message-id:reply-to:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=CLacDe8gu+up6PG80DI9tS0lnCM8wT4FanZwBbiqxB29kbT3InF+R6LpgHiezA3xDL Ik/0Z+vbtECXtJgeEYmSlmOP9lXz0ASCgmRfqGeRGpwCtqSz8CWcouFV3Bby2w3Duayp 8adLdxV/9QWw1lSza8ss4J5Il331qa9sKZiS0= Received: by 10.115.66.28 with SMTP id t28mr9556362wak.177.1251224789759; Tue, 25 Aug 2009 11:26:29 -0700 (PDT) Received: from pyunyh@gmail.com ([174.35.1.224]) by mx.google.com with ESMTPS id j26sm12628500waf.63.2009.08.25.11.26.27 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 25 Aug 2009 11:26:28 -0700 (PDT) Received: by pyunyh@gmail.com (sSMTP sendmail emulation); Tue, 25 Aug 2009 11:25:53 -0700 From: Pyun YongHyeon Date: Tue, 25 Aug 2009 11:25:53 -0700 To: freebsd-net@freebsd.org Message-ID: <20090825182553.GD1282@michelle.cdnetworks.com> References: <20090821142039.GA40018@traktor.dnepro.net> <20090821221932.GE1262@michelle.cdnetworks.com> <20090825083857.GA22983@traktor.dnepro.net> <20090825114649.GA11642@traktor.dnepro.net> <20090825130821.GA41669@traktor.dnepro.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="+HP7ph2BbKc20aGI" Content-Disposition: inline In-Reply-To: <20090825130821.GA41669@traktor.dnepro.net> User-Agent: Mutt/1.4.2.3i Cc: Eugene Perevyazko Subject: Re: D-Link DGE-560SX (Marvell 88E8061-based) doesn't see link X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: pyunyh@gmail.com List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Aug 2009 18:26:30 -0000 --+HP7ph2BbKc20aGI Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Aug 25, 2009 at 04:08:21PM +0300, Eugene Perevyazko wrote: > Hello. > > On Tue, Aug 25, 2009 at 02:46:49PM +0300, Eugene Perevyazko wrote: > > > > > > > > ATM there is no easy/clean way to pass driver specific data to mii > > > > layer in FreeBSD so e1000phy(4) incorrectly thinks it found copper > > > > PHY. Marvell PHYs seem to have no reliable way to know configured > > > > media type of PHY hardware unless parent driver(msk) gives hint to > > > > it. If you have just 1 NIC which uses e1000phy(4) on your system, > > > > modify e1000phy(4) to force it having fiber media by inserting the > > > > following line around line 114 in e1000phy.c. > > > > > > > > sc->mii_flags |= MIIF_HAVEFIBER; > [...] > > --- e1000phy.c 2009-08-25 14:45:03.000000000 +0300 > > +++ e1000phy.c.old 2009-08-25 14:44:47.000000000 +0300 > > @@ -166,7 +166,6 @@ > > break; > > } > > > > - sc->mii_flags |= MIIF_HAVEFIBER; > > e1000phy_reset(sc); > > > > sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask; > > > > for src/sys/dev/mii/e1000phy.c,v 1.18.2.8 > > I've rebooted with new kernel with following results: > > mskc0: port 0x4000-0x40ff mem 0xdc100000-0xdc103 > fff irq 16 at device 0.0 on pci1 > msk0: on mskc0 > msk0: Ethernet address: 00:21:91:52:4f:09 > miibus1: on msk0 > e1000phy0: PHY 0 on miibus1 > e1000phy0: 1000baseSX, 1000baseSX-FDX, auto > mskc0: [FILTER] > > # ifconfig msk0 > msk0: flags=8802 metric 0 mtu 1500 > options=11a > ether 00:21:91:52:4f:09 > media: Ethernet autoselect > > # ifconfig msk0 up > # ifconfig -m msk0 > msk0: flags=8843 metric 0 mtu 1500 > options=11a > capabilities=11a > ether 00:21:91:52:4f:09 > media: Ethernet autoselect (autoselect ) > status: active > supported media: > media autoselect > media 1000baseSX mediaopt full-duplex > media 1000baseSX > media none > > Switch and NIC see the link, but no packets pass through the interface. > > # ifconfig msk0 media 1000baseSX mediaopt full-duplex > # ifconfig msk0 > msk0: flags=8843 metric 0 mtu 1500 > options=11a > ether 00:21:91:52:4f:09 > media: Ethernet 1000baseSX (autoselect ) > status: active > > Again no packets are seen with tcpdump. > Switch counters show no incoming packets from NIC if I set an ip and try to generate some traffic. > > Any ideas? Try attached patch and let me know how it goes on your box. You can see statistics counters maintained in driver with sysctl. "sysctl dev.msk.0.stats" will show some numbers if it can see packets on wire. --+HP7ph2BbKc20aGI Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="msk.DGE560.diff" Index: sys/dev/msk/if_msk.c =================================================================== --- sys/dev/msk/if_msk.c (revision 196548) +++ sys/dev/msk/if_msk.c (working copy) @@ -3794,9 +3794,14 @@ /* Set receive filter. */ msk_rxfilter(sc_if); - /* Flush Rx MAC FIFO on any flow control or error. */ - CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, RX_GMF_FL_MSK), - GMR_FS_ANY_ERR); + if (sc->msk_hw_id == CHIP_ID_YUKON_XL) { + /* Clear flush mask - HW bug. */ + CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, RX_GMF_FL_MSK), 0); + } else { + /* Flush Rx MAC FIFO on any flow control or error. */ + CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, RX_GMF_FL_MSK), + GMR_FS_ANY_ERR); + } /* * Set Rx FIFO flush threshold to 64 bytes + 1 FIFO word Index: sys/dev/mii/e1000phy.c =================================================================== --- sys/dev/mii/e1000phy.c (revision 196548) +++ sys/dev/mii/e1000phy.c (working copy) @@ -150,6 +150,11 @@ case MII_MODEL_MARVELL_E1112: if (PHY_READ(sc, E1000_ESSR) & E1000_ESSR_FIBER_LINK) sc->mii_flags |= MIIF_HAVEFIBER; +#if 1 + /* XXX */ + sc->mii_flags |= MIIF_HAVEFIBER; + PHY_WRITE(sc, E1000_EADR, 0); +#endif break; case MII_MODEL_MARVELL_E1149: /* --+HP7ph2BbKc20aGI--