summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>2008-07-31 18:59:25 +0000
committernbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>2008-07-31 18:59:25 +0000
commit8d1ca8799daa1e18674a87a4ad92d74e33884a35 (patch)
tree20ffc4211770a7c8d15201b477d3c1308cce4fca
parent9b149826da6dbcd2c6f140bc7674c1f046507d38 (diff)
madwifi: add some beacon setup/update related fixes (based on Bruno Randolf's patchset)
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@12049 3c298f89-4303-0410-b956-a3cf2f4a3e73
-rw-r--r--package/madwifi/patches/374-nbtt_fix.patch22
-rw-r--r--package/madwifi/patches/375-atim_tsf_update.patch59
-rw-r--r--package/madwifi/patches/376-beacon_update.patch26
-rw-r--r--package/madwifi/patches/406-monitor_r3711.patch4
-rw-r--r--package/madwifi/patches/408-changeset_r3337.patch2
5 files changed, 110 insertions, 3 deletions
diff --git a/package/madwifi/patches/374-nbtt_fix.patch b/package/madwifi/patches/374-nbtt_fix.patch
new file mode 100644
index 000000000..3b00f644f
--- /dev/null
+++ b/package/madwifi/patches/374-nbtt_fix.patch
@@ -0,0 +1,22 @@
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -5476,6 +5476,9 @@
+ ath_beacon_dturbo_config(vap, intval &
+ ~(HAL_BEACON_RESET_TSF | HAL_BEACON_ENA));
+ #endif
++ if ((nexttbtt & HAL_BEACON_PERIOD) - (ath_hal_gettsf32(ah) >> 10)
++ <= ath_hal_sw_beacon_response_time)
++ nexttbtt += intval;
+ sc->sc_nexttbtt = nexttbtt;
+ ath_hal_beaconinit(ah, nexttbtt, intval);
+ if (intval & HAL_BEACON_RESET_TSF) {
+--- a/ath_hal/ah_os.c
++++ b/ath_hal/ah_os.c
+@@ -71,6 +71,7 @@
+ int ath_hal_dma_beacon_response_time = 2; /* in TUs */
+ int ath_hal_sw_beacon_response_time = 10; /* in TUs */
+ int ath_hal_additional_swba_backoff = 0; /* in TUs */
++EXPORT_SYMBOL(ath_hal_sw_beacon_response_time);
+
+ struct ath_hal *
+ _ath_hal_attach(u_int16_t devid, HAL_SOFTC sc,
diff --git a/package/madwifi/patches/375-atim_tsf_update.patch b/package/madwifi/patches/375-atim_tsf_update.patch
new file mode 100644
index 000000000..bbe380ed4
--- /dev/null
+++ b/package/madwifi/patches/375-atim_tsf_update.patch
@@ -0,0 +1,59 @@
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -2785,6 +2785,44 @@
+ return 1;
+ }
+
++/* Fix up the ATIM window after TSF resync */
++static int
++ath_hw_check_atim(struct ath_softc *sc, int window)
++{
++#define AR5K_TIMER0_5210 0x802c /* Next beacon time register */
++#define AR5K_TIMER0_5211 0x8028
++#define AR5K_TIMER3_5210 0x8038 /* End of ATIM window time register */
++#define AR5K_TIMER3_5211 0x8034
++ struct ath_hal *ah = sc->sc_ah;
++ unsigned int nbtt, atim;
++ int dev = ar_device(sc->devid);
++
++ switch(dev) {
++ case 5210:
++ nbtt = OS_REG_READ(ah, AR5K_TIMER0_5210);
++ atim = OS_REG_READ(ah, AR5K_TIMER3_5210);
++ if (atim - nbtt != window) {
++ OS_REG_WRITE(ah, AR5K_TIMER3_5210, nbtt + window );
++ return atim - nbtt;
++ }
++ break;
++ case 5211:
++ case 5212:
++ nbtt = OS_REG_READ(ah, AR5K_TIMER0_5211);
++ atim = OS_REG_READ(ah, AR5K_TIMER3_5211);
++ if (atim - nbtt != window) {
++ OS_REG_WRITE(ah, AR5K_TIMER3_5211, nbtt + window );
++ return atim - nbtt;
++ }
++ break;
++ /* NB: 5416+ doesn't do ATIM in hw */
++ default:
++ break;
++ }
++ return 0;
++}
++
++
+ /*
+ * Reset the hardware w/o losing operational state. This is
+ * basically a more efficient way of doing ath_stop, ath_init,
+@@ -6391,6 +6429,11 @@
+ DPRINTF(sc, ATH_DEBUG_BEACON,
+ "Updated beacon timers\n");
+ }
++ if ((sc->sc_opmode == IEEE80211_M_IBSS) &&
++ IEEE80211_ADDR_EQ(ni->ni_bssid, vap->iv_bss->ni_bssid) &&
++ ath_hw_check_atim(sc, 1)) {
++ DPRINTF(sc, ATH_DEBUG_ANY, "Fixed ATIM window after beacon recv\n");
++ }
+ /* NB: Fall Through */
+ case IEEE80211_FC0_SUBTYPE_PROBE_RESP:
+ if (vap->iv_opmode == IEEE80211_M_IBSS &&
diff --git a/package/madwifi/patches/376-beacon_update.patch b/package/madwifi/patches/376-beacon_update.patch
new file mode 100644
index 000000000..2b4f34b58
--- /dev/null
+++ b/package/madwifi/patches/376-beacon_update.patch
@@ -0,0 +1,26 @@
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -5495,6 +5495,8 @@
+ ath_hal_intrset(ah, sc->sc_imask);
+ ath_set_beacon_cal(sc, 0);
+ } else {
++ unsigned long flags;
++
+ ath_hal_intrset(ah, 0);
+ if (reset_tsf)
+ intval |= HAL_BEACON_RESET_TSF;
+@@ -5514,11 +5516,14 @@
+ ath_beacon_dturbo_config(vap, intval &
+ ~(HAL_BEACON_RESET_TSF | HAL_BEACON_ENA));
+ #endif
++ local_irq_save(flags);
+ if ((nexttbtt & HAL_BEACON_PERIOD) - (ath_hal_gettsf32(ah) >> 10)
+ <= ath_hal_sw_beacon_response_time)
+ nexttbtt += intval;
+ sc->sc_nexttbtt = nexttbtt;
+ ath_hal_beaconinit(ah, nexttbtt, intval);
++ local_irq_restore(flags);
++
+ if (intval & HAL_BEACON_RESET_TSF) {
+ sc->sc_last_tsf = 0;
+ }
diff --git a/package/madwifi/patches/406-monitor_r3711.patch b/package/madwifi/patches/406-monitor_r3711.patch
index d44a556fa..9f6ef59fc 100644
--- a/package/madwifi/patches/406-monitor_r3711.patch
+++ b/package/madwifi/patches/406-monitor_r3711.patch
@@ -1,6 +1,6 @@
--- a/ath/if_ath.c
+++ b/ath/if_ath.c
-@@ -6325,7 +6325,7 @@
+@@ -6371,7 +6371,7 @@
/* Never copy the SKB, as it is ours on the RX side, and this is the
* last process on the TX side and we only modify our own headers. */
@@ -9,7 +9,7 @@
if (tskb == NULL) {
DPRINTF(sc, ATH_DEBUG_ANY,
"Dropping; ath_skb_removepad failed!\n");
-@@ -6333,6 +6333,8 @@
+@@ -6379,6 +6379,8 @@
}
ieee80211_input_monitor(ic, tskb, bf, tx, tsf, sc);
diff --git a/package/madwifi/patches/408-changeset_r3337.patch b/package/madwifi/patches/408-changeset_r3337.patch
index de2eda273..13200ab4f 100644
--- a/package/madwifi/patches/408-changeset_r3337.patch
+++ b/package/madwifi/patches/408-changeset_r3337.patch
@@ -10,7 +10,7 @@
Please let us know if you think your name should be mentioned here!
--- a/ath/if_ath.c
+++ b/ath/if_ath.c
-@@ -2964,7 +2964,7 @@
+@@ -3002,7 +3002,7 @@
struct ath_softc *sc = dev->priv;
struct ath_hal *ah = sc->sc_ah;
struct ieee80211_phy_params *ph = (struct ieee80211_phy_params *)