From patchwork Thu Sep 24 10:21:01 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Holger Schurig X-Patchwork-Id: 49769 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n8OALI18003617 for ; Thu, 24 Sep 2009 10:21:18 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751193AbZIXKVL (ORCPT ); Thu, 24 Sep 2009 06:21:11 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751174AbZIXKVL (ORCPT ); Thu, 24 Sep 2009 06:21:11 -0400 Received: from mx51.mymxserver.com ([85.199.173.110]:40707 "EHLO mx51.mymxserver.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751134AbZIXKVL (ORCPT ); Thu, 24 Sep 2009 06:21:11 -0400 Received: from localhost (localhost [127.0.0.1]) by localhost.mx51.mymxserver.com (Postfix) with ESMTP id 572704B00F; Thu, 24 Sep 2009 12:21:14 +0200 (CEST) X-Virus-Scanned: by Mittwald Mailscanner Received: from mx51.mymxserver.com ([127.0.0.1]) by localhost (mx51.mymxserver.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id O09rZYUs4S44; Thu, 24 Sep 2009 12:21:14 +0200 (CEST) Received: from lin01.mn-solutions.de (pD95F9103.dip0.t-ipconnect.de [217.95.145.3]) by mx51.mymxserver.com (Postfix) with ESMTP id B609A4B009; Thu, 24 Sep 2009 12:21:13 +0200 (CEST) Received: by lin01.mn-solutions.de (Postfix, from userid 116) id 28CA91E00A9; Thu, 24 Sep 2009 12:21:13 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.1.7-deb3 (2006-10-05) on lin01.mn-logistik.de X-Spam-Level: X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00, UPPERCASE_25_50 autolearn=ham version=3.1.7-deb3 Received: from mnz66.mn-solutions.de (mnz66.mn-solutions.de [192.168.233.66]) by lin01.mn-solutions.de (Postfix) with ESMTP id C01851E0010; Thu, 24 Sep 2009 12:21:03 +0200 (CEST) From: Holger Schurig To: John Linville Subject: [PATCH, v2]: nl80211: report age of scan results Date: Thu, 24 Sep 2009 12:21:01 +0200 User-Agent: KMail/1.9.7 Cc: linux-wireless , Johannes Berg MIME-Version: 1.0 Content-Disposition: inline Message-Id: <200909241221.01456.hs4233@mail.mn-solutions.de> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Linux keeps scan results up to 15 seconds. This can be a problem for fast moving clients: they get back stale data. But if the kernel reports the age of the BSS items, then user-space can simply weed out old entries by itself. Signed-off-by: Holger Schurig Acked-by: Johannes Berg --- v2: renamed NL80211_BSS_AGE_MS to NL80211_BSS_SEEN_MS_AGO to underline that it's a relativene time --- linux-wl.orig/include/linux/nl80211.h +++ linux-wl/include/linux/nl80211.h @@ -1277,6 +1277,7 @@ * @NL80211_BSS_SIGNAL_UNSPEC: signal strength of the probe response/beacon * in unspecified units, scaled to 0..100 (u8) * @NL80211_BSS_STATUS: status, if this BSS is "used" + * @NL80211_BSS_SEEN_MS_AGO: age of this BSS entry in ms * @__NL80211_BSS_AFTER_LAST: internal * @NL80211_BSS_MAX: highest BSS attribute */ @@ -1291,6 +1292,7 @@ NL80211_BSS_SIGNAL_MBM, NL80211_BSS_SIGNAL_UNSPEC, NL80211_BSS_STATUS, + NL80211_BSS_SEEN_MS_AGO, /* keep last */ __NL80211_BSS_AFTER_LAST, --- linux-wl.orig/net/wireless/nl80211.c +++ linux-wl/net/wireless/nl80211.c @@ -3105,6 +3105,8 @@ NLA_PUT_U16(msg, NL80211_BSS_BEACON_INTERVAL, res->beacon_interval); NLA_PUT_U16(msg, NL80211_BSS_CAPABILITY, res->capability); NLA_PUT_U32(msg, NL80211_BSS_FREQUENCY, res->channel->center_freq); + NLA_PUT_U32(msg, NL80211_BSS_SEEN_MS_AGO, + jiffies_to_msecs(jiffies - intbss->ts)); switch (rdev->wiphy.signal_type) { case CFG80211_SIGNAL_TYPE_MBM: