From patchwork Tue Jan 31 20:07:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Manoharan, Rajkumar" X-Patchwork-Id: 9548377 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7056660236 for ; Tue, 31 Jan 2017 20:11:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 62D1D26E47 for ; Tue, 31 Jan 2017 20:11:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 57B4A28249; Tue, 31 Jan 2017 20:11:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0F3B626E47 for ; Tue, 31 Jan 2017 20:11:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752190AbdAaULR (ORCPT ); Tue, 31 Jan 2017 15:11:17 -0500 Received: from wolverine01.qualcomm.com ([199.106.114.254]:17342 "EHLO wolverine01.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751913AbdAaULO (ORCPT ); Tue, 31 Jan 2017 15:11:14 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=qca.qualcomm.com; i=@qca.qualcomm.com; q=dns/txt; s=qcdkim; t=1485893474; x=1517429474; h=from:to:cc:subject:date:message-id:mime-version; bh=P5KTZvo2BYjyhHtfjzK/6uZzvMOIzCRaz0B5i9/YiUY=; b=IwVM2eA1uzphhmlnGShCaBgra1hjdDx7N/a9c5rg82jvlbWK3e2PDSV1 kMVesoUYjTXfPhetuo9GzGg4tXyqvuYv8wfdmJRYWdSmV0F6baeTTeuxQ rG0GcHoV0v+EvBMkm6zkW9IZl9ZIt49I4Id0DaZYfe1iPCw1GQmLjOlFu E=; X-IronPort-AV: E=Sophos;i="5.33,315,1477983600"; d="scan'208";a="259415820" Received: from ironmsg02-lv.qualcomm.com ([10.47.202.183]) by wolverine01.qualcomm.com with ESMTP; 31 Jan 2017 12:08:04 -0800 X-IronPort-AV: E=McAfee;i="5700,7163,8425"; a="36178961" Received: from nalasexr01h.na.qualcomm.com ([10.49.56.54]) by ironmsg02-lv.qualcomm.com with ESMTP/TLS/RC4-SHA; 31 Jan 2017 12:08:04 -0800 Received: from qcmail1.qualcomm.com (10.80.80.8) by NALASEXR01H.na.qualcomm.com (10.49.56.54) with Microsoft SMTP Server (TLS) id 15.0.1178.4; Tue, 31 Jan 2017 12:07:58 -0800 Received: by qcmail1.qualcomm.com (sSMTP sendmail emulation); Tue, 31 Jan 2017 12:07:57 -0800 From: Rajkumar Manoharan To: CC: , , Rajkumar Manoharan Subject: [PATCH v2 1/3] mac80211: fix mesh moving average stuck Date: Tue, 31 Jan 2017 12:07:50 -0800 Message-ID: <1485893272-6893-1-git-send-email-rmanohar@qca.qualcomm.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: NASANEXM01E.na.qualcomm.com (10.85.0.31) To NALASEXR01H.na.qualcomm.com (10.49.56.54) Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP As moving average is not considering fractional part after certain ratio, it will stuck at the same state. For example with current values, moving average stuck at 96 and it will not move forward. Fortunately current threshold is matching against 95%. If thresold is increased more than 96, mesh path never be deactivated under worst case. Fix failure average movement by bumping up average at stuck state. Signed-off-by: Rajkumar Manoharan --- net/mac80211/mesh_hwmp.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c index b747c9645e43..f0aa1da15bd0 100644 --- a/net/mac80211/mesh_hwmp.c +++ b/net/mac80211/mesh_hwmp.c @@ -300,6 +300,7 @@ void ieee80211s_update_metric(struct ieee80211_local *local, { struct ieee80211_tx_info *txinfo = IEEE80211_SKB_CB(skb); struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; + u32 fail_avg = sta->mesh->fail_avg; int failed; if (!ieee80211_is_data(hdr->frame_control)) @@ -308,8 +309,17 @@ void ieee80211s_update_metric(struct ieee80211_local *local, failed = !(txinfo->flags & IEEE80211_TX_STAT_ACK); /* moving average, scaled to 100 */ - sta->mesh->fail_avg = - ((80 * sta->mesh->fail_avg + 5) / 100 + 20 * failed); + fail_avg = ((80 * fail_avg + 5) / 100 + 20 * failed); + + /* bump up fail average since fractional part of average is ignored. + * Otherwise fail average always stuck at the same level and + * never moves forward. + */ + if (fail_avg && fail_avg == sta->mesh->fail_avg) + fail_avg++; + + sta->mesh->fail_avg = fail_avg; + if (sta->mesh->fail_avg > 95) mesh_plink_broken(sta); }