From patchwork Tue Aug 16 13:53:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 12944974 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 8799CC25B0E for ; Tue, 16 Aug 2022 13:54:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233434AbiHPNyS (ORCPT ); Tue, 16 Aug 2022 09:54:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60756 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233512AbiHPNyR (ORCPT ); Tue, 16 Aug 2022 09:54:17 -0400 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2083.outbound.protection.outlook.com [40.107.21.83]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B19282CDD1 for ; Tue, 16 Aug 2022 06:54:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ji/8wjX2fZeI32bmS29NapYRbmesGoGBMQA8FgX+cqrqvrifAzwhtZ8I7MO6jV6wjI89LSY2OpSRjD44UB088ZfMYaRNJTBSi4US13l17TT+uKAYL6pdHJ176hPyx+bgvej/zEvs3br4sWog+KdGwupdU1CrPNyi5eZa6DwcDjGo8zGHDXhUOqiQ8rbdcbcPyXh7xi9zELegke7RHHkbjIyVQigZLaMduM03PsSvGH0cPMtlk1kgVbQUT26yC4lmIBG/Ehcxit5HL0+5fviDD51NWLU1mxjzTaVm/SKxopzRZPyrH/5qhXfZ//7jm8vrOAjoBJnB71FsKid23kFKWA== 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=1FYHUBLPsjZ0QKzoOjOZnARwHNzo+HDJd0eRxlHvk8Q=; b=VJj89nQOLAANlL5jFKqxGbWkzpPq73bobd9uyddJfUV6+0uri5q/7lOiGjFbr/pf6hSAPJz8lcA7CUZ358wXwsnSjRR6nmuqN+KukDA1peZK4a0Tma/Hjz5KhC2HmJilc89U6bM9WMzYjpfVPZVrxg0528SXb4uSp0+cmCpnIM6L8Am/+GFBic2oH/gdtTkHbl/M3IzsKpFGVoKEwBuTRicJvNAiX1RFSdOIbaU/kAka6IlRjAsUQs1Lm6v75HX6SrCvVxDVgttHW9C4Ny3AOUnJdyVATZz1YzizkWQ+K35+HfZiFyIdImOySMeh/XwYwBnPfTJ+hH8i8yQZon3Cdw== 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=1FYHUBLPsjZ0QKzoOjOZnARwHNzo+HDJd0eRxlHvk8Q=; b=JeguogozzPoMd1avaen53WP3PF9fKQfPuuF/zVcdkqgIeGe/+3IhG0jQT718hpbKevXsR6E7bRWGzvCt3XmbKAiVmjDPjnGCBF9OqS68GF/oB4wUP7RhCbtHOHfo3nqWuV0ueLbRi0DWhEbC8OCNTmj3v0X2K8sviZxlcS45uC4= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) by VI1PR04MB2989.eurprd04.prod.outlook.com (2603:10a6:802:8::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5525.11; Tue, 16 Aug 2022 13:54:13 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::71b7:8ed1:e4e0:3857]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::71b7:8ed1:e4e0:3857%4]) with mapi id 15.20.5525.011; Tue, 16 Aug 2022 13:54:13 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: Andrew Lunn , Vivien Didelot , Florian Fainelli , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Colin Foster , Maxim Kochetkov Subject: [PATCH net 0/8] Fixes for Ocelot driver statistics Date: Tue, 16 Aug 2022 16:53:44 +0300 Message-Id: <20220816135352.1431497-1-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: VI1PR08CA0244.eurprd08.prod.outlook.com (2603:10a6:803:dc::17) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 14d7733b-3b40-4307-9d45-08da7f8eccee X-MS-TrafficTypeDiagnostic: VI1PR04MB2989:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QcDFJQTKy4vmtXtL0qI+UQKBLq/aDFl6POH09dBaXDlaoywwQmWZHSgCOjHqJ2HaE5H04zTeK8QhOGSpDEdXBRLCxPpPMCdAdzEtRXCXXhxZD0Fj8tElXj/1h/3YVaKx3bUl1GQUitUZfHQbfooU+95J90L3Dtt3xmhQpmLWj/EZdmy8wZnTZZ0Hke0ikrvk10tpJn09ncqZ313fLIGpHgyarGCB59BDEf2P46T2ks/ix7aqERBB5uiCJrFp1DxNocTY1O0CfKI0SakOX3eJHqRBZpjOdIQzPbL/T2QaQ/o2lBvb1NQq4+oN7FgMyyzeGCerWmNm/g9dFIQPSMZ4JyV6iQvSywpl4pLOdjec0qnsbGvQXvNVBdERE9FpiG4c02yYIrvjbWKXa0sph5rBNo+xZPAVOIgbQW8CRfhSa7BkNo6j65OBCsGIWBbqy44cJkpEOwHBZnYfWyIlS/vk00A47TVulmnvdkgsVvtQNUoeIpdoDdamOjoEf1ecDFyiBnOszeK287skEmAxVyD9z5cnKEbbDZg3Bsxs7wDH7LOfKcjrOoJEPXI31ogXdjzXlJaGVoRYt1X305+fwaJ95B2+YqFO0No874wjy+mTJ0UemG2fbxlJbbr6soGB4++y6lY4qiGwC+EKyDmiiEeQNq6PEdw3j/jqOmaPRYbJvissSft9ItL0ETzItuvLEZ9tYDsbvoiQZtDCZPV71sAd3u/mlJL1KtqrLcztBCsdXSHhjIs8hfnRTCpAzFm4Aljd5lAf4wd7lCt9qHchwfHPOMzFvrcbpqf+RWNDYcjEY/x9uwGZ1ExklapL2MivP8/Vva9Hr54VqE2jBzvp7Jl3Jio0iUshxMKWUxNzeY0r5dw= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5136.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(4636009)(396003)(376002)(366004)(346002)(39860400002)(136003)(38350700002)(44832011)(38100700002)(2906002)(5660300002)(1076003)(2616005)(7416002)(4326008)(36756003)(8676002)(83380400001)(8936002)(66946007)(66476007)(66556008)(186003)(52116002)(6666004)(41300700001)(86362001)(6512007)(6506007)(478600001)(6916009)(316002)(26005)(6486002)(54906003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: mRvaOJsULu38aVJNIBHzKIZDr5LWjPe0T0QNuw8VP5oigqDsQMru0XqKa65sJ+Tj1XriXK9AZ4pZrB+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qCgGFulrFu6LNmi2UwZ4rQizlf/Z4Xke7zjQwrTpyG/b2QBCTH4NKxK9pa8sU+iJWayjWDDt7ZwyfbYjHUvKDL/IK2ZsAgOuOxwvSyfZUYhHzLAtmT3viaWNP5QJTcW5mQDEV21eJ58haaU06q9s/xDzsofnYeTrTVKR83PRsG53BsMt+yz+IJbIRRuv96ozmK/59ME4PxFsGtCYxhCJH25atQU8JFD1S3nImzrR/IWpY2aXv8ozGSX5FPxm5vr9M9UhpTo3XEicoakJee7C94sejKfHMTBFkX3pTY8s6yNH4X3zyP/0TMqDkGMqwMXLdc4eYK+uwnUI0d+QRESD3a/JaOBkFocvplcOHRz+47sGwyTLHkUsUd/cxWV5QQVobRFZuxg3moG7W5Tfvi8UnTmsAOplr65QnJpl3UTDn6CRlO9Viiv2ddlv1DuJXbjjUATDruh1xmoYU+jSJA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 14d7733b-3b40-4307-9d45-08da7f8eccee X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Aug 2022 13:54:12.9432 (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: p+QhOm1jXUcBkVMOoS6NoK339z31MK/VLO5DoDHBuMVbaolz+Zv9VAuuwTRc/SglQ+Hl1bsg6Y1p+J2M5rh8Aw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB2989 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org This series contains bug fixes for the ocelot drivers (both switchdev and DSA). Some concern the counters exposed to ethtool -S, and others to the counters exposed to ifconfig. I'm aware that the changes are fairly large, but I wanted to prioritize on a proper approach to addressing the issues rather than a quick hack. Some of the noticed problems: - bad register offsets for some counters - unhandled concurrency leading to corrupted counters - unhandled 32-bit wraparound of ifconfig counters The issues on the ocelot switchdev driver were noticed through code inspection, I do not have the hardware to test. This patch set necessarily converts ocelot->stats_lock from a mutex to a spinlock. I know this affects Colin Foster's development with the SPI controlled VSC7512. I have other changes prepared for net-next that convert this back into a mutex (along with other changes in this area). Vladimir Oltean (8): net: dsa: felix: fix ethtool 256-511 and 512-1023 TX packet counters net: mscc: ocelot: fix incorrect ndo_get_stats64 packet counters net: mscc: ocelot: fix address of SYS_COUNT_TX_AGING counter net: mscc: ocelot: turn stats_lock into a spinlock net: mscc: ocelot: fix race between ndo_get_stats64 and ocelot_check_stats_work net: mscc: ocelot: make struct ocelot_stat_layout array indexable net: mscc: ocelot: keep ocelot_stat_layout by reg address, not offset net: mscc: ocelot: report ndo_get_stats64 from the wraparound-resistant ocelot->stats drivers/net/dsa/ocelot/felix_vsc9959.c | 558 +++++++++++++++++---- drivers/net/dsa/ocelot/seville_vsc9953.c | 553 ++++++++++++++++---- drivers/net/ethernet/mscc/ocelot.c | 62 ++- drivers/net/ethernet/mscc/ocelot_net.c | 55 +- drivers/net/ethernet/mscc/ocelot_vsc7514.c | 468 +++++++++++++---- drivers/net/ethernet/mscc/vsc7514_regs.c | 84 +++- include/soc/mscc/ocelot.h | 179 ++++++- 7 files changed, 1581 insertions(+), 378 deletions(-)