Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 6 Jun 2014 00:24:05 +0000 (UTC)
From:      Andrey Zonov <zont@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r267142 - head/sys/dev/netmap
Message-ID:  <201406060024.s560O57I077923@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: zont
Date: Fri Jun  6 00:24:04 2014
New Revision: 267142
URL: http://svnweb.freebsd.org/changeset/base/267142

Log:
  Use mtx_lock_spin/mtx_unlock_spin primitives on spin lock
  
  Reviewed by:	luigi
  MFC after:	1 week

Modified:
  head/sys/dev/netmap/netmap.c
  head/sys/dev/netmap/netmap_mbq.c

Modified: head/sys/dev/netmap/netmap.c
==============================================================================
--- head/sys/dev/netmap/netmap.c	Fri Jun  6 00:22:19 2014	(r267141)
+++ head/sys/dev/netmap/netmap.c	Fri Jun  6 00:24:04 2014	(r267142)
@@ -1009,7 +1009,7 @@ netmap_rxsync_from_host(struct netmap_ad
 	(void)pwait;	/* disable unused warnings */
 	(void)td;
 
-	mtx_lock(&q->lock);
+	mtx_lock_spin(&q->lock);
 
 	/* First part: import newly received packets */
 	n = mbq_len(q);
@@ -1051,7 +1051,7 @@ netmap_rxsync_from_host(struct netmap_ad
 	if (kring->rcur == kring->rtail && td) /* no bufs available */
 		selrecord(td, &kring->si);
 
-	mtx_unlock(&q->lock);
+	mtx_unlock_spin(&q->lock);
 	return ret;
 }
 
@@ -2381,7 +2381,7 @@ netmap_transmit(struct ifnet *ifp, struc
 	 * not possible on Linux).
 	 * Also avoid overflowing the queue.
 	 */
-	mtx_lock(&q->lock);
+	mtx_lock_spin(&q->lock);
 
         space = kring->nr_hwtail - kring->nr_hwcur;
         if (space < 0)
@@ -2398,7 +2398,7 @@ netmap_transmit(struct ifnet *ifp, struc
 		m = NULL;
 		error = 0;
 	}
-	mtx_unlock(&q->lock);
+	mtx_unlock_spin(&q->lock);
 
 done:
 	if (m)

Modified: head/sys/dev/netmap/netmap_mbq.c
==============================================================================
--- head/sys/dev/netmap/netmap_mbq.c	Fri Jun  6 00:22:19 2014	(r267141)
+++ head/sys/dev/netmap/netmap_mbq.c	Fri Jun  6 00:24:04 2014	(r267142)
@@ -76,9 +76,9 @@ static inline void __mbq_enqueue(struct 
 
 void mbq_safe_enqueue(struct mbq *q, struct mbuf *m)
 {
-    mtx_lock(&q->lock);
+    mtx_lock_spin(&q->lock);
     __mbq_enqueue(q, m);
-    mtx_unlock(&q->lock);
+    mtx_unlock_spin(&q->lock);
 }
 
 
@@ -110,9 +110,9 @@ struct mbuf *mbq_safe_dequeue(struct mbq
 {
     struct mbuf *ret;
 
-    mtx_lock(&q->lock);
+    mtx_lock_spin(&q->lock);
     ret =  __mbq_dequeue(q);
-    mtx_unlock(&q->lock);
+    mtx_unlock_spin(&q->lock);
 
     return ret;
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201406060024.s560O57I077923>