From owner-freebsd-net@FreeBSD.ORG Tue Oct 11 17:12:18 2011 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 62B131065670 for ; Tue, 11 Oct 2011 17:12:18 +0000 (UTC) (envelope-from pyunyh@gmail.com) Received: from mail-ww0-f50.google.com (mail-ww0-f50.google.com [74.125.82.50]) by mx1.freebsd.org (Postfix) with ESMTP id EC27F8FC14 for ; Tue, 11 Oct 2011 17:12:17 +0000 (UTC) Received: by wwe3 with SMTP id 3so10407509wwe.31 for ; Tue, 11 Oct 2011 10:12:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; 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; bh=um8uD3sl7jhTA0qfuf1P2qkuNbwNdJzFQvg+frl5jgs=; b=OKZzdWnssQycCn3T9wVrJllzb+nGaTovCyogzqzxWjtm+2FukHtn51pPYs6GNdoF5H SXNarIkSm+CREMwlukxWmhS+67IrxPwho+R4QX61hoZT5FDi4+lQyESvZ28LDksPn67m jMU6J+U0hHGYgSQHFD8dfgkPu/sgSF3U65tGA= Received: by 10.216.203.79 with SMTP id e57mr1153245weo.12.1318353136927; Tue, 11 Oct 2011 10:12:16 -0700 (PDT) Received: from pyunyh@gmail.com ([174.35.1.224]) by mx.google.com with ESMTPS id p2sm39559956wbo.17.2011.10.11.10.12.12 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 11 Oct 2011 10:12:15 -0700 (PDT) Received: by pyunyh@gmail.com (sSMTP sendmail emulation); Tue, 11 Oct 2011 10:10:29 -0700 From: YongHyeon PYUN Date: Tue, 11 Oct 2011 10:10:29 -0700 To: Karim Message-ID: <20111011171029.GA5661@michelle.cdnetworks.com> References: <4E94637A.5090607@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4E94637A.5090607@gmail.com> User-Agent: Mutt/1.4.2.3i Cc: freebsd-net@freebsd.org Subject: Re: if_msk.c link negotiation / packet drops 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, 11 Oct 2011 17:12:18 -0000 On Tue, Oct 11, 2011 at 11:40:42AM -0400, Karim wrote: > Hi List, > > Using a Marvell NIC plugged into a CISCO switch I see the > auto-negotiation failing and even when forcing the device to full-duplex > we sometimes see packet drops. > > Here is the device description from dmesg: > > mskc0: port 0xbe00-0xbeff mem > 0xfdefc000-0xfdefffff irq 16 at device 0.0 on pci1 > msk0: on mskc0 > msk0: Ethernet address: 00:03:2d:09:94:52 > miibus0: on msk0 > e1000phy0: PHY 0 on miibus0 > e1000phy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT, > 1000baseT-master, 1000baseT-FDX, 1000baseT-FDX-master, auto, auto-flow > mskc0: [ITHREAD] > > The switch its plugged in (Cisco) is configured for 100baseTX full-duplex. > > ifconfig reports: > > msk0: > flags=608843 > metric 0 mtu 1500 > options=40018 The flags and options show that you're using very customized driver, right? > ether 00:03:2d:09:94:52 > inet 192.168.122.7 netmask 0xffffff00 broadcast 192.168.122.255 > media: Ethernet autoselect (100baseTX ) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Resolved duplex is half so I guess it would be normal to see dropped frames which may be triggered by collision. > status: active > > I added a bit of debugging code in e1000phy_status in the hope to > understand what was going on: > > bmsr = PHY_READ(sc, E1000_SR) | PHY_READ(sc, E1000_SR); > bmcr = PHY_READ(sc, E1000_CR); > ssr = PHY_READ(sc, E1000_SSR); > > printf("%s ssr 0x%x bmsr 0x%x bmcr 0x%x\n", __func__, ssr, bmsr, bmcr); > > Which consistently gives: > > kernel: e1000phy_status ssr 0x4d00 bmsr 0x796d bmcr 0x1000 > This register value is consistent with media status of ifconfig output. The real question is why auto-negotiation does not work against your switch. It could be a bug in switch side and if you have to manually set full-duplex with msk(4), please make sure your switch's duplex configuration also should be manually set to full-duplex. Otherwise resolved duplex is half. > Now and then the system will report the device is going inactive and we > can see packet drops when that happens. This repeat itself once in a > while without being predictable. > Check MAC H/W statistics counter and see any collisions(dev.msk.0.stats) > By the way on a 7.4 system this was happening every 10 min. Using a > driver from FBSD9 back ported to 7.4 we see the issue at a much lower > frequency (every 30 min) but the issue is still there. > > Cheers, > > Karim.