aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/netmap
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2017-02-14 21:36:18 +0000
committerMark Johnston <markj@FreeBSD.org>2017-02-14 21:36:18 +0000
commit4c55b4e8da031d7f30f8ae0618e15729d74b8088 (patch)
tree738443e77abbb7c1e7b4663677387e11858128e7 /sys/dev/netmap
parent7a60a91011f8898cfa5241e86657b45bd64a578a (diff)
Notes
Diffstat (limited to 'sys/dev/netmap')
-rw-r--r--sys/dev/netmap/netmap_generic.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/sys/dev/netmap/netmap_generic.c b/sys/dev/netmap/netmap_generic.c
index cb1cff1f0e71..45dc99184987 100644
--- a/sys/dev/netmap/netmap_generic.c
+++ b/sys/dev/netmap/netmap_generic.c
@@ -109,10 +109,13 @@ __FBSDID("$FreeBSD$");
* 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 inline void
+set_mbuf_destructor(struct mbuf *m, void *fn)
+{
+
+ m->m_ext.ext_free = fn;
+ m->m_ext.ext_type = EXT_EXTREF;
+}
static int
void_mbuf_dtor(struct mbuf *m, void *arg1, void *arg2)
@@ -167,9 +170,12 @@ nm_os_get_mbuf(struct ifnet *ifp, int len)
static void void_mbuf_dtor(struct mbuf *m, void *arg1, void *arg2) { }
-#define SET_MBUF_DESTRUCTOR(m, fn) do { \
- (m)->m_ext.ext_free = fn ? (void *)fn : (void *)void_mbuf_dtor; \
-} while (0)
+static inline void
+set_mbuf_destructor(struct mbuf *m, void *fn)
+{
+
+ m->m_ext.ext_free = (fn != NULL) ? fn : (void *)void_mbuf_dtor;
+}
static inline struct mbuf *
nm_os_get_mbuf(struct ifnet *ifp, int len)
@@ -381,7 +387,7 @@ generic_netmap_unregister(struct netmap_adapter *na)
* TX event is consumed. */
mtx_lock_spin(&kring->tx_event_lock);
if (kring->tx_event) {
- SET_MBUF_DESTRUCTOR(kring->tx_event, NULL);
+ set_mbuf_destructor(kring->tx_event, NULL);
}
kring->tx_event = NULL;
mtx_unlock_spin(&kring->tx_event_lock);
@@ -762,7 +768,7 @@ generic_set_tx_event(struct netmap_kring *kring, u_int hwcur)
return;
}
- SET_MBUF_DESTRUCTOR(m, generic_mbuf_destructor);
+ set_mbuf_destructor(m, generic_mbuf_destructor);
kring->tx_event = m;
mtx_unlock_spin(&kring->tx_event_lock);