madwifi: add patches for maximum and minimum rate (thx, SeG)

SVN-Revision: 10555
This commit is contained in:
Felix Fietkau 2008-03-07 01:36:41 +00:00
parent 9712028f88
commit b5a90e5cd9
2 changed files with 236 additions and 0 deletions

View file

@ -0,0 +1,110 @@
Index: madwifi-trunk-r3314/ath/if_ath.c
===================================================================
--- madwifi-trunk-r3314.orig/ath/if_ath.c 2008-03-07 02:30:44.403857478 +0100
+++ madwifi-trunk-r3314/ath/if_ath.c 2008-03-07 02:30:53.276363092 +0100
@@ -1307,6 +1307,7 @@
vap->iv_key_set = ath_key_set;
vap->iv_key_update_begin = ath_key_update_begin;
vap->iv_key_update_end = ath_key_update_end;
+ vap->iv_maxrateindex = 0;
if (sc->sc_default_ieee80211_debug) {
/* User specified defaults for new VAPs were provided, so
* use those (only). */
Index: madwifi-trunk-r3314/ath_rate/minstrel/minstrel.c
===================================================================
--- madwifi-trunk-r3314.orig/ath_rate/minstrel/minstrel.c 2008-03-07 02:30:44.275850185 +0100
+++ madwifi-trunk-r3314/ath_rate/minstrel/minstrel.c 2008-03-07 02:30:53.276363092 +0100
@@ -622,8 +622,12 @@
return;
}
sn->static_rate_ndx = -1;
+ if (vap->iv_maxrateindex == 0 || ni->ni_rates.rs_nrates <= 0
+ || vap->iv_maxrateindex > ni->ni_rates.rs_nrates)
+ sn->num_rates = ni->ni_rates.rs_nrates;
+ else
+ sn->num_rates = vap->iv_maxrateindex;
- sn->num_rates = ni->ni_rates.rs_nrates;
for (x = 0; x < ni->ni_rates.rs_nrates; x++) {
sn->rs_rateattempts [x] = 0;
sn->rs_thisprob [x] = 0;
Index: madwifi-trunk-r3314/ath_rate/sample/sample.c
===================================================================
--- madwifi-trunk-r3314.orig/ath_rate/sample/sample.c 2008-03-07 02:30:44.055837647 +0100
+++ madwifi-trunk-r3314/ath_rate/sample/sample.c 2008-03-07 02:30:53.280363321 +0100
@@ -835,7 +835,12 @@
}
sn->static_rate_ndx = -1;
- sn->num_rates = ni->ni_rates.rs_nrates;
+ if (vap->iv_maxrateindex == 0 || ni->ni_rates.rs_nrates <= 0
+ || vap->iv_maxrateindex > ni->ni_rates.rs_nrates)
+ sn->num_rates = ni->ni_rates.rs_nrates;
+ else
+ 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];
Index: madwifi-trunk-r3314/net80211/ieee80211_ioctl.h
===================================================================
--- madwifi-trunk-r3314.orig/net80211/ieee80211_ioctl.h 2008-03-07 02:30:44.211846539 +0100
+++ madwifi-trunk-r3314/net80211/ieee80211_ioctl.h 2008-03-07 02:30:53.284363550 +0100
@@ -641,6 +641,7 @@
FCC requires 30m, so that is the default. */
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) */
};
#define SIOCG80211STATS (SIOCDEVPRIVATE+2)
Index: madwifi-trunk-r3314/net80211/ieee80211_var.h
===================================================================
--- madwifi-trunk-r3314.orig/net80211/ieee80211_var.h 2008-03-07 02:30:44.155843346 +0100
+++ madwifi-trunk-r3314/net80211/ieee80211_var.h 2008-03-07 02:31:48.563513730 +0100
@@ -281,6 +281,7 @@
struct ieee80211_spy iv_spy; /* IWSPY support */
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;
};
/* Debug functions need the defintion of struct ieee80211vap because iv_debug
Index: madwifi-trunk-r3314/net80211/ieee80211_wireless.c
===================================================================
--- madwifi-trunk-r3314.orig/net80211/ieee80211_wireless.c 2008-03-07 02:30:44.211846539 +0100
+++ madwifi-trunk-r3314/net80211/ieee80211_wireless.c 2008-03-07 02:30:53.292364006 +0100
@@ -2839,6 +2839,12 @@
else
ic->ic_flags_ext &= ~IEEE80211_FEXT_MARKDFS;
break;
+ case IEEE80211_PARAM_MAXRATE:
+ if (value > 0)
+ vap->iv_maxrateindex = value;
+ else
+ vap->iv_maxrateindex = 0;
+ break;
#ifdef ATH_REVERSE_ENGINEERING
case IEEE80211_PARAM_DUMPREGS:
ieee80211_dump_registers(dev, info, w, extra);
@@ -3174,6 +3180,9 @@
else
param[0] = 0;
break;
+ case IEEE80211_PARAM_MAXRATE:
+ param[0] = vap->iv_maxrateindex;
+ break;
default:
return -EOPNOTSUPP;
}
@@ -5610,6 +5619,10 @@
0, IW_PRIV_TYPE_APPIEBUF, "getiebuf" },
{ IEEE80211_IOCTL_FILTERFRAME,
IW_PRIV_TYPE_FILTER , 0, "setfilter" },
+ {IEEE80211_PARAM_MAXRATE,
+ 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"},
#ifdef ATH_REVERSE_ENGINEERING
/*

View file

@ -0,0 +1,126 @@
Index: madwifi-trunk-r3314/ath/if_ath.c
===================================================================
--- madwifi-trunk-r3314.orig/ath/if_ath.c 2008-03-07 02:30:53.276363092 +0100
+++ madwifi-trunk-r3314/ath/if_ath.c 2008-03-07 02:32:12.584882631 +0100
@@ -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). */
Index: madwifi-trunk-r3314/ath_rate/minstrel/minstrel.c
===================================================================
--- madwifi-trunk-r3314.orig/ath_rate/minstrel/minstrel.c 2008-03-07 02:30:53.276363092 +0100
+++ madwifi-trunk-r3314/ath_rate/minstrel/minstrel.c 2008-03-07 02:32:12.584882631 +0100
@@ -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);
Index: madwifi-trunk-r3314/ath_rate/sample/sample.c
===================================================================
--- madwifi-trunk-r3314.orig/ath_rate/sample/sample.c 2008-03-07 02:30:53.280363321 +0100
+++ madwifi-trunk-r3314/ath_rate/sample/sample.c 2008-03-07 02:32:12.596883312 +0100
@@ -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);
Index: madwifi-trunk-r3314/net80211/ieee80211_ioctl.h
===================================================================
--- madwifi-trunk-r3314.orig/net80211/ieee80211_ioctl.h 2008-03-07 02:30:53.284363550 +0100
+++ madwifi-trunk-r3314/net80211/ieee80211_ioctl.h 2008-03-07 02:32:12.600883541 +0100
@@ -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)
Index: madwifi-trunk-r3314/net80211/ieee80211_var.h
===================================================================
--- madwifi-trunk-r3314.orig/net80211/ieee80211_var.h 2008-03-07 02:31:48.563513730 +0100
+++ madwifi-trunk-r3314/net80211/ieee80211_var.h 2008-03-07 02:32:12.604883771 +0100
@@ -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
Index: madwifi-trunk-r3314/net80211/ieee80211_wireless.c
===================================================================
--- madwifi-trunk-r3314.orig/net80211/ieee80211_wireless.c 2008-03-07 02:30:53.292364006 +0100
+++ madwifi-trunk-r3314/net80211/ieee80211_wireless.c 2008-03-07 02:32:12.604883771 +0100
@@ -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
/*