From patchwork Tue Jul 14 21:56:52 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergei Shtylyov X-Patchwork-Id: 6789301 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Original-To: patchwork-linux-sh@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 5091F9F3E6 for ; Tue, 14 Jul 2015 21:57:04 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 72B85204D5 for ; Tue, 14 Jul 2015 21:57:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 675F7206BD for ; Tue, 14 Jul 2015 21:57:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751893AbbGNV5A (ORCPT ); Tue, 14 Jul 2015 17:57:00 -0400 Received: from mail-la0-f49.google.com ([209.85.215.49]:35330 "EHLO mail-la0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751360AbbGNV45 (ORCPT ); Tue, 14 Jul 2015 17:56:57 -0400 Received: by lahh5 with SMTP id h5so13927793lah.2 for ; Tue, 14 Jul 2015 14:56:55 -0700 (PDT) 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:organization :user-agent:mime-version:content-transfer-encoding:content-type; bh=e8k5HSGjahXFhSa3fB89iN4BnBgsrk27zLr4x2TLfkc=; b=XJCwXaqNCAwNRIWiJS2ria1pt9ei5McgTqxQwDHJRwqplXR1c56C48Q1bRMNwsiYW/ 0cbAP34K4cfnPcBL4JfKDoR9DSVKDsjCDAsye478mdCEmG8J0VKWd473AoTXRwILsSht B1pg3GohvCUSIO5hRB0WfFiPNDhvY3bbDOCLe9PPwO+Yd+iurWdEq1J1w5BkWkiqfO5/ ikRD2HlfnJlOY5sREQZMmBCFsjhhZOZldmMVDFo//3kZPdjMEP1n00uikELF9HwmAVtW 1jfoZ/c0YhgImcaVAcCF4ROuAo39Wv2/1tuVt4nbRRpoJPCeUB536WgNsba1fV7hT1At A0xA== X-Gm-Message-State: ALoCoQnWPrkO6PIGay0tnypWrYUGqAPLfPfk+TGvxYkYZ68T+/y8+yedIRXo0HEEncl+uLdtidwV X-Received: by 10.152.29.97 with SMTP id j1mr768159lah.104.1436911015230; Tue, 14 Jul 2015 14:56:55 -0700 (PDT) Received: from wasted.cogentembedded.com (ppp26-205.pppoe.mtu-net.ru. [81.195.26.205]) by smtp.gmail.com with ESMTPSA id gg1sm567211lbc.27.2015.07.14.14.56.53 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Jul 2015 14:56:54 -0700 (PDT) From: Sergei Shtylyov To: netdev@vger.kernel.org Cc: linux-sh@vger.kernel.org Subject: [PATCH] ravb: do not invalidate cache for RX buffer twice Date: Wed, 15 Jul 2015 00:56:52 +0300 Message-ID: <4759713.2ulGRKsd9L@wasted.cogentembedded.com> Organization: Cogent Embedded Inc. User-Agent: KMail/4.14.9 (Linux/4.0.6-200.fc21.x86_64; KDE/4.14.9; x86_64; ; ) MIME-Version: 1.0 Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, 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 First, dma_sync_single_for_cpu() shouldn't have been called in the first place (it's a streaming DMA API). dma_unmap_single() should have been called instead. Second, dma_unmap_single() call after handing the buffer to napi_gro_receive() makes little sense. Signed-off-by: Sergei Shtylyov --- The patch is against Dave Miller's 'net.git' repo. Don't know why I missed this DMA API misuse while working on the driver. :-< drivers/net/ethernet/renesas/ravb_main.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Index: net/drivers/net/ethernet/renesas/ravb_main.c =================================================================== --- net.orig/drivers/net/ethernet/renesas/ravb_main.c +++ net/drivers/net/ethernet/renesas/ravb_main.c @@ -543,10 +543,9 @@ static bool ravb_rx(struct net_device *n skb = priv->rx_skb[q][entry]; priv->rx_skb[q][entry] = NULL; - dma_sync_single_for_cpu(&ndev->dev, - le32_to_cpu(desc->dptr), - ALIGN(PKT_BUF_SZ, 16), - DMA_FROM_DEVICE); + dma_unmap_single(&ndev->dev, le32_to_cpu(desc->dptr), + ALIGN(PKT_BUF_SZ, 16), + DMA_FROM_DEVICE); get_ts &= (q == RAVB_NC) ? RAVB_RXTSTAMP_TYPE_V2_L2_EVENT : ~RAVB_RXTSTAMP_TYPE_V2_L2_EVENT; @@ -584,9 +583,6 @@ static bool ravb_rx(struct net_device *n if (!skb) break; /* Better luck next round. */ ravb_set_buffer_align(skb); - dma_unmap_single(&ndev->dev, le32_to_cpu(desc->dptr), - ALIGN(PKT_BUF_SZ, 16), - DMA_FROM_DEVICE); dma_addr = dma_map_single(&ndev->dev, skb->data, le16_to_cpu(desc->ds_cc), DMA_FROM_DEVICE);