From patchwork Thu Mar 7 19:29:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Greear X-Patchwork-Id: 13586186 X-Patchwork-Delegate: nbd@nbd.name Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [67.231.154.164]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CF6531369A4 for ; Thu, 7 Mar 2024 19:30:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=67.231.154.164 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709839808; cv=none; b=BHflqogCYk2MKoSDRsrn1OKJwDp1/hleuJ7iKnR2syXQvlJtewlcBqw4k++qQKwjpJx2BS0vjnX2cD7idtHlAck+InEQNipkuwhNQ/9hOHgUmkjvgQKZTRt/DKQTumURBNrcIfOio5JzmW3TSYighYELdO3c++tqvAJT70Ii1/w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709839808; c=relaxed/simple; bh=PxmoAJnoMO8QQY9kPszditvML+bPeaKTD4C00Ht/1Rk=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=Fpms6xsjUxnmeLynnt+CoayG+UqQTqouY7tnrtYp4HEkOTc/NyBN98N+Km5x7eyduHCmLxafvXUgzJTDEVhIEFnpo2jUqM/e1rwoO4Lla91oUs0gnVhDnJL+h8EUOHmCRNO1kYdwBQvk5bVqJnSzP5l4A93P8ChQZ4kuD0H3YDQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=candelatech.com; spf=pass smtp.mailfrom=candelatech.com; dkim=pass (1024-bit key) header.d=candelatech.com header.i=@candelatech.com header.b=WkwWvxhE; arc=none smtp.client-ip=67.231.154.164 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=candelatech.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=candelatech.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=candelatech.com header.i=@candelatech.com header.b="WkwWvxhE" X-Virus-Scanned: Proofpoint Essentials engine 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 E49128007D for ; Thu, 7 Mar 2024 19:29:58 +0000 (UTC) Received: from ben-dt5.candelatech.com (unknown [50.251.239.81]) by mail3.candelatech.com (Postfix) with ESMTP id 63B6E13C2B0; Thu, 7 Mar 2024 11:29:58 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 mail3.candelatech.com 63B6E13C2B0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=candelatech.com; s=default; t=1709839798; bh=PxmoAJnoMO8QQY9kPszditvML+bPeaKTD4C00Ht/1Rk=; h=From:To:Cc:Subject:Date:From; b=WkwWvxhEvfWznD5nqVILPb6EzG8FHhcMQDRWVnRJmlcljsOmS46xxEmplE52oAoNm rdYDAFgmM2NxMYNBwst2C9b9zBx8OGIZgg2ZFuI0xZfX90qSP5wmDXyvzC2nUk4cYU gIxAJHAdJ+dHh80yP98DBkrPk9iNQdWidSdYWQ5o= From: greearb@candelatech.com To: linux-wireless@vger.kernel.org Cc: Ben Greear Subject: [PATCH 1/6] wifi: mt76: mt7996: add debugging for MCU command timeouts. Date: Thu, 7 Mar 2024 11:29:46 -0800 Message-ID: <20240307192951.3271156-1-greearb@candelatech.com> X-Mailer: git-send-email 2.42.0 Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MDID: 1709839799-I5RMuBD_6oGZ X-MDID-O: us5;at1;1709839799;I5RMuBD_6oGZ;;f7146c1849a4b08a52804beb1c1cdf45 From: Ben Greear Print information about whether the message is the first timeout, and also print info if we manage to recover after a timeout. Signed-off-by: Ben Greear --- drivers/net/wireless/mediatek/mt76/mt76.h | 2 ++ .../net/wireless/mediatek/mt76/mt7996/mcu.c | 31 +++++++++++++++++-- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h index b20c34d5a0f7..c341915e4d62 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76.h +++ b/drivers/net/wireless/mediatek/mt76/mt76.h @@ -829,6 +829,8 @@ struct mt76_dev { struct device *dma_dev; struct mt76_mcu mcu; + u32 first_failed_mcu_cmd; /* for debugging */ + u32 last_successful_mcu_cmd; /* for debugging */ struct net_device napi_dev; struct net_device tx_napi_dev; diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c index 699be57309c2..a858a0914bf0 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c @@ -200,14 +200,39 @@ mt7996_mcu_parse_response(struct mt76_dev *mdev, int cmd, int ret = 0; if (!skb) { - dev_err(mdev->dev, "Message %08x (seq %d) timeout\n", - cmd, seq); + const char *first = "Secondary"; + + if (!mdev->first_failed_mcu_cmd) + first = "Initial"; + + dev_err(mdev->dev, + "MCU: %s Failure: Message %08x (cid %lx ext_cid: %lx seq %d) timeout. Last successful cmd: 0x%x\n", + first, + cmd, FIELD_GET(__MCU_CMD_FIELD_ID, cmd), + FIELD_GET(__MCU_CMD_FIELD_EXT_ID, cmd), seq, + mdev->last_successful_mcu_cmd); + + if (!mdev->first_failed_mcu_cmd) + mdev->first_failed_mcu_cmd = cmd; return -ETIMEDOUT; } + mdev->last_successful_mcu_cmd = cmd; + + if (mdev->first_failed_mcu_cmd) { + dev_err(mdev->dev, "MCU: First success after failure: Message %08x (cid %lx ext_cid: %lx seq %d)\n", + cmd, FIELD_GET(__MCU_CMD_FIELD_ID, cmd), + FIELD_GET(__MCU_CMD_FIELD_EXT_ID, cmd), seq); + mdev->first_failed_mcu_cmd = 0; + } + rxd = (struct mt7996_mcu_rxd *)skb->data; - if (seq != rxd->seq) + if (seq != rxd->seq) { + /* This can happen if the previous request didn't wait (which is normal). + * Quietly return EAGAIN in that case, it is not something to warn about. + */ return -EAGAIN; + } if (cmd == MCU_CMD(PATCH_SEM_CONTROL)) { skb_pull(skb, sizeof(*rxd) - 4); From patchwork Thu Mar 7 19:29:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Greear X-Patchwork-Id: 13586185 X-Patchwork-Delegate: nbd@nbd.name Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [148.163.129.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CA379136663 for ; Thu, 7 Mar 2024 19:30:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.129.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709839803; cv=none; b=FsVp8J7sFdm2l2hOE6Ecpsr5GeQ7IrXafazHD9SSVEz/Ra6xyNM6UVfJqLnnGmYUv8Bxfp/QAWkGJ98D5ii9/95oFw+9v6kbs98SNjfQRgJuHcuVyyP5zKfqMELDwE7LF2zU/ZrKlt5592hvOb4ZPwxqLEK/vRn/75beJpabzhI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709839803; c=relaxed/simple; bh=Glwf9GgdnsO9unBN0hj7DJOFV1142GiKdQmXqNcq5oY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ekUH/AsuwcPeXtgVaCLzuslVx41GFeAHi50x1aC4CdlGFpunoBYWShyKyRIwuaIPC+wIIjlwf50iaYp7obEWDVVBw/U9J/rrOvcT/V++SZzBOHfJWOjVAQrwqfbvZbxMhQd8yfkFe9nMRltGFjQUIQo1Nyxq68YIz3BMEIitRyY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=candelatech.com; spf=pass smtp.mailfrom=candelatech.com; dkim=pass (1024-bit key) header.d=candelatech.com header.i=@candelatech.com header.b=gA1CRGHt; arc=none smtp.client-ip=148.163.129.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=candelatech.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=candelatech.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=candelatech.com header.i=@candelatech.com header.b="gA1CRGHt" X-Virus-Scanned: Proofpoint Essentials engine 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 0316CB00069 for ; Thu, 7 Mar 2024 19:29:59 +0000 (UTC) Received: from ben-dt5.candelatech.com (unknown [50.251.239.81]) by mail3.candelatech.com (Postfix) with ESMTP id 979DC13C2B1; Thu, 7 Mar 2024 11:29:58 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 mail3.candelatech.com 979DC13C2B1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=candelatech.com; s=default; t=1709839798; bh=Glwf9GgdnsO9unBN0hj7DJOFV1142GiKdQmXqNcq5oY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gA1CRGHtHswHqKd5BxSx2dBZUGs2N1Hf0z3XM9T0Zu+T8Rj8mnWjRlD2cuEeeDuTZ zZBI3mAo51TFWasfN9dUVCHKJ8OZtbY5+vM059XJl/e18gUqfy488v2/YtxsLMwz4L 3H3XxYv3HkaP3gODuDGWIjF/fZD5BBtPedQAwf10= From: greearb@candelatech.com To: linux-wireless@vger.kernel.org Cc: Ben Greear Subject: [PATCH 2/6] wifi: mt76: mt7996: add configured logging Date: Thu, 7 Mar 2024 11:29:47 -0800 Message-ID: <20240307192951.3271156-2-greearb@candelatech.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240307192951.3271156-1-greearb@candelatech.com> References: <20240307192951.3271156-1-greearb@candelatech.com> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MDID: 1709839800-4SJFZLh4bTjA X-MDID-O: us5;ut7;1709839800;4SJFZLh4bTjA;;f7146c1849a4b08a52804beb1c1cdf45 From: Ben Greear Allow module param and debugfs to configure a debug level to allow adding more debug logic that is only enabled when needed. Similar to how ath10k and iwlwifi work in this regard. Signed-off-by: Ben Greear --- drivers/net/wireless/mediatek/mt76/debugfs.c | 24 ++++++++++++++++ drivers/net/wireless/mediatek/mt76/mt76.h | 17 +++++++++++ .../net/wireless/mediatek/mt76/mt7996/init.c | 3 ++ .../net/wireless/mediatek/mt76/mt7996/mac.c | 28 +++++++++++++++++-- .../net/wireless/mediatek/mt76/mt7996/main.c | 18 ++++++++++++ .../net/wireless/mediatek/mt76/mt7996/mcu.c | 4 +++ 6 files changed, 92 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/debugfs.c b/drivers/net/wireless/mediatek/mt76/debugfs.c index ae83be572b94..bc16c3257540 100644 --- a/drivers/net/wireless/mediatek/mt76/debugfs.c +++ b/drivers/net/wireless/mediatek/mt76/debugfs.c @@ -100,6 +100,29 @@ void mt76_seq_puts_array(struct seq_file *file, const char *str, } EXPORT_SYMBOL_GPL(mt76_seq_puts_array); +static int +mt76_debug_lvl_set(void *data, u64 val) +{ + struct mt76_dev *dev = data; + + dev->debug_lvl = val; + + return 0; +} + +static int +mt76_debug_lvl_get(void *data, u64 *val) +{ + struct mt76_dev *dev = data; + + *val = dev->debug_lvl; + + return 0; +} + +DEFINE_DEBUGFS_ATTRIBUTE(fops_debug_lvl, mt76_debug_lvl_get, + mt76_debug_lvl_set, "%lld\n"); + struct dentry * mt76_register_debugfs_fops(struct mt76_phy *phy, const struct file_operations *ops) @@ -115,6 +138,7 @@ mt76_register_debugfs_fops(struct mt76_phy *phy, debugfs_create_file_unsafe("regval", 0600, dir, dev, fops); debugfs_create_file_unsafe("napi_threaded", 0600, dir, dev, &fops_napi_threaded); + debugfs_create_file("debug_lvl", 0600, dir, dev, &fops_debug_lvl); debugfs_create_blob("eeprom", 0400, dir, &dev->eeprom); if (dev->otp.data) debugfs_create_blob("otp", 0400, dir, &dev->otp); diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h index c341915e4d62..dd8a24cda48a 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76.h +++ b/drivers/net/wireless/mediatek/mt76/mt76.h @@ -815,6 +815,7 @@ struct mt76_dev { spinlock_t cc_lock; u32 cur_cc_bss_rx; + u32 debug_lvl; struct mt76_rx_status rx_ampdu_status; u32 rx_ampdu_len; @@ -1004,6 +1005,22 @@ struct mt76_mib_stats { u32 ul_hetrig_4mu_cnt; }; +enum MTK_DEUBG { + MTK_DEBUG_TX = 0x00000001, /* tx path */ + MTK_DEBUG_TXV = 0x00000002, /* verbose tx path */ + MTK_DEBUG_FATAL = 0x00000004, + MTK_DEBUG_WRN = 0x00000008, + MTK_DEBUG_MSG = 0x00000010, /* messages to/from firmware */ + MTK_DEBUG_CFG = 0x00000020, /* Configuration related */ + MTK_DEBUG_ANY = 0xffffffff +}; + +#define mtk_dbg(mt76, dbg_mask, fmt, ...) \ + do { \ + if ((mt76)->debug_lvl & MTK_DEBUG_##dbg_mask) \ + dev_info((mt76)->dev, fmt, ##__VA_ARGS__); \ + } while (0) + struct mt76_power_limits { s8 cck[4]; s8 ofdm[8]; diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/init.c b/drivers/net/wireless/mediatek/mt76/mt7996/init.c index 0cf0d1fe420a..d3b72fb73c30 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7996/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt7996/init.c @@ -14,6 +14,8 @@ #include "coredump.h" #include "eeprom.h" +extern u32 debug_lvl; /* module param */ + static const struct ieee80211_iface_limit if_limits[] = { { .max = 1, @@ -1309,6 +1311,7 @@ int mt7996_register_device(struct mt7996_dev *dev) dev->phy.dev = dev; dev->phy.mt76 = &dev->mt76.phy; dev->mt76.phy.priv = &dev->phy; + dev->mt76.debug_lvl = debug_lvl; INIT_WORK(&dev->rc_work, mt7996_mac_sta_rc_work); INIT_DELAYED_WORK(&dev->mphy.mac_work, mt7996_mac_work); INIT_LIST_HEAD(&dev->sta_rc_list); diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/mac.c b/drivers/net/wireless/mediatek/mt76/mt7996/mac.c index 53258488d49f..9b4637867354 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7996/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7996/mac.c @@ -923,6 +923,9 @@ int mt7996_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr, bool is_8023 = info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP; u8 *txwi = (u8 *)txwi_ptr; + mtk_dbg(&dev->mt76, TXV, "mt7996-tx-prepare-skb, skb-len: %d\n", + tx_info->skb->len); + if (unlikely(tx_info->skb->len <= ETH_HLEN)) return -EINVAL; @@ -933,8 +936,11 @@ int mt7996_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr, t->skb = tx_info->skb; id = mt76_token_consume(mdev, &t); - if (id < 0) + if (id < 0) { + mtk_dbg(&dev->mt76, TXV, "mt7996-tx-prepare-skb, token_consume error: %d\n", + id); return id; + } pid = mt76_tx_status_skb_add(mdev, wcid, tx_info->skb); mt7996_mac_write_txwi(dev, txwi_ptr, tx_info->skb, wcid, key, @@ -1124,6 +1130,9 @@ mt7996_mac_tx_free(struct mt7996_dev *dev, void *data, int len) idx = FIELD_GET(MT_TXFREE_INFO_WLAN_ID, info); wcid = rcu_dereference(dev->mt76.wcid[idx]); sta = wcid_to_sta(wcid); + + mtk_dbg(mdev, TXV, "mt7996-mac-tx-free, new wcid pair, idx: %d sta: %p wcid: %p\n", + idx, sta, wcid); if (!sta) continue; @@ -1157,8 +1166,14 @@ mt7996_mac_tx_free(struct mt7996_dev *dev, void *data, int len) count++; txwi = mt76_token_release(mdev, msdu, &wake); - if (!txwi) + + mtk_dbg(mdev, TXV, "mt7996-mac-tx-free, msdu: %d, count: %d/%d\n", + msdu, count, total); + + if (!txwi) { + WARN_ON_ONCE(1); continue; + } mt7996_txwi_free(dev, txwi, sta, &free_list); } @@ -1333,6 +1348,9 @@ static void mt7996_mac_add_txs(struct mt7996_dev *dev, void *data) u16 wcidx; u8 pid; + mtk_dbg(&dev->mt76, TX, "mt7996-mac-add-txs, format: %d\n", + le32_get_bits(txs_data[0], MT_TXS0_TXS_FORMAT)); + wcidx = le32_get_bits(txs_data[2], MT_TXS2_WCID); pid = le32_get_bits(txs_data[3], MT_TXS3_PID); @@ -1391,7 +1409,12 @@ bool mt7996_rx_check(struct mt76_dev *mdev, void *data, int len) case PKT_TYPE_RX_FW_MONITOR: mt7996_debugfs_rx_fw_monitor(dev, data, len); return false; + case PKT_TYPE_RX_EVENT: + case PKT_TYPE_NORMAL: + /* These are handled elsewhere, do not warn about them. */ + return true; default: + mtk_dbg(mdev, MSG, "mt7996-rx-check, pkt-type: %d not handled.\n", type); return true; } } @@ -1443,6 +1466,7 @@ void mt7996_queue_rx_skb(struct mt76_dev *mdev, enum mt76_rxq_id q, } fallthrough; default: + mtk_dbg(mdev, MSG, "mt7996-mac-queue-rx-skb, unhandled type: %d\n", type); dev_kfree_skb(skb); break; } diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/main.c b/drivers/net/wireless/mediatek/mt76/mt7996/main.c index 51deea84b642..f9a8a60a947e 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7996/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7996/main.c @@ -7,6 +7,19 @@ #include "mcu.h" #include "mac.h" +u32 debug_lvl = MTK_DEBUG_FATAL | MTK_DEBUG_WRN; +module_param(debug_lvl, uint, 0644); +MODULE_PARM_DESC(debug_lvl, + "Enable debugging messages\n" + "0x00001 tx path\n" + "0x00002 tx path verbose\n" + "0x00004 fatal/very-important messages\n" + "0x00008 warning messages\n" + "0x00010 Info about messages to/from firmware\n" + "0x00020 Configuration logs.\n" + "0xffffffff any/all\n" + ); + static bool mt7996_dev_running(struct mt7996_dev *dev) { struct mt7996_phy *phy; @@ -76,6 +89,8 @@ static int mt7996_start(struct ieee80211_hw *hw) struct mt7996_dev *dev = mt7996_hw_dev(hw); int ret; + dev->mt76.debug_lvl = debug_lvl; + flush_work(&dev->init_work); mutex_lock(&dev->mt76.mutex); @@ -739,6 +754,9 @@ static void mt7996_tx(struct ieee80211_hw *hw, wcid = &mvif->sta.wcid; } + mtk_dbg(&dev->mt76, TXV, "mt7996-tx, wcid: %d\n", + wcid->idx); + mt76_tx(mphy, control->sta, wcid, skb); } diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c index a858a0914bf0..5550671cdaf6 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c @@ -616,11 +616,15 @@ mt7996_mcu_rx_ext_event(struct mt7996_dev *dev, struct sk_buff *skb) { struct mt7996_mcu_rxd *rxd = (struct mt7996_mcu_rxd *)skb->data; + mtk_dbg(&dev->mt76, MSG, "mt7996-mcu-rx-ext-event, ext-eid: %d\n", rxd->ext_eid); + switch (rxd->ext_eid) { case MCU_EXT_EVENT_FW_LOG_2_HOST: mt7996_mcu_rx_log_message(dev, skb); break; default: + /* in SDK, grep for EventExtEventHandler */ + mtk_dbg(&dev->mt76, WRN, "mt7996, unhandled rx_ext_event: 0x%x", rxd->ext_eid); break; } } From patchwork Thu Mar 7 19:29:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Greear X-Patchwork-Id: 13586182 X-Patchwork-Delegate: nbd@nbd.name Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [67.231.154.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7B74E13473E for ; Thu, 7 Mar 2024 19:30:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=67.231.154.183 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709839803; cv=none; b=WDkB59vQgkZVqDEEfyRJ570TDsurMjNwf4zUgh/oPgAwOy95F9ysQbhKhTgKIMff3VynnNRKMUslMla2CASz3Q/yV85fww9YcOn9A3wAxLTgjfFPuLIh1yj/UROGYk0JZL2Pxm3KP/GS52nHBY7kuuMM+0DhSx/3Z0OUJH05mKI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709839803; c=relaxed/simple; bh=licXwMZE9nQRR1VJBrVvcUMfdfPScXi/Vz1g26dmJEU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=noFZaoOEQ4nbmsWIVmk5RcHTcfv4lelBc1zM+xOmFHvpSrCO16nI92kAcNm2Ev1J8oMSG8/wc60YKdBVDkrZ91SQOYpscgMDMf1x4wSRSY4+thP4BD1fdlITYwnBS25hO/62PgPlZUQzsig0PdVOlIyBqYcjg+F19Ega4EwsmfQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=candelatech.com; spf=pass smtp.mailfrom=candelatech.com; dkim=pass (1024-bit key) header.d=candelatech.com header.i=@candelatech.com header.b=Tqc3RJMJ; arc=none smtp.client-ip=67.231.154.183 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=candelatech.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=candelatech.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=candelatech.com header.i=@candelatech.com header.b="Tqc3RJMJ" X-Virus-Scanned: Proofpoint Essentials engine 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 5D2C82C006E for ; Thu, 7 Mar 2024 19:29:59 +0000 (UTC) Received: from ben-dt5.candelatech.com (unknown [50.251.239.81]) by mail3.candelatech.com (Postfix) with ESMTP id BFD5D13C2B3; Thu, 7 Mar 2024 11:29:58 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 mail3.candelatech.com BFD5D13C2B3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=candelatech.com; s=default; t=1709839798; bh=licXwMZE9nQRR1VJBrVvcUMfdfPScXi/Vz1g26dmJEU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Tqc3RJMJtNGcThi9Zm0mRh5vbLJU/MCXx5jgEMKn+VMYnE2iY7DHOcOBYi8EnIywU V3z0oQC4MeebkHbHj7OGltJC2ynJQFCIoXRvu3mLD9SbjNfRItsR3xUSyaRog8nwow vGC4PI+zaTXJ5CpIXz8v50EYvZ/mFyDBVi2fYpJM= From: greearb@candelatech.com To: linux-wireless@vger.kernel.org Cc: Ben Greear Subject: [PATCH 3/6] wifi: mt76: mt7996: Enable spectrum management hw flag. Date: Thu, 7 Mar 2024 11:29:48 -0800 Message-ID: <20240307192951.3271156-3-greearb@candelatech.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240307192951.3271156-1-greearb@candelatech.com> References: <20240307192951.3271156-1-greearb@candelatech.com> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MDID: 1709839800-mwwquWsOLHsO X-MDID-O: us5;at1;1709839800;mwwquWsOLHsO;;f7146c1849a4b08a52804beb1c1cdf45 From: Ben Greear This hardware does appear to support changing txpower dynamically. Signed-off-by: Ben Greear --- drivers/net/wireless/mediatek/mt76/mt7996/init.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/init.c b/drivers/net/wireless/mediatek/mt76/mt7996/init.c index d3b72fb73c30..494679a412cf 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7996/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt7996/init.c @@ -402,6 +402,7 @@ mt7996_init_wiphy(struct ieee80211_hw *hw, struct mtk_wed_device *wed) ieee80211_hw_set(hw, SUPPORTS_RX_DECAP_OFFLOAD); ieee80211_hw_set(hw, WANT_MONITOR_VIF); ieee80211_hw_set(hw, SUPPORTS_MULTI_BSSID); + ieee80211_hw_set(hw, SPECTRUM_MGMT); hw->max_tx_fragments = 4; From patchwork Thu Mar 7 19:29:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Greear X-Patchwork-Id: 13586187 X-Patchwork-Delegate: nbd@nbd.name Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [67.231.154.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 921531369A5 for ; Thu, 7 Mar 2024 19:30:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=67.231.154.183 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709839809; cv=none; b=sgfxBLTQ86BhN9RDCBLWQd5aCnVKtQi3sCRV72M7bYLL/GNIXYr/pegXNZqyYBtA8yPZmABgyvwpvDJKmpBcEHQfndl5thR6qxXnJa+ek9vP41Xw63zVUHMkq+UojgrPip917sWsWlpjKNGkgufOeodK+jrDnRkVuKskyAViwZs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709839809; c=relaxed/simple; bh=rz0UWo4M0Y/5XqRmFHUvTF57ACW4KzUMAQaLJ/wXVi4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Tdbnd+EqzqCDpEOphzXaJU3H5tim8NHeuMvDQFnQLIY+UHaD8QbtmT7jcDM1D9B58hQjtsBHCicg0oNgWkjtzTuG0f6tbb1Jk5YtGnXdgC1ieqKW0V9wVJApNuaIHgh6O88BdGEsFe0843DeVjTax6Zkvrfa+qTE+7sDN42Wqx8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=candelatech.com; spf=pass smtp.mailfrom=candelatech.com; dkim=pass (1024-bit key) header.d=candelatech.com header.i=@candelatech.com header.b=Lch9Qr2v; arc=none smtp.client-ip=67.231.154.183 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=candelatech.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=candelatech.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=candelatech.com header.i=@candelatech.com header.b="Lch9Qr2v" Received: from dispatch1-us1.ppe-hosted.com (ip6-localhost [127.0.0.1]) by dispatch1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTP id B63CF503545 for ; Thu, 7 Mar 2024 19:30:06 +0000 (UTC) X-Virus-Scanned: Proofpoint Essentials engine 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 67E318C006C for ; Thu, 7 Mar 2024 19:29:59 +0000 (UTC) Received: from ben-dt5.candelatech.com (unknown [50.251.239.81]) by mail3.candelatech.com (Postfix) with ESMTP id EEA5913C2B4; Thu, 7 Mar 2024 11:29:58 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 mail3.candelatech.com EEA5913C2B4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=candelatech.com; s=default; t=1709839799; bh=rz0UWo4M0Y/5XqRmFHUvTF57ACW4KzUMAQaLJ/wXVi4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Lch9Qr2vb0iXdHMdiJJHcBup2rVm7Y9yAK36RGCUcDnovjp0J8DiRUS9Gy+QWMLsY 4jpEoKMZJSmtUPGfMT2Z9VVDohWwoWGYTVS7fQzfnlm/bPdbkGzlqLNNd/AV5BpHrM 1uBq+64mdBKAoXRrcjbiHulvQeQ9St6BZYFsUNLU= From: greearb@candelatech.com To: linux-wireless@vger.kernel.org Cc: Ben Greear Subject: [PATCH 4/6] wifi: mt76: mt7915: Mitigate mcu communication loss. Date: Thu, 7 Mar 2024 11:29:49 -0800 Message-ID: <20240307192951.3271156-4-greearb@candelatech.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240307192951.3271156-1-greearb@candelatech.com> References: <20240307192951.3271156-1-greearb@candelatech.com> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MDID: 1709839800-eh3T4hxW4-xa X-MDID-O: us5;at1;1709839800;eh3T4hxW4-xa;;f7146c1849a4b08a52804beb1c1cdf45 From: Ben Greear Many calls that end up sending mcu messages to the firmware hold RTNL or other important locks. So when radio stops answering, the entire system becomes very sluggish. Add timeout counter, and if radio times out 3 times in a row, consider it dead and no longer attempt to talk to it. Signed-off-by: Ben Greear --- drivers/net/wireless/mediatek/mt76/dma.c | 14 ++++++++++++++ drivers/net/wireless/mediatek/mt76/mt76.h | 3 +++ drivers/net/wireless/mediatek/mt76/mt7915/mcu.c | 2 ++ 3 files changed, 19 insertions(+) diff --git a/drivers/net/wireless/mediatek/mt76/dma.c b/drivers/net/wireless/mediatek/mt76/dma.c index 00230f106294..4d1426093e1e 100644 --- a/drivers/net/wireless/mediatek/mt76/dma.c +++ b/drivers/net/wireless/mediatek/mt76/dma.c @@ -510,6 +510,20 @@ mt76_dma_tx_queue_skb_raw(struct mt76_dev *dev, struct mt76_queue *q, if (test_bit(MT76_MCU_RESET, &dev->phy.state)) goto error; + /* Check for non responsive radios. Better to just stop sending it messages + * than continuously block the OS (since rtnl and similar are often held while + * the timeout is happening). + */ + if (dev->mcu_timeouts > MAX_MCU_TIMEOUTS) { + static unsigned long last_log; + + if (time_after(jiffies, last_log + 5 * HZ)) { + last_log = jiffies; + mtk_dbg(dev, WRN, "mt76-dma-tx-queue-skb-raw, too many timeouts, msg is dropped.\n"); + } + goto error; + } + if (q->queued + 1 >= q->ndesc - 1) goto error; diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h index dd8a24cda48a..b052a9c24c73 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76.h +++ b/drivers/net/wireless/mediatek/mt76/mt76.h @@ -832,6 +832,9 @@ struct mt76_dev { struct mt76_mcu mcu; u32 first_failed_mcu_cmd; /* for debugging */ u32 last_successful_mcu_cmd; /* for debugging */ + u32 mcu_timeouts; /* sequential timeout counter */ + #define MAX_MCU_TIMEOUTS 3 + struct net_device napi_dev; struct net_device tx_napi_dev; diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c index c67c4f6ca2aa..f3e60fba48b2 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c @@ -161,11 +161,13 @@ mt7915_mcu_parse_response(struct mt76_dev *mdev, int cmd, int ret = 0; if (!skb) { + mdev->mcu_timeouts++; dev_err(mdev->dev, "Message %08x (seq %d) timeout\n", cmd, seq); return -ETIMEDOUT; } + mdev->mcu_timeouts = 0; rxd = (struct mt76_connac2_mcu_rxd *)skb->data; if (seq != rxd->seq && !(rxd->eid == MCU_CMD_EXT_CID && From patchwork Thu Mar 7 19:29:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Greear X-Patchwork-Id: 13586184 X-Patchwork-Delegate: nbd@nbd.name Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [148.163.129.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ABE7C13665B for ; Thu, 7 Mar 2024 19:30:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.129.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709839803; cv=none; b=sjEURe6xX514jWIA7pdin4VCnCiOzS/JYHVFpiI0pTtHIpxA2R9a1zpH4XYamctBRR+m2822y3RY5Fo/qL+AMu+Uqk3oPsBK93dN1e8IeEYZQomcGyLbJ2hTPd8PSFDOO4iqZJyoVpItMWb1XnXeix0XUUZy+Un3QplB6+EPcao= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709839803; c=relaxed/simple; bh=XUPe1YQt2j9RE4yyNTjIiGbnZhOmDr5YvmBxrNxCxbQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GKPuyrsbAmzSmW1wO/CpGK3ULr2NkhpDc+n0cycRFTjbRO9svahwGl7OjhEUtWAevm1bvhBUHv3ThHL4FwctzKqATAirW+zlXU8aYqhqmGbTXrWio1ct43CgWOylJcwO1Fw9lw4HIBPcd3dcrXf2lpfYEPvFm415wJxHHb2xtIU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=candelatech.com; spf=pass smtp.mailfrom=candelatech.com; dkim=pass (1024-bit key) header.d=candelatech.com header.i=@candelatech.com header.b=SanJ2b7e; arc=none smtp.client-ip=148.163.129.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=candelatech.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=candelatech.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=candelatech.com header.i=@candelatech.com header.b="SanJ2b7e" X-Virus-Scanned: Proofpoint Essentials engine 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 8787E50006C for ; Thu, 7 Mar 2024 19:29:59 +0000 (UTC) Received: from ben-dt5.candelatech.com (unknown [50.251.239.81]) by mail3.candelatech.com (Postfix) with ESMTP id 230D813C2B0; Thu, 7 Mar 2024 11:29:59 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 mail3.candelatech.com 230D813C2B0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=candelatech.com; s=default; t=1709839799; bh=XUPe1YQt2j9RE4yyNTjIiGbnZhOmDr5YvmBxrNxCxbQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SanJ2b7eHKkIh1eQpOQqpTgOH+t0LQgdvglcepr7elTNYMDLZb4a0YcsyBmI/oj83 ZBim/a9C/5Nn6Ynftg479lR09XZwULVZbOwFLBPh3crH5vRb7v5eetzUGkwFKcLRTs eszgL84Aq/RODJU+diXi71Zq8ehVeITOAspXTXb4= From: greearb@candelatech.com To: linux-wireless@vger.kernel.org Cc: Ben Greear Subject: [PATCH 5/6] wifi: mt76: mt7996: Mitigate mcu communication loss. Date: Thu, 7 Mar 2024 11:29:50 -0800 Message-ID: <20240307192951.3271156-5-greearb@candelatech.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240307192951.3271156-1-greearb@candelatech.com> References: <20240307192951.3271156-1-greearb@candelatech.com> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MDID: 1709839800-e4EruPvFvAfv X-MDID-O: us5;ut7;1709839800;e4EruPvFvAfv;;f7146c1849a4b08a52804beb1c1cdf45 From: Ben Greear Many calls that end up sending mcu messages to the firmware hold RTNL or other important locks. So when radio stops answering, the entire system becomes very sluggish. Add timeout counter, and if radio times out 3 times in a row, consider it dead and no longer attempt to talk to it. Signed-off-by: Ben Greear --- drivers/net/wireless/mediatek/mt76/mt7996/mcu.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c index 5550671cdaf6..77c89d2d2423 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c @@ -202,14 +202,16 @@ mt7996_mcu_parse_response(struct mt76_dev *mdev, int cmd, if (!skb) { const char *first = "Secondary"; + mdev->mcu_timeouts++; if (!mdev->first_failed_mcu_cmd) first = "Initial"; dev_err(mdev->dev, - "MCU: %s Failure: Message %08x (cid %lx ext_cid: %lx seq %d) timeout. Last successful cmd: 0x%x\n", + "MCU: %s Failure: Message %08x (cid %lx ext_cid: %lx seq %d) timeout (%d/%d). Last successful cmd: 0x%x\n", first, cmd, FIELD_GET(__MCU_CMD_FIELD_ID, cmd), FIELD_GET(__MCU_CMD_FIELD_EXT_ID, cmd), seq, + mdev->mcu_timeouts, MAX_MCU_TIMEOUTS, mdev->last_successful_mcu_cmd); if (!mdev->first_failed_mcu_cmd) @@ -217,6 +219,7 @@ mt7996_mcu_parse_response(struct mt76_dev *mdev, int cmd, return -ETIMEDOUT; } + mdev->mcu_timeouts = 0; mdev->last_successful_mcu_cmd = cmd; if (mdev->first_failed_mcu_cmd) { From patchwork Thu Mar 7 19:29:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Greear X-Patchwork-Id: 13586183 X-Patchwork-Delegate: nbd@nbd.name Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [148.163.129.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8DB5E135A6E for ; Thu, 7 Mar 2024 19:30:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.129.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709839803; cv=none; b=OQEgzJLLPbVyXq5+9AValFuBRDaGpC6lMFSyMiAUq711Alm235mkkzZfWNR/Yh/6LhmO4KcWqDdyLcgOzA9OIWgQyE9XMhfI/hFx3ttyrNp+FFHw8bd0Gwap6HWaoLkO/e093niT3+Ee1w4i25MXbLwRwykWKlgHjnyaviiDAGk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709839803; c=relaxed/simple; bh=WnWuViE8lVO5WJHNpH2NzOz3slYNxvA/iborrhEmiww=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=imdj1AFdE8WX7LefZ3BGW6Uhj6Lod6FpR39yvOmfNy6h1oYCLKWXr9vNpgzMOMu9YeECoMKIxNJjq/2wk68lhqtStUYxihsdEu75O6TFAjJHJwykLwX0fXWK3F+FlIV2eXdtNAm55s+yC1N8QnutaZC2BeNqggd7j1G7UDt1GoE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=candelatech.com; spf=pass smtp.mailfrom=candelatech.com; dkim=pass (1024-bit key) header.d=candelatech.com header.i=@candelatech.com header.b=RH6/ZbNu; arc=none smtp.client-ip=148.163.129.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=candelatech.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=candelatech.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=candelatech.com header.i=@candelatech.com header.b="RH6/ZbNu" X-Virus-Scanned: Proofpoint Essentials engine 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 D744F600091 for ; Thu, 7 Mar 2024 19:29:59 +0000 (UTC) Received: from ben-dt5.candelatech.com (unknown [50.251.239.81]) by mail3.candelatech.com (Postfix) with ESMTP id 4972A13C2B5; Thu, 7 Mar 2024 11:29:59 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 mail3.candelatech.com 4972A13C2B5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=candelatech.com; s=default; t=1709839799; bh=WnWuViE8lVO5WJHNpH2NzOz3slYNxvA/iborrhEmiww=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RH6/ZbNuZ1rpKOj8PetOzMS7Vfez9Cmur7Rbqmrh7kz3kM5HadgQwDM1FPDZIqiGY Gh1NTCqAQOX+2Wh9edyCEJwmBedFEm+rDOogw9S+H3Ra9vJiKzQD4xgCjIxteBXKcw Jy66ZeeMyl1pEHBBFzE4KbnYIyJsvWjZ2GNMv9Lg= From: greearb@candelatech.com To: linux-wireless@vger.kernel.org Cc: Ben Greear Subject: [PATCH 6/6] wifi: mt76: mt7996: Allow ignoring radar events. Date: Thu, 7 Mar 2024 11:29:51 -0800 Message-ID: <20240307192951.3271156-6-greearb@candelatech.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240307192951.3271156-1-greearb@candelatech.com> References: <20240307192951.3271156-1-greearb@candelatech.com> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MDID: 1709839800-Tlxa4G4JDBfk X-MDID-O: us5;ut7;1709839800;Tlxa4G4JDBfk;;f7146c1849a4b08a52804beb1c1cdf45 From: Ben Greear Useful for testing. Signed-off-by: Ben Greear --- .../net/wireless/mediatek/mt76/mt7996/debugfs.c | 2 ++ drivers/net/wireless/mediatek/mt76/mt7996/mcu.c | 14 ++++++++------ drivers/net/wireless/mediatek/mt76/mt7996/mt7996.h | 1 + 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/debugfs.c b/drivers/net/wireless/mediatek/mt76/mt7996/debugfs.c index 9bd953586b04..39008274b493 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7996/debugfs.c +++ b/drivers/net/wireless/mediatek/mt76/mt7996/debugfs.c @@ -806,6 +806,8 @@ int mt7996_init_debugfs(struct mt7996_phy *phy) debugfs_create_devm_seqfile(dev->mt76.dev, "twt_stats", dir, mt7996_twt_stats); debugfs_create_file("rf_regval", 0600, dir, dev, &fops_rf_regval); + debugfs_create_u32("ignore_radar", 0600, dir, + &dev->ignore_radar); if (phy->mt76->cap.has_5ghz) { debugfs_create_u32("dfs_hw_pattern", 0400, dir, diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c index 77c89d2d2423..c31fd2ea18ea 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c @@ -391,12 +391,14 @@ mt7996_mcu_rx_radar_detected(struct mt7996_dev *dev, struct sk_buff *skb) if (!mphy) return; - if (r->band_idx == MT_RX_SEL2) - cfg80211_background_radar_event(mphy->hw->wiphy, - &dev->rdd2_chandef, - GFP_ATOMIC); - else - ieee80211_radar_detected(mphy->hw); + if (!dev->ignore_radar) { + if (r->band_idx == MT_RX_SEL2) + cfg80211_background_radar_event(mphy->hw->wiphy, + &dev->rdd2_chandef, + GFP_ATOMIC); + else + ieee80211_radar_detected(mphy->hw); + } dev->hw_pattern++; } diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/mt7996.h b/drivers/net/wireless/mediatek/mt76/mt7996/mt7996.h index bc73bcb47bf0..8b5eb6e3807f 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7996/mt7996.h +++ b/drivers/net/wireless/mediatek/mt76/mt7996/mt7996.h @@ -286,6 +286,7 @@ struct mt7996_dev { struct list_head twt_list; u32 hw_pattern; + u32 ignore_radar; /* skip propagating up the stack, for debugging */ bool flash_mode:1; bool has_eht:1;