From owner-svn-src-user@FreeBSD.ORG Sat Nov 15 03:09:50 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8FD051065674; Sat, 15 Nov 2008 03:09:50 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 793CF8FC12; Sat, 15 Nov 2008 03:09:50 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAF39oKq008824; Sat, 15 Nov 2008 03:09:50 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAF39oB7008823; Sat, 15 Nov 2008 03:09:50 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200811150309.mAF39oB7008823@svn.freebsd.org> From: Kip Macy Date: Sat, 15 Nov 2008 03:09:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r184978 - user/kmacy/HEAD_fast_multi_xmit/sys/dev/cxgb/sys X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Nov 2008 03:09:50 -0000 Author: kmacy Date: Sat Nov 15 03:09:50 2008 New Revision: 184978 URL: http://svn.freebsd.org/changeset/base/184978 Log: simplify packet coalescing and attempt to plug packet zone leak Modified: user/kmacy/HEAD_fast_multi_xmit/sys/dev/cxgb/sys/uipc_mvec.c Modified: user/kmacy/HEAD_fast_multi_xmit/sys/dev/cxgb/sys/uipc_mvec.c ============================================================================== --- user/kmacy/HEAD_fast_multi_xmit/sys/dev/cxgb/sys/uipc_mvec.c Sat Nov 15 02:36:53 2008 (r184977) +++ user/kmacy/HEAD_fast_multi_xmit/sys/dev/cxgb/sys/uipc_mvec.c Sat Nov 15 03:09:50 2008 (r184978) @@ -308,39 +308,35 @@ err_out: } int -busdma_map_sg_vec(struct mbuf **m, struct mbuf **mret, bus_dma_segment_t *segs, int count) +busdma_map_sg_vec(struct mbuf **m, struct mbuf **mret, bus_dma_segment_t *segs, int pkt_count) { struct mbuf *m0, **mp; struct mbuf_iovec *mi; struct mbuf_vec *mv; - int i; - - if (count > MAX_MIOVEC_IOV) { - if ((m0 = uma_zalloc_arg(zone_clust, NULL, M_NOWAIT)) == NULL) - return (ENOMEM); - m0->m_type = EXT_CLIOVEC; - } else { - if ((m0 = uma_zalloc_arg(zone_miovec, NULL, M_NOWAIT)) == NULL) - return (ENOMEM); - m0->m_type = EXT_IOVEC; - } + int i, type; + + if ((m0 = mcl_alloc(pkt_count, &type)) == NULL) + return (ENOMEM); - m0->m_flags = 0; - m0->m_pkthdr.len = m0->m_len = (*m)->m_len; /* not the real length but needs to be non-zero */ + m0->m_type = type; + memcpy(m0, *m, sizeof(struct m_hdr) + sizeof(struct pkthdr)); mv = mtomv(m0); - mv->mv_count = count; + mv->mv_count = pkt_count; mv->mv_first = 0; - for (mp = m, i = 0, mi = mv->mv_vec; i < count; mp++, segs++, mi++, i++) { - if ((*mp)->m_flags & M_PKTHDR && !SLIST_EMPTY(&(*mp)->m_pkthdr.tags)) + for (mp = m, i = 0, mi = mv->mv_vec; i < pkt_count; mp++, segs++, mi++, i++) { + if ((*mp)->m_flags & M_PKTHDR + && !SLIST_EMPTY(&(*mp)->m_pkthdr.tags)) m_tag_delete_chain(*mp, NULL); busdma_map_mbuf_fast(*mp, segs); _mcl_collapse_mbuf(mi, *mp); KASSERT(mi->mi_len, ("empty packet")); } - for (mp = m, i = 0; i < count; i++, mp++) { + for (mp = m, i = 0; i < pkt_count; i++, mp++) { (*mp)->m_next = (*mp)->m_nextpkt = NULL; - if (((*mp)->m_flags & (M_EXT|M_NOFREE)) == M_EXT) { + + if ((((*mp)->m_flags & (M_EXT|M_NOFREE)) == M_EXT) && + ((*mp)->m_ext.ext_type != EXT_PACKET)){ (*mp)->m_flags &= ~M_EXT; cxgb_mbufs_outstanding--; m_free(*mp);