mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-20 22:23:27 +00:00
9664b41c05
Deleted (upstreamed): generic/backport-5.10/610-v5.13-02-netfilter-Fix-fall-through-warnings-for-Clang.patch generic/backport-5.10/792-v5.15-0001-net-dsa-b53-Fix-calculating-number-of-switch-ports.patch generic/backport-5.10/792-v5.15-0002-net-dsa-b53-Set-correct-number-of-ports-in-the-DSA-s.patch generic/backport-5.10/792-v5.15-0003-net-dsa-b53-Fix-IMP-port-setup-on-BCM5301x.patch generic/backport-5.10/840-0001-PCI-of-Don-t-fail-devm_pci_alloc_host_bridge-on-miss.patch generic/backport-5.10/840-0002-PCI-iproc-Fix-BCMA-probe-resource-handling.patch generic/pending-5.10/498-mtd-mtdconcat-select-readwrite-function.patch Signed-off-by: Rui Salvaterra <rsalvaterra@gmail.com>
86 lines
2.5 KiB
Diff
86 lines
2.5 KiB
Diff
From 447d290a58bd335d68f665713842365d3d6447df Mon Sep 17 00:00:00 2001
|
|
From: Vladimir Oltean <vladimir.oltean@nxp.com>
|
|
Date: Wed, 6 Jan 2021 11:51:33 +0200
|
|
Subject: [PATCH] net: dsa: move switchdev event implementation under the same
|
|
switch/case statement
|
|
|
|
We'll need to start listening to SWITCHDEV_FDB_{ADD,DEL}_TO_DEVICE
|
|
events even for interfaces where dsa_slave_dev_check returns false, so
|
|
we need that check inside the switch-case statement for SWITCHDEV_FDB_*.
|
|
|
|
This movement also avoids a useless allocation / free of switchdev_work
|
|
on the untreated "default event" case.
|
|
|
|
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
|
|
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
|
|
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
|
---
|
|
net/dsa/slave.c | 35 ++++++++++++++++-------------------
|
|
1 file changed, 16 insertions(+), 19 deletions(-)
|
|
|
|
--- a/net/dsa/slave.c
|
|
+++ b/net/dsa/slave.c
|
|
@@ -2159,31 +2159,29 @@ static int dsa_slave_switchdev_event(str
|
|
struct dsa_port *dp;
|
|
int err;
|
|
|
|
- if (event == SWITCHDEV_PORT_ATTR_SET) {
|
|
+ switch (event) {
|
|
+ case SWITCHDEV_PORT_ATTR_SET:
|
|
err = switchdev_handle_port_attr_set(dev, ptr,
|
|
dsa_slave_dev_check,
|
|
dsa_slave_port_attr_set);
|
|
return notifier_from_errno(err);
|
|
- }
|
|
-
|
|
- if (!dsa_slave_dev_check(dev))
|
|
- return NOTIFY_DONE;
|
|
+ case SWITCHDEV_FDB_ADD_TO_DEVICE:
|
|
+ case SWITCHDEV_FDB_DEL_TO_DEVICE:
|
|
+ if (!dsa_slave_dev_check(dev))
|
|
+ return NOTIFY_DONE;
|
|
|
|
- dp = dsa_slave_to_port(dev);
|
|
+ dp = dsa_slave_to_port(dev);
|
|
|
|
- switchdev_work = kzalloc(sizeof(*switchdev_work), GFP_ATOMIC);
|
|
- if (!switchdev_work)
|
|
- return NOTIFY_BAD;
|
|
-
|
|
- INIT_WORK(&switchdev_work->work,
|
|
- dsa_slave_switchdev_event_work);
|
|
- switchdev_work->ds = dp->ds;
|
|
- switchdev_work->port = dp->index;
|
|
- switchdev_work->event = event;
|
|
+ switchdev_work = kzalloc(sizeof(*switchdev_work), GFP_ATOMIC);
|
|
+ if (!switchdev_work)
|
|
+ return NOTIFY_BAD;
|
|
+
|
|
+ INIT_WORK(&switchdev_work->work,
|
|
+ dsa_slave_switchdev_event_work);
|
|
+ switchdev_work->ds = dp->ds;
|
|
+ switchdev_work->port = dp->index;
|
|
+ switchdev_work->event = event;
|
|
|
|
- switch (event) {
|
|
- case SWITCHDEV_FDB_ADD_TO_DEVICE:
|
|
- case SWITCHDEV_FDB_DEL_TO_DEVICE:
|
|
fdb_info = ptr;
|
|
|
|
if (!fdb_info->added_by_user) {
|
|
@@ -2196,13 +2194,12 @@ static int dsa_slave_switchdev_event(str
|
|
switchdev_work->vid = fdb_info->vid;
|
|
|
|
dev_hold(dev);
|
|
+ dsa_schedule_work(&switchdev_work->work);
|
|
break;
|
|
default:
|
|
- kfree(switchdev_work);
|
|
return NOTIFY_DONE;
|
|
}
|
|
|
|
- dsa_schedule_work(&switchdev_work->work);
|
|
return NOTIFY_OK;
|
|
}
|
|
|