From patchwork Sat Jan 28 00:01:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Manoharan, Rajkumar" X-Patchwork-Id: 9542899 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 AA41D60415 for ; Sat, 28 Jan 2017 00:03:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9F4A927F93 for ; Sat, 28 Jan 2017 00:03:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 93DE5281C3; Sat, 28 Jan 2017 00:03:38 +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 15A1827F93 for ; Sat, 28 Jan 2017 00:03:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751411AbdA1ADf (ORCPT ); Fri, 27 Jan 2017 19:03:35 -0500 Received: from wolverine02.qualcomm.com ([199.106.114.251]:38458 "EHLO wolverine02.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751119AbdA1ACP (ORCPT ); Fri, 27 Jan 2017 19:02:15 -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=1485561735; x=1517097735; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=ovz5OfnhbFPuxkRY9HNf4Rwz/8DgGWYDpZNF8BdEens=; b=gk/AEao6VHNRuxWmNi4cWdNAQnSef3j1+6l2MV9tZ9YVH8DiFXxIUKWl atOfd3DKZt4Yllzeazv6ZjwImuNaHcXlORHmTiXhhkqJ9sigmJYaNnN8a SXTpbisrKOt1U6gFntRz6w+LvhrdwmTGWi7ZO9zwWIqml5r5t6e5oz1vj 4=; X-IronPort-AV: E=Sophos;i="5.33,298,1477983600"; d="scan'208";a="354168819" Received: from ironmsg02-lv.qualcomm.com ([10.47.202.183]) by wolverine02.qualcomm.com with ESMTP; 27 Jan 2017 16:02:14 -0800 X-IronPort-AV: E=McAfee;i="5700,7163,8421"; a="36167822" Received: from nalasexr01h.na.qualcomm.com ([10.49.56.54]) by ironmsg02-lv.qualcomm.com with ESMTP/TLS/RC4-SHA; 27 Jan 2017 16:01:59 -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; Fri, 27 Jan 2017 16:01:57 -0800 Received: by qcmail1.qualcomm.com (sSMTP sendmail emulation); Fri, 27 Jan 2017 16:01:57 -0800 From: Rajkumar Manoharan To: CC: , , Rajkumar Manoharan Subject: [PATCH 2/3] mac80211: Make mesh failure moving average configurable Date: Fri, 27 Jan 2017 16:01:47 -0800 Message-ID: <1485561708-31559-2-git-send-email-rmanohar@qca.qualcomm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1485561708-31559-1-git-send-email-rmanohar@qca.qualcomm.com> References: <1485561708-31559-1-git-send-email-rmanohar@qca.qualcomm.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: NASANEXM01C.na.qualcomm.com (10.85.0.83) 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 Currently mesh moving fail average is calculated based on constant weight factor. In worst case moving average reaches threshold by considering 16 msdu tx ack status and deactivates mesh path. Having a constant weight factor might not be suitable for all environments. So make it tunable parameter and also lower default weight to 10 so that mesh broken link calculation will consider more packet status (32 msdus ack status) before dropping mesh path. In OTA 2-hop topolgy (MP1 <-> MP2 <-> MP3), while running TCP traffic of window size of 2M where each nodes are operating in VHT80 mode, mesh path between forwarding node (MP2) and border nodes (MP1/MP3) is deactivated more often when average weight is 20. Signed-off-by: Rajkumar Manoharan --- net/mac80211/debugfs_netdev.c | 27 +++++++++++++++++++++++++++ net/mac80211/ieee80211_i.h | 1 + net/mac80211/mesh.c | 1 + net/mac80211/mesh.h | 3 +++ net/mac80211/mesh_hwmp.c | 4 +++- 5 files changed, 35 insertions(+), 1 deletion(-) diff --git a/net/mac80211/debugfs_netdev.c b/net/mac80211/debugfs_netdev.c index 8f5fff8b2040..3923401a85dd 100644 --- a/net/mac80211/debugfs_netdev.c +++ b/net/mac80211/debugfs_netdev.c @@ -586,6 +586,32 @@ static ssize_t ieee80211_if_parse_tsf( #ifdef CONFIG_MAC80211_MESH IEEE80211_IF_FILE(estab_plinks, u.mesh.estab_plinks, ATOMIC); +static ssize_t ieee80211_if_fmt_fail_avg_weight( + const struct ieee80211_sub_if_data *sdata, char *buf, int buflen) +{ + return snprintf(buf, buflen, "%d\n", sdata->u.mesh.fail_avg_weight); +} + +static ssize_t ieee80211_if_parse_fail_avg_weight( + struct ieee80211_sub_if_data *sdata, const char *buf, int buflen) +{ + u8 val; + int ret; + + ret = kstrtou8(buf, 0, &val); + if (ret) + return ret; + + if (val > 100) + return -ERANGE; + + sdata->u.mesh.fail_avg_weight = val; + + return buflen; +} + +IEEE80211_IF_FILE_RW(fail_avg_weight); + /* Mesh stats attributes */ IEEE80211_IF_FILE(fwded_mcast, u.mesh.mshstats.fwded_mcast, DEC); IEEE80211_IF_FILE(fwded_unicast, u.mesh.mshstats.fwded_unicast, DEC); @@ -711,6 +737,7 @@ static void add_mesh_files(struct ieee80211_sub_if_data *sdata) { DEBUGFS_ADD_MODE(tsf, 0600); DEBUGFS_ADD_MODE(estab_plinks, 0400); + DEBUGFS_ADD_MODE(fail_avg_weight, 0600); } static void add_mesh_stats(struct ieee80211_sub_if_data *sdata) diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index 159a1a733725..30babcea3e06 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h @@ -711,6 +711,7 @@ struct ieee80211_if_mesh { struct mesh_table *mpp_paths; /* Store paths for MPP&MAP */ int mesh_paths_generation; int mpp_paths_generation; + u8 fail_avg_weight; }; #ifdef CONFIG_MAC80211_MESH diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c index 9c23172feba0..491fd76f91bd 100644 --- a/net/mac80211/mesh.c +++ b/net/mac80211/mesh.c @@ -1368,6 +1368,7 @@ void ieee80211_mesh_init_sdata(struct ieee80211_sub_if_data *sdata) ifmsh->last_preq = jiffies; ifmsh->next_perr = jiffies; ifmsh->csa_role = IEEE80211_MESH_CSA_ROLE_NONE; + ifmsh->fail_avg_weight = MESH_FAIL_AVG_WEIGHT; /* Allocate all mesh structures when creating the first mesh interface. */ if (!mesh_allocated) ieee80211s_init(); diff --git a/net/mac80211/mesh.h b/net/mac80211/mesh.h index 7e5f271e3c30..887746022cc6 100644 --- a/net/mac80211/mesh.h +++ b/net/mac80211/mesh.h @@ -185,6 +185,9 @@ struct mesh_rmc { /* Number of frames buffered per destination for unresolved destinations */ #define MESH_FRAME_QUEUE_LEN 10 +/* Moving failure average weight of mesh peer link (in percent) */ +#define MESH_FAIL_AVG_WEIGHT 10 + /* Public interfaces */ /* Various */ int ieee80211_fill_mesh_addresses(struct ieee80211_hdr *hdr, __le16 *fc, diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c index f0aa1da15bd0..61a824eb2c73 100644 --- a/net/mac80211/mesh_hwmp.c +++ b/net/mac80211/mesh_hwmp.c @@ -301,6 +301,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; + u8 fail_avg_weight = sta->sdata->u.mesh.fail_avg_weight; int failed; if (!ieee80211_is_data(hdr->frame_control)) @@ -309,7 +310,8 @@ void ieee80211s_update_metric(struct ieee80211_local *local, failed = !(txinfo->flags & IEEE80211_TX_STAT_ACK); /* moving average, scaled to 100 */ - fail_avg = ((80 * fail_avg + 5) / 100 + 20 * failed); + fail_avg = (((100 - fail_avg_weight) * fail_avg + 5) / 100 + + fail_avg_weight * failed); /* bump up fail average since fractional part of average is ignored. * Otherwise fail average always stuck at the same level and