aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenk de Groot <henk.de.groot@hetnet.nl>2009-12-06 15:29:31 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2009-12-11 15:23:23 -0500
commite81589a70c9dbee888cce16e8bdfdc993299dc3f (patch)
treeac5f92d18a989242fe2bf4c0f832b543b466c41e
parentd0f2cc5aea14a4dfd342616faade05b75cb6c309 (diff)
Staging: wlags49_h2: fix up signal levels
Adjusts the signal levels reported by the wlags49_h2 and wlags49_h25 staging drivers. With the constants supplied by Agere the signal levels are always poor, even in close proximity to the AP. The signals are now measured with a real device. 100% for close proximity to the AP, 0% for the noice floor. Now the levels shown by the NetworkManager gauge make sense. Some magic numbers in the related code are replaced by the correct constants from the wireless extension interface (wireless.h). Also the flag IW_QUAL_DBM is now set, as specified in the wireless.h header file. Signed-off-by: Henk de Groot <pe1dnn@amsat.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/staging/wlags49_h2/wl_if.h31
-rw-r--r--drivers/staging/wlags49_h2/wl_wext.c19
2 files changed, 39 insertions, 11 deletions
diff --git a/drivers/staging/wlags49_h2/wl_if.h b/drivers/staging/wlags49_h2/wl_if.h
index 919431f12a85..ed2b4135a10e 100644
--- a/drivers/staging/wlags49_h2/wl_if.h
+++ b/drivers/staging/wlags49_h2/wl_if.h
@@ -80,13 +80,32 @@
80#define TX_TIMEOUT ((800 * HZ) / 1000) 80#define TX_TIMEOUT ((800 * HZ) / 1000)
81 81
82 82
83//#define HCF_MIN_COMM_QUALITY 0
84//#define HCF_MAX_COMM_QUALITY 92
85//#define HCF_MIN_SIGNAL_LEVEL 47
86//#define HCF_MAX_SIGNAL_LEVEL 138
87//#define HCF_MIN_NOISE_LEVEL 47
88//#define HCF_MAX_NOISE_LEVEL 138
89//#define HCF_0DBM_OFFSET 149
90
91// PE1DNN
92// Better data from the real world. Not scientific but empirical data gathered
93// from a Thomson Speedtouch 110 which is identified as:
94// PCMCIA Info: "Agere Systems" "Wireless PC Card Model 0110"
95// Manufacture ID: 0156,0003
96// Lowest measurment for noise floor seen is value 54
97// Highest signal strength in close proximity to the AP seen is value 118
98// Very good must be arround 100 (otherwise its never "full scale"
99// All other constants are derrived from these. This makes the signal gauge
100// work for me...
101#define HCF_MIN_SIGNAL_LEVEL 54
102#define HCF_MAX_SIGNAL_LEVEL 100
103#define HCF_MIN_NOISE_LEVEL HCF_MIN_SIGNAL_LEVEL
104#define HCF_MAX_NOISE_LEVEL HCF_MAX_SIGNAL_LEVEL
105#define HCF_0DBM_OFFSET (HCF_MAX_SIGNAL_LEVEL + 1)
83#define HCF_MIN_COMM_QUALITY 0 106#define HCF_MIN_COMM_QUALITY 0
84#define HCF_MAX_COMM_QUALITY 92 107#define HCF_MAX_COMM_QUALITY (HCF_MAX_SIGNAL_LEVEL - HCF_MIN_NOISE_LEVEL + 1)
85#define HCF_MIN_SIGNAL_LEVEL 47 108
86#define HCF_MAX_SIGNAL_LEVEL 138
87#define HCF_MIN_NOISE_LEVEL 47
88#define HCF_MAX_NOISE_LEVEL 138
89#define HCF_0DBM_OFFSET 149
90 109
91/* For encryption (WEP) */ 110/* For encryption (WEP) */
92#define MIN_KEY_SIZE 5 // 40 bits RC4 - WEP 111#define MIN_KEY_SIZE 5 // 40 bits RC4 - WEP
diff --git a/drivers/staging/wlags49_h2/wl_wext.c b/drivers/staging/wlags49_h2/wl_wext.c
index 5562e1de229b..4434e0065488 100644
--- a/drivers/staging/wlags49_h2/wl_wext.c
+++ b/drivers/staging/wlags49_h2/wl_wext.c
@@ -2770,7 +2770,7 @@ static int wireless_get_scan(struct net_device *dev, struct iw_request_info *inf
2770 iwe.u.qual.level = dbm(probe_resp->signal); 2770 iwe.u.qual.level = dbm(probe_resp->signal);
2771 iwe.u.qual.noise = dbm(probe_resp->silence); 2771 iwe.u.qual.noise = dbm(probe_resp->silence);
2772 iwe.u.qual.qual = iwe.u.qual.level - iwe.u.qual.noise; 2772 iwe.u.qual.qual = iwe.u.qual.level - iwe.u.qual.noise;
2773 iwe.u.qual.updated = lp->probe_results.scan_complete; 2773 iwe.u.qual.updated = lp->probe_results.scan_complete | IW_QUAL_DBM;
2774 iwe.len = IW_EV_QUAL_LEN; 2774 iwe.len = IW_EV_QUAL_LEN;
2775 2775
2776 buf = IWE_STREAM_ADD_EVENT(info, buf, buf_end, &iwe, IW_EV_QUAL_LEN); 2776 buf = IWE_STREAM_ADD_EVENT(info, buf, buf_end, &iwe, IW_EV_QUAL_LEN);
@@ -3317,7 +3317,6 @@ struct iw_statistics * wl_wireless_stats( struct net_device *dev )
3317 /* Get the current link quality information */ 3317 /* Get the current link quality information */
3318 lp->ltvRecord.len = 1 + ( sizeof( *pQual ) / sizeof( hcf_16 )); 3318 lp->ltvRecord.len = 1 + ( sizeof( *pQual ) / sizeof( hcf_16 ));
3319 lp->ltvRecord.typ = CFG_COMMS_QUALITY; 3319 lp->ltvRecord.typ = CFG_COMMS_QUALITY;
3320
3321 status = hcf_get_info( &( lp->hcfCtx ), (LTVP)&( lp->ltvRecord )); 3320 status = hcf_get_info( &( lp->hcfCtx ), (LTVP)&( lp->ltvRecord ));
3322 3321
3323 if( status == HCF_SUCCESS ) { 3322 if( status == HCF_SUCCESS ) {
@@ -3327,6 +3326,11 @@ struct iw_statistics * wl_wireless_stats( struct net_device *dev )
3327 pStats->qual.qual = (u_char) CNV_LITTLE_TO_INT( pQual->coms_qual ); 3326 pStats->qual.qual = (u_char) CNV_LITTLE_TO_INT( pQual->coms_qual );
3328 pStats->qual.level = (u_char) dbm( CNV_LITTLE_TO_INT( pQual->signal_lvl )); 3327 pStats->qual.level = (u_char) dbm( CNV_LITTLE_TO_INT( pQual->signal_lvl ));
3329 pStats->qual.noise = (u_char) dbm( CNV_LITTLE_TO_INT( pQual->noise_lvl )); 3328 pStats->qual.noise = (u_char) dbm( CNV_LITTLE_TO_INT( pQual->noise_lvl ));
3329
3330 pStats->qual.updated |= (IW_QUAL_QUAL_UPDATED |
3331 IW_QUAL_LEVEL_UPDATED |
3332 IW_QUAL_NOISE_UPDATED |
3333 IW_QUAL_DBM);
3330#else 3334#else
3331 pStats->qual.qual = percent( CNV_LITTLE_TO_INT( pQual->coms_qual ), 3335 pStats->qual.qual = percent( CNV_LITTLE_TO_INT( pQual->coms_qual ),
3332 HCF_MIN_COMM_QUALITY, 3336 HCF_MIN_COMM_QUALITY,
@@ -3339,9 +3343,11 @@ struct iw_statistics * wl_wireless_stats( struct net_device *dev )
3339 pStats->qual.noise = percent( CNV_LITTLE_TO_INT( pQual->noise_lvl ), 3343 pStats->qual.noise = percent( CNV_LITTLE_TO_INT( pQual->noise_lvl ),
3340 HCF_MIN_NOISE_LEVEL, 3344 HCF_MIN_NOISE_LEVEL,
3341 HCF_MAX_NOISE_LEVEL ); 3345 HCF_MAX_NOISE_LEVEL );
3342#endif /* USE_DBM */
3343 3346
3344 pStats->qual.updated |= 0x07; 3347 pStats->qual.updated |= (IW_QUAL_QUAL_UPDATED |
3348 IW_QUAL_LEVEL_UPDATED |
3349 IW_QUAL_NOISE_UPDATED);
3350#endif /* USE_DBM */
3345 } else { 3351 } else {
3346 memset( &( pStats->qual ), 0, sizeof( pStats->qual )); 3352 memset( &( pStats->qual ), 0, sizeof( pStats->qual ));
3347 } 3353 }
@@ -3478,7 +3484,10 @@ inline void wl_spy_gather( struct net_device *dev, u_char *mac )
3478 wstats.noise = (u_char) dbm(stats[0]); 3484 wstats.noise = (u_char) dbm(stats[0]);
3479 wstats.qual = wstats.level > wstats.noise ? wstats.level - wstats.noise : 0; 3485 wstats.qual = wstats.level > wstats.noise ? wstats.level - wstats.noise : 0;
3480 3486
3481 wstats.updated = 7; 3487 wstats.updated = (IW_QUAL_QUAL_UPDATED |
3488 IW_QUAL_LEVEL_UPDATED |
3489 IW_QUAL_NOISE_UPDATED |
3490 IW_QUAL_DBM);
3482 3491
3483 wireless_spy_update( dev, mac, &wstats ); 3492 wireless_spy_update( dev, mac, &wstats );
3484 } 3493 }