From patchwork Thu Feb 25 00:36:51 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Troy Kisky X-Patchwork-Id: 8415521 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 DB7C7C0553 for ; Thu, 25 Feb 2016 00:45:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0A22E2026F for ; Thu, 25 Feb 2016 00:45:02 +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 A557C202E9 for ; Thu, 25 Feb 2016 00:45:00 +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 1aYk1P-0001JD-Jh; Thu, 25 Feb 2016 00:43:11 +0000 Received: from mail-pf0-x22e.google.com ([2607:f8b0:400e:c00::22e]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aYjz4-000811-4n for linux-arm-kernel@lists.infradead.org; Thu, 25 Feb 2016 00:40:47 +0000 Received: by mail-pf0-x22e.google.com with SMTP id e127so22268239pfe.3 for ; Wed, 24 Feb 2016 16:40:26 -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=HTu2Z8WzQWdj5rEkwnCcuK0Ox7i6W94pOXq80r8liiM=; b=VZWC+pcks7oeLltVuo2sUnV4Lyya66I1XIapZIOB79NzrCikGIYNNYfq1pxnfhsQtc sPz4Yf9PAFcILqhHiTdfHpI1u5bhmi2cQea335qdMZzk3+GuPpbBQK6KUut28SEnMWis fXsqopx3+IIzNI4veQ/GM1U95rL4EjS6SqjjQM7xG8hfzcErHOwK3BViMoR7lQrUUGVq Tlg4uc1lv+7UQBKLfsGA/EReR5AW4uqhMZL1+F4EgS1xY1R6AyiZAFqHs8yyK0DS2xmj Y+003Z7qz4SJt4wAOo58vk5Vfp4ak7/J/iFcU/FopU/xUlGX+c6yOJgM+fqUXKEWkkXz Bpbg== 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=HTu2Z8WzQWdj5rEkwnCcuK0Ox7i6W94pOXq80r8liiM=; b=fm27DaYzqwByUokGywufgiiuElTyvSDWRfxtGp/hTgl3KiifMti7ZMmA8cioAY77wP xhMqdkmh28C3sX+7JDx0Loq33CB/dDsnmCJUdZC2AaQJr2rXIV5qCEJjKLGikShiXbpT eyptJHkl60usfFDqwbWySL3rpL8ue7PpScOIU4g1V0O6NKdb/o1Gdyf0Hz83u0got66G XCq4FTrqoI/N7p0RkfTEnM9oAZwkJXWPAYg4KqZstBacXJR8h6EFMMQBAQc7wuZYVWk3 LV8pHsfAwj/vkzLLlYbwJ+7OvzkYLdWPXPHdK1BzDI8pFJyGbCVqjHM5hFZJ1zifOud1 H8YQ== X-Gm-Message-State: AG10YOSHKDShbt5upZ4SEyj2dbRzDojWWiHkAuEfkiXfo6aMRFTwDjFJ0+lhoIQZ0UlvNw== X-Received: by 10.98.75.79 with SMTP id y76mr50090363pfa.147.1456360825697; Wed, 24 Feb 2016 16:40:25 -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.23 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 24 Feb 2016 16:40:25 -0800 (PST) From: Troy Kisky To: netdev@vger.kernel.org, davem@davemloft.net, B38611@freescale.com Subject: [PATCH net-next V2 08/16] net: fec: eliminate calls to fec_enet_get_prevdesc Date: Wed, 24 Feb 2016 17:36:51 -0700 Message-Id: <1456360619-24390-9-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_164046_381980_0FE7C6EF X-CRM114-Status: GOOD ( 14.01 ) 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 This shrinks the code a little. Signed-off-by: Troy Kisky --- drivers/net/ethernet/freescale/fec_main.c | 37 +++++++++---------------------- 1 file changed, 11 insertions(+), 26 deletions(-) diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index 6ceb5f9..b5ed287 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c @@ -758,6 +758,7 @@ static void fec_enet_bd_init(struct net_device *dev) struct bufdesc *bdp; unsigned int i; unsigned int q; + unsigned status; for (q = 0; q < fep->num_rx_queues; q++) { /* Initialize the receive buffer descriptors. */ @@ -765,19 +766,13 @@ static void fec_enet_bd_init(struct net_device *dev) bdp = rxq->bd.base; for (i = 0; i < rxq->bd.ring_size; i++) { - /* Initialize the BD for every fragment in the page. */ - if (bdp->cbd_bufaddr) - bdp->cbd_sc = cpu_to_fec16(BD_ENET_RX_EMPTY); - else - bdp->cbd_sc = cpu_to_fec16(0); + status = bdp->cbd_bufaddr ? BD_ENET_RX_EMPTY : 0; + if (bdp == rxq->bd.last) + status |= BD_SC_WRAP; + bdp->cbd_sc = cpu_to_fec16(status); bdp = fec_enet_get_nextdesc(bdp, &rxq->bd); } - - /* Set the last buffer to wrap */ - bdp = fec_enet_get_prevdesc(bdp, &rxq->bd); - bdp->cbd_sc |= cpu_to_fec16(BD_SC_WRAP); - rxq->bd.cur = rxq->bd.base; } @@ -789,18 +784,16 @@ static void fec_enet_bd_init(struct net_device *dev) for (i = 0; i < txq->bd.ring_size; i++) { /* Initialize the BD for every fragment in the page. */ - bdp->cbd_sc = cpu_to_fec16(0); if (txq->tx_skbuff[i]) { dev_kfree_skb_any(txq->tx_skbuff[i]); txq->tx_skbuff[i] = NULL; } bdp->cbd_bufaddr = cpu_to_fec32(0); + bdp->cbd_sc = cpu_to_fec16((bdp == txq->bd.last) ? + BD_SC_WRAP : 0); bdp = fec_enet_get_nextdesc(bdp, &txq->bd); } - - /* Set the last buffer to wrap */ bdp = fec_enet_get_prevdesc(bdp, &txq->bd); - bdp->cbd_sc |= cpu_to_fec16(BD_SC_WRAP); txq->dirty_tx = bdp; } } @@ -2717,19 +2710,16 @@ fec_enet_alloc_rxq_buffers(struct net_device *ndev, unsigned int queue) } rxq->rx_skbuff[i] = skb; - bdp->cbd_sc = cpu_to_fec16(BD_ENET_RX_EMPTY); if (fep->bufdesc_ex) { struct bufdesc_ex *ebdp = (struct bufdesc_ex *)bdp; ebdp->cbd_esc = cpu_to_fec32(BD_ENET_RX_INT); } + bdp->cbd_sc = cpu_to_fec16(BD_ENET_RX_EMPTY | + ((bdp == rxq->bd.last) ? BD_SC_WRAP : 0)); bdp = fec_enet_get_nextdesc(bdp, &rxq->bd); } - - /* Set the last buffer to wrap. */ - bdp = fec_enet_get_prevdesc(bdp, &rxq->bd); - bdp->cbd_sc |= cpu_to_fec16(BD_SC_WRAP); return 0; err_alloc: @@ -2752,21 +2742,16 @@ fec_enet_alloc_txq_buffers(struct net_device *ndev, unsigned int queue) if (!txq->tx_bounce[i]) goto err_alloc; - bdp->cbd_sc = cpu_to_fec16(0); bdp->cbd_bufaddr = cpu_to_fec32(0); if (fep->bufdesc_ex) { struct bufdesc_ex *ebdp = (struct bufdesc_ex *)bdp; ebdp->cbd_esc = cpu_to_fec32(BD_ENET_TX_INT); } - + bdp->cbd_sc = cpu_to_fec16((bdp == txq->bd.last) ? + BD_SC_WRAP : 0); bdp = fec_enet_get_nextdesc(bdp, &txq->bd); } - - /* Set the last buffer to wrap. */ - bdp = fec_enet_get_prevdesc(bdp, &txq->bd); - bdp->cbd_sc |= cpu_to_fec16(BD_SC_WRAP); - return 0; err_alloc: