From patchwork Wed Jun 9 15:15:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksandr Mazur X-Patchwork-Id: 12310447 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5E49AC48BCF for ; Wed, 9 Jun 2021 15:16:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 46B36613B6 for ; Wed, 9 Jun 2021 15:16:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233695AbhFIPSQ (ORCPT ); Wed, 9 Jun 2021 11:18:16 -0400 Received: from mail-eopbgr50127.outbound.protection.outlook.com ([40.107.5.127]:39182 "EHLO EUR03-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S233257AbhFIPSM (ORCPT ); Wed, 9 Jun 2021 11:18:12 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OkDwRlLEqy1tRmnKVM4NWoaY940Ln/4pstvrW2Ghu6T21qgrGk3bB68QvGULb4SHDJZ+VmFRpOqt/IlmkEH/5VN6BdILYOp1htDjzBTPB1JdgeXUlijfafed3bRUI5zlcPjLswTpUe4mWfou0xqRTzdzpMwziCQvHd3/YKgufMHI3GER3kXUGfCu93d73aVB439kF7hGZ1T/B7pJxj3YY+K5AMrGVmuACIajv0VeRVyAVR44OjX6rSjmzO4V0aHfQ1ly5ZdXvA6Q8Uzu5KPtysb/Jew/BSJfA5rc2IOTkG0xT2mmLwiLAGgD0QssyEnHiA3qC1s8aYrHZHlYy6HirA== 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-SenderADCheck; bh=DAZu146b7e6ypjuMjavajC4ODeIU/lBLsC4MZ+gN/hk=; b=iH/CqX5oDg7hwj/7q7gaa4/9BFRPIaGxwJEY2J/9ZiY2YM0nyqR/0g1xv8CoXQyxQZV7CeoUP5s5q5KBc3UDMWY7BnR/A9ywOckB8Og5XsN7SBmEoSlYdBeET5kr2AIlCiocE/SjYP828bkWS5TUW/Jm4LH3xpdOzniYoHQy+zOCWuGYTE4AXmqAWo1+2cTmp+ne01WJ66MyGgsPhK/Wo1COC6faQjFVG4etf+6cXawBCY30GsFDBSResh5C6DN0QCxs1GDYtttknNw9C3WT6MP/bTxzuUtn1CyKrlgZb1HmjaIYHF9zqiKCobwRqWybhZKOgc1LSOXxy09dtstQPQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=plvision.eu; dmarc=pass action=none header.from=plvision.eu; dkim=pass header.d=plvision.eu; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=plvision.eu; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DAZu146b7e6ypjuMjavajC4ODeIU/lBLsC4MZ+gN/hk=; b=FgBPhVGT7dyigx+FGyebwQhmxtYhxt7oUC9tVK4oRu4L+HUJA4b80/ph7KIsJm1wUJj1B3Kot2Z81RIEFRLzuqoFABuWw4F9gk0jEkXOcMRMIZYgKlk7MtwoP2/iBoZjDKEyRgNb5exuVOcIxUo613tahwtesOsgtx3p7uKAxU4= Authentication-Results: plvision.eu; dkim=none (message not signed) header.d=none;plvision.eu; dmarc=none action=none header.from=plvision.eu; Received: from AM0P190MB0738.EURP190.PROD.OUTLOOK.COM (2603:10a6:208:19b::9) by AM4P190MB0004.EURP190.PROD.OUTLOOK.COM (2603:10a6:200:65::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4219.21; Wed, 9 Jun 2021 15:16:14 +0000 Received: from AM0P190MB0738.EURP190.PROD.OUTLOOK.COM ([fe80::d018:6384:155:a2fe]) by AM0P190MB0738.EURP190.PROD.OUTLOOK.COM ([fe80::d018:6384:155:a2fe%9]) with mapi id 15.20.4219.021; Wed, 9 Jun 2021 15:16:14 +0000 From: Oleksandr Mazur To: oleksandr.mazur@plvision.eu, jiri@nvidia.com, davem@davemloft.net, kuba@kernel.org Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 00/11] Marvell Prestera driver implementation of devlink functionality. Date: Wed, 9 Jun 2021 18:15:50 +0300 Message-Id: <20210609151602.29004-1-oleksandr.mazur@plvision.eu> X-Mailer: git-send-email 2.17.1 X-Originating-IP: [217.20.186.93] X-ClientProxiedBy: AM0PR06CA0092.eurprd06.prod.outlook.com (2603:10a6:208:fa::33) To AM0P190MB0738.EURP190.PROD.OUTLOOK.COM (2603:10a6:208:19b::9) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from omazur.x.ow.s (217.20.186.93) by AM0PR06CA0092.eurprd06.prod.outlook.com (2603:10a6:208:fa::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4219.21 via Frontend Transport; Wed, 9 Jun 2021 15:16:13 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 60fbf8af-c5db-47d8-863e-08d92b598576 X-MS-TrafficTypeDiagnostic: AM4P190MB0004: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dVskKLvT7ZAFkO31JDMymWjgnnyV7kjpvjDI4N+V5PN9mXWjLLyWXu+Pq23JNG55nTk0XkuIy2LlMtUqwG47r4k5rKvPxq5+hVP3BPq5VX+TQ19DzC+Vq+lrzBbzjpqVRsKlcKjnVVUjgiXp6UtAobKuXP/Cp4iEy2xKjwCMtAWYTljwfCJ8dp0gP9whERVDHupM+7s43TGZNL/SiW111yum9KZYpHkzZ2a5mqIE7Yd1EXgacm1wAy1rV/WPJaLDyvvUbBOGLiYW8E28aKKb1jqlnZy6mwp3oGOinpxcfGdzGHEY9SGdO/gx3JHw6WAUDTPWJKOzXX3wPSKFlKHnzANjbKsa9ED1ff9Gg99S6+MnxGN2QD1loskqm7rYEd/HCRzhMCxyqNtO/UvS2XsgTqYIIV7A+5vtcqMD3kWOuL2NpS7865hfBCHaTBZKQn9uyV/8zYsGKxXoPuA0S3vf/bs8HBr4PIfOPUNgxmZEt0NB9jIaeJRh9Y/cMyDhObj+chLeuWHFgt6Xb8g/w7JB3znebwiwaWH4kqgJJIw7r9jrbncEZWPAGsykc2PPETzixemeuIJKYNmvsBpdiLgEW9DiYSI1aHVeCumqDUTjkrUkvqOoCAPUCm68/Kfww6oHe5nTL7VXIDaaVC3RpRZMWg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM0P190MB0738.EURP190.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(346002)(136003)(396003)(39830400003)(376002)(366004)(38100700002)(38350700002)(316002)(8936002)(36756003)(478600001)(26005)(956004)(6506007)(6512007)(2616005)(5660300002)(4326008)(52116002)(83380400001)(2906002)(86362001)(16526019)(66946007)(1076003)(66476007)(66556008)(6666004)(44832011)(8676002)(6486002)(186003);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VG7tXzAKCacE+8R1HuIyN8qsjpO4Q4hzvZYh35kZUvzP9vD5WVSOBQPy17IhhMYG0yShtpAI1hqng6WSzvgywjtQDFTIvu4zybSE8Hvm84BlXNiutDR6IZ5S6xFbp99g8L8BWIElRCX+HF0p+ilg5xOXuRzJtd8dJkSWlqg+ZlXOv5/TPPBEiubeDGhDtRgZtSV0Vpf1TqGsuU5ZsSJhByTZKWX93sR6nTiAwvo9TxgJc4Koe0SRUmsMAKdoCkwp5J26cHV2/OqLD3m/NNd9nIOFpw2E09pqv2a1D+qvdUh6Wn X-OriginatorOrg: plvision.eu X-MS-Exchange-CrossTenant-Network-Message-Id: 60fbf8af-c5db-47d8-863e-08d92b598576 X-MS-Exchange-CrossTenant-AuthSource: AM0P190MB0738.EURP190.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jun 2021 15:16:14.2101 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 03707b74-30f3-46b6-a0e0-ff0a7438c9c4 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: yPd1CZlvtwNso47qzAPpZgZbXqoUqH8r2Cq/bKRejUsCQELQaTmdVWeUFr3yPpC9ql1qOLveUEAUldZd+AqOdpZ/DXFrMS2/ZtIz9ylSvlY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4P190MB0004 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Prestera Switchdev driver implements a set of devlink-based features, that include both debug functionality (traps with trap statistics), as well as functional rate limiter that is based on the devlink kernel API (interfaces). The core prestera-devlink functionality is implemented in the prestera_devlink.c. The patch series also extends the existing devlink kernel API with a list of core features: - devlink: add API for both publish/unpublish port parameters. - devlink: add port parameters-specific ops, as current design makes it impossible to register one parameter for multiple ports, and effectively distinguish for what port parameter_op is called. - devlink: add trap_drop_counter_get callback for driver to register - make it possible to keep track of how many packets have been dropped (hard) by the switch device, before the packets even made it to the devlink subsystem (e.g. dropped due to RXDMA buffer overflow). The core features that extend current functionality of prestera Switchdev driver: - add storm control (BUM control) functionality, that is driven through the devlink (per) port parameters. - add logic for driver traps and drops registration (also traps with DROP action). - add documentation for prestera driver traps and drops group. Oleksandr Mazur (10): net: core: devlink: add dropped stats traps field net: core: devlink: add port_params_ops for devlink port parameters altering testing: selftests: net: forwarding: add devlink-required functionality to test (hard) dropped stats field drivers: net: netdevsim: add devlink trap_drop_counter_get implementation testing: selftests: drivers: net: netdevsim: devlink: add test case for hard drop statistics drivers: net: netdevsim: add devlink port params usage net: marvell: prestera: devlink: add traps/groups implementation net: marvell: prestera: devlink: add traps with DROP action net: marvell: prestera: add storm control (rate limiter) implementation documentation: networking: devlink: add prestera switched driver Documentation Sudarsana Reddy Kalluru (1): net: core: devlink: add apis to publish/unpublish port params Documentation/networking/devlink/prestera.rst | 167 +++++ .../net/ethernet/marvell/prestera/prestera.h | 9 + .../marvell/prestera/prestera_devlink.c | 664 +++++++++++++++++- .../marvell/prestera/prestera_devlink.h | 3 + .../ethernet/marvell/prestera/prestera_dsa.c | 3 + .../ethernet/marvell/prestera/prestera_dsa.h | 1 + .../ethernet/marvell/prestera/prestera_hw.c | 60 ++ .../ethernet/marvell/prestera/prestera_hw.h | 20 + .../ethernet/marvell/prestera/prestera_rxtx.c | 7 +- drivers/net/netdevsim/dev.c | 108 ++- drivers/net/netdevsim/netdevsim.h | 3 + include/net/devlink.h | 35 + net/core/devlink.c | 139 +++- .../drivers/net/netdevsim/devlink_trap.sh | 10 + .../selftests/net/forwarding/devlink_lib.sh | 26 + 15 files changed, 1238 insertions(+), 17 deletions(-) create mode 100644 Documentation/networking/devlink/prestera.rst