if (bus_dmamap_load(sc->sc_dmatag, sc->sc_rxmap_spare, mtod(m, caddr_t), MCLBYTES - HME_RX_OFFSET, NULL, BUS_DMA_NOWAIT) != 0) { if (d->sd_mbuf == NULL) return (ENOBUFS); m_freem(m); return (ENOBUFS); }  if (d->sd_loaded) { bus_dmamap_sync(sc->sc_dmatag, d->sd_map, 0, d->sd_map->dm_mapsize, BUS_DMASYNC_POSTREAD); bus_dmamap_unload(sc->sc_dmatag, d->sd_map); d->sd_loaded = 0; }
hme_newbuf(sc, d, freeit)	struct hme_softc *sc;	struct hme_sxd *d;	int freeit;{	struct mbuf *m;	bus_dmamap_t map;	MGETHDR(m, M_DONTWAIT, MT_DATA);	if (m == NULL)		return (ENOBUFS);	m->m_pkthdr.rcvif = &sc->sc_arpcom.ac_if;	MCLGET(m, M_DONTWAIT);	if ((m->m_flags & M_EXT) == 0) {		m_freem(m);		return (ENOBUFS);	}	if (d->sd_loaded) {		bus_dmamap_sync(sc->sc_dmatag, d->sd_map,		    0, d->sd_map->dm_mapsize, BUS_DMASYNC_POSTREAD);		bus_dmamap_unload(sc->sc_dmatag, d->sd_map);		d->sd_loaded = 0;	}	if (bus_dmamap_load(sc->sc_dmatag, sc->sc_rxmap_spare,	    mtod(m, caddr_t), MCLBYTES - HME_RX_OFFSET, NULL,	    BUS_DMA_NOWAIT) != 0) {		if (d->sd_mbuf == NULL)			return (ENOBUFS);		m_freem(m);		return (ENOBUFS);	}	if (d->sd_loaded) {		bus_dmamap_sync(sc->sc_dmatag, d->sd_map, 0,		    d->sd_map->dm_mapsize, BUS_DMASYNC_POSTREAD);		bus_dmamap_unload(sc->sc_dmatag, d->sd_map);		d->sd_loaded = 0;	}	if ((d->sd_mbuf != NULL) && freeit) {		m_freem(d->sd_mbuf);		d->sd_mbuf = NULL;	}	map = d->sd_map;	d->sd_map = sc->sc_rxmap_spare;	sc->sc_rxmap_spare = map;	d->sd_loaded = 1;	bus_dmamap_sync(sc->sc_dmatag, d->sd_map, 0, d->sd_map->dm_mapsize,	    BUS_DMASYNC_PREREAD);	m->m_data += HME_RX_OFFSET;	d->sd_mbuf = m;	return (0);}