madwifi: reduce the packet loss impact of forced background scans triggered by the...
[openwrt.git] / package / madwifi / patches-testing / 303-bssid_alloc.patch
1 --- a/ath/if_ath.c
2 +++ b/ath/if_ath.c
3 @@ -1347,11 +1347,12 @@
4                         TAILQ_FOREACH(v, &ic->ic_vaps, iv_next)
5                                 id_mask |= (1 << ATH_GET_VAP_ID(v->iv_myaddr));
6  
7 -                       for (id = 1; id < ath_maxvaps; id++) {
8 +                       for (id = 0; id < ath_maxvaps; id++) {
9                                 /* Get the first available slot. */
10                                 if ((id_mask & (1 << id)) == 0) {
11                                         ATH_SET_VAP_BSSID(vap->iv_myaddr, id);
12                                         ATH_SET_VAP_BSSID(vap->iv_bssid, id);
13 +                                       sc->sc_bclast = id;
14                                         break;
15                                 }
16                         }
17 @@ -1359,7 +1360,12 @@
18                         EPRINTF(sc, "Unique BSSID requested on HW that does"
19                                 "does not support the necessary features.");
20                 }
21 +       } else {
22 +               /* share the BSSID of the last created VAP */
23 +               ATH_SET_VAP_BSSID(vap->iv_myaddr, sc->sc_bclast);
24 +               ATH_SET_VAP_BSSID(vap->iv_bssid, sc->sc_bclast);
25         }
26 +
27         avp->av_bslot = -1;
28  #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15)
29         atomic_set(&avp->av_beacon_alloc, 0);
30 --- a/ath/if_athvar.h
31 +++ b/ath/if_athvar.h
32 @@ -802,7 +802,7 @@
33         } sc_updateslot;                        /* slot time update fsm */
34         int sc_slotupdate;                      /* slot to next advance fsm */
35         struct ieee80211vap **sc_bslot;         /* beacon xmit slots */
36 -       int sc_bnext;                           /* next slot for beacon xmit */
37 +       int sc_bclast;                          /* last used slot for beacon xmit */
38  
39         int sc_beacon_cal;                      /* use beacon timer for calibration */
40         long unsigned int sc_calinterval_sec;   /* current interval for calibration (in seconds) */