From patchwork Thu Feb 25 00:36:48 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Troy Kisky X-Patchwork-Id: 8415491 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 96236C0553 for ; Thu, 25 Feb 2016 00:43:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BBD6F202E9 for ; Thu, 25 Feb 2016 00:43:24 +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 6848F202D1 for ; Thu, 25 Feb 2016 00:43:23 +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 1aYk07-0000CV-88; Thu, 25 Feb 2016 00:41:51 +0000 Received: from mail-pf0-x22b.google.com ([2607:f8b0:400e:c00::22b]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aYjyy-00080A-ME for linux-arm-kernel@lists.infradead.org; Thu, 25 Feb 2016 00:40:42 +0000 Received: by mail-pf0-x22b.google.com with SMTP id x65so22280509pfb.1 for ; Wed, 24 Feb 2016 16:40:20 -0800 (PST) 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=6SepaHuxXwO2gQR3k9S6t+OoaxJFaQOkwzQY+Wom7kQ=; b=XMeNTablldbU9tmShoR/OxmyDsbcPQO5VXwzg1goGs6/DRs0bTMQm8j1HuIUpyntm9 kZ7bZnwycCuqWaC1M5utD1mf+8sYHjB1cv6P7yi/twy2pVXLZdoXuhv/bcggFWvbqQ8g 7oBf2gL9dXHuACJj7bH9kklYdFzKU9w254FEzXmq/SD7KuCkZdybtcLXI6/LYO/Rw6O3 1aONZCngqU7InaLy7CKCa3AQoIKTz6moTO03X3YnEzX7PxONyJCTcyaTGWX08t1COhEj F/fALOst2YGsCqvGCOIrsvc3xpCegurIUqfVKbT3vqn+wREovaik3C2O3KohQoRvbRBC eTSQ== 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=6SepaHuxXwO2gQR3k9S6t+OoaxJFaQOkwzQY+Wom7kQ=; b=IqzFwm/TWKNYbN9TsVxhlHYvlx2pKijkf/FLjOxT+VXbcpxWaHKNni7jge0LeRT2Qh unHpUhb4wWGx0eSt/UwQU56PtQP9i12n/kixyZ0AbZIuj6H6orI48HXuJ1WucfKvLcpS NHgKc5TU459XTjKu6emE+V+H4KEzd8xTjKgO+MYVZnnkw+gW/RgEvLTOcnWUDDUvOAd2 pzT2AzHc3cf2XVtjXKYtB8K0okIBrykgnn4LLJyzWCcN0zhN0xAZhXg4gatmmbu6clkH 9wdQOdIyXsF8/8X22kQiV24zr5GHN75chtVIIyMg6mGM5G8+XHzbXYL+QD6wE5ZwQ2Go J+YQ== X-Gm-Message-State: AG10YOTEMjkjbjoQQBJ0zc+wU8Iy9A6EV+1zxYaASkx3fcCYHftln1XWBFbU2VqeeTl8ng== X-Received: by 10.98.31.21 with SMTP id f21mr57518242pff.134.1456360820009; Wed, 24 Feb 2016 16:40:20 -0800 (PST) Received: from localhost.localdomain (wsip-70-184-93-199.ph.ph.cox.net. [70.184.93.199]) by smtp.googlemail.com with ESMTPSA id 79sm7561982pfr.22.2016.02.24.16.40.18 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 24 Feb 2016 16:40:19 -0800 (PST) From: Troy Kisky To: netdev@vger.kernel.org, davem@davemloft.net, B38611@freescale.com Subject: [PATCH net-next V2 05/16] net: fec: split off napi routine with 3 queues Date: Wed, 24 Feb 2016 17:36:48 -0700 Message-Id: <1456360619-24390-6-git-send-email-troy.kisky@boundarydevices.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1456360619-24390-1-git-send-email-troy.kisky@boundarydevices.com> References: <1456360619-24390-1-git-send-email-troy.kisky@boundarydevices.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160224_164040_950511_8E36FF7A X-CRM114-Status: GOOD ( 13.80 ) 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: fabio.estevam@freescale.com, andrew@lunn.ch, stillcompiling@gmail.com, linux@arm.linux.org.uk, arnd@arndb.de, sergei.shtylyov@cogentembedded.com, Troy Kisky , laci@boundarydevices.com, johannes@sipsolutions.net, l.stach@pengutronix.de, shawnguo@kernel.org, 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=-4.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 --- 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 4a218b9..610cf6c 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c @@ -1521,7 +1521,7 @@ fec_enet_interrupt(int irq, void *dev_id) return IRQ_HANDLED; } -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, fep->rx_queue[0], + budget - pkts); + if (events & FEC_ENET_TXF_0) + fec_txq(ndev, fep, 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 */