DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] kni: add new mbuf in alloc_q only based on its empty slots
@ 2017-05-11 11:29 Gowrishankar
  2017-05-11 11:51 ` [dpdk-dev] [PATCH v2] " Gowrishankar
  0 siblings, 1 reply; 11+ messages in thread
From: Gowrishankar @ 2017-05-11 11:29 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: dev, Gowrishankar Muthukrishnan

From: Gowrishankar Muthukrishnan <gowrishankar.m@linux.vnet.ibm.com>

In kni_allocate_mbufs(), we attempt to add max_burst (32) count of mbuf always
into alloc_q, which is excessively leading too many rte_pktmbuf_free() when
alloc_q is contending at high packet rate (for eg 10Gig data). In a situation
when alloc_q fifo can only accommodate very few (or zero) mbuf, create only
what needed and add in fifo.

With this patch, we could stop random network stall in KNI at higher packet
rate (eg 1G or 10G data between vEth0 and PMD) sufficiently exhausting alloc_q
on above condition. I tested i40e PMD for this purpose in ppc64le.

Signed-off-by: Gowrishankar Muthukrishnan <gowrishankar.m@linux.vnet.ibm.com>
---
 lib/librte_kni/rte_kni.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/librte_kni/rte_kni.c b/lib/librte_kni/rte_kni.c
index c3f9208..7e0e9a6 100644
--- a/lib/librte_kni/rte_kni.c
+++ b/lib/librte_kni/rte_kni.c
@@ -624,6 +624,7 @@ struct rte_kni *
 	int i, ret;
 	struct rte_mbuf *pkts[MAX_MBUF_BURST_NUM];
 	void *phys[MAX_MBUF_BURST_NUM];
+	int allocq_free;
 
 	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, pool) !=
 			 offsetof(struct rte_kni_mbuf, pool));
@@ -646,7 +647,9 @@ struct rte_kni *
 		return;
 	}
 
-	for (i = 0; i < MAX_MBUF_BURST_NUM; i++) {
+	allocq_free = (kni->alloc_q->read - kni->alloc_q->write - 1) \
+			& MAX_MBUF_BURST_NUM;
+	for (i = 0; i < allocq_free; i++) {
 		pkts[i] = rte_pktmbuf_alloc(kni->pktmbuf_pool);
 		if (unlikely(pkts[i] == NULL)) {
 			/* Out of memory */
-- 
1.9.1

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2017-07-01 10:56 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-11 11:29 [dpdk-dev] [PATCH] kni: add new mbuf in alloc_q only based on its empty slots Gowrishankar
2017-05-11 11:51 ` [dpdk-dev] [PATCH v2] " Gowrishankar
2017-05-16 17:15   ` Ferruh Yigit
2017-05-18 17:45     ` gowrishankar muthukrishnan
2017-05-31 16:21       ` Ferruh Yigit
2017-06-01  5:56         ` gowrishankar muthukrishnan
2017-06-01  9:18           ` Ferruh Yigit
2017-06-06 14:43             ` gowrishankar muthukrishnan
2017-06-07 17:20               ` Ferruh Yigit
2017-06-07 17:20   ` Ferruh Yigit
2017-07-01 10:56     ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).