From patchwork Thu Jan 28 21:25:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Troy Kisky X-Patchwork-Id: 8154131 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 8FB6C9F818 for ; Thu, 28 Jan 2016 21:37:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A490F2020F for ; Thu, 28 Jan 2016 21:37:35 +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 B8D312017D for ; Thu, 28 Jan 2016 21:37:34 +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 1aOuEM-0005z9-PK; Thu, 28 Jan 2016 21:35:54 +0000 Received: from mail-pf0-x235.google.com ([2607:f8b0:400e:c00::235]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aOu7a-0005vq-4v for linux-arm-kernel@lists.infradead.org; Thu, 28 Jan 2016 21:28:57 +0000 Received: by mail-pf0-x235.google.com with SMTP id n128so29533147pfn.3 for ; Thu, 28 Jan 2016 13:28:35 -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=cYecjEcOskiRVtZ1N7F2ofvqxMFIYh94gbKplK+ouaA=; b=ddeV5I84n/UlRdbnQitnSraYHO/dn8m86atSDUVb0Wqvp5lr+2FcwIiWdvyUtzMVi8 SNO2AJpgU3dBPGNHZ4NvsGROuHizRsTuF5qZ1XZYcbCEt+h5rMNMwvUp7kToKJXtfgtz OW2/pI3JvbOekRAW6J409+qWh1WKZOYajCeblBRiGqlK2lOLdhqq9lp5pBxfeY3n3WhI zhVbCV1xrBKbJAzW9B+hs1dkOjmyYXgsawoJuPq6j+kOfgfP2LFKRNZv3wJF/fAXiZ04 XYgqpQYAxN7W8zfMmxJvEYeHzCxhWqBYUqcjVRCu3lBz+l8jmzLMWKhv8kM4NWrmT8gG bAMw== 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=cYecjEcOskiRVtZ1N7F2ofvqxMFIYh94gbKplK+ouaA=; b=M7IHQRUZycJ6Uq8DdbbtME4v5zgV2X0zs73/31LZB7aeSj9NUkDj1Rwe3CMhrHp7kd doE44pm3x9IhTb3RT2MEbmMxVyui7fqJgmILIjkpiC4WEYOu/xDB/5hXN0ybtntPFFb6 555Cm9SlURw7m8IMLY48no/mgXcLOcEjqALlJ+xGG02VRZ9Z7Z7ZZxzXwi0BvW1P4lbJ voIJJH9ktF+6BdGt3ghmc8psN2POrYQNR7TFyKlVX1wk3ELaZKfjxAn86xnRPWyqEudX jWS2nr+MNQk0R6WX3ttZGl5yGvTUij2dNDp2aFZHpN8sv1LKFCSBkMUdgN88PUaKTU6e 4UhQ== X-Gm-Message-State: AG10YORU1QH5Cm7y8xgjgybPnBAilc++QoZ0PF0BVscoCal0mJUOyr7dy6TAN6x3YiYMtA== X-Received: by 10.98.32.156 with SMTP id m28mr8064930pfj.74.1454016515274; Thu, 28 Jan 2016 13:28:35 -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 c90sm18583190pfd.31.2016.01.28.13.28.33 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 28 Jan 2016 13:28:34 -0800 (PST) From: Troy Kisky To: netdev@vger.kernel.org, davem@davemloft.net, B38611@freescale.com Subject: [PATCH net-next 16/40] net: fec: eliminate calls to fec_enet_get_prevdesc Date: Thu, 28 Jan 2016 14:25:40 -0700 Message-Id: <1454016364-30985-17-git-send-email-troy.kisky@boundarydevices.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1454016364-30985-1-git-send-email-troy.kisky@boundarydevices.com> References: <1454016364-30985-1-git-send-email-troy.kisky@boundarydevices.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160128_132854_757280_551A8F28 X-CRM114-Status: GOOD ( 13.76 ) 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, linux@arm.linux.org.uk, Troy Kisky , laci@boundarydevices.com, 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 | 34 ++++++++----------------------- 1 file changed, 9 insertions(+), 25 deletions(-) diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index 9285425..1a838cc 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 = BD_ENET_RX_EMPTY; - else - bdp->cbd_sc = 0; + status = bdp->cbd_bufaddr ? BD_ENET_RX_EMPTY : 0; + if (bdp == rxq->bd.last) + status |= BD_SC_WRAP; + bdp->cbd_sc = 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 |= BD_SC_WRAP; - rxq->bd.cur = rxq->bd.base; } @@ -789,18 +784,15 @@ 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 = 0; if (txq->tx_skbuff[i]) { dev_kfree_skb_any(txq->tx_skbuff[i]); txq->tx_skbuff[i] = NULL; } bdp->cbd_bufaddr = 0; + bdp->cbd_sc = (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 |= BD_SC_WRAP; txq->dirty_tx = bdp; } } @@ -2712,19 +2704,16 @@ fec_enet_alloc_rxq_buffers(struct net_device *ndev, unsigned int queue) } rxq->rx_skbuff[i] = skb; - bdp->cbd_sc = BD_ENET_RX_EMPTY; if (fep->bufdesc_ex) { struct bufdesc_ex *ebdp = (struct bufdesc_ex *)bdp; ebdp->cbd_esc = BD_ENET_RX_INT; } + bdp->cbd_sc = 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 |= BD_SC_WRAP; return 0; err_alloc: @@ -2747,21 +2736,16 @@ fec_enet_alloc_txq_buffers(struct net_device *ndev, unsigned int queue) if (!txq->tx_bounce[i]) goto err_alloc; - bdp->cbd_sc = 0; bdp->cbd_bufaddr = 0; if (fep->bufdesc_ex) { struct bufdesc_ex *ebdp = (struct bufdesc_ex *)bdp; ebdp->cbd_esc = BD_ENET_TX_INT; } + bdp->cbd_sc = (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 |= BD_SC_WRAP; - return 0; err_alloc: