From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by dpdk.org (Postfix) with ESMTP id 545C814EC for ; Thu, 11 May 2017 13:30:30 +0200 (CEST) Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v4BBNnAv141613 for ; Thu, 11 May 2017 07:30:29 -0400 Received: from e23smtp01.au.ibm.com (e23smtp01.au.ibm.com [202.81.31.143]) by mx0a-001b2d01.pphosted.com with ESMTP id 2ac5r854ej-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 11 May 2017 07:30:29 -0400 Received: from localhost by e23smtp01.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 11 May 2017 21:30:25 +1000 Received: from d23relay09.au.ibm.com (202.81.31.228) by e23smtp01.au.ibm.com (202.81.31.207) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 11 May 2017 21:30:23 +1000 Received: from d23av05.au.ibm.com (d23av05.au.ibm.com [9.190.234.119]) by d23relay09.au.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v4BBUFxu2621810 for ; Thu, 11 May 2017 21:30:23 +1000 Received: from d23av05.au.ibm.com (localhost [127.0.0.1]) by d23av05.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id v4BBToqe023370 for ; Thu, 11 May 2017 21:29:51 +1000 Received: from chozha.in.ibm.com ([9.79.197.152]) by d23av05.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id v4BBTnSE022722; Thu, 11 May 2017 21:29:49 +1000 From: Gowrishankar To: Ferruh Yigit Cc: dev@dpdk.org, Gowrishankar Muthukrishnan Date: Thu, 11 May 2017 16:59:32 +0530 X-Mailer: git-send-email 1.9.1 X-TM-AS-MML: disable x-cbid: 17051111-1617-0000-0000-000001D0675C X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17051111-1618-0000-0000-00004813A4DB Message-Id: <1494502172-16950-1-git-send-email-gowrishankar.m@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-05-11_08:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=2 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1703280000 definitions=main-1705110065 Subject: [dpdk-dev] [PATCH] kni: add new mbuf in alloc_q only based on its empty slots X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 May 2017 11:30:30 -0000 From: Gowrishankar Muthukrishnan 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 --- 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