blob: 49d6f079ba8d2578386c780856e9da22866f93ce [file] [log] [blame]
b.liue9582032025-04-17 19:18:16 +08001From ec5be4f79026282925ae383caa431a8d41e3456a Mon Sep 17 00:00:00 2001
2From: Tobias Waldekranz <tobias@waldekranz.com>
3Date: Sat, 16 Jan 2021 02:25:10 +0100
4Subject: [PATCH] net: bridge: switchdev: Include local flag in FDB
5 notifications
6
7Some switchdev drivers, notably DSA, ignore all dynamically learned
8address notifications (!added_by_user) as these are autonomously added
9by the switch. Previously, such a notification was indistinguishable
10from a local address notification. Include a local bit in the
11notification so that the two classes can be discriminated.
12
13This allows DSA-like devices to add local addresses to the hardware
14FDB (with the CPU as the destination), thereby avoiding flows towards
15the CPU being flooded by the switch as unknown unicast.
16
17Signed-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