Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1730402pxb; Wed, 9 Feb 2022 03:19:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJwIUZ6QLfzUjlgCPk4MMKxK7Iu2+bRoIF2VV+dYwtTNjpFn4Aius2jD+v/C/wu7tuLErai1 X-Received: by 2002:a17:90a:6b4b:: with SMTP id x11mr1987933pjl.11.1644405560553; Wed, 09 Feb 2022 03:19:20 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1644405560; cv=pass; d=google.com; s=arc-20160816; b=NVXRcAv62XlPiU23Tbh2n0dMlrVJvFK3KAPPn7oMumPh9UL33Wjx/qLZ4Ht53SKsXN AltSPn1aCTfG9f7uACt/P61GLnM1J1FG7uP256cPoZrKJl362WTtpxlVnYGKbYtKBY/k u/G5KlTHe0vnP79LHWNQyLHRM3fY0RGqyAiKUhrhAbQ9DF7Jxp23sCszq+LssUfowbzp ITsV8wvbHx6NzIj8Gg52lcLUztqAJShtmzz2EXIimbvMfOYI67OAOja8ue7diOVMS8Sd YRAD+Npzr5bw8f+gM2E8p/AlmjxK4hel7Gt+UQjWscIAzIBnvRILY7CansR5/reXLUVh EfZQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:in-reply-to:content-disposition :references:message-id:subject:cc:to:from:date:dkim-signature; bh=IF9kwQdD6j4REMOJI9tanY0TsHv4ChvNxqT78EOb6zI=; b=l7bzBFwTCFuCOt1fRBMPdJAgzPYwPTQ9jTabcKq71JYAViPpFy6LFvlI7LJse4yghi IowFtcInDq0t5Sz3mN5eDmgC0uUkEab4NcevD1Hvq4qapBNvFtZiGobqH91LGlLBm3cX fihJScT7vciekfwmTXgdiB47Gzxqa/3t+OK0nczgpHEsb4GfVSDywVfToZyqrNA+EclC eebyorq+PNDiGLKrtt5DwADKYP8q9x8612ILUzJ7IP9XP5l0FTAav5puH8p98qIgDmnn HCvZputG6e7Cp5uTPFzGHAikmySyivgTE7fYLANGDQrUMf9ZD/eoSkCTLjQVz4RG4wAN 7lxw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@inadvantage.onmicrosoft.com header.s=selector2-inadvantage-onmicrosoft-com header.b=HL7B1sxF; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=in-advantage.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id pi14si5089110pjb.154.2022.02.09.03.19.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Feb 2022 03:19:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@inadvantage.onmicrosoft.com header.s=selector2-inadvantage-onmicrosoft-com header.b=HL7B1sxF; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=in-advantage.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 456B3E0717E1; Wed, 9 Feb 2022 01:46:15 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346929AbiBHEfT (ORCPT + 99 others); Mon, 7 Feb 2022 23:35:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238046AbiBHEfR (ORCPT ); Mon, 7 Feb 2022 23:35:17 -0500 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2106.outbound.protection.outlook.com [40.107.243.106]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 563E0C0401DC; Mon, 7 Feb 2022 20:35:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gJlY2IfQgxidksvFwPFvwgXYuaEnaIv+OIFSyknCheg8fuTCbhio/cC6u0XYBUGH4LwlOrAAB/eUNEu/iWclmjegW+we+47rSa2mSm8nWMlA2ifMOAmFEFviYpvNvVVmFRbqQwl6j/+nAj45vfiEKca7n9G0tYJzgIW22pPS+sCCBP9Lc8cfV5uVlHFSJVM4qK4tF7rFz7I0rS2L1ZdVIY+VQye4zuY3yiR1uLyf2kgwVwjgCSDsWdGXiGapecMUv/KAbPh4RTXPjC5gIWGHgPHT2OEKyEfhfxunFjNZuXiRWk87jmljFLSi7w83ABwVdut1y1VkANvwOW69jGB5fg== 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=IF9kwQdD6j4REMOJI9tanY0TsHv4ChvNxqT78EOb6zI=; b=AnR6z6U8H4JW2VZRvXfFI5iphbbVJTnSj9jG9yZaD2E98vmyiLMso9cgvW7IwSQrwPQy882YYe/fVu4oSe3gCx09Qczd6dEHNbjqH9Frnnu8MIdHM7pNSc/vqiWYtCnugQhZHkc0xQ/4RgIfFdvdgirFN67SuIyTKdMc9S7S7HYqO904iJU8CiZnhGQWpNiAQ6XeslalG0Y9mWksHZwaXlQyalHMp1hv4X6qGzRnjCkGQMw/fkY+Mo5DDcrnFn2UP/gbhZhqV5Hpp2xFRWPtFHjr5jAWlzZkIXn1tFsHKyHT/fMUajF8TLL9m4JNaFjjoPO0Zwlhu/HYwlV59Osxlw== 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=IF9kwQdD6j4REMOJI9tanY0TsHv4ChvNxqT78EOb6zI=; b=HL7B1sxFqVdOrIvBnTKH5abEnPBF8usk41VFthIsuG6dXcdRCCNGWJe2C/lorg1/nM9d5FT3yiSOLO14J3JHDlW5aS5IrM2mBKzqjbixTEOEcgX4fd/icbh63hCCnjAUKK4J6SMN2r28kmANyEkVmuoTnuL0K6kdCqa+w3SCISc= 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 BLAPR10MB4852.namprd10.prod.outlook.com (2603:10b6:208:30f::23) 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:35:14 +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:35:13 +0000 Date: Mon, 7 Feb 2022 20:35:07 -0800 From: Colin Foster To: Vladimir Oltean Cc: "linux-kernel@vger.kernel.org" , "netdev@vger.kernel.org" , Jakub Kicinski , "David S. Miller" , "UNGLinuxDriver@microchip.com" , Alexandre Belloni , Claudiu Manoil Subject: Re: [PATCH v3 net-next 2/2] net: mscc: ocelot: use bulk reads for stats Message-ID: <20220208043507.GA246307@euler> References: <20220125071531.1181948-1-colin.foster@in-advantage.com> <20220125071531.1181948-3-colin.foster@in-advantage.com> <20220131102255.zgfmbzmffup6rste@skbuf> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220131102255.zgfmbzmffup6rste@skbuf> X-ClientProxiedBy: MWHPR1701CA0003.namprd17.prod.outlook.com (2603:10b6:301:14::13) 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: c0e4a057-af40-43cd-3503-08d9eabc65bd X-MS-TrafficTypeDiagnostic: BLAPR10MB4852:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2512; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4+efP3LFNUDKutAJ/6/8GH0VCOl1X3sHgj4bwcZb4gyobCbAxGEzkvGHahrBXRE9nz1w6npe3n2yVU0hu/T0yJK3ewIFOM90jS1S8xrGTzzEunQaiDOFEgZITD68pqAVzg2SvAVsHwa2wnNfTsUS2iuaDvlgiVrjNjxvPdauj7ZQlwXCpxuDwbsqc28bxPqk2amCY3j8GC+X/7CryUxlVBA1hL9QG7dWZUF9l/Vp4xDsOgyoufjopx1PFi16mNJUn8heSiw4LCrS+UoIqi9Tq19FyqmuSCUCHH30owf/hpByXb7SCJ5aOjVkRGVE7NsDJr4maJJkqF43rixcfhKXAEcVadqW8j0Xxid7XTvVF+rwGd7tD5srGAaqY+KzHQTMOf3HrxDCWzrI3Bb25cJPzzKJWXHlw0Uhor6+3KikfqfNwv6MFK+oJO85b8c4AXqL6VQdxXhEAlORlXlsk8u2kSOTW2PgpthTzooZQbQm08U9tGBcw1eNcwFb6LXAsZw6OFdSaC2k5+PkutUz8Tc3V/38cmoh7CWSEtRzr1ZX1HYnVM+uC7HpjYCRV9XvgeQ4alTK7D9mjxzKXu8R/bAk9b51TQDW7mBfQ1zHyKvcPwqKT7HW5POCOmnM8/L9NpJYV10APP6d/8wuy0HGnJ4vUknCop+GMl0U0qZLNB7GplHfh7dn+uSDojRgNBa1/mwjdB8/0PEY06gjScTJCdiSbQ== 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)(7916004)(396003)(366004)(136003)(376002)(346002)(39830400003)(42606007)(6916009)(33716001)(38350700002)(6512007)(5660300002)(44832011)(9686003)(54906003)(26005)(1076003)(316002)(83380400001)(186003)(66476007)(66556008)(66946007)(8676002)(8936002)(6486002)(52116002)(2906002)(508600001)(6506007)(86362001)(6666004)(4326008)(33656002)(38100700002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?njmxvCg/0ochMd8Fe+qZ598MOK4yDqovjBmO1Y52is5Fkoe8PyhV4XzalIHY?= =?us-ascii?Q?7RhP2fVPsCBXWKRhk+ks00NULkheqDELByw/9lxHCmCt/ReQs8rV2DH3rhvy?= =?us-ascii?Q?USJP8p0P5YeXt6sELLkJP36L5IeZKdwWXDEit2Nlu9QNWZ/oZrGtbv773BMi?= =?us-ascii?Q?j6PQabMLzrCuy7tZV3oJ+rskQidEN/Eg6fFOSud79FMkkEPwLB+d3TVDK1TX?= =?us-ascii?Q?eKA8a0j8TPQqUN+RxkJ75m5oW/07KJvObHs7AnqIXiZBWdglyuWcjBPdnQIY?= =?us-ascii?Q?4dCT1MRBzj2v1SdlFw5FZlVf1fjyeUCSsu38pDXdGfRHg7dcv3CjdOKTBQvI?= =?us-ascii?Q?Cl5x4+yhkoswv1k2pMCKsH1lR7oY6OyylVeXOUnK8S7VW6or2lIT6ngsTJfE?= =?us-ascii?Q?56+u53gAZotQbBabLF3nO0YVSk3IiusGvqwQTDOugl7sn6LH3S/xZt5lcufu?= =?us-ascii?Q?eV36xpwyRdbz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us-ascii?Q?6mfUHoIeIxQH8hvSImTkEilsv0r2aSWfPcdhSqwg2swV6XACeDjazZNDxQq7?= =?us-ascii?Q?sgkjYrgmd3V6MU974HTzbhwO9C2h72u2ghXKW5LT6DZFO7Dzm6w9WwKTAcmV?= =?us-ascii?Q?cHCEWa5lSfKif89+4woVh3vyIp9DDLizxpIBc3Ik2heYT9KaF8gFNBvliJFg?= =?us-ascii?Q?cgUWBDOs+5Ql83IzfQL6nZ0dOeuCse2KbmbLfXop89scRR870sVI6v8Xw3yt?= =?us-ascii?Q?8JmP16kLe4AF2RPvPE/O2B7BigQchFXyvwFFLLs5uzPX2u8z6UyTJ8c6BzXp?= =?us-ascii?Q?WiJwzg=3D=3D?= X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: c0e4a057-af40-43cd-3503-08d9eabc65bd 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:35:13.4879 (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: vl8ZM7cvfnwpSBcnkNzrQhE+QVZXhZOMNtNoCzeggCIT18lOjkHHUB6Dxo+LhK0l7cvPuEKdNT2B6eYA15WPqdtRe5TICXSXPSS4g5R1CzU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLAPR10MB4852 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Vladimir, I'm sending out v5 shortly. Sorry I seem to have forgotten to respond. All changes made, except the SYS << TARGET_OFFSET. The macros for *_rix use reg##_RSZ for expansion. On Mon, Jan 31, 2022 at 10:22:55AM +0000, Vladimir Oltean wrote: > On Mon, Jan 24, 2022 at 11:15:31PM -0800, Colin Foster wrote: [ ... ] > > mutex_lock(&ocelot->stats_lock); > > > > for (i = 0; i < ocelot->num_phys_ports; i++) { > > + unsigned int idx = 0; > > It is usual to leave a blank line between variable declarations and code. > > > /* 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, > > I'd be tempted to pass SYS << TARGET_OFFSET here. Expands to SYS_COUNT_RX_OCTETS_RSZ, defined in include/soc/mscc/ocelot_sys.h. > > > + region->offset, region->buf, > > + region->count); [ ... ] > > +@ -2799,6 +2845,10 @@ 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) > > + return ret; > > + > > Destroy ocelot->stats_queue and ocelot->owq. > > > 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 b66e5abe04a7..837450fdea57 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]; > > -- > > 2.25.1 > >