Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753190AbcCGREY (ORCPT ); Mon, 7 Mar 2016 12:04:24 -0500 Received: from shards.monkeyblade.net ([149.20.54.216]:51453 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752734AbcCGREM (ORCPT ); Mon, 7 Mar 2016 12:04:12 -0500 Date: Mon, 07 Mar 2016 12:04:10 -0500 (EST) Message-Id: <20160307.120410.1851177945150642006.davem@davemloft.net> To: sunil.kovvuri@gmail.com Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, sgoutham@cavium.com, robert.richter@caviumnetworks.com Subject: Re: [PATCH 1/2] net: thunderx: Set recevie buffer page usage count in bulk From: David Miller In-Reply-To: References: <1457336157-31508-2-git-send-email-sunil.kovvuri@gmail.com> <20160307.111534.235286977900488968.davem@davemloft.net> X-Mailer: Mew version 6.6 on Emacs 24.5 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Mon, 07 Mar 2016 09:04:12 -0800 (PST) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 909 Lines: 30 From: Sunil Kovvuri Date: Mon, 7 Mar 2016 22:28:39 +0530 > Hi David, > >>> you create a window of time during which the consumer >>> can release the page and prematurely free it. > Okay, but here the consumer i.e HW is notified only after page count > is incremented. > For example if you check 'nicvf_refill_rbdr' fn() only after receive > buffer ring is > refilled with buffers, doorbell is issued to hardware to start using > the new buffers. > > So > @@ -241,6 +254,8 @@ refill: > new_rb++; > } > > + nicvf_get_page(nic); > + > calling 'nicvf_get_page' before issuing doorbell ensures page ref > count is properly > set before hw/consumer can use the buffers. So if you know ahead of time how the page will be split up, just calculate that when you get the page and increment the page count appropriately. That's what we do in the NIU driver.