Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp2672580ybl; Thu, 29 Aug 2019 11:16:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqykqwKS27TMw3lSJrswdD5seNrcijVlBTnMyBvNQXAQ6jAHPDGDR3YLDK9leR7mHKmTyMVf X-Received: by 2002:a17:902:a607:: with SMTP id u7mr11426969plq.43.1567102588422; Thu, 29 Aug 2019 11:16:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567102588; cv=none; d=google.com; s=arc-20160816; b=Xea5wq0R54QjuLtrunuF4CNgIIcuT1FgdP7ibb4C8f306zTNPjTdZM+/A7lp/Eyg5f 3vk+TeraAw2zf0Cde4N3KtkVg2GYty4MKI+9p+aSx7bXpfxm0FucPeE5Zh4rqgp3rVe6 gSLYqnQgYIS7RbMfmlXS7n8KMwfrfpE3z9tP3tMC2jO/XTjiBudyPs4w9+po8k/7/txl gGM4LmWz/fQCLp2nWtA1nwBbY+PINJBqWLxdDHTFx64/ir8Uuor2HYAnKUE3f8EN3H5i qGamvMAqYdgcngNzRkxDCS2NNDeCZa1nx2/3D8eVkWTC2v7omr0t6pkXP/DAzK/wLjZX uZMA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=xWbQWn4m1c0A/WoH3vhzX33CR+YiF2XBGaZGdrD+3t0=; b=JSQzLXqN8dINhtaWFL8GCxG83w6g5HZP2GKg6VoNO152ZMnQ5/kYeq5Um3KwOTbTSn 69IkrTP3cqPpru9ZTXc5dNAjxLUiWrHxqKXrm3XcEmeCQ4iagTytDWDBBCMZkvEWPi7M L7qwR0+E1ekw2IsZW36JRhSKgKYd10UIdLrWTWB7zepRupxdkY3Fwpc20W7RSdb0GSrB gXEMWw5cBzvTUzt862e2SO+tex2VF4Eyz46ZTfGUq3h8pSL1NpyeJdKZ9v4E0ukF0eta 5+coJ6cjOGW7RW6+KbP8EmCA3jiTE/kdIcKhlfsBJHAyuQBaiZZNy1ydRdmMrsucdqoc lMdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=gOCbRoOs; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 35si2563917plb.24.2019.08.29.11.16.12; Thu, 29 Aug 2019 11:16:28 -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=gOCbRoOs; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728998AbfH2SOr (ORCPT + 99 others); Thu, 29 Aug 2019 14:14:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:56352 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727978AbfH2SOn (ORCPT ); Thu, 29 Aug 2019 14:14:43 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 860152339E; Thu, 29 Aug 2019 18:14:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567102483; bh=G/rydemY/se9oRI2oc9ftz0a3FwIJOnjndeX+QAiB20=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gOCbRoOsMZEqosza4vZyH+k1uR4tVJF0Wz5YCD3fYYJ66giH9WGCRK5mojF6iOLXC AlVAvd1AzfZQ7wkJPIf98YZOFK2U7oR+aqDSO9qpAfdb0KPfySx9Nwg0mLa35tY8gE NKCmF6sDYyj4c6rBNoIgmbsd9pn1RR3gXaa+q03A= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Thomas Falcon , Abdul Haleem , "Devesh K . Singh" , "David S . Miller" , Sasha Levin , linuxppc-dev@lists.ozlabs.org, netdev@vger.kernel.org Subject: [PATCH AUTOSEL 5.2 43/76] ibmvnic: Unmap DMA address of TX descriptor buffers after use Date: Thu, 29 Aug 2019 14:12:38 -0400 Message-Id: <20190829181311.7562-43-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190829181311.7562-1-sashal@kernel.org> References: <20190829181311.7562-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Thomas Falcon [ 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 3da6800732656..cebd20f3128d4 100644 --- a/drivers/net/ethernet/ibm/ibmvnic.c +++ b/drivers/net/ethernet/ibm/ibmvnic.c @@ -1568,6 +1568,8 @@ static netdev_tx_t 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], @@ -2788,7 +2790,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)) { @@ -2818,14 +2819,6 @@ static int ibmvnic_complete_tx(struct ibmvnic_adapter *adapter, 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