From owner-freebsd-drivers@FreeBSD.ORG Mon Jul 14 14:56:54 2008 Return-Path: Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EEEC91065672 for ; Mon, 14 Jul 2008 14:56:54 +0000 (UTC) (envelope-from mirnshi@gmail.com) Received: from el-out-1112.google.com (el-out-1112.google.com [209.85.162.180]) by mx1.freebsd.org (Postfix) with ESMTP id B97AB8FC17 for ; Mon, 14 Jul 2008 14:56:54 +0000 (UTC) (envelope-from mirnshi@gmail.com) Received: by el-out-1112.google.com with SMTP id v27so762748ele.13 for ; Mon, 14 Jul 2008 07:56:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:mime-version:content-type; bh=rc7yXTmaympevNyXkHc3knsL1IqOGagyhVoDKOPt6Po=; b=eM4oVtE37JToidc2B4tctL0FSDyvoe32zX7oMBLDKS/9EKm7ui4GHlCjW8hjyGU9pm LaGAglfdqC1zyA85qWXBLe9A4YcbHRph5QTvSyBBrwLKnd+056QxBedsYYMeQVOpxcNE TNswZQ3Nr+rUsQkzIAqqcng4GkYeW19kC6Dds= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type; b=ed/e2jZqCpwkOpIMtCrh80bR3HKdlnyrBM4JIDwkE32aJZqoYUv3N8GCyGPoX0HQFC Ggpzw0R8I6ARJCfH60EKwPvRM3PshJdr0FTM7MwGCaCdBPcIDtzNLjz5Vx8S8hVxp2zZ 3JCQHgT0sjDvguLLjeu5ktTomtnoPA6OD7OPE= Received: by 10.151.98.16 with SMTP id a16mr20326700ybm.233.1216045836307; Mon, 14 Jul 2008 07:30:36 -0700 (PDT) Received: by 10.150.157.5 with HTTP; Mon, 14 Jul 2008 07:30:36 -0700 (PDT) Message-ID: Date: Mon, 14 Jul 2008 22:30:36 +0800 From: mirnshi@gmail.com To: freebsd-drivers@freebsd.org MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_57398_27213851.1216045836272" X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: patch for Attansic L2 FastEthernet X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Jul 2008 14:56:55 -0000 ------=_Part_57398_27213851.1216045836272 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Recently, I got an eeepc 701. And I installed FreeBSD 7.0 on it . The url http://wiki.freebsd.org/AsusEee gives me a big hand. But, the driver of lan did not work. The problem is that the driver can be loaded by kldload, but the interrupt storm caused the system to stop responding when I use ifconfig to mark the nic 'up'. BTW, I used 10MB hub. The driver uses taskqueue_enqueue. 'ae_intr' reads nic register, but 'ae_int_task' reads it again. So I merge them into the new 'ae_intr'. I test 'ping' and 'ftp', it works well. Please refer to the patch for details. --- if_ae.c 2008-06-27 20:19:43.000000000 +0800 +++ /sys/dev/if_ae/if_ae.c 2008-07-14 21:54:06.000000000 +0800 @@ -1450,20 +1450,56 @@ { ae_softc_t *sc; uint32_t val; + struct ifnet *ifp; + struct mii_data *mii; sc = (ae_softc_t *)arg; + AE_LOCK(sc); KASSERT(sc != NULL, ("[ae, %d]: sc is null", __LINE__)); val = AE_READ_4(sc, AE_ISR_REG); - if (val == 0 || (val & AE_IMR_DEFAULT) == 0) + if (val == 0 || (val & AE_IMR_DEFAULT) == 0) { + AE_UNLOCK(sc); return FILTER_STRAY; + } - /* Disable interrupts. */ - AE_WRITE_4(sc, AE_ISR_REG, AE_ISR_DISABLE); + /* Clear interrupts and disable them. */ + AE_WRITE_4(sc, AE_ISR_REG, val | AE_ISR_DISABLE); - /* Schedule interrupt processing. */ - taskqueue_enqueue(sc->tq, &sc->int_task); + ifp = sc->ifp; + if ((val & AE_ISR_PHY) != 0) { + /* + * Clear PHY interrupt. Not sure if it needed. From Linux. + */ + ae_miibus_readreg(sc->miibus, 1, 19); + } + +#ifdef AE_DEBUG + if_printf(ifp, "Interrupt received: 0x%08x\n", val); +#endif + + if ((val & (AE_ISR_PHY | AE_ISR_MANUAL)) != 0) { + mii = device_get_softc(sc->miibus); + mii_mediachg(mii); + } + + if ((val & (AE_ISR_DMAR_TIMEOUT | AE_ISR_DMAW_TIMEOUT | + AE_ISR_PHY_LINKDOWN)) != 0) { + ae_init_locked(sc); + } + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) { + if ((val & AE_ISR_TX_EVENT) != 0) + ae_tx_intr(sc); + + if ((val & AE_ISR_RX_EVENT) != 0) + ae_rx_intr(sc); + } + + /* Re-enable interrupts. */ + AE_WRITE_4(sc, AE_ISR_REG, 0); + + AE_UNLOCK(sc); return (FILTER_HANDLED); } ------=_Part_57398_27213851.1216045836272-- From owner-freebsd-drivers@FreeBSD.ORG Tue Jul 15 01:10:36 2008 Return-Path: Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6343C106566B for ; Tue, 15 Jul 2008 01:10:36 +0000 (UTC) (envelope-from pyunyh@gmail.com) Received: from rv-out-0506.google.com (rv-out-0506.google.com [209.85.198.236]) by mx1.freebsd.org (Postfix) with ESMTP id 383558FC19 for ; Tue, 15 Jul 2008 01:10:36 +0000 (UTC) (envelope-from pyunyh@gmail.com) Received: by rv-out-0506.google.com with SMTP id b25so6168398rvf.43 for ; Mon, 14 Jul 2008 18:10:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:received:received:date:from :to:cc:subject:message-id:reply-to:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=m9i8S40noYQsxQVA7GEgDd3WR/04WBmuvJn9l8DQTas=; b=nbo1ylESFpGHwvIbib0pROW8nzr9MbM8iN4uvyXOWZk/lsio5j8ieZ+vJBru6mZqwE 9JaYzN8Nydasm4Ef5Mc2CroXYH3GnZmDl6mCqAQEm/7+gfi9MfxofA5r1zGSW++9Zz+H ZrLco6GPA1PBIUuT6RlvR9HWKFMN5wq7Aynjg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:reply-to:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=kjBcBSdjZZFt2wuGaeRKIUvNkhV1lDYLWtW5VMdFdhjz7UiaOMFDkgstShgsAbmdAA bwYJblqbURuumtDKO9rXCbwrSK9pO5s9As387mnUJdTxoLC5wv1Zvh8g9MC2uDTOxp4o 27ixBjaTtmB7+qxt9yZuZEVzS7hrpgvSzkXR4= Received: by 10.140.165.21 with SMTP id n21mr7010490rve.97.1216082712542; Mon, 14 Jul 2008 17:45:12 -0700 (PDT) Received: from michelle.cdnetworks.co.kr ( [211.53.35.84]) by mx.google.com with ESMTPS id l31sm9684168rvb.6.2008.07.14.17.45.09 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 14 Jul 2008 17:45:11 -0700 (PDT) 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 m6F0h18R040474 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 15 Jul 2008 09:43:01 +0900 (KST) (envelope-from pyunyh@gmail.com) Received: (from yongari@localhost) by michelle.cdnetworks.co.kr (8.13.5/8.13.5/Submit) id m6F0h1Sf040473; Tue, 15 Jul 2008 09:43:01 +0900 (KST) (envelope-from pyunyh@gmail.com) Date: Tue, 15 Jul 2008 09:43:01 +0900 From: Pyun YongHyeon To: mirnshi@gmail.com Message-ID: <20080715004301.GB40212@cdnetworks.co.kr> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.1i Cc: freebsd-drivers@freebsd.org Subject: Re: patch for Attansic L2 FastEthernet X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: pyunyh@gmail.com List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Jul 2008 01:10:36 -0000 On Mon, Jul 14, 2008 at 10:30:36PM +0800, mirnshi@gmail.com wrote: > Recently, I got an eeepc 701. And I installed FreeBSD 7.0 on it . The url > http://wiki.freebsd.org/AsusEee gives me a big hand. But, the driver of lan > did not work. The problem is that the driver can be loaded by kldload, but > the interrupt storm caused the system to stop responding when I use ifconfig > to mark the nic 'up'. BTW, I used 10MB hub. Sound like interrupts are enabled in taskqueue handler. > > The driver uses taskqueue_enqueue. 'ae_intr' reads nic register, but > 'ae_int_task' reads it again. So I merge them into the new 'ae_intr'. > I test 'ping' and 'ftp', it works well. > You can't hold a mutex in fast interrupt handler. Since there is no documentation for L2 controller I'm not sure but ae_int_task() seems to have a code that reenables interrupts which was already disabled in ae_intr(). How about nuking AE_ISR_DISABLE in ae_int_task()? From: /* Clear interrupts and disable them. */ AE_WRITE_4(sc, AE_ISR_REG, val | AE_ISR_DISABLE); To: /* Clear interrupts. */ AE_WRITE_4(sc, AE_ISR_REG, val); CCed to Stanislav Sedov, the author of driver. > Please refer to the patch for details. > > --- if_ae.c 2008-06-27 20:19:43.000000000 +0800 > +++ /sys/dev/if_ae/if_ae.c 2008-07-14 21:54:06.000000000 +0800 > @@ -1450,20 +1450,56 @@ > { > ae_softc_t *sc; > uint32_t val; > + struct ifnet *ifp; > + struct mii_data *mii; > > sc = (ae_softc_t *)arg; > + AE_LOCK(sc); > KASSERT(sc != NULL, ("[ae, %d]: sc is null", __LINE__)); > > val = AE_READ_4(sc, AE_ISR_REG); > - if (val == 0 || (val & AE_IMR_DEFAULT) == 0) > + if (val == 0 || (val & AE_IMR_DEFAULT) == 0) { > + AE_UNLOCK(sc); > return FILTER_STRAY; > + } > > - /* Disable interrupts. */ > - AE_WRITE_4(sc, AE_ISR_REG, AE_ISR_DISABLE); > + /* Clear interrupts and disable them. */ > + AE_WRITE_4(sc, AE_ISR_REG, val | AE_ISR_DISABLE); > > - /* Schedule interrupt processing. */ > - taskqueue_enqueue(sc->tq, &sc->int_task); > + ifp = sc->ifp; > > + if ((val & AE_ISR_PHY) != 0) { > + /* > + * Clear PHY interrupt. Not sure if it needed. From Linux. > + */ > + ae_miibus_readreg(sc->miibus, 1, 19); > + } > + > +#ifdef AE_DEBUG > + if_printf(ifp, "Interrupt received: 0x%08x\n", val); > +#endif > + > + if ((val & (AE_ISR_PHY | AE_ISR_MANUAL)) != 0) { > + mii = device_get_softc(sc->miibus); > + mii_mediachg(mii); > + } > + > + if ((val & (AE_ISR_DMAR_TIMEOUT | AE_ISR_DMAW_TIMEOUT | > + AE_ISR_PHY_LINKDOWN)) != 0) { > + ae_init_locked(sc); > + } > + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) { > + if ((val & AE_ISR_TX_EVENT) != 0) > + ae_tx_intr(sc); > + > + if ((val & AE_ISR_RX_EVENT) != 0) > + ae_rx_intr(sc); > + } > + > + /* Re-enable interrupts. */ > + AE_WRITE_4(sc, AE_ISR_REG, 0); > + > + AE_UNLOCK(sc); > return (FILTER_HANDLED); > } -- Regards, Pyun YongHyeon From owner-freebsd-drivers@FreeBSD.ORG Tue Jul 15 02:11:36 2008 Return-Path: Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 52662106564A for ; Tue, 15 Jul 2008 02:11:36 +0000 (UTC) (envelope-from mirnshi@gmail.com) Received: from yw-out-2324.google.com (yw-out-2324.google.com [74.125.46.28]) by mx1.freebsd.org (Postfix) with ESMTP id EA74A8FC1F for ; Tue, 15 Jul 2008 02:11:35 +0000 (UTC) (envelope-from mirnshi@gmail.com) Received: by yw-out-2324.google.com with SMTP id 9so2165333ywe.13 for ; Mon, 14 Jul 2008 19:11:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type:references; bh=EzgMo10+7GT5Jue3+d4Cpsb2U5yf7//KfXkVgX82O6M=; b=PyEnWfEhZqEivtfGrj8zrBMbEpQXSJS2tOQ8qK5F8Ws7Bj5/txvAyaLFSLyFCxsThj Q/3AekN9ZB+/D0esa5YMqj150EzRTUCY55YYOs5bfK2Z3JEf/zNimyRFWIiQJXz3lA9r E+bBabkbYB+RLaJP0OYFn4HMqiyDJ9F0p1Yng= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:references; b=iw564bp//Rr1uru97yuXE+fWD6EMEveRAdxxhpTOpEYk1NcLikdkhsIctkISBVD9ho boOSXArr/1bvc4SfLmT8FC4L4tQTIM5jxDmXzG5Wjg8vo9s1OCj9XC/nXuvaIBQZVeCS Ml4NZFPlcpZxoQYtUWA6tdCpV9pvEgrEsSGkY= Received: by 10.151.12.4 with SMTP id p4mr16801862ybi.76.1216087883988; Mon, 14 Jul 2008 19:11:23 -0700 (PDT) Received: by 10.150.157.5 with HTTP; Mon, 14 Jul 2008 19:11:23 -0700 (PDT) Message-ID: Date: Tue, 15 Jul 2008 10:11:23 +0800 From: mirnshi@gmail.com To: pyunyh@gmail.com In-Reply-To: <20080715004301.GB40212@cdnetworks.co.kr> MIME-Version: 1.0 References: <20080715004301.GB40212@cdnetworks.co.kr> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: freebsd-drivers@freebsd.org Subject: Re: patch for Attansic L2 FastEthernet X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Jul 2008 02:11:36 -0000 2008/7/15 Pyun YongHyeon : > On Mon, Jul 14, 2008 at 10:30:36PM +0800, mirnshi@gmail.com wrote: > > Recently, I got an eeepc 701. And I installed FreeBSD 7.0 on it . The > url > > http://wiki.freebsd.org/AsusEee gives me a big hand. But, the driver of > lan > > did not work. The problem is that the driver can be loaded by kldload, > but > > the interrupt storm caused the system to stop responding when I use > ifconfig > > to mark the nic 'up'. BTW, I used 10MB hub. > > Sound like interrupts are enabled in taskqueue handler. > > > > > The driver uses taskqueue_enqueue. 'ae_intr' reads nic register, but > > 'ae_int_task' reads it again. So I merge them into the new 'ae_intr'. > > I test 'ping' and 'ftp', it works well. > > > > You can't hold a mutex in fast interrupt handler. Do you mean the driver will slow down? Many GB driver use LOCK in their xxx_intr. > Since there is no documentation for L2 controller I'm not sure but > ae_int_task() seems to have a code that reenables interrupts which > was already disabled in ae_intr(). How about nuking AE_ISR_DISABLE > in ae_int_task()? > > From: > /* Clear interrupts and disable them. */ > AE_WRITE_4(sc, AE_ISR_REG, val | AE_ISR_DISABLE); > > To: > /* Clear interrupts. */ > AE_WRITE_4(sc, AE_ISR_REG, val); enable or disable the interrupt? I think this code enable the interrupt, right? Stanislav did not write the status word back, just disable the interrupt. AE_WRITE_4(sc, AE_ISR_REG, AE_ISR_DISABLE); but, the linux does it AT_WRITE_REG(hw, REG_ISR, status|ISR_DIS_INT); In 'ae_int_task', Stanislav read the status word again, like in linux, write back. val = AE_READ_4(sc, AE_ISR_REG); AE_WRITE_4(sc, AE_ISR_REG, val | AE_ISR_DISABLE); Is the status word still there ? > CCed to Stanislav Sedov, the author of driver. > > > Please refer to the patch for details. > > > > --- if_ae.c 2008-06-27 20:19:43.000000000 +0800 > > +++ /sys/dev/if_ae/if_ae.c 2008-07-14 21:54:06.000000000 +0800 > > @@ -1450,20 +1450,56 @@ > > { > > ae_softc_t *sc; > > uint32_t val; > > + struct ifnet *ifp; > > + struct mii_data *mii; > > > > sc = (ae_softc_t *)arg; > > + AE_LOCK(sc); > > KASSERT(sc != NULL, ("[ae, %d]: sc is null", __LINE__)); > > > > val = AE_READ_4(sc, AE_ISR_REG); > > - if (val == 0 || (val & AE_IMR_DEFAULT) == 0) > > + if (val == 0 || (val & AE_IMR_DEFAULT) == 0) { > > + AE_UNLOCK(sc); > > return FILTER_STRAY; > > + } > > > > - /* Disable interrupts. */ > > - AE_WRITE_4(sc, AE_ISR_REG, AE_ISR_DISABLE); > > + /* Clear interrupts and disable them. */ > > + AE_WRITE_4(sc, AE_ISR_REG, val | AE_ISR_DISABLE); > > > > - /* Schedule interrupt processing. */ > > - taskqueue_enqueue(sc->tq, &sc->int_task); > > + ifp = sc->ifp; > > > > + if ((val & AE_ISR_PHY) != 0) { > > + /* > > + * Clear PHY interrupt. Not sure if it needed. From Linux. > > + */ > > + ae_miibus_readreg(sc->miibus, 1, 19); > > + } > > + > > +#ifdef AE_DEBUG > > + if_printf(ifp, "Interrupt received: 0x%08x\n", val); > > +#endif > > + > > + if ((val & (AE_ISR_PHY | AE_ISR_MANUAL)) != 0) { > > + mii = device_get_softc(sc->miibus); > > + mii_mediachg(mii); > > + } > > + > > + if ((val & (AE_ISR_DMAR_TIMEOUT | AE_ISR_DMAW_TIMEOUT | > > + AE_ISR_PHY_LINKDOWN)) != 0) { > > + ae_init_locked(sc); > > + } > > + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) { > > + if ((val & AE_ISR_TX_EVENT) != 0) > > + ae_tx_intr(sc); > > + > > + if ((val & AE_ISR_RX_EVENT) != 0) > > + ae_rx_intr(sc); > > + } > > + > > + /* Re-enable interrupts. */ > > + AE_WRITE_4(sc, AE_ISR_REG, 0); > > + > > + AE_UNLOCK(sc); > > return (FILTER_HANDLED); > > } > > -- > Regards, > Pyun YongHyeon > From owner-freebsd-drivers@FreeBSD.ORG Tue Jul 15 23:29:21 2008 Return-Path: Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 39C55106566C for ; Tue, 15 Jul 2008 23:29:21 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from smtp.ht-systems.ru (mr0.ht-systems.ru [78.110.50.55]) by mx1.freebsd.org (Postfix) with ESMTP id 9E7E18FC0C for ; Tue, 15 Jul 2008 23:29:20 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from [85.21.245.235] (helo=stal.SpringDaemons.com) by smtp.ht-systems.ru with esmtpa (Exim 4.62) (envelope-from ) id 1KItAi-0008VD-Rc; Wed, 16 Jul 2008 02:39:01 +0400 Received: from stal.SpringDaemons.com (localhost [127.0.0.1]) by stal.SpringDaemons.com (Postfix) with SMTP id A25F12285B; Wed, 16 Jul 2008 02:39:07 +0400 (MSD) Date: Wed, 16 Jul 2008 02:39:07 +0400 From: Stanislav Sedov To: mirnshi@gmail.com Message-Id: <20080716023907.d11f15b2.stas@FreeBSD.org> In-Reply-To: References: <20080715004301.GB40212@cdnetworks.co.kr> Organization: The FreeBSD Project X-Mailer: Sylpheed 2.5.0 (GTK+ 2.12.10; i386-portbld-freebsd6.3) Mime-Version: 1.0 Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg="PGP-SHA1"; boundary="Signature=_Wed__16_Jul_2008_02_39_07_+0400_CS8TFO5FFqhy6XSI" Cc: freebsd-drivers@freebsd.org Subject: Re: patch for Attansic L2 FastEthernet X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Jul 2008 23:29:21 -0000 --Signature=_Wed__16_Jul_2008_02_39_07_+0400_CS8TFO5FFqhy6XSI Content-Type: text/plain; charset=US-ASCII Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, 15 Jul 2008 10:11:23 +0800 mirnshi@gmail.com mentioned: >=20 > Do you mean the driver will slow down? Many GB driver use LOCK in their > xxx_intr. >=20 You just can't hold locks in FILTER isrs. If you need locking, you're definitely not going to use fast interrupt handlers. And I see no good reason not to use them. >=20 > > Since there is no documentation for L2 controller I'm not sure but > > ae_int_task() seems to have a code that reenables interrupts which > > was already disabled in ae_intr(). How about nuking AE_ISR_DISABLE > > in ae_int_task()? > > > > From: > > /* Clear interrupts and disable them. */ > > AE_WRITE_4(sc, AE_ISR_REG, val | AE_ISR_DISABLE); > > > > To: > > /* Clear interrupts. */ > > AE_WRITE_4(sc, AE_ISR_REG, val); >=20 >=20 > enable or disable the interrupt? I think this code enable the interrupt, > right? >=20 > Stanislav did not write the status word back, just disable the interrupt. > AE_WRITE_4(sc, AE_ISR_REG, AE_ISR_DISABLE); > but, the linux does it > AT_WRITE_REG(hw, REG_ISR, status|ISR_DIS_INT); >=20 > In 'ae_int_task', Stanislav read the status word again, like in linux, wr= ite > back. > val =3D AE_READ_4(sc, AE_ISR_REG); > AE_WRITE_4(sc, AE_ISR_REG, val | AE_ISR_DISABLE); >=20 > Is the status word still there ? >=20 That's because I need to pass ISR status word between fast interrupt handler and the actual isr processor. Thus I just disable interrupts in filter, and clear the interrupt status word after processing in ae_int_task. >=20 >=20 > > CCed to Stanislav Sedov, the author of driver. > > > > > Please refer to the patch for details. > > > > > > --- if_ae.c 2008-06-27 20:19:43.000000000 +0800 > > > +++ /sys/dev/if_ae/if_ae.c 2008-07-14 21:54:06.000000000 +0800 > > > @@ -1450,20 +1450,56 @@ > > > { > > > ae_softc_t *sc; > > > uint32_t val; > > > + struct ifnet *ifp; > > > + struct mii_data *mii; > > > > > > sc =3D (ae_softc_t *)arg; > > > + AE_LOCK(sc); > > > KASSERT(sc !=3D NULL, ("[ae, %d]: sc is null", __LINE__)); > > > > > > val =3D AE_READ_4(sc, AE_ISR_REG); > > > - if (val =3D=3D 0 || (val & AE_IMR_DEFAULT) =3D=3D 0) > > > + if (val =3D=3D 0 || (val & AE_IMR_DEFAULT) =3D=3D 0) { > > > + AE_UNLOCK(sc); > > > return FILTER_STRAY; > > > + } > > > > > > - /* Disable interrupts. */ > > > - AE_WRITE_4(sc, AE_ISR_REG, AE_ISR_DISABLE); > > > + /* Clear interrupts and disable them. */ > > > + AE_WRITE_4(sc, AE_ISR_REG, val | AE_ISR_DISABLE); > > > > > > - /* Schedule interrupt processing. */ > > > - taskqueue_enqueue(sc->tq, &sc->int_task); > > > + ifp =3D sc->ifp; > > > > > > + if ((val & AE_ISR_PHY) !=3D 0) { > > > + /* > > > + * Clear PHY interrupt. Not sure if it needed. From Linux. > > > + */ > > > + ae_miibus_readreg(sc->miibus, 1, 19); > > > + } > > > + > > > +#ifdef AE_DEBUG > > > + if_printf(ifp, "Interrupt received: 0x%08x\n", val); > > > +#endif > > > + > > > + if ((val & (AE_ISR_PHY | AE_ISR_MANUAL)) !=3D 0) { > > > + mii =3D device_get_softc(sc->miibus); > > > + mii_mediachg(mii); > > > + } > > > + > > > + if ((val & (AE_ISR_DMAR_TIMEOUT | AE_ISR_DMAW_TIMEOUT | > > > + AE_ISR_PHY_LINKDOWN)) !=3D 0) { > > > + ae_init_locked(sc); > > > + } > > > + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) !=3D 0) { > > > + if ((val & AE_ISR_TX_EVENT) !=3D 0) > > > + ae_tx_intr(sc); > > > + > > > + if ((val & AE_ISR_RX_EVENT) !=3D 0) > > > + ae_rx_intr(sc); > > > + } > > > + > > > + /* Re-enable interrupts. */ > > > + AE_WRITE_4(sc, AE_ISR_REG, 0); > > > + > > > + AE_UNLOCK(sc); > > > return (FILTER_HANDLED); > > > } > > I don't see how this can help with your issue. One guy has reported he's able to stably reproduce the bug by booting into FreeBSD just after Linux touches the hardware. This explains why I've never seen that, as I never booted Linux on my box. I think the problem caused by the ukphy driver which just can't handle the F2 phy. I plan to use agephy to handle the Attansic L2 phy also. Please, wait a couple of days - I'll try to reproduce the problem, and incorporate appropriate fixes. Also, as was mentioned in my previous mail, the drives isn't complete now - there're a lot of places that had to be fixed, not speaking of the public version of the driver isn't the latest one. I'm a bit busy now, but I hope I'll roll out the updated version by the end of the week. --=20 Stanislav Sedov ST4096-RIPE --Signature=_Wed__16_Jul_2008_02_39_07_+0400_CS8TFO5FFqhy6XSI Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (FreeBSD) iEYEARECAAYFAkh9JwsACgkQK/VZk+smlYHgJgCfcpAQ7dORRL/U4m++CqFOaqXl cLkAnRmHFq/uK3nygKKW4lEM00dcQR+c =AGoz -----END PGP SIGNATURE----- --Signature=_Wed__16_Jul_2008_02_39_07_+0400_CS8TFO5FFqhy6XSI-- From owner-freebsd-drivers@FreeBSD.ORG Wed Jul 16 14:15:39 2008 Return-Path: Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3133B106564A for ; Wed, 16 Jul 2008 14:15:39 +0000 (UTC) (envelope-from Satendra.Pratap@citrix.com) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by mx1.freebsd.org (Postfix) with ESMTP id EE73E8FC12 for ; Wed, 16 Jul 2008 14:15:38 +0000 (UTC) (envelope-from Satendra.Pratap@citrix.com) X-IronPort-AV: E=Sophos;i="4.30,373,1212379200"; d="scan'208,217";a="983830" Received: from sjcpexch02.citrite.net ([10.216.4.38]) by FTLPIPO01.CITRIX.COM with ESMTP; 16 Jul 2008 09:46:29 -0400 Received: from banpexch01.citrite.net ([10.103.128.11]) by sjcpexch02.citrite.net with Microsoft SMTPSVC(6.0.3790.3959); Wed, 16 Jul 2008 06:46:28 -0700 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Date: Wed, 16 Jul 2008 19:16:25 +0530 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Regarding Broadcom driver for Linux tg3.c Thread-Index: AcjnSlbXanCeU4oDSKKdZIlg+o57HA== From: "Satendra Pratap" To: X-OriginalArrivalTime: 16 Jul 2008 13:46:28.0975 (UTC) FILETIME=[592C97F0:01C8E74A] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: Regarding Broadcom driver for Linux tg3.c X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Jul 2008 14:15:39 -0000 =20 Can anyone please let me know which code in Broadcom driver informs about the link failure to its Link partner when Broadcom NIC goes into disable (OR error disable) state? Actually I found that code but that code does inform the link partner and immediately comes up again. =20 Any help is appreciated. =20 Thanks, =20