linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mac80211: mesh: only switch path when new metric is at least 10% better
@ 2019-01-15 23:33 julanhsu
  2019-01-17 12:29 ` Julian Calaby
  0 siblings, 1 reply; 2+ messages in thread
From: julanhsu @ 2019-01-15 23:33 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, Julan Hsu

From: Julan Hsu <julanhsu@google.com>

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>
---
 net/mac80211/mesh_hwmp.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c
index 6950cd0bf594..9ce75ef3e249 100644
--- a/net/mac80211/mesh_hwmp.c
+++ b/net/mac80211/mesh_hwmp.c
@@ -441,7 +441,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;
 				}
@@ -506,8 +509,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);
-- 
2.20.1.97.g81188d93c3-goog


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] mac80211: mesh: only switch path when new metric is at least 10% better
  2019-01-15 23:33 [PATCH] mac80211: mesh: only switch path when new metric is at least 10% better julanhsu
@ 2019-01-17 12:29 ` Julian Calaby
  0 siblings, 0 replies; 2+ messages in thread
From: Julian Calaby @ 2019-01-17 12:29 UTC (permalink / raw)
  To: julanhsu; +Cc: Johannes Berg, linux-wireless

Hi Julan,

On Thu, Jan 17, 2019 at 4:06 AM <julanhsu@google.com> wrote:
>
> From: Julan Hsu <julanhsu@google.com>
>
> This helps to reduce frequent path switches when multiple path
> candidates have the same or very similar path metrics.

Should this be configurable?

Thanks,

-- 
Julian Calaby

Email: julian.calaby@gmail.com
Profile: http://www.google.com/profiles/julian.calaby/

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-01-17 12:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-15 23:33 [PATCH] mac80211: mesh: only switch path when new metric is at least 10% better julanhsu
2019-01-17 12:29 ` Julian Calaby

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).