merge madwifi changes to 8.09
authorFelix Fietkau <nbd@openwrt.org>
Sat, 11 Oct 2008 02:02:52 +0000 (02:02 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Sat, 11 Oct 2008 02:02:52 +0000 (02:02 +0000)
SVN-Revision: 12951

package/madwifi/patches/372-queue_vif.patch
package/madwifi/patches/381-ibss_modes.patch [new file with mode: 0644]
package/madwifi/patches/382-relax_bintval.patch [new file with mode: 0644]
package/madwifi/patches/383-ibss_hostap.patch [new file with mode: 0644]

index 6fa86b98847c3bffd973794fbb65df5857c689a7..83576c8e6ce06b097902af63befbdae9b73af014 100644 (file)
@@ -18,7 +18,7 @@
 +                      if (ret == NETDEV_TX_BUSY)
 +                              ieee80211_dev_kfree_skb(&skb1);
 +
-+                      if (ret != NETDEV_TX_OK) {
++                      else if (ret != NETDEV_TX_OK) {
                                /* If queue dropped the packet because device was
                                 * too busy */
                                vap->iv_devstats.tx_dropped++;
diff --git a/package/madwifi/patches/381-ibss_modes.patch b/package/madwifi/patches/381-ibss_modes.patch
new file mode 100644 (file)
index 0000000..1ce295e
--- /dev/null
@@ -0,0 +1,23 @@
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -1260,7 +1260,10 @@
+       case IEEE80211_M_IBSS:
+               if ((sc->sc_nvaps != 0) && (ic->ic_opmode == IEEE80211_M_STA))
+                       return NULL;
+-              ic_opmode = opmode;
++              if (ic->ic_opmode == IEEE80211_M_HOSTAP)
++                      ic_opmode = ic->ic_opmode;
++              else
++                      ic_opmode = opmode;
+               break;
+       case IEEE80211_M_AHDEMO:
+       case IEEE80211_M_MONITOR:
+@@ -1455,7 +1458,7 @@
+        * frames.  Other modes carry over directly to the HAL.
+        */
+       if (ic->ic_opmode == IEEE80211_M_AHDEMO)
+-              sc->sc_opmode = HAL_M_IBSS;
++              sc->sc_opmode = HAL_M_HOSTAP;
+       else
+               sc->sc_opmode = (HAL_OPMODE) ic->ic_opmode;     /* NB: compatible */
diff --git a/package/madwifi/patches/382-relax_bintval.patch b/package/madwifi/patches/382-relax_bintval.patch
new file mode 100644 (file)
index 0000000..0901949
--- /dev/null
@@ -0,0 +1,13 @@
+--- a/net80211/ieee80211_var.h
++++ b/net80211/ieee80211_var.h
+@@ -61,8 +61,8 @@
+ #define       IEEE80211_DTIM_MIN              1       /* min DTIM period */
+ #define       IEEE80211_DTIM_DEFAULT          1       /* default DTIM period */
+-#define       IEEE80211_BINTVAL_MAX           1000    /* max beacon interval (TUs) */
+-#define       IEEE80211_BINTVAL_MIN           25      /* min beacon interval (TUs) */
++#define       IEEE80211_BINTVAL_MAX           5000    /* max beacon interval (TUs) */
++#define       IEEE80211_BINTVAL_MIN           10      /* min beacon interval (TUs) */
+ #define       IEEE80211_BINTVAL_DEFAULT       100     /* default beacon interval (TUs) */
+ #define IEEE80211_BINTVAL_VALID(_bi) \
+       ((IEEE80211_BINTVAL_MIN <= (_bi)) && \
diff --git a/package/madwifi/patches/383-ibss_hostap.patch b/package/madwifi/patches/383-ibss_hostap.patch
new file mode 100644 (file)
index 0000000..b65c4af
--- /dev/null
@@ -0,0 +1,105 @@
+--- a/ath/if_ath.c
++++ b/ath/if_ath.c
+@@ -1452,6 +1452,23 @@
+               sc->sc_nstavaps++;
+       else if (opmode == IEEE80211_M_MONITOR)
+               sc->sc_nmonvaps++;
++
++
++      /* Driving the HAL in IBSS sometimes adapts the TSF and other timing registers
++       * from received beacons/probes. If that happens, expected TX interrupts may
++       * not occur until next reset. Which triggers the "lost beacon" tasklet.
++       * Resulting effectively in not sending packets for minutes. Because that only
++       * happens in large mesh networks, this mode needs to be activated by a kernel
++       * module parameter: hostap_for_ibss=1. Note that using this mode has side
++       * effects. Such as not supressing beacons/probe answers randomly when
++       * receiving other node beacons. It's recommended to lower the beacon interval
++       * then. When using an IBSS-VAP together with an HOSTAP-VAP, you may also need
++       * to re-trigger IBSS beacon generation after creating the HOSTAP-VAP by
++       * issueing "iwpriv athX bintval 1000".
++       */
++      if ((flags & IEEE80211_NO_STABEACONS) && (ic->ic_opmode == IEEE80211_M_IBSS))
++              sc->sc_opmode = HAL_M_HOSTAP;
++      else
+       /*
+        * Adhoc demo mode is a pseudo mode; to the HAL it's
+        * just IBSS mode and the driver doesn't use management
+@@ -4279,7 +4296,8 @@
+       if (ic->ic_opmode != IEEE80211_M_HOSTAP && (dev->flags & IFF_PROMISC))
+               rfilt |= HAL_RX_FILTER_PROM;
+       if (ic->ic_opmode == IEEE80211_M_STA ||
+-          sc->sc_opmode == HAL_M_IBSS ||      /* NB: AHDEMO too */
++          ic->ic_opmode == IEEE80211_M_IBSS ||
++          ic->ic_opmode == IEEE80211_M_AHDEMO ||
+           (sc->sc_nostabeacons) || sc->sc_scanning ||
+               (ic->ic_opmode == IEEE80211_M_HOSTAP))
+               rfilt |= HAL_RX_FILTER_BEACON;
+@@ -6433,6 +6451,33 @@
+ }
+ /*
++ * Advances (forwards/adds) a microsecond value to current chip's TSF registers
++ */
++
++/* from ath_info.c */
++#define AR5K_TSF_L32_5210             0x806c  /* TSF (lower 32 bits) */
++#define AR5K_TSF_L32_5211             0x804c
++#define AR5K_TSF_L32                  (ar_device(ah->ah_sc->devid) == 5210 ? \
++                                      AR5K_TSF_L32_5210 : AR5K_TSF_L32_5211)
++
++#define AR5K_TSF_U32_5210             0x8070
++#define AR5K_TSF_U32_5211             0x8050
++#define AR5K_TSF_U32                  (ar_device(ah->ah_sc->devid) == 5210 ? \
++                                      AR5K_TSF_U32_5210 : AR5K_TSF_U32_5211)
++
++static inline void ath_hal_settsf64(struct ath_hal *ah, u_int64_t tsf_adv)
++{
++      ATH_HAL_LOCK_IRQ(ah->ah_sc);
++      ath_hal_set_function(__func__);
++      tsf_adv += ah->ah_getTsf64(ah);
++      OS_REG_WRITE(ah, AR5K_TSF_L32, 0ll);
++      OS_REG_WRITE(ah, AR5K_TSF_U32, (tsf_adv >> 32) & 0xffffffffll);
++      OS_REG_WRITE(ah, AR5K_TSF_L32, (tsf_adv >> 00) & 0xffffffffll);
++      ath_hal_set_function(NULL);
++      ATH_HAL_UNLOCK_IRQ(ah->ah_sc);
++}
++
++/*
+  * Intercept management frames to collect beacon RSSI data and to do
+  * ibss merges. This function is called for all management frames,
+  * including those belonging to other BSS.
+@@ -6485,10 +6530,19 @@
+                       DPRINTF(sc, ATH_DEBUG_BEACON, 
+                               "Updated beacon timers\n");
+               }
+-              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");
++              if ((vap->iv_opmode == IEEE80211_M_IBSS) &&
++                              (sc->sc_opmode == HAL_M_HOSTAP) &&
++                              IEEE80211_ADDR_EQ(ni->ni_bssid, vap->iv_bss->ni_bssid)) {
++                      /* In this mode, we drive the HAL in HOSTAP mode. Hence
++                       * we do the IBSS merging in software. Also do not merge
++                       * if the difference it too small. Otherwise we are playing
++                       * tsf-pingpong with other vendors drivers */
++                      beacon_tsf = le64_to_cpu(ni->ni_tstamp.tsf);
++                      if (beacon_tsf > rtsf + 0xffff) {
++                              ath_hal_settsf64(sc->sc_ah, beacon_tsf - rtsf);
++                              ieee80211_ibss_merge(ni);
++                      }
++                      break;
+               }
+               /* NB: Fall Through */
+       case IEEE80211_FC0_SUBTYPE_PROBE_RESP:
+@@ -6561,6 +6615,10 @@
+ #endif
+                       if (do_merge)
+                               ieee80211_ibss_merge(ni);
++
++                      if ((sc->sc_opmode == HAL_M_IBSS) &&
++                                      ath_hw_check_atim(sc, 1, vap->iv_bss->ni_intval))
++                              DPRINTF(sc, ATH_DEBUG_ANY, "Fixed ATIM window after beacon recv\n");
+               }
+               break;
+       }