Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp899188rwn; Thu, 8 Sep 2022 10:14:32 -0700 (PDT) X-Google-Smtp-Source: AA6agR7tdO8FP8J92Vyc3R3FtDUF4FCvrF8fhJmc4a2h3VR1sGQ0GQc6z/pYp3ewaVLu75neNKj9 X-Received: by 2002:a17:902:cec4:b0:176:be0f:5c79 with SMTP id d4-20020a170902cec400b00176be0f5c79mr10099917plg.40.1662657272562; Thu, 08 Sep 2022 10:14:32 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1662657272; cv=pass; d=google.com; s=arc-20160816; b=HdSPQCc57FOOjwPE2cGJax3F7x2fVCkJzwznhcDkYhAX62qxaKomBGS0RykLujokZE Zbo+cFRzs8B/iaoEAx/lvaFkqA7v4calfIgQNVL7itKPeP0Vdrt7torwgKH+vbb9wXoQ 3+dnFuyRyXegvUiRpgWy3Rq8aOqRQ34I6cG86zJ5WDL2k7wYGHvqx9Pt9xAl1lWsBx4k sbV/6G6Yv0ysy41/SpUsHC6SaOJG+28cPj4ObkBWTwcn3744xrxx5R2hWs0J4yROPXHQ 0nmEQGh0YundP6kqcPbqI3/GUwAzwR8ukv4C/Yfc9tkuEa5sEx2IOT0TbNpY9Ngire1r AKXw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :message-id:date:subject:cc:to:from:dkim-signature; bh=+LFjIj+vE4lug3+njW+Tsf4gMSUVkVBUArQv5wuOkvU=; b=vUn0u1fu7S56KXtzlM0B7RxMgBKpqBQy9X7Ga99CW29B/wtPNU4lJoq7BonSP9qDP7 qPqCT+wHi1vHX6qt4mjX5iWlwvJBzlJE2VVAmFM6z+cP5Tw49FYvjub6AGzBpfsHrg15 +fEaHrPOMwhm1xGP16dutKVaWaoCvJtaP4a/MRVxkYWi82OC8pFKofUKpZi+hA7SrtDU 2QUtF53PIaO9u8Q2Rtu9uGDpxf2GWCN0MyYjntpWEcWpcLMLULgWUkeXmo4Esfp7pvyl GgDR98R6JbBLKXYkjXHspVm0BT1+7K9HGIPIm8DFoewP1WXXQoCdaiVc6r8x4EyvZO6g Nx9Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=EFXTnm+6; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x26-20020a056a00189a00b005385d37ab30si22708848pfh.10.2022.09.08.10.14.19; Thu, 08 Sep 2022 10:14:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=EFXTnm+6; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229574AbiIHQsu (ORCPT + 99 others); Thu, 8 Sep 2022 12:48:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43702 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229449AbiIHQsf (ORCPT ); Thu, 8 Sep 2022 12:48:35 -0400 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2082.outbound.protection.outlook.com [40.107.21.82]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA57A84EEF; Thu, 8 Sep 2022 09:48:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WN59k7o5s4uzK47dQ0qs12PAmnae6vzGnEqelklkN4WnY/U97x2LeXEHoEP68EderLg1dR2lzgdobMph+S7aLa9VS2hJYjK+wT9i/A4I9TqpuLA8OEBYmYDtowqVHEGs77SDOrpgPR7l6/ZDjBb4iGru/7zb3588y9mGOyBMqGjoeCca72jhKdDx2VwPGXeNoU7cJLQidyUaOG7Jed3p20D9n7/HjPjLGi0VMqHxt4IUDRjSvyE3B6k8yFPpQndP9i2mSqcBtuqsMP7fL4Dpz9VhQN1hopLzYH6VyQyb48skmvqHa0nUDw0t4T+XwEEI4GRsZ9BJSWcsi3wP7JoDHA== 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=+LFjIj+vE4lug3+njW+Tsf4gMSUVkVBUArQv5wuOkvU=; b=RcjIB1VluMDzl98tFIXbmcqsOyq7voWpWSd98DXEpuxdW6zbiuuq9u3VtNxL0n6hob6f0YgMc2gBBcr6Nxti92di6QAuENfHCiUaZSk89K4iqY8fPS1KaCwNORQrM1xeQX3+yddgnCCUKJTY3hwZFnoTBcWf4oGVrV3x833J9eyCt61av4M/rcAi+J8obsqQLpgGQO82wvDWCRnBf2S0Gq5f6cea3oDALnA9y5gVyCO7xZa4gWTC7VKJ2eVeHf7HiyVr0JJS8gx+93j/ThSEDOa0He+df+hERpG4fOrqN2vhyEmZaPoFb/TrdKaHyeUlHeBgJzWSKBadzEWfYiqLCQ== 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=+LFjIj+vE4lug3+njW+Tsf4gMSUVkVBUArQv5wuOkvU=; b=EFXTnm+6LjcPPRdTAx7Xxub6O6glZbAH0ebUIptr5Ud6mnvf4gkqh44/UuGTBCZRVDXRD1iuZv7B9zlKHQr/JQ46kLBtg75Zn9tiPpASrXAP98ph+FQF8+VhDbiLjXh+WNxE41yj1GKLP7eL1VrF2Sy2Q99k31s/1MLkpY6/kD4= 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 AM0PR04MB5154.eurprd04.prod.outlook.com (2603:10a6:208:c4::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.17; Thu, 8 Sep 2022 16:48:27 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::3412:9d57:ec73:fef3]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::3412:9d57:ec73:fef3%5]) with mapi id 15.20.5588.017; Thu, 8 Sep 2022 16:48:26 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Xiaoliang Yang , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Andrew Lunn , Vivien Didelot , Florian Fainelli , Maxim Kochetkov , Colin Foster , Richie Pearn , linux-kernel@vger.kernel.org Subject: [PATCH net-next 00/14] Standardized ethtool counters for Felix DSA driver Date: Thu, 8 Sep 2022 19:48:02 +0300 Message-Id: <20220908164816.3576795-1-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: BEXP281CA0009.DEUP281.PROD.OUTLOOK.COM (2603:10a6:b10::19) 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: 0c1a5e20-0161-466e-ad67-08da91b9f36d X-MS-TrafficTypeDiagnostic: AM0PR04MB5154:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PWGnrIZabog1+uKzMuhFdVuwzu8EWPB2WBS/eGWm8C/3nonh4assC89UZL9XWoE5Nbp0fdrDdpNjikUhJLCbTvF2nypaE3S2tr/TrC01sdTzbh/Aqd0NiImJ2Q1MsxuLEEX2kWlBXhPAhVgKzf21qJ6d/wGAJul+2IDXMESebeQbUTxRtGaMMw2o+zkJKquGfJogxWnWCgitxdie11h5g+wSAkUbhInTd1gsIrUxcgUBbdNHKA8eNMWfrkPFhcuUwyFA6sFZx6KGWBlED16MvNieTSevXtOpXKyTWr04BgX9ITAGajDc53klC4Wyf8JWGBgvAxvTO3TeixY1fT6Ag4kYoJMzUZEb6gj6ESWc5SQj/dATsuyjo8fa6wZ9vVxdP5rI1+we3w8AZvBLWVmyYGA6nyZyf98nWRDTOT1vPQ1Ba2h9EBJaogw9LdBXMq5GMr814MEpS4jOybHhEH8/JpkkgmZrQvtNwogP6Qb3ArPwex5T9LSS/hvJ7iN9VJ0PtfL6p+sRCv8ZMo+cv75QmHJcsK1g+EqJdxb09QUPGeI33afiEzSDHjOY5Wxa9wwjNGGoeeGpUN9zA5XlAtwH9POGZJX9/r2WA+6ZwCKHKMDHHEPunavvbZlq0RFPnuwp9bZ/BXNw14BFmNDnm/CNaHSnGYJl3aOvNFyoZoppd1I3gm8LdPclCnbwVJWtS2vpZLoA9t0zoWGDWN3aCjo9yFaBCU6uiW6carL2mC7fo7qcjkewOY0nNeiusqSnkCVQ 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)(376002)(346002)(136003)(396003)(39860400002)(366004)(186003)(6506007)(41300700001)(1076003)(6512007)(6666004)(478600001)(6486002)(2616005)(26005)(52116002)(38100700002)(86362001)(38350700002)(5660300002)(83380400001)(54906003)(316002)(44832011)(4326008)(8676002)(2906002)(8936002)(66476007)(66556008)(66946007)(6916009)(7416002)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?/feswYaEbskAFBEmoKGMHK90wo0DluVQNDbJttD4ccUHfGs63eqWWMG+a6Np?= =?us-ascii?Q?fSngqlGbTb2ae0rsbTT2vwt4S7V6E6WUvLXJuks0FS0pwyJW/XLl/xuf65J+?= =?us-ascii?Q?NirfcOljWc2smQ7n9mTSBxfuViQTU7DuU19TDbZZKCgc9J5l/4UFRzPzC9du?= =?us-ascii?Q?WhkaVgbpGVWeiNLTbXoIuf46u6cz1Wp/8sR4lGPfQtffmOaFZcYw4zYQp/NU?= =?us-ascii?Q?F19o/fDplmbZfmkoadnsLUvSV51y+gDU/vLN5D1V7LU4cREzJfWngOIbzDPl?= =?us-ascii?Q?dFIqV59qFe1KjeY0uK/Ejss322pUXjsNUcfDrUMJtKYitGDZeYI/UVMKDOd4?= =?us-ascii?Q?GMJY2xFztS8QtCyU4O2AREmisyuzWaOuMKxIggJLGVw71FrcQnNSG3hXhmLd?= =?us-ascii?Q?HzLAgWk204R48lHlLs58e2LxiZ6PHSnDsobK91ZBc6i96GWKqyvg8HaTtGmO?= =?us-ascii?Q?xBU0ms7Synq9FOHAK61ckDHU+etJjxHeu5t/J84yPayudu4Rjr0gNvhDVgJ6?= =?us-ascii?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bUTNa+K?= =?us-ascii?Q?D5lCCBnnDPPgBPIOGNxGRoJue00dOZHWe/IFsFQMkUGyBuI6aYjg/x/Q8axp?= =?us-ascii?Q?nuMpcYmG9d3oeqPHZrTWjfiBtVBXVMSf2cqvrzuYWFIa6cWSTAAMV8X/icv0?= =?us-ascii?Q?ypwzgslE6umZh8kwfTtaO/HEEe52xXdfqV9yxmOV3X9OvecYRYXms9sydceQ?= =?us-ascii?Q?PQ=3D=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0c1a5e20-0161-466e-ad67-08da91b9f36d X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Sep 2022 16:48:26.7249 (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: kNzWMkUzq2dzk5KlA9YzVEu0tY1ooBQ6LZHHVFee93nja4vNHUXY88kgsQnWcooBP/dK/qFn2U9YzXLUY+AGmA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB5154 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 The main purpose of this change set is to add reporting of structured ethtool statistics counters to the felix DSA driver (see patch 11/14 for details), as a prerequisite for extending these counters to the eMAC/pMAC defined by the IEEE MAC Merge layer. Along the way, the main purpose has diverged into multiple sub-purposes which are also tackled: - A bug fix patch submitted to "net" has made ocelot->stats_lock a spin lock, which is not an issue currently (all Ocelot switches are MMIO), but will be an issue for Colin Foster who is working on a SPI controlled Ocelot switch. We restore the hardware access to port stats to be sleepable. - PSFP (tc-gate, tc-police) tc-flower stats on Felix use a non-converged procedure to access the hardware counters, although the interface is very similar to what is used for the port counters. Benefit from the logic used for the port counters, which gains us 64-bit tc-flower stats that are resistant to overflows. - Also export the ndo_get_stats64 method used by the ocelot switchdev driver to Felix, so that ifconfig sees something hardware-based as well (but not 100% up to date). - Create a new ocelot_stats.c file which groups everything stats-related together. Along with this, also move some other topic-specific code, like FDB and PTP, out of the main ocelot.c. - Minimize the lines of code for the stats layout definitions. These changes alone cause the patch set to have an overall reduction of lines of code in the driver, even though we are adding new functionality as well. Tested the port counters with lockdep and friends, with some garden-variety traffic (ping, iperf3) and the PSFP counters with tools/testing/selftests/drivers/net/ocelot/psfp.sh. Vladimir Oltean (14): net: dsa: felix: add definitions for the stream filter counters net: mscc: ocelot: make access to STAT_VIEW sleepable again net: dsa: felix: check the 32-bit PSFP stats against overflow net: mscc: ocelot: report FIFO drop counters through stats->rx_dropped net: mscc: ocelot: sort Makefile files alphabetically net: mscc: ocelot: move stats code to ocelot_stats.c net: mscc: ocelot: unexport ocelot_port_fdb_do_dump from the common lib net: mscc: ocelot: move more PTP code from the lib to ocelot_ptp.c net: dsa: felix: use ocelot's ndo_get_stats64 method net: mscc: ocelot: exclude stats from bulk regions based on reg, not name net: mscc: ocelot: add support for all sorts of standardized counters present in DSA net: mscc: ocelot: harmonize names of SYS_COUNT_TX_AGING and OCELOT_STAT_TX_AGED net: mscc: ocelot: minimize definitions for stats net: mscc: ocelot: share the common stat definitions between all drivers drivers/net/dsa/ocelot/felix.c | 55 ++ drivers/net/dsa/ocelot/felix_vsc9959.c | 509 +++------------ drivers/net/dsa/ocelot/seville_vsc9953.c | 376 +---------- drivers/net/ethernet/mscc/Makefile | 11 +- drivers/net/ethernet/mscc/ocelot.c | 707 +-------------------- drivers/net/ethernet/mscc/ocelot.h | 12 +- drivers/net/ethernet/mscc/ocelot_net.c | 88 +-- drivers/net/ethernet/mscc/ocelot_ptp.c | 481 ++++++++++++++ drivers/net/ethernet/mscc/ocelot_stats.c | 458 +++++++++++++ drivers/net/ethernet/mscc/ocelot_vsc7514.c | 373 +---------- drivers/net/ethernet/mscc/vsc7514_regs.c | 3 +- include/soc/mscc/ocelot.h | 138 +++- 12 files changed, 1293 insertions(+), 1918 deletions(-) create mode 100644 drivers/net/ethernet/mscc/ocelot_stats.c -- 2.34.1