Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp5881780pxb; Thu, 27 Jan 2022 01:20:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJwinsQvtNgEQHk9T7/K5wtqD0c8iJR0zyQAFYOuAf56P0jW1TPlZcHHGfN0fSgqKGaQuKdZ X-Received: by 2002:a17:90b:3e8e:: with SMTP id rj14mr3268462pjb.35.1643275206394; Thu, 27 Jan 2022 01:20:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643275206; cv=none; d=google.com; s=arc-20160816; b=rwSijlBAghfwDndvE4WxagZHvE8+soXnQ8x5BxMbCDGb4e3FkKdTDvSSa3v48r0NRQ UBet1i/a2C1Mmk5S90agqXaMkGM799iDZN5wZCIuhFw8NhOnDcXqnNMCRcMFUpVTjcsT fXookicRmL8v83ZUcrYVmTNxD1UoZojq03qQwNUfZA6xBeJ0iU/AKZx+LO7/KTkSKMgc Xhb3q+tjCP3Or35fCR611Ff9nw2I7/Uci7cMsFBaTiFjo57MWyPTZ5BObfQDJsBP7wno 3XD1B1l9YELlFGoRDRDvno+8EAuUzX8e+62prZfgka02xCj7E5gRDgA/BlnHyAfCtjOD Nn4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=1Z4VArDTtAOxuFdjL+QvNhof6njmVX1hOvmyZvL8fsI=; b=T1yhqPYn1y5tRHhi8KKFmDxC8CQ5wgwwUajRCWQbxA8mlITtdkQBLf6GyVgGD2Xi23 u0ejXbdUtmQkFDL8q6FroAqeJ5bPv7k91SaKk2UlewQB5gY4LzYbChPQiCG+TSiBD/4X znHCl5dKtTUpFGRq/hENxo7Qy7MDn1gf7H/enanhMeRYyiDqoJHkHZ6r7+VjAbXvWMEY Fgg3FSPp5xS991CevSfrXm5TgdiHmmLZbhCYfi6VeoU2FC2dYNkP0J+SdkXiA4DUiFiU zOQNXFVaQrLrt7mLC6GMHMJj/ExFbAmd1sR6BrXshoACQnY48DsbDIOy7mUjcq9/7pAe XyAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=oMhBjV5P; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b10si1548446plk.604.2022.01.27.01.19.53; Thu, 27 Jan 2022 01:20:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=oMhBjV5P; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235202AbiA0Cek (ORCPT + 99 others); Wed, 26 Jan 2022 21:34:40 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:50830 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232931AbiA0Cej (ORCPT ); Wed, 26 Jan 2022 21:34:39 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B0CAA611B5; Thu, 27 Jan 2022 02:34:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BDC57C340E9; Thu, 27 Jan 2022 02:34:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1643250878; bh=nBFR2KGBtdN545VFqzbmwbS9CsNlhehTCJbDm0jsjsM=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=oMhBjV5P/LoBEf6KnKmjvwIypsbknPvT2oll3FELCjE+6UE92FEUqYLyfEWAxDdom s2cteejOWOk3V3qz9Sks+XQ/+HC0zoQ8Xh26OlHRCp79GEDkoM1zcH6FvB26dlmD7M 6rCqMRgkrfF/qWk1AEyFP9uvwj1SSw7H8pbyoLRIwX0+DGJ7x9Aht1JYpll+7qQkYz kptbgUIp/SXiX20M2+LRhO5+qYhJdboVUMMFECXdTYDo8LMDqPovTrdiiDUuXtsdKE VWcGkjQQaSh37kmyOZ+O9M3l5J4XitKGS3Qfq5wxz5GaUHp7xDKyYkJRqb3MI571W1 ySmhZyFV/EFDQ== Date: Wed, 26 Jan 2022 18:34:36 -0800 From: Jakub Kicinski To: Colin Foster Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, "David S. Miller" , UNGLinuxDriver@microchip.com, Alexandre Belloni , Claudiu Manoil , Vladimir Oltean Subject: Re: [PATCH v3 net-next 2/2] net: mscc: ocelot: use bulk reads for stats Message-ID: <20220126183436.063b467c@kicinski-fedora-PC1C0HJN.hsd1.ca.comcast.net> In-Reply-To: <20220125071531.1181948-3-colin.foster@in-advantage.com> References: <20220125071531.1181948-1-colin.foster@in-advantage.com> <20220125071531.1181948-3-colin.foster@in-advantage.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 24 Jan 2022 23:15:31 -0800 Colin Foster wrote: > Create and utilize bulk regmap reads instead of single access for gathering > stats. The background reading of statistics happens frequently, and over > a few contiguous memory regions. > > High speed PCIe buses and MMIO access will probably see negligible > performance increase. Lower speed buses like SPI and I2C could see > significant performance increase, since the bus configuration and register > access times account for a large percentage of data transfer time. > > Signed-off-by: Colin Foster > +static int ocelot_prepare_stats_regions(struct ocelot *ocelot) > +{ > + struct ocelot_stats_region *region = NULL; > + unsigned int last; > + int i; > + > + INIT_LIST_HEAD(&ocelot->stats_regions); > + > + for (i = 0; i < ocelot->num_stats; i++) { > + if (region && ocelot->stats_layout[i].offset == last + 1) { > + region->count++; > + } else { > + region = devm_kzalloc(ocelot->dev, sizeof(*region), > + GFP_KERNEL); > + if (!region) > + return -ENOMEM; > + > + region->offset = ocelot->stats_layout[i].offset; > + region->count = 1; > + list_add_tail(®ion->node, &ocelot->stats_regions); > + } > + > + last = ocelot->stats_layout[i].offset; > + } > + > + list_for_each_entry(region, &ocelot->stats_regions, node) { > + region->buf = devm_kzalloc(ocelot->dev, > + region->count * sizeof(*region->buf), > + GFP_KERNEL); devm_kcalloc() > + unnecessary new line > + if (!region->buf) > + return -ENOMEM;