[package] uhttpd:
[openwrt.git] / package / madwifi / patches / 383-ibss_hostap.patch
1 --- a/ath/if_ath.c
2 +++ b/ath/if_ath.c
3 @@ -1452,6 +1452,23 @@ ath_vap_create(struct ieee80211com *ic,
4 sc->sc_nstavaps++;
5 else if (opmode == IEEE80211_M_MONITOR)
6 sc->sc_nmonvaps++;
7 +
8 +
9 + /* Driving the HAL in IBSS sometimes adapts the TSF and other timing registers
10 + * from received beacons/probes. If that happens, expected TX interrupts may
11 + * not occur until next reset. Which triggers the "lost beacon" tasklet.
12 + * Resulting effectively in not sending packets for minutes. Because that only
13 + * happens in large mesh networks, this mode needs to be activated by a kernel
14 + * module parameter: hostap_for_ibss=1. Note that using this mode has side
15 + * effects. Such as not supressing beacons/probe answers randomly when
16 + * receiving other node beacons. It's recommended to lower the beacon interval
17 + * then. When using an IBSS-VAP together with an HOSTAP-VAP, you may also need
18 + * to re-trigger IBSS beacon generation after creating the HOSTAP-VAP by
19 + * issueing "iwpriv athX bintval 1000".
20 + */
21 + if ((flags & IEEE80211_NO_STABEACONS) && (ic->ic_opmode == IEEE80211_M_IBSS))
22 + sc->sc_opmode = HAL_M_HOSTAP;
23 + else
24 /*
25 * Adhoc demo mode is a pseudo mode; to the HAL it's
26 * just IBSS mode and the driver doesn't use management
27 @@ -4279,7 +4296,8 @@ ath_calcrxfilter(struct ath_softc *sc)
28 if (ic->ic_opmode != IEEE80211_M_HOSTAP && (dev->flags & IFF_PROMISC))
29 rfilt |= HAL_RX_FILTER_PROM;
30 if (ic->ic_opmode == IEEE80211_M_STA ||
31 - sc->sc_opmode == HAL_M_IBSS || /* NB: AHDEMO too */
32 + ic->ic_opmode == IEEE80211_M_IBSS ||
33 + ic->ic_opmode == IEEE80211_M_AHDEMO ||
34 (sc->sc_nostabeacons) || sc->sc_scanning ||
35 (ic->ic_opmode == IEEE80211_M_HOSTAP))
36 rfilt |= HAL_RX_FILTER_BEACON;
37 @@ -6435,6 +6453,33 @@ ath_capture(struct net_device *dev, cons
38 }
39
40 /*
41 + * Advances (forwards/adds) a microsecond value to current chip's TSF registers
42 + */
43 +
44 +/* from ath_info.c */
45 +#define AR5K_TSF_L32_5210 0x806c /* TSF (lower 32 bits) */
46 +#define AR5K_TSF_L32_5211 0x804c
47 +#define AR5K_TSF_L32 (ar_device(ah->ah_sc->devid) == 5210 ? \
48 + AR5K_TSF_L32_5210 : AR5K_TSF_L32_5211)
49 +
50 +#define AR5K_TSF_U32_5210 0x8070
51 +#define AR5K_TSF_U32_5211 0x8050
52 +#define AR5K_TSF_U32 (ar_device(ah->ah_sc->devid) == 5210 ? \
53 + AR5K_TSF_U32_5210 : AR5K_TSF_U32_5211)
54 +
55 +static inline void ath_hal_settsf64(struct ath_hal *ah, u_int64_t tsf_adv)
56 +{
57 + ATH_HAL_LOCK_IRQ(ah->ah_sc);
58 + ath_hal_set_function(__func__);
59 + tsf_adv += ah->ah_getTsf64(ah);
60 + OS_REG_WRITE(ah, AR5K_TSF_L32, 0ll);
61 + OS_REG_WRITE(ah, AR5K_TSF_U32, (tsf_adv >> 32) & 0xffffffffll);
62 + OS_REG_WRITE(ah, AR5K_TSF_L32, (tsf_adv >> 00) & 0xffffffffll);
63 + ath_hal_set_function(NULL);
64 + ATH_HAL_UNLOCK_IRQ(ah->ah_sc);
65 +}
66 +
67 +/*
68 * Intercept management frames to collect beacon RSSI data and to do
69 * ibss merges. This function is called for all management frames,
70 * including those belonging to other BSS.
71 @@ -6487,10 +6532,19 @@ ath_recv_mgmt(struct ieee80211vap * vap,
72 DPRINTF(sc, ATH_DEBUG_BEACON,
73 "Updated beacon timers\n");
74 }
75 - if ((sc->sc_opmode == HAL_M_IBSS) &&
76 - IEEE80211_ADDR_EQ(ni->ni_bssid, vap->iv_bss->ni_bssid) &&
77 - ath_hw_check_atim(sc, 1, vap->iv_bss->ni_intval)) {
78 - DPRINTF(sc, ATH_DEBUG_ANY, "Fixed ATIM window after beacon recv\n");
79 + if ((vap->iv_opmode == IEEE80211_M_IBSS) &&
80 + (sc->sc_opmode == HAL_M_HOSTAP) &&
81 + IEEE80211_ADDR_EQ(ni->ni_bssid, vap->iv_bss->ni_bssid)) {
82 + /* In this mode, we drive the HAL in HOSTAP mode. Hence
83 + * we do the IBSS merging in software. Also do not merge
84 + * if the difference it too small. Otherwise we are playing
85 + * tsf-pingpong with other vendors drivers */
86 + beacon_tsf = le64_to_cpu(ni->ni_tstamp.tsf);
87 + if (beacon_tsf > rtsf + 0xffff) {
88 + ath_hal_settsf64(sc->sc_ah, beacon_tsf - rtsf);
89 + ieee80211_ibss_merge(ni);
90 + }
91 + break;
92 }
93 /* NB: Fall Through */
94 case IEEE80211_FC0_SUBTYPE_PROBE_RESP:
95 @@ -6563,6 +6617,10 @@ ath_recv_mgmt(struct ieee80211vap * vap,
96 #endif
97 if (do_merge)
98 ieee80211_ibss_merge(ni);
99 +
100 + if ((sc->sc_opmode == HAL_M_IBSS) &&
101 + ath_hw_check_atim(sc, 1, vap->iv_bss->ni_intval))
102 + DPRINTF(sc, ATH_DEBUG_ANY, "Fixed ATIM window after beacon recv\n");
103 }
104 break;
105 }
This page took 0.047689 seconds and 5 git commands to generate.