Use mtx_lock_spin/mtx_unlock_spin primitives on spin lock

Reviewed by:	luigi
MFC after:	1 week
This commit is contained in:
Andrey Zonov 2014-06-06 00:24:04 +00:00
parent 96db02f25a
commit dc8a95e62b
2 changed files with 8 additions and 8 deletions

View File

@ -1009,7 +1009,7 @@ netmap_rxsync_from_host(struct netmap_adapter *na, struct thread *td, void *pwai
(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_adapter *na, struct thread *td, void *pwai
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, struct mbuf *m)
* 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, struct mbuf *m)
m = NULL;
error = 0;
}
mtx_unlock(&q->lock);
mtx_unlock_spin(&q->lock);
done:
if (m)

View File

@ -76,9 +76,9 @@ static inline void __mbq_enqueue(struct mbq *q, struct mbuf *m)
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 *q)
{
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;
}