mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-23 08:35:19 -05:00
net: dsa: modularize DSA_TAG_PROTO_NONE
There is no reason that I can see why the no-op tagging protocol should be registered manually, so make it a module and make all drivers which have any sort of reference to DSA_TAG_PROTO_NONE select it. Note that I don't know if ksz_get_tag_protocol() really needs this, or if it's just the logic which is poorly written. All switches seem to have their own tagging protocol, and DSA_TAG_PROTO_NONE is just a fallback that never gets used. Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
c5fb8ead32
commit
d2be320495
8 changed files with 41 additions and 22 deletions
|
@ -18,6 +18,7 @@ config NET_DSA_BCM_SF2
|
||||||
|
|
||||||
config NET_DSA_LOOP
|
config NET_DSA_LOOP
|
||||||
tristate "DSA mock-up Ethernet switch chip support"
|
tristate "DSA mock-up Ethernet switch chip support"
|
||||||
|
select NET_DSA_TAG_NONE
|
||||||
select FIXED_PHY
|
select FIXED_PHY
|
||||||
help
|
help
|
||||||
This enables support for a fake mock-up switch chip which
|
This enables support for a fake mock-up switch chip which
|
||||||
|
@ -99,6 +100,7 @@ config NET_DSA_SMSC_LAN9303_MDIO
|
||||||
|
|
||||||
config NET_DSA_VITESSE_VSC73XX
|
config NET_DSA_VITESSE_VSC73XX
|
||||||
tristate
|
tristate
|
||||||
|
select NET_DSA_TAG_NONE
|
||||||
select FIXED_PHY
|
select FIXED_PHY
|
||||||
select VITESSE_PHY
|
select VITESSE_PHY
|
||||||
select GPIOLIB
|
select GPIOLIB
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
menuconfig B53
|
menuconfig B53
|
||||||
tristate "Broadcom BCM53xx managed switch support"
|
tristate "Broadcom BCM53xx managed switch support"
|
||||||
depends on NET_DSA
|
depends on NET_DSA
|
||||||
|
select NET_DSA_TAG_NONE
|
||||||
select NET_DSA_TAG_BRCM
|
select NET_DSA_TAG_BRCM
|
||||||
select NET_DSA_TAG_BRCM_LEGACY
|
select NET_DSA_TAG_BRCM_LEGACY
|
||||||
select NET_DSA_TAG_BRCM_PREPEND
|
select NET_DSA_TAG_BRCM_PREPEND
|
||||||
|
|
|
@ -3,6 +3,7 @@ menuconfig NET_DSA_MICROCHIP_KSZ_COMMON
|
||||||
tristate "Microchip KSZ8795/KSZ9477/LAN937x series switch support"
|
tristate "Microchip KSZ8795/KSZ9477/LAN937x series switch support"
|
||||||
depends on NET_DSA
|
depends on NET_DSA
|
||||||
select NET_DSA_TAG_KSZ
|
select NET_DSA_TAG_KSZ
|
||||||
|
select NET_DSA_TAG_NONE
|
||||||
help
|
help
|
||||||
This driver adds support for Microchip KSZ9477 series switch and
|
This driver adds support for Microchip KSZ9477 series switch and
|
||||||
KSZ8795/KSZ88x3 switch chips.
|
KSZ8795/KSZ88x3 switch chips.
|
||||||
|
|
|
@ -18,6 +18,12 @@ if NET_DSA
|
||||||
|
|
||||||
# Drivers must select the appropriate tagging format(s)
|
# Drivers must select the appropriate tagging format(s)
|
||||||
|
|
||||||
|
config NET_DSA_TAG_NONE
|
||||||
|
tristate "No-op tag driver"
|
||||||
|
help
|
||||||
|
Say Y or M if you want to enable support for switches which don't tag
|
||||||
|
frames over the CPU port.
|
||||||
|
|
||||||
config NET_DSA_TAG_AR9331
|
config NET_DSA_TAG_AR9331
|
||||||
tristate "Tag driver for Atheros AR9331 SoC with built-in switch"
|
tristate "Tag driver for Atheros AR9331 SoC with built-in switch"
|
||||||
help
|
help
|
||||||
|
|
|
@ -20,6 +20,7 @@ obj-$(CONFIG_NET_DSA_TAG_HELLCREEK) += tag_hellcreek.o
|
||||||
obj-$(CONFIG_NET_DSA_TAG_KSZ) += tag_ksz.o
|
obj-$(CONFIG_NET_DSA_TAG_KSZ) += tag_ksz.o
|
||||||
obj-$(CONFIG_NET_DSA_TAG_LAN9303) += tag_lan9303.o
|
obj-$(CONFIG_NET_DSA_TAG_LAN9303) += tag_lan9303.o
|
||||||
obj-$(CONFIG_NET_DSA_TAG_MTK) += tag_mtk.o
|
obj-$(CONFIG_NET_DSA_TAG_MTK) += tag_mtk.o
|
||||||
|
obj-$(CONFIG_NET_DSA_TAG_NONE) += tag_none.o
|
||||||
obj-$(CONFIG_NET_DSA_TAG_OCELOT) += tag_ocelot.o
|
obj-$(CONFIG_NET_DSA_TAG_OCELOT) += tag_ocelot.o
|
||||||
obj-$(CONFIG_NET_DSA_TAG_OCELOT_8021Q) += tag_ocelot_8021q.o
|
obj-$(CONFIG_NET_DSA_TAG_OCELOT_8021Q) += tag_ocelot_8021q.o
|
||||||
obj-$(CONFIG_NET_DSA_TAG_QCA) += tag_qca.o
|
obj-$(CONFIG_NET_DSA_TAG_QCA) += tag_qca.o
|
||||||
|
|
|
@ -18,22 +18,6 @@
|
||||||
static LIST_HEAD(dsa_tag_drivers_list);
|
static LIST_HEAD(dsa_tag_drivers_list);
|
||||||
static DEFINE_MUTEX(dsa_tag_drivers_lock);
|
static DEFINE_MUTEX(dsa_tag_drivers_lock);
|
||||||
|
|
||||||
static struct sk_buff *dsa_slave_notag_xmit(struct sk_buff *skb,
|
|
||||||
struct net_device *dev)
|
|
||||||
{
|
|
||||||
/* Just return the original SKB */
|
|
||||||
return skb;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const struct dsa_device_ops none_ops = {
|
|
||||||
.name = "none",
|
|
||||||
.proto = DSA_TAG_PROTO_NONE,
|
|
||||||
.xmit = dsa_slave_notag_xmit,
|
|
||||||
.rcv = NULL,
|
|
||||||
};
|
|
||||||
|
|
||||||
DSA_TAG_DRIVER(none_ops);
|
|
||||||
|
|
||||||
static void dsa_tag_driver_register(struct dsa_tag_driver *dsa_tag_driver,
|
static void dsa_tag_driver_register(struct dsa_tag_driver *dsa_tag_driver,
|
||||||
struct module *owner)
|
struct module *owner)
|
||||||
{
|
{
|
||||||
|
@ -551,9 +535,6 @@ static int __init dsa_init_module(void)
|
||||||
|
|
||||||
dev_add_pack(&dsa_pack_type);
|
dev_add_pack(&dsa_pack_type);
|
||||||
|
|
||||||
dsa_tag_driver_register(&DSA_TAG_DRIVER_NAME(none_ops),
|
|
||||||
THIS_MODULE);
|
|
||||||
|
|
||||||
rc = rtnl_link_register(&dsa_link_ops);
|
rc = rtnl_link_register(&dsa_link_ops);
|
||||||
if (rc)
|
if (rc)
|
||||||
goto netlink_register_fail;
|
goto netlink_register_fail;
|
||||||
|
@ -561,7 +542,6 @@ static int __init dsa_init_module(void)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
netlink_register_fail:
|
netlink_register_fail:
|
||||||
dsa_tag_driver_unregister(&DSA_TAG_DRIVER_NAME(none_ops));
|
|
||||||
dsa_slave_unregister_notifier();
|
dsa_slave_unregister_notifier();
|
||||||
dev_remove_pack(&dsa_pack_type);
|
dev_remove_pack(&dsa_pack_type);
|
||||||
register_notifier_fail:
|
register_notifier_fail:
|
||||||
|
@ -574,7 +554,6 @@ module_init(dsa_init_module);
|
||||||
static void __exit dsa_cleanup_module(void)
|
static void __exit dsa_cleanup_module(void)
|
||||||
{
|
{
|
||||||
rtnl_link_unregister(&dsa_link_ops);
|
rtnl_link_unregister(&dsa_link_ops);
|
||||||
dsa_tag_driver_unregister(&DSA_TAG_DRIVER_NAME(none_ops));
|
|
||||||
|
|
||||||
dsa_slave_unregister_notifier();
|
dsa_slave_unregister_notifier();
|
||||||
dev_remove_pack(&dsa_pack_type);
|
dev_remove_pack(&dsa_pack_type);
|
||||||
|
|
|
@ -384,7 +384,6 @@ int dsa_port_change_master(struct dsa_port *dp, struct net_device *master,
|
||||||
struct netlink_ext_ack *extack);
|
struct netlink_ext_ack *extack);
|
||||||
|
|
||||||
/* slave.c */
|
/* slave.c */
|
||||||
extern const struct dsa_device_ops notag_netdev_ops;
|
|
||||||
extern struct notifier_block dsa_slave_switchdev_notifier;
|
extern struct notifier_block dsa_slave_switchdev_notifier;
|
||||||
extern struct notifier_block dsa_slave_switchdev_blocking_notifier;
|
extern struct notifier_block dsa_slave_switchdev_blocking_notifier;
|
||||||
|
|
||||||
|
|
30
net/dsa/tag_none.c
Normal file
30
net/dsa/tag_none.c
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
/*
|
||||||
|
* net/dsa/tag_none.c - Traffic handling for switches with no tag
|
||||||
|
* Copyright (c) 2008-2009 Marvell Semiconductor
|
||||||
|
* Copyright (c) 2013 Florian Fainelli <florian@openwrt.org>
|
||||||
|
*
|
||||||
|
* WARNING: do not use this for new switches. In case of no hardware
|
||||||
|
* tagging support, look at tag_8021q.c instead.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "dsa_priv.h"
|
||||||
|
|
||||||
|
#define NONE_NAME "none"
|
||||||
|
|
||||||
|
static struct sk_buff *dsa_slave_notag_xmit(struct sk_buff *skb,
|
||||||
|
struct net_device *dev)
|
||||||
|
{
|
||||||
|
/* Just return the original SKB */
|
||||||
|
return skb;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct dsa_device_ops none_ops = {
|
||||||
|
.name = NONE_NAME,
|
||||||
|
.proto = DSA_TAG_PROTO_NONE,
|
||||||
|
.xmit = dsa_slave_notag_xmit,
|
||||||
|
};
|
||||||
|
|
||||||
|
module_dsa_tag_driver(none_ops);
|
||||||
|
MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_NONE, NONE_NAME);
|
||||||
|
MODULE_LICENSE("GPL");
|
Loading…
Add table
Reference in a new issue