Received: by 2002:ab2:3c46:0:b0:1f5:f2ab:c469 with SMTP id x6csp200954lqf; Fri, 26 Apr 2024 04:24:31 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUCh4eBiLkyi8VV2SuWGKNa69D4bUV1iy9iaN6LXcLi5vHDrqvJ/3d6AHoltOcJoRW7di0v6MijtRrkUJYuvLw3e+SxUzngHAZjEDKuog== X-Google-Smtp-Source: AGHT+IFusoDuWC9usfo+ztTyls8+CdmoOIDOvMkts+4b8OuQ+hgqDVbuUGeL+JhimU3dFwv5xPSt X-Received: by 2002:a05:6a20:3ca3:b0:1a9:4964:726 with SMTP id b35-20020a056a203ca300b001a949640726mr3410544pzj.21.1714130671145; Fri, 26 Apr 2024 04:24:31 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714130671; cv=pass; d=google.com; s=arc-20160816; b=sVDHmTnDPrxIUasEAi9UOH0Sdt+lk6C39FNbvNXpk3inZHwCYoL9FezmqzDhqjS0OZ 0rqrMQvD2SaEgw3KYEJfKuyGkYsdWNcxWTUsG08uz3MZeVT3Ur6LXoBYVuCHsbQ8rZoy 82DbeGj8Idd1zhN97u0KpZs9GaeiMEfOd+YykxLnxaPdCZpFXR/wduU96m9TVxqvSDuQ ZcE2mHvJWKn9YDtjL79ePjvZ6xU9kxzKQZkvKa3pcD13iXe4UURvyZ7U14yMJvV1TKjF MTkoEuSIZQT38ehciYJ13huUFe4B3oXc6kRCOOC7ja4HRG8i+Y1GRHUQBhJHI9AAOksJ Nx/Q== 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=0dLohxwrmKgRDmw4a+e1NbQs8+ywqrx+CdH1UDUV2Fc=; fh=KJluyo8GkdQ0PKVYci8ap2SDXDaX7tsW4mnPNVybQI0=; b=JxvSUENu8M3aAEmkpIVgQOe/mjAkvZ8GaRx2yqbeVstnwcyS3aRE3i5Pf7t3AeBv1E 7qsP1c6hjv2eiOkt2thhdMXkEhu/8U2JXDpcuQ0OCkG+JcndSSjaF6PkjjLKNm4dn50O 24wEZ20VTqvRjyx9QszhuxGForBQ+dcJpKGsa0VZVYfcXTo1BMyfQmuJ9d5XyLuPHpvN RC6OnUi3lQ5ae8Zs+wfy9e8Z4dYquxZ27FL8dKeqoGDtCxBSbell3gF/MD3SKh22m/EK TAGsTu/Trpg4tN1cic891BSY8JXaMT2DPP+fQBy3OhfIXUEVs5yAjIMJaeZkyvQ166hA XViA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=j+ccKbVZ; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-wireless+bounces-6928-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-6928-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id c6-20020aa78e06000000b006ecf8c67605si14573903pfr.72.2024.04.26.04.24.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Apr 2024 04:24:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-6928-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=j+ccKbVZ; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-wireless+bounces-6928-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-6928-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 44A4DB210C9 for ; Fri, 26 Apr 2024 11:24:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4F9B0144D3C; Fri, 26 Apr 2024 11:24:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="j+ccKbVZ" 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 2A9CB13F01A for ; Fri, 26 Apr 2024 11:24:23 +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=1714130664; cv=none; b=ED4W6eVDFm2yez2V8++6oFaYgvMr/Q2eXutqUV1Qo5PID8G65zJuLNXJyq5YC/kqSok6r7OkQxjkhE4ZkkAaeSVlE+JqZ960VT3i9FDSwR0Fk5zqvAB9ZAQg4miLU8gqapVjWVax8/JLlp00ulriN6oxh9NgfQJy0tzitLUjBCM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714130664; c=relaxed/simple; bh=R9JX84BXKQf4UHZRk81RPQG7Gd4aJssAqnYn3UH2Ef8=; h=From:To:Cc:Subject:References:Date:In-Reply-To:Message-ID: MIME-Version:Content-Type; b=NSvYs6lQ5iAARnUH61Y8mPppKhhOlq0tqeV2Fg+1o+DbXARnKdVIk1EKmLe97d2Ixtc9fmWnlkGZa56S69Gd36SkAT+3fKvIaNnvn/X/QswXBgFgaTTn+XtOSmGybRfYkyrnCZ6PyH+MG+h8dWScbnyeOlaFX+LvFHOGKXImMHk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=j+ccKbVZ; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id CF223C113CD; Fri, 26 Apr 2024 11:24:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714130663; bh=R9JX84BXKQf4UHZRk81RPQG7Gd4aJssAqnYn3UH2Ef8=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=j+ccKbVZI0l10IW8Vlgc6LbKc7gEG8ExC8lik04Y0zdQbiVfZdcXbFYoeo/CfdaJh fFlwlrWdlEUqzzULPbCif5e8w7201DTFNIKQnNjpIxc9CmJuTzf/vygG4LZya98U/E +abl9PL2/BaXEx6q4vPrjXES/e2jNaIjUD5XWolwVoOnUDsnkv6Uwq9E9c9n0nUMiX 5ZZf6RLBhDwG28sVTHSxCAZ1STBk68gHfiw2xS/FjvVH2NkNOXKx4UwFqz0no39Et4 /bmo2vdcu3XlVhLeOUouWENjRA/ui99sZT4BVsV+9dqUeWjBXGkwVlqrJdKGrhGF/C d1OPcWelWMCAg== From: Kalle Valo To: Lingbo Kong Cc: , Subject: Re: [PATCH v4 1/3] wifi: ath12k: report station mode transmit rate References: <20240419032122.7009-1-quic_lingbok@quicinc.com> <20240419032122.7009-2-quic_lingbok@quicinc.com> <87r0etsp6u.fsf@kernel.org> Date: Fri, 26 Apr 2024 14:24:21 +0300 In-Reply-To: (Lingbo Kong's message of "Fri, 26 Apr 2024 16:01:19 +0800") Message-ID: <87r0esqsd6.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: > On 2024/4/25 18:37, Kalle Valo wrote: >> Lingbo Kong writes: >> >>> Currently, the transmit rate of "iw dev xxx station dump" command >>> always show an invalid value. >>> >>> To address this issue, ath12k parse the info of transmit complete >>> report from firmware and indicate the transmit rate to mac80211. >>> >>> This patch affects the station mode of WCN7850 and QCN9274. >>> >>> After that, "iw dev xxx station dump" show the correct transmit rate. >>> Such as: >>> >>> Station 00:03:7f:12:03:03 (on wlo1) >>> inactive time: 872 ms >>> rx bytes: 219111 >>> rx packets: 1133 >>> tx bytes: 53767 >>> tx packets: 462 >>> tx retries: 51 >>> tx failed: 0 >>> beacon loss: 0 >>> beacon rx: 403 >>> rx drop misc: 74 >>> signal: -95 dBm >>> beacon signal avg: -18 dBm >>> tx bitrate: 1441.1 MBit/s 80MHz EHT-MCS 13 EHT-NSS 2 EHT-GI 0 >>> >>> Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3 >>> Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.2.1-00201-QCAHKSWPL_SILICONZ-1 >>> >>> Signed-off-by: Lingbo Kong >> [...] >> >>> +static void ath12k_dp_tx_update(struct ath12k *ar, struct hal_tx_status *ts) >>> +{ >>> + if (ar->last_ppdu_id != 0) { >>> + if (ar->last_ppdu_id == ts->ppdu_id || >>> + ar->cached_ppdu_id == ar->last_ppdu_id) >>> + ar->cached_ppdu_id = ar->last_ppdu_id; >>> + >>> + ath12k_dp_tx_update_txcompl(ar, ts); >>> + } >>> + >>> + ar->last_ppdu_id = ts->ppdu_id; >>> +} >> A code comment would help a lot. Why is ar->cached_ppdu_id needed >> here? >> And if 'ar->cached_ppdu_id == ar->last_ppdu_id' is true why do then >> do >> 'ar->cached_ppdu_id = ar->last_ppdu_id'? The value of ar->cached_ppdu_id >> is not changing here (unless I'm missing something). >> Also I'm worried about locking. How is access to ar->last_ppdu_id >> and >> ar->cached_ppdu_id protected? >> > > Thanks for pointing to this. > you're right, the ar->cached_ppdu_id haven't used in here, so need to > delete it. > i missed something in here. > > So, change the ath12k_dp_tx_update(struct ath12k *ar, struct > hal_tx_status *ts) to > static void ath12k_dp_tx_update(struct ath12k *ar, struct hal_tx_status *ts) > { > if (ts->flags & HAL_TX_STATUS_FLAGS_FIRST_MSDU) { > if (ar->last_ppdu_id != 0) > ath12k_dp_tx_update_txcompl(ar, ts); > ar->last_ppdu_id = ts->ppdu_id; > } > } Access to ar->last_ppdu_id still looks racy to me. And why do we need to track last_ppdu_id? I don't have time to start investigating that right now, a code comment explaining that would help a lot. -- https://patchwork.kernel.org/project/linux-wireless/list/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches