From 45527e0121428c2cdb7a874da045b325586224d0 Mon Sep 17 00:00:00 2001 From: rwatson Date: Fri, 2 Jan 2015 19:06:27 +0000 Subject: [PATCH] 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 --- sys/dev/cxgb/ulp/tom/cxgb_listen.c | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/sys/dev/cxgb/ulp/tom/cxgb_listen.c b/sys/dev/cxgb/ulp/tom/cxgb_listen.c index 94a219b20c3c..e11bb2583373 100644 --- a/sys/dev/cxgb/ulp/tom/cxgb_listen.c +++ b/sys/dev/cxgb/ulp/tom/cxgb_listen.c @@ -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