On 10/15/2010 05:35 AM, mickael.mas...@orange-ftgroup.com wrote:
Hi Mohammed, Hi all,

We tried with the latest compat-wireless tree (as explained in 
http://wireless.kernel.org/en/users/Download/hacking#Git_trees_you_will_need) 
and we got same results with the command:
$ cat /proc/net/wireless
Inter-| sta-|   Quality        |   Discarded packets               | Missed | WE
  face | tus | link level noise |  nwid  crypt   frag  retry   misc | beacon | 
22
  wlan1: 0000   30.  -80.  -256        0      0      0     14     18        0
  wlan2: 0000    0     0     0        0      0      0      0      0        0
mon.wlan2: 0000    0     0     0        0      0      0      0      0        0

Noise is always equal to -256.
We knew that API changed when<iw>  tool was released (and 
consequently<wireless-tool>  was deprecated) but we thougth that read 
/proc/net/wireless would still provide reliable information. It seems that we were wrong!

I'm attaching patches to make this work, but the maintainers are not interested 
in these
patches upstream last I checked, so you'll have to apply them yourself.

The status/flags part of the patch is a real hack (exposes internal flags field 
with
no translation), but it can show you if the interfaces are scanning or not, etc.

This patch also shows current rate as a new field in /proc/net/wireless.

Please let me know if you have any questions.

Thanks,
Ben


--
Ben Greear <gree...@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com

>From e622b8b63b0323057b5d72b1fb068c3c4b699427 Mon Sep 17 00:00:00 2001
From: Ben Greear <gree...@candelatech.com>
Date: Fri, 8 Oct 2010 08:05:27 -0700
Subject: [PATCH 1/3] wext:  Add noise, flags, and rate to /proc/net/wireless

This seems unlikely to ever go upstream.  The noise probing
code may not work for all drivers, the flags are a copy of
internal data, and rate is a new field in /proc/net/wireless
which might confuse something.

Signed-off-by: Ben Greear <gree...@candelatech.com>
---
:100644 100644 4395b28... e538c2d... M  include/linux/wireless.h
:100644 100644 6187c2e... 6e48883... M  include/net/cfg80211.h
:100644 100644 18bd0e5... 1c01f8f... M  net/mac80211/cfg.c
:100644 100644 12222ee... b78ddfc... M  net/wireless/wext-compat.c
:100644 100644 8bafa31... 9ccc338... M  net/wireless/wext-proc.c
 include/linux/wireless.h   |    5 +++--
 include/net/cfg80211.h     |    7 ++++++-
 net/mac80211/cfg.c         |    8 ++++++++
 net/wireless/wext-compat.c |    3 +++
 net/wireless/wext-proc.c   |    8 +++++---
 5 files changed, 25 insertions(+), 6 deletions(-)

diff --git a/include/linux/wireless.h b/include/linux/wireless.h
index 4395b28..e538c2d 100644
--- a/include/linux/wireless.h
+++ b/include/linux/wireless.h
@@ -898,8 +898,9 @@ struct      iw_pmkid_cand
  */
 struct iw_statistics
 {
-       __u16           status;         /* Status
-                                        * - device dependent for now */
+       __u16           status;         /* Status: ieee80211_sta_info_flags
+                                        *   plus: (1<<15):  Scanning */
+       __u16           txrate;         /* Current rate, in 100Kbps units. */
 
        struct iw_quality       qual;           /* Quality of the link
                                                 * (instant/mean/max) */
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 6187c2e..6e48883 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -485,6 +485,8 @@ struct rate_info {
  * @plid: mesh peer link id
  * @plink_state: mesh peer link state
  * @signal: signal strength of last received packet in dBm
+ * @status: ieee80211_sta_info_flags plus:  (1<<15) Scanning.
+ * @noise: noise, as obtained from dump_survey of index 0.
  * @txrate: current unicast bitrate to this station
  * @rx_packets: packets received from this station
  * @tx_packets: packets transmitted to this station
@@ -505,7 +507,10 @@ struct station_info {
        u16 plid;
        u8 plink_state;
        s8 signal;
-       struct rate_info txrate;
+       u16 status;
+       u8 noise;
+       /* 3 byte hole */
+struct rate_info txrate;
        u32 rx_packets;
        u32 tx_packets;
        u32 tx_retries;
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 18bd0e5..1c01f8f 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -319,6 +319,7 @@ static int ieee80211_config_default_mgmt_key(struct wiphy 
*wiphy,
 static void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
 {
        struct ieee80211_sub_if_data *sdata = sta->sdata;
+       struct survey_info survey;
 
        sinfo->generation = sdata->local->sta_generation;
 
@@ -375,6 +376,13 @@ static void sta_set_sinfo(struct sta_info *sta, struct 
station_info *sinfo)
                sinfo->plink_state = sta->plink_state;
 #endif
        }
+
+       sinfo->status = sta->flags;
+       if (sdata->local->scanning)
+               sinfo->status |= (1<<15);
+
+       if (drv_get_survey(sdata->local, 0, &survey) == 0)
+               sinfo->noise = survey.noise;
 }
 
 
diff --git a/net/wireless/wext-compat.c b/net/wireless/wext-compat.c
index 12222ee..b78ddfc 100644
--- a/net/wireless/wext-compat.c
+++ b/net/wireless/wext-compat.c
@@ -1370,6 +1370,9 @@ struct iw_statistics *cfg80211_wireless_stats(struct 
net_device *dev)
                wstats.discard.misc = sinfo.rx_dropped_misc;
        if (sinfo.filled & STATION_INFO_TX_FAILED)
                wstats.discard.retries = sinfo.tx_failed;
+       wstats.status = sinfo.status;
+       wstats.qual.noise = sinfo.noise;
+       wstats.txrate = cfg80211_calculate_bitrate(&sinfo.txrate);
 
        return &wstats;
 }
diff --git a/net/wireless/wext-proc.c b/net/wireless/wext-proc.c
index 8bafa31..9ccc338 100644
--- a/net/wireless/wext-proc.c
+++ b/net/wireless/wext-proc.c
@@ -46,8 +46,9 @@ static void wireless_seq_printf_stats(struct seq_file *seq,
        }
 
        if (stats) {
+               u32 rt = 100000 * (u32)(stats->txrate);
                seq_printf(seq, "%6s: %04x  %3d%c  %3d%c  %3d%c  %6d %6d %6d "
-                               "%6d %6d   %6d\n",
+                               "%6d %6d   %6d  %d\n",
                           dev->name, stats->status, stats->qual.qual,
                           stats->qual.updated & IW_QUAL_QUAL_UPDATED
                           ? '.' : ' ',
@@ -61,7 +62,8 @@ static void wireless_seq_printf_stats(struct seq_file *seq,
                           ? '.' : ' ',
                           stats->discard.nwid, stats->discard.code,
                           stats->discard.fragment, stats->discard.retries,
-                          stats->discard.misc, stats->miss.beacon);
+                          stats->discard.misc, stats->miss.beacon,
+                          rt);
 
                if (stats != &nullstats)
                        stats->qual.updated &= ~IW_QUAL_ALL_UPDATED;
@@ -78,7 +80,7 @@ static int wireless_dev_seq_show(struct seq_file *seq, void 
*v)
 
        if (v == SEQ_START_TOKEN)
                seq_printf(seq, "Inter-| sta-|   Quality        |   Discarded "
-                               "packets               | Missed | WE\n"
+                               "packets               | Missed | WE   RATE\n"
                                " face | tus | link level noise |  nwid  "
                                "crypt   frag  retry   misc | beacon | %d\n",
                           WIRELESS_EXT);
-- 
1.7.2.2

_______________________________________________
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel

Reply via email to