From 3621da45f9138b041813c39d840420890916963c Mon Sep 17 00:00:00 2001 From: thib Date: Thu, 10 Jul 2008 18:14:59 +0000 Subject: [PATCH] move a common statement out of if/else; adjust the mbuf before loading it, with bus_dmamap_load_mbuf(), that way we dont have to fiddle with ds_addr; ok dlg@ --- sys/dev/pci/if_sis.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sys/dev/pci/if_sis.c b/sys/dev/pci/if_sis.c index 82aac88ac85..685dc5c3970 100644 --- a/sys/dev/pci/if_sis.c +++ b/sys/dev/pci/if_sis.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_sis.c,v 1.78 2008/07/07 12:53:43 thib Exp $ */ +/* $OpenBSD: if_sis.c,v 1.79 2008/07/10 18:14:59 thib Exp $ */ /* * Copyright (c) 1997, 1998, 1999 * Bill Paul . All rights reserved. @@ -1251,13 +1251,15 @@ sis_newbuf(struct sis_softc *sc, struct sis_desc *c, struct mbuf *m) m_freem(m_new); return (ENOBUFS); } - m_new->m_len = m_new->m_pkthdr.len = MCLBYTES; } else { m_new = m; - m_new->m_len = m_new->m_pkthdr.len = MCLBYTES; m_new->m_data = m_new->m_ext.ext_buf; } + m_new->m_len = m_new->m_pkthdr.len = MCLBYTES; + + m_adj(m_new, sizeof(u_int64_t)); + if (bus_dmamap_load_mbuf(sc->sc_dmat, sc->sc_rx_sparemap, m_new, BUS_DMA_NOWAIT)) { m_freem(m_new); @@ -1271,10 +1273,8 @@ sis_newbuf(struct sis_softc *sc, struct sis_desc *c, struct mbuf *m) bus_dmamap_sync(sc->sc_dmat, c->map, 0, c->map->dm_mapsize, BUS_DMASYNC_PREREAD); - m_adj(m_new, sizeof(u_int64_t)); - c->sis_mbuf = m_new; - c->sis_ptr = c->map->dm_segs[0].ds_addr + sizeof(u_int64_t); + c->sis_ptr = c->map->dm_segs[0].ds_addr; c->sis_ctl = ETHER_MAX_DIX_LEN; bus_dmamap_sync(sc->sc_dmat, sc->sc_listmap, -- 2.20.1