From owner-freebsd-stable@FreeBSD.ORG Fri Feb 13 11:37:03 2009 Return-Path: Delivered-To: stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6D592106564A for ; Fri, 13 Feb 2009 11:37:03 +0000 (UTC) (envelope-from pyunyh@gmail.com) Received: from rv-out-0506.google.com (rv-out-0506.google.com [209.85.198.225]) by mx1.freebsd.org (Postfix) with ESMTP id 33CFA8FC19 for ; Fri, 13 Feb 2009 11:37:02 +0000 (UTC) (envelope-from pyunyh@gmail.com) Received: by rv-out-0506.google.com with SMTP id f6so706904rvb.43 for ; Fri, 13 Feb 2009 03:37:02 -0800 (PST) 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=VyPQhsyH/SYXXGztx1e/ILpnCWPwgt/kfxB13KVPtzw=; b=qWbwGlVMVwNnojT5d0vGHZTBLY1FTyU4aU396KOm2lESEdvdX2/0QrXcKZR1dLUcIK bhjXRQSu1GUqkyJBHkakYa/dvYJ4YaPNqBm6VYE4I5aRIwvQaRJ5OIxBSnvWvxPCJ4Jz QD6lBlzM13EN+1KTPJ6QzD2MEfQboaHMUQxDg= 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=THqNl1fDVrxIO9oZrZgMPRor5q7nYbdJSMNVLvA8ExoQfE1HVdx8ZriUo+ko8tF0bM Hwx+okTZjB8SKKnTL+xKaSasYOpEkY+R37ZEKf+OR0/HerSV4ctu08K912GFyDrTBzcN G9vw+xWbp/wRHMl/ULRPRitb1JAglR0FLmtlg= Received: by 10.141.153.16 with SMTP id f16mr1097877rvo.272.1234525022742; Fri, 13 Feb 2009 03:37:02 -0800 (PST) Received: from michelle.cdnetworks.co.kr ([114.111.62.249]) by mx.google.com with ESMTPS id k37sm1254428rvb.1.2009.02.13.03.37.00 (version=SSLv3 cipher=RC4-MD5); Fri, 13 Feb 2009 03:37:01 -0800 (PST) Received: by michelle.cdnetworks.co.kr (sSMTP sendmail emulation); Fri, 13 Feb 2009 20:39:55 +0900 From: Pyun YongHyeon Date: Fri, 13 Feb 2009 20:39:55 +0900 To: Gerrit K?hn Message-ID: <20090213113955.GE12653@michelle.cdnetworks.co.kr> References: <20090204100507.5f223d9e.gerrit@pmp.uni-hannover.de> <20090204104655.GA73543@michelle.cdnetworks.co.kr> <20090205085812.b2deb1f7.gerrit@pmp.uni-hannover.de> <20090205082804.GD77461@michelle.cdnetworks.co.kr> <20090213101910.a126c14d.gerrit@pmp.uni-hannover.de> <20090213102400.GD12653@michelle.cdnetworks.co.kr> <20090213114143.a77f1acb.gerrit@pmp.uni-hannover.de> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="fUYQa+Pmc3FrFX/N" Content-Disposition: inline In-Reply-To: <20090213114143.a77f1acb.gerrit@pmp.uni-hannover.de> User-Agent: Mutt/1.4.2.3i Cc: stable@freebsd.org Subject: Re: fun with if_re X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: pyunyh@gmail.com List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Feb 2009 11:37:03 -0000 --fUYQa+Pmc3FrFX/N Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, Feb 13, 2009 at 11:41:43AM +0100, Gerrit K?hn wrote: > On Fri, 13 Feb 2009 19:24:00 +0900 Pyun YongHyeon wrote > about Re: fun with if_re: > > PY> > I had to reboot some of the machines meanwhile and could do some > PY> > further testing. One strange thing I noticed is that the > PY> > re-interfaces often do not come up in a working state after > PY> > rebooting. Strangely, I see network traffic floating around via > PY> > tcpdump, but not even ping works. This state often goes away when > PY> > playing around with the interface (sometimes ifconfig down/up helps, > PY> > sometimes disabling some of the additional features like txc/rxc), > PY> > but I cannot make out a reproducible behaviour so far. When the > PY> > interface leaves this strange state it seems to work fine > PY> > afterwards. Any clues? > > PY> Does this happen on latest if_re.c/if_rlreg.h? I guess jkim fixed > PY> this type of problem in r187483. If that have no effect please let > PY> me know. > > It happens on both versions: the old one from 11th Dec 08 I still had, and > the new one I built with the patches you recommended about a week ago. > if_re is 1.151 2009/01/20 20:22:28 jkim, if_rlreg is 1.94 2009/01/20 > 20:22:28 jkim for the latter. > Ok, try attached patch. --fUYQa+Pmc3FrFX/N Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="re.8169sc.diff" Index: sys/dev/re/if_re.c =================================================================== --- sys/dev/re/if_re.c (revision 187352) +++ sys/dev/re/if_re.c (working copy) @@ -158,6 +158,8 @@ /* Tunables. */ static int msi_disable = 1; TUNABLE_INT("hw.re.msi_disable", &msi_disable); +static int prefer_iomap = 0; +TUNABLE_INT("hw.re.prefer_iomap", &prefer_iomap); #define RE_CSUM_FEATURES (CSUM_IP | CSUM_TCP | CSUM_UDP) @@ -1131,26 +1133,36 @@ pci_enable_busmaster(dev); devid = pci_get_device(dev); - /* Prefer memory space register mapping over IO space. */ - sc->rl_res_id = PCIR_BAR(1); - sc->rl_res_type = SYS_RES_MEMORY; - /* RTL8168/8101E seems to use different BARs. */ - if (devid == RT_DEVICEID_8168 || devid == RT_DEVICEID_8101E) - sc->rl_res_id = PCIR_BAR(2); + /* + * Prefer memory space register mapping over IO space. + * Because RTL8169SC does not seem to work when memory mapping + * is used always activate io mapping. + */ + if (devid == RT_DEVICEID_8169SC) + prefer_iomap = 1; + if (prefer_iomap == 0) { + sc->rl_res_id = PCIR_BAR(1); + sc->rl_res_type = SYS_RES_MEMORY; + /* RTL8168/8101E seems to use different BARs. */ + if (devid == RT_DEVICEID_8168 || devid == RT_DEVICEID_8101E) + sc->rl_res_id = PCIR_BAR(2); + } else { + sc->rl_res_id = PCIR_BAR(0); + sc->rl_res_type = SYS_RES_IOPORT; + } sc->rl_res = bus_alloc_resource_any(dev, sc->rl_res_type, &sc->rl_res_id, RF_ACTIVE); - - if (sc->rl_res == NULL) { + if (sc->rl_res == NULL && prefer_iomap == 0) { sc->rl_res_id = PCIR_BAR(0); sc->rl_res_type = SYS_RES_IOPORT; sc->rl_res = bus_alloc_resource_any(dev, sc->rl_res_type, &sc->rl_res_id, RF_ACTIVE); - if (sc->rl_res == NULL) { - device_printf(dev, "couldn't map ports/memory\n"); - error = ENXIO; - goto fail; - } } + if (sc->rl_res == NULL) { + device_printf(dev, "couldn't map ports/memory\n"); + error = ENXIO; + goto fail; + } sc->rl_btag = rman_get_bustag(sc->rl_res); sc->rl_bhandle = rman_get_bushandle(sc->rl_res); --fUYQa+Pmc3FrFX/N--