Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp1641091lqt; Wed, 20 Mar 2024 09:40:00 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXD711gxgcUHZLOUlUozWl/+Dc+dfjLZ/pK6v/Onnku55Zk88oxoGLsoBliWWPymCUvXYPWCuv+FvJG51lhp3KWdmw//NkMkK27rmAcGQ== X-Google-Smtp-Source: AGHT+IF8i1F58quk1K7b3XA+VZIM4XnFZV4fooRqvnsnQKJlgyctwfRM6t20lW/VrdWIb1vgBdkG X-Received: by 2002:a05:6808:f93:b0:3c3:84c4:c05 with SMTP id o19-20020a0568080f9300b003c384c40c05mr12980855oiw.14.1710952800520; Wed, 20 Mar 2024 09:40:00 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710952799; cv=pass; d=google.com; s=arc-20160816; b=U1AEdNWQICQs+L9HOmPTCkd0FExaEeSHvjowubFvUzb2BOIv6vKTFtnwF++yPbFLUY AaJVpnjMT6Yjobyla5Ntx+WfCFTM+bhFy8Bdls3JLKY5zOnomRFi7dffLSmUfxVUyqKd 9gRrGPUjCeTr0VdmeYEOCgmXmtopIHTDE/sgVsruIozUgRK2HmkJVVOlX7CYVY+xKg9A zZyDXnsAS57jFrR7pHxIMk/d+2VWo3Nvs1iyhz9yWsMLDqHHuvIHlMHFeVEUr4NJlgi5 xhvw6KKGHS3wkV/SM3ns2C8BipAhXovhub7Q2IysFxZCIphrqsTP80lBoa2szlH5CGjR C2Nw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:message-id:in-reply-to:date:references:subject:cc:to :from:dkim-signature; bh=nUtkz+PUbm0KIRPdSySl58fbSxHslMdnrvw0EZ6JXgg=; fh=KJluyo8GkdQ0PKVYci8ap2SDXDaX7tsW4mnPNVybQI0=; b=abAaYBh4/2KSOg2le9FRcP+SbwEaXsR439KhQZMxea6LULTF4DhCLs6qPRv3rv2eqg Zq1vgyFYoBHiZBwHAa7vMPJ3PhfXrEYUSoKXmLTm8UY1He6Exs8e25CnQ/oy5i58QSFL svdKfmuiSzwsVPC9s1OfqUW0Y9DAoiuRvF3vlaS/91IftX+r9nAfLA0Y14LwAavk5hIb CcdgzbPozwn6dY5x9WzM+bMoSsJbISHilvR+sXaMZvnqiTJo2WU8uiNC1iooQdFK/52x 157aTxJbdXKgj5EOXsU92yzwlemc95CWDZyUMiYz85F4a850BOxPimhDKqQcB0sLmStj KWFg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FVc19hfP; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-wireless+bounces-4990-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-4990-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d18-20020a05620a137200b0078a101c2910si4277432qkl.569.2024.03.20.09.39.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Mar 2024 09:39:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-4990-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FVc19hfP; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-wireless+bounces-4990-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-4990-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 8C6601C203F4 for ; Wed, 20 Mar 2024 16:39:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4D17015C3; Wed, 20 Mar 2024 16:39:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="FVc19hfP" X-Original-To: linux-wireless@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2901515A5 for ; Wed, 20 Mar 2024 16:39:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710952796; cv=none; b=oK9RMFSTtmB0HtnznBZYhElzmTh4by3kFQft5Jdk1C4Ns+0jLOyy3k9nv83/k/5GOQfzuG3LGlIlcRjrCGZ5a/VtFwUDzRmNRr87fpKp1MlP1YgmDD0JP/KbUt8rkqTq7yrNUywMR8/2Sc8am1fPXHkphpz26ZFfKpWP20T7TnI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710952796; c=relaxed/simple; bh=pdueHAqME/RXgy8B9mFyZ15nNoudCV+XV4ekjt1t7PU=; h=From:To:Cc:Subject:References:Date:In-Reply-To:Message-ID: MIME-Version:Content-Type; b=Bhe1dasMKyRgB9sAgJ2YgOfr0Q6zQDcDqwFQvvTR0pAylGtX7PDTxyfifDYaMn2fRyOPVQlPl3EEow6ICp0MUBSRSf+v/zC0yNkWEq85Ve1/U4i1dhnVqSN3/eWLql4NcTXbfJP9SROzTABcYDk/thc+4Z2e7reVP2orh/tdU1Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=FVc19hfP; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id E1C6FC43399; Wed, 20 Mar 2024 16:39:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1710952795; bh=pdueHAqME/RXgy8B9mFyZ15nNoudCV+XV4ekjt1t7PU=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=FVc19hfPlD2Pe6iXcWwRKFQRVVTIBwSeK81M7Ns2vV4MoygQSFn9S7DkIGNqU/wfe dd+qCyPc078egc4X5E2JCEsh3R5ohsY1zvRGUhcReCzm8POz2JWc4EXjj4cNtfTGjj ettr+m+vnRaZGi31BZPdWVL00f0siVr6Hk8LzcBl/1tl6JYfDod+aYQeTt6ALg3tjo zzwx8j585+To2OE+ca5IJHVmR+Qzdy8OAav3k3CRM6w7P456VzP7N6NsXkr/B5SDyv BSBIykRtw7GTM9A3EXuzv0VTfwNreM3GDNkT2pAyjwQUk54iiKc38sHeLYpXETiFgY 15FIDX5s5ezpg== From: Kalle Valo To: Lingbo Kong Cc: , Subject: Re: [PATCH] wifi: ath12k: report signal for iw dev xxx station dump References: <20240219111417.1185-1-quic_lingbok@quicinc.com> Date: Wed, 20 Mar 2024 18:39:52 +0200 In-Reply-To: <20240219111417.1185-1-quic_lingbok@quicinc.com> (Lingbo Kong's message of "Mon, 19 Feb 2024 19:14:17 +0800") Message-ID: <87o7b8amcn.fsf@kernel.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain Lingbo Kong writes: > The signal of "iw dev xxx station dump" always show 0 dBm. This is because > currently signal is only set in ath12k_mgmt_rx_event function, and not set > for rx data packet. So, change to get signal from firmware and report to > mac80211. > > After that, "iw dev xxx station dump" show the correct signal such as: > signal: -50 dBm > signal: -49 dBm > > Tested-on: WCN7850 hw2.0 PCI > WLAN.HMT.1.0-03427-QCAHMTSWPL_V1.0_V2.0_SILICONZ-1.15378.4 > > Signed-off-by: Lingbo Kong I'll omit the cosmetics for now and focus on the big picture. First of all, no mention of WCN7850 and QCN9274 in the commit message. Not good. > --- a/drivers/net/wireless/ath/ath12k/hw.c > +++ b/drivers/net/wireless/ath/ath12k/hw.c > @@ -920,6 +920,8 @@ static const struct ath12k_hw_params ath12k_hw_params[] = { > .otp_board_id_register = QCN9274_QFPROM_RAW_RFA_PDET_ROW13_LSB, > > .supports_sta_ps = false, > + > + .supports_rssi_stats = false, > }, > { > .name = "wcn7850 hw2.0", > @@ -993,6 +995,8 @@ static const struct ath12k_hw_params ath12k_hw_params[] = { > .otp_board_id_register = 0, > > .supports_sta_ps = true, > + > + .supports_rssi_stats = true, > }, > { > .name = "qcn9274 hw2.0", > @@ -1061,6 +1065,8 @@ static const struct ath12k_hw_params ath12k_hw_params[] = { > .otp_board_id_register = QCN9274_QFPROM_RAW_RFA_PDET_ROW13_LSB, > > .supports_sta_ps = false, > + > + .supports_rssi_stats = false, > }, > }; Ok, based on this you enable this only for WCN7850 hw2.0. Why is that? We really should get rid of "I work only on WCN7850 and not care about QCN9274" mindset. And of course the other team says "I work only on QCN9274 and not care about WCN7850", sigh. If you work on ath12k you need to consider *BOTH* WCN7850 and QCN9274 families! > static void ath12k_mac_op_sta_statistics(struct ieee80211_hw *hw, > struct ieee80211_vif *vif, > struct ieee80211_sta *sta, > struct station_info *sinfo) > { > struct ath12k_sta *arsta = ath12k_sta_to_arsta(sta); > + struct ath12k *ar = arsta->arvif->ar; > + s8 signal; > > sinfo->rx_duration = arsta->rx_duration; > sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_DURATION); > @@ -7473,8 +7503,19 @@ static void ath12k_mac_op_sta_statistics(struct ieee80211_hw *hw, > sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BITRATE); > > /* TODO: Use real NF instead of default one. */ > - sinfo->signal = arsta->rssi_comb + ATH12K_DEFAULT_NOISE_FLOOR; > - sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL); > + signal = arsta->rssi_comb; > + > + if (!signal && > + arsta->arvif->vdev_type == WMI_VDEV_TYPE_STA && > + ar->ab->hw_params->supports_rssi_stats && > + !(ath12k_mac_get_fw_stats(ar, ar->pdev->pdev_id, 0, > + WMI_REQUEST_VDEV_STAT))) > + signal = arsta->rssi_beacon; > + > + if (signal) { > + sinfo->signal = signal; > + sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL); > + } > } If I'm reading the patch correctly this is the sequence: 1. ath12k_mac_op_sta_statistics() is called 2. WMI_REQUEST_STATS_CMDID is sent to the firmware 3. ath12k_mac_op_sta_statistics() returns 4. firmware sends WMI_UPDATE_STATS_EVENTID to host 5. ath12k_wmi_tlv_fw_stats_data_parse() stores signal to arsta->rssi_beacon So doesn't this mean that ath12k_mac_op_sta_statistics() actually uses the previous value? And if ath12k_mac_op_sta_statistics() is called very seldom, like once an hour, the signal value can be one hour wrong? Also I don't see any protection when accessing arsta->rssi_beacon. -- https://patchwork.kernel.org/project/linux-wireless/list/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches