Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet/tcp_pcap.c
Show First 20 Lines • Show All 305 Lines • ▼ Show 20 Lines | else { | ||||
* If this held an external cluster, try to | * If this held an external cluster, try to | ||||
* detach the cluster. But, if we held the | * detach the cluster. But, if we held the | ||||
* last reference, go through the normal | * last reference, go through the normal | ||||
* free-ing process. | * free-ing process. | ||||
*/ | */ | ||||
if (mhead->m_flags & M_EXT) { | if (mhead->m_flags & M_EXT) { | ||||
switch (mhead->m_ext.ext_type) { | switch (mhead->m_ext.ext_type) { | ||||
case EXT_SFBUF: | case EXT_SFBUF: | ||||
case EXT_PGS: | |||||
/* Don't mess around with these. */ | /* Don't mess around with these. */ | ||||
tcp_pcap_m_freem(mhead); | tcp_pcap_m_freem(mhead); | ||||
continue; | continue; | ||||
default: | default: | ||||
if (atomic_fetchadd_int( | if (atomic_fetchadd_int( | ||||
mhead->m_ext.ext_cnt, -1) == 1) | mhead->m_ext.ext_cnt, -1) == 1) | ||||
{ | { | ||||
/* | /* | ||||
▲ Show 20 Lines • Show All 56 Lines • ▼ Show 20 Lines | else if (((m->m_data + m->m_len) - M_START(m)) <= M_SIZE(n)) { | ||||
* is here to catch any instances where someone | * is here to catch any instances where someone | ||||
* changes the logic to invalidate that assumption. | * changes the logic to invalidate that assumption. | ||||
*/ | */ | ||||
KASSERT((n->m_flags & (M_EXT | M_PKTHDR)) == 0, | KASSERT((n->m_flags & (M_EXT | M_PKTHDR)) == 0, | ||||
("%s: Unexpected flags (%#x) for mbuf", | ("%s: Unexpected flags (%#x) for mbuf", | ||||
__func__, n->m_flags)); | __func__, n->m_flags)); | ||||
n->m_data = n->m_dat + M_LEADINGSPACE_NOWRITE(m); | n->m_data = n->m_dat + M_LEADINGSPACE_NOWRITE(m); | ||||
n->m_len = m->m_len; | n->m_len = m->m_len; | ||||
if (m->m_flags & M_NOMAP) | |||||
m_copydata(m, 0, m->m_len, n->m_data); | |||||
else | |||||
bcopy(M_START(m), n->m_dat, | bcopy(M_START(m), n->m_dat, | ||||
m->m_len + M_LEADINGSPACE_NOWRITE(m)); | m->m_len + M_LEADINGSPACE_NOWRITE(m)); | ||||
} | } | ||||
else { | else { | ||||
/* | /* | ||||
* This is the case where we need to "settle for what | * This is the case where we need to "settle for what | ||||
* we can get". The most probable way to this code | * we can get". The most probable way to this code | ||||
* path is that we've already taken references to the | * path is that we've already taken references to the | ||||
* maximum number of mbuf clusters we can, and the data | * maximum number of mbuf clusters we can, and the data | ||||
* is too long to fit in an mbuf's internal storage. | * is too long to fit in an mbuf's internal storage. | ||||
▲ Show 20 Lines • Show All 50 Lines • Show Last 20 Lines |