summaryrefslogtreecommitdiffstats
path: root/sys/pci
diff options
context:
space:
mode:
authorsilby <silby@FreeBSD.org>2003-03-29 06:34:25 +0000
committersilby <silby@FreeBSD.org>2003-03-29 06:34:25 +0000
commitebb10b6a3fecd2a638cbcdb52111e82230dd9b66 (patch)
tree7cf7bb099e5ea3fab6a34bf2d617e2e58ae09d91 /sys/pci
parent6f59be774d7b820d9fc3ec62a551dbb881c00d04 (diff)
downloadFreeBSD-src-ebb10b6a3fecd2a638cbcdb52111e82230dd9b66.zip
FreeBSD-src-ebb10b6a3fecd2a638cbcdb52111e82230dd9b66.tar.gz
Fix up the long mbuf chain recovery code to use m_defrag; the old
code messed up on B & C chipsets because it lost the packet header and therefore the flag indicating the need for hardware checksums. MFC after: 2 weeks
Diffstat (limited to 'sys/pci')
-rw-r--r--sys/pci/if_xl.c27
1 files changed, 8 insertions, 19 deletions
diff --git a/sys/pci/if_xl.c b/sys/pci/if_xl.c
index e7a11bf..b8eac16 100644
--- a/sys/pci/if_xl.c
+++ b/sys/pci/if_xl.c
@@ -2412,9 +2412,8 @@ xl_encap(sc, c, m_head)
struct xl_chain *c;
struct mbuf *m_head;
{
- struct xl_frag *f = NULL;
int error;
- u_int32_t baddr, status;
+ u_int32_t status;
/*
* Start packing the mbufs in this chain into
@@ -2441,33 +2440,23 @@ xl_encap(sc, c, m_head)
if (error) {
struct mbuf *m_new;
- m_new = m_head->m_pkthdr.len > MHLEN ?
- m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR) :
- m_gethdr(M_DONTWAIT, MT_DATA);
+ m_new = m_defrag(m_head, M_DONTWAIT);
if (m_new == NULL) {
m_freem(m_head);
printf("xl%d: no memory for tx list\n", sc->xl_unit);
return(1);
+ } else {
+ m_head = m_new;
}
- m_copydata(m_head, 0, m_head->m_pkthdr.len,
- mtod(m_new, caddr_t));
- m_new->m_pkthdr.len = m_new->m_len = m_head->m_pkthdr.len;
- m_freem(m_head);
- m_head = m_new;
- f = &c->xl_ptr->xl_frag[0];
- error = bus_dmamap_load(sc->xl_mtag, c->xl_map,
- mtod(m_new, void *), MCLBYTES, xl_dma_map_addr,
- &baddr, 0);
+
+ error = bus_dmamap_load_mbuf(sc->xl_mtag, c->xl_map,
+ m_head, xl_dma_map_txbuf, c->xl_ptr, 0);
if (error) {
- m_freem(m_new);
+ m_freem(m_head);
printf("xl%d: can't map mbuf (error %d)\n",
sc->xl_unit, error);
return(1);
}
- f->xl_addr = htole32(baddr);
- f->xl_len = htole32(m_new->m_len | XL_LAST_FRAG);
- c->xl_ptr->xl_status = htole32(m_new->m_len);
- c->xl_ptr->xl_next = 0;
}
if (sc->xl_type == XL_TYPE_905B) {
OpenPOWER on IntegriCloud