aboutsummaryrefslogtreecommitdiff
path: root/sys/sys/mbuf.h
diff options
context:
space:
mode:
authorKip Macy <kmacy@FreeBSD.org>2007-04-04 04:08:57 +0000
committerKip Macy <kmacy@FreeBSD.org>2007-04-04 04:08:57 +0000
commite0bfe940a4f8e64630391fc46202f351ae28d387 (patch)
tree756cad1072f27d7e099b27c8eed2f4a1d96c1e3a /sys/sys/mbuf.h
parenta6a026d5f81b94618a397a6eccc9a249fdf0571e (diff)
downloadsrc-e0bfe940a4f8e64630391fc46202f351ae28d387.tar.gz
src-e0bfe940a4f8e64630391fc46202f351ae28d387.zip
m_extadd does not appear to do the right thing for the case of clusters
allocated from UMA - add m_cljset to correspond to m_cljget MFC after: 3 days
Notes
Notes: svn path=/head/; revision=168350
Diffstat (limited to 'sys/sys/mbuf.h')
-rw-r--r--sys/sys/mbuf.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h
index a4d7f41dc0d5..2f19a61c7747 100644
--- a/sys/sys/mbuf.h
+++ b/sys/sys/mbuf.h
@@ -534,6 +534,45 @@ m_cljget(struct mbuf *m, int how, int size)
}
static __inline void
+m_cljset(struct mbuf *m, void *cl, int type)
+{
+ uma_zone_t zone;
+ int size;
+
+ switch (type) {
+ case EXT_CLUSTER:
+ size = MCLBYTES;
+ zone = zone_clust;
+ break;
+#if MJUMPAGESIZE != MCLBYTES
+ case EXT_JUMBOP:
+ size = MJUMPAGESIZE;
+ zone = zone_jumbop;
+ break;
+#endif
+ case EXT_JUMBO9:
+ size = MJUM9BYTES;
+ zone = zone_jumbo9;
+ break;
+ case EXT_JUMBO16:
+ size = MJUM16BYTES;
+ zone = zone_jumbo16;
+ break;
+ default:
+ panic("unknown cluster type");
+ break;
+ }
+
+ m->m_data = m->m_ext.ext_buf = cl;
+ m->m_ext.ext_free = m->m_ext.ext_args = NULL;
+ m->m_ext.ext_size = size;
+ m->m_ext.ext_type = type;
+ m->m_ext.ref_cnt = uma_find_refcnt(zone, cl);
+ m->m_flags |= M_EXT;
+
+}
+
+static __inline void
m_chtype(struct mbuf *m, short new_type)
{