freebsd-dev/sys/dev/netmap
Vincenzo Maffione 16f224b5f8 netmap: vtnet: fix races in vtnet_netmap_reg()
The nm_register callback needs to call nm_set_native_flags()
or nm_clear_native_flags() once the device has been stopped.
However, in the current implementation this is not true,
as the device is stopped by vtnet_init_locked(). This causes
race conditions where the driver crashes as soon as it
dequeues netmap buffers assuming they are mbufs (or the other
way around).
To fix the issue, we extend vtnet_init_locked() with a second
argument that, if not zero, will set/clear the netmap flags.
This results in a huge simplification of the nm_register
callback itself.
Also, use netmap_reset() to check if a ring is going to be
re-initialized in netmap mode.

MFC after:	1 week
2020-06-14 20:47:31 +00:00
..
if_ptnet.c
if_re_netmap.h
if_vtnet_netmap.h netmap: vtnet: fix races in vtnet_netmap_reg() 2020-06-14 20:47:31 +00:00
netmap_bdg.c
netmap_bdg.h
netmap_freebsd.c
netmap_generic.c
netmap_kern.h netmap: introduce netmap_kring_on() 2020-06-11 20:35:28 +00:00
netmap_kloop.c
netmap_legacy.c
netmap_mbq.c
netmap_mbq.h
netmap_mem2.c
netmap_mem2.h
netmap_monitor.c
netmap_null.c
netmap_offloadings.c
netmap_pipe.c
netmap_vale.c netmap: vale: fix disabled logs 2020-06-03 05:49:19 +00:00
netmap.c