All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next 0/4] Automatically manage DSA master interface state
@ 2021-01-27  1:00 Vladimir Oltean
  2021-01-27  1:00 ` [PATCH net-next 1/4] net: dsa: automatically bring up DSA master when opening user port Vladimir Oltean
                   ` (5 more replies)
  0 siblings, 6 replies; 20+ messages in thread
From: Vladimir Oltean @ 2021-01-27  1:00 UTC (permalink / raw)
  To: David S . Miller, Jakub Kicinski, netdev
  Cc: Andrew Lunn, Florian Fainelli, Vivien Didelot, Hideaki YOSHIFUJI

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

This patch series adds code that makes DSA open the master interface
automatically whenever one user interface gets opened, either by the
user, or by various networking subsystems: netconsole, nfsroot.
With that in place, we can remove some of the places in the network
stack where DSA-specific code was sprinkled.

Vladimir Oltean (4):
  net: dsa: automatically bring up DSA master when opening user port
  net: dsa: automatically bring user ports down when master goes down
  Revert "net: Have netpoll bring-up DSA management interface"
  Revert "net: ipv4: handle DSA enabled master network devices"

 Documentation/networking/dsa/dsa.rst |  4 ---
 net/core/netpoll.c                   | 22 +++------------
 net/dsa/slave.c                      | 40 ++++++++++++++++++++++++++--
 net/ipv4/ipconfig.c                  | 21 ++++++++++++---
 4 files changed, 59 insertions(+), 28 deletions(-)

-- 
2.25.1


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

* [PATCH net-next 1/4] net: dsa: automatically bring up DSA master when opening user port
  2021-01-27  1:00 [PATCH net-next 0/4] Automatically manage DSA master interface state Vladimir Oltean
@ 2021-01-27  1:00 ` Vladimir Oltean
  2021-01-28  0:51   ` Andrew Lunn
  2021-01-28  1:41   ` Florian Fainelli
  2021-01-27  1:00 ` [PATCH net-next 2/4] net: dsa: automatically bring user ports down when master goes down Vladimir Oltean
                   ` (4 subsequent siblings)
  5 siblings, 2 replies; 20+ messages in thread
From: Vladimir Oltean @ 2021-01-27  1:00 UTC (permalink / raw)
  To: David S . Miller, Jakub Kicinski, netdev
  Cc: Andrew Lunn, Florian Fainelli, Vivien Didelot, Hideaki YOSHIFUJI

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

DSA wants the master interface to be open before the user port is due to
historical reasons. The promiscuity of interfaces that are down used to
have issues, as referenced Lennert Buytenhek in commit df02c6ff2e39
("dsa: fix master interface allmulti/promisc handling").

The bugfix mentioned there, commit b6c40d68ff64 ("net: only invoke
dev->change_rx_flags when device is UP"), was basically a "don't do
that" approach to working around the promiscuity while down issue.

Further work done by Vlad Yasevich in commit d2615bf45069 ("net: core:
Always propagate flag changes to interfaces") has resolved the
underlying issue, and it is strictly up to the DSA and 8021q drivers
now, it is no longer mandated by the networking core that the master
interface must be up when changing its promiscuity.

From DSA's point of view, deciding to error out in dsa_slave_open
because the master isn't up is (a) a bad user experience and (b) missing
the forest for the trees. Even if there still was an issue with
promiscuity while down, DSA could still do this and avoid it: open the
DSA master manually, then do whatever. Voila, the DSA master is now up,
no need to error out.

Doing it this way has the additional benefit that user space can now
remove DSA-specific workarounds, like systemd-networkd with BindCarrier:
https://github.com/systemd/systemd/issues/7478

And we can finally remove one of the 2 bullets in the "Common pitfalls
using DSA setups" chapter.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
 Documentation/networking/dsa/dsa.rst |  4 ----
 net/dsa/slave.c                      | 10 ++++++++--
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/Documentation/networking/dsa/dsa.rst b/Documentation/networking/dsa/dsa.rst
index a8d15dd2b42b..e9517af5fe02 100644
--- a/Documentation/networking/dsa/dsa.rst
+++ b/Documentation/networking/dsa/dsa.rst
@@ -273,10 +273,6 @@ will not make us go through the switch tagging protocol transmit function, so
 the Ethernet switch on the other end, expecting a tag will typically drop this
 frame.
 
-Slave network devices check that the master network device is UP before allowing
-you to administratively bring UP these slave network devices. A common
-configuration mistake is forgetting to bring UP the master network device first.
-
 Interactions with other subsystems
 ==================================
 
diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index f2fb433f3828..393294a53834 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -68,8 +68,14 @@ static int dsa_slave_open(struct net_device *dev)
 	struct dsa_port *dp = dsa_slave_to_port(dev);
 	int err;
 
-	if (!(master->flags & IFF_UP))
-		return -ENETDOWN;
+	if (!(master->flags & IFF_UP)) {
+		err = dev_change_flags(master, master->flags | IFF_UP, NULL);
+		if (err < 0) {
+			netdev_err(dev, "failed to open master %s\n",
+				   master->name);
+			goto out;
+		}
+	}
 
 	if (!ether_addr_equal(dev->dev_addr, master->dev_addr)) {
 		err = dev_uc_add(master, dev->dev_addr);
-- 
2.25.1


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

* [PATCH net-next 2/4] net: dsa: automatically bring user ports down when master goes down
  2021-01-27  1:00 [PATCH net-next 0/4] Automatically manage DSA master interface state Vladimir Oltean
  2021-01-27  1:00 ` [PATCH net-next 1/4] net: dsa: automatically bring up DSA master when opening user port Vladimir Oltean
@ 2021-01-27  1:00 ` Vladimir Oltean
  2021-01-28  0:46   ` Andrew Lunn
  2021-01-27  1:00 ` [PATCH net-next 3/4] Revert "net: Have netpoll bring-up DSA management interface" Vladimir Oltean
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 20+ messages in thread
From: Vladimir Oltean @ 2021-01-27  1:00 UTC (permalink / raw)
  To: David S . Miller, Jakub Kicinski, netdev
  Cc: Andrew Lunn, Florian Fainelli, Vivien Didelot, Hideaki YOSHIFUJI

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

This is not fixing any actual bug that I know of, but having a DSA
interface that is up even when its lower (master) interface is down is
one of those things that just do not sound right.

Yes, DSA checks if the master is up before actually bringing the
user interface up, but nobody prevents bringing the master interface
down immediately afterwards... Then the user ports would attempt
dev_queue_xmit on an interface that is down, and wonder what's wrong.

This patch prevents that from happening. NETDEV_GOING_DOWN is the
notification emitted _before_ the master actually goes down, and we are
protected by the rtnl_mutex, so all is well.

$ ip link set eno2 down
[  763.672211] mscc_felix 0000:00:00.5 swp0: Link is Down
[  763.880137] mscc_felix 0000:00:00.5 swp1: Link is Down
[  764.078773] mscc_felix 0000:00:00.5 swp2: Link is Down
[  764.197106] mscc_felix 0000:00:00.5 swp3: Link is Down
[  764.299384] fsl_enetc 0000:00:00.2 eno2: Link is Down

For those of you reading this because you were doing switch testing
such as latency measurements for autonomously forwarded traffic, and you
needed a controlled environment with no extra packets sent by the
network stack, this patch breaks that, because now the user ports go
down too, which may shut down the PHY etc. But please don't do it like
that, just do instead:

tc qdisc add dev eno2 clsact
tc filter add dev eno2 egress flower action drop

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
 net/dsa/slave.c | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index 393294a53834..5e5798b46f34 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -2073,6 +2073,36 @@ static int dsa_slave_netdevice_event(struct notifier_block *nb,
 		err = dsa_port_lag_change(dp, info->lower_state_info);
 		return notifier_from_errno(err);
 	}
+	case NETDEV_GOING_DOWN: {
+		struct dsa_port *dp, *cpu_dp;
+		struct dsa_switch_tree *dst;
+		int err = 0;
+
+		if (!netdev_uses_dsa(dev))
+			return NOTIFY_DONE;
+
+		cpu_dp = dev->dsa_ptr;
+		dst = cpu_dp->ds->dst;
+
+		list_for_each_entry(dp, &dst->ports, list) {
+			if (!dsa_is_user_port(dp->ds, dp->index)) {
+				struct net_device *slave = dp->slave;
+
+				if (!(slave->flags & IFF_UP))
+					continue;
+
+				err = dev_change_flags(slave,
+						       slave->flags & ~IFF_UP,
+						       NULL);
+				if (err)
+					break;
+			}
+		}
+
+		return notifier_from_errno(err);
+	}
+	default:
+		break;
 	}
 
 	return NOTIFY_DONE;
-- 
2.25.1


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

* [PATCH net-next 3/4] Revert "net: Have netpoll bring-up DSA management interface"
  2021-01-27  1:00 [PATCH net-next 0/4] Automatically manage DSA master interface state Vladimir Oltean
  2021-01-27  1:00 ` [PATCH net-next 1/4] net: dsa: automatically bring up DSA master when opening user port Vladimir Oltean
  2021-01-27  1:00 ` [PATCH net-next 2/4] net: dsa: automatically bring user ports down when master goes down Vladimir Oltean
@ 2021-01-27  1:00 ` Vladimir Oltean
  2021-01-28  0:52   ` Andrew Lunn
  2021-01-28  1:43   ` Florian Fainelli
  2021-01-27  1:00 ` [PATCH net-next 4/4] Revert "net: ipv4: handle DSA enabled master network devices" Vladimir Oltean
                   ` (2 subsequent siblings)
  5 siblings, 2 replies; 20+ messages in thread
From: Vladimir Oltean @ 2021-01-27  1:00 UTC (permalink / raw)
  To: David S . Miller, Jakub Kicinski, netdev
  Cc: Andrew Lunn, Florian Fainelli, Vivien Didelot, Hideaki YOSHIFUJI

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

This reverts commit 1532b9778478577152201adbafa7738b1e844868.

The above commit is good and it works, however it was meant as a bugfix
for stable kernels and now we have more self-contained ways in DSA to
handle the situation where the DSA master must be brought up.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
 net/core/netpoll.c | 22 ++++------------------
 1 file changed, 4 insertions(+), 18 deletions(-)

diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index 960948290001..c310c7c1cef7 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -29,7 +29,6 @@
 #include <linux/slab.h>
 #include <linux/export.h>
 #include <linux/if_vlan.h>
-#include <net/dsa.h>
 #include <net/tcp.h>
 #include <net/udp.h>
 #include <net/addrconf.h>
@@ -658,15 +657,15 @@ EXPORT_SYMBOL_GPL(__netpoll_setup);
 
 int netpoll_setup(struct netpoll *np)
 {
-	struct net_device *ndev = NULL, *dev = NULL;
-	struct net *net = current->nsproxy->net_ns;
+	struct net_device *ndev = NULL;
 	struct in_device *in_dev;
 	int err;
 
 	rtnl_lock();
-	if (np->dev_name[0])
+	if (np->dev_name[0]) {
+		struct net *net = current->nsproxy->net_ns;
 		ndev = __dev_get_by_name(net, np->dev_name);
-
+	}
 	if (!ndev) {
 		np_err(np, "%s doesn't exist, aborting\n", np->dev_name);
 		err = -ENODEV;
@@ -674,19 +673,6 @@ int netpoll_setup(struct netpoll *np)
 	}
 	dev_hold(ndev);
 
-	/* bring up DSA management network devices up first */
-	for_each_netdev(net, dev) {
-		if (!netdev_uses_dsa(dev))
-			continue;
-
-		err = dev_change_flags(dev, dev->flags | IFF_UP, NULL);
-		if (err < 0) {
-			np_err(np, "%s failed to open %s\n",
-			       np->dev_name, dev->name);
-			goto put;
-		}
-	}
-
 	if (netdev_master_upper_dev_get(ndev)) {
 		np_err(np, "%s is a slave device, aborting\n", np->dev_name);
 		err = -EBUSY;
-- 
2.25.1


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

* [PATCH net-next 4/4] Revert "net: ipv4: handle DSA enabled master network devices"
  2021-01-27  1:00 [PATCH net-next 0/4] Automatically manage DSA master interface state Vladimir Oltean
                   ` (2 preceding siblings ...)
  2021-01-27  1:00 ` [PATCH net-next 3/4] Revert "net: Have netpoll bring-up DSA management interface" Vladimir Oltean
@ 2021-01-27  1:00 ` Vladimir Oltean
  2021-01-28  0:56   ` Andrew Lunn
  2021-01-28  1:43   ` Florian Fainelli
  2021-01-27  1:25 ` [PATCH net-next 0/4] Automatically manage DSA master interface state Vladimir Oltean
  2021-01-28  1:03 ` Florian Fainelli
  5 siblings, 2 replies; 20+ messages in thread
From: Vladimir Oltean @ 2021-01-27  1:00 UTC (permalink / raw)
  To: David S . Miller, Jakub Kicinski, netdev
  Cc: Andrew Lunn, Florian Fainelli, Vivien Didelot, Hideaki YOSHIFUJI

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

This reverts commit 728c02089a0e3eefb02e9927bfae50490f40e72e.

Since 2015 DSA has gained more integration with the network stack, we
can now have the same functionality without explicitly open-coding for
it:
- It now opens the DSA master netdevice automatically whenever a user
  netdevice is opened.
- The master and switch interfaces are coupled in an upper/lower
  hierarchy using the netdev adjacency lists.

In the nfsroot example below, the interface chosen by autoconfig was
swp3, and every interface except that and the DSA master, eth1, was
brought down afterwards:

[    8.714215] mscc_felix 0000:00:00.5 swp0 (uninitialized): PHY [0000:00:00.3:10] driver [Microsemi GE VSC8514 SyncE] (irq=POLL)
[    8.978041] mscc_felix 0000:00:00.5 swp1 (uninitialized): PHY [0000:00:00.3:11] driver [Microsemi GE VSC8514 SyncE] (irq=POLL)
[    9.246134] mscc_felix 0000:00:00.5 swp2 (uninitialized): PHY [0000:00:00.3:12] driver [Microsemi GE VSC8514 SyncE] (irq=POLL)
[    9.486203] mscc_felix 0000:00:00.5 swp3 (uninitialized): PHY [0000:00:00.3:13] driver [Microsemi GE VSC8514 SyncE] (irq=POLL)
[    9.512827] mscc_felix 0000:00:00.5: configuring for fixed/internal link mode
[    9.521047] mscc_felix 0000:00:00.5: Link is Up - 2.5Gbps/Full - flow control off
[    9.530382] device eth1 entered promiscuous mode
[    9.535452] DSA: tree 0 setup
[    9.539777] printk: console [netcon0] enabled
[    9.544504] netconsole: network logging started
[    9.555047] fsl_enetc 0000:00:00.2 eth1: configuring for fixed/internal link mode
[    9.562790] fsl_enetc 0000:00:00.2 eth1: Link is Up - 1Gbps/Full - flow control off
[    9.564661] 8021q: adding VLAN 0 to HW filter on device bond0
[    9.637681] fsl_enetc 0000:00:00.0 eth0: PHY [0000:00:00.0:02] driver [Qualcomm Atheros AR8031/AR8033] (irq=POLL)
[    9.655679] fsl_enetc 0000:00:00.0 eth0: configuring for inband/sgmii link mode
[    9.666611] mscc_felix 0000:00:00.5 swp0: configuring for inband/qsgmii link mode
[    9.676216] 8021q: adding VLAN 0 to HW filter on device swp0
[    9.682086] mscc_felix 0000:00:00.5 swp1: configuring for inband/qsgmii link mode
[    9.690700] 8021q: adding VLAN 0 to HW filter on device swp1
[    9.696538] mscc_felix 0000:00:00.5 swp2: configuring for inband/qsgmii link mode
[    9.705131] 8021q: adding VLAN 0 to HW filter on device swp2
[    9.710964] mscc_felix 0000:00:00.5 swp3: configuring for inband/qsgmii link mode
[    9.719548] 8021q: adding VLAN 0 to HW filter on device swp3
[    9.747811] Sending DHCP requests ..
[   12.742899] mscc_felix 0000:00:00.5 swp1: Link is Up - 1Gbps/Full - flow control rx/tx
[   12.743828] mscc_felix 0000:00:00.5 swp0: Link is Up - 1Gbps/Full - flow control off
[   12.747062] IPv6: ADDRCONF(NETDEV_CHANGE): swp1: link becomes ready
[   12.755216] fsl_enetc 0000:00:00.0 eth0: Link is Up - 1Gbps/Full - flow control rx/tx
[   12.766603] IPv6: ADDRCONF(NETDEV_CHANGE): swp0: link becomes ready
[   12.783188] mscc_felix 0000:00:00.5 swp2: Link is Up - 1Gbps/Full - flow control rx/tx
[   12.785354] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[   12.799535] IPv6: ADDRCONF(NETDEV_CHANGE): swp2: link becomes ready
[   13.803141] mscc_felix 0000:00:00.5 swp3: Link is Up - 1Gbps/Full - flow control rx/tx
[   13.811646] IPv6: ADDRCONF(NETDEV_CHANGE): swp3: link becomes ready
[   15.452018] ., OK
[   15.470336] IP-Config: Got DHCP answer from 10.0.0.1, my address is 10.0.0.39
[   15.477887] IP-Config: Complete:
[   15.481330]      device=swp3, hwaddr=00:04:9f:05:de:0a, ipaddr=10.0.0.39, mask=255.255.255.0, gw=10.0.0.1
[   15.491846]      host=10.0.0.39, domain=(none), nis-domain=(none)
[   15.498429]      bootserver=10.0.0.1, rootserver=10.0.0.1, rootpath=
[   15.498481]      nameserver0=8.8.8.8
[   15.627542] fsl_enetc 0000:00:00.0 eth0: Link is Down
[   15.690903] mscc_felix 0000:00:00.5 swp0: Link is Down
[   15.745216] mscc_felix 0000:00:00.5 swp1: Link is Down
[   15.800498] mscc_felix 0000:00:00.5 swp2: Link is Down
[   15.858143] ALSA device list:
[   15.861420]   No soundcards found.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
 net/ipv4/ipconfig.c | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c
index 3cd13e1bc6a7..f9ab1fb219ec 100644
--- a/net/ipv4/ipconfig.c
+++ b/net/ipv4/ipconfig.c
@@ -61,7 +61,6 @@
 #include <linux/export.h>
 #include <net/net_namespace.h>
 #include <net/arp.h>
-#include <net/dsa.h>
 #include <net/ip.h>
 #include <net/ipconfig.h>
 #include <net/route.h>
@@ -218,9 +217,9 @@ static int __init ic_open_devs(void)
 	last = &ic_first_dev;
 	rtnl_lock();
 
-	/* bring loopback and DSA master network devices up first */
+	/* bring loopback device up first */
 	for_each_netdev(&init_net, dev) {
-		if (!(dev->flags & IFF_LOOPBACK) && !netdev_uses_dsa(dev))
+		if (!(dev->flags & IFF_LOOPBACK))
 			continue;
 		if (dev_change_flags(dev, dev->flags | IFF_UP, NULL) < 0)
 			pr_err("IP-Config: Failed to open %s\n", dev->name);
@@ -305,6 +304,9 @@ static int __init ic_open_devs(void)
 	return 0;
 }
 
+/* Close all network interfaces except the one we've autoconfigured, and its
+ * lowers, in case it's a stacked virtual interface.
+ */
 static void __init ic_close_devs(void)
 {
 	struct ic_device *d, *next;
@@ -313,9 +315,20 @@ static void __init ic_close_devs(void)
 	rtnl_lock();
 	next = ic_first_dev;
 	while ((d = next)) {
+		bool bring_down = (d != ic_dev);
+		struct net_device *lower_dev;
+		struct list_head *iter;
+
 		next = d->next;
 		dev = d->dev;
-		if (d != ic_dev && !netdev_uses_dsa(dev)) {
+
+		netdev_for_each_lower_dev(ic_dev->dev, lower_dev, iter) {
+			if (dev == lower_dev) {
+				bring_down = false;
+				break;
+			}
+		}
+		if (bring_down) {
 			pr_debug("IP-Config: Downing %s\n", dev->name);
 			dev_change_flags(dev, d->flags, NULL);
 		}
-- 
2.25.1


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

* Re: [PATCH net-next 0/4] Automatically manage DSA master interface state
  2021-01-27  1:00 [PATCH net-next 0/4] Automatically manage DSA master interface state Vladimir Oltean
                   ` (3 preceding siblings ...)
  2021-01-27  1:00 ` [PATCH net-next 4/4] Revert "net: ipv4: handle DSA enabled master network devices" Vladimir Oltean
@ 2021-01-27  1:25 ` Vladimir Oltean
  2021-01-27 12:03   ` Vladimir Oltean
  2021-01-28  1:03 ` Florian Fainelli
  5 siblings, 1 reply; 20+ messages in thread
From: Vladimir Oltean @ 2021-01-27  1:25 UTC (permalink / raw)
  To: David S . Miller, Jakub Kicinski, netdev
  Cc: Andrew Lunn, Florian Fainelli, Vivien Didelot, Hideaki YOSHIFUJI

On Wed, Jan 27, 2021 at 03:00:24AM +0200, Vladimir Oltean wrote:
> From: Vladimir Oltean <vladimir.oltean@nxp.com>
> 
> This patch series adds code that makes DSA open the master interface
> automatically whenever one user interface gets opened, either by the
> user, or by various networking subsystems: netconsole, nfsroot.
> With that in place, we can remove some of the places in the network
> stack where DSA-specific code was sprinkled.
> 
> Vladimir Oltean (4):
>   net: dsa: automatically bring up DSA master when opening user port
>   net: dsa: automatically bring user ports down when master goes down
>   Revert "net: Have netpoll bring-up DSA management interface"
>   Revert "net: ipv4: handle DSA enabled master network devices"
> 
>  Documentation/networking/dsa/dsa.rst |  4 ---
>  net/core/netpoll.c                   | 22 +++------------
>  net/dsa/slave.c                      | 40 ++++++++++++++++++++++++++--
>  net/ipv4/ipconfig.c                  | 21 ++++++++++++---
>  4 files changed, 59 insertions(+), 28 deletions(-)

Please treat this as RFC. There's still some debugging I need to do with
nfsroot.

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

* Re: [PATCH net-next 0/4] Automatically manage DSA master interface state
  2021-01-27  1:25 ` [PATCH net-next 0/4] Automatically manage DSA master interface state Vladimir Oltean
@ 2021-01-27 12:03   ` Vladimir Oltean
  0 siblings, 0 replies; 20+ messages in thread
From: Vladimir Oltean @ 2021-01-27 12:03 UTC (permalink / raw)
  To: David S . Miller, Jakub Kicinski, netdev
  Cc: Andrew Lunn, Florian Fainelli, Vivien Didelot, Hideaki YOSHIFUJI

On Wed, Jan 27, 2021 at 03:25:46AM +0200, Vladimir Oltean wrote:
> Please treat this as RFC. There's still some debugging I need to do with
> nfsroot.

Sorry, please treat this as non-RFC again. The problem I had with
nfsroot was completely unrelated.

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

* Re: [PATCH net-next 2/4] net: dsa: automatically bring user ports down when master goes down
  2021-01-27  1:00 ` [PATCH net-next 2/4] net: dsa: automatically bring user ports down when master goes down Vladimir Oltean
@ 2021-01-28  0:46   ` Andrew Lunn
  2021-01-28  0:50     ` Vladimir Oltean
  0 siblings, 1 reply; 20+ messages in thread
From: Andrew Lunn @ 2021-01-28  0:46 UTC (permalink / raw)
  To: Vladimir Oltean
  Cc: David S . Miller, Jakub Kicinski, netdev, Florian Fainelli,
	Vivien Didelot, Hideaki YOSHIFUJI

> +	case NETDEV_GOING_DOWN: {
> +		struct dsa_port *dp, *cpu_dp;
> +		struct dsa_switch_tree *dst;
> +		int err = 0;
> +
> +		if (!netdev_uses_dsa(dev))
> +			return NOTIFY_DONE;
> +
> +		cpu_dp = dev->dsa_ptr;
> +		dst = cpu_dp->ds->dst;
> +
> +		list_for_each_entry(dp, &dst->ports, list) {
> +			if (!dsa_is_user_port(dp->ds, dp->index)) {

!dsa_is_user_port() ??

That ! seems odd. 

> +				struct net_device *slave = dp->slave;
> +
> +				if (!(slave->flags & IFF_UP))
> +					continue;
> +
> +				err = dev_change_flags(slave,
> +						       slave->flags & ~IFF_UP,
> +						       NULL);

  Andrew

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

* Re: [PATCH net-next 2/4] net: dsa: automatically bring user ports down when master goes down
  2021-01-28  0:46   ` Andrew Lunn
@ 2021-01-28  0:50     ` Vladimir Oltean
  2021-01-28  0:52       ` Andrew Lunn
  0 siblings, 1 reply; 20+ messages in thread
From: Vladimir Oltean @ 2021-01-28  0:50 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: David S . Miller, Jakub Kicinski, netdev, Florian Fainelli,
	Vivien Didelot, Hideaki YOSHIFUJI

On Thu, Jan 28, 2021 at 01:46:30AM +0100, Andrew Lunn wrote:
> > +	case NETDEV_GOING_DOWN: {
> > +		struct dsa_port *dp, *cpu_dp;
> > +		struct dsa_switch_tree *dst;
> > +		int err = 0;
> > +
> > +		if (!netdev_uses_dsa(dev))
> > +			return NOTIFY_DONE;
> > +
> > +		cpu_dp = dev->dsa_ptr;
> > +		dst = cpu_dp->ds->dst;
> > +
> > +		list_for_each_entry(dp, &dst->ports, list) {
> > +			if (!dsa_is_user_port(dp->ds, dp->index)) {
>
> !dsa_is_user_port() ??
>
> That ! seems odd.

Oops, that's something that I refactored at the last minute after I
prototyped the idea from:
			if (!dsa_is_user_port(dp->ds, dp->index))
				continue;
because it looked uglier that way.

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

* Re: [PATCH net-next 1/4] net: dsa: automatically bring up DSA master when opening user port
  2021-01-27  1:00 ` [PATCH net-next 1/4] net: dsa: automatically bring up DSA master when opening user port Vladimir Oltean
@ 2021-01-28  0:51   ` Andrew Lunn
  2021-01-28  1:41   ` Florian Fainelli
  1 sibling, 0 replies; 20+ messages in thread
From: Andrew Lunn @ 2021-01-28  0:51 UTC (permalink / raw)
  To: Vladimir Oltean
  Cc: David S . Miller, Jakub Kicinski, netdev, Florian Fainelli,
	Vivien Didelot, Hideaki YOSHIFUJI

On Wed, Jan 27, 2021 at 03:00:25AM +0200, Vladimir Oltean wrote:
> From: Vladimir Oltean <vladimir.oltean@nxp.com>
> 
> DSA wants the master interface to be open before the user port is due to
> historical reasons. The promiscuity of interfaces that are down used to
> have issues, as referenced Lennert Buytenhek in commit df02c6ff2e39
> ("dsa: fix master interface allmulti/promisc handling").
> 
> The bugfix mentioned there, commit b6c40d68ff64 ("net: only invoke
> dev->change_rx_flags when device is UP"), was basically a "don't do
> that" approach to working around the promiscuity while down issue.
> 
> Further work done by Vlad Yasevich in commit d2615bf45069 ("net: core:
> Always propagate flag changes to interfaces") has resolved the
> underlying issue, and it is strictly up to the DSA and 8021q drivers
> now, it is no longer mandated by the networking core that the master
> interface must be up when changing its promiscuity.
> 
> >From DSA's point of view, deciding to error out in dsa_slave_open
> because the master isn't up is (a) a bad user experience and (b) missing
> the forest for the trees. Even if there still was an issue with
> promiscuity while down, DSA could still do this and avoid it: open the
> DSA master manually, then do whatever. Voila, the DSA master is now up,
> no need to error out.
> 
> Doing it this way has the additional benefit that user space can now
> remove DSA-specific workarounds, like systemd-networkd with BindCarrier:
> https://github.com/systemd/systemd/issues/7478
> 
> And we can finally remove one of the 2 bullets in the "Common pitfalls
> using DSA setups" chapter.
> 
> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

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

* Re: [PATCH net-next 2/4] net: dsa: automatically bring user ports down when master goes down
  2021-01-28  0:50     ` Vladimir Oltean
@ 2021-01-28  0:52       ` Andrew Lunn
  2021-01-28  1:43         ` Florian Fainelli
  0 siblings, 1 reply; 20+ messages in thread
From: Andrew Lunn @ 2021-01-28  0:52 UTC (permalink / raw)
  To: Vladimir Oltean
  Cc: David S . Miller, Jakub Kicinski, netdev, Florian Fainelli,
	Vivien Didelot, Hideaki YOSHIFUJI

On Thu, Jan 28, 2021 at 02:50:14AM +0200, Vladimir Oltean wrote:
> On Thu, Jan 28, 2021 at 01:46:30AM +0100, Andrew Lunn wrote:
> > > +	case NETDEV_GOING_DOWN: {
> > > +		struct dsa_port *dp, *cpu_dp;
> > > +		struct dsa_switch_tree *dst;
> > > +		int err = 0;
> > > +
> > > +		if (!netdev_uses_dsa(dev))
> > > +			return NOTIFY_DONE;
> > > +
> > > +		cpu_dp = dev->dsa_ptr;
> > > +		dst = cpu_dp->ds->dst;
> > > +
> > > +		list_for_each_entry(dp, &dst->ports, list) {
> > > +			if (!dsa_is_user_port(dp->ds, dp->index)) {
> >
> > !dsa_is_user_port() ??
> >
> > That ! seems odd.
> 
> Oops, that's something that I refactored at the last minute after I
> prototyped the idea from:
> 			if (!dsa_is_user_port(dp->ds, dp->index))
> 				continue;
> because it looked uglier that way.

I was guessing it would be something like that. With that fixed:

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

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

* Re: [PATCH net-next 3/4] Revert "net: Have netpoll bring-up DSA management interface"
  2021-01-27  1:00 ` [PATCH net-next 3/4] Revert "net: Have netpoll bring-up DSA management interface" Vladimir Oltean
@ 2021-01-28  0:52   ` Andrew Lunn
  2021-01-28  1:43   ` Florian Fainelli
  1 sibling, 0 replies; 20+ messages in thread
From: Andrew Lunn @ 2021-01-28  0:52 UTC (permalink / raw)
  To: Vladimir Oltean
  Cc: David S . Miller, Jakub Kicinski, netdev, Florian Fainelli,
	Vivien Didelot, Hideaki YOSHIFUJI

On Wed, Jan 27, 2021 at 03:00:27AM +0200, Vladimir Oltean wrote:
> From: Vladimir Oltean <vladimir.oltean@nxp.com>
> 
> This reverts commit 1532b9778478577152201adbafa7738b1e844868.
> 
> The above commit is good and it works, however it was meant as a bugfix
> for stable kernels and now we have more self-contained ways in DSA to
> handle the situation where the DSA master must be brought up.
> 
> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

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

* Re: [PATCH net-next 4/4] Revert "net: ipv4: handle DSA enabled master network devices"
  2021-01-27  1:00 ` [PATCH net-next 4/4] Revert "net: ipv4: handle DSA enabled master network devices" Vladimir Oltean
@ 2021-01-28  0:56   ` Andrew Lunn
  2021-01-28  1:43   ` Florian Fainelli
  1 sibling, 0 replies; 20+ messages in thread
From: Andrew Lunn @ 2021-01-28  0:56 UTC (permalink / raw)
  To: Vladimir Oltean
  Cc: David S . Miller, Jakub Kicinski, netdev, Florian Fainelli,
	Vivien Didelot, Hideaki YOSHIFUJI

On Wed, Jan 27, 2021 at 03:00:28AM +0200, Vladimir Oltean wrote:
> From: Vladimir Oltean <vladimir.oltean@nxp.com>
> 
> This reverts commit 728c02089a0e3eefb02e9927bfae50490f40e72e.
> 
> Since 2015 DSA has gained more integration with the network stack, we
> can now have the same functionality without explicitly open-coding for
> it:
> - It now opens the DSA master netdevice automatically whenever a user
>   netdevice is opened.
> - The master and switch interfaces are coupled in an upper/lower
>   hierarchy using the netdev adjacency lists.
> 
> In the nfsroot example below, the interface chosen by autoconfig was
> swp3, and every interface except that and the DSA master, eth1, was
> brought down afterwards:
> 
> [    8.714215] mscc_felix 0000:00:00.5 swp0 (uninitialized): PHY [0000:00:00.3:10] driver [Microsemi GE VSC8514 SyncE] (irq=POLL)
> [    8.978041] mscc_felix 0000:00:00.5 swp1 (uninitialized): PHY [0000:00:00.3:11] driver [Microsemi GE VSC8514 SyncE] (irq=POLL)
> [    9.246134] mscc_felix 0000:00:00.5 swp2 (uninitialized): PHY [0000:00:00.3:12] driver [Microsemi GE VSC8514 SyncE] (irq=POLL)
> [    9.486203] mscc_felix 0000:00:00.5 swp3 (uninitialized): PHY [0000:00:00.3:13] driver [Microsemi GE VSC8514 SyncE] (irq=POLL)
> [    9.512827] mscc_felix 0000:00:00.5: configuring for fixed/internal link mode
> [    9.521047] mscc_felix 0000:00:00.5: Link is Up - 2.5Gbps/Full - flow control off
> [    9.530382] device eth1 entered promiscuous mode
> [    9.535452] DSA: tree 0 setup
> [    9.539777] printk: console [netcon0] enabled
> [    9.544504] netconsole: network logging started
> [    9.555047] fsl_enetc 0000:00:00.2 eth1: configuring for fixed/internal link mode
> [    9.562790] fsl_enetc 0000:00:00.2 eth1: Link is Up - 1Gbps/Full - flow control off
> [    9.564661] 8021q: adding VLAN 0 to HW filter on device bond0
> [    9.637681] fsl_enetc 0000:00:00.0 eth0: PHY [0000:00:00.0:02] driver [Qualcomm Atheros AR8031/AR8033] (irq=POLL)
> [    9.655679] fsl_enetc 0000:00:00.0 eth0: configuring for inband/sgmii link mode
> [    9.666611] mscc_felix 0000:00:00.5 swp0: configuring for inband/qsgmii link mode
> [    9.676216] 8021q: adding VLAN 0 to HW filter on device swp0
> [    9.682086] mscc_felix 0000:00:00.5 swp1: configuring for inband/qsgmii link mode
> [    9.690700] 8021q: adding VLAN 0 to HW filter on device swp1
> [    9.696538] mscc_felix 0000:00:00.5 swp2: configuring for inband/qsgmii link mode
> [    9.705131] 8021q: adding VLAN 0 to HW filter on device swp2
> [    9.710964] mscc_felix 0000:00:00.5 swp3: configuring for inband/qsgmii link mode
> [    9.719548] 8021q: adding VLAN 0 to HW filter on device swp3
> [    9.747811] Sending DHCP requests ..
> [   12.742899] mscc_felix 0000:00:00.5 swp1: Link is Up - 1Gbps/Full - flow control rx/tx
> [   12.743828] mscc_felix 0000:00:00.5 swp0: Link is Up - 1Gbps/Full - flow control off
> [   12.747062] IPv6: ADDRCONF(NETDEV_CHANGE): swp1: link becomes ready
> [   12.755216] fsl_enetc 0000:00:00.0 eth0: Link is Up - 1Gbps/Full - flow control rx/tx
> [   12.766603] IPv6: ADDRCONF(NETDEV_CHANGE): swp0: link becomes ready
> [   12.783188] mscc_felix 0000:00:00.5 swp2: Link is Up - 1Gbps/Full - flow control rx/tx
> [   12.785354] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
> [   12.799535] IPv6: ADDRCONF(NETDEV_CHANGE): swp2: link becomes ready
> [   13.803141] mscc_felix 0000:00:00.5 swp3: Link is Up - 1Gbps/Full - flow control rx/tx
> [   13.811646] IPv6: ADDRCONF(NETDEV_CHANGE): swp3: link becomes ready
> [   15.452018] ., OK
> [   15.470336] IP-Config: Got DHCP answer from 10.0.0.1, my address is 10.0.0.39
> [   15.477887] IP-Config: Complete:
> [   15.481330]      device=swp3, hwaddr=00:04:9f:05:de:0a, ipaddr=10.0.0.39, mask=255.255.255.0, gw=10.0.0.1
> [   15.491846]      host=10.0.0.39, domain=(none), nis-domain=(none)
> [   15.498429]      bootserver=10.0.0.1, rootserver=10.0.0.1, rootpath=
> [   15.498481]      nameserver0=8.8.8.8
> [   15.627542] fsl_enetc 0000:00:00.0 eth0: Link is Down
> [   15.690903] mscc_felix 0000:00:00.5 swp0: Link is Down
> [   15.745216] mscc_felix 0000:00:00.5 swp1: Link is Down
> [   15.800498] mscc_felix 0000:00:00.5 swp2: Link is Down
> [   15.858143] ALSA device list:
> [   15.861420]   No soundcards found.
> 
> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

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

* Re: [PATCH net-next 0/4] Automatically manage DSA master interface state
  2021-01-27  1:00 [PATCH net-next 0/4] Automatically manage DSA master interface state Vladimir Oltean
                   ` (4 preceding siblings ...)
  2021-01-27  1:25 ` [PATCH net-next 0/4] Automatically manage DSA master interface state Vladimir Oltean
@ 2021-01-28  1:03 ` Florian Fainelli
  2021-01-28  1:30   ` Vladimir Oltean
  5 siblings, 1 reply; 20+ messages in thread
From: Florian Fainelli @ 2021-01-28  1:03 UTC (permalink / raw)
  To: Vladimir Oltean, David S . Miller, Jakub Kicinski, netdev
  Cc: Andrew Lunn, Vivien Didelot, Hideaki YOSHIFUJI



On 1/26/2021 5:00 PM, Vladimir Oltean wrote:
> From: Vladimir Oltean <vladimir.oltean@nxp.com>
> 
> This patch series adds code that makes DSA open the master interface
> automatically whenever one user interface gets opened, either by the
> user, or by various networking subsystems: netconsole, nfsroot.
> With that in place, we can remove some of the places in the network
> stack where DSA-specific code was sprinkled.
> 
> Vladimir Oltean (4):
>   net: dsa: automatically bring up DSA master when opening user port
>   net: dsa: automatically bring user ports down when master goes down
>   Revert "net: Have netpoll bring-up DSA management interface"
>   Revert "net: ipv4: handle DSA enabled master network devices"

I really like all patches but number #2, though I don't believe there
are existing use cases besides you one you described where it makes
sense to keep a switch in an unmanaged mode being "headless" with its
CPU port down, while the user-facing ports are up.
-- 
Florian

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

* Re: [PATCH net-next 0/4] Automatically manage DSA master interface state
  2021-01-28  1:03 ` Florian Fainelli
@ 2021-01-28  1:30   ` Vladimir Oltean
  2021-01-28  1:55     ` Florian Fainelli
  0 siblings, 1 reply; 20+ messages in thread
From: Vladimir Oltean @ 2021-01-28  1:30 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: David S . Miller, Jakub Kicinski, netdev, Andrew Lunn,
	Vivien Didelot, Hideaki YOSHIFUJI

On Wed, Jan 27, 2021 at 05:03:23PM -0800, Florian Fainelli wrote:
> I really like all patches but number #2, though I don't believe there
> are existing use cases besides you one you described where it makes
> sense to keep a switch in an unmanaged mode being "headless" with its
> CPU port down, while the user-facing ports are up.

So what should I do with #2? Every other stacked interface goes down
when its lowers go down, if that brings any consolation.

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

* Re: [PATCH net-next 1/4] net: dsa: automatically bring up DSA master when opening user port
  2021-01-27  1:00 ` [PATCH net-next 1/4] net: dsa: automatically bring up DSA master when opening user port Vladimir Oltean
  2021-01-28  0:51   ` Andrew Lunn
@ 2021-01-28  1:41   ` Florian Fainelli
  1 sibling, 0 replies; 20+ messages in thread
From: Florian Fainelli @ 2021-01-28  1:41 UTC (permalink / raw)
  To: Vladimir Oltean, David S . Miller, Jakub Kicinski, netdev
  Cc: Andrew Lunn, Vivien Didelot, Hideaki YOSHIFUJI



On 1/26/2021 5:00 PM, Vladimir Oltean wrote:
> From: Vladimir Oltean <vladimir.oltean@nxp.com>
> 
> DSA wants the master interface to be open before the user port is due to
> historical reasons. The promiscuity of interfaces that are down used to
> have issues, as referenced Lennert Buytenhek in commit df02c6ff2e39
> ("dsa: fix master interface allmulti/promisc handling").
> 
> The bugfix mentioned there, commit b6c40d68ff64 ("net: only invoke
> dev->change_rx_flags when device is UP"), was basically a "don't do
> that" approach to working around the promiscuity while down issue.
> 
> Further work done by Vlad Yasevich in commit d2615bf45069 ("net: core:
> Always propagate flag changes to interfaces") has resolved the
> underlying issue, and it is strictly up to the DSA and 8021q drivers
> now, it is no longer mandated by the networking core that the master
> interface must be up when changing its promiscuity.
> 
> From DSA's point of view, deciding to error out in dsa_slave_open
> because the master isn't up is (a) a bad user experience and (b) missing
> the forest for the trees. Even if there still was an issue with
> promiscuity while down, DSA could still do this and avoid it: open the
> DSA master manually, then do whatever. Voila, the DSA master is now up,
> no need to error out.
> 
> Doing it this way has the additional benefit that user space can now
> remove DSA-specific workarounds, like systemd-networkd with BindCarrier:
> https://github.com/systemd/systemd/issues/7478
> 
> And we can finally remove one of the 2 bullets in the "Common pitfalls
> using DSA setups" chapter.
> 
> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

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

* Re: [PATCH net-next 3/4] Revert "net: Have netpoll bring-up DSA management interface"
  2021-01-27  1:00 ` [PATCH net-next 3/4] Revert "net: Have netpoll bring-up DSA management interface" Vladimir Oltean
  2021-01-28  0:52   ` Andrew Lunn
@ 2021-01-28  1:43   ` Florian Fainelli
  1 sibling, 0 replies; 20+ messages in thread
From: Florian Fainelli @ 2021-01-28  1:43 UTC (permalink / raw)
  To: Vladimir Oltean, David S . Miller, Jakub Kicinski, netdev
  Cc: Andrew Lunn, Vivien Didelot, Hideaki YOSHIFUJI



On 1/26/2021 5:00 PM, Vladimir Oltean wrote:
> From: Vladimir Oltean <vladimir.oltean@nxp.com>
> 
> This reverts commit 1532b9778478577152201adbafa7738b1e844868.
> 
> The above commit is good and it works, however it was meant as a bugfix
> for stable kernels and now we have more self-contained ways in DSA to
> handle the situation where the DSA master must be brought up.
> 
> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

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

* Re: [PATCH net-next 2/4] net: dsa: automatically bring user ports down when master goes down
  2021-01-28  0:52       ` Andrew Lunn
@ 2021-01-28  1:43         ` Florian Fainelli
  0 siblings, 0 replies; 20+ messages in thread
From: Florian Fainelli @ 2021-01-28  1:43 UTC (permalink / raw)
  To: Andrew Lunn, Vladimir Oltean
  Cc: David S . Miller, Jakub Kicinski, netdev, Vivien Didelot,
	Hideaki YOSHIFUJI



On 1/27/2021 4:52 PM, Andrew Lunn wrote:
> On Thu, Jan 28, 2021 at 02:50:14AM +0200, Vladimir Oltean wrote:
>> On Thu, Jan 28, 2021 at 01:46:30AM +0100, Andrew Lunn wrote:
>>>> +	case NETDEV_GOING_DOWN: {
>>>> +		struct dsa_port *dp, *cpu_dp;
>>>> +		struct dsa_switch_tree *dst;
>>>> +		int err = 0;
>>>> +
>>>> +		if (!netdev_uses_dsa(dev))
>>>> +			return NOTIFY_DONE;
>>>> +
>>>> +		cpu_dp = dev->dsa_ptr;
>>>> +		dst = cpu_dp->ds->dst;
>>>> +
>>>> +		list_for_each_entry(dp, &dst->ports, list) {
>>>> +			if (!dsa_is_user_port(dp->ds, dp->index)) {
>>>
>>> !dsa_is_user_port() ??
>>>
>>> That ! seems odd.
>>
>> Oops, that's something that I refactored at the last minute after I
>> prototyped the idea from:
>> 			if (!dsa_is_user_port(dp->ds, dp->index))
>> 				continue;
>> because it looked uglier that way.
> 
> I was guessing it would be something like that. With that fixed:
> 
> Reviewed-by: Andrew Lunn <andrew@lunn.ch>

When you fix it:

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

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

* Re: [PATCH net-next 4/4] Revert "net: ipv4: handle DSA enabled master network devices"
  2021-01-27  1:00 ` [PATCH net-next 4/4] Revert "net: ipv4: handle DSA enabled master network devices" Vladimir Oltean
  2021-01-28  0:56   ` Andrew Lunn
@ 2021-01-28  1:43   ` Florian Fainelli
  1 sibling, 0 replies; 20+ messages in thread
From: Florian Fainelli @ 2021-01-28  1:43 UTC (permalink / raw)
  To: Vladimir Oltean, David S . Miller, Jakub Kicinski, netdev
  Cc: Andrew Lunn, Vivien Didelot, Hideaki YOSHIFUJI



On 1/26/2021 5:00 PM, Vladimir Oltean wrote:
> From: Vladimir Oltean <vladimir.oltean@nxp.com>
> 
> This reverts commit 728c02089a0e3eefb02e9927bfae50490f40e72e.
> 
> Since 2015 DSA has gained more integration with the network stack, we
> can now have the same functionality without explicitly open-coding for
> it:
> - It now opens the DSA master netdevice automatically whenever a user
>   netdevice is opened.
> - The master and switch interfaces are coupled in an upper/lower
>   hierarchy using the netdev adjacency lists.
> 
> In the nfsroot example below, the interface chosen by autoconfig was
> swp3, and every interface except that and the DSA master, eth1, was
> brought down afterwards:
> 
> [    8.714215] mscc_felix 0000:00:00.5 swp0 (uninitialized): PHY [0000:00:00.3:10] driver [Microsemi GE VSC8514 SyncE] (irq=POLL)
> [    8.978041] mscc_felix 0000:00:00.5 swp1 (uninitialized): PHY [0000:00:00.3:11] driver [Microsemi GE VSC8514 SyncE] (irq=POLL)
> [    9.246134] mscc_felix 0000:00:00.5 swp2 (uninitialized): PHY [0000:00:00.3:12] driver [Microsemi GE VSC8514 SyncE] (irq=POLL)
> [    9.486203] mscc_felix 0000:00:00.5 swp3 (uninitialized): PHY [0000:00:00.3:13] driver [Microsemi GE VSC8514 SyncE] (irq=POLL)
> [    9.512827] mscc_felix 0000:00:00.5: configuring for fixed/internal link mode
> [    9.521047] mscc_felix 0000:00:00.5: Link is Up - 2.5Gbps/Full - flow control off
> [    9.530382] device eth1 entered promiscuous mode
> [    9.535452] DSA: tree 0 setup
> [    9.539777] printk: console [netcon0] enabled
> [    9.544504] netconsole: network logging started
> [    9.555047] fsl_enetc 0000:00:00.2 eth1: configuring for fixed/internal link mode
> [    9.562790] fsl_enetc 0000:00:00.2 eth1: Link is Up - 1Gbps/Full - flow control off
> [    9.564661] 8021q: adding VLAN 0 to HW filter on device bond0
> [    9.637681] fsl_enetc 0000:00:00.0 eth0: PHY [0000:00:00.0:02] driver [Qualcomm Atheros AR8031/AR8033] (irq=POLL)
> [    9.655679] fsl_enetc 0000:00:00.0 eth0: configuring for inband/sgmii link mode
> [    9.666611] mscc_felix 0000:00:00.5 swp0: configuring for inband/qsgmii link mode
> [    9.676216] 8021q: adding VLAN 0 to HW filter on device swp0
> [    9.682086] mscc_felix 0000:00:00.5 swp1: configuring for inband/qsgmii link mode
> [    9.690700] 8021q: adding VLAN 0 to HW filter on device swp1
> [    9.696538] mscc_felix 0000:00:00.5 swp2: configuring for inband/qsgmii link mode
> [    9.705131] 8021q: adding VLAN 0 to HW filter on device swp2
> [    9.710964] mscc_felix 0000:00:00.5 swp3: configuring for inband/qsgmii link mode
> [    9.719548] 8021q: adding VLAN 0 to HW filter on device swp3
> [    9.747811] Sending DHCP requests ..
> [   12.742899] mscc_felix 0000:00:00.5 swp1: Link is Up - 1Gbps/Full - flow control rx/tx
> [   12.743828] mscc_felix 0000:00:00.5 swp0: Link is Up - 1Gbps/Full - flow control off
> [   12.747062] IPv6: ADDRCONF(NETDEV_CHANGE): swp1: link becomes ready
> [   12.755216] fsl_enetc 0000:00:00.0 eth0: Link is Up - 1Gbps/Full - flow control rx/tx
> [   12.766603] IPv6: ADDRCONF(NETDEV_CHANGE): swp0: link becomes ready
> [   12.783188] mscc_felix 0000:00:00.5 swp2: Link is Up - 1Gbps/Full - flow control rx/tx
> [   12.785354] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
> [   12.799535] IPv6: ADDRCONF(NETDEV_CHANGE): swp2: link becomes ready
> [   13.803141] mscc_felix 0000:00:00.5 swp3: Link is Up - 1Gbps/Full - flow control rx/tx
> [   13.811646] IPv6: ADDRCONF(NETDEV_CHANGE): swp3: link becomes ready
> [   15.452018] ., OK
> [   15.470336] IP-Config: Got DHCP answer from 10.0.0.1, my address is 10.0.0.39
> [   15.477887] IP-Config: Complete:
> [   15.481330]      device=swp3, hwaddr=00:04:9f:05:de:0a, ipaddr=10.0.0.39, mask=255.255.255.0, gw=10.0.0.1
> [   15.491846]      host=10.0.0.39, domain=(none), nis-domain=(none)
> [   15.498429]      bootserver=10.0.0.1, rootserver=10.0.0.1, rootpath=
> [   15.498481]      nameserver0=8.8.8.8
> [   15.627542] fsl_enetc 0000:00:00.0 eth0: Link is Down
> [   15.690903] mscc_felix 0000:00:00.5 swp0: Link is Down
> [   15.745216] mscc_felix 0000:00:00.5 swp1: Link is Down
> [   15.800498] mscc_felix 0000:00:00.5 swp2: Link is Down
> [   15.858143] ALSA device list:
> [   15.861420]   No soundcards found.
> 
> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

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

* Re: [PATCH net-next 0/4] Automatically manage DSA master interface state
  2021-01-28  1:30   ` Vladimir Oltean
@ 2021-01-28  1:55     ` Florian Fainelli
  0 siblings, 0 replies; 20+ messages in thread
From: Florian Fainelli @ 2021-01-28  1:55 UTC (permalink / raw)
  To: Vladimir Oltean
  Cc: David S . Miller, Jakub Kicinski, netdev, Andrew Lunn,
	Vivien Didelot, Hideaki YOSHIFUJI



On 1/27/2021 5:30 PM, Vladimir Oltean wrote:
> On Wed, Jan 27, 2021 at 05:03:23PM -0800, Florian Fainelli wrote:
>> I really like all patches but number #2, though I don't believe there
>> are existing use cases besides you one you described where it makes
>> sense to keep a switch in an unmanaged mode being "headless" with its
>> CPU port down, while the user-facing ports are up.
> 
> So what should I do with #2? Every other stacked interface goes down
> when its lowers go down, if that brings any consolation.

I suppose it does, part of me may have just grown too used to existing
model and fear a change.
-- 
Florian

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

end of thread, other threads:[~2021-01-28  1:56 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-27  1:00 [PATCH net-next 0/4] Automatically manage DSA master interface state Vladimir Oltean
2021-01-27  1:00 ` [PATCH net-next 1/4] net: dsa: automatically bring up DSA master when opening user port Vladimir Oltean
2021-01-28  0:51   ` Andrew Lunn
2021-01-28  1:41   ` Florian Fainelli
2021-01-27  1:00 ` [PATCH net-next 2/4] net: dsa: automatically bring user ports down when master goes down Vladimir Oltean
2021-01-28  0:46   ` Andrew Lunn
2021-01-28  0:50     ` Vladimir Oltean
2021-01-28  0:52       ` Andrew Lunn
2021-01-28  1:43         ` Florian Fainelli
2021-01-27  1:00 ` [PATCH net-next 3/4] Revert "net: Have netpoll bring-up DSA management interface" Vladimir Oltean
2021-01-28  0:52   ` Andrew Lunn
2021-01-28  1:43   ` Florian Fainelli
2021-01-27  1:00 ` [PATCH net-next 4/4] Revert "net: ipv4: handle DSA enabled master network devices" Vladimir Oltean
2021-01-28  0:56   ` Andrew Lunn
2021-01-28  1:43   ` Florian Fainelli
2021-01-27  1:25 ` [PATCH net-next 0/4] Automatically manage DSA master interface state Vladimir Oltean
2021-01-27 12:03   ` Vladimir Oltean
2021-01-28  1:03 ` Florian Fainelli
2021-01-28  1:30   ` Vladimir Oltean
2021-01-28  1:55     ` Florian Fainelli

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.