nl80211: Optimize cfg80211_bss_expire invocations
authorDenis Kenzior <denkenz@gmail.com>
Mon, 21 May 2018 15:31:13 +0000 (10:31 -0500)
committerJohannes Berg <johannes.berg@intel.com>
Wed, 23 May 2018 09:06:40 +0000 (11:06 +0200)
Only invoke cfg80211_bss_expire on the first nl80211_dump_scan
invocation to avoid (likely) redundant processing.

Signed-off-by: Denis Kenzior <denkenz@gmail.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/wireless/nl80211.c

index a3dcea2..451f12e 100644 (file)
@@ -8100,7 +8100,15 @@ static int nl80211_dump_scan(struct sk_buff *skb, struct netlink_callback *cb)
 
        wdev_lock(wdev);
        spin_lock_bh(&rdev->bss_lock);
-       cfg80211_bss_expire(rdev);
+
+       /*
+        * dump_scan will be called multiple times to break up the scan results
+        * into multiple messages.  It is unlikely that any more bss-es will be
+        * expired after the first call, so only call only call this on the
+        * first dump_scan invocation.
+        */
+       if (start == 0)
+               cfg80211_bss_expire(rdev);
 
        cb->seq = rdev->bss_generation;