diff options
author | Jakub Kicinski <kuba@kernel.org> | 2021-01-14 18:34:50 -0800 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2021-01-14 18:34:50 -0800 |
commit | 1d9f03c0a15fa01aa14fb295cbc1236403fceb0b (patch) | |
tree | 2161a4e17f383a14e1e235e2deed7142733aca9b /net/dsa | |
parent | e4abfd88c78105069eef627e04ef9413746bab7b (diff) | |
parent | 146620506274bd24d52fb1c589110a30eed8240b (diff) | |
download | linux-1d9f03c0a15fa01aa14fb295cbc1236403fceb0b.tar.bz2 |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/dsa')
-rw-r--r-- | net/dsa/dsa2.c | 4 | ||||
-rw-r--r-- | net/dsa/master.c | 10 |
2 files changed, 14 insertions, 0 deletions
diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c index fd343466df27..6f65ea0eef9f 100644 --- a/net/dsa/dsa2.c +++ b/net/dsa/dsa2.c @@ -412,9 +412,13 @@ static int dsa_port_devlink_setup(struct dsa_port *dp) static void dsa_port_teardown(struct dsa_port *dp) { + struct devlink_port *dlp = &dp->devlink_port; + if (!dp->setup) return; + devlink_port_type_clear(dlp); + switch (dp->type) { case DSA_PORT_TYPE_UNUSED: break; diff --git a/net/dsa/master.c b/net/dsa/master.c index 5a0f6fec4271..cb3a5cf99b25 100644 --- a/net/dsa/master.c +++ b/net/dsa/master.c @@ -309,8 +309,18 @@ static struct lock_class_key dsa_master_addr_list_lock_key; int dsa_master_setup(struct net_device *dev, struct dsa_port *cpu_dp) { int mtu = ETH_DATA_LEN + cpu_dp->tag_ops->overhead; + struct dsa_switch *ds = cpu_dp->ds; + struct device_link *consumer_link; int ret; + /* The DSA master must use SET_NETDEV_DEV for this to work. */ + consumer_link = device_link_add(ds->dev, dev->dev.parent, + DL_FLAG_AUTOREMOVE_CONSUMER); + if (!consumer_link) + netdev_err(dev, + "Failed to create a device link to DSA switch %s\n", + dev_name(ds->dev)); + rtnl_lock(); ret = dev_set_mtu(dev, mtu); rtnl_unlock(); |