Skip to content

Instantly share code, notes, and snippets.

@senseisimple
Last active December 30, 2020 04:08
Show Gist options
  • Save senseisimple/fe91413d6bb5d5e0994222ac59bc90c4 to your computer and use it in GitHub Desktop.
Save senseisimple/fe91413d6bb5d5e0994222ac59bc90c4 to your computer and use it in GitHub Desktop.
Signal Quality as a Percent for IPW2200 - Archive

Signal Quality as a Percent for IPW2200

https://www.ces.clemson.edu/linux/signal_quality.shtml (dead link)

Bill Moss February 26, 2006

Introduction

The purpose of this note is to examine a new model for ipw2200 wireless signal quality and a conversion from signal quality to signal strength bars.

The quadratic model of signal quality that currently appears in ipw2200.c and ieee80211_wx.c is one I proposed some time ago. This model is based on a least squares fit of four data points collected using the Windows XP driver. In this note, I propose to revert to a piecewise linear model of signal quality that is the same as the model used in ipw2200-1.0.0 except for the low signal and high signal set points.

Users typically encouner wireless statistics when using the wireless tools. For example,

iwconfig eth1

IEEE 802.11b  ESSID:"mosswap"
Mode:Managed  Frequency:2.437 GHz  Access Point: 00:01:24:F0:40:5A
Bit Rate=11 Mb/s   Tx-Power=20 dBm
Retry limit:7   RTS thr:off   Fragment thr:off
Encryption key:****-****-****-****-****-****-**   Security mode:open
Power Management:off
Link Quality=69/100  Signal level=-55 dBm  Noise level=-82 dBm
Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
Tx excessive retries:0  Invalid misc:0   Missed beacon:1

and

iwlist eth1 scan

Cell 01 - Address: 00:01:24:F0:40:5A
          ESSID:"mosswap"
          Protocol:IEEE 802.11b
          Mode:Master
          Channel:6
          Encryption key:on
          Bit Rate:11 Mb/s
          Extra: Rates (Mb/s): 1 2 5.5 11
          Quality=74/100  Signal level=-53 dBm
          Extra: Last beacon: 124ms ago

New Signal Quality as a Percent Model

The ipw2200 driver produces an average for signal level and noise level in dBm. It converts the associated access point average signal level into a signal quality (0-100%) and also provides a link quality (0-100%) which is the minimum of five qualities: signal quality, beacon quality, transmitted quality, received quality, and rate quality. The iwconfig utility reports link quality along with average signal level and average noise level for an associated access point.

For each access point found in a scan, the ipw2200 driver produces a signal level in dBm. The ipw2200 driver provides a signal quality for each scanned access points using the same model that is used for associated access points.

The signal quality model we propose can be applied under the following assumptions. We assume that the wireless driver provides a value for signal level in dBm. We assume that the wireless driver defines a constant which represents the average noise level in dBm.

The signal-to-noise ratio, snr, is defined by

snr (dB) = signal_level (dBm) - avg_noise_level (dBm) We propose the following model for signal quality as a percent.

  signal_quality = 0                    if snr < 0
  signal_quality = 5*snr/2              if 0 <= snr < 40
                 = 100                  if snr >= 40

Figure 1 shows a plot of this piecewise linear model (red), together with the quadratic model (green) that is currently used in ipw2200 and ieee80211.

Figure 1: Models for Signal Quality 001yyzblgy6Xg7QmXrhb7

The weakest usable signal typically corresponds to a signal-to-noise ratio in the interval [10, 15] dB. This model associates 10 dB with 25 percent. Zero signal-to-noise ratio is converted to zero percent signal quality, meaning that the signal cannot be distinguished from the noise. There is no functional difference between two signals corresponding to signal-to-noise ratios above 40 dB. This model assigns all such signals the signal quality of 100 percent.

Signal-to-Noise Ratio Bands

In the article Jim Geier proposes the following signal-to-noise ratio bands for use in signal strength meters that use bars.

  40 <= snr       4 bars, always associated, lightening fast
  25 <= snr < 40  3 bars, always associated, very fast
  15 <= snr < 25  2 bars, always associated, usually fast
   5 <= snr < 15  1 bar, mostly associated, mostly slow
   0 <= snr <  5  0 bars, no usable signal, not associated

Here are the corresponding percentage bands for the new model of signal quality.

  40 <= snr       4 bars, 100  = signal quality
  25 <= snr < 40  3 bars,  63 <= signal quality < 100
  15 <= snr < 25  2 bars,  38 <= signal quality < 63
   5 <= snr < 15  1 bar,   13 <= signal quality < 38
   0 <= snr <  5  0 bars,   0 <= signal quality < 13

In practice, I don't find much difference between the 4 bar case and the 3 bar case. All the action seems to fall into the 1 and 2 bar cases. This is typically where you see the driver's adaptive bitrate selection algorithm changing the bitrate. In the 1 bar case, roaming may be initiated.

Traditional Signal Quality as a Percent Model

There is variation across wireless drivers in the way signal and noise levels are represented. My preference is for rssi to be represented as a nonnegative integer and for signal and noise levels to be represented in dBm. The ipw2200 driver does not use this representation. Instead, in the ipw2200 driver, rssi represents signal level in dBm and signal level is not reported. Here I will denote nonnegative integer rssi by rssi_raw to avoid confusion. For ipw2200, typical values are

         0 <= rssi_raw     <= RSSI_RAW_MAX = 92
  -85 dBm <= signal_level <= -20 dBm
  -85 dBm = average_noise_level

The constant #define IPW_RSSI_TO_DBM 112 which is currently found in ipw2200.h is used to convert rssi_raw values into dBm values or dBm values into rssi_raw values.

  signal_level = rssi_raw - IPW_RSSI_TO_DBM
  rssi_raw = signal_level + IPW_RSSI_TO_DBM

The tradition model for signal quality is to convert rssi_raw to a percent with RSSI_RAW_MAX corresponding to 100%.

signal_quality = 100*rssi_raw/RSSI_RAW_MAX

How do the new and traditional models for signal quality compare? Here are plots assuming that the average noise level is -85 dBm. Figure 2 shows a plot of the new model (blue), the quadratic model (red) that is currently used in ipw2200 and ieee80211, and the traditional model (green).

Figure 2: Models for Signal Quality Assuming a Noise Level of -85 dBm

001yyzblgy6Xg7RieFUbe

https://github.com/torvalds/linux/blob/9ff9b0d392ea08090cd1780fb196f36dbb586529/drivers/net/wireless/intel/ipw2x00/ipw2200.c#L4113 https://github.com/torvalds/linux/blob/9ff9b0d392ea08090cd1780fb196f36dbb586529/drivers/net/wireless/intel/ipw2x00/ipw2200.c#L11681 https://github.com/torvalds/linux/blob/9ff9b0d392ea08090cd1780fb196f36dbb586529/drivers/net/wireless/intel/ipw2x00/ipw2200.c#L4321

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment