From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751857AbdKYO43 (ORCPT ); Sat, 25 Nov 2017 09:56:29 -0500 Received: from shards.monkeyblade.net ([184.105.139.130]:50920 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751668AbdKYO41 (ORCPT ); Sat, 25 Nov 2017 09:56:27 -0500 Date: Sat, 25 Nov 2017 23:56:24 +0900 (KST) Message-Id: <20171125.235624.170651475497287701.davem@davemloft.net> To: mika.westerberg@linux.intel.com Cc: michael.jamet@intel.com, yehezkel.bernat@intel.com, David.Laight@ACULAB.COM, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] net: thunderbolt: Stop using zero to mean no valid DMA mapping From: David Miller In-Reply-To: <20171124110536.39032-1-mika.westerberg@linux.intel.com> References: <20171124110536.39032-1-mika.westerberg@linux.intel.com> X-Mailer: Mew version 6.7 on Emacs 25.3 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Sat, 25 Nov 2017 06:56:27 -0800 (PST) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mika Westerberg Date: Fri, 24 Nov 2017 14:05:36 +0300 > Commit 86dabda426ac ("net: thunderbolt: Clear finished Tx frame bus > address in tbnet_tx_callback()") fixed a DMA-API violation where the > driver called dma_unmap_page() in tbnet_free_buffers() for a bus address > that might already be unmapped. The fix was to zero out the bus address > of a frame in tbnet_tx_callback(). > > However, as pointed out by David Miller, zero might well be valid > mapping (at least in theory) so it is not good idea to use it here. > > It turns out that we don't need the whole map/unmap dance for Tx buffers > at all. Instead we can map the buffers when they are initially allocated > and unmap them when the interface is brought down. In between we just > DMA sync the buffers for the CPU or device as needed. > > Signed-off-by: Mika Westerberg Applied, thanks.