In mbuf_to_synq_entry(), use M_START() and M_SIZE() to calculate an offset

into mbuf storage, to reduce knowledge about mbuf/cluster layout in the
cxgb device driver.

Reviewed by:	np
Sponsored by:	EMC / Isilon Storage Division
This commit is contained in:
Robert Watson 2015-01-02 19:06:27 +00:00
parent c78d63c643
commit fe522dc9e3
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=276563

View File

@ -442,26 +442,13 @@ static struct synq_entry *
mbuf_to_synq_entry(struct mbuf *m)
{
int len = roundup(sizeof (struct synq_entry), 8);
uint8_t *buf;
int buflen;
if (__predict_false(M_TRAILINGSPACE(m) < len)) {
panic("%s: no room for synq_entry (%td, %d)\n", __func__,
M_TRAILINGSPACE(m), len);
}
if (m->m_flags & M_EXT) {
buf = m->m_ext.ext_buf;
buflen = m->m_ext.ext_size;
} else if (m->m_flags & M_PKTHDR) {
buf = &m->m_pktdat[0];
buflen = MHLEN;
} else {
buf = &m->m_dat[0];
buflen = MLEN;
}
return ((void *)(buf + buflen - len));
return ((void *)(M_START(m) + M_SIZE(m) - len));
}
#ifdef KTR