{nl,cfg}80211: make peer link expiration time configurable
Subsystems (2)
PATCH 1/2 {nl,cfg}80211: make peer link expiration time configurable
If a STA has a peer that it hasn't seen any tx activity from for a certain length of time, the peer link is expired. This means the inactive STA is removed from the list of peers and that STA is not considered a peer again unless it re-peers. Previously, this inactivity time was always 30 minutes. Now, add it to the mesh configuration and allow it to be configured. Retain 30 minutes as a default value.
--- include/net/cfg80211.h | 4 ++++ include/uapi/linux/nl80211.h | 5 +++++ net/wireless/mesh.c | 2 ++ net/wireless/nl80211.c | 8 +++++++- 4 files changed, 18 insertions(+), 1 deletion(-)
include/net/cfg80211.h +4 -0
@@ -1108,6 +1108,9 @@ struct bss_parameters {* setting for new peer links. * @dot11MeshAwakeWindowDuration: The duration in TUs the STA will remain awake * after transmitting its beacon. +* @plink_timeout: If no tx activity is seen from a STA we've established +* peering with for longer than this time (in seconds), then remove it +* from the STA's list of peers. Default is 30 minutes. */ struct mesh_config {u16 dot11MeshRetryTimeout;
@@ -1137,6 +1140,7 @@ struct mesh_config {u16 dot11MeshHWMPconfirmationInterval;enum nl80211_mesh_power_mode power_mode;u16 dot11MeshAwakeWindowDuration; +u32 plink_timeout; };/**
include/uapi/linux/nl80211.h +5 -0
@@ -2559,6 +2559,10 @@ enum nl80211_mesh_power_mode {* * @NL80211_MESHCONF_AWAKE_WINDOW: awake window duration (in TUs) * +* @NL80211_MESHCONF_PLINK_TIMEOUT: If no tx activity is seen from a STA we've +* established peering with for longer than this time (in seconds), then +* remove it from the STA's list of peers. Default is 30 minutes. +* * @__NL80211_MESHCONF_ATTR_AFTER_LAST: internal use */ enum nl80211_meshconf_params {
@@ -2590,6 +2594,7 @@ enum nl80211_meshconf_params {NL80211_MESHCONF_HWMP_CONFIRMATION_INTERVAL ,NL80211_MESHCONF_POWER_MODE ,NL80211_MESHCONF_AWAKE_WINDOW , +NL80211_MESHCONF_PLINK_TIMEOUT ,/* keep last */ __NL80211_MESHCONF_ATTR_AFTER_LAST,
net/wireless/mesh.c +2 -0
@@ -18,6 +18,7 @@#define MESH_PATH_TO_ROOT_TIMEOUT 6000#define MESH_ROOT_INTERVAL 5000#define MESH_ROOT_CONFIRMATION_INTERVAL 2000 +#define MESH_DEFAULT_PLINK_TIMEOUT 1800/* timeout in seconds */ /* * Minimum interval between two consecutive PREQs originated by the same
@@ -75,6 +76,7 @@ const struct mesh_config default_mesh_config = { .dot11MeshHWMPconfirmationInterval = MESH_ROOT_CONFIRMATION_INTERVAL, .power_mode = NL80211_MESH_POWER_ACTIVE, .dot11MeshAwakeWindowDuration = MESH_DEFAULT_AWAKE_WINDOW, + .plink_timeout = MESH_DEFAULT_PLINK_TIMEOUT, };const struct mesh_setup default_mesh_setup = {
net/wireless/nl80211.c +7 -1
@@ -4585,7 +4585,9 @@ static int nl80211_get_mesh_config(struct sk_buff *skb,nla_put_u32 (msg,NL80211_MESHCONF_POWER_MODE , cur_params.power_mode) ||nla_put_u16 (msg,NL80211_MESHCONF_AWAKE_WINDOW , - cur_params.dot11MeshAwakeWindowDuration)) + cur_params.dot11MeshAwakeWindowDuration) || +nla_put_u32 (msg,NL80211_MESHCONF_PLINK_TIMEOUT , + cur_params.plink_timeout)) goto nla_put_failure;nla_nest_end (msg, pinfoattr);genlmsg_end (msg, hdr);
@@ -4626,6 +4628,7 @@ static const struct nla_policy nl80211_meshconf_params_policy[NL80211_MESHCONF_A [NL80211_MESHCONF_HWMP_CONFIRMATION_INTERVAL] = { .type = NLA_U16 }, [NL80211_MESHCONF_POWER_MODE] = { .type = NLA_U32 }, [NL80211_MESHCONF_AWAKE_WINDOW] = { .type = NLA_U16 }, + [NL80211_MESHCONF_PLINK_TIMEOUT] = { .type = NLA_U32 }, }; static const struct nla_policy
@@ -4762,6 +4765,9 @@ do { \FILL_IN_MESH_PARAM_IF_SET (tb, cfg, dot11MeshAwakeWindowDuration,0 ,65535 , mask,NL80211_MESHCONF_AWAKE_WINDOW , nla_get_u16); +FILL_IN_MESH_PARAM_IF_SET (tb, cfg, plink_timeout,1 ,0xffffffff , + mask,NL80211_MESHCONF_PLINK_TIMEOUT , + nla_get_u32);if (mask_out) *mask_out = mask;
Signature · 1 line
1.7.9.5
PATCH 2/2 mac80211: expire mesh peers based on mesh configuration
The time it takes to see the peer link expire may differ by a minute since sta_expire() is run once a minute as a mesh housekeeping task.
--- net/mac80211/cfg.c | 2 ++ net/mac80211/mesh.c | 2 +- net/mac80211/mesh.h | 1 - 3 files changed, 3 insertions(+), 2 deletions(-)
net/mac80211/cfg.c +2 -0
@@ -1856,6 +1856,8 @@ static int ieee80211_update_mesh_config(struct wiphy *wiphy,if (_chg_mesh_attr (NL80211_MESHCONF_AWAKE_WINDOW , mask)) conf->dot11MeshAwakeWindowDuration = nconf->dot11MeshAwakeWindowDuration; +if (_chg_mesh_attr (NL80211_MESHCONF_PLINK_TIMEOUT , mask)) + conf->plink_timeout = nconf->plink_timeout;ieee80211_mbss_info_change_notify (sdata,BSS_CHANGED_BEACON );return 0 ; }
net/mac80211/mesh.c +1 -1
@@ -573,7 +573,7 @@ static void ieee80211_mesh_housekeeping(struct ieee80211_sub_if_data *sdata)struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;u32 changed; -ieee80211_sta_expire (sdata,IEEE80211_MESH_PEER_INACTIVITY_LIMIT ); +ieee80211_sta_expire (sdata, ifmsh->mshcfg.plink_timeout *HZ );mesh_path_expire (sdata); changed =mesh_accept_plinks_update (sdata);
net/mac80211/mesh.h +0 -1
@@ -188,7 +188,6 @@ struct mesh_rmc {u32 idx_mask; }; -#define IEEE80211_MESH_PEER_INACTIVITY_LIMIT (1800 * HZ)#define IEEE80211_MESH_HOUSEKEEPING_INTERVAL (60 * HZ)#define MESH_PATH_EXPIRE (600 * HZ)
Signature · 1 line
1.7.9.5
Johannes Berg
maintainerQuoted 8 lines · Colleen Twitty
If a STA has a peer that it hasn't seen any tx activity from for a certain length of time, the peer link is expired. This means the inactive STA is removed from the list of peers and that STA is not considered a peer again unless it re-peers. Previously, this inactivity time was always 30 minutes. Now, add it to the mesh configuration and allow it to be configured. Retain 30 minutes as a default value.
Applied both.
johannes