Remove dsa_priv.h
Subsystems (13)
Vladimir Oltean
maintainercover Remove dsa_priv.h
After working on the "Autoload DSA tagging driver when dynamically changing protocol" series:
https://patchwork.kernel.org/project/netdevbpf/cover/[email protected]/
it became clear to me that the situation with DSA headers is a bit messy, and I put the tagging protocol driver macros in a pretty random temporary spot in dsa_priv.h.
Now is the time to make the net/dsa/ folder a bit more organized, and to make tagging protocol driver modules include just headers they're going to use.
Another thing is the merging and cleanup of dsa.c and dsa2.c. Before, dsa.c had 589 lines and dsa2.c had 1817 lines. Now, the combined dsa.c has 1749 lines, the rest went to some other places.
Sorry for the set size, I know the rules, but since this is basically code movement for the most part, I thought more patches are better.
Vladimir Oltean (17):
net: dsa: unexport dsa_dev_to_net_device()
net: dsa: modularize DSA_TAG_PROTO_NONE
net: dsa: move bulk of devlink code to devlink.{c,h}
net: dsa: if ds->setup is true, ds->devlink is always non-NULL
net: dsa: move rest of devlink setup/teardown to devlink.c
net: dsa: move headers exported by port.c to port.h
net: dsa: move headers exported by master.c to master.h
net: dsa: move headers exported by slave.c to slave.h
net: dsa: move tagging protocol code to tag.{c,h}
net: dsa: move headers exported by switch.c to switch.h
net: dsa: move dsa_tree_notify() and dsa_broadcast() to switch.c
net: dsa: move notifier definitions to switch.h
net: dsa: merge dsa.c into dsa2.c
net: dsa: rename dsa2.c back into dsa.c and create its header
net: dsa: move definitions from dsa_priv.h to slave.c
net: dsa: move tag_8021q headers to their proper place
net: dsa: kill off dsa_priv.h
drivers/net/dsa/Kconfig | 2 + drivers/net/dsa/b53/Kconfig | 1 + drivers/net/dsa/microchip/Kconfig | 1 + include/linux/dsa/8021q.h | 31 +- include/net/dsa.h | 3 +- net/dsa/Kconfig | 6 + net/dsa/Makefile | 4 +- net/dsa/devlink.c | 391 +++++++ net/dsa/devlink.h | 16 + net/dsa/dsa.c | 1754 +++++++++++++++++++++++----- net/dsa/dsa.h | 40 + net/dsa/dsa2.c | 1817 ----------------------------- net/dsa/dsa_priv.h | 663 ----------- net/dsa/master.c | 10 +- net/dsa/master.h | 19 + net/dsa/netlink.c | 3 +- net/dsa/netlink.h | 8 + net/dsa/port.c | 6 +- net/dsa/port.h | 114 ++ net/dsa/slave.c | 49 +- net/dsa/slave.h | 69 ++ net/dsa/switch.c | 53 +- net/dsa/switch.h | 120 ++ net/dsa/tag.c | 243 ++++ net/dsa/tag.h | 310 +++++ net/dsa/tag_8021q.c | 19 +- net/dsa/tag_8021q.h | 27 + net/dsa/tag_ar9331.c | 2 +- net/dsa/tag_brcm.c | 2 +- net/dsa/tag_dsa.c | 2 +- net/dsa/tag_gswip.c | 2 +- net/dsa/tag_hellcreek.c | 2 +- net/dsa/tag_ksz.c | 3 +- net/dsa/tag_lan9303.c | 2 +- net/dsa/tag_mtk.c | 2 +- net/dsa/tag_none.c | 30 + net/dsa/tag_ocelot.c | 3 +- net/dsa/tag_ocelot_8021q.c | 4 +- net/dsa/tag_qca.c | 2 +- net/dsa/tag_rtl4_a.c | 2 +- net/dsa/tag_rtl8_4.c | 2 +- net/dsa/tag_rzn1_a5psw.c | 2 +- net/dsa/tag_sja1105.c | 4 +- net/dsa/tag_trailer.c | 2 +- net/dsa/tag_xrs700x.c | 2 +- 45 files changed, 3016 insertions(+), 2833 deletions(-) create mode 100644 net/dsa/devlink.c create mode 100644 net/dsa/devlink.h create mode 100644 net/dsa/dsa.h delete mode 100644 net/dsa/dsa2.c delete mode 100644 net/dsa/dsa_priv.h create mode 100644 net/dsa/master.h create mode 100644 net/dsa/netlink.h create mode 100644 net/dsa/port.h create mode 100644 net/dsa/slave.h create mode 100644 net/dsa/switch.h create mode 100644 net/dsa/tag.c create mode 100644 net/dsa/tag.h create mode 100644 net/dsa/tag_8021q.h create mode 100644 net/dsa/tag_none.c
Signature · 1 line
2.34.1
Vladimir Oltean
maintainerPATCH 1/17 net: dsa: unexport dsa_dev_to_net_device()
dsa.o and dsa2.o are linked into the same dsa_core.o, there is no reason to export this symbol when its only caller is local.
--- include/net/dsa.h | 2 -- net/dsa/dsa.c | 1 - net/dsa/dsa_priv.h | 2 ++ 3 files changed, 2 insertions(+), 3 deletions(-)
include/net/dsa.h +0 -2
@@ -1285,8 +1285,6 @@ struct dsa_switch_driver {const struct dsa_switch_ops *ops; }; -struct net_device *dsa_dev_to_net_device (struct device *dev); -bool dsa_fdb_present_in_other_db (struct dsa_switch *ds,int port,const unsigned char *addr,u16 vid,struct dsa_db db);
net/dsa/dsa.c +0 -1
@@ -182,7 +182,6 @@ struct net_device *dsa_dev_to_net_device(struct device *dev)return NULL ; } -EXPORT_SYMBOL_GPL (dsa_dev_to_net_device);/* Determine if we should defer delivery of skb until we have a rx timestamp. *
net/dsa/dsa_priv.h +2 -0
@@ -247,6 +247,8 @@ 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); +struct net_device *dsa_dev_to_net_device (struct device *dev); +bool dsa_db_equal (const struct dsa_db *a,const struct dsa_db *b);bool dsa_schedule_work (struct work_struct *work);
Signature · 1 line
2.34.1
Re: [PATCH net-next 01/17] net: dsa: unexport dsa_dev_to_net_device()
Quoted 4 lines · Vladimir Oltean
dsa.o and dsa2.o are linked into the same dsa_core.o, there is no reason to export this symbol when its only caller is local.
Signed-off-by Vladimir Oltean <[email protected]>
Signature · 1 line
Florian
Vladimir Oltean
maintainerPATCH 2/17 net: dsa: modularize DSA_TAG_PROTO_NONE
In reply to Vladimir OlteanThere 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.
--- drivers/net/dsa/Kconfig | 2 ++ drivers/net/dsa/b53/Kconfig | 1 + drivers/net/dsa/microchip/Kconfig | 1 + net/dsa/Kconfig | 6 ++++++ net/dsa/Makefile | 1 + net/dsa/dsa.c | 21 --------------------- net/dsa/dsa_priv.h | 1 - net/dsa/tag_none.c | 30 ++++++++++++++++++++++++++++++ 8 files changed, 41 insertions(+), 22 deletions(-) create mode 100644 net/dsa/tag_none.c
drivers/net/dsa/Kconfig +2 -0
@@ -18,6 +18,7 @@ config NET_DSA_BCM_SF2 config NET_DSA_LOOP tristate "DSA mock-up Ethernet switch chip support" + select NET_DSA_TAG_NONE select FIXED_PHY help 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 tristate + select NET_DSA_TAG_NONE select FIXED_PHY select VITESSE_PHY select GPIOLIB
drivers/net/dsa/b53/Kconfig +1 -0
@@ -2,6 +2,7 @@ menuconfig B53 tristate "Broadcom BCM53xx managed switch support" depends on NET_DSA + select NET_DSA_TAG_NONE select NET_DSA_TAG_BRCM select NET_DSA_TAG_BRCM_LEGACY select NET_DSA_TAG_BRCM_PREPEND
drivers/net/dsa/microchip/Kconfig +1 -0
@@ -3,6 +3,7 @@ menuconfig NET_DSA_MICROCHIP_KSZ_COMMON tristate "Microchip KSZ8795/KSZ9477/LAN937x series switch support" depends on NET_DSA select NET_DSA_TAG_KSZ + select NET_DSA_TAG_NONE help This driver adds support for Microchip KSZ9477 series switch and KSZ8795/KSZ88x3 switch chips.
net/dsa/Kconfig +6 -0
@@ -18,6 +18,12 @@ if NET_DSA # 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 tristate "Tag driver for Atheros AR9331 SoC with built-in switch" help
net/dsa/Makefile +1 -0
@@ -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_LAN9303) += tag_lan9303.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_8021Q) += tag_ocelot_8021q.o obj-$(CONFIG_NET_DSA_TAG_QCA) += tag_qca.o
net/dsa/dsa.c +0 -21
@@ -18,22 +18,6 @@static LIST_HEAD (dsa_tag_drivers_list);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,struct module *owner) {
@@ -551,9 +535,6 @@ static int __init dsa_init_module(void)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);if (rc) goto netlink_register_fail;
@@ -561,7 +542,6 @@ static int __init dsa_init_module(void)return 0 ; netlink_register_fail: -dsa_tag_driver_unregister (&DSA_TAG_DRIVER_NAME (none_ops));dsa_slave_unregister_notifier ();dev_remove_pack (&dsa_pack_type); register_notifier_fail:
@@ -574,7 +554,6 @@ module_init(dsa_init_module); static void __exit dsa_cleanup_module(void) {rtnl_link_unregister (&dsa_link_ops); -dsa_tag_driver_unregister (&DSA_TAG_DRIVER_NAME (none_ops));dsa_slave_unregister_notifier ();dev_remove_pack (&dsa_pack_type);
net/dsa/dsa_priv.h +0 -1
@@ -384,7 +384,6 @@ int dsa_port_change_master(struct dsa_port *dp, struct net_device *master, struct netlink_ext_ack *extack);/* 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_blocking_notifier;
net/dsa/tag_none.c new file +30 -0
@@ -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 <[email protected]> +* +* 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" );
Signature · 1 line
2.34.1
Re: [PATCH net-next 02/17] net: dsa: modularize DSA_TAG_PROTO_NONE
Quoted 10 lines · Vladimir Oltean
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_NONEselect 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, andDSA_TAG_PROTO_NONEis just a fallback that never gets used.Signed-off-by Vladimir Oltean <[email protected]>
Signature · 1 line
Florian
Vladimir Oltean
maintainerPATCH 3/17 net: dsa: move bulk of devlink code to devlink.{c,h}
In reply to Vladimir Olteandsa.c and dsa2.c are bloated with too much off-topic code. Identify all code related to devlink and move it to a new devlink.c file.
Steer clear of the dsa_priv.h dumping ground antipattern and create a dedicated devlink.h for it, which will be included only by the C files which need it. Usage of dsa_priv.h will be minimized in later patches.
--- net/dsa/Makefile | 1 + net/dsa/devlink.c | 355 ++++++++++++++++++++++++++++++++++++++++++++++ net/dsa/devlink.h | 13 ++ net/dsa/dsa.c | 107 -------------- net/dsa/dsa2.c | 240 +------------------------------ 5 files changed, 370 insertions(+), 346 deletions(-) create mode 100644 net/dsa/devlink.c create mode 100644 net/dsa/devlink.h
net/dsa/Makefile +1 -0
@@ -2,6 +2,7 @@ # the core obj-$(CONFIG_NET_DSA) += dsa_core.o dsa_core-y += \ + devlink.o \ dsa.o \ dsa2.o \ master.o \
net/dsa/devlink.c new file +355 -0
355 lines not on this page · raw message
net/dsa/devlink.h new file +13 -0
@@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#ifndef __DSA_DEVLINK_H +#define __DSA_DEVLINK_H + +struct dsa_port ; + +extern const struct devlink_ops dsa_devlink_ops; + +int dsa_port_devlink_setup (struct dsa_port *dp); +void dsa_port_devlink_teardown (struct dsa_port *dp); + +#endif
net/dsa/dsa.c +0 -107
113 lines not on this page · raw message
net/dsa/dsa2.c +1 -239
258 lines not on this page · raw message
Signature · 1 line
2.34.1
Re: [PATCH net-next 03/17] net: dsa: move bulk of devlink code to devlink.{c,h}
Quoted 8 lines · Vladimir Oltean
dsa.canddsa2.care bloated with too much off-topic code. Identify all code related to devlink and move it to a newdevlink.cfile.Steer clear of the
dsa_priv.hdumping ground antipattern and create a dedicateddevlink.hfor it, which will be included only by the C files which need it. Usage ofdsa_priv.hwill be minimized in later patches.Signed-off-by Vladimir Oltean <[email protected]>
Signature · 1 line
Florian
Vladimir Oltean
maintainerPATCH 4/17 net: dsa: if ds->setup is true, ds->devlink is always non-NULL
In reply to Vladimir OlteanSimplify dsa_switch_teardown() to remove the NULL checking for ds->devlink.
--- net/dsa/dsa2.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
net/dsa/dsa2.c +5 -7
@@ -682,8 +682,9 @@ static int dsa_switch_setup(struct dsa_switch *ds) goto free_slave_mii_bus; } - ds->setup = true;devlink_register (ds->devlink); + + ds->setup = true;return 0 ; free_slave_mii_bus:
@@ -705,8 +706,7 @@ static void dsa_switch_teardown(struct dsa_switch *ds)if (!ds->setup)return ; -if (ds->devlink) -devlink_unregister (ds->devlink); +devlink_unregister (ds->devlink);if (ds->slave_mii_bus && ds->ops->phy_read) {mdiobus_unregister (ds->slave_mii_bus);
@@ -721,10 +721,8 @@ static void dsa_switch_teardown(struct dsa_switch *ds)dsa_switch_unregister_notifier (ds); -if (ds->devlink) { -devlink_free (ds->devlink); - ds->devlink =NULL ; - } +devlink_free (ds->devlink); + ds->devlink =NULL ; ds->setup = false; }
Signature · 1 line
2.34.1
Re: [PATCH net-next 04/17] net: dsa: if ds->setup is true, ds->devlink is always non-NULL
Quoted 4 lines · Vladimir Oltean
Simplify
dsa_switch_teardown()to remove the NULL checking fords->devlink.Signed-off-by Vladimir Oltean <[email protected]>
Signature · 1 line
Florian
Vladimir Oltean
maintainerPATCH 5/17 net: dsa: move rest of devlink setup/teardown to devlink.c
In reply to Vladimir OlteanThe code that needed further refactoring into dedicated functions in dsa2.c was left aside. Move it now to devlink.c, and make dsa2.c stop including net/devlink.h.
--- net/dsa/devlink.c | 38 +++++++++++++++++++++++++++++++++++++- net/dsa/devlink.h | 7 +++++-- net/dsa/dsa2.c | 24 +++++++----------------- 3 files changed, 49 insertions(+), 20 deletions(-)
net/dsa/devlink.c +37 -1
@@ -167,7 +167,7 @@ dsa_devlink_sb_occ_tc_port_bind_get(struct devlink_port *dlp, p_max); } -const struct devlink_ops dsa_devlink_ops = { +static const struct devlink_ops dsa_devlink_ops = { .info_get = dsa_devlink_info_get, .sb_pool_get = dsa_devlink_sb_pool_get, .sb_pool_set = dsa_devlink_sb_pool_set,
@@ -353,3 +353,39 @@ void dsa_port_devlink_teardown(struct dsa_port *dp)devlink_port_fini (dlp); } + +void dsa_switch_devlink_register (struct dsa_switch *ds) +{ +devlink_register (ds->devlink); +} + +void dsa_switch_devlink_unregister (struct dsa_switch *ds) +{ +devlink_unregister (ds->devlink); +} + +int dsa_switch_devlink_alloc (struct dsa_switch *ds) +{ +struct dsa_devlink_priv *dl_priv; +struct devlink *dl; + +/* Add the switch to devlink before calling setup, so that setup can +* add dpipe tables +*/ + dl =devlink_alloc (&dsa_devlink_ops,sizeof (*dl_priv), ds->dev); +if (!dl) +return -ENOMEM ; + + ds->devlink = dl; + + dl_priv =devlink_priv (ds->devlink); + dl_priv->ds = ds; + +return 0 ; +} + +void dsa_switch_devlink_free (struct dsa_switch *ds) +{ +devlink_free (ds->devlink); + ds->devlink =NULL ; +}
net/dsa/devlink.h +5 -2
@@ -4,10 +4,13 @@#define __DSA_DEVLINK_Hstruct dsa_port ; - -extern const struct devlink_ops dsa_devlink_ops; +struct dsa_switch ;int dsa_port_devlink_setup (struct dsa_port *dp);void dsa_port_devlink_teardown (struct dsa_port *dp); +void dsa_switch_devlink_register (struct dsa_switch *ds); +void dsa_switch_devlink_unregister (struct dsa_switch *ds); +int dsa_switch_devlink_alloc (struct dsa_switch *ds); +void dsa_switch_devlink_free (struct dsa_switch *ds);#endif
net/dsa/dsa2.c +7 -17
@@ -15,7 +15,6 @@#include <linux/of.h> #include <linux/of_mdio.h> #include <linux/of_net.h> -#include <net/devlink.h> #include <net/sch_generic.h> #include "devlink.h"
@@ -627,7 +626,6 @@ static void dsa_switch_teardown_tag_protocol(struct dsa_switch *ds)static int dsa_switch_setup (struct dsa_switch *ds) { -struct dsa_devlink_priv *dl_priv;struct device_node *dn;int err;
@@ -641,15 +639,9 @@ static int dsa_switch_setup(struct dsa_switch *ds)*/ ds->phys_mii_mask |=dsa_user_ports (ds); -/* Add the switch to devlink before calling setup, so that setup can -* add dpipe tables -*/ - ds->devlink = -devlink_alloc (&dsa_devlink_ops,sizeof (*dl_priv), ds->dev); -if (!ds->devlink) -return -ENOMEM ; - dl_priv =devlink_priv (ds->devlink); - dl_priv->ds = ds; + err =dsa_switch_devlink_alloc (ds); +if (err) +return err; err =dsa_switch_register_notifier (ds);if (err)
@@ -682,7 +674,7 @@ static int dsa_switch_setup(struct dsa_switch *ds) goto free_slave_mii_bus; } -devlink_register (ds->devlink); +dsa_switch_devlink_register (ds); ds->setup = true;return 0 ;
@@ -696,8 +688,7 @@ static int dsa_switch_setup(struct dsa_switch *ds) unregister_notifier:dsa_switch_unregister_notifier (ds); devlink_free: -devlink_free (ds->devlink); - ds->devlink =NULL ; +dsa_switch_devlink_free (ds);return err; }
@@ -706,7 +697,7 @@ static void dsa_switch_teardown(struct dsa_switch *ds)if (!ds->setup)return ; -devlink_unregister (ds->devlink); +dsa_switch_devlink_unregister (ds);if (ds->slave_mii_bus && ds->ops->phy_read) {mdiobus_unregister (ds->slave_mii_bus);
@@ -721,8 +712,7 @@ static void dsa_switch_teardown(struct dsa_switch *ds)dsa_switch_unregister_notifier (ds); -devlink_free (ds->devlink); - ds->devlink =NULL ; +dsa_switch_devlink_free (ds); ds->setup = false; }
Signature · 1 line
2.34.1
Re: [PATCH net-next 05/17] net: dsa: move rest of devlink setup/teardown to devlink.c
Quoted 5 lines · Vladimir Oltean
The code that needed further refactoring into dedicated functions in
dsa2.cwas left aside. Move it now todevlink.c, and makedsa2.cstop includingnet/devlink.h.Signed-off-by Vladimir Oltean <[email protected]>
Signature · 1 line
Florian
Vladimir Oltean
maintainerPATCH 6/17 net: dsa: move headers exported by port.c to port.h
In reply to Vladimir OlteanMinimize the use of the bloated dsa_priv.h by moving the prototypes exported by port.c to their own header file.
--- net/dsa/dsa2.c | 1 + net/dsa/dsa_priv.h | 97 ------------------------------------- net/dsa/master.c | 1 + net/dsa/port.c | 1 + net/dsa/port.h | 114 ++++++++++++++++++++++++++++++++++++++++++++ net/dsa/slave.c | 1 + net/dsa/switch.c | 1 + net/dsa/tag_8021q.c | 1 + 8 files changed, 120 insertions(+), 97 deletions(-) create mode 100644 net/dsa/port.h
net/dsa/dsa2.c +1 -0
@@ -19,6 +19,7 @@#include "devlink.h" #include "dsa_priv.h" +#include "port.h" static DEFINE_MUTEX (dsa2_mutex);LIST_HEAD (dsa_tree_list);
net/dsa/dsa_priv.h +0 -97
103 lines not on this page · raw message
net/dsa/master.c +1 -0
@@ -7,6 +7,7 @@*/ #include "dsa_priv.h" +#include "port.h" static int dsa_master_get_regs_len (struct net_device *dev) {
net/dsa/port.c +1 -0
@@ -13,6 +13,7 @@#include <linux/of_net.h> #include "dsa_priv.h" +#include "port.h" /** * dsa_port_notify - Notify the switching fabric of changes to a port
net/dsa/port.h new file +114 -0
114 lines not on this page · raw message
net/dsa/slave.c +1 -0
@@ -23,6 +23,7 @@#include <linux/netpoll.h> #include "dsa_priv.h" +#include "port.h" static void dsa_slave_standalone_event_work (struct work_struct *work) {
net/dsa/switch.c +1 -0
@@ -13,6 +13,7 @@#include <net/switchdev.h> #include "dsa_priv.h" +#include "port.h" static unsigned int dsa_switch_fastest_ageing_time (struct dsa_switch *ds,unsigned int ageing_time)
net/dsa/tag_8021q.c +1 -0
@@ -8,6 +8,7 @@#include <linux/dsa/8021q.h> #include "dsa_priv.h" +#include "port.h" /* Binary structure of the fake 12-bit VID field (when the TPID is * ETH_P_DSA_8021Q):
Signature · 1 line
2.34.1
Re: [PATCH net-next 06/17] net: dsa: move headers exported by port.c to port.h
Quoted 4 lines · Vladimir Oltean
Minimize the use of the bloated
dsa_priv.hby moving the prototypes exported byport.cto their own header file.Signed-off-by Vladimir Oltean <[email protected]>
Signature · 1 line
Florian
Vladimir Oltean
maintainerPATCH 7/17 net: dsa: move headers exported by master.c to master.h
In reply to Vladimir OlteanMinimize the use of the bloated dsa_priv.h by moving the prototypes exported by master.c to their own header file.
--- net/dsa/dsa2.c | 1 + net/dsa/dsa_priv.h | 9 --------- net/dsa/master.c | 6 ++++++ net/dsa/master.h | 19 +++++++++++++++++++ net/dsa/slave.c | 1 + 5 files changed, 27 insertions(+), 9 deletions(-) create mode 100644 net/dsa/master.h
net/dsa/dsa2.c +1 -0
@@ -19,6 +19,7 @@#include "devlink.h" #include "dsa_priv.h" +#include "master.h" #include "port.h" static DEFINE_MUTEX (dsa2_mutex);
net/dsa/dsa_priv.h +0 -9
@@ -259,15 +259,6 @@ static inline int dsa_tag_protocol_overhead(const struct dsa_device_ops *ops)return ops->needed_headroom + ops->needed_tailroom; } -/* master.c */ -int dsa_master_setup (struct net_device *dev,struct dsa_port *cpu_dp); -void dsa_master_teardown (struct net_device *dev); -int dsa_master_lag_setup (struct net_device *lag_dev,struct dsa_port *cpu_dp, -struct netdev_lag_upper_info *uinfo, -struct netlink_ext_ack *extack); -void dsa_master_lag_teardown (struct net_device *lag_dev, -struct dsa_port *cpu_dp); -static inline struct net_device *dsa_master_find_slave (struct net_device *dev,int device,int port) {
net/dsa/master.c +6 -0
@@ -6,7 +6,13 @@* Vivien Didelot <[email protected]> */ +#include <linux/ethtool.h> +#include <linux/netdevice.h> +#include <linux/netlink.h> +#include <net/dsa.h> +#include "dsa_priv.h" +#include "master.h" #include "port.h" static int dsa_master_get_regs_len (struct net_device *dev)
net/dsa/master.h new file +19 -0
@@ -0,0 +1,19 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#ifndef __DSA_MASTER_H +#define __DSA_MASTER_H + +struct dsa_port ; +struct net_device ; +struct netdev_lag_upper_info ; +struct netlink_ext_ack ; + +int dsa_master_setup (struct net_device *dev,struct dsa_port *cpu_dp); +void dsa_master_teardown (struct net_device *dev); +int dsa_master_lag_setup (struct net_device *lag_dev,struct dsa_port *cpu_dp, +struct netdev_lag_upper_info *uinfo, +struct netlink_ext_ack *extack); +void dsa_master_lag_teardown (struct net_device *lag_dev, +struct dsa_port *cpu_dp); + +#endif
net/dsa/slave.c +1 -0
@@ -24,6 +24,7 @@#include "dsa_priv.h" #include "port.h" +#include "master.h" static void dsa_slave_standalone_event_work (struct work_struct *work) {
Signature · 1 line
2.34.1
Re: [PATCH net-next 07/17] net: dsa: move headers exported by master.c to master.h
Quoted 4 lines · Vladimir Oltean
Minimize the use of the bloated
dsa_priv.hby moving the prototypes exported bymaster.cto their own header file.Signed-off-by Vladimir Oltean <[email protected]>
Signature · 1 line
Florian
Vladimir Oltean
maintainerPATCH 8/17 net: dsa: move headers exported by slave.c to slave.h
In reply to Vladimir OlteanMinimize the use of the bloated dsa_priv.h by moving the prototypes exported by slave.c to their own header file.
This is just approximate to get the code structure right. There are some interdependencies with static inline code left in dsa_priv.h, so leave slave.h included from there for now.
--- net/dsa/dsa.c | 1 + net/dsa/dsa2.c | 1 + net/dsa/dsa_priv.h | 59 ++------------------------------------- net/dsa/netlink.c | 1 + net/dsa/port.c | 1 + net/dsa/slave.c | 1 + net/dsa/slave.h | 69 ++++++++++++++++++++++++++++++++++++++++++++++ net/dsa/switch.c | 1 + 8 files changed, 77 insertions(+), 57 deletions(-) create mode 100644 net/dsa/slave.h
net/dsa/dsa.c +1 -0
@@ -14,6 +14,7 @@#include <net/dst_metadata.h> #include "dsa_priv.h" +#include "slave.h" static LIST_HEAD (dsa_tag_drivers_list);static DEFINE_MUTEX (dsa_tag_drivers_lock);
net/dsa/dsa2.c +1 -0
@@ -21,6 +21,7 @@#include "dsa_priv.h" #include "master.h" #include "port.h" +#include "slave.h" static DEFINE_MUTEX (dsa2_mutex);LIST_HEAD (dsa_tree_list);
net/dsa/dsa_priv.h +2 -57
80 lines not on this page · raw message
net/dsa/netlink.c +1 -0
@@ -5,6 +5,7 @@#include <net/rtnetlink.h> #include "dsa_priv.h" +#include "slave.h" static const struct nla_policy dsa_policy[IFLA_DSA_MAX +1 ] = { [IFLA_DSA_MASTER ] = { .type =NLA_U32 },
net/dsa/port.c +1 -0
@@ -14,6 +14,7 @@#include "dsa_priv.h" #include "port.h" +#include "slave.h" /** * dsa_port_notify - Notify the switching fabric of changes to a port
net/dsa/slave.c +1 -0
@@ -25,6 +25,7 @@#include "dsa_priv.h" #include "port.h" #include "master.h" +#include "slave.h" static void dsa_slave_standalone_event_work (struct work_struct *work) {
net/dsa/slave.h new file +69 -0
69 lines not on this page · raw message
net/dsa/switch.c +1 -0
@@ -14,6 +14,7 @@#include "dsa_priv.h" #include "port.h" +#include "slave.h" static unsigned int dsa_switch_fastest_ageing_time (struct dsa_switch *ds,unsigned int ageing_time)
Signature · 1 line
2.34.1
Re: [PATCH net-next 08/17] net: dsa: move headers exported by slave.c to slave.h
Quoted 8 lines · Vladimir Oltean
Minimize the use of the bloated
dsa_priv.hby moving the prototypes exported byslave.cto their own header file.This is just approximate to get the code structure right. There are some interdependencies with static inline code left in
dsa_priv.h, so leaveslave.hincluded from there for now.Signed-off-by Vladimir Oltean <[email protected]>
Signature · 1 line
Florian
Vladimir Oltean
maintainerPATCH 9/17 net: dsa: move tagging protocol code to tag.{c,h}
In reply to Vladimir OlteanIt would be nice if tagging protocol drivers could include just the header they need, since they are (mostly) data path and isolated from most of the other DSA core code does.
Create a tag.c and a tag.h file which are meant to support tagging protocol drivers.
--- net/dsa/Makefile | 1 + net/dsa/dsa.c | 229 +-------------------------- net/dsa/dsa2.c | 1 + net/dsa/dsa_priv.h | 296 ----------------------------------- net/dsa/master.c | 1 + net/dsa/slave.c | 1 + net/dsa/tag.c | 243 +++++++++++++++++++++++++++++ net/dsa/tag.h | 310 +++++++++++++++++++++++++++++++++++++ net/dsa/tag_8021q.c | 1 + net/dsa/tag_ar9331.c | 2 +- net/dsa/tag_brcm.c | 2 +- net/dsa/tag_dsa.c | 2 +- net/dsa/tag_gswip.c | 2 +- net/dsa/tag_hellcreek.c | 1 + net/dsa/tag_ksz.c | 3 +- net/dsa/tag_lan9303.c | 2 +- net/dsa/tag_mtk.c | 2 +- net/dsa/tag_none.c | 2 +- net/dsa/tag_ocelot.c | 3 +- net/dsa/tag_ocelot_8021q.c | 3 +- net/dsa/tag_qca.c | 2 +- net/dsa/tag_rtl4_a.c | 2 +- net/dsa/tag_rtl8_4.c | 2 +- net/dsa/tag_rzn1_a5psw.c | 2 +- net/dsa/tag_sja1105.c | 3 +- net/dsa/tag_trailer.c | 2 +- net/dsa/tag_xrs700x.c | 2 +- 27 files changed, 581 insertions(+), 541 deletions(-) create mode 100644 net/dsa/tag.c create mode 100644 net/dsa/tag.h
net/dsa/Makefile +1 -0
@@ -10,6 +10,7 @@ dsa_core-y += \ port.o \ slave.o \ switch.o \ + tag.o \ tag_8021q.o # tagging formats
net/dsa/dsa.c +1 -228
250 lines not on this page · raw message
net/dsa/dsa2.c +1 -0
@@ -22,6 +22,7 @@#include "master.h" #include "port.h" #include "slave.h" +#include "tag.h" static DEFINE_MUTEX (dsa2_mutex);LIST_HEAD (dsa_tree_list);
net/dsa/dsa_priv.h +0 -296
319 lines not on this page · raw message
net/dsa/master.c +1 -0
@@ -14,6 +14,7 @@#include "dsa_priv.h" #include "master.h" #include "port.h" +#include "tag.h" static int dsa_master_get_regs_len (struct net_device *dev) {
net/dsa/slave.c +1 -0
@@ -26,6 +26,7 @@#include "port.h" #include "master.h" #include "slave.h" +#include "tag.h" static void dsa_slave_standalone_event_work (struct work_struct *work) {
net/dsa/tag.c new file +243 -0
243 lines not on this page · raw message
net/dsa/tag.h new file +310 -0
310 lines not on this page · raw message
net/dsa/tag_8021q.c +1 -0
@@ -9,6 +9,7 @@#include "dsa_priv.h" #include "port.h" +#include "tag.h" /* Binary structure of the fake 12-bit VID field (when the TPID is * ETH_P_DSA_8021Q):
net/dsa/tag_ar9331.c +1 -1
@@ -7,7 +7,7 @@#include <linux/bitfield.h> #include <linux/etherdevice.h> -#include "dsa_priv.h" +#include "tag.h" #define AR9331_NAME "ar9331"
net/dsa/tag_brcm.c +1 -1
@@ -10,7 +10,7 @@#include <linux/list.h> #include <linux/slab.h> -#include "dsa_priv.h" +#include "tag.h" #define BRCM_NAME "brcm"#define BRCM_LEGACY_NAME "brcm-legacy"
net/dsa/tag_dsa.c +1 -1
@@ -50,7 +50,7 @@#include <linux/list.h> #include <linux/slab.h> -#include "dsa_priv.h" +#include "tag.h" #define DSA_NAME "dsa"#define EDSA_NAME "edsa"
net/dsa/tag_gswip.c +1 -1
@@ -10,7 +10,7 @@#include <linux/skbuff.h> #include <net/dsa.h> -#include "dsa_priv.h" +#include "tag.h" #define GSWIP_NAME "gswip"
net/dsa/tag_hellcreek.c +1 -0
@@ -12,6 +12,7 @@#include <net/dsa.h> #include "dsa_priv.h" +#include "tag.h" #define HELLCREEK_NAME "hellcreek"
net/dsa/tag_ksz.c +2 -1
@@ -7,7 +7,8 @@#include <linux/etherdevice.h> #include <linux/list.h> #include <net/dsa.h> -#include "dsa_priv.h" + +#include "tag.h" #define KSZ8795_NAME "ksz8795"#define KSZ9477_NAME "ksz9477"
net/dsa/tag_lan9303.c +1 -1
@@ -7,7 +7,7 @@#include <linux/list.h> #include <linux/slab.h> -#include "dsa_priv.h" +#include "tag.h" /* To define the outgoing port and to discover the incoming port a regular * VLAN tag is used by the LAN9303. But its VID meaning is 'special':
net/dsa/tag_mtk.c +1 -1
@@ -8,7 +8,7 @@#include <linux/etherdevice.h> #include <linux/if_vlan.h> -#include "dsa_priv.h" +#include "tag.h" #define MTK_NAME "mtk"
net/dsa/tag_none.c +1 -1
@@ -8,7 +8,7 @@* tagging support, look at tag_8021q.c instead. */ -#include "dsa_priv.h" +#include "tag.h" #define NONE_NAME "none"
net/dsa/tag_ocelot.c +2 -1
@@ -2,7 +2,8 @@/* Copyright 2019 NXP */ #include <linux/dsa/ocelot.h> -#include "dsa_priv.h" + +#include "tag.h" #define OCELOT_NAME "ocelot"#define SEVILLE_NAME "seville"
net/dsa/tag_ocelot_8021q.c +2 -1
@@ -10,7 +10,8 @@*/ #include <linux/dsa/8021q.h> #include <linux/dsa/ocelot.h> -#include "dsa_priv.h" + +#include "tag.h" #define OCELOT_8021Q_NAME "ocelot-8021q"
net/dsa/tag_qca.c +1 -1
@@ -8,7 +8,7 @@#include <net/dsa.h> #include <linux/dsa/tag_qca.h> -#include "dsa_priv.h" +#include "tag.h" #define QCA_NAME "qca"
net/dsa/tag_rtl4_a.c +1 -1
@@ -18,7 +18,7 @@#include <linux/etherdevice.h> #include <linux/bits.h> -#include "dsa_priv.h" +#include "tag.h" #define RTL4_A_NAME "rtl4a"
net/dsa/tag_rtl8_4.c +1 -1
@@ -77,7 +77,7 @@#include <linux/bits.h> #include <linux/etherdevice.h> -#include "dsa_priv.h" +#include "tag.h" /* Protocols supported: *
net/dsa/tag_rzn1_a5psw.c +1 -1
@@ -10,7 +10,7 @@#include <linux/if_ether.h> #include <net/dsa.h> -#include "dsa_priv.h" +#include "tag.h" /* To define the outgoing port and to discover the incoming port a TAG is * inserted after Src MAC :
net/dsa/tag_sja1105.c +2 -1
@@ -5,7 +5,8 @@#include <linux/dsa/sja1105.h> #include <linux/dsa/8021q.h> #include <linux/packing.h> -#include "dsa_priv.h" + +#include "tag.h" #define SJA1105_NAME "sja1105"#define SJA1110_NAME "sja1110"
net/dsa/tag_trailer.c +1 -1
@@ -8,7 +8,7 @@#include <linux/list.h> #include <linux/slab.h> -#include "dsa_priv.h" +#include "tag.h" #define TRAILER_NAME "trailer"
net/dsa/tag_xrs700x.c +1 -1
@@ -7,7 +7,7 @@#include <linux/bitops.h> -#include "dsa_priv.h" +#include "tag.h" #define XRS700X_NAME "xrs700x"
Signature · 1 line
2.34.1
Re: [PATCH net-next 09/17] net: dsa: move tagging protocol code to tag.{c,h}
Quoted 8 lines · Vladimir Oltean
It would be nice if tagging protocol drivers could include just the header they need, since they are (mostly) data path and isolated from most of the other DSA core code does.
Create a
tag.cand atag.hfile which are meant to support tagging protocol drivers.Signed-off-by Vladimir Oltean <[email protected]>
Signature · 1 line
Florian
Vladimir Oltean
maintainerPATCH 10/17 net: dsa: move headers exported by switch.c to switch.h
In reply to Vladimir OlteanReduce code bloat in dsa_priv.h by moving the prototypes exported by switch.h into their own header file.
--- net/dsa/dsa2.c | 1 + net/dsa/dsa_priv.h | 4 ---- net/dsa/port.c | 1 + net/dsa/switch.c | 1 + net/dsa/switch.h | 11 +++++++++++ net/dsa/tag_8021q.c | 1 + 6 files changed, 15 insertions(+), 4 deletions(-) create mode 100644 net/dsa/switch.h
net/dsa/dsa2.c +1 -0
@@ -22,6 +22,7 @@#include "master.h" #include "port.h" #include "slave.h" +#include "switch.h" #include "tag.h" static DEFINE_MUTEX (dsa2_mutex);
net/dsa/dsa_priv.h +0 -4
@@ -155,10 +155,6 @@ bool dsa_schedule_work(struct work_struct *work);/* netlink.c */ extern struct rtnl_link_ops dsa_link_ops__read_mostly ; -/* switch.c */ -int dsa_switch_register_notifier (struct dsa_switch *ds); -void dsa_switch_unregister_notifier (struct dsa_switch *ds); -static inline bool dsa_switch_supports_uc_filtering (struct dsa_switch *ds) { return ds->ops->port_fdb_add && ds->ops->port_fdb_del &&
net/dsa/port.c +1 -0
@@ -15,6 +15,7 @@#include "dsa_priv.h" #include "port.h" #include "slave.h" +#include "switch.h" /** * dsa_port_notify - Notify the switching fabric of changes to a port
net/dsa/switch.c +1 -0
@@ -15,6 +15,7 @@#include "dsa_priv.h" #include "port.h" #include "slave.h" +#include "switch.h" static unsigned int dsa_switch_fastest_ageing_time (struct dsa_switch *ds,unsigned int ageing_time)
net/dsa/switch.h new file +11 -0
@@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#ifndef __DSA_SWITCH_H +#define __DSA_SWITCH_H + +struct dsa_switch ; + +int dsa_switch_register_notifier (struct dsa_switch *ds); +void dsa_switch_unregister_notifier (struct dsa_switch *ds); + +#endif
net/dsa/tag_8021q.c +1 -0
@@ -9,6 +9,7 @@#include "dsa_priv.h" #include "port.h" +#include "switch.h" #include "tag.h" /* Binary structure of the fake 12-bit VID field (when the TPID is
Signature · 1 line
2.34.1
Re: [PATCH net-next 10/17] net: dsa: move headers exported by switch.c to switch.h
Quoted 4 lines · Vladimir Oltean
Reduce code bloat in
dsa_priv.hby moving the prototypes exported byswitch.hinto their own header file.Signed-off-by Vladimir Oltean <[email protected]>
Signature · 1 line
Florian
Vladimir Oltean
maintainerPATCH 11/17 net: dsa: move dsa_tree_notify() and dsa_broadcast() to switch.c
In reply to Vladimir OlteanThere isn't an intuitive place for these 2 cross-chip notifier functions according to the function-to-file classification based on names (dsa_switch_*() goes to switch.c), but I consider these to be part of the cross-chip notifier handling, therefore part of switch.c. Move them there to reduce bloat in dsa2.c (the place where all code with no better place to go goes).
--- net/dsa/dsa2.c | 46 ---------------------------------------------- net/dsa/dsa_priv.h | 2 -- net/dsa/switch.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ net/dsa/switch.h | 4 ++++ 4 files changed, 50 insertions(+), 48 deletions(-)
net/dsa/dsa2.c +0 -46
@@ -31,52 +31,6 @@ LIST_HEAD(dsa_tree_list);/* Track the bridges with forwarding offload enabled */ static unsigned long dsa_fwd_offloading_bridges; -/** -* dsa_tree_notify - Execute code for all switches in a DSA switch tree. -* @dst: collection of struct dsa_switch devices to notify. -* @e: event, must be of type DSA_NOTIFIER_* -* @v: event-specific value. -* -* Given a struct dsa_switch_tree, this can be used to run a function once for -* each member DSA switch. The other alternative of traversing the tree is only -* through its ports list, which does not uniquely list the switches. -*/ -int dsa_tree_notify (struct dsa_switch_tree *dst,unsigned long e,void *v) -{ -struct raw_notifier_head *nh = &dst->nh; -int err; - - err =raw_notifier_call_chain (nh, e, v); - -return notifier_to_errno (err); -} - -/** -* dsa_broadcast - Notify all DSA trees in the system. -* @e: event, must be of type DSA_NOTIFIER_* -* @v: event-specific value. -* -* Can be used to notify the switching fabric of events such as cross-chip -* bridging between disjoint trees (such as islands of tagger-compatible -* switches bridged by an incompatible middle switch). -* -* WARNING: this function is not reliable during probe time, because probing -* between trees is asynchronous and not all DSA trees might have probed. -*/ -int dsa_broadcast (unsigned long e,void *v) -{ -struct dsa_switch_tree *dst; -int err =0 ; - -list_for_each_entry (dst, &dsa_tree_list, list) { - err =dsa_tree_notify (dst, e, v); -if (err) -break ; - } - -return err; -} -/** * dsa_lag_map() - Map LAG structure to a linear LAG array * @dst: Tree in which to record the mapping.
net/dsa/dsa_priv.h +0 -2
@@ -175,8 +175,6 @@ void dsa_lag_unmap(struct dsa_switch_tree *dst, struct dsa_lag *lag);struct dsa_lag *dsa_tree_lag_find (struct dsa_switch_tree *dst,const struct net_device *lag_dev);struct net_device *dsa_tree_find_first_master (struct dsa_switch_tree *dst); -int dsa_tree_notify (struct dsa_switch_tree *dst,unsigned long e,void *v); -int dsa_broadcast (unsigned long e,void *v);int dsa_tree_change_tag_proto (struct dsa_switch_tree *dst,const struct dsa_device_ops *tag_ops,const struct dsa_device_ops *old_tag_ops);
net/dsa/switch.c +46 -0
52 lines not on this page · raw message
net/dsa/switch.h +4 -0
@@ -3,8 +3,12 @@#ifndef __DSA_SWITCH_H#define __DSA_SWITCH_H +struct dsa_switch_tree ;struct dsa_switch ; +int dsa_tree_notify (struct dsa_switch_tree *dst,unsigned long e,void *v); +int dsa_broadcast (unsigned long e,void *v); +int dsa_switch_register_notifier (struct dsa_switch *ds);void dsa_switch_unregister_notifier (struct dsa_switch *ds);
Signature · 1 line
2.34.1
Re: [PATCH net-next 11/17] net: dsa: move dsa_tree_notify() and dsa_broadcast() to switch.c
Quoted 8 lines · Vladimir Oltean
There isn't an intuitive place for these 2 cross-chip notifier functions according to the function-to-file classification based on names (dsa_switch_*() goes to
switch.c), but I consider these to be part of the cross-chip notifier handling, therefore part ofswitch.c. Move them there to reduce bloat indsa2.c(the place where all code with no better place to go goes).Signed-off-by Vladimir Oltean <[email protected]>
Signature · 1 line
Florian
Vladimir Oltean
maintainerPATCH 12/17 net: dsa: move notifier definitions to switch.h
In reply to Vladimir OlteanReduce bloat in dsa_priv.h by moving the cross-chip notifier data structures to switch.h.
--- net/dsa/dsa_priv.h | 104 +----------------------------------------- net/dsa/switch.h | 109 ++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 108 insertions(+), 105 deletions(-)
net/dsa/dsa_priv.h +1 -103
@@ -13,109 +13,7 @@#define DSA_MAX_NUM_OFFLOADING_BRIDGES BITS_PER_LONG -enum { -DSA_NOTIFIER_AGEING_TIME , -DSA_NOTIFIER_BRIDGE_JOIN , -DSA_NOTIFIER_BRIDGE_LEAVE , -DSA_NOTIFIER_FDB_ADD , -DSA_NOTIFIER_FDB_DEL , -DSA_NOTIFIER_HOST_FDB_ADD , -DSA_NOTIFIER_HOST_FDB_DEL , -DSA_NOTIFIER_LAG_FDB_ADD , -DSA_NOTIFIER_LAG_FDB_DEL , -DSA_NOTIFIER_LAG_CHANGE , -DSA_NOTIFIER_LAG_JOIN , -DSA_NOTIFIER_LAG_LEAVE , -DSA_NOTIFIER_MDB_ADD , -DSA_NOTIFIER_MDB_DEL , -DSA_NOTIFIER_HOST_MDB_ADD , -DSA_NOTIFIER_HOST_MDB_DEL , -DSA_NOTIFIER_VLAN_ADD , -DSA_NOTIFIER_VLAN_DEL , -DSA_NOTIFIER_HOST_VLAN_ADD , -DSA_NOTIFIER_HOST_VLAN_DEL , -DSA_NOTIFIER_MTU , -DSA_NOTIFIER_TAG_PROTO , -DSA_NOTIFIER_TAG_PROTO_CONNECT , -DSA_NOTIFIER_TAG_PROTO_DISCONNECT , -DSA_NOTIFIER_TAG_8021Q_VLAN_ADD , -DSA_NOTIFIER_TAG_8021Q_VLAN_DEL , -DSA_NOTIFIER_MASTER_STATE_CHANGE , -}; - -/* DSA_NOTIFIER_AGEING_TIME */ -struct dsa_notifier_ageing_time_info { -unsigned int ageing_time; -}; - -/* DSA_NOTIFIER_BRIDGE_* */ -struct dsa_notifier_bridge_info { -const struct dsa_port *dp; -struct dsa_bridge bridge; -bool tx_fwd_offload; -struct netlink_ext_ack *extack; -}; - -/* DSA_NOTIFIER_FDB_* */ -struct dsa_notifier_fdb_info { -const struct dsa_port *dp; -const unsigned char *addr; -u16 vid; -struct dsa_db db; -}; - -/* DSA_NOTIFIER_LAG_FDB_* */ -struct dsa_notifier_lag_fdb_info { -struct dsa_lag *lag; -const unsigned char *addr; -u16 vid; -struct dsa_db db; -}; - -/* DSA_NOTIFIER_MDB_* */ -struct dsa_notifier_mdb_info { -const struct dsa_port *dp; -const struct switchdev_obj_port_mdb *mdb; -struct dsa_db db; -}; - -/* DSA_NOTIFIER_LAG_* */ -struct dsa_notifier_lag_info { -const struct dsa_port *dp; -struct dsa_lag lag; -struct netdev_lag_upper_info *info; -struct netlink_ext_ack *extack; -}; - -/* DSA_NOTIFIER_VLAN_* */ -struct dsa_notifier_vlan_info { -const struct dsa_port *dp; -const struct switchdev_obj_port_vlan *vlan; -struct netlink_ext_ack *extack; -}; - -/* DSA_NOTIFIER_MTU */ -struct dsa_notifier_mtu_info { -const struct dsa_port *dp; -int mtu; -}; - -/* DSA_NOTIFIER_TAG_PROTO_* */ -struct dsa_notifier_tag_proto_info { -const struct dsa_device_ops *tag_ops; -}; - -/* DSA_NOTIFIER_TAG_8021Q_VLAN_* */ -struct dsa_notifier_tag_8021q_vlan_info { -const struct dsa_port *dp; -u16 vid; -}; - -/* DSA_NOTIFIER_MASTER_STATE_CHANGE */ -struct dsa_notifier_master_state_info { -const struct net_device *master; -bool operational; -}; +struct dsa_notifier_tag_8021q_vlan_info ;struct dsa_switchdev_event_work {struct net_device *dev;
net/dsa/switch.h +107 -2
115 lines not on this page · raw message
Signature · 1 line
2.34.1
Re: [PATCH net-next 12/17] net: dsa: move notifier definitions to switch.h
Quoted 4 lines · Vladimir Oltean
Reduce bloat in
dsa_priv.hby moving the cross-chip notifier data structures toswitch.h.Signed-off-by Vladimir Oltean <[email protected]>
Signature · 1 line
Florian
Vladimir Oltean
maintainerPATCH 13/17 net: dsa: merge dsa.c into dsa2.c
In reply to Vladimir OlteanThere is no longer a meaningful distinction between what goes into dsa2.c and what goes into dsa.c. Merge the 2 into a single file.
--- net/dsa/Makefile | 1 - net/dsa/dsa.c | 234 --------------------------------------------- net/dsa/dsa2.c | 222 +++++++++++++++++++++++++++++++++++++++++- net/dsa/dsa_priv.h | 2 - 4 files changed, 221 insertions(+), 238 deletions(-) delete mode 100644 net/dsa/dsa.c
net/dsa/Makefile +0 -1
@@ -3,7 +3,6 @@ obj-$(CONFIG_NET_DSA) += dsa_core.o dsa_core-y += \ devlink.o \ - dsa.o \ dsa2.o \ master.o \ netlink.o \
net/dsa/dsa.c deleted +0 -234
234 lines not on this page · raw message
net/dsa/dsa2.c +221 -1
251 lines not on this page · raw message
net/dsa/dsa_priv.h +0 -2
@@ -44,8 +44,6 @@ struct dsa_standalone_event_work { };/* dsa.c */ -struct net_device *dsa_dev_to_net_device (struct device *dev); -bool dsa_db_equal (const struct dsa_db *a,const struct dsa_db *b);bool dsa_schedule_work (struct work_struct *work);
Signature · 1 line
2.34.1
Re: [PATCH net-next 13/17] net: dsa: merge dsa.c into dsa2.c
Quoted 4 lines · Vladimir Oltean
There is no longer a meaningful distinction between what goes into
dsa2.cand what goes intodsa.c. Merge the 2 into a single file.Signed-off-by Vladimir Oltean <[email protected]>
Signature · 1 line
Florian
Vladimir Oltean
maintainerPATCH 14/17 net: dsa: rename dsa2.c back into dsa.c and create its header
In reply to Vladimir OlteanThe previous change moved the code into the larger file (dsa2.c) to minimize the delta. Rename that now to dsa.c, and create dsa.h, where all related definitions from dsa_priv.h go.
---
net/dsa/Makefile | 2 +-
net/dsa/{dsa2.c => dsa.c} | 1 +
net/dsa/dsa.h | 40 +++++++++++++++++++++++++++++++++++++++
net/dsa/dsa_priv.h | 28 ---------------------------
net/dsa/master.c | 2 +-
net/dsa/port.c | 2 +-
net/dsa/slave.c | 1 +
net/dsa/switch.c | 1 +
8 files changed, 46 insertions(+), 31 deletions(-)
rename net/dsa/{dsa2.c => dsa.c} (99%)
create mode 100644 net/dsa/dsa.hnet/dsa/Makefile +1 -1
@@ -3,7 +3,7 @@ obj-$(CONFIG_NET_DSA) += dsa_core.o dsa_core-y += \ devlink.o \ - dsa2.o \ + dsa.o \ master.o \ netlink.o \ port.o \
net/dsa/dsa.c renamed from net/dsa/dsa2.c +1 -0
@@ -20,6 +20,7 @@#include <net/sch_generic.h> #include "devlink.h" +#include "dsa.h" #include "dsa_priv.h" #include "master.h" #include "port.h"
net/dsa/dsa.h new file +40 -0
@@ -0,0 +1,40 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#ifndef __DSA_H +#define __DSA_H + +#include <linux/list.h> +#include <linux/types.h> + +struct dsa_db ; +struct dsa_device_ops ; +struct dsa_lag ; +struct dsa_switch_tree ; +struct net_device ; +struct work_struct ; + +extern struct list_head dsa_tree_list; + +bool dsa_db_equal (const struct dsa_db *a,const struct dsa_db *b); +bool dsa_schedule_work (struct work_struct *work); +void dsa_lag_map (struct dsa_switch_tree *dst,struct dsa_lag *lag); +void dsa_lag_unmap (struct dsa_switch_tree *dst,struct dsa_lag *lag); +struct dsa_lag *dsa_tree_lag_find (struct dsa_switch_tree *dst, +const struct net_device *lag_dev); +struct net_device *dsa_tree_find_first_master (struct dsa_switch_tree *dst); +int dsa_tree_change_tag_proto (struct dsa_switch_tree *dst, +const struct dsa_device_ops *tag_ops, +const struct dsa_device_ops *old_tag_ops); +void dsa_tree_master_admin_state_change (struct dsa_switch_tree *dst, +struct net_device *master, +bool up); +void dsa_tree_master_oper_state_change (struct dsa_switch_tree *dst, +struct net_device *master, +bool up); +unsigned int dsa_bridge_num_get (const struct net_device *bridge_dev,int max); +void dsa_bridge_num_put (const struct net_device *bridge_dev, +unsigned int bridge_num); +struct dsa_bridge *dsa_tree_bridge_find (struct dsa_switch_tree *dst, +const struct net_device *br); + +#endif
net/dsa/dsa_priv.h +0 -28
@@ -43,11 +43,6 @@ struct dsa_standalone_event_work {u16 vid; }; -/* dsa.c */ -bool dsa_db_equal (const struct dsa_db *a,const struct dsa_db *b); - -bool dsa_schedule_work (struct work_struct *work); -/* netlink.c */ extern struct rtnl_link_ops dsa_link_ops__read_mostly ;
@@ -65,33 +60,10 @@ static inline bool dsa_switch_supports_mc_filtering(struct dsa_switch *ds) !ds->needs_standalone_vlan_filtering; } -/* dsa2.c */ -void dsa_lag_map (struct dsa_switch_tree *dst,struct dsa_lag *lag); -void dsa_lag_unmap (struct dsa_switch_tree *dst,struct dsa_lag *lag); -struct dsa_lag *dsa_tree_lag_find (struct dsa_switch_tree *dst, -const struct net_device *lag_dev); -struct net_device *dsa_tree_find_first_master (struct dsa_switch_tree *dst); -int dsa_tree_change_tag_proto (struct dsa_switch_tree *dst, -const struct dsa_device_ops *tag_ops, -const struct dsa_device_ops *old_tag_ops); -void dsa_tree_master_admin_state_change (struct dsa_switch_tree *dst, -struct net_device *master, -bool up); -void dsa_tree_master_oper_state_change (struct dsa_switch_tree *dst, -struct net_device *master, -bool up); -unsigned int dsa_bridge_num_get (const struct net_device *bridge_dev,int max); -void dsa_bridge_num_put (const struct net_device *bridge_dev, -unsigned int bridge_num); -struct dsa_bridge *dsa_tree_bridge_find (struct dsa_switch_tree *dst, -const struct net_device *br); -/* tag_8021q.c */ int dsa_switch_tag_8021q_vlan_add (struct dsa_switch *ds,struct dsa_notifier_tag_8021q_vlan_info *info);int dsa_switch_tag_8021q_vlan_del (struct dsa_switch *ds,struct dsa_notifier_tag_8021q_vlan_info *info); -extern struct list_head dsa_tree_list; -#endif
net/dsa/master.c +1 -1
@@ -11,7 +11,7 @@#include <linux/netlink.h> #include <net/dsa.h> -#include "dsa_priv.h" +#include "dsa.h" #include "master.h" #include "port.h" #include "tag.h"
net/dsa/port.c +1 -1
@@ -12,7 +12,7 @@#include <linux/of_mdio.h> #include <linux/of_net.h> -#include "dsa_priv.h" +#include "dsa.h" #include "port.h" #include "slave.h" #include "switch.h"
net/dsa/slave.c +1 -0
@@ -22,6 +22,7 @@#include <net/dcbnl.h> #include <linux/netpoll.h> +#include "dsa.h" #include "dsa_priv.h" #include "port.h" #include "master.h"
net/dsa/switch.c +1 -0
@@ -12,6 +12,7 @@#include <linux/if_vlan.h> #include <net/switchdev.h> +#include "dsa.h" #include "dsa_priv.h" #include "port.h" #include "slave.h"
Signature · 1 line
2.34.1
Re: [PATCH net-next 14/17] net: dsa: rename dsa2.c back into dsa.c and create its header
Quoted 5 lines · Vladimir Oltean
The previous change moved the code into the larger file (
dsa2.c) to minimize the delta. Rename that now todsa.c, and createdsa.h, where all related definitions fromdsa_priv.hgo.Signed-off-by Vladimir Oltean <[email protected]>
Signature · 1 line
Florian
Vladimir Oltean
maintainerPATCH 15/17 net: dsa: move definitions from dsa_priv.h to slave.c
In reply to Vladimir OlteanThere are some definitions in dsa_priv.h which are only used from slave.c. So move them to slave.c.
--- net/dsa/dsa_priv.h | 42 ------------------------------------------ net/dsa/slave.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 42 deletions(-)
net/dsa/dsa_priv.h +0 -42
@@ -15,51 +15,9 @@struct dsa_notifier_tag_8021q_vlan_info ; -struct dsa_switchdev_event_work { -struct net_device *dev; -struct net_device *orig_dev; -struct work_struct work; -unsigned long event; -/* Specific for SWITCHDEV_FDB_ADD_TO_DEVICE and -* SWITCHDEV_FDB_DEL_TO_DEVICE -*/ -unsigned char addr[ETH_ALEN ]; -u16 vid; -bool host_addr; -}; - -enum dsa_standalone_event { -DSA_UC_ADD , -DSA_UC_DEL , -DSA_MC_ADD , -DSA_MC_DEL , -}; - -struct dsa_standalone_event_work { -struct work_struct work; -struct net_device *dev; -enum dsa_standalone_event event; -unsigned char addr[ETH_ALEN ]; -u16 vid; -}; -/* netlink.c */ extern struct rtnl_link_ops dsa_link_ops__read_mostly ; -static inline bool dsa_switch_supports_uc_filtering (struct dsa_switch *ds) -{ -return ds->ops->port_fdb_add && ds->ops->port_fdb_del && - ds->fdb_isolation && !ds->vlan_filtering_is_global && - !ds->needs_standalone_vlan_filtering; -} - -static inline bool dsa_switch_supports_mc_filtering (struct dsa_switch *ds) -{ -return ds->ops->port_mdb_add && ds->ops->port_mdb_del && - ds->fdb_isolation && !ds->vlan_filtering_is_global && - !ds->needs_standalone_vlan_filtering; -} -/* tag_8021q.c */ int dsa_switch_tag_8021q_vlan_add (struct dsa_switch *ds,struct dsa_notifier_tag_8021q_vlan_info *info);
net/dsa/slave.c +42 -0
48 lines not on this page · raw message
Signature · 1 line
2.34.1
Re: [PATCH net-next 15/17] net: dsa: move definitions from dsa_priv.h to slave.c
Quoted 4 lines · Vladimir Oltean
There are some definitions in
dsa_priv.hwhich are only used fromslave.c. So move them toslave.c.Signed-off-by Vladimir Oltean <[email protected]>
Signature · 1 line
Florian
Vladimir Oltean
maintainerPATCH 16/17 net: dsa: move tag_8021q headers to their proper place
In reply to Vladimir Olteantag_8021q definitions are all over the place. Some are exported to linux/dsa/8021q.h (visible by DSA core, taggers, switch drivers and everyone else), and some are in dsa_priv.h.
Move the structures that don't need external visibility into tag_8021q.c, and the ones which don't need the world or switch drivers to see them into tag_8021q.h.
We also have the tag_8021q.h inclusion from switch.c, which is basically the entire reason why tag_8021q.c was built into DSA in commit 8b6e638b4be2 ("net: dsa: build tag_8021q.c as part of DSA core"). I still don't know how to better deal with that, so leave it alone.
--- include/linux/dsa/8021q.h | 31 +------------------------------ include/net/dsa.h | 1 + net/dsa/dsa_priv.h | 8 -------- net/dsa/port.c | 1 + net/dsa/switch.c | 1 + net/dsa/tag_8021q.c | 15 +++++++++++++++ net/dsa/tag_8021q.h | 27 +++++++++++++++++++++++++++ net/dsa/tag_ocelot_8021q.c | 1 + net/dsa/tag_sja1105.c | 1 + 9 files changed, 48 insertions(+), 38 deletions(-) create mode 100644 net/dsa/tag_8021q.h
include/linux/dsa/8021q.h +1 -30
@@ -5,28 +5,8 @@#ifndef _NET_DSA_8021Q_H#define _NET_DSA_8021Q_H -#include <linux/refcount.h> -#include <linux/types.h> #include <net/dsa.h> - -struct dsa_switch ; -struct dsa_port ; -struct sk_buff ; -struct net_device ; - -struct dsa_tag_8021q_vlan { -struct list_head list; -int port; -u16 vid; -refcount_t refcount; -}; - -struct dsa_8021q_context { -struct dsa_switch *ds; -struct list_head vlans; -/* EtherType of RX VID, used for filtering on master interface */ -__be16 proto; -}; +#include <linux/types.h> int dsa_tag_8021q_register (struct dsa_switch *ds,__be16 proto);
@@ -38,15 +18,6 @@ int dsa_tag_8021q_bridge_join(struct dsa_switch *ds, int port,void dsa_tag_8021q_bridge_leave (struct dsa_switch *ds,int port,struct dsa_bridge bridge); -struct sk_buff *dsa_8021q_xmit (struct sk_buff *skb,struct net_device *netdev, -u16 tpid,u16 tci); - -void dsa_8021q_rcv (struct sk_buff *skb,int *source_port,int *switch_id, -int *vbid); - -struct net_device *dsa_tag_8021q_find_port_by_vbid (struct net_device *master, -int vbid); -u16 dsa_tag_8021q_bridge_vid (unsigned int bridge_num);u16 dsa_tag_8021q_standalone_vid (const struct dsa_port *dp);
include/net/dsa.h +1 -0
@@ -22,6 +22,7 @@#include <net/devlink.h> #include <net/switchdev.h> +struct dsa_8021q_context ;struct tc_action ;struct phy_device ;struct fixed_phy_status ;
net/dsa/dsa_priv.h +0 -8
@@ -13,15 +13,7 @@#define DSA_MAX_NUM_OFFLOADING_BRIDGES BITS_PER_LONG -struct dsa_notifier_tag_8021q_vlan_info ; -/* netlink.c */ extern struct rtnl_link_ops dsa_link_ops__read_mostly ; -/* tag_8021q.c */ -int dsa_switch_tag_8021q_vlan_add (struct dsa_switch *ds, -struct dsa_notifier_tag_8021q_vlan_info *info); -int dsa_switch_tag_8021q_vlan_del (struct dsa_switch *ds, -struct dsa_notifier_tag_8021q_vlan_info *info); -#endif
net/dsa/port.c +1 -0
@@ -16,6 +16,7 @@#include "port.h" #include "slave.h" #include "switch.h" +#include "tag_8021q.h" /** * dsa_port_notify - Notify the switching fabric of changes to a port
net/dsa/switch.c +1 -0
@@ -17,6 +17,7 @@#include "port.h" #include "slave.h" #include "switch.h" +#include "tag_8021q.h" static unsigned int dsa_switch_fastest_ageing_time (struct dsa_switch *ds,unsigned int ageing_time)
net/dsa/tag_8021q.c +15 -0
@@ -11,6 +11,7 @@#include "port.h" #include "switch.h" #include "tag.h" +#include "tag_8021q.h" /* Binary structure of the fake 12-bit VID field (when the TPID is * ETH_P_DSA_8021Q):
@@ -63,6 +64,20 @@#define DSA_8021Q_PORT (x) (((x) << DSA_8021Q_PORT_SHIFT) & \ DSA_8021Q_PORT_MASK) +struct dsa_tag_8021q_vlan { +struct list_head list; +int port; +u16 vid; +refcount_t refcount; +}; + +struct dsa_8021q_context { +struct dsa_switch *ds; +struct list_head vlans; +/* EtherType of RX VID, used for filtering on master interface */ +__be16 proto; +}; +u16 dsa_tag_8021q_bridge_vid (unsigned int bridge_num) {/* The VBID value of 0 is reserved for precise TX, but it is also
net/dsa/tag_8021q.h new file +27 -0
@@ -0,0 +1,27 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#ifndef __DSA_TAG_8021Q_H +#define __DSA_TAG_8021Q_H + +#include <net/dsa.h> + +#include "switch.h" + +struct sk_buff ; +struct net_device ; + +struct sk_buff *dsa_8021q_xmit (struct sk_buff *skb,struct net_device *netdev, +u16 tpid,u16 tci); + +void dsa_8021q_rcv (struct sk_buff *skb,int *source_port,int *switch_id, +int *vbid); + +struct net_device *dsa_tag_8021q_find_port_by_vbid (struct net_device *master, +int vbid); + +int dsa_switch_tag_8021q_vlan_add (struct dsa_switch *ds, +struct dsa_notifier_tag_8021q_vlan_info *info); +int dsa_switch_tag_8021q_vlan_del (struct dsa_switch *ds, +struct dsa_notifier_tag_8021q_vlan_info *info); + +#endif
net/dsa/tag_ocelot_8021q.c +1 -0
@@ -12,6 +12,7 @@#include <linux/dsa/ocelot.h> #include "tag.h" +#include "tag_8021q.h" #define OCELOT_8021Q_NAME "ocelot-8021q"
net/dsa/tag_sja1105.c +1 -0
@@ -7,6 +7,7 @@#include <linux/packing.h> #include "tag.h" +#include "tag_8021q.h" #define SJA1105_NAME "sja1105"#define SJA1110_NAME "sja1110"
Signature · 1 line
2.34.1
Re: [PATCH net-next 16/17] net: dsa: move tag_8021q headers to their proper place
Quoted 8 lines · Vladimir Oltean
tag_8021qdefinitions are all over the place. Some are exported tolinux/dsa/8021q.h(visible by DSA core, taggers, switch drivers and everyone else), and some are indsa_priv.h.Move the structures that don't need external visibility into
tag_8021q.c, and the ones which don't need the world or switch drivers to see them intotag_8021q.h.
Quoted 6 lines
We also have the
tag_8021q.hinclusion fromswitch.c, which is basically the entire reason whytag_8021q.cwas built into DSA in commit8b6e638b4be2("net: dsa: buildtag_8021q.cas part of DSA core"). I still don't know how to better deal with that, so leave it alone.Signed-off-by Vladimir Oltean <[email protected]>
Signature · 1 line
Florian
Vladimir Oltean
maintainerPATCH 17/17 net: dsa: kill off dsa_priv.h
In reply to Vladimir OlteanThe last remnants in dsa_priv.h are a netlink-related definition for which we create a new header, and DSA_MAX_NUM_OFFLOADING_BRIDGES which is only used from dsa.c, so move it there.
Some inclusions need to be adjusted now that we no longer have headers included transitively from dsa_priv.h.
--- net/dsa/dsa.c | 4 +++- net/dsa/dsa_priv.h | 19 ------------------- net/dsa/netlink.c | 2 +- net/dsa/netlink.h | 8 ++++++++ net/dsa/slave.c | 2 +- net/dsa/switch.c | 2 +- net/dsa/tag_8021q.c | 1 - net/dsa/tag_hellcreek.c | 1 - 8 files changed, 14 insertions(+), 25 deletions(-) delete mode 100644 net/dsa/dsa_priv.h create mode 100644 net/dsa/netlink.h
net/dsa/dsa.c +3 -1
@@ -21,13 +21,15 @@#include "devlink.h" #include "dsa.h" -#include "dsa_priv.h" #include "master.h" +#include "netlink.h" #include "port.h" #include "slave.h" #include "switch.h" #include "tag.h" +#define DSA_MAX_NUM_OFFLOADING_BRIDGES BITS_PER_LONG +static DEFINE_MUTEX (dsa2_mutex);LIST_HEAD (dsa_tree_list);
net/dsa/dsa_priv.h deleted +0 -19
@@ -1,19 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later */ -/* -* net/dsa/dsa_priv.h - Hardware switch handling -* Copyright (c) 2008-2009 Marvell Semiconductor -*/ - -#ifndef __DSA_PRIV_H -#define __DSA_PRIV_H - -#include <linux/phy.h> -#include <linux/netdevice.h> -#include <net/dsa.h> - -#define DSA_MAX_NUM_OFFLOADING_BRIDGES BITS_PER_LONG - -/* netlink.c */ -extern struct rtnl_link_ops dsa_link_ops__read_mostly ; - -#endif
net/dsa/netlink.c +1 -1
@@ -4,7 +4,7 @@#include <linux/netdevice.h> #include <net/rtnetlink.h> -#include "dsa_priv.h" +#include "netlink.h" #include "slave.h" static const struct nla_policy dsa_policy[IFLA_DSA_MAX +1 ] = {
net/dsa/netlink.h new file +8 -0
@@ -0,0 +1,8 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#ifndef __DSA_NETLINK_H +#define __DSA_NETLINK_H + +extern struct rtnl_link_ops dsa_link_ops__read_mostly ; + +#endif
net/dsa/slave.c +1 -1
@@ -23,9 +23,9 @@#include <linux/netpoll.h> #include "dsa.h" -#include "dsa_priv.h" #include "port.h" #include "master.h" +#include "netlink.h" #include "slave.h" #include "tag.h"
net/dsa/switch.c +1 -1
@@ -13,7 +13,7 @@#include <net/switchdev.h> #include "dsa.h" -#include "dsa_priv.h" +#include "netlink.h" #include "port.h" #include "slave.h" #include "switch.h"
net/dsa/tag_8021q.c +0 -1
@@ -7,7 +7,6 @@#include <linux/if_vlan.h> #include <linux/dsa/8021q.h> -#include "dsa_priv.h" #include "port.h" #include "switch.h" #include "tag.h"
net/dsa/tag_hellcreek.c +0 -1
@@ -11,7 +11,6 @@#include <linux/skbuff.h> #include <net/dsa.h> -#include "dsa_priv.h" #include "tag.h" #define HELLCREEK_NAME "hellcreek"
Signature · 1 line
2.34.1
Re: [PATCH net-next 17/17] net: dsa: kill off dsa_priv.h
Quoted 8 lines · Vladimir Oltean
The last remnants in
dsa_priv.hare a netlink-related definition for which we create a new header, andDSA_MAX_NUM_OFFLOADING_BRIDGESwhich is only used fromdsa.c, so move it there.Some inclusions need to be adjusted now that we no longer have headers included transitively from
dsa_priv.h.Signed-off-by Vladimir Oltean <[email protected]>
Signature · 1 line
Florian
Quoted 12 lines · Vladimir Oltean
After working on the "Autoload DSA tagging driver when dynamically changing protocol" series:
https://patchwork.kernel.org/project/netdevbpf/cover/[email protected]/it became clear to me that the situation with DSA headers is a bit messy, and I put the tagging protocol driver macros in a pretty random temporary spot in
dsa_priv.h.Now is the time to make the
net/dsa/folder a bit more organized, and to make tagging protocol driver modules include just headers they're going to use.
Quoted 6 lines
Another thing is the merging and cleanup of
dsa.canddsa2.c. Before,dsa.chad 589 lines anddsa2.chad 1817 lines. Now, the combineddsa.chas 1749 lines, the rest went to some other places.Sorry for the set size, I know the rules, but since this is basically code movement for the most part, I thought more patches are better.
This all looks fine on paper, only concern is that it will make our lives so much more miserable for back porting fixes into older kernels, if you are fine with that as a co-maintainer, then so am I.
That argument could always be used to make zero re-structuring and it would be sad for DSA to ossify, so obviously should not be the major reason for not making changes.
Thanks for doing this work!
Signature · 1 line
Florian
Vladimir Oltean
maintainerQuoted 7 lines · Florian Fainelli
This all looks fine on paper, only concern is that it will make our lives so much more miserable for back porting fixes into older kernels, if you are fine with that as a co-maintainer, then so am I.
That argument could always be used to make zero re-structuring and it would be sad for DSA to ossify, so obviously should not be the major reason for not making changes.
I think the opposite of restructuring is not ossification as you say, but rather disorganized growth which will become even harder to disentangle later on.
The next step (at some point) is going to be reorganization of what gets exported to include/net/dsa.h and how, since to me, there's already a worrying amount of uncontrolled information being scavenged by certain DSA master drivers, even if the intended recipient for that header is switch drivers. I didn't start with include/net/dsa.h because, well, I think first you need to make your own bed before you rule the world, but in general, what is here can be seen only a small piece of what's to come.
I'm not sure what to say about backports.. it doesn't scare me too much. Maybe that's also the lack of experience speaking.
This series was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:
Quoted 9 lines · On Mon, 21 Nov 2022 15:55:38 +0200 you wrote:
After working on the "Autoload DSA tagging driver when dynamically changing protocol" series:
https://patchwork.kernel.org/project/netdevbpf/cover/[email protected]/it became clear to me that the situation with DSA headers is a bit messy, and I put the tagging protocol driver macros in a pretty random temporary spot in
dsa_priv.h.[...]
Here is the summary with links:
- [net-next,01/17] net: dsa: unexport dsa_dev_to_net_device()
https://git.kernel.org/netdev/net-next/c/c5fb8ead3283 - [net-next,02/17] net: dsa: modularize DSA_TAG_PROTO_NONE https://git.kernel.org/netdev/net-next/c/d2be320495b9 - [net-next,03/17] net: dsa: move bulk of devlink code to devlink.{c,h} https://git.kernel.org/netdev/net-next/c/5cf2c75b5b91 - [net-next,04/17] net: dsa: if ds->setup is true, ds->devlink is always non-NULL https://git.kernel.org/netdev/net-next/c/d95fa75061fb - [net-next,05/17] net: dsa: move rest of devlink setup/teardown to devlink.c https://git.kernel.org/netdev/net-next/c/7aea535d40ea - [net-next,06/17] net: dsa: move headers exported by port.c to port.h https://git.kernel.org/netdev/net-next/c/022bba63c3ca - [net-next,07/17] net: dsa: move headers exported by master.c to master.h https://git.kernel.org/netdev/net-next/c/94ef6fad3bf3 - [net-next,08/17] net: dsa: move headers exported by slave.c to slave.h https://git.kernel.org/netdev/net-next/c/09f92341681a - [net-next,09/17] net: dsa: move tagging protocol code to tag.{c,h} https://git.kernel.org/netdev/net-next/c/bd954b826032 - [net-next,10/17] net: dsa: move headers exported by switch.c to switch.h https://git.kernel.org/netdev/net-next/c/0c603136e1e0 - [net-next,11/17] net: dsa: move dsa_tree_notify() and dsa_broadcast() to switch.c https://git.kernel.org/netdev/net-next/c/6dbdfce77357 - [net-next,12/17] net: dsa: move notifier definitions to switch.h https://git.kernel.org/netdev/net-next/c/495550a4844b - [net-next,13/17] net: dsa: merge dsa.c into dsa2.c https://git.kernel.org/netdev/net-next/c/165c2fb93bed - [net-next,14/17] net: dsa: rename dsa2.c back into dsa.c and create its header https://git.kernel.org/netdev/net-next/c/47d2ce03dcfb - [net-next,15/17] net: dsa: move definitions from dsa_priv.h to slave.c https://git.kernel.org/netdev/net-next/c/8e396fec2146 - [net-next,16/17] net: dsa: move tag_8021q headers to their proper place https://git.kernel.org/netdev/net-next/c/19d05ea712ec - [net-next,17/17] net: dsa: kill off dsa_priv.h https://git.kernel.org/netdev/net-next/c/5917bfe68867
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html