kernel: DSA roaming fix for Marvell mv88e6xxx
[openwrt/openwrt.git] / target / linux / generic / pending-5.10 / 762-net-bridge-switchdev-Refactor-br_switchdev_fdb_notif.patch
1 From 46fe6cecb296d850c1ee2b333e57093ac4b733f3 Mon Sep 17 00:00:00 2001
2 From: Tobias Waldekranz <tobias@waldekranz.com>
3 Date: Sat, 16 Jan 2021 02:25:09 +0100
4 Subject: [PATCH] net: bridge: switchdev: Refactor br_switchdev_fdb_notify
5
6 Instead of having to add more and more arguments to
7 br_switchdev_fdb_call_notifiers, get rid of it and build the info
8 struct directly in br_switchdev_fdb_notify.
9
10 Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
11 Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
12 ---
13 net/bridge/br_switchdev.c | 41 +++++++++++----------------------------
14 1 file changed, 11 insertions(+), 30 deletions(-)
15
16 --- a/net/bridge/br_switchdev.c
17 +++ b/net/bridge/br_switchdev.c
18 @@ -102,46 +102,27 @@ int br_switchdev_set_port_flag(struct ne
19 return 0;
20 }
21
22 -static void
23 -br_switchdev_fdb_call_notifiers(bool adding, const unsigned char *mac,
24 - u16 vid, struct net_device *dev,
25 - bool added_by_user, bool offloaded)
26 -{
27 - struct switchdev_notifier_fdb_info info;
28 - unsigned long notifier_type;
29 -
30 - info.addr = mac;
31 - info.vid = vid;
32 - info.added_by_user = added_by_user;
33 - info.offloaded = offloaded;
34 - notifier_type = adding ? SWITCHDEV_FDB_ADD_TO_DEVICE : SWITCHDEV_FDB_DEL_TO_DEVICE;
35 - call_switchdev_notifiers(notifier_type, dev, &info.info, NULL);
36 -}
37 -
38 void
39 br_switchdev_fdb_notify(const struct net_bridge_fdb_entry *fdb, int type)
40 {
41 + struct switchdev_notifier_fdb_info info = {
42 + .addr = fdb->key.addr.addr,
43 + .vid = fdb->key.vlan_id,
44 + .added_by_user = test_bit(BR_FDB_ADDED_BY_USER, &fdb->flags),
45 + .offloaded = test_bit(BR_FDB_OFFLOADED, &fdb->flags),
46 + };
47 +
48 if (!fdb->dst)
49 return;
50
51 switch (type) {
52 case RTM_DELNEIGH:
53 - br_switchdev_fdb_call_notifiers(false, fdb->key.addr.addr,
54 - fdb->key.vlan_id,
55 - fdb->dst->dev,
56 - test_bit(BR_FDB_ADDED_BY_USER,
57 - &fdb->flags),
58 - test_bit(BR_FDB_OFFLOADED,
59 - &fdb->flags));
60 + call_switchdev_notifiers(SWITCHDEV_FDB_DEL_TO_DEVICE,
61 + fdb->dst->dev, &info.info, NULL);
62 break;
63 case RTM_NEWNEIGH:
64 - br_switchdev_fdb_call_notifiers(true, fdb->key.addr.addr,
65 - fdb->key.vlan_id,
66 - fdb->dst->dev,
67 - test_bit(BR_FDB_ADDED_BY_USER,
68 - &fdb->flags),
69 - test_bit(BR_FDB_OFFLOADED,
70 - &fdb->flags));
71 + call_switchdev_notifiers(SWITCHDEV_FDB_ADD_TO_DEVICE,
72 + fdb->dst->dev, &info.info, NULL);
73 break;
74 }
75 }