git.droids-corp.org
/
dpdk.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
net/mlx5: handle Rx CQE compression
[dpdk.git]
/
lib
/
librte_ring
/
rte_ring.h
diff --git
a/lib/librte_ring/rte_ring.h
b/lib/librte_ring/rte_ring.h
index
943c97c
..
eb45e41
100644
(file)
--- a/
lib/librte_ring/rte_ring.h
+++ b/
lib/librte_ring/rte_ring.h
@@
-431,6
+431,11
@@
__rte_ring_mp_do_enqueue(struct rte_ring *r, void * const *obj_table,
uint32_t mask = r->prod.mask;
int ret;
uint32_t mask = r->prod.mask;
int ret;
+ /* Avoid the unnecessary cmpset operation below, which is also
+ * potentially harmful when n equals 0. */
+ if (n == 0)
+ return 0;
+
/* move prod.head atomically */
do {
/* Reset n to the initial burst count */
/* move prod.head atomically */
do {
/* Reset n to the initial burst count */
@@
-618,6
+623,11
@@
__rte_ring_mc_do_dequeue(struct rte_ring *r, void **obj_table,
unsigned i, rep = 0;
uint32_t mask = r->prod.mask;
unsigned i, rep = 0;
uint32_t mask = r->prod.mask;
+ /* Avoid the unnecessary cmpset operation below, which is also
+ * potentially harmful when n equals 0. */
+ if (n == 0)
+ return 0;
+
/* move cons.head atomically */
do {
/* Restore n as it may change every loop */
/* move cons.head atomically */
do {
/* Restore n as it may change every loop */