summaryrefslogtreecommitdiff
path: root/package/madwifi/patches/125-tpc_PR_1435.patch
blob: 2ca624ffb7135c16aa9c1a599c13106079643f67 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
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: