From patchwork Wed Apr 6 02:25:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Troy Kisky X-Patchwork-Id: 8757591 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 1AD799F336 for ; Wed, 6 Apr 2016 02:31:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 35616202A1 for ; Wed, 6 Apr 2016 02:31:36 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 557AB20295 for ; Wed, 6 Apr 2016 02:31:35 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1andEH-000095-Un; Wed, 06 Apr 2016 02:30:01 +0000 Received: from mail-pf0-x231.google.com ([2607:f8b0:400e:c00::231]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1andCx-0007jL-Dq for linux-arm-kernel@lists.infradead.org; Wed, 06 Apr 2016 02:28:40 +0000 Received: by mail-pf0-x231.google.com with SMTP id e128so23106142pfe.3 for ; Tue, 05 Apr 2016 19:28:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=boundarydevices-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=rLstjlNg9tPlDt9u84l3pCVo5beAFZmzY3B3pb9LnAs=; b=k9n3C1/H+HG6GSnQUPmOiIdvQbFdwLJdZYU5U8UovYiB+odDmgIi3ZSDGgDtkl477n RtOfv7aZAQR/hICdRQLBcMRYFHpFijn2Ia1Tx5O5ylDfvdxSOypbGkx7f+lW0JJSdv2B CW1RxVc+XL7hCdQEUEXJ0UAdNQ+KbwJ62f3aFymy749Ib8sDJvJYRDr9ZExddzXy1Fu8 TnILRTjFMf5PbpndZiSaP647JQ0ZQhJrwgtoQlHZgkSsssdCOILhQD4lV3enCFJ3kQYf HSG6I/8InT/D6Q7uBbcOEik9SUOH9OctKamVUB2vy8mRibE5c+C3kYtLFb1h/v8wpIx7 j9Rg== 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:in-reply-to :references; bh=rLstjlNg9tPlDt9u84l3pCVo5beAFZmzY3B3pb9LnAs=; b=T+R/eiocHeeJ9ecTKt44FUn1M4bui+V7+9uujOXnHBj1ljNtCG/CfvvhAUQBgUObyw Xdofb294zGeeLei7QnvEpAW+iLCU5v2YSk/UyFG00PRZrKwUkpVUdRGGr5Ecu7UiTa4K Qxd1AayclJ8tgS5SrLVIecqQ2+ya958jsNuxEHMsP4TdN3Ldgu1mowcs/yPmw+1Kjw9R t6FfWb78oYvvRSImcE2PgNhcwqZU3IzdI2tjd4fK4jUcuvzMJXguobChj10CFhuxFp59 FcdIbcyX/u4uFktnTfWRItrA4qDAIr6ACITNwIeAhGISQMspr2tmQSkKtZnNQK75fpHb 3upQ== X-Gm-Message-State: AD7BkJKv42lb4k0wuyphyX5nRZZIinj4+YOezHsvwMArlR0+AtrYyB9NhMG8rfKsyNgiJQ== X-Received: by 10.98.16.198 with SMTP id 67mr34752330pfq.21.1459909698663; Tue, 05 Apr 2016 19:28:18 -0700 (PDT) Received: from localhost.localdomain (wsip-70-184-93-199.ph.ph.cox.net. [70.184.93.199]) by smtp.googlemail.com with ESMTPSA id l14sm528682pfi.23.2016.04.05.19.28.17 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 05 Apr 2016 19:28:18 -0700 (PDT) From: Troy Kisky To: netdev@vger.kernel.org, davem@davemloft.net, fugang.duan@nxp.com, lznuaa@gmail.com Subject: [PATCH net-next V3 06/16] net: fec: split off napi routine with 3 queues Date: Tue, 5 Apr 2016 19:25:52 -0700 Message-Id: <1459909562-22865-7-git-send-email-troy.kisky@boundarydevices.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1459909562-22865-1-git-send-email-troy.kisky@boundarydevices.com> References: <1459909562-22865-1-git-send-email-troy.kisky@boundarydevices.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160405_192839_632760_B5632F59 X-CRM114-Status: GOOD ( 13.54 ) X-Spam-Score: -2.6 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: andrew@lunn.ch, stillcompiling@gmail.com, arnd@arndb.de, sergei.shtylyov@cogentembedded.com, Troy Kisky , gerg@uclinux.org, fabio.estevam@nxp.com, johannes@sipsolutions.net, l.stach@pengutronix.de, linux-arm-kernel@lists.infradead.org, tremyfr@gmail.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP If we only have 1 tx/rx queue, we need not check the other queues. Signed-off-by: Troy Kisky --- v3: rebase changes only, fep is no longer passed as a parameter to fec_rxq/fec_txq --- drivers/net/ethernet/freescale/fec_main.c | 39 +++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index 918ac82..17140ea 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c @@ -1524,7 +1524,7 @@ fec_enet_interrupt(int irq, void *dev_id) return ret; } -static int fec_enet_rx_napi(struct napi_struct *napi, int budget) +static int fec_enet_napi_q3(struct napi_struct *napi, int budget) { struct net_device *ndev = napi->dev; struct fec_enet_private *fep = netdev_priv(ndev); @@ -1564,6 +1564,39 @@ static int fec_enet_rx_napi(struct napi_struct *napi, int budget) return pkts; } +static int fec_enet_napi_q1(struct napi_struct *napi, int budget) +{ + struct net_device *ndev = napi->dev; + struct fec_enet_private *fep = netdev_priv(ndev); + int pkts = 0; + uint events; + + do { + events = readl(fep->hwp + FEC_IEVENT); + if (fep->events) { + events |= fep->events; + fep->events = 0; + } + events &= FEC_ENET_RXF_0 | FEC_ENET_TXF_0; + if (!events) { + if (budget) { + napi_complete(napi); + writel(FEC_DEFAULT_IMASK, fep->hwp + FEC_IMASK); + } + return pkts; + } + + writel(events, fep->hwp + FEC_IEVENT); + if (events & FEC_ENET_RXF_0) + pkts += fec_rxq(ndev, fep->rx_queue[0], + budget - pkts); + if (events & FEC_ENET_TXF_0) + fec_txq(ndev, fep->tx_queue[0]); + } while (pkts < budget); + fep->events |= FEC_ENET_RXF_0; /* save for next callback */ + return pkts; +} + /* ------------------------------------------------------------------------- */ static void fec_get_mac(struct net_device *ndev) { @@ -3123,7 +3156,9 @@ static int fec_enet_init(struct net_device *ndev) ndev->ethtool_ops = &fec_enet_ethtool_ops; writel(FEC_RX_DISABLED_IMASK, fep->hwp + FEC_IMASK); - netif_napi_add(ndev, &fep->napi, fec_enet_rx_napi, NAPI_POLL_WEIGHT); + netif_napi_add(ndev, &fep->napi, (fep->num_rx_queues | + fep->num_tx_queues) == 1 ? fec_enet_napi_q1 : + fec_enet_napi_q3, NAPI_POLL_WEIGHT); if (fep->quirks & FEC_QUIRK_HAS_VLAN) /* enable hw VLAN support */