Date: Sat, 4 Feb 2006 16:31:22 GMT From: Warner Losh <imp@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 91075 for review Message-ID: <200602041631.k14GVMpf022394@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=91075 Change 91075 by imp@imp_plunger on 2006/02/04 16:30:31 I think this is close to basically working now. Affected files ... .. //depot/projects/arm/src/sys/arm/at91/if_ate.c#27 edit Differences ... ==== //depot/projects/arm/src/sys/arm/at91/if_ate.c#27 (text+ko) ==== @@ -25,13 +25,13 @@ /* TODO: (in no order) * * 5) Setup RX buffers in ateinit_locked + * 8) Need to sync busdma goo in atestop + * 9) atestop should maybe free the mbufs? + * 10) On Rx, how do we get a new mbuf? * * 1) detach * 2) Free dma setup * 3) Turn on the clock in pmc and turn on pins? Turn off? - * 6) Interrupt bits as appropriate - * 7) Keep track of the mbufs in flight on TX and free them in the ISR. - * 8) Need to sync busdma goo in atestop */ #include <sys/cdefs.h> @@ -227,7 +227,7 @@ static int ate_detach(device_t dev) { - return EBUSY; /* XXX */ + return EBUSY; /* XXX TODO(1) */ } static void @@ -346,6 +346,7 @@ sc->rx_descs, ATE_MAX_RX_BUFFERS * sizeof(eth_rx_desc_t), ate_getaddr, sc, 0) != 0) goto errout; + /* XXX TODO(5) Put this in ateinit_locked? */ for (i = 0; i < ATE_MAX_RX_BUFFERS; i++) { bus_dma_segment_t seg; int nsegs; @@ -381,7 +382,7 @@ struct ate_softc *sc; sc = device_get_softc(dev); - /* XXX teardown busdma junk, below from fxp -- customize */ + /* XXX TODO(2) teardown busdma junk, below from fxp -- customize */ #if 0 if (sc->fxp_mtag) { for (i = 0; i < FXP_NRFABUFS; i++) { @@ -584,10 +585,12 @@ sc->rx_map[i], BUS_DMASYNC_POSTREAD); bus_dmamap_unload(sc->rxtag, sc->rx_map[i]); + WR4(sc, ETH_RSR, RD4(sc, ETH_RSR)); /* - * Clear the corresponding bits in RSR. + * Allocate a new buffer to replace this one. + * if we cannot, then we drop this packet + * and keep the old buffer we had. */ - WR4(sc, ETH_RSR, RD4(sc, ETH_RSR)); sc->rx_mbuf[i] = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); if (!sc->rx_mbuf[i]) { @@ -596,7 +599,7 @@ bus_dmamap_sync(sc->rx_desc_tag, sc->rx_desc_map, BUS_DMASYNC_PREWRITE); - break; + continue; } if (bus_dmamap_load_mbuf_sg(sc->rxtag, sc->rx_map[i], @@ -606,7 +609,7 @@ bus_dmamap_sync(sc->rx_desc_tag, sc->rx_desc_map, BUS_DMASYNC_PREWRITE); - break; + continue; } /* * For the last buffer, set the wrap bit so @@ -620,8 +623,6 @@ mb->m_len = rx_stat & ETH_LEN_MASK; (*sc->ifp->if_input)(sc->ifp, mb); break; - - } } } @@ -662,7 +663,8 @@ ATE_ASSERT_LOCKED(sc); /* - * XXX we need to turn on the EMAC clock in the pmc. With the + * XXX TODO(3) + * we need to turn on the EMAC clock in the pmc. With the * default boot loader, this is already turned on. However, we * need to think about how best to turn it on/off as the interface * is brought up/down, as well as dealing with the mii bus... @@ -698,7 +700,7 @@ * swapping to do. Again, if we need it (which I don't think we do). */ - /* XXX need to setup multicast filters */ + ate_setmcast(sc); /* * Set 'running' flag, and clear output active flag @@ -766,19 +768,16 @@ WR4(sc, ETH_TAR, segs[0].ds_addr); WR4(sc, ETH_TCR, segs[0].ds_len); - /* XXX the following is wrong, we need to keep track of the mbuf and - * only free it when the ISR fires indicating xmit complete. - */ - /* * Tap off here if there is a bpf listener. */ BPF_MTAP(ifp, m); - m_freem(m); /* - * Once we've queued one packet, we'll do the rest via the ISR + * Once we've queued one packet, we'll do the rest via the ISR, + * save off a pointer. */ + sc->sent_mbuf[1] = m; } static void @@ -843,7 +842,8 @@ WR4(sc, ETH_RSR, 0xffffffff); /* - * XXX need to worry about the busdma resources? Yes, I think we need + * XXX TODO(8) + * need to worry about the busdma resources? Yes, I think we need * to sync and unload them. We may also need to release the mbufs * that are assocaited with RX and TX operations. */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200602041631.k14GVMpf022394>