Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp9449986ybc; Sat, 30 Nov 2019 07:32:46 -0800 (PST) X-Google-Smtp-Source: APXvYqxB+kzMy8lDnLcpDeR5OFa+QQCPVbohWVS/MLLI/tpTwcUM0C2/Zyfb0VZby73C4Wo+FvpF X-Received: by 2002:a50:8c63:: with SMTP id p90mr851861edp.12.1575127965977; Sat, 30 Nov 2019 07:32:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575127965; cv=none; d=google.com; s=arc-20160816; b=eIhlol0aYmjPnCD9FZSiKwHbo6GOJSdZkx6kEphc3JczUIqgKrzrOsTeKw2Tn9oVjt u4SmHKRA+TtL2WSH1lCO57Ct1uGSbVIxxTAD71Yr5iC2q37WCzeUEYmnNFu8d5izcJ5O aQN9/T+nDybsBxwTyYznE9pyFm1u7cy8eU8X2cKgZVTMduB8KaiLJRGpoKdguUhsFCbV XVpbm0sXpEGZnoJUW+LRcvXdUGkva2QIsERKNVgd/r02jgSV0uXqQIFqWUSDaQFh/tpV rXVdVqYVJ8MGqoG3DiQz8fGkOqiFj99ZMX0ali01Y+o0SS6MlUTPUxyuwcc8jJqxRZqL fC1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=cpKpPx5M3OPk2FzU0fWLRScfIUbiOPAbcxIzpFkCKm8=; b=acmRtOlM2k/ZBzD90ZMUPRd5dn3XvNphPKJIIqwKQIXa3GWUh6GyzTgdxidWsoJZEZ DMFx8eqB8CWL/9j0B7zuleJbcpMsqGInW3qU4sgwSLK9XS2bikLKzt9ANZ2+GAXDpbWY 2yIGEabx6YgPMkGLS/ALPau26oNJxl2370d2TdMYOWDf5P3Q2wFbz0CEeaGdUyCqVugJ 56SkIeHzcg/bSg4Iazl86LxxAvgxZ9JneKHxZ9wR2TOuIliyeyqPNAbieDyMyXAtlCbd 6snNbiaCCHMiD3spPj9wYktkiKyV2vDY4AgzvOzsD5OxzieJavaYiRo6Tv3ELtGtAEse JVRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@nbd.name header.s=20160729 header.b=s3iSCY+Q; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c18si10746268edt.390.2019.11.30.07.32.21; Sat, 30 Nov 2019 07:32:45 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@nbd.name header.s=20160729 header.b=s3iSCY+Q; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727328AbfK3PbJ (ORCPT + 99 others); Sat, 30 Nov 2019 10:31:09 -0500 Received: from nbd.name ([46.4.11.11]:56030 "EHLO nbd.name" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726955AbfK3Pas (ORCPT ); Sat, 30 Nov 2019 10:30:48 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=nbd.name; s=20160729; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=cpKpPx5M3OPk2FzU0fWLRScfIUbiOPAbcxIzpFkCKm8=; b=s3iSCY+Qar7FhngvN9+8l2ZGNh 765qdmyiIspI0C93aQASbI6uQdD5tuwmw1fDSp+4z4kOeFKMQAh5iwtYQGeTpYPbV6Uvx967je7Gb EfX7Z/PCqucwhSMhWBv76IR/ipsDSSenOSVRfoyGlsupn4ZbG7byU3aNPFroKULKqSvo=; Received: from p5b2067e3.dip0.t-ipconnect.de ([91.32.103.227] helo=maeck.local) by ds12 with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1ib4hq-0006hD-Ig for linux-wireless@vger.kernel.org; Sat, 30 Nov 2019 16:30:46 +0100 Received: by maeck.local (Postfix, from userid 501) id 01242721EBD3; Sat, 30 Nov 2019 16:30:45 +0100 (CET) From: Felix Fietkau To: linux-wireless@vger.kernel.org Subject: [PATCH 13/29] mt76: add multiple wiphy support to mt76_get_min_avg_rssi Date: Sat, 30 Nov 2019 16:30:29 +0100 Message-Id: <20191130153045.28105-13-nbd@nbd.name> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191130153045.28105-1-nbd@nbd.name> References: <20191130153045.28105-1-nbd@nbd.name> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Allow tracking clients of both wiphys separately Signed-off-by: Felix Fietkau --- drivers/net/wireless/mediatek/mt76/mt76.h | 2 +- drivers/net/wireless/mediatek/mt76/mt7603/mac.c | 2 +- drivers/net/wireless/mediatek/mt76/mt7615/mac.c | 2 +- drivers/net/wireless/mediatek/mt76/mt76x0/phy.c | 2 +- drivers/net/wireless/mediatek/mt76/mt76x2/phy.c | 2 +- drivers/net/wireless/mediatek/mt76/util.c | 8 ++++++-- 6 files changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h index 97baa92242fa..91a3acf57d12 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76.h +++ b/drivers/net/wireless/mediatek/mt76/mt76.h @@ -793,7 +793,7 @@ int mt76_sta_state(struct ieee80211_hw *hw, struct ieee80211_vif *vif, void __mt76_sta_remove(struct mt76_dev *dev, struct ieee80211_vif *vif, struct ieee80211_sta *sta); -int mt76_get_min_avg_rssi(struct mt76_dev *dev); +int mt76_get_min_avg_rssi(struct mt76_dev *dev, bool ext_phy); int mt76_get_txpower(struct ieee80211_hw *hw, struct ieee80211_vif *vif, int *dbm); diff --git a/drivers/net/wireless/mediatek/mt76/mt7603/mac.c b/drivers/net/wireless/mediatek/mt76/mt7603/mac.c index 8cf6c430ef67..ab9ac6e07159 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7603/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7603/mac.c @@ -1737,7 +1737,7 @@ mt7603_false_cca_check(struct mt7603_dev *dev) mt7603_cca_stats_reset(dev); - min_signal = mt76_get_min_avg_rssi(&dev->mt76); + min_signal = mt76_get_min_avg_rssi(&dev->mt76, false); if (!min_signal) { dev->sensitivity = 0; dev->last_cca_adj = jiffies; diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c index 581cbf52482c..38abb3dab549 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c @@ -1266,7 +1266,7 @@ mt7615_mac_adjust_sensitivity(struct mt7615_dev *dev, int signal; sensitivity = ofdm ? &dev->ofdm_sensitivity : &dev->cck_sensitivity; - signal = mt76_get_min_avg_rssi(&dev->mt76); + signal = mt76_get_min_avg_rssi(&dev->mt76, false); if (!signal) { mt7615_mac_set_default_sensitivity(dev); return; diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c b/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c index cc28ad03155d..b56397c05218 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c @@ -1069,7 +1069,7 @@ mt76x0_phy_update_channel_gain(struct mt76x02_dev *dev) u8 gain_delta; int low_gain; - dev->cal.avg_rssi_all = mt76_get_min_avg_rssi(&dev->mt76); + dev->cal.avg_rssi_all = mt76_get_min_avg_rssi(&dev->mt76, false); if (!dev->cal.avg_rssi_all) dev->cal.avg_rssi_all = -75; diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/phy.c b/drivers/net/wireless/mediatek/mt76/mt76x2/phy.c index 91ab25c7d5ba..ed2dcb05d614 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x2/phy.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x2/phy.c @@ -280,7 +280,7 @@ void mt76x2_phy_update_channel_gain(struct mt76x02_dev *dev) int low_gain; u32 val; - dev->cal.avg_rssi_all = mt76_get_min_avg_rssi(&dev->mt76); + dev->cal.avg_rssi_all = mt76_get_min_avg_rssi(&dev->mt76, false); if (!dev->cal.avg_rssi_all) dev->cal.avg_rssi_all = -75; diff --git a/drivers/net/wireless/mediatek/mt76/util.c b/drivers/net/wireless/mediatek/mt76/util.c index 23d1e1da78b2..8c60c450125a 100644 --- a/drivers/net/wireless/mediatek/mt76/util.c +++ b/drivers/net/wireless/mediatek/mt76/util.c @@ -64,7 +64,7 @@ int mt76_wcid_alloc(unsigned long *mask, int size) } EXPORT_SYMBOL_GPL(mt76_wcid_alloc); -int mt76_get_min_avg_rssi(struct mt76_dev *dev) +int mt76_get_min_avg_rssi(struct mt76_dev *dev, bool ext_phy) { struct mt76_wcid *wcid; int i, j, min_rssi = 0; @@ -75,14 +75,18 @@ int mt76_get_min_avg_rssi(struct mt76_dev *dev) for (i = 0; i < ARRAY_SIZE(dev->wcid_mask); i++) { unsigned long mask = dev->wcid_mask[i]; + unsigned long phy_mask = dev->wcid_phy_mask[i]; if (!mask) continue; - for (j = i * BITS_PER_LONG; mask; j++, mask >>= 1) { + for (j = i * BITS_PER_LONG; mask; j++, mask >>= 1, phy_mask >>= 1) { if (!(mask & 1)) continue; + if (!!(phy_mask & 1) != ext_phy) + continue; + wcid = rcu_dereference(dev->wcid[j]); if (!wcid) continue; -- 2.24.0