From owner-p4-projects@FreeBSD.ORG Fri Nov 23 23:30:21 2007 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 32A1816A41B; Fri, 23 Nov 2007 23:30:21 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DCD8E16A41A for ; Fri, 23 Nov 2007 23:30:20 +0000 (UTC) (envelope-from kmacy@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id E039B13C448 for ; Fri, 23 Nov 2007 23:30:20 +0000 (UTC) (envelope-from kmacy@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id lANNUK7W039869 for ; Fri, 23 Nov 2007 23:30:20 GMT (envelope-from kmacy@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id lANNUKm1039866 for perforce@freebsd.org; Fri, 23 Nov 2007 23:30:20 GMT (envelope-from kmacy@freebsd.org) Date: Fri, 23 Nov 2007 23:30:20 GMT Message-Id: <200711232330.lANNUKm1039866@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to kmacy@freebsd.org using -f From: Kip Macy To: Perforce Change Reviews Cc: Subject: PERFORCE change 129435 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Nov 2007 23:30:21 -0000 http://perforce.freebsd.org/chv.cgi?CH=129435 Change 129435 by kmacy@kmacy:storage:toestack on 2007/11/23 23:30:00 add add mbuf iovec allocation routine declare routine to initialize mbuf iovec from sgl Affected files ... .. //depot/projects/toestack/sys/dev/cxgb/sys/mvec.h#8 edit .. //depot/projects/toestack/sys/dev/cxgb/sys/uipc_mvec.c#5 edit Differences ... ==== //depot/projects/toestack/sys/dev/cxgb/sys/mvec.h#8 (text+ko) ==== @@ -157,6 +157,8 @@ } struct mbuf *mi_collapse_mbuf(struct mbuf_iovec *mi, struct mbuf *m); +struct mbuf *mi_collapse_sge(struct mbuf_iovec *mi, bus_dma_segment_t *seg); +void *mcl_alloc(int seg_count, int *type); static __inline int m_collapse(struct mbuf *m, int maxbufs, struct mbuf **mnew) ==== //depot/projects/toestack/sys/dev/cxgb/sys/uipc_mvec.c#5 (text+ko) ==== @@ -168,6 +168,24 @@ return _mcl_collapse_mbuf(mi, m); } +void * +mcl_alloc(int seg_count, int *type) +{ + uma_zone_t zone; + + if (seg_count > MAX_CL_IOV) { + zone = zone_jumbop; + *type = EXT_JMPIOVEC; + } else if (seg_count > MAX_MIOVEC_IOV) { + zone = zone_clust; + *type = EXT_CLIOVEC; + } else { + *type = EXT_IOVEC; + zone = zone_miovec; + } + return uma_zalloc_arg(zone, NULL, M_NOWAIT); +} + int busdma_map_sg_collapse(struct mbuf **m, bus_dma_segment_t *segs, int *nsegs) { @@ -176,7 +194,6 @@ struct mbuf *marray[TX_MAX_SEGS]; int i, type, seg_count, defragged = 0, err = 0; struct mbuf_vec *mv; - uma_zone_t zone; KASSERT(n->m_pkthdr.len, ("packet has zero header len")); @@ -262,17 +279,8 @@ err = EFBIG; goto err_out; } - if (seg_count > MAX_CL_IOV) { - zone = zone_jumbop; - type = EXT_JMPIOVEC; - } else if (seg_count > MAX_MIOVEC_IOV) { - zone = zone_clust; - type = EXT_CLIOVEC; - } else { - type = EXT_IOVEC; - zone = zone_miovec; - } - if ((m0 = uma_zalloc_arg(zone, NULL, M_NOWAIT)) == NULL) { + + if ((m0 = mcl_alloc(seg_count, &type)) == NULL) { err = ENOMEM; goto err_out; }