Message ID | 20210127010028.1619443-3-olteanv@gmail.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | Automatically manage DSA master interface state | expand |
Context | Check | Description |
---|---|---|
netdev/cover_letter | success | Link |
netdev/fixes_present | success | Link |
netdev/patch_count | success | Link |
netdev/tree_selection | success | Clearly marked for net-next |
netdev/subject_prefix | success | Link |
netdev/cc_maintainers | success | CCed 7 of 7 maintainers |
netdev/source_inline | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Link |
netdev/module_param | success | Was 0 now: 0 |
netdev/build_32bit | success | Errors and warnings before: 0 this patch: 0 |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/verify_fixes | success | Link |
netdev/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 36 lines checked |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 0 this patch: 0 |
netdev/header_inline | success | Link |
netdev/stable | success | Stable not CCed |
> + 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
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.
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
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>
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;