openwrt/package/madwifi/patches/125-tpc_PR_1435.patch

101 lines
3.1 KiB
Diff
Raw Normal View History

Index: madwifi-ng-r2568-20070710/ath/if_ath.c
===================================================================
--- madwifi-ng-r2568-20070710.orig/ath/if_ath.c 2007-07-13 11:18:17.733307111 +0200
+++ madwifi-ng-r2568-20070710/ath/if_ath.c 2007-07-13 11:18:18.945376179 +0200
@@ -273,9 +273,7 @@
static char *autocreate = NULL;
static char *ratectl = DEF_RATE_CTL;
static int rfkill = 0;
-#ifdef ATH_CAP_TPC
static int tpc = 0;
-#endif
static int countrycode = -1;
static int outdoor = -1;
static int xchanmode = -1;
@@ -533,12 +531,6 @@
rfkill ? "on" : "off");
ath_hal_setrfsilent(ah, rfkill);
-#ifdef ATH_CAP_TPC
- printk(KERN_INFO "ath_pci: ath_pci: switching per-packet transmit power control %s\n",
- tpc ? "on" : "off");
- ath_hal_settpc(ah, tpc);
-#endif
-
/*
* Setup rate tables for all potential media types.
*/
@@ -818,11 +810,18 @@
*/
#ifdef ATH_CAP_TPC
sc->sc_hastpc = ath_hal_hastpc(ah);
- if (sc->sc_hastpc || ath_hal_hastxpowlimit(ah))
+ if(tpc && !sc->sc_hastpc) {
+ printk(KERN_WARNING "ath_pci: WARNING: per-packet transmit power control was requested, but is not supported by the hardware.\n");
+ tpc = 0;
+ }
+ printk(KERN_INFO "ath_pci: switching per-packet transmit power control %s\n",
+ tpc ? "on" : "off");
+ ath_hal_settpc(ah, tpc);
#else
sc->sc_hastpc = 0;
- if (ath_hal_hastxpowlimit(ah))
+ tpc = 0; /* TPC is always zero, when compiled without ATH_CAP_TPC */
#endif
+ if (sc->sc_hastpc || ath_hal_hastxpowlimit(ah))
ic->ic_caps |= IEEE80211_C_TXPMGT;
/*
@@ -1836,7 +1835,7 @@
ath_stop_locked(dev);
#ifdef ATH_CAP_TPC
- /* Re-enable after suspend (?) */
+ /* Re-enable after suspend */
ath_hal_settpc(ah, tpc);
#endif
@@ -8787,26 +8786,16 @@
* Search for the VAP that needs a txpow change, if any
*/
TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) {
-#ifdef ATH_CAP_TPC
- if (ic->ic_newtxpowlimit == vap->iv_bss->ni_txpower) {
+ if (!tpc || ic->ic_newtxpowlimit >= vap->iv_bss->ni_txpower) {
vap->iv_bss->ni_txpower = clamped_txpow;
ieee80211_iterate_nodes(&vap->iv_ic->ic_sta, set_node_txpower, &clamped_txpow);
}
-#else
- vap->iv_bss->ni_txpower = clamped_txpow;
- ieee80211_iterate_nodes(&vap->iv_ic->ic_sta, set_node_txpower, &clamped_txpow);
-#endif
}
- ic->ic_newtxpowlimit = sc->sc_curtxpow = clamped_txpow;
+ sc->sc_curtxpow = clamped_txpow;
-#ifdef ATH_CAP_TPC
- if (ic->ic_newtxpowlimit >= txpowlimit)
- ath_hal_settxpowlimit(ah, ic->ic_newtxpowlimit);
-#else
- if (ic->ic_newtxpowlimit != txpowlimit)
- ath_hal_settxpowlimit(ah, ic->ic_newtxpowlimit);
-#endif
+ if (clamped_txpow != txpowlimit)
+ ath_hal_settxpowlimit(ah, clamped_txpow);
}
Index: madwifi-ng-r2568-20070710/net80211/ieee80211_wireless.c
===================================================================
--- madwifi-ng-r2568-20070710.orig/net80211/ieee80211_wireless.c 2007-07-13 11:18:13.473064331 +0200
+++ madwifi-ng-r2568-20070710/net80211/ieee80211_wireless.c 2007-07-13 11:18:18.949376408 +0200
@@ -1403,6 +1403,7 @@
} else {
if (!fixed) /* no change */
return 0;
+ ic->ic_newtxpowlimit = IEEE80211_TXPOWER_MAX;
ic->ic_flags &= ~IEEE80211_F_TXPOW_FIXED;
}
done: