All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 net-next 0/4] Reduce coupling between DSA and Broadcom SYSTEMPORT driver
@ 2021-01-07  1:23 Vladimir Oltean
  2021-01-07  1:24 ` [PATCH v2 net-next 1/4] net: dsa: move the Broadcom tag information in a separate header file Vladimir Oltean
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Vladimir Oltean @ 2021-01-07  1:23 UTC (permalink / raw)
  To: Florian Fainelli, David S. Miller, Jakub Kicinski, netdev
  Cc: Andrew Lunn, Vivien Didelot, bcm-kernel-feedback-list,
	Rafał Miłecki

From: Vladimir Oltean <vladimir.oltean@nxp.com>

Upon a quick inspection, it seems that there is some code in the generic
DSA layer that is somehow specific to the Broadcom SYSTEMPORT driver.
The challenge there is that the hardware integration is very tight between
the switch and the DSA master interface. However this does not mean that
the drivers must also be as integrated as the hardware is. We can avoid
creating a DSA notifier just for the Broadcom SYSTEMPORT, and we can
move some Broadcom-specific queue mapping helpers outside of the common
include/net/dsa.h.

Vladimir Oltean (4):
  net: dsa: move the Broadcom tag information in a separate header file
  net: dsa: export dsa_slave_dev_check
  net: systemport: use standard netdevice notifier to detect DSA
    presence
  net: dsa: remove the DSA specific notifiers

 MAINTAINERS                                |  1 +
 drivers/net/ethernet/broadcom/bcmsysport.c | 82 ++++++++++------------
 drivers/net/ethernet/broadcom/bcmsysport.h |  2 +-
 include/linux/dsa/brcm.h                   | 16 +++++
 include/net/dsa.h                          | 48 +------------
 net/dsa/dsa.c                              | 22 ------
 net/dsa/dsa_priv.h                         |  1 -
 net/dsa/slave.c                            | 18 +----
 net/dsa/tag_brcm.c                         |  1 +
 9 files changed, 60 insertions(+), 131 deletions(-)
 create mode 100644 include/linux/dsa/brcm.h

-- 
2.25.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v2 net-next 1/4] net: dsa: move the Broadcom tag information in a separate header file
  2021-01-07  1:23 [PATCH v2 net-next 0/4] Reduce coupling between DSA and Broadcom SYSTEMPORT driver Vladimir Oltean
@ 2021-01-07  1:24 ` Vladimir Oltean
  2021-01-07  1:24 ` [PATCH v2 net-next 2/4] net: dsa: export dsa_slave_dev_check Vladimir Oltean
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Vladimir Oltean @ 2021-01-07  1:24 UTC (permalink / raw)
  To: Florian Fainelli, David S. Miller, Jakub Kicinski, netdev
  Cc: Andrew Lunn, Vivien Didelot, bcm-kernel-feedback-list,
	Rafał Miłecki

From: Vladimir Oltean <vladimir.oltean@nxp.com>

It is a bit strange to see something as specific as Broadcom SYSTEMPORT
bits in the main DSA include file. Move these away into a separate
header, and have the tagger and the SYSTEMPORT driver include them.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
---
Changes in v2:
None.

 MAINTAINERS                                |  1 +
 drivers/net/ethernet/broadcom/bcmsysport.c |  1 +
 include/linux/dsa/brcm.h                   | 16 ++++++++++++++++
 include/net/dsa.h                          |  6 ------
 net/dsa/tag_brcm.c                         |  1 +
 5 files changed, 19 insertions(+), 6 deletions(-)
 create mode 100644 include/linux/dsa/brcm.h

diff --git a/MAINTAINERS b/MAINTAINERS
index 7c1e45c416b1..3854aca806f5 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -3400,6 +3400,7 @@ L:	openwrt-devel@lists.openwrt.org (subscribers-only)
 S:	Supported
 F:	Documentation/devicetree/bindings/net/dsa/brcm,b53.yaml
 F:	drivers/net/dsa/b53/*
+F:	include/linux/dsa/brcm.h
 F:	include/linux/platform_data/b53.h
 
 BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE
diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c
index b1ae9eb8f247..9ef743d6ba67 100644
--- a/drivers/net/ethernet/broadcom/bcmsysport.c
+++ b/drivers/net/ethernet/broadcom/bcmsysport.c
@@ -12,6 +12,7 @@
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/netdevice.h>
+#include <linux/dsa/brcm.h>
 #include <linux/etherdevice.h>
 #include <linux/platform_device.h>
 #include <linux/of.h>
diff --git a/include/linux/dsa/brcm.h b/include/linux/dsa/brcm.h
new file mode 100644
index 000000000000..47545a948784
--- /dev/null
+++ b/include/linux/dsa/brcm.h
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: GPL-2.0-only
+ * Copyright (C) 2014 Broadcom Corporation
+ */
+
+/* Included by drivers/net/ethernet/broadcom/bcmsysport.c and
+ * net/dsa/tag_brcm.c
+ */
+#ifndef _NET_DSA_BRCM_H
+#define _NET_DSA_BRCM_H
+
+/* Broadcom tag specific helpers to insert and extract queue/port number */
+#define BRCM_TAG_SET_PORT_QUEUE(p, q)	((p) << 8 | q)
+#define BRCM_TAG_GET_PORT(v)		((v) >> 8)
+#define BRCM_TAG_GET_QUEUE(v)		((v) & 0xff)
+
+#endif
diff --git a/include/net/dsa.h b/include/net/dsa.h
index 4e60d2610f20..af9a4f9ee764 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -873,12 +873,6 @@ static inline int call_dsa_notifiers(unsigned long val, struct net_device *dev,
 }
 #endif
 
-/* Broadcom tag specific helpers to insert and extract queue/port number */
-#define BRCM_TAG_SET_PORT_QUEUE(p, q)	((p) << 8 | q)
-#define BRCM_TAG_GET_PORT(v)		((v) >> 8)
-#define BRCM_TAG_GET_QUEUE(v)		((v) & 0xff)
-
-
 netdev_tx_t dsa_enqueue_skb(struct sk_buff *skb, struct net_device *dev);
 int dsa_port_get_phy_strings(struct dsa_port *dp, uint8_t *data);
 int dsa_port_get_ethtool_phy_stats(struct dsa_port *dp, uint64_t *data);
diff --git a/net/dsa/tag_brcm.c b/net/dsa/tag_brcm.c
index e934dace3922..e2577a7dcbca 100644
--- a/net/dsa/tag_brcm.c
+++ b/net/dsa/tag_brcm.c
@@ -5,6 +5,7 @@
  * Copyright (C) 2014 Broadcom Corporation
  */
 
+#include <linux/dsa/brcm.h>
 #include <linux/etherdevice.h>
 #include <linux/list.h>
 #include <linux/slab.h>
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v2 net-next 2/4] net: dsa: export dsa_slave_dev_check
  2021-01-07  1:23 [PATCH v2 net-next 0/4] Reduce coupling between DSA and Broadcom SYSTEMPORT driver Vladimir Oltean
  2021-01-07  1:24 ` [PATCH v2 net-next 1/4] net: dsa: move the Broadcom tag information in a separate header file Vladimir Oltean
@ 2021-01-07  1:24 ` Vladimir Oltean
  2021-01-07  1:24 ` [PATCH v2 net-next 3/4] net: systemport: use standard netdevice notifier to detect DSA presence Vladimir Oltean
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Vladimir Oltean @ 2021-01-07  1:24 UTC (permalink / raw)
  To: Florian Fainelli, David S. Miller, Jakub Kicinski, netdev
  Cc: Andrew Lunn, Vivien Didelot, bcm-kernel-feedback-list,
	Rafał Miłecki

From: Vladimir Oltean <vladimir.oltean@nxp.com>

Using the NETDEV_CHANGEUPPER notifications, drivers can be aware when
they are enslaved to e.g. a bridge by calling netif_is_bridge_master().

Export this helper from DSA to get the equivalent functionality of
determining whether the upper interface of a CHANGEUPPER notifier is a
DSA switch interface or not.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
---
Changes in v2:
None.

 include/net/dsa.h  | 6 ++++++
 net/dsa/dsa_priv.h | 1 -
 net/dsa/slave.c    | 1 +
 3 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/include/net/dsa.h b/include/net/dsa.h
index af9a4f9ee764..5badfd6403c5 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -855,6 +855,7 @@ int register_dsa_notifier(struct notifier_block *nb);
 int unregister_dsa_notifier(struct notifier_block *nb);
 int call_dsa_notifiers(unsigned long val, struct net_device *dev,
 		       struct dsa_notifier_info *info);
+bool dsa_slave_dev_check(const struct net_device *dev);
 #else
 static inline int register_dsa_notifier(struct notifier_block *nb)
 {
@@ -871,6 +872,11 @@ static inline int call_dsa_notifiers(unsigned long val, struct net_device *dev,
 {
 	return NOTIFY_DONE;
 }
+
+static inline bool dsa_slave_dev_check(const struct net_device *dev)
+{
+	return false;
+}
 #endif
 
 netdev_tx_t dsa_enqueue_skb(struct sk_buff *skb, struct net_device *dev);
diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h
index 7c96aae9062c..33c082f10bb9 100644
--- a/net/dsa/dsa_priv.h
+++ b/net/dsa/dsa_priv.h
@@ -172,7 +172,6 @@ extern const struct dsa_device_ops notag_netdev_ops;
 void dsa_slave_mii_bus_init(struct dsa_switch *ds);
 int dsa_slave_create(struct dsa_port *dp);
 void dsa_slave_destroy(struct net_device *slave_dev);
-bool dsa_slave_dev_check(const struct net_device *dev);
 int dsa_slave_suspend(struct net_device *slave_dev);
 int dsa_slave_resume(struct net_device *slave_dev);
 int dsa_slave_register_notifier(void);
diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index 4a0498bf6c65..c01bc7ebeb14 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -1924,6 +1924,7 @@ bool dsa_slave_dev_check(const struct net_device *dev)
 {
 	return dev->netdev_ops == &dsa_slave_netdev_ops;
 }
+EXPORT_SYMBOL_GPL(dsa_slave_dev_check);
 
 static int dsa_slave_changeupper(struct net_device *dev,
 				 struct netdev_notifier_changeupper_info *info)
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v2 net-next 3/4] net: systemport: use standard netdevice notifier to detect DSA presence
  2021-01-07  1:23 [PATCH v2 net-next 0/4] Reduce coupling between DSA and Broadcom SYSTEMPORT driver Vladimir Oltean
  2021-01-07  1:24 ` [PATCH v2 net-next 1/4] net: dsa: move the Broadcom tag information in a separate header file Vladimir Oltean
  2021-01-07  1:24 ` [PATCH v2 net-next 2/4] net: dsa: export dsa_slave_dev_check Vladimir Oltean
@ 2021-01-07  1:24 ` Vladimir Oltean
  2021-01-07  1:24 ` [PATCH v2 net-next 4/4] net: dsa: remove the DSA specific notifiers Vladimir Oltean
  2021-01-07 23:50 ` [PATCH v2 net-next 0/4] Reduce coupling between DSA and Broadcom SYSTEMPORT driver patchwork-bot+netdevbpf
  4 siblings, 0 replies; 6+ messages in thread
From: Vladimir Oltean @ 2021-01-07  1:24 UTC (permalink / raw)
  To: Florian Fainelli, David S. Miller, Jakub Kicinski, netdev
  Cc: Andrew Lunn, Vivien Didelot, bcm-kernel-feedback-list,
	Rafał Miłecki

From: Vladimir Oltean <vladimir.oltean@nxp.com>

The SYSTEMPORT driver maps each port of the embedded Broadcom DSA switch
port to a certain queue of the master Ethernet controller. For that it
currently uses a dedicated notifier infrastructure which was added in
commit 60724d4bae14 ("net: dsa: Add support for DSA specific notifiers").

However, since commit 2f1e8ea726e9 ("net: dsa: link interfaces with the
DSA master to get rid of lockdep warnings"), DSA is actually an upper of
the Broadcom SYSTEMPORT as far as the netdevice adjacency lists are
concerned. So naturally, the plain NETDEV_CHANGEUPPER net device notifiers
are emitted. It looks like there is enough API exposed by DSA to the
outside world already to make the call_dsa_notifiers API redundant. So
let's convert its only user to plain netdev notifiers.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Tested-by: Florian Fainelli <f.fainelli@gmail.com>
---
Changes in v2:
Kept the container_of(nb, struct bcm_sysport_priv, dsa_notifier) in the
code, which repairs an issue introduced in v1.

 drivers/net/ethernet/broadcom/bcmsysport.c | 81 ++++++++++------------
 drivers/net/ethernet/broadcom/bcmsysport.h |  2 +-
 2 files changed, 37 insertions(+), 46 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c
index 9ef743d6ba67..a8b20441ca7c 100644
--- a/drivers/net/ethernet/broadcom/bcmsysport.c
+++ b/drivers/net/ethernet/broadcom/bcmsysport.c
@@ -2311,33 +2311,22 @@ static const struct net_device_ops bcm_sysport_netdev_ops = {
 	.ndo_select_queue	= bcm_sysport_select_queue,
 };
 
-static int bcm_sysport_map_queues(struct notifier_block *nb,
-				  struct dsa_notifier_register_info *info)
+static int bcm_sysport_map_queues(struct net_device *dev,
+				  struct net_device *slave_dev)
 {
+	struct dsa_port *dp = dsa_port_from_netdev(slave_dev);
+	struct bcm_sysport_priv *priv = netdev_priv(dev);
 	struct bcm_sysport_tx_ring *ring;
-	struct bcm_sysport_priv *priv;
-	struct net_device *slave_dev;
 	unsigned int num_tx_queues;
 	unsigned int q, qp, port;
-	struct net_device *dev;
-
-	priv = container_of(nb, struct bcm_sysport_priv, dsa_notifier);
-	if (priv->netdev != info->master)
-		return 0;
-
-	dev = info->master;
 
 	/* We can't be setting up queue inspection for non directly attached
 	 * switches
 	 */
-	if (info->switch_number)
+	if (dp->ds->index)
 		return 0;
 
-	if (dev->netdev_ops != &bcm_sysport_netdev_ops)
-		return 0;
-
-	port = info->port_number;
-	slave_dev = info->info.dev;
+	port = dp->index;
 
 	/* On SYSTEMPORT Lite we have twice as less queues, so we cannot do a
 	 * 1:1 mapping, we can only do a 2:1 mapping. By reducing the number of
@@ -2377,27 +2366,16 @@ static int bcm_sysport_map_queues(struct notifier_block *nb,
 	return 0;
 }
 
-static int bcm_sysport_unmap_queues(struct notifier_block *nb,
-				    struct dsa_notifier_register_info *info)
+static int bcm_sysport_unmap_queues(struct net_device *dev,
+				    struct net_device *slave_dev)
 {
+	struct dsa_port *dp = dsa_port_from_netdev(slave_dev);
+	struct bcm_sysport_priv *priv = netdev_priv(dev);
 	struct bcm_sysport_tx_ring *ring;
-	struct bcm_sysport_priv *priv;
-	struct net_device *slave_dev;
 	unsigned int num_tx_queues;
-	struct net_device *dev;
 	unsigned int q, qp, port;
 
-	priv = container_of(nb, struct bcm_sysport_priv, dsa_notifier);
-	if (priv->netdev != info->master)
-		return 0;
-
-	dev = info->master;
-
-	if (dev->netdev_ops != &bcm_sysport_netdev_ops)
-		return 0;
-
-	port = info->port_number;
-	slave_dev = info->info.dev;
+	port = dp->index;
 
 	num_tx_queues = slave_dev->real_num_tx_queues;
 
@@ -2418,17 +2396,30 @@ static int bcm_sysport_unmap_queues(struct notifier_block *nb,
 	return 0;
 }
 
-static int bcm_sysport_dsa_notifier(struct notifier_block *nb,
-				    unsigned long event, void *ptr)
+static int bcm_sysport_netdevice_event(struct notifier_block *nb,
+				       unsigned long event, void *ptr)
 {
-	int ret = NOTIFY_DONE;
+	struct net_device *dev = netdev_notifier_info_to_dev(ptr);
+	struct netdev_notifier_changeupper_info *info = ptr;
+	struct bcm_sysport_priv *priv;
+	int ret = 0;
+
+	priv = container_of(nb, struct bcm_sysport_priv, netdev_notifier);
+	if (priv->netdev != dev)
+		return NOTIFY_DONE;
 
 	switch (event) {
-	case DSA_PORT_REGISTER:
-		ret = bcm_sysport_map_queues(nb, ptr);
-		break;
-	case DSA_PORT_UNREGISTER:
-		ret = bcm_sysport_unmap_queues(nb, ptr);
+	case NETDEV_CHANGEUPPER:
+		if (dev->netdev_ops != &bcm_sysport_netdev_ops)
+			return NOTIFY_DONE;
+
+		if (!dsa_slave_dev_check(info->upper_dev))
+			return NOTIFY_DONE;
+
+		if (info->linking)
+			ret = bcm_sysport_map_queues(dev, info->upper_dev);
+		else
+			ret = bcm_sysport_unmap_queues(dev, info->upper_dev);
 		break;
 	}
 
@@ -2601,9 +2592,9 @@ static int bcm_sysport_probe(struct platform_device *pdev)
 	priv->rx_max_coalesced_frames = 1;
 	u64_stats_init(&priv->syncp);
 
-	priv->dsa_notifier.notifier_call = bcm_sysport_dsa_notifier;
+	priv->netdev_notifier.notifier_call = bcm_sysport_netdevice_event;
 
-	ret = register_dsa_notifier(&priv->dsa_notifier);
+	ret = register_netdevice_notifier(&priv->netdev_notifier);
 	if (ret) {
 		dev_err(&pdev->dev, "failed to register DSA notifier\n");
 		goto err_deregister_fixed_link;
@@ -2630,7 +2621,7 @@ static int bcm_sysport_probe(struct platform_device *pdev)
 	return 0;
 
 err_deregister_notifier:
-	unregister_dsa_notifier(&priv->dsa_notifier);
+	unregister_netdevice_notifier(&priv->netdev_notifier);
 err_deregister_fixed_link:
 	if (of_phy_is_fixed_link(dn))
 		of_phy_deregister_fixed_link(dn);
@@ -2648,7 +2639,7 @@ static int bcm_sysport_remove(struct platform_device *pdev)
 	/* Not much to do, ndo_close has been called
 	 * and we use managed allocations
 	 */
-	unregister_dsa_notifier(&priv->dsa_notifier);
+	unregister_netdevice_notifier(&priv->netdev_notifier);
 	unregister_netdev(dev);
 	if (of_phy_is_fixed_link(dn))
 		of_phy_deregister_fixed_link(dn);
diff --git a/drivers/net/ethernet/broadcom/bcmsysport.h b/drivers/net/ethernet/broadcom/bcmsysport.h
index 3a5cb6f128f5..fefd3ccf0379 100644
--- a/drivers/net/ethernet/broadcom/bcmsysport.h
+++ b/drivers/net/ethernet/broadcom/bcmsysport.h
@@ -787,7 +787,7 @@ struct bcm_sysport_priv {
 	struct u64_stats_sync	syncp;
 
 	/* map information between switch port queues and local queues */
-	struct notifier_block	dsa_notifier;
+	struct notifier_block	netdev_notifier;
 	unsigned int		per_port_num_tx_queues;
 	struct bcm_sysport_tx_ring *ring_map[DSA_MAX_PORTS * 8];
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v2 net-next 4/4] net: dsa: remove the DSA specific notifiers
  2021-01-07  1:23 [PATCH v2 net-next 0/4] Reduce coupling between DSA and Broadcom SYSTEMPORT driver Vladimir Oltean
                   ` (2 preceding siblings ...)
  2021-01-07  1:24 ` [PATCH v2 net-next 3/4] net: systemport: use standard netdevice notifier to detect DSA presence Vladimir Oltean
@ 2021-01-07  1:24 ` Vladimir Oltean
  2021-01-07 23:50 ` [PATCH v2 net-next 0/4] Reduce coupling between DSA and Broadcom SYSTEMPORT driver patchwork-bot+netdevbpf
  4 siblings, 0 replies; 6+ messages in thread
From: Vladimir Oltean @ 2021-01-07  1:24 UTC (permalink / raw)
  To: Florian Fainelli, David S. Miller, Jakub Kicinski, netdev
  Cc: Andrew Lunn, Vivien Didelot, bcm-kernel-feedback-list,
	Rafał Miłecki

From: Vladimir Oltean <vladimir.oltean@nxp.com>

This effectively reverts commit 60724d4bae14 ("net: dsa: Add support for
DSA specific notifiers"). The reason is that since commit 2f1e8ea726e9
("net: dsa: link interfaces with the DSA master to get rid of lockdep
warnings"), it appears that there is a generic way to achieve the same
purpose. The only user thus far, the Broadcom SYSTEMPORT driver, was
converted to use the generic notifiers.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
---
Changes in v2:
None.

 include/net/dsa.h | 42 ------------------------------------------
 net/dsa/dsa.c     | 22 ----------------------
 net/dsa/slave.c   | 17 -----------------
 3 files changed, 81 deletions(-)

diff --git a/include/net/dsa.h b/include/net/dsa.h
index 5badfd6403c5..3950e4832a33 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -828,51 +828,9 @@ static inline int dsa_switch_resume(struct dsa_switch *ds)
 }
 #endif /* CONFIG_PM_SLEEP */
 
-enum dsa_notifier_type {
-	DSA_PORT_REGISTER,
-	DSA_PORT_UNREGISTER,
-};
-
-struct dsa_notifier_info {
-	struct net_device *dev;
-};
-
-struct dsa_notifier_register_info {
-	struct dsa_notifier_info info;	/* must be first */
-	struct net_device *master;
-	unsigned int port_number;
-	unsigned int switch_number;
-};
-
-static inline struct net_device *
-dsa_notifier_info_to_dev(const struct dsa_notifier_info *info)
-{
-	return info->dev;
-}
-
 #if IS_ENABLED(CONFIG_NET_DSA)
-int register_dsa_notifier(struct notifier_block *nb);
-int unregister_dsa_notifier(struct notifier_block *nb);
-int call_dsa_notifiers(unsigned long val, struct net_device *dev,
-		       struct dsa_notifier_info *info);
 bool dsa_slave_dev_check(const struct net_device *dev);
 #else
-static inline int register_dsa_notifier(struct notifier_block *nb)
-{
-	return 0;
-}
-
-static inline int unregister_dsa_notifier(struct notifier_block *nb)
-{
-	return 0;
-}
-
-static inline int call_dsa_notifiers(unsigned long val, struct net_device *dev,
-				     struct dsa_notifier_info *info)
-{
-	return NOTIFY_DONE;
-}
-
 static inline bool dsa_slave_dev_check(const struct net_device *dev)
 {
 	return false;
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
index a1b1dc8a4d87..df75481b12ed 100644
--- a/net/dsa/dsa.c
+++ b/net/dsa/dsa.c
@@ -309,28 +309,6 @@ bool dsa_schedule_work(struct work_struct *work)
 	return queue_work(dsa_owq, work);
 }
 
-static ATOMIC_NOTIFIER_HEAD(dsa_notif_chain);
-
-int register_dsa_notifier(struct notifier_block *nb)
-{
-	return atomic_notifier_chain_register(&dsa_notif_chain, nb);
-}
-EXPORT_SYMBOL_GPL(register_dsa_notifier);
-
-int unregister_dsa_notifier(struct notifier_block *nb)
-{
-	return atomic_notifier_chain_unregister(&dsa_notif_chain, nb);
-}
-EXPORT_SYMBOL_GPL(unregister_dsa_notifier);
-
-int call_dsa_notifiers(unsigned long val, struct net_device *dev,
-		       struct dsa_notifier_info *info)
-{
-	info->dev = dev;
-	return atomic_notifier_call_chain(&dsa_notif_chain, val, info);
-}
-EXPORT_SYMBOL_GPL(call_dsa_notifiers);
-
 int dsa_devlink_param_get(struct devlink *dl, u32 id,
 			  struct devlink_param_gset_ctx *ctx)
 {
diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index c01bc7ebeb14..1b511895e7a5 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -1764,20 +1764,6 @@ int dsa_slave_resume(struct net_device *slave_dev)
 	return 0;
 }
 
-static void dsa_slave_notify(struct net_device *dev, unsigned long val)
-{
-	struct net_device *master = dsa_slave_to_master(dev);
-	struct dsa_port *dp = dsa_slave_to_port(dev);
-	struct dsa_notifier_register_info rinfo = {
-		.switch_number = dp->ds->index,
-		.port_number = dp->index,
-		.master = master,
-		.info.dev = dev,
-	};
-
-	call_dsa_notifiers(val, dev, &rinfo.info);
-}
-
 int dsa_slave_create(struct dsa_port *port)
 {
 	const struct dsa_port *cpu_dp = port->cpu_dp;
@@ -1863,8 +1849,6 @@ int dsa_slave_create(struct dsa_port *port)
 		goto out_gcells;
 	}
 
-	dsa_slave_notify(slave_dev, DSA_PORT_REGISTER);
-
 	rtnl_lock();
 
 	ret = register_netdevice(slave_dev);
@@ -1913,7 +1897,6 @@ void dsa_slave_destroy(struct net_device *slave_dev)
 	phylink_disconnect_phy(dp->pl);
 	rtnl_unlock();
 
-	dsa_slave_notify(slave_dev, DSA_PORT_UNREGISTER);
 	phylink_destroy(dp->pl);
 	gro_cells_destroy(&p->gcells);
 	free_percpu(slave_dev->tstats);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 net-next 0/4] Reduce coupling between DSA and Broadcom SYSTEMPORT driver
  2021-01-07  1:23 [PATCH v2 net-next 0/4] Reduce coupling between DSA and Broadcom SYSTEMPORT driver Vladimir Oltean
                   ` (3 preceding siblings ...)
  2021-01-07  1:24 ` [PATCH v2 net-next 4/4] net: dsa: remove the DSA specific notifiers Vladimir Oltean
@ 2021-01-07 23:50 ` patchwork-bot+netdevbpf
  4 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-01-07 23:50 UTC (permalink / raw)
  To: Vladimir Oltean
  Cc: f.fainelli, davem, kuba, netdev, andrew, vivien.didelot,
	bcm-kernel-feedback-list, zajec5

Hello:

This series was applied to netdev/net-next.git (refs/heads/master):

On Thu,  7 Jan 2021 03:23:59 +0200 you wrote:
> From: Vladimir Oltean <vladimir.oltean@nxp.com>
> 
> Upon a quick inspection, it seems that there is some code in the generic
> DSA layer that is somehow specific to the Broadcom SYSTEMPORT driver.
> The challenge there is that the hardware integration is very tight between
> the switch and the DSA master interface. However this does not mean that
> the drivers must also be as integrated as the hardware is. We can avoid
> creating a DSA notifier just for the Broadcom SYSTEMPORT, and we can
> move some Broadcom-specific queue mapping helpers outside of the common
> include/net/dsa.h.
> 
> [...]

Here is the summary with links:
  - [v2,net-next,1/4] net: dsa: move the Broadcom tag information in a separate header file
    https://git.kernel.org/netdev/net-next/c/f46b9b8ee89b
  - [v2,net-next,2/4] net: dsa: export dsa_slave_dev_check
    https://git.kernel.org/netdev/net-next/c/a5e3c9ba9258
  - [v2,net-next,3/4] net: systemport: use standard netdevice notifier to detect DSA presence
    https://git.kernel.org/netdev/net-next/c/1593cd40d785
  - [v2,net-next,4/4] net: dsa: remove the DSA specific notifiers
    https://git.kernel.org/netdev/net-next/c/1dbb130281c4

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-01-07 23:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-07  1:23 [PATCH v2 net-next 0/4] Reduce coupling between DSA and Broadcom SYSTEMPORT driver Vladimir Oltean
2021-01-07  1:24 ` [PATCH v2 net-next 1/4] net: dsa: move the Broadcom tag information in a separate header file Vladimir Oltean
2021-01-07  1:24 ` [PATCH v2 net-next 2/4] net: dsa: export dsa_slave_dev_check Vladimir Oltean
2021-01-07  1:24 ` [PATCH v2 net-next 3/4] net: systemport: use standard netdevice notifier to detect DSA presence Vladimir Oltean
2021-01-07  1:24 ` [PATCH v2 net-next 4/4] net: dsa: remove the DSA specific notifiers Vladimir Oltean
2021-01-07 23:50 ` [PATCH v2 net-next 0/4] Reduce coupling between DSA and Broadcom SYSTEMPORT driver patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.