batman-adv: mcast: shorten multicast tt/tvlv worker spinlock section
authorLinus Lüssing <linus.luessing@c0d3.blue>
Tue, 7 May 2019 04:08:26 +0000 (06:08 +0200)
committerSimon Wunderlich <sw@simonwunderlich.de>
Sat, 25 May 2019 10:59:54 +0000 (12:59 +0200)
commit6bc4544021f82283f0949f94494011730ecdd084
tree04bb23d43a1ed1c8d117d510da9fa22e37c44426
parent68a600de9afc2134aa24d0cce539b98a0acb68b1
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: Linus Lüssing <linus.luessing@c0d3.blue>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
net/batman-adv/multicast.c
net/batman-adv/soft-interface.c
net/batman-adv/types.h