Skip to content

Commit

Permalink
net: bridge: multicast: add context support for host-joined groups
Browse files Browse the repository at this point in the history
Adding bridge multicast context support for host-joined groups is easy
because we only need the proper timer value. We pass the already chosen
context and use its timer value.

Signed-off-by: Nikolay Aleksandrov <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Nikolay Aleksandrov authored and davem330 committed Jul 21, 2021
1 parent 6567cb4 commit 58d913a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion net/bridge/br_mdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1105,7 +1105,7 @@ static int br_mdb_add_group(struct net_bridge *br, struct net_bridge_port *port,
return -EEXIST;
}

br_multicast_host_join(mp, false);
br_multicast_host_join(brmctx, mp, false);
br_mdb_notify(br->dev, mp, NULL, RTM_NEWMDB);

return 0;
Expand Down
8 changes: 4 additions & 4 deletions net/bridge/br_multicast.c
Original file line number Diff line number Diff line change
Expand Up @@ -1312,7 +1312,8 @@ struct net_bridge_port_group *br_multicast_new_port_group(
return p;
}

void br_multicast_host_join(struct net_bridge_mdb_entry *mp, bool notify)
void br_multicast_host_join(const struct net_bridge_mcast *brmctx,
struct net_bridge_mdb_entry *mp, bool notify)
{
if (!mp->host_joined) {
mp->host_joined = true;
Expand All @@ -1325,8 +1326,7 @@ void br_multicast_host_join(struct net_bridge_mdb_entry *mp, bool notify)
if (br_group_is_l2(&mp->addr))
return;

mod_timer(&mp->timer,
jiffies + mp->br->multicast_ctx.multicast_membership_interval);
mod_timer(&mp->timer, jiffies + brmctx->multicast_membership_interval);
}

void br_multicast_host_leave(struct net_bridge_mdb_entry *mp, bool notify)
Expand Down Expand Up @@ -1363,7 +1363,7 @@ __br_multicast_add_group(struct net_bridge_mcast *brmctx,
return ERR_CAST(mp);

if (!pmctx) {
br_multicast_host_join(mp, true);
br_multicast_host_join(brmctx, mp, true);
goto out;
}

Expand Down
3 changes: 2 additions & 1 deletion net/bridge/br_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -887,7 +887,8 @@ void br_multicast_get_stats(const struct net_bridge *br,
struct br_mcast_stats *dest);
void br_mdb_init(void);
void br_mdb_uninit(void);
void br_multicast_host_join(struct net_bridge_mdb_entry *mp, bool notify);
void br_multicast_host_join(const struct net_bridge_mcast *brmctx,
struct net_bridge_mdb_entry *mp, bool notify);
void br_multicast_host_leave(struct net_bridge_mdb_entry *mp, bool notify);
void br_multicast_star_g_handle_mode(struct net_bridge_port_group *pg,
u8 filter_mode);
Expand Down

0 comments on commit 58d913a

Please sign in to comment.