From patchwork Tue Nov 15 01:18:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13043052 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4BD78C433FE for ; Tue, 15 Nov 2022 01:19:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232020AbiKOBTD (ORCPT ); Mon, 14 Nov 2022 20:19:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230109AbiKOBTB (ORCPT ); Mon, 14 Nov 2022 20:19:01 -0500 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70075.outbound.protection.outlook.com [40.107.7.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D514013DCC for ; Mon, 14 Nov 2022 17:19:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cuk0D0IdLUqxzMTlMeXCXKjHyT/nU+qo0X6DBU6ZQOnbDoR2d3ae39/lN3dc6IlGV729Pyr3yKFg//3exTSyfYLuFGlQHRcPJR22ATf44TUJOv5GYRFb6SKpHRpUrwUj/sSC/0pRhITIONeLlIwod8C6g2DACINpskoZk9Rw4yedayyeM7oK5Orkm3BG3sicSBhn8AcqNkPMiQ9opegpOppGdj+JdfMiMpWnSwi42UGAfTb5/x4GOEjKUCNWCZYsLBm5Gu1N/n5b7U+YTitXWYnWhB30Tjrai5IePiKw+jF3JGwDaqVVE108PFlCoF28bJ6GFk/yBLLUflDNjMlIFg== 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=B2Dekc/3v0V8Nyk9hNVzraoLLvZmRD3gbNJsuDM4Ey0=; b=nUEXBlkz9r+ml6nePV0fxPmvnJnPM/xd6KzxdvqAyEGBKEaw00IXvl+ykSnOHDjkFzcoWN99FL9hGkKTRorNqlHUhKX3QYW0mTnb7dk+59l2Z4/wYHzLeUPzL2Caxwzy0w3iNuH8NyUNfGnSWeN6i7ZZLdwTmRShq/LM0vEvF2ftXx37N5ei9k2M/x/dCMxoZqxxKweLRDtbUmTb6a4tBihULdirJ9uCId4g5TinYDj02/9lZJjedbRfk39YKYcVG6WxUt6GoGjWKnoPxvUHflROyLptaA2hBdR5DvBiBSviS/oAIAeRWNOGtzlAzQKFSzdm66HgSPpC4rUjsco9TA== 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=B2Dekc/3v0V8Nyk9hNVzraoLLvZmRD3gbNJsuDM4Ey0=; b=X6eglESnP4YCRNDEv6p3NUodLCcRaIlArBJKSDwCXxkIBFsmNa+Nob5GEmc71+VOhJTa5jv/mAdphjAsLPHpooSop96WZf3TEsA+8jIcH9uX943Xn+ouveM9VyKkW+qCFe6QS/tQ7Lw9OiJ5EJZx6I8W6xljiY5SFv5oFeys7y4= 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 AS8PR04MB7815.eurprd04.prod.outlook.com (2603:10a6:20b:28a::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5813.16; Tue, 15 Nov 2022 01:18:58 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::9317:77dc:9be2:63b]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::9317:77dc:9be2:63b%7]) with mapi id 15.20.5813.018; Tue, 15 Nov 2022 01:18:58 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Michael Walle , Heiko Thiery Subject: [PATCH v2 net-next 1/6] net: dsa: stop exposing tag proto module helpers to the world Date: Tue, 15 Nov 2022 03:18:42 +0200 Message-Id: <20221115011847.2843127-2-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221115011847.2843127-1-vladimir.oltean@nxp.com> References: <20221115011847.2843127-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AS4P191CA0006.EURP191.PROD.OUTLOOK.COM (2603:10a6:20b:5d5::17) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5136:EE_|AS8PR04MB7815:EE_ X-MS-Office365-Filtering-Correlation-Id: fcd33b4f-3a84-4fc7-4d2c-08dac6a75ee1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ii9rz0JK22H0jFRASuc4F0xF2CDRWERh4MCN53rWxsCwp8FAICbad1O4ddktjJo/fZMUksCK+0shGizDYloSpKXQ+mLy4mOTQjspHCXrhgHGJIvPdKfjFUUlKKTxqWhZFc7YIlyPN2QWpe+0PFX7+0GNK00kuEQQN2MtFjTC5TWrFuDbsazaKIBUsSu79LsVoMPJhrwSwXBcgbmG6MoT4G7yth8iigwZQsUvfvAYFHehqB9pDPROPARm7LdKfmRTsCXYD3DneVzBn9Htu6PMl1taBCpx44hdDkld+p3SFZekiiSdQrbud1wObHiGzN3SIplmupFq0nSnMyRJHkIWl9zb4rfPGsPnhx0Qv511l0a0AJPp9gxNt0HXcji/l6obi1+pIbk7qC7Eeez6fwOcAtcvQitgRnDer8Y18GTNUfwp+RnBj3m+u8NkJ3/kdcsaNbUyZi6TRGg5tATDUI9EoKAUETTOL7vMVeSDVdEla0RVt8xgIHMx7WnF/m9hwsaS2kmCcE3kzdvZPCQjPFJmrKLsNgWujpbQukRWi0Q08V1N94EAWPMbSdYp4CuRoxyw9zacFIBGE6BwrW1tY3rgReumYDQE/Q1teqMlmjoqpVrRtScYrQqZgxQObvxg6TFz7LHUFC5dSeyERjILVz219nhfufPIjPT8/9hXNBTfr6w9pD/xYR4OoWRnPTNUiarH9FAAi/mM6kr8HpAQCEqhoJZcgIRrJx6oEjjFBw7IpiQ6cGmmTgUvauMew2iG5WcOqxS1Te8W+VU4EpcBqX5AJg== 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)(366004)(396003)(39860400002)(346002)(376002)(136003)(451199015)(66556008)(86362001)(316002)(6916009)(4326008)(7416002)(8936002)(8676002)(36756003)(5660300002)(41300700001)(44832011)(66946007)(66476007)(2616005)(6512007)(38350700002)(54906003)(38100700002)(478600001)(186003)(83380400001)(6486002)(26005)(6506007)(52116002)(6666004)(1076003)(2906002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: plV4mxGuBvYS311HSNAGHGNGU9uyJYaQ7Y6iLSmEU40hTaT1GMYSKI02n+IGaST08NTZYQsf+S0yfnEAsKm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YUQ/JlioN7oMhDzd9UvZXj/Xg47r5aBo5XRcbDbiLa9SUXpyBQYFLq8y7Mxx+4lk+w9PI5q7An45hWr8UqWE5jyMYM0QQ0zbNV7wnm4h0oVGtB0MenE9UqHpMlFC9lcwsb4vtRKdXE65+eIpd+/VsUT/dYvKitgXg6Tn282Got5fiTAUgifinIJwq0u+30diyp6TbiNaRjei/PGpD1Ya5+AZWQY7KSdmdghqAlq8IyHYYu5ofX1PByIeealnl+y9sq36aUQfQ0aCh6KPuWRwed0KJNVoypjolhr07yG+O3/iIvbAVss8r65c4qAXGf2FtJPFVKIfss6gpp1jsNZVfhv+R/e7wkwHd44MNb4lEI2FbTpcJobSyi2gn+JtdnUyXg+v5lWkdxNV7aFZuTmcofETfpqXV+p3TIbNsUfyB0Ns0L44HJxlTwsg== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: fcd33b4f-3a84-4fc7-4d2c-08dac6a75ee1 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Nov 2022 01:18:58.1883 (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: 9SNmIpXW8HB4qUp6uDNYmrDWNXvNcSCAxUgNMAbclffooXcuWsH16311ZcZgVzm8dZGvYliN4hmRfo0x2baB9Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB7815 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The DSA tagging protocol driver macros are in the public include/net/dsa.h probably because that's also where the DSA_TAG_PROTO_*_VALUE macros are (MODULE_ALIAS_DSA_TAG_DRIVER hinges on those macro definitions). But there is no reason to expose these helpers to . That header is shared between switch drivers (drivers/net/dsa/), tagging protocol drivers (net/dsa/tag_*.c), the DSA core (net/dsa/ sans tag_*.c), and the rest of the world (DSA master drivers, network stack, etc). Too much exposure. On the other hand, net/dsa/dsa_priv.h is included only by the DSA core and by DSA tagging protocol drivers (or IOW, "friend" modules). Also a bit too much exposure - I've contemplated creating a new header which is only included by tagging protocol drivers, but completely separating a new dsa_tag_proto.h from dsa_priv.h is not immediately trivial - for example dsa_slave_to_port() is used both from the fast path and from the control path. So for now, move these definitions to dsa_priv.h which at least hides them from the world. Signed-off-by: Vladimir Oltean --- v1->v2: patch is new include/net/dsa.h | 70 ---------------------------------------------- net/dsa/dsa_priv.h | 70 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+), 70 deletions(-) diff --git a/include/net/dsa.h b/include/net/dsa.h index ee369670e20e..0736e8720b5a 100644 --- a/include/net/dsa.h +++ b/include/net/dsa.h @@ -118,10 +118,6 @@ struct dsa_netdevice_ops { int cmd); }; -#define DSA_TAG_DRIVER_ALIAS "dsa_tag-" -#define MODULE_ALIAS_DSA_TAG_DRIVER(__proto) \ - MODULE_ALIAS(DSA_TAG_DRIVER_ALIAS __stringify(__proto##_VALUE)) - struct dsa_lag { struct net_device *dev; unsigned int id; @@ -1403,70 +1399,4 @@ static inline bool dsa_slave_dev_check(const struct net_device *dev) netdev_tx_t dsa_enqueue_skb(struct sk_buff *skb, struct net_device *dev); void dsa_port_phylink_mac_change(struct dsa_switch *ds, int port, bool up); -struct dsa_tag_driver { - const struct dsa_device_ops *ops; - struct list_head list; - struct module *owner; -}; - -void dsa_tag_drivers_register(struct dsa_tag_driver *dsa_tag_driver_array[], - unsigned int count, - struct module *owner); -void dsa_tag_drivers_unregister(struct dsa_tag_driver *dsa_tag_driver_array[], - unsigned int count); - -#define dsa_tag_driver_module_drivers(__dsa_tag_drivers_array, __count) \ -static int __init dsa_tag_driver_module_init(void) \ -{ \ - dsa_tag_drivers_register(__dsa_tag_drivers_array, __count, \ - THIS_MODULE); \ - return 0; \ -} \ -module_init(dsa_tag_driver_module_init); \ - \ -static void __exit dsa_tag_driver_module_exit(void) \ -{ \ - dsa_tag_drivers_unregister(__dsa_tag_drivers_array, __count); \ -} \ -module_exit(dsa_tag_driver_module_exit) - -/** - * module_dsa_tag_drivers() - Helper macro for registering DSA tag - * drivers - * @__ops_array: Array of tag driver structures - * - * Helper macro for DSA tag drivers which do not do anything special - * in module init/exit. Each module may only use this macro once, and - * calling it replaces module_init() and module_exit(). - */ -#define module_dsa_tag_drivers(__ops_array) \ -dsa_tag_driver_module_drivers(__ops_array, ARRAY_SIZE(__ops_array)) - -#define DSA_TAG_DRIVER_NAME(__ops) dsa_tag_driver ## _ ## __ops - -/* Create a static structure we can build a linked list of dsa_tag - * drivers - */ -#define DSA_TAG_DRIVER(__ops) \ -static struct dsa_tag_driver DSA_TAG_DRIVER_NAME(__ops) = { \ - .ops = &__ops, \ -} - -/** - * module_dsa_tag_driver() - Helper macro for registering a single DSA tag - * driver - * @__ops: Single tag driver structures - * - * Helper macro for DSA tag drivers which do not do anything special - * in module init/exit. Each module may only use this macro once, and - * calling it replaces module_init() and module_exit(). - */ -#define module_dsa_tag_driver(__ops) \ -DSA_TAG_DRIVER(__ops); \ - \ -static struct dsa_tag_driver *dsa_tag_driver_array[] = { \ - &DSA_TAG_DRIVER_NAME(__ops) \ -}; \ -module_dsa_tag_drivers(dsa_tag_driver_array) #endif - diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h index 6e65c7ffd6f3..a7f1c2ca1089 100644 --- a/net/dsa/dsa_priv.h +++ b/net/dsa/dsa_priv.h @@ -17,6 +17,76 @@ #define DSA_MAX_NUM_OFFLOADING_BRIDGES BITS_PER_LONG +#define DSA_TAG_DRIVER_ALIAS "dsa_tag-" +#define MODULE_ALIAS_DSA_TAG_DRIVER(__proto) \ + MODULE_ALIAS(DSA_TAG_DRIVER_ALIAS __stringify(__proto##_VALUE)) + +struct dsa_tag_driver { + const struct dsa_device_ops *ops; + struct list_head list; + struct module *owner; +}; + +void dsa_tag_drivers_register(struct dsa_tag_driver *dsa_tag_driver_array[], + unsigned int count, + struct module *owner); +void dsa_tag_drivers_unregister(struct dsa_tag_driver *dsa_tag_driver_array[], + unsigned int count); + +#define dsa_tag_driver_module_drivers(__dsa_tag_drivers_array, __count) \ +static int __init dsa_tag_driver_module_init(void) \ +{ \ + dsa_tag_drivers_register(__dsa_tag_drivers_array, __count, \ + THIS_MODULE); \ + return 0; \ +} \ +module_init(dsa_tag_driver_module_init); \ + \ +static void __exit dsa_tag_driver_module_exit(void) \ +{ \ + dsa_tag_drivers_unregister(__dsa_tag_drivers_array, __count); \ +} \ +module_exit(dsa_tag_driver_module_exit) + +/** + * module_dsa_tag_drivers() - Helper macro for registering DSA tag + * drivers + * @__ops_array: Array of tag driver structures + * + * Helper macro for DSA tag drivers which do not do anything special + * in module init/exit. Each module may only use this macro once, and + * calling it replaces module_init() and module_exit(). + */ +#define module_dsa_tag_drivers(__ops_array) \ +dsa_tag_driver_module_drivers(__ops_array, ARRAY_SIZE(__ops_array)) + +#define DSA_TAG_DRIVER_NAME(__ops) dsa_tag_driver ## _ ## __ops + +/* Create a static structure we can build a linked list of dsa_tag + * drivers + */ +#define DSA_TAG_DRIVER(__ops) \ +static struct dsa_tag_driver DSA_TAG_DRIVER_NAME(__ops) = { \ + .ops = &__ops, \ +} + +/** + * module_dsa_tag_driver() - Helper macro for registering a single DSA tag + * driver + * @__ops: Single tag driver structures + * + * Helper macro for DSA tag drivers which do not do anything special + * in module init/exit. Each module may only use this macro once, and + * calling it replaces module_init() and module_exit(). + */ +#define module_dsa_tag_driver(__ops) \ +DSA_TAG_DRIVER(__ops); \ + \ +static struct dsa_tag_driver *dsa_tag_driver_array[] = { \ + &DSA_TAG_DRIVER_NAME(__ops) \ +}; \ +module_dsa_tag_drivers(dsa_tag_driver_array) + enum { DSA_NOTIFIER_AGEING_TIME, DSA_NOTIFIER_BRIDGE_JOIN, From patchwork Tue Nov 15 01:18:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13043053 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ABC45C43217 for ; Tue, 15 Nov 2022 01:19:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232091AbiKOBTF (ORCPT ); Mon, 14 Nov 2022 20:19:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229635AbiKOBTC (ORCPT ); Mon, 14 Nov 2022 20:19:02 -0500 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70075.outbound.protection.outlook.com [40.107.7.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F6FC13DD6 for ; Mon, 14 Nov 2022 17:19:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ePq0TtBnJc8GUs05IdLHyJiXSCvQhbDIgugz1r+lCPRWbAjG9PXmxR6b71HokfX0l8jnHyLq4a5EGUM/c3jUPWsk2g3DWLMCCtQLQpU/7BBiPQxnhmfu0+mkSC9ChPoubA6T2Zs0gEAcDJHCYHnIPXdnspHHNP9/UClLNwX0/1z1z/e7G2ULWla8wqHaitNSrje4IpY+7tD3Sn4GY/UrCnPyFPVCv+WiNYbYsfeymSA+yY7uN1SYO1BS89AmJhK4WdEe5878QwWeM+WYBY6H32QZt8b6Q6NTMY3Txn4c3/jA1TWyGcbhCaeJUmXJmDF8ieMASDm4Qewnx6lGEp+guQ== 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=S1v/2rCKfo2bc8jqIB5EsNRR4IMToUZrDkyWnobfWKw=; b=T4r/yLgxfoYGWsE+5Sp4PMfWy/+peXhJ6oAplEu4jaRqZzaObhSDreqyKbZ7pT9g/FYMcNcdC6fwUr4mYgzYICJ9j4WcJjbuEpvzSDWfjMhJ+hdVSakuIAZR2e7Rbyoz2ZKCEr1p5O+0GAh8SeI7OnW3tVtG4gjxt9Xhd95DwyOq/k8ks+qUTjAey/cusN13SXej1PfVnII7b2GC/q2U0vezuqWGXuGkXrd98sLJsZxR8eTQh9bxPug4GCUyT5dAFF9b9fnPflnRemrnvTOis8CPsG5zvJ26imzQPRbDc30jZSy+21a6LO71Uvbcj1Zz7orjW05OTer3/kn1GZC17A== 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=S1v/2rCKfo2bc8jqIB5EsNRR4IMToUZrDkyWnobfWKw=; b=OyyGewcI6vvtElnEwHwsyd2thlELRN5HKnFtNbbfByRRjyWsTX4kIr1CwlqynRTDsZxLUYhWoJXFM1amf3Qt7hPXB9h9yhmMKjmltVoe6TMm6GWADbZyC30OhbbnmmqZvoE8OXdi3WZL/utxDiWBXGtAntUIZCTH8uvO9zb6XiA= 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 AS8PR04MB7815.eurprd04.prod.outlook.com (2603:10a6:20b:28a::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5813.16; Tue, 15 Nov 2022 01:18:59 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::9317:77dc:9be2:63b]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::9317:77dc:9be2:63b%7]) with mapi id 15.20.5813.018; Tue, 15 Nov 2022 01:18:59 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Michael Walle , Heiko Thiery Subject: [PATCH v2 net-next 2/6] net: dsa: rename tagging protocol driver modalias Date: Tue, 15 Nov 2022 03:18:43 +0200 Message-Id: <20221115011847.2843127-3-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221115011847.2843127-1-vladimir.oltean@nxp.com> References: <20221115011847.2843127-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AS4P191CA0006.EURP191.PROD.OUTLOOK.COM (2603:10a6:20b:5d5::17) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5136:EE_|AS8PR04MB7815:EE_ X-MS-Office365-Filtering-Correlation-Id: 84a33188-cf21-4a67-7c9e-08dac6a75f96 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: znFDlz7VJux8ZgWZR717KfQBY5Tm6g1Ow8nKq58Q2BkT6BWwsJ1kcOPmIVFU3B8H6nABqIHU0O1qndgB8wiyZPvP+w+GN/0YcoFCDxd/2zhYBDif+p2yOXUFyjsoJVir+RUWPnCHtZGAgKZPaZr/YQ8j/baGXBWac0PEXCmo9PPHNg6S8lrTmTTGyn3adzqlGF2vLuBT6+owyPjmDiQhladRx4bHaRkfnqfYpyDzU15sv1CnARyJa8bxvmCQxrKMdqpZ8DVDuwvpm4yQKkhKKjA6vfvKUY7C+MqI4HJ4txcy5JzErJBtMOodrDsaFUKck4yIRmKNGMkm2ALwPzFmMtN4aGhgUSXLzeRqM+vFtOYNZZ8pRc1+g/EQR5TQ++KeK/VLbe3ebPDrwdchZBWppssuKueg8K8g1cKmau+C32e2n0wAjh5M1gP76qKgB1DnXmXpno7PrBTUVasxZGz0d2aSWEc5TusU5tuiazu/H3rBKGQESJLEdiPGhSgeFhvS/R1rTES6qehVHc5giA8i8EopYzPQog5QiASN6/eglBvXUkG57xZdQOhAG2IMDVFeenaLvYDk6I7SHUbb1g5nXdKPjEOddLi6RoFINj13nPFroc8ZR01uweUFTbOZFsay1/Zsn1sJUUFgKBY2PuRrsuHT0/MB8Ia9p0gjY6BJG80le/6RbXUN+bNNI9mAdDMTizc2ck8T4Ys7pb2tlg/TUhf46/rQwIj8IW+C3RUwh1WJmzCXl97Jf2EKSkI3xJEmh4fmrMxwtxtbPq/Yckom6A== 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)(366004)(396003)(39860400002)(346002)(376002)(136003)(451199015)(66556008)(86362001)(316002)(6916009)(4326008)(7416002)(8936002)(8676002)(36756003)(5660300002)(41300700001)(44832011)(66946007)(66476007)(2616005)(6512007)(38350700002)(54906003)(38100700002)(478600001)(186003)(83380400001)(6486002)(26005)(6506007)(52116002)(6666004)(1076003)(2906002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: uStRGjaI0AbxYejKdua9Dp8q52WP/sp+ZwwGNLpDn4EfNxH7eTdZHG0q0o9Dgdsb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Wpc0fFO6SWZP8tIMjCkYn8OLlret5itrc7FgFiQkRg2vcnSBMnQc4Q50+vFpDPKV9suieXEdNwJ+hGitSUqbtErzzQ7Qz5dx6EUEdVPIyPiZdulf7ctOIRsdEO1NGLZ/NwLCCwzFai7eEPKri/rmfNOgw4eCIqbkCcqkkIXd6dB2cTwczzKG9MB+E7DUNDIKYWs5IDIaoLYvZb80llszlBJYnFYvIJT+EOEJEd1eZDLGOAjvWGKoEHvNNns0AJSk1fpzP8OylINW7mv8gGUo6bppCpw20Bk1d4CUXI2LRuQInZEHnff8Y+c+t+N2CmC2GkoYNHFTEzLqorendCiJSPkiraEOR8RyVHJpI4hIg1f7aFVQhhixbVegBy06H6cLgSZRUfVhDA+YUraDwgRqv8p8f9mGFQ+SxHQWrU4Y+NGlYmI5/UlINBJF60zSBEbopu7qZebXmpPDmHELv38LQoF2Xg== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 84a33188-cf21-4a67-7c9e-08dac6a75f96 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Nov 2022 01:18:59.4382 (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: LUC8LawTLCmN5KQhMayqANsBjggQ+SI7vPqg5WjLpBDkDSZOxKEI7R5zYLAE7mZd/NG5JWDy44ld8xCwcR4xWg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB7815 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org It's autumn cleanup time, and today's target are modaliases. Michael says that for users of modinfo, "dsa_tag-20" is not the most suggestive name, and recommends a change to "dsa_tag-id-20". Andrew points out that other modaliases have a prefix delimited by colons, so he recommends "dsa_tag:20" instead of "dsa_tag-20". To satisfy both proposals, Florian recommends "dsa_tag:id-20". The modaliases are not stable ABI, and the essential information (protocol ID) is still conveyed in the new string, which request_module() must be adapted to form. Link: 20221027210830.3577793-1-vladimir.oltean@nxp.com Suggested-by: Andrew Lunn Suggested-by: Michael Walle Suggested-by: Florian Fainelli Signed-off-by: Vladimir Oltean --- v1->v2: patch is new net/dsa/dsa.c | 2 +- net/dsa/dsa_priv.h | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c index 64b14f655b23..38c64cc5c0d2 100644 --- a/net/dsa/dsa.c +++ b/net/dsa/dsa.c @@ -107,7 +107,7 @@ const struct dsa_device_ops *dsa_tag_driver_get(int tag_protocol) const struct dsa_device_ops *ops; bool found = false; - request_module("%s%d", DSA_TAG_DRIVER_ALIAS, tag_protocol); + request_module("%sid-%d", DSA_TAG_DRIVER_ALIAS, tag_protocol); mutex_lock(&dsa_tag_drivers_lock); list_for_each_entry(dsa_tag_driver, &dsa_tag_drivers_list, list) { diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h index a7f1c2ca1089..9b635dddad3f 100644 --- a/net/dsa/dsa_priv.h +++ b/net/dsa/dsa_priv.h @@ -17,9 +17,10 @@ #define DSA_MAX_NUM_OFFLOADING_BRIDGES BITS_PER_LONG -#define DSA_TAG_DRIVER_ALIAS "dsa_tag-" -#define MODULE_ALIAS_DSA_TAG_DRIVER(__proto) \ - MODULE_ALIAS(DSA_TAG_DRIVER_ALIAS __stringify(__proto##_VALUE)) +#define DSA_TAG_DRIVER_ALIAS "dsa_tag:" +#define MODULE_ALIAS_DSA_TAG_DRIVER(__proto) \ + MODULE_ALIAS(DSA_TAG_DRIVER_ALIAS "id-" \ + __stringify(__proto##_VALUE)) struct dsa_tag_driver { const struct dsa_device_ops *ops; From patchwork Tue Nov 15 01:18:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13043054 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 636D7C433FE for ; Tue, 15 Nov 2022 01:19:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232224AbiKOBTP (ORCPT ); Mon, 14 Nov 2022 20:19:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33118 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232059AbiKOBTF (ORCPT ); Mon, 14 Nov 2022 20:19:05 -0500 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70075.outbound.protection.outlook.com [40.107.7.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 016DD13DCC for ; Mon, 14 Nov 2022 17:19:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VYXkErThum0PIg8qMOdY0xz6EXkv/OM9VB5laMrOPK6izh3IIq/5VzdR6JyikzgidvEpkqBkIPeGpo2C7t0Df/hGCRbAvB+3lsLDb+WS34YBN8MLhBjm84wCzs1YRYbsvP3Uw6eNvWoydJWt0/nZeznCs+Xxisg/2LJwcnBFOqrB7pX8yaCiE6BBT05vCQUHncxgtn8myCMFEbp321FLXGagcmClOmemXI4xyp7FyC2MJmv+gVMmwNIOJET5dxtcHx7qgB2Z8nOIncmiCtVX7Zu688E8TBERMMEO9mj6h2lFjEilVNpz9zbagpJY79DLQB2YkgRJ4kNwfHnEWr0RzA== 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=LVl3uiffsw9WSZ8efCamAHaUCGjx+jmhb78KJ4EEAT0=; b=kpp2dLm51IkTdmBZkPuajAOa/8V0+/R45xlcbu4v485w1HWkFtP6ajnl8yJuX6msfQLTN1u3olvw/fbDkCpWT0Bp50CXQtHvkp8VioFbDD/kSEuDhDRwsd0zQL6aRjhojY2gJfEBg5fW7S1nnYn1N6EyofAorifV16F3svImRUMiI0pLsEHnfqAvoByrkPzsEhymNgU35U9T/+s1i/sSgIrgeUT7PE9KmyMW9Z9N3y9G6YDMVuo7nGPXnlnlyndCp+xr/GPf5+qqzjzg4L9lSzeMhLW8b28rDn1IucXI+LD6iOwQnVCuYv7a2RaOX6x7aErp2jT8jWtvY14IZAt+kQ== 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=LVl3uiffsw9WSZ8efCamAHaUCGjx+jmhb78KJ4EEAT0=; b=LV4b7yMsF86dG7ydYIPUCevubSkp5Y972J3jGfjXGq5OUM9cJOyhdd25XsecaQqI11VQl9YoR1mArhLhZt1tseqZHxkrDzcU+sgVjKlVkZCmwR+6n75xxvdUgrGgX8Iqg8X9bezpM0jiUi7bKY2rG72Vd7GmlZxGZ75i5dja5Lg= 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 AS8PR04MB7815.eurprd04.prod.outlook.com (2603:10a6:20b:28a::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5813.16; Tue, 15 Nov 2022 01:19:00 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::9317:77dc:9be2:63b]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::9317:77dc:9be2:63b%7]) with mapi id 15.20.5813.018; Tue, 15 Nov 2022 01:19:00 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Michael Walle , Heiko Thiery Subject: [PATCH v2 net-next 3/6] net: dsa: provide a second modalias to tag proto drivers based on their name Date: Tue, 15 Nov 2022 03:18:44 +0200 Message-Id: <20221115011847.2843127-4-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221115011847.2843127-1-vladimir.oltean@nxp.com> References: <20221115011847.2843127-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AS4P191CA0006.EURP191.PROD.OUTLOOK.COM (2603:10a6:20b:5d5::17) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5136:EE_|AS8PR04MB7815:EE_ X-MS-Office365-Filtering-Correlation-Id: e26ac216-e8c5-4682-9793-08dac6a76057 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gl3VmdDQlDgWp9AXjoB7c+XJXfuX+CyMWzhndY6Ar04d+N9yGQovxHCrBaIRwedlDPwMBCCi4+w5nHNwAV3smD/k/WLHHRoZsfB5cvoAMuXWABju58W9q7jrFbLIPo7N28UwQu24mPpxl8tmDMcVeFEm1BQFG7PXBi3UqUZxJPvjFExfWdKgoR4Sl3r6MiJId8cHiCbRVaeiF/Hoo2kVTyj8T2rfoRITRgcObo5vQUnCky2jwBLQYuC7M8CGZM05fmm1/Zytd2AT6QvP342BMhcRpponnSuHDkqnucwgC1IUTS0td6atSg2iRPNiPB9n0ybKK/PNJp7Ks9WZHnojc60z1TVMDwaLhmUyZEzUS5VAvt98peK0ydeFlZO2MytsSt/88288GzIzAQdf3k8CzDDEf5fK+vbVCOXYgXLSTd4beni2m+fqvGTWzPZs329oVcsAnZLvTAp60iT5/fiKSU4SkhzhqCpsR+JFXiqi94u+37tqA/NT0OGih1+vE5n1Bl3AorHP6s79aIwtAx2EyOHXnBD2avJolgZjEA5DOJtepa5ROgO9V+KW/CRnBbUZTJSLRRixsow+o9xNH8fI12o1wKeM+24ci19JZz/uLzluHgyciUr6w0QSejvL1hh2vu5ZAi6P1ey0gXBiZUrI9VyH8unJv7/5891eKw7rc9Xc9ASxQrzoNd1F1nJA7cx7KpL2eQ9MlXNR/H4dJBjUx4+xiUyVmSXk4pB8RBcGuB+DLerCQx30xuKVI6nROA1NP4DTTagRPHfBtc7dIy/uAg== 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)(366004)(396003)(39860400002)(346002)(376002)(136003)(451199015)(66556008)(86362001)(316002)(6916009)(30864003)(4326008)(7416002)(8936002)(8676002)(36756003)(5660300002)(41300700001)(44832011)(66946007)(66476007)(2616005)(6512007)(38350700002)(54906003)(38100700002)(478600001)(186003)(83380400001)(6486002)(26005)(6506007)(52116002)(6666004)(1076003)(2906002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: mJUmC5PEkr0vcxeAidPM28EL2enq1/u+Ht3gZEZOkmkFz3adxVt2k/TFrd1+twUZpQf7IqlXu7Z1FIomLAelSxBElfzeR6+tgS9ShWzFufXjgsO9r8+3xe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LmM2as6hH6P+x3aZ4tTMKNuwsHU/xgWiHmYHBOdhdP6Ccbbf4z8XJKgYs8v1bYFg04HE7ug+o58D90ZZJ3Xm+muOXfSEr53dPw/CBew0jD4wFpiHS8Mzm/hgIH0uVFyoTZcxp8toKGpvepDo3BoEDZDR2mktgeYa4CF4ZN9c0FTpZ1LdpJHvKZSl3WhZl/PekBUFRenqSFOLm4qNnlpl+mHdmv7TKCOLYI2YwwYo51sq/iIFn4KZZhuTC+qmiIBcWgh7vtW+k+Ok4bn+6Xh63t1aMRvYYW4nElgbagAl3rJVMRZWiAB8OBy6HqE+Tbm5K27P//nViFbYluxsut47rNa5G8D8jSiU/eUFtSPZ0ddp5NxRsQO81segETCIvPLQPT6XgR7qCG28SesX1QpaJxuUQsgCF6D/flj8ux7EaBZ50A== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e26ac216-e8c5-4682-9793-08dac6a76057 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Nov 2022 01:19:00.6881 (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: wY4jY/9NlA+omrEM9iqgsIbJDVfE1f9UHqSMWgtDW6RKIH2GQzzaxWseLDtMSWLQbo/8Qkt3UeBUbiCg06zfJg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB7815 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Currently, tagging protocol drivers have a modalias of "dsa_tag:id-", where the number is one of DSA_TAG_PROTO_*_VALUE. This modalias makes it possible for the request_module() call in dsa_tag_driver_get() to work, given the input it has - an integer returned by ds->ops->get_tag_protocol(). It is also possible to change tagging protocols at (pseudo-)runtime, via sysfs or via device tree, and this works via the name string of the tagging protocol rather than via its id (DSA_TAG_PROTO_*_VALUE). In the latter case, there is no request_module() call, because there is no association that the DSA core has between the string name and the ID, to construct the modalias. The module is simply assumed to have been inserted. This is actually slightly problematic when the tagging protocol change should take place at probe time, since it's expected that the dependency module should get autoloaded. For this purpose, let's introduce a second modalias, so that the DSA core can call request_module() by name. There is no reason to make the modalias by name optional, so just modify the MODULE_ALIAS_DSA_TAG_DRIVER() macro to take both the ID and the name as arguments, and generate two modaliases behind the scenes. Suggested-by: Michael Walle Signed-off-by: Vladimir Oltean Tested-by: Michael Walle # on kontron-sl28 w/ ocelot_8021q --- v1->v2: macros are now in net/dsa/dsa_priv.h, otherwise the same net/dsa/dsa_priv.h | 6 +++++- net/dsa/tag_ar9331.c | 6 ++++-- net/dsa/tag_brcm.c | 16 ++++++++++------ net/dsa/tag_dsa.c | 11 +++++++---- net/dsa/tag_gswip.c | 6 ++++-- net/dsa/tag_hellcreek.c | 6 ++++-- net/dsa/tag_ksz.c | 21 +++++++++++++-------- net/dsa/tag_lan9303.c | 6 ++++-- net/dsa/tag_mtk.c | 6 ++++-- net/dsa/tag_ocelot.c | 11 +++++++---- net/dsa/tag_ocelot_8021q.c | 6 ++++-- net/dsa/tag_qca.c | 6 ++++-- net/dsa/tag_rtl4_a.c | 6 ++++-- net/dsa/tag_rtl8_4.c | 7 +++++-- net/dsa/tag_rzn1_a5psw.c | 6 ++++-- net/dsa/tag_sja1105.c | 11 +++++++---- net/dsa/tag_trailer.c | 6 ++++-- net/dsa/tag_xrs700x.c | 6 ++++-- 18 files changed, 98 insertions(+), 51 deletions(-) diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h index 9b635dddad3f..b4b8fe4ed9bf 100644 --- a/net/dsa/dsa_priv.h +++ b/net/dsa/dsa_priv.h @@ -17,8 +17,12 @@ #define DSA_MAX_NUM_OFFLOADING_BRIDGES BITS_PER_LONG +/* Create 2 modaliases per tagging protocol, one to auto-load the module + * given the ID reported by get_tag_protocol(), and the other by name. + */ #define DSA_TAG_DRIVER_ALIAS "dsa_tag:" -#define MODULE_ALIAS_DSA_TAG_DRIVER(__proto) \ +#define MODULE_ALIAS_DSA_TAG_DRIVER(__proto, __name) \ + MODULE_ALIAS(DSA_TAG_DRIVER_ALIAS __name); \ MODULE_ALIAS(DSA_TAG_DRIVER_ALIAS "id-" \ __stringify(__proto##_VALUE)) diff --git a/net/dsa/tag_ar9331.c b/net/dsa/tag_ar9331.c index 8a02ac44282f..bfa161a4f502 100644 --- a/net/dsa/tag_ar9331.c +++ b/net/dsa/tag_ar9331.c @@ -9,6 +9,8 @@ #include "dsa_priv.h" +#define AR9331_NAME "ar9331" + #define AR9331_HDR_LEN 2 #define AR9331_HDR_VERSION 1 @@ -80,7 +82,7 @@ static struct sk_buff *ar9331_tag_rcv(struct sk_buff *skb, } static const struct dsa_device_ops ar9331_netdev_ops = { - .name = "ar9331", + .name = AR9331_NAME, .proto = DSA_TAG_PROTO_AR9331, .xmit = ar9331_tag_xmit, .rcv = ar9331_tag_rcv, @@ -88,5 +90,5 @@ static const struct dsa_device_ops ar9331_netdev_ops = { }; MODULE_LICENSE("GPL v2"); -MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_AR9331); +MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_AR9331, AR9331_NAME); module_dsa_tag_driver(ar9331_netdev_ops); diff --git a/net/dsa/tag_brcm.c b/net/dsa/tag_brcm.c index 16889ea3e0a7..9e7477ed70f1 100644 --- a/net/dsa/tag_brcm.c +++ b/net/dsa/tag_brcm.c @@ -12,6 +12,10 @@ #include "dsa_priv.h" +#define BRCM_NAME "brcm" +#define BRCM_LEGACY_NAME "brcm-legacy" +#define BRCM_PREPEND_NAME "brcm-prepend" + /* Legacy Broadcom tag (6 bytes) */ #define BRCM_LEG_TAG_LEN 6 @@ -196,7 +200,7 @@ static struct sk_buff *brcm_tag_rcv(struct sk_buff *skb, struct net_device *dev) } static const struct dsa_device_ops brcm_netdev_ops = { - .name = "brcm", + .name = BRCM_NAME, .proto = DSA_TAG_PROTO_BRCM, .xmit = brcm_tag_xmit, .rcv = brcm_tag_rcv, @@ -204,7 +208,7 @@ static const struct dsa_device_ops brcm_netdev_ops = { }; DSA_TAG_DRIVER(brcm_netdev_ops); -MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_BRCM); +MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_BRCM, BRCM_NAME); #endif #if IS_ENABLED(CONFIG_NET_DSA_TAG_BRCM_LEGACY) @@ -273,7 +277,7 @@ static struct sk_buff *brcm_leg_tag_rcv(struct sk_buff *skb, } static const struct dsa_device_ops brcm_legacy_netdev_ops = { - .name = "brcm-legacy", + .name = BRCM_LEGACY_NAME, .proto = DSA_TAG_PROTO_BRCM_LEGACY, .xmit = brcm_leg_tag_xmit, .rcv = brcm_leg_tag_rcv, @@ -281,7 +285,7 @@ static const struct dsa_device_ops brcm_legacy_netdev_ops = { }; DSA_TAG_DRIVER(brcm_legacy_netdev_ops); -MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_BRCM_LEGACY); +MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_BRCM_LEGACY, BRCM_LEGACY_NAME); #endif /* CONFIG_NET_DSA_TAG_BRCM_LEGACY */ #if IS_ENABLED(CONFIG_NET_DSA_TAG_BRCM_PREPEND) @@ -300,7 +304,7 @@ static struct sk_buff *brcm_tag_rcv_prepend(struct sk_buff *skb, } static const struct dsa_device_ops brcm_prepend_netdev_ops = { - .name = "brcm-prepend", + .name = BRCM_PREPEND_NAME, .proto = DSA_TAG_PROTO_BRCM_PREPEND, .xmit = brcm_tag_xmit_prepend, .rcv = brcm_tag_rcv_prepend, @@ -308,7 +312,7 @@ static const struct dsa_device_ops brcm_prepend_netdev_ops = { }; DSA_TAG_DRIVER(brcm_prepend_netdev_ops); -MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_BRCM_PREPEND); +MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_BRCM_PREPEND, BRCM_PREPEND_NAME); #endif static struct dsa_tag_driver *dsa_tag_driver_array[] = { diff --git a/net/dsa/tag_dsa.c b/net/dsa/tag_dsa.c index e4b6e3f2a3db..9fe77f5cc759 100644 --- a/net/dsa/tag_dsa.c +++ b/net/dsa/tag_dsa.c @@ -52,6 +52,9 @@ #include "dsa_priv.h" +#define DSA_NAME "dsa" +#define EDSA_NAME "edsa" + #define DSA_HLEN 4 /** @@ -339,7 +342,7 @@ static struct sk_buff *dsa_rcv(struct sk_buff *skb, struct net_device *dev) } static const struct dsa_device_ops dsa_netdev_ops = { - .name = "dsa", + .name = DSA_NAME, .proto = DSA_TAG_PROTO_DSA, .xmit = dsa_xmit, .rcv = dsa_rcv, @@ -347,7 +350,7 @@ static const struct dsa_device_ops dsa_netdev_ops = { }; DSA_TAG_DRIVER(dsa_netdev_ops); -MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_DSA); +MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_DSA, DSA_NAME); #endif /* CONFIG_NET_DSA_TAG_DSA */ #if IS_ENABLED(CONFIG_NET_DSA_TAG_EDSA) @@ -381,7 +384,7 @@ static struct sk_buff *edsa_rcv(struct sk_buff *skb, struct net_device *dev) } static const struct dsa_device_ops edsa_netdev_ops = { - .name = "edsa", + .name = EDSA_NAME, .proto = DSA_TAG_PROTO_EDSA, .xmit = edsa_xmit, .rcv = edsa_rcv, @@ -389,7 +392,7 @@ static const struct dsa_device_ops edsa_netdev_ops = { }; DSA_TAG_DRIVER(edsa_netdev_ops); -MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_EDSA); +MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_EDSA, EDSA_NAME); #endif /* CONFIG_NET_DSA_TAG_EDSA */ static struct dsa_tag_driver *dsa_tag_drivers[] = { diff --git a/net/dsa/tag_gswip.c b/net/dsa/tag_gswip.c index df7140984da3..020050dff3e4 100644 --- a/net/dsa/tag_gswip.c +++ b/net/dsa/tag_gswip.c @@ -12,6 +12,8 @@ #include "dsa_priv.h" +#define GSWIP_NAME "gswip" + #define GSWIP_TX_HEADER_LEN 4 /* special tag in TX path header */ @@ -98,7 +100,7 @@ static struct sk_buff *gswip_tag_rcv(struct sk_buff *skb, } static const struct dsa_device_ops gswip_netdev_ops = { - .name = "gswip", + .name = GSWIP_NAME, .proto = DSA_TAG_PROTO_GSWIP, .xmit = gswip_tag_xmit, .rcv = gswip_tag_rcv, @@ -106,6 +108,6 @@ static const struct dsa_device_ops gswip_netdev_ops = { }; MODULE_LICENSE("GPL"); -MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_GSWIP); +MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_GSWIP, GSWIP_NAME); module_dsa_tag_driver(gswip_netdev_ops); diff --git a/net/dsa/tag_hellcreek.c b/net/dsa/tag_hellcreek.c index 846588c0070a..03fd5f2877c8 100644 --- a/net/dsa/tag_hellcreek.c +++ b/net/dsa/tag_hellcreek.c @@ -13,6 +13,8 @@ #include "dsa_priv.h" +#define HELLCREEK_NAME "hellcreek" + #define HELLCREEK_TAG_LEN 1 static struct sk_buff *hellcreek_xmit(struct sk_buff *skb, @@ -57,7 +59,7 @@ static struct sk_buff *hellcreek_rcv(struct sk_buff *skb, } static const struct dsa_device_ops hellcreek_netdev_ops = { - .name = "hellcreek", + .name = HELLCREEK_NAME, .proto = DSA_TAG_PROTO_HELLCREEK, .xmit = hellcreek_xmit, .rcv = hellcreek_rcv, @@ -65,6 +67,6 @@ static const struct dsa_device_ops hellcreek_netdev_ops = { }; MODULE_LICENSE("Dual MIT/GPL"); -MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_HELLCREEK); +MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_HELLCREEK, HELLCREEK_NAME); module_dsa_tag_driver(hellcreek_netdev_ops); diff --git a/net/dsa/tag_ksz.c b/net/dsa/tag_ksz.c index 38fa19c1e2d5..37db5156f9a3 100644 --- a/net/dsa/tag_ksz.c +++ b/net/dsa/tag_ksz.c @@ -9,6 +9,11 @@ #include #include "dsa_priv.h" +#define KSZ8795_NAME "ksz8795" +#define KSZ9477_NAME "ksz9477" +#define KSZ9893_NAME "ksz9893" +#define LAN937X_NAME "lan937x" + /* Typically only one byte is used for tail tag. */ #define KSZ_EGRESS_TAG_LEN 1 #define KSZ_INGRESS_TAG_LEN 1 @@ -74,7 +79,7 @@ static struct sk_buff *ksz8795_rcv(struct sk_buff *skb, struct net_device *dev) } static const struct dsa_device_ops ksz8795_netdev_ops = { - .name = "ksz8795", + .name = KSZ8795_NAME, .proto = DSA_TAG_PROTO_KSZ8795, .xmit = ksz8795_xmit, .rcv = ksz8795_rcv, @@ -82,7 +87,7 @@ static const struct dsa_device_ops ksz8795_netdev_ops = { }; DSA_TAG_DRIVER(ksz8795_netdev_ops); -MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_KSZ8795); +MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_KSZ8795, KSZ8795_NAME); /* * For Ingress (Host -> KSZ9477), 2 bytes are added before FCS. @@ -147,7 +152,7 @@ static struct sk_buff *ksz9477_rcv(struct sk_buff *skb, struct net_device *dev) } static const struct dsa_device_ops ksz9477_netdev_ops = { - .name = "ksz9477", + .name = KSZ9477_NAME, .proto = DSA_TAG_PROTO_KSZ9477, .xmit = ksz9477_xmit, .rcv = ksz9477_rcv, @@ -155,7 +160,7 @@ static const struct dsa_device_ops ksz9477_netdev_ops = { }; DSA_TAG_DRIVER(ksz9477_netdev_ops); -MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_KSZ9477); +MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_KSZ9477, KSZ9477_NAME); #define KSZ9893_TAIL_TAG_OVERRIDE BIT(5) #define KSZ9893_TAIL_TAG_LOOKUP BIT(6) @@ -183,7 +188,7 @@ static struct sk_buff *ksz9893_xmit(struct sk_buff *skb, } static const struct dsa_device_ops ksz9893_netdev_ops = { - .name = "ksz9893", + .name = KSZ9893_NAME, .proto = DSA_TAG_PROTO_KSZ9893, .xmit = ksz9893_xmit, .rcv = ksz9477_rcv, @@ -191,7 +196,7 @@ static const struct dsa_device_ops ksz9893_netdev_ops = { }; DSA_TAG_DRIVER(ksz9893_netdev_ops); -MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_KSZ9893); +MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_KSZ9893, KSZ9893_NAME); /* For xmit, 2 bytes are added before FCS. * --------------------------------------------------------------------------- @@ -241,7 +246,7 @@ static struct sk_buff *lan937x_xmit(struct sk_buff *skb, } static const struct dsa_device_ops lan937x_netdev_ops = { - .name = "lan937x", + .name = LAN937X_NAME, .proto = DSA_TAG_PROTO_LAN937X, .xmit = lan937x_xmit, .rcv = ksz9477_rcv, @@ -249,7 +254,7 @@ static const struct dsa_device_ops lan937x_netdev_ops = { }; DSA_TAG_DRIVER(lan937x_netdev_ops); -MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_LAN937X); +MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_LAN937X, LAN937X_NAME); static struct dsa_tag_driver *dsa_tag_driver_array[] = { &DSA_TAG_DRIVER_NAME(ksz8795_netdev_ops), diff --git a/net/dsa/tag_lan9303.c b/net/dsa/tag_lan9303.c index 98d7d7120bab..4118292ed218 100644 --- a/net/dsa/tag_lan9303.c +++ b/net/dsa/tag_lan9303.c @@ -30,6 +30,8 @@ * Required when no forwarding between the external ports should happen. */ +#define LAN9303_NAME "lan9303" + #define LAN9303_TAG_LEN 4 # define LAN9303_TAG_TX_USE_ALR BIT(3) # define LAN9303_TAG_TX_STP_OVERRIDE BIT(4) @@ -110,7 +112,7 @@ static struct sk_buff *lan9303_rcv(struct sk_buff *skb, struct net_device *dev) } static const struct dsa_device_ops lan9303_netdev_ops = { - .name = "lan9303", + .name = LAN9303_NAME, .proto = DSA_TAG_PROTO_LAN9303, .xmit = lan9303_xmit, .rcv = lan9303_rcv, @@ -118,6 +120,6 @@ static const struct dsa_device_ops lan9303_netdev_ops = { }; MODULE_LICENSE("GPL"); -MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_LAN9303); +MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_LAN9303, LAN9303_NAME); module_dsa_tag_driver(lan9303_netdev_ops); diff --git a/net/dsa/tag_mtk.c b/net/dsa/tag_mtk.c index 415d8ece242a..ba37495ab5f4 100644 --- a/net/dsa/tag_mtk.c +++ b/net/dsa/tag_mtk.c @@ -10,6 +10,8 @@ #include "dsa_priv.h" +#define MTK_NAME "mtk" + #define MTK_HDR_LEN 4 #define MTK_HDR_XMIT_UNTAGGED 0 #define MTK_HDR_XMIT_TAGGED_TPID_8100 1 @@ -91,7 +93,7 @@ static struct sk_buff *mtk_tag_rcv(struct sk_buff *skb, struct net_device *dev) } static const struct dsa_device_ops mtk_netdev_ops = { - .name = "mtk", + .name = MTK_NAME, .proto = DSA_TAG_PROTO_MTK, .xmit = mtk_tag_xmit, .rcv = mtk_tag_rcv, @@ -99,6 +101,6 @@ static const struct dsa_device_ops mtk_netdev_ops = { }; MODULE_LICENSE("GPL"); -MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_MTK); +MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_MTK, MTK_NAME); module_dsa_tag_driver(mtk_netdev_ops); diff --git a/net/dsa/tag_ocelot.c b/net/dsa/tag_ocelot.c index 0d81f172b7a6..8cc31ab47e28 100644 --- a/net/dsa/tag_ocelot.c +++ b/net/dsa/tag_ocelot.c @@ -4,6 +4,9 @@ #include #include "dsa_priv.h" +#define OCELOT_NAME "ocelot" +#define SEVILLE_NAME "seville" + /* If the port is under a VLAN-aware bridge, remove the VLAN header from the * payload and move it into the DSA tag, which will make the switch classify * the packet to the bridge VLAN. Otherwise, leave the classified VLAN at zero, @@ -183,7 +186,7 @@ static struct sk_buff *ocelot_rcv(struct sk_buff *skb, } static const struct dsa_device_ops ocelot_netdev_ops = { - .name = "ocelot", + .name = OCELOT_NAME, .proto = DSA_TAG_PROTO_OCELOT, .xmit = ocelot_xmit, .rcv = ocelot_rcv, @@ -192,10 +195,10 @@ static const struct dsa_device_ops ocelot_netdev_ops = { }; DSA_TAG_DRIVER(ocelot_netdev_ops); -MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_OCELOT); +MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_OCELOT, OCELOT_NAME); static const struct dsa_device_ops seville_netdev_ops = { - .name = "seville", + .name = SEVILLE_NAME, .proto = DSA_TAG_PROTO_SEVILLE, .xmit = seville_xmit, .rcv = ocelot_rcv, @@ -204,7 +207,7 @@ static const struct dsa_device_ops seville_netdev_ops = { }; DSA_TAG_DRIVER(seville_netdev_ops); -MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_SEVILLE); +MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_SEVILLE, SEVILLE_NAME); static struct dsa_tag_driver *ocelot_tag_driver_array[] = { &DSA_TAG_DRIVER_NAME(ocelot_netdev_ops), diff --git a/net/dsa/tag_ocelot_8021q.c b/net/dsa/tag_ocelot_8021q.c index 37ccf00404ea..d1ec68001487 100644 --- a/net/dsa/tag_ocelot_8021q.c +++ b/net/dsa/tag_ocelot_8021q.c @@ -12,6 +12,8 @@ #include #include "dsa_priv.h" +#define OCELOT_8021Q_NAME "ocelot-8021q" + struct ocelot_8021q_tagger_private { struct ocelot_8021q_tagger_data data; /* Must be first */ struct kthread_worker *xmit_worker; @@ -119,7 +121,7 @@ static int ocelot_connect(struct dsa_switch *ds) } static const struct dsa_device_ops ocelot_8021q_netdev_ops = { - .name = "ocelot-8021q", + .name = OCELOT_8021Q_NAME, .proto = DSA_TAG_PROTO_OCELOT_8021Q, .xmit = ocelot_xmit, .rcv = ocelot_rcv, @@ -130,6 +132,6 @@ static const struct dsa_device_ops ocelot_8021q_netdev_ops = { }; MODULE_LICENSE("GPL v2"); -MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_OCELOT_8021Q); +MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_OCELOT_8021Q, OCELOT_8021Q_NAME); module_dsa_tag_driver(ocelot_8021q_netdev_ops); diff --git a/net/dsa/tag_qca.c b/net/dsa/tag_qca.c index 57d2e00f1e5d..73d6e111228d 100644 --- a/net/dsa/tag_qca.c +++ b/net/dsa/tag_qca.c @@ -10,6 +10,8 @@ #include "dsa_priv.h" +#define QCA_NAME "qca" + static struct sk_buff *qca_tag_xmit(struct sk_buff *skb, struct net_device *dev) { struct dsa_port *dp = dsa_slave_to_port(dev); @@ -107,7 +109,7 @@ static void qca_tag_disconnect(struct dsa_switch *ds) } static const struct dsa_device_ops qca_netdev_ops = { - .name = "qca", + .name = QCA_NAME, .proto = DSA_TAG_PROTO_QCA, .connect = qca_tag_connect, .disconnect = qca_tag_disconnect, @@ -118,6 +120,6 @@ static const struct dsa_device_ops qca_netdev_ops = { }; MODULE_LICENSE("GPL"); -MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_QCA); +MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_QCA, QCA_NAME); module_dsa_tag_driver(qca_netdev_ops); diff --git a/net/dsa/tag_rtl4_a.c b/net/dsa/tag_rtl4_a.c index 6d928ee3ef7a..18b52d77d200 100644 --- a/net/dsa/tag_rtl4_a.c +++ b/net/dsa/tag_rtl4_a.c @@ -20,6 +20,8 @@ #include "dsa_priv.h" +#define RTL4_A_NAME "rtl4a" + #define RTL4_A_HDR_LEN 4 #define RTL4_A_ETHERTYPE 0x8899 #define RTL4_A_PROTOCOL_SHIFT 12 @@ -112,7 +114,7 @@ static struct sk_buff *rtl4a_tag_rcv(struct sk_buff *skb, } static const struct dsa_device_ops rtl4a_netdev_ops = { - .name = "rtl4a", + .name = RTL4_A_NAME, .proto = DSA_TAG_PROTO_RTL4_A, .xmit = rtl4a_tag_xmit, .rcv = rtl4a_tag_rcv, @@ -121,4 +123,4 @@ static const struct dsa_device_ops rtl4a_netdev_ops = { module_dsa_tag_driver(rtl4a_netdev_ops); MODULE_LICENSE("GPL"); -MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_RTL4_A); +MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_RTL4_A, RTL4_A_NAME); diff --git a/net/dsa/tag_rtl8_4.c b/net/dsa/tag_rtl8_4.c index a593ead7ff26..030a8cf0ad48 100644 --- a/net/dsa/tag_rtl8_4.c +++ b/net/dsa/tag_rtl8_4.c @@ -84,6 +84,9 @@ * 0x04 = RTL8365MB DSA protocol */ +#define RTL8_4_NAME "rtl8_4" +#define RTL8_4T_NAME "rtl8_4t" + #define RTL8_4_TAG_LEN 8 #define RTL8_4_PROTOCOL GENMASK(15, 8) @@ -234,7 +237,7 @@ static const struct dsa_device_ops rtl8_4_netdev_ops = { DSA_TAG_DRIVER(rtl8_4_netdev_ops); -MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_RTL8_4); +MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_RTL8_4, RTL8_4_NAME); /* Tail version */ static const struct dsa_device_ops rtl8_4t_netdev_ops = { @@ -247,7 +250,7 @@ static const struct dsa_device_ops rtl8_4t_netdev_ops = { DSA_TAG_DRIVER(rtl8_4t_netdev_ops); -MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_RTL8_4T); +MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_RTL8_4T, RTL8_4T_NAME); static struct dsa_tag_driver *dsa_tag_drivers[] = { &DSA_TAG_DRIVER_NAME(rtl8_4_netdev_ops), diff --git a/net/dsa/tag_rzn1_a5psw.c b/net/dsa/tag_rzn1_a5psw.c index e2a5ee6ae688..b9135069f9fc 100644 --- a/net/dsa/tag_rzn1_a5psw.c +++ b/net/dsa/tag_rzn1_a5psw.c @@ -22,6 +22,8 @@ * See struct a5psw_tag for layout */ +#define A5PSW_NAME "a5psw" + #define ETH_P_DSA_A5PSW 0xE001 #define A5PSW_TAG_LEN 8 #define A5PSW_CTRL_DATA_FORCE_FORWARD BIT(0) @@ -101,7 +103,7 @@ static struct sk_buff *a5psw_tag_rcv(struct sk_buff *skb, } static const struct dsa_device_ops a5psw_netdev_ops = { - .name = "a5psw", + .name = A5PSW_NAME, .proto = DSA_TAG_PROTO_RZN1_A5PSW, .xmit = a5psw_tag_xmit, .rcv = a5psw_tag_rcv, @@ -109,5 +111,5 @@ static const struct dsa_device_ops a5psw_netdev_ops = { }; MODULE_LICENSE("GPL v2"); -MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_A5PSW); +MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_A5PSW, A5PSW_NAME); module_dsa_tag_driver(a5psw_netdev_ops); diff --git a/net/dsa/tag_sja1105.c b/net/dsa/tag_sja1105.c index 83e4136516b0..3b6e642a90e9 100644 --- a/net/dsa/tag_sja1105.c +++ b/net/dsa/tag_sja1105.c @@ -7,6 +7,9 @@ #include #include "dsa_priv.h" +#define SJA1105_NAME "sja1105" +#define SJA1110_NAME "sja1110" + /* Is this a TX or an RX header? */ #define SJA1110_HEADER_HOST_TO_SWITCH BIT(15) @@ -786,7 +789,7 @@ static int sja1105_connect(struct dsa_switch *ds) } static const struct dsa_device_ops sja1105_netdev_ops = { - .name = "sja1105", + .name = SJA1105_NAME, .proto = DSA_TAG_PROTO_SJA1105, .xmit = sja1105_xmit, .rcv = sja1105_rcv, @@ -798,10 +801,10 @@ static const struct dsa_device_ops sja1105_netdev_ops = { }; DSA_TAG_DRIVER(sja1105_netdev_ops); -MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_SJA1105); +MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_SJA1105, SJA1105_NAME); static const struct dsa_device_ops sja1110_netdev_ops = { - .name = "sja1110", + .name = SJA1110_NAME, .proto = DSA_TAG_PROTO_SJA1110, .xmit = sja1110_xmit, .rcv = sja1110_rcv, @@ -813,7 +816,7 @@ static const struct dsa_device_ops sja1110_netdev_ops = { }; DSA_TAG_DRIVER(sja1110_netdev_ops); -MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_SJA1110); +MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_SJA1110, SJA1110_NAME); static struct dsa_tag_driver *sja1105_tag_driver_array[] = { &DSA_TAG_DRIVER_NAME(sja1105_netdev_ops), diff --git a/net/dsa/tag_trailer.c b/net/dsa/tag_trailer.c index 5749ba85c2b8..8754dfe680f6 100644 --- a/net/dsa/tag_trailer.c +++ b/net/dsa/tag_trailer.c @@ -10,6 +10,8 @@ #include "dsa_priv.h" +#define TRAILER_NAME "trailer" + static struct sk_buff *trailer_xmit(struct sk_buff *skb, struct net_device *dev) { struct dsa_port *dp = dsa_slave_to_port(dev); @@ -50,7 +52,7 @@ static struct sk_buff *trailer_rcv(struct sk_buff *skb, struct net_device *dev) } static const struct dsa_device_ops trailer_netdev_ops = { - .name = "trailer", + .name = TRAILER_NAME, .proto = DSA_TAG_PROTO_TRAILER, .xmit = trailer_xmit, .rcv = trailer_rcv, @@ -58,6 +60,6 @@ static const struct dsa_device_ops trailer_netdev_ops = { }; MODULE_LICENSE("GPL"); -MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_TRAILER); +MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_TRAILER, TRAILER_NAME); module_dsa_tag_driver(trailer_netdev_ops); diff --git a/net/dsa/tag_xrs700x.c b/net/dsa/tag_xrs700x.c index ff442b8af636..dc935dd90f98 100644 --- a/net/dsa/tag_xrs700x.c +++ b/net/dsa/tag_xrs700x.c @@ -9,6 +9,8 @@ #include "dsa_priv.h" +#define XRS700X_NAME "xrs700x" + static struct sk_buff *xrs700x_xmit(struct sk_buff *skb, struct net_device *dev) { struct dsa_port *partner, *dp = dsa_slave_to_port(dev); @@ -51,7 +53,7 @@ static struct sk_buff *xrs700x_rcv(struct sk_buff *skb, struct net_device *dev) } static const struct dsa_device_ops xrs700x_netdev_ops = { - .name = "xrs700x", + .name = XRS700X_NAME, .proto = DSA_TAG_PROTO_XRS700X, .xmit = xrs700x_xmit, .rcv = xrs700x_rcv, @@ -59,6 +61,6 @@ static const struct dsa_device_ops xrs700x_netdev_ops = { }; MODULE_LICENSE("GPL"); -MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_XRS700X); +MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_XRS700X, XRS700X_NAME); module_dsa_tag_driver(xrs700x_netdev_ops); From patchwork Tue Nov 15 01:18:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13043055 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 051F7C4332F for ; Tue, 15 Nov 2022 01:19:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235981AbiKOBTR (ORCPT ); Mon, 14 Nov 2022 20:19:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232159AbiKOBTG (ORCPT ); Mon, 14 Nov 2022 20:19:06 -0500 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70075.outbound.protection.outlook.com [40.107.7.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2DE6815825 for ; Mon, 14 Nov 2022 17:19:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DYH3A6rtTN4JdcO+G0NA56SoL67mRVF+zOrTeV/GU/31xPn1IgyjMw004Bfw1100xPnWDnEUJ5bjArdIiwZ5tahE7Uttg1TJ11yIOeNNr4uvuWpwJWcBnMjw7+WP44BIzG5iSM+RGHVVn6i0albxKHzLe+JYtYOt0ijPwtbh7rAo30CXrOnd/yBPa8v3o+w/6qm0yWTChkQlRaOpox3QvfFrtGOQTRl4dOUtwIJAJrr1WHcDk7vMithUNs3/LIiRlC7yZ5t+N02PNWirB62mavjlGi3bqp9+L1Ieub7siA0tVJcR1Ls/2E+AKyNHG7ItgCOaHIkkRuqasuEREDc6zA== 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=LCNUfh7YOdvwv3wlQPR+iqvpp+XCnhzc1VrkZreSfPM=; b=aTMEiE3p/34j6RN5WpdgDLQwfuqEeMNXEDF/6O1zHZvJYpnPRYBCsRRXez6De7sefSIodP7ufx4UEQnSpH8cGiPIkrKofLd15y/YbhOTSg6luGuY93FTAmB09HaDCmEz/72uxdWOQsawR+io/Gw8eP/IteIG3xi7HDJq9wvDx/SyNP9yK6RczDtfx57I9SDInDlcMoA6UZemSCN+BLQzA+UfxIeacT3fAcKV9EqQB2J2fb+9IhpY/HPm2TbzC2o0AYUqGBZw99HVTF1PFa5uxymQJdOJqkCaHsAKrRs+HkdL38sa35iEB4Uwq33NJprV/IZuNkY49Q3XDq1fDDuD+A== 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=LCNUfh7YOdvwv3wlQPR+iqvpp+XCnhzc1VrkZreSfPM=; b=Ctw0bEzKtFHc/E28iqJJpk9JQc2nWyA/8rxhgepJZdfZkqQUrbhQQLlD7B33VCTkhxZi8eLE7UHbL25hwHhhrBaQ6tCksnANHkUtoJznLcQj+AeuyCzJ5J/IseXxTIqHcIwcS7vrQ4MyKmjyDGHlF3xg2kRKbsBzTHZwL44zmnI= 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 AS8PR04MB7815.eurprd04.prod.outlook.com (2603:10a6:20b:28a::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5813.16; Tue, 15 Nov 2022 01:19:02 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::9317:77dc:9be2:63b]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::9317:77dc:9be2:63b%7]) with mapi id 15.20.5813.018; Tue, 15 Nov 2022 01:19:01 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Michael Walle , Heiko Thiery Subject: [PATCH v2 net-next 4/6] net: dsa: strip sysfs "tagging" string of trailing newline Date: Tue, 15 Nov 2022 03:18:45 +0200 Message-Id: <20221115011847.2843127-5-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221115011847.2843127-1-vladimir.oltean@nxp.com> References: <20221115011847.2843127-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AS4P191CA0006.EURP191.PROD.OUTLOOK.COM (2603:10a6:20b:5d5::17) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5136:EE_|AS8PR04MB7815:EE_ X-MS-Office365-Filtering-Correlation-Id: 47ceeb32-c12a-4ff5-8b9d-08dac6a76111 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gGTxkhfzWH/sB/aJRuZDxpA3fZ660eO8c7YUHPR8URA5/2GtWICcVY++wH044TF7U1qS5l1hvbPK9WGF0hQXmY0Dv0qtcMLzpi7abFExA+BpT/LJ3iwZngkW4uRTc3zId4+8lkC6YzM7jOFpZqMsrSpnSQjOv26Qs6T2SaNzi6QbdRgAf5IdkTeBq7MwjLFvD0DooS1zttdBRKjjRwI7TDAm14/nNEkGyaPcrpxZp6jKwd7Q3hdk9/C6+n0TC8nQjyXehrm5n9hRhtR9auDv/2vjrvJmX0SKyZbxZnFtfAm2cJ2W7X9PukE98uHM3x8BdNkpE7Rav8Qo2eIykBABr7u1SAfL/FAly8UZ+E8Ee3TkMRw0j7nmTZr/p4evJ1jCNTo5d0BDuMO3+bEJ9XVsX8BOtLrkKxMwoHAPqZQwhOxsdT7ANseMLmOcRuSVs+vBPRXGOi9yrAnR1QsKAEXSZljLalIr1q8+NMFF5F4nDKnUeRBsb7inh4bZxjFqdI/QRk3T0rJnZXw0irTGyadIGkW702DLTmgIdDvAhUvxhvSAAje9mlfkZQhWge+LmWviFZnu07/D+UTWKv5fUzY3RQz/wTlCTL17hvvQ4gNNsQi6V4I0CVMUkOubmDchYQrsd7nr1H2nLhoGQlZzNQRVORrP8+B6bzPh6DLIMEwUAmGkNqigNk3wviS9tMj0S2IdqpfPaEhZkZGIYNZmmHVpSrxk4HG30Z7PUTKIjoXxxoCVMYYgxYJTxUeGeWLthzg1JSc2yR5BNEQ0J7UG+OvXOQ== 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)(366004)(396003)(39860400002)(346002)(376002)(136003)(451199015)(66556008)(86362001)(316002)(6916009)(4326008)(7416002)(8936002)(8676002)(36756003)(5660300002)(41300700001)(44832011)(66946007)(66476007)(2616005)(6512007)(38350700002)(54906003)(38100700002)(478600001)(186003)(83380400001)(6486002)(26005)(6506007)(52116002)(6666004)(1076003)(2906002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Ew5WCeDzbsVLNmP7AX2zUf4zxo7lqeUHrtaQL7RSvwzbqAYiHlakI0SShbmDhS2m2xn62wvTeimmgJGZuZAPWMqwdCsi5VWxOhYgJjLYZFzBav6yS6GyJ9bX0pitpdX87zFI71VVxAw5XHiKqSnks0MZ4h8ohl7jfJ6/DDiXiZ7+gW/OXeq/O9fVsgsDhEgM+kjFlwO7TK1yAKKVXKUCJiZx1Vprg7cNIfFF4GR+f1ks+MuMwMAB684ofNbJWAU45OP7MFiW89rHvYNgzHx0t9ncz4ipS+jg8R/tMxaEHB8b4uxLpxyI8O/LIim+hWNZn2M1e4s5q0anhTGdEo5UOgADgK0lKnDrG2PYdHTFJMNBI2XX52p8s5wvfmi+bJNTGENvTlgt2Aef+u3YJF99wDRiQhOY4lRScl9Bu0tqULv1+straYIZ6yoZntLZFAY1pdfNB7msuHklxWh73u6aK8VURlT0d4TbB1ZXIbz/+7Vhsa2YsM9g4F1lamt7fZ7mafUP98szIYLIhPasY0eP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76jQ76/yYBr50A== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 47ceeb32-c12a-4ff5-8b9d-08dac6a76111 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Nov 2022 01:19:01.8286 (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: VEd59SH6mG6f1fH4st1SyWmllDbakLlcezQa7G3GT+Mxw7Zo1irm/Ce6lIoNNUF57Okk5cTu6y+26QMbVPsW9Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB7815 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Currently, dsa_find_tagger_by_name() uses sysfs_streq() which works both with strings that contain \n at the end (echo ocelot > .../dsa/tagging) and with strings that don't (printf ocelot > .../dsa/tagging). There will be a problem once we'll want to construct the modalias string based on which we auto-load the protocol kernel module. If the sysfs buffer ends in a newline, we need to strip it first. This is a preparatory patch specifically for that. Signed-off-by: Vladimir Oltean --- v1->v2: patch is new net/dsa/dsa.c | 4 ++-- net/dsa/dsa_priv.h | 2 +- net/dsa/master.c | 13 ++++++++++++- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c index 38c64cc5c0d2..e0ea5b309e61 100644 --- a/net/dsa/dsa.c +++ b/net/dsa/dsa.c @@ -78,7 +78,7 @@ const char *dsa_tag_protocol_to_str(const struct dsa_device_ops *ops) /* Function takes a reference on the module owning the tagger, * so dsa_tag_driver_put must be called afterwards. */ -const struct dsa_device_ops *dsa_find_tagger_by_name(const char *buf) +const struct dsa_device_ops *dsa_find_tagger_by_name(const char *name) { const struct dsa_device_ops *ops = ERR_PTR(-ENOPROTOOPT); struct dsa_tag_driver *dsa_tag_driver; @@ -87,7 +87,7 @@ const struct dsa_device_ops *dsa_find_tagger_by_name(const char *buf) list_for_each_entry(dsa_tag_driver, &dsa_tag_drivers_list, list) { const struct dsa_device_ops *tmp = dsa_tag_driver->ops; - if (!sysfs_streq(buf, tmp->name)) + if (strcmp(name, tmp->name)) continue; if (!try_module_get(dsa_tag_driver->owner)) diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h index b4b8fe4ed9bf..9fe68d3ae2f5 100644 --- a/net/dsa/dsa_priv.h +++ b/net/dsa/dsa_priv.h @@ -245,7 +245,7 @@ struct dsa_slave_priv { /* dsa.c */ const struct dsa_device_ops *dsa_tag_driver_get(int tag_protocol); void dsa_tag_driver_put(const struct dsa_device_ops *ops); -const struct dsa_device_ops *dsa_find_tagger_by_name(const char *buf); +const struct dsa_device_ops *dsa_find_tagger_by_name(const char *name); bool dsa_db_equal(const struct dsa_db *a, const struct dsa_db *b); diff --git a/net/dsa/master.c b/net/dsa/master.c index 40367ab41cf8..104eab880076 100644 --- a/net/dsa/master.c +++ b/net/dsa/master.c @@ -300,12 +300,23 @@ static ssize_t tagging_store(struct device *d, struct device_attribute *attr, const char *buf, size_t count) { const struct dsa_device_ops *new_tag_ops, *old_tag_ops; + const char *end = strchrnul(buf, '\n'), *name; struct net_device *dev = to_net_dev(d); struct dsa_port *cpu_dp = dev->dsa_ptr; + size_t len = end - buf; int err; + /* Empty string passed */ + if (!len) + return -ENOPROTOOPT; + + name = kstrndup(buf, len, GFP_KERNEL); + if (!name) + return -ENOMEM; + old_tag_ops = cpu_dp->tag_ops; - new_tag_ops = dsa_find_tagger_by_name(buf); + new_tag_ops = dsa_find_tagger_by_name(name); + kfree(name); /* Bad tagger name, or module is not loaded? */ if (IS_ERR(new_tag_ops)) return PTR_ERR(new_tag_ops); From patchwork Tue Nov 15 01:18:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13043056 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 561F9C4332F for ; Tue, 15 Nov 2022 01:19:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232223AbiKOBTT (ORCPT ); Mon, 14 Nov 2022 20:19:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232124AbiKOBTO (ORCPT ); Mon, 14 Nov 2022 20:19:14 -0500 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70075.outbound.protection.outlook.com [40.107.7.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 82A7417E10 for ; Mon, 14 Nov 2022 17:19:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Pjs7QjDwk/r3RFiFTumqG/kJzc6J6rv/aZ2PxxgV8IeZtbuU7zfk6yYOdUcTkvXK6nChvZX4hpyNNBWbBWBXxPid4+XU9RafwVHGq1YDNvINcc4LIBHo32xuthwiVC42Mtlp5KxJw5FtrKv6dCn3OmaRENuy1dc0r8ynWChjFnY69Y422D+y5sK+oKsVm19xCfxUGJNY3DkG5y8wyYcj14/V3nm3aQE1iG6CkiqMmGKqzm1hgiPdDs/GASyvzGmxLlRkfwH+GjmqSD7WMJ240BrtW9HUNTel8XDO1X94BA+IhWBk74YsI+iBAIMRZeyRHz8AlgiqLI2kFPupnKLQJA== 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=48sYji7v5eu9xcrE/QeRVEsz88ardifB46uZI5IQcIw=; b=jpyHtGkRakP+4z/owDn+iHnlhj1mLWN7WtnpPk4iATUNol2cjDmN0poosiWpHf/1EwBwYMsEYpSkoyHgBmDrIJFRzXz2aoD2OPQxoWafSeM5Ro6KAaIP860uhtmb3AH2hgnwoZu6LXHOU9fnOQKag/xJQJfXZDezgN6sk3PAUP+92EOjPDOsFCWXNmJMoTmrWsQ2UH4Z0zkq66JgW3ORA93v0KqpEOFNcxO3Zgm3OcqtB/PjIrw/XBraBpznIDm5P8P1V9dwCMkpsfO1P6HWfGjhmLnWLOoZGV0hkM+DMe/eqOPesQ5ithahWTnxu5iA5jCm7PST8tdgvVTzmPLk8Q== 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=48sYji7v5eu9xcrE/QeRVEsz88ardifB46uZI5IQcIw=; b=EebnQzWl/spNef+oYKxX3bVNyFxbfPFhbI6dUXw4tSwrpNaYAMH/5BDsL5WilbInq/V8qYdiEl70xDZWy/w6tCTweHlP21Ukpr/W1DbDwxN2fS8JaTK6ek//fKXUJIXlt+tEs+ZnJm+Op1GBb99Jjpu05H3Za00Ih8sZucECQtQ= 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 AS8PR04MB7815.eurprd04.prod.outlook.com (2603:10a6:20b:28a::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5813.16; Tue, 15 Nov 2022 01:19:03 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::9317:77dc:9be2:63b]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::9317:77dc:9be2:63b%7]) with mapi id 15.20.5813.018; Tue, 15 Nov 2022 01:19:03 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Michael Walle , Heiko Thiery Subject: [PATCH v2 net-next 5/6] net: dsa: rename dsa_tag_driver_get() to dsa_tag_driver_get_by_id() Date: Tue, 15 Nov 2022 03:18:46 +0200 Message-Id: <20221115011847.2843127-6-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221115011847.2843127-1-vladimir.oltean@nxp.com> References: <20221115011847.2843127-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AS4P191CA0006.EURP191.PROD.OUTLOOK.COM (2603:10a6:20b:5d5::17) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5136:EE_|AS8PR04MB7815:EE_ X-MS-Office365-Filtering-Correlation-Id: 9ddd1aae-9da9-45c2-f66d-08dac6a761c1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZVQ6r8TShMJ9iI5ACR6f6Yb5UR8O3k6CMOjrC9vIx6jdEqN8CBFZ+HR97wKHWwUDa08U/pwtBZytO90ddQFOHLkESx4vTShEbetddID/T+VenvV7sB7kkLiHIop1I0jhPzbMJCueztYjMHvXOd+Vg9rnO9QThUL/4r5BTf4PAuKm9hYliEA/V3MOvMvLUxeoz0Ki60Z9MbmqCW5dmtGOOK5Lbv96W4gqTwD4xo+UHnPHO3XJPuykugK4a6FGDu4qjh+OYCCzpCzP9tnoqKpCEZ2LifPsvxXsESGh9GPQeFlTletgfatDW8A64vOCWN6KkX/Exnka/iCt9kqaP+NVA/BbaGZtpNPt57gaqa0A9pLWxFtejmkRq4pOu2jtAK6E/RA0xxGhFEoVnEQGIBhM7q3Q9aO3gRloON235tEukC+4w0qaaKTYMb8RAbQ3ly0mi09mgDYk+y9l1q7FtgWDKNhIH2XVP/JbNT2sUVtNflGuSxGhkKnKsqyCuvvu6NTjOQ7+Uf8bXD1GXaCzHIzBUaj9pokSIJc6NKfc+eCF/hxOhf7K3UCj2Sg/Abzz05JrRU7wDz/rKR1CMjMEUGytyUWwUJPptMeL9uVdWCeiN+tD29TwjM8J2ho5NZ6yn10D5YU9TXNEH+9xvLtjcSEYgnjqg40wjMFZWDuKKrt1azOQ+uVJk7c9+PHpSpr7S0OBfSOl5qoSTg3kXdaarUX5R9TosjvhAFlWZKLP574ZNxvUiRFQMJXCI57dGtijcENdjJIeE2hVD9Kf8iAHloGfcw== 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)(366004)(396003)(39860400002)(346002)(376002)(136003)(451199015)(66556008)(86362001)(316002)(6916009)(4326008)(7416002)(8936002)(8676002)(36756003)(5660300002)(41300700001)(44832011)(66946007)(66476007)(2616005)(6512007)(38350700002)(54906003)(38100700002)(478600001)(186003)(83380400001)(6486002)(26005)(6506007)(52116002)(6666004)(1076003)(2906002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: DNuXHWV3x7799+IU47lP07x7UR6yQ3JW/6Uy5VUresjKzjpE9RlK4uIX7ItyqpaOsCKzJdneFZZClKNV1wH60t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lND8yBdIJhIuVpPKp7B46waHR0auHQhkF6LEUqYtAUlQa5JwvopCgBO1Z+ae9EVlT7UCC5GcWQS31iSLRyoPkMXmr7FSTYxdHqHMFTkTO24XVTvlwoNy8sN8KUzIZ+M4/JfXlOf9fFrbImQrTSFO9gm8YcErSuDqjJD0+Lx8I/NqcmPCdw+iJZlLqpiPOTLH2sopO2utkfGxsQnr4EB8nyzWcS+FHVBIrps/IRRV/2TwRUuuVMjhx2q4UHfaJ36zlGdVIsBJ21lJHRqGt5rqDaSy5XfrvFyBRkdbH7OONPVulEMzw5igaIG7JJTTn3zjwduNKj6dk0Y/mLfgBwUrJW0B1oc6QCOW65MAFhOfivMY3peO3BRWr4Ivv2RTzQhe8BHTEV2zFj5N/nzTMBVeT71Xjkbd1wqVf5ZjGMMxiaWOa2Xa3oE/ehKUr5OA8C525yDuqIoe9RIK+LpJVA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9ddd1aae-9da9-45c2-f66d-08dac6a761c1 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Nov 2022 01:19:03.0004 (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: PNlJEuP5zEwp7qqeXyUdTT3CaS+gSUpWKxHCsPb2VlPX0fWGFFxKx+BICN3Ksf6TKPdeDVCAGD6Gy9zywr4XJA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB7815 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org A future patch will introduce one more way of getting a reference on a tagging protocl driver (by name). Rename the current method to "by_id". Signed-off-by: Vladimir Oltean --- v1->v2: split from previous patch 3/3 net/dsa/dsa.c | 2 +- net/dsa/dsa2.c | 2 +- net/dsa/dsa_priv.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c index e0ea5b309e61..d51b81cc196c 100644 --- a/net/dsa/dsa.c +++ b/net/dsa/dsa.c @@ -101,7 +101,7 @@ const struct dsa_device_ops *dsa_find_tagger_by_name(const char *name) return ops; } -const struct dsa_device_ops *dsa_tag_driver_get(int tag_protocol) +const struct dsa_device_ops *dsa_tag_driver_get_by_id(int tag_protocol) { struct dsa_tag_driver *dsa_tag_driver; const struct dsa_device_ops *ops; diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c index b80dbd02e154..9920eed0c654 100644 --- a/net/dsa/dsa2.c +++ b/net/dsa/dsa2.c @@ -1434,7 +1434,7 @@ static int dsa_port_parse_cpu(struct dsa_port *dp, struct net_device *master, } if (!tag_ops) - tag_ops = dsa_tag_driver_get(default_proto); + tag_ops = dsa_tag_driver_get_by_id(default_proto); if (IS_ERR(tag_ops)) { if (PTR_ERR(tag_ops) == -ENOPROTOOPT) diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h index 9fe68d3ae2f5..e128095f9e65 100644 --- a/net/dsa/dsa_priv.h +++ b/net/dsa/dsa_priv.h @@ -243,7 +243,7 @@ struct dsa_slave_priv { }; /* dsa.c */ -const struct dsa_device_ops *dsa_tag_driver_get(int tag_protocol); +const struct dsa_device_ops *dsa_tag_driver_get_by_id(int tag_protocol); void dsa_tag_driver_put(const struct dsa_device_ops *ops); const struct dsa_device_ops *dsa_find_tagger_by_name(const char *name); From patchwork Tue Nov 15 01:18:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13043057 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5616BC433FE for ; Tue, 15 Nov 2022 01:19:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235675AbiKOBTV (ORCPT ); Mon, 14 Nov 2022 20:19:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232194AbiKOBTP (ORCPT ); Mon, 14 Nov 2022 20:19:15 -0500 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70075.outbound.protection.outlook.com [40.107.7.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8DF99186C9 for ; Mon, 14 Nov 2022 17:19:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=e/AC82sGsVjLkK7/vEbBWKphk3cVLh9gn7HqtzCRJOsDoD3S7xNonGJnmEISGVsaChTLiCRhqWyfDs5KMBdJN6eEJ6SiMM5jtllFWaEfLUKiwsYS/xT4hPHp9JM569wQnT4jW9zPsjFziFr2MV1VqlYR7RaPK5ksJuM1JPXfFGuhu/tf/zqZe0pUhLPj3cY7ps/yWvOPxWOot+0gcR7enxQ9Rp3HHnHeOqEqAa+TkhmpcyTPf0g6PcbmCanLaZ2/nTGoiDKCMmC4NAWpsYOwFm5h3gjP7rMNw5x79LyC1NDhZEtHx3Z1M2uVS/5PR19uU6dXnH5+gAJ4DTKBGoxN1g== 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=9aZhbjeLIe426QGapPcbB1YXKE+rnddTiXIZ5tl1JTI=; b=KuFg2fO1SZZecOVFSxYa3wL5mzVs9RyoK2WmLKbz8UcCbCSd0HrHP5wJyeAGhGtSaUmMjZGb4Bmhli40FoVSr309o/fXuK454S4ItYvlrYHlpQ1R0ydDAG/MvYPbYabUMF5VNH0dKEpZ+X5pJHE16OUTnmy44I0dyEehXQradN/luv8VFqxZBZT+lYE9ZTX0FlhUME+lPmiXC0ne7Lc+h6W77nyF5TLkcF7P7qUM0BzSTeNZl5/cNfY+SH+ZDsbI850EGX1SkSMg1nM/zqMsueStW4UoYy6pFBVWTh+7yrRfJI4mcLTL/OpyZgX4swUJV4/qlo+OSJxfc8ok5IFb5g== 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=9aZhbjeLIe426QGapPcbB1YXKE+rnddTiXIZ5tl1JTI=; b=CD8WgrKaW8+cfELHFhPcQ3smvQxm5A+v+JozOnjIsvpjjdDM8iGNpb7lD8tWqGhZS4sCVcqKT850QLXp6rjGvo5mkSSjIEFLUxJXqruxsVNMRTSWFQ8k6onyjiW5tM5T4m8J/oMvBZ8K8LOl8Rds6zyE64J253K6eSXDhPlLHUw= 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 AS8PR04MB7815.eurprd04.prod.outlook.com (2603:10a6:20b:28a::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5813.16; Tue, 15 Nov 2022 01:19:04 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::9317:77dc:9be2:63b]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::9317:77dc:9be2:63b%7]) with mapi id 15.20.5813.018; Tue, 15 Nov 2022 01:19:04 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Michael Walle , Heiko Thiery Subject: [PATCH v2 net-next 6/6] net: dsa: autoload tag driver module on tagging protocol change Date: Tue, 15 Nov 2022 03:18:47 +0200 Message-Id: <20221115011847.2843127-7-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221115011847.2843127-1-vladimir.oltean@nxp.com> References: <20221115011847.2843127-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AS4P191CA0006.EURP191.PROD.OUTLOOK.COM (2603:10a6:20b:5d5::17) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5136:EE_|AS8PR04MB7815:EE_ X-MS-Office365-Filtering-Correlation-Id: 1aa79189-3f93-4e87-6142-08dac6a76272 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QgEcb5WEKyo22u+XEfzG6qTmdz1H3ZVkmK2F6upiQsfVWS63LQN6dCb22Ddh3kpl7PwnGXw6QDl84ROLupEyJaN+sebE6hLLIewjNDKIltgLY53TNX3RKZWHFWsP0XF3LflGRs2M7Nw3/sPv0O3QhOzFupJ3HatiqnOkphAzHFRn0MI315iGlHk219p5W+x7QfbnvbuHSsRY+VSjnwm2yhFOK7z7tfWsUiGetJX6d3JqhZkbYg6OSd2S6OB67TVS5BpcboqTM6Ls0EN0sJkb374dSaitGwJqXETNPOCY4hPUmb2YrEUsZGO2S+g3U4NJO1xTZJ3Htn9D38R1JUhYaF2zBLElaamm3WReU42ujyT8/V83W/X+qmjDPYWbk0sRnznPNbNfSZlflDS7PjWKoGxF6H1fpcbmYpyQBcdzgSyeqGQ8v8Z84AFqw86dK5gNfmxtu7Kl8M4rGgMIAVs7pWqiUTgRguazGijdkjKuFQAypZjeo8qjGV1BEeKJa3sS+pFYzk3ygP6Amgp0ZqPia2OOh2qg/E2gduN06H1Ly7bA5BG7H+Ff80R+zmflK1fi9LIAXeX8KYtLRhCEb5WOW07KR9+hd5WRm3dfIfVe8BY3ztJlx8mDHK9+T1rmQqh32sWj2hJAUKpDNWxMewB6tdhTSmf9+YwEiJGKElg0NyaZ6KmYuCWZg03K+iziF/tdmv5ZKxv8mqbbyudAyTdMdgirLdXkn96WMl3XID03tTti3NLI285JbfHpWmgbKe4lIORAX7S9d+F90OfQGN12azrBJczuIZKpqFfe2h6F9Sk= 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)(366004)(396003)(39860400002)(346002)(376002)(136003)(451199015)(66556008)(86362001)(316002)(6916009)(4326008)(7416002)(8936002)(8676002)(36756003)(5660300002)(41300700001)(44832011)(66946007)(66476007)(2616005)(6512007)(38350700002)(54906003)(38100700002)(478600001)(186003)(83380400001)(6486002)(966005)(26005)(6506007)(52116002)(6666004)(1076003)(2906002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: X739IUw+9n1UlOgwZr9jypCWc5VNLUN+OnJKOaf94xzJ/HFg7PmzNE99+IXA6q6L9a4horLnDHlmGRR+MWObrgq7fc81XCj+001x5uiSgUfutBc1F7pdY293yAODcJuLZe2SQMJ++WOxQX/h2YX6X8MoeeFEpCeKNcmG2L1+crme5iMB5A6lD3n+tw86ClmxF78iwU4eZinygXFc4oMrFFea1DdDVMMNmYGogvk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wCbgrWLxyl9vKSZIUHKOi7reSPWaFcvpkCGVlky1tdU+RbgiOozu+CfEa/G820yB3UuK1d2M2/EPuAeBNBNRMYWUDX/EWIXzsvKgL9QL/OWG+16SspPrMATwSOzWRDjy9DtVOTBi9VjCuR6WtqSAdjikpAdkr1jQsz2u/hbOizlF5DrLiMVMVG5hn0XcmFO45gM/jjItG6ILxrvpXB+9nCslfP9Fmc86nBD8Y1+qfH+jZhhIMLT/NKfx6opkrOBX/bJE5hmecIbsCjCa1pj7ZRkyDocRgkx7xT6pl4A== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1aa79189-3f93-4e87-6142-08dac6a76272 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Nov 2022 01:19:04.1722 (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: o9jl01ido/lEF5/VwgZLllC3OWkbsOnNcok+TyOr5BvF+ad/PjZWnWk12C5NBJGv81TH58Lea10RIB/ZUuEeKg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB7815 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Issue a request_module() call when an attempt to change the tagging protocol is made, either by sysfs or by device tree. In the case of ocelot (the only driver for which the default and the alternative tagging protocol are compiled as different modules), the user is now no longer required to insert tag_ocelot_8021q.ko manually. In the particular case of ocelot, this solves a problem where tag_ocelot_8021q.ko is built as module, and this is present in the device tree: &mscc_felix_port4 { dsa-tag-protocol = "ocelot-8021q"; }; &mscc_felix_port5 { dsa-tag-protocol = "ocelot-8021q"; }; Because no one attempts to load the module into the kernel at boot time, the switch driver will fail to probe (actually forever defer) until someone manually inserts tag_ocelot_8021q.ko. This is now no longer necessary and happens automatically. Rename dsa_find_tagger_by_name() to denote the change in functionality: there is now feature parity with dsa_tag_driver_get_by_id(), i.o.w. we also load the module if it's missing. Link: https://lore.kernel.org/lkml/20221027113248.420216-1-michael@walle.cc/ Suggested-by: Michael Walle Signed-off-by: Vladimir Oltean Tested-by: Michael Walle # on kontron-sl28 w/ ocelot_8021q --- v1->v2: - don't call request_module() with sysfs-formatted names that end in '\n' net/dsa/dsa.c | 4 +++- net/dsa/dsa2.c | 2 +- net/dsa/dsa_priv.h | 2 +- net/dsa/master.c | 4 ++-- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c index d51b81cc196c..857d07c6d0cb 100644 --- a/net/dsa/dsa.c +++ b/net/dsa/dsa.c @@ -78,11 +78,13 @@ const char *dsa_tag_protocol_to_str(const struct dsa_device_ops *ops) /* Function takes a reference on the module owning the tagger, * so dsa_tag_driver_put must be called afterwards. */ -const struct dsa_device_ops *dsa_find_tagger_by_name(const char *name) +const struct dsa_device_ops *dsa_tag_driver_get_by_name(const char *name) { const struct dsa_device_ops *ops = ERR_PTR(-ENOPROTOOPT); struct dsa_tag_driver *dsa_tag_driver; + request_module("%s%s", DSA_TAG_DRIVER_ALIAS, name); + mutex_lock(&dsa_tag_drivers_lock); list_for_each_entry(dsa_tag_driver, &dsa_tag_drivers_list, list) { const struct dsa_device_ops *tmp = dsa_tag_driver->ops; diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c index 9920eed0c654..1bcf8a2d4a95 100644 --- a/net/dsa/dsa2.c +++ b/net/dsa/dsa2.c @@ -1424,7 +1424,7 @@ static int dsa_port_parse_cpu(struct dsa_port *dp, struct net_device *master, return -EINVAL; } - tag_ops = dsa_find_tagger_by_name(user_protocol); + tag_ops = dsa_tag_driver_get_by_name(user_protocol); if (IS_ERR(tag_ops)) { dev_warn(ds->dev, "Failed to find a tagging driver for protocol %s, using default\n", diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h index e128095f9e65..d2fefc40bc7a 100644 --- a/net/dsa/dsa_priv.h +++ b/net/dsa/dsa_priv.h @@ -244,8 +244,8 @@ struct dsa_slave_priv { /* dsa.c */ const struct dsa_device_ops *dsa_tag_driver_get_by_id(int tag_protocol); +const struct dsa_device_ops *dsa_tag_driver_get_by_name(const char *name); void dsa_tag_driver_put(const struct dsa_device_ops *ops); -const struct dsa_device_ops *dsa_find_tagger_by_name(const char *name); bool dsa_db_equal(const struct dsa_db *a, const struct dsa_db *b); diff --git a/net/dsa/master.c b/net/dsa/master.c index 104eab880076..56ed7af89ac3 100644 --- a/net/dsa/master.c +++ b/net/dsa/master.c @@ -315,9 +315,9 @@ static ssize_t tagging_store(struct device *d, struct device_attribute *attr, return -ENOMEM; old_tag_ops = cpu_dp->tag_ops; - new_tag_ops = dsa_find_tagger_by_name(name); + new_tag_ops = dsa_tag_driver_get_by_name(name); kfree(name); - /* Bad tagger name, or module is not loaded? */ + /* Bad tagger name? */ if (IS_ERR(new_tag_ops)) return PTR_ERR(new_tag_ops);