Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp3781671rwe; Mon, 17 Apr 2023 03:34:06 -0700 (PDT) X-Google-Smtp-Source: AKy350Z8wYvO6BftVm7axUYoZ5FsavMw6+t1f5KEEqvbDsH/+4ID1bjPs5RK6KXcaNlNKgUc6EYN X-Received: by 2002:a17:90a:b114:b0:247:6eda:a2ae with SMTP id z20-20020a17090ab11400b002476edaa2aemr6136560pjq.32.1681727645879; Mon, 17 Apr 2023 03:34:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681727645; cv=none; d=google.com; s=arc-20160816; b=ftZ3bdqImNvOUKzncnlgVYXsObbwcWO5QmmbHf3g6n4rqZbc9wUjkQqoPVjYKC1JBg HwT9DtUF44F7eGge7xEC8N5xJNLcQcHLZ4HbHTeXq84312XJM/BSQG+piRcAPtgFx6ML Nu3jmWJtzT2DUZLx4vK9WlmSkGyxH7RVx8c65Hr3mgM62pgBsB6EDeKH3wLwjswoM1Pt B+dvCgJRZBho4+0qLe2RtXRPt2h5dx3JPz2u7Tb6XEm3pTc2n9kw+mbSljhmwsajnG+5 GSrsP4BoCLVLWvrCy1AERD3fsolQF60ySdHpVfdfNK6ypMU5rsEVUio0W1sIJz8Lvd4I BFbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from :dkim-signature; bh=6ILMAxn2X9XASMKxX1f9QOUcK7H08mCJWvLaMaR6t70=; b=oky7eJVvsaFNxIPypGr7FYesmc+PyOcjANxfcluFOdxMxEimwiev0lKlaluci9yw1w EFkeZZEtTAcoiXm9/4EiS2Y9R7mctsxq7YMBkvN+XZnCmiXiZOMwnr6FwfwFkq1pbqyW gOyyN4HAadqM2cxd+SiicLcoL93MG6vDGTL1BorRIfgYJzUYzC5NlOc/t8sLQAKPxO+v KYxnFlyPpWaHRr1HXtGT8fQJG/6Ux2GnFce4txfmLcmGJmTF49kv8I2zre0MDORLtkzi C7Amu/23QVcPYFCKRFvLfSI9XL0oYbuY/1eLtx5MF/bS9d07qTaMsuXVxfUf2ticz8fE zcPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=ngaP4ViO; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d1-20020a17090abf8100b002473f9e8a19si8364163pjs.14.2023.04.17.03.33.57; Mon, 17 Apr 2023 03:34:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=ngaP4ViO; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230363AbjDQKc3 (ORCPT + 63 others); Mon, 17 Apr 2023 06:32:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229573AbjDQKc2 (ORCPT ); Mon, 17 Apr 2023 06:32:28 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5BA9683F7 for ; Mon, 17 Apr 2023 03:31:30 -0700 (PDT) Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33H9W3rj029823; Mon, 17 Apr 2023 10:03:11 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : mime-version : content-type; s=qcppdkim1; bh=6ILMAxn2X9XASMKxX1f9QOUcK7H08mCJWvLaMaR6t70=; b=ngaP4ViOTG55TQGWHE5nRcjI+6TUVdeCCMtQEZfsPbDwtDeLXFQRAZJo+7aDgz2ATJbe FbZBLSC5dEivLQfrRukG4l+wP97/GhHlWg2L5wmcDUjzxiixUv/xnL3Nz/kC9z2PA48c JeVq5RGvjZGR+VU49Obj3XXJ0JSJL3kuKaFPFArPZ/k73vNIF9Z3mpiCqzo5QqXX3fbQ aUdxNXO/QMyXKpIivSEqey4eumEBjhs/rO+zIJIQg8xVmHYY7UWNZlfkotQcisLgG6Of rUSBPgWdaHVoX5E8G7ZNcaJWHwNQQu5cHyyOkzIodiMz1b38dTAHRxobGmAwoZPVKTuJ 1Q== Received: from nasanppmta04.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3q12ut86px-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Apr 2023 10:03:11 +0000 Received: from nasanex01a.na.qualcomm.com (nasanex01a.na.qualcomm.com [10.52.223.231]) by NASANPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 33HA3AdE017163 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Apr 2023 10:03:10 GMT Received: from karm-linux.qualcomm.com (10.80.80.8) by nasanex01a.na.qualcomm.com (10.52.223.231) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.42; Mon, 17 Apr 2023 03:03:08 -0700 From: Karthik M To: CC: , Karthik M , Tamizh Chelvam Raja Subject: [PATCH v1] wifi: mac80211: Initialize EWMA fail avg to 1 Date: Mon, 17 Apr 2023 15:32:58 +0530 Message-ID: <20230417100258.22965-1-quic_karm@quicinc.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nasanex01a.na.qualcomm.com (10.52.223.231) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: c8h5C5AED0p8aj-cESSVHy0SoHx701mj X-Proofpoint-ORIG-GUID: c8h5C5AED0p8aj-cESSVHy0SoHx701mj X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-17_06,2023-04-14_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 spamscore=0 priorityscore=1501 mlxlogscore=999 lowpriorityscore=0 adultscore=0 phishscore=0 mlxscore=0 clxscore=1011 suspectscore=0 impostorscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304170089 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org If the average value in mesh metrics calculation has been rounded to 0 (success), this resets it to the smallest nonzero value (similarly to the initialization) to avoid a case where a single failure would result in an average value that goes beyond the value of 95 (Link Failure Threshold). Signed-off-by: Tamizh Chelvam Raja Signed-off-by: Karthik M --- Changes since v1: - Altered the comment to mention "mesh" and thershold value. - Checkpatch done --- net/mac80211/mesh_hwmp.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c index 9b1ce7c3925a..f89cbcf212d5 100644 --- a/net/mac80211/mesh_hwmp.c +++ b/net/mac80211/mesh_hwmp.c @@ -298,10 +298,23 @@ void ieee80211s_update_metric(struct ieee80211_local *local, { struct ieee80211_tx_info *txinfo = st->info; int failed; + u32 fail_avg; struct rate_info rinfo; failed = !(txinfo->flags & IEEE80211_TX_STAT_ACK); + fail_avg = ewma_mesh_fail_avg_read(&sta->mesh->fail_avg); + if (!fail_avg) { + /* If the average value in mesh metrics calculation + * has been rounded to 0 (success), this resets it to + * the smallest nonzero value (similarly to the initialization) + * to avoid a case where a single failure would result in + * an average value that goes beyond the value + * of 95 (Link Failure Threshold) + */ + ewma_mesh_fail_avg_add(&sta->mesh->fail_avg, 1); + } + /* moving average, scaled to 100. * feed failure as 100 and success as 0 */ -- 2.17.1