diff options
Diffstat (limited to 'sys/dev/netmap/netmap_kern.h')
| -rw-r--r-- | sys/dev/netmap/netmap_kern.h | 81 |
1 files changed, 0 insertions, 81 deletions
diff --git a/sys/dev/netmap/netmap_kern.h b/sys/dev/netmap/netmap_kern.h index e5be1c793f4d..0c658c1e046d 100644 --- a/sys/dev/netmap/netmap_kern.h +++ b/sys/dev/netmap/netmap_kern.h @@ -110,23 +110,12 @@ #define NM_ATOMIC_TEST_AND_SET(p) (!atomic_cmpset_acq_int((p), 0, 1)) #define NM_ATOMIC_CLEAR(p) atomic_store_rel_int((p), 0) -#if __FreeBSD_version >= 1100030 #define WNA(_ifp) (_ifp)->if_netmap -#else /* older FreeBSD */ -#define WNA(_ifp) (_ifp)->if_pspare[0] -#endif /* older FreeBSD */ -#if __FreeBSD_version >= 1100005 struct netmap_adapter *netmap_getna(if_t ifp); -#endif -#if __FreeBSD_version >= 1100027 #define MBUF_REFCNT(m) ((m)->m_ext.ext_count) #define SET_MBUF_REFCNT(m, x) (m)->m_ext.ext_count = x -#else -#define MBUF_REFCNT(m) ((m)->m_ext.ref_cnt ? *((m)->m_ext.ref_cnt) : -1) -#define SET_MBUF_REFCNT(m, x) *((m)->m_ext.ref_cnt) = x -#endif #define MBUF_QUEUED(m) 1 @@ -2390,69 +2379,6 @@ ptnet_sync_tail(struct nm_csb_ktoa *ktoa, struct netmap_kring *kring) #ifdef __FreeBSD__ /* * FreeBSD mbuf allocator/deallocator in emulation mode: - */ -#if __FreeBSD_version < 1100000 - -/* - * For older versions of FreeBSD: - * - * We allocate EXT_PACKET mbuf+clusters, but need to set M_NOFREE - * so that the destructor, if invoked, will not free the packet. - * In principle we should set the destructor only on demand, - * but since there might be a race we better do it on allocation. - * As a consequence, we also need to set the destructor or we - * would leak buffers. - */ - -/* mbuf destructor, also need to change the type to EXT_EXTREF, - * add an M_NOFREE flag, and then clear the flag and - * chain into uma_zfree(zone_pack, mf) - * (or reinstall the buffer ?) - */ -#define SET_MBUF_DESTRUCTOR(m, fn) do { \ - (m)->m_ext.ext_free = (void *)fn; \ - (m)->m_ext.ext_type = EXT_EXTREF; \ -} while (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; -} - -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 *)void_mbuf_dtor; - m->m_ext.ext_type = EXT_EXTREF; - nm_prdis(5, "create m %p refcnt %d", m, MBUF_REFCNT(m)); - } - return m; -} - -#else /* __FreeBSD_version >= 1100000 */ - -/* - * Newer versions of FreeBSD, using a straightforward scheme. * * We allocate mbufs with m_gethdr(), since the mbuf header is needed * by the driver. We also attach a customly-provided external storage, @@ -2465,13 +2391,7 @@ nm_os_get_mbuf(struct ifnet *ifp, int len) * has a KASSERT(), checking that the mbuf dtor function is not NULL. */ -#if __FreeBSD_version <= 1200050 -static void void_mbuf_dtor(struct mbuf *m, void *arg1, void *arg2) { } -#else /* __FreeBSD_version >= 1200051 */ -/* The arg1 and arg2 pointers argument were removed by r324446, which - * in included since version 1200051. */ static void void_mbuf_dtor(struct mbuf *m) { } -#endif /* __FreeBSD_version >= 1200051 */ #define SET_MBUF_DESTRUCTOR(m, fn) do { \ (m)->m_ext.ext_free = (fn != NULL) ? \ @@ -2497,7 +2417,6 @@ nm_os_get_mbuf(struct ifnet *ifp, int len) return m; } -#endif /* __FreeBSD_version >= 1100000 */ #endif /* __FreeBSD__ */ struct nmreq_option * nmreq_getoption(struct nmreq_header *, uint16_t); |
