summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulan Hsu <julanhsu@google.com>2019-01-15 15:33:03 -0800
committerJohannes Berg <johannes.berg@intel.com>2019-01-19 09:56:22 +0100
commita8d418d9ac25f85a9caf652a4b2d07ec790474ab (patch)
tree7af06d1b9b6cfb7a31fea87b437bf8fcda51a6bc
parent67fc05549cdb39f9e02ec4af5cc94509b1f89754 (diff)
downloadlinux-a8d418d9ac25f85a9caf652a4b2d07ec790474ab.tar.gz
linux-a8d418d9ac25f85a9caf652a4b2d07ec790474ab.tar.bz2
linux-a8d418d9ac25f85a9caf652a4b2d07ec790474ab.zip
mac80211: mesh: only switch path when new metric is at least 10% better
This helps to reduce frequent path switches when multiple path candidates have the same or very similar path metrics. Signed-off-by: Julan Hsu <julanhsu@google.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-rw-r--r--net/mac80211/mesh_hwmp.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c
index f50409635a16..e00284afdda5 100644
--- a/net/mac80211/mesh_hwmp.c
+++ b/net/mac80211/mesh_hwmp.c
@@ -447,7 +447,10 @@ static u32 hwmp_route_info_get(struct ieee80211_sub_if_data *sdata,
(mpath->flags & MESH_PATH_SN_VALID)) {
if (SN_GT(mpath->sn, orig_sn) ||
(mpath->sn == orig_sn &&
- new_metric >= mpath->metric)) {
+ (rcu_access_pointer(mpath->next_hop) !=
+ sta ?
+ mult_frac(new_metric, 10, 9) :
+ new_metric) >= mpath->metric)) {
process = false;
fresh_info = false;
}
@@ -515,8 +518,10 @@ static u32 hwmp_route_info_get(struct ieee80211_sub_if_data *sdata,
if (mpath) {
spin_lock_bh(&mpath->state_lock);
if ((mpath->flags & MESH_PATH_FIXED) ||
- ((mpath->flags & MESH_PATH_ACTIVE) &&
- (last_hop_metric > mpath->metric)))
+ ((mpath->flags & MESH_PATH_ACTIVE) &&
+ ((rcu_access_pointer(mpath->next_hop) != sta ?
+ mult_frac(last_hop_metric, 10, 9) :
+ last_hop_metric) > mpath->metric)))
fresh_info = false;
} else {
mpath = mesh_path_add(sdata, ta);