From owner-freebsd-net@FreeBSD.ORG Mon Nov 13 04:53:47 2006 Return-Path: X-Original-To: freebsd-net@freebsd.org Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 261C916A40F; Mon, 13 Nov 2006 04:53:47 +0000 (UTC) (envelope-from josemi@freebsd.jazztel.es) Received: from smtp01.jazztel.es (smtp01.jazztel.es [62.14.3.170]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8C9BB43D49; Mon, 13 Nov 2006 04:53:46 +0000 (GMT) (envelope-from josemi@freebsd.jazztel.es) Received: from [87.217.186.155] (helo=[192.168.254.128]) by smtp01.jazztel.es with esmtpa (Exim 4.60) (envelope-from ) id 1GjTk5-0007Kc-A7; Mon, 13 Nov 2006 05:48:21 +0100 Message-ID: <4557FA58.5060300@freebsd.jazztel.es> Date: Mon, 13 Nov 2006 05:53:44 +0100 From: Jose M Rodriguez User-Agent: Thunderbird 1.5.0.8 (Windows/20061025) MIME-Version: 1.0 To: freebsd-net@freebsd.org Content-Type: multipart/mixed; boundary="------------010004050901090700010503" Cc: obrien@freebsd.org Subject: nfe net driver for nfroce chipsets working on RELENG_6 X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Nov 2006 04:53:47 -0000 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--