From patchwork Thu Jan 28 21:25:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Troy Kisky X-Patchwork-Id: 8154081 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 EE364BEEE5 for ; Thu, 28 Jan 2016 21:34:17 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0527D2020F for ; Thu, 28 Jan 2016 21:34:17 +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 105382013A for ; Thu, 28 Jan 2016 21:34:16 +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 1aOuB9-0001XT-MD; Thu, 28 Jan 2016 21:32:35 +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 1aOu7V-0005v0-4s for linux-arm-kernel@lists.infradead.org; Thu, 28 Jan 2016 21:28:52 +0000 Received: by mail-pf0-x235.google.com with SMTP id n128so29532839pfn.3 for ; Thu, 28 Jan 2016 13:28:34 -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=Zz0K0cpvJwAKqVFs0q2rT6N3Sqbe+kwP2z6IIe86GPU=; b=mgMAM83b6sHg5HYnDBiI6TE0Mlgtxzclr3d4mQMN1ywcFdhlr743Wy1dnCfHUVGbqs f1YL5Gvqjy31vaqPSjECmT0OEJAC83Kfs1oawMCJLFwmbm9Lq9E4r+pFBSdH6ui6CRHh NUwcTgDY/xc8/yAqaq6vsm0Ij507NkevMoDYT9agLUs/dK1aPN1dXP9aK+ncTOaSSTUr swDdEABJO828JMMhuCwlnizJbbq9lALh3Z/Bwx+7nWnljTayaPkOeqlITt1B1bmlQusj HLPPu8NGEeYi+26ASjFYejClnY2u5nxmYvd0ZMLiQEW4CFnU1wex7W3OSyK+b7ZZXBK7 WI5w== 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=Zz0K0cpvJwAKqVFs0q2rT6N3Sqbe+kwP2z6IIe86GPU=; b=JWp/vhnMnDNZb5HWGWGg30RBDNpxggX8dNh7/kfHJLMh4oAxR590yC9pJH+L6KejnP Q16P+MjStiZReWXi8v/p3WYBDJEO9lDBHgEE0UQMM5lOm/7IDyg8AFjHBQuy4hYrLYRU 0/+FpgC5ixnQr3EmJSNxRyxrrD+K2nRA1sMCXq2JMAv3QnN0T/jfAStG9Pq73mzA7GiM RaDOPdXXQGUEh5ZMhwBMvnP8P0f7aAN8fxJUod2y1nX5ZbWBrdzNYK5xAYvoPybx74Go bQNe7h4JYKMaxRGYN2AL2C8AGQxCKB0urrqLIYffP9QLuUkozKoZKHEn//vIFWEq3UDN 9q4w== X-Gm-Message-State: AG10YOS2CIJjatB8lo5hlJgTDuXukXpaBYPLFDCm9Ra7ZOuFAEUb3lhUuSxWZNrBpTHLdQ== X-Received: by 10.98.87.196 with SMTP id i65mr7980463pfj.72.1454016513653; Thu, 28 Jan 2016 13:28:33 -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.32 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 28 Jan 2016 13:28:33 -0800 (PST) From: Troy Kisky To: netdev@vger.kernel.org, davem@davemloft.net, B38611@freescale.com Subject: [PATCH net-next 15/40] net: fec: set cbd_sc without relying on previous value Date: Thu, 28 Jan 2016 14:25:39 -0700 Message-Id: <1454016364-30985-16-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_132849_558545_DF42C1F9 X-CRM114-Status: GOOD ( 14.14 ) 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 Relying on the wrap bit to stay valid once initialized when the controller also writes to this byte seems undesirable since we can easily know what the value should be. Signed-off-by: Troy Kisky --- drivers/net/ethernet/freescale/fec_main.c | 31 ++++++++++--------------------- 1 file changed, 10 insertions(+), 21 deletions(-) diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index a7af1ac..9285425 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c @@ -338,9 +338,8 @@ fec_enet_txq_submit_frag_skb(struct fec_enet_priv_tx_q *txq, bdp = fec_enet_get_nextdesc(bdp, &txq->bd); ebdp = (struct bufdesc_ex *)bdp; - status = bdp->cbd_sc; - status &= ~BD_ENET_TX_STATS; - status |= (BD_ENET_TX_TC | BD_ENET_TX_READY); + status = (BD_ENET_TX_TC | BD_ENET_TX_READY) | + ((bdp == txq->bd.last) ? BD_SC_WRAP : 0); frag_len = skb_shinfo(skb)->frags[frag].size; /* Handle the last BD specially */ @@ -435,8 +434,6 @@ static int fec_enet_txq_submit_skb(struct fec_enet_priv_tx_q *txq, /* Fill in a Tx ring entry */ bdp = txq->bd.cur; last_bdp = bdp; - status = bdp->cbd_sc; - status &= ~BD_ENET_TX_STATS; /* Set buffer length and buffer pointer */ bufaddr = skb->data; @@ -461,6 +458,8 @@ static int fec_enet_txq_submit_skb(struct fec_enet_priv_tx_q *txq, return NETDEV_TX_OK; } + status = (BD_ENET_TX_TC | BD_ENET_TX_READY) | + ((bdp == txq->bd.last) ? BD_SC_WRAP : 0); if (nr_frags) { last_bdp = fec_enet_txq_submit_frag_skb(txq, skb, ndev); if (IS_ERR(last_bdp)) @@ -507,7 +506,6 @@ static int fec_enet_txq_submit_skb(struct fec_enet_priv_tx_q *txq, /* Send it on its way. Tell FEC it's ready, interrupt when done, * it's the last BD of the frame, and to put the CRC on the end. */ - status |= (BD_ENET_TX_READY | BD_ENET_TX_TC); bdp->cbd_sc = status; /* If this was the last BD in the ring, start at the beginning again. */ @@ -539,10 +537,8 @@ fec_enet_txq_put_data_tso(struct fec_enet_priv_tx_q *txq, struct sk_buff *skb, unsigned int estatus = 0; dma_addr_t addr; - status = bdp->cbd_sc; - status &= ~BD_ENET_TX_STATS; - - status |= (BD_ENET_TX_TC | BD_ENET_TX_READY); + status = (BD_ENET_TX_TC | BD_ENET_TX_READY) | + ((bdp == txq->bd.last) ? BD_SC_WRAP : 0); if (((unsigned long) data) & fep->tx_align || fep->quirks & FEC_QUIRK_SWAP_FRAME) { @@ -600,10 +596,8 @@ fec_enet_txq_put_hdr_tso(struct fec_enet_priv_tx_q *txq, unsigned short status; unsigned int estatus = 0; - status = bdp->cbd_sc; - status &= ~BD_ENET_TX_STATS; - status |= (BD_ENET_TX_TC | BD_ENET_TX_READY); - + status = (BD_ENET_TX_TC | BD_ENET_TX_READY) | + ((bdp == txq->bd.last) ? BD_SC_WRAP : 0); bufaddr = txq->tso_hdrs + index * TSO_HEADER_SIZE; dmabuf = txq->tso_hdrs_dma + index * TSO_HEADER_SIZE; if (((unsigned long)bufaddr) & fep->tx_align || @@ -1442,12 +1436,6 @@ static int fec_rxq(struct net_device *ndev, struct fec_enet_private *fep, } rx_processing_done: - /* Clear the status flags for this buffer */ - status &= ~BD_ENET_RX_STATS; - - /* Mark the buffer empty */ - status |= BD_ENET_RX_EMPTY; - if (fep->bufdesc_ex) { struct bufdesc_ex *ebdp = (struct bufdesc_ex *)bdp; @@ -1459,7 +1447,8 @@ rx_processing_done: * performed before transferring ownership. */ wmb(); - bdp->cbd_sc = status; + bdp->cbd_sc = BD_ENET_RX_EMPTY | + ((bdp == rxq->bd.last) ? BD_SC_WRAP : 0); /* Update BD pointer to next entry */ bdp = fec_enet_get_nextdesc(bdp, &rxq->bd);