Date: Mon, 13 Nov 2006 05:53:44 +0100 From: Jose M Rodriguez <josemi@freebsd.jazztel.es> To: freebsd-net@freebsd.org Cc: obrien@freebsd.org Subject: nfe net driver for nfroce chipsets working on RELENG_6 Message-ID: <4557FA58.5060300@freebsd.jazztel.es>
next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format. --------------010004050901090700010503 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hi, I'm using the nfe driver from current in RELENG_6 with a little patch merge from openbsd cvs repo. Workking great on a home network (MCP51). Due the fact that nve seems a dead end, are any plans to MFC the nfe driver soon? patch attached. -- josemi --------------010004050901090700010503 Content-Type: text/plain; name="if_nfe.c.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="if_nfe.c.diff" --- if_nfe.c.orig Sun Nov 12 23:52:01 2006 +++ if_nfe.c Mon Nov 13 05:37:40 2006 @@ -1668,7 +1668,14 @@ bus_dmamap_t map; bus_dma_segment_t segs[NFE_MAX_SCATTER]; int error, i, nsegs; - u_int16_t flags = NFE_TX_VALID; + u_int16_t flags = 0, /* don't activate the first fragment */ + *fflags; /* mark TX_VALID late */ +#if NVLAN > 0 + u_int32_t vtag = 0; + + if (m0->m_flags & M_VLANTAG) + vtag = htole32(NFE_TX_VTAG | m0->m_pkthdr.ether_vtag); +#endif map = sc->txq.data[sc->txq.cur].tx_data_map; @@ -1686,15 +1693,11 @@ return ENOBUFS; } - -#ifdef NFE_CSUM - if (m0->m_pkthdr.csum_flags & CSUM_IP) - flags |= NFE_TX_IP_CSUM; - if (m0->m_pkthdr.csum_flags & CSUM_TCP) - flags |= NFE_TX_TCP_CSUM; - if (m0->m_pkthdr.csum_flags & CSUM_UDP) - flags |= NFE_TX_TCP_CSUM; -#endif + /* Take account of the first fragment */ + if (sc->nfe_flags & NFE_40BIT_ADDR) + fflags = &sc->txq.desc64[sc->txq.cur].flags; + else + fflags = &sc->txq.desc32[sc->txq.cur].flags; for (i = 0; i < nsegs; i++) { data = &sc->txq.data[sc->txq.cur]; @@ -1709,9 +1712,9 @@ desc64->length = htole16(segs[i].ds_len - 1); desc64->flags = htole16(flags); #if NVLAN > 0 - if (m0->m_flags & M_VLANTAG) - desc64->vtag = htole32(NFE_TX_VTAG | - m0->m_pkthdr.ether_vtag); + desc64->vtag = vtag; + /* vtag belong to the first fragment only */ + vtag = 0; #endif } else { desc32 = &sc->txq.desc32[sc->txq.cur]; @@ -1721,26 +1724,34 @@ desc32->flags = htole16(flags); } - /* csum flags and vtag belong to the first fragment only */ - if (nsegs > 1) { - flags &= ~(NFE_TX_IP_CSUM | NFE_TX_TCP_CSUM); - } + /* Next fragments must be valid */ + flags |= NFE_TX_VALID; sc->txq.queued++; sc->txq.cur = (sc->txq.cur + 1) % NFE_TX_RING_COUNT; } /* the whole mbuf chain has been DMA mapped, fix last descriptor */ - if (sc->nfe_flags & NFE_40BIT_ADDR) { - flags |= NFE_TX_LASTFRAG_V2; - desc64->flags = htole16(flags); - } else { - if (sc->nfe_flags & NFE_JUMBO_SUP) - flags |= NFE_TX_LASTFRAG_V2; - else - flags |= NFE_TX_LASTFRAG_V1; - desc32->flags = htole16(flags); - } + if (sc->nfe_flags & NFE_40BIT_ADDR) + desc64->flags |= htole16(NFE_TX_LASTFRAG_V2); + else + desc32->flags |= + htole16((sc->nfe_flags & NFE_JUMBO_SUP)? + NFE_TX_LASTFRAG_V2: + NFE_TX_LASTFRAG_V1); + + /* now do the first fragment with Checksum and TX valid */ + +#ifdef NFE_CSUM + if (m0->m_pkthdr.csum_flags & CSUM_IP) + flags |= NFE_TX_IP_CSUM; + if (m0->m_pkthdr.csum_flags & CSUM_TCP) + flags |= NFE_TX_TCP_CSUM; + if (m0->m_pkthdr.csum_flags & CSUM_UDP) + flags |= NFE_TX_TCP_CSUM; +#endif + + *fflags |= htole16(flags); data->m = m0; data->active = map; --------------010004050901090700010503--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4557FA58.5060300>