aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincenzo Maffione <vmaffione@FreeBSD.org>2019-07-01 20:37:35 +0000
committerVincenzo Maffione <vmaffione@FreeBSD.org>2019-07-01 20:37:35 +0000
commit23ced944518f5ea6a5d5c62e1e348f29ed0eee2c (patch)
tree5651c0c209c820745fc51df68fcbca73c18ac130
parente3722b788eaa629d536a524e5b3fb7dc1082dbf3 (diff)
downloadsrc-23ced944518f5ea6a5d5c62e1e348f29ed0eee2c.tar.gz
src-23ced944518f5ea6a5d5c62e1e348f29ed0eee2c.zip
netmap: fix two panics with emulated adapter
This patch fixes 2 panics. The first one is due to the current VNET not being set in the emulated adapter transmission path. The second one is caused by the M_PKTHDR flag not being set when preallocated mbufs are recycled in the transmit path. Submitted by: aleksandr.fedorov@itglobal.com Reviewed by: vmaffione MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D20824
Notes
Notes: svn path=/head/; revision=349581
-rw-r--r--sys/dev/netmap/netmap_freebsd.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/sys/dev/netmap/netmap_freebsd.c b/sys/dev/netmap/netmap_freebsd.c
index fc574cad4598..59837840eed9 100644
--- a/sys/dev/netmap/netmap_freebsd.c
+++ b/sys/dev/netmap/netmap_freebsd.c
@@ -444,6 +444,7 @@ nm_os_generic_xmit_frame(struct nm_os_gen_arg *a)
m->m_ext.ext_size = len;
#endif /* __FreeBSD_version >= 1100000 */
+ m->m_flags |= M_PKTHDR;
m->m_len = m->m_pkthdr.len = len;
/* mbuf refcnt is not contended, no need to use atomic
@@ -452,7 +453,9 @@ nm_os_generic_xmit_frame(struct nm_os_gen_arg *a)
M_HASHTYPE_SET(m, M_HASHTYPE_OPAQUE);
m->m_pkthdr.flowid = a->ring_nr;
m->m_pkthdr.rcvif = ifp; /* used for tx notification */
+ CURVNET_SET(ifp->if_vnet);
ret = NA(ifp)->if_transmit(ifp, m);
+ CURVNET_RESTORE();
return ret ? -1 : 0;
}