From patchwork Sun Feb 19 13:52:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 59147 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp856467wrn; Sun, 19 Feb 2023 05:55:32 -0800 (PST) X-Google-Smtp-Source: AK7set80M2cSOQrOdCBJW/bSfCqWpQ955DezQBklbKaPKE1At9N++ykc3Lzo6NAo8O1Id0G6j4VX X-Received: by 2002:a05:6402:b3a:b0:4ad:7301:fe72 with SMTP id bo26-20020a0564020b3a00b004ad7301fe72mr2249264edb.8.1676814932617; Sun, 19 Feb 2023 05:55:32 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1676814932; cv=pass; d=google.com; s=arc-20160816; b=u5iqPJCtFPj4t8zebQWLuIaOtcFY5nu1A7/ce33OWRNpKQ2swtEqvg4L2A3sTE5qMH SmTTlGwPNHLGlN9AcHJJGokk1c4DJ4tvc5DrZvmR+nn1A/gBTRgSlyaC1Kv4ZD8jHIfj ycqRYhSnFeUi1C+blDukF8LPO4XxjkVi1nD6JRE87IIM2SHmVSpN8ZUbv8V5OIFwD6Ov zH7uIoQObskOMyFaSUYcNBtca8CgIYtsu1AGkzECXfZmJegEV6plk2ZNRz3S95KV/5LP gs3PhzpccjnHx6v2nxuTXmPSyDyEV29/BAsaz7Y8w9D+hoJoFmEwbT5XzLeBbkgcxin6 Lanw== 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=+40kMAraM7hDvsFJEK7pFjXpHKWGz2oct9yJ4VaKdBM=; b=CCaS/PmSp3qK9/tGkMz3sVZ8AqalCjgQHCEr1njzz/FTd0dj49krWygwSh3Cw4sEdE Kt2WcLFwbtpL0mUOyDKtjWR0I16StsLP29A3jgJ9pQpdykfEz9llS1028jSuiw4WSsaf sPtyKy+kOWwuYnCsf9icCGaekH0BHAKN/JZY3KcXF3LHtO5Gjfo+b5029ThIx94nOD0t WiCn4+18bo/Jvr5mKSoxE24afZV0YrDGgcxruivJeoePYBMXwYkCeZMVfwfj3vICp11p DFWmC1hvqwplrGvDatGy2J5tN1NzdXo/JgRaHd9SNnUnLR1IFsgmTWhKvqQFJNlhIQuK Cvfg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=AzwdEe4d; 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 n20-20020aa7d054000000b004ab0d0a4759si12498198edo.410.2023.02.19.05.55.09; Sun, 19 Feb 2023 05:55:32 -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=AzwdEe4d; 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 S230007AbjBSNxs (ORCPT + 99 others); Sun, 19 Feb 2023 08:53:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43974 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229737AbjBSNxn (ORCPT ); Sun, 19 Feb 2023 08:53:43 -0500 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2052.outbound.protection.outlook.com [40.107.104.52]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64BF74C0A; Sun, 19 Feb 2023 05:53:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=U+gAmSEHOHxvgVNu24JaSocWEFFc4iPPBmrPM21/Gw1T1mThG3kD4/j1f2j1jrQ9ZRJlVyG4jofC0khv75idq0RFhdlYe4VXDogub3Z0Xlm3FkS9db6Fk4xnRB4BOklbm7ZXV82FOkcjVo/OqDskzbuHwbBff5r/kDj8r3S9EFNMNSFykKThSpbSjRsaNoyv7LMSrkR5dEZEaZViip6+sdd7ji/0PE7v2yFCJ0wv4uQbPmQl1zstzQvgikgO/wT0WQdTJMcoBpfP20WZ/QEyHlH82owo/AK5MjNFXVyhRS6Jg5Q/new4hFTXqVFwAHPJa4RuUE3Fi3b5P71tWLoSHA== 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=+40kMAraM7hDvsFJEK7pFjXpHKWGz2oct9yJ4VaKdBM=; b=cOfre2bIjfvqmdujD4wjBycpyHy4uNPXRENdKIecYnP+l6JgKTbRLFzdBZNhhGGLqkam3WX2L6G/c9FH6+UT01/41trFVgG10i9S565zUjBc6b05xo9FA9TDULR9S2oh864NL456kr9NYy11iCbOWIJLsq/14l7NORoptHaswWxvExzfwnhMe+tPb/f5nDWtuTtjtYZfFf5lY8hw5nCUEPgq8+QlzSq0xY65OpbitSRXdKLXT5xmaPl0U6a/g8Pr0pECUD4uBm7oDfy7+p+6Rl8u4icPQ5/goCmAdGZBYl974VCw7bTLJhCk3fd0cnxfNBx4uQMv9iW3chX4QDv81w== 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=+40kMAraM7hDvsFJEK7pFjXpHKWGz2oct9yJ4VaKdBM=; b=AzwdEe4dFN7YWC1qGDnhGsXUvnv/i2M+zwgR6AZfXPKamMDw6LZVu0iXepDaVmRx+ZrxQzOlZic88jNYZrfyoakCy1A22tnS/AIQuGkN1hCNs/d1S3nViPcMI+XS/RO91wNMKS+DVBxptWprGdZKM2k1TwrHKgBGqDAgnuGJSa4= 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 PAXPR04MB8238.eurprd04.prod.outlook.com (2603:10a6:102:1bc::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6111.17; Sun, 19 Feb 2023 13:53:39 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::3cfb:3ae7:1686:a68b]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::3cfb:3ae7:1686:a68b%7]) with mapi id 15.20.6111.018; Sun, 19 Feb 2023 13:53:39 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Jamal Hadi Salim , Cong Wang , Jiri Pirko , Vinicius Costa Gomes , Kurt Kanzenbach , Gerhard Engleder , Amritha Nambiar , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Andrew Lunn , Florian Fainelli , Ferenc Fejes , Xiaoliang Yang , Roger Quadros , Pranavi Somisetty , Harini Katakam , linux-kernel@vger.kernel.org, Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Wong Vee Khee , Michael Sit Wei Hong , Jacob Keller Subject: [PATCH v2 net-next 01/12] net: enetc: rename "mqprio" to "qopt" Date: Sun, 19 Feb 2023 15:52:57 +0200 Message-Id: <20230219135309.594188-2-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230219135309.594188-1-vladimir.oltean@nxp.com> References: <20230219135309.594188-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: BE1P281CA0136.DEUP281.PROD.OUTLOOK.COM (2603:10a6:b10:7c::6) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5136:EE_|PAXPR04MB8238:EE_ X-MS-Office365-Filtering-Correlation-Id: 7b81aa0f-6e52-40a6-6cb0-08db1280b3ff X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qlLF5w7BM2npg5gI4/ue+SieZsA+rablIAIFzNXEwtxeJYkP7VxS/mLs9wBLI3cw/YKsQ5C7y11qZMGp3ZqDaAAsb3//Ymet2oFcSoSg7+poXEv1GVBqmUhRB1NFJkSQ5UZVBxpgTv0BlUN5tUK6LyCHMQw6383XIknMH/1qJhq/7saOShLhwVOzPT3ws6rGnQBoucVFvEYb+/2SNCSPFQV+G0KL4a0MOK4smvF1qRl/Wd8/8ezLbvmI6CvEcPnUDJOvDedGsixAkCuzWLwsiRDP1U6NND9UzNTz5pipMupQ4TYzmbVj7snBI5sCcm9Bvh0p16UXIiQh+6iTnChUF++bW0v6aDNFL2NDaASXVaJm9RbeSu/UuB/2caQw+daoGFytraEHiZrzpgKjkis4SZXabbN6byDgOfep8MBMLUVdNTlS8qivqNYTODwgeFfK9zhtQkmyrAwVohGcNqGaEBq55TenQnHay02aW9HgYd1y/+NgK0vSPwZbO5IHA/Ti54+/YGp6bbGLptGExc+XW8TEjQ8vb1l0sbQD1hsX0aBZy7s8eZy5U989cPAJD6Xo2moAH08iYb02I7+DZ/o5cF4c5+QAAcFy+ruzLHKlNOjqOvTPCoEBcTyT9L6WcXKLEYPqaqOzNyqW9+YdnitMg6OY6S1Hnk5TNdzWA0yI57aC34D5TZTFYhdqTdhrQQKKkoKIX4Awzp1RCAzwBv/Pqw== 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)(396003)(346002)(136003)(39860400002)(366004)(376002)(451199018)(8676002)(66556008)(66946007)(66476007)(5660300002)(7416002)(4326008)(8936002)(41300700001)(6916009)(44832011)(86362001)(38100700002)(38350700002)(6512007)(6666004)(6506007)(186003)(26005)(2616005)(83380400001)(52116002)(6486002)(478600001)(1076003)(36756003)(316002)(54906003)(2906002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Pp9KUcRMx8+wlPYBIF0jp3b6aXoSe+lTCZmE1n7CGxlXlZftig6ZLACTsGPJDGeiwgNN5d4LET2xMmxaKFzlGKNnBSncFo13SJTEfQ5IkKRvo6FyRCJ8ct5EOyeLwE22WAIAwJ4PmZLmLa9I/dvXyk1HKs6M4eNS7ajl7akFiIZCmvFtYPgqSvIW2vtF4RYIdMDhBUcpf7Db5TrNm1MSc4yldp4DLRLw3zciPp5tGkU0IbNaTEKTc+vIIYz9sDMOvy7DbQw/G4f4Pb7qz370RFv0H2Nd2HC3Es55OqgHq9bfQAp04MZinO6jFBpiMogR4riB418ieVrr/YwS2EEvUDPtmajyn4ElIIRr105C9uzInS7TF/ejp1ahzjZnct6HSoFxa4R2IDWkjkSzotga9QysVyo8Vj454UIu7DM5eiWxdug4n0oYj+6IK/eH+3rsjHlUqb7EtV86W7WB+vua5pXBSNrxUHj0bVWWOMSXWhSJZrIvsM9ZYHK4Syg3DKfkBVSiGTvFV1UJvw32hjKm4S7TYulc3eY8ciS5Yxzs35DQB1+Su/JdoONbyzVN4UiOOQqIoxnmaYNNbLMTOZSXNIVWuQVJIm65i99vRRCf/XQYxr8bQkEVZbngo/Yomob5VT8r0ncSPLncLQWj7rh09C1bHrV6GO2M9VItTU3gS9XtxJ4p/8Klhtxf44PhfC/p18ODL2O7tPErzjIvOtA/bovztkuynwRheyNKDBgIWSwowOXMbbJBzw8Jk6zkQGG1HQWqvuIr25ZY+0aBhCRRQjAFOH3T3qZ5jyCFdOk0I+5cxdNiyeq9GS4RU94Imz4J+57rK0TuOFyd3vkByk/YxQ7fdNeMDvZRQA/6eyj8b0HuJPpJ1CHmcKBswHd4t+B+tbgH2iv7TT3SkJtLv5osJz/K91qnvmR4KaF5NbCgNilFbZWqlL4x3MKIaq1nsXZVpWstVY/teHohDTc77ZQU0uf2LMvarMB3P/opkBe45AZfoaBurkNKZCKA1bta3JRGXJZCp8RBCvag8uynvOBjbByJGCLkomHE+/ruMNFp+DL3zK3VlnnZ19qTv5gAgkJelKPrfupBcdKBEM9bjRozPoEqoacvXThhTlbh6QTq5aSFuTwXguo8xSojYRcyhJgo2I2uCBKY9AiVTBQP37DatsMTtzjt8GnrGQt2R7UrKyHbg/09PfORPumyzjKkQPlBMN2RDXluGEPLXMgMIuLYTRFh8P7vtGcXAdv0XKIKPYKJ+2I6o9isUtFCWRxGQj6H2nOKB4fATNtxDNYpVwLbg4qKko+CEyig6qxJL1uZrE44BVmmAWcKRxmsyhBW0JYVZvi+raeUEHv/y4buS9W4SNfWzxuaL65cs8vOrftCnEMUjsZK0ZLga7+Gs8nhq0YU6VkzDb9i5J4Yh+BE1MtMApn4IMQ3x622qfGf3vZOa4Q2+G9I9u/V1D6KzGfL+iemVLRCdfa0QnpZEOU8Iq79sF1ssaNHCDMxqh7Hih6xnrAAU7R8El1A5SR01qIgdGDfF9dkd5T+zk2lfIUXLudY0vy7laKzpBdqmA2RlcrjiRMsiWpdhaUlEAjuiXBDJcLPSvhdXPYovCF4HQ839rf/ww== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7b81aa0f-6e52-40a6-6cb0-08db1280b3ff X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Feb 2023 13:53:39.0375 (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: pTf5k4tIzu5m+DNbvVXLDfF/Gj/xeNHS+BtZBwHcIo9U80wK75YAYhVUTK7NmC6u+eJ8D96zDoJWCQCjPwyfvg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8238 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?1758267894688250837?= X-GMAIL-MSGID: =?utf-8?q?1758267894688250837?= 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 --- v1->v2: none 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 Sun Feb 19 13:52:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 59154 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp856881wrn; Sun, 19 Feb 2023 05:56:49 -0800 (PST) X-Google-Smtp-Source: AK7set8VkVJ8NUEVnTg3cROPMXkYmMes21Rkg65I4+U3nip4eD+FeSQ2np9OrQfwhiBmbbllQLPB X-Received: by 2002:a05:6402:1641:b0:4ab:1dcc:2786 with SMTP id s1-20020a056402164100b004ab1dcc2786mr1844733edx.35.1676815009019; Sun, 19 Feb 2023 05:56:49 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1676815009; cv=pass; d=google.com; s=arc-20160816; b=H+Zvm5LMt3ynntCMsZ4toj16EnX8SwBOz2houJvABFCbwY9dqD20cgjoqYY3uXCl4S gi8qwEKo0Q7JwTGR8dAMw20C3+cK/j7mK+zbq3hVdAblosCLtUHARoNTm1VSdDh0Sg8m 6DT07Ekaa6n1N+GZLPtImchLC2Z2FFchddEZWqQ/GczR04xUCRLR9dx2Si9abpkmylvC /u6I/gAmkaUdiuYf5fL5r7xpYIH6T7Qc620r63akfPeiSl9FF4UfXayNXf1VQ9UQI1t1 gWED+NY8e6sY5mFgHaSENnTtQEUpzC+hj9o3FyNYJGE26QfjLP2vLTFCdwVq1DEKsHTW wkwg== 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=hl7MclDXQJW4H3dwkVvndquCv9OyPf3JcRdtSaz4Ths=; b=wXeXv1QuOYYYrIBxAM0eJQinqBDDzUnszWcsz4UcTi+EtHppn5XaxXwmIAkZ1WtO3X cEgviNdhVifj6qyPd1QTevONUxLK8GqAusbBA4L+CL3Zyi1WS8Ib9bKCk21FxU76X6+U v4LeAouXtLdspk3xmAqv7DILflrxZXzP12BeWTid/6L9JEXi1V1rMZP8/2XRIwgzZHo8 qYnnYdpCEm8HmIGhaDQGlkVF4y0HMZBfDVrq1+GZgRAkVRV3d0r6j3FXdKLaUnDGDYGO qvVD3GT5B7lX4jSMYbtzO04o10XzKo3glKt/xJHIUAX99xCNi0JTLOLwc6LJgalLrrUs iU9A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=Nd8RFfa2; 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 r6-20020aa7cfc6000000b004adbb128325si2498624edy.119.2023.02.19.05.56.26; Sun, 19 Feb 2023 05:56:48 -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=Nd8RFfa2; 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 S230020AbjBSNxv (ORCPT + 99 others); Sun, 19 Feb 2023 08:53:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229994AbjBSNxo (ORCPT ); Sun, 19 Feb 2023 08:53:44 -0500 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2052.outbound.protection.outlook.com [40.107.104.52]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5DD1910F0; Sun, 19 Feb 2023 05:53:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=X2MO8PiPthWBLh6a4SOjb5UZIANTW7KF9s8hcuIM50i4WK5Iqt6L3cbU6hpDQIYPPVN4+Mrlt9JPjw5FZY7VXE5v6jQY9rb4D1sEGX4bQ9NdQmIF7qTmqNNjR7TSLjVosDFh73DLOle1QKgQ4J5Mc8Yd8WNMsAly5FujqM2SB5uXerKWIEwp0HGeA4931cJKZKz3XQQqDYV7JMjmsP6Xg3GrBlpleKc2ejp57BgdglNiBeHiOikTFP/iMs/EHu4iNmKOaEhMH+znphQgpsSrkDizZkLl/Vj7SwZDCsiYLz/eKMWEuiFVXSsYgZv0x01gYGypvmrsWALbZjrS+hyV4w== 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=hl7MclDXQJW4H3dwkVvndquCv9OyPf3JcRdtSaz4Ths=; b=DdSD0lpL5VkK+OzfNDkTfsbrueH1oi/+ZVxJNrNBU/e0jNE5KvA2HDQ1omGhwWdUcjQZ7Tq5Dt0ZHR7mgl4SG6W13hcuJHbepYdo50JmU9YG7wcntZRxTQFm299Vqza2Co+9ETR6U6+BtcS/ZI7zShysCX/LqQVFsIc3ot9QaRVFiG8ml8klYNcIrzYL3fIrg7fOHJ1fpZ41lBrOfE6WBAnFLxz30MailZss9nlAj5eIM88/YQgs8v6XlCJrvvZh5p0r3TjnzXoFqgMm+m8r8WOPBax+fIp/J2zyAW86qjUNqOEAp6uI7+ua8Sy3+WZGjW6Hiv31AfAF5jfDEpD/wg== 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=hl7MclDXQJW4H3dwkVvndquCv9OyPf3JcRdtSaz4Ths=; b=Nd8RFfa2lLb/yA6mWlFo9+CrIdtX5TZoW6SVFRO0tDJtgfU55BzfHGRwuTPvjgpN4yx+qpqS8wBy8IRiNfGGsijctWnLtvfBC7BciRkVS3sZadIowpoQjShsrYnBfJcw361+n/JpqAZuOSd/Ov5P3/GaxY7XlALRn7Gyty/5AA8= 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 PAXPR04MB8238.eurprd04.prod.outlook.com (2603:10a6:102:1bc::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6111.17; Sun, 19 Feb 2023 13:53:41 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::3cfb:3ae7:1686:a68b]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::3cfb:3ae7:1686:a68b%7]) with mapi id 15.20.6111.018; Sun, 19 Feb 2023 13:53:41 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Jamal Hadi Salim , Cong Wang , Jiri Pirko , Vinicius Costa Gomes , Kurt Kanzenbach , Gerhard Engleder , Amritha Nambiar , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Andrew Lunn , Florian Fainelli , Ferenc Fejes , Xiaoliang Yang , Roger Quadros , Pranavi Somisetty , Harini Katakam , linux-kernel@vger.kernel.org, Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Wong Vee Khee , Michael Sit Wei Hong , Jacob Keller Subject: [PATCH v2 net-next 02/12] net: mscc: ocelot: add support for mqprio offload Date: Sun, 19 Feb 2023 15:52:58 +0200 Message-Id: <20230219135309.594188-3-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230219135309.594188-1-vladimir.oltean@nxp.com> References: <20230219135309.594188-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: BE1P281CA0136.DEUP281.PROD.OUTLOOK.COM (2603:10a6:b10:7c::6) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5136:EE_|PAXPR04MB8238:EE_ X-MS-Office365-Filtering-Correlation-Id: 46cde5f2-fa84-405b-0ae3-08db1280b527 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZkXbG9ef/eYAcH1Iut2zpHs/5sj3onXJZBHw4R3A2QFeTKyyZW+6T3cXkgRiW/lFfNC7UzHGow2Tg3K8au8sBX/n/db7DY2vJ4AUfPdU0g2FgsmHbzHYZxj6AAdw9G/pbQYZrcU1eMwcqKNnYQm3WsYy5HURhNQJmEUU82E3A0N+EDCQJrXWJichOCyehYdSfK4TW5Fhq48Jyf0FasXunFfiBBxaA8Spv0qiOboIEacuxaqJO/Dgk2IyQmV78/a7+oqWalxy6gsKrJbhiqpXQpWxDqEUIMazsc2GXKnrElxGpQLDC7Upyxr+kj2OZQUhAkWV5SF4KcdL+EXZFZLgOhsDnqNyMkdWEFONI8C1jRKLhNpSxfStr9/Yff9qBPYjIQM20Zed6wWu0yps7V9jlN9W2RgYxAcqhKoFDCkHpHU0AhKfWjr7F0OyLmfXV3eq+IX0HPz6o3E0YJPmRa64tjYg1bpOSRRokHYSJhB6nQXeWPKz88qzpC8IyRH+47K5/rvQRPXLus7MJWncuOb4iFIC+9beTzXzp4THYpo53MU/Z1IssSY5bOGyqw33Y22RNoqK/aetckbkaBw2gWWMfsp97UWWD2VZXZTJk4Q5wDIyp7TFt0Sx+sB9ZS6B+iMOUiUxQYsgGaVfUVwe7i9SAXDhF8Cm2k5fewOi1767Ch6WPH0nGXh/SsrzM6l4KvQttp2G5K4NscUHN8nfBfDYmQ== 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)(396003)(346002)(136003)(39860400002)(366004)(376002)(451199018)(8676002)(66556008)(66946007)(66476007)(5660300002)(7416002)(4326008)(8936002)(41300700001)(6916009)(44832011)(86362001)(38100700002)(38350700002)(6512007)(6666004)(6506007)(186003)(26005)(2616005)(83380400001)(52116002)(6486002)(478600001)(1076003)(36756003)(316002)(54906003)(2906002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: aDBJSRvxdgWDK3r5GsKUMga64n1kH6m0/AV8a9MrvjS8do8AMRTbAhD5d4G9NepEzKE+wV0CIhWZw4Pb/fA2os/JWOm+uHSl+oEj4EgHB7rAgF0Sb0Z2Gt3O0hbAiOl3iLMGWC58Rg2wVCjmdr5f05vLLKwogZ0Ad/ChfmtBIV+9qW9+czuJOu6shk0bVgyqrY2GrAg/7cnKi9eCD8O8+FDgUUDspGSvaDpM4+KE/0TqP/bfUtlWxW3AyoQcy48INT3bZC+iCGI6p3Ngwl+cgAzgIr1xI08wpTKeiX1/ql3FXmUJyArUc2Bdn6V2v0VCc3NFROHffmKZ+viL4eNcWjYMMw/+r1BIS8WAAcqGf9jJdhaS58OAJtJkH0BzOQ8fyEkop9HHxuJ3NtpICNdTXDEVfu+v/d4RNtmeNslVDKqDNxTHd8eMmNbhpPFYqR299Gh8zvlbZVQDx+MX3iMwl17zQ4fRib5o+NGe5fTrjFUgPTqxhg9NbIcm8GKGiB4PuZko1cqAO86oejVorXBH6zTK0eM56PP8KJQQKp7W/pdMojKCUjQWpa5EIg90EElId/vBirg7tPtznQQeTOh1ZpVkX38Rk6ThLA992+NdkJ5QXKlVdLHFOzx/LYEHUgaDaoON1M8SVXAulJ2QxKEAd3dGJvC+YOZE/EFyLkyDBa3Bz+RVG54xu6N/o1TWq0OiWNGpj4XPu8NbqbXxFF/ReJeelnqmv6Iq4IlB25+Qk9jgTxygrKFL2n3lyD+TTHMU6HhBEoccWq3sb4dMa2R1OcCFnjnfvJkg/UInGf6ygDl6E3/zx+JzJRvIMN41f/5qQaoLHlNHRpOv7BeLKnFr7Ve/zIYtIuO52pDj+iFjgqP1JP8fV9fj0CjNO+HkskQ5G84hLHUJpyrdFkfr8kM/PHl0pt5K6tXHU0M9ej9zY2fVjF24pYssi9ti5WAzZn6mru98YQ939ZHYps2hrRLi4szfa9xhQYpvD8IC1jJsqOs1mZEBtWXiCOAJ+WGZ4Wxg8Z7d2FlTpgd1F8pJcSWRFflZYWkvKjmopFFWrclIvSdHZ2F9cIw62F6aMvTzJIJTei9EbvRiIR4RBm3jen6QzJRoy4n8ayLmf8aNe4syrjjrT9PSSu+flE6E90XzJ7xeuOn+uk194AXuiLOF/+inr0XvFVGPF+4HP2blI4erjjgGtyJ33H6iUukOJ/OOzRFkgq3BxT08a2mKNFJHqGBqc0hSNzeVJQcEHrtNyFVSIU9TQYUNOPNFB7jwh6L60fKHEkZRuzidP3TziVkgkSssUO+KCFvTRhdwkQhDYcA2yzFudo3CobQQugJT/ynAApOKugdlyhXl/uBbnrSzmqc58I/X+XVKoIVptKvSJP8MAmRhMcr9sdHA3Hg5tQvi8eBQddZn4TG65o1iGJtSbw8j/53X7C6hlWFpdRw97BF83mf74woYmIYhFvj/LrLNn6M5/I4rpJeMDFDXzuMFQIuvVbQDoy7xEASe9VgTJ12A1tkamqyyqOexe8wT5tLBJHsunB/RM79mSHCXW0/8vLQFgK232swJEihfXQ8EEnYLvpC5UCrbZHjuVp076nCDsmacBtquUjfGfJ4GJh31QBRDZA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 46cde5f2-fa84-405b-0ae3-08db1280b527 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Feb 2023 13:53:40.9280 (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: t5sjtOhkCTOpNmIJ+tlzZ3nKNBkWshgBHM5aJb1sXWvo785rgi8bHotH7i+L6ZjERx3dLCKM/rAnvbddid9WBg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8238 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?1758267974953237745?= X-GMAIL-MSGID: =?utf-8?q?1758267974953237745?= 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 --- v1->v2: none 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 Sun Feb 19 13:52:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 59149 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp856684wrn; Sun, 19 Feb 2023 05:56:11 -0800 (PST) X-Google-Smtp-Source: AK7set+n4p/Se8ZsiaczPUN2LMslqTGgq3rIDpyEsunyJAYFi+86WjRs+uPvlRjp+SZ7NOt8St/r X-Received: by 2002:a17:906:c40d:b0:87b:d60a:fcbb with SMTP id u13-20020a170906c40d00b0087bd60afcbbmr4431469ejz.47.1676814971714; Sun, 19 Feb 2023 05:56:11 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1676814971; cv=pass; d=google.com; s=arc-20160816; b=NqlGcYNOvUItSwdheTOBZ5fO2VXQggh7l89aaM72Zro+o88GMlPnNh9aaL08/Jo5Lq IOfbh5EuGbyn8qp4zTu+hnY5qlt8+MMpbDc9yhSblfctCwIqGjUUn5v45qLRJFHI6F/d b9FfNBSOFNuq03KGVxmGlSyjvktBMr5URpxekFxvH6B0ndEmOYfD8DJYGz8F3j+EtbeT 0Be4cTgBsDbjqnDgDMb9CtjosBi0Zxqu0+/R0ygm7pDgIXcI7YxpQbW07uYMfVpdFcIF dUMQkSeOpKe+o96FDI6cip4ikA0/o/0k09YywHLvzp1sxH0Im7vigaAYq3q8+Xly8yfS Ppdg== 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=QShS6cOparXs1wiRaUsAwSj4ujBrAQYnKHPoAdZu+Dk=; b=ov0H9hREa6+CWgUH1D4Enn6SMXWX+oEGO4FV9o55ISPuWvXpB/IgBlOBkDJs2HS5LC Um/Ty5wACtSBmOO8XruBBkCInQH54HoveEvrGHB39gaDgQHR4f6i5JJb9ohtkBQtuoxS gODGDHAIKmMuwt5k8XU1t+KHovZr6Nn4K9loFdWOnHzDfUBwmb0U+n0HAKX6Gbfl0EU1 7SU68emjBbXiSfofXSNVZzj1SfBWJqVXvuumPNVcn9YrsF+jXA2/Auguo0UljAZ1FouU 4A74fGDNnNjLUzc5ZCCbx8A69TVeamrXt2DLJtOiptWWbaFJNFVzT5zbSBIFnvJD18xk yLug== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=aKqNoBbq; 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 fh21-20020a1709073a9500b008bafadf8b22si5508939ejc.199.2023.02.19.05.55.48; Sun, 19 Feb 2023 05:56: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=aKqNoBbq; 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 S230011AbjBSNxy (ORCPT + 99 others); Sun, 19 Feb 2023 08:53:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229763AbjBSNxp (ORCPT ); Sun, 19 Feb 2023 08:53:45 -0500 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2052.outbound.protection.outlook.com [40.107.104.52]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B28A14C14; Sun, 19 Feb 2023 05:53:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CabmCGu5yaiRDsGl2gLbdvgHnoaJ0aiBm3ZpZ29HHfzInjbgGz40/OhoNfYyMnUMtdiydjM/OHDjQELR6GYHaZC2pB77oPNi08UFCv+OXpwbVKLWMZVLfS841HkLsNFWAAjnOjkR3dyq2PRrImaT+nlt5X/PWyNpRdEmSeIuUL41J7rjCdAcOSl02QavsIY20hcnc6N+MuHzSLi2QiZcHnZwc9mrRVqTSlRhZeEJD41/PxnGBOCqHuNXS3KEglfv8kIgAPnURy32J0a0DkfZA29FIsx2bKwbtJqJRpIp+mtrinqq9zTOziCYj8wOO6/FEgYPGSdf9cDbnoL9yhzFBQ== 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=QShS6cOparXs1wiRaUsAwSj4ujBrAQYnKHPoAdZu+Dk=; b=U05hpMD7XO6WuLtFQJ53AdUvUK9ByjOVvXv/y7wtuAlDgHlsnwfG4zyEhva7oOgR+9KsOnBtHWtnTD92A/1ff+rhej8aG8AA/V/YalFslVoueWxiN33Ogf3LXTAItKwmF6CJB+33IhvHQOCvXWnmBZG0mnmdVUMZVWC8si6KoyILpXnsL1CPfXesjcvkgBiGy+GHuf2KeYak4x4OjiTNXa+O6UC2YUku32FYkJWvmvuYfSIJgymeiSdEDxxFvcTRjM00I3/QewcSzCYYhAiz3CZFTrMaYn18x6BH/2Gwnx0L6Fl2kGa1zF0gREeW0ewP97HG8eBDr9Xq0O+v5B0gEg== 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=QShS6cOparXs1wiRaUsAwSj4ujBrAQYnKHPoAdZu+Dk=; b=aKqNoBbq5z7Z9ZzZgn2YXPDUzg9rfT2EsQm8tQWq0URuPPUZJGJEtr+TqOaTcOkJ9lmnl+/MrfNZw5E62rJtPuxNDkpnQ7rO8Tt3hiuVV3ItfNATZimGm4MsadG/EDDfdZwItDXCHfK/UxkMSdDb2voR+It0DvPGLMYLtLws77g= 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 PAXPR04MB8238.eurprd04.prod.outlook.com (2603:10a6:102:1bc::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6111.17; Sun, 19 Feb 2023 13:53: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%7]) with mapi id 15.20.6111.018; Sun, 19 Feb 2023 13:53: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 , Roger Quadros , Pranavi Somisetty , Harini Katakam , linux-kernel@vger.kernel.org, Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Wong Vee Khee , Michael Sit Wei Hong , Jacob Keller Subject: [PATCH v2 net-next 03/12] net: dsa: felix: act upon the mqprio qopt in taprio offload Date: Sun, 19 Feb 2023 15:52:59 +0200 Message-Id: <20230219135309.594188-4-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230219135309.594188-1-vladimir.oltean@nxp.com> References: <20230219135309.594188-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: BE1P281CA0136.DEUP281.PROD.OUTLOOK.COM (2603:10a6:b10:7c::6) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5136:EE_|PAXPR04MB8238:EE_ X-MS-Office365-Filtering-Correlation-Id: 85939bc3-a162-4f9e-8243-08db1280b647 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Q29rSgzVDF5AwG19c3sMiOdqPwJ33h7qIJKQGzkyJrjeQEmP/LfC/LPGSoM48H10n43esePBHvATtpRM8j4oPTnpaYOVJVVVPg51ZGM7GxAMptGbS0ljksIgE0zaXBrF8tVqg/Q7rh0VeSE0geymDLkkSPYQ/nHbLihZVS5GCP7D1e8M1ukRBaOA05bT71E6qplahemlj0+DMnSDpfqNAdIF3XFCdq4hAbdBPsnN0wXHgFzHUHvt3NeXCRQYr+qBMWQV4PfQDMyByNqAcJ6632H4RdkDwlog8MKqrZ+rOu3kP2JzLcXennQ7EkpKxrTekF/dPKFJd7oriBwp1Nt0V+DL0iH6qm9h1WqHKfWTZ0yjdMrTo+ywKSEQaym8EJl4plEFOfixIlV5MOegYR3A92fUESPqoOtawSIEtf/kDWb+bt+xe63SdsXMJt6LfuvJ1wgkd+xIkE2e2OxcogVSDBLo2IHdelm7hIBOC1R76UIPLgEXA0uliFcus2B7z3/MzHMqxliSmfqzYlMZBMG4hbLEdovqIu6Ep+FCeBjtEbGB8PO7cn0uJZmjkjZfBKwpW6v+2Or6jwTbku3LZa3qsmowTyiaic+HPEiTnwi+NHr/WMjbNNt93O5j1hDNQPlF593f3zqtOXxE0V/L+bcw/8LKVUk/rOAbDYOqHFXr77BVtRYolyk5TiPwVj6CpNQ8YsdPfEL5bhR3HxWzxivKJg== 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)(396003)(346002)(136003)(39860400002)(366004)(376002)(451199018)(8676002)(66556008)(66946007)(66476007)(5660300002)(7416002)(4326008)(8936002)(41300700001)(6916009)(44832011)(86362001)(38100700002)(38350700002)(6512007)(6666004)(6506007)(186003)(26005)(2616005)(83380400001)(52116002)(6486002)(478600001)(1076003)(36756003)(316002)(54906003)(2906002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: GjAvfgIR1nMBg4ffMkHXGxbdgHBRS3IUixjgturLkmjPoKvNVEw1WIdq57kckCiaoMneDjjLIO9VXVuPNlGVw5370fYmNIFafznbtlVr9btLdKjGjWDg4v9177H/lAiprQqgVc+ihaZee9NdMiFmuScxnVGXJI+ke9X5Lc0oCVUDzbmL/vDsUV7afx8NlIMYvaofGeBLIMO4qVq4lrJymsYAEi9m0SHwPLqjUy4soYw6sI/2GstCWErmPZkhqkEzEBD/mvDIkpYGJOzHAP5lDDu/oFOZGMN2VWUYcFHR8Nrl56lzcu6RzGK0DHHDlAtdm+iSWjX0JNyiMOxOrOPbn/22IeRsgojDMrF43mVJOuNDT7pTZ9IoHELum5J50aHfG0/PlSciQR4hBNZHYQVUCA3KmGB9WBn6vFpQx5UR/92/6V4dxLKkGmxJ1XQz0lXrb1wrB7WAicppzIz60BH5VahQLQMtrJ9KEZz7QIgONl+7cGfUpMssN9fE8t9Zhye5Bv1HTMwmcaNXZLs2Lehn9VGCMkiLD1TZxcaYSF8x5WbhJMgd6hjwx95Nq/thMP5s5yoGUQFrEX+4u2kP3OLp3DGsVFTyLXwK5NJLYh8F1GYNQ5vRyrWXPRmvTDd+a8cNpqhilboLva3giAXGKoWTtopJvaAnqFJ8L/ofytI7gGV4GElx9vPdrzN7rbZ9N7A89LHDN035NLKxX4+cQde7CbYiLVAUiYScCgICFGYKjzvVU30kVaDcLAnwO9mRNj/1RTvNOYEnPTaOiDZsWG1zvJ2iEItN+29WgcVrbS8hR6CdTRNX4lModWC+ewwge+MHz6E05LUMguqTtyfFE+QVj8PxNYQYIk36WuTs00wWnPxkdd6PbZJBUumK1ZCsG3x1xo2HfuXWfwZoMdL30bBdbYwdetZdgBlu+o6vK1X+5tso8Tea6TIjnLl1lzzprXtsjZFm77TFQtjKzcEjbaxkwZXJ7I8BG2UnJJAMX9ovYBgU65XOarBidDO6u4+OUiIYKHG/3VJyQigkcw5JsiNfQGKd8UzhPQlV/Fc2HThikxU5O+5V/K7wbnjeCwqDztrsiYyBWsXBogKYMf/cQlupuSIzn2sgIg7ab5VRNQEfEAb0GsfShaGba95WvNrX/Wh2lNO/c9Kd/dtrReKl7uwGyG+YYNHpH1mTNOef/7FkX/AdLnSjT5M73mAUHvFNCT7C3B1IKxcdPoRDNQvyyJCe8m6ohQi+Mea2RX6ydVHNFZ9cIePoJvOVZzcRlb/bZjh0bgfhqEuYc1DJ0giu72rVbwoCGJC/jHAcaoSx+uATwuxBDWTshNjdczvQ5Bs7eHroqsMtMeSiuX85u/pLhbB35KmK4M0W2hSxkRZKGfCFAXvXzx5gtllY0xT3GsrzeMFehnBReamdcFnWc4hJo5mw5b+cHyWTm8nU7Fj7A5JW3ydxXlDdEkLbUF5jkPtVDsKpVKCH2JoajvrtslnzcEUHg8j1aV5aPjaSJ49jF1CgS3VKGpQnSs4VVOUc6YstKnYql9AElCOnHrVvxpfquVTqehQPPPuMeI8/oklIZmI1FlvYeNXx8bYGUx8z20aelOOb9ZKWO+6hGKgXXeUOJku6tw== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 85939bc3-a162-4f9e-8243-08db1280b647 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Feb 2023 13:53:42.9904 (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: DkQ/zt4M6dF0dQYgSVh0pV0dTv7jDxBns3qdKm48RlB1Yu/5sDPP4tRMo6oswf9IzKyLffj50QlfbgV6RREPbA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8238 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?1758267935481156176?= X-GMAIL-MSGID: =?utf-8?q?1758267935481156176?= 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 --- v1->v2: none 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 Sun Feb 19 13:53:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 59148 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp856604wrn; Sun, 19 Feb 2023 05:55:56 -0800 (PST) X-Google-Smtp-Source: AK7set8FZm91fjITUpgGLdGQLXB1yuOEaBLKAcFuOYQ3egr1ZTuhVBUkZT/xPT7XxAcUS9x+2R5f X-Received: by 2002:aa7:d7c2:0:b0:4ae:e51e:6956 with SMTP id e2-20020aa7d7c2000000b004aee51e6956mr2623640eds.13.1676814956352; Sun, 19 Feb 2023 05:55:56 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1676814956; cv=pass; d=google.com; s=arc-20160816; b=xRFOHvSgZ564djGx4VsvaJ0Z6jOMF8IP5Oe+ZivK91KnWtjf6xaUkYYdup07VMn/hK ftoe+aIOX3wvhljU8nRzdslnlqwoYB38O5vnrtM7sOg5hrJGt4kU3DHPB61FQeZoe2AA cgw6yeSdaFHRXMQOzOd6NSQY48j9GbR4eGnB0dBSGdhhZMXBjyqdwwlzP1z5cYxVS3hK Nii/YfTxmrDB59YaK/cICbcpM6+AtxkkPqb4cduei91pJZxHDNP9Tr0BIvnoBWGYFN9C w7zMUoVej80i0eQSco06KWC70oeMOA1GFSzC4VUZhm9N/a9lpyi6P31TNjamnV+TMuuT v+Ig== 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=KAcT0HkzHfhthUr00XV9F6JG0Hk17BzdNfP36HDxFrY=; b=SXX5jFBiA+/1iCpe8fanI/WZyU9yfpu7XmkdvboAvmbVCaWAs4jeaTXdTS4V/hc2Wz nd001PbpoalYPrFaAeF1IeXqA+3ySSrtxZpHC2/L5uiDlsYHEFxxGYxVkbvP8u9BwUsu avBtADqxY0JN2eiImNKoZbJyU5klQ08MsvLrDp7d22n4Z37yjL6Ya7WE5QwBkH+PmTgD QkFEHH5a+vveIiTC1H93CEJ+vppEDeKgq0rhrO7YgDTRSW9ttRUpnYJ6X7zE0ac8r0hP 0SnsgXLNag9nneE27ITxYO10Kr979CBSZxoZL1eakCs51BQ4tyVU5Vn3WY9FymiYNpm8 L13Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=MvtwJ1ip; 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 o6-20020aa7d3c6000000b004ab15df672asi2863076edr.469.2023.02.19.05.55.34; Sun, 19 Feb 2023 05:55:56 -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=MvtwJ1ip; 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 S230037AbjBSNx6 (ORCPT + 99 others); Sun, 19 Feb 2023 08:53:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230009AbjBSNxs (ORCPT ); Sun, 19 Feb 2023 08:53:48 -0500 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on2041.outbound.protection.outlook.com [40.107.14.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A7DAF8682; Sun, 19 Feb 2023 05:53:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ad3UTFdIqaPl6i7KXCR/qLDL6BO5TbRTM4KrHW7nWeu8CRbgfi/BA5fWeBemoToLGd6FlkokL1HWPNw2D09Gb/Lyr6lHJIYK27pXzjnxhBEIJo8idWll5ai26oouunuDWGdSObd2PFCHQ1jv43F26O9PPLoWLX2uq6NZoy37cMT9Ahs+fCpp9JgzylheZIbbWy/cjQXfRv+anXkD9rnJtuIaHUUIc3m1a11ddhPHQWx11UNbhPqibf0swxqmAm6J/00ES3IpZTHSrN+BZFwtIDM1uYJhD56JgVbFvDNHlaPq1wYOC1lmjwpyc0tXGDTNvJIVpWlvnIll6LW7drPvSg== 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=KAcT0HkzHfhthUr00XV9F6JG0Hk17BzdNfP36HDxFrY=; b=comU/+GSPPKxs0o+V07X5kzz3vtere5vDkkGzgpLxdlUyJGugporBtVh/OwXYovyrI0ThcwV54rHvzEcrnYo2WzwvnswE7XB8vgBoAYB/pGZ11Li+h4EoWr6PlLFYEywb/+nO0qznbAzCFhSVBhKhd/k/6K//el1nkNwdRiZ8OmEut4FEY/80T1EWWH55syEY2ZjPdmKY1SZtONrxE8yGPTDcnZet9LFePhOTiy9jtm800ExEMvofNJ8XUsgMMpu9pY3mC0dRqmRBn9kDOZ7Y6YBimJFYKrKDSL0HDwOhWY37c09KwzN3c9AVduMObCrSCqnGqcm/6EWKY/jA69IwA== 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=KAcT0HkzHfhthUr00XV9F6JG0Hk17BzdNfP36HDxFrY=; b=MvtwJ1ip5XOGHJoywKxc5OOH8wOficX2cPYsxyvTLwVl9g/ZEs7UU+nUmOKQZDKXrdvMZ5L8cO3uKf90pWZoLP99zIzbcYpOvfBmpCBqqQ+DTwCe2OYcWXf8nhQPtVeDwmDWe8AboPzDkjKXqMLmfuTiyERVzhKN5fdA6VK9T7U= 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 PAXPR04MB8238.eurprd04.prod.outlook.com (2603:10a6:102:1bc::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6111.17; Sun, 19 Feb 2023 13:53: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%7]) with mapi id 15.20.6111.018; Sun, 19 Feb 2023 13:53: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 , Roger Quadros , Pranavi Somisetty , Harini Katakam , linux-kernel@vger.kernel.org, Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Wong Vee Khee , Michael Sit Wei Hong , Jacob Keller Subject: [PATCH v2 net-next 04/12] net: ethtool: fix __ethtool_dev_mm_supported() implementation Date: Sun, 19 Feb 2023 15:53:00 +0200 Message-Id: <20230219135309.594188-5-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230219135309.594188-1-vladimir.oltean@nxp.com> References: <20230219135309.594188-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: BE1P281CA0136.DEUP281.PROD.OUTLOOK.COM (2603:10a6:b10:7c::6) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5136:EE_|PAXPR04MB8238:EE_ X-MS-Office365-Filtering-Correlation-Id: 1065324f-985e-4e8e-ce7a-08db1280b79e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: AFWGWZQmktRWd33jNytt2rojoBUGD2k8Yc82GgQWFKgXNxEFIF1FQdRm2FFtU8YHuY2FQCZUII7U6p/RW0C+/oJzA9AJU9oRWH0WRkZAmhFl8cXiLUlJj65mMPu221wx/rAMVup3HlSwlRb/oKDzGyD/laG8DMwm74DOGxhaW2TX1tjI+DvAGkdeuOhdVPHukHvE0W7c9VyeYlAS2yZ6oRjy/2qe9ar2/q3DQwLgFCkJmFdretYTDMAA6Gf8v61plbMPX+GIY32svAq1x7YRA+UbxnZiqEo9+Q8zvbJg6ut9An0N4niO9/B4tQtndYOpxolwdOrTxVJVAuSFM4huH7yxTQFR0ZvvdOsHV2YDBLpKX2kUT33Dl9Nav6KT+GIUxJNZ8d+bHirrEvx9cwlxMy/ki0xDKIgTlJLVdythMvLH4S5RbhVRaLzmOVanENib/dI0NZYTph7zuUWdAN8WctRme+CwQ3J85rCH4wxzt40yqvJumgdMF/wRzLsdpHEEBJI5eJkaNz+5Ei/UygU+6X9XSMH3Ihh0yaYDjAPNaEoO9v0CdlBxbuwkdnXc8Paxt59FFKM7Q7cOch3F+sQqkk4gji8o8LGK1Fjx1NeLSR3eZipn/nHnBPyKa7za1HEb/RlNZxQAbgJlkn3ZgjFC1FSVYNE5U4405jeldlqE3oZTTlQjS8rdyBGMFjSsVIsRTmfG3u0ZkcY8j813ftrXYA== 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)(396003)(346002)(136003)(39860400002)(366004)(376002)(451199018)(4744005)(8676002)(66556008)(66946007)(66476007)(5660300002)(7416002)(4326008)(8936002)(41300700001)(6916009)(44832011)(86362001)(38100700002)(38350700002)(6512007)(6666004)(6506007)(186003)(26005)(2616005)(83380400001)(52116002)(6486002)(478600001)(966005)(1076003)(36756003)(316002)(54906003)(2906002)(309714004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: tpv/veH8FN4HiKcdueRMYHZ9xqXrZ2omjrgCKV1GjlPmy1bpi/ziNi47DUJ6QmJNDifhOa+Ga6aluTJpmXcUs3YFG+no8P3NTEi2CccmWx1yVuQXj8efv1BsZNcHJBC3Ps/j/T0vOgisB9fODScT8gr/a9+ubKlXtsW4ceSzp9x7W/m+FusyMi4qAepjPZASJmPFtcshQLqw5JbbKJzwbZTxV4S0eU2jcc+tycgfuX73A2TyGmMioRYjy63L3tsVfeVt5HERkS2URLK6m1eJpQa+ctqBi2GXzrnf49eSV2De5R5trSfThM7OQgNbrdmXbLWUibsRWfFdOK4+n5RIr2H9W1iKeFOoM8aHwYzVubuXwmQ2ms9uxtcqHS+iboIl+kVn4N5YgsBU1XUJvDLkmE6UcVlutnPfNzZJJUz9He6TPCdPvUXuLMvjMwhSqM4DXMHMFd40uZRnyzoDGTQdVH9v4pjJVJUYAHSI8yKC2rc/u4SVEGgtg2g7EuFN4TGF2+6bntYhdueno3whAw8ECa8+2tyKK9nK4HFv/H+WBTfpa7Gl70LrHjUpt/DX4a3nBkp74sIQfe0Bc8T0uuXFnR3dAhSMZJW1WvbPxua9jrfflNNEghOop8mBPmUEuqfzci3JwHWBCXibC7O5gqBYKMYtp9ZYWGI3KKf0BrK4PvmpA0sui+n3hhm2rqdx3z5Ps3quGg4u7JD0DacKiGaCjOJxvrNnsfIAxET46piVdeMV0EQB0IJC3N1Hd9k0qPforEka5wceJzufnkqjMa2GPzOerY43RkW6wbJm/fynW8ht8CigE8Mfbxj5yhYk31gZCcPJoXNLO4b/mBiLajyVhrb5idUy8F+CbfgzsNvGEXjmsTPxtfWhzumH8updhy9p60FNcaMirGN68ZoPdqSgcAd//0NJQ/omacXY96/kun6ftpgj6B+T2MDc72ZZfMbg8p6jQ1iScl8e0/95Zpkwf5pDxrLztCwp/BbEsaThwqHzinAkah3XUWe7PbsT9/gW5UK8gYtZvLVsfEY9A1w03kJkx85gF+gyklcHtrHRIeAJeaku76DI+y0Rac37abZjgmr+SCwZd/wiZZHXI+4GbtjDo+YITWx4Kw9MDNmpbFORi5lp2ZXHMb3hpADRlbixY6KXImsiItCJlAfMyP4kUdc+PtyJ+G5v+PuXFz8dNOFJ4xqvpGGGcoRuXu9KOojTUNiFbnLngrfFYzl23eXODM6lLtAD+hnAY/Cg3fmkZdoHnMpnDIDttgHg3CC3Gm/X5j4Jsklx8EVtXJDq0Ru6oETCKJYApA9xrCjU+0X0dhwb+PiffWM9Ioyr4krQQMNS0ERniIh9IvJYA8A1h6gxp3npgfczZPUAiOP5AeindV/wQVzvbuVo7A19I+0ikjqovuTaeFLLKxcnTuV7gsr1RVVc9aqERIK7ZdrWmZcYfT4NMaVvd0zlovTXJEcQiN3B4I6dLxf5M6OgKZgbzCCeQij8fq4qMHXD7SzO/27U1q38Lxqr6RjLcIbDdgjzzTBprhKiXXg66GdeXkfG9tISS6g03X40Y1GDb6j6CKUXBkO+Mwgrre6cNhIlHnoFGQ+huJZmnZrTL8kpdzVzl1DBtg== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1065324f-985e-4e8e-ce7a-08db1280b79e X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Feb 2023 13:53:45.0996 (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: nEK9m9NPv52IjDXXbjP1S8ov+aD30ndPd8tAS7Srj3/dt9BN9ANYB6Hk3MR6C/jq2L9qtiwAOFcDukWb6yGOXA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8238 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758267919432117721?= X-GMAIL-MSGID: =?utf-8?q?1758267919432117721?= 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 --- v1->v2: none 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 Sun Feb 19 13:53:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 59150 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp856693wrn; Sun, 19 Feb 2023 05:56:12 -0800 (PST) X-Google-Smtp-Source: AK7set/zvnqarmshnqE8TAnWRuB5+SS/qmIzO6g4og6b4RBa8irONd7+ZupwLDVd15+7Bu75bu7L X-Received: by 2002:a17:907:2128:b0:8af:54d0:181d with SMTP id qo8-20020a170907212800b008af54d0181dmr5197667ejb.35.1676814972736; Sun, 19 Feb 2023 05:56:12 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1676814972; cv=pass; d=google.com; s=arc-20160816; b=p2G8FgabMydmwXJd5DfUJAKMuun+o5YdzYZ1nXSfSaYuru+KDq5Oft3DGFMFRko5oA 1eXVHdY4HhMzzwQKwBLRkbahVxK88jnf2gxSYILlbHGSIkhaKzJgdyLtQdn2iTAK13yY L3sEJKe2NTPisI1Hn20BvEAZ5E6X9THOimBmA2Ahg+K9HNSlAa++dYccQg02+Uph/zeH mln9Gx0YzbwqQnW5AF8yus8IW4LGVyLUWDu0WLkXzJt9pzSAH1+kfWu5Wa/blJsOspCi dS/SEAjP5hfJDpBYWjrNbQD4AVkCjnoMeAmMwkm3rOoZlDG9oMlipKwbwkF2vGbWKvJk 8JuA== 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=prtL8wN1DAe1pCU6JlXiJfEihnur3t9YaBWwfb5Tv5s=; b=0K9KHiz2yweHZvCsva0RM9IwPOMAbe9T1aTcuSKY23lB1bCuvnGdYkjzhwzrD7VrQo Th+pil62fdAPqS3O1dNcFD3UJo87/pjaN4cRXTg+kotsEMZdcI4B21yZuxzhk4Vq9FQh 1T40MQ0KrcGJ7fRWA+YWJAyp0dBlvfNeuKTvRraWKtW8EnShItKxO+AMR2JfzS7c30xP cWAV6R0+GMGzD0YvjmXcqcBHwWNWXjZfGeRWPe7a5ry+7Kv6wn2L31zLNplmDTlWKzbR o+NCQ/agL//H8zaOI5N/ZahCipA7jQK8vIh1oyDY8aeV7cpa2+NUiI9lhGZo3PeICBrv S3TQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=LzhRnaC7; 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 20-20020a170906001400b008d214f8678fsi351976eja.690.2023.02.19.05.55.49; Sun, 19 Feb 2023 05:56:12 -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=LzhRnaC7; 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 S230049AbjBSNyE (ORCPT + 99 others); Sun, 19 Feb 2023 08:54:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229942AbjBSNxt (ORCPT ); Sun, 19 Feb 2023 08:53:49 -0500 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on2041.outbound.protection.outlook.com [40.107.14.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0044310ABF; Sun, 19 Feb 2023 05:53:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Fg5z8ku9Nwqbf2bais5WEkN4x/SWAb/T0Khnc3VKTARU4RUjWFLcB4BmFBZxUoCFuVlUJizlwvZZdJiN7NeB9qHYHAwamMyl9tjUdjJXxPjL/kLX9RcDYDlaU/mQgHUPvMDlYj/f+su6a5r5JUU609YBV48+7z6YZLz9HnY+5Z/f1TGGT99xxA6B+QAndite5rkB+0JGbkP+Lluw7fA27I9NxtTaoqFjkoadGrO9LbvCmfJexFNApSxv01szEb6AoH4SFnRFkZC06I/ndqrr4gV4wp7RjVsGr4y3MDin116R0ZlVqs+ciqtWH5V2BoAD07FWHd4plT8h1FZp8xW19w== 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=prtL8wN1DAe1pCU6JlXiJfEihnur3t9YaBWwfb5Tv5s=; b=DH453lu6I0ifadvLPIQEOd25CMfmRwG3J5QxHolTxBUNpyQL0bV3Fi1Te68tEhn81aZOVrijTssab5UBtusu4rBLpER9XammaPp4yDEPxtRqZJiFa9I9tqLvOU263vFngnPXC6bS/vhs9FRUvuG7Vj5/4vnywP5pWIEqq01/17nkHfJRBLCrZDtU2jleIu89vzdwLF/AoR+bivo1AodguTcMIRm7b3bCitDeFhm2bce4okFrHGGAqftMnRkK+TSSeu+Fr5ishk6xzQD9NKw4C6JF6urZzBdJm/c/a9dfi8jrI10aUVFNgJiP8LNsY/ahj1qY5DAagiBLwVgnK3F7Rw== 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=prtL8wN1DAe1pCU6JlXiJfEihnur3t9YaBWwfb5Tv5s=; b=LzhRnaC7BR4L8GeJ1eX4jx9nzT2p9JBmXUwY8eyHG9FkTVGTEStX4DAgLDG8SFzuuMKbIUaFBf15Pgl46VX2VUpov6G4rB3eZsNUWIK5g7c1p264B6S+eOwz+rxn+QcHjiWIgW8IrpbWwF4gXVdfUi8TO6bz7fApjj9NWq70f6s= 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 PAXPR04MB8238.eurprd04.prod.outlook.com (2603:10a6:102:1bc::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6111.17; Sun, 19 Feb 2023 13:53: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%7]) with mapi id 15.20.6111.018; Sun, 19 Feb 2023 13:53: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 , Roger Quadros , Pranavi Somisetty , Harini Katakam , linux-kernel@vger.kernel.org, Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Wong Vee Khee , Michael Sit Wei Hong , Jacob Keller Subject: [PATCH v2 net-next 05/12] net: ethtool: create and export ethtool_dev_mm_supported() Date: Sun, 19 Feb 2023 15:53:01 +0200 Message-Id: <20230219135309.594188-6-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230219135309.594188-1-vladimir.oltean@nxp.com> References: <20230219135309.594188-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: BE1P281CA0136.DEUP281.PROD.OUTLOOK.COM (2603:10a6:b10:7c::6) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5136:EE_|PAXPR04MB8238:EE_ X-MS-Office365-Filtering-Correlation-Id: 3fd6d318-746a-4f54-ba83-08db1280b8d4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: akJ7DMOQ0UOMVBD13CbhdiTDx/8s/JInmF7cpCVVbNpya6ATcfkCA+zmnYG/PFM7V+6ULs3ij2i+I+fV9XMLPpMTX/+bHYS49ivkonKdnHO/GfKPJtm0tEF43C8LVxA6cGh1l/3E1pVuhMQkXaGR+OC3S+BzHIguGTXy13xpfJOYxhESVOIAMbJjmQtyFBj+0/l7afA6bx5aK5kyEnN6OcTB0MXJxJJ9honS41W96EWQ/O3yHdZi+5ftpfq8yz9HME72N/x5PUNg/6obKmogteJIJy0KX2fSTtjd9z1J0v1US4xd/E4kDsRYcZU1z7agk4C0QTgS6TZ+dvL3eq2KJuQn4XrIfNcngH9ZoJHGjjE+e5ZUh0MPTfybY8z4EIJEXlc3GwueDGQFzaVIUwG41JyDXyXAgij7rr+89v5vHNdy9ehVgEs8B+Z57CXQWB/JEP+UPTJVM6oP2lf0Yibgrla6dOQy40+qezqDTYclulnCLY0Iv+1Az6fj350hHYzVEmcltDvXLl7vBZT4GhwPciT+Fwsny4yDcVpAw4PbR51AEovIR4DxKXpED+eKHCVJpVhdt18ol3V4L0VqTWyWIQECsnYEDHq8wRDRpGgxYC/cgP0FQRyYFEwihnAgF0mcs2fQYtxsMsXj8JwmoA3bW31P3Dg1MjpZTNnsdlyZcGhKFvZ7aH0QDi8lmSnsWGEAkMR8Dvw1OIrnCAwFMbFa9g== 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)(396003)(346002)(136003)(39860400002)(366004)(376002)(451199018)(8676002)(66556008)(66946007)(66476007)(5660300002)(7416002)(4326008)(8936002)(41300700001)(6916009)(44832011)(86362001)(38100700002)(38350700002)(6512007)(6666004)(6506007)(186003)(26005)(2616005)(52116002)(6486002)(478600001)(1076003)(36756003)(316002)(54906003)(2906002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: fjTciUMLOQ7h6Eq0XyP5/IougvAJs29Q/R9XQHfsRnQ4s8mHIhhBdaxgtq5uSGKnY0oMbIcLIvoBfjPWn8XZ6hOpAngnxN5eSrezUXS3/ExfASIbJya+OZh2oihC6pJFjLO5JYoX41o5VhI+4zfj1cOWUnohru8acriMn+ET919PqRvI3PuX/a72Y6AEIVM3r2STdZBAyiC4zbfzV1Cv28SjohkCgfL9uobFKqexscSkY9Kw2ss5wMYqJR9vq6EHFB2iWhEdasney8fsF11YgK4MZqFK4C5LkftWSirxey+GDde8K36darnO8l6PmsmKu+91rPktvFPVJjEyNlX0OvOsX+mWuM5r5t4AvjunYUSfzZHuYSFnuyr9qwP9GZnAaaLjS+540Gy7nA0iMh42533ZKnIr3MsBzM/WUkNJHLqlQWxuLN/C5H6VgaZinEJ5XaG9ZuBmFUS/BDhF5GCsG4Ko73uDD/mQACf/jBD+rC9u+AshcXqCQhQ0oQRgK5WoHneUVkalxrytZHAXp3Nyx6VgZs/g6sDmpeV2rLhIDBpHYLMc3vKzcLhL/Q0mTDD1NxZsT7vMmBeh8AvwBjRxmpGoWeNFhHFxNvmR2c5N72qyLSvTDWMZnrLRdI90IZ5RJlw56TWuMDlXxJ7J+eqEDxeh15w02VsqiRifTTC6K+vgGncgt97Nw4HZ9AprO0m+E6nlx7Zv5ODFJxglHdfZ7+kqdGSLcbiGcONt3oLV9WJvA0MZW8UWCZRfxRS6TP+PtgLAbB9/tAeCUs2OUWqnXdUYzxag/N5OyXQBHETRS4Q+5TPX6ycLZVrhCA1Qh1uIj1efq9sAcuvdiXyLVXrnLAIsMyyUS1d96rzIk15xOMEY6OogFWXxKN2M9qT20GgOtv0/+sxR2VsZpi/vE1dZ7k5TBif/Wv/lfDY6zb+JB3pkpAkqGAxJ6fWIu09WSwQjz7mmawhukvtLdcILf+vTh3ZqEeQSQYoREcOe710wclA/HG257lR4mV74480GxOsiS/NR/wPSQX8K01KjgRwpZZ+32ISzf3l+ehu8w5SzlJee3OOxa6jcNqRxUf4asqDtw/Vd5pgPrQcPrzKUun7P3cMNUawBkxO3NMKaqvmw0FCuocga+e1B92vLfeYJWfBMTpdiyQ4O+1Qcz4fwQgueqRG8C0oRqL5T6FspPXMUnYs9dtbpFFP458Pw6v5TtsDQmtbcsAKLG3Q1mogCtwab3GQdjAd3yPt14y/ig4SXKhTzSxNJ7VfyimdlO9p9lyMY+2iQspJ8HLFqloNbog4wLB+lKAQcnmtDlvRi+LjfPkBmCEKtp4qrZiteyNAh1j0UkGUmEEi693pvRnHjqelvNGFAmsMr35jgUUNutWX7bA11ZlQt3Kh7BvIv7OxnCAkOYhhk8DY6ZlFgZGR3HIbUX3utxdFsG+cMCFRSB+KolAUh3/hSYC/ncErRcSP+SKl3Gg+l3zqxT01sO+/1bg1yz7h1ho3txi9bfN2wA1IQlxqLDg8eyDIv4xRzmVLRxgPP7q7rbuicKhJX/8QLyndhTNhT5OKyXvAj3uDw8NL1X9PLL6PfOxMDZ6Q2zOsimgPe4JAIFXKrlEZzFKLVjCvNCg== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3fd6d318-746a-4f54-ba83-08db1280b8d4 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Feb 2023 13:53:47.1463 (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: +k7ScDop8URlZzzDkDgH9pYRjcDLXocvKX7XQ3GyYo8xj2ZsLdnwu3kefH9X4qOnabsbtEUmZLnEXVF5LJBxgg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8238 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758267936993387951?= X-GMAIL-MSGID: =?utf-8?q?1758267936993387951?= 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 --- v1->v2: - don't touch net/sched/sch_mqprio.c in this patch - add missing EXPORT_SYMBOL_GPL(ethtool_dev_mm_supported) include/linux/ethtool_netlink.h | 6 ++++++ net/ethtool/mm.c | 23 +++++++++++++++++++++++ 2 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..e00d7d5cea7e 100644 --- a/net/ethtool/mm.c +++ b/net/ethtool/mm.c @@ -249,3 +249,26 @@ 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; +} +EXPORT_SYMBOL_GPL(ethtool_dev_mm_supported); From patchwork Sun Feb 19 13:53:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 59151 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp856706wrn; Sun, 19 Feb 2023 05:56:15 -0800 (PST) X-Google-Smtp-Source: AK7set/GvHkWh3CGIZvyRqcQcHbfCA6gYC2gTmGn2NhUFU6KhWDXqaHK3XRvbATMPBUfz0ki1hSj X-Received: by 2002:a17:906:749:b0:8b0:fbd1:1a61 with SMTP id z9-20020a170906074900b008b0fbd11a61mr5918675ejb.52.1676814975395; Sun, 19 Feb 2023 05:56:15 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1676814975; cv=pass; d=google.com; s=arc-20160816; b=aeTgOPXNkenAZYc+voayTYCz42P654/eNcviuQhwyo5B8dURSKi/Nkdqc5Dx130nSb wck1JZWYWjK1UDWnurYEbMD7HNk3J34dc8ACPYV0bB9+TT4poghmHE9JyIgS7H9U7mwT b0jcpUQ2I1cHPhCW/XRCspiogZ57sEAPMhqTD3oIhXr62lYVtkLrOChh7h8GOHA4+Lie uZwJmM//oX4+jr9JgVXORDBb/5Hy5ZzpT5xUz7VV1g4OgGv1E0PLBDNp3hdZ7FCoDKkh 9RqZLFU7Fic9XxvfbwMA5AG5jXp9j9w9E5j+xXZa+lgv4jor865KvAQkFn4AmHcrJiz+ HBhA== 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=itueYiE25vD14VZjwV/XI4EnB7VRX3t95vpBl1y6Hq8=; b=cqj6eXwHfySUPAqwMY34SDBiQotLD3jSLU8FmJDhwioleaklFbclBWfdlAw+pFLjl2 rEuy1Ej6lzH8VIZQDY4tMlCdHHSEns1So992LNaRWt4RZ4tDfsYAut5rRIAxJ1avblFE kT7bEJvlM+GCgXEkvkvbtlLOlgaWhtXXhLwp4f8XKHTgnOoSGKgVegTn600rGKWghAA7 qkc+PyP/P8FUCGzznEXDDRsNLxTUVtN7x3vXiH3CMnnSzqvERvxdBoYUyIiIUtyEHBTp 1gY8/hOWLHb7+DRmoAGkml8B9fWUcWICNI00sg/LVKeHXO/CvlO3zE30RTubY3RH6hK4 xDFA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b="lXW+m/l/"; 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 w9-20020aa7da49000000b004acc992d6f7si11752485eds.257.2023.02.19.05.55.52; Sun, 19 Feb 2023 05:56: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="lXW+m/l/"; 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 S230058AbjBSNyI (ORCPT + 99 others); Sun, 19 Feb 2023 08:54:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44206 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230024AbjBSNxv (ORCPT ); Sun, 19 Feb 2023 08:53:51 -0500 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on2041.outbound.protection.outlook.com [40.107.14.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 409651117A; Sun, 19 Feb 2023 05:53:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=m00IwGvP7/vXf4A+F64K3DTZB2uyStPL1quPxxlK7Re68IXz08+/svHusAneneGI/OtysDxWvX2MuyVqWv36TqgvVq4QTjBD6XH0Dld11r8PX94lJ7DsQ+YtR1kF4EIbPXesBqsvPCKoUJ69vErSOUwi3BIL6L4i5RtoelfEqExoXweeeGP9UmJisAwxHpby64bsS3ZigjnL98C0ljBblBQBMT/meKXyQPaJWRFMOo27I+CY2ZKmKqwT6hsWNVwfsOdms/RsqAP1gZ3JfDADBm6NgFdlIqOONuNYDI2SprIZv27qbosBJ179VbzbEAHByhcZO6xBj++QdnDPrj+jXA== 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=itueYiE25vD14VZjwV/XI4EnB7VRX3t95vpBl1y6Hq8=; b=EhDd7coM05Xi2dpYP5zcF5a5ig3atOauS8RJnHs/uhbWx7aek+vOBaoUfxa+30d7T9RJfY40qDByF0nMYQV3tEj3FYpnGiC0CbdH4zAVqEtHxb978wAKQXqKjHz1x9/jE6pXmMaFhLBdQHO1v9ZM/D8OrN9DvWm24Vu7upYdxdZOaBCV5dBLfGcfNU3fzKiorlXmf0YF+nhJqhRRKugH3PDWclT0XzwSYsdu4OnKlTuJzumgPQjXgOtWKghpUNN/s6px/waJ+2JSIdtdKnKNy13BlQ1mjS6LqiLmv8e/0kSIhKjm4/SycEVRMiPbwpgWwj5loOlDZN7b1f99SIKTIw== 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=itueYiE25vD14VZjwV/XI4EnB7VRX3t95vpBl1y6Hq8=; b=lXW+m/l/S3Pt5Kn/CJ6wfwkalqChDIrFjO9WX/Yg08qVD5ILB221mLkvA+3iD7k67GH95CAf3gmj8MU73ebfDIXFLdbxU9rwDhvzJxBPM0Og/LGIarOeBOSj5x2CGOzu9O6E8dc2XSr7Y9rHcGr2UmlyyRNemKY3BkV+Q+sWy0g= 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 PAXPR04MB8238.eurprd04.prod.outlook.com (2603:10a6:102:1bc::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6111.17; Sun, 19 Feb 2023 13:53: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%7]) with mapi id 15.20.6111.018; Sun, 19 Feb 2023 13:53: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 , Roger Quadros , Pranavi Somisetty , Harini Katakam , linux-kernel@vger.kernel.org, Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Wong Vee Khee , Michael Sit Wei Hong , Jacob Keller Subject: [PATCH v2 net-next 06/12] net/sched: mqprio: simplify handling of nlattr portion of TCA_OPTIONS Date: Sun, 19 Feb 2023 15:53:02 +0200 Message-Id: <20230219135309.594188-7-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230219135309.594188-1-vladimir.oltean@nxp.com> References: <20230219135309.594188-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: BE1P281CA0136.DEUP281.PROD.OUTLOOK.COM (2603:10a6:b10:7c::6) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5136:EE_|PAXPR04MB8238:EE_ X-MS-Office365-Filtering-Correlation-Id: 8c793e91-4460-4175-1d5f-08db1280ba01 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Gdtqbq/PG6jv4HIP0UGrY0Ndo22s/ovOGsXo6Q6jeBNLXhjLVJ4aNHqx1O6XG0qvg7/Nc/kcsRYO7KWCVviDsxaeW5RW5ph/g2UFxWchwaq60QTwIkYR9aKM5G0tAurDIlECNZq/M40qJESJ0d8Iu6BW4OKCwBEOghT3A+21pOZImBd+/gB7G++VthxvD5GyML4i46Bts0s3xHCIrjYft2PW8FUQtm2RwXXt31ICxCs/AW5UIsIcPxgqAOZa3jkHHc2KyyKnNi86l8H4GilGpj5Kq1UdyA8bGE32uMBBrq/36gcGsaVLkphgKCk011L2cbFoCs6WuEa2ghQt4fq0MvNLOfTKFmV5wNG3aG7QwQYYIvqaL3+0zT1DgYIkU6z7Q4oUvSj5gcxWZZeTie0nAIjIa0bTRUgwYxdOkkXQeN4EOguhpD5cU3UoEVWNBwZI4v+KYIsMFyAt6Oc74KHWv3v0bWY5QlUANKAybZvdXon7/H8WjaNF+gUhuqRkpMFfpSCazShrMN91rsZLCh2151zdhFj+5pF5KLal8fSNb/lU62w2CVjAG0y1t3UkofV6d0aspsstg8W8DW/12MP445qdY0eU1BBUNylrNFRcQ07KtrMRqBeN5vEZYhC1P5rmA8JpLKmVFJtVX8yvTSzGHVsGgDstVMEtfciKJbTbCy2vcUnQVnjCAPP2lhRZ9RWc7ivuHxkYj9zoxDAGxKXgDA== 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)(396003)(346002)(136003)(39860400002)(366004)(376002)(451199018)(8676002)(66556008)(66946007)(66476007)(5660300002)(7416002)(4326008)(8936002)(41300700001)(6916009)(44832011)(86362001)(38100700002)(38350700002)(6512007)(6666004)(6506007)(186003)(26005)(2616005)(83380400001)(52116002)(6486002)(478600001)(1076003)(36756003)(316002)(54906003)(2906002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: lBpGOPcjnpEXhpGyfzSld80cRZFbxBvBdp+BBZvF8JeMhTPHSPgcOcI/XXUqiD2kjTP6//CeUCYIFHzoMgkbDS6ZbGvodhL7aV/AkNY905w/ELaaUL+yIF8wrzGF3KwtYk75xKBkUBQE3lxKbKoKQHVj7OZ9hS6QoNcFVfses6CQYxuFW4cD/iqI0Toxs32hOutXT0c++bVitO2CcLeJQig6qqbl6Yj7Nq6K9hT0D/eatup5vb+VT00niIZY3wstXwKfsSr89JX0AnE1kO2mpMdbzf+Vafwn5QQitjAP4nKaXNVKSV5EdlwY2k31EWKnEld61N0FR2JKsGzCtqN2/AwYthuEznCModD4UFPe7xL0DetZz6j65ozfmxt2lb2pYG6ZDDUjF/sYPstceczYRCiXBCoZiCo7PUqmg+2ebk5LwccbiWuE97m/2hpB4O060qAg+QyoFleqcPcsEFerA2CRR31tH5x/JKHTGdN2IPmxLmdpV3UrvstMuYoJR3JAdW7FQ+fLJtnt13PG5az/zXE4BRW7UnHFq2JdwBCE+2TSym6f47dpSPdyKBfKM4mxqVj+HNiz6xyFCLpa40ZSy7Y3W+pbOHHRpt8C7Q5SWdQ5V4sajR6zpT9glfn0lrmGHTGEsvMi5vAvvUg7h1XDnW1x8mJSq8786WirCWjxWEPX3vik89JPf95aDXWLia9kEnL7rNHiyI0MpefusTw7EHEEa+2B7KWfzNsFpkuHGv7oeAzT8LiNeHe1kaagXeLqMB84J8KaW7PJosWRluz9YzrYwDG/wf1lPkgQcZPN3C8ArfwvbEW6Ccg7nFOXgkbAQC+wUFZAeXqBqUPNl+/4gChnIrjEhOr49mToIdbBWjM8UK3i9jVEMpM32s75ayBNTwofJEZCICbK5S9wAK1412xG9hpQouK0b1x1hinz5tOqSyz//RgnflS/uPN5uO5aUgR709akui1n+ultri0C4XvCH8IubmQggnUQO8QS3FRz6u+VNITghZCFO4roRbv4Krely4sZvOmCwWOiG6+310DF88JAPTTp8y6fXcM5Y3FfyR7QwkD0WGGdfBZLoJ6frNUH+7hOuLRBqLFWEL/A6xJHJV9ksJmeIRL/dYJXwxarxHcn/gA+fYWdof5s0eK9vbugGZh1utUOvIqc18A6j22BvcWJUxsWIV17HWXBgTv27VtI7+KQAcDxujXxg3msulUoA9pljMqWi9rCmAtBIcANVzuBAXe1ECyTSIdzPXyeUJHxSIb+lkAD+H0/N8gsfDVhiLzyEVj+6MInHR3T17KH8IF6RPadpWWfB9GVmqmmkSYA9Of2GQRU/ghNoE3BknpjhtO5rwu5Wa/Q6dcHAiezJtRh5V5MeUokKXf5AjCWqZzCm+ga31sJzCKc3SycJwPtUCHC7N3yMsK8buxTooXtGcqhol9gXIWke5rsUNersEpDjQzL1Da3Aiau188tg6KRcHVMPHMfVonJ6hqTijj5tQtjump35PFM3EQKp77Lst2fGHdt7hCON/CgsAfKYzNC3QfvGMcfv6k11m/Qss1SBqoRRaMBXmVk9JcjYMZmAyeMtUfmdNvVtk0slPvp9OXlI8p8gPoGlRpxJPQm9Q== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8c793e91-4460-4175-1d5f-08db1280ba01 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Feb 2023 13:53:49.1462 (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: XR5gH9acTcjL5/8GUEe2OcRw9Jlcw6v7sBQLMA3MpG3hTrbpe/NFylEV3aER1GUyrCoEBnMd7/7UeL6t5S8rsw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8238 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758267939629993976?= X-GMAIL-MSGID: =?utf-8?q?1758267939629993976?= 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 --- v1->v2: none 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 48ed87b91086..94093971da5e 100644 --- a/net/sched/sch_mqprio.c +++ b/net/sched/sch_mqprio.c @@ -146,32 +146,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 Sun Feb 19 13:53:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 59152 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp856765wrn; Sun, 19 Feb 2023 05:56:26 -0800 (PST) X-Google-Smtp-Source: AK7set9nuYVNk8m6gMwU5myWp0LOzZSozmN9uBTos+bM+CCk8momN3oGEpR8egO+OiG749fIOZDE X-Received: by 2002:a17:906:35cc:b0:8af:2d2e:5d31 with SMTP id p12-20020a17090635cc00b008af2d2e5d31mr4512580ejb.31.1676814986190; Sun, 19 Feb 2023 05:56:26 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1676814986; cv=pass; d=google.com; s=arc-20160816; b=RTuLz4TwN5/TYdknMhumEWWIYJPD/j0GPdIn1cBusZEavqap1euocYtQAv9PZfwKTn /CVPl85VI72oroZIFVIMf75ihuXFbPF4hNwAv+6JjJnVIo8+CwE3bgbGTCKCx4CyG0fG cbg2dq+AqOHvrlcdu6JAS2oySzmOpzdYNC5ciNgiDG9rQVb05djap8lMMcjPbDqL4bZY EfE4L4XzjrjD7YLpZ41V/2cWW3997MSAwn9wB28Y3gu+XjW9YTd6J+VKZ7+hPcM8z8X6 WU1KR+Ukl84QY+Tk3FFFQZOR9YCoV5griArNWPtL+s+PyrDhmcGYQ2sWUqIHoCMbz1TZ s1Mg== 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=9xv3OHoj9xpm2LZXRJ8CcH0mgiYcoB0G7lZO1InBYok=; b=vt9tMDT9SoeJcN0cGoQwfHYyTp1tesFCeB9pih6rwfmrpFX9yPVpmv1bcbDsH7nfMy Kq2SUijZ2yxZ+vOxqZ8nLQApZ4KeraC2af3RH1frEdm/ODCj1mp1D01YENvz2z4LyRl1 4EhywoZz3+Iqf3y/sSm/2yTyswpufYYiy0G4n2ouG0lp40mNtBhi70qrY4cD8O6AUQFV H5Eq+fS2annfiQlIj39tNTwBUzgXC9chOi8KliwB+1pasCsOMqJ4+UbzZ/OfIPlhAfIX 0Q81ND14Wkohi7uFGmu0tfuNk+W6ks6yGS10HWVK/t3ZAJH0LffEDfRzqhIPFavkpImt etzw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=rpNEmRFr; 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 p11-20020a170907910b00b008b71bc0308fsi6145419ejq.357.2023.02.19.05.56.03; Sun, 19 Feb 2023 05:56:26 -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=rpNEmRFr; 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 S229780AbjBSNyp (ORCPT + 99 others); Sun, 19 Feb 2023 08:54:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230050AbjBSNyF (ORCPT ); Sun, 19 Feb 2023 08:54:05 -0500 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on2084.outbound.protection.outlook.com [40.107.14.84]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10BB2113E7; Sun, 19 Feb 2023 05:53:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MNKBDzUrBKXU2k27OORYefdykPbNRtwkgLVPJ84vKxGfqepVjAaGRzt2bJUOw1ZqX8ZZB7Eh8RLoJIaXQ29PaaBtpsq80QWXP/7A3RF4/aLWvk73CEtLcJFkaPlm0HLCrp3JDCTXsMByMkU0lqKUDMiAdW9avFSiE04kXI78cFEjkqFYFIfi2gyGyJ4+b14/N73pitmegomNKJuupa9hjpWmRsQ0mK0LPo2eESHVq8HOah6jj+yL9Hs2RHVNtrmjc5p+2p5YIIqdArh24sOTMmB+iFKi+er1G5BzswWEYfVHCb0n8/CS+rP16AkJvjhIn1lQ54Qo8ca7tUAeZEiEaw== 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=9xv3OHoj9xpm2LZXRJ8CcH0mgiYcoB0G7lZO1InBYok=; b=bgEgvKUeLrmb4kBH4vQAlMk1wkmNvHwAxp0rT149gtWO0U5yVXQo/4Icd6hrofdCVaZuFb951FZ1Qqm7OSBkCF4L2XrJBBMLZn1fCfQF11nH+m5K+j2eaPlhlKVIhRlIytMWJyFZRo+u81GkHnJyI70P8DS0Fr3EWsBY5kLg7xDqWRcKPjN7cRomILYdvQMPh8qGCwTDqrM/vA5e6RTgrLM9kHYjiJoxCwXv486wHcOQ1MJGUIGdNtz6gpvjBgaYIunaQkMmku/RAKTD9MaYwPR5ZaDU3AJNwx5Dm6izg6uhv8ElzKzK6ZKS8o8MUK4P2PHRg5d7VkpRb+6u1crLpQ== 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=9xv3OHoj9xpm2LZXRJ8CcH0mgiYcoB0G7lZO1InBYok=; b=rpNEmRFrwPxiMxIQlgO0UTA1kk1+3m+GUrloHxj+RFNxRB2YSrxYzqndVKOkGsyGk1UwrK6nD9qoN6GgeCmLeBlgCZrPF8M2j05l5cTvvRWQz1oDA4eFZntH2eMLtubV6j4WruqwkwtV1PoXKXjMRtovexu0JjamAg5g5/i0iJw= 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 PAXPR04MB8238.eurprd04.prod.outlook.com (2603:10a6:102:1bc::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6111.17; Sun, 19 Feb 2023 13:53: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%7]) with mapi id 15.20.6111.018; Sun, 19 Feb 2023 13:53: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 , Roger Quadros , Pranavi Somisetty , Harini Katakam , linux-kernel@vger.kernel.org, Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Wong Vee Khee , Michael Sit Wei Hong , Jacob Keller Subject: [PATCH v2 net-next 07/12] net/sched: mqprio: add extack to mqprio_parse_nlattr() Date: Sun, 19 Feb 2023 15:53:03 +0200 Message-Id: <20230219135309.594188-8-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230219135309.594188-1-vladimir.oltean@nxp.com> References: <20230219135309.594188-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: BE1P281CA0136.DEUP281.PROD.OUTLOOK.COM (2603:10a6:b10:7c::6) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5136:EE_|PAXPR04MB8238:EE_ X-MS-Office365-Filtering-Correlation-Id: a9926974-8e8c-47e0-6bbe-08db1280bb39 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: d0N8RBZTt902sWXu6sp9JZ4sQ89d7pOv6MmPYRpTCje00D+qbICCk86w0ml1N2PE9RNdMk/UM7J8I5UPvG0uLdoPGyO+OtH/4oMev8d794Fw/NQCni1Yw1LSZ4ebNBtsCIci4KRDFnyjsAbrtnEVrlbkcUIVvxmv6Y5P9VgcJC71cb+GAqyUylq6nv8pgyA/GU4mwgbDoAsU3yUxIMpuTbnkw7H4i5wyNEf3dLkr+U0+X6P/dTQ6zv6kC9b+kWSxMWjH8rwbEHf0/BPlbuh1euNDim9yL7czhmG9bfjL6WCN7eFgQYbRIQSXlZyr0N/0Vc485dWNSlgd5wRx7IQ45Y3lZG12Up+gg2Q9Fm+1S1MCHkYHiNeTZAOLxKzz6Itf1QSHf0HpcLkGFWr5Nt/YcTCYwYRKHwWsbnAsS5A2fw1aTFOGJUkzeWyCwo5n7LUCWF8EmuP0XXDj7K2XovA8Ib4jk05ohoMmffDD0Lx5hLe4XiXRkQmNWSoRC1U+WYbxddJgWdBckGVHTn85lSflw3ruvgZUhYVJG5YSSQ+HdKXeAqd7w2qC8RIguiyIeNn5ZNS64ODEUF72YpqZ1y129VLrL+sNgRkc79BwuSUOyY5lj35i9l9NQYqmd7+y4Z48ttUx+ir/Cwqv83taYj433AKMtDVO6ak00HluWVXRfsCJbAk3R2XI1WEZIFd9YGdTJ44F7zULY5PWgrjzPkM4pQ== 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)(396003)(346002)(136003)(39860400002)(366004)(376002)(451199018)(8676002)(66556008)(66946007)(66476007)(5660300002)(7416002)(4326008)(8936002)(41300700001)(6916009)(44832011)(86362001)(38100700002)(38350700002)(6512007)(6666004)(6506007)(186003)(26005)(2616005)(83380400001)(52116002)(6486002)(478600001)(1076003)(36756003)(316002)(54906003)(2906002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: nWfks/8YSEOwOzS5WgJgLqoSq2jJnP5BYOHVdd6EJdQD6sJdyTP/n97rf3PIOpaPFIfHOcpshbxxR92c6lThA/0vQsySseDvWHnD2TIiqXnXRDW4wQfa0/3Ohd9VdEC0qJivP+xEJiyVmoIGQgTILD8RiPw2eu1pn+IPISedU8gtxiM36eDLzenaHu0QvAPdiKmSMHl1Nb/d5gqALD7cKhlnHIemtpnJLZNY+r4zUieTFLyNaxC5nmJ2PJ9qFmEaYcSGiLSvmocktOfDYz99MXl+UK5uKM6VTFzRV+8kPMNNsD3lo28j5Tozd/xMEqutCmvdL7CYr+3MR+l32BeidGP5UpFwOdQ3nxP3WUBam1ENd2NBTyjNxLV0JKL/v1ldvEfZyP4RxRgqXxaBN8AO6fPMDjSCSSmJAGus9+b/ai6EYEwq6QQNrpBYozxNNQx6kX96MHVbt+hiYrQnvou9HryHQHiO/5WINvKunTVmcxeH2MsbYEJSv5mWFF4v69KrB/mZqNcsZMVDn6Nh423OcIMHcg3KBYppo0DEwiZep7TaogDhGUaCAvdX0xppql3OdLnPUEkPsFGFd8l5idj8s1ptfcFYZjnk8l5NQYlN75Btg5GuzM1kl4ws7m4OiOq1S/4b3S7dAkX4ixub2tbFG2mhXhlj48KjWOu7Cscui841pxGo7+Lq8/uJvP2DkhhPp6uymHOQ5pUhHvZ/2ssmrtQpmv3B5S1WWEdDpakGOxadRTZPb7TlJGH0B9P/JX5M7qWf4y7+9BIc4LOfsAfD26pXQE38PHJwttPmTAGwBleW27bKleAEw03eb4Je7+cFT+mUNvottcTJB/+I2KONaCU876dgsrqApxFFZo7Z7PZ0fCoRgM/mb1Q5Q6e3ZLIYqWjWKVUtC2fkp3WPGd5FwlumJPBCDy+07qvZuYvOmJuS1kkRLHpz9DnwYsqZflnYrrht/rMpn2sXPW5dplr63ZIvdHuLPbns/NYniiPxo8i3IqTwS0Qp8QeHTUsVGMx83U69hm2Kuj0dDqs1F9fuh3LVXQRDvwVtCtUmV8FViH57b8z3FT+R/UQZk+NWtbDFCBY0ZVslCviFVIdZbwKlp7hhJjNJEaBOFJG2gV/OwfJ02rNHAWHj86090iDeCOuixEUKrCBFbzKTUksg7dH3iLRmRWWlf3Zaq0p8MXtWSAGzL/jZgKgcBwnNSgE3xD6vcAWOA9R1uMNZzey6SbTQebfWgKObyll1UwIG/bUOCXt7ejImpxKZ2TtL98i1LR1YiH3oZz/DuuqzclJy2NDflf2VS/ZnS1wDkWTkPLx9dQHArdhJkpT9jE7ancIvPptqW8tM0TD3JbTbYmrpDU+0OuMI1UI2CXFktS10ICMOjpj5Qx/HYaiswiI1vk8mH8kGOty9avlFOJH1uOVbwUWfcVzP85yzWwZb+YY3Eld1Ttb2ocFpu3OWdynbqXof3VGZQtzQ9DO+CSd695o7AN2u9I4+Y91dhXHV1lBTs22Rp4YxRjticJPJZOMScLx3J5KlgKDNcN5imCRmneIggbHEZhGdK2rsaiwe83AOsuPCBn54L2M0vR1iNHG4jn3489ALHwqicbUaOxIvoODC5J5Mtw== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: a9926974-8e8c-47e0-6bbe-08db1280bb39 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Feb 2023 13:53:51.1773 (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: cdkyWdBaI3hK/kMF3Q50cGSTQFWCFB3gG5p/ohjJZiVMs56Lip67/2NqacQJSTgmsVBj7ewJmVF/7gXf7pHCEA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8238 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758267950742476260?= X-GMAIL-MSGID: =?utf-8?q?1758267950742476260?= 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 --- v1->v2: none 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 94093971da5e..5a9261c38b95 100644 --- a/net/sched/sch_mqprio.c +++ b/net/sched/sch_mqprio.c @@ -150,7 +150,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)); @@ -167,8 +168,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; @@ -181,13 +185,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); @@ -197,13 +207,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); @@ -252,7 +268,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 Sun Feb 19 13:53:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 59153 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp856878wrn; Sun, 19 Feb 2023 05:56:48 -0800 (PST) X-Google-Smtp-Source: AK7set8IV4C2Fie2FagQSBw40zt/g9/aC5rRW2bGKNhHXI9yy+XIM0cistvJbYAYBb/IPaKBZER/ X-Received: by 2002:aa7:d915:0:b0:4ab:33d5:4251 with SMTP id a21-20020aa7d915000000b004ab33d54251mr1106103edr.39.1676815008368; Sun, 19 Feb 2023 05:56:48 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1676815008; cv=pass; d=google.com; s=arc-20160816; b=TZyoV7aNrcS9RZKc0aElcqy4ZkGOO7in+stLBiliEu7uSusI5bUzQXnw02PDbeDp3Q 2f0/rzgnw2UD2ksuvBGImfh5uk6ngxdaHprNoUjxxGxSdnTm5YCkBDHrgPwweFSc1/da 1Z55e4MWkkfSZ5fAH0G3oKaNJgWe9xf2f4XMcK4ajjbRBUCGa1yyvjkoXaJs16RXyWZn VSSTVvxzss2ps7y4aVIGBRN2C5ByR0HkfUX50EEz65/USq4QhJfr2BzN+yyQy0QsQGzw giqeZQiANCFVrACf+21NrZPmNaLH3TV/nkfpbjTnqRSBwqs1GJ/bBwjzX/07nDCQJise CsOQ== 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=oWA5ZVkzye1cWQMELYAg+E5GiyqEGuVWmdf9EzSQVbM=; b=W7wiNhVjV9VbwZTRoj30GdRVKcYtccEf8HqLKAQfTpl2oU4NjK1AX9Q69Lp8qH0YGK ButsJorKv+pvoHWQndDU1kR2BFDODfTBA0Uj7/Qya/FJLeGFeyCIKxtBtjBkFp24Howr zjHggb7+HyygZ1ILW6k5y7Z3ePmvc1aeippfrSQ7rtB/IK6XPzP4mReuo1yG7rBZNLAW xTBFcZAOQQaNORZqd40wLNYsi/PP0n9Y9YSlmID1PsvSHyiLlJPImY9ukZy77mhmiyME y6TgvykOeI6ICyhA4k8M0dZqxRjOkmYc2RAPw+YhRkMKlrW0fyFh7UD5BbYKG3SiND8P mbPA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b="FQL/jHqH"; 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 r21-20020aa7da15000000b004acc9d32198si11217153eds.582.2023.02.19.05.56.26; Sun, 19 Feb 2023 05:56:48 -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="FQL/jHqH"; 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 S230126AbjBSNyr (ORCPT + 99 others); Sun, 19 Feb 2023 08:54:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230009AbjBSNyZ (ORCPT ); Sun, 19 Feb 2023 08:54:25 -0500 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on2084.outbound.protection.outlook.com [40.107.14.84]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18B5710F0; Sun, 19 Feb 2023 05:53:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=W6xM13ygB7KrqzQZC/kXFl7TYGj1bf4JJQAmhieSQZEuzbr1sPJjn+AJrJEi6oc0kL2N/hSqGAvVRPIV5MaodKtmbOWlxCguM28O6dSerMGPG/jERsFRo/FnvNffe4iFjSo3yPx4MlAvSTSJRxH9uiI9WPJfCLpEa6JYWYq1aXtrAX8sO167fHA2tSwbJmf7nnBzPegjheM3MdvbXbDqqR1UZEteNcu1iEqBy4DLQq/9sSrif4QFs/dLIfnIUDOgrdOxYGTFfSAlLE92yXo3/MPqL68i1mnhKZYBEr3XeLeWh4/MIm2dIG9R5rxxiXhxMpRcAWH+I/eUCNc2WwBAyw== 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=oWA5ZVkzye1cWQMELYAg+E5GiyqEGuVWmdf9EzSQVbM=; b=SbiMv4FhWnlv5kClsNt94nlnVi+jwhaxB/4jLAzaeUScP0I0B8+dojBJB8NVou28XnYAdLTW3FaPMpqa2UOGIkAvJBSdrgn2Wb2myGilqZV2I6eUQa2ir7lWGtR+0IggKbEXxFOPMBwSg6L/y8gt2OiGieNfleL73XMVQQKCKGJdxdBXsZDkA8adk17Vnp7nmVyr7GO3OfpmHnfpEL0pg7stxn6snDUcyy/VjsTxu5utyXsrre36fEZG/fn1H8RjO1rD1ffs7cs8smbw+WFBGLXnl3cgJJHutrdCBvtlRTCE1gm5N+ZuJ3nRM1Hgsw9ZWbUOZ7I2OWtVK/7Nguhl2A== 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=oWA5ZVkzye1cWQMELYAg+E5GiyqEGuVWmdf9EzSQVbM=; b=FQL/jHqHqMpedhbvvjUc3xtS6r2xANoA2r7i7sSe5wN7OewpPN/g97g0FkWZ0s+zMNjzvF7KqTBqd5l6ZxGUbbd01dVeXDrKwaPYmRIZs5zl2prj+TZJ+ImG3ZxX1JutM8EBNJF1JxMGluDv48ZsSXsbXVqvVAWQarV8L6389M0= 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 PAXPR04MB8238.eurprd04.prod.outlook.com (2603:10a6:102:1bc::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6111.17; Sun, 19 Feb 2023 13:53: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%7]) with mapi id 15.20.6111.018; Sun, 19 Feb 2023 13:53: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 , Roger Quadros , Pranavi Somisetty , Harini Katakam , linux-kernel@vger.kernel.org, Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Wong Vee Khee , Michael Sit Wei Hong , Jacob Keller Subject: [PATCH v2 net-next 08/12] net/sched: mqprio: add an extack message to mqprio_parse_opt() Date: Sun, 19 Feb 2023 15:53:04 +0200 Message-Id: <20230219135309.594188-9-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230219135309.594188-1-vladimir.oltean@nxp.com> References: <20230219135309.594188-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: BE1P281CA0136.DEUP281.PROD.OUTLOOK.COM (2603:10a6:b10:7c::6) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5136:EE_|PAXPR04MB8238:EE_ X-MS-Office365-Filtering-Correlation-Id: 0f92ad06-8180-43bd-9313-08db1280bc6a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: P1TjPIbliq730M693J794ImFT69MqsaxiqOSXM0MHL5c0vxga6mrt7GYYV9UYDPMUxe4jJY1qIzhFS9WojMEtvWhWQONb6CsRDct4DIPODntN1uGVlrOm8clTWovqINdhL7RfNMhMf5HZtZ6p7eF4XzkidsXZARUfLcUy6UvAH/6Hp6zD20l1HRaHvNls2QEDtclBAqDG7cVo6NoNveo/Jyyt42vIxJx1rXozRkzS9sZIK3HXPYfgyuzZSOoWV9y7MDuBWt7gDztqqf4GU6HMVBpUHOrP8vvHkHXEgU14LG9uuy5npCv+O22OANT6OGpcDb+HQKSzmoQFoBXoqNEgT40c/1KikT3AUev8JOqRWcIKCBDBKmqNbvKio66QVC7b8FxU4EQHMNpGvrnbW0S9k3idrbN1XSk/btWORUJ1sCxoX22wtBqeeFWKAhlhPnSAybtxoDFQvYqVPilECVsE1ir1GpkLOaggH6j+3NIjuulL5pmFBB0waI2LoQXVW7wx6ItCiyBVDEBPlxjzdWrd+0sHFbI3RPZOhXQzAI4pkitNphywqg3bbQ++rbWFH27jQJkWXuh5hf+Jb712DHU61DIHhT/6JLqkidH4IKC9i2WtiqMPkKTeyTiZrdprb6vRje6Lbw09ruKxN/cELk6D+PRNlrNhZM+n4eL8tIe+ejJ9phTuLOTdXntCUaFbRkN 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)(396003)(346002)(136003)(39860400002)(366004)(376002)(451199018)(8676002)(66556008)(66946007)(66476007)(5660300002)(7416002)(4326008)(8936002)(41300700001)(6916009)(44832011)(86362001)(38100700002)(38350700002)(6512007)(6666004)(6506007)(186003)(26005)(2616005)(83380400001)(52116002)(6486002)(478600001)(966005)(1076003)(36756003)(316002)(54906003)(2906002)(15650500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: EIlrReJEwhEN9b1qF+Gao4PLi1wIBABS4fqLGMfU0f+znUCrDmGsbrPADO8O9X8gj2MHg7pJkmeCZv5oj+yIQXW1RhYq5afgpbsHBa87TJKxSGI4kzQlnuCbZvx3DizVhoVv9XQRFqtQnM6qhMftvI61Y8vQbO8i7mZCt+vM45+UXbzGUnnLxHYU5IlaoYPCDQOUtumilswMwSNSXZ+kk22OltKzxeJT+AfWPxWu5Nddi2bplvwUqcf3hvk6O7tyEqU1Q/MlpzYzYRTHMvwRC8uZnTg6zmf3cNCEO5QjAYk3QioDT+/3XBFBQA0NvEVULuLSCSBF0df84t6nsNx9SYPFKTr2hHSBwBAjZnD6Lj28jH+zIQ9u+COeEEUJ57IRgTvX8AVHNHurI7FWHRm1KEqb8jUFbSTeU9aXhwFE5w/T5AuuZu1Uekban5B0s4OsVxDa5bTCL/5lemiswMTEWpq9JmB4h7DdDTkRXbvNBK0xDPCNlenf83TvlQXNFeeFw4wcE1YjsyFYv+Qu9NemaokmIad0O93z1RZpF1EnZOoHN1VX71t0zNL+u6jO5jTp0EPWJotGHfHo9rDGCdY3HIYqRcrqMu0hLSGDkNaxwlTWyDk0RIw3PbyKoUV60kgHZteNkfZFObBwBay1EMPU1FWshi9Vcm/7NxM8xqBA9nCcNmsSvGL4Y+HsJx7zsxvvLAyQDN2YsHGOrmpYtCxDMCwBnya7EgNxdSq7hJMfuOyWIuCTEXUuvYgm2mfeZM2vYfkrOGZ8pX1x1swQe9+fKTs/gBHLPpZ/yC2k80XfzLgjYwh+9WzO4xpuMKGDjIdtlUkuKxoKUBq56KLxjAgBO9aCLFDlE1tQARdbogg9TPtWNnYsZWXBBNF1/DlKtMDRd7XAii6bLOt1GzmhNLuYU5debODCYEaMyNe0Tr8XFuOMo/RER30g1LlGA0bXgUnLHRAEY2h7QyFbbB6t63IIeJ8ccEK01X1n88R9tVxTKNXdPNBSgWXRosQpgaa7qoVkkCikhFQq8IZk35a9sGn8x2r6fQdUTRz/puNJ+werpkbznuEF2j1599pCjGDj+zQUQTlHJFWpTAg1F42OMLZzmG6yj1AnSFU8jNM0yAWUJWOl0P2ZejDUVGMxePVWW9SVRKdFcdWrmx8GjPMTosxSFv1B73u1RiQYWR+1p1vIl0UUbg24HHhTchH1wWo/PLurK/Dui++om6Azk1JFoQ1cgpOfjIaAiFyaUMBga7I50uwvldhP4LnGIVSp4+wLkGSVHw0Huf8E969EQ0/YNMM+bo/1ilxQ78vViQGz7R3pX7tiQWZPOPMKKthqKrTEoBGAV6/bwRP5uuFRD+WrSYDgPRkB7iBOTe2cRkDRtecsUhWk6H5JhwhExgGCujBUNBCQ5Pcjf9AIx38TQmAhzvB0aN+JsTiuGQsYcWzSpNfPa6lpqJTtyh3aUzCBHFfuCvPRoLZPOIbEI/n6iXzdh6OVtioA4jRZ5s2c3SV+xBT6w7pzn04lxI1pPuI70B4d7AcbT/2a4Hcz1jU4C+9KWpo7gbTIHu5kaQMiJHKpjyK9yZP5tZgo9kfLP9h2flRDTFxL7i76L0GKukICUupU8x23Ug== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0f92ad06-8180-43bd-9313-08db1280bc6a X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Feb 2023 13:53:53.2084 (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: 5spolHz5ZBEOD18BX7oRQ5QSga4E8Vc+lSUT1RLEi3w5hjumlvXZeAr9FQVhooC9pV60FeHMN+A/b9gUcLxlMg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8238 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758267974488506348?= X-GMAIL-MSGID: =?utf-8?q?1758267974488506348?= 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. The kernel was (and still is) rejecting this because iproute2 defaults to "hw 1" if this command line 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 --- v1->v2: slightly reword last paragraph of commit message 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 5a9261c38b95..9ee5a9a9b9e9 100644 --- a/net/sched/sch_mqprio.c +++ b/net/sched/sch_mqprio.c @@ -133,8 +133,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 Sun Feb 19 13:53:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 59155 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp856975wrn; Sun, 19 Feb 2023 05:57:01 -0800 (PST) X-Google-Smtp-Source: AK7set8WWzOoWFOMDub+0G1ujUgdMQu2a2n51wiunBO+c5Y8p36ZZ1FUCIDUK8PGpziyHy9JJ4L7 X-Received: by 2002:a17:906:6cf:b0:88d:72c0:611 with SMTP id v15-20020a17090606cf00b0088d72c00611mr5798021ejb.3.1676815021682; Sun, 19 Feb 2023 05:57:01 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1676815021; cv=pass; d=google.com; s=arc-20160816; b=ta/1cX/kLxfiCTfkHSSiF/iHmu/coG0+OZBsfxUz12z+xUsXEtkSbwpgH2tJQ2kzmQ ldBmxrXVKdhhMzbNjo1/Cv0/aMQbceVolRGzDMqXF5jL2+A1ge+JQuQdCFJrfMmLDBB+ LrdvZF1BNQVrZQGSCD+Xun7IS3m/u2mf4v+YW7hUR4DwIcX5IwkYSAlBPAmLnfnXDdrZ pGp2AM5coX0ebxYiHPF/svJ8sVfWO1BkzLTt3oBHhwYN+rPeNcuSHFTXqVEsMXO1FYEM MzNfw4yQJplnSbYzwdrVn5VAjdkauuTB+G8TBormOBut/120Ahr8LHKeVKvEBm17RYCH 0v/g== 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=/tnAuFk/OkIAF62qcqfhm9P34ifrnzrvpBR8KHX5j50=; b=oEt8dOeNoBWr2NZyWDeeUbHW4+We8mw5s79VJRKjasJO8A0vur4JC/NXgurv2GSRhH Xyr2NaTQXOUta5pko4U12pWIn5hTBwk8bXeYhH+36FQG70TKvugx5TRAp0aTtsR2ozGt R2Ijp9B3zRl4Z8OpFy1wqK/aZ3Tb6ToYy1Pc4XQIOJFijk/k+p/rO/e+5ZIVmf409sx/ 3Pn9ZbT6AXzDbGtk3iUJt3++cD6aPP/FR/6hFhouwclcTONxU6SjQmAEyIpCq313zJh/ 7yRTr6tCa+Ha4jyApb2Xqu/9CbXRzG47Vk/4HjjbIxVfPthO1/Rv4QCS2JQodkLLEXF7 nFvw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=bDgC2jVp; 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 20-20020a17090600d400b008b1800c3c15si10250156eji.563.2023.02.19.05.56.38; Sun, 19 Feb 2023 05:57: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=bDgC2jVp; 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 S230006AbjBSNzJ (ORCPT + 99 others); Sun, 19 Feb 2023 08:55:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230116AbjBSNyq (ORCPT ); Sun, 19 Feb 2023 08:54:46 -0500 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on2084.outbound.protection.outlook.com [40.107.14.84]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E391C1205C; Sun, 19 Feb 2023 05:54:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PnJUJRxjY5Uua4ggQ8HUBe1DNK6TH/2JdVCt8XQAPY2QdRrW7aG3Qttx9kws8g1UOlE0yLxx96ZXaIL1vGZQUbMxDAuoOINbb4ojjXrRsSRyCIbUghnCPf0oT1KkcsulOMUbv+q1jn+zPIMJOp7G/AeG75lfgtF431+PnHlDEZgbo6BS4zeKSBcqpgI9vV8B0nR+58BYS+7nT5Ary2Ql4ozApxff+opEUSu8WRyAGD1irAsxqYLY2vEnVdcT6kA/PJlzXBDFH0aHDVvBLL/ZfuBeec9pf2PfAAPKwuRSmEWCrw8ilGpETtJX2FBUfXw9adFBXfjVRI9Ugi+CZsol1Q== 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=/tnAuFk/OkIAF62qcqfhm9P34ifrnzrvpBR8KHX5j50=; b=GeZhQ4LKiqa6dD4aP4j5VFuJggf8FLzYchYZuQdiGsvpZj2Uc3JHnLppKQADppbbDXV4r6YClPAr9LLwBDLpzrnTt9Qc4I7z33g3dTSIG2sAVuwaTwmMVh2tkI6h8scXZm7TIgIFTw68jsdF5gbGf/uMnR5LebW1EF2CjsotQotCBUADKqNjNAN7RPx6yTi6KVsLmXsZjdJsozO8s4BeaGoiqnwOtfq8oRlDty0XZDg5YJQkY/s/8SrXI7qVgZOtrafgmQ0KFXVyVFY6pbH5srtnEKlM3t2qBaIaqmnchyinpwHl2HZ40Oj7FXh0Pphla641opXzVvWGqAcNkCHrew== 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=/tnAuFk/OkIAF62qcqfhm9P34ifrnzrvpBR8KHX5j50=; b=bDgC2jVpcFDFbt4dPqbAi6UDhuL4kjjHJOQG3N/Lgnb2gUDpU2uq3xUGvh+oBZ8s8a8n91XK0diplHThf2PzmTCUkY3Tav2mNQRPPsNvijy9r5C67qjVK+q1Wgu3bYKGDSmeHkLfq2uNR20K6dpF5OWFmIzxkKPRsOmLMXeweSI= 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 PAXPR04MB8238.eurprd04.prod.outlook.com (2603:10a6:102:1bc::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6111.17; Sun, 19 Feb 2023 13:53:56 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::3cfb:3ae7:1686:a68b]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::3cfb:3ae7:1686:a68b%7]) with mapi id 15.20.6111.018; Sun, 19 Feb 2023 13:53:55 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Jamal Hadi Salim , Cong Wang , Jiri Pirko , Vinicius Costa Gomes , Kurt Kanzenbach , Gerhard Engleder , Amritha Nambiar , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Andrew Lunn , Florian Fainelli , Ferenc Fejes , Xiaoliang Yang , Roger Quadros , Pranavi Somisetty , Harini Katakam , linux-kernel@vger.kernel.org, Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Wong Vee Khee , Michael Sit Wei Hong , Jacob Keller Subject: [PATCH v2 net-next 09/12] net/sched: mqprio: allow per-TC user input of FP adminStatus Date: Sun, 19 Feb 2023 15:53:05 +0200 Message-Id: <20230219135309.594188-10-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230219135309.594188-1-vladimir.oltean@nxp.com> References: <20230219135309.594188-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: BE1P281CA0136.DEUP281.PROD.OUTLOOK.COM (2603:10a6:b10:7c::6) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5136:EE_|PAXPR04MB8238:EE_ X-MS-Office365-Filtering-Correlation-Id: 5b2a0896-8193-4c23-583b-08db1280bd99 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: IsM7XWm6CIgxS7CBmy9rqwI2fx6gt5HOCWa0N3lyRmWUEfkdDkFHvg32Pofd7zeAHCVYaBIc0fMssXfFlOYHZgIOM/WF9OQrFvLwmYIeDKUJUHo2dH+jpzDkL7N+hKAb2uCFD5bVtEo2z3AwYcHUbySMB27WoXGRYnDIjjitsZRqIymjjy2cj1v8YREAFVNwwJYc+SS7WdfIv4Covd0GWrpDgMTOB6FebNaJAcLZuag/hQn+yZoly/zxA9O8DtnLuY+GKYJy2bgevU1BCLDX9Kw4vVK1eGTqnQAkl1qVkRrDocYw0ImvPKAoGye8XPqqfyRI5TVSSUe6rk2/cJAQTE9E6R3WLk3SkdfQ7GvxylRrrgWXpI8dOqqLSCT3JsDm7FZjtiwJD/f/zbqxZqltXvnsVuwuejC40WnzEgLnMJmMfO7MjcaI770wpusIq7AuDKngV/TxItUqYQUCBT1buCNXIZHZUmTyOaKSmzXRBKmESz6pSNPHEoYKPNagF0BqvUSU1urTNTBxv03HO01EBfBm2U5WMhFDNy8mjIW8dE2fclWDSPMOx7cYAmcAGPcxalvd4aPSLRF5H0Py/NrN8MvYULfH9w3LPLLJYTWEE6Ix5kK6fzrjxCPxfhaQjSE1e6/w/p8MgxWMUjo7Nqnop5JsnZQiWUB2wZVwaItl0tUwKypYfk38gdFoN+gF/LWZzYYdCUrhjv/1Zx1pIeUwbQ== 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)(396003)(346002)(136003)(39860400002)(366004)(376002)(451199018)(8676002)(66556008)(66946007)(66476007)(5660300002)(7416002)(4326008)(8936002)(41300700001)(30864003)(6916009)(44832011)(86362001)(38100700002)(38350700002)(6512007)(6666004)(6506007)(186003)(26005)(2616005)(83380400001)(52116002)(6486002)(478600001)(1076003)(36756003)(316002)(54906003)(2906002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: EMrPJ/+EXticyiYhcPCnSdMziR5EC5tLiUmdPH6q8n9cbxO8dUV37Y/XmhMIOFd99YxdJ/JwoJbzN3RCS7NETWcd2+h1xOW5gQVaGGn/eHKu8lwZEqi5aJYsVJUWwVIKvZgfe4EE7/Zmk3UTJYFPC9hAaFcJ22wceSNniJDkty9JA81WFqxu2YGja/VSdnU3LeKhLQmyBLj9dXa65IePA/is/saELgRP2Wr1xyHWA3ebxxpXlrwJUnDCU7D3NvRM1gF9OAbG4wenP/zG7wr1PZGL7MTv+kT/4+oZdqD5J7v0yjwlfMYh2fNb4y5iVyDfq9/z4kDT5mwSL7Nynnd1/3sZLMokCVI7gV4+nVSI9vz2LMZnF4LguWjDeINfnnKYgLY/t0bvEC3fiVXxHfAqSSzTWvABeRIe7SI1rsyAHedEhj6YxoZVSRqApncGV1/1QXZn5sOxFQbxhpZ1zycP4/gOutbLDdVugHGC6Nr0uen8i/d56CO0ucgkv5PTjAWGZ/LXs0pvo7MMAq2lwi3cy1zsamV2mG5XLIoFF0q/r45LqIPdK93EI8+sG9JScgS8S1wQ4UA9pUEAUvpU7MGgpzwIcIwzPzSbUKAzeo9MTAJXPcNZW7mol5GKGwzuHeHF26jpPgPZvQWCx248YU4U5qlqS7sGnCAt5aPWyKs1hVIlBI1ZXrpxkd7/o00E4s9B1t9zs/aJkcbUeYI2nSI0YPEwE55f0nfTjfPWRh2ZgLzq3lmtuLNr/m0GaxHfvuwagL1ifqt5dawQkirBxDkJnkVZHeRrD/v37+mcMRawERo0TwE/jkxw7u/rzOYx/5kTd56NngcW2uA+PuJyhFGOwbE+fPWulbqsxL9Y1cHy5ftj49h1zruKTJovD6CDYUndPxd2k4Eg2wFSyqc5wv9MdMEwt5bEUVsBOMd6+6hQRuGnTXs0ag4kx/I+ZSCsUH5XRxbToCs6MYCZFmXELSjZzF0DS/kE36KbpRwltaQf9vEy7Hx7Qc1pbb7eJMT6o1QaCekJ4/hxLslKFEZGyatyKilgqWzrvh345D7iDpZtGQ0UPH+AdJPdXRgLnQ4k5ODlLJ32QwNJHMfwbenrVTkIlL0yVZRM2pDhbLh3qrH49nb4Q68JeF3GnTTtptZYwLpL/3Xvr/Qv55MupY9/nWs3GG5mIFFb5/uJA5BGpr3EDoLDegdUis0Bghhgp8ZLs0t8t81FZ+qv82NxkqwVDiewp0rFYqa6A2rgY1rMsvxQJExtelTRyWTodLU65s9h6fQR2zk3o1edv70jUwmrHMQY9r0d+qdF1N7Z65BrH8BMpEB1xeOcVcYxa+vOKJEoGz2+UX8JHBjo4X+/FO7Qy1RNTXZZlervlvIGidKG6pUMT3EtJnobgG2Z1bLMSZRDLfhZStjZoMU2udbyDdu0s5XGNHtopIim7TBKPmME2AtXT7W0/TnTeeXdbAASBg0KwF3GJD69sTQnjIT+/mZfgioFXjleHD2oKshaSIvsHO8YPx99o9OAoGz3GRhrt/1s2S2REMjhYj9jY3RVwJfHqj1/Kc3RQYRxhxd5VKFkOsikkHmC4qgI9rHVcQw9gOxkrjrHOq1YQ7IRvXFn2s1bcb2LmA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5b2a0896-8193-4c23-583b-08db1280bd99 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Feb 2023 13:53:55.1614 (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: xC2Uxnsc+ZHBKk3IYgqNmgNRvDlF3pnfiQmh84H02VcTEEyy3pL9+GpEbW9d9e2E9D35WUIM4hl8upeGKy7KcQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8238 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758267988136292097?= X-GMAIL-MSGID: =?utf-8?q?1758267988136292097?= 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 (which presumably is also under their control, when constructing the mqprio netlink attributes). 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, for the other use cases. Signed-off-by: Vladimir Oltean --- v1->v2: - slightly reword commit message - move #include to this patch - remove self-evident comment "only for dump and offloading" include/net/pkt_sched.h | 1 + include/uapi/linux/pkt_sched.h | 16 +++++ net/sched/sch_mqprio.c | 127 ++++++++++++++++++++++++++++++++- net/sched/sch_mqprio_lib.c | 14 ++++ net/sched/sch_mqprio_lib.h | 2 + 5 files changed, 159 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 9ee5a9a9b9e9..f2ca7d272274 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 @@ -27,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]; }; static int mqprio_enable_offload(struct Qdisc *sch, @@ -60,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) @@ -142,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. */ @@ -231,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; } @@ -244,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); @@ -262,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)); @@ -412,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); @@ -462,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 Sun Feb 19 13:53:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 59156 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp857138wrn; Sun, 19 Feb 2023 05:57:40 -0800 (PST) X-Google-Smtp-Source: AK7set//drf1Zj+b3C+068GxJZ2iM+XGxvw2QjM4Zgp+vtL2ni51/KwlzzYd2xu669BLYIJz/uxW X-Received: by 2002:aa7:dc0b:0:b0:474:a583:2e1a with SMTP id b11-20020aa7dc0b000000b00474a5832e1amr1585227edu.12.1676815059902; Sun, 19 Feb 2023 05:57:39 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1676815059; cv=pass; d=google.com; s=arc-20160816; b=tyXQVvXm4fxQlQtqdKF8ZbIRAbiMPrBb2ECZhzNEvWcOKvLSDqIlhpq5mUDkEbbCMS 6GSKrC2i/5i+p2W7zL9gM8YAWMqcNtwVQKRJXpb1u+KuAv2U26GKkr3UoUCJ3n6eLcUU INnWX/3dV54iFBtxM1N0w0LHDlcT4ESS2Cbw+VUxl34iSDj+P9VKnV3BOE1ThTjpsZPc q7yDTRmONeA9v3D5YUgy+RcFCi0b7Lx4wcf51C/ublz/wjdO/tnt5yRN3CnBUPmLPcrb t+n7FIwAFUuA+8MTlfohgTRkhBekinSVPPL64Wzfh0TYCpbf2krg+vEP1aKZBxk9D3aH 7nWA== 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=4ifzCyDc/Iq2TIwUwjzFqoMcukuy6moC10jjJvogVZU=; b=L2RABgBFMikwR7luMRdNoMCHMC6ZyCe/MOsBgCpDqf/5wQGe3sfW9F/+8h79ffINvy Czr6Ru3yyYAKhUvxtQy0rXchAnTPO0gfJ7keuegjWcM5Yg/dXyXBsP+Pj8hZYAv3l5lF 2mpsD7c+J8EMajaulXEOFUttVwS2f7kMV2cQG2xbUe3FHW9IHkjOWt14u4saXBF31NnX 3UzuYl522OUxaY4ndnSE017uTYzZB6/DTlXcCCn/xResLjJM00c/QtKK/EJOPXeH8RsB LiOHENJYegQEanCCLR+DhVtVaggA5xnwRGK+7UT0FmYHWMSkkVaYMCGXoOyK827C6k9/ t4bw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=AY+vtnOK; 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 m13-20020aa7d34d000000b004accbc82a5fsi11887660edr.422.2023.02.19.05.57.16; Sun, 19 Feb 2023 05:57:39 -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=AY+vtnOK; 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 S229975AbjBSNzd (ORCPT + 99 others); Sun, 19 Feb 2023 08:55:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230166AbjBSNzJ (ORCPT ); Sun, 19 Feb 2023 08:55:09 -0500 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on2084.outbound.protection.outlook.com [40.107.14.84]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 383A7125B8; Sun, 19 Feb 2023 05:54:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aBLFXZJ4WGqMVH9/a5GGZezBr8aAh6zhjL+p+MndXQH6PQtalx3+qnGG68uF9xUJhzTbzgwgCGhmOgNQwctfFEpDE0TqzTREmRX5qzGybQKqTa7HtFXtP/yzVPvU+OgjLoZSLgSn0H2xlYOlHE4Md+n4K+8oXwNX2NANk/oT0msrGvuAbrlur1qpRUyiLtGHcVQuJieNsqgo7JG69BvHoUv1ZWJievo27wfoMBpO0b1MPXtPeQm7170bapNpA0kbxXyxD1Zp21tAGMca5S4ikez1TzLLA5P0NVK5z4CK5WLHMiyPTc0xkW5OCeOVpDWl4KR4Fx/oVqQjDtO20ylOzw== 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=4ifzCyDc/Iq2TIwUwjzFqoMcukuy6moC10jjJvogVZU=; b=W8z8E2mHT6v6gxw9PsSBfzBvOgG96LwIvJaXzz+3sbmQirGGiE8O5HzpzzqInsyr5OXy/7zqy4ayK5wLF7Q1jSaI3+lzz7ICJeE4zdn8S2xGRt37O7+QY6H5+Ucq3WRypy0Ei34fSVZAcFG2ZevjyziRDMtyCl+QbTAW90pgouiApx0mr2WrkSU4yqCkARqyxzAl0NnObIgZlQ//JsdhcxFVC8FPVYKd8PQXOfRG+t3RfxTYCZCqNylObelwomj+HqnUW6r6DOVXv1bIHczIknnYJKksi1vqiC2W09jgM6ash+0+iMm9L5ImUUxXJdUhckozsqLSPOO87EBS2TGVCQ== 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=4ifzCyDc/Iq2TIwUwjzFqoMcukuy6moC10jjJvogVZU=; b=AY+vtnOKDBaQ9DbSE+8ZivjuMrMU8d1SKb7x9dtSZRrUp7tBFzEV0EmnOxaTywtRXsWtpChgbikQkGj3qP/lwB+WZXguvJ6ZUsVkUptv2x7qBsaRiVj3g+qDJrmTIW2Lq64yMv3ZXlIpwalAYL0vPwogBOYw9TJC9xiIarQ4kZ4= 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 PAXPR04MB8238.eurprd04.prod.outlook.com (2603:10a6:102:1bc::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6111.17; Sun, 19 Feb 2023 13:53:57 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::3cfb:3ae7:1686:a68b]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::3cfb:3ae7:1686:a68b%7]) with mapi id 15.20.6111.018; Sun, 19 Feb 2023 13:53:57 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Jamal Hadi Salim , Cong Wang , Jiri Pirko , Vinicius Costa Gomes , Kurt Kanzenbach , Gerhard Engleder , Amritha Nambiar , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Andrew Lunn , Florian Fainelli , Ferenc Fejes , Xiaoliang Yang , Roger Quadros , Pranavi Somisetty , Harini Katakam , linux-kernel@vger.kernel.org, Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Wong Vee Khee , Michael Sit Wei Hong , Jacob Keller Subject: [PATCH v2 net-next 10/12] net/sched: taprio: allow per-TC user input of FP adminStatus Date: Sun, 19 Feb 2023 15:53:06 +0200 Message-Id: <20230219135309.594188-11-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230219135309.594188-1-vladimir.oltean@nxp.com> References: <20230219135309.594188-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: BE1P281CA0136.DEUP281.PROD.OUTLOOK.COM (2603:10a6:b10:7c::6) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5136:EE_|PAXPR04MB8238:EE_ X-MS-Office365-Filtering-Correlation-Id: 85f28dd7-f70a-45f8-1d5c-08db1280bec8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zYK9zyswMiHJSSCOyBFxr5tILiEVnHLw7Jtl7IaxoRw+rwOWH/VJ1LCAOp1K7Ic2GKIz1dwg0L1YXRD2BnO6/To8uiqiIEKp6lP34yuRx0bIJhrYca3C65hux/1PnZJExUv5Pj+q1wPSiqlCUEp9F65Hp+5SZtwoIrkVvQBfuX/4zQNpMvqGGkSP4IkUd1VknnoShNvdwpavno7b1OlzBOf00/oTho/AUjAg0mJJlf7TIbDa/9XUETw298CNxix1YFxvHDUg4cOavT9T5NRPWZPJg7jugLF3fhep6NpwigaqR0EX2O6yon2A8p2uzPSA48CPl0L5Cde5jy6ym7e+Vh99Oor5TLcV2iI24VMtSpDDYSa7/sdCNss5TMqnUtjJ8/KFBqzg/DP6Xl23DXUH4/RUtU77A2ndpg4cV+hFXbW1PtLeqU/SapiZ+405X2J+1aaH+2uQoOz/TfzbVA5yg2NwSTXUcco3ewZUFYR5SJbNbt0Rjiz8DtBYNPEG/6Dw7WrYF3aDwqnmVkJxGAhPgGyTJAsgsGI6oAhr8cAToHf5FkM0A+cax5vM+UvTCucTjKOH4cHvPWE4eOMV0Xcu9sbk2TaC8d6MNBUFlEmZxjepG0uTbArLAERqiEHxrIvuOYVUMTWbpNecNijXVmVQtf7GjOAz36/DhvhLLjL1M0KNZmiki2WvsjGsRbHIUMJwQM5pHTPho9OoGxY3yuxisQ== 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)(396003)(346002)(136003)(39860400002)(366004)(376002)(451199018)(8676002)(66556008)(66946007)(66476007)(5660300002)(7416002)(4326008)(8936002)(41300700001)(6916009)(44832011)(86362001)(38100700002)(38350700002)(6512007)(6666004)(6506007)(186003)(26005)(2616005)(83380400001)(52116002)(6486002)(478600001)(1076003)(36756003)(316002)(54906003)(2906002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: G+Qt9Z2rSOouPVgoINs7pIrPvKMn4Ttcf/48lzKEZOg1UUeP9RYKDNrVJi/KaOaApzaBVKbxkUpGkh8qqMHiokYn/5n++8BuEIqh2w1kOwWAEpsmq+IYtN9Y/dyPDN61guXgqjuDJLlmA3rwlq3OSjUPiTsvbPwsmG5RdobRmgbKxMenm7Xc9dujhnzcLQu4Focf8sbsPTO7SCwsAgsw0KMq6d5oP+yNhwNgdbd3QHxxEHWUZQ5FE9LGqpwKoPeWnnXMwtv/lV9BkzqF4UDBxsg79N3+FDTZ6YT2LoR5T+07CUorjywEnRwnzYg0OKPLh8dfmGegWLuR3fgCJZ/ZDbD5zV+Jcd/tqSKrKFXuemuAtmALaMjKFIpyAFKtBTA1JeXAMfqje6mYk2AkwdqdHtr30S2qoaAXuw0jFZ0qkai4o4l0DuocFKcaeJvM4UPOcuDcHqc7tOTabIXvQ6Sfm9OQjzGJf2Q+oQMXGh9Bt9v+Y0jrfmVkBFV2kHxFHClFnPWrDf6C3XqNcM7w3F7jiZiwXtQ9CPHBQHwkoJcRfIhLcs/KNEDQrCt9u7Fa6qfG/o8oO2AoWtW3fLBzY3ATOEqPCsTQjBThBqhDzZ2PFyE1zkvWbMUl4I8/z2FPSKUsTU8PmpetGFUTyfo45RCwr07veaUdtx75aD+OEcMdWbbSRI0gTInhdkP1R8QOsO+8PGSBHJ0LACOnazQgpaGw6cvVJnsBUSeUjX0+Hhea1kR1B/4LM48zAU2pQ9XO2KbY8/LsYEK9SbL4liy156uBtpkjYODdTfHdbXOk0CTkbelVhy9eBm18F9XLlB30e7eTa+limxtXL+eEaVBXZue55R+vqjfyi5QLEw4ysqQViypt3lMnFq+8hVy6NruEogb7M6MUzOmZc2o3QYHwUFTKmLPur3Lil0XNVrVlzq1OIRyN0A8hkWE9r2DLDe8ibveyobfxYeVYgjkj22kdEfne45By724B5FCPHmE0MRz0V6GRX69iWSfqEVk7QnwgfvQAz3uMPy2Sq0O9Y6vZldsXHF1V2MBJbYzyMWyLEohJnGlZ0TcMFGLJ2yWSmSSd4Ye2cjxlb7P3ZAfti+DSx7gfYprZ0ea+IVbsT8C5gSK/iq+EsuQ3FTdAh+8oONaH7umuh1aeUPk5KkkV+qmPfknNJKZ8DwvIsNazUBAg+HC/uPlNvr0664z66bhxup7mZhRdqtZbCDCUk5UDE1lPqHm3dY9D7ZRjI8tTJlYqlVLiZWqghlB18sRT+9i78wsrJWRSieWCRrr20IE0IC60PbgM7wvyuMfHG+GPKk9+VZ41PABr3gYQtKaz0nYfjD7NUCGNegG5Cy/fS+TNml35/JWatGP7w56fy3mykFJapI/5SKI2Q8vdVQmfqnBTQ6FT+9s7MXHBZdM6bXofmkCiOSiK8BYEmH8ZspAaCQflKRp7KMaHl1SJOuu5rUFhnngNfUofe1LzUgO5xSPoTBmb0Q/G1IqgyiIRqMPwuDnNoAabsw0saSSbe57uHqMtumtLBss/aUhJJTy5cyUXJCQ+U7WZjWuvQV4h8Uk2cJRh5FC08RhByjTiE4pg7v/Iy3APG6Wz2cKDlGnXmFseRjnIsq/Kmg== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 85f28dd7-f70a-45f8-1d5c-08db1280bec8 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Feb 2023 13:53:57.1612 (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: 3sjTRgJx8ooHCpwNvhz0UOzyw6KfoyD6HhNnDvAFDYrUGRNfdPFGUQtg5fZwrpezzsytWGAuPWSVfIu3zV2J5w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8238 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758268028133093095?= X-GMAIL-MSGID: =?utf-8?q?1758268028133093095?= 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. So within the tc-taprio UAPI space, one can distinguish between the 2 use cases by choosing whether to use the TC_TAPRIO_CMD_SET_AND_HOLD and TC_TAPRIO_CMD_SET_AND_RELEASE gate operations within the schedule, or just TC_TAPRIO_CMD_SET_GATES. 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 --- v1->v2: slightly reword commit message 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 Sun Feb 19 13:53:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 59157 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp866698wrn; Sun, 19 Feb 2023 06:17:54 -0800 (PST) X-Google-Smtp-Source: AK7set/YC24DEM+eAdZoQRvDJsIbVBNsys2mvddgC6ZGXx32nMvZj94Rh0fXbas066ueGjDMfc+f X-Received: by 2002:aa7:9ec3:0:b0:5a8:cb5f:94d1 with SMTP id r3-20020aa79ec3000000b005a8cb5f94d1mr785204pfq.16.1676816273759; Sun, 19 Feb 2023 06:17:53 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1676816273; cv=pass; d=google.com; s=arc-20160816; b=X8a35ayEH12HFiBrGiw8vX0oUR2k7B1l9Pv4JyTu/46Mj+RFsReo3cEW9HDwCEx6Kr w26vxkVVmzRa1TBM09PzFb8ANaPkPchc/BPFhHSJ83BoIrQdczFSBu5sVyliz9mYret/ NAmEZN4/cmkdGNVrymHrObLp3CNRi5BBxZHTPNsSm2SqfW/Ac5UAhHhnL3Jg2i8J6rwS vfb3bS84TXXpX6bdcUE0ph512JEUA6XSDNQ22OUQFPej4lHhidbn0A41X84xl+vQYHtY 7zeON3urALN8sFFO9SEtOxs5NYvdE5YKTWKtr6PPsHBmC/S0JMGvfNMHASEP5HPbS8io mQxg== 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=+QokfDUKT/Riqy8XY66MoD5yTl/4NzMa1ubloe2YxCI=; b=j5A+ct9xnNn7fECiUkqi80wqXWaD3mnxYBNM8qGG2NgzqtT/SuUw7IKIrIl9kN10mA NSHBcTIQZPxKVpjv3YsuJMKhX/as05vunshB8pcMgDFWNLCKLUAjOQrVY3abkyh7PuMs FoPc0VcnYwKJj9wGIart8TGUYBG1ewSeDZQhg/E/sX+5uPGk035TcyBuLanOtacvH6JA jGTLMMXmXQGMtyqi7jpt77qoy2VcY67QBC7L3MHuGiJSxrZrRToYwfvxzPNK5a2PKNXd yVx6kZw+bkYEUZZYj6FpSeMxo9bOPBHzBpWzD+YGaUHFMuMTwaZ4tWQ9/ych09gM4MNd 2Jlg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b="MpZRL/qG"; 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 z28-20020aa79f9c000000b0059cc9bfde63si11145008pfr.92.2023.02.19.06.17.40; Sun, 19 Feb 2023 06:17:53 -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="MpZRL/qG"; 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 S229925AbjBSN4h (ORCPT + 99 others); Sun, 19 Feb 2023 08:56:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229967AbjBSN4e (ORCPT ); Sun, 19 Feb 2023 08:56:34 -0500 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0605.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe1f::605]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA45612072; Sun, 19 Feb 2023 05:55:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GLLs+lBEzVx8X2p2Pe0slQT9HbigeL2dA+wke1N5H5u+DrZBKzcsjGTIhunxRvjy9xcYege4HK9V1OV+a7fp0M3T4fAibYHupVh0stB826RgbLGS7dKahEmexzLn9+LxkHuq54oEcOY/6ckLRaFmwRPC7TMjQIMEBFvAKWe7GPkKjx4vLLA745vAGt58QDv9eCTYWcyIS1jrjjyMQ5It2cWTMp7dvvdZ+G2hsaF0RYBaULloHpvyc4LHQzELzaiiBjYEtuitVpMjQT1phXRUk/4TnhEllEUzbeGB7W324nm5oLfYN8RKgOrZsSyBbTYuazSOwmlhCbWuHKKoQvQbvA== 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=+QokfDUKT/Riqy8XY66MoD5yTl/4NzMa1ubloe2YxCI=; b=EphQUbhZxMYI9A27Q2fznVkkOWzsv3s2GchO4xXEYqZNmZyUEWygkK/pfps61tiQGxECKgpQoLdGIXybOczknHtBsVxdfvJ7fnaMmBqWZ1MdUrpbxLFs0XY2Q2/cXx7FgFQFprgb8CrqzRPIK9D+2sVeb2uJWjWZwRqXHg5NtJTSa/ZetPJDkVmQLnk4vTckQ6d8wev8HHpm9TcXCVSO2JmmrCJYOedziojl81Vg3dpjsTxprmh4dvlGHF77nBhrD60OuRA2XC/HS0Lgc7ZdsBLZ4Ae2H4xzFxoxipdUUl1M1gs3DxBHmTxKVLij5kIiwrJBzyZmiAoNFlqajK1FKA== 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=+QokfDUKT/Riqy8XY66MoD5yTl/4NzMa1ubloe2YxCI=; b=MpZRL/qGXQcS0765yuzvQ2SRtYZdg184y3rspssGVMWVTslvlz8g1f/B3saRTJoa/nU45/JQZTtmO92CJPp5rIrJhK9NPLq6ANzwmXJsmjgIqMg8wOZLv1+kY4A62GoPsaE5/nlWMhGjTKYdU3BIbJ6Ey1p7cejf0cRs5ITWyis= 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 PAXPR04MB8238.eurprd04.prod.outlook.com (2603:10a6:102:1bc::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6111.17; Sun, 19 Feb 2023 13:53:59 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::3cfb:3ae7:1686:a68b]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::3cfb:3ae7:1686:a68b%7]) with mapi id 15.20.6111.018; Sun, 19 Feb 2023 13:53:59 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Jamal Hadi Salim , Cong Wang , Jiri Pirko , Vinicius Costa Gomes , Kurt Kanzenbach , Gerhard Engleder , Amritha Nambiar , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Andrew Lunn , Florian Fainelli , Ferenc Fejes , Xiaoliang Yang , Roger Quadros , Pranavi Somisetty , Harini Katakam , linux-kernel@vger.kernel.org, Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Wong Vee Khee , Michael Sit Wei Hong , Jacob Keller Subject: [PATCH v2 net-next 11/12] net: mscc: ocelot: add support for preemptible traffic classes Date: Sun, 19 Feb 2023 15:53:07 +0200 Message-Id: <20230219135309.594188-12-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230219135309.594188-1-vladimir.oltean@nxp.com> References: <20230219135309.594188-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: BE1P281CA0136.DEUP281.PROD.OUTLOOK.COM (2603:10a6:b10:7c::6) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5136:EE_|PAXPR04MB8238:EE_ X-MS-Office365-Filtering-Correlation-Id: bb5a327f-3f56-401c-5723-08db1280c00c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sJnoAQpSyKSS1fDGmhXZnajvpPnndwhRsKrBjdPy4oHV5PYrbTw2vmFezfAxXEEw/hxPERliSz0rQnMZ/TN8gSv2B6vG35LG439CQXMNhGO2yOzmm5Z3eL/JFjlNSdnbYJ86sxoEKU7tNoC2vQIteNj5dq2fuxN7JWSVQF/K418EzNusIIxLXc9LngTJ2O242kHe+gkT94IsFgnQqGqEEKUV37IeZbYPQ/SBeKBrhoGnwoJkm5M6IJi0uU2TqWWf3pPi1bDMNDOFumfOawm1Ykquithr0UTu7HAwJoQq5kSOfeBSbLPbI70lnzi5b10HB9hTfQycIsVDQGZBKJT/i6Z/gBWJsR8SN09RZRZiJmBC+O9y7GaW30D0KvF18GieFhNYZ/rNu5Hn7u42pAbIa2biKsx62JFM6se0DjPYg+xjsm55KegKtvMmjWhWD2604/j6UKknfY/z/Uzu0seMbaRIbb4ZKrq5saoqgoKYm3umiHG+DR8FCoqulAaoRKcODtpb1xfpeVH81CDXEivxxeAy+RbyPotAQ+DT7zSFqB/ZEWlZBw9q9s9S5asBtNMFuVIvZir3g86eparIRaw7dPft95PSJRrHgYSou2Exdd3c6tN+6L6UMP0mLFL5SmnRQ5SSFF0Q7CUNozjXxdLplWbxm4BGroeoXENuFQ7m1sSKRpWcKzyGCvPoq4r3d0Wmwk+YNg5jCelGJYN/Q3cQ3Q== 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)(396003)(346002)(136003)(39860400002)(366004)(376002)(451199018)(8676002)(66556008)(66946007)(66476007)(5660300002)(7416002)(4326008)(8936002)(41300700001)(6916009)(44832011)(86362001)(38100700002)(38350700002)(6512007)(6666004)(6506007)(186003)(26005)(2616005)(83380400001)(52116002)(6486002)(478600001)(1076003)(36756003)(316002)(54906003)(2906002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: gA/DRg6ml6gJiSMEMb5p+D/jDOCwptfzZIMivGnyaumAd7oW9LpSbskp2Riiy7kz7fW16Tab32ejqlqgumJbB+eQ5odTun8TK+sBAUvp5F/3a7ibZDJnyGeTlrKiud8pN3uboDWSfCdefcPQ5dqEWKKTjOKuM4cFb92MtZTXK9io/csEVPkuRnkMiYgEBuN3c0gsT6rVZzLYiM6/zQmuS6HRHg8u+8zaWNvyPHYb+TpJcDvFb6HuvYdspiIQ6yC4E4Mh+Ih5XrQsF+flWm2UW9dU3iErkJqmIqN+nN/jv/HmXvr5PquGBJUfcybc79GlJbAZKTNFPCxbqUaAx6zXLGf+3bO5aKHgNgUGWrYlBU4SGTO/D+uLES3LIf/ZTd813wkNYlhUKU4mntJ9BygzAB+wheLSm60wq7nFi8E0i6rQs1xdGSFJCFiibWH3l898cGVnw7bxc51c0AR0OMSif00YnRDih0DHePc28P2nNI1g52a4xNt6YsxC4l7XQVUY5f1h24P7ivm3fec8YUkA53IyO3tYMY+v0ugkbppAJx+/1ZAD4K/uloNUkTHdt8wiOyct0SiOjZao+RYFbVULd5emreSbzxdgIisjv2Lvyq1AYEbs3MMp6RzfXUzOWDHW63JARikLfqhC/t74cnkpQMnVZWZfwlZQeOecWxQ8ZeGjcnROCeZoMzosPV+J3h2Pn5kol1+472QCj69us6jSeRuXIz6OC8wYOwlqExoUqFNtIPwsOgglXj4atHkOw6IX9IpwfQxuWs9GGrpCYloemUHKk3mRAqS6NlLnRxNzzvLU/1tA/TVP3zwZ4bi2qhjrCaknIHVRHHFo17tn6inCq9NdY90xdnvRvfRcynDcEWVPemIUYYk+0ygQjdRiEJKQ+Mqh5+c0+hUotTkF7nsNH0wvGoKngx6ow+iTG2dbuj2qSpXlfR2D05ySvXav+ucVVBsUiz1WEhYJN+oa2UDsaC5G4aMIeEyv+tzHTWUJVB4iOzZAO7w9ZLXKdpf2LP59QaNj3w2F4xXC3gzLF2sgA/36cbQoIVmARulMvZDWJaUjbBHzWrLdMSAD2x3YuNdCqPR37nVGGgz7gt+99g73lDMOtrwKMmYVd0moSv561Np2KlQFyYgZJgRjVknrP/tqIQboojlArzF0F0l80LU2emoalxDY00Ex3r+IavDVzjjAFCouGW+hKB92/t/jq0SkeS6f7HqAPRU6cPfRMq0UqSqKoM5Pd+HHxvbsftxNZWFr8jhE7+4Bi4weyG0nxmtFyTJ65YJcV/Zrkm9J9KzcM8FxQFgUCuhZoWG1IEfKbNoqkYoqO/rkPMeH1T8nED1sU0Ewkk1Cc9R9gsO6wRnMyC4kkm9qvc2zV8TruPvmkUukb9oTVAIGbj3GI31PaRSm3GJuhIScJQah8YEu5PDWSyHZwXbi0geVPX92IdZDE34qNo7R6sDTe8Ug0hwo7Aq8reJ0sTjeFQQLAJ83lnmnMdVDUEWFngsN3y5YcgiJq4hizyBGiICLK1NWW9ql+f0OzwL0xYQGvEf4HO86RsLILsE92aIQHqfD+upanXRn/uD3rXAFp0nREUn+yD6q8u40WU+OQs6VQtAGqu32QbYm2Q== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: bb5a327f-3f56-401c-5723-08db1280c00c X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Feb 2023 13:53:59.2236 (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: VbUCXQKa+OoV+ERtagPAYIA8J/Iq2wWKFx8UPcpfT/LMBwih0qhNm+Td1a5kJPHjYMLfd3OnpGM1QR11+do/PQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8238 X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO,SPF_HELO_PASS, T_SPF_PERMERROR autolearn=no 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?1758269300860961857?= X-GMAIL-MSGID: =?utf-8?q?1758269300860961857?= 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 --- v1->v2: none 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 Sun Feb 19 13:53:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 59158 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp867692wrn; Sun, 19 Feb 2023 06:20:34 -0800 (PST) X-Google-Smtp-Source: AK7set8X4pw+DE8Kj6qGVp79tzmpWiwJPoXn6CiX9p+a25bo0jnLi+Zn5w2qQ1p+Z5vfpif02bRm X-Received: by 2002:a05:6a20:b290:b0:bc:d05e:c667 with SMTP id ei16-20020a056a20b29000b000bcd05ec667mr6862426pzb.29.1676816433838; Sun, 19 Feb 2023 06:20:33 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1676816433; cv=pass; d=google.com; s=arc-20160816; b=iEgEd5Q2t/NkejI+aXMMiFzVF8YPpkjG+goJOIYbP0rbUGz83IMvrGmpfVSzSusjH7 zv6jkLNohUC5XstHVkzL98hWRRHnQBgzAVuj/B1U++hqC/qs75P8NwXlFyegjJjP2H2s MZ8JFtUb+3TLoy8p1ORzBXRuP3KA41+RjaDzZVBkM67yIMA+8Tijl/zEsyvk4BEwAcBp t6C53KpwaFlSw2RHg6goyJLR5kDAMgN8DYRZZCHSd/coJkTuPJ3D0DS/WD/xSJkReRxx 8o+wdEmzdM6wiGbYqnIH03TzRGldZDuwZmEKToGs7eedUSJqnDKOO26HsUZJEOniD7Lg V6VQ== 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=knxDSXXbyoJv/0vvC/G3NE1Qp+zteBCa6Ip6NcPFFV4=; b=h+L8YzROwKM9OI6SPzDErm58VMka/IXCFFQEnbNIexQUhn47EfTqdiULHMEMRTLQdJ e1OeDrPqD8qExrzmUi1CaC8M5Yut1OX1BCI5EhhGf9noC+jfokwXJeNfqE5fBqs2NtJ1 dUZ4kdL74QuFrk+NqKxPj/WzWyhudiH3CQKCIUeXKNetmFdn6eVuUw9356BubXZ/nfBH nuW4plkZDi//EbYdunhaHUSGfqSVWU6F1Y2r+B0VrdRtmidbsXNEeZASZFe5oPvjFPbv 90HNev0IcYDPHlCG2hajMEe+B3URvknUokKajK09g7COaXURAj+MyqZU2mNGYGkxUOGd 83+g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=CLxkB7wP; 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 i13-20020a63584d000000b004fbba63b116si10127632pgm.548.2023.02.19.06.20.20; Sun, 19 Feb 2023 06:20:33 -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=CLxkB7wP; 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 S230038AbjBSNzv (ORCPT + 99 others); Sun, 19 Feb 2023 08:55:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230062AbjBSNzj (ORCPT ); Sun, 19 Feb 2023 08:55:39 -0500 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on2084.outbound.protection.outlook.com [40.107.14.84]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B16EE1166D; Sun, 19 Feb 2023 05:55:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gBm2wW3xx1ID90E3XAlggZIJRSy/U6F+Ooo7gbmTlkslWkujEfN9FRQKYYqd3lvKc3f0VoCWwLttKgXTyHaviRYorE6kGzkhrq8spzJEtTiGM79lxXDs6R4tPacVx2/PvdbqJEmD3S8hMjcDKCcUcB0tkz8wiCtu9g+yPUuuJpbw+cW2Edrc+YUlxZy3aDHViWUcBGgESeNyN0nlyqqnPi+h1z3nXubt6XxOEPHx+vwkqCL4WRIUeV8HZTXd1u0m3iQMwPMV48rYUDdEd6kan+m8Mx1+FiXVP/4rkjA63gOv4lccemCu0V/GqVv5zErzHFzbhv6mj2L3QS7fTbMlHA== 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=knxDSXXbyoJv/0vvC/G3NE1Qp+zteBCa6Ip6NcPFFV4=; b=UIxXQ2R8uyZsz6xRzZADNHZO8U/hLZ3rQvWVDe0++uZBnoUAyW2uztLIJHnYxlZoDZvRF8hcMo8+Mrmu4CiXNn+8XOtXarCep9K5CLblxIzhSAf2HPKp+Vog47m03TKFD5KGY53OS0fS4mGcI98m6ShXvzuMmGZaPZmK2d8rgkmmAhlyIPeAUJQCJAWpm5UbcWgF0cP8pnTM+SVBfFlWJ35ay3k/cmf8TQCbLsMXpRW/IyM5pItLzsnpO2cv5qXcoxcJ7qCKQbrF1SZqc4D6/iGkMqAYkeEr6sYKeqw/D3KScgqeXTNwTDYXJeGVJywixjSrzW7Gu1O1YxjIqgvLSA== 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=knxDSXXbyoJv/0vvC/G3NE1Qp+zteBCa6Ip6NcPFFV4=; b=CLxkB7wP3phZEw9UM9X9dZzJ5gUtv2ZfYj8GFGR8KrtG0+MD0kTIjtFQ1o7Dr0zpqYoUgPr2coTdLs/CkgNT48HMirkg8bTBdfw9Bk7iNlPa7GxOC6Knhcak2zwsnGuHVMjzeV1wGV1T7vjxxRHlkld7n+oNsjI/zCluOXm7Xb4= 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 PAXPR04MB8238.eurprd04.prod.outlook.com (2603:10a6:102:1bc::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6111.17; Sun, 19 Feb 2023 13:54:01 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::3cfb:3ae7:1686:a68b]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::3cfb:3ae7:1686:a68b%7]) with mapi id 15.20.6111.018; Sun, 19 Feb 2023 13:54:01 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Jamal Hadi Salim , Cong Wang , Jiri Pirko , Vinicius Costa Gomes , Kurt Kanzenbach , Gerhard Engleder , Amritha Nambiar , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Andrew Lunn , Florian Fainelli , Ferenc Fejes , Xiaoliang Yang , Roger Quadros , Pranavi Somisetty , Harini Katakam , linux-kernel@vger.kernel.org, Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Wong Vee Khee , Michael Sit Wei Hong , Jacob Keller Subject: [PATCH v2 net-next 12/12] net: enetc: add support for preemptible traffic classes Date: Sun, 19 Feb 2023 15:53:08 +0200 Message-Id: <20230219135309.594188-13-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230219135309.594188-1-vladimir.oltean@nxp.com> References: <20230219135309.594188-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: BE1P281CA0136.DEUP281.PROD.OUTLOOK.COM (2603:10a6:b10:7c::6) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5136:EE_|PAXPR04MB8238:EE_ X-MS-Office365-Filtering-Correlation-Id: 3bdeaec7-ecf3-4bde-f55e-08db1280c133 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MPOjGp52WVf/DGonI2X/5thaJUOAfRqslqL5c+qcCqYpPLsfwiNG6jcDcJsLKS1P3Xaa/w9YWX/01bnME6+YelaGUWCAomjTauUi+hwrEGjjWTuGqJuGL547jTMyORZy7Npc0yjrsy8wP0HWEa8FSzEEc+yHwSDvJEXml3WVy7AQbaRWDnyW9MZt/FYtO7e7dCSIIoDLv/kQkpBrCNG/VXSjRc+fKV8vfUwk3bwNcVC59hXAeZXlOsfwISFz468ijNulabSGkMmTZtYw3FxpOiniKFA/b2Lwx3A7b0obglU3CYY37Kf7mKXMfn7UiSGWvrbKUSk+RX+oVa5tSEPwQTfk6U2kLyhykUYgmHwDkz//jlBnoxb+1BKpDUmsTOlMT+ip7e9M2NDU4kSalf4YdTAkcDHKg1vF7MfK1olwfITRb8VGTz02oLwqCkOu9TsEOA8VXukfxCcNtdLD9zjXC0vp1mJJQ++oAMVumc3TEYZFBZBOPx9+20Wdvhl2Uo/Og2YOYHS+qNy/lh+XszmR5ufQSOxrFJIj3d+W1lvcpH4MVGgjA/ZMQ6FWs2SQEjZuWk17gOyzjfDFgovjNF/a4CZnrPqKYSxHz2pjYmnjp9N9OpOuzrIAqV5gUXR8rdzOgD85kAo0zQxBmbIe2dG88B3pbeP72awv7q6xQo7CcXED2177xyYFpeA18AxbgwR1od++R6MPpCu1AsLA36PT7w== 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)(396003)(346002)(136003)(39860400002)(366004)(376002)(451199018)(8676002)(66556008)(66946007)(66476007)(5660300002)(7416002)(4326008)(8936002)(41300700001)(6916009)(44832011)(86362001)(38100700002)(38350700002)(6512007)(6506007)(186003)(26005)(2616005)(83380400001)(52116002)(6486002)(478600001)(1076003)(36756003)(316002)(54906003)(2906002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: aACVf/2hmLj/M/8n2HsK5z2xn0puVLrAkuYclXIwTKl32vAEGTffOtoh8jbfIJEPDfbu7xYJzh8hR67cJCsRy4a3wU9skfDmHDoTfgzc0vkY395GDJyWRj3xNHLI1lxy18h8Qi0o9FcIptpbrTmnkltCSw04ruJg6crP4OJeVKsxPq6xDQo8MT0RnEKc4x1DO4yAl/EyAgxZPVjsbmltmUjj9rdjGpYtb32qoc14HVXtl6VmJyLmC4iYCbpNBgJwrKLQwek7oYzzHUzxHQ9IGUdz81OQ/eowv/pzkwzoojrmsagV3mLAGQoHDKRdloeggIjx4/6SyvGAihH9pl+a5giIiHA1Rz9uQg7pb++htpPvP5cDiL/ttAinclRrJ17eF0b3qZIzt8yRHZmlrXFwhgXUAwqls+C+Mq0IXWXb6/I8XtDg5R8MHBvJ8941Ey9H6iiDlRSil07SZ0jchqbo9YL+XJ06nfND65lhTE3hYopFfOQ6bwo8jVCZPf4fHlO72JoQR+D7ChuhXeLUhXV7QWkF4Bs7H+Oe0G64RPx8cFyjPUTLdyQO1DpSsmpLKAHY+sb7tb7wQlQAHS7cta+uandRVeP/ueMIwOoH0t5H0kAEhpav9TDFuuL7XFy7DvxBTrICZy3vhWLsrQLhgDw8PDIoDiYtXaFrJKmq5Q2xB8L/BmjZjSoWqowagjcr3t2eDcWYpIug8oWNwUypL+J26+HDdhmayUkN4SlSG7JvL4Az+KO2AM390WCOMo/oMJcwVs8cclv4G9tZaYdm72f3ajV1BcDWQbDvmkrL0I/6CDb/bLB+GvgnKhLR/2Crjy4dCxsGyNI+KTnkqubrdmak8J2kYh4opKuL/SjRkcv3Y3NdiGm/YJi8q5FpMcmz02XvCozrUmper1Jbcv5Js8ulO5VbJHlLXI37wt8wyGP8ef+NMIiHg+FrIKzuP1bGcYnPTDpE5jXg3rx7fpJ1WoYZEJvsZcP3rsQe9t9Nwu7vnGa6IKLqT3MRu/PE4bO4+vAXr6rHWHAWnXp3qBR45ekcfj6fKQ1J2NBk16JNm44XQ0fI8OiDfRKvD5B31N+YJvH+NbFqW+C0lV3Ss35CD8WhkZfKzWJd7JZ79sXFlQ6fQ6heiIRybDyy9SNKsa+OMM7v9g3RfY5zE92reu2c6vAiXs3JQmmmf80PLI4EeetFvXKkp0MvsCLbO+0T4qVnTjILQ/lHtKvI8McPnpPMm1Rp855oBc77aaOOhvCru17nw7DwLSji2VV6GdWyFG3ytIO+WNBhMIXvxzzbOm5Vnuy1HZzMKNSgy/lJV16W7kBVBTrSa7aAbPRW8madnqMkZ91FdOZO2q6PeflQfApDmg7KXAhN93onAUetP42dQTzFgGVc8nKQXBrP9M+Mp8Y9NPV5p/RiIoaAR6N8cqLQN14wi0vn/Wgi7jkO1ygESts3nOJnpo+4vU4mNjEGYD4OlBkl3YIzG6l6sYCcNTp3RiYX7YoqgFZhnROImNZ5CEQ0Aie7LJ9AOSCN8Cbq9Xa2KvAUUyzJKnbtmw+sJedD1Sc0FL+n6bFPTSG8UZ51YQh0SyUqMLL0cqkgWFJqs5mxsQTYvRnSYCNYsvw0wT7eMEzQiA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3bdeaec7-ecf3-4bde-f55e-08db1280c133 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Feb 2023 13:54:01.2547 (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: YARr60V9KyXNVRFZjsLzsYPNNrXdp4SP+wy6P2EUcmItrV+6sVrCf4fvXXZKID1KZxyWUk6w2KDD34s/2VT44g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8238 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758269468999913290?= X-GMAIL-MSGID: =?utf-8?q?1758269468999913290?= 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 --- v1->v2: none 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)