All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mac80211: add command to get current rssi
@ 2012-05-22  6:45 Victor Goldenshtein
  2012-05-22 11:16 ` Kalle Valo
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Victor Goldenshtein @ 2012-05-22  6:45 UTC (permalink / raw)
  To: linux-wireless; +Cc: johannes

Get current rssi (in dBm) from the driver/FW.

Instead of reporting the signal received in the last
rx packet, which might be inaccurate if rx traffic is
low and beacon filtering is enabled, get the singal
from the driver/FW.

Signed-off-by: Victor Goldenshtein <victorg@ti.com>
---
 include/net/mac80211.h      |    4 ++++
 net/mac80211/cfg.c          |   22 ++++++++++++++--------
 net/mac80211/driver-ops.h   |   11 +++++++++++
 net/mac80211/driver-trace.h |    6 ++++++
 4 files changed, 35 insertions(+), 8 deletions(-)

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 4d6e6c6..279126a 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -2231,6 +2231,8 @@ enum ieee80211_rate_control_changed {
  * @get_et_strings:  Ethtool API to get a set of strings to describe stats
  *	and perhaps other supported types of ethtool data-sets.
  *
+ * @get_rssi: Get current signal strength in dBm.
+ *
  */
 struct ieee80211_ops {
 	void (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb);
@@ -2370,6 +2372,8 @@ struct ieee80211_ops {
 	void	(*get_et_strings)(struct ieee80211_hw *hw,
 				  struct ieee80211_vif *vif,
 				  u32 sset, u8 *data);
+	void (*get_rssi)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+			 s8 *rssi_dbm);
 };
 
 /**
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 0221270..41bdf02 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -353,6 +353,7 @@ void sta_set_rate_info_tx(struct sta_info *sta,
 static void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
 {
 	struct ieee80211_sub_if_data *sdata = sta->sdata;
+	struct ieee80211_local *local = sdata->local;
 	struct timespec uptime;
 
 	sinfo->generation = sdata->local->sta_generation;
@@ -388,7 +389,10 @@ static void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
 	if ((sta->local->hw.flags & IEEE80211_HW_SIGNAL_DBM) ||
 	    (sta->local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC)) {
 		sinfo->filled |= STATION_INFO_SIGNAL | STATION_INFO_SIGNAL_AVG;
-		sinfo->signal = (s8)sta->last_signal;
+		if (local->ops->get_rssi)
+			drv_get_rssi(local, sdata, &sinfo->signal);
+		else
+			sinfo->signal = (s8)sta->last_signal;
 		sinfo->signal_avg = (s8) -ewma_read(&sta->avg_signal);
 	}
 
@@ -517,7 +521,7 @@ static void ieee80211_get_et_stats(struct wiphy *wiphy,
 	 * network device.
 	 */
 
-	rcu_read_lock();
+	mutex_lock(&local->sta_mtx);
 
 	if (sdata->vif.type == NL80211_IFTYPE_STATION) {
 		sta = sta_info_get_bss(sdata, sdata->u.mgd.bssid);
@@ -546,7 +550,7 @@ static void ieee80211_get_et_stats(struct wiphy *wiphy,
 			data[i] = (u8)sinfo.signal_avg;
 		i++;
 	} else {
-		list_for_each_entry_rcu(sta, &local->sta_list, list) {
+		list_for_each_entry(sta, &local->sta_list, list) {
 			/* Make sure this station belongs to the proper dev */
 			if (sta->sdata->dev != dev)
 				continue;
@@ -603,7 +607,7 @@ do_survey:
 	else
 		data[i++] = -1LL;
 
-	rcu_read_unlock();
+	mutex_unlock(&local->sta_mtx);
 
 	if (WARN_ON(i != STA_STATS_LEN))
 		return;
@@ -629,10 +633,11 @@ static int ieee80211_dump_station(struct wiphy *wiphy, struct net_device *dev,
 				 int idx, u8 *mac, struct station_info *sinfo)
 {
 	struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+	struct ieee80211_local *local = sdata->local;
 	struct sta_info *sta;
 	int ret = -ENOENT;
 
-	rcu_read_lock();
+	mutex_lock(&local->sta_mtx);
 
 	sta = sta_info_get_by_idx(sdata, idx);
 	if (sta) {
@@ -641,7 +646,7 @@ static int ieee80211_dump_station(struct wiphy *wiphy, struct net_device *dev,
 		sta_set_sinfo(sta, sinfo);
 	}
 
-	rcu_read_unlock();
+	mutex_unlock(&local->sta_mtx);
 
 	return ret;
 }
@@ -658,10 +663,11 @@ static int ieee80211_get_station(struct wiphy *wiphy, struct net_device *dev,
 				 u8 *mac, struct station_info *sinfo)
 {
 	struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+	struct ieee80211_local *local = sdata->local;
 	struct sta_info *sta;
 	int ret = -ENOENT;
 
-	rcu_read_lock();
+	mutex_lock(&local->sta_mtx);
 
 	sta = sta_info_get_bss(sdata, mac);
 	if (sta) {
@@ -669,7 +675,7 @@ static int ieee80211_get_station(struct wiphy *wiphy, struct net_device *dev,
 		sta_set_sinfo(sta, sinfo);
 	}
 
-	rcu_read_unlock();
+	mutex_unlock(&local->sta_mtx);
 
 	return ret;
 }
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index 6d33a0c..cbfaf72 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -845,4 +845,15 @@ drv_allow_buffered_frames(struct ieee80211_local *local,
 						  more_data);
 	trace_drv_return_void(local);
 }
+
+static inline void drv_get_rssi(struct ieee80211_local *local,
+				struct ieee80211_sub_if_data *sdata,
+				s8 *rssi_dbm)
+{
+	might_sleep();
+
+	trace_drv_get_rssi(local, sdata);
+	local->ops->get_rssi(&local->hw, &sdata->vif, rssi_dbm);
+	trace_drv_return_void(local);
+}
 #endif /* __MAC80211_DRIVER_OPS */
diff --git a/net/mac80211/driver-trace.h b/net/mac80211/driver-trace.h
index 6de00b2..fc91ac4 100644
--- a/net/mac80211/driver-trace.h
+++ b/net/mac80211/driver-trace.h
@@ -1218,6 +1218,12 @@ DEFINE_EVENT(release_evt, drv_allow_buffered_frames,
 	TP_ARGS(local, sta, tids, num_frames, reason, more_data)
 );
 
+DEFINE_EVENT(local_sdata_evt, drv_get_rssi,
+	TP_PROTO(struct ieee80211_local *local,
+		 struct ieee80211_sub_if_data *sdata),
+	TP_ARGS(local, sdata)
+);
+
 /*
  * Tracing for API calls that drivers call.
  */
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH] mac80211: add command to get current rssi
  2012-05-22  6:45 [PATCH] mac80211: add command to get current rssi Victor Goldenshtein
@ 2012-05-22 11:16 ` Kalle Valo
  2012-05-22 14:25   ` Goldenshtein, Victor
  2012-05-22 18:40 ` Johannes Berg
  2012-06-25 12:06 ` sylvain_gmail
  2 siblings, 1 reply; 14+ messages in thread
From: Kalle Valo @ 2012-05-22 11:16 UTC (permalink / raw)
  To: Victor Goldenshtein; +Cc: linux-wireless, johannes

Victor Goldenshtein <victorg@ti.com> writes:

> Get current rssi (in dBm) from the driver/FW.
>
> Instead of reporting the signal received in the last
> rx packet, which might be inaccurate if rx traffic is
> low and beacon filtering is enabled, get the singal
> from the driver/FW.
>
> Signed-off-by: Victor Goldenshtein <victorg@ti.com>
> ---
>  include/net/mac80211.h      |    4 ++++
>  net/mac80211/cfg.c          |   22 ++++++++++++++--------
>  net/mac80211/driver-ops.h   |   11 +++++++++++
>  net/mac80211/driver-trace.h |    6 ++++++
>  4 files changed, 35 insertions(+), 8 deletions(-)
>
> diff --git a/include/net/mac80211.h b/include/net/mac80211.h
> index 4d6e6c6..279126a 100644
> --- a/include/net/mac80211.h
> +++ b/include/net/mac80211.h
> @@ -2231,6 +2231,8 @@ enum ieee80211_rate_control_changed {
>   * @get_et_strings:  Ethtool API to get a set of strings to describe stats
>   *	and perhaps other supported types of ethtool data-sets.
>   *
> + * @get_rssi: Get current signal strength in dBm.

Please document that the callback is optional and it can sleep.

-- 
Kalle Valo

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] mac80211: add command to get current rssi
  2012-05-22 11:16 ` Kalle Valo
@ 2012-05-22 14:25   ` Goldenshtein, Victor
  0 siblings, 0 replies; 14+ messages in thread
From: Goldenshtein, Victor @ 2012-05-22 14:25 UTC (permalink / raw)
  To: Kalle Valo; +Cc: linux-wireless, johannes

On Tue, May 22, 2012 at 2:16 PM, Kalle Valo <kvalo@adurom.com> wrote:
> Please document that the callback is optional and it can sleep.
>

Will send v2 with updated documentation.

Thanks for the review.

-- 
Victor.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] mac80211: add command to get current rssi
  2012-05-22  6:45 [PATCH] mac80211: add command to get current rssi Victor Goldenshtein
  2012-05-22 11:16 ` Kalle Valo
@ 2012-05-22 18:40 ` Johannes Berg
  2012-05-23  6:58   ` Goldenshtein, Victor
  2012-06-25 12:06 ` sylvain_gmail
  2 siblings, 1 reply; 14+ messages in thread
From: Johannes Berg @ 2012-05-22 18:40 UTC (permalink / raw)
  To: Victor Goldenshtein; +Cc: linux-wireless

On Tue, 2012-05-22 at 09:45 +0300, Victor Goldenshtein wrote:

> @@ -388,7 +389,10 @@ static void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
>  	if ((sta->local->hw.flags & IEEE80211_HW_SIGNAL_DBM) ||
>  	    (sta->local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC)) {
>  		sinfo->filled |= STATION_INFO_SIGNAL | STATION_INFO_SIGNAL_AVG;
> -		sinfo->signal = (s8)sta->last_signal;
> +		if (local->ops->get_rssi)
> +			drv_get_rssi(local, sdata, &sinfo->signal);
> +		else
> +			sinfo->signal = (s8)sta->last_signal;
>  		sinfo->signal_avg = (s8) -ewma_read(&sta->avg_signal);
>  	}

So .. you're filling a per-station value with a generic per-interface
callback? What were you thinking? ;-)

johannes


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] mac80211: add command to get current rssi
  2012-05-22 18:40 ` Johannes Berg
@ 2012-05-23  6:58   ` Goldenshtein, Victor
  2012-05-23  8:51     ` Goldenshtein, Victor
  0 siblings, 1 reply; 14+ messages in thread
From: Goldenshtein, Victor @ 2012-05-23  6:58 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless

On Tue, May 22, 2012 at 9:40 PM, Johannes Berg
<johannes@sipsolutions.net> wrote:
> On Tue, 2012-05-22 at 09:45 +0300, Victor Goldenshtein wrote:
>
>> @@ -388,7 +389,10 @@ static void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
>>       if ((sta->local->hw.flags & IEEE80211_HW_SIGNAL_DBM) ||
>>           (sta->local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC)) {
>>               sinfo->filled |= STATION_INFO_SIGNAL | STATION_INFO_SIGNAL_AVG;
>> -             sinfo->signal = (s8)sta->last_signal;
>> +             if (local->ops->get_rssi)
>> +                     drv_get_rssi(local, sdata, &sinfo->signal);
>> +             else
>> +                     sinfo->signal = (s8)sta->last_signal;
>>               sinfo->signal_avg = (s8) -ewma_read(&sta->avg_signal);
>>       }
>
> So .. you're filling a per-station value with a generic per-interface
> callback? What were you thinking? ;-)
>

This is this is for managed only.
I can rename the drv_get_rssi() to drv_get_sta_rssi() and to call it
only for NL80211_IFTYPE_STATION, I think it would clarify things?


-- 
Victor.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] mac80211: add command to get current rssi
  2012-05-23  6:58   ` Goldenshtein, Victor
@ 2012-05-23  8:51     ` Goldenshtein, Victor
  2012-05-29  7:11       ` Johannes Berg
  2012-05-29  7:11       ` Johannes Berg
  0 siblings, 2 replies; 14+ messages in thread
From: Goldenshtein, Victor @ 2012-05-23  8:51 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless

On Wed, May 23, 2012 at 9:58 AM, Goldenshtein, Victor <victorg@ti.com> wrote:
> On Tue, May 22, 2012 at 9:40 PM, Johannes Berg
> <johannes@sipsolutions.net> wrote:
>> On Tue, 2012-05-22 at 09:45 +0300, Victor Goldenshtein wrote:
>>
>>> @@ -388,7 +389,10 @@ static void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
>>>       if ((sta->local->hw.flags & IEEE80211_HW_SIGNAL_DBM) ||
>>>           (sta->local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC)) {
>>>               sinfo->filled |= STATION_INFO_SIGNAL | STATION_INFO_SIGNAL_AVG;
>>> -             sinfo->signal = (s8)sta->last_signal;
>>> +             if (local->ops->get_rssi)
>>> +                     drv_get_rssi(local, sdata, &sinfo->signal);
>>> +             else
>>> +                     sinfo->signal = (s8)sta->last_signal;
>>>               sinfo->signal_avg = (s8) -ewma_read(&sta->avg_signal);
>>>       }
>>
>> So .. you're filling a per-station value with a generic per-interface
>> callback? What were you thinking? ;-)
>>
>
> This is this is for managed only.
> I can rename the drv_get_rssi() to drv_get_sta_rssi() and to call it
> only for NL80211_IFTYPE_STATION, I think it would clarify things?
>

Alternatively we could leave it as general callback "drv_get_rssi()",
add the peer address and let the driver decide if it supports
retrieval of the rssi for the given peer.  Thus, allowing us to do
something like:

if (!local->ops->get_rssi) || (drv_get_rssi(local, sdata,
sta->sta.addr, &sinfo->signal))
        sinfo->signal = (s8)sta->last_signal;

-- 
Victor.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] mac80211: add command to get current rssi
  2012-05-23  8:51     ` Goldenshtein, Victor
@ 2012-05-29  7:11       ` Johannes Berg
  2012-05-29  7:11       ` Johannes Berg
  1 sibling, 0 replies; 14+ messages in thread
From: Johannes Berg @ 2012-05-29  7:11 UTC (permalink / raw)
  To: Goldenshtein, Victor; +Cc: linux-wireless

On Wed, 2012-05-23 at 11:51 +0300, Goldenshtein, Victor wrote:
> On Wed, May 23, 2012 at 9:58 AM, Goldenshtein, Victor <victorg@ti.com> wrote:
> > On Tue, May 22, 2012 at 9:40 PM, Johannes Berg
> > <johannes@sipsolutions.net> wrote:
> >> On Tue, 2012-05-22 at 09:45 +0300, Victor Goldenshtein wrote:
> >>
> >>> @@ -388,7 +389,10 @@ static void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
> >>>       if ((sta->local->hw.flags & IEEE80211_HW_SIGNAL_DBM) ||
> >>>           (sta->local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC)) {
> >>>               sinfo->filled |= STATION_INFO_SIGNAL | STATION_INFO_SIGNAL_AVG;
> >>> -             sinfo->signal = (s8)sta->last_signal;
> >>> +             if (local->ops->get_rssi)
> >>> +                     drv_get_rssi(local, sdata, &sinfo->signal);
> >>> +             else
> >>> +                     sinfo->signal = (s8)sta->last_signal;
> >>>               sinfo->signal_avg = (s8) -ewma_read(&sta->avg_signal);
> >>>       }
> >>
> >> So .. you're filling a per-station value with a generic per-interface
> >> callback? What were you thinking? ;-)
> >>
> >
> > This is this is for managed only.
> > I can rename the drv_get_rssi() to drv_get_sta_rssi() and to call it
> > only for NL80211_IFTYPE_STATION, I think it would clarify things?
> >
> 
> Alternatively we could leave it as general callback "drv_get_rssi()",
> add the peer address and let the driver decide if it supports
> retrieval of the rssi for the given peer.  Thus, allowing us to do
> something like:
> 
> if (!local->ops->get_rssi) || (drv_get_rssi(local, sdata,
> sta->sta.addr, &sinfo->signal))
>         sinfo->signal = (s8)sta->last_signal;

That's probably better.

johannes


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] mac80211: add command to get current rssi
  2012-05-23  8:51     ` Goldenshtein, Victor
  2012-05-29  7:11       ` Johannes Berg
@ 2012-05-29  7:11       ` Johannes Berg
  2012-05-29 14:39         ` Goldenshtein, Victor
  1 sibling, 1 reply; 14+ messages in thread
From: Johannes Berg @ 2012-05-29  7:11 UTC (permalink / raw)
  To: Goldenshtein, Victor; +Cc: linux-wireless

On Wed, 2012-05-23 at 11:51 +0300, Goldenshtein, Victor wrote:
> On Wed, May 23, 2012 at 9:58 AM, Goldenshtein, Victor <victorg@ti.com> wrote:
> > On Tue, May 22, 2012 at 9:40 PM, Johannes Berg
> > <johannes@sipsolutions.net> wrote:
> >> On Tue, 2012-05-22 at 09:45 +0300, Victor Goldenshtein wrote:
> >>
> >>> @@ -388,7 +389,10 @@ static void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
> >>>       if ((sta->local->hw.flags & IEEE80211_HW_SIGNAL_DBM) ||
> >>>           (sta->local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC)) {
> >>>               sinfo->filled |= STATION_INFO_SIGNAL | STATION_INFO_SIGNAL_AVG;
> >>> -             sinfo->signal = (s8)sta->last_signal;
> >>> +             if (local->ops->get_rssi)
> >>> +                     drv_get_rssi(local, sdata, &sinfo->signal);
> >>> +             else
> >>> +                     sinfo->signal = (s8)sta->last_signal;
> >>>               sinfo->signal_avg = (s8) -ewma_read(&sta->avg_signal);
> >>>       }
> >>
> >> So .. you're filling a per-station value with a generic per-interface
> >> callback? What were you thinking? ;-)
> >>
> >
> > This is this is for managed only.
> > I can rename the drv_get_rssi() to drv_get_sta_rssi() and to call it
> > only for NL80211_IFTYPE_STATION, I think it would clarify things?
> >
> 
> Alternatively we could leave it as general callback "drv_get_rssi()",
> add the peer address and let the driver decide if it supports
> retrieval of the rssi for the given peer.  Thus, allowing us to do
> something like:
> 
> if (!local->ops->get_rssi) || (drv_get_rssi(local, sdata,
> sta->sta.addr, &sinfo->signal))
>         sinfo->signal = (s8)sta->last_signal;

However, I think you should pass &sta->sta, not sta->sta.addr.

johannes


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] mac80211: add command to get current rssi
  2012-05-29  7:11       ` Johannes Berg
@ 2012-05-29 14:39         ` Goldenshtein, Victor
  0 siblings, 0 replies; 14+ messages in thread
From: Goldenshtein, Victor @ 2012-05-29 14:39 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless

On Tue, May 29, 2012 at 10:11 AM, Johannes Berg
<johannes@sipsolutions.net> wrote:
>> if (!local->ops->get_rssi) || (drv_get_rssi(local, sdata,
>> sta->sta.addr, &sinfo->signal))
>>         sinfo->signal = (s8)sta->last_signal;
>
> However, I think you should pass &sta->sta, not sta->sta.addr.
>

Will send v2 with the above change.

-- 
Thanks,
Victor.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] mac80211: add command to get current rssi
  2012-05-22  6:45 [PATCH] mac80211: add command to get current rssi Victor Goldenshtein
  2012-05-22 11:16 ` Kalle Valo
  2012-05-22 18:40 ` Johannes Berg
@ 2012-06-25 12:06 ` sylvain_gmail
  2012-06-25 13:32   ` Kalle Valo
  2 siblings, 1 reply; 14+ messages in thread
From: sylvain_gmail @ 2012-06-25 12:06 UTC (permalink / raw)
  To: Victor Goldenshtein; +Cc: Johannes Berg, linux-wireless

Hello Victor,

I am very pleased with your patch ;). I will be very useful. ;)

But do not you think it would be interesting to have a function that 
returns the RSSI signal by antennas?

Regards,
Sylvain


Le 22/05/2012 08:45, Victor Goldenshtein a écrit :
> Get current rssi (in dBm) from the driver/FW.
>
> Instead of reporting the signal received in the last
> rx packet, which might be inaccurate if rx traffic is
> low and beacon filtering is enabled, get the singal
> from the driver/FW.
>
> Signed-off-by: Victor Goldenshtein <victorg@ti.com>
> ---
>   include/net/mac80211.h      |    4 ++++
>   net/mac80211/cfg.c          |   22 ++++++++++++++--------
>   net/mac80211/driver-ops.h   |   11 +++++++++++
>   net/mac80211/driver-trace.h |    6 ++++++
>   4 files changed, 35 insertions(+), 8 deletions(-)
>
> diff --git a/include/net/mac80211.h b/include/net/mac80211.h
> index 4d6e6c6..279126a 100644
> --- a/include/net/mac80211.h
> +++ b/include/net/mac80211.h
> @@ -2231,6 +2231,8 @@ enum ieee80211_rate_control_changed {
>    * @get_et_strings:  Ethtool API to get a set of strings to describe stats
>    *	and perhaps other supported types of ethtool data-sets.
>    *
> + * @get_rssi: Get current signal strength in dBm.
> + *
>    */
>   struct ieee80211_ops {
>   	void (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb);
> @@ -2370,6 +2372,8 @@ struct ieee80211_ops {
>   	void	(*get_et_strings)(struct ieee80211_hw *hw,
>   				  struct ieee80211_vif *vif,
>   				  u32 sset, u8 *data);
> +	void (*get_rssi)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
> +			 s8 *rssi_dbm);
>   };
>   
>   /**
> diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
> index 0221270..41bdf02 100644
> --- a/net/mac80211/cfg.c
> +++ b/net/mac80211/cfg.c
> @@ -353,6 +353,7 @@ void sta_set_rate_info_tx(struct sta_info *sta,
>   static void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
>   {
>   	struct ieee80211_sub_if_data *sdata = sta->sdata;
> +	struct ieee80211_local *local = sdata->local;
>   	struct timespec uptime;
>   
>   	sinfo->generation = sdata->local->sta_generation;
> @@ -388,7 +389,10 @@ static void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
>   	if ((sta->local->hw.flags & IEEE80211_HW_SIGNAL_DBM) ||
>   	    (sta->local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC)) {
>   		sinfo->filled |= STATION_INFO_SIGNAL | STATION_INFO_SIGNAL_AVG;
> -		sinfo->signal = (s8)sta->last_signal;
> +		if (local->ops->get_rssi)
> +			drv_get_rssi(local, sdata, &sinfo->signal);
> +		else
> +			sinfo->signal = (s8)sta->last_signal;
>   		sinfo->signal_avg = (s8) -ewma_read(&sta->avg_signal);
>   	}
>   
> @@ -517,7 +521,7 @@ static void ieee80211_get_et_stats(struct wiphy *wiphy,
>   	 * network device.
>   	 */
>   
> -	rcu_read_lock();
> +	mutex_lock(&local->sta_mtx);
>   
>   	if (sdata->vif.type == NL80211_IFTYPE_STATION) {
>   		sta = sta_info_get_bss(sdata, sdata->u.mgd.bssid);
> @@ -546,7 +550,7 @@ static void ieee80211_get_et_stats(struct wiphy *wiphy,
>   			data[i] = (u8)sinfo.signal_avg;
>   		i++;
>   	} else {
> -		list_for_each_entry_rcu(sta, &local->sta_list, list) {
> +		list_for_each_entry(sta, &local->sta_list, list) {
>   			/* Make sure this station belongs to the proper dev */
>   			if (sta->sdata->dev != dev)
>   				continue;
> @@ -603,7 +607,7 @@ do_survey:
>   	else
>   		data[i++] = -1LL;
>   
> -	rcu_read_unlock();
> +	mutex_unlock(&local->sta_mtx);
>   
>   	if (WARN_ON(i != STA_STATS_LEN))
>   		return;
> @@ -629,10 +633,11 @@ static int ieee80211_dump_station(struct wiphy *wiphy, struct net_device *dev,
>   				 int idx, u8 *mac, struct station_info *sinfo)
>   {
>   	struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
> +	struct ieee80211_local *local = sdata->local;
>   	struct sta_info *sta;
>   	int ret = -ENOENT;
>   
> -	rcu_read_lock();
> +	mutex_lock(&local->sta_mtx);
>   
>   	sta = sta_info_get_by_idx(sdata, idx);
>   	if (sta) {
> @@ -641,7 +646,7 @@ static int ieee80211_dump_station(struct wiphy *wiphy, struct net_device *dev,
>   		sta_set_sinfo(sta, sinfo);
>   	}
>   
> -	rcu_read_unlock();
> +	mutex_unlock(&local->sta_mtx);
>   
>   	return ret;
>   }
> @@ -658,10 +663,11 @@ static int ieee80211_get_station(struct wiphy *wiphy, struct net_device *dev,
>   				 u8 *mac, struct station_info *sinfo)
>   {
>   	struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
> +	struct ieee80211_local *local = sdata->local;
>   	struct sta_info *sta;
>   	int ret = -ENOENT;
>   
> -	rcu_read_lock();
> +	mutex_lock(&local->sta_mtx);
>   
>   	sta = sta_info_get_bss(sdata, mac);
>   	if (sta) {
> @@ -669,7 +675,7 @@ static int ieee80211_get_station(struct wiphy *wiphy, struct net_device *dev,
>   		sta_set_sinfo(sta, sinfo);
>   	}
>   
> -	rcu_read_unlock();
> +	mutex_unlock(&local->sta_mtx);
>   
>   	return ret;
>   }
> diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
> index 6d33a0c..cbfaf72 100644
> --- a/net/mac80211/driver-ops.h
> +++ b/net/mac80211/driver-ops.h
> @@ -845,4 +845,15 @@ drv_allow_buffered_frames(struct ieee80211_local *local,
>   						  more_data);
>   	trace_drv_return_void(local);
>   }
> +
> +static inline void drv_get_rssi(struct ieee80211_local *local,
> +				struct ieee80211_sub_if_data *sdata,
> +				s8 *rssi_dbm)
> +{
> +	might_sleep();
> +
> +	trace_drv_get_rssi(local, sdata);
> +	local->ops->get_rssi(&local->hw, &sdata->vif, rssi_dbm);
> +	trace_drv_return_void(local);
> +}
>   #endif /* __MAC80211_DRIVER_OPS */
> diff --git a/net/mac80211/driver-trace.h b/net/mac80211/driver-trace.h
> index 6de00b2..fc91ac4 100644
> --- a/net/mac80211/driver-trace.h
> +++ b/net/mac80211/driver-trace.h
> @@ -1218,6 +1218,12 @@ DEFINE_EVENT(release_evt, drv_allow_buffered_frames,
>   	TP_ARGS(local, sta, tids, num_frames, reason, more_data)
>   );
>   
> +DEFINE_EVENT(local_sdata_evt, drv_get_rssi,
> +	TP_PROTO(struct ieee80211_local *local,
> +		 struct ieee80211_sub_if_data *sdata),
> +	TP_ARGS(local, sdata)
> +);
> +
>   /*
>    * Tracing for API calls that drivers call.
>    */



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] mac80211: add command to get current rssi
  2012-06-25 12:06 ` sylvain_gmail
@ 2012-06-25 13:32   ` Kalle Valo
  2012-06-26  8:05     ` sylvain_gmail
  0 siblings, 1 reply; 14+ messages in thread
From: Kalle Valo @ 2012-06-25 13:32 UTC (permalink / raw)
  To: sylvain_gmail; +Cc: Victor Goldenshtein, Johannes Berg, linux-wireless

sylvain_gmail <sylvain.roger.rieunier@gmail.com> writes:

> But do not you think it would be interesting to have a function that
> returns the RSSI signal by antennas?

Just out of interest, how would user space use that information? Do you
have any ideas?

-- 
Kalle Valo

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] mac80211: add command to get current rssi
  2012-06-25 13:32   ` Kalle Valo
@ 2012-06-26  8:05     ` sylvain_gmail
  2012-06-26  8:20       ` DINO MYCLE
  0 siblings, 1 reply; 14+ messages in thread
From: sylvain_gmail @ 2012-06-26  8:05 UTC (permalink / raw)
  To: Kalle Valo; +Cc: Victor Goldenshtein, Johannes Berg, linux-wireless

it can be very useful when you installed multiple polarization antennas. 
For each polarization picks up the signal on a different axis. For 
example for a dual polarization antenna, you have a horizontal 
polarization and vertical polarization.

Regards,
Sylvain

Le 25/06/2012 15:32, Kalle Valo a écrit :
> sylvain_gmail <sylvain.roger.rieunier@gmail.com> writes:
>
>> But do not you think it would be interesting to have a function that
>> returns the RSSI signal by antennas?
> Just out of interest, how would user space use that information? Do you
> have any ideas?
>



^ permalink raw reply	[flat|nested] 14+ messages in thread

* RE: [PATCH] mac80211: add command to get current rssi
  2012-06-26  8:05     ` sylvain_gmail
@ 2012-06-26  8:20       ` DINO MYCLE
  2012-06-26  8:50         ` Johannes Berg
  0 siblings, 1 reply; 14+ messages in thread
From: DINO MYCLE @ 2012-06-26  8:20 UTC (permalink / raw)
  To: sylvain_gmail, Kalle Valo
  Cc: Victor Goldenshtein, Johannes Berg, linux-wireless

Hello,
 Adding the RSSI for each antenna will be useful. We can verify if the antenna connectors are proper or not by checking the RSSI value of each antenna, Also this will be helpful for outdoor installation where they use dual polarized antennas for PtP and PMP systems

--
Thanks and Regards,
Dino Joseph Mycle, Ext: 3299, +91 9916888337
Sasken Communication Technologies Ltd.


-----Original Message-----
From: linux-wireless-owner@vger.kernel.org [mailto:linux-wireless-owner@vger.kernel.org] On Behalf Of sylvain_gmail
Sent: Tuesday, June 26, 2012 1:35 PM
To: Kalle Valo
Cc: Victor Goldenshtein; Johannes Berg; linux-wireless@vger.kernel.org
Subject: Re: [PATCH] mac80211: add command to get current rssi

it can be very useful when you installed multiple polarization antennas.
For each polarization picks up the signal on a different axis. For example for a dual polarization antenna, you have a horizontal polarization and vertical polarization.

Regards,
Sylvain

Le 25/06/2012 15:32, Kalle Valo a écrit :
> sylvain_gmail <sylvain.roger.rieunier@gmail.com> writes:
>
>> But do not you think it would be interesting to have a function that
>> returns the RSSI signal by antennas?
> Just out of interest, how would user space use that information? Do
> you have any ideas?
>


--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@vger.kernel.org More majordomo info at  http://vger.kernel.org/majordomo-info.html

SASKEN BUSINESS DISCLAIMER: This message may contain confidential, proprietary or legally privileged information. In case you are not the original intended Recipient of the message, you must not, directly or indirectly, use, disclose, distribute, print, or copy any part of this message and you are requested to delete it and inform the sender. Any views expressed in this message are those of the individual sender unless otherwise stated. Nothing contained in this message shall be construed as an offer or acceptance of any offer by Sasken Communication Technologies Limited ("Sasken") unless sent with that express intent and with due authority of Sasken. Sasken has taken enough precautions to prevent the spread of viruses. However the company accepts no liability for any damage caused by any virus transmitted by this email.
Read Disclaimer at http://www.sasken.com/extras/mail_disclaimer.html

^ permalink raw reply	[flat|nested] 14+ messages in thread

* RE: [PATCH] mac80211: add command to get current rssi
  2012-06-26  8:20       ` DINO MYCLE
@ 2012-06-26  8:50         ` Johannes Berg
  0 siblings, 0 replies; 14+ messages in thread
From: Johannes Berg @ 2012-06-26  8:50 UTC (permalink / raw)
  To: DINO MYCLE; +Cc: sylvain_gmail, Kalle Valo, Victor Goldenshtein, linux-wireless

On Tue, 2012-06-26 at 13:50 +0530, DINO MYCLE wrote:
> Hello,
>  Adding the RSSI for each antenna will be useful. We can verify if the
> antenna connectors are proper or not by checking the RSSI value of
> each antenna, Also this will be helpful for outdoor installation where
> they use dual polarized antennas for PtP and PMP systems

Does this make sense for the normal reporting though? I see more value
in reporting it in radiotap monitoring for instance.

johannes


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2012-06-26  8:51 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-22  6:45 [PATCH] mac80211: add command to get current rssi Victor Goldenshtein
2012-05-22 11:16 ` Kalle Valo
2012-05-22 14:25   ` Goldenshtein, Victor
2012-05-22 18:40 ` Johannes Berg
2012-05-23  6:58   ` Goldenshtein, Victor
2012-05-23  8:51     ` Goldenshtein, Victor
2012-05-29  7:11       ` Johannes Berg
2012-05-29  7:11       ` Johannes Berg
2012-05-29 14:39         ` Goldenshtein, Victor
2012-06-25 12:06 ` sylvain_gmail
2012-06-25 13:32   ` Kalle Valo
2012-06-26  8:05     ` sylvain_gmail
2012-06-26  8:20       ` DINO MYCLE
2012-06-26  8:50         ` Johannes Berg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.