[dpdk-dev] [PATCH 1/4] net/memif: do not update local copy of tail in tx function
Honnappa Nagarahalli
honnappa.nagarahalli at arm.com
Mon Sep 21 21:22:51 CEST 2020
In the case of S2M queues, the receiver synchronizes with the sender
(i.e. informs of the packets it has received) using ring->tail.
Hence, the sender does not need to update last_tail.
In the case of M2S queues, the receiver uses last_tail to
keep track of the descriptors it has received. The
sender is not required to update the last_tail. Updating
the last_tail makes it a shared variable between the
transmitter and receiver affecting the performance.
Fixes: 09c7e63a71f9 ("net/memif: introduce memory interface PMD")
Cc: jgrajcia at cisco.com
Cc: stable at dpdk.org
Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli at arm.com>
Reviewed-by: Phil Yang <phil.yang at arm.com>
---
drivers/net/memif/rte_eth_memif.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/net/memif/rte_eth_memif.c b/drivers/net/memif/rte_eth_memif.c
index c1c7e9f8d..fd7dbc53e 100644
--- a/drivers/net/memif/rte_eth_memif.c
+++ b/drivers/net/memif/rte_eth_memif.c
@@ -568,12 +568,10 @@ eth_memif_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
ring_size = 1 << mq->log2_ring_size;
mask = ring_size - 1;
- n_free = __atomic_load_n(&ring->tail, __ATOMIC_ACQUIRE) - mq->last_tail;
- mq->last_tail += n_free;
-
if (type == MEMIF_RING_S2M) {
slot = __atomic_load_n(&ring->head, __ATOMIC_ACQUIRE);
- n_free = ring_size - slot + mq->last_tail;
+ n_free = ring_size - slot +
+ __atomic_load_n(&ring->tail, __ATOMIC_ACQUIRE);
} else {
slot = __atomic_load_n(&ring->tail, __ATOMIC_ACQUIRE);
n_free = __atomic_load_n(&ring->head, __ATOMIC_ACQUIRE) - slot;
--
2.17.1
More information about the dev
mailing list