From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752899AbbCDVcl (ORCPT ); Wed, 4 Mar 2015 16:32:41 -0500 Received: from violet.fr.zoreil.com ([92.243.8.30]:38002 "EHLO violet.fr.zoreil.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750934AbbCDVck (ORCPT ); Wed, 4 Mar 2015 16:32:40 -0500 Date: Wed, 4 Mar 2015 22:32:35 +0100 From: Francois Romieu To: Nicolas Schichan Cc: "David S. Miller" , Sebastian Hesselbarth , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v1] mv643xx_eth: only account for work done in rxq_process in poll callback. Message-ID: <20150304213235.GA20596@electric-eye.fr.zoreil.com> References: <1425492124-5033-1-git-send-email-nschichan@freebox.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1425492124-5033-1-git-send-email-nschichan@freebox.fr> X-Organisation: Land of Sunshine Inc. User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Nicolas Schichan : [...] > diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c > index 1c75829..52bc56b 100644 > --- a/drivers/net/ethernet/marvell/mv643xx_eth.c > +++ b/drivers/net/ethernet/marvell/mv643xx_eth.c [...] > @@ -1050,7 +1049,7 @@ static int txq_reclaim(struct tx_queue *txq, int budget, int force) > __netif_tx_lock_bh(nq); > > reclaimed = 0; > - while (reclaimed < budget && txq->tx_desc_count > 0) { > + while (txq->tx_desc_count > 0) { > int tx_index; > struct tx_desc *desc; > u32 cmd_sts; You may use a local 'int count = txq->tx_desc_count' variable then perform a single update at the end of the locked section. txq->tx_used_desc could be reworked in a similar way. > @@ -1105,8 +1104,7 @@ static int txq_reclaim(struct tx_queue *txq, int budget, int force) > > __netif_tx_unlock_bh(nq); > > - if (reclaimed < budget) > - mp->work_tx &= ~(1 << txq->index); > + mp->work_tx &= ~(1 << txq->index); > > return reclaimed; > } work_tx is also updated in irq context. I'd rather see "clear_flag() then reclaim()" than "reclaim() then clear_flag()" in a subsequent patch. -- Ueimor