summaryrefslogtreecommitdiffstats
path: root/sys/netinet/ip_output.c
diff options
context:
space:
mode:
authorsilby <silby@FreeBSD.org>2003-09-01 05:55:37 +0000
committersilby <silby@FreeBSD.org>2003-09-01 05:55:37 +0000
commit75c663cdc739404f8d4bc296f5c2b442f53ffeb9 (patch)
treedf3cb4583a5c6c233144ffce721adb4a42b7133b /sys/netinet/ip_output.c
parent7a8c89dde15c19a8c1e8eb2976dc9936d9b7329c (diff)
downloadFreeBSD-src-75c663cdc739404f8d4bc296f5c2b442f53ffeb9.zip
FreeBSD-src-75c663cdc739404f8d4bc296f5c2b442f53ffeb9.tar.gz
Implement MBUF_STRESS_TEST mark II.
Changes from the original implementation: - Fragmentation is handled by the function m_fragment, which can be called from whereever fragmentation is needed. Note that this function is wrapped in #ifdef MBUF_STRESS_TEST to discourage non-testing use. - m_fragment works slightly differently from the old fragmentation code in that it allocates a seperate mbuf cluster for each fragment. This defeats dma_map_load_mbuf/buffer's feature of coalescing adjacent fragments. While that is a nice feature in practice, it nerfed the usefulness of mbuf_stress_test. - Add two modes of random fragmentation. Chains with fragments all of the same random length and chains with fragments that are each uniquely random in length may now be requested.
Diffstat (limited to 'sys/netinet/ip_output.c')
-rw-r--r--sys/netinet/ip_output.c20
1 files changed, 2 insertions, 18 deletions
diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c
index 4a507cf..f6a70ef 100644
--- a/sys/netinet/ip_output.c
+++ b/sys/netinet/ip_output.c
@@ -1030,24 +1030,8 @@ pass:
#endif
#ifdef MBUF_STRESS_TEST
- if (mbuf_frag_size && m->m_pkthdr.len > mbuf_frag_size) {
- struct mbuf *m1, *m2;
- int length, tmp;
-
- tmp = length = m->m_pkthdr.len;
-
- while ((length -= mbuf_frag_size) >= 1) {
- m1 = m_split(m, length, M_DONTWAIT);
- if (m1 == NULL)
- break;
- m1->m_flags &= ~M_PKTHDR;
- m2 = m;
- while (m2->m_next != NULL)
- m2 = m2->m_next;
- m2->m_next = m1;
- m->m_pkthdr.len = tmp;
- }
- }
+ if (mbuf_frag_size && m->m_pkthdr.len > mbuf_frag_size)
+ m = m_fragment(m, M_DONTWAIT, mbuf_frag_size);
#endif
error = (*ifp->if_output)(ifp, m,
(struct sockaddr *)dst, ro->ro_rt);
OpenPOWER on IntegriCloud