From patchwork Wed Apr 29 14:56:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Madalin Bucur X-Patchwork-Id: 466131 X-Patchwork-Delegate: scottwood@freescale.com Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 587BE1402BD for ; Thu, 30 Apr 2015 01:00:32 +1000 (AEST) Received: from ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 31B9B1A1939 for ; Thu, 30 Apr 2015 01:00:32 +1000 (AEST) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Received: from na01-bn1-obe.outbound.protection.outlook.com (mail-bn1on0119.outbound.protection.outlook.com [157.56.110.119]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id E10A41A11A4 for ; Thu, 30 Apr 2015 00:56:59 +1000 (AEST) Received: from DM2PR03CA0048.namprd03.prod.outlook.com (10.141.96.47) by BLUPR03MB550.namprd03.prod.outlook.com (10.141.76.28) with Microsoft SMTP Server (TLS) id 15.1.136.25; Wed, 29 Apr 2015 14:56:52 +0000 Received: from BL2FFO11FD019.protection.gbl (2a01:111:f400:7c09::131) by DM2PR03CA0048.outlook.office365.com (2a01:111:e400:2428::47) with Microsoft SMTP Server (TLS) id 15.1.148.16 via Frontend Transport; Wed, 29 Apr 2015 14:56:52 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=freescale.com; freescale.mail.onmicrosoft.com; dkim=none (message not signed) header.d=none; Received-SPF: Fail (protection.outlook.com: domain of freescale.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BL2FFO11FD019.mail.protection.outlook.com (10.173.161.37) with Microsoft SMTP Server (TLS) id 15.1.160.8 via Frontend Transport; Wed, 29 Apr 2015 14:56:51 +0000 Received: from localhost.localdomain (fsr-fed1764-003.ea.freescale.net [10.171.73.45]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id t3TEulpg017597; Wed, 29 Apr 2015 07:56:50 -0700 From: Madalin Bucur To: , Subject: [RFC,v3 03/10] dpaa_eth: add configurable bpool thresholds Date: Wed, 29 Apr 2015 17:56:38 +0300 Message-ID: <1430319405-31280-2-git-send-email-madalin.bucur@freescale.com> X-Mailer: git-send-email 1.5.6.5 In-Reply-To: <1430319405-31280-1-git-send-email-madalin.bucur@freescale.com> References: <1430319405-31280-1-git-send-email-madalin.bucur@freescale.com> X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:192.88.168.50; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(339900001)(189002)(199003)(33646002)(6806004)(49486002)(77096005)(46102003)(87936001)(77156002)(47776003)(2950100001)(53806999)(62966003)(50226001)(5001960100001)(50986999)(19580395003)(50466002)(86362001)(575784001)(229853001)(106466001)(5001770100001)(104016003)(43066003)(36756003)(76176999)(48376002)(19580405001)(105606002)(85426001)(142933001)(4001430100001); DIR:OUT; SFP:1102; SCL:1; SRVR:BLUPR03MB550; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; MLV:sfv; MX:1; A:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BLUPR03MB550; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(5005006)(3002001); SRVR:BLUPR03MB550; BCL:0; PCL:0; RULEID:; SRVR:BLUPR03MB550; X-Forefront-PRVS: 05610E64EE X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Apr 2015 14:56:51.6609 (UTC) X-MS-Exchange-CrossTenant-Id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=710a03f5-10f6-4d38-9ff4-a80b81da590d; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR03MB550 Cc: linux-kernel@vger.kernel.org, Madalin Bucur X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: madalin.bucur@freescale.com Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Allow the user to tweak the refill threshold and the total number of buffers in the buffer pool. The provided values are for one CPU. Signed-off-by: Madalin Bucur --- drivers/net/ethernet/freescale/dpaa/Kconfig | 18 ++++++++++++++++++ drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 2 +- drivers/net/ethernet/freescale/dpaa/dpaa_eth.h | 3 --- drivers/net/ethernet/freescale/dpaa/dpaa_eth_sg.c | 6 +++--- 4 files changed, 22 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/freescale/dpaa/Kconfig b/drivers/net/ethernet/freescale/dpaa/Kconfig index 1f3a203..9e6a39f 100644 --- a/drivers/net/ethernet/freescale/dpaa/Kconfig +++ b/drivers/net/ethernet/freescale/dpaa/Kconfig @@ -11,6 +11,24 @@ menuconfig FSL_DPAA_ETH if FSL_DPAA_ETH +config FSL_DPAA_ETH_MAX_BUF_COUNT + int "Maximum number of buffers in private bpool" + range 64 2048 + default "128" + ---help--- + The maximum number of buffers to be by default allocated in the DPAA-Ethernet private port's + buffer pool. One needn't normally modify this, as it has probably been tuned for performance + already. This cannot be lower than DPAA_ETH_REFILL_THRESHOLD. + +config FSL_DPAA_ETH_REFILL_THRESHOLD + int "Private bpool refill threshold" + range 32 FSL_DPAA_ETH_MAX_BUF_COUNT + default "80" + ---help--- + The DPAA-Ethernet driver will start replenishing buffer pools whose count + falls below this threshold. This must be related to DPAA_ETH_MAX_BUF_COUNT. One needn't normally + modify this value unless one has very specific performance reasons. + config FSL_DPAA_CS_THRESHOLD_1G hex "Egress congestion threshold on 1G ports" range 0x1000 0x10000000 diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c index 80c3651..2340e71 100644 --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c @@ -476,7 +476,7 @@ dpa_priv_bp_probe(struct device *dev) return ERR_PTR(-ENOMEM); dpa_bp->percpu_count = devm_alloc_percpu(dev, *dpa_bp->percpu_count); - dpa_bp->target_count = FSL_DPAA_ETH_MAX_BUF_COUNT; + dpa_bp->target_count = CONFIG_FSL_DPAA_ETH_MAX_BUF_COUNT; dpa_bp->seed_cb = dpa_bp_priv_seed; dpa_bp->free_buf_cb = _dpa_bp_free_pf; diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.h b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.h index 3d286a1..7656c85 100644 --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.h +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.h @@ -126,9 +126,6 @@ struct dpa_buffer_layout_s { #define DPAA_ETH_RX_QUEUES 128 -#define FSL_DPAA_ETH_MAX_BUF_COUNT 128 -#define FSL_DPAA_ETH_REFILL_THRESHOLD 80 - /* More detailed FQ types - used for fine-grained WQ assignments */ enum dpa_fq_type { FQ_TYPE_RX_DEFAULT = 1, /* Rx Default FQs */ diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth_sg.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth_sg.c index 1c0bdf0..baa767e 100644 --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth_sg.c +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth_sg.c @@ -152,7 +152,7 @@ int dpaa_eth_refill_bpools(struct dpa_bp *dpa_bp, int *countptr) int count = *countptr; int new_bufs; - if (unlikely(count < FSL_DPAA_ETH_REFILL_THRESHOLD)) { + if (unlikely(count < CONFIG_FSL_DPAA_ETH_REFILL_THRESHOLD)) { do { new_bufs = _dpa_bp_add_8_bufs(dpa_bp); if (unlikely(!new_bufs)) { @@ -163,10 +163,10 @@ int dpaa_eth_refill_bpools(struct dpa_bp *dpa_bp, int *countptr) break; } count += new_bufs; - } while (count < FSL_DPAA_ETH_MAX_BUF_COUNT); + } while (count < CONFIG_FSL_DPAA_ETH_MAX_BUF_COUNT); *countptr = count; - if (unlikely(count < FSL_DPAA_ETH_MAX_BUF_COUNT)) + if (unlikely(count < CONFIG_FSL_DPAA_ETH_MAX_BUF_COUNT)) return -ENOMEM; }