From owner-p4-projects@FreeBSD.ORG Sat Feb 4 02:42:46 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id A058A16A423; Sat, 4 Feb 2006 02:42:45 +0000 (GMT) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6582616A420 for ; Sat, 4 Feb 2006 02:42:45 +0000 (GMT) (envelope-from cognet@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7B17E43D53 for ; Sat, 4 Feb 2006 02:42:44 +0000 (GMT) (envelope-from cognet@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id k142giZV063341 for ; Sat, 4 Feb 2006 02:42:44 GMT (envelope-from cognet@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id k142giNw063338 for perforce@freebsd.org; Sat, 4 Feb 2006 02:42:44 GMT (envelope-from cognet@freebsd.org) Date: Sat, 4 Feb 2006 02:42:44 GMT Message-Id: <200602040242.k142giNw063338@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to cognet@freebsd.org using -f From: Olivier Houchard To: Perforce Change Reviews Cc: Subject: PERFORCE change 91025 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Feb 2006 02:42:46 -0000 http://perforce.freebsd.org/chv.cgi?CH=91025 Change 91025 by cognet@cognet on 2006/02/04 02:42:20 Use m_defrag to make sure we only have one mbuf. Enable RX and TX interrupts. TX seems to work, RX not yet, it doesn't even generate an interrupt when it receives a packet. Affected files ... .. //depot/projects/arm/src/sys/arm/at91/if_ate.c#24 edit Differences ... ==== //depot/projects/arm/src/sys/arm/at91/if_ate.c#24 (text+ko) ==== @@ -434,7 +434,7 @@ /* * The KB920x boot loader tests ETH_SR & ETH_SR_LINK and will ask * the MII if there's a link if this bit is clear. Not sure if we - * should do the same thing ehre or not. + * should do the same thing here or not. */ ATE_ASSERT_LOCKED(sc); if (sc->miibus != NULL) { @@ -528,6 +528,7 @@ status = RD4(sc, ETH_ISR); if (status == 0) return; + printf("IT IS %x\n", RD4(sc, ETH_RSR)); if (status & ETH_ISR_RCOM) { bus_dmamap_sync(sc->rx_desc_tag, sc->rx_desc_map, BUS_DMASYNC_POSTREAD); @@ -538,6 +539,7 @@ int rx_stat = sc->rx_descs[i].status; int nsegs; + printf("GOT ONE\n"); bus_dmamap_sync(sc->rxtag, sc->rx_map[i], BUS_DMASYNC_POSTREAD); bus_dmamap_unload(sc->rxtag, @@ -601,6 +603,11 @@ sc->txcur = 0; } } + if (status & ETH_ISR_RBNA) { + /* Workaround Errata #11 */ + WR4(sc, ETH_CTL, RD4(sc, ETH_CTL) &~ ETH_CTL_RE); + WR4(sc, ETH_CTL, RD4(sc, ETH_CTL) | ETH_CTL_RE); + } } /* @@ -635,6 +642,8 @@ #endif WR4(sc, ETH_CTL, RD4(sc, ETH_CTL) | ETH_CTL_TE | ETH_CTL_RE); + WR4(sc, ETH_IER, /*ETH_ISR_RCOM | ETH_ISR_TCOM | ETH_ISR_RBNA*/ + 0xffffffff); /* * Boot loader fills in MAC address. If that's not the case, then @@ -644,8 +653,6 @@ */ /* XXX need to setup multicast filters */ - /* XXX need to setup rx buffers and assoc structures */ - /* XXX need to enable appropriate interrupt masks */ /* * Set 'running' flag, and clear output active flag @@ -665,7 +672,7 @@ atestart_locked(struct ifnet *ifp) { struct ate_softc *sc = ifp->if_softc; - struct mbuf *m; + struct mbuf *m, *mdefrag; bus_dma_segment_t segs[1]; int nseg; @@ -694,8 +701,13 @@ ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; return; } + mdefrag = m_defrag(m, M_DONTWAIT); + if (mdefrag == NULL) { + m_freem(m); + return; + } + m = mdefrag; - m = m_pullup(m, m_length(m, NULL)); if (bus_dmamap_load_mbuf_sg(sc->mtag, sc->tx_map[sc->txcur], m, segs, &nseg, 0) != 0) { m_free(m);