Don't manage free SQ entry index by the atomic operations
It is not necessary as entries are being manipulated under lock. Reviewed by: wma Obtained from: Semihalf Sponsored by: Cavium Differential Revision: https://reviews.freebsd.org/D5536
This commit is contained in:
parent
15e01a35e1
commit
d6d108caa1
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=297388
@ -48,7 +48,6 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/proc.h>
|
||||
#include <sys/sockio.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/stdatomic.h>
|
||||
#include <sys/cpuset.h>
|
||||
#include <sys/lock.h>
|
||||
#include <sys/mutex.h>
|
||||
@ -1048,7 +1047,7 @@ nicvf_init_snd_queue(struct nicvf *nic, struct snd_queue *sq, int q_len,
|
||||
|
||||
sq->desc = sq->dmem.base;
|
||||
sq->head = sq->tail = 0;
|
||||
atomic_store_rel_int(&sq->free_cnt, q_len - 1);
|
||||
sq->free_cnt = q_len - 1;
|
||||
sq->thresh = SND_QUEUE_THRESH;
|
||||
sq->idx = qidx;
|
||||
sq->nic = nic;
|
||||
@ -1640,7 +1639,7 @@ nicvf_get_sq_desc(struct snd_queue *sq, int desc_cnt)
|
||||
int qentry;
|
||||
|
||||
qentry = sq->tail;
|
||||
atomic_subtract_int(&sq->free_cnt, desc_cnt);
|
||||
sq->free_cnt -= desc_cnt;
|
||||
sq->tail += desc_cnt;
|
||||
sq->tail &= (sq->dmem.q_len - 1);
|
||||
|
||||
@ -1652,7 +1651,7 @@ static void
|
||||
nicvf_put_sq_desc(struct snd_queue *sq, int desc_cnt)
|
||||
{
|
||||
|
||||
atomic_add_int(&sq->free_cnt, desc_cnt);
|
||||
sq->free_cnt += desc_cnt;
|
||||
sq->head += desc_cnt;
|
||||
sq->head &= (sq->dmem.q_len - 1);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user