From patchwork Sat Nov 4 08:57:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shiji Yang X-Patchwork-Id: 742205 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 14937C4332F for ; Sat, 4 Nov 2023 08:58:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229947AbjKDI6t (ORCPT ); Sat, 4 Nov 2023 04:58:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230159AbjKDI6q (ORCPT ); Sat, 4 Nov 2023 04:58:46 -0400 Received: from JPN01-OS0-obe.outbound.protection.outlook.com (mail-os0jpn01olkn2071.outbound.protection.outlook.com [40.92.98.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A29CD5E; Sat, 4 Nov 2023 01:58:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WAXFqqaQKZlOwgxfpQIAl8wokiiFAcwcFYz/JdyiULCDHGhQupClPtmsgPdFwKC8hpIao5YhdBmKt8uK8pcuCNEMN6qVp6eCW1pm8O6NT+i9e/Q2k6TcW1a06waFsjZe1enIF/PvrmlsaQlOrAANGAyJE/Hvu6XRBE+Rr7GHQDeCPsquj+KdlAvsWkOKBlokQzjQUmrSqkarrGheQxu5A8ma9Aq/+kGWB20zjPzPXQZtc/wFkvsZVDdY/IdeL/HcuWT9JZVGQIc62JKhV/glW42CUpqx8RMNoUR9eY9a2CjtT/O+Hs9JTwQqZ/D8r03OjdoB0mlONYQZI4RF9BOYVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=RwS8nPnOJ+5jS0PMbXFmWbqshZAZOfUzT0xDR0HcJEg=; b=jib2spxuZuSPJdczWIZqCjPlFNBg7GnDC31ujxLLFRO7HzuXNE4bIjZj1AJVNrS/20S3fbL+awi+nRy69BBRaUDXNKG0ao5cgOefB/KQtTA4+db4lpqvrcaFTn7z80Jz6mYJqsYe6wF+WVb6kDa9zoII/e5a/oi27EGFKdBZsOWIbnk7NR+yO0g3kLwmiqNN5TTRAlVsGhlNfLb653TWF9MIjl1qt8d6T1BM2VvPP71JClxxghJcSOWN3G18BBNvQAd4xJLUeXrWF/Cg++Pm4lmMMHLUwlFZ0NVWyccPJdLycdfGICyLICE7c9Z2/1OZ/yK9ghHbS84F/YhW5cN9hA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RwS8nPnOJ+5jS0PMbXFmWbqshZAZOfUzT0xDR0HcJEg=; b=ccK/7FpemXKfI0uYOBzL07CgdpGFQkXVqx6PdAUZ2opj0+g7XXSJUHKyQ/wUDJAUUcOzxkGXDDP8Q8VBOtCxh66uIsx44G1/Lj95jmmkA6isWagrqutyrJthIkVk2X0qEJrfnI4mc1+xHtoZ+PDO3iw0E4sxuOqcIAO2qRdO8h1f0X5EyWJHid0bNNgUNZgz5HDc9RmyubJXZ+ZUfpTXXa2kCQvTYQgsr/2QjmXShcrcPko10/HSpzIXDN3xf0x6x0VhgDMxibeoewjItmyuOHKxVokSU90aks7dr8NM3wklxn/fTjY+kBh+f1G6353n2BXAZtVgEhI4y91igE1HsQ== Received: from TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM (2603:1096:404:8041::8) by TYCP286MB2289.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:15f::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.25; Sat, 4 Nov 2023 08:58:18 +0000 Received: from TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM ([fe80::465a:2534:4d99:a25b]) by TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM ([fe80::465a:2534:4d99:a25b%6]) with mapi id 15.20.6954.025; Sat, 4 Nov 2023 08:58:18 +0000 From: Shiji Yang To: linux-wireless@vger.kernel.org Cc: Stanislaw Gruszka , Kalle Valo , linux-kernel@vger.kernel.org, Shiji Yang Subject: [PATCH v2 1/3] wifi: rt2x00: introduce DMA busy check watchdog for rt2800 Date: Sat, 4 Nov 2023 16:57:58 +0800 Message-ID: X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231104085800.17576-1-yangshiji66@outlook.com> References: <20231104085800.17576-1-yangshiji66@outlook.com> X-TMN: [OZ3VfvqeRrgmpwGHEbKHTDiCI+l7FTZZ] X-ClientProxiedBy: TYCP301CA0090.JPNP301.PROD.OUTLOOK.COM (2603:1096:405:7b::17) To TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM (2603:1096:404:8041::8) X-Microsoft-Original-Message-ID: <20231104085800.17576-2-yangshiji66@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYAP286MB0315:EE_|TYCP286MB2289:EE_ X-MS-Office365-Filtering-Correlation-Id: e566895b-eae7-464c-06d4-08dbdd143042 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 22og/CWJIZLfxjp9PUHjNpDFUtKzwVHzxDh4FJdhvNWr1eHCiZbAxoVi9Ay7lPPlfYQ6fEfcD+jqL3xQLylgBfjPU7R2NpNoH2WML9ByxsAcStb/5h/HOkC2X6Ye//uerMI+neSCJuQNvqSicAbwW8WuVfcw3ba1lfn8M3IWNeu5NKRvkPYsNjXZKRYiZG7y15akahjLVNUxc7Ngb4YYE0auaEw8WJYIqGGNrkrRTjuxxGzNVovbgHg9jVgHdVbSPMmElJIgEeYZymtSpakw9Z2yon5SSbUsKYYQ1Yb7PVgbmvRffaoBCLuHn6/zoivUSqN49jgtbrDG+VDboZDXFyR2qUi20wZcAvRj7muzgWTlcM9hyjOgE4cplT2h3usMjEGKj8Qec1MK/qkVR5QhazHj2P9ISFQo7xikvr3rb89hZOu3BnoqI8wKFTb+F8uLVj32e2VyLaHJ7a64g1tVhMtWDKWxBMCtnWhxFjAqkvGKxC6cx7u4r2XdxMaDBG8QKByIogr37gZKY+ah+GKB/Q3+GMSMYJb00/HtcbYWvlFBw4TnSn4Yn7N5zLTKq4U+PHd2imJO+lpSLETQ8r0Rc5rVIjcpTXPza9/W25gaqmTN0f9puKIi73A08AUyl8sn X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Tia7WVZAFpfI8GqeGmBhswhauwtgJ6pHCXy45UXI+cptdCWIQLMAoZPAIAaNL14BY6N9H5cIyTiODogDmyHpkENMXzLZ0xkL2cwVcaIhCpUa8cRSYmGleUStLxCXouY8r21PnV2VN6OYI5uO2DWXv6ClrlTNxvzXto3JGptkAhdPXfb1ix5dttYqXCDiChB/1nS60RxXsnYE3V8FX0fuQUVqeLAHN7YHx8x/4q4em5K3QY+Raz/znZVGXU9y95rMXGFp8heYxa/V6hiRV+1HLineHHLkafQKywxI9e+pF85pXTSXHqP712j3ATXjueVv4Y6JKUHVLWWdoCZNKdsa+proQESh7u2ZniOgmEMInQS5LsoTsPVo/N8PC27ef7TerW6fsAea7bvrkB0sddpRL3ghd+0v6N1TtsJXBg0bNxK0fo8J92dlUivVNssm66ZN040uzYQajMUSnjFlyokKwYB2u31iM9RPqy2jQUFNWeiqh0EVv7wpxNMp5aH8SqoXdvCbQMp762Ix9mVW/g+fx1TH1Jqw1HwCUGmG7VnqDuHM9pXtbewFsNYtW5fJIWDz09r8iy0nv3oMSPqlYFfHAmXHZePgDCxjj9nkdGIcmaECKv8Djfkblp0uV20YSPS/Be1nrzLWwTGaJc8NtkP3smIKWvm+es8E3GlYjYrR+viMDz59D1C1UgdUJFztCJcmHvkVjk7tuDnw2UZf+zD4stppI3/o/oG4wUMXqfy+7U5/2bv3SK/F/RpxlnDLVguJ7s31BDSg5IzlK7bKfJbdBYb2GLdODQ8rg4+YcV0kkKbA1chjhtqsKKMjcrs2hP7/K33b8JOb/aoRKrOJnSJYLaUPzJjSGngdeY0nJkm7Dr+YpVi8D0b3b6Rld6FpDZgoSPbytCVJswSyKMpUe0vAV3/5fDvhxIlLuRNl2w9+aIdWlsD+XL4Z0MamamXDxPglTiQo5LVamfmubfzBfbL18KT1ezQHH67tmIEI3z6Pe3A9uLPpBhIyZ87L1VrPoYH0dmdTVQp2QpjNmmpME3NuQxzFlwuwtsFl9XSINL65rL/pVplR45OgI6P/iIquD/gW17an0KFM8uS6Y2KUb7O3QBQfNPd/K/2t8/y9wiiDX5Ibrm673Md3/yCshYxH1+wwSKEdNawJ7RgUmBo+P9MCWn76TetxCYIEKGsI0V5E0cKqkzfgnQ7AIyYxacYACZR6DwW8icBCF1/I/Azuhkd/1WVI2BcV5N8XurhXDtE6J7A= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: e566895b-eae7-464c-06d4-08dbdd143042 X-MS-Exchange-CrossTenant-AuthSource: TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2023 08:58:18.5238 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYCP286MB2289 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org When I tried to fix the watchdog of rt2800, I found that sometimes the watchdog can not reset the hung device. This is because the queue is not completely stuck, it just becomes very slow. The MTK vendor driver for the new chip MT7603/MT7612 has a DMA busy watchdog to detect device hangs by checking DMA busy status. This watchdog implementation is something similar to it. To reduce unnecessary reset, we can check the INT_SOURCE_CSR register together as I found that when the radio hung, the RX/TX coherent interrupt will always stuck at triggered state. The 'watchdog' module parameter has been extended to control all watchdogs(0=disabled, 1=hang watchdog, 2=DMA watchdog, 3=both). This new watchdog function is a slight schedule and it won't affect the transmission speed. So we can turn on it by default. Due to the INT_SOURCE_CSR register is invalid on rt2800 USB NICs, the DMA busy watchdog will be automatically disabled for them. Tested on MT7620 and RT5350. Signed-off-by: Shiji Yang Acked-by: Stanislaw Gruszka --- drivers/net/wireless/ralink/rt2x00/rt2800.h | 4 + .../net/wireless/ralink/rt2x00/rt2800lib.c | 77 ++++++++++++++++--- drivers/net/wireless/ralink/rt2x00/rt2x00.h | 3 + 3 files changed, 73 insertions(+), 11 deletions(-) diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800.h b/drivers/net/wireless/ralink/rt2x00/rt2800.h index 48521e455..8930589b4 100644 --- a/drivers/net/wireless/ralink/rt2x00/rt2800.h +++ b/drivers/net/wireless/ralink/rt2x00/rt2800.h @@ -3194,4 +3194,8 @@ enum rt2800_eeprom_word { */ #define BCN_TBTT_OFFSET 64 +/* Watchdog type mask */ +#define RT2800_WATCHDOG_HANG BIT(0) +#define RT2800_WATCHDOG_DMA_BUSY BIT(1) + #endif /* RT2800_H */ diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c index 594dd3d9f..be4f7c144 100644 --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c @@ -30,9 +30,10 @@ #include "rt2800lib.h" #include "rt2800.h" -static bool modparam_watchdog; -module_param_named(watchdog, modparam_watchdog, bool, S_IRUGO); -MODULE_PARM_DESC(watchdog, "Enable watchdog to detect tx/rx hangs and reset hardware if detected"); +static unsigned int modparam_watchdog = RT2800_WATCHDOG_DMA_BUSY; +module_param_named(watchdog, modparam_watchdog, uint, 0444); +MODULE_PARM_DESC(watchdog, "Enable watchdog to recover tx/rx hangs.\n" + "\t\t(0=disabled, 1=hang watchdog, 2=DMA watchdog(default), 3=both)"); /* * Register access. @@ -1260,15 +1261,12 @@ static void rt2800_update_survey(struct rt2x00_dev *rt2x00dev) chan_survey->time_ext_busy += rt2800_register_read(rt2x00dev, CH_BUSY_STA_SEC); } -void rt2800_watchdog(struct rt2x00_dev *rt2x00dev) +static bool rt2800_watchdog_hung(struct rt2x00_dev *rt2x00dev) { struct data_queue *queue; bool hung_tx = false; bool hung_rx = false; - if (test_bit(DEVICE_STATE_SCANNING, &rt2x00dev->flags)) - return; - rt2800_update_survey(rt2x00dev); queue_for_each(rt2x00dev, queue) { @@ -1296,18 +1294,72 @@ void rt2800_watchdog(struct rt2x00_dev *rt2x00dev) } } + if (!hung_tx && !hung_rx) + return false; + if (hung_tx) rt2x00_warn(rt2x00dev, "Watchdog TX hung detected\n"); if (hung_rx) rt2x00_warn(rt2x00dev, "Watchdog RX hung detected\n"); - if (hung_tx || hung_rx) { - queue_for_each(rt2x00dev, queue) - queue->wd_count = 0; + queue_for_each(rt2x00dev, queue) + queue->wd_count = 0; + + return true; +} + +static bool rt2800_watchdog_dma_busy(struct rt2x00_dev *rt2x00dev) +{ + bool busy_rx, busy_tx; + u32 reg_cfg = rt2800_register_read(rt2x00dev, WPDMA_GLO_CFG); + u32 reg_int = rt2800_register_read(rt2x00dev, INT_SOURCE_CSR); + + if (rt2x00_get_field32(reg_cfg, WPDMA_GLO_CFG_RX_DMA_BUSY) && + rt2x00_get_field32(reg_int, INT_SOURCE_CSR_RX_COHERENT)) + rt2x00dev->rxdma_busy++; + else + rt2x00dev->rxdma_busy = 0; + if (rt2x00_get_field32(reg_cfg, WPDMA_GLO_CFG_TX_DMA_BUSY) && + rt2x00_get_field32(reg_int, INT_SOURCE_CSR_TX_COHERENT)) + rt2x00dev->txdma_busy++; + else + rt2x00dev->txdma_busy = 0; + + busy_rx = rt2x00dev->rxdma_busy > 30 ? true : false; + busy_tx = rt2x00dev->txdma_busy > 30 ? true : false; + + if (!busy_rx && !busy_tx) + return false; + + if (busy_rx) + rt2x00_warn(rt2x00dev, "Watchdog RX DMA busy detected\n"); + + if (busy_tx) + rt2x00_warn(rt2x00dev, "Watchdog TX DMA busy detected\n"); + + rt2x00dev->rxdma_busy = 0; + rt2x00dev->txdma_busy = 0; + + return true; +} + +void rt2800_watchdog(struct rt2x00_dev *rt2x00dev) +{ + bool reset = false; + + if (test_bit(DEVICE_STATE_SCANNING, &rt2x00dev->flags)) + return; + + if (modparam_watchdog & RT2800_WATCHDOG_DMA_BUSY) + reset = rt2800_watchdog_dma_busy(rt2x00dev); + + if (modparam_watchdog & RT2800_WATCHDOG_HANG) + reset = rt2800_watchdog_hung(rt2x00dev) || reset; + + if (reset) ieee80211_restart_hw(rt2x00dev->hw); - } } EXPORT_SYMBOL_GPL(rt2800_watchdog); @@ -12015,6 +12067,9 @@ int rt2800_probe_hw(struct rt2x00_dev *rt2x00dev) __set_bit(REQUIRE_TASKLET_CONTEXT, &rt2x00dev->cap_flags); } + /* USB NICs don't support DMA watchdog as INT_SOURCE_CSR is invalid */ + if (rt2x00_is_usb(rt2x00dev)) + modparam_watchdog &= ~RT2800_WATCHDOG_DMA_BUSY; if (modparam_watchdog) { __set_bit(CAPABILITY_RESTART_HW, &rt2x00dev->cap_flags); rt2x00dev->link.watchdog_interval = msecs_to_jiffies(100); diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00.h b/drivers/net/wireless/ralink/rt2x00/rt2x00.h index aaaf99331..62fed38f4 100644 --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h @@ -926,6 +926,9 @@ struct rt2x00_dev { */ u16 beacon_int; + /* Rx/Tx DMA busy watchdog counter */ + u16 rxdma_busy, txdma_busy; + /** * Timestamp of last received beacon */ From patchwork Sat Nov 4 08:57:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shiji Yang X-Patchwork-Id: 741045 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 0147DC4332F for ; Sat, 4 Nov 2023 08:58:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231129AbjKDI67 (ORCPT ); Sat, 4 Nov 2023 04:58:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44664 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231556AbjKDI6y (ORCPT ); Sat, 4 Nov 2023 04:58:54 -0400 Received: from JPN01-OS0-obe.outbound.protection.outlook.com (mail-os0jpn01olkn2071.outbound.protection.outlook.com [40.92.98.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED82B10C3; Sat, 4 Nov 2023 01:58:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=U7gEJz9OLrKrJ4NXabR6B/HRDc9rJEpQ/s+b5MNWBVmOwIqhhIhoANJI7wUKg+yTqpyo+WUeix0imBE2q7/uH24djnPBLGaiNsNpbOW9ep8aPNZKDYUyvzFCN93YgkY87AJbM9bH18boCmf7BTEKo4Y5mu253jQ2sSgoKe2wtXeCgwo54JX1AdHgDSG9ObCZZLprrNJtKLDiqyK7m/cmvKtm+Rs2AnHK8mwiCOpScmEjGjXc+vMy8w7e7Dm0cQSuNdogYA3X07DcQzc0KI5X51b1E5cgq1A+yHrjQQZB/hm9XmT+GMgZy77kswuS5zN1/kOOsqpaC7kMCh84mLmIFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Ckt80JXpGB8R1BBajScypxfzDcInTJdPlUGN9F2/SAk=; b=FK8ERMJeJVwMV+YOIdKmxX+12yS+GvW9UeHqf6FAHsb5YdjDoAiQC09m5IA+0VmI+KyWTTqm/sXQy5cEnk8Q38WUTArgsukyRLOZgwyRFDiJBYb9AyzAXVhvgj0B8dafflnPOtIR2UybF2SDOj00baim6olk5EjSMhNzGNS2ko2/mQZamQQ/MsecDEhShppYzRcJFEhtMMSMhTF+Ky0v7ugnb0xSwKf5YzbWRBukvOHS+UQO9X/VHldrd7zJE4Q5p5zz2BH8kkqvrLQxYBDOW6u2EwICF+NWTSsYFJCJk5SnAeQ5qJsndUrSZS3ljkfQY0n42T1dzthfxDWfiaOJiQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Ckt80JXpGB8R1BBajScypxfzDcInTJdPlUGN9F2/SAk=; b=qDHAMvFIdahOkWUNtGTB1aoZkGM4N84klyoIvDyYibbRrzd1N9rQ7z6R+nGJ+kOS9v4pIYaExdP606XhKR+HzU/OkBSEobaiT1l9e2dbFJhdm3xxY7R6qyhlNV0SJjJQW3RQWpQYR37UjB7HZ2z6yQME0f9oZg/cyUAiJq4XPYfIKok1+LN1JQXh/iVpIAFWoxBnm3f4zzylmIpiUr8Mh51qfzT2UASxxT3mpJ1SoKftZE1S5TPvLKZph4lVz2km8eV1oo1QMCcBHCmh6jR5e3jG9ckb51k56qXa51GxPjrJxSnu+njzNVATxgHzMatZv0YK3Ua4iSxu1jpkHx9bhg== Received: from TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM (2603:1096:404:8041::8) by TYCP286MB2289.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:15f::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.25; Sat, 4 Nov 2023 08:58:20 +0000 Received: from TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM ([fe80::465a:2534:4d99:a25b]) by TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM ([fe80::465a:2534:4d99:a25b%6]) with mapi id 15.20.6954.025; Sat, 4 Nov 2023 08:58:19 +0000 From: Shiji Yang To: linux-wireless@vger.kernel.org Cc: Stanislaw Gruszka , Kalle Valo , linux-kernel@vger.kernel.org, Shiji Yang Subject: [PATCH v2 2/3] wifi: rt2x00: disable RTS threshold for rt2800 by default Date: Sat, 4 Nov 2023 16:57:59 +0800 Message-ID: X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231104085800.17576-1-yangshiji66@outlook.com> References: <20231104085800.17576-1-yangshiji66@outlook.com> X-TMN: [6GqaJoIfJRJxobY0hzO5XyBv7iyUCwx7] X-ClientProxiedBy: TYCP301CA0090.JPNP301.PROD.OUTLOOK.COM (2603:1096:405:7b::17) To TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM (2603:1096:404:8041::8) X-Microsoft-Original-Message-ID: <20231104085800.17576-3-yangshiji66@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYAP286MB0315:EE_|TYCP286MB2289:EE_ X-MS-Office365-Filtering-Correlation-Id: 1dea664b-c366-4fe4-ffe9-08dbdd14311a X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GyHX3Db1voPLtn22fOuGBvitMwUs1MDmsd/jeVpoVpirXFJXQl4nez203+xYo4uXr+W5//3xcAFkpdxN/M2xbZdkDv4IyB3ZEKLHQd+Z2z1AokElZ8TogzRfeuavGcJ3UoQiWfgua2KF6kBNApg+IkITPZpaCFcPr/C6SZ5tdaWLOX3OyFjBeQy0DSYusIieKGi9wq4NIK7c35NcrgG84Sv2GJiOMM6acUJow1BXeYie/WXINAwQ2EQNxhIl3jZEDrunoCg8br3l1lT7wRACDoYy/LczmYuK5R6XXWBSf77px1tGVLWDkRc20XnWed5BUp8mIbVh50tIp0QgQq44PIW9FqmbGA0zGRWt1PiwOeVEH304egP+367uJpDmmdPUvXbpOu8XP4mSwOEslNPJqcN3qhzr7F9hXdYusZWekkGd6pxFVIncJbY51EmPG6qH2iZVt9WpU9SXYhvv91sdgKriA3JgswvA3wuah84PK+XFe5mfM/sdWupxcxAd194XNt1DN79vpT0sDGaa0KUmieNCvffWeGaX/t09MHxtGclhHGwXqGqao431QcqATe5j8inNysA3z8Dywg5KBMMJu+a2+U63oLIbR87cmPnVpHc= X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: PDtZWTxrkAHhR+gURBg5TbpI8tlVwp+h/ezGL+db+i1CQyT4/yZcPpAL790eU66kRLnSvk6FVlIYKOyYa3uFqQCN2gWVVsZyRB9uFDpMHOCIVzdk6xE07RKvnPJfk76Cgf5//++l5PzgF33tcPIyJnk76aIWKkpIz/DSegqCwes+Mlr4f3o8JCz6GyHCKirg6Yfz2gNw691dFvInjrCBaG51KDn+OhUlWBET6zyZXsYxD9R3YE7ftHR0cZ7PqfvrhAitiXUKL43L2rL7x1+qF0QQIgv4C6C+eBaZQvwAtsL8uc1JyZGEXa6WPpBuXLBzAIO979544c4DmcuPNUFAyv3Om32IM3YGkc6ro/Tv8V7bjXv0SqWhu5IQ6YLcgRbACaZcEk9I2euxAYwrLv0B1Cclk2BThg87zynokHu502DG/jawoF92at/636eqF7dNLtVFC05XiDB9r/5AenyJF/n9i8m/oDaqhvtmX5TfD5O6AlEg6P5sZP+vPTtpOCAwSyz/i5O+yDdH51pFkS2g5JSV4/2DZi2ugvQCnyIMSOtiCenQ+dROZZFSgkYmMnqX0tXv8rW/l5A4LGfhI3roFCJwC4MumiflzBuwadqpakBUeGqMq2gCq8EODGdtc5HsSp+iRkolwGQ8moWcy4RraQVPVwUW67Hkh+K8NqaWGFCFVwCC8NyuWsZvaTXycN4Fwr1InWC4ckdIGQsfoRSLqK0iulVjtlb0ineQkVd9eTxUHimpdVVx4QUa7nYOH13SCDggJIwhye/SzNkot3GZcSg4OH8zqlFkdE/Kc7hQdUah/+65UoI2womxjQJi0vAXRkSwI1EL14kSv+Kc1eqWDSSXeJZ31fk8XVbc31+1F6mxR5XwlMWjYMFZFJD0AMdPrIbrgWeOMtrERwMXzPJp0FRGy5PVwjLx5BoNNnHlbwl6m/tweyexYvbFXiluTF+LGHxJNUuCOYY3RytmTFoKMWfLW/PzWHriq9r8cdPtB1xrgTpK2l4qmqUmLtmRek7rvAll1T6PXyrtdU9CWlPU60iBgPmIHC324AYO3WgauajhgCd5goFgoXenW6Fv4fUAmu+vJlZxnioyA0qMrnLXJnW8UxiRSJp0o2axuNDZPHQLhNMmQ+EDbFRXXuDBozAUUMk2OQVAIsh727AqVmvQUCRz4o1yR23FwQ6qkq8Tt14xe+wqb18089OacVyh+YMwYm6JqLbJjFVxgyU4wYpZIzWlbDxQ0pNYaa6RE5thDNo= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1dea664b-c366-4fe4-ffe9-08dbdd14311a X-MS-Exchange-CrossTenant-AuthSource: TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2023 08:58:19.9348 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYCP286MB2289 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org rt2800 has a lot of registers to control the RTS enable/disable status for different rates. And the driver control them via rt2800_set_rts_threshold(). When RTS was disabled in user interface, this function won't be called at all. This means that the RTS is still 'on' for CCK and OFDM rates. So we'd better to disable them by default because it should be like this. The RTS for HT20 and HT40 is already default off so we don't need to touch them. If we toggle the RTS status, these register bits will be enable/disable again by rt2800_set_rts_threshold(). Signed-off-by: Shiji Yang Acked-by: Stanislaw Gruszka --- drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c index be4f7c144..04855490f 100644 --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c @@ -6099,7 +6099,7 @@ static int rt2800_init_registers(struct rt2x00_dev *rt2x00dev) rt2x00_set_field32(®, CCK_PROT_CFG_TX_OP_ALLOW_MM40, 0); rt2x00_set_field32(®, CCK_PROT_CFG_TX_OP_ALLOW_GF20, 1); rt2x00_set_field32(®, CCK_PROT_CFG_TX_OP_ALLOW_GF40, 0); - rt2x00_set_field32(®, CCK_PROT_CFG_RTS_TH_EN, 1); + rt2x00_set_field32(®, CCK_PROT_CFG_RTS_TH_EN, 0); rt2800_register_write(rt2x00dev, CCK_PROT_CFG, reg); reg = rt2800_register_read(rt2x00dev, OFDM_PROT_CFG); @@ -6112,7 +6112,7 @@ static int rt2800_init_registers(struct rt2x00_dev *rt2x00dev) rt2x00_set_field32(®, OFDM_PROT_CFG_TX_OP_ALLOW_MM40, 0); rt2x00_set_field32(®, OFDM_PROT_CFG_TX_OP_ALLOW_GF20, 1); rt2x00_set_field32(®, OFDM_PROT_CFG_TX_OP_ALLOW_GF40, 0); - rt2x00_set_field32(®, OFDM_PROT_CFG_RTS_TH_EN, 1); + rt2x00_set_field32(®, OFDM_PROT_CFG_RTS_TH_EN, 0); rt2800_register_write(rt2x00dev, OFDM_PROT_CFG, reg); reg = rt2800_register_read(rt2x00dev, MM20_PROT_CFG); From patchwork Sat Nov 4 08:58:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shiji Yang X-Patchwork-Id: 742204 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 0799CC4332F for ; Sat, 4 Nov 2023 08:59:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231690AbjKDI7L (ORCPT ); Sat, 4 Nov 2023 04:59:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231681AbjKDI7I (ORCPT ); Sat, 4 Nov 2023 04:59:08 -0400 Received: from JPN01-OS0-obe.outbound.protection.outlook.com (mail-os0jpn01olkn2071.outbound.protection.outlook.com [40.92.98.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8161BD78; Sat, 4 Nov 2023 01:58:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=U+EBoqOXOtsJ6QIucQRrkHqaYWSQhAH4DQtiYSZPDQDYk/tsc756VST9m02FQpDIYYmcuu7Go6CwlmNMeuUn2xqltg7PVOZ1ImUHYP6OLKWDNW+/FRbhTH/3a3Kst33Z3BnpRXsT7gfCIKU4GN627EQfNZwklM7Nnf3LZvkeR9LBpv2Xtnnl1PAUG+n0zcIu20XLzJvohYPAcKKRQQ3RzT97A0trXUYFl1w4/bi2q6NApLAAOIlw175K5IcJfl8b+eoUnwirWC2GMZFuyDwH3Ug+KRbMs9RsgFCroW6qEu4AcGsePyzcpB/KSetlgk3JMl7exr5EqtW8VP3vbm0ASg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=xnkOIjl2W1yovzxHol++eMImW9Dec1syaM6d7FbvEx8=; b=YS+UUkp7aCf/HK+FsKHdbe6hBP+OvMUISolVF9ywJYqOpKJsD0DLnP35y7xnlGvTgAShxKtVRihGUxdJZFy+3thjMOtWAlIiVtdPV0GZSbuZFIRT6gNstwaOPXRAMUdoeFDPJLoatxapa62Yl6/xgwHa8sCDbCEVQ5dg14slO89V/vdErAYl8cB35Gy48gNHcBOBRwkTf9j9P58c0NlUeMKwUhbtrRUe8odvoaioOvdiidd9SW6GJCnRgNYyORne/0GBK84GqVgCy0KrWQ5ESpCiTZoYhUy0UJNmYr+xubqVFcvUv+PakbbIM7Pb70mo0ghapqzn8BrXFqUQJHmZ7Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xnkOIjl2W1yovzxHol++eMImW9Dec1syaM6d7FbvEx8=; b=K8EQp7upVpSfcGLBldQ0NCID2/g2w5WZWJSGODlPdV9kfusmEC5+0W6Rfh4JXrb1ZpiYLeoHDTNWjodpQBhOZLFJav6OUy25oPsQk39dejS4vCFbpDhGEd/YjZQocQEutxMlUFJfigjqDzRsLsJE7xGvmXY5Q5e7EOs07Iff2Eh20oKlAMTacHPzHnx9Vlc1ZjsmlcuOy188EiWu49zUJFGSwiHuj48qvilwv+yJaxBPFaG8UQeWVZihn9b4hnhnNiaHixoktIynSLv3staVkQQ4v1eRWd3Uk3UxkbJ8/HPAg4GrfdPoA6UHhUnbT10uulEPIXSRb/IvQXPStj28DA== Received: from TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM (2603:1096:404:8041::8) by TYCP286MB2289.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:15f::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.25; Sat, 4 Nov 2023 08:58:21 +0000 Received: from TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM ([fe80::465a:2534:4d99:a25b]) by TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM ([fe80::465a:2534:4d99:a25b%6]) with mapi id 15.20.6954.025; Sat, 4 Nov 2023 08:58:21 +0000 From: Shiji Yang To: linux-wireless@vger.kernel.org Cc: Stanislaw Gruszka , Kalle Valo , linux-kernel@vger.kernel.org, Shiji Yang Subject: [PATCH v2 3/3] wifi: rt2x00: restart beacon queue when hardware reset Date: Sat, 4 Nov 2023 16:58:00 +0800 Message-ID: X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231104085800.17576-1-yangshiji66@outlook.com> References: <20231104085800.17576-1-yangshiji66@outlook.com> X-TMN: [apcXweCsE75gzQgJ6Wx8r7nLrqzRDQFB] X-ClientProxiedBy: TYCP301CA0090.JPNP301.PROD.OUTLOOK.COM (2603:1096:405:7b::17) To TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM (2603:1096:404:8041::8) X-Microsoft-Original-Message-ID: <20231104085800.17576-4-yangshiji66@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYAP286MB0315:EE_|TYCP286MB2289:EE_ X-MS-Office365-Filtering-Correlation-Id: c9bfb2ee-2331-4f19-5d60-08dbdd1431f6 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DVCASfiDHdLKARlG9DUcpdL1siqIzGqfvefLsn7ERXoaFhPI+s7lISCC8Bb8TWN0ntoExyKR7TRL3JDI2H62/CCSQU+19vXsuxOqxIVGkwsuDCWJu9p/VXULO4pQN9BtWMXe3KrmooVeUJYfLsDrrqz3zShbtMu0CW+bedJgC2rjZDeqUR4vwpf1liilIxeGZM9pNICcKd5BCjeLubcyVkvEOK7+CVfCfRopFD48RfaxPyD6SaA6XYSPRL4PDkBL7rJq4moZI9T8FxbqnM5sVfMmELxcJSFHxYto2DyDbOkCYDOjqL7Xe8qN4/DPH8T+PdeJmRTJVr6towAgjbUayNjeWuojrP7vD1nSsgH9QE1tnHpJvRyQ6GjwUqm4dpl7zYGJHz4F7zkyp36b8QsCgjuaKhyU/+65v4NddkyXF2req2LVc/UBbZmUkX80LWI/VrJdGTMogOzGCZyGUb+71bDOGthoRJ+AggGsItRNMDVJb9kKrlyHVMYrKe5jxFQ1cGWrJ1aIJO8F+a6JTkiKol4Qb/whIasw942AYB/L9aF1fqD0H/T1z+/9gOcuT1YB9w+iR8XZ6PmtgbeC1IewBAL0ueT0Lw1lxc3QJ1HO+b9nP+TNK78oWXDPzfRtyM49 X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: KsnkYMR444YHJV+a9xzIkFy4P9ojFQJ03P7TlRpP+Apuapoi41tRFo452Z/vd8HsdUgfsp6WWE0MqEkGoBn3InFzJsxJKtUyYTxMUYlPFQKF0dMDcujh2+D0RXGQDPQRQuxNSDrQygJo485UgoU16QigkdBv9q55pSSCyvyEEwLvw/EP/uQdbB0dI0qRgtp3k+KHlaZ6wqjOEgQytJl9F8asFkAvMH5ScGh9BXop0uyoaI7PtuEymasOVDcIOd8WDyr5gPvvs2USIchhHt3xtqKnwyUtQZI/8RCY6qqpZXgeNHJxxLxj1MilxltczhmE5rLBunK9jGXXZo34ks+F7Cym9tIPlPfUMwy3RQYt33CffuqbsWU93djygwEicb1+8pGYnQfnSutVqCHFaTFfPZAA06lxJlO2fG/50y5O8UWRkZj5RcVb0ZuAlvAg1/j/NC+qYqOxj0a+Cw0vgbsj5E5se9z4BeX6NW937WjLoojBc0Q4OBQhrN877TiFKWkhva2c7tXw1wORPUwi/YBBOkz6xqYkJKnczFh6GdB9ErhqZzvpkd5oRnYvIFWSEWWrMqAlGOzNQTwbAAfFFPuVWczo3qiQ6UBJfbqc/FcKB7157PrUaxCJDLbZ8db7vJhTDQl7WzbaXfz5NcN6IHEXnV5lukZo1I+UY84ni+jqMhbUKN7gOaasaEWdP/VQaLL4knP1k2UlhFdShrcsGPIhwzFmYB4/1LQ5QQ9v7NWeEx7RuOWlSr039pdHOZbql+5YyFg/6jbNtMWBB/BSgCp+D06TeEDxCZxQcmMt2ZVhm7aHNh4Sipr+nAI+dKaEIvJTgyv7STtQCxhSSZt1jZmYAd973H6NkkhQ0ide3fGthze/NBKVfKm8/rRPF2fv+JfPcqj48A1nHblPdZGOiXPpvwirUTkhR6TftTkjHvtdzZ4VeluP0ns0p8KLPocjIRpW5hchJrmZurHG4ASqHvByHvMeXpjwjyhbBx3S3MFRt35lyeC5bcvPdLqFx2IsJG+xnIxmC+xPjUbLigRV923pgWzgJ+Chfsp0G7RnEhGTXgI1Xn3WXclMBoNopkwMoopuAzCbFqLNVkoSwA7iIjMFueWiym9nUWEp/PtjA/gQxEWtHJZUQlxZGeBQiQ9KOYqiD2/u5rkn7J+6cZAP3MhtokGeN5nqST3FiZb7n9EGPcDcckj/dCG0Q6TeOjfyMDk0fIv5YNbX1lcKnntgWF3yaw9L9PvFaWNg9J/QeqERXq8= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: c9bfb2ee-2331-4f19-5d60-08dbdd1431f6 X-MS-Exchange-CrossTenant-AuthSource: TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2023 08:58:21.3291 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYCP286MB2289 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org When a hardware reset is triggered, all registers are reset, so all queues are forced to stop in hardware interface. However, mac80211 will not automatically stop the queue. If we don't manually stop the beacon queue, the queue will be deadlocked and unable to start again. This patch fixes the issue where Apple devices cannot connect to the AP after calling ieee80211_restart_hw(). Signed-off-by: Shiji Yang Acked-by: Stanislaw Gruszka --- drivers/net/wireless/ralink/rt2x00/rt2x00dev.c | 3 +++ drivers/net/wireless/ralink/rt2x00/rt2x00mac.c | 11 +++++++++++ 2 files changed, 14 insertions(+) diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c index 9a9cfd0ce..00b945053 100644 --- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c @@ -101,6 +101,7 @@ void rt2x00lib_disable_radio(struct rt2x00_dev *rt2x00dev) rt2x00link_stop_tuner(rt2x00dev); rt2x00queue_stop_queues(rt2x00dev); rt2x00queue_flush_queues(rt2x00dev, true); + rt2x00queue_stop_queue(rt2x00dev->bcn); /* * Disable radio. @@ -1286,6 +1287,7 @@ int rt2x00lib_start(struct rt2x00_dev *rt2x00dev) rt2x00dev->intf_ap_count = 0; rt2x00dev->intf_sta_count = 0; rt2x00dev->intf_associated = 0; + rt2x00dev->intf_beaconing = 0; /* Enable the radio */ retval = rt2x00lib_enable_radio(rt2x00dev); @@ -1312,6 +1314,7 @@ void rt2x00lib_stop(struct rt2x00_dev *rt2x00dev) rt2x00dev->intf_ap_count = 0; rt2x00dev->intf_sta_count = 0; rt2x00dev->intf_associated = 0; + rt2x00dev->intf_beaconing = 0; } static inline void rt2x00lib_set_if_combinations(struct rt2x00_dev *rt2x00dev) diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00mac.c b/drivers/net/wireless/ralink/rt2x00/rt2x00mac.c index 4202c6517..75fda72c1 100644 --- a/drivers/net/wireless/ralink/rt2x00/rt2x00mac.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00mac.c @@ -598,6 +598,17 @@ void rt2x00mac_bss_info_changed(struct ieee80211_hw *hw, */ if (changes & BSS_CHANGED_BEACON_ENABLED) { mutex_lock(&intf->beacon_skb_mutex); + + /* + * Clear the 'enable_beacon' flag and clear beacon because + * the beacon queue has been stopped after hardware reset. + */ + if (test_bit(DEVICE_STATE_RESET, &rt2x00dev->flags) && + intf->enable_beacon) { + intf->enable_beacon = false; + rt2x00queue_clear_beacon(rt2x00dev, vif); + } + if (!bss_conf->enable_beacon && intf->enable_beacon) { rt2x00dev->intf_beaconing--; intf->enable_beacon = false;