1 Add an optional threshold for low-rssi disconnection. This can be useful
2 when letting wpa_supplicant control roaming.
4 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
6 --- a/net80211/ieee80211_ioctl.h
7 +++ b/net80211/ieee80211_ioctl.h
9 IEEE80211_PARAM_PROTMODE_RSSI = 77, /* RSSI Threshold for enabling protection mode */
10 IEEE80211_PARAM_PROTMODE_TIMEOUT = 78, /* Timeout for expiring protection mode */
11 IEEE80211_PARAM_BGSCAN_THRESH = 79, /* bg scan rssi threshold */
12 + IEEE80211_PARAM_RSSI_DIS_THR = 80, /* rssi threshold for disconnection */
13 + IEEE80211_PARAM_RSSI_DIS_COUNT = 81, /* counter for rssi threshold */
16 #define SIOCG80211STATS (SIOCDEVPRIVATE+2)
17 --- a/net80211/ieee80211_wireless.c
18 +++ b/net80211/ieee80211_wireless.c
19 @@ -2798,6 +2798,12 @@
20 case IEEE80211_PARAM_ROAM_RATE_11G:
21 vap->iv_roam.rate11b = value;
23 + case IEEE80211_PARAM_RSSI_DIS_THR:
24 + vap->iv_rssi_dis_thr = value;
26 + case IEEE80211_PARAM_RSSI_DIS_COUNT:
27 + vap->iv_rssi_dis_max = value;
29 case IEEE80211_PARAM_UAPSDINFO:
30 if (vap->iv_opmode == IEEE80211_M_HOSTAP) {
31 if (ic->ic_caps & IEEE80211_C_UAPSD) {
32 @@ -3183,6 +3189,12 @@
33 case IEEE80211_PARAM_ROAM_RATE_11G:
34 param[0] = vap->iv_roam.rate11b;
36 + case IEEE80211_PARAM_RSSI_DIS_THR:
37 + param[0] = vap->iv_rssi_dis_thr;
39 + case IEEE80211_PARAM_RSSI_DIS_COUNT:
40 + param[0] = vap->iv_rssi_dis_max;
42 case IEEE80211_PARAM_UAPSDINFO:
43 if (vap->iv_opmode == IEEE80211_M_HOSTAP) {
44 if (IEEE80211_VAP_UAPSD_ENABLED(vap))
45 @@ -5732,6 +5744,14 @@
46 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "rate11g" },
47 { IEEE80211_PARAM_ROAM_RATE_11G,
48 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "get_rate11g" },
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 @@ -3263,6 +3263,17 @@
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);
74 + vap->iv_rssi_dis_trig = 0;
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
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 */