Received: by 10.223.185.116 with SMTP id b49csp8995078wrg; Fri, 2 Mar 2018 11:25:54 -0800 (PST) X-Google-Smtp-Source: AG47ELvKe6KjyaVAzIncIgfbsheWG5YxEkfdZ2kMxXf8mnFQSbh/wfXkPpUCfZU6uQHs6sc9YaRS X-Received: by 10.101.80.3 with SMTP id f3mr5471834pgo.242.1520018754692; Fri, 02 Mar 2018 11:25:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520018754; cv=none; d=google.com; s=arc-20160816; b=mf1LGOEIBmMpH6fWxpoAq2+Qj3TWL2TVkWO9p8g0rDqW7eCo9WCH33dvKv0fD2XMT8 7abiTzNXnPIukMArgTZQhTZ1jiOYaQR3SK3P9S6l2RJfEZDruibHweiASIPhAsL0Q//t oL/z1ILUpXF0eB8W7uKK5XwswxZ5VPbNI6J/lKlahNo9dT0AiKJR1uZTQCf+XUG89yV3 /b9xWfNVkFB3N8Br/8VrJX3cf/q95XdertDWkzCXVJxmsbP83kMDUUVZp+yb96oqD31Q BMlrLX/3eFEdnboxOabrM1wC7XtafQTnnfJnNHn+CXTTKLy5ADXC1mzTzYLDTi0/p+LO enxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=srLZ2YmBBNMsQGB/zJCccWUgmHkj4DcCbn1gXQ8zF3Q=; b=RyHrh6jy9dFtKrWPzyUwpRSLNyX2RPzWvYdkbOlyA3izKDb4Rvt2ajm9l9OryQZsl9 Ktl75HVPkiLlyVwDdpzR5UibfoADB8YtuTOVeR/HTvt7mtoddWfzyreC0FwW26cBhIf1 GM9ucZPmgynlSnMQjSb3qgrHNwoaMMeU0CVb6jnNBjGTvScMrJBY+RXnKRNRpqLRZrsF wbFwYL4icutbtG5u72ik8oWV0YsFcRpAt5twV1qXsC92ePNGsm8PGdhbQyGqQmvCXtmK EPNEL7f8miKiYPsNnkAXxwgv9IqR16FF76P4BXjmIyvDeebtluGO1+hItpzwaYMBNugX BS4g== ARC-Authentication-Results: i=1; mx.google.com; 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 r4si4372076pgp.603.2018.03.02.11.25.39; Fri, 02 Mar 2018 11:25:54 -0800 (PST) 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; 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 S1034388AbeCBPpP (ORCPT + 99 others); Fri, 2 Mar 2018 10:45:15 -0500 Received: from mail.bootlin.com ([62.4.15.54]:36264 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030192AbeCBPpK (ORCPT ); Fri, 2 Mar 2018 10:45:10 -0500 Received: by mail.bootlin.com (Postfix, from userid 110) id 0DC03207F2; Fri, 2 Mar 2018 16:45:02 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.free-electrons.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT shortcircuit=ham autolearn=disabled version=3.4.0 Received: from localhost (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.bootlin.com (Postfix) with ESMTPSA id AA67120715; Fri, 2 Mar 2018 16:45:01 +0100 (CET) From: Antoine Tenart To: davem@davemloft.net Cc: Yan Markman , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, thomas.petazzoni@bootlin.com, maxime.chevallier@bootlin.com, gregory.clement@bootlin.com, miquel.raynal@bootlin.com, nadavh@marvell.com, stefanc@marvell.com, mw@semihalf.com, Antoine Tenart Subject: [PATCH net-next 3/5] net: mvpp2: use a data size of 10kB for Tx FIFO on port 0 Date: Fri, 2 Mar 2018 16:40:42 +0100 Message-Id: <20180302154044.25204-4-antoine.tenart@bootlin.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180302154044.25204-1-antoine.tenart@bootlin.com> References: <20180302154044.25204-1-antoine.tenart@bootlin.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yan Markman This patch sets the Tx FIFO data size on port 0 to 10kB. This prepares the PPv2 driver for the Jumbo frame support addition as the hardware will need big enough Tx FIFO buffers when dealing with frames going through an interface with an MTU of 9000. Signed-off-by: Yan Markman [Antoine: commit message, small reworks.] Signed-off-by: Antoine Tenart --- drivers/net/ethernet/marvell/mvpp2.c | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/marvell/mvpp2.c b/drivers/net/ethernet/marvell/mvpp2.c index db511dd4249d..39635de51dd7 100644 --- a/drivers/net/ethernet/marvell/mvpp2.c +++ b/drivers/net/ethernet/marvell/mvpp2.c @@ -44,6 +44,7 @@ #define MVPP2_RX_ATTR_FIFO_SIZE_REG(port) (0x20 + 4 * (port)) #define MVPP2_RX_MIN_PKT_SIZE_REG 0x60 #define MVPP2_RX_FIFO_INIT_REG 0x64 +#define MVPP22_TX_FIFO_THRESH_REG(port) (0x8840 + 4 * (port)) #define MVPP22_TX_FIFO_SIZE_REG(port) (0x8860 + 4 * (port)) /* RX DMA Top Registers */ @@ -542,6 +543,11 @@ /* TX FIFO constants */ #define MVPP22_TX_FIFO_DATA_SIZE_10KB 0xa #define MVPP22_TX_FIFO_DATA_SIZE_3KB 0x3 +#define MVPP2_TX_FIFO_THRESHOLD_MIN 256 +#define MVPP2_TX_FIFO_THRESHOLD_10KB \ + (MVPP22_TX_FIFO_DATA_SIZE_10KB * 1024 - MVPP2_TX_FIFO_THRESHOLD_MIN) +#define MVPP2_TX_FIFO_THRESHOLD_3KB \ + (MVPP22_TX_FIFO_DATA_SIZE_3KB * 1024 - MVPP2_TX_FIFO_THRESHOLD_MIN) /* RX buffer constants */ #define MVPP2_SKB_SHINFO_SIZE \ @@ -8456,14 +8462,25 @@ static void mvpp22_rx_fifo_init(struct mvpp2 *priv) mvpp2_write(priv, MVPP2_RX_FIFO_INIT_REG, 0x1); } -/* Initialize Tx FIFO's */ +/* Initialize Tx FIFO's + * The CP110's total tx-fifo size is 19kB. + * Use large-size 10kB for fast port but 3kB for others. + */ static void mvpp22_tx_fifo_init(struct mvpp2 *priv) { - int port; + int port, size, thrs; - for (port = 0; port < MVPP2_MAX_PORTS; port++) - mvpp2_write(priv, MVPP22_TX_FIFO_SIZE_REG(port), - MVPP22_TX_FIFO_DATA_SIZE_3KB); + for (port = 0; port < MVPP2_MAX_PORTS; port++) { + if (port == 0) { + size = MVPP22_TX_FIFO_DATA_SIZE_10KB; + thrs = MVPP2_TX_FIFO_THRESHOLD_10KB; + } else { + size = MVPP22_TX_FIFO_DATA_SIZE_3KB; + thrs = MVPP2_TX_FIFO_THRESHOLD_3KB; + } + mvpp2_write(priv, MVPP22_TX_FIFO_SIZE_REG(port), size); + mvpp2_write(priv, MVPP22_TX_FIFO_THRESH_REG(port), thrs); + } } static void mvpp2_axi_init(struct mvpp2 *priv) -- 2.14.3