Commit 6bc45440 authored by Linus Lüssing's avatar Linus Lüssing Committed by Simon Wunderlich

batman-adv: mcast: shorten multicast tt/tvlv worker spinlock section

It is not necessary to hold the mla_lock spinlock during the whole
multicast tt/tvlv worker callback. Just holding it during the checks and
updates of the bat_priv stored multicast flags and mla_list is enough.

Therefore this patch splits batadv_mcast_mla_tvlv_update() in two:
batadv_mcast_mla_flags_get() at the beginning of the worker to gather
and calculate the new multicast flags, which does not need any locking
as it neither reads from nor writes to bat_priv->mcast.

And batadv_mcast_mla_flags_update() at the end of the worker which
commits the newly calculated flags and lists to bat_priv->mcast and
therefore needs the lock.
Signed-off-by: default avatarLinus Lüssing <linus.luessing@c0d3.blue>
Signed-off-by: default avatarSven Eckelmann <sven@narfation.org>
Signed-off-by: default avatarSimon Wunderlich <sw@simonwunderlich.de>
parent 68a600de
This diff is collapsed.
......@@ -804,11 +804,6 @@ static int batadv_softif_init_late(struct net_device *dev)
atomic_set(&bat_priv->distributed_arp_table, 1);
#endif
#ifdef CONFIG_BATMAN_ADV_MCAST
bat_priv->mcast.querier_ipv4.exists = false;
bat_priv->mcast.querier_ipv4.shadowing = false;
bat_priv->mcast.querier_ipv6.exists = false;
bat_priv->mcast.querier_ipv6.shadowing = false;
bat_priv->mcast.flags = BATADV_NO_FLAGS;
atomic_set(&bat_priv->multicast_mode, 1);
atomic_set(&bat_priv->multicast_fanout, 16);
atomic_set(&bat_priv->mcast.num_want_all_unsnoopables, 0);
......
......@@ -1170,6 +1170,26 @@ struct batadv_mcast_querier_state {
unsigned char shadowing:1;
};
/**
* struct batadv_mcast_mla_flags - flags for the querier, bridge and tvlv state
*/
struct batadv_mcast_mla_flags {
/** @querier_ipv4: the current state of an IGMP querier in the mesh */
struct batadv_mcast_querier_state querier_ipv4;
/** @querier_ipv6: the current state of an MLD querier in the mesh */
struct batadv_mcast_querier_state querier_ipv6;
/** @enabled: whether the multicast tvlv is currently enabled */
unsigned char enabled:1;
/** @bridged: whether the soft interface has a bridge on top */
unsigned char bridged:1;
/** @tvlv_flags: the flags we have last sent in our mcast tvlv */
u8 tvlv_flags;
};
/**
* struct batadv_priv_mcast - per mesh interface mcast data
*/
......@@ -1198,20 +1218,10 @@ struct batadv_priv_mcast {
*/
struct hlist_head want_all_ipv6_list;
/** @querier_ipv4: the current state of an IGMP querier in the mesh */
struct batadv_mcast_querier_state querier_ipv4;
/** @querier_ipv6: the current state of an MLD querier in the mesh */
struct batadv_mcast_querier_state querier_ipv6;
/** @flags: the flags we have last sent in our mcast tvlv */
u8 flags;
/** @enabled: whether the multicast tvlv is currently enabled */
unsigned char enabled:1;
/** @bridged: whether the soft interface has a bridge on top */
unsigned char bridged:1;
/**
* @mla_flags: flags for the querier, bridge and tvlv state
*/
struct batadv_mcast_mla_flags mla_flags;
/**
* @mla_lock: a lock protecting mla_list and mla_flags
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment