PERFORCE change 91025 for review

Olivier Houchard cognet at FreeBSD.org
Fri Feb 3 18:42:46 PST 2006


http://perforce.freebsd.org/chv.cgi?CH=91025

Change 91025 by cognet at 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);


More information about the p4-projects mailing list