Received: by 2002:a19:771d:0:0:0:0:0 with SMTP id s29csp1268238lfc; Wed, 1 Jun 2022 13:39:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwRwdigtiHso/7ksNo8vvus0/snBuFK7HgZnKl4dP3vDMbZSeZAdCH0qpzOz2CvzAl8Ue73 X-Received: by 2002:a62:d145:0:b0:51b:4376:e761 with SMTP id t5-20020a62d145000000b0051b4376e761mr1351649pfl.11.1654115946147; Wed, 01 Jun 2022 13:39:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654115946; cv=none; d=google.com; s=arc-20160816; b=yv+nNtZ7EsBzznqK6AfULPwVVmQ1kKF3ao+suwgtVv5WQkq7b4aLUTzrti8kPhknCt wLPXl0U55JU9gQXQY7hMC9mCofv759muqkSn6x8HuRPzJb3SP4wllj0IDO3bjlFO+s5f C7v05WfiUh7Q2zQy8IIfaKTwkKjqR0J1HpkaF021LLnWtCvMHjP0z/9qYsQeDBV12VFz dSD6cLcJvbR/SGGokUzTMGztotFuNzUFyunSuFj1447oJeQ80hziC+Urwm9dbCph8Krv zM93R3nvlJYiGUiIZjV3ZQse9QjNWx6ZVt0mNRKDxQOdYvsss6DIANtjMP94eJFCVQtc KioA== 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=ZpEZUbTyOlHdQb3s50ph6E8UgE+hAIWuG+XNzFNjdOE=; b=fdL1JytpDSiskTo9v4AIRvLAnD4C9ZH5x/MmHLA+UptxOG4MxkNhMlh9+cAeJE2nyM 0IdemBcpPPAd2Bm/ZIKoa+PZtB6I8jnRuGE2isYIPw8OLBjOKsFNmlyk1i7KFReHPx5X gMoqULZACRdStMLNc/Ui1u9t67685gSlqPvYLDQa6GeSeYEQkvMjbpg8RqBLgSosx44Q ZbMyJuUn5T81b2G2Pre6opuerShHTgu4rrd690Po/rrfBNB3UubS9EUsdJhdH4xq2oqO kmuvbSuE5oZzGXwkqAKKt9RBm7DGIb60bYtDv3andVYWIthswM+cPwKIEADOsjmWlIyc +YFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=BPMpKEix; spf=softfail (google.com: domain of transitioning linux-wireless-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id cd11-20020a056a00420b00b005191e2b27a5si3160014pfb.58.2022.06.01.13.39.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 13:39:06 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-wireless-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=BPMpKEix; spf=softfail (google.com: domain of transitioning linux-wireless-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9583928B5CA; Wed, 1 Jun 2022 12:47:34 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350118AbiFAHBe (ORCPT + 67 others); Wed, 1 Jun 2022 03:01:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241833AbiFAHBd (ORCPT ); Wed, 1 Jun 2022 03:01:33 -0400 Received: from alexa-out-sd-01.qualcomm.com (alexa-out-sd-01.qualcomm.com [199.106.114.38]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A22B54B853 for ; Wed, 1 Jun 2022 00:01:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1654066892; x=1685602892; h=from:to:cc:subject:date:message-id:mime-version; bh=ZpEZUbTyOlHdQb3s50ph6E8UgE+hAIWuG+XNzFNjdOE=; b=BPMpKEixV2hS6537UYzWBvW9Zdf8NFye1MkSlbkRNdANpp8QOXOR/MTN TsgHwUURNQMPmL4Z9HxUaiMxmZskmeR7feQrzh4OUcvPcZZXvmb+93D2a A8vw5eO6yULvxSYCP/0kGbmxMZH2KoxZCcC7rhZykUcVMBk62YcbLu0pl 4=; Received: from unknown (HELO ironmsg01-sd.qualcomm.com) ([10.53.140.141]) by alexa-out-sd-01.qualcomm.com with ESMTP; 01 Jun 2022 00:01:32 -0700 X-QCInternal: smtphost Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg01-sd.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Jun 2022 00:01:32 -0700 Received: from nalasex01a.na.qualcomm.com (10.47.209.196) by nasanex01c.na.qualcomm.com (10.47.97.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Wed, 1 Jun 2022 00:01:31 -0700 Received: from adisi-linux.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Wed, 1 Jun 2022 00:01:30 -0700 From: Aditya Kumar Singh To: CC: , Aditya Kumar Singh Subject: [PATCH] mac80211: fix mesh airtime link metric estimating Date: Wed, 1 Jun 2022 12:31:15 +0530 Message-ID: <20220601070115.24340-1-quic_adisi@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: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 ieee80211s_update_metric function uses sta_set_rate_info_tx function to get struct rate_info data from ieee80211_tx_rate struct, present in ieee80211_sta->tx_stats. However, drivers can skip tx rate calculation by setting rate idx as -1. Such drivers provides rate_info directly and hence ieee80211s metric is updated incorrectly since ieee80211_tx_rate has inconsistent data. Add fix to use rate_info directly if present instead of sta_set_rate_info_tx for updating ieee80211s metric. Signed-off-by: Aditya Kumar Singh --- net/mac80211/mesh_hwmp.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c index 44a6fdb6efbd..3c80e7b68298 100644 --- a/net/mac80211/mesh_hwmp.c +++ b/net/mac80211/mesh_hwmp.c @@ -310,7 +310,12 @@ void ieee80211s_update_metric(struct ieee80211_local *local, LINK_FAIL_THRESH) mesh_plink_broken(sta); - sta_set_rate_info_tx(sta, &sta->tx_stats.last_rate, &rinfo); + /* use rate info set by the driver directly if present */ + if (st->rate) + rinfo = sta->tx_stats.last_rate_info; + else + sta_set_rate_info_tx(sta, &sta->tx_stats.last_rate, &rinfo); + ewma_mesh_tx_rate_avg_add(&sta->mesh->tx_rate_avg, cfg80211_calculate_bitrate(&rinfo)); } -- 2.17.1