Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3384720imm; Sun, 19 Aug 2018 19:50:00 -0700 (PDT) X-Google-Smtp-Source: AA+uWPw3zbVypjXfajHLEcQQeK2wlqjH8fEsP8f8EXCZtp8oNWSelNPTip12CEENHZspAefB8V4M X-Received: by 2002:aa7:83cd:: with SMTP id j13-v6mr46326578pfn.236.1534733400607; Sun, 19 Aug 2018 19:50:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534733400; cv=none; d=google.com; s=arc-20160816; b=MWLbJR2IArnfy+retKarwU2utuxHegZcv9eq2tEIONXTQb4rmynchvd+GHoCh5vZiI 3eDWjPfmCk4C7ftl0OKAc8HcLtkRmnsG9sKUGG+YtKj+dryHVJVSWl9WXNCUbAZPgmtL TBI7JAEsWX/t9CtgFPsXaXrjoUNIiQGYBV3SjDDBeYrB93khsWq+4OV70IoWPhrBG4LL k9sPMdv1r/kASuTeazRwLQHinBDKTCh7zWkr49XNdgzYqdT7m3DNcC56nimqNFA1q1LB Y0E1P4D5BchaZhwMEAkbXTu2d/V+hJuHeOV9JlBXf72ppTfM28G2ekkolXs3P07+IAAE bvXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=b1I7dBbI/arDrANAKQX779/AMaCxS+x0jAszuzQ5uOU=; b=mHh3OCIeLTKit+NT2pnDUOBCwOB63donilJyrW90W0ieh3J0M7GWadpxb/yxr6xSET ImsbMCRosdZms5ZWgLdR3j91QHaMjrLOVCZwMHMj1Vduwbp4pSz4dy4/rkofXEar4H7j hqSmqUqrgB3Rye/W1XYYVsAsBgKkzXVLKRPfVlWGxQ3M65dFSrq0sb2WvLnw0E/2iawW AKGmjDKPBmkt+VRHrMbaPWUGsnxxJdHkCr/yVL3/in4zHOUubmpadaZp6KBmCR7JWDRh FbcKNZHrhieU1PxBYz4seSPs+MI82g4awoNwrdGR3c0+hmUFSJcP55p/9L56+zMCiDCY s84A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Tqc380+t; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n7-v6si8879240pfn.241.2018.08.19.19.49.33; Sun, 19 Aug 2018 19:50:00 -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=@linaro.org header.s=google header.b=Tqc380+t; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726132AbeHTGB3 (ORCPT + 99 others); Mon, 20 Aug 2018 02:01:29 -0400 Received: from mail-yw1-f68.google.com ([209.85.161.68]:45894 "EHLO mail-yw1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725994AbeHTGB3 (ORCPT ); Mon, 20 Aug 2018 02:01:29 -0400 Received: by mail-yw1-f68.google.com with SMTP id 139-v6so6323332ywg.12 for ; Sun, 19 Aug 2018 19:47:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=b1I7dBbI/arDrANAKQX779/AMaCxS+x0jAszuzQ5uOU=; b=Tqc380+thWPlWjZdC43KIH9HsvJPBgjMwmT0IBzXAVc6OY8X5GHz/CVwSMLbYos0WX LOmHVBg5zoR5z0kMmMV5h2vN/8kQBD2idwExwxMltwsujCsD2KcAxbJEKoMHDEOmogvP GPrE6XSuEiw+9mVNHsyMjrlj2mgdDkwsXISSc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=b1I7dBbI/arDrANAKQX779/AMaCxS+x0jAszuzQ5uOU=; b=diiFsMC/gKXqeuxzNAyamI6Zgb8Ba/aQ5Ml0//7cMZD5FUrKtHEYbZZwUkFjRsCFVq Nifwl7cbGnbXH2a9o6U1DxuhQ7xE559M4fK+0jiJylwd1V0Z0jR5TYAnbXig1JVwyDhJ Xo/CBmhoHQcOBrlpqgRFN8F/3YRTWpm4VYWivK7ZXt2KX6HzcCAXmG4W22jUw51nqusp ZkTbM8tWJDu49FHF4xs/OtEuIEk5MBJ9zsshl4DUg0zRjOF6FIgvc1smguLCJmH6+uvu XAEfCGr2GmrUrWI//cH3IAKa9AYMFTxKrGo4mOMVhNVNbt948sxnRMdoEG0MMS+8dcFn 6U7g== X-Gm-Message-State: AOUpUlFFSb9nL/tO9HciSCS3z2HcPCmMuxuGhC5OZc9R0wJTcumGSMYi /f0zAubDKXharv5Utax7vEWHIg== X-Received: by 2002:a81:518e:: with SMTP id f136-v6mr4067828ywb.46.1534733263608; Sun, 19 Aug 2018 19:47:43 -0700 (PDT) Received: from a8k.localdomain (68-248-140-212.lightspeed.austtx.sbcglobal.net. [68.248.140.212]) by smtp.gmail.com with ESMTPSA id h65-v6sm4335668ywe.75.2018.08.19.19.47.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 19 Aug 2018 19:47:42 -0700 (PDT) From: Brian Brooks To: davem@davemloft.net Cc: antoine.tenart@bootlin.com, maxime.chevallier@bootlin.com, ymarkman@marvell.com, stefanc@marvell.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, bjorn.topel@intel.com, brian.brooks@arm.com, Brian Brooks Subject: [PATCH] net: mvpp2: avoid bouncing buffers Date: Sun, 19 Aug 2018 21:47:30 -0500 Message-Id: <20180820024730.9147-1-brian.brooks@linaro.org> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Some memory regions used by this device need to share the same upper 8 bits of the 40-bit bus address. Currently, a coherent DMA mask of 32 bits is used so that dma_alloc_coherent() regions have the same upper 8 bits. Packet buffers are not allocated via DMA APIs, and the device does not require these memory regions to have the same upper 8 bits. However, packet buffers are being bounced during streaming mappings because streaming and coherent DMA are using the same DMA mask, i.e. dev->dma_mask points to dev->coherent_dma_mask. Avoid bouncing packet buffers by ensuring streaming DMA uses a mask of 40 bits and coherent DMA uses a mask of 32 bits. iperf3 shows throughput increases from 4.04 Gbps to 9.14 Gbps. Signed-off-by: Brian Brooks --- drivers/net/ethernet/marvell/mvpp2/mvpp2.h | 3 +++ drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2.h b/drivers/net/ethernet/marvell/mvpp2/mvpp2.h index def00dc3eb4e..3eb0c3ede8d2 100644 --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2.h +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2.h @@ -676,6 +676,9 @@ struct mvpp2 { struct clk *mg_core_clk; struct clk *axi_clk; + /* DMA mask for streaming mappings */ + u64 dma_mask; + /* List of pointers to port structures */ int port_count; struct mvpp2_port *port_list[MVPP2_MAX_PORTS]; diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c index 0319ed9ef8b8..3a190c489589 100644 --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c @@ -5126,6 +5126,12 @@ static int mvpp2_probe(struct platform_device *pdev) } if (priv->hw_version == MVPP22) { + /* Platform code may have set dev->dma_mask to point + * to dev->coherent_dma_mask, but we want to ensure + * they take different values due to comment below. + */ + pdev->dev.dma_mask = &priv->dma_mask; + err = dma_set_mask(&pdev->dev, MVPP2_DESC_DMA_MASK); if (err) goto err_axi_clk; -- 2.17.1