X-Git-Url: https://git.rohieb.name/openwrt.git/blobdiff_plain/0ee2c9dc7b5f895c88d5d6bb8b91b95028409b7c..fb9f9cdc813406041715d4c692f2b18cfd418cee:/package/madwifi/patches/421-channel_handling.patch?ds=sidebyside diff --git a/package/madwifi/patches/421-channel_handling.patch b/package/madwifi/patches/421-channel_handling.patch index 781194eed..2a8ec27ce 100644 --- a/package/madwifi/patches/421-channel_handling.patch +++ b/package/madwifi/patches/421-channel_handling.patch @@ -8,7 +8,7 @@ static void ath_updateslot(struct net_device *); static int ath_beaconq_setup(struct ath_softc *); static int ath_beacon_alloc(struct ath_softc *, struct ieee80211_node *); -@@ -240,7 +239,7 @@ static void ath_setup_stationkey(struct +@@ -240,7 +239,7 @@ static void ath_setup_stationkey(struct static void ath_setup_stationwepkey(struct ieee80211_node *); static void ath_setup_keycacheslot(struct ath_softc *, struct ieee80211_node *); static void ath_newassoc(struct ieee80211_node *, int); @@ -173,7 +173,7 @@ /* NB: setup here so ath_rate_update is happy */ ath_setcurmode(sc, IEEE80211_MODE_11A); -@@ -909,10 +929,6 @@ ath_attach(u_int16_t devid, struct net_d +@@ -908,10 +928,6 @@ ath_attach(u_int16_t devid, struct net_d IEEE80211_ATHC_COMP : 0); #endif @@ -184,7 +184,7 @@ #ifdef ATH_SUPERG_XR ic->ic_ath_cap |= (ath_hal_xrsupported(ah) ? IEEE80211_ATHC_XR : 0); #endif -@@ -4466,17 +4482,17 @@ ath_mode_init(struct net_device *dev) +@@ -4470,17 +4486,17 @@ ath_mode_init(struct net_device *dev) * Set the slot time based on the current setting. */ static void @@ -210,7 +210,7 @@ sc->sc_updateslot = OK; } -@@ -4498,7 +4514,7 @@ ath_updateslot(struct net_device *dev) +@@ -4502,7 +4518,7 @@ ath_updateslot(struct net_device *dev) if (ic->ic_opmode == IEEE80211_M_HOSTAP) sc->sc_updateslot = UPDATE; else if (dev->flags & IFF_RUNNING) @@ -219,7 +219,7 @@ } #ifdef ATH_SUPERG_DYNTURBO -@@ -5342,7 +5358,7 @@ ath_beacon_send(struct ath_softc *sc, in +@@ -5346,7 +5362,7 @@ ath_beacon_send(struct ath_softc *sc, in sc->sc_updateslot = COMMIT; /* commit next beacon */ sc->sc_slotupdate = slot; } else if ((sc->sc_updateslot == COMMIT) && (sc->sc_slotupdate == slot)) @@ -228,7 +228,7 @@ if (bfaddr != 0) { /* -@@ -7796,12 +7812,14 @@ ath_get_ivlen(struct ieee80211_key *k) +@@ -7802,12 +7818,14 @@ ath_get_ivlen(struct ieee80211_key *k) * Get transmit rate index using rate in Kbps */ static __inline int @@ -245,7 +245,7 @@ ndx = i; break; } -@@ -8094,7 +8112,7 @@ ath_tx_start(struct net_device *dev, str +@@ -8100,7 +8118,7 @@ ath_tx_start(struct net_device *dev, str atype = HAL_PKT_TYPE_NORMAL; /* default */ if (ismcast) { @@ -254,7 +254,7 @@ txrate = rt->info[rix].rateCode; if (shortPreamble) txrate |= rt->info[rix].shortPreamble; -@@ -9061,7 +9079,7 @@ ath_chan_change(struct ath_softc *sc, st +@@ -9067,7 +9085,7 @@ ath_chan_change(struct ath_softc *sc, st struct net_device *dev = sc->sc_dev; enum ieee80211_phymode mode; @@ -263,7 +263,7 @@ ath_rate_setup(dev, mode); ath_setcurmode(sc, mode); -@@ -10110,8 +10128,7 @@ ath_newassoc(struct ieee80211_node *ni, +@@ -10124,8 +10142,7 @@ ath_newassoc(struct ieee80211_node *ni, } static int @@ -273,7 +273,7 @@ { struct ath_softc *sc = dev->priv; struct ieee80211com *ic = &sc->sc_ic; -@@ -10125,17 +10142,31 @@ ath_getchannels(struct net_device *dev, +@@ -10139,17 +10156,31 @@ ath_getchannels(struct net_device *dev, EPRINTF(sc, "Insufficient memory for channel table!\n"); return -ENOMEM; } @@ -307,7 +307,7 @@ /* * Convert HAL channels to ieee80211 ones. */ -@@ -10379,7 +10410,7 @@ ath_xr_rate_setup(struct net_device *dev +@@ -10395,7 +10426,7 @@ ath_xr_rate_setup(struct net_device *dev struct ieee80211com *ic = &sc->sc_ic; const HAL_RATE_TABLE *rt; struct ieee80211_rateset *rs; @@ -316,7 +316,7 @@ sc->sc_xr_rates = ath_hal_getratetable(ah, HAL_MODE_XR); rt = sc->sc_xr_rates; if (rt == NULL) -@@ -10392,57 +10423,16 @@ ath_xr_rate_setup(struct net_device *dev +@@ -10408,57 +10439,16 @@ ath_xr_rate_setup(struct net_device *dev } else maxrates = rt->rateCount; rs = &ic->ic_sup_xr_rates; @@ -380,7 +380,7 @@ static int ath_rate_setup(struct net_device *dev, u_int mode) { -@@ -10451,7 +10441,7 @@ ath_rate_setup(struct net_device *dev, u +@@ -10467,7 +10457,7 @@ ath_rate_setup(struct net_device *dev, u struct ieee80211com *ic = &sc->sc_ic; const HAL_RATE_TABLE *rt; struct ieee80211_rateset *rs; @@ -389,7 +389,7 @@ switch (mode) { case IEEE80211_MODE_11A: -@@ -10469,6 +10459,12 @@ ath_rate_setup(struct net_device *dev, u +@@ -10485,6 +10475,12 @@ ath_rate_setup(struct net_device *dev, u case IEEE80211_MODE_TURBO_G: sc->sc_rates[mode] = ath_hal_getratetable(ah, HAL_MODE_108G); break; @@ -402,7 +402,7 @@ default: DPRINTF(sc, ATH_DEBUG_ANY, "Invalid mode %u\n", mode); return 0; -@@ -10483,10 +10479,16 @@ ath_rate_setup(struct net_device *dev, u +@@ -10499,10 +10495,16 @@ ath_rate_setup(struct net_device *dev, u maxrates = IEEE80211_RATE_MAXSIZE; } else maxrates = rt->rateCount; @@ -419,7 +419,7 @@ return 1; } -@@ -10515,13 +10517,18 @@ ath_setcurmode(struct ath_softc *sc, enu +@@ -10531,13 +10533,18 @@ ath_setcurmode(struct ath_softc *sc, enu { 0, 500, 130 }, }; const HAL_RATE_TABLE *rt; @@ -440,7 +440,7 @@ memset(sc->sc_hwmap, 0, sizeof(sc->sc_hwmap)); for (i = 0; i < 32; i++) { u_int8_t ix = rt->rateCodeToIndex[i]; -@@ -10531,7 +10538,7 @@ ath_setcurmode(struct ath_softc *sc, enu +@@ -10547,7 +10554,7 @@ ath_setcurmode(struct ath_softc *sc, enu continue; } sc->sc_hwmap[i].ieeerate = @@ -449,7 +449,7 @@ if (rt->info[ix].shortPreamble || rt->info[ix].phy == IEEE80211_T_OFDM) sc->sc_hwmap[i].flags |= IEEE80211_RADIOTAP_F_SHORTPRE; -@@ -10932,9 +10939,115 @@ enum { +@@ -10948,9 +10955,106 @@ enum { ATH_MAXVAPS = 26, ATH_INTMIT = 27, ATH_NOISE_IMMUNITY = 28, @@ -471,20 +471,11 @@ + struct ieee80211vap *vap; + u_int16_t freq = 0; + struct ifreq ifr; -+ void *ptr; -+ u32 *reg; + + if (ic->ic_curchan != IEEE80211_CHAN_ANYC) + freq = ic->ic_curchan->ic_freq; + + switch(ctl) { -+ case ATH_REGDOMAIN: -+ ptr = ah; -+ ptr += sizeof(struct ath_hal); -+ ptr += 116; -+ reg = ptr; -+ *reg = val; -+ return 0; + case ATH_COUNTRYCODE: + ic->ic_country_code = val; + break; @@ -566,7 +557,7 @@ static int ath_sysctl_set_intmit(struct ath_softc *sc, long ctl, u_int val) { -@@ -11013,6 +11126,7 @@ static int +@@ -11029,6 +11133,7 @@ static int ATH_SYSCTL_DECL(ath_sysctl_halparam, ctl, write, filp, buffer, lenp, ppos) { struct ath_softc *sc = ctl->extra1; @@ -574,11 +565,14 @@ struct ath_hal *ah = sc->sc_ah; u_int val; u_int tab_3_val[3]; -@@ -11036,25 +11150,31 @@ ATH_SYSCTL_DECL(ath_sysctl_halparam, ctl +@@ -11052,25 +11157,34 @@ ATH_SYSCTL_DECL(ath_sysctl_halparam, ctl lenp, ppos); if (ret == 0) { switch ((long)ctl->extra2) { + case ATH_REGDOMAIN: ++ ath_hal_setregdomain(ah, val); ++ break; ++ case ATH_OUTDOOR: + case ATH_COUNTRYCODE: + case ATH_CHANBW: + ret = ath_sysctl_setchanparam(sc, (long) ctl->extra2, val); @@ -619,12 +613,9 @@ break; case ATH_SOFTLED: if (val != sc->sc_softled) { -@@ -11206,7 +11326,12 @@ ATH_SYSCTL_DECL(ath_sysctl_halparam, ctl - } +@@ -11223,6 +11337,9 @@ ATH_SYSCTL_DECL(ath_sysctl_halparam, ctl } } else { -+ void *ptr; -+ u32 *reg; switch ((long)ctl->extra2) { + case ATH_CHANBW: + val = sc->sc_chanbw ?: 20; @@ -632,7 +623,7 @@ case ATH_SLOTTIME: val = ath_hal_getslottime(ah); break; -@@ -11225,11 +11350,18 @@ ATH_SYSCTL_DECL(ath_sysctl_halparam, ctl +@@ -11241,6 +11358,9 @@ ATH_SYSCTL_DECL(ath_sysctl_halparam, ctl case ATH_COUNTRYCODE: ath_hal_getcountrycode(ah, &val); break; @@ -642,17 +633,7 @@ case ATH_MAXVAPS: val = ath_maxvaps; break; - case ATH_REGDOMAIN: -- ath_hal_getregdomain(ah, &val); -+ ptr = ah; -+ ptr += sizeof(struct ath_hal); -+ ptr += 116; -+ reg = ptr; -+ val = *reg; - break; - case ATH_DEBUG: - val = sc->sc_debug | ath_debug_global; -@@ -11338,11 +11470,17 @@ static const ctl_table ath_sysctl_templa +@@ -11354,11 +11474,17 @@ static const ctl_table ath_sysctl_templa }, { .ctl_name = CTL_AUTO, .procname = "countrycode", @@ -671,7 +652,7 @@ .procname = "maxvaps", .mode = 0444, .proc_handler = ath_sysctl_halparam, -@@ -11350,7 +11488,7 @@ static const ctl_table ath_sysctl_templa +@@ -11366,7 +11492,7 @@ static const ctl_table ath_sysctl_templa }, { .ctl_name = CTL_AUTO, .procname = "regdomain", @@ -680,7 +661,7 @@ .proc_handler = ath_sysctl_halparam, .extra2 = (void *)ATH_REGDOMAIN, }, -@@ -11413,6 +11551,12 @@ static const ctl_table ath_sysctl_templa +@@ -11429,6 +11555,12 @@ static const ctl_table ath_sysctl_templa .extra2 = (void *)ATH_ACKRATE, }, { .ctl_name = CTL_AUTO, @@ -693,7 +674,7 @@ .procname = "rp", .mode = 0200, .proc_handler = ath_sysctl_halparam, -@@ -11653,13 +11797,6 @@ static ctl_table ath_static_sysctls[] = +@@ -11669,13 +11801,6 @@ static ctl_table ath_static_sysctls[] = }, #endif { .ctl_name = CTL_AUTO, @@ -707,7 +688,7 @@ .procname = "maxvaps", .mode = 0444, .data = &ath_maxvaps, -@@ -11667,13 +11804,6 @@ static ctl_table ath_static_sysctls[] = +@@ -11683,13 +11808,6 @@ static ctl_table ath_static_sysctls[] = .proc_handler = proc_dointvec }, { .ctl_name = CTL_AUTO, @@ -723,7 +704,7 @@ .data = &ath_xchanmode, --- a/ath/if_athvar.h +++ b/ath/if_athvar.h -@@ -689,16 +689,17 @@ struct ath_softc { +@@ -688,17 +688,18 @@ struct ath_softc { int8_t sc_ofdm_weak_det; /* OFDM weak frames detection, -1 == auto */ /* rate tables */ @@ -737,6 +718,7 @@ - const HAL_RATE_TABLE *sc_quarter_rates; /* quarter rate table */ HAL_OPMODE sc_opmode; /* current hal operating mode */ enum ieee80211_phymode sc_curmode; /* current phy mode */ + u_int sc_poweroffset; /* hardware power offset */ u_int16_t sc_curtxpow; /* current tx power limit */ u_int16_t sc_curaid; /* current association id */ HAL_CHANNEL sc_curchan; /* current h/w channel */ @@ -871,7 +853,7 @@ } /* Initialize candidate channels to all available */ memcpy(ic->ic_chan_active, ic->ic_chan_avail, -@@ -311,11 +296,58 @@ ieee80211_ifattach(struct ieee80211com * +@@ -311,11 +296,59 @@ ieee80211_ifattach(struct ieee80211com * * When 11g is supported, force the rate set to * include basic rates suitable for a mixed b/g bss. */ @@ -884,6 +866,7 @@ + if (init) + return; + ++ ifmedia_removeall(&ic->ic_media); + ieee80211_media_setup(ic, &ic->ic_media, ic->ic_caps, NULL, NULL); + ieee80211com_media_status(ic->ic_dev, &imr); + ifmedia_set(&ic->ic_media, imr.ifm_active); @@ -931,7 +914,7 @@ /* Setup initial channel settings */ ic->ic_bsschan = IEEE80211_CHAN_ANYC; /* Arbitrarily pick the first channel */ -@@ -327,6 +359,7 @@ ieee80211_ifattach(struct ieee80211com * +@@ -327,6 +360,7 @@ ieee80211_ifattach(struct ieee80211com * /* Enable WME by default, if we're capable. */ if (ic->ic_caps & IEEE80211_C_WME) ic->ic_flags |= IEEE80211_F_WME; @@ -939,7 +922,7 @@ (void) ieee80211_setmode(ic, ic->ic_curmode); /* Store default beacon interval, as nec. */ -@@ -763,7 +796,8 @@ ieee80211_media_setup(struct ieee80211co +@@ -763,7 +797,8 @@ ieee80211_media_setup(struct ieee80211co struct ieee80211_rateset allrates; /* Fill in media characteristics. */ @@ -949,7 +932,7 @@ maxrate = 0; memset(&allrates, 0, sizeof(allrates)); -@@ -793,7 +827,7 @@ ieee80211_media_setup(struct ieee80211co +@@ -793,7 +828,7 @@ ieee80211_media_setup(struct ieee80211co ADD(media, IFM_AUTO, mopt | IFM_IEEE80211_WDS); if (mode == IEEE80211_MODE_AUTO) continue; @@ -958,7 +941,7 @@ for (i = 0; i < rs->rs_nrates; i++) { rate = rs->rs_rates[i]; -@@ -1207,7 +1241,7 @@ ieee80211_announce(struct ieee80211com * +@@ -1207,7 +1242,7 @@ ieee80211_announce(struct ieee80211com * if ((ic->ic_modecaps & (1 << mode)) == 0) continue; if_printf(dev, "%s rates: ", ieee80211_phymode_name[mode]); @@ -967,7 +950,7 @@ for (i = 0; i < rs->rs_nrates; i++) { rate = rs->rs_rates[i]; mword = ieee80211_rate2media(ic, rate, mode); -@@ -1417,7 +1451,7 @@ ieee80211com_media_change(struct net_dev +@@ -1417,7 +1452,7 @@ ieee80211com_media_change(struct net_dev * now so drivers have a consistent state. */ KASSERT(vap->iv_bss != NULL, ("no bss node")); @@ -976,7 +959,7 @@ } error = -ENETRESET; } -@@ -1435,7 +1469,7 @@ findrate(struct ieee80211com *ic, enum i +@@ -1435,7 +1470,7 @@ findrate(struct ieee80211com *ic, enum i { #define IEEERATE(_ic,_m,_i) \ ((_ic)->ic_sup_rates[_m].rs_rates[_i] & IEEE80211_RATE_VAL) @@ -985,7 +968,7 @@ for (i = 0; i < nrates; i++) if (IEEERATE(ic, mode, i) == rate) return i; -@@ -1881,11 +1915,6 @@ ieee80211_build_countryie(struct ieee802 +@@ -1877,11 +1912,6 @@ ieee80211_build_countryie(struct ieee802 if (ieee80211_chan2mode(c) != curmode_noturbo) continue; @@ -997,7 +980,7 @@ if (*cur_runlen == 0) { (*cur_runlen)++; *cur_pow = c->ic_maxregpower; -@@ -1919,7 +1948,7 @@ void +@@ -1915,7 +1945,7 @@ void ieee80211_build_sc_ie(struct ieee80211com *ic) { struct ieee80211_ie_sc *ie = &ic->ic_sc_ie; @@ -1017,7 +1000,7 @@ u_int16_t ic_modecaps; /* set of mode capabilities */ u_int16_t ic_curmode; /* current mode */ u_int16_t ic_lintval; /* beacon interval */ -@@ -715,6 +713,7 @@ MALLOC_DECLARE(M_80211_VAP); +@@ -714,6 +712,7 @@ MALLOC_DECLARE(M_80211_VAP); int ieee80211_ifattach(struct ieee80211com *); void ieee80211_ifdetach(struct ieee80211com *); @@ -1025,7 +1008,7 @@ int ieee80211_vap_setup(struct ieee80211com *, struct net_device *, const char *, int, int, struct ieee80211vap *); int ieee80211_vap_attach(struct ieee80211vap *, ifm_change_cb_t, ifm_stat_cb_t); -@@ -794,6 +793,23 @@ ieee80211_anyhdrspace(struct ieee80211co +@@ -793,6 +792,23 @@ ieee80211_anyhdrspace(struct ieee80211co return size; } @@ -1126,7 +1109,7 @@ nrs = &ni->ni_rates; fixedrate = IEEE80211_FIXED_RATE_NONE; for (i = 0; i < nrs->rs_nrates;) { -@@ -1401,6 +1401,7 @@ ieee80211_new_state(struct ieee80211vap +@@ -1407,6 +1407,7 @@ ieee80211_new_state(struct ieee80211vap IEEE80211_VAPS_UNLOCK_IRQ(ic); return rc; } @@ -1201,7 +1184,7 @@ if ((ic->ic_flags & IEEE80211_F_USEPROT) && --- a/net80211/ieee80211_wireless.c +++ b/net80211/ieee80211_wireless.c -@@ -2133,7 +2133,7 @@ ieee80211_ioctl_setmode(struct net_devic +@@ -2142,7 +2142,7 @@ ieee80211_ioctl_setmode(struct net_devic vap->iv_des_mode = mode; if (IS_UP_AUTO(vap)) @@ -1210,7 +1193,7 @@ retv = 0; } -@@ -4081,46 +4081,60 @@ ieee80211_ioctl_getchanlist(struct net_d +@@ -4090,46 +4090,60 @@ ieee80211_ioctl_getchanlist(struct net_d return 0; } @@ -1288,7 +1271,7 @@ --- a/net80211/ieee80211_scan_ap.c +++ b/net80211/ieee80211_scan_ap.c -@@ -518,12 +518,13 @@ pick_channel(struct ieee80211_scan_state +@@ -512,12 +512,13 @@ pick_channel(struct ieee80211_scan_state int ss_last = ss->ss_last; struct ieee80211_channel *best; struct ap_state *as = ss->ss_priv; @@ -1303,7 +1286,7 @@ for (i = 0; i < ss_last; i++) { chans[i].chan = ss->ss_chans[i]; chans[i].orig = i; -@@ -612,6 +613,7 @@ pick_channel(struct ieee80211_scan_state +@@ -571,6 +572,7 @@ pick_channel(struct ieee80211_scan_state "%s: best: channel %u rssi %d\n", __func__, i, as->as_maxrssi[i]); } @@ -1311,7 +1294,7 @@ return best; } -@@ -647,6 +649,7 @@ ap_end(struct ieee80211_scan_state *ss, +@@ -609,6 +611,7 @@ ap_end(struct ieee80211_scan_state *ss, res = 1; /* Do NOT restart scan */ } else { struct ieee80211_scan_entry se; @@ -1319,7 +1302,7 @@ /* XXX: notify all VAPs? */ /* if this is a dynamic turbo frequency , start with normal * mode first */ -@@ -661,6 +664,11 @@ ap_end(struct ieee80211_scan_state *ss, +@@ -623,6 +626,11 @@ ap_end(struct ieee80211_scan_state *ss, return 0; } } @@ -1352,3 +1335,17 @@ /* * Iterate over the contents of the scan cache. +--- a/ath/if_ath_hal_wrappers.h ++++ b/ath/if_ath_hal_wrappers.h +@@ -111,6 +111,11 @@ static inline HAL_BOOL ath_hal_getregdom + return (ath_hal_getcapability(ah, HAL_CAP_REG_DMN, 0, destination) == HAL_OK); + } + ++static inline HAL_BOOL ath_hal_setregdomain(struct ath_hal *ah, u_int32_t v) ++{ ++ return (ath_hal_setcapability(ah, HAL_CAP_REG_DMN, 0, v, NULL)); ++} ++ + static inline HAL_BOOL ath_hal_gettkipmic(struct ath_hal *ah) + { + return (ath_hal_getcapability(ah, HAL_CAP_TKIP_MIC, 1, NULL) == HAL_OK);