- Use m_getcl() instead of hand allocating.

Sponsored by:	Nginx, Inc.
This commit is contained in:
Gleb Smirnoff 2013-03-15 12:53:53 +00:00
parent c69f77c339
commit 39f6074e2e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=248323

View File

@ -842,23 +842,19 @@ tcp_output(struct tcpcb *tp)
TCPSTAT_INC(tcps_sndpack);
TCPSTAT_ADD(tcps_sndbyte, len);
}
MGETHDR(m, M_NOWAIT, MT_DATA);
#ifdef INET6
if (MHLEN < hdrlen + max_linkhdr)
m = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR);
else
#endif
m = m_gethdr(M_NOWAIT, MT_DATA);
if (m == NULL) {
SOCKBUF_UNLOCK(&so->so_snd);
error = ENOBUFS;
goto out;
}
#ifdef INET6
if (MHLEN < hdrlen + max_linkhdr) {
MCLGET(m, M_NOWAIT);
if ((m->m_flags & M_EXT) == 0) {
SOCKBUF_UNLOCK(&so->so_snd);
m_freem(m);
error = ENOBUFS;
goto out;
}
}
#endif
m->m_data += max_linkhdr;
m->m_len = hdrlen;