From patchwork Wed Apr 12 12:47:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13209140 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 5C5B0C77B6E for ; Wed, 12 Apr 2023 12:49:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229815AbjDLMtg (ORCPT ); Wed, 12 Apr 2023 08:49:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33364 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229916AbjDLMt1 (ORCPT ); Wed, 12 Apr 2023 08:49:27 -0400 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2071.outbound.protection.outlook.com [40.107.22.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 75504A247; Wed, 12 Apr 2023 05:48:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oZmHlne/1AMHZTzSZ3wWq/3WPWcBbEp7zqtMWt8gIu3UvP6i55TFU7z4Khc8pxvi/lX84kxlKThDR1LVGMSMflzBkIcDYGgCDnCiozTH0ZBciaeAN27gmjpBTkEAOc8SdinfSSgp9KODGifsY37lUkb9z56U7cngVfxFvudBeGy5lIsPIpDkFyTtWONjFuwTe4ZFL0dYZiuLP2A2PDolhS5IHE9GnW2S+eMoaYsEoURNcKQrIgN+92iuh83RPyljeZKDkjaWYyBYolWqK8ddkBpwfWdGYXOhvCvxO/P3N5FmT/d9Qc+2mSu8qPjaZiOB+19T1VFJf06FgHoh8/Xcaw== 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=TS/rSogzg/Yo2bKWcqE9w9nBxu5/lORMaffud/S49gM=; b=E5/V+MZukHaiimv7oH7gmK6a/s0E17NlGcEl64kv/Oc/tzgITWIFn4f0Z29zegRJDV2i38TBS4v3urVWS6sMR/miTv5HcLbKapj3ryhdFT9gvxaAhmAz/HG8enrwuf7sfnyy43KP/0I+PgwlCvbBlpRgXD9pcx57OcWysM7HlpuOV7UIaUEVSQ29XxuMS6ibRyyl8Sz5jdqR7W98YxxLBsqvQ/o0Gik9R9Mve67ImhfJlPLKUJ59mLGp5rde5aJFUU+QFfDb/ilX03QV8nBbPOvji9MM/E8DbAaqdsGItcaPYO8Un+95Ozif8jRZ11Q+ygnq/Lk916CYUJkCz+jpbQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=TS/rSogzg/Yo2bKWcqE9w9nBxu5/lORMaffud/S49gM=; b=Xo3gjmJbB5JaPV02+o2AHV3fTddDh2iRkxd57m10cMBKDzCZ81xseP0ICG11sKj4u4ioTqhlMJuY3h0wVSssayzeSOejgUrWJYJjDJmTC4UIjZA1la9zFukuv9jBgnaoxXlZlMiKbgfS2rybtBPYyQIjY7B7gi/T5vEoRyveCbM= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) by AM7PR04MB6888.eurprd04.prod.outlook.com (2603:10a6:20b:107::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.38; Wed, 12 Apr 2023 12:47:53 +0000 Received: from AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::55b1:d2dd:4327:912b]) by AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::55b1:d2dd:4327:912b%5]) with mapi id 15.20.6298.028; Wed, 12 Apr 2023 12:47:53 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: Andrew Lunn , Florian Fainelli , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Colin Foster , linux-kernel@vger.kernel.org Subject: [PATCH net-next 1/8] net: mscc: ocelot: strengthen type of "u32 reg" in I/O accessors Date: Wed, 12 Apr 2023 15:47:30 +0300 Message-Id: <20230412124737.2243527-2-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230412124737.2243527-1-vladimir.oltean@nxp.com> References: <20230412124737.2243527-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: VI1PR0701CA0056.eurprd07.prod.outlook.com (2603:10a6:800:5f::18) To AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM0PR04MB6452:EE_|AM7PR04MB6888:EE_ X-MS-Office365-Filtering-Correlation-Id: 6f545d4f-2964-4339-9159-08db3b54218a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QcHQw5o2+uT+Jtm13MuvVHyurbhGED/+yTtSo/zrOTYmua6HZW1dNPLGfsCvzerby/pQrKZ0UsgYlp2eFfSr7WNS2io2Y63DFhjyzd8jC4aNufaECm7GNZUH4zvffdbQnNYe65Kgl0GRvGYewcY9nwHRRAE4WK4FP9ZRYixtsfi9up87BQh34IIJJg6YUSuZgiW/qFzfdYgtDgx0fr6fMorYX72yZC4nNT3OVI8i01v/fy47X0/tl7uZf2hC3gSXISKT/A/RzAysKOk1Ki/gG2JDSkmjAe69Yo6gv8d2hJu6n9csnzL1WTa2Rg4yE/qRtkyrWqbAK3CkSK5sNRDTjqOH/UQNXpKcIX2xIVCnrUIEGs14ZXxZ3G/PbIzgIVrFr5+5JJR2WgDItEltocBhJvoJtJTwPpLycMrcPBXjicIZXfc/ztmyBnp+Nc/EzsCi9LOk7lfmVCILbRaXUuLDRFkFge0REIav1NWVl9cZ/oVi4EWBpgp4NEQPheDX+2xVafI6byXg7CxHZdjLPSCkSsuH0LnAD+58tg7NkKeSeUpqOd4kfJmGH1AK0bvgtKVr1UOAyCCcB2OC80UTqgtwwWRpBrVCcgXVYuuBZhpLGyzJBA3vORohssAMjoOGRT1Ja5f9kVjkHb8lmh3Vt+vOjQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM0PR04MB6452.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(366004)(39860400002)(136003)(376002)(346002)(396003)(451199021)(478600001)(52116002)(86362001)(83380400001)(6512007)(36756003)(38350700002)(2616005)(38100700002)(316002)(2906002)(1076003)(6506007)(26005)(54906003)(44832011)(186003)(5660300002)(66476007)(6486002)(6666004)(6916009)(8936002)(66556008)(41300700001)(8676002)(7416002)(66946007)(4326008)(461764006);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: USUQaetkCJgbivOyoInY1K5sK05tmLp++lKE9xREVPxUUw/6hQCRNUvksmpnMYWaWSYVnkwCG37cbnuDVeuzK1Sclwh37oWhLF2Wmw5Z4LFc9oNlrxXK+OoNdwKK2R//84ChXJNXC5NMH5NO90VDS7oGaEZVCCwwsUUe5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4Ey67ghOfkJivjoOpUgmxHKBlL/n6kOh/pYEE/TjpIUKQkFLq6Cdeb6A2yrYSpb11bhcBqjrWy5b6y9+urLYycZXJ8vvQpb9OsTmN1xX0uNaeCZDyvRRSQW7ZJ+MvBDEioXCsqYFkbjr2puFyE4Xwvqal6MrTIJrLUYU5Wf+dklXw70TqA6lA0RIaoR/NUjB2Ej3Bu8UFEZNaDVThhk/kO5I3Os1MjsYJFB8FWcTJ8MBfhMaqyXumcWsSiGWE8sLUsCkR4lE3Lj1FyjaMf7clIxxilPf7m9y8NSM6N94t3yvLhZgi64gyQSEihMQWH4GygLAThuZ2pxBxAAVGjTGWGKCM6DFM6+EJrRsuSGSg+uHSyesNTKwRDkV+eMiA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6f545d4f-2964-4339-9159-08db3b54218a X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB6452.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Apr 2023 12:47:53.1569 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: uEm4a/peCv2KgroxUafTczSrn5DTXOeOvB+xd/nTw4UwjJZtNEGXIYYo9LlY6DkxSpom6YuQfwtSVBlKbF9/Cg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB6888 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The "u32 reg" argument that is passed to these functions is not a plain address, but rather a driver-specific encoding of another enum ocelot_target target in the upper bits, and an index into the u32 ocelot->map[target][] array in the lower bits. That encoded value takes the type "enum ocelot_reg" and is what is passed to these I/O functions, so let's actually use that to prevent type confusion. Signed-off-by: Vladimir Oltean Reviewed-by: Jacob Keller --- drivers/net/ethernet/mscc/ocelot_io.c | 20 +++++++++++--------- include/soc/mscc/ocelot.h | 20 +++++++++++--------- 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/drivers/net/ethernet/mscc/ocelot_io.c b/drivers/net/ethernet/mscc/ocelot_io.c index 2067382d0ee1..ddb96f32830d 100644 --- a/drivers/net/ethernet/mscc/ocelot_io.c +++ b/drivers/net/ethernet/mscc/ocelot_io.c @@ -10,8 +10,8 @@ #include "ocelot.h" -int __ocelot_bulk_read_ix(struct ocelot *ocelot, u32 reg, u32 offset, void *buf, - int count) +int __ocelot_bulk_read_ix(struct ocelot *ocelot, enum ocelot_reg reg, + u32 offset, void *buf, int count) { u16 target = reg >> TARGET_OFFSET; @@ -23,7 +23,7 @@ int __ocelot_bulk_read_ix(struct ocelot *ocelot, u32 reg, u32 offset, void *buf, } EXPORT_SYMBOL_GPL(__ocelot_bulk_read_ix); -u32 __ocelot_read_ix(struct ocelot *ocelot, u32 reg, u32 offset) +u32 __ocelot_read_ix(struct ocelot *ocelot, enum ocelot_reg reg, u32 offset) { u16 target = reg >> TARGET_OFFSET; u32 val; @@ -36,7 +36,8 @@ u32 __ocelot_read_ix(struct ocelot *ocelot, u32 reg, u32 offset) } EXPORT_SYMBOL_GPL(__ocelot_read_ix); -void __ocelot_write_ix(struct ocelot *ocelot, u32 val, u32 reg, u32 offset) +void __ocelot_write_ix(struct ocelot *ocelot, u32 val, enum ocelot_reg reg, + u32 offset) { u16 target = reg >> TARGET_OFFSET; @@ -47,8 +48,8 @@ void __ocelot_write_ix(struct ocelot *ocelot, u32 val, u32 reg, u32 offset) } EXPORT_SYMBOL_GPL(__ocelot_write_ix); -void __ocelot_rmw_ix(struct ocelot *ocelot, u32 val, u32 mask, u32 reg, - u32 offset) +void __ocelot_rmw_ix(struct ocelot *ocelot, u32 val, u32 mask, + enum ocelot_reg reg, u32 offset) { u16 target = reg >> TARGET_OFFSET; @@ -60,7 +61,7 @@ void __ocelot_rmw_ix(struct ocelot *ocelot, u32 val, u32 mask, u32 reg, } EXPORT_SYMBOL_GPL(__ocelot_rmw_ix); -u32 ocelot_port_readl(struct ocelot_port *port, u32 reg) +u32 ocelot_port_readl(struct ocelot_port *port, enum ocelot_reg reg) { struct ocelot *ocelot = port->ocelot; u16 target = reg >> TARGET_OFFSET; @@ -73,7 +74,7 @@ u32 ocelot_port_readl(struct ocelot_port *port, u32 reg) } EXPORT_SYMBOL_GPL(ocelot_port_readl); -void ocelot_port_writel(struct ocelot_port *port, u32 val, u32 reg) +void ocelot_port_writel(struct ocelot_port *port, u32 val, enum ocelot_reg reg) { struct ocelot *ocelot = port->ocelot; u16 target = reg >> TARGET_OFFSET; @@ -84,7 +85,8 @@ void ocelot_port_writel(struct ocelot_port *port, u32 val, u32 reg) } EXPORT_SYMBOL_GPL(ocelot_port_writel); -void ocelot_port_rmwl(struct ocelot_port *port, u32 val, u32 mask, u32 reg) +void ocelot_port_rmwl(struct ocelot_port *port, u32 val, u32 mask, + enum ocelot_reg reg) { u32 cur = ocelot_port_readl(port, reg); diff --git a/include/soc/mscc/ocelot.h b/include/soc/mscc/ocelot.h index c0e40ceba50c..85505ac5e63e 100644 --- a/include/soc/mscc/ocelot.h +++ b/include/soc/mscc/ocelot.h @@ -943,15 +943,17 @@ struct ocelot_policer { __ocelot_target_write_ix(ocelot, target, val, reg, 0) /* I/O */ -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, - u32 offset); +u32 ocelot_port_readl(struct ocelot_port *port, enum ocelot_reg reg); +void ocelot_port_writel(struct ocelot_port *port, u32 val, enum ocelot_reg reg); +void ocelot_port_rmwl(struct ocelot_port *port, u32 val, u32 mask, + enum ocelot_reg reg); +int __ocelot_bulk_read_ix(struct ocelot *ocelot, enum ocelot_reg reg, + u32 offset, void *buf, int count); +u32 __ocelot_read_ix(struct ocelot *ocelot, enum ocelot_reg reg, u32 offset); +void __ocelot_write_ix(struct ocelot *ocelot, u32 val, enum ocelot_reg reg, + u32 offset); +void __ocelot_rmw_ix(struct ocelot *ocelot, u32 val, u32 mask, + enum ocelot_reg reg, u32 offset); u32 __ocelot_target_read_ix(struct ocelot *ocelot, enum ocelot_target target, u32 reg, u32 offset); void __ocelot_target_write_ix(struct ocelot *ocelot, enum ocelot_target target, From patchwork Wed Apr 12 12:47:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13209144 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 DE77CC77B6E for ; Wed, 12 Apr 2023 12:50:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230253AbjDLMuV (ORCPT ); Wed, 12 Apr 2023 08:50:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230459AbjDLMtw (ORCPT ); Wed, 12 Apr 2023 08:49:52 -0400 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2066.outbound.protection.outlook.com [40.107.22.66]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F7827ABC; Wed, 12 Apr 2023 05:49:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Mg/5Cw0OW97fxWn3q5KM34ttIuk75YEF+eJZiw+yIRY/wvut0I384ghrut7ayAyNHeYw+auomD6b5sSyrjd9bHOA2uU6cuQLXz1BT+lLd8I/L+1cYLSArw35OL3k3KbKpkGJ3lWKXVDQhttqCUyiUSJGWdrjh5fNqSi5RdYhCuSomzUjdJoyw53j/4RFawXucU/LWXyFu+wc80dGSFo+kkCf5mJBzV9LpYmQc4eGNknK8ISixWQtPDJ0fyNCMti4QnbBP9qYzoUzcgjBr3skQ/3Cz7e/+JDmfJ6947U0LyHTxRgJ+1YlnUbTTFlLeqPSjKquAt2oUWNV+H33Y4LgDw== 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=9AgmYtTYSgBMTncLhBRsN0OgZSSCzQeGJA13dHgv11c=; b=f90Y5Zgcaa0OQRfcrM32O1f10dea+vQqNGcvUB4bXar6ZCcP8vmx6VeyV2MKaSnTSLy9nHwQbeU7AnbuGdAY0uNEKhejcOck40bFwyhb7LhNSRVibxhP8jnfyo1hUwhgGckCen29/yJVUeAYUYfO6j2HGj5rbZGYdXIFBIPt4NH3vBzk9dT3IPREBf3lOocJ29GeEm+5BzSTVkjjv1CflqNIBtz+MjBSplKt9eEJtiBPRxnD2dXNo2JTIYvzx8fnNfbcVdJg1iEshPt7AMWDWPtw1L3ZkSJ5kocP74KgVdWRcZl4fMQNRb87gLJ3yCbVFwz34a/o65lx6Wh6Sdt7Zw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9AgmYtTYSgBMTncLhBRsN0OgZSSCzQeGJA13dHgv11c=; b=bBNTvobvBw6Rq3vKvE0Zm/iVaR+xDNJ9U5fd9xca/xPgQOx1EhJDVuRUV2WAe8qM4ho0SHzTbe1tLXkyDjhiZT9LuNR2Em+0HXw8xTtQfhxVxs1VnVcaRUF49mXh6OLY4BPnf2YU89+l4Oh39Rrasp7XoQZzTM3PCQ0MoIMc2/I= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) by AM7PR04MB6888.eurprd04.prod.outlook.com (2603:10a6:20b:107::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.38; Wed, 12 Apr 2023 12:47:54 +0000 Received: from AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::55b1:d2dd:4327:912b]) by AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::55b1:d2dd:4327:912b%5]) with mapi id 15.20.6298.028; Wed, 12 Apr 2023 12:47:54 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: Andrew Lunn , Florian Fainelli , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Colin Foster , linux-kernel@vger.kernel.org Subject: [PATCH net-next 2/8] net: mscc: ocelot: refactor enum ocelot_reg decoding to helper Date: Wed, 12 Apr 2023 15:47:31 +0300 Message-Id: <20230412124737.2243527-3-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230412124737.2243527-1-vladimir.oltean@nxp.com> References: <20230412124737.2243527-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: VI1PR0701CA0056.eurprd07.prod.outlook.com (2603:10a6:800:5f::18) To AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM0PR04MB6452:EE_|AM7PR04MB6888:EE_ X-MS-Office365-Filtering-Correlation-Id: b3041181-7461-4462-eac4-08db3b542227 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: CPwosvh97F2fWPJOPzsZ5NvqsNE/muYefL56ei2bIhRVX2PPXMZSEG3GdkHkB3Mj1hg9LWmv4wNSOWCb89Z5vZYYpfAhxKS3vDlCg23NH+IoBA5Oq9YlwrGpiwN34ewz8sjs6CbcEhEb9hsYVS2wyL5JCZvMQe4WgVAtIw5lYXzBQj6I6zEA+0Yv9qaXHdkduaMaeFB9xq3WhYe+EtcyYg74uLZH+UfA8TwBeycAZjSsbVp2KPfaD9DSwtRA6IhXjEn2S2gZ1qEo6fIRAiBKfLy+pefTTr6bexlEifu/6qyOr8pSczDoEcyKxDS+utzdeIFVN/pfaTrWDzzpic9RDzVUJRhkF/lPyRFmOXYQQncYIzYjHCKVkHOI1uIFke7yB+0qjK4Ah0Ug3QeqGHyuHxwYMg2DLFHikZ30t5MNYhGgYD9N1jAVfXnJ3t++PJztSNVjnPOEbc/+9WCv0tmoNAPXw8wyEtkksPjKi+FJm4LyfAkKA8BV/IMogNGiiJsAwFbEh8xc2dgEMSZbl/AvQRQdtE+8HUgeSZvCzffcCmyrizfiDTQoClg6oHDR47aLWrHsjDiaut0hM39zzYwY6pge5De0Eat7J4NiFf0smTpqnnTz2R/FNNbattd7xtuA6K+Zm8yRSq2Pt59J++My9g== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM0PR04MB6452.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(366004)(39860400002)(136003)(376002)(346002)(396003)(451199021)(478600001)(52116002)(86362001)(83380400001)(6512007)(36756003)(38350700002)(2616005)(38100700002)(316002)(2906002)(1076003)(6506007)(26005)(54906003)(44832011)(186003)(5660300002)(66476007)(6486002)(6666004)(6916009)(8936002)(66556008)(41300700001)(8676002)(7416002)(66946007)(4326008)(461764006);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: tXRUaxwndIu4IzyKPA+lWbRDKOpYFNW6pgjqD1wCehM6SYyynMsilF1iMpNlt9L/jBeA8jotBB/OL6Z/mexQFfhgZYS5v9Otnhp1UFs6xgQxLsFTpDj45r02NyCZgSgX3jm3gSuFqbgVp/8fETYeDg1i8U7kAAsC5xYmhJbI9143hHXEDmpoVetJCQh7vl7A0Zcp1Zt69Kke3HutfQuYDITfIq26SIBsukYKsmkzhCCb4L6Zl+BvgjJQ81wkujE/fsPgVLaDwXnh+0Mo51BWG+CQoK3BAfSVE1P2UcAgZg4mPQgfVlARhNLxfxvVrBAYKe07UyymhkqjdD9XFdxIwvow8S9BsLcf11emA5BXmFdFbc7C6aeg47JZXj+AF69lz6y4l/WwnoeK8YX2CpwVZAaq9VrInVkYvhz0AI0UOQXYE771QZ4GKfMTljiZ0W7OXd28NxxxPXkbk7F6A73jyulOXUxwBcuPWsehS3BRW2xC6+k6AgSe5mUQfxJNXyedIecLM/PQlaK3L6O7bVnikRqfshYfObxxCXUgqRaSN82tLDlFpL9SDLERwVlq0P/4XiHkaC7V8Ql9kukz2gZcvSshbwFdmEaHiKEOYam5buE7oMaNkGue147hG7brIBj5m0JdYhfMOfmSojVc7tIWT6rWMeRTjPHczSObVBRpvPCzQSlNqu+EbSfzQVWD6RGAi9XN/Euer1ATPImVrmZexYVw1l8EFEsc+6UCfKq6s/xhbCqCsTvpMh4iGQWidmuXYD0oFy/oCb9gyjuWELz4WLgvtjPq0xjudAgBn4RA632FbIwzF/gPGMHfrne3RUVpShhLHUAx6kxWl5+FFJrrjpk2nfvMjmlz/EL4z8N9OY60yycaOxCoRlPasuzkkerqrIVAT9sC3O6TS8VigGFfrPwv+iv7o8fHgdc/5eafqmzM1A8OTp072D2ad3cQhgke4yi7vzULqM0EXlVgmBqmMKGEJjQKgreJI8NM4jCGjsWd27vu57znZWSmF0MpjHSP+HokesDiYopKAxAqpggBmqLcd15uGv67b0yRUo1X60WW+1LdJw4xQwLLRku5bPqU5RPvEdYvqTEKvrooXaQE1uGuDJkgGPbRlKfwpdSz3SSE3jzYfJweWp0Cqwh7SUvhgxLqyKi4k/THOd/2SpR3o7ndaC+e429UAS8l2tJ5McNtkXM5hMSFXcN3LdxZUQnmOsVFjLzuHxhReBT7/AL1I+z0+6Ni2OA2tGdvZ4dYt+FUdA4a2N+DxzELAzB4ZfoA1RnL1HUfTwP1OucDTsY5YI4yvZWc2CFkgViQ6TeUco01tpg9CFqw2Oj5Aw6SQQma0/mHzEmL8c6asVTo9ka0o3zF1iDFrIwfJn0hPpnog1S+aSKgePEuI7hWbK5dWVK3otwcoWdQ+pnfynv4pvb9hfWvaFH2em7yzRKugn8/g41uosnfuzdTIQ3ikJEKLM7xe63UEVVcul2BawBL0+qIwAytJUTBjMVp1PqgHEXHJMU5H7/UYyDM8hnJ6Bg5tn9MHGpMC2yqdu12o2etVWYpvhzG/lp5LrOj7kC5EQJ1aHNqP9X4sNXpohAhmep9UrktXRndkp7Cm0fTqi5AofEGfQ== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b3041181-7461-4462-eac4-08db3b542227 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB6452.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Apr 2023 12:47:54.0838 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: +Xr4Ezt1M76M2tvVZ3e2978xpP3uSViKXocGAwND0uU8mJ/jGpC/VsP0l91zm4yy5+gaepC5I9IRnlick4lKbQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB6888 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org ocelot_io.c duplicates the decoding of an enum ocelot_reg (which holds an enum ocelot_target in the upper bits and an index into a regmap array in the lower bits) 4 times. We'd like to reuse that logic once more, from ocelot.c. In order to do that, let's consolidate the existing 4 instances into a header accessible both by ocelot.c as well as by ocelot_io.c. Signed-off-by: Vladimir Oltean Reviewed-by: Jacob Keller --- drivers/net/ethernet/mscc/ocelot.h | 9 ++++++++ drivers/net/ethernet/mscc/ocelot_io.c | 30 ++++++++++++++------------- 2 files changed, 25 insertions(+), 14 deletions(-) diff --git a/drivers/net/ethernet/mscc/ocelot.h b/drivers/net/ethernet/mscc/ocelot.h index 9e0f2e4ed556..14440a3b04c3 100644 --- a/drivers/net/ethernet/mscc/ocelot.h +++ b/drivers/net/ethernet/mscc/ocelot.h @@ -74,6 +74,15 @@ struct ocelot_multicast { struct ocelot_pgid *pgid; }; +static inline void ocelot_reg_to_target_addr(struct ocelot *ocelot, + enum ocelot_reg reg, + enum ocelot_target *target, + u32 *addr) +{ + *target = reg >> TARGET_OFFSET; + *addr = ocelot->map[*target][reg & REG_MASK]; +} + int ocelot_bridge_num_find(struct ocelot *ocelot, const struct net_device *bridge); diff --git a/drivers/net/ethernet/mscc/ocelot_io.c b/drivers/net/ethernet/mscc/ocelot_io.c index ddb96f32830d..3aa7dc29ebe1 100644 --- a/drivers/net/ethernet/mscc/ocelot_io.c +++ b/drivers/net/ethernet/mscc/ocelot_io.c @@ -13,25 +13,26 @@ int __ocelot_bulk_read_ix(struct ocelot *ocelot, enum ocelot_reg reg, u32 offset, void *buf, int count) { - u16 target = reg >> TARGET_OFFSET; + enum ocelot_target target; + u32 addr; + ocelot_reg_to_target_addr(ocelot, reg, &target, &addr); WARN_ON(!target); - return regmap_bulk_read(ocelot->targets[target], - ocelot->map[target][reg & REG_MASK] + offset, + return regmap_bulk_read(ocelot->targets[target], addr + offset, buf, count); } EXPORT_SYMBOL_GPL(__ocelot_bulk_read_ix); u32 __ocelot_read_ix(struct ocelot *ocelot, enum ocelot_reg reg, u32 offset) { - u16 target = reg >> TARGET_OFFSET; - u32 val; + enum ocelot_target target; + u32 addr, val; + ocelot_reg_to_target_addr(ocelot, reg, &target, &addr); WARN_ON(!target); - regmap_read(ocelot->targets[target], - ocelot->map[target][reg & REG_MASK] + offset, &val); + regmap_read(ocelot->targets[target], addr + offset, &val); return val; } EXPORT_SYMBOL_GPL(__ocelot_read_ix); @@ -39,25 +40,26 @@ EXPORT_SYMBOL_GPL(__ocelot_read_ix); void __ocelot_write_ix(struct ocelot *ocelot, u32 val, enum ocelot_reg reg, u32 offset) { - u16 target = reg >> TARGET_OFFSET; + enum ocelot_target target; + u32 addr; + ocelot_reg_to_target_addr(ocelot, reg, &target, &addr); WARN_ON(!target); - regmap_write(ocelot->targets[target], - ocelot->map[target][reg & REG_MASK] + offset, val); + regmap_write(ocelot->targets[target], addr + offset, val); } EXPORT_SYMBOL_GPL(__ocelot_write_ix); void __ocelot_rmw_ix(struct ocelot *ocelot, u32 val, u32 mask, enum ocelot_reg reg, u32 offset) { - u16 target = reg >> TARGET_OFFSET; + enum ocelot_target target; + u32 addr; + ocelot_reg_to_target_addr(ocelot, reg, &target, &addr); WARN_ON(!target); - regmap_update_bits(ocelot->targets[target], - ocelot->map[target][reg & REG_MASK] + offset, - mask, val); + regmap_update_bits(ocelot->targets[target], addr + offset, mask, val); } EXPORT_SYMBOL_GPL(__ocelot_rmw_ix); From patchwork Wed Apr 12 12:47:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13209143 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 CCA97C77B6E for ; Wed, 12 Apr 2023 12:50:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230173AbjDLMuT (ORCPT ); Wed, 12 Apr 2023 08:50:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39728 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231761AbjDLMuC (ORCPT ); Wed, 12 Apr 2023 08:50:02 -0400 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2058.outbound.protection.outlook.com [40.107.22.58]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D22878A71; Wed, 12 Apr 2023 05:49:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dzT0l9+xkQucwb8At2BunfW9yy/qT44gFcnvc9c0BO2mavXKUhKijS1V8keOPBtDFv4jt6e3uweYPt8R7w+zXY4ylWU6+ZKbtqdnXmIy0HaFuZD1B8lua7cnAH8lV4JwFLlpHmkJtbFeC8+QTyS/oTuxk/nZIVpG0w9WwCw4dMLqqIRK2Q2GfLrvnetnezoAFAokfMF7I5UBzchzw+tdPrO3DdTlDuVpkWaY5Z19tTMEBxpl0HhdxLKXjr/8aboSOZ+JBW4gPnLBwf82QD1Hrr8FiQD5ZTH35bAyngzfeLf3sLf5ygjGIxeSc9c0TEQiTknQqirMCSVL0Linv1ajtg== 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=9A3FkgECR+wOrtxS66iwjqK7z4EGPmIhtRTRgbu8FOI=; b=Iarnrli3YsHpXVAkC/g1j9jI3H351QjJyEtuC0l8gNmyr/447sK+aKy84OX0HTIO6lnDW8Ps2RNmm6gyHjRNh3JGA9VtGAWxSLbrlAfa2v2Uvl2x6A3wpPuL4y/bBOxkDDXnxGnw3EWNF9CtAFJ3VU4uLlaqmRVUeMnLXnkgOqLeQmAkw/rW/6dO43/uVCa6XeYkUjz2qbj5M9oaspzYYE5s/H5rrT9AqtYHXYZdTr7Gw9rqpGOflCiBhJdHDbcRCQPh/4RTNQhQqry0OJNH0U5NUg1uyVROVZOzone3GkrI6jHHNBneASiouKhOSJXi32JCdMKuCst3stgm8OBWCw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9A3FkgECR+wOrtxS66iwjqK7z4EGPmIhtRTRgbu8FOI=; b=CaKN/sUswcriWoAGvpTDKiilLEOOvWZ1YxWyN560rURUL7QdaxTsq62N1ixZQmJjpAsb7yBTSHfI7ZxeaztzyWJ2wWBpdZQlBXjzoMfnJlsQDk740QPxn1HEj3nhwal322Hw/vBmEd8fbkIq9+EMEJBF341W+9MhSmkrj0B1PqM= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) by AM7PR04MB6888.eurprd04.prod.outlook.com (2603:10a6:20b:107::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.38; Wed, 12 Apr 2023 12:47:55 +0000 Received: from AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::55b1:d2dd:4327:912b]) by AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::55b1:d2dd:4327:912b%5]) with mapi id 15.20.6298.028; Wed, 12 Apr 2023 12:47:55 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: Andrew Lunn , Florian Fainelli , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Colin Foster , linux-kernel@vger.kernel.org Subject: [PATCH net-next 3/8] net: mscc: ocelot: debugging print for statistics regions Date: Wed, 12 Apr 2023 15:47:32 +0300 Message-Id: <20230412124737.2243527-4-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230412124737.2243527-1-vladimir.oltean@nxp.com> References: <20230412124737.2243527-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: VI1PR0701CA0056.eurprd07.prod.outlook.com (2603:10a6:800:5f::18) To AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM0PR04MB6452:EE_|AM7PR04MB6888:EE_ X-MS-Office365-Filtering-Correlation-Id: 19106e46-226d-4f6a-588a-08db3b5422b9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Hb7WzG5Iy4pCw+AbbV5bg/wwscGTOxjq3fDICDRbhXUXKncIn7shT6Z4I14zMHRjheK4J/XITfjEh/yhjVAP+aqAq7AUAF5kpNiwdRCx2viH3llImnKAQ8If1IDNda1yxs7xPHQdie1JbWlrrWOTs84k5BbTakxiUDZn90jTNcvOMKKLr3JiQGcyCcSKJRZONv8V9LxM7C8ZgFQxv3adcxxXCRrdTTk36Jpk/lQL8qBZJRcfmZ51b4ggpDSszxuyRz0tC1uvy+6KcatBwbO46z6hqif7wtu/GxrEPNoGVPQlboPfwMyQKHFeHcdg78g7twm2pDPrUCSB9kPTLZOxgqODqi4vHhP/9MLiiZKu9gV7pwjY1vJPsHkshGTv7OTdn1fNWyyicLC2KzQp6TH9/4Wcz4y4Ir8f9OrbMKSljPDPWAtCHB+eb0EcEeBA8lDOjIslKFgOIE5ilK9q+UrW8DRhuNeGxIXgoQ1GqTFtDZNLEa/3CDIswyE0wwDTsHZ4seoUlyytSyk+EgQDMMOl1WJnsNj0lZQPSXnMyWlbUR1gyc+g/WNoinyPWQwlfW/oVrP34ojWcdlgRCfypjuXobHlv2TTzzJqzfNizvzsVgFbcx3EXwKpxlkRoPy90+Jr X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM0PR04MB6452.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(366004)(39860400002)(136003)(376002)(346002)(396003)(451199021)(478600001)(52116002)(86362001)(6512007)(36756003)(38350700002)(2616005)(38100700002)(316002)(2906002)(1076003)(6506007)(26005)(54906003)(44832011)(186003)(5660300002)(66476007)(6486002)(6666004)(6916009)(8936002)(66556008)(41300700001)(8676002)(7416002)(66946007)(4326008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 7kuLUF6uAuCOef+rAVgdEvGBtVqwpN7geWGr9u3Y11qtGjOTdjUDT6nYxuG6c9Y4EeiO83RT4HjiHfOA/SECPZWiX8TLoRNRAHb3CcTAYDterWwxxmhyDgxEyknaglO2CwQJj3k/ti4GKRvhzOy2w4kJdbtulnVOVrR9nx9codm7MUe/viuyODrgNYwPBjfWKJ6E8kqBmPN7yT+fdCxDav6AdIUzaC/MJ1ADmWGVanXuo3ZCMXMXAylmoSLW1j1aYYa0ViTQR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nNmhEnNxguf5k11/f+WjagkXgCIyqViPpWto+zsW7TkHFsbN1yNwcKf8NvCAvgyzOv3nx4a+Vo2di7RPzZ7PZUZl096P/UkMLfBiRABzthnDYa7hC8LxmbrX6cY6FOGgEl68sHYPewVdt/e79paAqPWn9xTPx3Eo0+a53uZl7QhVcqLOflsPzZBViRH2g4tPIjJn3Xbu950HgZiQRNn+kgswNGrfJV2LQUH0dmpTNMHxrOS+7UfYjfyykrJ9bb6c076j19R1DGLU4xfxMw== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 19106e46-226d-4f6a-588a-08db3b5422b9 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB6452.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Apr 2023 12:47:55.0822 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: sh9hWutSYRWV9goJleANIHn0glIzBI4VYaUayBcuO0DMDhHk/CbNJruUVxpfbQsCpzXmRWbGN0frcXbcZmpJOg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB6888 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org To make it easier to debug future issues with statistics counters not getting aggregated properly into regions, like what happened in commit 6acc72a43eac ("net: mscc: ocelot: fix stats region batching"), add some dev_dbg() prints which show the regions that were dynamically determined. Signed-off-by: Vladimir Oltean Reviewed-by: Jacob Keller --- drivers/net/ethernet/mscc/ocelot_stats.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/net/ethernet/mscc/ocelot_stats.c b/drivers/net/ethernet/mscc/ocelot_stats.c index d0e6cd8dbe5c..b50d9d9f8023 100644 --- a/drivers/net/ethernet/mscc/ocelot_stats.c +++ b/drivers/net/ethernet/mscc/ocelot_stats.c @@ -925,6 +925,15 @@ static int ocelot_prepare_stats_regions(struct ocelot *ocelot) } list_for_each_entry(region, &ocelot->stats_regions, node) { + enum ocelot_target target; + u32 addr; + + ocelot_reg_to_target_addr(ocelot, region->base, &target, + &addr); + + dev_dbg(ocelot->dev, + "region of %d contiguous counters starting with SYS:STAT:CNT[0x%03x]\n", + region->count, addr / 4); region->buf = devm_kcalloc(ocelot->dev, region->count, sizeof(*region->buf), GFP_KERNEL); if (!region->buf) From patchwork Wed Apr 12 12:47:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13209145 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 24D22C77B72 for ; Wed, 12 Apr 2023 12:50:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230408AbjDLMuY (ORCPT ); Wed, 12 Apr 2023 08:50:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231220AbjDLMtx (ORCPT ); Wed, 12 Apr 2023 08:49:53 -0400 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2071.outbound.protection.outlook.com [40.107.22.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3FD1272BE; Wed, 12 Apr 2023 05:49:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HpVtFZp4WSxT7xI1L67qrkNkBqWt7K6CdJaEbD7XdTe4StAaCCQw1upzxhN++Ub/jHlmaR/7l4ngC4qZXGGOXY9jIQYIOus/yVHmcTug9ka27I2zPPuFT38kqLFcA2dcoolqNNx6uKAMCH8yy17m1SzPjFcpCjEImiwFE5wbdd0KQYks5wvpkzxRU6tTIrA8pCS6QuLFHF1WK7sji8b0T6UcVKRxsUz4vqV0DDZchi/6XMD4bRUUo8xwIO/uPUe2IOx7GFFaDICmNyxUF+cy6uSThJHyDgyftqDsdyI06kZHhQa9S3uLifs5Tez9Wv3+9B8teC88FY3H+3dIqm3brg== 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=UkfiAaeWtzu2DIh+22VbDXvIUPGPOEA6mt139v4rRdc=; b=R7HtedqRgEiwUnUEV5feeRxVcQEk+LQRmtD54tBudeK268Bqqp7b2GK2ULUEavWcmpExgmNSbBcLTP5F/PBuZUvVpdnsCy8eIxgp1M36XPJU0UyqSCuwy7vAUCz4gMxA9ZE9aZ/QdK/ovaYZYihwVPhybhQyt+f74PccuxivqXTM4U0qBlV5dLg9e+R8nb4lhdg7+kwJpDAOuOoY/SGCg3qM+Hl4jL2LJc0gtyoP14nlRJkHPo1CqCjOjTmEyR+hmAC0p66RTNs3PVz6b93TNHcT7drZdLaUBdXrgm+aXmm+agr2tV+CF1P7DugxBy2RlvCd9VFPUX8yuT38ogEQSg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=UkfiAaeWtzu2DIh+22VbDXvIUPGPOEA6mt139v4rRdc=; b=EfkaJ8pKESYiNuVM5RUErMf4cRTWN0gyYdJhWmMC9qj98oTemhY3yMbU9291krozMXvJ38C/VZmm5zNE1bZeiZIYbGS9ScE2jLI7tZ1kQMQUc1ghWCU4yLn9elwQRHJKwFFIuTdXIu4ZsMnHP17w6Bade3+XlP32e0y5yPuQR9A= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) by AM7PR04MB6888.eurprd04.prod.outlook.com (2603:10a6:20b:107::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.38; Wed, 12 Apr 2023 12:47:56 +0000 Received: from AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::55b1:d2dd:4327:912b]) by AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::55b1:d2dd:4327:912b%5]) with mapi id 15.20.6298.028; Wed, 12 Apr 2023 12:47:56 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: Andrew Lunn , Florian Fainelli , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Colin Foster , linux-kernel@vger.kernel.org Subject: [PATCH net-next 4/8] net: mscc: ocelot: remove blank line at the end of ocelot_stats.c Date: Wed, 12 Apr 2023 15:47:33 +0300 Message-Id: <20230412124737.2243527-5-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230412124737.2243527-1-vladimir.oltean@nxp.com> References: <20230412124737.2243527-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: VI1PR0701CA0056.eurprd07.prod.outlook.com (2603:10a6:800:5f::18) To AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM0PR04MB6452:EE_|AM7PR04MB6888:EE_ X-MS-Office365-Filtering-Correlation-Id: b19eff83-ebd3-4d37-eb85-08db3b542370 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: iGV2iW2P2h/j0me3Cr+dSDV9aFRtt32XKb5BEQJu8HXHCJAK3hgTLyuedo9cTCQZCxRhhm3gLbqtkx7H62qkEzNtrij7M8OhqeytfuJ+jJFqT2jYC7j8G15aAri4Vtrh3SO94zYsfTnNZabETuw+q+f+9YtyrEkpAHcJ+8XMrqwPNTbxbFeVRAuhPe5TrIZv/J4yBlKBJ8UBh0TGSM/IebD0o3fw+i5LYT07zbgRctSzU6JVzQHKArYVXe5q2+k951dCG813wDFRH8EhSUctElUH90v0//yiosDkXkVRs3dOkfxpX2DHgdvSkAguItuIA8yVSjuUIMydy4Gu2fR51cAzlH+fUCPRFmqSFwkDxdX13GPMXJ1QOsC+e0tvYYootlSqMJkzh6PLbpEUqwTlwCKEr1wEds7k71+eWo97Mz8TV765ESCFecbXzj5/rHFRjeFkzEBu9s80cbjPP0mLelCVuvIdUB9cdGz/d2W4Yb/mbiCOSfZAitZId4jHWkNHhOCVUzX16cT/OE4ouoj3G6lqBcHcYWHOIUSWa3tqzh11Gwq1MuL5cxjtppvB6hLQsiwVHos8fFQV7cbyjOddSWw9u8nKwwm186Cpa6jKntfpb981+049wNIthtEHnT1b X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM0PR04MB6452.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(366004)(39860400002)(136003)(376002)(346002)(396003)(451199021)(478600001)(52116002)(86362001)(83380400001)(6512007)(36756003)(38350700002)(2616005)(38100700002)(316002)(2906002)(4744005)(1076003)(6506007)(26005)(54906003)(44832011)(186003)(5660300002)(66476007)(6486002)(6666004)(6916009)(8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SlVA9o4FxE1RmIC5Vj/3vGM3T/bLUESBuc31eiKbmDuR97TsEo6+gCOPQj7bOSl93BP07H2xdnmE2pBYC8URCjlTcrE+hXGu3xCsIo61YtIpCkB04ODQUPVXQcCTy2pY26VUT5hchHdj4G0yjsrGYM4QMbP9h6srkzjntGXKSE38l4G1lXXg/31bCBIpqwCj8e2Nd6cl+3k29aS8sX9Ott9AHU+kXZTaADoffLogrX9Gkca9hInSrQkSWESbx/FbOw9yFZ/DoEek164pntZQXFU/pQo0CcQQsZTbJ4Bdxawam36vxpbQO060CcHqA41diBPMkWYEXhNUbH8ag2dKLEKUK8k0K8gBYDdfOW5ENNZYmfy8BiZfa4hvsptUicKTvQs2bnNgEoI7kV4rBGfEnZAIaYPQWhiwd5Oo4F0FDBjfpEoLZt4hW1t675H0u43v5ExzXJk20Iu+ZSrqpycTwFu+VjEdzmTwdv5xP0jbNlQmS9f8wjib1jpGdYJ90XCD+64Cx+GfSTmKFrcB6FK+lN0BxjLtg+RXpNdIcIcE6ItmtLU2FgLeMoEYM+OuV1rzCklOwa3zWdmUSpHmAcHHcCkqv7BsbjscIx1xnoddCyEh7vy8roSWkDqddmcc4VROc3L0c6F/KXe3cQii3s+tE3SIUfO6XVSjIg== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b19eff83-ebd3-4d37-eb85-08db3b542370 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB6452.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Apr 2023 12:47:56.3025 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: gPdQ2NDdMedgfteV+4u3ug+v3Oe5U4aOQ+qkH2Z1volhoLP0y9P9y0NUqdru1A94KeJMn9czSvgsEfSwqaBReA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB6888 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Commit a3bb8f521fd8 ("net: mscc: ocelot: remove unnecessary exposure of stats structures") made an unnecessary change which was to add a new line at the end of ocelot_stats.c. Remove it. Signed-off-by: Vladimir Oltean Acked-by: Colin Foster Reviewed-by: Jacob Keller --- drivers/net/ethernet/mscc/ocelot_stats.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/net/ethernet/mscc/ocelot_stats.c b/drivers/net/ethernet/mscc/ocelot_stats.c index b50d9d9f8023..99a14a942600 100644 --- a/drivers/net/ethernet/mscc/ocelot_stats.c +++ b/drivers/net/ethernet/mscc/ocelot_stats.c @@ -981,4 +981,3 @@ void ocelot_stats_deinit(struct ocelot *ocelot) cancel_delayed_work(&ocelot->stats_work); destroy_workqueue(ocelot->stats_queue); } - From patchwork Wed Apr 12 12:47:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13209142 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 3EE76C7619A for ; Wed, 12 Apr 2023 12:50:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229755AbjDLMuR (ORCPT ); Wed, 12 Apr 2023 08:50:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39728 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231485AbjDLMtz (ORCPT ); Wed, 12 Apr 2023 08:49:55 -0400 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2061a.outbound.protection.outlook.com [IPv6:2a01:111:f400:7e1b::61a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2091D868D; Wed, 12 Apr 2023 05:49:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Kmqq86Z2Yn+vrf3z7yoC+nky8TzCQ+hXrVFKIdrBm3CisDhieiQLXTsY7antS2ao5xEbgFU3UsPFxk+gXvoanDkhiNoQZO8TVf7Zabk1z3Lr5yDInCz3kThph5f3QYFaWYjE6MFLa4YSkT4qGCG9JCiwbyMNNMgotHEKPf2fBDNl1YMRWQb2CM+entvEjNrgzsurmuplfLRc5egTb9w+zgl+T9pCGPjGBw24FIAHy8/1GYz5omA7UzuGAijDksEZAer0ZmCT/yjWwKDGqRaxWjri6Fk2talWLpZX3ZREXJkhacUOUsm4hoILyl1IP346cZXtRwZ7HFcJy4m/YHmrjg== 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=6T4+lWflBLs8QRBOwrTdASAf83R3d0iOinQW9i9yQME=; b=hmGS0uHoy+jXS+NYx73m/fGc9OCbDkWyFp0hZkuzC/tNorHsxdo3dXtJ0P+NVxKpC8LR/fExryIh9bMMx1Wd7kxfNMXjAJETNmDRf85N9As62FG/qjWdI73YajQKP6ZTN6ikseMY+UpWcoRiIRjvwo3YlWNrBuhUIyfF/gydujTV00q/JSheZUfD0RnoI1TcZeWnt4Wrx1KSVfGRH2hOwe36+EetvwdwSJE/PrGSt4sLF8x1q8KQvWRbI61JBgGtjWYhcFLhlkU+L3BGE/gmduJQJtABQdtVLtql3hi/fSd0K6OjKhhPTRrS6y2BqI1wRrvRyfq31qfQ8R9ZGJzhCg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6T4+lWflBLs8QRBOwrTdASAf83R3d0iOinQW9i9yQME=; b=KsjVqRP63BDvj4gfOnhq1gqFXaUdCXDkFQyUqU9nd8fY2p15/FDYsBeFKnTA0Lbdx0VpWf2ZzFWY3sHyfX57iXkZUvMesOm3WSwF5vtmsj4RO2+aJMsrWx1JoXTdWztVtLs078Bn5Ab0GJ36AVd4p37aQeFiFGT764CdWrBbn1U= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) by AM7PR04MB6888.eurprd04.prod.outlook.com (2603:10a6:20b:107::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.38; Wed, 12 Apr 2023 12:47:57 +0000 Received: from AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::55b1:d2dd:4327:912b]) by AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::55b1:d2dd:4327:912b%5]) with mapi id 15.20.6298.028; Wed, 12 Apr 2023 12:47:57 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: Andrew Lunn , Florian Fainelli , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Colin Foster , linux-kernel@vger.kernel.org Subject: [PATCH net-next 5/8] net: dsa: felix: remove confusing/incorrect comment from felix_setup() Date: Wed, 12 Apr 2023 15:47:34 +0300 Message-Id: <20230412124737.2243527-6-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230412124737.2243527-1-vladimir.oltean@nxp.com> References: <20230412124737.2243527-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: VI1PR0701CA0056.eurprd07.prod.outlook.com (2603:10a6:800:5f::18) To AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM0PR04MB6452:EE_|AM7PR04MB6888:EE_ X-MS-Office365-Filtering-Correlation-Id: e1da837a-b138-44b1-1dfa-08db3b542407 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6GYP1/dcv5m4EK0fgplSaQp8HrPo2eVK1ddNkWomsKvmrVoq/AM5BaHrFRHSOs4FhX/+Ij/44dsvst0YSviCTHZFWqpyDkzKQS3fHceJUI2Ny8DfsUmFK87T7N3QtTQEbSEXUFoiTaMeNynjH+bASXLRgUdbV7ZbAPGsoDA6Nt+ohvJuRB5ThF01GN5cDuRjm38rnTRD20yUoaZW+vTwJx0f/Z33fpuHjn+WBdwwOIMaSnGK//naw+kvFZKx6HFzLkyx4FfYpKmhlmDKMImipuFa1CNNJTa75WAllPKN317Kl1nU/q81j787FORtMMZu9wvFb/+R5ElfzEXqap4pK3PmD5H95/1GtCL1JQdTTyfuEv7ozxv9PJ0LSCJrJxG08hVICKXdjwbUcCI/o2szuAhlpy8YsmWmyB/S+rm/4qM2bDjTXWT6rcH2p1VRqnBlWUq+8o9Hw9e70pX7PP5SrBut4iO34d9/4RUs/bw0LxvA+pdcOcy7D6pr0115QLuglidryZ692aGCQjGDc/Qu/sUGbQApFIyLAYGo2n0eSwOT/NRykafbs1HW2Ql430tkxYGS2+IGfrhUK4Ml+jVyuwOMk+Q90oEEhYqJy0nxCOYFQmwUOGuPbOLPPsRId9Bn X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM0PR04MB6452.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(366004)(39860400002)(136003)(376002)(346002)(396003)(451199021)(478600001)(52116002)(86362001)(83380400001)(6512007)(36756003)(38350700002)(2616005)(38100700002)(316002)(2906002)(1076003)(6506007)(26005)(54906003)(44832011)(186003)(5660300002)(66476007)(6486002)(6666004)(6916009)(8936002)(66556008)(41300700001)(8676002)(7416002)(66946007)(4326008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: LQAXkWz4eReDrWcNYG3CMaYlLZGFYUqxO+Og4GX7MAFkF2A+SCApXvixYX+zOk3CG+iGvwjwD79eCEuYiWYJu+UgLCnplrXpxnYSGBhnzbG+upIhDc2FEDvowibhg6Owb1qMgT0A3MUeX2kruEzXU+VeHb0O8un81VxfhnNpLM0dwfh5mwSAhL+Q5J0zbujKKkslTZJG6o35t/74EZ9WiIgzGDFYyzJhQXTp4wsQuw/1ULKs5/baNZRlGkodTqiY6OBFtNgaKY0X7FWpygUbm/zrojs482/hq7sxRsrhkKkXlOzNPsRFZbk+bJkO8dZ86vTFNDTkoW4y1xtzj/3n21Tll7BMLelXbH+WQGkzZJNlT4CXXU5KSeEHcq2iJqi9tYKPlq8bmDLMUZFsxhfVsD/xg4SpR1KUlWfGDfzSmYo+d3dz10Oivqc4O1bIMGjRibUG/7MEof4oHiO9s75sRm2N9JCvDWK8FwQBSPIdKBrpMFiSkxCpNl5W6n8XdyaY7kOVob0OKZAYcMsN2e/u2rw/JQ96gDgIWbsCef6nQFVz4Q1LtOBrwME2VnGL5bLv04d3gCifvP5EaNlozUfgzspapdFYol8ERWfaet1xLSbHCRQMV8fWXus6EyBM6MjNbdqAEVtHVMGO8d++JaLGB+v9TijPDS4ocqc6E1kif4yrjv3hmUTsB3Ro38S6iNVK2I+EJrkhaQ0XcUHES4dzoI2wmdOFfoY9XFlogpa29bxMKM56YU0HdFjGJZeU53+apRonxD/f4a7LWA7vpG1zdhBBY+gnwnLdNOtsDN3cAL0eGAHnMuLovbrdW11nmPmdyJMbMbGbifKuArbK84n8nUQBmF7sXSuu59fi+y+SuAg9aBEOcbUyliq5YgTSQhwXtyJCuXrirbtXUM1kRbLiZ6QhTTOu+1dHzuSU38ea8JX3nwPMjo91zKyqtmSww2vho+UAGyJILn6sy8qnPvtx56bvubCfHw0fRwfwsaiNwVcDm7Trd1oZhiuYd1qWN7RMljxa85q1PKTBWxe3kWPqhWYxtUXZtprPegOmrlsDC3WymQKheWrEWhtfak+ivKhsuv4x5BIQEI7aqG/rcHqrHqm7+3L6UV/q94oVf4PSYTCe9HtcHjz0fDwFQJK/YCVO1FZGp5OkTa6HC7avjzbeiSLpX8Ax6rlGB0wBs085b+9U/JVKzDgS5KYXPrDmlqvt/h23P1lx1tc3nN0sAEiKg7vMg85YQjsGCTnd5x1C6RWGE43CRLyliMrP7tn9S3hG/K7EnTEu6vspQ/e1R2c13wwkwrEpL28vdqzx82uEvBn7nXk5hM0p4wVrnsyx7nLLW6R5Lcv/AIDD+3BkLQv1X2tcjqjcjVD6o6+KJEYwwsAQlsamKL3noVW4EJJ+WHmadBaGrzeLmztd0bxoWevFepLIB1K3qmBwDbk7U4XQf329rs/HDOnN+V+XzRnfMSZRUoeaNndG7HRWS+l0WrzzeVKgfaVvZOE65pbCK0Zg6LuaTI7T0TMcxfmUsqioST89rs2kXrFCuxDmjcYA7eMKSHyqC6g90c9AS2nU/NmAa1DXJd0FW7CLmVFm3ujNY3549kYwVWMPrZdbtLpdZuI9Tg== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e1da837a-b138-44b1-1dfa-08db3b542407 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB6452.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Apr 2023 12:47:57.2774 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: jWECevEO4sCscfSMPAI9V+mcXhXs0jttNgHJVA/rVG53svh1lMSAI5eYxWo+Z+Olm1U0tS57NeY7ypojpxFkNw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB6888 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org That comment was written prior to knowing that what I was actually seeing was a manifestation of the bug fixed in commit b4024c9e5c57 ("felix: Fix initialization of ioremap resources"). There isn't any particular reason now why the hardware initialization is done in felix_setup(), so just delete that comment to avoid spreading misinformation. Signed-off-by: Vladimir Oltean Reviewed-by: Jacob Keller --- drivers/net/dsa/ocelot/felix.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c index 6dcebcfd71e7..80861ac090ae 100644 --- a/drivers/net/dsa/ocelot/felix.c +++ b/drivers/net/dsa/ocelot/felix.c @@ -1550,11 +1550,6 @@ static int felix_connect_tag_protocol(struct dsa_switch *ds, } } -/* Hardware initialization done here so that we can allocate structures with - * devm without fear of dsa_register_switch returning -EPROBE_DEFER and causing - * us to allocate structures twice (leak memory) and map PCI memory twice - * (which will not work). - */ static int felix_setup(struct dsa_switch *ds) { struct ocelot *ocelot = ds->priv; From patchwork Wed Apr 12 12:47:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13209146 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 87D65C77B73 for ; Wed, 12 Apr 2023 12:50:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230096AbjDLMu0 (ORCPT ); Wed, 12 Apr 2023 08:50:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229578AbjDLMuQ (ORCPT ); Wed, 12 Apr 2023 08:50:16 -0400 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2066.outbound.protection.outlook.com [40.107.22.66]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B47017DAF; Wed, 12 Apr 2023 05:49:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CwUjx2YpoqH8cbcPD8uK83WF/Vfax87KZgVS0NgoWY9Xow34GREJvt4C9RcvsQ45eGbrXMYiuMcstNMu/+i+O4MKrzBNL1zU4KW7EnODEy7mlxUdQbEfZ7nNzhQGny6u/n20roJff/WbUkuj3+sERouTpTEUGQoLGTYxZNZFVpMkq028BGVr9TkVFmeKz0dNTzkypH9FcBSagweuELXpZ1p5I3tzKjWLQjFZYeSsXGW1TT8e1PTaIv7QyDrbwJH5bh+vF0T/2eQGmJitilB2qRWIgiKf4adW6G8bKU5qZn5FssF8LI3wloRj1dXHPzUl4dUpI/MulSqaKE9XrAvV/Q== 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=Edo4YSD6AKS3MQf0k+r4USSRl1cHKHtSqXCo8dExYJ4=; b=oZKwASxVjWHXfHrB1NCEulHPdUPRS0KYOHx9zOHO7w2z4m2KLCBuvL8STWahsfgFofXv0vg4RMK1AB/RVv/WznRjAbbzxwCr60kpKD2Hdfh8+GDz8QED0OvuHjPMPg34J/Mduf904qzicW2+BVxt23fvCkz7MWP9AZqZNycHsNnOMBkr5TIw+Gj5QQh5w6C2HGP7gBriV34ch9mUtg7pZssKZgbJn5gukusMyxV+5DgXh6hYD7AJ8Msy2Eg5Fp66acyEzo3of4v4fuhOvVqCqr/A8FDQ4yJcoSyvvvDJEKvLdQW89zZrtne3Rj0baWxzGbzTjFvPYyZ+OtMfO8WZlA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Edo4YSD6AKS3MQf0k+r4USSRl1cHKHtSqXCo8dExYJ4=; b=f2lfyvmSwPJBfGzqDdV/0lDpULST+TtD2KXZqQPXyERoHIXWvN5pamJJNBNhoaHseEiGwy2x0EMkEAxPEAP2LFFuHJJdBTAVyxM7g14zD9RrPtcxb/hMa6Duz8Qc+uyK6Id/K14wuGGYfTtcbnd9mFwmXkTPJAp5r9cRBtJCR3s= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) by AM7PR04MB6888.eurprd04.prod.outlook.com (2603:10a6:20b:107::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.38; Wed, 12 Apr 2023 12:47:58 +0000 Received: from AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::55b1:d2dd:4327:912b]) by AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::55b1:d2dd:4327:912b%5]) with mapi id 15.20.6298.028; Wed, 12 Apr 2023 12:47:58 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: Andrew Lunn , Florian Fainelli , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Colin Foster , linux-kernel@vger.kernel.org Subject: [PATCH net-next 6/8] net: mscc: ocelot: strengthen type of "u32 reg" and "u32 base" in ocelot_stats.c Date: Wed, 12 Apr 2023 15:47:35 +0300 Message-Id: <20230412124737.2243527-7-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230412124737.2243527-1-vladimir.oltean@nxp.com> References: <20230412124737.2243527-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: VI1PR0701CA0056.eurprd07.prod.outlook.com (2603:10a6:800:5f::18) To AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM0PR04MB6452:EE_|AM7PR04MB6888:EE_ X-MS-Office365-Filtering-Correlation-Id: 0b0e9fa4-cd98-4880-5061-08db3b54249d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HGcd8HlKG3sK3iBapxtUFrzYkVDaBK8fZhrr+eLVfl+dOEjDx4cj3mA5SMuGEWMSgmMD2ypoaFYqEvSK6l8UP4P4l43jjuKqEsKNzIP/c7yv0LObKv/Sf/09u9SAcd7We2xmL9V/x4x2pPEmY31zH2yAKfREn8xivGD+pSJ8CdoA6DRbtSntw1YSCkGSrQ+W+9GcSJUhRVrlEb/5HqY5IRoAMXWCBEwaEpufDpe0RGeIBR+DipaPdVyXDuRe1jm8jutXkJfL+QwOszLCgHNbbJtas1IVYllpECd9vgb71Bxl31AJ8ZxFbecKwKSZsk+GqcKfFSSIIovR/7+ee7iyWamgBak2Jkzs0k6ReFpDPdvmIJMW04uaqODTKqKtXZHERVkI1MV6sW1t/4kWnvgonmD+Uqo3cxwS6UnAttIOtcHBL4I2oSm6DBcub+BnRngbwl0V0O9atgQnx9A66mTe7yTymVZoHxw3N1f9i5qQwRJM3eZmsjq/706fnMqUtClDLOohnG4SMG+nxENBisppHkXshX92uj+NG6zGPCItWbe0x2Ajwy58Ah5MfqeN2z/YJKnJ2YxlVVIHNil8tIEFaUwHKdPZmKKSeT+2yrTnybXtLNtTWxPWF+QJlge2SdEG X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM0PR04MB6452.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(366004)(39860400002)(136003)(376002)(346002)(396003)(451199021)(478600001)(52116002)(86362001)(83380400001)(6512007)(36756003)(38350700002)(2616005)(38100700002)(316002)(2906002)(1076003)(6506007)(26005)(54906003)(44832011)(186003)(5660300002)(66476007)(6486002)(6666004)(6916009)(8936002)(66556008)(41300700001)(8676002)(7416002)(66946007)(4326008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 8dhO3YkryxswivNc4FA0Y4SYjkuME6L0u8nqFiV4jFgsAxZ+39Hyj5CnrHphgImHouXsZrKkMAWQx9Wvn0eWxlYVrQ3gpC/0eRtdIUQC5ucy0Ko71AynVffQG88L88vAaJpCVQnqdSbbxAQMGEtiXB+dJ//DHKaej7OFkiZ7oK+LffFHv399zScNhMLLlO3Aul8+SZJvCmmJJbjMcqM/g49SXejrBeYe1/sxtc/zj6Ap+ZPZSSpm/G3EQPgIUAu4QttqnzBM0rnIsVAEWY6slvt6qDls+jxnX0u0utUh8mPqUceYIQzG2yePGjmrdECibiBchQ7lYV6L0qQR+b2vdO95o0nor/sDkMLQ8LW5dwNR/EsOSQtkMg8Cxje7NrRuh62Ne3ii6+fN3nAHldnlez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YuNt7ulsZBXmPAyoN6iZkfzo8pNR8sf4R2lSDOpC03OYejnCD8afxYXMyuuOXBaQ8sPd5NL1CNWiVCjqU2wRkcFclb/07V66ecdHWmROXlqGo4CiMF9aQY1F95l6ESjF64WA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0b0e9fa4-cd98-4880-5061-08db3b54249d X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB6452.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Apr 2023 12:47:58.2457 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: HsT6Mb40c5sQltI1xQ/VkBzIgtH40Ys4XmXmCDhRrbzBs5i6tRTEoZqKMXNGEzOe5OPb/klT0G6dSm2z7YQt/g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB6888 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Use the specific enum ocelot_reg to make it clear that the region registers are encoded and not plain addresses. Signed-off-by: Vladimir Oltean Reviewed-by: Jacob Keller --- drivers/net/ethernet/mscc/ocelot_stats.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/mscc/ocelot_stats.c b/drivers/net/ethernet/mscc/ocelot_stats.c index 99a14a942600..a381e326cb2b 100644 --- a/drivers/net/ethernet/mscc/ocelot_stats.c +++ b/drivers/net/ethernet/mscc/ocelot_stats.c @@ -145,7 +145,7 @@ enum ocelot_stat { }; struct ocelot_stat_layout { - u32 reg; + enum ocelot_reg reg; char name[ETH_GSTRING_LEN]; }; @@ -257,7 +257,7 @@ struct ocelot_stat_layout { struct ocelot_stats_region { struct list_head node; - u32 base; + enum ocelot_reg base; enum ocelot_stat first_stat; int count; u32 *buf; @@ -889,7 +889,7 @@ static int ocelot_prepare_stats_regions(struct ocelot *ocelot) { struct ocelot_stats_region *region = NULL; const struct ocelot_stat_layout *layout; - unsigned int last = 0; + enum ocelot_reg last = 0; int i; INIT_LIST_HEAD(&ocelot->stats_regions); From patchwork Wed Apr 12 12:47:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13209148 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 24D83C7619A for ; Wed, 12 Apr 2023 12:50:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229990AbjDLMub (ORCPT ); Wed, 12 Apr 2023 08:50:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229946AbjDLMuR (ORCPT ); Wed, 12 Apr 2023 08:50:17 -0400 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2071.outbound.protection.outlook.com [40.107.22.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 535A29F; Wed, 12 Apr 2023 05:49:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jwQVAFCjtwrbnaApOPFK6LFOhqErZw/7pq8kVxub8G7NeDXd+EbbILgT2RnHwxc7Lbjd4td8IBaLtFf9F8FbFbj+xDfllq7ZGHcTxa6Xjyx7XwJiIBAq6Yycypu/b4kLF/Z6vN7ZSxDvztXBbkWhlGn9XehQ/IjmFi+GZhEOs0joKlHb3PO9ctLqKg0UpHjnYu/miu2flrrx5LbA9b0EEPllxPu2XhlzzlM2HL1ftTEIvXA6W7Pu4ojw7f63ooeFwE4XfbdEvV8G4j2I2E8I2NgXgGcqhMx+XpYHHxYjAf0q7jemUBWQh70Vu+pBZ6xa9JapHluAqeM2uMBmdKqANA== 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=x0dzRqtPSO85rjzAqEo8rc0SJ1W5x9A0rEVVF5pPY4M=; b=Q6xBlLrddJwcw+XrdVXmSCPrXNvzoecTIxegDOlflIPiMj2etAQhBewoLl6kdxzSC+2lV5QNP6KT5hCPG9PgNTVYRZXlvhdgdV1hzxo6tq8fPi8vH81FbojYLZLuRNNIZtEzVvCloXhemQXGDnJ4M0QyidfTkeQ2i06BRTN+IkzX/xQMS8jC9/gAmoOMj1eajXEgUa1b6fqXwym97lWz3guzBPqGSk1KmglIdv1U20rwP19XqUHSREVdkqngTlQNiACNtBOYsyHyxcWr6qbnIwo0nHT53bqrR1N8hlxQEOaCt0RE/zE9zcsZEfGG0OJWIN7SMlf/+MvCUh6Pd5bhhg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=x0dzRqtPSO85rjzAqEo8rc0SJ1W5x9A0rEVVF5pPY4M=; b=P/wrJAh+dFMmvFN90M1G93o6RIPXvdelEWjYmItZy7oiP08Ngiwu0+7zIS80iv8MvUAqzviYk2Td6t9EVNl0HIz9D48FhM+T1I/l5pjn4hpVhaMILAEFxZIEDmvKkWlUgPbp43RlUXq60m6JhHdFlFjzK5nibugzyTZhcx3k0xM= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) by AM7PR04MB6888.eurprd04.prod.outlook.com (2603:10a6:20b:107::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.38; Wed, 12 Apr 2023 12:47:59 +0000 Received: from AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::55b1:d2dd:4327:912b]) by AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::55b1:d2dd:4327:912b%5]) with mapi id 15.20.6298.028; Wed, 12 Apr 2023 12:47:59 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: Andrew Lunn , Florian Fainelli , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Colin Foster , linux-kernel@vger.kernel.org Subject: [PATCH net-next 7/8] net: mscc: ocelot: strengthen type of "int i" in ocelot_stats.c Date: Wed, 12 Apr 2023 15:47:36 +0300 Message-Id: <20230412124737.2243527-8-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230412124737.2243527-1-vladimir.oltean@nxp.com> References: <20230412124737.2243527-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: VI1PR0701CA0056.eurprd07.prod.outlook.com (2603:10a6:800:5f::18) To AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM0PR04MB6452:EE_|AM7PR04MB6888:EE_ X-MS-Office365-Filtering-Correlation-Id: 4f8d8014-7a77-4d6c-be60-08db3b54252e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xQlkxqbmf112VmdEIT63tOyXzcG3sJ99GN/6ABkm31zkjXij2B7LKRvEWxXzla6EkXIs6t4n3M4DIRN+82RjbDCok4D9/bcjP5FdrVMqeKdYUm+7RdhDYXLI5I0TZ8lnLRtZYj1Nevt0vK98kWeTIOb09EiY/Rw2D7/Q/biZ+tzQ0AaTbly+T+dm//qOj1GiDqFCLIvPx7XGC/e+YRViMqOHzBvTEX0JVEheS6YA7Z1DYMHV4eJncJs+nKFxXUFWm+qB/adVgu3Iy7ZG+eO2+bLmsJlu/B8mB9GFWyE3l9d2KCgdHzGhZ9RQMh9eTJhErDDGi6RlP++FXSeeeTaH3z0jsRqMHE+3xAUAqxGKz3bnljjvVI5IuvxrT/OZoGNrsJp4RNCNWF2C75qKqDlZu2fC9vADm7X7ToLvBlCAfTf5tx0u7LtcSPgUXrEwYCPMzqfLPozowI/nif6nJWwVaq/elTV/KX3Kw8soNmygnatF40ns7ZF2zhJdtJjoNp/r/Ylk9e1dLjNPSlH5/VzmmtJkr67yXTrQsCLz0SX4YQnyqcelaXh81zmzfNM6MFB3C6aDo89/AclRYOe8yJLA/qacYmtihB/xBZXlzRSUovLOWdFLUSMlU2tCjavWjW9E X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM0PR04MB6452.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(366004)(39860400002)(136003)(376002)(346002)(396003)(451199021)(478600001)(52116002)(86362001)(83380400001)(6512007)(36756003)(38350700002)(2616005)(38100700002)(316002)(2906002)(1076003)(6506007)(26005)(54906003)(44832011)(186003)(5660300002)(66476007)(6486002)(6666004)(6916009)(8936002)(66556008)(41300700001)(8676002)(7416002)(66946007)(4326008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSp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XRK40Kq43HGbUwIfH0tVd1+ToIuYh4imkR95C4ZThBHwzT50VWtMAwszVjPuJwK6b+Sov56ynTmCi+DhmdU9V6JZs8J2LFC49gyuIastwJB2urZnL+BhNdxImcgB78Z1QDpCbpBuk8NBnAUB51CscorDsFJFf6UrHEaRbQcNt+oCx0wfNwnFGvAlaHmTkuzdp/BedgqHuDACCm5qVAJLNMQa1HI+Y24xLYj13RxcBG91wdW+jFQYJH9pAGHYWuWWqvvP8bfF7h7Mpa+LhXSzrSC/ioDyREmU+tuBqc8Q6zYoamLsuhdDQUF3QMLm/xUHnwK0xIRROuWG1KS0CdWlhM8D3vk/4AQ8apAfrHpcoU9D56pmwP3Bzs45PEaRiKnqRKASflf6D43y7/aT2id54OgPfnYfUKn2QVHRvWgMAv/yGEuCna0zuzIJVgscFXUYrQDjTZNZY0skbuxDbG20AJydzEQSgWveiJee8/keDUbNk85z+KgTArOipn9HOKKpICee3/751loNjyAMEPDVOy2mmW5NeCvYBR0o00uHA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4f8d8014-7a77-4d6c-be60-08db3b54252e X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB6452.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Apr 2023 12:47:59.2064 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: iaRinoSMQnHBn+96J6O8PhbLgYHZSx/2MzdLdVqEr8Jr8pI2nxc3i6LhjQrmOLruG/5TVSoiiW/Fof0Tc0AS8g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB6888 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The "int i" used to index the struct ocelot_stat_layout array actually has a specific type: enum ocelot_stat. Use it, so that the WARN() comment from ocelot_prepare_stats_regions() makes more sense. Signed-off-by: Vladimir Oltean Reviewed-by: Jacob Keller --- drivers/net/ethernet/mscc/ocelot_stats.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/mscc/ocelot_stats.c b/drivers/net/ethernet/mscc/ocelot_stats.c index a381e326cb2b..e82c9d9d0ad3 100644 --- a/drivers/net/ethernet/mscc/ocelot_stats.c +++ b/drivers/net/ethernet/mscc/ocelot_stats.c @@ -395,7 +395,7 @@ static void ocelot_check_stats_work(struct work_struct *work) void ocelot_get_strings(struct ocelot *ocelot, int port, u32 sset, u8 *data) { const struct ocelot_stat_layout *layout; - int i; + enum ocelot_stat i; if (sset != ETH_SS_STATS) return; @@ -442,7 +442,8 @@ static void ocelot_port_stats_run(struct ocelot *ocelot, int port, void *priv, int ocelot_get_sset_count(struct ocelot *ocelot, int port, int sset) { const struct ocelot_stat_layout *layout; - int i, num_stats = 0; + enum ocelot_stat i; + int num_stats = 0; if (sset != ETH_SS_STATS) return -EOPNOTSUPP; @@ -461,8 +462,8 @@ static void ocelot_port_ethtool_stats_cb(struct ocelot *ocelot, int port, void *priv) { const struct ocelot_stat_layout *layout; + enum ocelot_stat i; u64 *data = priv; - int i; layout = ocelot_get_stats_layout(ocelot); @@ -890,7 +891,7 @@ static int ocelot_prepare_stats_regions(struct ocelot *ocelot) struct ocelot_stats_region *region = NULL; const struct ocelot_stat_layout *layout; enum ocelot_reg last = 0; - int i; + enum ocelot_stat i; INIT_LIST_HEAD(&ocelot->stats_regions); From patchwork Wed Apr 12 12:47:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13209147 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 523E5C77B6E for ; Wed, 12 Apr 2023 12:50:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230503AbjDLMu1 (ORCPT ); Wed, 12 Apr 2023 08:50:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230241AbjDLMuT (ORCPT ); Wed, 12 Apr 2023 08:50:19 -0400 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2061a.outbound.protection.outlook.com [IPv6:2a01:111:f400:7e1b::61a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF91A2136; Wed, 12 Apr 2023 05:49:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jGMSPVXm6YkJzMykY44BFuMGA/HG4yKPe4ggbaiVTK8lP+D0imAN2ZReL596i/s58wcYvBDFHLcED4zwm+5Nk0uCouLXBc2AX/P8mrdFUSTItysOrqP/k1CBZ3aYSipp3ExwIbYHT5ZyrUfvWJ6/tMHc9GHmBOyhr8k//FljQHJ0tIvEkUjozH1F2GCrgrE5Jt8l15tPXfMRfXfP7QouUSyJutMuO7OaavzZ5XlOzreuKqfJAuAfo9LGpUib29vIlTeRYnd7P10pw0nX1x1Wh0kMhJQxMOHslFNh5j/p8UnxuTTWN9V81hmIAjeDicT4yXCNeDsMS6NsgtxU6jRQoA== 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=NnmNMpuh9UU9gdg3p3oYozM1mlgGEylNuPOANWgIrlk=; b=jiRtfoVg+lHFFfni/AQeqwWB/1YcvauqT15/NJphTk60XUsmj6FLsmSQO3TR/HOqbXUFGUitwlanT0D33lvrXMCB989QoP4v2skMp4z0QGjvwqWjRA9kdyrl3Pe6Y/f2X8ZaDJ7jrbLu6xwYUd9gJ5AxrUSTmFqmt22q2h8Vp5nYuC5FERzAMo5u/QumA+57CwjL8NCTZq6zRWjf3Y/z+DcAVCGvSbjb7vB9lTkY6bikOcfNigQ3kTUA/9XCb2IAMgcpR8Seo2mu6Vdsf4E1J69fZCJq0SKRrmC8iv413Y1aQ40po1tCunmlUlciWzsz9sg76wlsjnKXKq5iT5DJlg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NnmNMpuh9UU9gdg3p3oYozM1mlgGEylNuPOANWgIrlk=; b=XbsQ2sCnJ7EnYUG6R2nAlUeqUxTiQJH51mFDuiW6lHe041QLDqGtkRpKehtExZWxIn8hpAdnjiQZ7i/unpDCSWllo2q7uQkA9kNtWMjzFEQRIOQ8QF5P4lrOn/q1KDh+e0fhL8eN4OA6m4/MjUO2zsQcqabLheCgo5kqCGwo4zY= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) by AM7PR04MB6888.eurprd04.prod.outlook.com (2603:10a6:20b:107::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.38; Wed, 12 Apr 2023 12:48:00 +0000 Received: from AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::55b1:d2dd:4327:912b]) by AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::55b1:d2dd:4327:912b%5]) with mapi id 15.20.6298.028; Wed, 12 Apr 2023 12:48:00 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: Andrew Lunn , Florian Fainelli , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Colin Foster , linux-kernel@vger.kernel.org Subject: [PATCH net-next 8/8] net: mscc: ocelot: fix ineffective WARN_ON() in ocelot_stats.c Date: Wed, 12 Apr 2023 15:47:37 +0300 Message-Id: <20230412124737.2243527-9-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230412124737.2243527-1-vladimir.oltean@nxp.com> References: <20230412124737.2243527-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: VI1PR0701CA0056.eurprd07.prod.outlook.com (2603:10a6:800:5f::18) To AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM0PR04MB6452:EE_|AM7PR04MB6888:EE_ X-MS-Office365-Filtering-Correlation-Id: dcee1635-8bd0-42da-f09a-08db3b5425c4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sI8B/2z+QKPv91tuZa+AsdCwSSoRiIic8SUxjWatlgqLW06eHoRUnmd+/EdVfVOOhVHhLh32+qZzQG5vF5mlAOR94U8Zvg4rILmkcjofDvAFM8OX/aW1hthPyZ5fD88SDZdYyYUrrPfKTqDzdMZxXruko1NZC1SAERpdom2lyaVjIRt0HPtUM3c/8eYPo+MeEMPrYeXrTW0y+DrBUCvCCZw/BvV6eGmA/b2+pKUMgXHIblqpIK5Wwe886x0YoArOorJfVvPVgNpWTPSfq94OsV+UjUMHqjBtqyf5GZHb7bVmJyIqce9W8QmPzYngRTlUTIcEwtSR+ZslJWRbPEzgiRWj8vSfbN4r/xI6ZkjidAPX3JZ+86SGBf96jX293nj/rtBkfne0yvmWk5LfXtnbb+Cgy3/wBvWQREFlApo4BqhJn9oausPimc3Dz4THd3bOe2c2zgLRMbOxYteseQNIolaUtPziaQVwmtNl1bMLoozSXF4GftBVn0bWhyGsPwFzvloFGR/rhv91lIkIDwAF2fQUouRJqQCYilKGTm59qLLNYQw3tOP3BR0RHPOEnwj/qM3ZywtY7C8K2Qc2sZq80HIWdzcXbSLlr8QkCkjDLcnrpdXLKrsmrbkp9aUu4lCy X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM0PR04MB6452.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(366004)(39860400002)(136003)(376002)(346002)(396003)(451199021)(478600001)(52116002)(86362001)(83380400001)(6512007)(36756003)(38350700002)(2616005)(38100700002)(316002)(2906002)(1076003)(6506007)(26005)(54906003)(44832011)(186003)(5660300002)(66476007)(6486002)(6666004)(6916009)(8936002)(66556008)(41300700001)(8676002)(7416002)(66946007)(4326008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: MvYcJ0w9mNfEqgWnkMszceoffGuplbqLs9tJOENUMKQ59ijPOchw6KHhhJfF2a7jaPZsuj4+W0pTtHeCeX/3V4e1cHfmPzk2fo2Ph1QSiX1Tm7BTVPM7U1KJZmOg2cLXUOyWfbSC8qKAcbEwgbI8cCzyHbJ837cA+qpVF3CEvY8AAK/OOfCakYJ8/SPuu+jOh8/jfF/BD7qcXIAHrRTRiNI25UMN3K3ArfnyiB1753zrp53ptgtGnwj7TMF6GAwAJKQi8z9VoBkh5G8mmsPMxRuKDWEXqsHUeFde/UBSvizp4yJq3McXFxvkWwcA9CvT3BUztxg4n3SNAlGilGnEDUpxOW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sNGpQPlXZwrZsdjq8v4Iq0mjpLvG+nIqF7abhvsJ97sViS05CHy3tCuqOduN24sZg+6DTrkiYiZ5kHcnIP+QTvuVqNn/2pl0sjFxr043Mg8rWZC2zVjNFDSrhnKajeqK/TOKVHeYbhwDDkHIJ8r0LccQgbCsLXD4a2HOMp6ZH9tgXJ+HpygPO/JzYnpiM9i6w== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: dcee1635-8bd0-42da-f09a-08db3b5425c4 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB6452.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Apr 2023 12:48:00.2235 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 8cfa9IPEp/YWY4gQmGA5dKPUw937HsLYWAZwwXIR/gTH4+dTROIycKmRKDKhK4zXlTfwzZoAhuli4DnpHIb5BA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB6888 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Since it is hopefully now clear that, since "last" and "layout[i].reg" are enum types and not addresses, the existing WARN_ON() is ineffective in checking that the _addresses_ are sorted in the proper order. Signed-off-by: Vladimir Oltean Reviewed-by: Jacob Keller --- drivers/net/ethernet/mscc/ocelot_stats.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/mscc/ocelot_stats.c b/drivers/net/ethernet/mscc/ocelot_stats.c index e82c9d9d0ad3..5c55197c7327 100644 --- a/drivers/net/ethernet/mscc/ocelot_stats.c +++ b/drivers/net/ethernet/mscc/ocelot_stats.c @@ -901,6 +901,17 @@ static int ocelot_prepare_stats_regions(struct ocelot *ocelot) if (!layout[i].reg) continue; + /* enum ocelot_stat must be kept sorted in the same order + * as the addresses behind layout[i].reg in order to have + * efficient bulking + */ + if (last) { + WARN(ocelot->map[SYS][last & REG_MASK] >= ocelot->map[SYS][layout[i].reg & REG_MASK], + "reg 0x%x had address 0x%x but reg 0x%x has address 0x%x, bulking broken!", + last, ocelot->map[SYS][last & REG_MASK], + layout[i].reg, ocelot->map[SYS][layout[i].reg & REG_MASK]); + } + if (region && ocelot->map[SYS][layout[i].reg & REG_MASK] == ocelot->map[SYS][last & REG_MASK] + 4) { region->count++; @@ -910,12 +921,6 @@ static int ocelot_prepare_stats_regions(struct ocelot *ocelot) if (!region) return -ENOMEM; - /* enum ocelot_stat must be kept sorted in the same - * order as layout[i].reg in order to have efficient - * bulking - */ - WARN_ON(last >= layout[i].reg); - region->base = layout[i].reg; region->first_stat = i; region->count = 1;