use the Download/ macro to get ACX firmwares
[openwrt.git] / package / madwifi / patches-testing / 327-rssi_disconnect.patch
1 Add an optional threshold for low-rssi disconnection. This can be useful
2 when letting wpa_supplicant control roaming.
3
4 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
5
6 --- a/net80211/ieee80211_ioctl.h
7 +++ b/net80211/ieee80211_ioctl.h
8 @@ -656,6 +656,8 @@
9 IEEE80211_PARAM_PROTMODE_RSSI = 85, /* RSSI Threshold for enabling protection mode */
10 IEEE80211_PARAM_PROTMODE_TIMEOUT = 86, /* Timeout for expiring protection mode */
11 IEEE80211_PARAM_BGSCAN_THRESH = 87, /* bg scan rssi threshold */
12 + IEEE80211_PARAM_RSSI_DIS_THR = 88, /* rssi threshold for disconnection */
13 + IEEE80211_PARAM_RSSI_DIS_COUNT = 89, /* counter for rssi threshold */
14 };
15
16 #define SIOCG80211STATS (SIOCDEVPRIVATE+2)
17 --- a/net80211/ieee80211_wireless.c
18 +++ b/net80211/ieee80211_wireless.c
19 @@ -2832,6 +2832,12 @@
20 case IEEE80211_PARAM_ROAM_RATE_11G:
21 vap->iv_roam.rate11g = value;
22 break;
23 + case IEEE80211_PARAM_RSSI_DIS_THR:
24 + vap->iv_rssi_dis_thr = value;
25 + break;
26 + case IEEE80211_PARAM_RSSI_DIS_COUNT:
27 + vap->iv_rssi_dis_max = value;
28 + break;
29 case IEEE80211_PARAM_UAPSDINFO:
30 if (vap->iv_opmode == IEEE80211_M_HOSTAP) {
31 if (ic->ic_caps & IEEE80211_C_UAPSD) {
32 @@ -3220,6 +3226,12 @@
33 case IEEE80211_PARAM_ROAM_RATE_11G:
34 param[0] = vap->iv_roam.rate11g;
35 break;
36 + case IEEE80211_PARAM_RSSI_DIS_THR:
37 + param[0] = vap->iv_rssi_dis_thr;
38 + break;
39 + case IEEE80211_PARAM_RSSI_DIS_COUNT:
40 + param[0] = vap->iv_rssi_dis_max;
41 + break;
42 case IEEE80211_PARAM_UAPSDINFO:
43 if (vap->iv_opmode == IEEE80211_M_HOSTAP) {
44 if (IEEE80211_VAP_UAPSD_ENABLED(vap))
45 @@ -5770,6 +5782,14 @@
46 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "rate11g_x2" },
47 { IEEE80211_PARAM_ROAM_RATE_11G,
48 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "get_rate11g_x2" },
49 + { IEEE80211_PARAM_RSSI_DIS_THR,
50 + IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "rssi_disthr" },
51 + { IEEE80211_PARAM_RSSI_DIS_THR,
52 + 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "get_rssi_disthr" },
53 + { IEEE80211_PARAM_RSSI_DIS_COUNT,
54 + IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "rssi_discnt" },
55 + { IEEE80211_PARAM_RSSI_DIS_COUNT,
56 + 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "get_rssi_discnt" },
57 { IEEE80211_PARAM_UAPSDINFO,
58 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "uapsd" },
59 { IEEE80211_PARAM_UAPSDINFO,
60 --- a/net80211/ieee80211_input.c
61 +++ b/net80211/ieee80211_input.c
62 @@ -3234,6 +3234,17 @@
63
64 /* When rssi is low, start doing bgscans more frequently to allow
65 * the supplicant to make a better switching decision */
66 + if ((vap->iv_rssi_dis_thr > 0) && (vap->iv_rssi_dis_max > 0)) {
67 + if ((rssi > 0) && (rssi < vap->iv_rssi_dis_thr)) {
68 + if (++vap->iv_rssi_dis_trig > vap->iv_rssi_dis_max) {
69 + vap->iv_rssi_dis_trig = 0;
70 + ieee80211_node_leave(ni);
71 + return 0;
72 + }
73 + } else {
74 + vap->iv_rssi_dis_trig = 0;
75 + }
76 + }
77 if ((rssi < vap->iv_bgscanthr) &&
78 (!vap->iv_bgscanthr_next ||
79 !time_before(jiffies, vap->iv_bgscanthr_next)) &&
80 --- a/net80211/ieee80211_var.h
81 +++ b/net80211/ieee80211_var.h
82 @@ -233,6 +233,9 @@
83 u_int iv_bgscanintvl; /* bg scan min interval */
84 u_int iv_bgscanthr; /* bg scan rssi threshold */
85 u_int iv_bgscantrintvl; /* bg scan trigger interval */
86 + u_int iv_rssi_dis_thr; /* rssi disassoc threshold */
87 + u_int iv_rssi_dis_max; /* max beacons below disconnect threshold */
88 + u_int iv_rssi_dis_trig; /* rssi disassoc trigger count */
89 unsigned long iv_bgscanthr_next; /* last trigger for bgscan */
90 u_int iv_scanvalid; /* scan cache valid threshold */
91 struct ieee80211_roam iv_roam; /* sta-mode roaming state */
This page took 0.048247 seconds and 5 git commands to generate.