From patchwork Mon Feb 20 12:23: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: 5637 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1276642wrn; Mon, 20 Feb 2023 04:25:02 -0800 (PST) X-Google-Smtp-Source: AK7set/dAQHkNk5G4yFW/Hxpg6ZyOOlp9UE7vbHH96LgO+GrrlmvsKE/rgCkI48M8slWNdkcdcGh X-Received: by 2002:a05:6a20:3d8b:b0:c3:cc88:c3a4 with SMTP id s11-20020a056a203d8b00b000c3cc88c3a4mr1155320pzi.45.1676895902598; Mon, 20 Feb 2023 04:25:02 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1676895902; cv=pass; d=google.com; s=arc-20160816; b=n9/saM1s3BMCo+JEvuhmpdknKtW4mBp5xiIngiEwqAxMCk9+stAjGoqSTK6OnziDm/ cfZ7w2tbG1InZGNxBej4//g1cFvGadu9kxsh3WCMXNL+Z94b8ANCWbjo1lPhW1e0MZ8V C1czYQEsgfgZCo1lFKmz6e9QkvkcPGMtrcjZzR8DetHi9XJw+Ip1QZGmK8qoZF1MAGmI e3pLnQjgJfcpN3/h1DU5/CcYUuPfy5/J6G7Rw2b3LhPeDVAb4ujgc7+lhOTWqIR8MIV9 ne3rx5PKK8y2D1ZVS8MECdpPY01V6gejTJtoDY2eCQl9EiRUufz5ayPVP1Sqv3BuE7M1 ea2w== 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=X+LTUaIE0Ikc7XtpwDkLYIH8r9lvnmmldzltBcOqElc=; b=XpLN2OliDu8yKl94Acj7QUFbFXH1mOaqYBmw4LqlKJc//bNG2B5zFmzr5A5Lr7fGCn qVOsaQhH9A3Jj5PkBWg+LKLXYBe+NhtU7DxYjk0jdqabcSKLygEYJRkc9B/1TaYWSo6V qcHOQGJd4C4toJEE8HnOdxvAhO56jzMzeuD0aYFeV1OCer2AvroBYDZ/iM3sxIvb5U4/ W+AUNrfMYQethDl9gD1VwCNpGNVzXVLIJuK47AuB0zCLGDQKwfmxhl/QmYBn7LuwC4lW wK4H9VN9083K0zOj4x3lULMpZ1hHZfBi05e3eFbyu6Io5rAR1+x4sE1RHKT5GClrhju0 ffuw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b="poRoi/v9"; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s13-20020aa78bcd000000b005a8b4de535esi1633459pfd.233.2023.02.20.04.24.50; Mon, 20 Feb 2023 04:25:02 -0800 (PST) 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="poRoi/v9"; 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 S232008AbjBTMYB (ORCPT + 99 others); Mon, 20 Feb 2023 07:24:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42510 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230392AbjBTMYA (ORCPT ); Mon, 20 Feb 2023 07:24:00 -0500 Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2056.outbound.protection.outlook.com [40.107.105.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5864EC666; Mon, 20 Feb 2023 04:23:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EF92c9bzzH3PhvyD9cD+o5NzeqyWN75m5LD588Ddri/ZB5n3F/4wV44cB1PtfR8xyn4uWiKPRPBqUWX3OE4KhMVdl0d7C5XG7mRGaoHkFYS5wFCAma+HZ8PzeKKmj6zmdht75t8dL0zd7nWJdmtiYfZVXc4dNrNylt8C+PfdtC8j7dJcUDjtZ7AP1uzOni7uJ9mgglrqFlAk98PiZcopDQFyfd4Iadn3qJoYpwJ/T7ukS+yOZuKeSQQpSOE8HAydDQ99Nt5RWxbeN5S/ET01FLIYfF7rpVshozYQyiwtNniIwJfHSX592ZnHY1EtCM6NvAEcjG4DkY0rF35iU4ukhg== 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=X+LTUaIE0Ikc7XtpwDkLYIH8r9lvnmmldzltBcOqElc=; b=bE/GaoL3J3jnJJxeLpPSjPxUAIRU23QHL5ud8sH2ELlNKWWb728tba36s26e4HYFd89/+8SaNijnHParFZN9kvRESymPQMABEvSsw4DdZRhpgqdi/F4uMPkZUHxlR/KIS9zQB2b244+1DxtZ24TW7KymBVxJwm+IPMVnTrI7TSK2oMTdGZpfi0BqnJc2IIT3ZgibYRLrujOhoG/VUws2G1Co84osZlwMojybCiKjQqbBWKKtePEkFkn7a2sMDXJuAUOwzNOUSCPJFR/iI4uAE5KOHJBDp4OLIyPqjYnaf00pOQguJyVRCu3i2C3IcdSWOcS77LlLQdiUs9uJ042tyA== 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=X+LTUaIE0Ikc7XtpwDkLYIH8r9lvnmmldzltBcOqElc=; b=poRoi/v9tc3hp/wxww3BPNZKZl6eZlqCI0gN9e1cyf0zBOdOp3aoANPMJMjCEM/xCpS+wrtmdoWT38dNsetSd5PKbTiqMyZOIwgXVSR8YCRpRXUqXDStxEkAkXQB6yjrKg/TfYm1JvxX94altKKToI+byFF40LjNgQcn0o/PNfM= 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 PA4PR04MB7725.eurprd04.prod.outlook.com (2603:10a6:102:f1::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6111.19; Mon, 20 Feb 2023 12:23:56 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::3cfb:3ae7:1686:a68b]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::3cfb:3ae7:1686:a68b%7]) with mapi id 15.20.6111.019; Mon, 20 Feb 2023 12:23:55 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Jamal Hadi Salim , Cong Wang , Jiri Pirko , Vinicius Costa Gomes , Kurt Kanzenbach , Gerhard Engleder , Amritha Nambiar , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Andrew Lunn , Florian Fainelli , Ferenc Fejes , Xiaoliang Yang , Roger Quadros , Pranavi Somisetty , Harini Katakam , Giuseppe Cavallaro , Alexandre Torgue , Michael Sit Wei Hong , Mohammad Athari Bin Ismail , Jacob Keller , linux-kernel@vger.kernel.org Subject: [PATCH v3 net-next 00/13] Add tc-mqprio and tc-taprio support for preemptible traffic classes Date: Mon, 20 Feb 2023 14:23:30 +0200 Message-Id: <20230220122343.1156614-1-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: BE1P281CA0183.DEUP281.PROD.OUTLOOK.COM (2603:10a6:b10:8d::17) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5136:EE_|PA4PR04MB7725:EE_ X-MS-Office365-Filtering-Correlation-Id: 144a3aca-fa83-4254-7583-08db133d5596 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zrrQ1FZ4P1qXtLdqDIvZCbc9QTe88Nx4wW8hmV6g8JmL96cGl4BVCx5NOzjHnyVrk4IF1j+NrfyJdKkp3gpS7dQ+LiJ84cVjjKyFF8gXP2XP3v2Prd9n5UF1VLLDGeyE/16Ssw029FtHM0bujNuJgezplAfp8BS0GBGU8uKBgn1YGc1E0f6KHDg1UbT0oAE3CtzhepRJ6POPJQnWR/ZrAejfyCUtRRC/IQpFZsyDDfwfXMVpVGYRjgL2NI3NjFSuesrVIGmqVX0+BjOxf0kT/dDvXZxcLpzUPh/KVesERYzzJYeWlwgZZkn2AmWspbwZJDrQeUH4bctEq2i/IPrtRW9FXZDTYmE4rNsnd8C/pNLCQM9CWHwOIFimUAoVoZUHH/ZZl/YsLSp1Yk4ATCCbwxmKfBmQmHhI4vziHKa+OzJjLZvxtND2XrK6tPpBbkzFoTzyKyCMy1TpdT5stjTZDLDCAwvJoKOcYnbrgRQABdElkiORxYi3q3Pbkcbi1NWM/P8auX0y6h86wCCn+XxJ09aysxPQiR4WkH0RtDiOBh3GWKDAM8mf0hTCOf2o1TlqrnpqK22mgCIGgp2XO+2zql8rnSF2EHoQc7fYQpNkyJqyRV9c1uJm3m0wraKJYLYuwF42X23lF206r5blZPsEcsLMueRHUhNM/f6sPO9qV2RkQ2pdXR0A3RX8+DYsMfMt73gG2x+jRb5EkTUmo7WnUiPo4/JYUWIDCPFH42rgsT8= 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:(13230025)(4636009)(366004)(346002)(39860400002)(136003)(376002)(396003)(451199018)(8676002)(6916009)(4326008)(66556008)(316002)(6486002)(66476007)(54906003)(66946007)(7416002)(966005)(52116002)(8936002)(5660300002)(41300700001)(86362001)(36756003)(478600001)(38100700002)(1076003)(38350700002)(6506007)(26005)(186003)(6512007)(6666004)(2616005)(2906002)(44832011)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: cr0QwTgZrauCoC6E6uzi1rOjvNvdMp36/Av77nfCJmq+qJaRaeakwZgEnW6P68xsMESvQUWnbqeQRspTWMIMyQ5jp0Lh8DzbXfLjTWsI5DJ0jWjkoHYfoZwrSYW6cLrOQhYWvDsNuU6pAxXzYEsmt6/o1o0p/u09RSXNh7DQAiTFfzkmvYjkJbhUugf5M7qgDZKPMj2owfIUp+2HSd2viHlFpbIiN6WKgPm4qjCSWjBs0x52sbmqcKBE63J7v7n8KNGvp/1BA+bd88CvK7A2JTjSOLIwG/u2eXWcy4B3aF2OVQT4OcM8T3NTN3/tdrc3kZMEEby2qTiHZZe65THPIGEO3hppr1YUJ55ESLp4PHgEo4eVr8lL6lZVbvQtaj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NrhG3mckxuHK1hZWQQSx7aTDsAWdZZ6ROB8/Anx3mq0SuZUMUWNCv9F37Stc4qTuyC5Cm2m4wqEdxyaKXs8wdUtXHu+GYNGcVKJZ1BrZYWNHuPgwQ5+7iw4h0ReiKWJ/jDW7Q3q+H9T5BpCFXfPxMspYxsWB+q4meTCQ== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 144a3aca-fa83-4254-7583-08db133d5596 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Feb 2023 12:23:55.6507 (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: d/uo5bdzQL3uFYq4fZJuH2dt8t48EK3fmM80nGRRcFYgA3ztkjzA91QexB8XEu8CexCFEpBdHfQ9Euf6WQkW9Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB7725 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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758352797606534002?= X-GMAIL-MSGID: =?utf-8?q?1758352797606534002?= The last RFC in August 2022 contained a proposal for the UAPI of both TSN standards which together form Frame Preemption (802.1Q and 802.3): https://lore.kernel.org/netdev/20220816222920.1952936-1-vladimir.oltean@nxp.com/ It wasn't clear at the time whether the 802.1Q portion of Frame Preemption should be exposed via the tc qdisc (mqprio, taprio) or via some other layer (perhaps also ethtool like the 802.3 portion, or dcbnl), even though the options were discussed extensively, with pros and cons: https://lore.kernel.org/netdev/20220816222920.1952936-3-vladimir.oltean@nxp.com/ So the 802.3 portion got submitted separately and finally was accepted: https://lore.kernel.org/netdev/20230119122705.73054-1-vladimir.oltean@nxp.com/ leaving the only remaining question: how do we expose the 802.1Q bits? This series proposes that we use the Qdisc layer, through separate (albeit very similar) UAPI in mqprio and taprio, and that both these Qdiscs pass the information down to the offloading device driver through the common mqprio offload structure (which taprio also passes). Implementations are provided for the NXP LS1028A on-board Ethernet (enetc, felix). Some patches should have maybe belonged to separate series, leaving here only patches 07/13 - 13/13, for ease of review. That may be true, however due to a perceived lack of time to wait for the prerequisite cleanup to be merged, here they are all together. Changes in v3: - fixed build error caused by "default" switch case with no code - reordered patches: bug fix first, driver changes all at the end - changed links from patchwork to lore - passed extack down to ndo_setup_tc() for mqprio and taprio, and made use of it in ocelot v2 at: https://lore.kernel.org/netdev/20230219135309.594188-1-vladimir.oltean@nxp.com/ Changes in v2: - add missing EXPORT_SYMBOL_GPL(ethtool_dev_mm_supported) - slightly reword some commit messages - move #include to the respective patch in mqprio - remove self-evident comment "only for dump and offloading" in mqprio v1 at: https://lore.kernel.org/netdev/20230216232126.3402975-1-vladimir.oltean@nxp.com/ Vladimir Oltean (13): net: ethtool: fix __ethtool_dev_mm_supported() implementation net: ethtool: create and export ethtool_dev_mm_supported() net/sched: mqprio: simplify handling of nlattr portion of TCA_OPTIONS net/sched: mqprio: add extack to mqprio_parse_nlattr() net/sched: mqprio: add an extack message to mqprio_parse_opt() net/sched: pass netlink extack to mqprio and taprio offload net/sched: mqprio: allow per-TC user input of FP adminStatus net/sched: taprio: allow per-TC user input of FP adminStatus net: enetc: rename "mqprio" to "qopt" net: mscc: ocelot: add support for mqprio offload net: dsa: felix: act upon the mqprio qopt in taprio offload net: mscc: ocelot: add support for preemptible traffic classes net: enetc: add support for preemptible traffic classes drivers/net/dsa/ocelot/felix_vsc9959.c | 44 ++++- drivers/net/ethernet/freescale/enetc/enetc.c | 31 ++- drivers/net/ethernet/freescale/enetc/enetc.h | 1 + .../net/ethernet/freescale/enetc/enetc_hw.h | 4 + drivers/net/ethernet/mscc/ocelot.c | 53 +++++ drivers/net/ethernet/mscc/ocelot.h | 2 + drivers/net/ethernet/mscc/ocelot_mm.c | 52 +++++ include/linux/ethtool_netlink.h | 6 + include/net/pkt_sched.h | 3 + include/soc/mscc/ocelot.h | 6 + include/uapi/linux/pkt_sched.h | 17 ++ net/ethtool/mm.c | 25 ++- net/sched/sch_mqprio.c | 187 +++++++++++++++--- net/sched/sch_mqprio_lib.c | 14 ++ net/sched/sch_mqprio_lib.h | 2 + net/sched/sch_taprio.c | 77 ++++++-- 16 files changed, 474 insertions(+), 50 deletions(-) Reviewed-by: Simon Horman