aboutsummaryrefslogtreecommitdiffstats
path: root/package/madwifi/patches/341-minrate.patch
blob: 1e75ddecf81344363f56c32a8d7929755f81a838 (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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
--- a/ath/if_ath.c
+++ b/ath/if_ath.c
@@ -1308,6 +1308,7 @@
 	vap->iv_key_update_begin = ath_key_update_begin;
 	vap->iv_key_update_end = ath_key_update_end;
 	vap->iv_maxrateindex = 0;
+	vap->iv_minrateindex = 0;
 	if (sc->sc_default_ieee80211_debug) {
 		/* User specified defaults for new VAPs were provided, so
 		 * use those (only). */
--- a/ath_rate/minstrel/minstrel.c
+++ b/ath_rate/minstrel/minstrel.c
@@ -638,9 +638,15 @@
 			sn->rs_succ_hist	[x] = 0;
 			sn->rs_att_hist 	[x] = 0;
 			sn->rs_this_tp 		[x] = 0;
-
+			if (vap->iv_minrateindex && vap->iv_minrateindex<ni->ni_rates.rs_nrates)
+			{
+			int idx = vap->iv_minrateindex; 
+			sn->rates[x].rate = ni->ni_rates.rs_rates[idx] & IEEE80211_RATE_VAL;
+			sn->rates[x].rix = sc->sc_rixmap[sn->rates[idx].rate];
+			}else{
 			sn->rates[x].rate = ni->ni_rates.rs_rates[x] & IEEE80211_RATE_VAL;
 			sn->rates[x].rix = sc->sc_rixmap[sn->rates[x].rate];
+			}
 			if (sn->rates[x].rix == 0xff) {
 				DPRINTF(sc, "%s: %s ignore bogus rix at %d\n",
 					dev_info, __func__, x);
@@ -649,7 +655,7 @@
 			sn->rates[x].rateCode = rt->info[sn->rates[x].rix].rateCode;
 			sn->rates[x].shortPreambleRateCode =
 				rt->info[sn->rates[x].rix].rateCode |
-				rt->info[sn->rates[x].rix].shortPreamble;
+				rt->info[sn->rates[x].rix].shortPreamble;			
 		}
 
 		ath_fill_sample_table(sn);
--- a/ath_rate/sample/sample.c
+++ b/ath_rate/sample/sample.c
@@ -842,8 +842,15 @@
 		sn->num_rates = vap->iv_maxrateindex;
 
 	for (x = 0; x < ni->ni_rates.rs_nrates; x++) {
-		sn->rates[x].rate = ni->ni_rates.rs_rates[x] & IEEE80211_RATE_VAL;
-		sn->rates[x].rix = sc->sc_rixmap[sn->rates[x].rate];
+		if (vap->iv_minrateindex && vap->iv_minrateindex<ni->ni_rates.rs_nrates)
+			{
+			int idx = vap->iv_minrateindex; 
+			sn->rates[x].rate = ni->ni_rates.rs_rates[idx] & IEEE80211_RATE_VAL;
+			sn->rates[x].rix = sc->sc_rixmap[sn->rates[idx].rate];
+			}else{
+			sn->rates[x].rate = ni->ni_rates.rs_rates[x] & IEEE80211_RATE_VAL;
+			sn->rates[x].rix = sc->sc_rixmap[sn->rates[x].rate];
+			}
 		if (sn->rates[x].rix == 0xff) {
 			DPRINTF(sc, ATH_DEBUG_RATE, "%s: %s ignore bogus rix at %u\n",
 				dev_info, __func__, x);
--- a/net80211/ieee80211_ioctl.h
+++ b/net80211/ieee80211_ioctl.h
@@ -642,6 +642,7 @@
 	IEEE80211_PARAM_BEACON_MISS_THRESH	= 73,	/* Beacon miss threshold (in beacons) */
 	IEEE80211_PARAM_BEACON_MISS_THRESH_MS	= 74,	/* Beacon miss threshold (in ms) */
 	IEEE80211_PARAM_MAXRATE			= 75,	/* Maximum rate (by table index) */
+	IEEE80211_PARAM_MINRATE			= 76,	/* Maximum rate (by table index) */
 };
 
 #define	SIOCG80211STATS			(SIOCDEVPRIVATE+2)
--- a/net80211/ieee80211_var.h
+++ b/net80211/ieee80211_var.h
@@ -282,6 +282,7 @@
 	struct ieee80211_app_ie app_ie[IEEE80211_APPIE_NUM_OF_FRAME]; /* app-specified IEs by frame type */
 	u_int32_t app_filter;				/* filters which management frames are forwarded to app */
 	int iv_maxrateindex;
+	int iv_minrateindex;
 };
 
 /* Debug functions need the defintion of struct ieee80211vap because iv_debug 
--- a/net80211/ieee80211_wireless.c
+++ b/net80211/ieee80211_wireless.c
@@ -2845,6 +2845,12 @@
 		else
 			vap->iv_maxrateindex = 0;
 		break;
+	case IEEE80211_PARAM_MINRATE:
+		if (value > 0)
+			vap->iv_minrateindex = value;
+		else
+			vap->iv_minrateindex = 0;
+		break;
 #ifdef ATH_REVERSE_ENGINEERING
 	case IEEE80211_PARAM_DUMPREGS:
 		ieee80211_dump_registers(dev, info, w, extra);
@@ -3183,6 +3189,9 @@
 	case IEEE80211_PARAM_MAXRATE:
 		param[0] = vap->iv_maxrateindex;
 		break;
+	case IEEE80211_PARAM_MINRATE:
+		param[0] = vap->iv_minrateindex;
+		break;
 	default:
 		return -EOPNOTSUPP;
 	}
@@ -5623,6 +5632,10 @@
 	 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "maxrate"},
 	{IEEE80211_PARAM_MAXRATE,
 	 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "get_maxrate"},
+	{IEEE80211_PARAM_MINRATE,
+	 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "minrate"},
+	{IEEE80211_PARAM_MINRATE,
+	 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "get_minrate"},
 
 #ifdef ATH_REVERSE_ENGINEERING
 	/*