diff options
author | Adrian Chadd <adrian@FreeBSD.org> | 2016-12-30 14:47:46 +0000 |
---|---|---|
committer | Adrian Chadd <adrian@FreeBSD.org> | 2016-12-30 14:47:46 +0000 |
commit | 869d88787db303d581fd6cee5d066d12f3cc9871 (patch) | |
tree | 66f116f273e58f7db169b15e67dd56189a8132fc /sys/dev/netmap/netmap_freebsd.c | |
parent | 9a4ee196ddf2107a1e9b195d3f2c822097732012 (diff) | |
download | src-869d88787db303d581fd6cee5d066d12f3cc9871.tar.gz src-869d88787db303d581fd6cee5d066d12f3cc9871.zip |
[netmap] fix locking regressions
* Firmware oriented NICs may need to sleep in their configuration paths.
Use RLOCK instead of WLOCK to allow this to again occur.
This fixes netmap on cxgbe.
* Change the worker lock to a normal mutex rather than a spin lock.
Drivers shouldn't be doing netmap work from the fast interrupt
handlers, so it's not required to be a spinlock.
Submitted by: luigi, Vincenzo Maffione <v.maffione@gmail.com>
Reviewed by: jhb
Notes
Notes:
svn path=/head/; revision=310822
Diffstat (limited to 'sys/dev/netmap/netmap_freebsd.c')
-rw-r--r-- | sys/dev/netmap/netmap_freebsd.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/dev/netmap/netmap_freebsd.c b/sys/dev/netmap/netmap_freebsd.c index fd4592b7b5ab..dd41c85965ec 100644 --- a/sys/dev/netmap/netmap_freebsd.c +++ b/sys/dev/netmap/netmap_freebsd.c @@ -92,7 +92,7 @@ nm_os_selinfo_uninit(NM_SELINFO_T *si) void nm_os_ifnet_lock(void) { - IFNET_WLOCK(); + IFNET_RLOCK(); } void @@ -1090,8 +1090,8 @@ nm_kthread_worker(void *data) continue; } else if (nmk->run) { /* wait on event with one second timeout */ - msleep_spin((void *)(uintptr_t)ctx->cfg.wchan, - &nmk->worker_lock, "nmk_ev", hz); + msleep((void *)(uintptr_t)ctx->cfg.wchan, + &nmk->worker_lock, 0, "nmk_ev", hz); nmk->scheduled++; } mtx_unlock(&nmk->worker_lock); @@ -1122,7 +1122,7 @@ nm_os_kthread_create(struct nm_kthread_cfg *cfg, unsigned int cfgtype, if (!nmk) return NULL; - mtx_init(&nmk->worker_lock, "nm_kthread lock", NULL, MTX_SPIN); + mtx_init(&nmk->worker_lock, "nm_kthread lock", NULL, MTX_DEF); nmk->worker_ctx.worker_fn = cfg->worker_fn; nmk->worker_ctx.worker_private = cfg->worker_private; nmk->worker_ctx.type = cfg->type; |