diff options
-rw-r--r-- | sys/dev/ti/if_ti.c | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/sys/dev/ti/if_ti.c b/sys/dev/ti/if_ti.c index b603103..898fe14 100644 --- a/sys/dev/ti/if_ti.c +++ b/sys/dev/ti/if_ti.c @@ -2955,7 +2955,7 @@ ti_encap(sc, m_head) struct ti_txdesc *txd; struct ti_tx_desc *f; struct ti_tx_desc txdesc; - struct mbuf *m, *n; + struct mbuf *m; struct m_tag *mtag; bus_dma_segment_t txsegs[TI_MAXTXSEGS]; u_int16_t csum_flags; @@ -2964,41 +2964,28 @@ ti_encap(sc, m_head) if ((txd = STAILQ_FIRST(&sc->ti_cdata.ti_txfreeq)) == NULL) return (ENOBUFS); - m = *m_head; - csum_flags = 0; - if (m->m_pkthdr.csum_flags) { - if (m->m_pkthdr.csum_flags & CSUM_IP) - csum_flags |= TI_BDFLAG_IP_CKSUM; - if (m->m_pkthdr.csum_flags & (CSUM_TCP | CSUM_UDP)) - csum_flags |= TI_BDFLAG_TCP_UDP_CKSUM; - if (m->m_flags & M_LASTFRAG) - csum_flags |= TI_BDFLAG_IP_FRAG_END; - else if (m->m_flags & M_FRAG) - csum_flags |= TI_BDFLAG_IP_FRAG; - } - error = bus_dmamap_load_mbuf_sg(sc->ti_mbuftx_dmat, txd->tx_dmamap, - m, txsegs, &nseg, 0); + *m_head, txsegs, &nseg, 0); if (error == EFBIG) { - n = m_defrag(m, M_DONTWAIT); - if (n == NULL) { - m_freem(m); - m = NULL; + m = m_defrag(*m_head, M_DONTWAIT); + if (m == NULL) { + m_freem(*m_head); + *m_head = NULL; return (ENOMEM); } - m = n; + *m_head = m; error = bus_dmamap_load_mbuf_sg(sc->ti_mbuftx_dmat, - txd->tx_dmamap, m, txsegs, &nseg, 0); + txd->tx_dmamap, *m_head, txsegs, &nseg, 0); if (error) { - m_freem(m); - m = NULL; + m_freem(*m_head); + *m_head = NULL; return (error); } } else if (error != 0) return (error); if (nseg == 0) { - m_freem(m); - m = NULL; + m_freem(*m_head); + *m_head = NULL; return (EIO); } @@ -3007,6 +2994,19 @@ ti_encap(sc, m_head) return (ENOBUFS); } + m = *m_head; + csum_flags = 0; + if (m->m_pkthdr.csum_flags) { + if (m->m_pkthdr.csum_flags & CSUM_IP) + csum_flags |= TI_BDFLAG_IP_CKSUM; + if (m->m_pkthdr.csum_flags & (CSUM_TCP | CSUM_UDP)) + csum_flags |= TI_BDFLAG_TCP_UDP_CKSUM; + if (m->m_flags & M_LASTFRAG) + csum_flags |= TI_BDFLAG_IP_FRAG_END; + else if (m->m_flags & M_FRAG) + csum_flags |= TI_BDFLAG_IP_FRAG; + } + bus_dmamap_sync(sc->ti_mbuftx_dmat, txd->tx_dmamap, BUS_DMASYNC_PREWRITE); bus_dmamap_sync(sc->ti_rdata_dmat, sc->ti_rdata_dmamap, |