From patchwork Mon Apr 4 22:50:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Greear X-Patchwork-Id: 556162 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 CAFD2C433EF for ; Mon, 4 Apr 2022 23:11:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240973AbiDDXNb (ORCPT ); Mon, 4 Apr 2022 19:13:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245394AbiDDXLw (ORCPT ); Mon, 4 Apr 2022 19:11:52 -0400 Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [148.163.129.48]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B50B26FE for ; Mon, 4 Apr 2022 15:51:02 -0700 (PDT) X-Virus-Scanned: Proofpoint Essentials engine Received: from mx1-us1.ppe-hosted.com (unknown [10.7.67.121]) by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id CFE5C1A0068 for ; Mon, 4 Apr 2022 22:51:00 +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 98C4A4C009F for ; Mon, 4 Apr 2022 22:51:00 +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 0A3EB13C2B0; Mon, 4 Apr 2022 15:51:00 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 mail3.candelatech.com 0A3EB13C2B0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=candelatech.com; s=default; t=1649112660; bh=1iwDxC6ujRhg/xJSQNybtzQggExjPVsczveA7x69l/A=; h=From:To:Cc:Subject:Date:From; b=LDfHC9lTdZZ0sn2AXkN7hnrbWDcnKFB0vjV1saLoQZVlHhHEU+4Af9qKlD66Hj2N+ PbcE11gZE8LHfxMmF7NlpAONU/E1ztW/8hWz5+/aGBZSefh58RDoqulZXzTD4+bSdZ THpKOQioTvEqJ3GOnrDobU76c5zQ/u0WVP4ZfUVE= From: greearb@candelatech.com To: linux-wireless@vger.kernel.org Cc: Ben Greear Subject: [PATCH 1/2] mt76: mt7915: retry pci probe logic up to 3 times. Date: Mon, 4 Apr 2022 15:50:57 -0700 Message-Id: <20220404225058.32475-1-greearb@candelatech.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-MDID: 1649112661-LnSlg-cs1YHA Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Ben Greear On my x86-64 system with 6 mtk7915 radios, one or more radios often fails to start upon reboot. So, do up to 3 retries in the pci probe logic. Example of this mitigation working: [ 8.637908] mt7915e 0000:06:00.0: ASIC revision: 79150000 [ 8.638026] mt7915e 0000:06:00.0: mt7915: register_device Driver-Version: 5.17.0-ct [ 28.863203] mt7915e 0000:06:00.0: MCU: Initial Failure: Message 00000010 (cid 10 ext_cid: 0 seq 1) timeout. Last successful cmd: 0x0 [ 28.873960] mt7915e 0000:06:00.0: Failed to get patch semaphore: -110 [ 28.879141] mt7915e 0000:06:00.0: mcu-init: Failed to load firmware, err: -11 [ 28.879143] mt7915e 0000:06:00.0: mt7915_register_device failed, ret: -11 [ 28.884796] mt7915e 0000:06:00.0: mt7915_pci_probe had error on try 1/3, ret: -11 [ 28.891161] mt7915e 0000:06:00.0: ASIC revision: 79150094 [ 28.891261] mt7915e 0000:06:00.0: mt7915: register_device Driver-Version: 5.17.0-ct [ 29.022875] mt7915e 0000:06:00.0: HW/SW Version: 0x8a108a10, Build Time: 20211222184017a [ 29.033934] mt7915e 0000:06:00.0: WM Firmware Version: ____000000, Build Time: 20211222184052 [ 29.051992] mt7915e 0000:06:00.0: WA Firmware Version: DEV_000000, Build Time: 20211222184111 [ 29.446014] mt7915e 0000:06:00.0: mt7915_pci_probe succeeded on try 2/3 A quick test of traffic shows the radio works fine after recovery. Signed-off-by: Ben Greear --- .../net/wireless/mediatek/mt76/mt7915/pci.c | 61 +++++++++++++------ 1 file changed, 44 insertions(+), 17 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/pci.c b/drivers/net/wireless/mediatek/mt76/mt7915/pci.c index 6f819c41a4c4..07cb8a699b75 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/pci.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/pci.c @@ -92,8 +92,8 @@ static int mt7915_pci_hif2_probe(struct pci_dev *pdev) return 0; } -static int mt7915_pci_probe(struct pci_dev *pdev, - const struct pci_device_id *id) +static int _mt7915_pci_probe(struct pci_dev *pdev, + const struct pci_device_id *id) { struct mt7915_dev *dev; struct mt76_dev *mdev; @@ -101,20 +101,6 @@ static int mt7915_pci_probe(struct pci_dev *pdev, int irq; int ret; - ret = pcim_enable_device(pdev); - if (ret) - return ret; - - ret = pcim_iomap_regions(pdev, BIT(0), pci_name(pdev)); - if (ret) - return ret; - - pci_set_master(pdev); - - ret = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32)); - if (ret) - return ret; - mt76_pci_disable_aspm(pdev); if (id->device == 0x7916 || id->device == 0x790a) @@ -161,8 +147,11 @@ static int mt7915_pci_probe(struct pci_dev *pdev, } ret = mt7915_register_device(dev); - if (ret) + if (ret) { + dev_err(dev->mt76.dev, "mt7915_register_device failed, ret: %d", + ret); goto free_hif2_irq; + } return 0; @@ -181,6 +170,44 @@ static int mt7915_pci_probe(struct pci_dev *pdev, return ret; } +static int mt7915_pci_probe(struct pci_dev *pdev, + const struct pci_device_id *id) +{ + int z; + int ret; + + ret = pcim_enable_device(pdev); + if (ret) + return ret; + + ret = pcim_iomap_regions(pdev, BIT(0), pci_name(pdev)); + if (ret) + return ret; + + pci_set_master(pdev); + + ret = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32)); + if (ret) + return ret; + + for (z = 0; z<3; z++) { + ret = _mt7915_pci_probe(pdev, id); + if (ret) { + dev_err(&pdev->dev, "mt7915_pci_probe had error on try %d/3, ret: %d", + z + 1, ret); + } else { + /* It is worth a message to let user know we succeeded if + * earlier attempts failed. + */ + if (z > 0) + dev_info(&pdev->dev, "mt7915_pci_probe succeeded on try %d/3", + z + 1); + break; + } + } + return ret; +} + static void mt7915_hif_remove(struct pci_dev *pdev) { struct mt7915_hif *hif = pci_get_drvdata(pdev); From patchwork Mon Apr 4 22:50:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Greear X-Patchwork-Id: 556489 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 E1269C433EF for ; Mon, 4 Apr 2022 23:11:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241438AbiDDXNc (ORCPT ); Mon, 4 Apr 2022 19:13:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245452AbiDDXLw (ORCPT ); Mon, 4 Apr 2022 19:11:52 -0400 Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [67.231.154.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E1842714 for ; Mon, 4 Apr 2022 15:51:03 -0700 (PDT) X-Virus-Scanned: Proofpoint Essentials engine Received: from mx1-us1.ppe-hosted.com (unknown [10.110.51.166]) by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id E806B1A006F for ; Mon, 4 Apr 2022 22:51:01 +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 BE62890007C for ; Mon, 4 Apr 2022 22:51:01 +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 2271513C2B0; Mon, 4 Apr 2022 15:51:01 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 mail3.candelatech.com 2271513C2B0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=candelatech.com; s=default; t=1649112661; bh=eTxdnXb0GyBcyBa0Hmicj6RDB/2JX86y/qaBebGfSbw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bMgxhxiLLIgT3GjqaGN2Z9K0jiC3qtOJbLIBtGqzPuBgi6x9XCvVdzLYBJRxmo436 ro1zat9x0mnZU3wCrMAclNAJg2Z6cN0CwgfWvjNkGzh0C0oS4pnnUmkOO+TJP88dS3 SZNTZSFBndEvh00Em7wj5d5qgrNci8QXzELWryrk= From: greearb@candelatech.com To: linux-wireless@vger.kernel.org Cc: Ben Greear Subject: [PATCH 2/2] mt76: mt7915: improve logging around unhandled events. Date: Mon, 4 Apr 2022 15:50:58 -0700 Message-Id: <20220404225058.32475-2-greearb@candelatech.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220404225058.32475-1-greearb@candelatech.com> References: <20220404225058.32475-1-greearb@candelatech.com> MIME-Version: 1.0 X-MDID: 1649112662-vqgomUADLNrx Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Ben Greear It would be good to know of events that firmware is sending that the driver does not currently handle. Signed-off-by: Ben Greear --- .../net/wireless/mediatek/mt76/mt76_connac_mcu.h | 1 + drivers/net/wireless/mediatek/mt76/mt7915/mcu.c | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h index c3c93338d56a..272b107b7e91 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h @@ -820,6 +820,7 @@ enum { MCU_EXT_EVENT_CSA_NOTIFY = 0x4f, MCU_EXT_EVENT_BCC_NOTIFY = 0x75, MCU_EXT_EVENT_MURU_CTRL = 0x9f, + MCU_EXT_EVENT_IGMP_FLOODING = 0xBD, /* Seen on 7915 */ }; enum { diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c index d09cf89c4505..83af8e2ca95f 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c @@ -487,7 +487,13 @@ mt7915_mcu_rx_ext_event(struct mt7915_dev *dev, struct sk_buff *skb) case MCU_EXT_EVENT_BCC_NOTIFY: mt7915_mcu_rx_bcc_notify(dev, skb); break; + case MCU_EXT_EVENT_IGMP_FLOODING: + case MCU_EXT_EVENT_PS_SYNC: + /* ignore some we know we do not care about */ + break; default: + /* in SDK, grep for EventExtEventHandler */ + dev_info(dev->mt76.dev, "mt7915, unhandled rx_ext_event: 0x%x", rxd->ext_eid); break; } } @@ -502,6 +508,7 @@ mt7915_mcu_rx_unsolicited_event(struct mt7915_dev *dev, struct sk_buff *skb) mt7915_mcu_rx_ext_event(dev, skb); break; default: + dev_info(dev->mt76.dev, "mt7915, unhandled unsolicited event: 0x%x", rxd->eid); break; } dev_kfree_skb(skb); @@ -2090,7 +2097,7 @@ static int mt7915_load_patch(struct mt7915_dev *dev) case PATCH_NOT_DL_SEM_SUCCESS: break; default: - dev_err(dev->mt76.dev, "Failed to get patch semaphore\n"); + dev_err(dev->mt76.dev, "Failed to get patch semaphore: %d", sem); return -EAGAIN; } @@ -2530,8 +2537,11 @@ int mt7915_mcu_init(struct mt7915_dev *dev) } ret = mt7915_load_firmware(dev); - if (ret) + if (ret) { + dev_info(dev->mt76.dev, "mcu-init: Failed to load firmware, err: %d", + ret); return ret; + } set_bit(MT76_STATE_MCU_RUNNING, &dev->mphy.state);