summaryrefslogtreecommitdiffstats
path: root/sys/arm/xscale
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2008-01-17 23:37:47 +0000
committerjhb <jhb@FreeBSD.org>2008-01-17 23:37:47 +0000
commit4d2d2276c89d16d6686c32b709d17b5333f0c812 (patch)
tree6bf70a921cd833c0f3c1adc253928f44cb04943f /sys/arm/xscale
parent7e32513a5bd95aa6c5a6cf09ad0df8902f8b826f (diff)
downloadFreeBSD-src-4d2d2276c89d16d6686c32b709d17b5333f0c812.zip
FreeBSD-src-4d2d2276c89d16d6686c32b709d17b5333f0c812.tar.gz
- Retire npe_defrag(), gem_defrag(), msk_defrag(), nfe_defrag(), and
re_defrag() and use m_collapse() instead. - Replace a reference to ath_defrag() in a comment in if_wpi.c with m_collapse().
Diffstat (limited to 'sys/arm/xscale')
-rw-r--r--sys/arm/xscale/ixp425/if_npe.c86
1 files changed, 1 insertions, 85 deletions
diff --git a/sys/arm/xscale/ixp425/if_npe.c b/sys/arm/xscale/ixp425/if_npe.c
index 77ac3ee..730f10a 100644
--- a/sys/arm/xscale/ixp425/if_npe.c
+++ b/sys/arm/xscale/ixp425/if_npe.c
@@ -1140,90 +1140,6 @@ npeinit(void *xsc)
}
/*
- * Defragment an mbuf chain, returning at most maxfrags separate
- * mbufs+clusters. If this is not possible NULL is returned and
- * the original mbuf chain is left in it's present (potentially
- * modified) state. We use two techniques: collapsing consecutive
- * mbufs and replacing consecutive mbufs by a cluster.
- */
-static struct mbuf *
-npe_defrag(struct mbuf *m0, int how, int maxfrags)
-{
- struct mbuf *m, *n, *n2, **prev;
- u_int curfrags;
-
- /*
- * Calculate the current number of frags.
- */
- curfrags = 0;
- for (m = m0; m != NULL; m = m->m_next)
- curfrags++;
- /*
- * First, try to collapse mbufs. Note that we always collapse
- * towards the front so we don't need to deal with moving the
- * pkthdr. This may be suboptimal if the first mbuf has much
- * less data than the following.
- */
- m = m0;
-again:
- for (;;) {
- n = m->m_next;
- if (n == NULL)
- break;
- if ((m->m_flags & M_RDONLY) == 0 &&
- n->m_len < M_TRAILINGSPACE(m)) {
- bcopy(mtod(n, void *), mtod(m, char *) + m->m_len,
- n->m_len);
- m->m_len += n->m_len;
- m->m_next = n->m_next;
- m_free(n);
- if (--curfrags <= maxfrags)
- return m0;
- } else
- m = n;
- }
- KASSERT(maxfrags > 1,
- ("maxfrags %u, but normal collapse failed", maxfrags));
- /*
- * Collapse consecutive mbufs to a cluster.
- */
- prev = &m0->m_next; /* NB: not the first mbuf */
- while ((n = *prev) != NULL) {
- if ((n2 = n->m_next) != NULL &&
- n->m_len + n2->m_len < MCLBYTES) {
- m = m_getcl(how, MT_DATA, 0);
- if (m == NULL)
- goto bad;
- bcopy(mtod(n, void *), mtod(m, void *), n->m_len);
- bcopy(mtod(n2, void *), mtod(m, char *) + n->m_len,
- n2->m_len);
- m->m_len = n->m_len + n2->m_len;
- m->m_next = n2->m_next;
- *prev = m;
- m_free(n);
- m_free(n2);
- if (--curfrags <= maxfrags) /* +1 cl -2 mbufs */
- return m0;
- /*
- * Still not there, try the normal collapse
- * again before we allocate another cluster.
- */
- goto again;
- }
- prev = &n->m_next;
- }
- /*
- * No place where we can collapse to a cluster; punt.
- * This can occur if, for example, you request 2 frags
- * but the packet requires that both be clusters (we
- * never reallocate the first mbuf to avoid moving the
- * packet header).
- */
-bad:
- return NULL;
-}
-
-/*
* Dequeue packets and place on the h/w transmit queue.
*/
static void
@@ -1254,7 +1170,7 @@ npestart_locked(struct ifnet *ifp)
error = bus_dmamap_load_mbuf_sg(dma->mtag, npe->ix_map,
m, segs, &nseg, 0);
if (error == EFBIG) {
- n = npe_defrag(m, M_DONTWAIT, NPE_MAXSEG);
+ n = m_collapse(m, M_DONTWAIT, NPE_MAXSEG);
if (n == NULL) {
if_printf(ifp, "%s: too many fragments %u\n",
__func__, nseg);
OpenPOWER on IntegriCloud