From patchwork Wed Jul 27 23:01:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Greear X-Patchwork-Id: 12930850 X-Patchwork-Delegate: nbd@nbd.name Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1FF14C04A68 for ; Wed, 27 Jul 2022 23:01:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232724AbiG0XBo (ORCPT ); Wed, 27 Jul 2022 19:01:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34726 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230113AbiG0XBm (ORCPT ); Wed, 27 Jul 2022 19:01:42 -0400 Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [148.163.129.52]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C2D151FCC7 for ; Wed, 27 Jul 2022 16:01:41 -0700 (PDT) X-Virus-Scanned: Proofpoint Essentials engine Received: from mx1-us1.ppe-hosted.com (unknown [10.7.67.129]) by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id 2B74F1A0080; Wed, 27 Jul 2022 23:01:40 +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 EBC8050007E; Wed, 27 Jul 2022 23:01:39 +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 6395C13C2B1; Wed, 27 Jul 2022 16:01:39 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 mail3.candelatech.com 6395C13C2B1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=candelatech.com; s=default; t=1658962899; bh=kXQXO3rSUUuSpLoLuCJGYmcnPbKfMLEcMXz+La9UHF8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mhM9FsLazDQAoOgxcLYEF7rO8dMEKa43gURamWZCZpyZaQMzis9oVrk/7/RqINPJt SCRK8OHddO/8jY5kk/xGzEUsDIC9j1eKIjEa9uZKCEbqhwbqbp7Fj0lxpYT7OR4tFc MSIac5H/cTpDwY406VtHAQB6dI8/I3BmV5MMU6vw= From: greearb@candelatech.com To: linux-wireless@vger.kernel.org Cc: nbd@nbd.name, Ben Greear Subject: [PATCH 02/12] wifi: mt76: mt7915: allow processing TXS for 'NO_SKB' pkt-ids Date: Wed, 27 Jul 2022 16:01:12 -0700 Message-Id: <20220727230122.29842-2-greearb@candelatech.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220727230122.29842-1-greearb@candelatech.com> References: <20220727230122.29842-1-greearb@candelatech.com> MIME-Version: 1.0 X-MDID: 1658962900-tLlJopnbjydw Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Ben Greear This will let us update stats and wcid.rate for every TXS callback we receive for a particular wcid. For now, the TXS is not requested for NO_SKB frames, however. That will be allowed in next patch. Signed-off-by: Ben Greear --- .../net/wireless/mediatek/mt76/mt7915/mac.c | 38 +++++++++++-------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c index 62a2dc47938e..2d1a8d8b04fb 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c @@ -1614,26 +1614,31 @@ mt7915_mac_add_txs_skb(struct mt7915_dev *dev, struct mt76_wcid *wcid, int pid, struct ieee80211_tx_info *info; struct sk_buff_head list; struct rate_info rate = {}; - struct sk_buff *skb; + struct sk_buff *skb = NULL; + bool check_status; bool cck = false; u32 txrate, txs, mode; - mt76_tx_status_lock(mdev, &list); - skb = mt76_tx_status_skb_get(mdev, wcid, pid, &list); - if (!skb) - goto out_no_skb; + check_status = (pid >= MT_PACKET_ID_FIRST); + + if (check_status) { + mt76_tx_status_lock(mdev, &list); + skb = mt76_tx_status_skb_get(mdev, wcid, pid, &list); + } txs = le32_to_cpu(txs_data[0]); - info = IEEE80211_SKB_CB(skb); - if (!(txs & MT_TXS0_ACK_ERROR_MASK)) - info->flags |= IEEE80211_TX_STAT_ACK; + if (skb) { + info = IEEE80211_SKB_CB(skb); + if (!(txs & MT_TXS0_ACK_ERROR_MASK)) + info->flags |= IEEE80211_TX_STAT_ACK; - info->status.ampdu_len = 1; - info->status.ampdu_ack_len = !!(info->flags & - IEEE80211_TX_STAT_ACK); + info->status.ampdu_len = 1; + info->status.ampdu_ack_len = !!(info->flags & + IEEE80211_TX_STAT_ACK); - info->status.rates[0].idx = -1; + info->status.rates[0].idx = -1; + } txrate = FIELD_GET(MT_TXS0_TX_RATE, txs); @@ -1721,10 +1726,11 @@ mt7915_mac_add_txs_skb(struct mt7915_dev *dev, struct mt76_wcid *wcid, int pid, wcid->rate = rate; out: - mt76_tx_status_skb_done(mdev, skb, &list); + if (skb) + mt76_tx_status_skb_done(mdev, skb, &list); -out_no_skb: - mt76_tx_status_unlock(mdev, &list); + if (check_status) + mt76_tx_status_unlock(mdev, &list); return !!skb; } @@ -1743,7 +1749,7 @@ static void mt7915_mac_add_txs(struct mt7915_dev *dev, void *data) wcidx = le32_get_bits(txs_data[2], MT_TXS2_WCID); pid = le32_get_bits(txs_data[3], MT_TXS3_PID); - if (pid < MT_PACKET_ID_FIRST) + if (pid < MT_PACKET_ID_NO_SKB) return; if (wcidx >= mt7915_wtbl_size(dev))