fix a small race condition in the madwifi queue handling
[openwrt.git] / package / madwifi / patches / 315-power_drop_PR1695.patch
1 The attached patch fixes the problem of very weak packets being send out
2 after periodic calibration
3
4 Signed-off-by: Karol Kowalik <karol.kowalik@cnri.dit.ie>
5 Index: madwifi-dfs-r3252/ath/if_ath.c
6 ===================================================================
7 --- madwifi-dfs-r3252.orig/ath/if_ath.c 2008-01-26 03:56:26.461576124 +0100
8 +++ madwifi-dfs-r3252/ath/if_ath.c      2008-01-26 03:58:50.628969172 +0100
9 @@ -8875,6 +8875,9 @@
10         struct ieee80211com *ic = &sc->sc_ic;
11         /* u_int32_t nchans; */
12         HAL_BOOL isIQdone = AH_FALSE;
13 +       u_int8_t papd_probe_power;
14 +       u_int8_t papd_probe_power_max = 63;
15 +       u_int16_t crnt_power_hdBm = sc->sc_curtxpow;
16  
17         sc->sc_stats.ast_per_cal++;
18         DPRINTF(sc, ATH_DEBUG_CALIBRATE, 
19 @@ -8912,6 +8915,20 @@
20                 sc->sc_stats.ast_per_calfail++;
21         }
22  
23 +       /*
24 +       * After calibration is done we need to update AR5K_PHY_PAPD_PROBE
25 +       * register with the probe_tx_power equal to current tx_power
26 +       * otherwise a power drop may be observed
27 +       */
28 +       crnt_power_hdBm = crnt_power_hdBm <= ic->ic_txpowlimit ? crnt_power_hdBm : ic->ic_txpowlimit;
29 +       papd_probe_power = papd_probe_power_max - (ic->ic_txpowlimit - crnt_power_hdBm);
30 +#define AR5K_PHY_PAPD_PROBE_TX_NEXT 0x00008000
31 +#define AR5K_PHY_PAPD_PROBE 0x9930
32 +       OS_REG_WRITE(ah, AR5K_PHY_PAPD_PROBE,
33 +       AR5K_PHY_PAPD_PROBE_TX_NEXT | (papd_probe_power << 9));
34 +#undef AR5K_PHY_PAPD_PROBE_TX_NEXT
35 +#undef AR5K_PHY_PAPD_PROBE
36 +
37         ath_hal_process_noisefloor(ah);
38         if (isIQdone == AH_TRUE) {
39                 /* Unless user has overridden calibration interval,