b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame^] | 1 | From ec5be4f79026282925ae383caa431a8d41e3456a Mon Sep 17 00:00:00 2001 |
| 2 | From: Tobias Waldekranz <tobias@waldekranz.com> |
| 3 | Date: Sat, 16 Jan 2021 02:25:10 +0100 |
| 4 | Subject: [PATCH] net: bridge: switchdev: Include local flag in FDB |
| 5 | notifications |
| 6 | |
| 7 | Some switchdev drivers, notably DSA, ignore all dynamically learned |
| 8 | address notifications (!added_by_user) as these are autonomously added |
| 9 | by the switch. Previously, such a notification was indistinguishable |
| 10 | from a local address notification. Include a local bit in the |
| 11 | notification so that the two classes can be discriminated. |
| 12 | |
| 13 | This allows DSA-like devices to add local addresses to the hardware |
| 14 | FDB (with the CPU as the destination), thereby avoiding flows towards |
| 15 | the CPU being flooded by the switch as unknown unicast. |
| 16 | |
| 17 | Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com> |
| 18 | --- |
| 19 | include/net/switchdev.h | 1 + |
| 20 | net/bridge/br_switchdev.c | 1 + |
| 21 | 2 files changed, 2 insertions(+) |
| 22 | |
| 23 | --- a/include/net/switchdev.h |
| 24 | +++ b/include/net/switchdev.h |
| 25 | @@ -124,6 +124,7 @@ struct switchdev_notifier_fdb_info { |
| 26 | const unsigned char *addr; |
| 27 | u16 vid; |
| 28 | u8 added_by_user:1, |
| 29 | + local:1, |
| 30 | offloaded:1; |
| 31 | }; |
| 32 | |
| 33 | --- a/net/bridge/br_switchdev.c |
| 34 | +++ b/net/bridge/br_switchdev.c |
| 35 | @@ -109,6 +109,7 @@ br_switchdev_fdb_notify(const struct net |
| 36 | .addr = fdb->key.addr.addr, |
| 37 | .vid = fdb->key.vlan_id, |
| 38 | .added_by_user = fdb->added_by_user, |
| 39 | + .local = fdb->is_local, |
| 40 | .offloaded = fdb->offloaded, |
| 41 | }; |
| 42 | |