Skip to contentSkip to conversation

dsa: Change dsa_uses_{dsa,trailer}_tags() into inline functions

PATCH In review Ben Hutchings 3 participants 17 messages Nov 26, 2011 – Nov 27, 2011

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/8 dsa: Change dsa_uses_{dsa,trailer}_tags() into inline functions

eth_type_trans() will use these functions if DSA is enabled, which blocks building DSA as a module.

---
 include/linux/netdevice.h |    2 +-
 include/net/dsa.h         |   53 +++++++++++++++++++++++++++++++++++++++++++-
 net/dsa/dsa.c             |   23 -------------------
 net/dsa/dsa_priv.h        |   33 ----------------------------
 4 files changed, 52 insertions(+), 59 deletions(-)
include/linux/netdevice.h +1 -1
index 999bb26..63721a6 100644
@@ -1080,7 +1080,7 @@ struct net_device {
 	struct vlan_group __rcu	*vlgrp;		/* VLAN group */
 #endif
 #ifdef CONFIG_NET_DSA
-	void			*dsa_ptr;	/* dsa specific data */
+	struct dsa_switch_tree	*dsa_ptr;	/* dsa specific data */
 #endif
 	void 			*atalk_ptr;	/* AppleTalk link 	*/
 	struct in_device __rcu	*ip_ptr;	/* IPv4 specific data	*/
include/net/dsa.h +51 -2

65 lines not on this page · raw message

net/dsa/dsa.c +0 -23
index 0dc1589..66f5c04 100644
@@ -199,29 +199,6 @@ static void dsa_switch_destroy(struct dsa_switch *ds)
 }
 
 
-/* hooks for ethertype-less tagging formats *********************************/
-/*
- * The original DSA tag format and some other tag formats have no
- * ethertype, which means that we need to add a little hack to the
- * networking receive path to make sure that received frames get
- * the right ->protocol assigned to them when one of those tag
- * formats is in use.
- */
-bool dsa_uses_dsa_tags(void *dsa_ptr)
-{
-	struct dsa_switch_tree *dst = dsa_ptr;
-
-	return !!(dst->tag_protocol == htons(ETH_P_DSA));
-}
-
-bool dsa_uses_trailer_tags(void *dsa_ptr)
-{
-	struct dsa_switch_tree *dst = dsa_ptr;
-
-	return !!(dst->tag_protocol == htons(ETH_P_TRAILER));
-}
-
-
 /* link polling *************************************************************/
 static void dsa_link_poll_work(struct work_struct *ugly)
 {
net/dsa/dsa_priv.h +0 -33
index 4b0ea05..a45186cb 100644
@@ -48,39 +48,6 @@ struct dsa_switch {
 	struct net_device	*ports[DSA_MAX_PORTS];
 };
 
-struct dsa_switch_tree {
-	/*
-	 * Configuration data for the platform device that owns
-	 * this dsa switch tree instance.
-	 */
-	struct dsa_platform_data	*pd;
-
-	/*
-	 * Reference to network device to use, and which tagging
-	 * protocol to use.
-	 */
-	struct net_device	*master_netdev;
-	__be16			tag_protocol;
-
-	/*
-	 * The switch and port to which the CPU is attached.
-	 */
-	s8			cpu_switch;
-	s8			cpu_port;
-
-	/*
-	 * Link state polling.
-	 */
-	int			link_poll_needed;
-	struct work_struct	link_poll_work;
-	struct timer_list	link_poll_timer;
-
-	/*
-	 * Data for the individual switch chips.
-	 */
-	struct dsa_switch	*ds[DSA_MAX_SWITCHES];
-};
-
 static inline bool dsa_is_cpu_port(struct dsa_switch *ds, int p)
 {
 	return !!(ds->index == ds->dst->cpu_switch && p == ds->dst->cpu_port);
Signature · 1 line
1.7.7.3
#1 lore raw

PATCH 2/8 dsa: Export functions from core to modules

---
 net/dsa/dsa.c   |    2 ++
 net/dsa/slave.c |    2 ++
 2 files changed, 4 insertions(+), 0 deletions(-)
net/dsa/dsa.c +2 -0
index 66f5c04..fc93088 100644
@@ -29,6 +29,7 @@ void register_switch_driver(struct dsa_switch_driver *drv)
 	list_add_tail(&drv->list, &dsa_switch_drivers);
 	mutex_unlock(&dsa_switch_drivers_mutex);
 }
+EXPORT_SYMBOL_GPL(register_switch_driver);
 
 void unregister_switch_driver(struct dsa_switch_driver *drv)
 {
@@ -36,6 +37,7 @@ void unregister_switch_driver(struct dsa_switch_driver *drv)
 	list_del_init(&drv->list);
 	mutex_unlock(&dsa_switch_drivers_mutex);
 }
+EXPORT_SYMBOL_GPL(unregister_switch_driver);
 
 static struct dsa_switch_driver *
 dsa_switch_probe(struct mii_bus *bus, int sw_addr, char **_name)
net/dsa/slave.c +2 -0
index 56cf9b8..c9d52ca 100644
@@ -45,6 +45,7 @@ void dsa_slave_mii_bus_init(struct dsa_switch *ds)
 			ds->master_mii_bus->id, ds->pd->sw_addr);
 	ds->slave_mii_bus->parent = &ds->master_mii_bus->dev;
 }
+EXPORT_SYMBOL_GPL(dsa_slave_mii_bus_init);
 
 
 /* slave device handling ****************************************************/
@@ -402,3 +403,4 @@ dsa_slave_create(struct dsa_switch *ds, struct device *parent,
 
 	return slave_dev;
 }
+EXPORT_SYMBOL_GPL(dsa_slave_create);
Signature · 1 line
1.7.7.3
#2 lore raw

Re: [PATCH net-next 2/8] dsa: Export functions from core to modules

Quoted 19 lines · Ben Hutchings
---
 net/dsa/dsa.c   |    2 ++
 net/dsa/slave.c |    2 ++
 2 files changed, 4 insertions(+), 0 deletions(-)
net/dsa/dsa.c +1 -0
index 66f5c04..fc93088 100644
@@ -29,6 +29,7 @@ void register_switch_driver(struct dsa_switch_driver *drv)
 	list_add_tail(&drv->list, &dsa_switch_drivers);
 	mutex_unlock(&dsa_switch_drivers_mutex);
 }
+EXPORT_SYMBOL_GPL(register_switch_driver);
 
 void unregister_switch_driver(struct dsa_switch_driver *drv)
 {

net/dsa/dsa.c void unregister_switch_driver(struct dsa_switch_driver *drv) · line 43

Quoted 7 lines
net/dsa/dsa.c +1 -0
@@ -36,6 +37,7 @@ void unregister_switch_driver(struct dsa_switch_driver *drv)
 	list_del_init(&drv->list);
 	mutex_unlock(&dsa_switch_drivers_mutex);
 }
+EXPORT_SYMBOL_GPL(unregister_switch_driver);
 
 static struct dsa_switch_driver *
 dsa_switch_probe(struct mii_bus *bus, int sw_addr, char **_name)

ACK on these.

Quoted 13 lines
net/dsa/slave.c +1 -0
index 56cf9b8..c9d52ca 100644
@@ -45,6 +45,7 @@ void dsa_slave_mii_bus_init(struct dsa_switch *ds)
 			ds->master_mii_bus->id, ds->pd->sw_addr);
 	ds->slave_mii_bus->parent = &ds->master_mii_bus->dev;
 }
+EXPORT_SYMBOL_GPL(dsa_slave_mii_bus_init);
 
 
 /* slave device handling ****************************************************/

net/dsa/slave.c dsa_slave_create(struct dsa_switch *ds, struct device *parent, · line 406

Quoted 4 lines
net/dsa/slave.c +1 -0
@@ -402,3 +403,4 @@ dsa_slave_create(struct dsa_switch *ds, struct device *parent,
 
 	return slave_dev;
 }
+EXPORT_SYMBOL_GPL(dsa_slave_create);

Why do these need to be exported? They are only called from dsa.c, and dsa.c and slave.c are always linked into the same entity, even after your patches.

#3 lore raw

Re: [PATCH net-next 2/8] dsa: Export functions from core to modules

On Sun, 2011-11-27 at 20:15 +0100, Lennert Buytenhek wrote:
[...]

Quoted 14 lines
Quoted 14 lines
net/dsa/slave.c +1 -0
index 56cf9b8..c9d52ca 100644
@@ -45,6 +45,7 @@ void dsa_slave_mii_bus_init(struct dsa_switch *ds)
 			ds->master_mii_bus->id, ds->pd->sw_addr);
 	ds->slave_mii_bus->parent = &ds->master_mii_bus->dev;
 }
+EXPORT_SYMBOL_GPL(dsa_slave_mii_bus_init);
 
 
 /* slave device handling ****************************************************/
@@ -402,3 +403,4 @@ dsa_slave_create(struct dsa_switch *ds, struct device *parent,
 
Quoted 7 lines

net/dsa/slave.c dsa_slave_create(struct dsa_switch *ds, struct device *parent, · line 406

Quoted 3 lines
net/dsa/slave.c +1 -0
 	return slave_dev;
 }
+EXPORT_SYMBOL_GPL(dsa_slave_create);

Why do these need to be exported? They are only called from dsa.c, and dsa.c and slave.c are always linked into the same entity, even after your patches.

Oh, yes. I just failed to revert these exports when I decided they should be linked together.

Ben.

Signature · 2 lines
Ben Hutchings
The two most common things in the universe are hydrogen and stupidity.
#4 lore raw

PATCH 3/8 dsa: Combine core and tagging code

In reply to Ben Hutchings

These files have circular dependencies, so if we make DSA modular then they must be built into the same module. Therefore, link them together and merge their respective module init and exit functions.

---
 net/dsa/Makefile      |   13 +++++++------
 net/dsa/dsa.c         |   26 +++++++++++++++++++++++++-
 net/dsa/dsa_priv.h    |    3 +++
 net/dsa/tag_dsa.c     |   15 +--------------
 net/dsa/tag_edsa.c    |   15 +--------------
 net/dsa/tag_trailer.c |   15 +--------------
 6 files changed, 38 insertions(+), 49 deletions(-)
net/dsa/Makefile +7 -6
index 2374faf..5431b4a 100644
@@ -1,13 +1,14 @@
+# the core
+obj-$(CONFIG_NET_DSA) += dsa_core.o
+dsa_core-y += dsa.o slave.o
+
 # tagging formats
-obj-$(CONFIG_NET_DSA_TAG_DSA) += tag_dsa.o
-obj-$(CONFIG_NET_DSA_TAG_EDSA) += tag_edsa.o
-obj-$(CONFIG_NET_DSA_TAG_TRAILER) += tag_trailer.o
+dsa_core-$(CONFIG_NET_DSA_TAG_DSA) += tag_dsa.o
+dsa_core-$(CONFIG_NET_DSA_TAG_EDSA) += tag_edsa.o
+dsa_core-$(CONFIG_NET_DSA_TAG_TRAILER) += tag_trailer.o
 
 # switch drivers
 obj-$(CONFIG_NET_DSA_MV88E6XXX) += mv88e6xxx.o
 obj-$(CONFIG_NET_DSA_MV88E6060) += mv88e6060.o
 obj-$(CONFIG_NET_DSA_MV88E6123_61_65) += mv88e6123_61_65.o
 obj-$(CONFIG_NET_DSA_MV88E6131) += mv88e6131.o
-
-# the core
-obj-$(CONFIG_NET_DSA) += dsa.o slave.o
net/dsa/dsa.c +25 -1
index fc93088..88e7c2f 100644
@@ -398,12 +398,36 @@ static struct platform_driver dsa_driver = {
 
 static int __init dsa_init_module(void)
 {
-	return platform_driver_register(&dsa_driver);
+	int rc;
+
+	rc = platform_driver_register(&dsa_driver);
+	if (rc)
+		return rc;
+
+#ifdef CONFIG_NET_DSA_TAG_DSA
+	dev_add_pack(&dsa_packet_type);
+#endif
+#ifdef CONFIG_NET_DSA_TAG_EDSA
+	dev_add_pack(&edsa_packet_type);
+#endif
+#ifdef CONFIG_NET_DSA_TAG_TRAILER
+	dev_add_pack(&trailer_packet_type);
+#endif
+	return 0;
 }
 module_init(dsa_init_module);
 
 static void __exit dsa_cleanup_module(void)
 {
+#ifdef CONFIG_NET_DSA_TAG_TRAILER
+	dev_remove_pack(&trailer_packet_type);
+#endif
+#ifdef CONFIG_NET_DSA_TAG_EDSA
+	dev_remove_pack(&edsa_packet_type);
+#endif
+#ifdef CONFIG_NET_DSA_TAG_DSA
+	dev_remove_pack(&dsa_packet_type);
+#endif
 	platform_driver_unregister(&dsa_driver);
 }
 module_exit(dsa_cleanup_module);
net/dsa/dsa_priv.h +3 -0
index a45186cb..89a2eb4 100644
@@ -137,12 +137,15 @@ struct net_device *dsa_slave_create(struct dsa_switch *ds,
 
 /* tag_dsa.c */
 netdev_tx_t dsa_xmit(struct sk_buff *skb, struct net_device *dev);
+extern struct packet_type dsa_packet_type;
 
 /* tag_edsa.c */
 netdev_tx_t edsa_xmit(struct sk_buff *skb, struct net_device *dev);
+extern struct packet_type edsa_packet_type;
 
 /* tag_trailer.c */
 netdev_tx_t trailer_xmit(struct sk_buff *skb, struct net_device *dev);
+extern struct packet_type trailer_packet_type;
 
 
 #endif
net/dsa/tag_dsa.c +1 -14
index 98dfe80..cacce1e 100644
@@ -186,20 +186,7 @@ out:
 	return 0;
 }
 
-static struct packet_type dsa_packet_type __read_mostly = {
+struct packet_type dsa_packet_type __read_mostly = {
 	.type	= cpu_to_be16(ETH_P_DSA),
 	.func	= dsa_rcv,
 };
-
-static int __init dsa_init_module(void)
-{
-	dev_add_pack(&dsa_packet_type);
-	return 0;
-}
-module_init(dsa_init_module);
-
-static void __exit dsa_cleanup_module(void)
-{
-	dev_remove_pack(&dsa_packet_type);
-}
-module_exit(dsa_cleanup_module);
net/dsa/tag_edsa.c +1 -14
index 6f38332..e70c43c 100644
@@ -205,20 +205,7 @@ out:
 	return 0;
 }
 
-static struct packet_type edsa_packet_type __read_mostly = {
+struct packet_type edsa_packet_type __read_mostly = {
 	.type	= cpu_to_be16(ETH_P_EDSA),
 	.func	= edsa_rcv,
 };
-
-static int __init edsa_init_module(void)
-{
-	dev_add_pack(&edsa_packet_type);
-	return 0;
-}
-module_init(edsa_init_module);
-
-static void __exit edsa_cleanup_module(void)
-{
-	dev_remove_pack(&edsa_packet_type);
-}
-module_exit(edsa_cleanup_module);
net/dsa/tag_trailer.c +1 -14
index d6d7d0a..94bc260 100644
@@ -114,20 +114,7 @@ out:
 	return 0;
 }
 
-static struct packet_type trailer_packet_type __read_mostly = {
+struct packet_type trailer_packet_type __read_mostly = {
 	.type	= cpu_to_be16(ETH_P_TRAILER),
 	.func	= trailer_rcv,
 };
-
-static int __init trailer_init_module(void)
-{
-	dev_add_pack(&trailer_packet_type);
-	return 0;
-}
-module_init(trailer_init_module);
-
-static void __exit trailer_cleanup_module(void)
-{
-	dev_remove_pack(&trailer_packet_type);
-}
-module_exit(trailer_cleanup_module);
Signature · 1 line
1.7.7.3
#6 lore raw

PATCH 4/8 mv88e6xxx: Combine mv88e6131 and mv88e612_61_65 drivers

In reply to Ben Hutchings

These drivers share a lot of code, so if we make them modular they should be built into the same module. Therefore, link them together and merge their respective module init and exit functions.

---
 net/dsa/Makefile          |    7 ++++---
 net/dsa/mv88e6123_61_65.c |   15 +--------------
 net/dsa/mv88e6131.c       |   15 +--------------
 net/dsa/mv88e6xxx.c       |   23 +++++++++++++++++++++++
 net/dsa/mv88e6xxx.h       |    3 +++
 5 files changed, 32 insertions(+), 31 deletions(-)
net/dsa/Makefile +4 -3
index 5431b4a..5c48ac5 100644
@@ -8,7 +8,8 @@ dsa_core-$(CONFIG_NET_DSA_TAG_EDSA) += tag_edsa.o
 dsa_core-$(CONFIG_NET_DSA_TAG_TRAILER) += tag_trailer.o
 
 # switch drivers
-obj-$(CONFIG_NET_DSA_MV88E6XXX) += mv88e6xxx.o
 obj-$(CONFIG_NET_DSA_MV88E6060) += mv88e6060.o
-obj-$(CONFIG_NET_DSA_MV88E6123_61_65) += mv88e6123_61_65.o
-obj-$(CONFIG_NET_DSA_MV88E6131) += mv88e6131.o
+obj-$(CONFIG_NET_DSA_MV88E6XXX) += mv88e6xxx_drv.o
+mv88e6xxx_drv-y += mv88e6xxx.o
+mv88e6xxx_drv-$(CONFIG_NET_DSA_MV88E6123_61_65) += mv88e6123_61_65.o
+mv88e6xxx_drv-$(CONFIG_NET_DSA_MV88E6131) += mv88e6131.o
net/dsa/mv88e6123_61_65.c +1 -14
index 52faaa2..7951a6c 100644
@@ -419,7 +419,7 @@ static int mv88e6123_61_65_get_sset_count(struct dsa_switch *ds)
 	return ARRAY_SIZE(mv88e6123_61_65_hw_stats);
 }
 
-static struct dsa_switch_driver mv88e6123_61_65_switch_driver = {
+struct dsa_switch_driver mv88e6123_61_65_switch_driver = {
 	.tag_protocol		= cpu_to_be16(ETH_P_EDSA),
 	.priv_size		= sizeof(struct mv88e6xxx_priv_state),
 	.probe			= mv88e6123_61_65_probe,
@@ -432,16 +432,3 @@ static struct dsa_switch_driver mv88e6123_61_65_switch_driver = {
 	.get_ethtool_stats	= mv88e6123_61_65_get_ethtool_stats,
 	.get_sset_count		= mv88e6123_61_65_get_sset_count,
 };
-
-static int __init mv88e6123_61_65_init(void)
-{
-	register_switch_driver(&mv88e6123_61_65_switch_driver);
-	return 0;
-}
-module_init(mv88e6123_61_65_init);
-
-static void __exit mv88e6123_61_65_cleanup(void)
-{
-	unregister_switch_driver(&mv88e6123_61_65_switch_driver);
-}
-module_exit(mv88e6123_61_65_cleanup);
net/dsa/mv88e6131.c +1 -14
index 9bd1061..45f4123 100644
@@ -415,7 +415,7 @@ static int mv88e6131_get_sset_count(struct dsa_switch *ds)
 	return ARRAY_SIZE(mv88e6131_hw_stats);
 }
 
-static struct dsa_switch_driver mv88e6131_switch_driver = {
+struct dsa_switch_driver mv88e6131_switch_driver = {
 	.tag_protocol		= cpu_to_be16(ETH_P_DSA),
 	.priv_size		= sizeof(struct mv88e6xxx_priv_state),
 	.probe			= mv88e6131_probe,
@@ -428,16 +428,3 @@ static struct dsa_switch_driver mv88e6131_switch_driver = {
 	.get_ethtool_stats	= mv88e6131_get_ethtool_stats,
 	.get_sset_count		= mv88e6131_get_sset_count,
 };
-
-static int __init mv88e6131_init(void)
-{
-	register_switch_driver(&mv88e6131_switch_driver);
-	return 0;
-}
-module_init(mv88e6131_init);
-
-static void __exit mv88e6131_cleanup(void)
-{
-	unregister_switch_driver(&mv88e6131_switch_driver);
-}
-module_exit(mv88e6131_cleanup);
net/dsa/mv88e6xxx.c +23 -0
index efe661a..50fd860 100644
@@ -520,3 +520,26 @@ void mv88e6xxx_get_ethtool_stats(struct dsa_switch *ds,
 
 	mutex_unlock(&ps->stats_mutex);
 }
+
+static int __init mv88e6xxx_init(void)
+{
+#if IS_ENABLED(CONFIG_NET_DSA_MV88E6131)
+	register_switch_driver(&mv88e6131_switch_driver);
+#endif
+#if IS_ENABLED(CONFIG_NET_DSA_MV88E6123_61_65)
+	register_switch_driver(&mv88e6123_61_65_switch_driver);
+#endif
+	return 0;
+}
+module_init(mv88e6xxx_init);
+
+static void __exit mv88e6xxx_cleanup(void)
+{
+#if IS_ENABLED(CONFIG_NET_DSA_MV88E6123_61_65)
+	unregister_switch_driver(&mv88e6123_61_65_switch_driver);
+#endif
+#if IS_ENABLED(CONFIG_NET_DSA_MV88E6131)
+	unregister_switch_driver(&mv88e6131_switch_driver);
+#endif
+}
+module_exit(mv88e6xxx_cleanup);
net/dsa/mv88e6xxx.h +3 -0
index 61156ca2..fc2cd7b 100644
@@ -71,6 +71,9 @@ void mv88e6xxx_get_ethtool_stats(struct dsa_switch *ds,
 				 int nr_stats, struct mv88e6xxx_hw_stat *stats,
 				 int port, uint64_t *data);
 
+extern struct dsa_switch_driver mv88e6131_switch_driver;
+extern struct dsa_switch_driver mv88e6123_61_65_switch_driver;
+
 #define REG_READ(addr, reg)						\
 	({								\
 		int __ret;						\
Signature · 1 line
1.7.7.3
Acked-by on v1 4/8
#7 lore raw

Re: [PATCH net-next 4/8] mv88e6xxx: Combine mv88e6131 and mv88e612_61_65 drivers

Quoted 5 lines · Ben Hutchings

These drivers share a lot of code, so if we make them modular they should be built into the same module. Therefore, link them together and merge their respective module init and exit functions.

Minor nit: s/612_/6123_/ in Subject: line.

Quoted 7 lines
---
 net/dsa/Makefile          |    7 ++++---
 net/dsa/mv88e6123_61_65.c |   15 +--------------
 net/dsa/mv88e6131.c       |   15 +--------------
 net/dsa/mv88e6xxx.c       |   23 +++++++++++++++++++++++
 net/dsa/mv88e6xxx.h       |    3 +++
 5 files changed, 32 insertions(+), 31 deletions(-)

[...]

#8 lore raw

PATCH 5/8 dsa: Define module author, description, license and aliases for drivers

In reply to Ben Hutchings
---
 net/dsa/mv88e6060.c       |    5 +++++
 net/dsa/mv88e6123_61_65.c |    4 ++++
 net/dsa/mv88e6131.c       |    5 +++++
 net/dsa/mv88e6xxx.c       |    4 ++++
 4 files changed, 18 insertions(+), 0 deletions(-)
net/dsa/mv88e6060.c +5 -0
index 8f4ff5a..0e028df 100644
@@ -286,3 +286,8 @@ static void __exit mv88e6060_cleanup(void)
 	unregister_switch_driver(&mv88e6060_switch_driver);
 }
 module_exit(mv88e6060_cleanup);
+
+MODULE_AUTHOR("Lennert Buytenhek <[email protected]>");
+MODULE_DESCRIPTION("Driver for Marvell 88E6060 ethernet switch chip");
+MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:mv88e6060");
net/dsa/mv88e6123_61_65.c +4 -0
index 7951a6c..6504405 100644
@@ -432,3 +432,7 @@ struct dsa_switch_driver mv88e6123_61_65_switch_driver = {
 	.get_ethtool_stats	= mv88e6123_61_65_get_ethtool_stats,
 	.get_sset_count		= mv88e6123_61_65_get_sset_count,
 };
+
+MODULE_ALIAS("platform:mv88e6123");
+MODULE_ALIAS("platform:mv88e6161");
+MODULE_ALIAS("platform:mv88e6165");
net/dsa/mv88e6131.c +5 -0
index 45f4123..6786ba4 100644
@@ -428,3 +428,8 @@ struct dsa_switch_driver mv88e6131_switch_driver = {
 	.get_ethtool_stats	= mv88e6131_get_ethtool_stats,
 	.get_sset_count		= mv88e6131_get_sset_count,
 };
+
+MODULE_ALIAS("platform:mv88e6085");
+MODULE_ALIAS("platform:mv88e6095");
+MODULE_ALIAS("platform:mv88e6095f");
+MODULE_ALIAS("platform:mv88e6131");
net/dsa/mv88e6xxx.c +4 -0
index 50fd860..cacd955 100644
@@ -543,3 +543,7 @@ static void __exit mv88e6xxx_cleanup(void)
 #endif
 }
 module_exit(mv88e6xxx_cleanup);
+
+MODULE_AUTHOR("Lennert Buytenhek <[email protected]>");
+MODULE_DESCRIPTION("Driver for Marvell 88E6XXX ethernet switch chips");
+MODULE_LICENSE("GPL");
Signature · 1 line
1.7.7.3
#10 lore raw

PATCH 6/8 dsa: Allow core and drivers to be built as modules

In reply to Ben Hutchings

Change the kconfig types to tristate and adjust the condition for declaring net_device::dsa_ptr to allow for this.

Adjust the makefile so that if NET_DSA_MV88E6123_61_65=y and NET_DSA_MV88E6131=m or vice versa then both drivers are built-in. We could leave these options as bool and make NET_DSA_MV88E6XXX a user-selected option, but that would break existing configurations.

---
I've tested that the all-modules configuration works as far as building and loading them, but no further.

Ben.

 include/linux/netdevice.h |    2 +-
 net/dsa/Kconfig           |   10 +++++-----
 net/dsa/Makefile          |    8 ++++++--
 3 files changed, 12 insertions(+), 8 deletions(-)
include/linux/netdevice.h +1 -1
index 63721a6..87f7353 100644
@@ -1079,7 +1079,7 @@ struct net_device {
 #if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 	struct vlan_group __rcu	*vlgrp;		/* VLAN group */
 #endif
-#ifdef CONFIG_NET_DSA
+#if IS_ENABLED(CONFIG_NET_DSA)
 	struct dsa_switch_tree	*dsa_ptr;	/* dsa specific data */
 #endif
 	void 			*atalk_ptr;	/* AppleTalk link 	*/
net/dsa/Kconfig +5 -5
index c53ded2..7e12303 100644
@@ -1,5 +1,5 @@
 menuconfig NET_DSA
-	bool "Distributed Switch Architecture support"
+	tristate "Distributed Switch Architecture support"
 	default n
 	depends on EXPERIMENTAL && NETDEVICES && !S390
 	select PHYLIB
@@ -26,11 +26,11 @@ config NET_DSA_TAG_TRAILER
 
 # switch drivers
 config NET_DSA_MV88E6XXX
-	bool
+	tristate
 	default n
 
 config NET_DSA_MV88E6060
-	bool "Marvell 88E6060 ethernet switch chip support"
+	tristate "Marvell 88E6060 ethernet switch chip support"
 	select NET_DSA_TAG_TRAILER
 	---help---
 	  This enables support for the Marvell 88E6060 ethernet switch
@@ -41,7 +41,7 @@ config NET_DSA_MV88E6XXX_NEED_PPU
 	default n
 
 config NET_DSA_MV88E6131
-	bool "Marvell 88E6085/6095/6095F/6131 ethernet switch chip support"
+	tristate "Marvell 88E6085/6095/6095F/6131 ethernet switch chip support"
 	select NET_DSA_MV88E6XXX
 	select NET_DSA_MV88E6XXX_NEED_PPU
 	select NET_DSA_TAG_DSA
@@ -50,7 +50,7 @@ config NET_DSA_MV88E6131
 	  ethernet switch chips.
 
 config NET_DSA_MV88E6123_61_65
-	bool "Marvell 88E6123/6161/6165 ethernet switch chip support"
+	tristate "Marvell 88E6123/6161/6165 ethernet switch chip support"
 	select NET_DSA_MV88E6XXX
 	select NET_DSA_TAG_EDSA
 	---help---
net/dsa/Makefile +6 -2
index 5c48ac5..191dd48 100644
@@ -11,5 +11,9 @@ dsa_core-$(CONFIG_NET_DSA_TAG_TRAILER) += tag_trailer.o
 obj-$(CONFIG_NET_DSA_MV88E6060) += mv88e6060.o
 obj-$(CONFIG_NET_DSA_MV88E6XXX) += mv88e6xxx_drv.o
 mv88e6xxx_drv-y += mv88e6xxx.o
-mv88e6xxx_drv-$(CONFIG_NET_DSA_MV88E6123_61_65) += mv88e6123_61_65.o
-mv88e6xxx_drv-$(CONFIG_NET_DSA_MV88E6131) += mv88e6131.o
+ifdef CONFIG_NET_DSA_MV88E6123_61_65
+mv88e6xxx_drv-y += mv88e6123_61_65.o
+endif
+ifdef CONFIG_NET_DSA_MV88E6131
+mv88e6xxx_drv-y += mv88e6131.o
+endif
Signature · 1 line
1.7.7.3
Acked-by on v1 6/8
#11 lore raw

Re: [PATCH net-next 6/8] dsa: Allow core and drivers to be built as modules

Quoted 9 lines · Ben Hutchings

Change the kconfig types to tristate and adjust the condition for declaring net_device::dsa_ptr to allow for this.

Adjust the makefile so that if NET_DSA_MV88E6123_61_65=y and NET_DSA_MV88E6131=m or vice versa then both drivers are built-in. We could leave these options as bool and make NET_DSA_MV88E6XXX a user-selected option, but that would break existing configurations.

Thanks for the patches!

(While you're at it -- the switch chip drivers in net/dsa/ still ought to be moved to drivers/net/dsa/ or so -- feel like whipping up a patch for that?)

#12 lore raw

Re: [PATCH net-next 6/8] dsa: Allow core and drivers to be built as modules

Quoted 12 lines · Lennert Buytenhek
Quoted 9 lines · Ben Hutchings

Change the kconfig types to tristate and adjust the condition for declaring net_device::dsa_ptr to allow for this.

Adjust the makefile so that if NET_DSA_MV88E6123_61_65=y and NET_DSA_MV88E6131=m or vice versa then both drivers are built-in. We could leave these options as bool and make NET_DSA_MV88E6XXX a user-selected option, but that would break existing configurations.

Quoted 7 lines

Thanks for the patches!

(While you're at it -- the switch chip drivers in net/dsa/ still ought to be moved to drivers/net/dsa/ or so -- feel like whipping up a patch for that?)

I agree. Maybe.

Ben.

Signature · 2 lines
Ben Hutchings
The two most common things in the universe are hydrogen and stupidity.
#13 lore raw

PATCH 7/8 net: Revert ARCNET and PHYLIB to tristate options

In reply to Ben Hutchings

commit 88491d8103498a6166f70d5999902fec70924314 ("drivers/net: Kconfig & Makefile cleanup") changed the type of these options to bool, but they select code that could (and still can) be built as modules.

---
Yes David, they do still build this way. Even in an allmodconfig configuration, now. And I still really want this in net.

Ben.

 drivers/net/arcnet/Kconfig |    2 +-
 drivers/net/phy/Kconfig    |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/arcnet/Kconfig +1 -1
index a73d9dc..84fb634 100644
@@ -4,7 +4,7 @@
 
 menuconfig ARCNET
 	depends on NETDEVICES && (ISA || PCI || PCMCIA)
-	bool "ARCnet support"
+	tristate "ARCnet support"
 	---help---
 	  If you have a network card of this type, say Y and check out the
 	  (arguably) beautiful poetry in
drivers/net/phy/Kconfig +1 -1
index bb88e12..a702443 100644
@@ -3,7 +3,7 @@
 #
 
 menuconfig PHYLIB
-	bool "PHY Device support and infrastructure"
+	tristate "PHY Device support and infrastructure"
 	depends on !S390
 	depends on NETDEVICES
 	help
Signature · 1 line
1.7.7.3
maintainer
#14 lore raw

Re: [PATCH net-next 7/8] net: Revert ARCNET and PHYLIB to tristate options

From: Ben Hutchings <[email protected]>
Date: Sat, 26 Nov 2011 00:40:02 +0000

Quoted 8 lines

commit 88491d8103498a6166f70d5999902fec70924314 ("drivers/net: Kconfig & Makefile cleanup") changed the type of these options to bool, but they select code that could (and still can) be built as modules.

---
Yes David, they do still build this way. Even in an allmodconfig configuration, now. And I still really want this in net.

Color me extremely impressed.

Ok, I'll put this into 'net', pull it into 'net-next', then apply the rest of this series there.

Thanks!

#15 lore raw

PATCH 8/8 net: Use IS_ENABLED() in netdevice.h as appropriate

In reply to Ben Hutchings
---
 include/linux/netdevice.h |   18 ++++++++----------
 1 files changed, 8 insertions(+), 10 deletions(-)
include/linux/netdevice.h +8 -10
index 87f7353..ac9a4b9 100644
@@ -144,22 +144,20 @@ static inline bool dev_xmit_complete(int rc)
  *	used.
  */
 
-#if defined(CONFIG_WLAN) || defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE)
+#if defined(CONFIG_WLAN) || IS_ENABLED(CONFIG_AX25)
 # if defined(CONFIG_MAC80211_MESH)
 #  define LL_MAX_HEADER 128
 # else
 #  define LL_MAX_HEADER 96
 # endif
-#elif defined(CONFIG_TR) || defined(CONFIG_TR_MODULE)
+#elif IS_ENABLED(CONFIG_TR)
 # define LL_MAX_HEADER 48
 #else
 # define LL_MAX_HEADER 32
 #endif
 
-#if !defined(CONFIG_NET_IPIP) && !defined(CONFIG_NET_IPIP_MODULE) && \
-    !defined(CONFIG_NET_IPGRE) &&  !defined(CONFIG_NET_IPGRE_MODULE) && \
-    !defined(CONFIG_IPV6_SIT) && !defined(CONFIG_IPV6_SIT_MODULE) && \
-    !defined(CONFIG_IPV6_TUNNEL) && !defined(CONFIG_IPV6_TUNNEL_MODULE)
+#if !IS_ENABLED(CONFIG_NET_IPIP) && !IS_ENABLED(CONFIG_NET_IPGRE) && \
+    !IS_ENABLED(CONFIG_IPV6_SIT) && !IS_ENABLED(CONFIG_IPV6_TUNNEL)
 #define MAX_HEADER LL_MAX_HEADER
 #else
 #define MAX_HEADER (LL_MAX_HEADER + 48)
@@ -922,7 +920,7 @@ struct net_device_ops {
 	int			(*ndo_get_vf_port)(struct net_device *dev,
 						   int vf, struct sk_buff *skb);
 	int			(*ndo_setup_tc)(struct net_device *dev, u8 tc);
-#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE)
+#if IS_ENABLED(CONFIG_FCOE)
 	int			(*ndo_fcoe_enable)(struct net_device *dev);
 	int			(*ndo_fcoe_disable)(struct net_device *dev);
 	int			(*ndo_fcoe_ddp_setup)(struct net_device *dev,
@@ -937,7 +935,7 @@ struct net_device_ops {
 						       unsigned int sgc);
 #endif
 
-#if defined(CONFIG_LIBFCOE) || defined(CONFIG_LIBFCOE_MODULE)
+#if IS_ENABLED(CONFIG_LIBFCOE)
 #define NETDEV_FCOE_WWNN 0
 #define NETDEV_FCOE_WWPN 1
 	int			(*ndo_fcoe_get_wwn)(struct net_device *dev,
@@ -1076,7 +1074,7 @@ struct net_device {
 
 	/* Protocol specific pointers */
 
-#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
+#if IS_ENABLED(CONFIG_VLAN_8021Q)
 	struct vlan_group __rcu	*vlgrp;		/* VLAN group */
 #endif
 #if IS_ENABLED(CONFIG_NET_DSA)
@@ -1242,7 +1240,7 @@ struct net_device {
 	struct netdev_tc_txq tc_to_txq[TC_MAX_QUEUE];
 	u8 prio_tc_map[TC_BITMASK + 1];
 
-#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE)
+#if IS_ENABLED(CONFIG_FCOE)
 	/* max exchange id for FCoE LRO by ddp */
 	unsigned int		fcoe_ddp_xid;
 #endif
Signature · 1 line
1.7.7.3