From patchwork Wed Apr 6 02:26:01 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Troy Kisky X-Patchwork-Id: 8757701 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 217D2C0553 for ; Wed, 6 Apr 2016 02:35:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 56DBE202A1 for ; Wed, 6 Apr 2016 02:35:51 +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 7D52720295 for ; Wed, 6 Apr 2016 02:35:50 +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 1andIC-0005J7-2d; Wed, 06 Apr 2016 02:34:04 +0000 Received: from mail-pf0-x22f.google.com ([2607:f8b0:400e:c00::22f]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1andD8-0007lK-PZ for linux-arm-kernel@lists.infradead.org; Wed, 06 Apr 2016 02:28:52 +0000 Received: by mail-pf0-x22f.google.com with SMTP id c20so23185978pfc.1 for ; Tue, 05 Apr 2016 19:28:34 -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=2Wz8IhJCrexaiFQz8W7o59choCw0Eb4EejVPYukdxX0=; b=wGCLoud+RguaR54rqnlZc3/cPq1jEKeqJ7D5q02xLyAiJDKNRyAQNIgoL647U0TqUN ojgAMheTY/5hcdGnKuK5vM52YHMpH5ldq5Qy09/Wp78YgyqjXBPeVE3s/ynimYvz2PQa /2FzaoUWOvbcsBhA6C6q9JXTaccj4of+Gsa1qSqMREKPNyFiTffPkWWm73Q20uSljJy5 y0/BMh3DBsMjt8vgLJPpQZPVrATORrx3K8vmUw3W58aXZ+SYVzJSCCWF2I/+fjGDwc0A 9zJe2AylYDZqszkCMOWF+qudqFr3e6/khq3zPpp/kIfPCZEDeFsGJQFpgyX9qDMrATXE 6BAA== 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=2Wz8IhJCrexaiFQz8W7o59choCw0Eb4EejVPYukdxX0=; b=kyeVpMYgso3P2pkWRGPowSTCBVNQm8CJ/rVlqn5E16n6L5DIIBZTWp4bQMZpp+UJuv xWHvrUmq3HdVs3oSAiRu+6uj0SVeeNQThrA1Xp/f4P2C4koyx8BcGH9nimUkuNeh4xBg YKllMa9ayr8BieMZRHP/kbDnB0VNwEPnVL9tJmF0jth2907eFHWCkNH6cZUVn/Hehr4k T2dL11u6Sw57mpxbCro3EKRXdtQJzs6ExIBIemTwGq344X87dxl4KMEFouy78hBKCAkp O74vTN07Hbva1mOBW9nPO7bR+gku4A6e8TD/V2UjXSHH+TQtvhi9e84G7jEotfcDyMUt OrbQ== X-Gm-Message-State: AD7BkJK9tL/eA1TU2HmRVfxBAVTUrF2K8ClwQHyQOgHhgJ+Aq4GWKlfh/epDfmabaBoFfA== X-Received: by 10.98.71.70 with SMTP id u67mr34823922pfa.85.1459909713737; Tue, 05 Apr 2016 19:28:33 -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.32 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 05 Apr 2016 19:28:33 -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 15/16] net: fec: call dma_unmap_single on mapped tx buffers at restart Date: Tue, 5 Apr 2016 19:26:01 -0700 Message-Id: <1459909562-22865-16-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_192851_043544_8E4C3748 X-CRM114-Status: GOOD ( 11.99 ) 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 Make sure any pending tx buffers are unmapped when the fec is restarted. Signed-off-by: Troy Kisky --- v3: no change --- drivers/net/ethernet/freescale/fec_main.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index a38acf2..101d820 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c @@ -404,6 +404,7 @@ dma_mapping_error: bdp = fec_enet_get_nextdesc(bdp, &txq->bd); dma_unmap_single(&fep->pdev->dev, fec32_to_cpu(bdp->cbd_bufaddr), fec16_to_cpu(bdp->cbd_datlen), DMA_TO_DEVICE); + bdp->cbd_bufaddr = cpu_to_fec32(0); } return ERR_PTR(-ENOMEM); } @@ -761,11 +762,18 @@ static void reset_tx_queue(struct fec_enet_private *fep, txq->bd.cur = bdp; for (i = 0; i < txq->bd.ring_size; i++) { /* Initialize the BD for every fragment in the page. */ + if (bdp->cbd_bufaddr) { + if (!IS_TSO_HEADER(txq, fec32_to_cpu(bdp->cbd_bufaddr))) + dma_unmap_single(&fep->pdev->dev, + fec32_to_cpu(bdp->cbd_bufaddr), + fec16_to_cpu(bdp->cbd_datlen), + DMA_TO_DEVICE); + bdp->cbd_bufaddr = cpu_to_fec32(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); @@ -2643,6 +2651,7 @@ static void fec_enet_free_buffers(struct net_device *ndev) fec32_to_cpu(bdp->cbd_bufaddr), FEC_ENET_RX_FRSIZE - fep->rx_align, DMA_FROM_DEVICE); + bdp->cbd_bufaddr = cpu_to_fec32(0); dev_kfree_skb(skb); } bdp = fec_enet_get_nextdesc(bdp, &rxq->bd);