From patchwork Thu Jan 28 21:25:46 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Troy Kisky X-Patchwork-Id: 8154401 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 A6A0ABEEE5 for ; Thu, 28 Jan 2016 21:53:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D6CDB20219 for ; Thu, 28 Jan 2016 21:53:13 +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 03A5A20218 for ; Thu, 28 Jan 2016 21:53:13 +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 1aOuTm-00058r-O9; Thu, 28 Jan 2016 21:51:50 +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 1aOu7i-0005yq-JJ for linux-arm-kernel@lists.infradead.org; Thu, 28 Jan 2016 21:29:06 +0000 Received: by mail-pf0-x22e.google.com with SMTP id x125so29976432pfb.0 for ; Thu, 28 Jan 2016 13:28:45 -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=T1sTZOVWbrnZ3ANh697e9uQHFVm27u3ZIUf0zuxvds0=; b=FU19iuqevmPL504Cyisn/DbrdzBqIxeaWHq4YD7Fwmf9csmGdiyxpAdZWE7Hthk8UG ejOyh8bm5Ppsc8hslwateMQNXonyX6aCruN39VswT8o/PpufkleSQkFIbXZ2N4YWIqmX cblsZT8IcFqTREgkxVEW3kilnGMavzwUZe7vtcLEkzTGwfI2HDRNiaGm0O/I1Tgaop77 fj7RdA7lk0LCpftkLbESiuvwpR/5pn3Sy9ag5cLHf6HBoZt8bBcUKpyzhWQgvfaTphnR Kqu1+SA7AlgkUNscnx6MKCFRhR9RQcOeMIDAmzRCNX2udBVFWhxiGPuAYlI0xFdSaLxZ xr7A== 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=T1sTZOVWbrnZ3ANh697e9uQHFVm27u3ZIUf0zuxvds0=; b=H7gR/FQ4qRUtEsTTjyUnQer+4XtS3VwHj3KzN3t84W8s1lTKxI/pwxPptdJ3+qGVtl 6JUg7QFTpzokTRPBkkME97vqySl2jGADwcSc2Sxioge8xz7Pp15Er9rg9012xi2Az9wJ 1kTIXbKFdRy7VFlUXEYAbWhu6i5UaRvNuh9PbKC3jHekyKf1CmX2NlvBh+PoiihwskU+ MndiQ5iCG40X/ed3EkVRsV6oxovqSHz5ZRa9A5KTAJf5qawcr/lgw7sKMIvT0KCCBHN/ 7QRxb/eJ0MtTzPInyn89e5pNk+DuPsk0/CZygIUqdNdq2WeERtPJskkCiET1kWlkg2Bg bZCQ== X-Gm-Message-State: AG10YOSTWXBiIpLceoQ3huPtFh4MpgvUHqdB5dsztJitWC1LEiGaW93HiL7Xhfs/wAC7+Q== X-Received: by 10.98.42.10 with SMTP id q10mr7985561pfq.73.1454016525457; Thu, 28 Jan 2016 13:28:45 -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.43 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 28 Jan 2016 13:28:44 -0800 (PST) From: Troy Kisky To: netdev@vger.kernel.org, davem@davemloft.net, B38611@freescale.com Subject: [PATCH net-next 22/40] net: fec: call dma_unmap_single on mapped tx buffers at restart Date: Thu, 28 Jan 2016 14:25:46 -0700 Message-Id: <1454016364-30985-23-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_132902_972271_F89B30C2 X-CRM114-Status: GOOD ( 11.64 ) 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 Signed-off-by: Troy Kisky --- drivers/net/ethernet/freescale/fec_main.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index bc084ad9..da2e3c530 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c @@ -403,6 +403,7 @@ dma_mapping_error: bdp = fec_enet_get_nextdesc(bdp, &txq->bd); dma_unmap_single(&fep->pdev->dev, bdp->cbd_bufaddr, bdp->cbd_datlen, DMA_TO_DEVICE); + bdp->cbd_bufaddr = 0; } return ERR_PTR(-ENOMEM); } @@ -788,11 +789,18 @@ 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. */ + if (bdp->cbd_bufaddr) { + if (!IS_TSO_HEADER(txq, bdp->cbd_bufaddr)) + dma_unmap_single(&fep->pdev->dev, + bdp->cbd_bufaddr, + bdp->cbd_datlen, + DMA_TO_DEVICE); + bdp->cbd_bufaddr = 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); } @@ -2635,6 +2643,7 @@ static void fec_enet_free_buffers(struct net_device *ndev) bdp->cbd_bufaddr, FEC_ENET_RX_FRSIZE - fep->rx_align, DMA_FROM_DEVICE); + bdp->cbd_bufaddr = 0; dev_kfree_skb(skb); } bdp = fec_enet_get_nextdesc(bdp, &rxq->bd); @@ -2645,11 +2654,20 @@ static void fec_enet_free_buffers(struct net_device *ndev) txq = fep->tx_queue[q]; bdp = txq->bd.base; for (i = 0; i < txq->bd.ring_size; i++) { + if (bdp->cbd_bufaddr) { + if (!IS_TSO_HEADER(txq, bdp->cbd_bufaddr)) + dma_unmap_single(&fep->pdev->dev, + bdp->cbd_bufaddr, + bdp->cbd_datlen, + DMA_TO_DEVICE); + bdp->cbd_bufaddr = 0; + } kfree(txq->tx_bounce[i]); txq->tx_bounce[i] = NULL; skb = txq->tx_skbuff[i]; txq->tx_skbuff[i] = NULL; dev_kfree_skb(skb); + bdp = fec_enet_get_nextdesc(bdp, &txq->bd); } } }