[email protected]
[Top] [All Lists]

PERFORCE change 114055 for review

Subject: PERFORCE change 114055 for review
From: Sepherosa Ziehau
Date: Mon, 5 Feb 2007 15:30:03 GMT
http://perforce.freebsd.org/chv.cgi?CH=114055

Change 114055 by [email protected]_zealot:sam_wifi on 2007/02/05 15:29:03

        For ral(4) rt2560 part:
        - Convert RSSI to receive signal strength(dbm)
        - Add noise floor
        
        zealot:ral# ifconfig ral0 up scan
        SSID            BSSID              CHAN RATE   S:N     INT CAPS
        sephewifi-test  00:16:b6:2b:cd:38    1   54M -52:-95  100 ES  
        sephewifi       00:90:4c:7e:00:64   13   54M -55:-95  100 EP   WPA
        
        zealot:ral# ifconfig ath0 up scan
        SSID            BSSID              CHAN RATE   S:N     INT CAPS
        sephewifi-test  00:16:b6:2b:cd:38    1   54M -55:-96  100 ES  
        sephewifi       00:90:4c:7e:00:64   13   54M -55:-91  100 EP   WPA
        
        Obtained-from: Dragonfly

Affected files ...

.. //depot/projects/wifi/sys/dev/ral/rt2560.c#13 edit
.. //depot/projects/wifi/sys/dev/ral/rt2560reg.h#2 edit
.. //depot/projects/wifi/sys/dev/ral/rt2560var.h#7 edit

Differences ...

==== //depot/projects/wifi/sys/dev/ral/rt2560.c#13 (text) ====

@@ -65,6 +65,9 @@
 #include <dev/ral/rt2560reg.h>
 #include <dev/ral/rt2560var.h>
 
+#define RT2560_RSSI(sc, rssi)                                  \
+       ((rssi) > (RT2560_NOISE_FLOOR + (sc)->rssi_corr) ?      \
+        ((rssi) - RT2560_NOISE_FLOOR - (sc)->rssi_corr) : 0)
 
 #ifdef RAL_DEBUG
 #define DPRINTF(x)     do { if (ral_debug > 0) printf x; } while (0)
@@ -1166,7 +1169,7 @@
                        tap->wr_chan_freq = htole16(ic->ic_curchan->ic_freq);
                        tap->wr_chan_flags = htole16(ic->ic_curchan->ic_flags);
                        tap->wr_antenna = sc->rx_ant;
-                       tap->wr_antsignal = desc->rssi;
+                       tap->wr_antsignal = RT2560_RSSI(sc, desc->rssi);
 
                        bpf_mtap2(sc->sc_drvbpf, tap, sc->sc_rxtap_len, m);
                }
@@ -1178,11 +1181,13 @@
                    (struct ieee80211_frame_min *)wh);
 
                /* send the frame to the 802.11 layer */
-               ieee80211_input(ic, m, ni, desc->rssi, 0, 0);
+               ieee80211_input(ic, m, ni, RT2560_RSSI(sc, desc->rssi),
+                               RT2560_NOISE_FLOOR, 0);
 
                /* give rssi to the rate adatation algorithm */
                rn = (struct rt2560_node *)ni;
-               ral_rssadapt_input(ic, ni, &rn->rssadapt, desc->rssi);
+               ral_rssadapt_input(ic, ni, &rn->rssadapt,
+                                  RT2560_RSSI(sc, desc->rssi));
 
                /* node is no longer needed */
                ieee80211_free_node(ni);
@@ -2540,6 +2545,14 @@
                sc->txpow[i * 2] = val >> 8;
                sc->txpow[i * 2 + 1] = val & 0xff;
        }
+
+       val = rt2560_eeprom_read(sc, RT2560_EEPROM_CALIBRATE);
+       if ((val & 0xff00) == 0xff00)
+               sc->rssi_corr = RT2560_DEFAULT_RSSI_CORR;
+       else
+               sc->rssi_corr = val >> 8;
+       DPRINTF(("rssi correction %d, calibrate 0x%02x\n",
+                sc->rssi_corr, val));
 }
 
 

==== //depot/projects/wifi/sys/dev/ral/rt2560reg.h#2 (text) ====

@@ -17,6 +17,9 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
+#define RT2560_DEFAULT_RSSI_CORR       0x79
+#define RT2560_NOISE_FLOOR             -95
+
 #define RT2560_TX_RING_COUNT           48
 #define RT2560_ATIM_RING_COUNT         4
 #define RT2560_PRIO_RING_COUNT         16
@@ -296,6 +299,7 @@
 #define RT2560_EEPROM_CONFIG0  16
 #define RT2560_EEPROM_BBP_BASE 19
 #define RT2560_EEPROM_TXPOWER  35
+#define RT2560_EEPROM_CALIBRATE        62
 
 /*
  * control and status registers access macros

==== //depot/projects/wifi/sys/dev/ral/rt2560var.h#7 (text) ====

@@ -120,6 +120,7 @@
        uint32_t                asic_rev;
        uint32_t                eeprom_rev;
        uint8_t                 rf_rev;
+       uint8_t                 rssi_corr;
 
        struct rt2560_tx_ring   txq;
        struct rt2560_tx_ring   prioq;
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/p4-projects
To unsubscribe, send any mail to "[email protected]"

<Prev in Thread] Current Thread [Next in Thread>
  • PERFORCE change 114055 for review, Sepherosa Ziehau <=