tcp_pcap.c (24b9bb56144191cb6d5848be6c05780fbf4b716b) tcp_pcap.c (82334850ea451f7f6903be20e4836118e6a77460)
1/*-
2 * Copyright (c) 2015
3 * Jonathan Looney. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 297 unchanged lines hidden (view full) ---

306 * If this held an external cluster, try to
307 * detach the cluster. But, if we held the
308 * last reference, go through the normal
309 * free-ing process.
310 */
311 if (mhead->m_flags & M_EXT) {
312 switch (mhead->m_ext.ext_type) {
313 case EXT_SFBUF:
1/*-
2 * Copyright (c) 2015
3 * Jonathan Looney. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 297 unchanged lines hidden (view full) ---

306 * If this held an external cluster, try to
307 * detach the cluster. But, if we held the
308 * last reference, go through the normal
309 * free-ing process.
310 */
311 if (mhead->m_flags & M_EXT) {
312 switch (mhead->m_ext.ext_type) {
313 case EXT_SFBUF:
314 case EXT_PGS:
314 /* Don't mess around with these. */
315 tcp_pcap_m_freem(mhead);
316 continue;
317 default:
318 if (atomic_fetchadd_int(
319 mhead->m_ext.ext_cnt, -1) == 1)
320 {
321 /*

--- 56 unchanged lines hidden (view full) ---

378 * is here to catch any instances where someone
379 * changes the logic to invalidate that assumption.
380 */
381 KASSERT((n->m_flags & (M_EXT | M_PKTHDR)) == 0,
382 ("%s: Unexpected flags (%#x) for mbuf",
383 __func__, n->m_flags));
384 n->m_data = n->m_dat + M_LEADINGSPACE_NOWRITE(m);
385 n->m_len = m->m_len;
315 /* Don't mess around with these. */
316 tcp_pcap_m_freem(mhead);
317 continue;
318 default:
319 if (atomic_fetchadd_int(
320 mhead->m_ext.ext_cnt, -1) == 1)
321 {
322 /*

--- 56 unchanged lines hidden (view full) ---

379 * is here to catch any instances where someone
380 * changes the logic to invalidate that assumption.
381 */
382 KASSERT((n->m_flags & (M_EXT | M_PKTHDR)) == 0,
383 ("%s: Unexpected flags (%#x) for mbuf",
384 __func__, n->m_flags));
385 n->m_data = n->m_dat + M_LEADINGSPACE_NOWRITE(m);
386 n->m_len = m->m_len;
386 bcopy(M_START(m), n->m_dat,
387 m->m_len + M_LEADINGSPACE_NOWRITE(m));
387 if (m->m_flags & M_NOMAP)
388 m_copydata(m, 0, m->m_len, n->m_data);
389 else
390 bcopy(M_START(m), n->m_dat,
391 m->m_len + M_LEADINGSPACE_NOWRITE(m));
388 }
389 else {
390 /*
391 * This is the case where we need to "settle for what
392 * we can get". The most probable way to this code
393 * path is that we've already taken references to the
394 * maximum number of mbuf clusters we can, and the data
395 * is too long to fit in an mbuf's internal storage.

--- 50 unchanged lines hidden ---
392 }
393 else {
394 /*
395 * This is the case where we need to "settle for what
396 * we can get". The most probable way to this code
397 * path is that we've already taken references to the
398 * maximum number of mbuf clusters we can, and the data
399 * is too long to fit in an mbuf's internal storage.

--- 50 unchanged lines hidden ---