Make sbcompress use the new M_WRITABLE macro. Previously sbcompress

could not compress into clusters. This could result in lots of
wasted clusters while recieving small packets from an interface
that uses clusters for all it's packets.

Patch is partially from BSDi (limiting the size of the copy) and
based on a patch for 4.1 by Ian Dowse <iedowse@maths.tcd.ie> and
myself.

Reviewed by:	bmilekic
Obtained From:	BSDi
Submitted by:	iedowse
This commit is contained in:
David Malone 2000-11-19 22:22:47 +00:00
parent 09980f4348
commit 32af0d74f0
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=68918
2 changed files with 8 additions and 4 deletions

View File

@ -718,8 +718,10 @@ sbcompress(sb, m, n)
m = m_free(m);
continue;
}
if (n && (n->m_flags & (M_EXT | M_EOR)) == 0 &&
(n->m_data + n->m_len + m->m_len) < &n->m_dat[MLEN] &&
if (n && (n->m_flags & M_EOR) == 0 &&
M_WRITABLE(n) &&
m->m_len <= MCLBYTES / 4 && /* XXX: Don't copy too much */
m->m_len <= M_TRAILINGSPACE(n) &&
n->m_type == m->m_type) {
bcopy(mtod(m, caddr_t), mtod(n, caddr_t) + n->m_len,
(unsigned)m->m_len);

View File

@ -718,8 +718,10 @@ sbcompress(sb, m, n)
m = m_free(m);
continue;
}
if (n && (n->m_flags & (M_EXT | M_EOR)) == 0 &&
(n->m_data + n->m_len + m->m_len) < &n->m_dat[MLEN] &&
if (n && (n->m_flags & M_EOR) == 0 &&
M_WRITABLE(n) &&
m->m_len <= MCLBYTES / 4 && /* XXX: Don't copy too much */
m->m_len <= M_TRAILINGSPACE(n) &&
n->m_type == m->m_type) {
bcopy(mtod(m, caddr_t), mtod(n, caddr_t) + n->m_len,
(unsigned)m->m_len);