Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp713653pxm; Fri, 25 Feb 2022 18:04:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJyyRiVjaRNt8FV2pgth/drmoSu0/5B/DngxvvwKBLptmwfNTptfKlZyA0EJwXAqW0iA0D9Z X-Received: by 2002:a62:dd03:0:b0:4f1:1bfa:134c with SMTP id w3-20020a62dd03000000b004f11bfa134cmr10778250pff.14.1645841063082; Fri, 25 Feb 2022 18:04:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645841063; cv=none; d=google.com; s=arc-20160816; b=kYeudzM8/8BWVm3AATH5A5XezZY0ND2gQC92+udyt7VODInYoIJTfoCSBn96/iQqk+ +pXixUX3aXR41tYQgaGDVyNuQFaXPxoRnBAguxCSDgwgDc0kzO5ATDxqSlcxoE+z9dZC u9PKLk2TXqm5KFtM05PI1dN4SmD0d8K1m7oDSQl/XjEMI9KkKhviWkCAwzi6JeXxoIJp FxRM84vFNFMEHBdp0n4jMgAhDwCoQUwdQzpDi0QR1KbJQSHOJzwA1iGaFMnQMYuOdmBa jzbTBJGoAydCn3t3YVPw2xDMug6TaeVpze6OzfvHTJxEE/kMmJwYXM0yoUP0NH0h6H1E BjKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature:dkim-filter; bh=9haJG1VJ06GtdS+Laz8MrHp6YaOOfH+njE0x5fZ8Ijc=; b=06RYTnSqwSQZ+XmlxloNce3BtUYfg7uB1s937A0/634Gs+xDciu/MQkAJ7XvY05cdp IDnE/JgjTGB5wX68j8UtJ5dAa9/mQsQAgI4/GRHgb+UTt2nA79k+tqLaZZFemtxgOAwI L7WH9bQajsbbielM3rKtswV5ILvmOyn/dkcqk5Qchn56wL7/UbGncjqX/PC6vvs/4Y14 nyjBC78PSoM7aoAuTsvHaA/GvXpqZLG3dre9ovaZCaZdsmdbQ1ubQCMwe6rJBADopTdT waX3/Nd0hjjM/a12+PZXTijpNMSHspjJtMVCD9vbb37jFrei4ZQ4AkSbR3atOGLFRshm ru8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@candelatech.com header.s=default header.b=fDScoqeJ; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=candelatech.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id a10-20020a17090a8c0a00b001bc3b7a293asi9076836pjo.95.2022.02.25.18.04.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Feb 2022 18:04:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@candelatech.com header.s=default header.b=fDScoqeJ; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=candelatech.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 92D24888EB; Fri, 25 Feb 2022 17:43:59 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239258AbiBYX3W (ORCPT + 72 others); Fri, 25 Feb 2022 18:29:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58028 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230190AbiBYX3V (ORCPT ); Fri, 25 Feb 2022 18:29:21 -0500 Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [67.231.154.183]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E08F912341F for ; Fri, 25 Feb 2022 15:28:47 -0800 (PST) X-Virus-Scanned: Proofpoint Essentials engine Received: from mx1-us1.ppe-hosted.com (unknown [10.110.51.164]) by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id 6C023A0074 for ; Fri, 25 Feb 2022 23:28:46 +0000 (UTC) Received: from mail3.candelatech.com (mail2.candelatech.com [208.74.158.173]) by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTP id 3F9B7B00072 for ; Fri, 25 Feb 2022 23:28:46 +0000 (UTC) Received: from ben-dt4.candelatech.com (50-251-239-81-static.hfc.comcastbusiness.net [50.251.239.81]) by mail3.candelatech.com (Postfix) with ESMTP id A8D8113C2B0; Fri, 25 Feb 2022 15:28:45 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 mail3.candelatech.com A8D8113C2B0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=candelatech.com; s=default; t=1645831725; bh=0KnkVM0jE2CErxS79Sa2/Q5kulSfZbpWM9FmwF87zAg=; h=From:To:Cc:Subject:Date:From; b=fDScoqeJMKumnjj60tfORh/pWEzPcqBrUNKQym7yGzl6fHy7onVkfDuoimqAQEtQs JAnFfmgosJmi94cL4x0XAatb3nJYnJEpETryMT52rr2aGPgsR+nVFB+hWngkeBGuDJ 3qtecPYb6k1Lc+r5VD0CDSZJmvTADCUG29zAaImM= From: greearb@candelatech.com To: linux-wireless@vger.kernel.org Cc: Ben Greear Subject: [PATCH 1/2] mac80211: Allow drivers to report avg chain signal. Date: Fri, 25 Feb 2022 15:28:41 -0800 Message-Id: <20220225232842.32028-1-greearb@candelatech.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-MDID: 1645831726-m_09h8JzGjcz 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 From: Ben Greear Drivers that use RSS cannot get the avg signal from mac80211. So allow drivers to report the avg chain signal while letting mac80211 take care of the last chain signal. Signed-off-by: Ben Greear --- net/mac80211/sta_info.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c index 43a58b30c6a4..00836f587b6d 100644 --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c @@ -2543,6 +2543,7 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo, if (last_rxstats->chains && !(sinfo->filled & (BIT_ULL(NL80211_STA_INFO_CHAIN_SIGNAL) | BIT_ULL(NL80211_STA_INFO_CHAIN_SIGNAL_AVG)))) { + /* Neither chain signal nor chain signal avg is filled */ sinfo->filled |= BIT_ULL(NL80211_STA_INFO_CHAIN_SIGNAL); if (!sta->pcpu_rx_stats) sinfo->filled |= BIT_ULL(NL80211_STA_INFO_CHAIN_SIGNAL_AVG); @@ -2557,6 +2558,21 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo, } } + /* Check if chain signal is not filled, for cases avg was filled by + * driver bug last chain signal was not. + */ + if (last_rxstats->chains && + !(sinfo->filled & (BIT_ULL(NL80211_STA_INFO_CHAIN_SIGNAL)))) { + sinfo->filled |= BIT_ULL(NL80211_STA_INFO_CHAIN_SIGNAL); + + sinfo->chains = last_rxstats->chains; + + for (i = 0; i < ARRAY_SIZE(sinfo->chain_signal); i++) { + sinfo->chain_signal[i] = + last_rxstats->chain_signal_last[i]; + } + } + if (!(sinfo->filled & BIT_ULL(NL80211_STA_INFO_TX_BITRATE))) { sta_set_rate_info_tx(sta, &sta->tx_stats.last_rate, &sinfo->txrate); -- 2.20.1