Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp4448818ybe; Mon, 9 Sep 2019 09:23:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqxdTlt3NEYg+FCMxCkqNKS4grxyDWAV7/HdKaARqED4PiV45NGQxaE53MWw4EDcPg4NBWtn X-Received: by 2002:a50:ab49:: with SMTP id t9mr21952888edc.301.1568046235516; Mon, 09 Sep 2019 09:23:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568046235; cv=none; d=google.com; s=arc-20160816; b=Ii1U9gvArheKIx32iLrTWmC2s1PC2TUj6x7boY1EAFTZ+iawWkUY1eVdkwRMf4T4mk aUSNWF/5+hxi0Ce4sapHATlk0zP7YFJOFBAs+/NNSbhgse32b3WlfE0xSMhayw6fNw46 YNhcpLXIgdsS6w6wpp5qyvIDToxyALszyfNAYhFh3TTu2PJoRcb7PteCWW1xCNFp52wX gCkPaVq8N9ja/d3optf+eGu0QcPTiE7HhAiuDhdG30nSG9ici/kVOWQj6nzdBF4eTyzw Kv3LSGqYEvAYFbu5lCCgW+CnESlmVmwzS9CgDAQn6gzSbfrvQ8ZOJcoqILtKDn4NKAb0 Y0XA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=WzA8jvWxS7rjh2YAcJlRTvtdhapjUW6colWdiqUaNpk=; b=zTbYOKJISQ5uyM2N7Wehmqkbmv2IKFH4aCN98qAJZRGWeTN0UnmR/J4tRguruUZtmY HTuLZrInUhnqCaea7DbbJhlms4OleoGK+icwdQR6dpjgDBRCcliumVdtwkrwyKV0K1GE tf0ZwgA2yOl22+Ul1Om3mqmhdI8P/yvc0fi77vi7Gl2CAHCenye7neUN4yOeB38VpBE5 z/AdyNVfHeoTnmPM9JV+Z8hSGsETvpSSqN3CcQ9v5wzcrOF1lHtYw2BnUXkkK0t5kCxh 17E4uCPXKnY+QEna0cbWmUyqQm2ZmQgEsxnOvxdnpOR5ZZWsQdnVIlHx//u6HhwyGdGW wGQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=xLEnf3vd; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z5si7321647edk.157.2019.09.09.09.23.18; Mon, 09 Sep 2019 09:23:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=xLEnf3vd; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727080AbfIHM5H (ORCPT + 99 others); Sun, 8 Sep 2019 08:57:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:38028 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731131AbfIHMsn (ORCPT ); Sun, 8 Sep 2019 08:48:43 -0400 Received: from localhost (unknown [62.28.240.114]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 49EAE218AC; Sun, 8 Sep 2019 12:48:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567946922; bh=P6zxFv9o4/b1cOgLWIe7mJyfenxsoJ4ZJtDeh7Q9hrA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xLEnf3vdNOA7QCG2fI5W3WvrEF6R9MWiiaF+rc+qcmfkuSMbzpkFxy7sNvwUnLVcN Q+NgKPwZ2zne/Gt70R7g4/Fld5F3w3HI2okubfpYISCgCv7YEOpx5pPt4576GtWBBE Yn2aHa5apQ1YeXxDTkw+oio6vhB5D8Glg90zY54I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Abdul Haleem , "Devesh K. Singh" , Thomas Falcon , "David S. Miller" , Sasha Levin Subject: [PATCH 4.19 34/57] ibmvnic: Unmap DMA address of TX descriptor buffers after use Date: Sun, 8 Sep 2019 13:41:58 +0100 Message-Id: <20190908121140.554764096@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190908121125.608195329@linuxfoundation.org> References: <20190908121125.608195329@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 80f0fe0934cd3daa13a5e4d48a103f469115b160 ] There's no need to wait until a completion is received to unmap TX descriptor buffers that have been passed to the hypervisor. Instead unmap it when the hypervisor call has completed. This patch avoids the possibility that a buffer will not be unmapped because a TX completion is lost or mishandled. Reported-by: Abdul Haleem Tested-by: Devesh K. Singh Signed-off-by: Thomas Falcon Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/ibm/ibmvnic.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c index 0ae43d27cdcff..255de7d68cd33 100644 --- a/drivers/net/ethernet/ibm/ibmvnic.c +++ b/drivers/net/ethernet/ibm/ibmvnic.c @@ -1586,6 +1586,8 @@ static int ibmvnic_xmit(struct sk_buff *skb, struct net_device *netdev) lpar_rc = send_subcrq_indirect(adapter, handle_array[queue_num], (u64)tx_buff->indir_dma, (u64)num_entries); + dma_unmap_single(dev, tx_buff->indir_dma, + sizeof(tx_buff->indir_arr), DMA_TO_DEVICE); } else { tx_buff->num_entries = num_entries; lpar_rc = send_subcrq(adapter, handle_array[queue_num], @@ -2747,7 +2749,6 @@ static int ibmvnic_complete_tx(struct ibmvnic_adapter *adapter, union sub_crq *next; int index; int i, j; - u8 *first; restart_loop: while (pending_scrq(adapter, scrq)) { @@ -2777,14 +2778,6 @@ restart_loop: txbuff->data_dma[j] = 0; } - /* if sub_crq was sent indirectly */ - first = &txbuff->indir_arr[0].generic.first; - if (*first == IBMVNIC_CRQ_CMD) { - dma_unmap_single(dev, txbuff->indir_dma, - sizeof(txbuff->indir_arr), - DMA_TO_DEVICE); - *first = 0; - } if (txbuff->last_frag) { dev_kfree_skb_any(txbuff->skb); -- 2.20.1