From patchwork Mon Jan 13 23:22:03 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaud Ebalard X-Patchwork-Id: 310410 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 66A7F2C0089 for ; Tue, 14 Jan 2014 10:22:30 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752210AbaAMXW1 (ORCPT ); Mon, 13 Jan 2014 18:22:27 -0500 Received: from smtp2-g21.free.fr ([212.27.42.2]:60364 "EHLO smtp2-g21.free.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751388AbaAMXW0 (ORCPT ); Mon, 13 Jan 2014 18:22:26 -0500 Received: from smtp.natisbad.org (unknown [IPv6:2a01:e35:139b:9f90:221:70ff:fe55:8f78]) by smtp2-g21.free.fr (Postfix) with ESMTP id 91D7E4B0072 for ; Tue, 14 Jan 2014 00:22:16 +0100 (CET) Received: by smtp.natisbad.org (Postfix, from userid 5001) id C43B12C0CD1; Tue, 14 Jan 2014 00:22:14 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=natisbad.org; s=mail; t=1389655334; bh=DXolyugqzER6x/Z3LvtNm5cGDzfs7tK91AnopovfawQ=; h=From:To:Cc:Subject:References:Date; b=sqlIelR2jjD3K6m2+YzyMr9ve3Ss/vz+XwHJOuyqqz6Bg6o5kBIUpgxJFJGosxI1S bz5SJglZ+IIciUppPZdwEeE3rNpuUl3xZC3b3FS++Kjj0na6t3t3XDxzFAYBcv00Nx Y2JgcKKljzZ2HSvYzE69nrwpRNVbgB1Dm3PYu8PA= X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on petit X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED, T_DKIM_INVALID autolearn=unavailable version=3.3.2 Received: from small (localhost [127.0.0.1]) by smtp.natisbad.org (Postfix) with ESMTP id 700952C073F; Tue, 14 Jan 2014 00:22:04 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=natisbad.org; s=mail; t=1389655324; bh=DXolyugqzER6x/Z3LvtNm5cGDzfs7tK91AnopovfawQ=; h=From:To:Cc:Subject:References:Date; b=GOPQRQpCiVpl0CSrM+NUQQWcPBP3P0ZwPszCoGN2hUCtED8O09LMlbTi7JXmoj52u Dn0lp91M0E3LHtAoubPvxLNQAm/Wg0ppEoc7gYyAi7g5OYR1O3eNvzLIK9v2oxSkpj K4mBsbGa7uVoIruyRGG7T3HWsHqqEbaCK+qq8b+E= From: arno@natisbad.org (Arnaud Ebalard) To: Willy Tarreau Cc: davem@davemloft.net, netdev@vger.kernel.org, Thomas Petazzoni , Gregory CLEMENT , Eric Dumazet Subject: Re: [PATCH 5/5] net: mvneta: replace Tx timer with a real interrupt References: <1389519069-1619-1-git-send-email-w@1wt.eu> <1389519069-1619-6-git-send-email-w@1wt.eu> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) X-PGP-Key-URL: http://natisbad.org/arno@natisbad.org.asc X-Fingerprint: D3A5 B68A 839B 38A5 815A 781B B77C 0748 A7AE 341B X-Hashcash: 1:20:140113:eric.dumazet@gmail.com::e4ln5sqTRqPlES18:00000000000000000000000000000000000000004po X-Hashcash: 1:20:140113:thomas.petazzoni@free-electrons.com::rDR6TPqxe2bXgkNU:000000000000000000000000000mVd X-Hashcash: 1:20:140113:davem@davemloft.net::bo+O0qIixEtjsJOq:0000000000000000000000000000000000000000003CkV X-Hashcash: 1:20:140113:gregory.clement@free-electrons.com::ER/6bGWBlM7JyHI7:0000000000000000000000000007bXh X-Hashcash: 1:20:140113:w@1wt.eu::2p71mqEtNGsvZ0jb:0000000007sMb X-Hashcash: 1:20:140113:netdev@vger.kernel.org::0X5H9eMemkjcS8R4:000000000000000000000000000000000000000Dj1k Date: Tue, 14 Jan 2014 00:22:03 +0100 Message-ID: <87y52jeack.fsf@natisbad.org> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Hi Willy, Willy Tarreau writes: > @@ -1935,14 +1907,22 @@ static int mvneta_poll(struct napi_struct *napi, int budget) > > /* Read cause register */ > cause_rx_tx = mvreg_read(pp, MVNETA_INTR_NEW_CAUSE) & > - MVNETA_RX_INTR_MASK(rxq_number); > + (MVNETA_RX_INTR_MASK(rxq_number) | MVNETA_TX_INTR_MASK(txq_number)); > + > + /* Release Tx descriptors */ > + if (cause_rx_tx & MVNETA_TX_INTR_MASK_ALL) { > + int tx_todo = 0; > + > + mvneta_tx_done_gbe(pp, (cause_rx_tx & MVNETA_TX_INTR_MASK_ALL), &tx_todo); > + cause_rx_tx &= ~MVNETA_TX_INTR_MASK_ALL; > + } Unless I missed something, tx_todo above is just here to make the compiler happy w/ current prototype of mvneta_tx_done_gbe() but is otherwise unused: you could simply remove the third parameter of the function (it is only used here) and remove tx_todo. Additionally, as you do not use the return value of the function, you could probably make it void and spare some additional cycles by removing the computation of the return value. While at it, mvneta_txq_done() could also be made void. The patch below gives the idea, it's compile-tested only and applies on your whole set (fixes + perf). --- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Index: linux/drivers/net/ethernet/marvell/mvneta.c =================================================================== --- linux.orig/drivers/net/ethernet/marvell/mvneta.c 2014-01-14 00:07:18.728729578 +0100 +++ linux/drivers/net/ethernet/marvell/mvneta.c 2014-01-14 00:11:57.740949448 +0100 @@ -1314,25 +1314,23 @@ } /* Handle end of transmission */ -static int mvneta_txq_done(struct mvneta_port *pp, +static void mvneta_txq_done(struct mvneta_port *pp, struct mvneta_tx_queue *txq) { struct netdev_queue *nq = netdev_get_tx_queue(pp->dev, txq->id); int tx_done; tx_done = mvneta_txq_sent_desc_proc(pp, txq); - if (tx_done == 0) - return tx_done; - mvneta_txq_bufs_free(pp, txq, tx_done); + if (tx_done) { + mvneta_txq_bufs_free(pp, txq, tx_done); - txq->count -= tx_done; + txq->count -= tx_done; - if (netif_tx_queue_stopped(nq)) { - if (txq->size - txq->count >= MAX_SKB_FRAGS + 1) - netif_tx_wake_queue(nq); + if (netif_tx_queue_stopped(nq)) { + if (txq->size - txq->count >= MAX_SKB_FRAGS + 1) + netif_tx_wake_queue(nq); + } } - - return tx_done; } static void *mvneta_frag_alloc(const struct mvneta_port *pp) @@ -1704,30 +1702,23 @@ /* Handle tx done - called in softirq context. The argument * must be a valid cause according to MVNETA_TXQ_INTR_MASK_ALL. */ -static u32 mvneta_tx_done_gbe(struct mvneta_port *pp, u32 cause_tx_done, - int *tx_todo) +static void mvneta_tx_done_gbe(struct mvneta_port *pp, u32 cause_tx_done) { struct mvneta_tx_queue *txq; - u32 tx_done = 0; struct netdev_queue *nq; - *tx_todo = 0; while (cause_tx_done) { txq = mvneta_tx_done_policy(pp, cause_tx_done); nq = netdev_get_tx_queue(pp->dev, txq->id); __netif_tx_lock(nq, smp_processor_id()); - if (txq->count) { - tx_done += mvneta_txq_done(pp, txq); - *tx_todo += txq->count; - } + if (txq->count) + mvneta_txq_done(pp, txq); __netif_tx_unlock(nq); cause_tx_done &= ~((1 << txq->id)); } - - return tx_done; } /* Compute crc8 of the specified address, using a unique algorithm , @@ -1961,9 +1952,7 @@ /* Release Tx descriptors */ if (cause_rx_tx & MVNETA_TX_INTR_MASK_ALL) { - int tx_todo = 0; - - mvneta_tx_done_gbe(pp, (cause_rx_tx & MVNETA_TX_INTR_MASK_ALL), &tx_todo); + mvneta_tx_done_gbe(pp, (cause_rx_tx & MVNETA_TX_INTR_MASK_ALL)); cause_rx_tx &= ~MVNETA_TX_INTR_MASK_ALL; }