Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2330102imm; Mon, 28 May 2018 06:11:07 -0700 (PDT) X-Google-Smtp-Source: AB8JxZr413nJYXZ/fH9GooyPIiRy+DgSDK9y7F43zlwe9SBNp+cTKshHey8BEdPPWcd+ZRBRi84C X-Received: by 2002:a62:883:: with SMTP id 3-v6mr13662546pfi.154.1527513067006; Mon, 28 May 2018 06:11:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527513066; cv=none; d=google.com; s=arc-20160816; b=Kkpk9IjJGE0v2BHnLQxrSePqYQIFziauPYgq3LAbdLeLGa7rhh+lXA0LIv1qrjAiSR /vQBvHGmJ0NrZB72yNWfjLy4dx6YyxXN9/NDcOLdHIsdJ3QXZDGYaLayVw2HdAh/h+jH I88XCGTY3odnomcFDspPQSpfIPiN9It36471WHYGzFxh/2pzGKRZ18hYsNXV39A+zOoa 5M2C0EIjnOh7EYgrTXqikJ4tRCunxCspagnSiX0NX1N9J7x/Fv80tKMltFCbvnck+y7Q IPg7u5jOkiKKHSzTv5tAYnyVaoIXt/PDLg8c5TZSvLPRFZI2BE+alZveMoFJP3teex8U 9Kew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=swyDwUsh8LSsNSS03jTD2S7w7voFiwmfvDPs8AKKfDw=; b=BeOaYst3KESDCcDGqKhUGDy+91IvLzJAlQ4uoTdOGWnIlRh/G6t4J1pmMKowfir5xk nOgWPpMxluHeGMTVp25xSYPT/+ahzvu7s5jCel4ifCgF0izNF7HqNUbUhQucqxsVuWOu hTWfYqKqcMpTfrbP7dW2pyzw5mPCiQzPAQWjJhz2K20MuHFO7ydZNqEG6o3up4hxCeBI E6bvDtMNbm5mdLNKS3OBln485B2rBfAffWmAaLUfsVUz4LdAf2C7iud5yVC7o0X/rFrX KER03eo3r3o5qTWeFArVCFe9DpIjrhp0tMHj8lffYL5VZhAxgxPYYjDs5ijbh50Oa9MT XZBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=XTkEy7MH; 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 j10-v6si30753140pfn.87.2018.05.28.06.10.52; Mon, 28 May 2018 06:11:06 -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=XTkEy7MH; 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 S1163832AbeE1Kvf (ORCPT + 99 others); Mon, 28 May 2018 06:51:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:40890 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1163823AbeE1Kv2 (ORCPT ); Mon, 28 May 2018 06:51:28 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (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 96703204EE; Mon, 28 May 2018 10:51:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527504688; bh=BHEx/Vcv1rO/emlJ0fgHHqVmaAssXu0Lfnz3CVgzrsM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XTkEy7MH10XVWJ3toO0vC9X2+gh5CFRCuPAIVKkMr1d820hoiMrtM9e0+NW+mg2Bt wWptqNZr5ycbWFlK+jJ3+wxaRGlcM2U1u378AIYUZpkyL1gwYqFWtQWTNFCWLpem1C 8uhW6S1RMkRGzj1//injuDCb02G8mRMcywuxR7v0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hemanth Puranik , Timur Tabi , "David S. Miller" , Sasha Levin Subject: [PATCH 4.14 228/496] net: qcom/emac: Use proper free methods during TX Date: Mon, 28 May 2018 12:00:13 +0200 Message-Id: <20180528100329.511196546@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180528100319.498712256@linuxfoundation.org> References: <20180528100319.498712256@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Hemanth Puranik [ Upstream commit cc5db3150e87fe7f7e947bf333b6c1c97f848ecb ] This patch fixes the warning messages/call traces seen if DMA debug is enabled, In case of fragmented skb's memory was allocated using dma_map_page but freed using dma_unmap_single. This patch modifies buffer allocations in TX path to use dma_map_page in all the places and dma_unmap_page while freeing the buffers. Signed-off-by: Hemanth Puranik Acked-by: Timur Tabi Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/qualcomm/emac/emac-mac.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) --- a/drivers/net/ethernet/qualcomm/emac/emac-mac.c +++ b/drivers/net/ethernet/qualcomm/emac/emac-mac.c @@ -1204,9 +1204,9 @@ void emac_mac_tx_process(struct emac_ada while (tx_q->tpd.consume_idx != hw_consume_idx) { tpbuf = GET_TPD_BUFFER(tx_q, tx_q->tpd.consume_idx); if (tpbuf->dma_addr) { - dma_unmap_single(adpt->netdev->dev.parent, - tpbuf->dma_addr, tpbuf->length, - DMA_TO_DEVICE); + dma_unmap_page(adpt->netdev->dev.parent, + tpbuf->dma_addr, tpbuf->length, + DMA_TO_DEVICE); tpbuf->dma_addr = 0; } @@ -1363,9 +1363,11 @@ static void emac_tx_fill_tpd(struct emac tpbuf = GET_TPD_BUFFER(tx_q, tx_q->tpd.produce_idx); tpbuf->length = mapped_len; - tpbuf->dma_addr = dma_map_single(adpt->netdev->dev.parent, - skb->data, tpbuf->length, - DMA_TO_DEVICE); + tpbuf->dma_addr = dma_map_page(adpt->netdev->dev.parent, + virt_to_page(skb->data), + offset_in_page(skb->data), + tpbuf->length, + DMA_TO_DEVICE); ret = dma_mapping_error(adpt->netdev->dev.parent, tpbuf->dma_addr); if (ret) @@ -1381,9 +1383,12 @@ static void emac_tx_fill_tpd(struct emac if (mapped_len < len) { tpbuf = GET_TPD_BUFFER(tx_q, tx_q->tpd.produce_idx); tpbuf->length = len - mapped_len; - tpbuf->dma_addr = dma_map_single(adpt->netdev->dev.parent, - skb->data + mapped_len, - tpbuf->length, DMA_TO_DEVICE); + tpbuf->dma_addr = dma_map_page(adpt->netdev->dev.parent, + virt_to_page(skb->data + + mapped_len), + offset_in_page(skb->data + + mapped_len), + tpbuf->length, DMA_TO_DEVICE); ret = dma_mapping_error(adpt->netdev->dev.parent, tpbuf->dma_addr); if (ret)