Skip to content

Commit 3d5839b

Browse files
ilanpeer2jmberg-intel
authored andcommitted
mac80211: Call drv_set_tim only if there is a change
It is possible that sta_info_recalc_tim() is called consecutively without changing the station's tim bit. In such cases there is no need to call the driver's set_tim() callback. Signed-off-by: Ilan Peer <ilan.peer@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
1 parent e943789 commit 3d5839b

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

‎net/mac80211/sta_info.c‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -556,6 +556,15 @@ static inline void __bss_tim_clear(u8 *tim, u16 id)
556556
tim[id / 8] &= ~(1 << (id % 8));
557557
}
558558

559+
static inline bool __bss_tim_get(u8 *tim, u16 id)
560+
{
561+
/*
562+
* This format has been mandated by the IEEE specifications,
563+
* so this line may not be changed to use the test_bit() format.
564+
*/
565+
return tim[id / 8] & (1 << (id % 8));
566+
}
567+
559568
static unsigned long ieee80211_tids_for_ac(int ac)
560569
{
561570
/* If we ever support TIDs > 7, this obviously needs to be adjusted */
@@ -636,6 +645,9 @@ void sta_info_recalc_tim(struct sta_info *sta)
636645
done:
637646
spin_lock_bh(&local->tim_lock);
638647

648+
if (indicate_tim == __bss_tim_get(ps->tim, id))
649+
goto out_unlock;
650+
639651
if (indicate_tim)
640652
__bss_tim_set(ps->tim, id);
641653
else
@@ -647,6 +659,7 @@ void sta_info_recalc_tim(struct sta_info *sta)
647659
local->tim_in_locked_section = false;
648660
}
649661

662+
out_unlock:
650663
spin_unlock_bh(&local->tim_lock);
651664
}
652665

0 commit comments

Comments
 (0)