From patchwork Tue Feb 8 04:46:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12738189 X-Patchwork-Delegate: kuba@kernel.org 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 A232FC433FE for ; Tue, 8 Feb 2022 05:33:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243861AbiBHFda (ORCPT ); Tue, 8 Feb 2022 00:33:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347015AbiBHErA (ORCPT ); Mon, 7 Feb 2022 23:47:00 -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 86B5CC0401E5; Mon, 7 Feb 2022 20:46:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Hb2knJKjyS4GGvNAOmtJYvNR+w9juW+UfsC8AJrxY6POI8hRx8wkIQlPK4PofwcW0c4jgFFK8e4DB8/E9Jg882jaiUeW03vHg4b9W3VfULjtvJPOY9PhlGc63S2ueuo8Ii2x59PRQSWBUzTnYiB+b5DM36jElQafBKaGGzjLmKPBZVD3q9fdW0KQd2KX6WnuTQUJD65k5vq7b8lWjQe5xBts1T16DajU6ixb7y7SIqlPW7jcGiTsB+tUBc/zSBoJTQLIi33lRJGs/3FqfuHc+L2P1ncJnCgZaEBA3TElkLodhmSH4Zl9OjF20p2UwvaYRWFGOymOEPsZkyWmsipoTg== 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=cMiOnOSz3IyVWPX0xUP/G3tVqPywZ/OKkq0FH3v0e+8=; b=VXVrPsVT47yZSOIHescfh7wLWIyPMSdfUg+16xBonLjjTR5vVrVlFIHQvEPZgYNFgwY99a7mbE+9yoa1BStL3frrpE79oDy4hnwYs9SlTi3pI7Xf1qv4rRjM9Iw0FPuc51T1pJr+3ks5x/3MB9PYDVE/mg+bZ/gEK+7aAlNuSPWaMyga6DDycQ79J1mGxcC31Ltdols/jBpDk/QGkf3pMFuaLI1gTzyBmnZ0YNpgvlIfb/uiJn8SieNh8FKrZtqfZwLHn6iy52cHFRCecMvKm7JhCW/Co59Przi56cxzJAMbskB9iPtBUJ9YalJFkiv3EKwDfDG4/mhIJGZdLng3Rg== 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=cMiOnOSz3IyVWPX0xUP/G3tVqPywZ/OKkq0FH3v0e+8=; b=UfXTRzFM2Hbv1zMvnVTIPP01cq+c5s//eXkIov2JRK+Z8QS7OcBFsHFZQvuQZTKVcE/5k05sU9uhh9qmKyYE+5BjgAsY4oXSO6+QZk0LcO4z7iN307I1fYMynVokrxdV2IQVwdQ7f5Qmz/CGV5grOIXvGgz7yr4mVjTzzgkCJyE= 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:55 +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:55 +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 1/3] net: ocelot: align macros for consistency Date: Mon, 7 Feb 2022 20:46:42 -0800 Message-Id: <20220208044644.359951-2-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220208044644.359951-1-colin.foster@in-advantage.com> References: <20220208044644.359951-1-colin.foster@in-advantage.com> 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: e8b365d5-1b05-4194-7597-08d9eabe0803 X-MS-TrafficTypeDiagnostic: DM6PR10MB4394:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3513; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ax6gc72gH0hAvRIfNaf3vs9X4FeLCDevKgAJsPaa5Oxl8CSnVCz4AixJmgIDm+IfgB918BFkAhYDa7lPyEnh+IWUhVe3YkfTlq1fcAk24iP7d5oOHcDf3qOvJUMrMVFQHyetnkYmAhDYIcmhiRfuh99lbJR0lEo9JA3HQJ1Jlg0z53xffGbbMF2nO1+QLUK3RgSeLdNJaTAuxK+PWt4RjTJypVj82EO8D6FvfTX3A78ps7P5T7zl/WYZ+Efu7HL/Kv2qUkQfdjjrepdfpKcDlZBbKQhKgqs890dhsByID9jGU+ZWx9VThqVFMPPQLtLKUB4hD1e4Lbr5V2iVNpDy1OPXhVnSOAHcgfla3CY7y0rXs06FF8hQx16pp0Ih6IQRdlFseXa4hxd8HsEHXeHk6wECx9tGYoy3jam0qNOp8oGH99FDhfCkPByOq22I7aRBEdWBfTmJ5Tnwvu54Ao0uiFaY3pBRAn6twBZ1UMtZu+P3O2X3MeESLyLOnE3AuDsyrg5YYcHi3/PEPnuzOnwpneiqvXlfCQDFAssINAgM8khPPVvBS0byjVV/4Uep5kDws5q92443J/OLdUkV7+PEVhTbmV41kbQ70DZfUrKDtQf2prcfapvRglpT9mfs2+wG74y71OEnJxMp3Ws5Ko2XrVGORnJU8FUubEDjP7r3Wr8ZH0FGC+bSj6sJ9M11MI4l/TvcQtTic25QPUJ7P89Y9A== 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: sXENp4CzzMvZVmuxd+fff+QbrrgYVqgroWBwbE4KLzIn+DKDgEm36hqOO1L3JMMiNcEBuegkV5aXUSWp6RHuZgzAdnYU5iSAHs2wZcoizZ47MBbJDQeyhaHCzHQr2KyrSUrhWTGXmnlmQvh8SK8uTmSzGc2j3UDJwHf2r9XIHHmbbkNc1M91eFg/m2gBQytWwH6EHTuh3tTFHLYttueqEHCKBxVURQZ82RefSgDtaFh5z47SLUonjOePH/Y64akmG31ILpypkOWIhtZ9pC482S3bpbGi7XOFV4jXY2ZyrH+6i5UN2e4IvUcpgocQzEhi1EE1TLa9yD3EQW9t11VTKuDAeCTfXaJ9BpwjBH1Q58wd9vUlu+9b3uh3x6hAiFMS0mseiqeg+b5Qx69TGkuz8HLguGHC+ygs8WXyEfAZO4D3yJSm5kpebXEu4VwtPH5prLLJpcbz0vhXoYBJ9tJKEXAwg/efqr8M5Ng+E+3MxfQedA7CBQfRv9S8xwNxxVUMZuyipUR71A3uxe8GXx9i/C1bMUFMrWfG/RVZX9w7XaTyhBFu5pUg4708m/7jZUZUgt7isx48xRQzn74wpT9/hWb+vqIjH+nIM2wbYNdCEne19ACpzxUTQMMRk5kMiDXbVADizZWlEBIqZAyTUn9Gtw4y42PZpns7qcm+nI0IAk1d8l5TLYvLZR2gvyReA/MtY0g/zG1OoC8P6ZIchPvGqrU39s2M+QoxcIUFB+yM0Ol/jiMsFoBVBqRoDpDlzjMRK6x5F+yIs2yMxmgpOcU6ca7IdMww610VeXJTk20PHUojwJgAIxubw4DJT5mukAJ/IftAJY+xktWUy/p3NuzC1+kSIczZxJJCJJCqeX/fUYHz8Lk4JgXmn4En/NyfVED6+kjdmVP3lB36x501POqRrzWU88L4CR8apGhfS8h6k7DvBuDcPNrvyaCriRWklUXmSa4PxcB001pn9svaMOSwYHnChhGXHMj3Hc+i+W7jtU3NMoCH5y4igct+8Wpo2Yf9vaEOMXUiY1fVbl9223B8yWUpIOkpi4B40BWYDtG3+VlkrgciKxbPHLoRHvjSnk0LryqpmqmPes1rHJtm9YCB5iVqbhDGe07NZx0ZYy8qD3gS2xmhFqFApvbMfj3+0wcyfR8thBquhHXg2OAS3E/KgC6JMW5kQAcqEXtj++tkRCUNnJ5uL9fk0uxqZFWeHf13+0xY27K4cKfhmm7MOGJ+438DJ6vgqxIxjmxQcCTpuSfH6mk4+r67/HwEibR79XcK6wHqJtxoqtiLtKUfxr2Gyb3Ln118cph4q1cPS4Uq7NZGUN91FIA7WKv4jb8jYNaIkrLXpsNBXPzNUV4oNAGUoxG6zVfiCM8e6v1DhS6s2wCLg4bcaEo4M9GxVZRuEiUWpZssaeGNRUVePK7iItVTKzTAeuJc/kWnXhi9bIRiAQbPg30/8CIDxH69gtX6ou5gmbUz+zlFsujRiQeQ3mMSatvxF0Dzyv/Bd+x9h6NGPP5Or5FZN8w5Bobty1hynozuz0GLUDfqCzUZeFz7rTc1H3NXrdwpbkjOr9bQ4wFxh7WcCy7QK1QETbyrz6V8Da7LFEsX9dRHwcDcXzi8ykKsVFa7MJbZt3AsDLLTBQWs5U/frso4YzYwmzr78Km7L4ob2IyEq1Z6KbybfR0JZMHDTc9D/lHybYqCHZXXXbmk3AU= X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: e8b365d5-1b05-4194-7597-08d9eabe0803 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:55.0016 (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: dznHMM0A6hoYH7bScXoJNl7NeaMGbsQpdsz68DKlKNW/MGyJPRKINtQNGRM2QpqcHMD4/4Y3stKWqox6AFytA0O3gfi85+BF8m6BNt+bdhI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB4394 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org In the ocelot.h file, several read / write macros were split across multiple lines, while others weren't. Split all macros that exceed the 80 character column width and match the style of the rest of the file. Signed-off-by: Colin Foster Reviewed-by: Vladimir Oltean --- include/soc/mscc/ocelot.h | 44 ++++++++++++++++++++++++++------------- 1 file changed, 29 insertions(+), 15 deletions(-) diff --git a/include/soc/mscc/ocelot.h b/include/soc/mscc/ocelot.h index 62cd61d4142e..14a6f4de8e1f 100644 --- a/include/soc/mscc/ocelot.h +++ b/include/soc/mscc/ocelot.h @@ -744,25 +744,39 @@ struct ocelot_policer { u32 burst; /* bytes */ }; -#define ocelot_read_ix(ocelot, reg, gi, ri) __ocelot_read_ix(ocelot, reg, reg##_GSZ * (gi) + reg##_RSZ * (ri)) -#define ocelot_read_gix(ocelot, reg, gi) __ocelot_read_ix(ocelot, reg, reg##_GSZ * (gi)) -#define ocelot_read_rix(ocelot, reg, ri) __ocelot_read_ix(ocelot, reg, reg##_RSZ * (ri)) -#define ocelot_read(ocelot, reg) __ocelot_read_ix(ocelot, reg, 0) - -#define ocelot_write_ix(ocelot, val, reg, gi, ri) __ocelot_write_ix(ocelot, val, reg, reg##_GSZ * (gi) + reg##_RSZ * (ri)) -#define ocelot_write_gix(ocelot, val, reg, gi) __ocelot_write_ix(ocelot, val, reg, reg##_GSZ * (gi)) -#define ocelot_write_rix(ocelot, val, reg, ri) __ocelot_write_ix(ocelot, val, reg, reg##_RSZ * (ri)) +#define ocelot_read_ix(ocelot, reg, gi, ri) \ + __ocelot_read_ix(ocelot, reg, reg##_GSZ * (gi) + reg##_RSZ * (ri)) +#define ocelot_read_gix(ocelot, reg, gi) \ + __ocelot_read_ix(ocelot, reg, reg##_GSZ * (gi)) +#define ocelot_read_rix(ocelot, reg, ri) \ + __ocelot_read_ix(ocelot, reg, reg##_RSZ * (ri)) +#define ocelot_read(ocelot, reg) \ + __ocelot_read_ix(ocelot, reg, 0) + +#define ocelot_write_ix(ocelot, val, reg, gi, ri) \ + __ocelot_write_ix(ocelot, val, reg, reg##_GSZ * (gi) + reg##_RSZ * (ri)) +#define ocelot_write_gix(ocelot, val, reg, gi) \ + __ocelot_write_ix(ocelot, val, reg, reg##_GSZ * (gi)) +#define ocelot_write_rix(ocelot, val, reg, ri) \ + __ocelot_write_ix(ocelot, val, reg, reg##_RSZ * (ri)) #define ocelot_write(ocelot, val, reg) __ocelot_write_ix(ocelot, val, reg, 0) -#define ocelot_rmw_ix(ocelot, val, m, reg, gi, ri) __ocelot_rmw_ix(ocelot, val, m, reg, reg##_GSZ * (gi) + reg##_RSZ * (ri)) -#define ocelot_rmw_gix(ocelot, val, m, reg, gi) __ocelot_rmw_ix(ocelot, val, m, reg, reg##_GSZ * (gi)) -#define ocelot_rmw_rix(ocelot, val, m, reg, ri) __ocelot_rmw_ix(ocelot, val, m, reg, reg##_RSZ * (ri)) +#define ocelot_rmw_ix(ocelot, val, m, reg, gi, ri) \ + __ocelot_rmw_ix(ocelot, val, m, reg, reg##_GSZ * (gi) + reg##_RSZ * (ri)) +#define ocelot_rmw_gix(ocelot, val, m, reg, gi) \ + __ocelot_rmw_ix(ocelot, val, m, reg, reg##_GSZ * (gi)) +#define ocelot_rmw_rix(ocelot, val, m, reg, ri) \ + __ocelot_rmw_ix(ocelot, val, m, reg, reg##_RSZ * (ri)) #define ocelot_rmw(ocelot, val, m, reg) __ocelot_rmw_ix(ocelot, val, m, reg, 0) -#define ocelot_field_write(ocelot, reg, val) regmap_field_write((ocelot)->regfields[(reg)], (val)) -#define ocelot_field_read(ocelot, reg, val) regmap_field_read((ocelot)->regfields[(reg)], (val)) -#define ocelot_fields_write(ocelot, id, reg, val) regmap_fields_write((ocelot)->regfields[(reg)], (id), (val)) -#define ocelot_fields_read(ocelot, id, reg, val) regmap_fields_read((ocelot)->regfields[(reg)], (id), (val)) +#define ocelot_field_write(ocelot, reg, val) \ + regmap_field_write((ocelot)->regfields[(reg)], (val)) +#define ocelot_field_read(ocelot, reg, val) \ + regmap_field_read((ocelot)->regfields[(reg)], (val)) +#define ocelot_fields_write(ocelot, id, reg, val) \ + regmap_fields_write((ocelot)->regfields[(reg)], (id), (val)) +#define ocelot_fields_read(ocelot, id, reg, val) \ + regmap_fields_read((ocelot)->regfields[(reg)], (id), (val)) #define ocelot_target_read_ix(ocelot, target, reg, gi, ri) \ __ocelot_target_read_ix(ocelot, target, reg, reg##_GSZ * (gi) + reg##_RSZ * (ri)) From patchwork Tue Feb 8 04:46:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12738157 X-Patchwork-Delegate: kuba@kernel.org 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 0B3D1C4321E for ; Tue, 8 Feb 2022 05:32:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346994AbiBHFcr (ORCPT ); Tue, 8 Feb 2022 00:32:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347019AbiBHErB (ORCPT ); Mon, 7 Feb 2022 23:47:01 -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 0A2B5C0401DC; Mon, 7 Feb 2022 20:47:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Kdc8MDTi5Zp2uounsgcJS/NjUh+jPJcfNi8XEkg2Ub5E3tEqZ5ksloXIR/QfSxO5yf/nHR6frYFjLr58IQQf8x8rh30ZdGdEhxGjXEvKF+tI1YVz3evWphMdKa4BENqvhTzACHekVVWefsCQxGNvPOfY7b9j9HXLgZYv6OFkSo0btPVK2oN/erFOxEbUVUzN+YAhBtZKYUu7qr1Pgza5QKIFveL8SSeSx/lm276/agvJ9saYmiCv+BvoSNLAKCPfGSS4etx4TqGNpdIwl8f4YStYpfy6XzZ22vKrizQP7h7dF/fk6z41bjDwjzXkk9wlWgNRwWIVgLAqCcFTBeEekw== 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=aw3CFL0LhDMQEJy0xv5ELwfu7cQIQ3X/C9+1ecOuKEA=; b=RmDuMuaXinOq36xNVtngfcGkw2QjrkcU8D1JoLjCKV9eCtv7aTFdkLCSkXyixagbTH7H6garwG5vTHKQII5FY/TOJdAhPvGW41e/H3smEikE0qTGufH/Rsak3JCjRnMGVTaFttBWO+v30QpTsLu5btoL7HSyODnEehX5WByu2AbONEv/C3cTrs1Rnzb81cernoz5MKg8Fm3mxGxEdphu7/2eFmS51aQtZfBWCjucywM4Q84cOUBfTSp/IYBYO3k/ESP8obx5q5vsgNWppJhbBM6DNP9SgWqKzaMdnhDB5RPb5e9tUh3zDtT1855kfprT0gFJt87+veC/y5/jLs2bXg== 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=aw3CFL0LhDMQEJy0xv5ELwfu7cQIQ3X/C9+1ecOuKEA=; b=m7AnT4Ob+4kkG2zvLjeWWn7alkxmEsppTUPqVZduGSBmU2X7bx/QT2pl5LvzIJBISbM5YMg7vCOSkP2+e/7bcjb9auTPVOiQKV5rd5QqOA9eDIhfPsGM8VQZg21CD4W3XSQ9OdrWazKG0eGKtVQA+RPLk0ycee0PIX50FNTP6hM= 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:56 +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:56 +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 2/3] net: mscc: ocelot: add ability to perform bulk reads Date: Mon, 7 Feb 2022 20:46:43 -0800 Message-Id: <20220208044644.359951-3-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220208044644.359951-1-colin.foster@in-advantage.com> References: <20220208044644.359951-1-colin.foster@in-advantage.com> 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: 7a712c7f-e351-45d5-d402-08d9eabe0843 X-MS-TrafficTypeDiagnostic: DM6PR10MB4394:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4502; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: B8sQFA6KCgTs8St6lF9GDzXHpV+M9QKX1ksNv/hLs7HwQ4eCiF1+ybqIGOtzk99dd1hwFcInCRVf/VE3sFLyIp8CqfQ7pCEyuszE1/Lw5VJcwtY/myx8v0PBrvxIn0Yh9IPigLExz6VwwlvThP/3J8R0E5EidYyfhgDm0Dh1UrK+b2oCqq57Z0E+DNPQA0x74wZNaF9booH7Ea8n7/nmfZLRnzr6lxB/DuhCvM2R3NtZkjODLCIvWXsGPk2fXnd1/qYlBQMadG5WQyyTeJdoATKJG7F+tkLB3DE9fLebWArO1r4Av/r3PgqIP6Iwo4BbFuqqkrGp7KERyTm5/JmTFq566frRnaxs+n9hPAoeQopURqVkcTQj6HkpUv6RlstF7iJ48LtdEY61sTS2YtgrQv0fIlXvwVQFuKk1Vd584zFDcMzm3k2whU+KMBRywfc5YhznrsgRIIhApqLIB0w2H7AW3/9eQkTE5RX0TCsG83LX5iHnd68/l03MXaqsGq5WA2cPxJ9/bm+icpgxdLRfrs//8mff87uW8nMnXZ9u7UP4qpIRpW6i2sDA9/LK9SsOhIdFeFc6NuhXfM2Hhz8yCDMOtLElTnaqgSLsttJXgZElJOboab02BOmjtuY+lisKhDvKvVm/eyE+eqM3iBZAeJF7acE5BMBI3gwyPc48Oi1GrsX7v5gIW5o+gtZ8cw/n2aWxTv20yJf1DX3Wyun1Vw== 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: SgU87+OKS7RtWQYMIRCr6TjO6ADlVLnAhXomyVm/jF0tpFVITKZRsYvQyo06LtlIV8vuXwJa3LEF9VRZSuPxBp7GioF0ATS/gZTXODvQ3JqKWs/64amXAdvlsA4hxIAnjrFthuEUqCdaorVvpndmEZGSsGzVPBZk7Vyc2jUtrlUFWOzMTMPxZHeF0pwvUL0arZ1WHNMRhfiVe53S54DmQSH++cgHM6cCH1u3oQRuMk9BgfcewByNI9kQxZAhrGrwlzPY4a9+dbjmsVr+HXYsqFMskFLNwJdu+Fn0XjafIyv0hTTFR6D48T82sPI9NKqf16+Zot3kVtk+UOWRB+26md2fXPSuorFPt+PyL6QKiv78BFC0eqobARGVCOgsAn+ghFRwvdynwrhhjxHCoUL8fFIV8OhPg4+mjXbyIM9p9ZhNkrjxs5b3b9O4r5a4fIzV7OC5745L6+tPvnA2Y1FESt1yBy03ZdZQU1U6/wZvI96SQXdd94JQXMHwZy+7O0agSf5WEAhyCOeVSjXEIFidLQdDP5jJmUA50LEYiwYDHCxB0g5/0IuzK0LNOHSeBUOZY/8mF6USz0S5Vb41D+lQlY5xTqd3GG+hOKOdSz+vGo4MwO8kfZ55UnNJ5sv14UwXuWY58pXJvGKo1vySFZonrAG6aIdRaCW/yHUCIvd8JjRT5RYM1KDm/yWnCk/IISBSWKTuAmTcYbbgac19xYrAv/H68kbf/P1F6yiE1r/n7WvbKc7dTG/Q/B0rQDzR7pv1lwYvPBGtpXFnd8C+YmdaiBgcHIBgqxWsyyNeJUhm1g3ju4I/SYr7Aj2Uk/jRqcLD8Lc9vo6VZGDvn7X/rATUICxwHS2eEZVV3j0GOJg5CgNhF/vOUrX7+ZaMuZvfBNHF4gAKdjok++vyo31wU2ks8p7NVyZtzbTeT8mx0ExOKCWCH5BB51XKBeH3xDdoE0aLkSmBCsy59S3rusgn5iaUh0C7JDH34Ct5krUlnzdEDIChiSq5pUlviANa81aX7mz9o+9s1NnJx26lAQb9aoUwS85cza+pQmu2wbyTNbzXTU94E463U6tWllAvXdne0Z5JYcOypw7RtLYjKwphvIUB0ADZ15Uqv1MkGJpx3rioIfvDvmaHK7v2O1F/gDaBBxEK3CgvcvVcCOJozfSDPaorMwokpKz9hEoiUdu7avmopIrxXV5sxn1ILr2Und7K7jKR4x/K9/UmdMnj8H2M0g1eJToyuGcIKHUOS4bFrIxTJCNGAN7W+gfrdjbC/XDt1lpLrtKrd2qR+pumyIwxFT6YewIswpPTQ5VRGWRvDp4moeq37NO8lCR9cEWEkYzt4IO9b9NmyFRwafBk8hnl10h/g2w63MaBY1XH7IZaLNjZN25RFE0Xs1J1U8WGJpfJCJnPSQseUUMEQCB7utKPakkJggnPwnFKo8WedyRoI6aVNVzf/vMIzT+m5r71qGIYDE3PMWLcSmNQUZqBGUGYeIB93mnYGgi17/7pgsXxE2BmcKJSA3s2aIjrKy0Don8GyPe43p52Cx+nu8uZcFrVTsuRgh/fl4zoTZo4y3LnIv09X1WbeRRPIROmoffyZ23LUM2Q/RBWHj8W42i4pehn0zF3FxfKGz3vUmwjmj4J4oYt8r0CZjmr/hE06iUXUEDeJVslj9iK9eHVJbeo9XWZdSIHhQ== X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7a712c7f-e351-45d5-d402-08d9eabe0843 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:55.4390 (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: xmPmHVyfohUrX5rz8Rgr3H6CdPMtCRV4veJu/ahOoPf00w5bSQpuMhM6wb8zHcpUBJ6mEoCrOE3WMA0m2b37cLbOWmDuRRUIkZLqVWL1QGU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB4394 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Regmap supports bulk register reads. Ocelot does not. This patch adds support for Ocelot to invoke bulk regmap reads. That will allow any driver that performs consecutive reads over memory regions to optimize that access. Signed-off-by: Colin Foster Reviewed-by: Vladimir Oltean --- drivers/net/ethernet/mscc/ocelot_io.c | 13 +++++++++++++ include/soc/mscc/ocelot.h | 5 +++++ 2 files changed, 18 insertions(+) diff --git a/drivers/net/ethernet/mscc/ocelot_io.c b/drivers/net/ethernet/mscc/ocelot_io.c index 7390fa3980ec..2067382d0ee1 100644 --- a/drivers/net/ethernet/mscc/ocelot_io.c +++ b/drivers/net/ethernet/mscc/ocelot_io.c @@ -10,6 +10,19 @@ #include "ocelot.h" +int __ocelot_bulk_read_ix(struct ocelot *ocelot, u32 reg, u32 offset, void *buf, + int count) +{ + u16 target = reg >> TARGET_OFFSET; + + WARN_ON(!target); + + return regmap_bulk_read(ocelot->targets[target], + ocelot->map[target][reg & REG_MASK] + offset, + buf, count); +} +EXPORT_SYMBOL_GPL(__ocelot_bulk_read_ix); + u32 __ocelot_read_ix(struct ocelot *ocelot, u32 reg, u32 offset) { u16 target = reg >> TARGET_OFFSET; diff --git a/include/soc/mscc/ocelot.h b/include/soc/mscc/ocelot.h index 14a6f4de8e1f..312b72558659 100644 --- a/include/soc/mscc/ocelot.h +++ b/include/soc/mscc/ocelot.h @@ -744,6 +744,9 @@ struct ocelot_policer { u32 burst; /* bytes */ }; +#define ocelot_bulk_read_rix(ocelot, reg, ri, buf, count) \ + __ocelot_bulk_read_ix(ocelot, reg, reg##_RSZ * (ri), buf, count) + #define ocelot_read_ix(ocelot, reg, gi, ri) \ __ocelot_read_ix(ocelot, reg, reg##_GSZ * (gi) + reg##_RSZ * (ri)) #define ocelot_read_gix(ocelot, reg, gi) \ @@ -800,6 +803,8 @@ struct ocelot_policer { u32 ocelot_port_readl(struct ocelot_port *port, u32 reg); void ocelot_port_writel(struct ocelot_port *port, u32 val, u32 reg); void ocelot_port_rmwl(struct ocelot_port *port, u32 val, u32 mask, u32 reg); +int __ocelot_bulk_read_ix(struct ocelot *ocelot, u32 reg, u32 offset, void *buf, + int count); u32 __ocelot_read_ix(struct ocelot *ocelot, u32 reg, u32 offset); void __ocelot_write_ix(struct ocelot *ocelot, u32 val, u32 reg, u32 offset); void __ocelot_rmw_ix(struct ocelot *ocelot, u32 val, u32 mask, u32 reg, From patchwork Tue Feb 8 04:46:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12738163 X-Patchwork-Delegate: kuba@kernel.org 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 831F5C433EF for ; Tue, 8 Feb 2022 05:33:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347104AbiBHFcw (ORCPT ); Tue, 8 Feb 2022 00:32:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347016AbiBHErB (ORCPT ); Mon, 7 Feb 2022 23:47:01 -0500 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2097.outbound.protection.outlook.com [40.107.220.97]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 08E7FC0401E9; Mon, 7 Feb 2022 20:47:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=G4fKnY7hkjy6186++n+Nn/VKlf4aGW+VFfgXFDF4bqvAlfdTCZA2Q+I7373NkuTlMGDXMHsv+ynDKVcv4rksB5soPAjiTNR/f5rRUiSMInK4yX4g1gOGMwjZQRFDdnoMIm7dAbYqKUmP9qg8ShSOA8nMHRPxKdnH9/HFN9E+BoTrBokbzcLjEHQuKBtBfqBUs6VGuzQS60Ptd3ThzlRmvJX/1pqvn/pIXOO67Pn5gnD754Jba3bFV2Sam3bOMFjqgAqabGtnT+EBBgyn9Fv3HI1Aj+f+1ghlmBpx+lznLZDkMyP5N864GlwRgc/OiU6Xk9HiAjs597jQfmNNJWPYNw== 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=Gc3k37fgcH4Cy6R5yFs/SVQZ8AteMJL/IRFkIAGwOj0=; b=mooxyRQ1+PCA1Aul1rQlDYv/SH7OXqqFEtoyRtulvCpfs/DM2x3TuN1jE/VyLJFPVLxN9Ufo2gfPGHJfDHuAhxCooJ/dfjDv4q9lKEknE7kLPBkRSytm2EI7qxGCla0Mm3SJWVC6kRgqunWXG5b2aIQC70jJ1sMTvN8vHT20I5nY+8Eo8DLH+Bn+3MoMPh26Fp+ikmB40y/4/5WSSX61K9rVy7ZQskFk4u8p9set8Tm0PKELO1yYD+b/bXE3IYkrymzuWq3LMHIjtbM7SSYWSgSM/oUI5URNuxgtU5S2NJPBnMVqWhWM4mIYEz2ng8ZpO6oPiwYvfeX9CM0mdDI9FQ== 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=Gc3k37fgcH4Cy6R5yFs/SVQZ8AteMJL/IRFkIAGwOj0=; b=okSU1O77DiB0T7xeMvx2VCBzYM7FhqZPOsxD7HjV7DOH6rOA/GOgi0p5FD0BGiQi2Z9bBZ3hpPsTCMbgSr6EdPhjiqLpslASHDBnf9e9I+Ap2FKv6DTWnpqk/T0xH+CIYzU7/hVIC3Cz8/Tb5ojl9qPiDA8fUdhHLma8gt9yQ10= 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 MWHPR1001MB2176.namprd10.prod.outlook.com (2603:10b6:301:30::39) 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:57 +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:56 +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 3/3] net: mscc: ocelot: use bulk reads for stats Date: Mon, 7 Feb 2022 20:46:44 -0800 Message-Id: <20220208044644.359951-4-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220208044644.359951-1-colin.foster@in-advantage.com> References: <20220208044644.359951-1-colin.foster@in-advantage.com> 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: f63ab5a8-2bde-47d9-f6f1-08d9eabe0888 X-MS-TrafficTypeDiagnostic: MWHPR1001MB2176:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1060; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /kglMlFDvd8WapdwImEJouIXaEQIi0SArH7etynnSs6/xHYJ74wTImr3MrmwCzCfeaEYHLXBiQpM7AEBBeECol2YSn+PZBZNXp88Wnqh1gsAwqC5XDjeQRHtbmOU3IDVi8s7s2f3Ddw9wi+zhd7/Oqd78O0r/MVESkz5osNhfkCdAg0z4or3bAl54xdTuKtI37O2v1zkYXpcBE9kIXgVcz09744I55KibJcSHnpuvun8OGjLiSuRuAvi2bIE1eTFDxp+YTiu19ENozNPllxaY4RKJICJvQaeccAcQ6s1cVhCdV62BSOKPsMV5cSZcIF/tYXNqybcfnW0C64fjORJhm7JWj8/MBwoAkkpwsowfKtJloZd5g1o15VZSmRJWwsTGcBC4bZaDY7XxeVw1b3yyeoy7I2bGT2GEEeT123O+aN0da5+7Sb9FSougkgRFn9y7Uq2II/nGRlisSntjHy3l/r9CGttD6klQqG5loHLs3KZ3bABYxNL92MeH0ID25n+JLiqQxo5JoB5B4ZrvPe8ZLuw6vIaEF74o7KD8LdrazWNukNETLm0XNTIv2iuy0LTyigT8pBp0Ty/h8TubNJjG446tAzPKxL6mI6FxGtK9W6oKN2wD0jlXAlMgxxY3TcCGTT0b5j39aTxG9aN2m2prK55jQ1n3BASHAVBW39UCbrUmbhKU+hnlFY1v33eCBBj7ZxV2U0ohskYvGo2rTYS5A== 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)(366004)(376002)(39830400003)(136003)(346002)(42606007)(396003)(54906003)(86362001)(508600001)(6506007)(44832011)(6512007)(52116002)(36756003)(8676002)(8936002)(66556008)(4326008)(66946007)(6486002)(66476007)(83380400001)(316002)(1076003)(186003)(38100700002)(2616005)(38350700002)(26005)(2906002)(5660300002)(6666004);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 9L6MmNNXLO72kpSU3vs3Vs+1/brKx8JyMJYm2ukdDxk2PYpLKcSiVGeQUp6BF4erSsUD9txGdnsXuGTNR0zn/TeRrRQob26d0KRIHmWXjKm9iRdhCjNitAX75JUKfNd8Zktqzovc98lCgWzuz5tETpufXcA9usvL+Z9HcetxwxXr594YcS/5sUtEQHzWcdh9iOLQOccgdv9mAu7r1YsB9mpEZcjHZ5cwxAv3dyi3gnY0o2FK8mJRfrJWQrsUGtZFWGTNwDX+4Xr01iUXZjfiVKiQ++TKgko1CQRDHa2y8wLxCxGnm5GmsTmb4iGrC6Lhg1PbclPe4nVW6l1G5yDA9YAN2RldL0n8Xi5x9qhNiEIIvvk1ThKgZFPC6bjCSsjn8AY8eeWUw7KeTFTsUGyoeQdN/+2SE0895pn3/gYuU2s9781iMaYt8LVleA7RVdGg/sp6Sbhe0rVebt6q5YVSuTyXt/n3VcevkI8yREfQjWHW5L3u5WQTiQLnUoBoZbb3W6xf4ev2QTRrpP2GUhkTKs6E7PhwPXpwpjpAoCeXGs4lAcj1IemACKdsxm8kc8PrHa80kDH8LGjTOtb/juTTW0//don0YZANQcnApB6/EtTbsOivGYABuaVH5GIMnxnCozaHwU6iFTmOsSBGcLxgfCqey6AIBrhtYtziJpgiUBZawx22y1wOQSnzJsa7yXN98k4hBCggecklPao+oJ5tWmW5P1M6ccmrPuj7m4uRFEVDaZ+1xKt657BR3PvNRRod6eAhc/yUJPGfABXCvB5b9+zo7xSSno9Gp2X6fiXM5PyZJian5IJ0ixliTz8I0su+G0oECnzGc9amhFUVIfI/DXyFI5cqLogS+AOpyduzdRBwDv5kaQJtx7xgieuenTbwsql/6Cp7qAqgP33lT/3f3Fbm+LcVOXRyzo7LzBWFpj0gOomBghhpB4TeDHnMUNcv0KmY6qgjtcisy3fyQDZs5AZHJDF2DVQv25pJOKYf6hTT3m1nytWs6i12rWfHYrvJc/B5ygNahG2plh+KsdTEbrSwAFU65OCuZKkvVZXEYoxAOOwNVgL9rc5Yl7qDCVWjVUHzhrIauj0wNkUQmxEum3+3TwqFIxugIeWnusEEdAs8w6TsHjBxs1HHfviLaG68jgIuH7n3PcM/9NbBJzdvWVEzUT852HdPGdQNUEwzkTGeNGu2CV+NCWX+Ix9x8kNj09ohwuBhAPMWXUyWX9hbaUPplYRWhnU8DPByd8IkVZKPeQA6g+YlxqG1bbtPXfvYSLuybQ2XhQa2PeGH3XuFk6zqCXw3G+Nm+5chiMpfBAu1pNqIIER01507hIjji/MJkxXB6WZQgC30pCpo/l4rDbxMl5b0/Xbds439RRwTmSo3io909A0YXfWF5Msf7RvNHPLeO89uyZMvAV7G7PCNBSuE0eyHi41KSmY73bAj7IeLEsBO4+SGN7NHXFrzbl3+6syFK+LdoXAKGGAnL88xCg0gDVq/i+ZUk1DEPByBmKllR/cXdd52rmIjuahbGnORmRi0DLu3RzWe2aI+3eah2cUFcZS5g/slDk/6HeALHYlHD99oy/HlH65Au0cs2EvGikH6c8fL5oKKxRlxnBhT9pdTw2iIflH0ZQtsBFioPEf+eivFxtY/XqXlUK+/GZKvikcbKGbL8hIwoXco1z0ILA== X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: f63ab5a8-2bde-47d9-f6f1-08d9eabe0888 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:55.8609 (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: bDaV868a27ALZXwIUx+lbZpXVlAUWklc0R/w6crbkewB3/aJrcVT3Iokj2tWFBwGTTazI7meUJDkPbf0FjdMUUknRJDvvUa61iTAWYzAD7A= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR1001MB2176 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org 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 Reviewed-by: Vladimir Oltean --- drivers/net/ethernet/mscc/ocelot.c | 78 +++++++++++++++++++++++++----- include/soc/mscc/ocelot.h | 8 +++ 2 files changed, 73 insertions(+), 13 deletions(-) diff --git a/drivers/net/ethernet/mscc/ocelot.c b/drivers/net/ethernet/mscc/ocelot.c index 455293aa6343..5efb1f3a1410 100644 --- a/drivers/net/ethernet/mscc/ocelot.c +++ b/drivers/net/ethernet/mscc/ocelot.c @@ -1737,32 +1737,41 @@ void ocelot_get_strings(struct ocelot *ocelot, int port, u32 sset, u8 *data) } EXPORT_SYMBOL(ocelot_get_strings); -static void ocelot_update_stats(struct ocelot *ocelot) +static int ocelot_update_stats(struct ocelot *ocelot) { - int i, j; + struct ocelot_stats_region *region; + int i, j, err = 0; mutex_lock(&ocelot->stats_lock); for (i = 0; i < ocelot->num_phys_ports; i++) { + unsigned int idx = 0; + /* Configure the port to read the stats from */ ocelot_write(ocelot, SYS_STAT_CFG_STAT_VIEW(i), SYS_STAT_CFG); - for (j = 0; j < ocelot->num_stats; j++) { - u32 val; - unsigned int idx = i * ocelot->num_stats + j; + list_for_each_entry(region, &ocelot->stats_regions, node) { + err = ocelot_bulk_read_rix(ocelot, SYS_COUNT_RX_OCTETS, + region->offset, region->buf, + region->count); + if (err) + goto out; - val = ocelot_read_rix(ocelot, SYS_COUNT_RX_OCTETS, - ocelot->stats_layout[j].offset); + for (j = 0; j < region->count; j++) { + if (region->buf[j] < (ocelot->stats[idx + j] & U32_MAX)) + ocelot->stats[idx + j] += (u64)1 << 32; - if (val < (ocelot->stats[idx] & U32_MAX)) - ocelot->stats[idx] += (u64)1 << 32; + ocelot->stats[idx + j] = (ocelot->stats[idx + j] & + ~(u64)U32_MAX) + region->buf[j]; + } - ocelot->stats[idx] = (ocelot->stats[idx] & - ~(u64)U32_MAX) + val; + idx += region->count; } } +out: mutex_unlock(&ocelot->stats_lock); + return err; } static void ocelot_check_stats_work(struct work_struct *work) @@ -1779,10 +1788,11 @@ static void ocelot_check_stats_work(struct work_struct *work) void ocelot_get_ethtool_stats(struct ocelot *ocelot, int port, u64 *data) { - int i; + int i, err; /* check and update now */ - ocelot_update_stats(ocelot); + err = ocelot_update_stats(ocelot); + WARN_ONCE(err, "Error %d updating ethtool stats\n", err); /* Copy all counters */ for (i = 0; i < ocelot->num_stats; i++) @@ -1799,6 +1809,41 @@ int ocelot_get_sset_count(struct ocelot *ocelot, int port, int sset) } EXPORT_SYMBOL(ocelot_get_sset_count); +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_kcalloc(ocelot->dev, region->count, + sizeof(*region->buf), GFP_KERNEL); + if (!region->buf) + return -ENOMEM; + } + + return 0; +} + int ocelot_get_ts_info(struct ocelot *ocelot, int port, struct ethtool_ts_info *info) { @@ -2799,6 +2844,13 @@ int ocelot_init(struct ocelot *ocelot) ANA_CPUQ_8021_CFG_CPUQ_BPDU_VAL(6), ANA_CPUQ_8021_CFG, i); + ret = ocelot_prepare_stats_regions(ocelot); + if (ret) { + destroy_workqueue(ocelot->stats_queue); + destroy_workqueue(ocelot->owq); + return ret; + } + INIT_DELAYED_WORK(&ocelot->stats_work, ocelot_check_stats_work); queue_delayed_work(ocelot->stats_queue, &ocelot->stats_work, OCELOT_STATS_CHECK_DELAY); diff --git a/include/soc/mscc/ocelot.h b/include/soc/mscc/ocelot.h index 312b72558659..d3291a5f7e88 100644 --- a/include/soc/mscc/ocelot.h +++ b/include/soc/mscc/ocelot.h @@ -542,6 +542,13 @@ struct ocelot_stat_layout { char name[ETH_GSTRING_LEN]; }; +struct ocelot_stats_region { + struct list_head node; + u32 offset; + int count; + u32 *buf; +}; + enum ocelot_tag_prefix { OCELOT_TAG_PREFIX_DISABLED = 0, OCELOT_TAG_PREFIX_NONE, @@ -673,6 +680,7 @@ struct ocelot { struct regmap_field *regfields[REGFIELD_MAX]; const u32 *const *map; const struct ocelot_stat_layout *stats_layout; + struct list_head stats_regions; unsigned int num_stats; u32 pool_size[OCELOT_SB_NUM][OCELOT_SB_POOL_NUM];