From patchwork Fri Jan 28 20:05:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12729017 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 95E53C433F5 for ; Fri, 28 Jan 2022 20:06:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344406AbiA1UGE (ORCPT ); Fri, 28 Jan 2022 15:06:04 -0500 Received: from mail-dm6nam12on2138.outbound.protection.outlook.com ([40.107.243.138]:24992 "EHLO NAM12-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S234277AbiA1UGD (ORCPT ); Fri, 28 Jan 2022 15:06:03 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fktAqssuPmKyMVUz65r6XxsSV2tglx3ofeqp8IlzF8tJZMxKaPD1UHI+xCgZTrGPi1pAlGg+pUT5Z+meCtYrVamqgIL6rqlPfhv7LQzjGsceUJzG2TU/88gYKTC/kYcTAZe7lseg2q8epJAnZhVOIKqRYnG0W9se96qElKdqwn0SWdIc0GsrZjeKHvl98KstSZWwYCJJNJIxNJMPDxntoPwDVvTekANtTGH1Kh29atn1UPLjq4rzUWYoR6TazBhZuu19yjpoVj++6bwIUs1nd6962bTK7+FhWyD23B97fkG6dc9FLcPnPrIqVazfmTSEwSjO4pIRrmR/r8fvTeB5PQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=cK/1LA6KEtx1ERaM6rz8b3aJv6RvJWyas2Vmh/LMWRA=; b=LBB2arjz6GUWaF1/fDVqv9+Nagtw6yKS+HuE7iNm561NTDkBukkf8/dEyA9kpUMNodCYABdw202uFZZJbgZe4vejLDKnrds9nt1mRuTPRfSeze3iPCbwxKfupri9usQ0DS3kIvbaPCmb1MwbayGT6+uH2CmCFiMIxsVMqdXWhp7iWM+OLRgYKJfZewn+lIplQ1KEC7Y5ldfnHANhXbQ65JK2T68jOPmvRerLJo2qDMwcxncLJdlrHn+zB6tMSAkX4lDDgeaWmz7Bzwr+sR0nC0Soxb4YxRLuiBmLZ7jwRcDIu4LUkQpDhPL5+kNaUtHAyjIyg6bDu+qNYgu7oJsloQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inadvantage.onmicrosoft.com; s=selector2-inadvantage-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=cK/1LA6KEtx1ERaM6rz8b3aJv6RvJWyas2Vmh/LMWRA=; b=u6b+2W/hpGKHSZukH+d4Rz7QNtlyZhz1rsQozUAGmAXrOPElf/buoM6Ey2xdGFy9/c70BPJpQQ4erF3zEcaZvn5GeF8cjjlXbNo4po/VYD9CwzSP1izXiq2nM6ii8dsYrpZjqA4OAoihLRdMbUbGXATiB7POrpADlo2GVGDflCA= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=in-advantage.com; Received: from MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) by CH0PR10MB4969.namprd10.prod.outlook.com (2603:10b6:610:c8::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4930.15; Fri, 28 Jan 2022 20:06:02 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::2d52:2a96:7e6c:460f]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::2d52:2a96:7e6c:460f%4]) with mapi id 15.20.4909.017; Fri, 28 Jan 2022 20:06:02 +0000 From: Colin Foster To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org Cc: Jakub Kicinski , "David S. Miller" , UNGLinuxDriver@microchip.com, Alexandre Belloni , Claudiu Manoil , Vladimir Oltean Subject: [PATCH v4 net-next 0/2] use bulk reads for ocelot statistics Date: Fri, 28 Jan 2022 12:05:47 -0800 Message-Id: <20220128200549.1634446-1-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 X-ClientProxiedBy: MW4PR03CA0152.namprd03.prod.outlook.com (2603:10b6:303:8d::7) To MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4e190373-36dd-4563-7a7b-08d9e2999b7e X-MS-TrafficTypeDiagnostic: CH0PR10MB4969:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1468; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9NO54B7ouH0+pOK9WVNDcwpsW5T5vnnNCn7amW72hADRgNl3evr0y8+27tPrYEDri8ckHt+ufEy4oG92qQzWJrmWWjpDSKk9qHmkb7W8FNCmT/a5Yg+0yIh1wqDW6v6Hqh0aAG8D/HOs8xFo2DZcAj6RgnR/yY2OKH3uF37GPTHw0bohak3mQHd4xQolJvfm8ofw1L+GzyVKJeji0AQv9hGGAMG0Kora2D0TxW3W9Lk2/07ix3FEBy3vgeGKWLCV5IYOtrFQrPxL33T5I+Mz8DedewUb0iF9jEDzQWBmApplNTsL3BJp9hk21x9aYQ75W8/49QLEpaBix1jltKCx/2JCEYOIpRVNV4dYAC3oGjf6PntjKjOXY/EgmyedJTe20QBnBxrsMIjNWBiB/8iQgjogtPvjsUu1m1cyg4pEpv/pqy05Bg/iDK6vGdIVv1vF5tr9mJvej6meFF9nNmsYkvUpHp/Tww2OVg578assSz8A1VIYBUzxsIxRLYboDiQ3xiaosy2vCMiqVWA9bzq+Sbns+xzpcrGNFzDhJbygWtZ1K+b2pjO4zxUjkUXePBH3moiY2NTG4rHuvj2EQZdWE3YUqN3F+w0dmlt34KFBJKWfpbbnsbblkSMzSmLhc3lhMd8VS5AbA8JYHd5J0I24MR3BbIo5u9Wb8s7OCRw1lpug6ekuM0RAa5hPtmpcdkK45+vv8gTEA2GXRlLwXf1qOA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR1001MB2351.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(39830400003)(396003)(376002)(136003)(42606007)(346002)(366004)(83380400001)(2616005)(66556008)(66946007)(66476007)(36756003)(6506007)(6512007)(8676002)(6666004)(4326008)(8936002)(52116002)(38100700002)(38350700002)(26005)(44832011)(54906003)(5660300002)(316002)(508600001)(86362001)(6486002)(2906002)(186003)(1076003)(20210929001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: hWKFx4s4s7eS1rPOXb5Zd/e5lfWtgzzH9i8iwIC4EvAO4UGksGLQksxvV9+OzQhB7IwCebnYGN3l2q7BoiT2GtmP/N6to2mUYVu6VP6IxjHg1Dr7jCmcoaGJXuuWWu2+IFUA2/AlTrr8s+GrVXeguk+XdVOVVu1w3c/gLbN0NfgHh4twRXL13sQBsHIsC21uibH1V6Qj7BeYXJSt6MSUj15C324/QBc3aIRo777nsh6egjjE9t44a6mT76nNqLUtYOWjDPgBPEkP1RlkuMarLc9q9DhQGwu9zoTgXSF0yi03ccbCUlvJNoLwBq/AV3mQKgA1BXvyz4VYwMTx4x4ugrqspamuH5dHyTFyqE/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1TVsqbAMcXsFJYAdGwhLWs6MDAXvkSd/JtXJT3Us753CDogUJvFgc2bwMMyM+rHxrEqeAo/HguOVJAjfSVhRbsz3Ej/sLUYgBVs8/lC9F8wdho03f+Gbg5vMToD4tEB0AWfmsWDoU5BEZnayx0IAyPBxQj1kL0tOAFUEUmKdlrKlpLk1M46ai39CVvtWB8ooi7X+ATEfWHSVTTWgNGVvgXhOMtSW/fdCnkCXkWnIWvCpE5PtQjA== X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4e190373-36dd-4563-7a7b-08d9e2999b7e X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jan 2022 20:06:01.9391 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 48e842ca-fbd8-4633-a79d-0c955a7d3aae X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 8XWMqUKcMIezHAlG4K7i1chaEhBkYHw0xT4IXfQJrJtzVWQKXWg6AfesOE13vgQYhJL2HVizAjsESi2bz7jad/LpLaUbo4Xo/UmTUwbaviM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR10MB4969 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Ocelot loops over memory regions to gather stats on different ports. These regions are mostly continuous, and are ordered. This patch set uses that information to break the stats reads into regions that can get read in bulk. The motiviation is for general cleanup, but also for SPI. Performing two back-to-back reads on a SPI bus require toggling the CS line, holding, re-toggling the CS line, sending 3 address bytes, sending N padding bytes, then actually performing the read. Bulk reads could reduce almost all of that overhead, but require that the reads are performed via regmap_bulk_read. v1 > v2: reword commit messages v2 > v3: correctly mark this for net-next when sending v3 > v4: calloc array instead of zalloc per review Colin Foster (2): net: mscc: ocelot: add ability to perform bulk reads net: mscc: ocelot: use bulk reads for stats drivers/net/ethernet/mscc/ocelot.c | 74 ++++++++++++++++++++++----- drivers/net/ethernet/mscc/ocelot_io.c | 13 +++++ include/soc/mscc/ocelot.h | 12 +++++ 3 files changed, 86 insertions(+), 13 deletions(-)