linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Williams <dcbw@redhat.com>
To: Arend van Spriel <arend.vanspriel@broadcom.com>,
	Johannes Berg <johannes@sipsolutions.net>
Cc: linux-wireless <linux-wireless@vger.kernel.org>
Subject: Re: [PATCH 1/5] nl80211: allow reporting RTT information in scan results
Date: Thu, 17 Nov 2016 10:15:40 -0600	[thread overview]
Message-ID: <1479399340.6110.8.camel@redhat.com> (raw)
In-Reply-To: <1479382792-13131-2-git-send-email-arend.vanspriel@broadcom.com>

On Thu, 2016-11-17 at 11:39 +0000, Arend van Spriel wrote:
> Add distance and its variance to the BSS structure so drivers
> may provide RTT information for BSS instances found during
> scanning.
> 
> Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
> Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.co
> m>
> Reviewed-by: Franky Lin <franky.lin@broadcom.com>
> Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
> ---
>  include/net/cfg80211.h       | 11 +++++++++++
>  include/uapi/linux/nl80211.h |  6 ++++++
>  net/wireless/nl80211.c       |  8 ++++++++
>  net/wireless/scan.c          |  2 ++
>  4 files changed, 27 insertions(+)
> 
> diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
> index 2019310..d1217da 100644
> --- a/include/net/cfg80211.h
> +++ b/include/net/cfg80211.h
> @@ -1675,6 +1675,9 @@ enum cfg80211_signal_type {
>   * @scan_width: scan width that was used
>   * @signal: signal strength value, according to the wiphy's
>   *	signal type
> + * @distance: distance to AP with %parent_bssid in centimeters. Zero
> + *	value indicates this is undetermined.
> + * @var_distance: variance of %distance indicating accurracy.

"accuracy" without the second 'r'.

Also, what unit is the variance in?  Needs more documentation.

Dan

>   * @boottime_ns: timestamp (CLOCK_BOOTTIME) when the information was
>   *	received; should match the time when the frame was
> actually
>   *	received by the device (not just by the host, in case it
> was
> @@ -1691,6 +1694,8 @@ struct cfg80211_inform_bss {
>  	struct ieee80211_channel *chan;
>  	enum nl80211_bss_scan_width scan_width;
>  	s32 signal;
> +	u32 distance;
> +	u32 var_distance;
>  	u64 boottime_ns;
>  	u64 parent_tsf;
>  	u8 parent_bssid[ETH_ALEN] __aligned(2);
> @@ -1737,6 +1742,9 @@ struct cfg80211_bss_ies {
>   *	that holds the beacon data. @beacon_ies is still valid, of
> course, and
>   *	points to the same data as hidden_beacon_bss->beacon_ies
> in that case.
>   * @signal: signal strength value (type depends on the wiphy's
> signal_type)
> + * @distance: distance to AP with %parent_bssid in centimeters. Zero
> + *	value indicates this is undetermined.
> + * @var_distance: variance of %distance indicating accurracy.
>   * @priv: private area for driver use, has at least wiphy-
> >bss_priv_size bytes
>   */
>  struct cfg80211_bss {
> @@ -1756,6 +1764,9 @@ struct cfg80211_bss {
>  
>  	u8 bssid[ETH_ALEN];
>  
> +	u32 distance;
> +	u32 var_distance;
> +
>  	u8 priv[0] __aligned(sizeof(void *));
>  };
>  
> diff --git a/include/uapi/linux/nl80211.h
> b/include/uapi/linux/nl80211.h
> index 259c9c7..7e935f6 100644
> --- a/include/uapi/linux/nl80211.h
> +++ b/include/uapi/linux/nl80211.h
> @@ -3651,6 +3651,10 @@ enum nl80211_bss_scan_width {
>   *	@NL80211_BSS_PARENT_BSSID. (u64).
>   * @NL80211_BSS_PARENT_BSSID: the BSS according to which
> @NL80211_BSS_PARENT_TSF
>   *	is set.
> + * @NL80211_BSS_DISTANCE: distance to AP with
> @NL80211_BSS_PARENT_BSSID in
> + *	centimeters (u32).
> + * @NL80211_BSS_VARIANCE_DISTANCE: variance of @NL80211_BSS_DISTANCE
> value (u32).
> + *
>   * @__NL80211_BSS_AFTER_LAST: internal
>   * @NL80211_BSS_MAX: highest BSS attribute
>   */
> @@ -3674,6 +3678,8 @@ enum nl80211_bss {
>  	NL80211_BSS_PAD,
>  	NL80211_BSS_PARENT_TSF,
>  	NL80211_BSS_PARENT_BSSID,
> +	NL80211_BSS_DISTANCE,
> +	NL80211_BSS_VARIANCE_DISTANCE,
>  
>  	/* keep last */
>  	__NL80211_BSS_AFTER_LAST,
> diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
> index 24ab199..ffce566 100644
> --- a/net/wireless/nl80211.c
> +++ b/net/wireless/nl80211.c
> @@ -7515,6 +7515,14 @@ static int nl80211_send_bss(struct sk_buff
> *msg, struct netlink_callback *cb,
>  			      intbss->ts_boottime, NL80211_BSS_PAD))
>  		goto nla_put_failure;
>  
> +	if (res->distance && nla_put_u32(msg, NL80211_BSS_DISTANCE,
> +					 res->distance))
> +		goto nla_put_failure;
> +
> +	if (res->var_distance && nla_put_u32(msg,
> NL80211_BSS_VARIANCE_DISTANCE,
> +					     res->var_distance))
> +		goto nla_put_failure;
> +
>  	switch (rdev->wiphy.signal_type) {
>  	case CFG80211_SIGNAL_TYPE_MBM:
>  		if (nla_put_u32(msg, NL80211_BSS_SIGNAL_MBM, res-
> >signal))
> diff --git a/net/wireless/scan.c b/net/wireless/scan.c
> index b5bd58d..afda1f9 100644
> --- a/net/wireless/scan.c
> +++ b/net/wireless/scan.c
> @@ -973,6 +973,8 @@ struct cfg80211_bss *
>  	tmp.pub.signal = data->signal;
>  	tmp.pub.beacon_interval = beacon_interval;
>  	tmp.pub.capability = capability;
> +	tmp.pub.distance = data->distance;
> +	tmp.pub.var_distance = data->var_distance;
>  	tmp.ts_boottime = data->boottime_ns;
>  
>  	/*

  reply	other threads:[~2016-11-17 17:33 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-17 11:39 [RFC 0/5] nl80211: add support for g-scan Arend van Spriel
2016-11-17 11:39 ` [PATCH 1/5] nl80211: allow reporting RTT information in scan results Arend van Spriel
2016-11-17 16:15   ` Dan Williams [this message]
2016-11-17 19:50     ` Arend Van Spriel
2016-11-17 11:39 ` [PATCH 2/5] nl80211: add reporting of gscan capabilities Arend van Spriel
2016-11-17 14:20   ` kbuild test robot
2016-11-17 11:39 ` [PATCH 3/5] nl80211: add support for gscan Arend van Spriel
2016-11-17 12:10   ` kbuild test robot
2016-11-17 12:40     ` Arend Van Spriel
2016-11-17 16:32   ` kbuild test robot
2016-11-17 11:39 ` [PATCH 4/5] nl80211: rename some notification functions Arend van Spriel
2016-11-17 11:39 ` [PATCH 5/5] nl80211: add driver api for gscan notifications Arend van Spriel
2016-11-17 12:11   ` Arend Van Spriel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1479399340.6110.8.camel@redhat.com \
    --to=dcbw@redhat.com \
    --cc=arend.vanspriel@broadcom.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).