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/22IeRsgojDMrF43mVJOuN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U7Fj7A5JW3ydxXlDdEkLbUF5jkPtVDsKpVKCH2JoajvrtslnzcEUHg8j1aV5aPjaSJ49jF1CgS3VKGpQnSs4VVOUc6YstKnYql9AElCOnHrVvxpfquVTqehQPPPuMeI8/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;