Date: Fri, 23 Nov 2007 23:30:20 GMT From: Kip Macy <kmacy@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 129435 for review Message-ID: <200711232330.lANNUKm1039866@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
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; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200711232330.lANNUKm1039866>