예제 #1
0
static int
void_mbuf_dtor(struct mbuf *m, void *arg1, void *arg2)
{
	/* restore original mbuf */
	m->m_ext.ext_buf = m->m_data = m->m_ext.ext_arg1;
	m->m_ext.ext_arg1 = NULL;
	m->m_ext.ext_type = EXT_PACKET;
	m->m_ext.ext_free = NULL;
	if (MBUF_REFCNT(m) == 0)
		SET_MBUF_REFCNT(m, 1);
	uma_zfree(zone_pack, m);

	return 0;
}
예제 #2
0
static inline struct mbuf *
nm_os_get_mbuf(struct ifnet *ifp, int len)
{
    struct mbuf *m;

    (void)ifp;
    m = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR | M_NOFREE);
    if (m) {
        m->m_ext.ext_arg1 = m->m_ext.ext_buf; // XXX save
        m->m_ext.ext_free = (void *)netmap_default_mbuf_destructor;
        m->m_ext.ext_type = EXT_EXTREF;
        ND(5, "create m %p refcnt %d", m, MBUF_REFCNT(m));
    }
    return m;
}
예제 #3
0
static inline struct mbuf *
nm_os_get_mbuf(struct ifnet *ifp, int len)
{
	struct mbuf *m;

	(void)ifp;
	m = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR);
	if (m) {
		/* m_getcl() (mb_ctor_mbuf) has an assert that checks that
		 * M_NOFREE flag is not specified as third argument,
		 * so we have to set M_NOFREE after m_getcl(). */
		m->m_flags |= M_NOFREE;
		m->m_ext.ext_arg1 = m->m_ext.ext_buf; // XXX save
		m->m_ext.ext_free = (void *)netmap_default_mbuf_destructor;
		m->m_ext.ext_type = EXT_EXTREF;
		ND(5, "create m %p refcnt %d", m, MBUF_REFCNT(m));
	}
	return m;
}