From f236f5351548b8c2fa9961feda504333885c4f7b Mon Sep 17 00:00:00 2001 From: tsutsui Date: Fri, 20 Oct 2006 17:11:36 +0000 Subject: [PATCH] In re_newbuf(): - adjust m_data and m_len directly rather than calling m_adj(9) - more cosmetics --- sys/dev/ic/rtl8169.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/sys/dev/ic/rtl8169.c b/sys/dev/ic/rtl8169.c index 96edd7247808..47ef91c40ccb 100644 --- a/sys/dev/ic/rtl8169.c +++ b/sys/dev/ic/rtl8169.c @@ -1,4 +1,4 @@ -/* $NetBSD: rtl8169.c,v 1.41 2006/10/20 16:46:47 tsutsui Exp $ */ +/* $NetBSD: rtl8169.c,v 1.42 2006/10/20 17:11:36 tsutsui Exp $ */ /* * Copyright (c) 1997, 1998-2003 @@ -1021,13 +1021,13 @@ re_newbuf(struct rtk_softc *sc, int idx, struct mbuf *m) MGETHDR(n, M_DONTWAIT, MT_DATA); if (n == NULL) return ENOBUFS; - m = n; - MCLGET(m, M_DONTWAIT); - if ((m->m_flags & M_EXT) == 0) { - m_freem(m); + MCLGET(n, M_DONTWAIT); + if ((n->m_flags & M_EXT) == 0) { + m_freem(n); return ENOBUFS; } + m = n; } else m->m_data = m->m_ext.ext_buf; @@ -1036,8 +1036,8 @@ re_newbuf(struct rtk_softc *sc, int idx, struct mbuf *m) * alignment so that the frame payload is * longword aligned. */ - m->m_len = m->m_pkthdr.len = MCLBYTES; - m_adj(m, RTK_ETHER_ALIGN); + m->m_len = m->m_pkthdr.len = MCLBYTES - RTK_ETHER_ALIGN; + m->m_data += RTK_ETHER_ALIGN; map = sc->rtk_ldata.rtk_rx_dmamap[idx]; error = bus_dmamap_load_mbuf(sc->sc_dmat, map, m, @@ -1071,7 +1071,7 @@ re_newbuf(struct rtk_softc *sc, int idx, struct mbuf *m) sc->rtk_ldata.rtk_rx_mbuf[idx] = m; return 0; -out: + out: if (n != NULL) m_freem(n); return ENOMEM;