madwifi: minor cleanup for the channel handling patch

SVN-Revision: 15637
This commit is contained in:
Felix Fietkau 2009-05-06 14:06:59 +00:00
parent 287dbd648a
commit 28f12da43f

View file

@ -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 {
@@ -10932,9 +10939,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
@@ -11013,6 +11117,7 @@ static int
ATH_SYSCTL_DECL(ath_sysctl_halparam, ctl, write, filp, buffer, lenp, ppos)
{
struct ath_softc *sc = ctl->extra1;
@ -574,11 +565,13 @@
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
@@ -11036,25 +11141,33 @@ 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_COUNTRYCODE:
+ case ATH_CHANBW:
+ ret = ath_sysctl_setchanparam(sc, (long) ctl->extra2, val);
@ -619,12 +612,9 @@
break;
case ATH_SOFTLED:
if (val != sc->sc_softled) {
@@ -11206,7 +11326,12 @@ ATH_SYSCTL_DECL(ath_sysctl_halparam, ctl
}
@@ -11207,6 +11320,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 +622,7 @@
case ATH_SLOTTIME:
val = ath_hal_getslottime(ah);
break;
@@ -11225,11 +11350,18 @@ ATH_SYSCTL_DECL(ath_sysctl_halparam, ctl
@@ -11225,6 +11341,9 @@ ATH_SYSCTL_DECL(ath_sysctl_halparam, ctl
case ATH_COUNTRYCODE:
ath_hal_getcountrycode(ah, &val);
break;
@ -642,17 +632,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
@@ -11338,11 +11457,17 @@ static const ctl_table ath_sysctl_templa
},
{ .ctl_name = CTL_AUTO,
.procname = "countrycode",
@ -671,7 +651,7 @@
.procname = "maxvaps",
.mode = 0444,
.proc_handler = ath_sysctl_halparam,
@@ -11350,7 +11488,7 @@ static const ctl_table ath_sysctl_templa
@@ -11350,7 +11475,7 @@ static const ctl_table ath_sysctl_templa
},
{ .ctl_name = CTL_AUTO,
.procname = "regdomain",
@ -680,7 +660,7 @@
.proc_handler = ath_sysctl_halparam,
.extra2 = (void *)ATH_REGDOMAIN,
},
@@ -11413,6 +11551,12 @@ static const ctl_table ath_sysctl_templa
@@ -11413,6 +11538,12 @@ static const ctl_table ath_sysctl_templa
.extra2 = (void *)ATH_ACKRATE,
},
{ .ctl_name = CTL_AUTO,
@ -693,7 +673,7 @@
.procname = "rp",
.mode = 0200,
.proc_handler = ath_sysctl_halparam,
@@ -11653,13 +11797,6 @@ static ctl_table ath_static_sysctls[] =
@@ -11653,13 +11784,6 @@ static ctl_table ath_static_sysctls[] =
},
#endif
{ .ctl_name = CTL_AUTO,
@ -707,7 +687,7 @@
.procname = "maxvaps",
.mode = 0444,
.data = &ath_maxvaps,
@@ -11667,13 +11804,6 @@ static ctl_table ath_static_sysctls[] =
@@ -11667,13 +11791,6 @@ static ctl_table ath_static_sysctls[] =
.proc_handler = proc_dointvec
},
{ .ctl_name = CTL_AUTO,
@ -1352,3 +1332,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);