Date: Sun, 13 Mar 2005 18:36:01 GMT From: Sam Leffler <sam@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 73025 for review Message-ID: <200503131836.j2DIa196071461@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=73025 Change 73025 by sam@sam_ebb on 2005/03/13 18:35:34 o check for rdonly mbuf's when coalescing o save stats+test stuff since this is a private branch Affected files ... .. //depot/projects/wifi/sys/dev/ath/if_ath.c#76 edit Differences ... ==== //depot/projects/wifi/sys/dev/ath/if_ath.c#76 (text+ko) ==== @@ -3269,6 +3269,18 @@ ath_tx_cleanupq(sc, &sc->sc_txq[i]); } +SYSCTL_NODE(_hw_ath, OID_AUTO, defrag, CTLFLAG_RD, 0, "defrag testing"); +static int ath_maxfrags = 4; +SYSCTL_INT(_hw_ath_defrag, OID_AUTO, max, CTLFLAG_RW, &ath_maxfrags, 0, ""); +static int ath_defrags; +SYSCTL_INT(_hw_ath_defrag, OID_AUTO, calls, CTLFLAG_RW, &ath_defrags, 0, ""); +static int ath_collectedfrags; +SYSCTL_INT(_hw_ath_defrag, OID_AUTO, combined, CTLFLAG_RW, &ath_collectedfrags, 0, ""); +static int ath_replacedfrags; +SYSCTL_INT(_hw_ath_defrag, OID_AUTO, replaced, CTLFLAG_RW, &ath_replacedfrags, 0, ""); +static int ath_defragsfail; +SYSCTL_INT(_hw_ath_defrag, OID_AUTO, fail, CTLFLAG_RW, &ath_defragsfail, 0, ""); + /* * Defragment an mbuf chain, returning at most maxfrags separate * mbufs+clusters. If this is not possible NULL is returned and @@ -3282,12 +3294,14 @@ struct mbuf *m, *n, *n2, **prev; u_int curfrags; +ath_defrags++;/*XXX*/ /* * Calculate the current number of frags. */ curfrags = 0; for (m = m0; m != NULL; m = m->m_next) curfrags++; +if (curfrags <= maxfrags) return m0; /* XXX for testing */ /* * First, try to collapse mbufs. Note that we always collapse * towards the front so we don't need to deal with moving the @@ -3300,12 +3314,14 @@ n = m->m_next; if (n == NULL) break; - if (n->m_len < M_TRAILINGSPACE(m)) { + 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); +ath_collectedfrags++;/*XXX*/ if (--curfrags <= maxfrags) return m0; } else @@ -3331,6 +3347,7 @@ *prev = m; m_free(n); m_free(n2); +ath_replacedfrags++;/*XXX*/ if (--curfrags <= maxfrags) /* +1 cl -2 mbufs */ return m0; /* @@ -3349,6 +3366,7 @@ * packet header). */ bad: +ath_defragsfail++;/*XXX*/ return NULL; } @@ -3423,6 +3441,8 @@ pktlen += IEEE80211_CRC_LEN; +m = ath_defrag(m0, M_DONTWAIT, ath_maxfrags); if (m != NULL) m0 = m; /*XXX*/ + /* * Load the DMA map so any coalescing is done. This * also calculates the number of descriptors we need.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200503131836.j2DIa196071461>