Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965537AbcCJKnk (ORCPT ); Thu, 10 Mar 2016 05:43:40 -0500 Received: from mail-wm0-f66.google.com ([74.125.82.66]:33181 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965356AbcCJKna (ORCPT ); Thu, 10 Mar 2016 05:43:30 -0500 MIME-Version: 1.0 In-Reply-To: References: <1457336157-31508-2-git-send-email-sunil.kovvuri@gmail.com> <20160307.111534.235286977900488968.davem@davemloft.net> <20160307.120410.1851177945150642006.davem@davemloft.net> Date: Thu, 10 Mar 2016 16:13:28 +0530 Message-ID: Subject: Re: [PATCH 1/2] net: thunderx: Set recevie buffer page usage count in bulk From: Sunil Kovvuri To: David Miller Cc: Linux Netdev List , LKML , LAKML , Sunil Goutham , Robert Richter Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1251 Lines: 40 Hi David, >> 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. > > Thanks for the suggestion, will check and get back. > I looked at the NIU driver and in fn() niu_rbr_refill() static void niu_rbr_refill(struct niu *np, struct rx_ring_info *rp, gfp_t mask) { int index = rp->rbr_index; rp->rbr_pending++; if ((rp->rbr_pending % rp->rbr_blocks_per_page) == 0) { Here it's been checked whether rbr_pending is a exact multiple of page split count. And hence updating page count based on fixed calculation is right. On my platform driver receives a interrupt when free buffer count falls below a threshold and by the time SW reads count of buffers to be refilled it can be any number i.e may or may not be a exact multiple of page split count. When interface is being brought down and while freeing unused receive buffers one page's count will go wrong and hence will disappear completely. In the patch i am updating page->count before issuing doorbell to HW irrespective of full page utilised or not. So there is no mismatch while doing put_page(unused buffer). Thanks, Sunil.