From patchwork Tue Feb 8 04:46:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12738191 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 77A5EC433F5 for ; Tue, 8 Feb 2022 05:34:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231450AbiBHFck (ORCPT ); Tue, 8 Feb 2022 00:32:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347013AbiBHEq7 (ORCPT ); Mon, 7 Feb 2022 23:46:59 -0500 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2125.outbound.protection.outlook.com [40.107.244.125]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86963C0401DC; Mon, 7 Feb 2022 20:46:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=k3TztukKWmqbWuD3nCBvuH80EyZGHs6xQ3TAF/KG1paGUxcbR+7GcFCuPZMDGhl6nSilGjqdvxruS6IBq5CQq8Frck+zHJtCRu5nElpg8Ibt4OioONw+oc0iVO5t7KrvgBkcsXuIPAhvFgwFN8+CrPQKyViMOTn2kuSanzESGt86RJ+YNjAsmUpoEh7KqgguWwvFaEoM6n1rFAfzutxm4D4T0XsqAqJ5YsfJ2GH1ycYTPHuA5Ez/Fybkua04uSsS1faDbsCpJNwPT36ITLzOR0ZICl7xl+ZLi16FbyNimTtvegdFGN0NLPU7I1z8Qf3/IWiR9rXCfJykIkYWA+rnog== 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=u3Ozhtl3Vm4r+UsISOpZYHXfOOcE7BoKeT217UZplhA=; b=InsgP0sDgQOpUg558aSRFr34fkTXFbfhi88r4zBVSM6SJMhZDn9IfemsaAQa92eU9p8xFZKGBYzU1EW4VgbWEIzGCxXQdlLLdKdYHMRSMtegIhEBqcZoxKZ8/oic0a1RwDCJ9O89Og2o9dEo2h2WRVZjK065k7+Ti6ALhVjdyRTbsHanwFGhZ7jvpViHA8l+Od+ctyp2/sLmPHrLLaXSuO4ydzLs+0Fy+Dqf7gzwKPYdqBz89ft9vWTiAo/9FakHstFRga7k3MmAXuwjVuw2zI/qD3B25mjdF1/I4p4NWazNSKwV5Q075/9yYBUr7vbgytfxyKCmg3ERXm3KTQMh6Q== 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=u3Ozhtl3Vm4r+UsISOpZYHXfOOcE7BoKeT217UZplhA=; b=OtOPJDt4LPVO+jlwFF02OJRfVK0QUyC6POEsLb/htRqwWMDwrUyWQdwEmqVR7oSLJD9/C4HEhRiB241FPkUU4oy5C0mFzxDFw5cj+zrlmVTe4Cp2a4RL+SQyHu8/Bsfoeq/N09bLorsbWc0YdRF/7NcpqXvAxOR1J334Kc9JkB8= 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 DM6PR10MB4394.namprd10.prod.outlook.com (2603:10b6:5:221::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4951.12; Tue, 8 Feb 2022 04:46:54 +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.4951.018; Tue, 8 Feb 2022 04:46:54 +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 v5 net-next 0/3] use bulk reads for ocelot statistics Date: Mon, 7 Feb 2022 20:46:41 -0800 Message-Id: <20220208044644.359951-1-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 X-ClientProxiedBy: MWHPR17CA0090.namprd17.prod.outlook.com (2603:10b6:300:c2::28) 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: 90887445-3aa7-4d9e-c971-08d9eabe07b4 X-MS-TrafficTypeDiagnostic: DM6PR10MB4394:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:489; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wLR5ZJlHGo9FVZugRzTBWinzKj1qa18yYKMYtBYqmb+cYQFYX3PYv3mqfRjV5t6WaBWCddGpSxaZwpMztWhcj5uFzfJh0+6WT1DJ6I3k36GeN3VorusC1YPZO6l+wRoLRH8I/qd2H7+G1z9vbSq8FAZUVpO16/9EROQx3UaFEzvSKFH+lQ8syj9HNljb+pDp9JtvXuN00h6RkQ0ldfwsxU4E6h/Cv2pMNpYihnMyy3LSao2tNBnmB2fhK7Iwy9Zh+9RY5UhO+CWARG6eVngvfiXqlg8Whp/10T92b2YkebX7LlINBYosA8VP9U6s7iavx6nCko/CT1qPT7ldB5gmNchVG2I1zzUFHiUU8k9A+nZzF3Boa5B6thSJaLTmPuzr+FxcLopvasmFLsJEahVDlX7BULRQ40nQ0sca8cqp+l3aNQE4Yuqedg66VTrIdyIfIA4Z78W296JCptSQLUa4FOEkI/Wzm45ZGBmZozyOhZaS9qoUAH0vFOyyqnuJsN0snHNeHe6KdUkyn0yf9DeYJKaOLPuJbPJlYslFOnCztBESjJFRQ7lswps57K0Y7go/GhfT1Qo3bitGOyg51+eyJ2goVOCT2kCO5D1dYTjjHS2Fr6Bko2JTT/WBpMKuTohsZn0F/78aGMNrqrTeUXRxde/EQlVJGJ/8F1Z5cEJjJid79/8+yDdan5wmcqHK0YMOi2GQnDfVDbRdC49G2ySK/g== 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)(346002)(396003)(376002)(39830400003)(42606007)(136003)(366004)(52116002)(1076003)(186003)(6486002)(6506007)(508600001)(86362001)(26005)(36756003)(2616005)(6666004)(6512007)(54906003)(83380400001)(5660300002)(66946007)(8936002)(2906002)(4326008)(66556008)(8676002)(66476007)(38350700002)(44832011)(38100700002)(316002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: QxnwwKl5bfgpExOpxdI4CnrQ+2VmrS1Ksttn/ISn7FEHHVQpuFiL8NJRTViV1ayoSMJQ9KDkbk76vRa+zFNzMQQDsurUVX2AI23jB9/IAP9v4BirmlxrQngA7w2Zlo2K3Ao+2KP1qz+aUBV814NKs0uxEVeMWKC3DTxlHrMWWoJ28NBaaTiOgO07CUFAU6At2RUZsXuAzCCiCjTDnQPQ0DmgaWyfEJif9WxK6c+4BN+3eCkFV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enQa9zMrIVeY84d0fH9W21SS0bPH1IZFY8TVYnwdG5y3ZbbRZ8Jm3aIOe+G+RBVb8xVLCU8ZSlRdYom1bHQ3r6zHrw9pUNWFswuqLwtZzZWyT1cG5K2LcEh1s6AK1iQnjLW7LPuLxjk0d6zzBUg6Q0qi/7R66s133ePKFAB+OCxd1tKwFk6s61ZCq5C2D/N+TnGv+T16KlMUcSZUtWC3Y9BeMkoanUXXdn9j8jNv0JJ+UtX+ioQvIAitgYfcvIbdrQtGuzMkqetbPIVBtX5C5uhQTN46K6Fd/OaIx1L0Ie5lsD4R4ykWPw6tsm9avktQMOWx2BcJqpiD/Zz7KsTkmcUzQVnc5+YlsY3Sf15TKzm136NCNy4TZT5L3nsfJDh127I= X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: 90887445-3aa7-4d9e-c971-08d9eabe07b4 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Feb 2022 04:46:54.5641 (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: wG2UcfLjTxZZm64N+Yx3eOla42+7hZFwdCplaCbJX2pTWpTs+gUQTb2dHsNUsBfoIKvNjTmwBMwcf/C+4wKIfZsHKrWFi1e8AcAt7pJBb5I= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB4394 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 v4 > v5: Apply CR suggestions for whitespace Fix calloc / zalloc mixup Properly destroy workqueues Add third commit to split long macros Colin Foster (3): net: ocelot: align macros for consistency net: mscc: ocelot: add ability to perform bulk reads net: mscc: ocelot: use bulk reads for stats drivers/net/ethernet/mscc/ocelot.c | 78 ++++++++++++++++++++++----- drivers/net/ethernet/mscc/ocelot_io.c | 13 +++++ include/soc/mscc/ocelot.h | 57 ++++++++++++++------ 3 files changed, 120 insertions(+), 28 deletions(-)