> > Hi Vladimir > > > > So you are suggesting this? > > > > > > + ret = netdev_upper_dev_link(master, slave_dev, NULL); > > > > Andrew > > Yes, basically this: > > diff --git a/net/dsa/slave.c b/net/dsa/slave.c > index 4c7f086a047b..6aff8cfc9cf1 100644 > --- a/net/dsa/slave.c > +++ b/net/dsa/slave.c > @@ -1807,6 +1807,13 @@ int dsa_slave_create(struct dsa_port *port) > ret, slave_dev->name); > goto out_phy; > } > + rtnl_lock(); > + ret = netdev_upper_dev_link(master, slave_dev, NULL); > + rtnl_unlock(); > + if (ret) { > + unregister_netdevice(slave_dev); > + goto out_phy; > + } > > return 0; > > @@ -1826,12 +1833,14 @@ int dsa_slave_create(struct dsa_port *port) > > void dsa_slave_destroy(struct net_device *slave_dev) > { > + struct net_device *master = dsa_slave_to_master(slave_dev); > struct dsa_port *dp = dsa_slave_to_port(slave_dev); > struct dsa_slave_priv *p = netdev_priv(slave_dev); > > netif_carrier_off(slave_dev); > rtnl_lock(); > phylink_disconnect_phy(dp->pl); > + netdev_upper_dev_unlink(master, slave_dev); > rtnl_unlock(); > > dsa_slave_notify(slave_dev, DSA_PORT_UNREGISTER); > > Do you see a problem with it?
I was initially not sure you could do this. But it looks like you can have N : M relationships between uppers and lowers. I suppose it does make sense. You can have multiple VLAN uppers to one base device. You can have multiple lowers to one bond device, etc. I wonder what 'side effects' there are for declaring this linkage. It is not something i've looked into before, since we never used it. So i don't see a problem with this, other than i don't know what problems we might run into :-) Andrew