summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2008-04-21 03:45:39 +0000
committerFelix Fietkau <nbd@openwrt.org>2008-04-21 03:45:39 +0000
commit73663230c8534e9810da65abf54b9b2ab0d5699e (patch)
treee7770c4fcd919f4f58ca81d67b3c488d24f7aa5f
parent3e03e66d7a25aa8a73d40874e74d0e28d41de505 (diff)
downloadmtk-20170518-73663230c8534e9810da65abf54b9b2ab0d5699e.zip
mtk-20170518-73663230c8534e9810da65abf54b9b2ab0d5699e.tar.gz
mtk-20170518-73663230c8534e9810da65abf54b9b2ab0d5699e.tar.bz2
madwifi: add configurable rssi threshold and timeout values for protection mode the 11b protection mode can harm throughput a lot, so let's make sure that it is only active as long as it needs to be.
SVN-Revision: 10899
-rw-r--r--package/madwifi/patches/346-protmode_trig.patch139
1 files changed, 139 insertions, 0 deletions
diff --git a/package/madwifi/patches/346-protmode_trig.patch b/package/madwifi/patches/346-protmode_trig.patch
new file mode 100644
index 0000000..cf28aaa
--- /dev/null
+++ b/package/madwifi/patches/346-protmode_trig.patch
@@ -0,0 +1,139 @@
+Index: madwifi-trunk-r3314/net80211/ieee80211.c
+===================================================================
+--- madwifi-trunk-r3314.orig/net80211/ieee80211.c 2008-04-21 05:22:20.000000000 +0200
++++ madwifi-trunk-r3314/net80211/ieee80211.c 2008-04-21 05:23:46.000000000 +0200
+@@ -333,7 +333,9 @@
+ IEEE80211_MS_TO_TU(IEEE80211_BMISSTHRESH_DEFAULT_MS),
+ ic->ic_lintval), ic->ic_lintval);
+ }
+-
++ ic->ic_protmode_timeout = IEEE80211_PROTMODE_TIMEOUT;
++ ic->ic_protmode_rssi = IEEE80211_PROTMODE_RSSITHR;
++
+ IEEE80211_LOCK_INIT(ic, "ieee80211com");
+ IEEE80211_VAPS_LOCK_INIT(ic, "ieee80211com_vaps");
+ TAILQ_INIT(&ic->ic_vaps);
+Index: madwifi-trunk-r3314/net80211/ieee80211_input.c
+===================================================================
+--- madwifi-trunk-r3314.orig/net80211/ieee80211_input.c 2008-04-21 05:22:32.000000000 +0200
++++ madwifi-trunk-r3314/net80211/ieee80211_input.c 2008-04-21 05:23:46.000000000 +0200
+@@ -3412,16 +3412,32 @@
+ IEEE80211_IS_CHAN_ANYG(ic->ic_curchan)) {
+
+ /* Assume no ERP IE == 11b AP */
+- if ((!has_erp || (has_erp && (scan.erp & IEEE80211_ERP_NON_ERP_PRESENT))) &&
+- !(ic->ic_flags & IEEE80211_F_USEPROT)) {
++ if ((!has_erp || (has_erp &&
++ (scan.erp & IEEE80211_ERP_NON_ERP_PRESENT))) &&
++ (rssi > ic->ic_protmode_rssi)) {
+ struct ieee80211vap *tmpvap;
+
+- ic->ic_flags |= IEEE80211_F_USEPROT;
+- TAILQ_FOREACH(tmpvap, &ic->ic_vaps, iv_next) {
+- tmpvap->iv_flags_ext |= IEEE80211_FEXT_ERPUPDATE;
++ if (!(ic->ic_flags & IEEE80211_F_USEPROT)) {
++ ic->ic_flags |= IEEE80211_F_USEPROT;
++ TAILQ_FOREACH(tmpvap, &ic->ic_vaps, iv_next) {
++ tmpvap->iv_flags_ext |= IEEE80211_FEXT_ERPUPDATE;
++ }
+ }
++ ic->ic_protmode_lasttrig = jiffies;
+ }
+ }
++ if ((ic->ic_flags & IEEE80211_F_USEPROT) &&
++ (ic->ic_protmode_lasttrig + ic->ic_protmode_timeout * HZ <
++ jiffies)) {
++ struct ieee80211vap *tmpvap;
++
++ /* expire protection mode */
++ ic->ic_flags &= ~IEEE80211_F_USEPROT;
++ TAILQ_FOREACH(tmpvap, &ic->ic_vaps, iv_next) {
++ tmpvap->iv_flags_ext |= IEEE80211_FEXT_ERPUPDATE;
++ }
++ }
++
+
+ /*
+ * If scanning, just pass information to the scan module.
+Index: madwifi-trunk-r3314/net80211/ieee80211_ioctl.h
+===================================================================
+--- madwifi-trunk-r3314.orig/net80211/ieee80211_ioctl.h 2008-04-21 05:22:20.000000000 +0200
++++ madwifi-trunk-r3314/net80211/ieee80211_ioctl.h 2008-04-21 05:23:46.000000000 +0200
+@@ -643,6 +643,8 @@
+ 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) */
++ IEEE80211_PARAM_PROTMODE_RSSI = 77, /* RSSI Threshold for enabling protection mode */
++ IEEE80211_PARAM_PROTMODE_TIMEOUT = 78, /* Timeout for expiring protection mode */
+ };
+
+ #define SIOCG80211STATS (SIOCDEVPRIVATE+2)
+Index: madwifi-trunk-r3314/net80211/ieee80211_var.h
+===================================================================
+--- madwifi-trunk-r3314.orig/net80211/ieee80211_var.h 2008-04-21 05:22:20.000000000 +0200
++++ madwifi-trunk-r3314/net80211/ieee80211_var.h 2008-04-21 05:41:45.000000000 +0200
+@@ -128,6 +128,9 @@
+
+ #define IEEE80211_APPIE_MAX 1024
+
++#define IEEE80211_PROTMODE_RSSITHR 15 /* default rssi threshold for protection mode trigger */
++#define IEEE80211_PROTMODE_TIMEOUT 30 /* timeout for keeping protection mode alive */
++
+ #define IEEE80211_PWRCONSTRAINT_VAL(ic) \
+ (((ic)->ic_bsschan->ic_maxregpower > (ic)->ic_curchanmaxpwr) ? \
+ (ic)->ic_bsschan->ic_maxregpower - (ic)->ic_curchanmaxpwr : 0)
+@@ -324,6 +327,9 @@
+ u_int16_t ic_newtxpowlimit; /* tx power limit to change to (in 0.5 dBm) */
+ u_int16_t ic_uapsdmaxtriggers; /* max triggers that could arrive */
+ u_int8_t ic_coverageclass; /* coverage class */
++ u_int8_t ic_protmode_rssi; /* rssi threshold for protection mode */
++ u_int64_t ic_protmode_lasttrig; /* last trigger for protection mode */
++ u_int16_t ic_protmode_timeout; /* protection mode timeout */
+
+ /* Channel state:
+ *
+Index: madwifi-trunk-r3314/net80211/ieee80211_wireless.c
+===================================================================
+--- madwifi-trunk-r3314.orig/net80211/ieee80211_wireless.c 2008-04-21 05:22:20.000000000 +0200
++++ madwifi-trunk-r3314/net80211/ieee80211_wireless.c 2008-04-21 05:23:46.000000000 +0200
+@@ -2312,6 +2312,12 @@
+ IEEE80211_IS_CHAN_ANYG(ic->ic_bsschan))
+ retv = ENETRESET;
+ break;
++ case IEEE80211_PARAM_PROTMODE_TIMEOUT:
++ ic->ic_protmode_timeout = value;
++ break;
++ case IEEE80211_PARAM_PROTMODE_RSSI:
++ ic->ic_protmode_rssi = value;
++ break;
+ case IEEE80211_PARAM_MCASTCIPHER:
+ if ((vap->iv_caps & cipher2cap(value)) == 0 &&
+ !ieee80211_crypto_available(vap, value))
+@@ -2955,6 +2961,12 @@
+ case IEEE80211_PARAM_PROTMODE:
+ param[0] = ic->ic_protmode;
+ break;
++ case IEEE80211_PARAM_PROTMODE_TIMEOUT:
++ param[0] = ic->ic_protmode_timeout;
++ break;
++ case IEEE80211_PARAM_PROTMODE_RSSI:
++ param[0] = ic->ic_protmode_rssi;
++ break;
+ case IEEE80211_PARAM_MCASTCIPHER:
+ param[0] = rsn->rsn_mcastcipher;
+ break;
+@@ -5346,6 +5358,14 @@
+ IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "protmode" },
+ { IEEE80211_PARAM_PROTMODE,
+ 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "get_protmode" },
++ { IEEE80211_PARAM_PROTMODE_RSSI,
++ IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "protrssi" },
++ { IEEE80211_PARAM_PROTMODE_RSSI,
++ 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "get_protrssi" },
++ { IEEE80211_PARAM_PROTMODE_TIMEOUT,
++ IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "prottime" },
++ { IEEE80211_PARAM_PROTMODE_TIMEOUT,
++ 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "get_prottime" },
+ { IEEE80211_PARAM_MCASTCIPHER,
+ IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "mcastcipher" },
+ { IEEE80211_PARAM_MCASTCIPHER,