Jean a question or two for you below. OK I know I seemed happy with the original patch but after somethought I have some concerns. They are below. On Wed, Mar 26, 2008 at 8:30 AM, Bruno Randolf <bruno@xxxxxxxxxxxxx> wrote: > diff --git a/include/net/mac80211.h b/include/net/mac80211.h > @@ -697,6 +701,24 @@ enum ieee80211_tkip_key_type {> * @IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE:> * Hardware is not capable of receiving frames with short preamble on> * the 2.4 GHz band.> + *> + * @IEEE80211_HW_SIGNAL_UNSPEC:> + * Hardware can provide signal values but we don't know its units. To be> + * able to standardize between different devices we would like linear> + * values from 0-100. If possible please provide dB or dBm instead.> + *> + * @IEEE80211_HW_SIGNAL_DB:> + * Hardware gives signal values in dB, decibel difference from an> + * arbitrary, fixed reference. If possible please provide dBm instead.> + * Signal should given in either be in dBm or an unspecified value. Sincewe have "unspecified" not sure why we would have the "db" value. Canyou clarify what the difference between "unspecified" and "db" wouldbe? I don't think it makes sense to refer to signal with a "db" value,unless we want "singal" here to be able to mean SNR. > + * @IEEE80211_HW_SIGNAL_DBM:> + * Hardware gives signal values in dBm, decibel difference from> + * one milliwatt. This is the preferred method since it is standardized> + * between different devices.> + *> + * @IEEE80211_HW_NOISE_DBM:> + * Hardware can provide noise floor values in units dBm, decibel difference> + * from one milliwatt.> */> enum ieee80211_hw_flags {> IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE = 1<<0,> @@ -704,6 +726,10 @@ enum ieee80211_hw_flags {> IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING = 1<<2,> IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE = 1<<3,> IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE = 1<<4,> + IEEE80211_HW_SIGNAL_UNSPEC = 1<<5,> + IEEE80211_HW_SIGNAL_DB = 1<<6,> + IEEE80211_HW_SIGNAL_DBM = 1<<7,> + IEEE80211_HW_NOISE_DBM = 1<<8,> };>> /** <-- snip --> > diff --git a/net/mac80211/ieee80211_ioctl.c b/net/mac80211/ieee80211_ioctl.c> index 5af23d3..731ecd2 100644> --- a/net/mac80211/ieee80211_ioctl.c> +++ b/net/mac80211/ieee80211_ioctl.c> @@ -158,12 +158,20 @@ static int ieee80211_ioctl_giwrange(struct net_device *dev,> range->num_encoding_sizes = 2;> range->max_encoding_tokens = NUM_DEFAULT_KEYS;>> - range->max_qual.qual = local->hw.max_signal;> - range->max_qual.level = local->hw.max_rssi;> - range->max_qual.noise = local->hw.max_noise;> + range->max_qual.level = 0;> + if (local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC)> + range->max_qual.level = 100;> + else if (local->hw.flags & IEEE80211_HW_SIGNAL_DB)> + /* this is pretty arbitrary but the range of most drivers */> + range->max_qual.level = 64;> + else if (local->hw.flags & IEEE80211_HW_SIGNAL_DBM)> + range->max_qual.level = -110;> +> + range->max_qual.noise = -110;> + range->max_qual.qual = 100;> range->max_qual.updated = local->wstats_flags; I'm pretty perplexed by the original intention of Wireless Extensionsmax_qual. The documentation we have for this states: /* Quality of link & SNR stuff */ /* Quality range (link, level, noise) * If the quality is absolute, it will be in the range [0 ; max_qual], * if the quality is dBm, it will be in the range [max_qual ; 0]. * Don't forget that we use 8 bit arithmetics... */ struct iw_quality max_qual; /* Quality of the link */ max_qual is a struct though, iw_quality which is: /* * Quality of the link */struct iw_quality{ __u8 qual; /* link quality (%retries, SNR, %missed beacons or better...) */ __u8 level; /* signal level (dBm) */ __u8 noise; /* noise level (dBm) */ __u8 updated; /* Flags to know if updated */}; Jean, if range->max_qual.level is set to -110 does this mean signallevel can be set only from -110 up to 0 ? Is max_qual.level supposedto be the weakest signal possibly detected? Also, technically the noise should change depending on the channel bandwidth. IEEE-802.11 Channel bandwidth802.11a 20MHz802.11b 22MHz802.11g 20MHz (except when operating in 802.11b rates)802.11n 20MHz, 40MHz (except when operating in 802.11b rates) Applying the noise power formula: Pn = kTB where: k is Boltzmann's constant, 1.38*10^-23 J/KT is the temperature in Kelvin (room temperature, 290 K)B is the system bandwidth, in Hz Note: Watt = J/s For a 1 Hz bandwidth and at 290 K: Pn = 1.38 * 10-23 J/K * 290 K * 1 HzPn = 4.00200 * 10^-21 JHzPn = 4.00200 * 10^-21 J/sPn = 4.00200 * 10^-21 WPn = 4.00200 × 10-18 mW To convert to Bell, we do log (foo), to deciBell we do 10 * log (foo)so: (dBm == dBmW) Pn = 10 * log (4.00200 * 10^-18) dBmPn = ~-173.97722915699807401277 dBmPn = ~-174 dBm Now applying the same noise power formula, Pn = kTB, and knowingalready -174dBm applies for each 1 Hz we can compute the power noisefor each differing bandwidth for 802.11: Pn = -174 dBm / Hz + 10 * log (Bandwidth) mcgrof@monster:~$ calcC-style arbitrary precision calculator (version 2.12.1.13)Calc is open software. For license details type: help copyright[Type "exit" to exit, or "help" for help.] ; -174 + (10 * log(20 * 10^6)) ~-100.98970004336018804794; -174 + (10 * log(22 * 10^6)) ~-100.57577319177793764041; -174 + (10 * log(40 * 10^6)) ~-97.97940008672037609579 So I don't see why noise power should be -110, instead how abouthaving it set to -101 dBm for 20 MHz and 22 MHz channel bandwidth and-98 dBm for 40 MHz channel bandwidth when used? If we want to be evenmore exact we can take into consideration the noise from the amplifierchain for the hardware when known; for example for Atheros it seems tobe known to be 5dBm [1] so the noise for Atheros hardware shouldchange to -96 dBm. [1] http://madwifi.org/wiki/UserDocs/RSSI Luis��.n��������+%������w��{.n�����{���zW����ܨ}���Ơz�j:+v�����w����ޙ��&�)ߡ�a����z�ޗ���ݢj��w�f