Message ID | 20201213024018.772586-5-vladimir.oltean@nxp.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | Offload software learnt bridge addresses to DSA | 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/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, 9 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 |
On 12/12/2020 6:40 PM, Vladimir Oltean wrote: > Right now, the following would happen for a switch driver that does not > implement .port_fdb_add or .port_fdb_del. > > dsa_slave_switchdev_event returns NOTIFY_OK and schedules: > -> dsa_slave_switchdev_event_work > -> dsa_port_fdb_add > -> dsa_port_notify(DSA_NOTIFIER_FDB_ADD) > -> dsa_switch_fdb_add > -> if (!ds->ops->port_fdb_add) return -EOPNOTSUPP; > -> an error is printed with dev_dbg, and > dsa_fdb_offload_notify(switchdev_work) is not called. > > We can avoid scheduling the worker for nothing and say NOTIFY_OK. Not sure if this comment is intended to describe what is being added, only if you have to respin, should this be NOTIFY_DONE? > Because we don't call dsa_fdb_offload_notify, the static FDB entry will > remain just in the software bridge. > > Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
diff --git a/net/dsa/slave.c b/net/dsa/slave.c index 99907e76770b..53d9d2ea9369 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c @@ -2129,6 +2129,9 @@ static int dsa_slave_switchdev_event(struct notifier_block *unused, dp = dsa_slave_to_port(dev); + if (!dp->ds->ops->port_fdb_add || !dp->ds->ops->port_fdb_del) + return NOTIFY_DONE; + switchdev_work = kzalloc(sizeof(*switchdev_work), GFP_ATOMIC); if (!switchdev_work) return NOTIFY_BAD;
Right now, the following would happen for a switch driver that does not implement .port_fdb_add or .port_fdb_del. dsa_slave_switchdev_event returns NOTIFY_OK and schedules: -> dsa_slave_switchdev_event_work -> dsa_port_fdb_add -> dsa_port_notify(DSA_NOTIFIER_FDB_ADD) -> dsa_switch_fdb_add -> if (!ds->ops->port_fdb_add) return -EOPNOTSUPP; -> an error is printed with dev_dbg, and dsa_fdb_offload_notify(switchdev_work) is not called. We can avoid scheduling the worker for nothing and say NOTIFY_OK. Because we don't call dsa_fdb_offload_notify, the static FDB entry will remain just in the software bridge. Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> --- Changes in v2: Patch is new. net/dsa/slave.c | 3 +++ 1 file changed, 3 insertions(+)