-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy path0009-net-bridge-Differentiate-MDB-additions-from-modifica.patch
More file actions
103 lines (91 loc) · 3.62 KB
/
0009-net-bridge-Differentiate-MDB-additions-from-modifica.patch
File metadata and controls
103 lines (91 loc) · 3.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
From 5cf9d6e2ce6e3b9ad031b25fa6af8f36b2738890 Mon Sep 17 00:00:00 2001
From: Tobias Waldekranz <tobias@waldekranz.com>
Date: Thu, 16 May 2024 14:51:54 +0200
Subject: [PATCH 09/47] net: bridge: Differentiate MDB additions from
modifications
Before this change, the reception of an IGMPv3 report (and analogously
for MLDv2) that adds a new group, would trigger two MDB RTM_NEWMDB
notifications from br_ip4_multicast_igmp3_report():
1. In br_ip4_multicast_add_group() when creating the entry
2. Directly at the end of br_ip4_multicast_igmp3_report(), as the new
group is also deemed to be "changed"
The corresponding switchdev notifications generated by these present a
problem for drivers wanting to reference count group memberships,
since logically there is only a single reference to the group. Indeed,
when the membership eventually times out, only a single RTM_DELMDB is
generated.
Therefore, discriminate new groups from changes to existing groups by
introducing a RTM_SETMDB events to be used in the latter scenario.
---
include/uapi/linux/rtnetlink.h | 2 ++
net/bridge/br_mdb.c | 4 ++--
net/bridge/br_multicast.c | 8 ++++----
3 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/include/uapi/linux/rtnetlink.h b/include/uapi/linux/rtnetlink.h
index dab9493c791b..40a3534f0f1d 100644
--- a/include/uapi/linux/rtnetlink.h
+++ b/include/uapi/linux/rtnetlink.h
@@ -142,6 +142,8 @@ enum {
#define RTM_DELMDB RTM_DELMDB
RTM_GETMDB = 86,
#define RTM_GETMDB RTM_GETMDB
+ RTM_SETMDB = 87,
+#define RTM_SETMDB RTM_SETMDB
RTM_NEWNSID = 88,
#define RTM_NEWNSID RTM_NEWNSID
diff --git a/net/bridge/br_mdb.c b/net/bridge/br_mdb.c
index 400eb872b403..cd7a2cd0911a 100644
--- a/net/bridge/br_mdb.c
+++ b/net/bridge/br_mdb.c
@@ -752,7 +752,7 @@ static int br_mdb_replace_group_sg(const struct br_mdb_config *cfg,
else
timer_delete(&pg->timer);
- br_mdb_notify(cfg->br->dev, mp, pg, RTM_NEWMDB);
+ br_mdb_notify(cfg->br->dev, mp, pg, RTM_SETMDB);
return 0;
}
@@ -973,7 +973,7 @@ static int br_mdb_replace_group_star_g(const struct br_mdb_config *cfg,
else
timer_delete(&pg->timer);
- br_mdb_notify(cfg->br->dev, mp, pg, RTM_NEWMDB);
+ br_mdb_notify(cfg->br->dev, mp, pg, RTM_SETMDB);
if (br_multicast_should_handle_mode(brmctx, cfg->group.proto))
br_multicast_star_g_handle_mode(pg, cfg->filter_mode);
diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c
index bacff6c2e968..a5f3e4935edc 100644
--- a/net/bridge/br_multicast.c
+++ b/net/bridge/br_multicast.c
@@ -616,7 +616,7 @@ static void br_multicast_fwd_src_handle(struct net_bridge_group_src *src)
sg_mp = br_mdb_ip_get(src->br, &sg_key.addr);
if (!sg_mp)
return;
- br_mdb_notify(src->br->dev, sg_mp, sg, RTM_NEWMDB);
+ br_mdb_notify(src->br->dev, sg_mp, sg, RTM_SETMDB);
}
}
@@ -884,7 +884,7 @@ static void br_multicast_port_group_expired(struct timer_list *t)
if (WARN_ON(!mp))
goto out;
- br_mdb_notify(br->dev, mp, pg, RTM_NEWMDB);
+ br_mdb_notify(br->dev, mp, pg, RTM_SETMDB);
}
out:
spin_unlock(&br->multicast_lock);
@@ -2949,7 +2949,7 @@ static int br_ip4_multicast_igmp3_report(struct net_bridge_mcast *brmctx,
break;
}
if (changed)
- br_mdb_notify(brmctx->br->dev, mdst, pg, RTM_NEWMDB);
+ br_mdb_notify(brmctx->br->dev, mdst, pg, RTM_SETMDB);
unlock_continue:
spin_unlock(&brmctx->br->multicast_lock);
}
@@ -3091,7 +3091,7 @@ static int br_ip6_multicast_mld2_report(struct net_bridge_mcast *brmctx,
break;
}
if (changed)
- br_mdb_notify(brmctx->br->dev, mdst, pg, RTM_NEWMDB);
+ br_mdb_notify(brmctx->br->dev, mdst, pg, RTM_SETMDB);
unlock_continue:
spin_unlock(&brmctx->br->multicast_lock);
}