From patchwork Thu Feb 16 23:21:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 58275 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp582811wrn; Thu, 16 Feb 2023 15:22:46 -0800 (PST) X-Google-Smtp-Source: AK7set/hnzHsVH/r3ES4SDKCoL1fP+mofN+neRboHlwDpR7fOwKT/9gqoz9TQRgZghOWgCgQQdvK X-Received: by 2002:a05:6a20:b1a6:b0:b9:6208:44e6 with SMTP id ee38-20020a056a20b1a600b000b9620844e6mr5856519pzb.7.1676589766650; Thu, 16 Feb 2023 15:22:46 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1676589766; cv=pass; d=google.com; s=arc-20160816; b=S1TIrWMibG3nZwJBUAMyJeSxBUoFmt3febFhyD8o2N+NNwR3a/Fl4HqFpLC7v87xqm EO5cQkEB8pjnfYsWof6SGgfXM4HT+E4OoqOmI3ogNkjD5zbeaHXQA9j5nmmc2bH7fGT4 C8v8tCezE++qb3fzvDCiy0UoA9y8/3+LRadTAEAEODNwGnEwjkBOMLxTv4+EyeWlplQD REpdan0QzKb9nKEhaEmEi2a5VGogXwoG7dJC1kuHJwX8NyW3f+PenSLDO41y2YiiH3kc Emc2DFsmbvNlLzgy6maKSMR6WSa8kOofhVvSFy1d76A5CoUtRtwrplJgkChqYIRCTqoP eNyQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=V4Q80mCxvBneKP5ZVv6v5WaAONSC4VppBorKYRTSPBA=; b=xjw+GKCKCSP2qq1l09dHCvAMUWjn9zz99Es0EECsfEVtRII5fg/IT9LqahmpbnB6Df MvFqqiRjOBBEIuKShRctsCNjIXB5qvZK5x1kQzlKumg/F99NeZC4iDHCoKIW2ASpfoI9 RyR4qLtsikBexuc8pLPbnc7fTO4nlbmHeTZ4nFIOZwLjFkHwA6F+tAJ4iJf7/438e8wD ukbCSrurKCOydvlKGeUo9Q/D1rlGHsuMy70Sbojp3Ck7OfN5Ik+7s6Q/hi494QezTWHh M0ol1CawUgBAEF9skcJc0+wWF/f6uBwRmGxvIRHiN5hrC/r6vs2WkyUPVwrPN0EgkpXx DZ+g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=WCYGEqtu; 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 h10-20020a65468a000000b004fb878e0fbbsi3054073pgr.639.2023.02.16.15.22.30; Thu, 16 Feb 2023 15:22:46 -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=WCYGEqtu; 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 S229834AbjBPXVu (ORCPT + 99 others); Thu, 16 Feb 2023 18:21:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229508AbjBPXVq (ORCPT ); Thu, 16 Feb 2023 18:21:46 -0500 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2046.outbound.protection.outlook.com [40.107.104.46]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B370442FB; Thu, 16 Feb 2023 15:21:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=H1OFA7WD4JnbWo7WdIRLNOJhLZEXhx2DuMRbAXjsR2RjVULykf70xuEeDHZoGg+nt0a7OVHyZ2R4qlnS8Js6tAJFWe0UtWLuYPnnP2FnyxWUnraViVHaz+XaoNM2YQw7RdmLtHBWle8TlHrW+eLOoKwtBj9IrcwzG98huDzgGCQdiID36Ulc1edf+I706SgwHXR0tHjwekcGfmqQ7qS+8CBx11QDRk/H4RbgZysUpQkglnRnSKlUg1LwI0XDw6lCrGOa1LTifD+Kujc67OzRH2vD3uap9nLkyf3nDkzBEXAcNzrfvahPdqqrl4SBaL6QQhveFgQTwN1Ima/0mvuykQ== 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=V4Q80mCxvBneKP5ZVv6v5WaAONSC4VppBorKYRTSPBA=; b=MnqIbPQE9jblTUEb79R2UF1yQgvbAe12vHJITxK3BDnUO9ikKVZ3QP3jc7M05lAgqRoFzw8sRmg9Q6kfOZPasyj0UT+U3MrFDmvboK34mAjIP36BZPYvhInEzpsZcD/bNvRQdsD1a+ayOgHhlovurskKmAfIidku7aak3bGIJJ3PR5daUziFB7GMNd4hOEhrDuSyWkOUoRQgxRiTFjmFb27cQ7QhAiu/fHokm5TXszlCx9mNAXCCYl1XI0l8Yb5Dt0tZZG6K5OANQ200BPOdoEb0v6Dceqr6Tz2y2vW5Ir8/gS0hsH0iozwluXZf5vCnYWAUBIGTtmWj9aEWvlPXTQ== 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=V4Q80mCxvBneKP5ZVv6v5WaAONSC4VppBorKYRTSPBA=; b=WCYGEqtuD9nmKlJjlBuaGktB631p7VtwWJZ1aV132u8P4N0mUfPndnf9j/Zfr5mDX5CmA6/1A6jyF9WXXbPGH8TWykJjbA2BXKUGQhRHP3AZpA7K+rgx64JMKxPsE5s/poRT4IMUfDrdegeQmBg+wTy/JOD17je8xmm7aQ7iVBM= 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 PR3PR04MB7436.eurprd04.prod.outlook.com (2603:10a6:102:87::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.26; Thu, 16 Feb 2023 23:21:42 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::3cfb:3ae7:1686:a68b]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::3cfb:3ae7:1686:a68b%4]) with mapi id 15.20.6086.026; Thu, 16 Feb 2023 23:21:42 +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 , linux-kernel@vger.kernel.org Subject: [PATCH net-next 01/12] net: enetc: rename "mqprio" to "qopt" Date: Fri, 17 Feb 2023 01:21:15 +0200 Message-Id: <20230216232126.3402975-2-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230216232126.3402975-1-vladimir.oltean@nxp.com> References: <20230216232126.3402975-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: VI1PR0501CA0018.eurprd05.prod.outlook.com (2603:10a6:800:92::28) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5136:EE_|PR3PR04MB7436:EE_ X-MS-Office365-Filtering-Correlation-Id: 85fbaea5-e512-4b7a-1dc8-08db10749004 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 79y/p5gaP6wt7+6MJgV/tTlntjLW/Mq+4mqAzJXY+eVPUUSbm3UeetVtq2PE7HqmPPlb9tiIsse1rdbWdro+xWOJpVgYpUItZuXkZd7oAOiXfoBYew+tx6YL3TWwylfjdhx+yPfnJ1uTUKK21S7Y0o5aWAHkuKCRxDKe+C8ledwnPbZymdgYdjH4agGHmhZrPr0hbmAnTou9OxH3yAI6iKsbCuuiO70FkH2CgjG4iIQlBXZ+7q9JnoXCHVzmtRx2vELNEDubrl//69DoBI0e8vgU6+/GNHNrUETC7oystQ9lmrq0rUWmG2IEBVvCmwY/JogzA6uzq+RUAwTL5R/NVVejRvNdVupv3u+02wofLXD6td8qeiZ+ZwyYqTxW3aXCag2CFMBD6PDaTOjx6MLm8Z2EfH2WD4NAMBwCiSGuuwytqeX/HNm7cTAM4BQPBJ2ePW+v8eJ8JHDisPskYoyK/jEylDRaAfxEXBfh8q5f7B0BS8WSyRHfDl31+JMTGgqZux9gqHI07u6+TKKyLneREAU4P3rGZkWVVObxdqeWW6wluwBXRnhSCHVNT95YNozEWkr7o+bbYOOG3FsqIM4Ezty3xUE6qtb5OvcnZT3lBpCBAAmdCHw15CFau4s12itMMkAzwvmSAvOsoYXLu7A0kX2mlYkZJ2yKgu5kdubtl9YcKIaJIX765MLzCctCZAInMWd1950qDZWwktl6scRXIw== 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)(376002)(366004)(396003)(136003)(39860400002)(346002)(451199018)(38100700002)(2906002)(38350700002)(44832011)(7416002)(83380400001)(66476007)(2616005)(86362001)(478600001)(6916009)(66556008)(36756003)(5660300002)(41300700001)(6506007)(52116002)(6666004)(4326008)(66946007)(6486002)(54906003)(186003)(316002)(8936002)(26005)(6512007)(1076003)(8676002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: zz3bo6mr1TAF7Ol3lwfiIFh+v/iJDi5p39wUG8BRQleykc4PG/Hu52suUqVzkoTiNYWRDUqxMUp7cVfIKTQQ5yOj02GB97nkZMcZZNmbCy3oHyrcFgrP7uEmRsI08aMnsS6DFpUzRutEw7eECe4qSZ5JzjjMOjnsqkLEyjSB44QM/Fe45DmVGf//FKxnOinGQgajMJ+UNmtd95nXcb/JjGghZD+OR7XelavunhEE1T12Z159UuEaF1NVshYbbmBtfnEBiewyqdRdv/0AZCVHf6EYSmfA5CJsO7JdbffjzVg1bkOLlRi0g74q502tSXPSGovaf1DVIAlAAGFCFIm1wenbG4gs2E5Np1AauJu+roT/cmy0fyQf9xoUePX2a73HxDw+xdbjdeAYQWqjnDi2XPnUAERoFWwFZHtMWu1Mm6EDTsu8lnuRkLBqiUA64/ApmIKUciIR53iFCtCHer22EcK2QkSAIeV+A4RjSIH54C+DF2RBuqQzQAbb9O3f2sNNh6Tm6stBUra1BIvdDR+ulDWjlhGFX1EIR3kpPrlveVs1NUWLU/K8l16NLICx8iG0sgR5nFGe1um2MR2OO3+bWstFz7pRiFE7khdiYydAbxM8AFsXlRnO0p6PHEt/4OIY7wYFSXtnAO2Igmd8VxAmPO6P4N8E44P1HT8m9DVzGkCmhGM3a8cYDJ51oxZs9Hfrxh2KDPwTU16ZngVy274Eswl8oW1AtaKsRJRyvXah6DuyeELPE7bELGNVWKXOveSnTHYm0r5cAtCci0fkA3Kd6/xnF/AI/UfjEAcTC6YR/xunmkP9LW6voTiL9IhwNa/NPEgtbsPp4J2Ihi2QxV9NYvkrJ4grhh3DiIPAyCqmgTwwR6ELcoL5SMb+1y/DhgU/e+zksJ3MZyNMEqfgqH8WZeUkplo/07wTa+Ov1vQCuqECRtGdxbdgWGBzlQvynXM1KvEws58Zo7Uw3X64gynYhFjwPBEJntvIApZ5hn6bjADh9Xhjuz1DHs3wUa3siwH2YGxl+Cq4IbxhQXnFyWztecipMlP6/+1b1oNE4QlTH/4zwu8MB2SaCx+V5i3AnZbUPVz7FN1kyetbqSOoEdZm5F0mS1VqcR7v1qHhCnXh9ye1BrHKkLOPHBfFLdl8ATZkAA+LHhNMY7c4vrjfnRF8EESeeOs1XRipuQtHmlSEQasD4nfTfkFymmy7EZI/P7I0aBBj6ybWobzmHsRsoqVYOIlLHjOW9wH2HfPo0tR+MTHKFNS4rGANKmcoofPmrfFQ2s/zKFuC8Xo3mZyGabyQcOLTH69inpTV0FLtKQUuok5o6pIVri6DG0tc3vcRHQRfT1kbwHn9M7VG2wW+HHApWlIC6dr2uqM7wOExt1qZyFEHW9ZJp2TA3OYKsDDTKaiid/f3S1dPGx3B/tUyKcSXUlxAp/XE5uJ0gvzktVAc4FBJpR7+pDE4MJxsl/eeYXFryGMKllAm+wjC4mi7zIG3tmj6g6/JZpBtkNb5vRbm5IdkIvNxZATdhhQuSUykMR0JYBw82Vd8t2dk7BnJmJdp3wQOLFTLzwvk+Ip423fA/fgZOTJ0c20lNLuCvlheBfw+5JLU2BQhkoyz9/3aNWCBjg== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 85fbaea5-e512-4b7a-1dc8-08db10749004 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Feb 2023 23:21:42.4309 (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: zPZa0G2r1/tF6qeQFmFhSdG7YYFDNfp8blmzkxJZOJQdSvi/1Hn9sYz1njCyDdO8evdZybbKlfWfEm7d1q2NrQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR04MB7436 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_NONE,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?1758031790769676182?= X-GMAIL-MSGID: =?utf-8?q?1758031790769676182?= To gain access to the larger encapsulating structure which has the type tc_mqprio_qopt_offload, rename just the "qopt" field as "qopt". Signed-off-by: Vladimir Oltean --- drivers/net/ethernet/freescale/enetc/enetc.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/freescale/enetc/enetc.c b/drivers/net/ethernet/freescale/enetc/enetc.c index 2fc712b24d12..e0207b01ddd6 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc.c +++ b/drivers/net/ethernet/freescale/enetc/enetc.c @@ -2644,12 +2644,13 @@ static void enetc_reset_tc_mqprio(struct net_device *ndev) int enetc_setup_tc_mqprio(struct net_device *ndev, void *type_data) { + struct tc_mqprio_qopt_offload *mqprio = type_data; struct enetc_ndev_priv *priv = netdev_priv(ndev); - struct tc_mqprio_qopt *mqprio = type_data; + struct tc_mqprio_qopt *qopt = &mqprio->qopt; struct enetc_hw *hw = &priv->si->hw; int num_stack_tx_queues = 0; - u8 num_tc = mqprio->num_tc; struct enetc_bdr *tx_ring; + u8 num_tc = qopt->num_tc; int offset, count; int err, tc, q; @@ -2663,8 +2664,8 @@ int enetc_setup_tc_mqprio(struct net_device *ndev, void *type_data) return err; for (tc = 0; tc < num_tc; tc++) { - offset = mqprio->offset[tc]; - count = mqprio->count[tc]; + offset = qopt->offset[tc]; + count = qopt->count[tc]; num_stack_tx_queues += count; err = netdev_set_tc_queue(ndev, tc, count, offset); From patchwork Thu Feb 16 23:21:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 58280 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp583161wrn; Thu, 16 Feb 2023 15:23:37 -0800 (PST) X-Google-Smtp-Source: AK7set+hgWfkiVnpJuSip4IUBL3akhDSEcfbWP8flJbitRPN0weDMPVzTtiqNHAZpOyMWjQfuciK X-Received: by 2002:a17:902:f1c5:b0:19b:77a5:2f5d with SMTP id e5-20020a170902f1c500b0019b77a52f5dmr542464plc.13.1676589817248; Thu, 16 Feb 2023 15:23:37 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1676589817; cv=pass; d=google.com; s=arc-20160816; b=N5jeHyPqKMan+O6dIgtd1kOw8INnvjv6RcMYRYOlNGJ5gcyOs491SQrPww4lqq9KgK CRGnx/sz8wLxEr4zt7GEUCcTViy6nJxIJt+C+6jmGJVZq3ZO6GBu4+0PRXcJcQc4SPLl CkzfEh+1sKNFX/713Z7V/ZGJBnhTymJe3c/oFIAVLYgWne/iwyHZZMfnhHKF+zcNa2Jd Ne3V+/j/KFcR6PaBs52Rq/k/DlOvFQ8V2LwegMbHuwRnz1CLpztrbdLmMv3tN2rL2XF0 s/CT4JQRrgHJoqXdcwqsxlAfPIx/9BSRQnRyyy+E0vhjabOQGtcndBqAJ0Xm06cze3Bb KWTQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=+ZfGR5HnJQknXuJLPXQXsF5f0S85/zl/e1YhKUiZDDM=; b=vAzKTjJmgywzEeajLoXDGta3Zop060KhYwoqY4Yq9jlkmHjFLvwcOC1yxO9GAn5ylU hbe1mYsc6nkTtQ/FiQHmar0Y3/bg+aPSVxYNIHUxq7TZUwFTjdlZpRutkcwdcI1s7NXX hEOCPESiBJgbOt4Y1hTsiuLezUuPyaGp8hOdTIiu1QRQ9BHYkWqvJ1M+B37H9G2Q2ZMf PUxKXa8Y/4Oy6KEk3Ze/F1xuytOz8GGDXkzZc/RUEFKB0ICNG1WN9XO+ooF/xFnRmoFL NmN0KK3fE3rys/svSIVanyktt351PYpRC9BnAy2JNLXuo+epxsM+AfHEFDH3pS1mpsvD KZ2w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=OQ6rZoNi; 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 a8-20020a170902ecc800b0019955f57cbdsi3148529plh.441.2023.02.16.15.23.24; Thu, 16 Feb 2023 15:23:37 -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=OQ6rZoNi; 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 S229824AbjBPXVz (ORCPT + 99 others); Thu, 16 Feb 2023 18:21:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229704AbjBPXVr (ORCPT ); Thu, 16 Feb 2023 18:21:47 -0500 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2046.outbound.protection.outlook.com [40.107.104.46]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77C65474DA; Thu, 16 Feb 2023 15:21:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=j9ygkspCVpQqTvLoVIS09wJ30sXaq1apG4OphQ2IQWhW8L3TmW07R/IAMo4uDM5bs/2vMUYwTULAJ+c9AjQR3+VIr+7QzPMgmmrO3mwpNBfdhEe3fEcPv3SaXu46TFbW0v9fOFHNkiHo5xFY23tI09+4BbzeWIjcvygXLL2mkByI+TUeKdfjKEcUn6Pmc6jP0nevknnBK9v4VYNZUM3fVxfI1NPUtgPLrrZPV5+wWPQDzkGoELaLxLfcjnx9N0gia3ZbQqZHmuGd9VU2SZdNrYZC7xmtfBQD0F/g/LKc8hT/l46vSh3fp85r22mvWgDB8YL8TcFfErNgYc4lFofOkQ== 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=+ZfGR5HnJQknXuJLPXQXsF5f0S85/zl/e1YhKUiZDDM=; b=mEYLliYCa56TzNRimjGn9IB+wKHEVVgtG4OMg8o2GNgHvFlRp7qvS/XDb/VBTbLCDBocYfFZIeGMqzKNqOXvLjwEcZTTeYpHo8kVpgahP8BqdjOSbHeEhnkSgZtrhCZ8sTtFOF1t5+WGkct3q3MhnuOYXwLd0sWgnZ+rDdyHieVJn4rdkAQuneOcNZnFUYwfpwP3cZB5wjTv9bGbqF6xp6bHMCXVvwqjQDzsVXp2hguoz2tv6sCic4HjuoUWayU/PzXwxr9xK0ltvA4u27kX1sABsSYvl49ovz26wcJPUyHwt8C5JJzKFVQjMlDJF1s9mUbUnlikdraTklVpqoyHLw== 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=+ZfGR5HnJQknXuJLPXQXsF5f0S85/zl/e1YhKUiZDDM=; b=OQ6rZoNirx0Iq4Ks9bKRddzSkrifn4VIN94W6urUvfmGTQjrRaV/Q+O4AvWxSSftAXLh8CZIdaSE2r9LFptq3eGQGhgj1KQu1zD/kOFwsEkB0Ipq5HJmJ4gwcP8tJhcV9HPhXBM9mkZY592DDV6N1+1odfWT+jfl0rogAaa7M6I= 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 PR3PR04MB7436.eurprd04.prod.outlook.com (2603:10a6:102:87::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.26; Thu, 16 Feb 2023 23:21:43 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::3cfb:3ae7:1686:a68b]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::3cfb:3ae7:1686:a68b%4]) with mapi id 15.20.6086.026; Thu, 16 Feb 2023 23:21:43 +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 , linux-kernel@vger.kernel.org Subject: [PATCH net-next 02/12] net: mscc: ocelot: add support for mqprio offload Date: Fri, 17 Feb 2023 01:21:16 +0200 Message-Id: <20230216232126.3402975-3-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230216232126.3402975-1-vladimir.oltean@nxp.com> References: <20230216232126.3402975-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: VI1PR0501CA0018.eurprd05.prod.outlook.com (2603:10a6:800:92::28) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5136:EE_|PR3PR04MB7436:EE_ X-MS-Office365-Filtering-Correlation-Id: fa3b7664-03be-419a-eae0-08db107490b6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FzrY8w/pzbvGErFo98Y8jrq3IgTQFvzmAKXFaNjE+mMURbhL7NmZwjIboKkGlSc/DFDMyzjHGADA1yh1c2c9EmA/ANu9p4sBdB0jqgF4cw1XBgNDfKyxYoHcH6/u+PDJi87LbCay9GVUg0eyJxsahxXm8MmSg873BCajVPxpgdaFece/Fj70ukYunSSrAKI33Z/wsVz76gDx5+yTJOeziP/2SKJZSWW1GuBNU2b7AhwzStutA0v188+2G5+z7sJDrQ8Lw53KrTmzeIyJugEjFCDbEeO4Gf0/wBBSYr7CXHXPg50Pl/emIM+X5PVrC98Luflw59qlTfmut87bHDTiB6dkcoudA89Y17KWdBl17a2AQp2EboeQ3Tj/WqjxGVthqnedhh3r4YXe48M2qhfhgtl4H0wjEluIbBlH5XNSneT4Wz/vmP7eUbma3AqXHjugOuk2L59pNZ6iQJmCgouOa6h3dsRkAWKqS06ewfyE9zkZ9p1VbBDAIjcs1wi5G4A5gdg+BzfAnLQhO2FCJHdWgbnyMHAPq+o/dMOeiHJ+UbJEYB2y/jy/I7056+UBjqOYBbPMMZWtM3CUQke7gexjHDn5NLJQEmd5z/mVSD9yn7WDc67doOlIW9IWDq7gRIfwBw8bG2t5pKwxY5a8sstB84JaohnNtDkCkZqsZqF9p2Xx8LT35gaXmWgUvPVVLfCWGd/VmlZYjnb/Ub8nVl64cg== 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)(376002)(366004)(396003)(136003)(39860400002)(346002)(451199018)(38100700002)(2906002)(38350700002)(44832011)(7416002)(83380400001)(66476007)(2616005)(86362001)(478600001)(6916009)(66556008)(36756003)(5660300002)(41300700001)(6506007)(52116002)(6666004)(4326008)(66946007)(6486002)(54906003)(186003)(316002)(8936002)(26005)(6512007)(1076003)(8676002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: vjtxKUDrDhMK+GOHDxFl5m+9H0oEo6ETw2Tl5Ra5HWv7EXbw4k0FZZPevuD95m617XCFIeNGbXFXdeSHdqL7E86DAeAK2AYSgeVEArNqR4W4fNclI3/e7r1HO0UuPCbDx3NIwSA59UKlYztl4zBou4rFu5UIXipULsQuUOxBtXc2vnU7/ewa4LzOqJViZIUyOTgyWNm+wAHKCvG7hC5uWqPf3qGo4zVI+tE8uu+GpbEsZlILCXi+A/4427Te7Uitzjix1Z271IKlERdpX0No/jm2ou4ZyuoWJky1bGO5pYj+i30AJxLFSU3/C+arne1GhL44MI9o3pAU3kAqmcrz55XsATfZWNe9LAFKE+OY/fk1CRlwZ2QERi4YF7iFThw86vYu5+ujtRyWqVs/AR3w/eeqw81YoqC1LefNvZ255Tim3UqHWxTbg2/1eA+P5N5ZOBc4hjcI+n0NidQ4MULxnXye+LjW3AD2+lg4m803dTFaui56Z0xWb9kfDAhq46umYUcoe5qrbnTEK/J7Nr+GJ2msTop3dQIsnHrd5d+dAB2tg4613z3GsA8q+DcVDePbB7rxLSYrwDg/q1NS44pl+9q3WWyo5yMHHjeDWlw//LxQgC7uQ57UN5yAf9wT3kQXD1cH0U4OKJU0QNqZzBcu9ABIoLby64vB+bKeyNXs0LE3PWKgaTfbX0kJPAkEGxDOWa6z7jIvT+FrZLifMWa7Q3B1/butiHzw2+AodGkNUowKqISK40sE5WHzxTyZRhfOzwT7gMPYpuwczpcAQv/hwTAeUfblPlYc2WJ1R+SfMky9iRCMkImYu2wGQ/UffnijifcLYWs2WRLfua6G0F+/Fl45TblKDRaTIimDtCnAVqhaJQF4A6wcYad7Oiq14+oWiXkxQZUo/r1YUMvxx7WxUkSvEooeXIIYZEP3YO1E4ah3sY/sn0ovhcy9Vkb/psw2qfD/5XJ0UzLSF9gofMaTFSMRlFK7Uaf0JPw2bOd7q8baiCbA/u5hN8Hoo0gWACvicpGnKjyUVIIdDokXZOoF3I3YJ7w4AQ6rDfSdaXXGqB2cKP4v8xGX0BMgeTg0cxI3KiC70P82/KXcLGYUOPY13C6r6HPfCE7B2oVqCVhq30772ZxwBfXy5RpGgzOPzgcSjjTuUyaRYjwYcg8K0Nanb2clqLXFkAHZdWjRwqq7EtScTe+j3jZL1fnowK4tJJ9GjVUcphpZMIYkwdv96Fl9G8heZfCCJVDd6PnJOX7s8Z6Ai+8JLbHuoddFl/ejGMqeF6slNMZwX7jMojxf475lf82i78mz1b4J0EY+PMy/dPFNLAgsfN5u0PNGu/plWVHsaZNXTP7koj4gueSDwZOoxnTtMCXPTlOi9SclJd+CWra/3KZ64reuo5kxlfPRzK3d/94ocK9FF7sRXxLrkecDHci5zFjt1bgK2Muz8glBK5K+pUxyGyGvz+t8zEEqDLbUlQaxs96vPBFbp2oy67CCUWoUwcjrksNokE+EgvlpesLFoCyJ5u8ewJUWV2PaMNz5vZJ1KZ4IdOyyqx1HW5dKo2G0uZmHV1tc7Hr8N0hY6qWDyW0NZltCrPkg4o7fUeJtzGjrnSPhd+N0NeJtKfsQLQ== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: fa3b7664-03be-419a-eae0-08db107490b6 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Feb 2023 23:21:43.4777 (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: +vm7z3pB+nDBMPwXcl/cHoW81pEZNWk8nKJn0CwwjNU58shUwnUc3cunreGr6xkBM2FlpA/caX9qdkkTBsbwnQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR04MB7436 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_NONE,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?1758031843866015271?= X-GMAIL-MSGID: =?utf-8?q?1758031843866015271?= This doesn't apply anything to hardware and in general doesn't do anything that the software variant doesn't do, except for checking that there isn't more than 1 TXQ per TC (TXQs for a DSA switch are a dubious concept anyway). The reason we add this is to be able to parse one more field added to struct tc_mqprio_qopt_offload, namely preemptible_tcs. Signed-off-by: Vladimir Oltean --- drivers/net/dsa/ocelot/felix_vsc9959.c | 9 +++++ drivers/net/ethernet/mscc/ocelot.c | 48 ++++++++++++++++++++++++++ include/soc/mscc/ocelot.h | 4 +++ 3 files changed, 61 insertions(+) diff --git a/drivers/net/dsa/ocelot/felix_vsc9959.c b/drivers/net/dsa/ocelot/felix_vsc9959.c index 354aa3dbfde7..3df71444dde1 100644 --- a/drivers/net/dsa/ocelot/felix_vsc9959.c +++ b/drivers/net/dsa/ocelot/felix_vsc9959.c @@ -1612,6 +1612,13 @@ static int vsc9959_qos_port_cbs_set(struct dsa_switch *ds, int port, static int vsc9959_qos_query_caps(struct tc_query_caps_base *base) { switch (base->type) { + case TC_SETUP_QDISC_MQPRIO: { + struct tc_mqprio_caps *caps = base->caps; + + caps->validate_queue_counts = true; + + return 0; + } case TC_SETUP_QDISC_TAPRIO: { struct tc_taprio_caps *caps = base->caps; @@ -1635,6 +1642,8 @@ static int vsc9959_port_setup_tc(struct dsa_switch *ds, int port, return vsc9959_qos_query_caps(type_data); case TC_SETUP_QDISC_TAPRIO: return vsc9959_qos_port_tas_set(ocelot, port, type_data); + case TC_SETUP_QDISC_MQPRIO: + return ocelot_port_mqprio(ocelot, port, type_data); case TC_SETUP_QDISC_CBS: return vsc9959_qos_port_cbs_set(ds, port, type_data); default: diff --git a/drivers/net/ethernet/mscc/ocelot.c b/drivers/net/ethernet/mscc/ocelot.c index 08acb7b89086..20557a9c46e6 100644 --- a/drivers/net/ethernet/mscc/ocelot.c +++ b/drivers/net/ethernet/mscc/ocelot.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include "ocelot.h" #include "ocelot_vcap.h" @@ -2602,6 +2603,53 @@ void ocelot_port_mirror_del(struct ocelot *ocelot, int from, bool ingress) } EXPORT_SYMBOL_GPL(ocelot_port_mirror_del); +static void ocelot_port_reset_mqprio(struct ocelot *ocelot, int port) +{ + struct net_device *dev = ocelot->ops->port_to_netdev(ocelot, port); + + netdev_reset_tc(dev); +} + +int ocelot_port_mqprio(struct ocelot *ocelot, int port, + struct tc_mqprio_qopt_offload *mqprio) +{ + struct net_device *dev = ocelot->ops->port_to_netdev(ocelot, port); + struct tc_mqprio_qopt *qopt = &mqprio->qopt; + int num_tc = qopt->num_tc; + int tc, err; + + if (!num_tc) { + ocelot_port_reset_mqprio(ocelot, port); + return 0; + } + + err = netdev_set_num_tc(dev, num_tc); + if (err) + return err; + + for (tc = 0; tc < num_tc; tc++) { + if (qopt->count[tc] != 1) { + netdev_err(dev, "Only one TXQ per TC supported\n"); + return -EINVAL; + } + + err = netdev_set_tc_queue(dev, tc, 1, qopt->offset[tc]); + if (err) + goto err_reset_tc; + } + + err = netif_set_real_num_tx_queues(dev, num_tc); + if (err) + goto err_reset_tc; + + return 0; + +err_reset_tc: + ocelot_port_reset_mqprio(ocelot, port); + return err; +} +EXPORT_SYMBOL_GPL(ocelot_port_mqprio); + void ocelot_init_port(struct ocelot *ocelot, int port) { struct ocelot_port *ocelot_port = ocelot->ports[port]; diff --git a/include/soc/mscc/ocelot.h b/include/soc/mscc/ocelot.h index 2080879e4134..27ff770a6c53 100644 --- a/include/soc/mscc/ocelot.h +++ b/include/soc/mscc/ocelot.h @@ -11,6 +11,8 @@ #include #include +struct tc_mqprio_qopt_offload; + /* Port Group IDs (PGID) are masks of destination ports. * * For L2 forwarding, the switch performs 3 lookups in the PGID table for each @@ -1145,6 +1147,8 @@ int ocelot_port_set_mm(struct ocelot *ocelot, int port, struct netlink_ext_ack *extack); int ocelot_port_get_mm(struct ocelot *ocelot, int port, struct ethtool_mm_state *state); +int ocelot_port_mqprio(struct ocelot *ocelot, int port, + struct tc_mqprio_qopt_offload *mqprio); #if IS_ENABLED(CONFIG_BRIDGE_MRP) int ocelot_mrp_add(struct ocelot *ocelot, int port, From patchwork Thu Feb 16 23:21:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 58276 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp582851wrn; Thu, 16 Feb 2023 15:22:52 -0800 (PST) X-Google-Smtp-Source: AK7set9/iuTE6CI5lj/DVRZ90RacXMPJq2DH0J7yWH1tgXQCFhTNBK0jdJ57kPtsvmmyQXlgZnwV X-Received: by 2002:a05:6a20:a10d:b0:a5:df86:f0e1 with SMTP id q13-20020a056a20a10d00b000a5df86f0e1mr3591026pzk.16.1676589772116; Thu, 16 Feb 2023 15:22:52 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1676589772; cv=pass; d=google.com; s=arc-20160816; b=ioeKohVF0Zn4R9VmWl9xpGkEMTrTSB9OYcxP2wosuinQ9zAc1z1eBZPe5hEx18nWOn pFtFA+uv9n+RqYEfOaxuKTPwMQDZAJcLvv2EfnuGpc4RRpoZbVmQ9G3Yjc0x7DZvf+rV 2r5nNQ7QR465Ax1o6Ofb+XE8Que+nulWgoiBskWVSLoB3JJhQSG26u7RHEJ/luSMMGsH J5Fhczstj18IGVp0vmim1+CvUQQDc6LfCcte/OtkTKTO5vFMQA0HdiVsy+JqgL0OU76P tBReUndW9JoGAk/IqGjnWn4H2M7uYlcOVQw8W70uQ8ihbtTRx1pPicImLIH/9c0icMsb Tq+A== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ua7VzKZotSf/owtZxk1sEG9iE3xyW+WtDobxxo6yEls=; b=pKXJaCn779vHZOPSxMXDdC/8NbXwvWTuba9Uk1QddX8Yth8CZTTkrZZj2PzGlOfWdz knaO/OGILm97Tu4T1prVESnYV/METw0NNl4Q02tWSsjX7VUdJomvtNc3FaMW5JSSoHU0 9m4TWfv/vkec1C5R5Yw4JXWAfKF7oB6KCgLFxUgiuilgBi/IxnifXOfOhJmLNAC+e6nZ FMA0P/FVZTZ49oYyyMnoHcaIo45WLho9cRIQYcgVUZlBwTds4zOZbKmUsN7eryUm8pUO 9/fb2pU3FeoxSVO2EVxNaG0Hd7GZBlBcA/1xouORU0nLX6stcJ7zDUeKg0hxCuzhPUGi Ro+Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=nCza2ZG5; 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 b1-20020a056a00114100b005a7f87d1466si3083122pfm.359.2023.02.16.15.22.39; Thu, 16 Feb 2023 15:22:52 -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=nCza2ZG5; 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 S229886AbjBPXV7 (ORCPT + 99 others); Thu, 16 Feb 2023 18:21:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229448AbjBPXVs (ORCPT ); Thu, 16 Feb 2023 18:21:48 -0500 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2046.outbound.protection.outlook.com [40.107.104.46]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C53084C3C3; Thu, 16 Feb 2023 15:21:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mQdg4ZLibWIAjh/JFklBEbrulErK5/3ubktNJpJZPqReRY7Aw4LCSdn/E6rziZ/JmZc+pXugbgVvyUhDp/nr/ytYgqs4meCW6r+aI7TeLhZOtM0fhc613eEcHGRQ/6Fsi4roSpPp4sl9XjMo4n2Reg+mas3U2fBHfnxVLGsO6FNL2YlEP5qlGPXwuDXTK2alKXPmulxZ/bIInHpcbTgiKjpIfOHTZkoOvet+xFWZ+0D0jZ6wDeCX+wvw3d0mc/Gv9SmQ0Oj43g0F1arZBfFvzlY05awM9zRDV7zWe2NfrLeIC1kpPP3UFNIJ0gK0iQQVGzQgfXZtMuJgivxUyiWYsw== 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=ua7VzKZotSf/owtZxk1sEG9iE3xyW+WtDobxxo6yEls=; b=im3adpWbRi7vrSseeV0ERKY7EznTIA55vbel98D34DRl+sp52wqMWD6GSA15EHc594bMxndivx9N5v94+RPduUvy1vYWsEzqQtthVsWxmrAbMiM4TJXADt0borUPA6ZW76LcqsWErIGREqqNcac/1oQp+wrQVTWGLznlRRMEfQRA78baBcNoen03Wg1aSMw+kWjSW9RxZj7KaXRUtxKsjzUdta5VKP8fa0mMDYIUtuXX67hiDsJK3ejnOQ/RUUsfTlVnqknGjmYSpXwydFQhRKBaIfh2gv5jtfUHE56qxL1ROtm8ysbz/O4lf+40I2Cqya1u5AauG2ZRUhDR1lnnlg== 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=ua7VzKZotSf/owtZxk1sEG9iE3xyW+WtDobxxo6yEls=; b=nCza2ZG5+Z7r1r3qgP3zQjaQrxQSSMC8T7yamXlGmSk/dOQzZKrjnHCNVG80eCzSbpObAZ88F6pKDmF4gIoWLCLDH4gr/GxsoUcLcRXodsF5odwrO/5257CgqyXQcJKXsDjMGGHFCPFKnuAtJj4ExD8H7QueLqU9cdfERKvmIfc= 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 PR3PR04MB7436.eurprd04.prod.outlook.com (2603:10a6:102:87::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.26; Thu, 16 Feb 2023 23:21:44 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::3cfb:3ae7:1686:a68b]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::3cfb:3ae7:1686:a68b%4]) with mapi id 15.20.6086.026; Thu, 16 Feb 2023 23:21:44 +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 , linux-kernel@vger.kernel.org Subject: [PATCH net-next 03/12] net: dsa: felix: act upon the mqprio qopt in taprio offload Date: Fri, 17 Feb 2023 01:21:17 +0200 Message-Id: <20230216232126.3402975-4-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230216232126.3402975-1-vladimir.oltean@nxp.com> References: <20230216232126.3402975-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: VI1PR0501CA0018.eurprd05.prod.outlook.com (2603:10a6:800:92::28) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5136:EE_|PR3PR04MB7436:EE_ X-MS-Office365-Filtering-Correlation-Id: 73668702-de3d-4bea-ba0a-08db1074914a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NRF7gsJ0f4QZhyRnqoFhumqvg6vs+kcgug1DGKdISc+Q7Aur+INe3B7wFgBxply+picEsMZlSBiPTbq8pSMk+VYmUscjxXFUsLyAQZn27YNQ16LQ1GeNfmYhhSOnGYRu/rWo8PNjhdm1eQBXyGhnrqDDsSD5cdm+hCPMTJ2//e/bvHlLhPP2K5JS4Ro66YwvKEM/cxQid6lXEeWKqjIGXSDg1z6RNcBn1kEinPBCCzSWO2L1F+FX/PYuCtKzTYOIYetjVcliOm8p40SZri7WxAKM1SwzexMZ0bxoYXbQ64qIIPCVU7rG1rQtIM/hngIJ0Z7MybjukmAChabJGKnPISD92iDOYm1ocx5rEvZl/sC6tXVlL1cIV3d7vb9t3GrAPOdTwZfCR+nB3ZTpLVZDYPN3v8oBljg5gZw5dAs5nGyqAa+iaiXTqXbnRtbAjItpLvJGsUXbIEevxOKkzcur9Wgl7QljNM3E4Yisiv0Ns7Pqs0V7MafbAjOvVrGxrz8I61Hnxt+p775tL+QH2bKC4//3RTaRbkKG5wPW++uCcN2GxqSqkucgHsABt+wyRbIgFthgRchC46LOY4bp1l9M+6fwXQVA4UGz/m8nfF8M5lLsczWXBekzZ76sfAG6UqYI02EarKv3FfG68S63oXbErUEQn84sTGV4W9mLp+S3KcXMH5YIygccQiDXsQsxfR0NcUzqPfytWOP3r2D7YwVrVA== 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)(376002)(366004)(396003)(136003)(39860400002)(346002)(451199018)(38100700002)(2906002)(38350700002)(44832011)(7416002)(83380400001)(66476007)(2616005)(86362001)(478600001)(6916009)(66556008)(36756003)(5660300002)(41300700001)(6506007)(52116002)(6666004)(4326008)(66946007)(6486002)(54906003)(186003)(316002)(8936002)(26005)(6512007)(1076003)(8676002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Nw0J4Rg/0mej833mXSH5E71g9eII64ZiKwLa5SnFT0ZKvtQPGDj/L08UrS2QRXHLN+p54QwyA57atTHa1vxm95CSGbTQFASwLu3U4l72ZpoqGy6bsMBK/PK3jS3yZbPlRWEUz8BiMdztX4/jfAtHLfI64V7EEjD1z1qTYt8u0LJLUpD+Hoyd7T5Jlq6Je/UxHErOr8e8gteT2QabmIs5SuOix1c42ssLYokKAhpfwtQb9MY2FQOQ5n/jYBJNSdUZnZ+pcTNv7B+Bw+QZ1fPlH+5XBiEKbcD+j780eY1cR4frkQSF+QUxOus0qAEvUKwmkckqUMfua0b2/SOSZnipTMpyoc4znCYOtsNbkHVqKxOkGRRP7b2XPQ356h4D/gq6OGlQ0thlws9Os16t8ZdvPHF2IrJAjDFqrakBIQx101c3BjRQ2S9TcJewFNKGXJ7BD1OenSU8m4wgucHMG8Kc+MoSj0YU0Hv9eZ+Np8zqyJ5DO/DN6isfE3LcEaycfy+/4Om5m/uxlJGd3BLq7dK3rtThSqvWEpRjV08ja3CrmUesy7gSc3kFCXEGXmtdT1eGqBElrsw4ffMe4dLrzG9eCs0J3IbUMBOtnVSUo9Pp8vBgVBN8z45p7N/hUpKkK0FfGzt/T0VHKbNXE1ijskZ+4AL6amvzyUgaDMdTYtG0CPHeJ90ou5rFePXlBdVicRbv1yfgbR3C5kpmFtTTsM3t4s0411bA+IAu74g1laalVy2ojBGP280PCLH3VR3ZvKoJPHkdyL3pMgNTEGkGltkFwQFO5sF2ECTlpgLqB2CfEQq1p8Tw4N2oAl31ZVUkM04A4C0xLdnlRNjPDFJUJuDfcgiYdsIBSamOtHaZin3jGV/9cZHKIyue+WHPMSzKExl8SnL+/x8X/boYwsa/jlfxoiQj5w0idmihAYzzf/qaG1qRlzW+c+xPd8vA0E2HU6NPIh/hl8joG3lM60HmjqjvWBmIg6yvyYjMazr5jGs9VOymwiyzQyruuQY4U3wIeP22W758N6H7KXml6xuYFCNbm2RrvK8tGyp77JaYZzhUQPB7c83EhoJUWI/m7mQ/4+S1IFLcftYf8wU8+0GTZ5NFZ2vLzkY6oPgRNrILilNy6qeZqZDiYFe9mx+QC73Mq+2d4ULqFGMS89g7JL09GAK1Wq2PwGEAo4q3HKuMS0648JNqyp88H1FoNgEdaevKdvaHAKwKS28vbFHZmiemAJILQkP6be8L+y5itZSpwVqLVPsLeH79WjiidramWjrYM4YMAKv5B1IQ5a2rpgz0hZ9yicMAt7NLKzWm119UdnmMXQQUo55pU4U9Hk1ES8PCWbpwfrCrMDXcnX69XnNmQGerLBnJWFdgY6IPQ583AVBf1N9YqSC2u1qHoLH/ezP0IDVUrSMYmXGG330oIN/1ZCMT3nri0YS8AjrkRxYvenWAtnt+keCMQM+EtpyitY42+GmwGzPiUIcMxoQ9eytAlZs3G+Qdgk+w2l9OGU62DSYnl4efCq/KTucfwhrQkOJQd9/hGxLAOTQTapkHBz4Vq03GSQvJxr04KPkKJFZkbTpkMnQvCpmma7OTcUEFgKtOdFSB6vGirPQAvli+Gjh1yxMhvA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 73668702-de3d-4bea-ba0a-08db1074914a X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Feb 2023 23:21:44.4620 (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: cU72zsQ/Zmr3TCVdomaH1vOofvw8W7kpqCoEFR00lzPgXfoJ6Qmfi6lDmlINKZSKdciqevnibbfMFEpmxb/Zew== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR04MB7436 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_NONE,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?1758031796533901546?= X-GMAIL-MSGID: =?utf-8?q?1758031796533901546?= The mqprio queue configuration can appear either through TC_SETUP_QDISC_MQPRIO or through TC_SETUP_QDISC_TAPRIO. Make sure both are treated in the same way. Code does nothing new for now. Signed-off-by: Vladimir Oltean --- drivers/net/dsa/ocelot/felix_vsc9959.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/drivers/net/dsa/ocelot/felix_vsc9959.c b/drivers/net/dsa/ocelot/felix_vsc9959.c index 3df71444dde1..81fcdccacd8b 100644 --- a/drivers/net/dsa/ocelot/felix_vsc9959.c +++ b/drivers/net/dsa/ocelot/felix_vsc9959.c @@ -1424,6 +1424,7 @@ static int vsc9959_qos_port_tas_set(struct ocelot *ocelot, int port, mutex_lock(&ocelot->tas_lock); if (!taprio->enable) { + ocelot_port_mqprio(ocelot, port, &taprio->mqprio); ocelot_rmw_rix(ocelot, 0, QSYS_TAG_CONFIG_ENABLE, QSYS_TAG_CONFIG, port); @@ -1436,15 +1437,19 @@ static int vsc9959_qos_port_tas_set(struct ocelot *ocelot, int port, return 0; } + ret = ocelot_port_mqprio(ocelot, port, &taprio->mqprio); + if (ret) + goto err_unlock; + if (taprio->cycle_time > NSEC_PER_SEC || taprio->cycle_time_extension >= NSEC_PER_SEC) { ret = -EINVAL; - goto err; + goto err_reset_tc; } if (taprio->num_entries > VSC9959_TAS_GCL_ENTRY_MAX) { ret = -ERANGE; - goto err; + goto err_reset_tc; } /* Enable guard band. The switch will schedule frames without taking @@ -1468,7 +1473,7 @@ static int vsc9959_qos_port_tas_set(struct ocelot *ocelot, int port, val = ocelot_read(ocelot, QSYS_PARAM_STATUS_REG_8); if (val & QSYS_PARAM_STATUS_REG_8_CONFIG_PENDING) { ret = -EBUSY; - goto err; + goto err_reset_tc; } ocelot_rmw_rix(ocelot, @@ -1503,12 +1508,19 @@ static int vsc9959_qos_port_tas_set(struct ocelot *ocelot, int port, !(val & QSYS_TAS_PARAM_CFG_CTRL_CONFIG_CHANGE), 10, 100000); if (ret) - goto err; + goto err_reset_tc; ocelot_port->taprio = taprio_offload_get(taprio); vsc9959_tas_guard_bands_update(ocelot, port); -err: + mutex_unlock(&ocelot->tas_lock); + + return 0; + +err_reset_tc: + taprio->mqprio.qopt.num_tc = 0; + ocelot_port_mqprio(ocelot, port, &taprio->mqprio); +err_unlock: mutex_unlock(&ocelot->tas_lock); return ret; From patchwork Thu Feb 16 23:21:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 58282 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp583194wrn; Thu, 16 Feb 2023 15:23:43 -0800 (PST) X-Google-Smtp-Source: AK7set/AochrZzIM0y/n6XNKKIPkCjwATz58kiq+OBTCi3Fxh0FFj0gE2hSefuPjOhT+vXMTMsuj X-Received: by 2002:a05:6a20:12d4:b0:c7:4d95:276e with SMTP id v20-20020a056a2012d400b000c74d95276emr2475785pzg.60.1676589823649; Thu, 16 Feb 2023 15:23:43 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1676589823; cv=pass; d=google.com; s=arc-20160816; b=icbs/dMGfDlCS6sDksybBCC+29oDY4sdew55YrtTGL0e0rZegYQi3FlY/FGuixs2D3 QoHdSsPbQoH+VLRkN9od9LgBnQGhCCeCGYSkeIuItQShVNcuiuFbvjucYCLvAXqiMP3S w48+59mSSDTY98ATCAzedEkjzlUrYXXLDskJ+OwNbC8hz074DpQGUW5YWKvhBTK+oRx9 QcUD50y1HxqyqCoVSW6+ncCb9UQBUBB1Fqyc4bfHana7FOySTmekcRzvvZAhSIOXidhX Di4+UUx4URpe2q2MqSiWlhGED1HlWJJtVZdwWDImwJnO42TaR64yPX1IIiDmQTW8cXnf IIuA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=141wq/zDW3i/p2w4llBv4/GzapNf8wupXTTUdv63uK4=; b=ln2C4m23Uf2YXq8NjDIwwvexe/fjcAE4cfhJW68Rk+tRS7OkQGZAdSQ9ewxAt9SjSK 2YG274LsrIqw/j//3sea0411MAMXPIjOAiQFrRLHEzGdvFmsJovbVsjTOBOEHbmvxJss VuuULrHZ5y3/58uodwQF/zX2MFAazoUtoj5lOlWFvTMAYFiAKB5NUmhLr4oBKQyZeabX EnhYokjWuM7LQ5PwZ9Yo+BwEmVgcxZHnx6eNE6XjfcOEvfS0CUtRHpSU5q5OvIqJvCA5 7yKoyEsVwTaWMkDa3t2/3Xci3AQacVBfVSCpyOFnmdjbUVh40oV1MIVDLaglhfsIlnmr 4U3A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=N9QLubz0; 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 p3-20020a63c143000000b004fbfd0c7037si2789424pgi.461.2023.02.16.15.23.31; Thu, 16 Feb 2023 15:23:43 -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=N9QLubz0; 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 S229905AbjBPXWE (ORCPT + 99 others); Thu, 16 Feb 2023 18:22:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229802AbjBPXVu (ORCPT ); Thu, 16 Feb 2023 18:21:50 -0500 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2046.outbound.protection.outlook.com [40.107.104.46]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A20F52CDE; Thu, 16 Feb 2023 15:21:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RPf5EoEtSQNuladMyIBV2oEH0JK7CFcMbnzTtQbYXKITCDnJEcZN8vnn5kljb1FC48Jm2YMn5PEs4K3YqAJGfyKbghbJyiYKSHLPLQ1zHg8sVo3MFuSj/Pf4+alCAfVN7ncKY8cP90fXa7DwO2hCDWHr7uv2S9FHct5jLa6mAMNTXjmy9LiohkbMR4Dbq2r6LWTaFp14E+cznHWan3uWIDHVsP1Wn86AhDbVhtx+YSPpoVN0B1aaXdnIJwnF3W5xM6N5yIIIq36mGsCYcRemDfwsvFxroaCGXWFT/HL2bpFtivAobgq8O/FUeXRdotOWTd146PKV1+DVQKTyJFOcvg== 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=141wq/zDW3i/p2w4llBv4/GzapNf8wupXTTUdv63uK4=; b=AikfUcg3xfd2xTCFJOPnAJj3GlHUjHwFA4OOU9+KmqzEOol0DnuRyIbjzfxY5urtjTy7R6btT1x2VJ/ZJZJsg83gT/94FQYe/sRGtbmwf9gxxNtyP9FjQDbJaOLSRNCA9piS3TYDM3BavCQ4Obld1PMiximvYVa0x9zOi+7k3nzlUW2vf6MYt0Ay7b4mwZMmFBM93Wnn46aHPVzjPj2Tv7u/Znxl37oScSjCwvspOYfmaCbNlQLoRofiA/XLTiQwmrK50jdqSXSSBGMX+nP9UotHULX8SB+eAIDZ5z4gRITe/JZ/7r/kG0zWwsNeCpfFU4hk0CtKNjuH9GtUpXkW1w== 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=141wq/zDW3i/p2w4llBv4/GzapNf8wupXTTUdv63uK4=; b=N9QLubz0iFo5Bcg6Ih+EfYLaPkNYyf1/vrdI0vPs282SaM8UOaEdOjZVa5qKqcI4zHxcMquUm9j68j3lMqTV0CVMsKTz2iOWCx0J5D9caIk+Ov5/Op+tSaMew/BBpP+y7ps3V5imUR/fukpw3Itt44jJsF7cLOGlGZTzFKigy0E= 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 PR3PR04MB7436.eurprd04.prod.outlook.com (2603:10a6:102:87::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.26; Thu, 16 Feb 2023 23:21:45 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::3cfb:3ae7:1686:a68b]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::3cfb:3ae7:1686:a68b%4]) with mapi id 15.20.6086.026; Thu, 16 Feb 2023 23:21:45 +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 , linux-kernel@vger.kernel.org Subject: [PATCH net-next 04/12] net: ethtool: fix __ethtool_dev_mm_supported() implementation Date: Fri, 17 Feb 2023 01:21:18 +0200 Message-Id: <20230216232126.3402975-5-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230216232126.3402975-1-vladimir.oltean@nxp.com> References: <20230216232126.3402975-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: VI1PR0501CA0018.eurprd05.prod.outlook.com (2603:10a6:800:92::28) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5136:EE_|PR3PR04MB7436:EE_ X-MS-Office365-Filtering-Correlation-Id: bf211a17-582e-4b54-1267-08db107491e8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dwVGus31ktGIs3FnlHjKyfxkv0+87hTnQvFIotv8tHLy+2/GhByAigpVvzTRy6YufycW95ufggrZIKNP32oAhRc3+4Pkry6hdD1GcY1sbnSRr1fI6XiQUdn+hEJw1qZX5rAmk86ynPtux4ZuWhThamGwvJGcF7w54DU9tsFTR8T0WKDbqOatHlgJ72uxvLmSQaziclONtyOgSaEU1wFG4WIaQ1Vk1cDO4lDie2RLGbl6QBMeF8S7W5jYPYyuLgfHbXkMSjfhS6F491r05IMYTB35F//CL5WeNjFf9Wh0/G4KFRWvrhr80gSEeEqU5KUcDBN4D3QUcjvn78fdiGtHWwPAOpaDAx5zhF8Hw/XXo+aBs6fntnZ2yXRUGBN2AtAH7q7Jdp/xbK+HxecPu31aQShcKyMLpcALrSehi0BPEUi3Z24nET1P+v6h46luRwld02hva4iZwZyAKBl3kBVs3Jsc+4N1TQwC+BcxWKTtSL6KQOH3E/EmP66kratDzQGhD/+yXVWx5cTg+81MJ04CUstL2rgjWQO1+ZTjDsb+rxBLzYctp/p+wwzNm8rOI43PI/Qajh9voyC+4obSRLiNaYgkDpNAXPxT1QdZ1RXd6nDXUnaFZS7O9oAmiaqThvts+qOIoJxTpNuy3ZRN5x1CJWs1KIzG+8PtTUJO1bbyHJVPpgSKpDoWLjfxw2ug5+3NyRrNmyAZYckdstyDdaUccg== 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)(376002)(366004)(396003)(136003)(39860400002)(346002)(451199018)(38100700002)(2906002)(38350700002)(44832011)(7416002)(4744005)(83380400001)(66476007)(2616005)(966005)(86362001)(478600001)(6916009)(66556008)(36756003)(5660300002)(41300700001)(6506007)(52116002)(6666004)(4326008)(66946007)(6486002)(54906003)(186003)(316002)(8936002)(26005)(6512007)(1076003)(8676002)(309714004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: q5GKpGFej0wUG0BKBx/0Pt4RjxHg4371mzAzY/igz5FEJMMlFOs1K4rVrs5w8N2O01+pgVi3qMblXoUPTr9RURB24z7ibta0Lb2XbgmcBWqayhefiKqueeVyAOCF0SDXqZfmCJiphiWBHrVfy4fALZgegobRxrjapzt0rruihN2sBxt7+DMQ1N7OmPKz2Yi6asdTuFaJl9LS+nJPi7LFh2W2hBWDcOvJW5eM8vjlPoun/u/OLin2uZ9Vm242hjHPguZXAfivvMyhrz6kYZ/DgR93ALMxcqdU8f3WPSI4Oeu/CLAgc1Ddx1xk6b48bqDXsQRq4UqryV3WEceCuHN5tQlub7mHwcA6dfek1x1mtNpsr5oQrij5IC5nwp/qvZcLoN83JBvrKU696LTW2c1MH9JCUMbZ5EzGbWBlgUD2JJE+TaF8hVNJ5I2Bw2jlEd1wVhyfHX61XXESDJ9OuKKTvHp6zTQCV0MWvY1xUg50f1KrByckbAs+PIaVkj6QurqP1hYWdTuWnMW5Lg390+I+LqsWcwcSMAlFwcUT0nsqXSZXr0OaEDQpd52M/kM/GkEF5WX4dT+i08L+vE4uJNDGg0Ne7Vea+EmA8uk2r+m+yLwMEqzZ9qOqr8PW0XfnPsxNT9vlKKfz+f5ncmlN0aZ7P6mJcyxxoWS2CydhW2OBc3u4VltmkG3v5jED/NT0tVEo7yiRWaI5FkWB+0HD9I21JKKSgeJcwkwr8aRbXKDPESBk1m2tgxOuTkRxJ09oa+yZhFzG3gtEPNUlJlP5PzV1ale6YCvJXMzzMolzWfW9aGu0J6Z/m+t9qVmNKV3QmZ2DJJuxuvd4Zs/WuIwUrZtuQhf3848TY3pfr+OF84NhUPtZ+lKniu0OhI/bwNWJQaFRggzq0bNTCwuZ+7vsQIApHS6IvQ+mVPFDyLZ1ZGkYpWMzXaii2zPS5O3ZntpJHdjpaAoQGr17Piqvm4Bp5HgwIuRiqvfansjalw1MmMlE2uHoMZZFrzCejpKAALPNz0VY1IB1GDD4gOmPDyYRDC9A0E84z8hflqrpgVb86Utc7jrnmTeA0N9zG/0yz6o4TX1rqKgQzmUKlQ5NjCMaERPTOrMgn7HDmXYzG7TaQ+pmop4qoE8KNBWb2bFzI0bjzhwT+mT4hzdot0mYMkClSyr/Nv0Gri0N1rntfit7czd4A/WYz1bwNIHORwc2eZnR16+ZTJ+iPnl5YrpF1fA9bJzhH4wW0xm2jrBXCQ1vRS449f3jznu6sFCFJUSBtEg/Vk8HxB8dI5cBpoMPYuBQ6P2s6r0IUT6wvLqGICP3oIlghjZgb8fHj2771kHESV0dRhjD2mLff3NFHExhe8GRWFiYb39hwbFuri8XjPhBRxrgynxvJLGYALybEKMxvkLrGaiHwcLKhVow8Ky46ihhET2aP/DazfE5yneXspNbVZ09RfSoFzAbrY88h4D+Px5/AiCJF4OhugKrHQ+UV+tPRvX52AZ/XgX+BB50CwUgqHcepPAU3tooe6L53vhURY7is70FYKAEppjztCSbfWhGBGcimdnE2eUyak7xdAmsAsjisApCjJ1K8B3utN5w6EOtD1EYf6MwQ5eoVlx0IIX3k2msZw== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: bf211a17-582e-4b54-1267-08db107491e8 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Feb 2023 23:21:45.4931 (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: WyiAG/xLy48Wpmf0m2pjgpD2VB4BIvrad2585H7mxPgc8ZVkoQxX8XZ0JDLp8lUdNp7Zby3mJvrs53zSMubO6g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR04MB7436 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_NONE,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?1758031851162060109?= X-GMAIL-MSGID: =?utf-8?q?1758031851162060109?= The MAC Merge layer is supported when ops->get_mm() returns 0. The implementation was changed during review, and in this process, a bug was introduced. Link: https://patchwork.kernel.org/project/netdevbpf/patch/20230111161706.1465242-5-vladimir.oltean@nxp.com/ Fixes: 04692c9020b7 ("net: ethtool: netlink: retrieve stats from multiple sources (eMAC, pMAC)") Signed-off-by: Vladimir Oltean --- net/ethtool/mm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ethtool/mm.c b/net/ethtool/mm.c index e612856eed8c..fce3cc2734f9 100644 --- a/net/ethtool/mm.c +++ b/net/ethtool/mm.c @@ -247,5 +247,5 @@ bool __ethtool_dev_mm_supported(struct net_device *dev) if (ops && ops->get_mm) ret = ops->get_mm(dev, &state); - return !!ret; + return !ret; } From patchwork Thu Feb 16 23:21:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 58279 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp583149wrn; Thu, 16 Feb 2023 15:23:36 -0800 (PST) X-Google-Smtp-Source: AK7set/vAUWegPc6fnEUBwMjo3DfBnMyJ2XL7NfcHxNHqGxCymsh8lnMHcfiWlJAN4Bw6zamsn8i X-Received: by 2002:a05:6a20:1b1c:b0:c7:346b:71c0 with SMTP id ch28-20020a056a201b1c00b000c7346b71c0mr2761400pzb.11.1676589815758; Thu, 16 Feb 2023 15:23:35 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1676589815; cv=pass; d=google.com; s=arc-20160816; b=kq/hjVZwe4KbUH0sAv4LLaqBZfITFjjsarSl32E9QrO4KOZeIynWVPVZINZygSggfX kpu7Q2hkpZKDSYT2k5dSQlIaEkHOJGaZJcI2JqIZGqYwbDHjOUsgovBVdL24S6dvevzK QdbRGy8/guUqndB4zmDc90axVrqgBn9UFcDBU1zpDfJlxiTMqCWjFu4vOP5n1f0X5eWa di2oyYnHKThU8FjeZhEFZYiD8+k/dBu7W9v1RjVbuZU70LwxQ0vtzdl0+yiGlNCMk65w TnblzFpbUExgfywqtQlOEdtslrhO3arvqVwUVeH9wrzR/ApQoY51azpELWAkhSjSV8v+ +zCQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=gBWnWGGLsOf9IfMcqZszFz2gB3H+yp0NtLUzVYAjprA=; b=MkW7YZX40DJLif9e/9HKbro5WLwX+9ZgmSv4iNZfC1c61XbEpFXa8bjkjaqwNf9N0k 9aiLQE67JJv3GPmvaB8vKNsxj7nMAsosu3VaDRkRdpblgoy9g06E8s14wcgv4OTMyLLf 0hQqV9LgQkpl8HhahGR8ihMnLmwAXqU2rTbBr0M1E0ZE0Al+r1onqBolsgoZuNO585aO KmGzsa8ldObA61K3LH5ta0GrUzFYGktCtNmkt12Vwd+95YDnlXL7KLf7pehfpIf7yKW4 d+EjX/H1eV/p9FrSOCO302noh/P6J0Twh/MeUbGTck0ZbM/EHkJ5g93ZkBSjjtg2fSH6 uRrA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=MdikkotO; 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 k67-20020a633d46000000b004ecac379bfbsi3354299pga.339.2023.02.16.15.23.23; Thu, 16 Feb 2023 15:23:35 -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=MdikkotO; 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 S229962AbjBPXWP (ORCPT + 99 others); Thu, 16 Feb 2023 18:22:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229863AbjBPXVy (ORCPT ); Thu, 16 Feb 2023 18:21:54 -0500 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2046.outbound.protection.outlook.com [40.107.104.46]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 55C8E53838; Thu, 16 Feb 2023 15:21:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=e5awm80bMsBNMbD4evMw4RXpBy7DJ9dGuOmztyHV7pGbTMIwcPdG9nDC0x0PH/c0gRJdK4GUTnShiyMp1jYP6dyKHABRVOwFNfAN2h0ld6KeyB9fytz8CvSMo/FXCLqdylJuB6OU7+L9oH7Popwkha1CnC1orRA/vINCitqvZEaf2wAZBtzzfRPo7u/onwJ4INlItZqRU62e6hu7tE4vEISIzG/ZZN9DKetOj/rASjfBZ00NqeFfoyEp67Stf/endd/JrTq6LouK0u1X2WZg5ZLAYeXuoCZuZ6FO1+02BP0aeP9lWghxpzuWyFduEebLcRv7rXRCChmJ3Bzh5B4YKg== 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=gBWnWGGLsOf9IfMcqZszFz2gB3H+yp0NtLUzVYAjprA=; b=XjLou+A+iShhXcOl9yCqKx2v4oTxiF7lmMjMVePD8PsvXlE5iu3ptlSV/MePj/g6Oltny5dSXYGBjUwuTawGYiqCO/aJdgZU6CjDl/GNbZxYQP/SEnR+o2Wvr6zQbQ056cTg4oy+C2au3pn+U7EKdjGRUTP5vNyruLp/pMuYqT4TQfeUCcEcwOSQHPR0DHRCv3/J8nbJqDYDv9W/0n/2HtY0kFSQl6TCnoScuhbTLhvn5lTcrQMWhJyfOqW7TJjvze2mrYGAqQHiLhiahyGDkplh2OY4av3DI9OtxgpJlQu2JLLyWEpJbVhdAGUBQ7mfiR//z9EYa2adCtBDf/SUqg== 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=gBWnWGGLsOf9IfMcqZszFz2gB3H+yp0NtLUzVYAjprA=; b=MdikkotOMrwLJWjHHuBjaEDTzCwVi9nO2PMMNupIZbdSA8UnPqTKF48umlaMkl3qze9AROvnzOeQITqTc2Ry167iYMV0bwm1RcqQC0KNtg9PylceaUxGS3uFTWjFaafhfKXU55OjRrSNYfNiMA29pStDb4pUghxWtJJQ7e71L6Q= 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 PR3PR04MB7436.eurprd04.prod.outlook.com (2603:10a6:102:87::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.26; Thu, 16 Feb 2023 23:21:46 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::3cfb:3ae7:1686:a68b]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::3cfb:3ae7:1686:a68b%4]) with mapi id 15.20.6086.026; Thu, 16 Feb 2023 23:21:46 +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 , linux-kernel@vger.kernel.org Subject: [PATCH net-next 05/12] net: ethtool: create and export ethtool_dev_mm_supported() Date: Fri, 17 Feb 2023 01:21:19 +0200 Message-Id: <20230216232126.3402975-6-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230216232126.3402975-1-vladimir.oltean@nxp.com> References: <20230216232126.3402975-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: VI1PR0501CA0018.eurprd05.prod.outlook.com (2603:10a6:800:92::28) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5136:EE_|PR3PR04MB7436:EE_ X-MS-Office365-Filtering-Correlation-Id: c9dc0b9f-162d-4194-0875-08db10749283 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FtzTP6scCk1Imh/yAXMposK4mVRmz6DJvmhQKqqvvEokYH0rwZhWqM1lwjq8Le+zF0Mv19/5tr43/4vsGsMDJ3UvLOvd6WEM3m2voQsfb24UISDtXGeITpkTT4Npm3W1QGskWaCbTvXnwSnLqlQSmW+I37e3n7paduQP7yT6ncbhCm+7LRy1le/Co2rLzX16bHHVkYlp0GI+6CoQQM7a0f9CyQh2NczvjBe/LF9AjY2jK/msPv/tAhokDjKSx3sR1whfc/GmImjAky5Oz4Q67WJJbpojnHEBVLmKnJ1jRj4DYIiqPRl6X/cqaF/NZrFkysB2rQTzoqYz6lZrqc3QYV36l4aPj70rx+b6rTAJbfY8hQusJlM2RTGsLukf7a6XUGvDzUX57OWXv0+ga1BCO7Lemk3p+h7jxP6ynWwv5XfPE2wPeWBmio0hKkouUikMZuapO0QN7ogJTNTdVfTZHygdw8c9uOt/xGc0M890ucF1lgFxwoVV7kOe1nBd7f27/GPwTVSHcTq3BBx5txuWbgTVQkDN7o9pQ6UGqixFXmbh9XXNdUSWFse9vkq8AP4lS1MEKbIN/R7rmViCm4vJ+HYus46BgbluBgRTs/BBxJOXgfQCSkG8iYFX2jnjI1/TotBW3oilGjT7471wgLAFHirJO3WADJZcIxcPjQX4RkKiv/5kCIO8fHIkqq9VXInnZGtb+ainpcFFQ9158mLJlg== 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)(376002)(366004)(396003)(136003)(39860400002)(346002)(451199018)(38100700002)(2906002)(38350700002)(44832011)(7416002)(66476007)(2616005)(86362001)(478600001)(6916009)(66556008)(36756003)(5660300002)(41300700001)(6506007)(52116002)(6666004)(4326008)(66946007)(6486002)(54906003)(186003)(316002)(8936002)(26005)(6512007)(1076003)(8676002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 2wSA+VQm9o+P0E/RXpjDLfJyc64lBTj4TaWCpWJ1oRI0uZI3KoDbY5B0UCaJKioZSuNF4LQSNCucXbttsINIJ+3CfrGwGP3JfL3EXQjlV9wi2WuNm1H6/jMv0f/TBylZ8bpa/P7QLpa86KeWfzvyqw6haZxj/C1eaL0gdQgeOGIEvEVoWqa2JtAZRvxEo5Ym/tFvZ4rr1BM7EviYYHYiZJDMmwo1pXud0lZ0whEPmmSPPJ8/LSaDBjue1G6yscFQ3EYour1PEHVLkY+UKSJeoG2TI1cm2TmZ+toZNYTDVa/ue09nuQTOrUC9uX0iLmMn1cBMHlOHRrF3M9UltxKPFmmNKR7FJEuUu/SQOETZGb1OdE/7Ew21v5eHA7/iiIz/Wk7X1E4/M/xBjuwungF/sMoLh+A+QO8LbWCoQCnAxvtoZAHACxn8pi8RfmG/U4kyBjxnUjTiYdemcEVGKj2sNIxNeiEKHSEefjhEGkuc6YikphnlnKxRpN4/ZGurnI47JuRmHDjh50YQ4BFAd4qs9pA7ztfQDKif09XzOdPY6PN9OjUJYIf+6K2Z7hNkmzhDQ03kWZUc+HGdVcrv10RptxrftMiOW3rIIVrXcu8JKTxuRPEY1iMjp3kddnHl1W4TkEqNjzjQMe/I3Rg1wOVDvnpOykpjSyWIHZaM8YAnYaTHgIVsVcnvNiomAACdb3YL9MOnSlIy2CmUlU4LKYhzo5ZreyWiTLkKlHZK/0WfxjCeYrOJB9UthuVVOgsCQINtAZAiyNk1BAW7LzVHOZwdFkWbF8uMYwzmqjAKroHnBtVo5/ZBjaqyaP5ajaFSUdDlnupJ4sO9J4tgJz5Sib4BMGQtc5483XxixyxJYEygmGn6DJt4DJIs/sW6qRICIphSKZu5UpEo20Bj39TxI8/cTbN6Y3tV4gGt8+b1xHauDS/UnJt3NaktPBSMV/QTioCKCOJu/v9rBo3TYT23MO7SZe/YoS7uWBdNcqoKYfwkX/Rj1jbVKPh5lDj6EozzDSgzr8PZgjVGJvCmQb8SPjwVuPeH9DARhXoqruPc1LeXZSGTyWukCJbTeLvp8NgU/i/GKPgipnngakSCoFJTpigpWSqHTrpLxoxOxQwgddsx831vWy3j5q7WGc0PCNcr7u849cNeO6z69eq/viiBLom/ZZBft/F9iVNTaj2JxsjALf9Df0Tj2gVhHG1sL+Y4izgOoPV8TcJUgtBiUhKKc/Rzy3ybeuhoBhEZLEPSdgDYVZ0KjoQsin5Wb9TTMLVpF+OqUtzTC8YskEDziP5eNbBxzzHCrPvf8pansj4UqmEzB6y3RSuHx6Sb+XjEym+Deq42C7s7gYokJeBLBfMslaUt20Sqr7xyudfL1lPL+TXx+bMszg5U0e47huaYgpt1FL3r39k638W1CAkMGfVdtkezj6Q26k4BSCOwNrFN2knA5OB/IGmMkb6aZPM2DuLYEUr7xyY/vXHrflCTu11QzXSjSBMr/kov6+dLICXUugHTM5AiibFxppxY5PBUVKAWn8wrm6bxRhVLHMD4uTvF6zYQurINvbwwMmLda5DGbZ54gLf4lkgNOqqLUK5FpdkYkSQjhPcxO94Gh6v+9WN/ofRBPA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: c9dc0b9f-162d-4194-0875-08db10749283 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Feb 2023 23:21:46.5087 (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: DT5QGLsZWs1zCKvJBDC+AluQr+SeRJnE4pXzIezGTG83buNu2x/oSQ3ljVI48t+zL0FKuwAjNdV4PHxQ9RYKRw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR04MB7436 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_NONE,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?1758031842616992167?= X-GMAIL-MSGID: =?utf-8?q?1758031842616992167?= Create a wrapper over __ethtool_dev_mm_supported() which also calls ethnl_ops_begin() and ethnl_ops_complete(). It can be used by other code layers, such as tc, to make sure that preemptible TCs are supported (this is true if an underlying MAC Merge layer exists). Signed-off-by: Vladimir Oltean --- include/linux/ethtool_netlink.h | 6 ++++++ net/ethtool/mm.c | 22 ++++++++++++++++++++++ net/sched/sch_mqprio.c | 1 + 3 files changed, 29 insertions(+) diff --git a/include/linux/ethtool_netlink.h b/include/linux/ethtool_netlink.h index 17003b385756..fae0dfb9a9c8 100644 --- a/include/linux/ethtool_netlink.h +++ b/include/linux/ethtool_netlink.h @@ -39,6 +39,7 @@ void ethtool_aggregate_pause_stats(struct net_device *dev, struct ethtool_pause_stats *pause_stats); void ethtool_aggregate_rmon_stats(struct net_device *dev, struct ethtool_rmon_stats *rmon_stats); +bool ethtool_dev_mm_supported(struct net_device *dev); #else static inline int ethnl_cable_test_alloc(struct phy_device *phydev, u8 cmd) @@ -112,5 +113,10 @@ ethtool_aggregate_rmon_stats(struct net_device *dev, { } +static inline bool ethtool_dev_mm_supported(struct net_device *dev) +{ + return false; +} + #endif /* IS_ENABLED(CONFIG_ETHTOOL_NETLINK) */ #endif /* _LINUX_ETHTOOL_NETLINK_H_ */ diff --git a/net/ethtool/mm.c b/net/ethtool/mm.c index fce3cc2734f9..87d9682efadd 100644 --- a/net/ethtool/mm.c +++ b/net/ethtool/mm.c @@ -249,3 +249,25 @@ bool __ethtool_dev_mm_supported(struct net_device *dev) return !ret; } + +bool ethtool_dev_mm_supported(struct net_device *dev) +{ + const struct ethtool_ops *ops = dev->ethtool_ops; + bool supported; + int ret; + + ASSERT_RTNL(); + + if (!ops) + return false; + + ret = ethnl_ops_begin(dev); + if (ret < 0) + return false; + + supported = __ethtool_dev_mm_supported(dev); + + ethnl_ops_complete(dev); + + return supported; +} diff --git a/net/sched/sch_mqprio.c b/net/sched/sch_mqprio.c index 48ed87b91086..f0232783ced7 100644 --- a/net/sched/sch_mqprio.c +++ b/net/sched/sch_mqprio.c @@ -5,6 +5,7 @@ * Copyright (c) 2010 John Fastabend */ +#include #include #include #include From patchwork Thu Feb 16 23:21:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 58278 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp583092wrn; Thu, 16 Feb 2023 15:23:29 -0800 (PST) X-Google-Smtp-Source: AK7set+OLsnJO9J/cHtbpiBAzc6xfJkMdBjikWrcip/JJ0BL/ttecPG7yKf1oJPE8Ezwx3OM3gj3 X-Received: by 2002:a62:1a09:0:b0:592:528e:72a1 with SMTP id a9-20020a621a09000000b00592528e72a1mr5758555pfa.27.1676589808759; Thu, 16 Feb 2023 15:23:28 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1676589808; cv=pass; d=google.com; s=arc-20160816; b=b2fX3Y+e6ori2+iZyy7LcJgWouiqmYP3NGOPQR6J9uwSiP/N8MjVmzCZkPwJCzfOLE 3OfTGgsqtykxRIeUol1bW97VFwxlyxXNE6yH6fUZTuQrvNp1P+40q3/+NjKsxQZ64o/5 78C7A44R2CoQrXbTXwrkfw3w4cPx40nw2zRwNN3x2VBEHtVYO/L1OZAxGiluc3yBW1TE snRNL4ifTtSBwRXa7cLC2/t8XPUxhsHdSd8ItetCYwx3+N7ChLoXia8Z6deu5jdDiZmt llC8kj8ZW7zqUSSz+aa+eGJ82uQDdUP1y7C+E5cC29bxbusjw0wJIukk9faj33BA3wAF rF2Q== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=jiUVozUMEjWcF8Zejiu7eEwqiflH6NVFM+g++3wtl7E=; b=MjwiOhRSnJP9bc+/XjUhe4mPhPeC7L/yrxpdwAjoiyBJin1o2XaH8saCjhwfZYfm49 30U1cmpSYWkrrEXdprYvvDOh57PkNJcFdwHLud2bH53Nto1BM4i+1amm+OnGKlcoD0CC MNjJqhcnNHsRZSgzqoIXAD3gGyEdW7t9TbGpStCDzplx6ikOGabCH5vN9xJ7KdvTbrPP ZpH1vO6LruL0ZJS/JsQzrSuZv3I0m3hsp6iZm4JPvPST7O72GQgTSsiGXJLmUAvX2JqF Cv1vOMoZuSGG8Y8k0q7mDFQ9+38ushoWJocC8tw/mIH6v6+F3VHtJuDV5PKHZqx4IiBz r0xQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=kU7vBFi6; 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 t23-20020a62d157000000b005659a66d652si2742636pfl.229.2023.02.16.15.23.15; Thu, 16 Feb 2023 15:23:28 -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=kU7vBFi6; 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 S229955AbjBPXWe (ORCPT + 99 others); Thu, 16 Feb 2023 18:22:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33502 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229866AbjBPXWN (ORCPT ); Thu, 16 Feb 2023 18:22:13 -0500 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2075.outbound.protection.outlook.com [40.107.104.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C20554D0F; Thu, 16 Feb 2023 15:21:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bOt3WS2d8USB6w407j269zL2shDXXyIb4UefolaeTbQWr8193Aqb7qLagr/IopnwgKlS7E8aI/1Ned3ZkWlxSm2qlF7Szi5iMxwddBIoHx4ysFv/rmo+Bz8ycMqCpbMpeM5FSLlPVXmZkwrtD6Nw1S++TpCYDLYC7Gx/j5wdjJEPeVRMoAvhBdu6AkMq+8N7OkBQLGENRBs/REAzpEeCv/40P5QEBoJXUW/8QxvAgdwieKf/0UMK9njxtjwEcObN7VambPlhuid7Om7rDlvUaynlWauNPwG+SAm7BRyGZk/2xQN8Coma8Xxu/f5rHxzkyNuIMVi6looYlAAMlhFnzg== 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=jiUVozUMEjWcF8Zejiu7eEwqiflH6NVFM+g++3wtl7E=; b=ICDzIK6qhe/RDbTzy4CCFf2yA7+seB+YojHyiJKfWCdfWb5xjp1dbfoibd1Rkylx1D3TqZdSAbgr8WQhSBX2k6aQ0sECvKqndnvXaAtIU1PcRa34CTZDJYvGb4BH84/JdxsiAz+HNAlKgpG9zbEDXv6bIb4FuCOzgvzKrNxl42YqAxgNunv/e1YOCad/SYN17grc7B/+hIrrf2N63TW5PwoMzzyNtxGLXEsCQAxkQnEEVtCJ+7/Td1fs4WL+3rPQ0JtnzcWcvb3+8BNu7zfw7t6RX6FEChUwG1utw4uRJ/c2i3Wa++fHZP0fqW9bga886UmKhbuHlzpcICassSB4wA== 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=jiUVozUMEjWcF8Zejiu7eEwqiflH6NVFM+g++3wtl7E=; b=kU7vBFi6ulNsgUacvjjhdkfm0VJAhRxDAmfX5M1/JaS8cV24//BhgUgwRDDgdKKM+a+8dk3ZYldjcTGL5Ynbs5qdvIJZYdKe/m9/swos52IgyfnJ/hgYGPlXzKag9ZY5WM5QSaa5MKh3zN0xvk6Tqg2v/x67FHnec6dZ/O5CZw8= 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 PR3PR04MB7436.eurprd04.prod.outlook.com (2603:10a6:102:87::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.26; Thu, 16 Feb 2023 23:21:47 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::3cfb:3ae7:1686:a68b]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::3cfb:3ae7:1686:a68b%4]) with mapi id 15.20.6086.026; Thu, 16 Feb 2023 23:21:47 +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 , linux-kernel@vger.kernel.org Subject: [PATCH net-next 06/12] net/sched: mqprio: simplify handling of nlattr portion of TCA_OPTIONS Date: Fri, 17 Feb 2023 01:21:20 +0200 Message-Id: <20230216232126.3402975-7-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230216232126.3402975-1-vladimir.oltean@nxp.com> References: <20230216232126.3402975-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: VI1PR0501CA0018.eurprd05.prod.outlook.com (2603:10a6:800:92::28) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5136:EE_|PR3PR04MB7436:EE_ X-MS-Office365-Filtering-Correlation-Id: 961174d8-43f7-4f6a-fe89-08db1074931d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PENbNupF6m/UEy0zscRy7oMLO3CSk0wA4lRyYmAHmZey3moEsP5JM96cfeq0EvD9zf/+kAC3pWGDBToqyKwaQov14NI2HEV2cvEzdyXXmh2iN4aAbzKVqlYgXJJwUGq9yymh+P1wVTmOAzhtQvvL0YEFrcpjek9PPAc0wJD7t8bKAVRGAxHV7rn6+pRLcRO3CP9WSLMi1PVM3P03jflQ26CMOQ+j51v/etPVbxdUcQajzAVe3YphoMgserIVrZOCN8RBBcjaYd0X7PIkj3swJJxB/NfYL+GckLCmnk87OhIg5aZl2DOI+7NjdJPf+VAS5HJdmnCiAqAiAltxpxcU6w40fRwlcPkwhdbot1JoOshYl4ywxIrtdI4cK2Y32jVyey8XG/A7YcvBY7Hlf0iJHuEvrCYoqe7eMbhVmCGCipy6xZe2BGmZDP336ce8uMMtpdjNLJy81zMcnYSYEDvvBPINROLm1R9yLMtuvuc0nhduYkPOpFO/VLZiNvHy1E+vGS+o9sQw2i2t6EPnDchb8XBnUf6yTR2I2mb3TfdXBX0MJytlIb+TV8JsWjzRYdDPZSH/9VazsJVts+od0f8QjjiIqupF0p7MNRmst/Yt90vH7ZXSU9HnLjdPNW3w+WZkDbh2tbeyEi3Pdz8Whwsm3LysP32IXlqnwlwHDPdffdLdCmVBatz9fjn2IWBE4F5/zFUAXmY7vCDKV8ntclLmjw== 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)(376002)(366004)(396003)(136003)(39860400002)(346002)(451199018)(38100700002)(2906002)(38350700002)(44832011)(7416002)(83380400001)(66476007)(2616005)(86362001)(478600001)(6916009)(66556008)(36756003)(5660300002)(41300700001)(6506007)(52116002)(6666004)(4326008)(66946007)(6486002)(54906003)(186003)(316002)(8936002)(26005)(6512007)(1076003)(8676002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: fpWsW2kmHU+lkCtD0abn4gfZDhbn9STsvgs+5odDufpevO6zSh0mGHGYN+lR8KQQorAISL4zfzfKPpKTxIBusXKCsYh7XAvfD6Tg/hqYRXt5gEzVBkrzXOhCxOvVpWFHnLDs1esg2F5/TfndK8CgMuF+A4v19O0dxRAay81M/cohelaR8DV/8L4OkgsNG6EqqM8cu6Uzc1CspukCX/cN5XIyUrPfQrR4y7IJ1OdBiuEpyRI3b6YCOfJWyiQwIr4J9biftoU4kdLoctdiujkPAMLH7xiFAqXRkW6Bokq+Wjbmfy1zlYsTAAvbYnCG7xfKCZC1VFXaRdaK87esuHKj8LkknNiIhv7QFGOigXAhYeAuPi49I6xwsuSWHmvwTQsWZcv17aFkMFQSQOBE6XVo+AArZr/ha2vQaifcnLRdbN7Fpp6M7d9bku6WEhmrdD6mMOEpIsYFITl7glKdRkqZOIr2IL4ODFBbC6//jgMTXYL8P+Y4tIuLe9Z8XSETxnT2k5RxHfG92S6R92r08AKlGuvp31ar+L44qASAYW4pm2VPIFjO5VYDAp30zh6jfi6DESl7RW+RtKsyV8SoOzGrknShheS9rMwe4tRwLOQ3OoXjZ37NTpm3AZeAYAJvJwWj7M7M05biBEeQF/sirJPyYwKdcX/5F9DXl1W7Da8alxOG/daBOcBzLRH1RGKLC5PB6ZvdXf/A9xC6UwiL0Sr9kDYOpdCYlKhoeNw3M9Z2JiRFcUEb1DSjNAXBU2guG7/VAQ63LdWLcK/EobVrYB0W8GbaCkyJhYjclUzlzJB+ZJ79dJVr2/OSqug4Uj4ein+wUEgXL8Zl7DR9hSZuhc2hW2SCNB1gt8X2q3vQOUaFfYPh+9ezpuTnpcBFBwTYhehvsUH1qGtFweM5mUdYvLhfGKvavehMdzLbAe7tjKf8aQ8sCLKo/L3r2h+mnaBM5P9i8cr5I3JHI0YRnrT+l2WJa+EnoOiGOEYmJFz7gfRPnWlGXSw0nKb3a3qvEnS+YrJuZZgSx3hnhPFgbER0R5HuzS4/EqIt9VVkSD/G6wOTMdlTbi8a/8soHCUw5Hn3RXe2S47MhoBJ3UQS5icRWCcc0cyZjkwBNbBruLCrVZS2GPp01sgdQ2ArSrr7336805pPzTpPbGgz3UqFmihl6vqM6xZxGp+c/nU4xPw1ZgXCpMH7kJk2oxa1BEN9+OzE82Qb+egobWQ3ZxJOvEAHZ+0pliu5q9P/4kvbiwgGcUssRAaYC6MmkMwnZRyA1ri3ehPkYJ/YPP9LALV51nhuuLAYlcuEQMm39wjBiCD3BqeVfN2uywM4fJuPMrkZW/NfU92B4BUwSPlg+Ou8dJDBuc1bKyb1m6qHqbNUB6x+F3NV0MGemzN/xJx/i/vK+QPrr271gVnXgxH8mD3fs5X/x3V8wXRQrVLpa13mMoBymKkCAzDyStUUrfis+J50y+L6q7l7bxxK0EnzMYIT0g0qmmUuvvoI4D+ADi+6GA5gCO+5VyW96827/NBT3AIzGTdDVoZVGds8RxGxvaLWrbCYK7jH1OJPmwp89ExcBJDJ6jIGRp+QPApr2xMVkWDttm+rwp6iMU4AaADDK+g44N9vYtM3+g== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 961174d8-43f7-4f6a-fe89-08db1074931d X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Feb 2023 23:21:47.5086 (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: M3uFzIkXpKujzhMGVTRxvc3RN43cWIhJiw+4dOmmW6QpT6epJ7YxyWxqh2I5ysDXzMK0i+9Qc6WVbWtcQLyLkA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR04MB7436 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_NONE,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?1758031835275731428?= X-GMAIL-MSGID: =?utf-8?q?1758031835275731428?= In commit 4e8b86c06269 ("mqprio: Introduce new hardware offload mode and shaper in mqprio"), the TCA_OPTIONS format of mqprio was extended to contain a fixed portion (of size NLA_ALIGN(sizeof struct tc_mqprio_qopt)) and a variable portion of other nlattrs (in the TCA_MQPRIO_* type space) following immediately afterwards. In commit feb2cf3dcfb9 ("net/sched: mqprio: refactor nlattr parsing to a separate function"), we've moved the nlattr handling to a smaller function, but yet, a small parse_attr() still remains, and the larger mqprio_parse_nlattr() still does not have access to the beginning, and the length, of the TCA_OPTIONS region containing these other nlattrs. In a future change, the mqprio qdisc will need to iterate through this nlattr region to discover other attributes, so eliminate parse_attr() and add 2 variables in mqprio_parse_nlattr() which hold the beginning and the length of the nlattr range. We avoid the need to memset when nlattr_opt_len has insufficient length by pre-initializing the table "tb". Signed-off-by: Vladimir Oltean --- net/sched/sch_mqprio.c | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/net/sched/sch_mqprio.c b/net/sched/sch_mqprio.c index f0232783ced7..cbb9cd2c3eff 100644 --- a/net/sched/sch_mqprio.c +++ b/net/sched/sch_mqprio.c @@ -147,32 +147,26 @@ static const struct nla_policy mqprio_policy[TCA_MQPRIO_MAX + 1] = { [TCA_MQPRIO_MAX_RATE64] = { .type = NLA_NESTED }, }; -static int parse_attr(struct nlattr *tb[], int maxtype, struct nlattr *nla, - const struct nla_policy *policy, int len) -{ - int nested_len = nla_len(nla) - NLA_ALIGN(len); - - if (nested_len >= nla_attr_size(0)) - return nla_parse_deprecated(tb, maxtype, - nla_data(nla) + NLA_ALIGN(len), - nested_len, policy, NULL); - - memset(tb, 0, sizeof(struct nlattr *) * (maxtype + 1)); - return 0; -} - +/* Parse the other netlink attributes that represent the payload of + * TCA_OPTIONS, which are appended right after struct tc_mqprio_qopt. + */ static int mqprio_parse_nlattr(struct Qdisc *sch, struct tc_mqprio_qopt *qopt, struct nlattr *opt) { + struct nlattr *nlattr_opt = nla_data(opt) + NLA_ALIGN(sizeof(*qopt)); + int nlattr_opt_len = nla_len(opt) - NLA_ALIGN(sizeof(*qopt)); struct mqprio_sched *priv = qdisc_priv(sch); - struct nlattr *tb[TCA_MQPRIO_MAX + 1]; + struct nlattr *tb[TCA_MQPRIO_MAX + 1] = {}; struct nlattr *attr; int i, rem, err; - err = parse_attr(tb, TCA_MQPRIO_MAX, opt, mqprio_policy, - sizeof(*qopt)); - if (err < 0) - return err; + if (nlattr_opt_len >= nla_attr_size(0)) { + err = nla_parse_deprecated(tb, TCA_MQPRIO_MAX, nlattr_opt, + nlattr_opt_len, mqprio_policy, + NULL); + if (err < 0) + return err; + } if (!qopt->hw) return -EINVAL; From patchwork Thu Feb 16 23:21:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 58277 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp583005wrn; Thu, 16 Feb 2023 15:23:15 -0800 (PST) X-Google-Smtp-Source: AK7set+phbVWL0LzMeNA1Elx5Y549fQkhu81f8y3SSG6TVkflqnEnr0C/7kkEGdzgxVa/8+jNQoO X-Received: by 2002:a05:6a20:734c:b0:bf:4903:22fa with SMTP id v12-20020a056a20734c00b000bf490322famr7764757pzc.11.1676589795337; Thu, 16 Feb 2023 15:23:15 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1676589795; cv=pass; d=google.com; s=arc-20160816; b=1H4RwapS4GBh+rCsNxHjGNGYJejMNlQzFE5IbOEluhZzfeRBiGc2IbOr2s1eyIuppo CHdO65XHmgpt8b9N+he4fNk5xbW7Sgv1T8zta4UwGGTvKzDF2uQGv+m/7pX/6/k5yTKK TINtRk3JmtWy+cXxqBkDPhyWhEPMQGO3SdLmYVvdTQbK3eAcyFcrfjpK2+B/AJd8AVNH OW3LQC3YGgoOfWhQkwBhOHB8wwJvD+YmJy7VKrFjWcJ19r+PlKKusTJYiRjxtuk6ySBA iIv43gX8YhyFc8d9URotcDJyYqG9RSY9eJERlbdpcMOVDhNx/V+vfw9YQKXFA2yOqnkC /auw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=hN68A9dOgisiMZbohGpFUD572fa+AlUlqQ84jTWoNKo=; b=yGiG7/pzGkiFVNXidLvcScCVjJw0NlsFO7Q8+SWSYSabpb7C2AjiXoVCEfABY1hMxH lPasKZmKo8wU23K54Oecp1lD7I7/xTrQ4Ua6zxx8GQdEdLRkLyH+K240l6Ze0Zrjdi1F weuuyJ4sVKn9zj6s6PW0D+KpQ5IMymwfjFLXoI2o7NyEFzE1JrafNx7diUAxMJzjIUNm yz28zH+qFOKg0/IPREthfNU05JcD8icxO4Ke7iaa871bprlG0D3boFYtMvU+UXmueRjh vW3VJDtT6GdF/SO8q5uI4Rc5mzZVEUiBJnBqcKkpZQmVrhWr8CWQ+/ASCu0Utfdlrhhx DliA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=CTbA0viF; 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 b7-20020a655787000000b004fb8f5e1a8dsi3068624pgr.111.2023.02.16.15.23.02; Thu, 16 Feb 2023 15:23:15 -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=CTbA0viF; 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 S230037AbjBPXW3 (ORCPT + 99 others); Thu, 16 Feb 2023 18:22:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229929AbjBPXWI (ORCPT ); Thu, 16 Feb 2023 18:22:08 -0500 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2089.outbound.protection.outlook.com [40.107.104.89]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F87154D17; Thu, 16 Feb 2023 15:21:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bHcvMViSQKx2hO4BfZScwZoycBSiMxKsiKc+ItqU/QKLnCbvo1ouroISzkXD11noDXZn0OaVGN5nKOq6z7q0QKwgejq0bbN6V1MJYAX6ok509FGnRahEYSw4au0szMcrd/WHmgv7acwATXhsSVtTsplStIDcFaRvLRPNNrkBbL+m7m2fObEFQkUNVFXG+lcfcU2tfVy4+6r1Qpl4JkIa6nBaGeSLIyBOn5uilBO6B62BPEpvdh1N+JU/w/taKlWLHhMKAmhtlhKrjVmzQp4M2CqBa+A23CXd6qUP0L+nF5MexM11NLAP7pEfL9vCQwlpRQt5HzeFUj4HekAbxFxTYA== 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=hN68A9dOgisiMZbohGpFUD572fa+AlUlqQ84jTWoNKo=; b=H2cNoSmCN78OCfMdy3VrxdTpo0pCpY4QFKh47dN9YhNkDLVQ+sB6RnWIps4SeWqFWd9or3aSLdR50KfCL+lnWEoqHsDi4lifvMptkrxTM94N7rumzK49zkkl37KdjUD7PtBH6v8O+iLHq04jibJSl8mY7Xy/1p4zEIyDi6AKM/RDAf4n+g+EsMGUrC22uGJksltpV4ddKGOQ6VA0cfXp9KacXHKEprdvVewpibOCkc5zHW4E6gxuSKkb65OcwlMe8cCCPAr6jxGMxrl0085Xu73AY6wQLBhswi6Re1D8TkZuqkX8POQwmAY2lzZmuz7DP/hU/lIyyfXgaxSHlhjFvw== 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=hN68A9dOgisiMZbohGpFUD572fa+AlUlqQ84jTWoNKo=; b=CTbA0viFznR9DmedONb28l0YO58iYmOSLQ21ivxX+gZRZOTjvFYrALY2Nf3hDrBdivAfy3IsHBl3dPwpIG8pXePWKZIKgwrDIXnpIdggMQXgudhHrGv1U6N2hCnEC904mN4YDG9MRU21gBUCzC5B7umAsGmgG+GXzx2x5rO9d/M= 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 PR3PR04MB7436.eurprd04.prod.outlook.com (2603:10a6:102:87::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.26; Thu, 16 Feb 2023 23:21:48 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::3cfb:3ae7:1686:a68b]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::3cfb:3ae7:1686:a68b%4]) with mapi id 15.20.6086.026; Thu, 16 Feb 2023 23:21:48 +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 , linux-kernel@vger.kernel.org Subject: [PATCH net-next 07/12] net/sched: mqprio: add extack to mqprio_parse_nlattr() Date: Fri, 17 Feb 2023 01:21:21 +0200 Message-Id: <20230216232126.3402975-8-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230216232126.3402975-1-vladimir.oltean@nxp.com> References: <20230216232126.3402975-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: VI1PR0501CA0018.eurprd05.prod.outlook.com (2603:10a6:800:92::28) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5136:EE_|PR3PR04MB7436:EE_ X-MS-Office365-Filtering-Correlation-Id: 5703ae59-58dd-4f8f-cdac-08db107493b1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 072dGNqbiZr6R6IlDXR/X3MzNUBux8NR5Xy01VImTXTE5XxrUX6qpd5M7aulXCr0MuDznIgOi1TYkgiJ5VaLAvdu9mFny0QbTzYxd1MXBOxQx/RpywJIy2B3NGdPdk9v4xn0ro3c/iLaQxNPOoH9E1IR02UIoDXmWklsY3CZag9hgO1MU2GZH7MfTmy0gC1Huj3Io9ym/CbV+2YpDE/Bm1g3UhtAMwgk1U6VYY1EE2FsGvwNUMVeYWSObDLlJG/9yUonqif89KyTpkerRS9P6LN5Qm3hTGPCp6kaMGYFRYteQO38B5WpZ2I2jasvmEn5Vb301WD/b+6jVhsElTNq1pxLyK7wKxJJ99j8akDwCCsB2A2IuXYj0/H3kP7ZQusp6hg3M+XWWCSns9qoHCKhIDb434lCsUum8UD5UoPQ2ip3i/vn/Oqjt1P/pWjM8UNvO7v84mIpOlGzizscpEadtShm0awT3QWUoGpaGFqM4VIlDEWiy5Bt+G6JL/6kOmC+DP6eEQ8tb/v6lh7pRoNRIHiD0v4RphwqCgccAC9f0psfdf1sqLM358zNqB4zY1nSRKJMwbeQD7acDWo8ZtG2mhBUzcg0Ks63OKuRh0ajvFKMCeSAtU2fbeb8OPmt5KX8AKqglJcHLlcH0pouqr4gHFUd3+aA61V2FDgzsRzA9YL3sudZyeuPy2FeegMwmjurAScBJamKep7vgyXKl+1Rog== 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)(376002)(366004)(396003)(136003)(39860400002)(346002)(451199018)(38100700002)(2906002)(38350700002)(44832011)(7416002)(83380400001)(66476007)(2616005)(86362001)(478600001)(6916009)(66556008)(36756003)(5660300002)(41300700001)(6506007)(52116002)(6666004)(4326008)(66946007)(6486002)(54906003)(186003)(316002)(8936002)(26005)(6512007)(1076003)(8676002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 9GYEZMd87KllhVSUJxRrSAc12tnnS50iD+YEvzDYw93mxdW5LsCCA4FpNKdV+BGPCA7e6rTv0fIA3bH40wOFk2nRR8IRxSIeMjxQpqsDN75kp8D0vuQadYWCqu78XzOt7Q/8sXFvdv6jnHqKUkHt0pvVv/m4Y8xJFl8Kl+7TqfGIR0kLZ4V4euGAG9s/3Yb1O5JSme6Ku2jNvw1wsMW9AfZxgeyRjqqozHiCRbqLlLAhAygsSMuaMN5Yk5majAyOGdEttMBMbi2lxE+qLBdyzThhMGNUXjyUlmwE2q6jgDb08BN52m5p1AB6LDpkb0PrZM/eFTeUq/uAdXzXFSJBZB5bBn8hkG4NraIlWxk/ujOxmOPQVsa3S8SdK9rEgQBgjt6AnQNdkViLko4E7m3FwcYukOKRAKXEUjKgaUPaxokGPWCL0DygdsiNVnyR1EmvfgmyJjm7edqCSxzQ1zhFs9/hPIxME2oYYMRnNQ3eRMWmeu7UwEB2mCrCrBn6tnuK/qiSQR7/tee5f6/WFmYrVJ499Rf1BJXGTEmNUBIsaFgG0Lg8zMUmUVuKP35uoc+rpn1AtIFStIvPFvltZZ1pzJQf2+UIKzb3yNQ3EDCbximHdDtgEt+Ra/kT6w6eAILBPFrkS7EsgFn9nHqrsqd/pNGKdz3cWaYoytJR/T7kEFlObosO6naPRfLsCr4TryKcSkegvW99tJhLEAGG/FNvYF2Ept0CGhMBLudvlGnPUcQ/EU60lHc6oQeRHaR//8a0qv28HYLcuCP6vHsiHqho+oST8E72vsn6YHSGPhBNqbaYF+TS52CJRpZZSEBKtY7UmABNhWxT6RvnNaULk6r80Q1+ksz92+Xhuy/FqQDH7lnsV8lPtuSjTF2GyGX5J8TMVUaLi4wCJPqJMtwWkZ6dv25uZ9wikEPfzUf2T/O5gsNsdJ0yzhXtVulIrdMYCohmV8yOFAzKI3w5foEIsNQ1AFewK+56P09d7yS1EqJ3idSiqmSdoj4R7Pi4o/oFFJZ9Z3Zds+qklYqYieRm25CDq84qEUxlXClon21Z8W6NKyiHgzvgpEYCa7mWfTv26qUmxiMBoy8xRY9ecjy2V3Qu6+7hwhZz7+qnCrSiKEhpnIz6AVtE2MjmIdu9fsup9O7P2oP0XqCXBefyxSSJR/EhdLerOgwd4+8mk5O9nSZ7TMfhyPrM1qeapv+UFappaqKnBdfCaGe0iVKHlRBulVvV6nS6au8x/DPtaTT58BieZZnelSrnoGs2jLtADL3ia3rP1uxazt4OEnvJ6XnW0qrZZxttEfQEFhdQootE9A+tAk89pcruj9mvRRcbwRHk1yaaDHLzPxLto60fjImma672CObs3ANbtdpYFZVOkZHAvs9p1jnJsEGsB0S5vjD53JkG5rKI4kYbdP715G35RWYjQ368phL9ca3mH58MEKzgSa3hCXUCLEJq3jOjK4q1n0OJtjvhWOIz7M1tOz9w71U7mXCPwQjsdjptPA2naCM9BYzBI4So/SELuus0KMwdy9O6Rx0wxahRVpa3gswEfIIxs42ixw20RfimXe0H1gVaN9XFrvkF0wCGzcec30kUE30XRwbuUzXSYR9nYsMWjpMpug== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5703ae59-58dd-4f8f-cdac-08db107493b1 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Feb 2023 23:21:48.5086 (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: P0FxYVhcn1/1kVkFUW7uK/MxvBQtfdBvmo6jQPcGXglJ7JDGo/Sc/z9q8E+GZFV9zQki9lZfz7rQPrJf+O0hDQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR04MB7436 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_NONE,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?1758031820943846695?= X-GMAIL-MSGID: =?utf-8?q?1758031820943846695?= Netlink attribute parsing in mqprio is a minesweeper game, with many options having the possibility of being passed incorrectly and the user being none the wiser. Try to make errors less sour by giving user space some information regarding what went wrong. Signed-off-by: Vladimir Oltean --- net/sched/sch_mqprio.c | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/net/sched/sch_mqprio.c b/net/sched/sch_mqprio.c index cbb9cd2c3eff..18eda5fade81 100644 --- a/net/sched/sch_mqprio.c +++ b/net/sched/sch_mqprio.c @@ -151,7 +151,8 @@ static const struct nla_policy mqprio_policy[TCA_MQPRIO_MAX + 1] = { * TCA_OPTIONS, which are appended right after struct tc_mqprio_qopt. */ static int mqprio_parse_nlattr(struct Qdisc *sch, struct tc_mqprio_qopt *qopt, - struct nlattr *opt) + struct nlattr *opt, + struct netlink_ext_ack *extack) { struct nlattr *nlattr_opt = nla_data(opt) + NLA_ALIGN(sizeof(*qopt)); int nlattr_opt_len = nla_len(opt) - NLA_ALIGN(sizeof(*qopt)); @@ -168,8 +169,11 @@ static int mqprio_parse_nlattr(struct Qdisc *sch, struct tc_mqprio_qopt *qopt, return err; } - if (!qopt->hw) + if (!qopt->hw) { + NL_SET_ERR_MSG(extack, + "mqprio TCA_OPTIONS can only contain netlink attributes in hardware mode"); return -EINVAL; + } if (tb[TCA_MQPRIO_MODE]) { priv->flags |= TC_MQPRIO_F_MODE; @@ -182,13 +186,19 @@ static int mqprio_parse_nlattr(struct Qdisc *sch, struct tc_mqprio_qopt *qopt, } if (tb[TCA_MQPRIO_MIN_RATE64]) { - if (priv->shaper != TC_MQPRIO_SHAPER_BW_RATE) + if (priv->shaper != TC_MQPRIO_SHAPER_BW_RATE) { + NL_SET_ERR_MSG_ATTR(extack, tb[TCA_MQPRIO_MIN_RATE64], + "min_rate accepted only when shaper is in bw_rlimit mode"); return -EINVAL; + } i = 0; nla_for_each_nested(attr, tb[TCA_MQPRIO_MIN_RATE64], rem) { - if (nla_type(attr) != TCA_MQPRIO_MIN_RATE64) + if (nla_type(attr) != TCA_MQPRIO_MIN_RATE64) { + NL_SET_ERR_MSG_ATTR(extack, attr, + "Attribute type expected to be TCA_MQPRIO_MIN_RATE64"); return -EINVAL; + } if (i >= qopt->num_tc) break; priv->min_rate[i] = *(u64 *)nla_data(attr); @@ -198,13 +208,19 @@ static int mqprio_parse_nlattr(struct Qdisc *sch, struct tc_mqprio_qopt *qopt, } if (tb[TCA_MQPRIO_MAX_RATE64]) { - if (priv->shaper != TC_MQPRIO_SHAPER_BW_RATE) + if (priv->shaper != TC_MQPRIO_SHAPER_BW_RATE) { + NL_SET_ERR_MSG_ATTR(extack, tb[TCA_MQPRIO_MAX_RATE64], + "max_rate accepted only when shaper is in bw_rlimit mode"); return -EINVAL; + } i = 0; nla_for_each_nested(attr, tb[TCA_MQPRIO_MAX_RATE64], rem) { - if (nla_type(attr) != TCA_MQPRIO_MAX_RATE64) + if (nla_type(attr) != TCA_MQPRIO_MAX_RATE64) { + NL_SET_ERR_MSG_ATTR(extack, attr, + "Attribute type expected to be TCA_MQPRIO_MAX_RATE64"); return -EINVAL; + } if (i >= qopt->num_tc) break; priv->max_rate[i] = *(u64 *)nla_data(attr); @@ -253,7 +269,7 @@ static int mqprio_init(struct Qdisc *sch, struct nlattr *opt, len = nla_len(opt) - NLA_ALIGN(sizeof(*qopt)); if (len > 0) { - err = mqprio_parse_nlattr(sch, qopt, opt); + err = mqprio_parse_nlattr(sch, qopt, opt, extack); if (err) return err; } From patchwork Thu Feb 16 23:21:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 58281 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp583181wrn; Thu, 16 Feb 2023 15:23:42 -0800 (PST) X-Google-Smtp-Source: AK7set+0u7nRG6R335FYwUl7wVdwPXeY7uC9QCfCzlDX/2xSrF3jFr1SuRKch5AwSeoMjoxY+5vE X-Received: by 2002:a05:6a00:1489:b0:594:26a7:cbd2 with SMTP id v9-20020a056a00148900b0059426a7cbd2mr4137729pfu.8.1676589821882; Thu, 16 Feb 2023 15:23:41 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1676589821; cv=pass; d=google.com; s=arc-20160816; b=Wt9adzOHS2qvnpkdjKM3KHhaqLtVWmcttIbh8QimIdx0pq56GMJ+I1ZnFL42Y60Sv7 aDN2dMooMv+rUZxIaSsOsjS/WEtJZcxTZ0BLfPhfAFDVtmQJtutuBEce2W4nHtau8Jan eb5Tq32YVG08VQRLjPN4Cfu0HnyOEHx2xE5AIEL7CRTMpI+OINH4qK8zlqvApEEIN4wV 7ngRW35ZHK//sJsJI+8cMrPi5hBi6d8ZlUrVxxlxukHfk4j1d66lfmph1wPab/R7htNl yNT/oQnxwT9xHjH0R1ThfJoH7X2IN0ppzBAv936fGnoSPOPIMdlM1H1ObK7EJjctMAwg SsFw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ahom7zc0vAt42PO8uFVSUdi6HqcyiIxgwgjJivK1p78=; b=n+WBdlqQfUEUGLPuW9R8t8p1MCHvWLEzVWps0VaTz3XflyR0jfeZWVxXedaee8JQUw +MeHUZ1DaTQX04oFtOF4fQiVyB7nau7gkuy76FtnpFe2kW6vIw5Fe3mdPa+vpt9qTaLc NUhhbdQnMo6Kx4SXOt5oJMoZVc7A3vdWUUcWIrcjHdkqk7PR0j54zxBAz5ro3xnXbDcd Go6urKFaOPWC8Pr3DRgbD3LiqF+jyCwvUy22+1aQTTWY5Z1Gr6HX7DQf7eTqZ7dj/h8k 7CsqBIHRhkuZHwOEpSFpDFAnUKJm+jaf8UFY/RUUS5RK7yQHZaG+uyUDhlpHsFOT06k9 AEdg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=JSXYc0BR; 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 194-20020a6300cb000000b004fbf9dee276si2892714pga.841.2023.02.16.15.23.28; Thu, 16 Feb 2023 15:23:41 -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=JSXYc0BR; 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 S230130AbjBPXWh (ORCPT + 99 others); Thu, 16 Feb 2023 18:22:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229927AbjBPXW1 (ORCPT ); Thu, 16 Feb 2023 18:22:27 -0500 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2089.outbound.protection.outlook.com [40.107.104.89]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10E8554D50; Thu, 16 Feb 2023 15:21:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ErxKvLgXnVNRz6lgujfD6ZCHfe/YyPFrxT29GpQ2/C5ZBvwpQNyvO2KRLvfmsEjxPB8D5HzeLgkwjgF7UN0kPfJ74aT1Ttf3/umktoSNXvrAn6y1isDrdtujHHVZmX7MiHODr0jBOHRloZJrMHgbB/9NIsSDOScAKxB8P7hEtZhwmG8TYbk2cHAntlFUP4KZOHeHaKbjfJoBTx/jhWrPrnE3mUmFdsihEakz/i5+G0OTMZS20UAsZoGuUtlketMkYAZ0BnOCsivGOQwaBlqp2hpgnFuecwMhXhe6U2wzcLJZeLqtftgLCuCCkXLiXtS/xPg55fgzxmbX13yMGWzx2w== 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=ahom7zc0vAt42PO8uFVSUdi6HqcyiIxgwgjJivK1p78=; b=e2lLA+v49vTldDjI++zDXeTwKWxhYtajhxIUxWxLBAoUWV1TRys9xgDP9FwiC2m1NtBB05i/2wjbOZE8/v1/kaAK3/lcUewdNcTfwTU6Eo2swzU43MDwNl8Sne36h2heVHxsCLsQYhl96YU9HVPA5bzuQsi49YxoJRPI/AgfI5hoD/u9M8D2rEZo/UjZ31NsrlNoG9igy/ZJn1T1qW6BoMsTolfbrRBtCw7nADA+sWRvb1Z3C2dZ+K+87emFH4gvheVARJk+0nR0xYYG9jFRBBeAPFUKfT75VhT+hefzXlFukxW2cBitevdVAHJjgO3PTb8/E9lKq/GaK4Rg7fIDJg== 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=ahom7zc0vAt42PO8uFVSUdi6HqcyiIxgwgjJivK1p78=; b=JSXYc0BRBuIDSoeHdD27FlKS5qrhAW4S5tphPo+1LBf6Fz2gquJ9+PUsI+UBDqqx3PPCJRhdDf5LmA46j/nPIoBJ7F5IK69cJvBZU2PffIIdWBbilnDsz3DM8JDInFT8I2EsxkL2S7PVdx3eE07Z5HNfIL4QL8A0SyyDSuoYWQ4= 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 PR3PR04MB7436.eurprd04.prod.outlook.com (2603:10a6:102:87::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.26; Thu, 16 Feb 2023 23:21:49 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::3cfb:3ae7:1686:a68b]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::3cfb:3ae7:1686:a68b%4]) with mapi id 15.20.6086.026; Thu, 16 Feb 2023 23:21:49 +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 , linux-kernel@vger.kernel.org Subject: [PATCH net-next 08/12] net/sched: mqprio: add an extack message to mqprio_parse_opt() Date: Fri, 17 Feb 2023 01:21:22 +0200 Message-Id: <20230216232126.3402975-9-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230216232126.3402975-1-vladimir.oltean@nxp.com> References: <20230216232126.3402975-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: VI1PR0501CA0018.eurprd05.prod.outlook.com (2603:10a6:800:92::28) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5136:EE_|PR3PR04MB7436:EE_ X-MS-Office365-Filtering-Correlation-Id: ab0c7b92-7090-4cf2-c3b8-08db1074944c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +PEHy+cXGy/Luqn4fMy5ZjGclZBPBlPSsM3FklSPbIGdEsXApdpl477cGJs0ewIaPQEg8OvXoeu+PJiI6ohmR7ZWL37UWPE0YiqAAd4b7WOFlk5KrclMIwWrwRcGyBxpBnibejjBM6f/aN0VZYPeHhvDNzuj0+uGwHerGOfXqdUVTn69GEWpV/4M+O5uud+DRPtGuZfLqcuzBrYIj7UZ2y81JW+YyM/DatBYd/0del4zvCyuGYCwkdgr7bvt6n6ZEtONyqZzWXIvr0RUVGrLNE+wQXIpl/si/Z/GyaLeqE3SanoOvOWuMbkZ6EQ8Ox+5b8nsvkeHv8HCWFqhp8Ci/NXBIq69dY80RZ+9V7cR1oRrGumiZM9tbXCCMJlnCez/+fhcY22EthfNT8Q4TKhIg/hsYGennr7vntEAvqT4IbQgGgA9bK9sUpObhybKaWbO5y1Tv3lsWOhfwUH9BlHF8/T6GB/sPFehEMelKae+6cwyknCqm14Fu4FYevnxjI8g12EezqMCeT1zAQ2QCturzaawzDHMFWuLWOfvFkjxFUCv+hqnjScY5wBCLB5W3D+tEk5nlSaumCrr8vmfML376fxo5uTHZ8Egb9OgzZOeBR1r/AjfI31DkfL7Dr8IPPP4vE2vIvGVau1qZ4U/6Jrip6oaZaqrOWjwVe62V9w//4Wx3sMOgQTl9VImGmBWA/w/ 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)(376002)(366004)(396003)(136003)(39860400002)(346002)(451199018)(38100700002)(2906002)(38350700002)(44832011)(7416002)(83380400001)(66476007)(2616005)(966005)(86362001)(478600001)(6916009)(66556008)(36756003)(5660300002)(41300700001)(6506007)(52116002)(6666004)(4326008)(66946007)(6486002)(54906003)(186003)(316002)(8936002)(26005)(6512007)(1076003)(8676002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: EED9sLfd8PfFjkI7QWCphD0nShZdLDQsqAFFtCIejKFMwsSBiY4Xz27P+arvp17rvTlVIKFmRwc10j8Yp3iOr4k9atEq+SS+8IVjXQMWdtJLeUlOExgfAVeaHVA8aC5PtOQrcyw9p5BKz+2ThQQqPaSpXO60h7fK5VvVsrWoNP/IVPrgjFTkC2e8qSaCDI6TU0e8evdhAQWds6YuqMmjAAktYgB8JupM7hJ4a1EARK85pN7OSGLnDkkBMtQ6rLOupze6HlvlQoBSImbmyIWCsQLYkpGv9vYmOdq/rY4LPtl3YfFOzYqDkGHRJDtO5nhnO1/VUQoeaIAc3swA0WKG47Gclpt3NKEuA7/WZmJ9vTr2B2No/qCPJRX0UwwbIrX3noUzM/zOwswgo0ls68JXDxXCqqdOJMTLtU7ATGFAbvIsVlU13+o/Ocr6zNpSg0Mj3PN0OzE21mQoxPjXCzEI6hNqwO80AXRGs5OxtGFI+k+ZXmAhoyLUBCg9kO7sGYyk0YPHWFGX0IAw/p6zAdwmOsDHE+o2/p4r6mPvIOsdtf+HtbbVyBNiNiMUKLACBlgVlEhRbaB3xXp9zvOEtJM9fubAgAkBLGitVrdESBq1D7HuWYjEF4plswD4ZRGI64aVb4ICvnbm63q4eUruPfGp2aZvET3DKOkeQAnAGxadcncU2b4689KpTn9ftvhGbglPpkjhjlQHlIWBfcMvOqPQ63+WbDEMGznlSLUbc42Yik5lTZJYR9h2+/Ag0n3lXjZ90PKrPwflTrhJYwYOlMP/6JSWi+xwG6UfrAjJIGdQH8cNt1Kuip3vvcHsnZXG4Odfjuwlaz2NGHFOY6JVc3+rekIrmGmuxYMOir3J0r7+xDAJ4bswInMsqU2yVEGesqgJq5l7m+BiN30PZ6mrieEgOvy8c2fVkIRI5d94U/M928aJTA6gRiy97IhPsSUt18lDYwc51Ccr5+XA3shOJ94fWnEbKqVjlBuv7U/05JHIVeMABq574xOcUDH+fTDTrZ/GV7ItB3iH5LdyoN5CR03eJBrsI/atLljqtg9EXf6CMz42UAdzIsCeNxSkzm+fpE5BLMorD2T7l9ljpzAiRNZ5zpE2+GEZLr50VTmhZV63I7wMy8IYGT0HyvL/yaVXFcLyvhRtDIuFLGSXCzkYR4kWeAD5Ae3uLBWjWGTEpBiDnNmwR6PPmZol29sjbjZaGa7fgH9vypt4KJ9iSl3MUixZwVaAhjMwvrNJCq/zJhd6k6Wz1+5Fg8bpoQe1w3Bvi69mKZiAl9fhN8fW8shA6uDmwGz00KtBbBT/fmnNvO3ljEbNBm+BIVJjjoCQRNdAALcOr7nu1dZODelh8zMphhKp9jW/7g3c4ul3DnFrmbNFSLivJ8MSuaAAT/ISSh23Soh6e34kVgVQcjkh2Y6c+1V4xO+9q/FCs9OZ5a/071GlC4DLkhuliSGQ4NGH0Km1ur8Cv6tMhHaMuC3DtBv8iogDwr6qy7x31vAw/Z6uxqZB14mzv6C67hn5jmtTokUnrHyCSIfGUsAB7cXjQGIrildmz8bhTtFTx0iLQIxRtJchpYSQ1SUbrxbWxvarcw/KlqWewVq758EorclwnlSnLRRvdA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ab0c7b92-7090-4cf2-c3b8-08db1074944c X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Feb 2023 23:21:49.5710 (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: XON40SMMTeM+FxisnyXbs5yoCniowuIGtUqisJ/FHB1YsWgv3MFTC0lJ36003TYy4HhIoeeSvV/uhZ3OdMjHeg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR04MB7436 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_NONE,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?1758031849108497999?= X-GMAIL-MSGID: =?utf-8?q?1758031849108497999?= Ferenc reports that a combination of poor iproute2 defaults and obscure cases where the kernel returns -EINVAL make it difficult to understand what is wrong with this command: $ ip link add veth0 numtxqueues 8 numrxqueues 8 type veth peer name veth1 $ tc qdisc add dev veth0 root mqprio num_tc 8 map 0 1 2 3 4 5 6 7 \ queues 1@0 1@1 1@2 1@3 1@4 1@5 1@6 1@7 RTNETLINK answers: Invalid argument Hopefully with this patch, the cause is clearer: Error: Device does not support hardware offload. This was rejected because iproute2 defaults to "hw 1" if the option is not specified. Link: https://patchwork.kernel.org/project/netdevbpf/patch/20230204135307.1036988-3-vladimir.oltean@nxp.com/#25215636 Signed-off-by: Vladimir Oltean --- net/sched/sch_mqprio.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/net/sched/sch_mqprio.c b/net/sched/sch_mqprio.c index 18eda5fade81..52cfc0ec2e23 100644 --- a/net/sched/sch_mqprio.c +++ b/net/sched/sch_mqprio.c @@ -134,8 +134,11 @@ static int mqprio_parse_opt(struct net_device *dev, struct tc_mqprio_qopt *qopt, /* If ndo_setup_tc is not present then hardware doesn't support offload * and we should return an error. */ - if (qopt->hw && !dev->netdev_ops->ndo_setup_tc) + if (qopt->hw && !dev->netdev_ops->ndo_setup_tc) { + NL_SET_ERR_MSG(extack, + "Device does not support hardware offload"); return -EINVAL; + } return 0; } From patchwork Thu Feb 16 23:21:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 58283 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp583303wrn; Thu, 16 Feb 2023 15:24:01 -0800 (PST) X-Google-Smtp-Source: AK7set/GCegL2kA9qNTBAkh9sjr+R8JRK6dJ9PkkANYfYfyUFDNUqUzEedrjsULWufGhDJKqY1tA X-Received: by 2002:a17:902:f693:b0:196:7d1b:f1c0 with SMTP id l19-20020a170902f69300b001967d1bf1c0mr10019404plg.18.1676589841122; Thu, 16 Feb 2023 15:24:01 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1676589841; cv=pass; d=google.com; s=arc-20160816; b=P/symhiClaQvZqfSIPVf8IsCm1ielcd908Au71ozMLhoJ3e9JPm7paTZTnYq9SpD0D 8DR54kdD3UitVVp4NdTsWpcQjkuGyY3qP9SAy/X46ux1S9Q9GvajFFojXIX2paIQbBok YEJ1a2vWvBltkU4ehUa1bwQqXc8ZpgBfr+AX1+sB4hjN5x/fd3NcJYzhGz9XWqlGfzFv SOdDnDdfCkrZjvOjS9mwHPfwtgeCVqad2Km8dKiACrfKLJomiOdgVrMFmeJnOB5Zhpxe mLe+rQU4vxCEYOsyQ+hFzDfCV5f3NsNqT7ulRyLCPWZENbkHS5Ppof4eyZ4w2nIQmmqT p5Dw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=8D6L4E/yOxXNnApcjCDxJDmkPqDQglSjJq9Re+q5zt4=; b=CRoxVquUySks/zjo+7EcCgzvfsyOZ/LW+AJ5Tljhp8G7DFM1lgBeT2Vo8zbgxXP0W7 4daL4F+DKluQmI5f5rT67SB77Qq7zGkWCjqY1N8Z7GvvNM4ZOhQ/zc8+tCLYLwHznP6t TamLnGW+HybPW66+8Ex3SCQZ7T68KvMHIKNByt1UzUfif0HyRVqX4iZ/gPM8esLojlPb x3B7cgzMcppkrOd8BFH2T/5NblPpXM9DPUE/slU93vYqnD7Mh9pDRbqlGmy+JPKUmsNb /8xLkqbla//cs5HwHs7MbPVfuF5058bOeMhuDyxTDmWGDUKdZI1aCGZSdWjx5+BYB+Og Cg3Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=jFHjeEhQ; 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 d1-20020a170902cec100b00188c9c17571si3170055plg.391.2023.02.16.15.23.48; Thu, 16 Feb 2023 15:24:01 -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=jFHjeEhQ; 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 S229918AbjBPXXB (ORCPT + 99 others); Thu, 16 Feb 2023 18:23:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33670 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230096AbjBPXWb (ORCPT ); Thu, 16 Feb 2023 18:22:31 -0500 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2075.outbound.protection.outlook.com [40.107.104.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3BB8D56EC1; Thu, 16 Feb 2023 15:22:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KQoHb9iy79+ZVpz5cVIEOYG2xePi52bu6eLB1/cFdLnUMYPs/2T1W71N6x550V/oLKBWm+6g1qqzblTWvMvLNQuDO87bGCBBcT+UuCx+7RSR3TWygsAVSGy2eLOzoU9L7GL6g3/u6e2Oc55H6pPzXQIDfpywhWKXZ0cihs6xntABhaV/U8BK0OkYMy4ArA3uBIBz4620LuBEpyUeb7B3To3uXzIlGvdI1uBYkCzg7t8cJOo1iSJVUdeFthq974VTz5MgRTWUcwpaVsykYxmtNwN8q4aZpN9dO/U0wx3dZ4xubF1yIz847KVvXwi9VbZMtPKae6m/Aroe9Ijqjqb9Xg== 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=8D6L4E/yOxXNnApcjCDxJDmkPqDQglSjJq9Re+q5zt4=; b=Iae58i9aqMvhzTYiVMcw7dKDKM23CPWXI4HPTkaYmv5m3i4goTGxmiAUbaGyPpBu15MbmuEoczTRsd2nAQQ45TKr93p8W3savYddrusQc6zFkHzZcaaiNcVaNVNJeEKdIfczuapZthleSAFJRxpAFuQOkWoauD5DCgij6dPqkWDz2xa/x5sLMo0OMZelskjPN938lC55H0N+z5nXS68Xp55M9JgpmWqr8fCTSO6r4RSmDUDyshV8rYPep4kYno1P4NICjK9MkP8Jy0xHiynehC31uRMAQyALNnvAGsLXggX2ZVA9HA9/ryuqmRbmnDOQYLhYVVX0NQV/qK0SxYSl+Q== 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=8D6L4E/yOxXNnApcjCDxJDmkPqDQglSjJq9Re+q5zt4=; b=jFHjeEhQVgQQO01ST/lKCRyLog5XqIDqAVPIslTaj+fEBy3+GIUleVPlUEdtgi207akv3WaRt/SGpU4djYOmbSg+7Lpc7LzvrJvc4i8y1cK7l7xlZNnghVbAv7MF/jcqkBdS9UkoXGog11+gunS2RYuviEmpvd/lzuBcnyWkaOA= 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 PR3PR04MB7436.eurprd04.prod.outlook.com (2603:10a6:102:87::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.26; Thu, 16 Feb 2023 23:21:50 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::3cfb:3ae7:1686:a68b]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::3cfb:3ae7:1686:a68b%4]) with mapi id 15.20.6086.026; Thu, 16 Feb 2023 23:21:50 +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 , linux-kernel@vger.kernel.org Subject: [PATCH net-next 09/12] net/sched: mqprio: allow per-TC user input of FP adminStatus Date: Fri, 17 Feb 2023 01:21:23 +0200 Message-Id: <20230216232126.3402975-10-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230216232126.3402975-1-vladimir.oltean@nxp.com> References: <20230216232126.3402975-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: VI1PR0501CA0018.eurprd05.prod.outlook.com (2603:10a6:800:92::28) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5136:EE_|PR3PR04MB7436:EE_ X-MS-Office365-Filtering-Correlation-Id: 975b2c76-86ca-4bc7-4303-08db107494f1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0xIF8bXTVzrjbkmJpVU8oldyGXfm3osI/Vt4Vo8gbXyTgh9eJ8PRBE2U7IWXKdTFDEkfY23+p0rWxNQkwzXwYIhf9IyoTcD9i+hRiOzah1kG0v1wm81MDTS05WrnPKFhBNVAIGgayZxL2B3D0rclI66gPP5KMAoLpw/EuYeH7vljgZ3YwhtueuCw6vcVwUFKp7IOw0u02deTc1LRnNTHXRPrNETqN4V886jy+q9GtJ/ooNRq13EVVDFC2Q1Fbf2HkMLFJNPx8JTXjTJ4+P44AzD+S4ivZHXWo+MJ38l/bInf0ZgsCZYpjES6U5FBZvSyEMAUai8Vj4hGpSzqVo3t0q2haebi9/eGthNmkexMwiB5y9wxiGV4NuJPyyov93JZV8+138dkLfwTc+C4raIuv3o1ZDVy6DCI8+FEVV24tOokkv828TYQ8WOwJV2AP9tOfauT81nKMhw82K3WZsm9tVNA7+HnMobIxmYiMd1TzF7CDC09L2sTunowYsYemouREQnZCKcYwSrYtOG270yzNsDlSXEDEngsAQBFR8XC7vzOBVztWo8HBMRkkJ7c2iQLqYidHX5SMq6WBvqjhrlX1jPlstKCjoaBzqBHOiW2qEX0uJH8trz1c3RT9hiCj7fESZBvvOIt4egyefU211Efr7t34jWz4xnpWPAS7mc1d5gyh9Qukk/WC5SOfiFP6hX5fK2PJ2UuAz+9oSTqG/QVMw== 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)(376002)(366004)(396003)(136003)(39860400002)(346002)(451199018)(38100700002)(2906002)(38350700002)(44832011)(7416002)(83380400001)(66476007)(2616005)(86362001)(478600001)(6916009)(66556008)(36756003)(5660300002)(41300700001)(6506007)(52116002)(6666004)(4326008)(66946007)(6486002)(54906003)(186003)(316002)(8936002)(26005)(6512007)(1076003)(8676002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: RNeIBKzGv+jK1PS9y/NC5zzoDiMG3RnJAnclDpYGo+PirP9yKAD9MXusmDxA7YsMxH1rDcmvx4caMK3fDhLYh7l8RMipKrpxyU/q8uP/UvP/xZYCchz5RTjSSAfiQ3pHTDj8HDS0q6mbNu5pBDUZNIovScz9iMVI1Fb8pjzmdDLD3P4aMtos24eXRVvu4rFyTpa1CR7IpYjobOms75K70BrIHmhdA9OaFLMOtK/zWt13A3JwgaJm2ihyFJLR6yWc6GmjG7uIpAaHRWDfxwjLdMnBXwMibv/lbEnaUAbIQaSEL+UWU9QNgiSQmRf+7ZBpuxgQUng/Xn1Lc/bIngH4z0X6EhjRLe1SXvXQjUQRXr/i7tsC/+d5V2N5AV28j/VR46AVIak4zcscMmRxUUGQH0sAflP5W0weeWfxsnE4kC9ec7OO4dlZSUaRcbstwAWd+3fsXWlyMal5Z6gieLP8cHDE3mgT2ow3R1lBw1VI1veC6kNt6HkxCuaIaQFulbdxwaHGfae0ZWoSy5qgRPelUxEpkG6JWUUN/PdH5qij5JmwfIay2o9PmVi1nK+uBmdL0sX7ef6RgFkrFaUuOMRztGnHyZYJpPuxzL6xplk9IPIPdY++XbUUNMQY7wdTu8i08NqnfVW8D2IVJKvxNr9zWfRix8VwuKLTvIAb8bJtcoQqJ7bUvU+KzgqLVEGKQAUE7wvYcKVzn1y06XeVe1psh99RxUlLcTGzfL1qpbwRqd4/OfnOQa02vM94TMPWWfrAw3WDDibo0SUmyRuZR1uRFvr9LqxDZWZMmyZG5ecueRMsL80F5iFg8baxbbvk24hOL7kxciXpkZE8dV61o9RdkfMI3kb3RlA1dwfd0HhJE8pahk3fhu6i8pTRzGFdSJFXW1SCTcc3U3mdIpGkFDQ8900aXmQvf9S6lLCZIzOOc2tTI/oKbKLWNfqC+Mjr5e9zs7QmGENwNu2ykqkaj3+8PnPfGOUA4bq2lPIul2v9WNKcB6gEVPyIHtSK8hA1zz+alkb3+bSIerBGTq0znlSazXJ2jNjTVY7V49iDauuycPZfAsdZYfwLugqYpyBEWMy+Lcv2G5qXB2lBzoqXoCjlGDhA3HI43caoQzHSQRsfy4KRkjpCO4mPkF0eXo6FlABmTVVA+MV2vu0+Sugbki5Z+NDoDnexNjNnUcz1AcoX1SNtNGVpQeSsmbEZkB6HxDgbDUdLLaKac6r/jI4GzPET8O1kvrfu+5Ci5hgY4hAFg6XzlJ/V3rKlmcYWL0E9ls+OiVngv4F6h1ERlcOlDnCCqMyng/SwojBYF5EejkZDgAUObq3nLKWS7dGUxXStGeo2evdIaFsCpl0ZeU+BG72nrhIkTa7sckkbycc9w3aJ5WS+eUJem2jPXwQ1aJoDP1uAZGppjagoeDsdwp12GN+Jjum9kW3p2+BuDjJW7xJf3PEsFKpkJMFIzn2xpeK1hw7EOojet4JzlHg0KGB9WAfGQAC39rlNUKP2cmH4j0ZaC1sTecOMkPnsnT+d+9VyUF3d7nqjNq3QsoIh4/TmLqzwT+81+2ZZdWQWAvhFhbR36QutSgQFFSfQgVirgCRw2CAHzdCa/Uc8APsDJXlTosWyNA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 975b2c76-86ca-4bc7-4303-08db107494f1 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Feb 2023 23:21:50.6178 (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: Ov9T3255tn4VpilmsEoSJMPbtsm0OoViBieEvLxAPX58iRz8L/nE3hw7waIOeR9PdGY76IK1cBT3OOEgu+przQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR04MB7436 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_NONE,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?1758031869227693474?= X-GMAIL-MSGID: =?utf-8?q?1758031869227693474?= IEEE 802.1Q-2018 clause 6.7.2 Frame preemption specifies that each packet priority can be assigned to a "frame preemption status" value of either "express" or "preemptible". Express priorities are transmitted by the local device through the eMAC, and preemptible priorities through the pMAC (the concepts of eMAC and pMAC come from the 802.3 MAC Merge layer). The FP adminStatus is defined per packet priority, but 802.1Q clause 12.30.1.1.1 framePreemptionAdminStatus also says that: | Priorities that all map to the same traffic class should be | constrained to use the same value of preemption status. It is impossible to ignore the cognitive dissonance in the standard here, because it practically means that the FP adminStatus only takes distinct values per traffic class, even though it is defined per priority. I can see no valid use case which is prevented by having the kernel take the FP adminStatus as input per traffic class (what we do here). In addition, this also enforces the above constraint by construction. User space network managers which wish to expose FP adminStatus per priority are free to do so; they must only observe the prio_tc_map of the netdev. The reason for configuring frame preemption as a property of the Qdisc layer is that the information about "preemptible TCs" is closest to the place which handles the num_tc and prio_tc_map of the netdev. If the UAPI would have been any other layer, it would be unclear what to do with the FP information when num_tc collapses to 0. A key assumption is that only mqprio/taprio change the num_tc and prio_tc_map of the netdev. Not sure if that's a great assumption to make. Having FP in tc-mqprio can be seen as an implementation of the use case defined in 802.1Q Annex S.2 Preemption used in isolation. There will be a separate implementation of FP in tc-taprio. Signed-off-by: Vladimir Oltean --- include/net/pkt_sched.h | 1 + include/uapi/linux/pkt_sched.h | 16 +++++ net/sched/sch_mqprio.c | 126 ++++++++++++++++++++++++++++++++- net/sched/sch_mqprio_lib.c | 14 ++++ net/sched/sch_mqprio_lib.h | 2 + 5 files changed, 158 insertions(+), 1 deletion(-) diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h index 2016839991a4..23be97f542fc 100644 --- a/include/net/pkt_sched.h +++ b/include/net/pkt_sched.h @@ -172,6 +172,7 @@ struct tc_mqprio_qopt_offload { u32 flags; u64 min_rate[TC_QOPT_MAX_QUEUE]; u64 max_rate[TC_QOPT_MAX_QUEUE]; + unsigned long preemptible_tcs; }; struct tc_taprio_caps { diff --git a/include/uapi/linux/pkt_sched.h b/include/uapi/linux/pkt_sched.h index 000eec106856..b8d29be91b62 100644 --- a/include/uapi/linux/pkt_sched.h +++ b/include/uapi/linux/pkt_sched.h @@ -719,6 +719,11 @@ enum { #define __TC_MQPRIO_SHAPER_MAX (__TC_MQPRIO_SHAPER_MAX - 1) +enum { + TC_FP_EXPRESS = 1, + TC_FP_PREEMPTIBLE = 2, +}; + struct tc_mqprio_qopt { __u8 num_tc; __u8 prio_tc_map[TC_QOPT_BITMASK + 1]; @@ -732,12 +737,23 @@ struct tc_mqprio_qopt { #define TC_MQPRIO_F_MIN_RATE 0x4 #define TC_MQPRIO_F_MAX_RATE 0x8 +enum { + TCA_MQPRIO_TC_ENTRY_UNSPEC, + TCA_MQPRIO_TC_ENTRY_INDEX, /* u32 */ + TCA_MQPRIO_TC_ENTRY_FP, /* u32 */ + + /* add new constants above here */ + __TCA_MQPRIO_TC_ENTRY_CNT, + TCA_MQPRIO_TC_ENTRY_MAX = (__TCA_MQPRIO_TC_ENTRY_CNT - 1) +}; + enum { TCA_MQPRIO_UNSPEC, TCA_MQPRIO_MODE, TCA_MQPRIO_SHAPER, TCA_MQPRIO_MIN_RATE64, TCA_MQPRIO_MAX_RATE64, + TCA_MQPRIO_TC_ENTRY, __TCA_MQPRIO_MAX, }; diff --git a/net/sched/sch_mqprio.c b/net/sched/sch_mqprio.c index 52cfc0ec2e23..2db0802c2ce8 100644 --- a/net/sched/sch_mqprio.c +++ b/net/sched/sch_mqprio.c @@ -28,6 +28,7 @@ struct mqprio_sched { u32 flags; u64 min_rate[TC_QOPT_MAX_QUEUE]; u64 max_rate[TC_QOPT_MAX_QUEUE]; + u32 fp[TC_QOPT_MAX_QUEUE]; /* only for dump and offloading */ }; static int mqprio_enable_offload(struct Qdisc *sch, @@ -61,6 +62,8 @@ static int mqprio_enable_offload(struct Qdisc *sch, return -EINVAL; } + mqprio_fp_to_offload(priv->fp, &mqprio); + err = dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_QDISC_MQPRIO, &mqprio); if (err) @@ -143,13 +146,94 @@ static int mqprio_parse_opt(struct net_device *dev, struct tc_mqprio_qopt *qopt, return 0; } +static const struct +nla_policy mqprio_tc_entry_policy[TCA_MQPRIO_TC_ENTRY_MAX + 1] = { + [TCA_MQPRIO_TC_ENTRY_INDEX] = NLA_POLICY_MAX(NLA_U32, + TC_QOPT_MAX_QUEUE), + [TCA_MQPRIO_TC_ENTRY_FP] = NLA_POLICY_RANGE(NLA_U32, + TC_FP_EXPRESS, + TC_FP_PREEMPTIBLE), +}; + static const struct nla_policy mqprio_policy[TCA_MQPRIO_MAX + 1] = { [TCA_MQPRIO_MODE] = { .len = sizeof(u16) }, [TCA_MQPRIO_SHAPER] = { .len = sizeof(u16) }, [TCA_MQPRIO_MIN_RATE64] = { .type = NLA_NESTED }, [TCA_MQPRIO_MAX_RATE64] = { .type = NLA_NESTED }, + [TCA_MQPRIO_TC_ENTRY] = { .type = NLA_NESTED }, }; +static int mqprio_parse_tc_entry(u32 fp[TC_QOPT_MAX_QUEUE], + struct nlattr *opt, + unsigned long *seen_tcs, + struct netlink_ext_ack *extack) +{ + struct nlattr *tb[TCA_MQPRIO_TC_ENTRY_MAX + 1] = { }; + int err, tc; + + err = nla_parse_nested(tb, TCA_MQPRIO_TC_ENTRY_MAX, opt, + mqprio_tc_entry_policy, extack); + if (err < 0) + return err; + + if (!tb[TCA_MQPRIO_TC_ENTRY_INDEX]) { + NL_SET_ERR_MSG(extack, "TC entry index missing"); + return -EINVAL; + } + + tc = nla_get_u32(tb[TCA_MQPRIO_TC_ENTRY_INDEX]); + if (*seen_tcs & BIT(tc)) { + NL_SET_ERR_MSG(extack, "Duplicate tc entry"); + return -EINVAL; + } + + *seen_tcs |= BIT(tc); + + if (tb[TCA_MQPRIO_TC_ENTRY_FP]) + fp[tc] = nla_get_u32(tb[TCA_MQPRIO_TC_ENTRY_FP]); + + return 0; +} + +static int mqprio_parse_tc_entries(struct Qdisc *sch, struct nlattr *nlattr_opt, + int nlattr_opt_len, + struct netlink_ext_ack *extack) +{ + struct mqprio_sched *priv = qdisc_priv(sch); + struct net_device *dev = qdisc_dev(sch); + bool have_preemption = false; + unsigned long seen_tcs = 0; + u32 fp[TC_QOPT_MAX_QUEUE]; + struct nlattr *n; + int tc, rem; + int err = 0; + + for (tc = 0; tc < TC_QOPT_MAX_QUEUE; tc++) + fp[tc] = priv->fp[tc]; + + nla_for_each_attr(n, nlattr_opt, nlattr_opt_len, rem) { + if (nla_type(n) != TCA_MQPRIO_TC_ENTRY) + continue; + + err = mqprio_parse_tc_entry(fp, n, &seen_tcs, extack); + if (err) + goto out; + } + + for (tc = 0; tc < TC_QOPT_MAX_QUEUE; tc++) { + priv->fp[tc] = fp[tc]; + if (fp[tc] == TC_FP_PREEMPTIBLE) + have_preemption = true; + } + + if (have_preemption && !ethtool_dev_mm_supported(dev)) { + NL_SET_ERR_MSG(extack, "Device does not support preemption"); + return -EOPNOTSUPP; + } +out: + return err; +} + /* Parse the other netlink attributes that represent the payload of * TCA_OPTIONS, which are appended right after struct tc_mqprio_qopt. */ @@ -232,6 +316,13 @@ static int mqprio_parse_nlattr(struct Qdisc *sch, struct tc_mqprio_qopt *qopt, priv->flags |= TC_MQPRIO_F_MAX_RATE; } + if (tb[TCA_MQPRIO_TC_ENTRY]) { + err = mqprio_parse_tc_entries(sch, nlattr_opt, nlattr_opt_len, + extack); + if (err) + return err; + } + return 0; } @@ -245,7 +336,7 @@ static int mqprio_init(struct Qdisc *sch, struct nlattr *opt, int i, err = -EOPNOTSUPP; struct tc_mqprio_qopt *qopt = NULL; struct tc_mqprio_caps caps; - int len; + int len, tc; BUILD_BUG_ON(TC_MAX_QUEUE != TC_QOPT_MAX_QUEUE); BUILD_BUG_ON(TC_BITMASK != TC_QOPT_BITMASK); @@ -263,6 +354,9 @@ static int mqprio_init(struct Qdisc *sch, struct nlattr *opt, if (!opt || nla_len(opt) < sizeof(*qopt)) return -EINVAL; + for (tc = 0; tc < TC_QOPT_MAX_QUEUE; tc++) + priv->fp[tc] = TC_FP_EXPRESS; + qdisc_offload_query_caps(dev, TC_SETUP_QDISC_MQPRIO, &caps, sizeof(caps)); @@ -413,6 +507,33 @@ static int dump_rates(struct mqprio_sched *priv, return -1; } +static int mqprio_dump_tc_entries(struct mqprio_sched *priv, + struct sk_buff *skb) +{ + struct nlattr *n; + int tc; + + for (tc = 0; tc < TC_QOPT_MAX_QUEUE; tc++) { + n = nla_nest_start(skb, TCA_MQPRIO_TC_ENTRY); + if (!n) + return -EMSGSIZE; + + if (nla_put_u32(skb, TCA_MQPRIO_TC_ENTRY_INDEX, tc)) + goto nla_put_failure; + + if (nla_put_u32(skb, TCA_MQPRIO_TC_ENTRY_FP, priv->fp[tc])) + goto nla_put_failure; + + nla_nest_end(skb, n); + } + + return 0; + +nla_put_failure: + nla_nest_cancel(skb, n); + return -EMSGSIZE; +} + static int mqprio_dump(struct Qdisc *sch, struct sk_buff *skb) { struct net_device *dev = qdisc_dev(sch); @@ -463,6 +584,9 @@ static int mqprio_dump(struct Qdisc *sch, struct sk_buff *skb) (dump_rates(priv, &opt, skb) != 0)) goto nla_put_failure; + if (mqprio_dump_tc_entries(priv, skb)) + goto nla_put_failure; + return nla_nest_end(skb, nla); nla_put_failure: nlmsg_trim(skb, nla); diff --git a/net/sched/sch_mqprio_lib.c b/net/sched/sch_mqprio_lib.c index c58a533b8ec5..83b3793c4012 100644 --- a/net/sched/sch_mqprio_lib.c +++ b/net/sched/sch_mqprio_lib.c @@ -114,4 +114,18 @@ void mqprio_qopt_reconstruct(struct net_device *dev, struct tc_mqprio_qopt *qopt } EXPORT_SYMBOL_GPL(mqprio_qopt_reconstruct); +void mqprio_fp_to_offload(u32 fp[TC_QOPT_MAX_QUEUE], + struct tc_mqprio_qopt_offload *mqprio) +{ + unsigned long preemptible_tcs = 0; + int tc; + + for (tc = 0; tc < TC_QOPT_MAX_QUEUE; tc++) + if (fp[tc] == TC_FP_PREEMPTIBLE) + preemptible_tcs |= BIT(tc); + + mqprio->preemptible_tcs = preemptible_tcs; +} +EXPORT_SYMBOL_GPL(mqprio_fp_to_offload); + MODULE_LICENSE("GPL"); diff --git a/net/sched/sch_mqprio_lib.h b/net/sched/sch_mqprio_lib.h index 63f725ab8761..079f597072e3 100644 --- a/net/sched/sch_mqprio_lib.h +++ b/net/sched/sch_mqprio_lib.h @@ -14,5 +14,7 @@ int mqprio_validate_qopt(struct net_device *dev, struct tc_mqprio_qopt *qopt, struct netlink_ext_ack *extack); void mqprio_qopt_reconstruct(struct net_device *dev, struct tc_mqprio_qopt *qopt); +void mqprio_fp_to_offload(u32 fp[TC_QOPT_MAX_QUEUE], + struct tc_mqprio_qopt_offload *mqprio); #endif From patchwork Thu Feb 16 23:21:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 58284 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp589146wrn; Thu, 16 Feb 2023 15:39:11 -0800 (PST) X-Google-Smtp-Source: AK7set97pkgleCnytdPhTMTffwxBTSNZRJfIrAUrOblmVcj17oKCFG5lxfYEdhws1e/0ezqgKXqZ X-Received: by 2002:a17:902:d484:b0:19a:8b3a:fad with SMTP id c4-20020a170902d48400b0019a8b3a0fadmr9586708plg.20.1676590751383; Thu, 16 Feb 2023 15:39:11 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1676590751; cv=pass; d=google.com; s=arc-20160816; b=jpMGpAKXhIOLGiQHF+mx+dicMSPDCLntNLrWLdXAZJQmB+kSyPzjbp+O7JS3Q0mhV5 7gDBNVSpkZhClSLS99WC6VisTay/hAOr/SfadvTKC0JVtohN/3hJ61sLxDX7MV+u0O3p tOKuduWuLLWYy++YTHOJLLm+quAXA6n8fFAPylNx1hNc9Ks4f93NBpx7tF2m4Q8360ZD 4+I0W9GhA+f2V5dfOp+TvAgwiQ/m1q/A2nfulgxooMT9KptX9ybh4McmiR7WvGMp5Ndi RTK4Mx5CBJM1KoFne6RcRu1aCAREYhd+JEDcNKRwdtO27h9LIGzr1GbC1LzMxqcN1ghn ozNA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=dCvDGlqEhmhBrzdjS8pON7A+LMxlN3DCWgftb1a0e4c=; b=ydpCZ7YbzlNDYk66qG3mBmsoLPl10+bFYukNEf+cbQcaMmJAdSiTuizv2qFKioY7dN 4tRcrdozxEEjcRsHwZmz+PQkqmPWLoxFOfp61o1twyzhuXalTyx7JEyk+YFRwT8i6D3k 9OZMoGfOC5UCvZVcZIvRUd5OeG1mJMP+jDFfJxZRDj25za8RfthPXRX4zL5gPQBbhVRJ 2s+3nxnzpuKlI3Pa6Z7aW4gmjzdY96BpoDha4EBZSi63FhTZaIwTfEsMXbUDEw8AN4G4 OWrFMmvBqIRjhcUibV/rLkEZmyrbzydCT9fXnAQSmTfygTtdesfljwROzZBYhUx2GF1y eoCA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=XMfhiQs+; 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 o17-20020a639211000000b004fb35911c7csi3266133pgd.34.2023.02.16.15.38.58; Thu, 16 Feb 2023 15:39:11 -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=XMfhiQs+; 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 S230150AbjBPXXP (ORCPT + 99 others); Thu, 16 Feb 2023 18:23:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230012AbjBPXWx (ORCPT ); Thu, 16 Feb 2023 18:22:53 -0500 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2089.outbound.protection.outlook.com [40.107.104.89]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 037B65649A; Thu, 16 Feb 2023 15:22:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SEMZcOzVKmNcmCDrlxVxu5mqgtaCMCVFDtzbtJO3SRRhCJ3lTsr/CJQ77P/I1z1hOK3Bbj8WFNPDCYPQRnh+c+cra3JWIHRn8imZ3ARnjiCB9qKeY+uX8pd3wS2ciqxuybq2XdxmAg3fbjbTq3xoZFLu60hkcYARvVL2qMC39fhwaFhEuwOKOQJxwqiLycV3uqUPJX0yZk/iAzC/OHl3SJbh7ZG0YhyvWzHDvmfJoZBxJtzvVFNgOXir7kIsZN8nK0bdu1DbmYAWTjRi1+QHBni5yVRNFSwYQfyLEQDf2tH05XvgOVe7xATOBB+yPgAq5vW58BWNrNnN1Ohg6e3LkA== 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=dCvDGlqEhmhBrzdjS8pON7A+LMxlN3DCWgftb1a0e4c=; b=gv6HjnAL3bZ+fm/AsYlzgXrI3cII2KhDWWP9YnbblvF3ky7Y34ZoUA91AW9F7bxVCw/wU7h2Umt3BVR6pioLt5LjysaiwJUEsIXkDMpMGZ1kDWWF7aQu8jjP9JLjeF4c0hAhHB4jtWLy9kDnjVnuZSztQ0ktFFsJOnPFsJL/gdAMK0+vGfdj8Ybi4AWX5sBNaZxPvf9f7tjZ7blXfJp6tGNIvcbv2kXWzlSmrJTNgCa1nIxnXFgqJs5uIpJOnZhSW1tDM8WI1GoAWMV/zvxNtS4qXkvl9h+x8O7nQ5bXTmvpXK8ns8OQRcj3Ieg3aTLfi8P08MHwmnIV0JemUda88g== 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=dCvDGlqEhmhBrzdjS8pON7A+LMxlN3DCWgftb1a0e4c=; b=XMfhiQs+4xW4wgkK40Qes54uo6WI3v2+E79njHCEmLVXXiYc3jJIfz+qUB+Pt/XzjW+7YaNxj4psG7Z+1JWpjNT9q0abMYMsfdqZUDM83elSQTYZAXbFbyUZabcQdqWiRAW6kNCrWp9YNxO/0z3RpLIdNCVZB+KdLBWNqCX+5Ps= 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 PR3PR04MB7436.eurprd04.prod.outlook.com (2603:10a6:102:87::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.26; Thu, 16 Feb 2023 23:21:51 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::3cfb:3ae7:1686:a68b]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::3cfb:3ae7:1686:a68b%4]) with mapi id 15.20.6086.026; Thu, 16 Feb 2023 23:21:51 +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 , linux-kernel@vger.kernel.org Subject: [PATCH net-next 10/12] net/sched: taprio: allow per-TC user input of FP adminStatus Date: Fri, 17 Feb 2023 01:21:24 +0200 Message-Id: <20230216232126.3402975-11-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230216232126.3402975-1-vladimir.oltean@nxp.com> References: <20230216232126.3402975-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: VI1PR0501CA0018.eurprd05.prod.outlook.com (2603:10a6:800:92::28) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5136:EE_|PR3PR04MB7436:EE_ X-MS-Office365-Filtering-Correlation-Id: 866e3292-624f-4095-9b5e-08db1074958e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XTb/A/qxWQLqjJucye1ye2OAfzO5x3Xm2qlzhN1g4LB4EYpjgbnhH/Oqw2II71Y+IyDpb8iRxMQoeNF4wL+UP2zX6FG9ljrjNObUwYP2/AUVNDdI7f3Y9j+QSOtMk6nk1eUevP/RKNIG+zVGqQu7+cZjf/hwCGkwdV3vC2laDtqGAygl/jvadJW1M2ziQ5X1I4dJSnRDO61Loh47hn8VOFbWMKwAKVhL8E7k/h35QJvO04uza0bOQRABhx2/l+nPnnaKl90/RxeMaEiEtmzvmRIt6hyCDqaKgRhxCChIvo1hWwxy16E2JmFj/OghRidpJmz6tKLjBXkSZRRAaujPLkU1BnNQPb0pidaYvkjUtXezOkxusS13k1rSV/5/n1ihVDXVbNigg0F40e95oHQ5Gk5vpm8A+o0HWJYLT1jcZs+8zS9jFrD9E8djQ4YjGuGeW5bv2vCCnKd/beDTHeGjqUe/6P4+Gdt3Q/gypLLjoQ21Kn7dXaOMi/lpkl/v29Y8Z9kN9M81f9WKo3yX7WKU7P4VZbaSoxOBrFOZM7fW5EVSPQ3/NR9AWBKfN+WKccHl1v9AUU5WCu7z+Il3M3bKP1J69uQJ83zZDggXK9TGlN+IBWr//JVA0lDWOq9Ua1WUWCWvNqBZDgG5RAMvbLO3S6Ej20R1DKobwvq8xJDcZyPmJQ1bJ7ijwPNvdmxC9sgW8KswfTj0YiBmhtlFVB/XEg== 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)(376002)(366004)(396003)(136003)(39860400002)(346002)(451199018)(38100700002)(2906002)(38350700002)(44832011)(7416002)(83380400001)(66476007)(2616005)(86362001)(478600001)(6916009)(66556008)(36756003)(5660300002)(41300700001)(6506007)(52116002)(6666004)(4326008)(66946007)(6486002)(54906003)(186003)(316002)(8936002)(26005)(6512007)(1076003)(8676002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: /I+1O/x6f5xpSBvZL1jxU4PmvaWlENKjdQXNrYTmp+pFlft5GwzVZnrLjy8Nl0uKGj2lpUtPD88ETJAKyHPHAHFaAWOGUdGz77b2S0P9+DxMLUBR+bU3AlMnYJD/2FPyyLzEZke0KG3UPbVbKVJWinzxjjSqvqKQGJlDvVukQNpWccts/aFKJhv3wtR/u6RpUpDysBomUM7wX0kSToUck4ET5PHifXnqxSSgiNoERBysO+QnPvhfTDjVgnbBl8ni8fgCOvg54lmaEVV8x07ooBAMoWpvhXXBo9iwURHmWx2yVZ/bcKE3mK1SnL2dvXJF0z1IoYpdPP2I7MREZCJnT1xsfDNEuA3Wz1UeORJJK0rxIj7LRJzHTxhRhvU+SxEN9uLWIXqpZHOANXAygbnr4RKxr5INpodinLCe6Tf7bUV8CsxGJ06O2NJYVs9ecwA6YM+44i9s/2G8qvviZ1S+6KFBz+c5s2MYamQt5AK0TcTiVtK/9TKJRa6HUr/17Yno3fkCj91p2RjpsceYFsdt1Esob3Hfh/O7EH8Jnq15uEF3OjS+OEkoe0KWNrYSdHqn8GudVtq3QbGfk0ywJjSwc8alMd5AvTv+18LkVVp+FWN8/rRwQYbZoyDLF7N8GvnTaLuxabS2H7GN6tBOxhtq/lAAJl/RW00N69R8DddyyOU8XSkbO9ieQ7wke3jT/GvkVKk++uvFYjVsG+5gqcd4dJtSe9BB+QknQGiHIANaj+adWv4uDSQEdxceSi3c+4iiUBuiSm4Vbgh19f0r2TE8rKVyEHAR7VwTrPST17z2rc7ZnSi7GZT4w6hWfUXwScUE8VUPDbnaiN/A/c9pSGxswkYsI05tcWyxd33Qxditdf6P/g+xQ5Ae+BPSayjsYSoW+kd2mgjQXY6rymVGr8PCmjJ6FoVHO35KhWE+WjhCAPhlsjvut6oU65VF/CruVmNH78tXkm50eLifKtexnBHoNPZT+m/gEEBIYKUx9UomC5e2oFfgBDlsRSN9kiV4wBOyOxTVNKnil+FZ1lQ7rYrPnZh+Scu6NljwH+UsHf5XfgH0QMZ5M6+bse/WICwcr2FrkvjeWW+/7f3myrz+COrfqvcGJbvOsetx8f/nJDJlqEVG6ZjOe7yMwY1c+IDYf1BTNpH5NUZrE0KEu+Nfbq7TSY06N4yCu54hrPVjQZOlniA8ecV6rmpDKLF0KSkLUBaVrkZuom171wwn29L0SGVDbUL6Tr9X9KcuNsrjKGasLyI2t1os8gTyV4xhWsJ+7hgxfbgsGvb4MH8IbKYlAVYVLdQVOgKkgzLX4Blgs+xGrT3dhNDOA/qc0lsbqMRhnhXkj/HvfsLFmzvBJXlxG8Is7IFnJ/jI6It5uX7+7TUASKcRXg/39VkG7x3pppUhSy6jMLEiobIsHMKV+O7z+bOwZ3sT+dWhht5POeh27GNMBJ/jybLQeBQSLKSlzJhzFV7SDT3QieRuilWJgMG0B+CXYiScdMWwL8l8SbzqI2N8NKO0IkJzfqdWyhoeU21MfCuE0KMdZDXCUW8JBsggR/mbHrWd4p1CHTnF7Be0EFFOB/njwA5TsfIwTQhD8fOkFMXCfCH4gyoTpa3hl/ZjH7fGWg== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 866e3292-624f-4095-9b5e-08db1074958e X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Feb 2023 23:21:51.7115 (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: 9RZaXCZm0066613oHBlFoj1I3foNaWyJSzPsHbl4DcdO2e/ihSK0k6i9xC1zpQXdbQjl3L5Nx2a/nWpnHBF/uQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR04MB7436 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_NONE,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?1758032823759734800?= X-GMAIL-MSGID: =?utf-8?q?1758032823759734800?= This is a duplication of the FP adminStatus logic introduced for tc-mqprio. Offloading is done through the tc_mqprio_qopt_offload structure embedded within tc_taprio_qopt_offload. So practically, if a device driver is written to treat the mqprio portion of taprio just like standalone mqprio, it gets unified handling of frame preemption. I would have reused more code with taprio, but this is mostly netlink attribute parsing, which is hard to transform into generic code without having something that stinks as a result. We have the same variables with the same semantics, just different nlattr type values (TCA_MQPRIO_TC_ENTRY=5 vs TCA_TAPRIO_ATTR_TC_ENTRY=12; TCA_MQPRIO_TC_ENTRY_FP=2 vs TCA_TAPRIO_TC_ENTRY_FP=3, etc) and consequently, different policies for the nest. Every time nla_parse_nested() is called, an on-stack table "tb" of nlattr pointers is allocated statically, up to the maximum understood nlattr type. That array size is hardcoded as a constant, but when transforming this into a common parsing function, it would become either a VLA (which the Linux kernel rightfully doesn't like) or a call to the allocator. Having FP adminStatus in tc-taprio can be seen as addressing the 802.1Q Annex S.3 "Scheduling and preemption used in combination, no HOLD/RELEASE" and S.4 "Scheduling and preemption used in combination with HOLD/RELEASE" use cases. HOLD and RELEASE events are emitted towards the underlying MAC Merge layer when the schedule hits a Set-And-Hold-MAC or a Set-And-Release-MAC gate operation. A small part of the change is dedicated to refactoring the max_sdu nlattr parsing to put all logic under the "if" that tests for presence of that nlattr. Signed-off-by: Vladimir Oltean --- include/uapi/linux/pkt_sched.h | 1 + net/sched/sch_taprio.c | 65 +++++++++++++++++++++++++++------- 2 files changed, 53 insertions(+), 13 deletions(-) diff --git a/include/uapi/linux/pkt_sched.h b/include/uapi/linux/pkt_sched.h index b8d29be91b62..51a7addc56c6 100644 --- a/include/uapi/linux/pkt_sched.h +++ b/include/uapi/linux/pkt_sched.h @@ -1252,6 +1252,7 @@ enum { TCA_TAPRIO_TC_ENTRY_UNSPEC, TCA_TAPRIO_TC_ENTRY_INDEX, /* u32 */ TCA_TAPRIO_TC_ENTRY_MAX_SDU, /* u32 */ + TCA_TAPRIO_TC_ENTRY_FP, /* u32 */ /* add new constants above here */ __TCA_TAPRIO_TC_ENTRY_CNT, diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c index 9781b47962bb..c799361adea4 100644 --- a/net/sched/sch_taprio.c +++ b/net/sched/sch_taprio.c @@ -7,6 +7,7 @@ */ #include +#include #include #include #include @@ -96,6 +97,7 @@ struct taprio_sched { struct list_head taprio_list; int cur_txq[TC_MAX_QUEUE]; u32 max_sdu[TC_MAX_QUEUE]; /* save info from the user */ + u32 fp[TC_QOPT_MAX_QUEUE]; /* only for dump and offloading */ u32 txtime_delay; }; @@ -994,6 +996,9 @@ static const struct nla_policy entry_policy[TCA_TAPRIO_SCHED_ENTRY_MAX + 1] = { static const struct nla_policy taprio_tc_policy[TCA_TAPRIO_TC_ENTRY_MAX + 1] = { [TCA_TAPRIO_TC_ENTRY_INDEX] = { .type = NLA_U32 }, [TCA_TAPRIO_TC_ENTRY_MAX_SDU] = { .type = NLA_U32 }, + [TCA_TAPRIO_TC_ENTRY_FP] = NLA_POLICY_RANGE(NLA_U32, + TC_FP_EXPRESS, + TC_FP_PREEMPTIBLE), }; static const struct nla_policy taprio_policy[TCA_TAPRIO_ATTR_MAX + 1] = { @@ -1514,6 +1519,7 @@ static int taprio_enable_offload(struct net_device *dev, offload->enable = 1; mqprio_qopt_reconstruct(dev, &offload->mqprio.qopt); taprio_sched_to_offload(dev, sched, offload, &caps); + mqprio_fp_to_offload(q->fp, &offload->mqprio); for (tc = 0; tc < TC_MAX_QUEUE; tc++) offload->max_sdu[tc] = q->max_sdu[tc]; @@ -1655,13 +1661,14 @@ static int taprio_parse_clockid(struct Qdisc *sch, struct nlattr **tb, static int taprio_parse_tc_entry(struct Qdisc *sch, struct nlattr *opt, u32 max_sdu[TC_QOPT_MAX_QUEUE], + u32 fp[TC_QOPT_MAX_QUEUE], unsigned long *seen_tcs, struct netlink_ext_ack *extack) { struct nlattr *tb[TCA_TAPRIO_TC_ENTRY_MAX + 1] = { }; struct net_device *dev = qdisc_dev(sch); - u32 val = 0; int err, tc; + u32 val; err = nla_parse_nested(tb, TCA_TAPRIO_TC_ENTRY_MAX, opt, taprio_tc_policy, extack); @@ -1686,15 +1693,18 @@ static int taprio_parse_tc_entry(struct Qdisc *sch, *seen_tcs |= BIT(tc); - if (tb[TCA_TAPRIO_TC_ENTRY_MAX_SDU]) + if (tb[TCA_TAPRIO_TC_ENTRY_MAX_SDU]) { val = nla_get_u32(tb[TCA_TAPRIO_TC_ENTRY_MAX_SDU]); + if (val > dev->max_mtu) { + NL_SET_ERR_MSG_MOD(extack, "TC max SDU exceeds device max MTU"); + return -ERANGE; + } - if (val > dev->max_mtu) { - NL_SET_ERR_MSG_MOD(extack, "TC max SDU exceeds device max MTU"); - return -ERANGE; + max_sdu[tc] = val; } - max_sdu[tc] = val; + if (tb[TCA_TAPRIO_TC_ENTRY_FP]) + fp[tc] = nla_get_u32(tb[TCA_TAPRIO_TC_ENTRY_FP]); return 0; } @@ -1704,29 +1714,51 @@ static int taprio_parse_tc_entries(struct Qdisc *sch, struct netlink_ext_ack *extack) { struct taprio_sched *q = qdisc_priv(sch); + struct net_device *dev = qdisc_dev(sch); u32 max_sdu[TC_QOPT_MAX_QUEUE]; + bool have_preemption = false; unsigned long seen_tcs = 0; + u32 fp[TC_QOPT_MAX_QUEUE]; struct nlattr *n; int tc, rem; int err = 0; - for (tc = 0; tc < TC_QOPT_MAX_QUEUE; tc++) + for (tc = 0; tc < TC_QOPT_MAX_QUEUE; tc++) { max_sdu[tc] = q->max_sdu[tc]; + fp[tc] = q->fp[tc]; + } nla_for_each_nested(n, opt, rem) { if (nla_type(n) != TCA_TAPRIO_ATTR_TC_ENTRY) continue; - err = taprio_parse_tc_entry(sch, n, max_sdu, &seen_tcs, + err = taprio_parse_tc_entry(sch, n, max_sdu, fp, &seen_tcs, extack); if (err) - goto out; + return err; } - for (tc = 0; tc < TC_QOPT_MAX_QUEUE; tc++) + for (tc = 0; tc < TC_QOPT_MAX_QUEUE; tc++) { q->max_sdu[tc] = max_sdu[tc]; + q->fp[tc] = fp[tc]; + if (fp[tc] != TC_FP_EXPRESS) + have_preemption = true; + } + + if (have_preemption) { + if (!FULL_OFFLOAD_IS_ENABLED(q->flags)) { + NL_SET_ERR_MSG(extack, + "Preemption only supported with full offload"); + return -EOPNOTSUPP; + } + + if (!ethtool_dev_mm_supported(dev)) { + NL_SET_ERR_MSG(extack, + "Device does not support preemption"); + return -EOPNOTSUPP; + } + } -out: return err; } @@ -2007,7 +2039,7 @@ static int taprio_init(struct Qdisc *sch, struct nlattr *opt, { struct taprio_sched *q = qdisc_priv(sch); struct net_device *dev = qdisc_dev(sch); - int i; + int i, tc; spin_lock_init(&q->current_entry_lock); @@ -2064,6 +2096,9 @@ static int taprio_init(struct Qdisc *sch, struct nlattr *opt, q->qdiscs[i] = qdisc; } + for (tc = 0; tc < TC_QOPT_MAX_QUEUE; tc++) + q->fp[tc] = TC_FP_EXPRESS; + taprio_detect_broken_mqprio(q); return taprio_change(sch, opt, extack); @@ -2207,6 +2242,7 @@ static int dump_schedule(struct sk_buff *msg, } static int taprio_dump_tc_entries(struct sk_buff *skb, + struct taprio_sched *q, struct sched_gate_list *sched) { struct nlattr *n; @@ -2224,6 +2260,9 @@ static int taprio_dump_tc_entries(struct sk_buff *skb, sched->max_sdu[tc])) goto nla_put_failure; + if (nla_put_u32(skb, TCA_TAPRIO_TC_ENTRY_FP, q->fp[tc])) + goto nla_put_failure; + nla_nest_end(skb, n); } @@ -2265,7 +2304,7 @@ static int taprio_dump(struct Qdisc *sch, struct sk_buff *skb) nla_put_u32(skb, TCA_TAPRIO_ATTR_TXTIME_DELAY, q->txtime_delay)) goto options_error; - if (oper && taprio_dump_tc_entries(skb, oper)) + if (oper && taprio_dump_tc_entries(skb, q, oper)) goto options_error; if (oper && dump_schedule(skb, oper)) From patchwork Thu Feb 16 23:21:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 58286 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp594123wrn; Thu, 16 Feb 2023 15:52:50 -0800 (PST) X-Google-Smtp-Source: AK7set+n7e1nGzLBF5UlVg7Rhchut1ERc6l9knMX8sJJ4MVybxkvWm8KJqxytx0iF84ikuQJBsxP X-Received: by 2002:a17:90a:15:b0:230:1acb:191f with SMTP id 21-20020a17090a001500b002301acb191fmr9194626pja.32.1676591570669; Thu, 16 Feb 2023 15:52:50 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1676591570; cv=pass; d=google.com; s=arc-20160816; b=Ra2ezPCiENsPIlWzfUSPpfj76fuYdKmH7QZy7F6uX5PRz4i5InclKZLrXiPs/x3M7X JH4gvrVqODXpRClHpCEWwWUFtpeFEpZ17D17AIf0fmQdc6Y/eF2BYXCOp0hvHbc1LwS8 TMF2f16VnVfjEi+6sd403gkYR2yjjB/PatH5N90oR91cRg+AI+r3vkwe+sc6oTL4hHFa Dg1y5gHGwk72o8dZTwlYYtV+sOb66IOre1JiK9ToaLX2ozlfAgAk4qnM4F3P52tcdlHc HSWim5iPL75wZ9RpY46v/6LKUe/CPPQGT8nqo+ScqOs7eeMHs0Yx1/3WUGwjg043orSE /JhA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=B8wagc4X+3+nBvx9IXv7O389xaHEKXmbQE+WmjvfWgY=; b=02OOjDfgovp1Z0sA8SFhbgjWJJiN5ssmDBKz8utYMXgAemjN7n+gaGEMBprDiEQyzy HDe70kmyWRM+u7nQExz+4BVL8sMePLDhR6y0O1M9duiMj8BenzFhLm4Ol7qk9p9FB50Y 50ESg2Y4RJlRcscR/NR4Dd2LGQH/49/L1iNufJIJ9jLYZE0h9Y2pffNPcJJ2FkWRII1v JuHksgmw8BveEfBlwDKkRcDKa+NoUrmWVvjAgQjutoC/drX+MxLFlmoPvjtyignrmab5 lRPpsT3yuOjSoev255EBUpZM8nKbMhWxyHJlBjgtZa3ioEm5IGlwEWV+kAzg1KaoSooh ay/w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=rJ1hrilZ; 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 z17-20020a17090abd9100b00230ff98778dsi1162808pjr.144.2023.02.16.15.52.37; Thu, 16 Feb 2023 15:52:50 -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=rJ1hrilZ; 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 S230048AbjBPXX1 (ORCPT + 99 others); Thu, 16 Feb 2023 18:23:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230002AbjBPXXF (ORCPT ); Thu, 16 Feb 2023 18:23:05 -0500 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2075.outbound.protection.outlook.com [40.107.104.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE27753831; Thu, 16 Feb 2023 15:22:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ow/NQrWjRf1QSurYhU28BMuBglGv/TDRulpVEgjkHBR9TjHpGCsLxUsfsRAFcK6h8fsNvNkCGq0dHNsZC89Ey5PjMTx71hixfnLfe8MUStSOfyyjBlgUpExO6kpxKDulaU5qPECPOGpOS9+klIXocG+rbHPrbeaMYYBSLTMqAGyJrp16jPUGegrAvR8R0//0sK3zFUnk9B42u+wkrvgwiiWEWRUb93EIUWvkqE4Szcbyo1/PkAI3Rca49MTOLi500YaEYLs1gWps52A3NKyEEwJ3T5S3x8crOMdD7wS/Gvfslax+unJUmWFBtG5uT+leJ881ay0HQTpXR7fJ7b4TLA== 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=B8wagc4X+3+nBvx9IXv7O389xaHEKXmbQE+WmjvfWgY=; b=nZt+H2GUy1BLrPw2mAQV5Dawy9zoLHlstr3fC9S+MnIQ1ZQMo7rIiCCj42Lb/qrFa+Dz8asbYHUu3+m7UYCZD9msYmEqEyzWvHckb7E17ey2ezhRBMnGm6kPuy9fU9tSsxOWwUJgUiA0sG+GLpIbtzMw5R1VQOE+HPSATVK99vDHSiti4NtHdttvqDa/Ndchc9nmPb0NJTovfda8O4KXE7wLnRTSI8GYk1Lp+4TDwTkRmmL/5h3iVUoDdAEGbVXp/qMxvktJ7isIerhv4Hp3CuoEytZP+IWpYjOflCmsb877/+zDNjRkvPr2F1rvfjIVJnfGocG13MuwT6OO35NSQg== 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=B8wagc4X+3+nBvx9IXv7O389xaHEKXmbQE+WmjvfWgY=; b=rJ1hrilZwGUkwB0RWsuNXZDucGsGZ7rQ+4XvprMmCNIL0meDP+oHLRq/Yti1+wFMPDHJC93c+/Qtp5351aI8qHsKBirqIlX39FW5sS20rJfB6cFVbQhEKMtlDcOuK0KOntdfGOxUrTfvK4SWVf4d/Ce290LpsJV2dDw/npvR7v8= 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 PR3PR04MB7436.eurprd04.prod.outlook.com (2603:10a6:102:87::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.26; Thu, 16 Feb 2023 23:21:52 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::3cfb:3ae7:1686:a68b]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::3cfb:3ae7:1686:a68b%4]) with mapi id 15.20.6086.026; Thu, 16 Feb 2023 23:21:52 +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 , linux-kernel@vger.kernel.org Subject: [PATCH net-next 11/12] net: mscc: ocelot: add support for preemptible traffic classes Date: Fri, 17 Feb 2023 01:21:25 +0200 Message-Id: <20230216232126.3402975-12-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230216232126.3402975-1-vladimir.oltean@nxp.com> References: <20230216232126.3402975-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: VI1PR0501CA0018.eurprd05.prod.outlook.com (2603:10a6:800:92::28) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5136:EE_|PR3PR04MB7436:EE_ X-MS-Office365-Filtering-Correlation-Id: 0a6c4637-8a38-4939-df56-08db10749637 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: heM1h6pzKeg66La1ZvMxliPZ6Fn/8owrRQ8eo9UtF+CFsXeFRY0PridKP4b2i1x9HnKgocGjwdlmCPnxHIlgJCWEQSNa2b2AeK8HihAvIbSjwVYJJYVj98KT15EcaVE4FvSzGb/kneiPuLFGXluHytv1HgZEa+VMts2dxKb96JU4NMOR5Kq5bbcKpgvZMJUybj8G6VVVrocS5fCaRIEgMgUEzgT7HyWRZwcFCv5o3Nqwt15B6SphJXA9WqXzUe+GjPTlGmU3whJhQHL8uSR5fVprzq5bWW77wHqwKg9wMZv5VArRk72o91x2AZh0BmX2G43RCbz9755YpfajOsSXX62BqqiWq0FFfkzJPkLnI0oXmGdOMWFU/KvWkorKre1v8rMKk4hNaFtANnn3J4xtTbJDcrEy7GlwyuyfsbKrgDrGDH15NBh4Exhc1FtlilUEYYQiGIEIq6JfmL3uGmopMHOpFyGQZ422rl0Y9l/beJpRWMQKwPTbZOTUsGDc9ELWerRkm7iYQN3fc29ZcxqYggp+gKsfBA68Ge9rJV2fqfdxzEiEYfBCDZvf52R5PrEWYJQeXnPxQ6Z8UpefptYXszytu59gAOTzcKoU4n3P7RREGNzN79PqfXgI4kRBlNur4te3lh1uG64rxyhcNVha2BaH6AGcSaxIpSo/lOBzC3YWqRAJfuydr/kZa00+HyZsA1b2Qyez/AS8Aj+2vSNIAg== 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)(376002)(366004)(396003)(136003)(39860400002)(346002)(451199018)(38100700002)(2906002)(38350700002)(44832011)(7416002)(83380400001)(66476007)(2616005)(86362001)(478600001)(6916009)(66556008)(36756003)(5660300002)(41300700001)(6506007)(52116002)(6666004)(4326008)(66946007)(6486002)(54906003)(186003)(316002)(8936002)(26005)(6512007)(1076003)(8676002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: zIfZHMCW0kIbDYd8DULdnrfWGMLLi6tLpEJcg1E4XCytYq3M0M7OfmFPf7B2/SDX7CAfsKilTaJlmTOy4gulE0u2RrjupYCmf5YZ/U5pjAdGzOAECFJZ4j6dozEMbLqFEaFOwhyUmXUXHVabba0wv+/xETOiqwg/kcPvUmlhLi0cbwtppECW3wxs6HTLx8tZUPb3yEhpgW5TLaFI2gBINdmbgXIHhwp8QzKA/G5yot75PdjIXCTYZYnXaIUBc+8cHf6ObUbGBZiI3ih14y73WQUBYyreyQh9uWWJeCTEWYTAfY/CC87rGh+hCMuCGOFEg9CtF1W+nEWhGQYNZ+LuzdvLhlS2973g2jQDQXyiBw/XBVRHyf8VBAUnmPyKoHpBHqx9J4IHl4l94O6A2o0dxsMveEVJNEIgN7Er5AKODURFgs4m1NzWShliTNnixPMS4CHcbOi6qCOAjpe52aY0LS1m8otjR1p0rW3DmHHxUTrFi+MZWFRtbXSvxpSEZ8XnNWEfA+oTKE15oNSx8rxJKwNQVokloqhB0w2YdWU90B0NDyt3ALBgn2o34lPpo0fmV4cgeW/8FaPAIM/aLJ+DjwZQznl3SkwNZQJ5nTldKQtYWqLzLPHI7W1A7lUxncQNspb4noM3VQX2HBxx1iX1wkMjFlEmDESVN//DPNNj8GO4FHIBXBiR48KsLRT6U414xFzELA/7EL9Nv1/sB5QUOSk9YTwV1A1uYJ7c8oCrtjJF7tTzKnzVNgAKokr05mBEBPV57WFt64t5TXtgMaI4/r5gvWjvP3NYXk34ElHpGizSe68N7VdSM0dig/gFlOcIyupqHO6AbCZMtLeFAIsdAJi0Z3y17EDYENm/ZbGuvGgVV/ivwlPl/pFZAjdrznw9OP8y1UvYckICNm80sCl+oKS/hugmd+dbIL8Eci0IEo48YfzEglcvcblNVlkhoqfxQ1vLbkPJFDiBaFLgvAooZVkb7+CIpV/lPNxljTuHPppkll6a3PH+nq1ChgW2IReFLD6sk8aHMn9iuoqEqjDLX5NOexZO5FagB/h/48/rksvhRlxL0L76QjRzs1uWVYGFEW//1pLfrBKupHkuFCGFgte8jTXx5eeqqZCOio3o4qNBKcPOdr46bGGVpjyWhljHL6dHTWxB3Ntc36Bs80Vejlv4eqzulKX6xBp9XTwlsrUMQ1+J0RHDKuUku6mPF7c9n/5KxBlD/EB098MY7V66uEVJGAiWxeMKnM4XwbIlS9S+N5TuvMrPzZPM6QzK3STbZQyZzRjOdLaj1E0ng6JzGfENLGrvLO7rwQN2XpcwPZPxfqI3zaJ+mT6F6iD2IYOEkywuJ6TvovvQEdNuhv/Fba8lJifrnotRpTWJa56/xxYLdlVW3NROZIXNy3NABGcUxCJbiBKEy3Bevjmu2S8u0iMTdRyIqvxuttI9Wi8CLi1OTPTiBGF5iIqiAdJn2K6k4i2h63LJp7Xvi5Twh7CIYse0GTTrwE4VISaX869PUV1V157ReItW5lFVS/G9JBJRB0Nh852PO0Pt29MJH0IKS0c203Qg647grVn/jquSCbulAGrvYETp7kEL9pWBvNYm9wO5YBmZaySkVw2vHqWpRA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0a6c4637-8a38-4939-df56-08db10749637 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Feb 2023 23:21:52.7270 (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: 5EjbJ4cKGK+UO7zYU82IKRTydnpuG07MQj24BgNjwS8ViGovEmtlxfWlRVdWezYT7A0Y2KVBDjEEo4ZFwxs0bw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR04MB7436 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_NONE,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?1758033682759708467?= X-GMAIL-MSGID: =?utf-8?q?1758033682759708467?= In order to not transmit (preemptible) frames which will be received by the link partner as corrupted (because it doesn't support FP), the hardware requires the driver to program the QSYS_PREEMPTION_CFG_P_QUEUES register only after the MAC Merge layer becomes active (verification succeeds, or was disabled). There are some cases when FP is known (through experimentation) to be broken. Give priority to FP over cut-through switching, and disable FP for known broken link modes. Signed-off-by: Vladimir Oltean --- drivers/net/dsa/ocelot/felix_vsc9959.c | 13 +++++- drivers/net/ethernet/mscc/ocelot.c | 3 ++ drivers/net/ethernet/mscc/ocelot.h | 2 + drivers/net/ethernet/mscc/ocelot_mm.c | 56 ++++++++++++++++++++++++++ include/soc/mscc/ocelot.h | 2 + 5 files changed, 74 insertions(+), 2 deletions(-) diff --git a/drivers/net/dsa/ocelot/felix_vsc9959.c b/drivers/net/dsa/ocelot/felix_vsc9959.c index 81fcdccacd8b..c6a5cf57dcc6 100644 --- a/drivers/net/dsa/ocelot/felix_vsc9959.c +++ b/drivers/net/dsa/ocelot/felix_vsc9959.c @@ -1343,6 +1343,7 @@ static void vsc9959_sched_speed_set(struct ocelot *ocelot, int port, u32 speed) { struct ocelot_port *ocelot_port = ocelot->ports[port]; + struct ocelot_mm_state *mm = &ocelot->mm[port]; u8 tas_speed; switch (speed) { @@ -1374,6 +1375,11 @@ static void vsc9959_sched_speed_set(struct ocelot *ocelot, int port, vsc9959_tas_guard_bands_update(ocelot, port); mutex_unlock(&ocelot->tas_lock); + + /* Workaround for hardware bug */ + mutex_lock(&mm->lock); + ocelot_port_update_preemptible_tcs(ocelot, port); + mutex_unlock(&mm->lock); } static void vsc9959_new_base_time(struct ocelot *ocelot, ktime_t base_time, @@ -2519,6 +2525,7 @@ static void vsc9959_cut_through_fwd(struct ocelot *ocelot) for (port = 0; port < ocelot->num_phys_ports; port++) { struct ocelot_port *ocelot_port = ocelot->ports[port]; + struct ocelot_mm_state *mm = &ocelot->mm[port]; int min_speed = ocelot_port->speed; unsigned long mask = 0; u32 tmp, val = 0; @@ -2559,10 +2566,12 @@ static void vsc9959_cut_through_fwd(struct ocelot *ocelot) /* Enable cut-through forwarding for all traffic classes that * don't have oversized dropping enabled, since this check is - * bypassed in cut-through mode. + * bypassed in cut-through mode. Also exclude preemptible + * traffic classes, since these would hang the port for some + * reason, if sent as cut-through. */ if (ocelot_port->speed == min_speed) { - val = GENMASK(7, 0); + val = GENMASK(7, 0) & ~mm->preemptible_tcs; for (tc = 0; tc < OCELOT_NUM_TC; tc++) if (vsc9959_port_qmaxsdu_get(ocelot, port, tc)) diff --git a/drivers/net/ethernet/mscc/ocelot.c b/drivers/net/ethernet/mscc/ocelot.c index 20557a9c46e6..76a7c25744b9 100644 --- a/drivers/net/ethernet/mscc/ocelot.c +++ b/drivers/net/ethernet/mscc/ocelot.c @@ -2608,6 +2608,7 @@ static void ocelot_port_reset_mqprio(struct ocelot *ocelot, int port) struct net_device *dev = ocelot->ops->port_to_netdev(ocelot, port); netdev_reset_tc(dev); + ocelot_port_update_fp(ocelot, port, 0); } int ocelot_port_mqprio(struct ocelot *ocelot, int port, @@ -2642,6 +2643,8 @@ int ocelot_port_mqprio(struct ocelot *ocelot, int port, if (err) goto err_reset_tc; + ocelot_port_update_fp(ocelot, port, mqprio->preemptible_tcs); + return 0; err_reset_tc: diff --git a/drivers/net/ethernet/mscc/ocelot.h b/drivers/net/ethernet/mscc/ocelot.h index e9a0179448bf..fa9b69ba198c 100644 --- a/drivers/net/ethernet/mscc/ocelot.h +++ b/drivers/net/ethernet/mscc/ocelot.h @@ -110,6 +110,8 @@ int ocelot_stats_init(struct ocelot *ocelot); void ocelot_stats_deinit(struct ocelot *ocelot); int ocelot_mm_init(struct ocelot *ocelot); +void ocelot_port_update_fp(struct ocelot *ocelot, int port, + unsigned long preemptible_tcs); extern struct notifier_block ocelot_netdevice_nb; extern struct notifier_block ocelot_switchdev_nb; diff --git a/drivers/net/ethernet/mscc/ocelot_mm.c b/drivers/net/ethernet/mscc/ocelot_mm.c index 0a8f21ae23f0..21d5656dfc70 100644 --- a/drivers/net/ethernet/mscc/ocelot_mm.c +++ b/drivers/net/ethernet/mscc/ocelot_mm.c @@ -49,6 +49,61 @@ static enum ethtool_mm_verify_status ocelot_mm_verify_status(u32 val) } } +void ocelot_port_update_preemptible_tcs(struct ocelot *ocelot, int port) +{ + struct ocelot_port *ocelot_port = ocelot->ports[port]; + struct ocelot_mm_state *mm = &ocelot->mm[port]; + u32 val = 0; + + lockdep_assert_held(&mm->lock); + + /* On NXP LS1028A, when using QSGMII, the port hangs if transmitting + * preemptible frames at any other link speed than gigabit + */ + if (ocelot_port->phy_mode != PHY_INTERFACE_MODE_QSGMII || + ocelot_port->speed == SPEED_1000) { + /* Only commit preemptible TCs when MAC Merge is active */ + switch (mm->verify_status) { + case ETHTOOL_MM_VERIFY_STATUS_SUCCEEDED: + case ETHTOOL_MM_VERIFY_STATUS_DISABLED: + val = mm->preemptible_tcs; + break; + default: + } + } + + ocelot_rmw_rix(ocelot, QSYS_PREEMPTION_CFG_P_QUEUES(val), + QSYS_PREEMPTION_CFG_P_QUEUES_M, + QSYS_PREEMPTION_CFG, port); +} +EXPORT_SYMBOL_GPL(ocelot_port_update_preemptible_tcs); + +void ocelot_port_update_fp(struct ocelot *ocelot, int port, + unsigned long preemptible_tcs) +{ + struct ocelot_mm_state *mm = &ocelot->mm[port]; + + mutex_lock(&mm->lock); + + if (mm->preemptible_tcs == preemptible_tcs) + goto out_unlock; + + mm->preemptible_tcs = preemptible_tcs; + + /* Cut through switching doesn't work for preemptible priorities, + * so disable it. + */ + mutex_lock(&ocelot->fwd_domain_lock); + ocelot->ops->cut_through_fwd(ocelot); + mutex_unlock(&ocelot->fwd_domain_lock); + + ocelot_port_update_preemptible_tcs(ocelot, port); + +out_unlock: + mutex_unlock(&mm->lock); +} +EXPORT_SYMBOL_GPL(ocelot_port_update_fp); + void ocelot_port_mm_irq(struct ocelot *ocelot, int port) { struct ocelot_port *ocelot_port = ocelot->ports[port]; @@ -66,6 +121,7 @@ void ocelot_port_mm_irq(struct ocelot *ocelot, int port) "Port %d MAC Merge verification state %s\n", port, mm_verify_state_to_string(verify_status)); mm->verify_status = verify_status; + ocelot_port_update_preemptible_tcs(ocelot, port); } if (val & DEV_MM_STAT_MM_STATUS_PRMPT_ACTIVE_STICKY) { diff --git a/include/soc/mscc/ocelot.h b/include/soc/mscc/ocelot.h index 27ff770a6c53..7ee7a29e7c51 100644 --- a/include/soc/mscc/ocelot.h +++ b/include/soc/mscc/ocelot.h @@ -748,6 +748,7 @@ struct ocelot_mm_state { struct mutex lock; enum ethtool_mm_verify_status verify_status; bool tx_active; + u8 preemptible_tcs; }; struct ocelot_port; @@ -1149,6 +1150,7 @@ int ocelot_port_get_mm(struct ocelot *ocelot, int port, struct ethtool_mm_state *state); int ocelot_port_mqprio(struct ocelot *ocelot, int port, struct tc_mqprio_qopt_offload *mqprio); +void ocelot_port_update_preemptible_tcs(struct ocelot *ocelot, int port); #if IS_ENABLED(CONFIG_BRIDGE_MRP) int ocelot_mrp_add(struct ocelot *ocelot, int port, From patchwork Thu Feb 16 23:21:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 58285 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp592276wrn; Thu, 16 Feb 2023 15:47:37 -0800 (PST) X-Google-Smtp-Source: AK7set+Pm5iDhv/SaIfDz/FkHo6ou+e31RFlJ3jG82qoDQSXSG5wN7kq4Og8gJqTCQ9cqxmvzRRF X-Received: by 2002:a17:906:7c16:b0:889:b38b:4bb2 with SMTP id t22-20020a1709067c1600b00889b38b4bb2mr8184252ejo.49.1676591257122; Thu, 16 Feb 2023 15:47:37 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1676591257; cv=pass; d=google.com; s=arc-20160816; b=khUNtSPtma/TOrxZly1EiBfABDxsah3S3ecAKqdiQY9R6rQrJIHzgsiB5e/JnYPiCJ zdZ85Qd+XpNc4aRk6adTSkuD3xyoje5WMAFmugnf9butWZ0Gl+xnnFt9+uL4B3iQYIua vP55Ea2adkk8XNZI6czXMsemZ9nlKWht2kM2og/TLoTC6PUmtGdyYjllJ+FVEUhEtZma 9GnCawV7d8JcHmy2BYYM//XwQ/M1G3O5ZzI15u9sGe9JvumUCkQg4N9+Vzj3ieSC5Qoa 27D+xBm8F5gqQOddhj/uGW/6IZRM735CTvuHhTIfrqnmKIQJRw5n+up7AaCJvfUT3NFN 78yA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=3T4BHjiL3x/4CkYmBq68my7S7dLUmIM77eYFaSDln3Y=; b=Sl1Ml+HJebjaPuU7x9BfqURxQclIMhy0PqECG5D1Elo246bdIPTKnEImbDH1HmzrB5 DA3oXSTQivrYlGXICN/dQyuNMHbmIpdhLspJQB+EmJH15f4N2ybXCP3xkQJIPHwY8gjv gr3lZ2i8voNfYn0eBOD/1LOIidPPMywrorvzrkXqODvYrk/GssvbrGOLcSzMdumE9tVj bfOmhNZum8kjbfUngbL6oWexAbU1SrDXrOS4LQvzSrk8ErxAKY5p0vMA8ON2GBQxn9jC keEr7bPoiE0GFgvE9Lkl+xNKjJsjV0RxDVcJAoSS8E+fwgRRZFvRRzF8wIYaMaeIbefe c1Ow== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=qfBwBuuA; 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 kb17-20020a170907925100b008b132f166a7si3651226ejb.918.2023.02.16.15.47.14; Thu, 16 Feb 2023 15:47:37 -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=qfBwBuuA; 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 S230033AbjBPXXr (ORCPT + 99 others); Thu, 16 Feb 2023 18:23:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230046AbjBPXXX (ORCPT ); Thu, 16 Feb 2023 18:23:23 -0500 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2089.outbound.protection.outlook.com [40.107.104.89]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B096654D0B; Thu, 16 Feb 2023 15:22:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KtDJZN9GfiRzJG4CXvflTDA/3s1MUctkag9xoebsJpVoXJTWomzUHVnYBMNkynnMwMzlVorQd7EQzEOVHIBKaV54aIM8IZoStsDLjuH0BIs01RotPzXgVSPHjLHwH1EtTLm0K8hVlZM3JrTbM9WDEwVUM+1KdWe0dowEPxH/La35dJlV5U+ZVdb25nVVicsOhas5fD+Z7PU+w/s15Nx4ODdlg63j6VpkXBAyivlyUEua5Er7IAn85EQH59229/76vWhODfUxxnQwzmOsYiRL94yTKfXJag4ciXxHUwhMih8tr0AyZntzx0nKeGs5XalnezukZ7sJIEojoN3pQ7aAiA== 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=3T4BHjiL3x/4CkYmBq68my7S7dLUmIM77eYFaSDln3Y=; b=avMDexf4SZFh79TntXD43ucLqscCCVe2hzMKGMtpXDtjbljyhgQh5USnACu9sfil73LwAjuCJjYZkYB6WJgGP7tJCys41wE+ih0YrxyMmuta7cXpnlnG8n020uINQCnvjKx2jeDZvxmobHWpXzM+phGTqxYdwAw4hFKF9MNa2OBBeWY134xEMDGyw6Xula2+BAfT7jJApqVfmK//5oSC4c/v39N1Zs1s0xVCtQ03y2tczIPlY7ZEa8RaJrQYRYSSL4+T1onx/t2lLMJtu9F82ZTZps69BJq10gSf9gbBVPDWdITAJPNe1oxF4tSnKmygHqY6SfKv2tj9Fia6uz/1dg== 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=3T4BHjiL3x/4CkYmBq68my7S7dLUmIM77eYFaSDln3Y=; b=qfBwBuuAfmsUsyN1Dt0Ot7Nkng5G0l940hsX4G/ooOqx/YyfkMMpGyEhC8r8oQvnC8zBmdX6pEyJPug8d0vnpNNWleRSh83y687aoGxlKJiWBgo8BRCd2439bkn63gVuoITz+YosUljZ56yRRhFxK+D3EQaD+WgkpY3T54n4Awk= 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 PR3PR04MB7436.eurprd04.prod.outlook.com (2603:10a6:102:87::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.26; Thu, 16 Feb 2023 23:21:53 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::3cfb:3ae7:1686:a68b]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::3cfb:3ae7:1686:a68b%4]) with mapi id 15.20.6086.026; Thu, 16 Feb 2023 23:21:53 +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 , linux-kernel@vger.kernel.org Subject: [PATCH net-next 12/12] net: enetc: add support for preemptible traffic classes Date: Fri, 17 Feb 2023 01:21:26 +0200 Message-Id: <20230216232126.3402975-13-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230216232126.3402975-1-vladimir.oltean@nxp.com> References: <20230216232126.3402975-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: VI1PR0501CA0018.eurprd05.prod.outlook.com (2603:10a6:800:92::28) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5136:EE_|PR3PR04MB7436:EE_ X-MS-Office365-Filtering-Correlation-Id: e8911449-bddc-44a0-99fb-08db107496d7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rsSqckUAYaUWd4B4rLVrwbIP+CttgSC7u03LVFj5/a8CG1q3iQWLWkxYHoZXapa35hyTWW4+lvy3DqSZNlqjEhYLVBE6rp9cZZHFkC6hJVkUbSiSQslwJ6Zc4mw9I8+nhocAHV1F5naonXO3LA3RGwpQtjPnSeBtZklM4MAPNTp9gtRJEgO15JPmM3J0ZdJRO2BQXgCAP3DwXJKnsgsKFhRm59BiCGY0YO9CZ/siUAOy6Sel7KqEPRYguhJYPft5AMKiaXvPXH/MJzyTek+UEpR1rNZlPcb2WWHEhJeBVTldwmz5g2lZ5o70fRniZ//ARdXbJcx7uIrbXax/WYtGNDeOVzVbm5TgYAnMVFXlcS6y3UDkFgp2qtBYGeDRHIfLeB0cX22bq5cONcEEJr/LWfY/Gab+xXT+dTaLM1mA50t/+YdlGtd5m7FFVwL1XUd5OxpZcjIbBLxgKsp4AEaikh0r7mxJutbxVymkcB+2+JO00g/pL8JEGeaDDsOrG55qlDy7Dw4KsNNLwwcYxWkF12puT2Fd2bUGN21wldMOIrlVQ1mdFrDc16mHPCLJbf1oNAg0uWJHSaJG0fKnrMCSgYTKwp/S+a/FHoWr7q8wqFQ3q02PVvqnzm4qHiNi0ImyCxeJK2OlCA5ppMmgKgjoGkpmRSjF5bmoyGpQeebc/KEwEl+zmXnp1A+BuWiK9MoYjWTDwpwrMkC83t4Pct715w== 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)(376002)(366004)(396003)(136003)(39860400002)(346002)(451199018)(38100700002)(2906002)(38350700002)(44832011)(7416002)(83380400001)(66476007)(2616005)(86362001)(478600001)(6916009)(66556008)(36756003)(5660300002)(41300700001)(6506007)(52116002)(6666004)(4326008)(66946007)(6486002)(54906003)(186003)(316002)(8936002)(26005)(6512007)(1076003)(8676002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: EWs83fWYUA0o1FfJgzqm/4Nanj7jEWQm8hl2VmhspHNV1NNZ/3yvpbae+OVbbzfRTfkx8mV7+QlnitU+axjLqZYc4isuidGetge+X0iDF4b/guj9KerHPHczEyYSJXV2gzb60KEv32SYPcQhvPYUiZBgGC76SQM3x8GeoqNNdG6PKzTpJSH+77Ym5Y7EWAV0oOMXxYUclaEklKwxOoIOK6E1IWbG5nsrUBt+kR2UnQZr+cgM62FBpzgY/l2UvHFHmrTYV2Cww71PWaQJnxNiLkSjb8zCn2kTiwuCHriqrwyxUtJdEteOPKB+WO2xN8R2ORFOWoIt10nbO8A3dtN9o+xvtZxtqLW0puvBhfarv/BgUcbsrcaPEyas6T1dbO7vN5ekyfM8XZK4yoQOWFHhBckMtItMAgdGX6yDIFdG8l4oLNtEKcO5KaVAo5Pbu1ZIMHhWD9g8GO6cZcllz22bari9OHMNlCis/G+P+/lSOI1Zmp1sjakzmFLNAwMEht8elI2/mAKiiHqyMth2Cj69QzU8lEMvaq3jxXH3hJZJH1SWZV7kboYGqu8X1zDgDTfQhX3QE73Jcau6UCnCiwZy/bODATLsP/7KtmNv/6UqWWla7s+nZXfsAdp9NEMaCO/axR9nMRWxx9Wq6ayCDrIaiBjQqIrrveAnqW6oUQ+oI+6k0duqws5Lk5jwyWmkJ2TjZMTneD2AwVlzVe771pQUuYte6mmPMBo7h4PXXFhaScRaVmp9TZAKLlErYxFiyzBl5qcSxWoVFzZCLsyj/sMpkHzaoQf6NV0McOBZJcFUenMv274GUaCXHF8ODguR5qmwBnZ3xLLMXgFkWQ4WnH/NJmkU9XF09TA+vsEW3zw8tzaD5UU90xaY7wfZwhjgPuAlEnI//Ki9hLvoJxf5Lv8Q+UqLaBC2Bzggp7wJg7tzaJHxrC+97wm2u7hYGaRKDfasZDm/faMVq8F1Q617xW4diDJQgkzw6hu1Wkh+be9OoLJhCiAzI/1BUzG0N8eYC/w/46iaNOt9tdUH9rBSykb56SX5RZafqbveBE2GqRmbw9kXGg12tr4y0AQDAEvSFyyBEVEZ10jBbx8ya/P2ZsEQBCCmEkjdCedVFBdwRv8hOgi4VAjSJM7j7BjiT7vQHr1C1bjCE/785o+rFpcUHcowRY0wZXYbHqD8C8urLL76Kg1D9lMRYC7L0zIDELA9sZrXsyJW4tgBq2jv2lbDyqR8gGlygZ6ZY5d/Mx4A3LM2fDPh9YNXtbiFd1Kxk7e+45Ge7TZg6OPgtzqCn4CR7sxA5gmGprxeUDkurA/ziCq4COMeHGT4f1kIbkwvCA6zD7j8n9Swn15Zu9cBHZl+CAhnWAJqRr11C10GUCvwVf5ayZUQub0T+lNKlOwW01sIl3ZY8DoSF3hHP9IGgK+OP4NvkH1uSxBsFMnEjzOOJfGdMvX7hLjg1mbHMQ/d2KsbcGn/j/QGw9Qv9g4dryjD/vTG39ZBBHkUmeUfFSIMOG3cExsz3Bt3ewJIQL/TEgi+vfDqV4dlzsIp2aLa4yqbZo3zN7nABbmrhcUik0AKgvskOmOVwH+Gicr9cnI3Y+TSqXORBAlWwCWxpxrl/dFeEBMW4w== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e8911449-bddc-44a0-99fb-08db107496d7 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Feb 2023 23:21:53.7582 (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: nu3vfOyMkgFsQ+i7S2Kkaai4W59X+YOK6gLYNSB2OB8GnqFS0Pe79stX6FEJaVgLQoZqNiV413H/h5DMMCU0Xw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR04MB7436 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_NONE,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?1758033354029934847?= X-GMAIL-MSGID: =?utf-8?q?1758033354029934847?= PFs which support the MAC Merge layer also have a set of 8 registers called "Port traffic class N frame preemption register (PTC0FPR - PTC7FPR)". Through these, a traffic class (group of TX rings of same dequeue priority) can be mapped to the eMAC or to the pMAC. There's nothing particularly spectacular here. We should probably only commit the preemptible TCs to hardware once the MAC Merge layer became active, but unlike Felix, we don't have an IRQ that notifies us of that. We'd have to sleep for up to verifyTime (127 ms) to wait for a resolution coming from the verification state machine; not only from the ndo_setup_tc() code path, but also from enetc_mm_link_state_update(). Since it's relatively complicated and has a relatively small benefit, I'm not doing it. Signed-off-by: Vladimir Oltean --- drivers/net/ethernet/freescale/enetc/enetc.c | 22 +++++++++++++++++++ drivers/net/ethernet/freescale/enetc/enetc.h | 1 + .../net/ethernet/freescale/enetc/enetc_hw.h | 4 ++++ 3 files changed, 27 insertions(+) diff --git a/drivers/net/ethernet/freescale/enetc/enetc.c b/drivers/net/ethernet/freescale/enetc/enetc.c index e0207b01ddd6..41c194c1672d 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc.c +++ b/drivers/net/ethernet/freescale/enetc/enetc.c @@ -25,6 +25,24 @@ void enetc_port_mac_wr(struct enetc_si *si, u32 reg, u32 val) } EXPORT_SYMBOL_GPL(enetc_port_mac_wr); +void enetc_set_ptcfpr(struct enetc_hw *hw, unsigned long preemptible_tcs) +{ + u32 val; + int tc; + + for (tc = 0; tc < 8; tc++) { + val = enetc_port_rd(hw, ENETC_PTCFPR(tc)); + + if (preemptible_tcs & BIT(tc)) + val |= ENETC_PTCFPR_FPE; + else + val &= ~ENETC_PTCFPR_FPE; + + enetc_port_wr(hw, ENETC_PTCFPR(tc), val); + } +} +EXPORT_SYMBOL_GPL(enetc_set_ptcfpr); + static int enetc_num_stack_tx_queues(struct enetc_ndev_priv *priv) { int num_tx_rings = priv->num_tx_rings; @@ -2640,6 +2658,8 @@ static void enetc_reset_tc_mqprio(struct net_device *ndev) } enetc_debug_tx_ring_prios(priv); + + enetc_set_ptcfpr(hw, 0); } int enetc_setup_tc_mqprio(struct net_device *ndev, void *type_data) @@ -2694,6 +2714,8 @@ int enetc_setup_tc_mqprio(struct net_device *ndev, void *type_data) enetc_debug_tx_ring_prios(priv); + enetc_set_ptcfpr(hw, mqprio->preemptible_tcs); + return 0; err_reset_tc: diff --git a/drivers/net/ethernet/freescale/enetc/enetc.h b/drivers/net/ethernet/freescale/enetc/enetc.h index 8010f31cd10d..143078a9ef16 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc.h +++ b/drivers/net/ethernet/freescale/enetc/enetc.h @@ -486,6 +486,7 @@ static inline void enetc_cbd_free_data_mem(struct enetc_si *si, int size, void enetc_reset_ptcmsdur(struct enetc_hw *hw); void enetc_set_ptcmsdur(struct enetc_hw *hw, u32 *queue_max_sdu); +void enetc_set_ptcfpr(struct enetc_hw *hw, unsigned long preemptible_tcs); #ifdef CONFIG_FSL_ENETC_QOS int enetc_qos_query_caps(struct net_device *ndev, void *type_data); diff --git a/drivers/net/ethernet/freescale/enetc/enetc_hw.h b/drivers/net/ethernet/freescale/enetc/enetc_hw.h index de2e0ee8cdcb..36bb2d6d5658 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_hw.h +++ b/drivers/net/ethernet/freescale/enetc/enetc_hw.h @@ -965,6 +965,10 @@ static inline u32 enetc_usecs_to_cycles(u32 usecs) return (u32)div_u64(usecs * ENETC_CLK, 1000000ULL); } +/* Port traffic class frame preemption register */ +#define ENETC_PTCFPR(n) (0x1910 + (n) * 4) /* n = [0 ..7] */ +#define ENETC_PTCFPR_FPE BIT(31) + /* port time gating control register */ #define ENETC_PTGCR 0x11a00 #define ENETC_PTGCR_TGE BIT(31)