From patchwork Thu Feb 25 00:36:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Troy Kisky X-Patchwork-Id: 8415601 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 095E29F372 for ; Thu, 25 Feb 2016 00:49:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2CCE92010C for ; Thu, 25 Feb 2016 00:49:22 +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 5B01620108 for ; Thu, 25 Feb 2016 00:49:21 +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 1aYk5p-0006a3-IA; Thu, 25 Feb 2016 00:47:45 +0000 Received: from mail-pa0-x22e.google.com ([2607:f8b0:400e:c03::22e]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aYjzH-00083d-OJ for linux-arm-kernel@lists.infradead.org; Thu, 25 Feb 2016 00:41:02 +0000 Received: by mail-pa0-x22e.google.com with SMTP id fy10so21765793pac.1 for ; Wed, 24 Feb 2016 16:40:39 -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=g9AQ/iEmNAW/ekh28aWDkVubDfcHfs1fXuGbjEryzXU=; b=1fE/Q2E4kxqaVOIHd/CIVd4twWtyhg9DQ47VlbdPElIY6Wgl/GEVR/jxWTWzUjWX9+ q1xjrlU5ECLEXs7DKsSwug7/lH+Uca/+payXYrbZ89FjsyS3IxJ5iynoiVkE++CgkqtY CGtc1fvPd+qdpT02yIgc43vhnjVrNmwSmbq7Wxux4CTk1kbSZ4lg7gIeHSfFosIyy1Fs PY4d8IdI4T7RCXZ7rwA38IBnqdV1XECmi+jH4vmFnhQwzuv/vYX1btORHMTnl18kImZ5 QJ1Is4nE42JJA+XMRRU6klhBTwh0IciLNamlD6B0qQpHOCywJHq9jLiZwFEAUYOokzhf ixPg== 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=g9AQ/iEmNAW/ekh28aWDkVubDfcHfs1fXuGbjEryzXU=; b=h53edLiHhuVfzFx0YY1rqLdWBS+m7/VR/R9cYspi/ApH/vIp6/yRW8vTodVo3x4b+K euSescIPguZbGUvMVcmArjZ0pUWFFSHyEA+Rap8I9Q4mqTDO9145CpYoCaTmZaKtixv/ 0QgggJPobQkO9bIolwglNzfLOfCu/1pACBXWjbuxK3J4Mbu/Mrem3tZhP2Dd6Kt8Z+6p 41WdGaBLeod4Ebip1lkWxRc/R0HrEkNnjeXvWcJMMVw/O4AiES4kwKWyqMMeNAPM+H5a FVkmHaF1zpX10Kfa8rZ0CnJl1HWOg+umOlKEobGXTtOQMTwaZUceln8XLnlbcsyaoX+x DNlg== X-Gm-Message-State: AG10YORKT0floLgUcjawFPp/BGFT/eFwXh0oWmiR7YXX6CQ8z6wX66YasCmPtVTsxYT/hw== X-Received: by 10.66.144.134 with SMTP id sm6mr59197323pab.158.1456360839059; Wed, 24 Feb 2016 16:40:39 -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.37 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 24 Feb 2016 16:40:38 -0800 (PST) From: Troy Kisky To: netdev@vger.kernel.org, davem@davemloft.net, B38611@freescale.com Subject: [PATCH net-next V2 15/16] net: fec: call dma_unmap_single on mapped tx buffers at restart Date: Wed, 24 Feb 2016 17:36:58 -0700 Message-Id: <1456360619-24390-16-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_164100_090882_628187D6 X-CRM114-Status: GOOD ( 12.53 ) 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=ham 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 --- 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 8711196..1d71b2e 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); @@ -2647,6 +2655,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);