Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp311761rwb; Wed, 28 Sep 2022 03:07:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM71diQXK/VVjLBzv0Q5mJpPqUp8SaKrc/PH0gRjpbIrAkBNyxs7Pro7BRj1z/ovHPqrEhFi X-Received: by 2002:a05:6a00:4517:b0:557:ba71:e53b with SMTP id cw23-20020a056a00451700b00557ba71e53bmr21915437pfb.6.1664359626765; Wed, 28 Sep 2022 03:07:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1664359626; cv=pass; d=google.com; s=arc-20160816; b=KElPEBX1J8KyTlANXTJH1eqjeQxc7WkJJTcf5IsUMKkTLBD8EiIVpjFiTZrhXTv5pG bbGVLeJsB1CVeOJ8JkEmCW8K4LfyUwMAhIFDXWmxWvaaPpYkIhM66e7Gj0BQoIX0HMwh rpCGAVSied3lJQ+ds7Fh3hOLK/WMddE2CnWTAt92cTH6VWY5BRfQaiRxAybL+yq423Hb JPgn5E5bGRW8dAT2KrDF+LH0yPqRO8Qhxp7yQmLcbEb+gYYtl2piFpvElSoLQTEcjez7 jIftOGH0/nPyi5rAF0G1yJxZl+GcJeQlJNL/+Atr1EyZ7pHE5x5z/JlxEQqJFoDi0AkC D0eA== 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=3+CTWgfk5gVOajkWlBPC/DR+CcBeZgQ3OCvOzER7mSc=; b=nHC9Ah1iBkx6fPI1V1ZBZfnvga3yhZnj3p0kYPIFBW6IxFmHw9cuh+DXN5nE7jXwK/ GEgBpBMHMWR4qAp45r/Wj/NKFgRd0dH/7ShexMrmmUN59S1r8Chmjztyeh7656UF/yzx /Yq8E85awqu2M/23/9ria6CeWk6ni/YKR0u4jr7Jald3TD3vxKn+ISoB5rqINM/gayhx FYvNtQdhQfYd985FBgGpJSmDTG9itfstcFuITbDdJG8IU93wt/pMz76hnq7kPHugyk7E DmgFnKJyAq40r7Wg+nbOIkQp7krnTolEMiSTtWE2Ftqc2PHpDEJdQv5xPBE5u5bATE9Y 8Blw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=FV2cDigQ; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bk13-20020a056a02028d00b00438b79bcf26si5696982pgb.151.2022.09.28.03.06.55; Wed, 28 Sep 2022 03:07:06 -0700 (PDT) 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=FV2cDigQ; 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 S233576AbiI1JxU (ORCPT + 99 others); Wed, 28 Sep 2022 05:53:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233459AbiI1Jwx (ORCPT ); Wed, 28 Sep 2022 05:52:53 -0400 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70088.outbound.protection.outlook.com [40.107.7.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A5EFAABF3D; Wed, 28 Sep 2022 02:52:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Xxde/gp+l7FjhCFPXeD+EkEFkVUjFgahU4miSkUP8s6Wuk5/wNeIor3JrV0PEBxp+RP/4hRpnVATYLrJYx4+PTZpnNYAf+W3kMP4ZOKzdqii/oqG6RmwNIiYdX4GCE5zWaw+TIwISvC8kSQI2QfLMHA3r09HKyr2C35j3sMWqqA37jCgpBpMKVZo8HZ3W0aNLQN/c2CuSsshLbbh9ig5ohVxYOox62IIvSGX1S6Bjl7r2gEUxk7ziLgtvdiELBSPkkFVm5oEZoRGq/ZjLhzXgcAuC+yBOkPcTAzSTLxvudGL/3kuW+1gb7xy6MrBo6rRaWmlz+VMAYUY9RgsOAVKIw== 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=3+CTWgfk5gVOajkWlBPC/DR+CcBeZgQ3OCvOzER7mSc=; b=M0AjPyKSFngEKCXb3TEVw+aMQXmjm5aXKhew8820+YwEZY0pahQKpg3jEo09oWY1hRXyshnslm/Yo+oosYeNaGgEn0GFdqpbr5taC2JWbKtcbCgwDt1aPw7PbcfiU0Mu6QcoeNIf9zD4SC3vE2fK6ni32w5zme5ibUV1IqbY0TzhEdbTJmzDFo2AGbfvjC6s8F87k8INMw3fCJjUvXH2zdgQ3VZ7ghxRlfuvra5SoCfC4IesneqNgVPbCelyvLVXXAMTe6P50jvqCHHjxlLXVHx/5o8P7Fn6bhBEmicEuDsPGLNBL6XNWimUWH88C6S+L4VTQYRBud7FnA6nFol0Yw== 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=3+CTWgfk5gVOajkWlBPC/DR+CcBeZgQ3OCvOzER7mSc=; b=FV2cDigQHkkhfnWj39UUvmV5McyRhRnPTxiO7g7mQOmCDteNnIIzGC8GtgPkx2/HFQD9AmorvBMUl011P13UgR70N5p0NRo7ZE9Y1b9AF+l2AMjnLDfYwxMKLoLHm8DcbaqLYdtuEP3F8y38BjoPdH9HEo019MO7vjQDLx1hLdI= 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 AS8PR04MB7752.eurprd04.prod.outlook.com (2603:10a6:20b:288::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.15; Wed, 28 Sep 2022 09:52:24 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::a67a:849c:aeff:cad1]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::a67a:849c:aeff:cad1%7]) with mapi id 15.20.5654.025; Wed, 28 Sep 2022 09:52:24 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Xiaoliang Yang , Rui Sousa , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Horatiu Vultur , Andrew Lunn , Vivien Didelot , Florian Fainelli , Michael Walle , Vinicius Costa Gomes , Maxim Kochetkov , Colin Foster , Richie Pearn , Kurt Kanzenbach , Vladimir Oltean , Jamal Hadi Salim , Cong Wang , Jiri Pirko , linux-kernel@vger.kernel.org Subject: [PATCH v4 net-next 4/8] net: dsa: hellcreek: refactor hellcreek_port_setup_tc() to use switch/case Date: Wed, 28 Sep 2022 12:52:00 +0300 Message-Id: <20220928095204.2093716-5-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220928095204.2093716-1-vladimir.oltean@nxp.com> References: <20220928095204.2093716-1-vladimir.oltean@nxp.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: VI1PR0501CA0006.eurprd05.prod.outlook.com (2603:10a6:800:92::16) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5136:EE_|AS8PR04MB7752:EE_ X-MS-Office365-Filtering-Correlation-Id: 95354c07-7ef1-4e8f-e89e-08daa1372502 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: IQBlgrfMQ8ZZRAckJLk6zsJfg+O1cW9Yzj5vN/yf81D0QusYX7QFf+oNaqAkFzDnAGUgw4sxLdzSi52g4HRqZzejQB6EeCOrMK/MObyXonsL6yVWoZEx6DkInl6VShmMohnR/HFRa5GoiEVSqawcQwNfbW+r7c7BPmzh3q8IPjSI8HkvpO2dXBaZJc3uhcuQUQDDw/16lyVq/9ayd2ZPEHVGPQAdpmmNmDoEdXoezlALlcATTDF+oG0xpuQMIuvPoPfPFW+Hr4qTy4RvEMuIsBimQdeejNnceVTUBNXuHtNc4h6c+ddjZKICGnm81va2bQmsjA8ZKG7gU768Nmva/79pNY8N1pBrqwWE2mf/gA0PjQroDuMwFWv5kvqQ8T/hspa0F8UT9B2REnn3qmNEZd1Df8iNdVjSh5hc3GVXgN8f3vsov9W6xfmNl6F8gGep0zJqh9jNgobVxlFEdCtkw3gHpcwj+YkembOmujE6fubHlLZvw8mQwbtbGaEuJ7Re033h5kRSYcXyxjGTMcy0iu1kiisHTagrqLBVBun0b6vVy6rslXYMn3FR+TUvC+VmFeWayVKcAJH/MUKMKPl1ZHwPp87OUXRjar25nhKCAv73FQt55J76eAU02ylchLiQuKaUJFjo0mwvplBmDzyMNqA9qlZgmM8tIBc2O1Ee2DkxyVlPiHcHZ/fz50WeV6BSzt2vLZ+yt4SF6nadhDYg5WcfbnmZkQJdSiSyhMQN2lYQ4AY5xU6ozIySqD8Tg4NaUjwSYE3G7YUZK+8wENWEtw== 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:(13230022)(4636009)(376002)(136003)(346002)(366004)(396003)(39860400002)(451199015)(38350700002)(38100700002)(5660300002)(6506007)(52116002)(6666004)(6512007)(8936002)(7416002)(2906002)(41300700001)(44832011)(36756003)(6486002)(478600001)(86362001)(54906003)(6916009)(26005)(4326008)(83380400001)(1076003)(186003)(8676002)(66476007)(66946007)(66556008)(2616005)(316002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?S0Tg/W/R3Wyqrm3Pn/HQJEv4zYXKuiqBU1zaeZbmiDr5UwD4q+dBKqIc5fZA?= =?us-ascii?Q?7k8dfVUN2P4Kv2mky0EwQ6pDjjqNWG8Fd1sRj35lWRCeVBw1BV5NybH0Ep/T?= =?us-ascii?Q?YaklM9G32nS7Rir7EkfbVd5TPesbncYVfiRalt5NmHZptWlXpUsD2jMQujk5?= =?us-ascii?Q?GcMWhb+LMHJhCvgkM+qBufQ05U4bd4PDDKGfP2C6tPZw8nCdgoXNcxDf/5mm?= =?us-ascii?Q?EgWmotCJd0ELY8d67XUIZkW3nwm/V1W2MwraAy1iRTZTcNQJG4mekLwTLkT2?= =?us-ascii?Q?stHjrDmvnlFTDkmQQ3drYeaq1i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ascii?Q?eRtQgGrqMtyxIgYkzNq5U3k5Z9pO3mlm5euBJnc7EmMLinL24fiz3Sw1JoSs?= =?us-ascii?Q?/N80tOTqbWfwp5zLVl7GIgktHRf5qG0rIwzJgVNBPeL4AU0P5SW+5V4sYHTC?= =?us-ascii?Q?wFJuSu3rFs6oiOnsQ6M80H7ILlaxeF1zn1E2WdyueaVHhN6TVmiPaRueLBlD?= =?us-ascii?Q?jvvuC8q95NBq/Kk5TG1PK0kRYEROgMpnCx84ONnVLSsD1KgWMkTqCghiqnoQ?= =?us-ascii?Q?9gc3J1zEdHZeQeB2eH9EK7XlwbRPuyZSSL+ZF/+lB3mY3DK0C3nPd5a5rQjL?= =?us-ascii?Q?LNJABLDmBMgeXdJud5RbhBRZ/zHZ92JIF6/hSoTqKrelsdy+Kd0aHLl7GWbb?= =?us-ascii?Q?QyqQUy3Yn1Tdo6lD2TJkqVgVDuIS7ZMz3ELENY5pynO1ZzEXIeW/8JQ/LkRu?= =?us-ascii?Q?fg=3D=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 95354c07-7ef1-4e8f-e89e-08daa1372502 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Sep 2022 09:52:24.4598 (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: B/uBlX/LmJFg6g70uBzqXDEOOmXYLp1wbB9M3A7jVplEzlEtIeez9BvPZUUWYXTAx+6Iv9KL9c/SWv7TS0DLVw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB7752 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 The following patch will need to make this function also respond to TC_QUERY_BASE, so make the processing more structured around the tc_setup_type. Signed-off-by: Vladimir Oltean --- v2->v3: - patch is new v3->v4: - fix broken patch splitting (hellcreek_tc_query_caps should not have been introduced here) drivers/net/dsa/hirschmann/hellcreek.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/drivers/net/dsa/hirschmann/hellcreek.c b/drivers/net/dsa/hirschmann/hellcreek.c index eac6ace7c5f9..19e61d4112b3 100644 --- a/drivers/net/dsa/hirschmann/hellcreek.c +++ b/drivers/net/dsa/hirschmann/hellcreek.c @@ -1812,19 +1812,23 @@ static bool hellcreek_validate_schedule(struct hellcreek *hellcreek, static int hellcreek_port_setup_tc(struct dsa_switch *ds, int port, enum tc_setup_type type, void *type_data) { - struct tc_taprio_qopt_offload *taprio = type_data; struct hellcreek *hellcreek = ds->priv; - if (type != TC_SETUP_QDISC_TAPRIO) - return -EOPNOTSUPP; + switch (type) { + case TC_SETUP_QDISC_TAPRIO: { + struct tc_taprio_qopt_offload *taprio = type_data; - if (!hellcreek_validate_schedule(hellcreek, taprio)) - return -EOPNOTSUPP; + if (!hellcreek_validate_schedule(hellcreek, taprio)) + return -EOPNOTSUPP; - if (taprio->enable) - return hellcreek_port_set_schedule(ds, port, taprio); + if (taprio->enable) + return hellcreek_port_set_schedule(ds, port, taprio); - return hellcreek_port_del_schedule(ds, port); + return hellcreek_port_del_schedule(ds, port); + } + default: + return -EOPNOTSUPP; + } } static const struct dsa_switch_ops hellcreek_ds_ops = { -- 2.34.1