Date: Fri, 13 Feb 2009 20:39:55 +0900 From: Pyun YongHyeon <pyunyh@gmail.com> To: Gerrit K?hn <gerrit@pmp.uni-hannover.de> Cc: stable@freebsd.org Subject: Re: fun with if_re Message-ID: <20090213113955.GE12653@michelle.cdnetworks.co.kr> In-Reply-To: <20090213114143.a77f1acb.gerrit@pmp.uni-hannover.de> 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>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
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 <pyunyh@gmail.com> 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.
[-- Attachment #2 --]
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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090213113955.GE12653>
