package/madwifi: refresh madwifi patches
[openwrt/openwrt.git] / package / madwifi / patches / 375-atim_tsf_update.patch
index 3800b90c1bbd60fc809faae6beb2e89f940e4b8a..d1313aa5645c3bbbf95701c96ee8ca1e9b42adc8 100644 (file)
@@ -1,6 +1,6 @@
 --- a/ath/if_ath.c
 +++ b/ath/if_ath.c
-@@ -161,6 +161,7 @@
+@@ -161,6 +161,7 @@ static void ath_beacon_send(struct ath_s
  static void ath_beacon_return(struct ath_softc *, struct ath_buf *);
  static void ath_beacon_free(struct ath_softc *);
  static void ath_beacon_config(struct ath_softc *, struct ieee80211vap *);
@@ -8,7 +8,7 @@
  static int ath_desc_alloc(struct ath_softc *);
  static void ath_desc_free(struct ath_softc *);
  static void ath_desc_swap(struct ath_desc *);
-@@ -2783,6 +2784,72 @@
+@@ -2793,6 +2794,72 @@ ath_set_ack_bitrate(struct ath_softc *sc
        return 1;
  }
  
@@ -37,7 +37,7 @@
 +      struct ath_hal *ah = sc->sc_ah;
 +      int dev = sc->sc_ah->ah_macType;
 +      unsigned int nbtt, atim;
-+      bool is_5210 = false;
++      int is_5210 = 0;
 +
 +      /*
 +       * check if the ATIM window is still correct:
@@ -50,7 +50,7 @@
 +      case 5210:
 +              nbtt = OS_REG_READ(ah, AR5K_TIMER0_5210);
 +              atim = OS_REG_READ(ah, AR5K_TIMER3_5210);
-+              is_5210 = true;
++              is_5210 = 1;
 +              break;
 +      case 5211:
 +      case 5212:
@@ -81,7 +81,7 @@
  /*
   * Reset the hardware w/o losing operational state.  This is
   * basically a more efficient way of doing ath_stop, ath_init,
-@@ -5282,6 +5349,7 @@
+@@ -5294,6 +5361,7 @@ ath_beacon_config(struct ath_softc *sc,
        u_int64_t tsf, hw_tsf;
        u_int32_t tsftu, hw_tsftu;
        u_int32_t intval, nexttbtt = 0;
@@ -89,7 +89,7 @@
        int reset_tsf = 0;
  
        if (vap == NULL)
-@@ -5289,6 +5357,9 @@
+@@ -5301,6 +5369,9 @@ ath_beacon_config(struct ath_softc *sc,
  
        ni = vap->iv_bss;
  
@@ -99,7 +99,7 @@
        hw_tsf = ath_hal_gettsf64(ah);
        tsf = le64_to_cpu(ni->ni_tstamp.tsf);
        hw_tsftu = hw_tsf >> 10;
-@@ -5478,15 +5549,27 @@
+@@ -5490,15 +5561,27 @@ ath_beacon_config(struct ath_softc *sc,
                                <= ath_hal_sw_beacon_response_time)
                        nexttbtt += intval;
                sc->sc_nexttbtt = nexttbtt;
                sc->sc_bmisscount = 0;
                ath_hal_intrset(ah, sc->sc_imask);
 +
-+              if (ath_hw_check_atim(sc, 1, intval & HAL_BEACON_PERIOD)) {
++              if ((sc->sc_opmode == HAL_M_IBSS) && ath_hw_check_atim(sc, 1, intval & HAL_BEACON_PERIOD)) {
 +                      DPRINTF(sc, ATH_DEBUG_BEACON,
 +                              "fixed atim window after beacon init\n");
 +              }
        /* We print all debug messages here, in order to preserve the
         * time critical aspect of this function */
        DPRINTF(sc, ATH_DEBUG_BEACON,
-@@ -6389,6 +6472,11 @@
+@@ -6401,6 +6484,11 @@ ath_recv_mgmt(struct ieee80211vap * vap,
                        DPRINTF(sc, ATH_DEBUG_BEACON, 
                                "Updated beacon timers\n");
                }
-+              if ((sc->sc_opmode == IEEE80211_M_IBSS) &&
++              if ((sc->sc_opmode == HAL_M_IBSS) &&
 +                              IEEE80211_ADDR_EQ(ni->ni_bssid, vap->iv_bss->ni_bssid) &&
 +                              ath_hw_check_atim(sc, 1, vap->iv_bss->ni_intval)) {
 +                      DPRINTF(sc, ATH_DEBUG_ANY, "Fixed ATIM window after beacon recv\n");