From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wi0-f170.google.com (mail-wi0-f170.google.com [209.85.212.170]) by dpdk.org (Postfix) with ESMTP id 3B8982E81 for ; Wed, 26 Nov 2014 22:20:55 +0100 (CET) Received: by mail-wi0-f170.google.com with SMTP id bs8so16701373wib.5 for ; Wed, 26 Nov 2014 13:20:55 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:organization :user-agent:in-reply-to:references:mime-version :content-transfer-encoding:content-type; bh=wWhOgfywrEgSnoD6a/Ky6lfcxGD0YQNyt20cCIx60dY=; b=hu1FWSda3ucaJTanuOed+UYKaNmhTzovGzymL2GsaGrHM7vrTHDDsoEvcququSWBBo 4QmRZRnpIiubrjwq95Vxma48ZcN0G/OzHHm/1PQEK5fZ1zgeiD32jxVhojTVcvoIFa2B ZEog4rP9l8gi1PfwaQV+YVLdK0F8su62m17RfuoqGEGghbeZ1JF1OrIcpDu27kfQ6rjU LgmiQvpHxpqvo+PDkyggp5Nsbj/ijutHvxAGDe8mjeCTICbBPbMjPFz2TIGKsD9zc4DJ c/zlpupLm9D3+EXAcjAPyXhTlsZE+a4rqM8ppPyemBDU8ohuEN4hjCFGkQ7jZiQ1Tw1R A1WQ== X-Gm-Message-State: ALoCoQl0ol8R4nhx3B73wfvP4H2dgOUgJiOxRqQVokTEU6cPHVt6rxOE/EazSo+TS5YrU9tm9Dek X-Received: by 10.180.84.198 with SMTP id b6mr45629805wiz.41.1417036855111; Wed, 26 Nov 2014 13:20:55 -0800 (PST) Received: from xps13.localnet (136-92-190-109.dsl.ovh.fr. [109.190.92.136]) by mx.google.com with ESMTPSA id h14sm8842983wic.8.2014.11.26.13.20.53 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 Nov 2014 13:20:54 -0800 (PST) From: Thomas Monjalon To: dev@dpdk.org Date: Wed, 26 Nov 2014 22:20:32 +0100 Message-ID: <1520998.LI3zsdbzN8@xps13> Organization: 6WIND User-Agent: KMail/4.14.2 (Linux/3.17.2-1-ARCH; KDE/4.14.2; x86_64; ; ) In-Reply-To: <1791036.bZfV7z791K@xps13> References: <14060979121185-git-send-email-Hemant@freescale.com> <1791036.bZfV7z791K@xps13> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-dev] [PATCH] kni: optimizing the rte_kni_rx_burst X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Nov 2014 21:20:55 -0000 Ping 2014-11-11 23:58, Thomas Monjalon: > Is there anyone interested in KNI to review this patch please? > > > 2014-07-23 12:15, Hemant Agrawal: > > The current implementation of rte_kni_rx_burst polls the fifo for buffers. > > Irrespective of success or failure, it allocates the mbuf and try to put them into the alloc_q > > if the buffers are not added to alloc_q, it frees them. > > This waste lots of cpu cycles in allocating and freeing the buffers if alloc_q is full. > > > > The logic has been changed to: > > 1. Initially allocand add buffer(burstsize) to alloc_q > > 2. Add buffers to alloc_q only when you are pulling out the buffers. > > > > Signed-off-by: Hemant Agrawal > > --- > > lib/librte_kni/rte_kni.c | 8 ++++++-- > > 1 file changed, 6 insertions(+), 2 deletions(-) > > > > diff --git a/lib/librte_kni/rte_kni.c b/lib/librte_kni/rte_kni.c > > index 76feef4..01e85f8 100644 > > --- a/lib/librte_kni/rte_kni.c > > +++ b/lib/librte_kni/rte_kni.c > > @@ -263,6 +263,9 @@ rte_kni_alloc(struct rte_mempool *pktmbuf_pool, > > > > ctx->in_use = 1; > > > > + /* Allocate mbufs and then put them into alloc_q */ > > + kni_allocate_mbufs(ctx); > > + > > return ctx; > > > > fail: > > @@ -369,8 +372,9 @@ rte_kni_rx_burst(struct rte_kni *kni, struct rte_mbuf **mbufs, unsigned num) > > { > > unsigned ret = kni_fifo_get(kni->tx_q, (void **)mbufs, num); > > > > - /* Allocate mbufs and then put them into alloc_q */ > > - kni_allocate_mbufs(kni); > > + /* If buffers removed, allocate mbufs and then put them into alloc_q */ > > + if(ret) > > + kni_allocate_mbufs(kni); > > > > return ret; > > }