ieee80211: Add spectrum management information and use stat.signal to
           provide signal level information.

Signed-off-by: Zhu Yi <[EMAIL PROTECTED]>
---
 net/ieee80211/ieee80211_wx.c |   31 +++++++++++++++++++++++++++++--
 1 file changed, 29 insertions(+), 2 deletions(-)
---
diff --git a/net/ieee80211/ieee80211_wx.c b/net/ieee80211/ieee80211_wx.c
index f0621cd..6b40a70 100644
--- a/net/ieee80211/ieee80211_wx.c
+++ b/net/ieee80211/ieee80211_wx.c
@@ -149,9 +149,7 @@ static inline char *ipw2100_translate_sc
                iwe.u.qual.updated |= IW_QUAL_QUAL_INVALID |
                    IW_QUAL_LEVEL_INVALID;
                iwe.u.qual.qual = 0;
-               iwe.u.qual.level = 0;
        } else {
-               iwe.u.qual.level = network->stats.rssi;
                if (ieee->perfect_rssi == ieee->worst_rssi)
                        iwe.u.qual.qual = 100;
                else
@@ -179,6 +177,13 @@ static inline char *ipw2100_translate_sc
                iwe.u.qual.noise = network->stats.noise;
        }
 
+       if (!(network->stats.mask & IEEE80211_STATMASK_SIGNAL)) {
+               iwe.u.qual.updated |= IW_QUAL_LEVEL_INVALID;
+               iwe.u.qual.level = 0;
+       } else {
+               iwe.u.qual.level = network->stats.signal;
+       }
+
        start = iwe_stream_add_event(start, stop, &iwe, IW_EV_QUAL_LEN);
 
        iwe.cmd = IWEVCUSTOM;
@@ -229,6 +234,28 @@ static inline char *ipw2100_translate_sc
        if (iwe.u.data.length)
                start = iwe_stream_add_point(start, stop, &iwe, custom);
 
+       /* Add spectrum management information */
+       iwe.cmd = -1;
+       p = custom;
+       p += snprintf(p, MAX_CUSTOM_LEN - (p - custom), " Channel flags: ");
+
+       if (ieee80211_get_channel_flags(ieee, network->channel) &
+           IEEE80211_CH_INVALID) {
+               iwe.cmd = IWEVCUSTOM;
+               p += snprintf(p, MAX_CUSTOM_LEN - (p - custom), "INVALID ");
+       }
+
+       if (ieee80211_get_channel_flags(ieee, network->channel) &
+           IEEE80211_CH_RADAR_DETECT) {
+               iwe.cmd = IWEVCUSTOM;
+               p += snprintf(p, MAX_CUSTOM_LEN - (p - custom), "DFS ");
+       }
+
+       if (iwe.cmd == IWEVCUSTOM) {
+               iwe.u.data.length = p - custom;
+               start = iwe_stream_add_point(start, stop, &iwe, custom);
+       }
+
        return start;
 }
 
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to