From patchwork Sun Dec 31 05:03:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rahul Rameshbabu X-Patchwork-Id: 184088 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp3370074dyb; Sat, 30 Dec 2023 21:04:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IHrD1iAFQ+0h18rt4OvtwhDkBIzEL3yM1H8IffpaYqMCusumbgvdcwiBWVH8tgPcym4++v4 X-Received: by 2002:a1c:7c0f:0:b0:40d:5c0e:a679 with SMTP id x15-20020a1c7c0f000000b0040d5c0ea679mr3714137wmc.138.1703999085425; Sat, 30 Dec 2023 21:04:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703999085; cv=none; d=google.com; s=arc-20160816; b=1BvM80gLDoOcY5O9OeKfoCX3+aAVynGXIm7fuoxv9PvAHod8yBaFo//N2PUFyUBKR9 1TVH9j6qilw5ppRvAvqd53+rL6qwLdBZum8deSjpRXxWez3SP/zSBUrTHPCVO9zssHIk paKG4mOQl0DXOalISY+CVaOc8lA7TaUosYGxQcyOIdAcuKQalZZAiNoh9SLWT+U1H6gc lJkL6Ypkf1nHShWgP5dHNjC/v+bEOeaWaGq+WfelfMnl31/8t/g/TDxDOQWbxvhRRZio 0Wkam0Jht1bPfVOD/Abgwu3dXYSft9OfFBXr99YMF3vZHTUZW4I1tnMasMURT0zJVHwy 6BZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:feedback-id:references :in-reply-to:message-id:subject:cc:from:to:date:dkim-signature; bh=Ikr85Z6/yN9nhBhWeQxE+j4mUr9OFD3GvuUtgh2uMSk=; fh=PsnbK8gZ4eZSiF/O9d5dpgr6CuL/1pz8cu0fjhqYkzQ=; b=AeIx70nfrbLX7WUyrc4XbyxU03KVQa+8bfwkaMwAQ0uM/ulYL4VEq9DhyPQXiHnrm6 97za4ycp0GNacfOxp86U4108JO8mnTIGYFw6+7E6pqEMBEiKzGz0OzuLeYHJ7ZwK0XhH dVbGAh6wel52UKH+JhnqaH50KXvC91fHRf/jk8faT16z9qOe5k9CODF5VtZlVXYjILW7 UhnJB74zHoo2LsfQaSwj7bnbx7o3bDXUxWhCudMYq6IiFziZMWdfvmQlMCXdeRYD2L5r IhMM5gPk1esW4j9uFy77Cl0I0MgP4/Lvk9fsNR+riQeLmVn7IqBYAclJBBpteBOcFaJ0 Ab8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@protonmail.com header.s=protonmail3 header.b=Os2dGPbM; spf=pass (google.com: domain of linux-kernel+bounces-13633-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-13633-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=protonmail.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id kt6-20020a170906aac600b00a2346b9a3e6si9287863ejb.690.2023.12.30.21.04.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Dec 2023 21:04:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-13633-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@protonmail.com header.s=protonmail3 header.b=Os2dGPbM; spf=pass (google.com: domain of linux-kernel+bounces-13633-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-13633-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=protonmail.com 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 am.mirrors.kernel.org (Postfix) with ESMTPS id DCE1A1F220CA for ; Sun, 31 Dec 2023 05:04:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8ACC279E4; Sun, 31 Dec 2023 05:04:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=protonmail.com header.i=@protonmail.com header.b="Os2dGPbM" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-40134.protonmail.ch (mail-40134.protonmail.ch [185.70.40.134]) (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 8ACB53C37 for ; Sun, 31 Dec 2023 05:03:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=protonmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=protonmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1703999032; x=1704258232; bh=Ikr85Z6/yN9nhBhWeQxE+j4mUr9OFD3GvuUtgh2uMSk=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=Os2dGPbMJw5UkLLO/e/zJ2a57GOunjgW98EY6kjJIDqW8SSz3Ke5CYhE9y0hxvfs2 jy0PULC2LKBS+Fo41iZT4850YhAil/V0EhIcVlaITqOFq8Co4M2h7q8bLUghFtJisc ea74FLCI9MTigtgXymgnd6u1bun1WgKdidwgBFp8t7QcByc/6GDi7Di1zAxtyRpyo6 IuPifjhfrNmR3Vobg9rPQjKtlnRoojOhoQRHndsFE+uEQrzo5oL8GSiZbArzLh9GjQ ygwyMlS+ql3HDTNXMcrzZqQnzCqjVVV2wId7IfKxyELmN70PWYKjWbi4WgOelFjSO4 oDo70EX1aiJdg== Date: Sun, 31 Dec 2023 05:03:33 +0000 To: Kalle Valo , Larry Finger , =?utf-8?q?Michael_B=C3=BCsch?= , Julian Calaby From: Rahul Rameshbabu Cc: linux-wireless@vger.kernel.org, b43-dev@lists.infradead.org, linux-kernel@vger.kernel.org, Rahul Rameshbabu Subject: [PATCH wireless v2 1/4] wifi: b43: Stop/wake correct queue in DMA Tx path when QoS is disabled Message-ID: <20231231050300.122806-2-sergeantsagara@protonmail.com> In-Reply-To: <20231231050300.122806-1-sergeantsagara@protonmail.com> References: <20231231050300.122806-1-sergeantsagara@protonmail.com> Feedback-ID: 26003777:user:proton Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1786772544961058699 X-GMAIL-MSGID: 1786772544961058699 When QoS is disabled, the queue priority value will not map to the correct ieee80211 queue since there is only one queue. Stop/wake queue 0 when QoS is disabled to prevent trying to stop/wake a non-existent queue and failing to stop/wake the actual queue instantiated. Log of issue before change (with kernel parameter qos=0): [ +5.112651] ------------[ cut here ]------------ [ +0.000005] WARNING: CPU: 7 PID: 25513 at net/mac80211/util.c:449 __ieee80211_wake_queue+0xd5/0x180 [mac80211] [ +0.000067] Modules linked in: b43(O) snd_seq_dummy snd_hrtimer snd_seq snd_seq_device nft_chain_nat xt_MASQUERADE nf_nat xfrm_user xfrm_algo xt_addrtype overlay ccm af_packet amdgpu snd_hda_codec_cirrus snd_hda_codec_generic ledtrig_audio drm_exec amdxcp gpu_sched xt_conntrack nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 ip6t_rpfilter ipt_rpfilter xt_pkttype xt_LOG nf_log_syslog xt_tcpudp nft_compat nf_tables nfnetlink sch_fq_codel btusb uinput iTCO_wdt ctr btrtl intel_pmc_bxt i915 intel_rapl_msr mei_hdcp mei_pxp joydev at24 watchdog btintel atkbd libps2 serio radeon btbcm vivaldi_fmap btmtk intel_rapl_common snd_hda_codec_hdmi bluetooth uvcvideo nls_iso8859_1 applesmc nls_cp437 x86_pkg_temp_thermal snd_hda_intel intel_powerclamp vfat videobuf2_vmalloc coretemp fat snd_intel_dspcfg crc32_pclmul uvc polyval_clmulni snd_intel_sdw_acpi loop videobuf2_memops snd_hda_codec tun drm_suballoc_helper polyval_generic drm_ttm_helper drm_buddy tap ecdh_generic videobuf2_v4l2 gf128mul macvlan ttm ghash_clmulni_intel ecc tg3 [ +0.000044] videodev bridge snd_hda_core rapl crc16 drm_display_helper cec mousedev snd_hwdep evdev intel_cstate bcm5974 hid_appleir videobuf2_common stp mac_hid libphy snd_pcm drm_kms_helper acpi_als mei_me intel_uncore llc mc snd_timer intel_gtt industrialio_triggered_buffer apple_mfi_fastcharge i2c_i801 mei snd lpc_ich agpgart ptp i2c_smbus thunderbolt apple_gmux i2c_algo_bit kfifo_buf video industrialio soundcore pps_core wmi tiny_power_button sbs sbshc button ac cordic bcma mac80211 cfg80211 ssb rfkill libarc4 kvm_intel kvm drm irqbypass fuse backlight firmware_class efi_pstore configfs efivarfs dmi_sysfs ip_tables x_tables autofs4 dm_crypt cbc encrypted_keys trusted asn1_encoder tee tpm rng_core input_leds hid_apple led_class hid_generic usbhid hid sd_mod t10_pi crc64_rocksoft crc64 crc_t10dif crct10dif_generic ahci libahci libata uhci_hcd ehci_pci ehci_hcd crct10dif_pclmul crct10dif_common sha512_ssse3 sha512_generic sha256_ssse3 sha1_ssse3 aesni_intel usbcore scsi_mod libaes crypto_simd cryptd scsi_common [ +0.000055] usb_common rtc_cmos btrfs blake2b_generic libcrc32c crc32c_generic crc32c_intel xor raid6_pq dm_snapshot dm_bufio dm_mod dax [last unloaded: b43(O)] [ +0.000009] CPU: 7 PID: 25513 Comm: irq/17-b43 Tainted: G W O 6.6.7 #1-NixOS [ +0.000003] Hardware name: Apple Inc. MacBookPro8,3/Mac-942459F5819B171B, BIOS 87.0.0.0.0 06/13/2019 [ +0.000001] RIP: 0010:__ieee80211_wake_queue+0xd5/0x180 [mac80211] [ +0.000046] Code: 00 45 85 e4 0f 85 9b 00 00 00 48 8d bd 40 09 00 00 f0 48 0f ba ad 48 09 00 00 00 72 0f 5b 5d 41 5c 41 5d 41 5e e9 cb 6d 3c d0 <0f> 0b 5b 5d 41 5c 41 5d 41 5e c3 cc cc cc cc 48 8d b4 16 94 00 00 [ +0.000002] RSP: 0018:ffffc90003c77d60 EFLAGS: 00010097 [ +0.000001] RAX: 0000000000000001 RBX: 0000000000000002 RCX: 0000000000000000 [ +0.000001] RDX: 0000000000000000 RSI: 0000000000000002 RDI: ffff88820b924900 [ +0.000002] RBP: ffff88820b924900 R08: ffffc90003c77d90 R09: 000000000003bfd0 [ +0.000001] R10: ffff88820b924900 R11: ffffc90003c77c68 R12: 0000000000000000 [ +0.000001] R13: 0000000000000000 R14: ffffc90003c77d90 R15: ffffffffc0fa6f40 [ +0.000001] FS: 0000000000000000(0000) GS:ffff88846fb80000(0000) knlGS:0000000000000000 [ +0.000001] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ +0.000001] CR2: 00007fafda7ae008 CR3: 000000046d220005 CR4: 00000000000606e0 [ +0.000002] Call Trace: [ +0.000003] [ +0.000001] ? __ieee80211_wake_queue+0xd5/0x180 [mac80211] [ +0.000044] ? __warn+0x81/0x130 [ +0.000005] ? __ieee80211_wake_queue+0xd5/0x180 [mac80211] [ +0.000045] ? report_bug+0x171/0x1a0 [ +0.000004] ? handle_bug+0x41/0x70 [ +0.000004] ? exc_invalid_op+0x17/0x70 [ +0.000003] ? asm_exc_invalid_op+0x1a/0x20 [ +0.000005] ? __ieee80211_wake_queue+0xd5/0x180 [mac80211] [ +0.000043] ieee80211_wake_queue+0x4a/0x80 [mac80211] [ +0.000044] b43_dma_handle_txstatus+0x29c/0x3a0 [b43] [ +0.000016] ? __pfx_irq_thread_fn+0x10/0x10 [ +0.000002] b43_handle_txstatus+0x61/0x80 [b43] [ +0.000012] b43_interrupt_thread_handler+0x3f9/0x6b0 [b43] [ +0.000011] irq_thread_fn+0x23/0x60 [ +0.000002] irq_thread+0xfe/0x1c0 [ +0.000002] ? __pfx_irq_thread_dtor+0x10/0x10 [ +0.000001] ? __pfx_irq_thread+0x10/0x10 [ +0.000001] kthread+0xe8/0x120 [ +0.000003] ? __pfx_kthread+0x10/0x10 [ +0.000003] ret_from_fork+0x34/0x50 [ +0.000002] ? __pfx_kthread+0x10/0x10 [ +0.000002] ret_from_fork_asm+0x1b/0x30 [ +0.000004] [ +0.000001] ---[ end trace 0000000000000000 ]--- [ +0.000065] ------------[ cut here ]------------ [ +0.000001] WARNING: CPU: 0 PID: 56077 at net/mac80211/util.c:514 __ieee80211_stop_queue+0xcc/0xe0 [mac80211] [ +0.000077] Modules linked in: b43(O) snd_seq_dummy snd_hrtimer snd_seq snd_seq_device nft_chain_nat xt_MASQUERADE nf_nat xfrm_user xfrm_algo xt_addrtype overlay ccm af_packet amdgpu snd_hda_codec_cirrus snd_hda_codec_generic ledtrig_audio drm_exec amdxcp gpu_sched xt_conntrack nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 ip6t_rpfilter ipt_rpfilter xt_pkttype xt_LOG nf_log_syslog xt_tcpudp nft_compat nf_tables nfnetlink sch_fq_codel btusb uinput iTCO_wdt ctr btrtl intel_pmc_bxt i915 intel_rapl_msr mei_hdcp mei_pxp joydev at24 watchdog btintel atkbd libps2 serio radeon btbcm vivaldi_fmap btmtk intel_rapl_common snd_hda_codec_hdmi bluetooth uvcvideo nls_iso8859_1 applesmc nls_cp437 x86_pkg_temp_thermal snd_hda_intel intel_powerclamp vfat videobuf2_vmalloc coretemp fat snd_intel_dspcfg crc32_pclmul uvc polyval_clmulni snd_intel_sdw_acpi loop videobuf2_memops snd_hda_codec tun drm_suballoc_helper polyval_generic drm_ttm_helper drm_buddy tap ecdh_generic videobuf2_v4l2 gf128mul macvlan ttm ghash_clmulni_intel ecc tg3 [ +0.000073] videodev bridge snd_hda_core rapl crc16 drm_display_helper cec mousedev snd_hwdep evdev intel_cstate bcm5974 hid_appleir videobuf2_common stp mac_hid libphy snd_pcm drm_kms_helper acpi_als mei_me intel_uncore llc mc snd_timer intel_gtt industrialio_triggered_buffer apple_mfi_fastcharge i2c_i801 mei snd lpc_ich agpgart ptp i2c_smbus thunderbolt apple_gmux i2c_algo_bit kfifo_buf video industrialio soundcore pps_core wmi tiny_power_button sbs sbshc button ac cordic bcma mac80211 cfg80211 ssb rfkill libarc4 kvm_intel kvm drm irqbypass fuse backlight firmware_class efi_pstore configfs efivarfs dmi_sysfs ip_tables x_tables autofs4 dm_crypt cbc encrypted_keys trusted asn1_encoder tee tpm rng_core input_leds hid_apple led_class hid_generic usbhid hid sd_mod t10_pi crc64_rocksoft crc64 crc_t10dif crct10dif_generic ahci libahci libata uhci_hcd ehci_pci ehci_hcd crct10dif_pclmul crct10dif_common sha512_ssse3 sha512_generic sha256_ssse3 sha1_ssse3 aesni_intel usbcore scsi_mod libaes crypto_simd cryptd scsi_common [ +0.000084] usb_common rtc_cmos btrfs blake2b_generic libcrc32c crc32c_generic crc32c_intel xor raid6_pq dm_snapshot dm_bufio dm_mod dax [last unloaded: b43] [ +0.000012] CPU: 0 PID: 56077 Comm: kworker/u16:17 Tainted: G W O 6.6.7 #1-NixOS [ +0.000003] Hardware name: Apple Inc. MacBookPro8,3/Mac-942459F5819B171B, BIOS 87.0.0.0.0 06/13/2019 [ +0.000001] Workqueue: phy7 b43_tx_work [b43] [ +0.000019] RIP: 0010:__ieee80211_stop_queue+0xcc/0xe0 [mac80211] [ +0.000076] Code: 74 11 48 8b 78 08 0f b7 d6 89 e9 4c 89 e6 e8 ab f4 00 00 65 ff 0d 9c b7 34 3f 0f 85 55 ff ff ff 0f 1f 44 00 00 e9 4b ff ff ff <0f> 0b 5b 5d 41 5c 41 5d c3 cc cc cc cc 0f 1f 80 00 00 00 00 90 90 [ +0.000002] RSP: 0000:ffffc90004157d50 EFLAGS: 00010097 [ +0.000002] RAX: 0000000000000001 RBX: 0000000000000002 RCX: 0000000000000000 [ +0.000002] RDX: 0000000000000000 RSI: 0000000000000002 RDI: ffff8882d65d0900 [ +0.000002] RBP: 0000000000000000 R08: 0000000000000001 R09: 0000000000000001 [ +0.000001] R10: 00000000000000ff R11: ffff88814d0155a0 R12: ffff8882d65d0900 [ +0.000002] R13: 0000000000000000 R14: ffff8881002d2800 R15: 00000000000000d0 [ +0.000002] FS: 0000000000000000(0000) GS:ffff88846f800000(0000) knlGS:0000000000000000 [ +0.000003] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ +0.000002] CR2: 00007f2e8c10c880 CR3: 0000000385b66005 CR4: 00000000000606f0 [ +0.000002] Call Trace: [ +0.000001] [ +0.000001] ? __ieee80211_stop_queue+0xcc/0xe0 [mac80211] [ +0.000075] ? __warn+0x81/0x130 [ +0.000004] ? __ieee80211_stop_queue+0xcc/0xe0 [mac80211] [ +0.000075] ? report_bug+0x171/0x1a0 [ +0.000005] ? handle_bug+0x41/0x70 [ +0.000003] ? exc_invalid_op+0x17/0x70 [ +0.000004] ? asm_exc_invalid_op+0x1a/0x20 [ +0.000004] ? __ieee80211_stop_queue+0xcc/0xe0 [mac80211] [ +0.000076] ieee80211_stop_queue+0x36/0x50 [mac80211] [ +0.000077] b43_dma_tx+0x550/0x780 [b43] [ +0.000023] b43_tx_work+0x90/0x130 [b43] [ +0.000018] process_one_work+0x174/0x340 [ +0.000003] worker_thread+0x27b/0x3a0 [ +0.000004] ? __pfx_worker_thread+0x10/0x10 [ +0.000002] kthread+0xe8/0x120 [ +0.000003] ? __pfx_kthread+0x10/0x10 [ +0.000004] ret_from_fork+0x34/0x50 [ +0.000002] ? __pfx_kthread+0x10/0x10 [ +0.000003] ret_from_fork_asm+0x1b/0x30 [ +0.000006] [ +0.000001] ---[ end trace 0000000000000000 ]--- Fixes: e6f5b934fba8 ("b43: Add QOS support") Signed-off-by: Rahul Rameshbabu Reviewed-by: Julian Calaby --- Notes: Changes: v1->v2: - Refactored logic with helpers (suggested by Larry Finger ) Issue Details: When QoS was first introduced to the b43 driver in commit e6f5b934fba8 ("b43: Add QOS support"), four rings were allocated for different QoS priorities for video, voice, best effort, and background. The core networking stack maps these priorities in the skb, and these mappings are noted in the ring's queue_prio member. When disabling QoS in the driver, the skb will still contain the mapping for the core stack while only one queue is actually considered active (the best effort queue). In the situation that QoS is disabled, b43 needs to pass 0 to ieee80211 queue functions since the number of queues is set to 1 in the struct ieee80211_hw queues member. drivers/net/wireless/broadcom/b43/b43.h | 16 ++++++++++++++++ drivers/net/wireless/broadcom/b43/dma.c | 4 ++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/broadcom/b43/b43.h b/drivers/net/wireless/broadcom/b43/b43.h index 67b4bac048e5..c0d8fc0b22fb 100644 --- a/drivers/net/wireless/broadcom/b43/b43.h +++ b/drivers/net/wireless/broadcom/b43/b43.h @@ -1082,6 +1082,22 @@ static inline bool b43_using_pio_transfers(struct b43_wldev *dev) return dev->__using_pio_transfers; } +static inline void b43_wake_queue(struct b43_wldev *dev, int queue_prio) +{ + if (dev->qos_enabled) + ieee80211_wake_queue(dev->wl->hw, queue_prio); + else + ieee80211_wake_queue(dev->wl->hw, 0); +} + +static inline void b43_stop_queue(struct b43_wldev *dev, int queue_prio) +{ + if (dev->qos_enabled) + ieee80211_stop_queue(dev->wl->hw, queue_prio); + else + ieee80211_stop_queue(dev->wl->hw, 0); +} + /* Message printing */ __printf(2, 3) void b43info(struct b43_wl *wl, const char *fmt, ...); __printf(2, 3) void b43err(struct b43_wl *wl, const char *fmt, ...); diff --git a/drivers/net/wireless/broadcom/b43/dma.c b/drivers/net/wireless/broadcom/b43/dma.c index 760d1a28edc6..6ac7dcebfff9 100644 --- a/drivers/net/wireless/broadcom/b43/dma.c +++ b/drivers/net/wireless/broadcom/b43/dma.c @@ -1399,7 +1399,7 @@ int b43_dma_tx(struct b43_wldev *dev, struct sk_buff *skb) should_inject_overflow(ring)) { /* This TX ring is full. */ unsigned int skb_mapping = skb_get_queue_mapping(skb); - ieee80211_stop_queue(dev->wl->hw, skb_mapping); + b43_stop_queue(dev, skb_mapping); dev->wl->tx_queue_stopped[skb_mapping] = true; ring->stopped = true; if (b43_debug(dev, B43_DBG_DMAVERBOSE)) { @@ -1570,7 +1570,7 @@ void b43_dma_handle_txstatus(struct b43_wldev *dev, } else { /* If the driver queue is running wake the corresponding * mac80211 queue. */ - ieee80211_wake_queue(dev->wl->hw, ring->queue_prio); + b43_wake_queue(dev, ring->queue_prio); if (b43_debug(dev, B43_DBG_DMAVERBOSE)) { b43dbg(dev->wl, "Woke up TX ring %d\n", ring->index); } From patchwork Sun Dec 31 05:03:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rahul Rameshbabu X-Patchwork-Id: 184087 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp3369983dyb; Sat, 30 Dec 2023 21:04:27 -0800 (PST) X-Google-Smtp-Source: AGHT+IF0JmZ9QRgAlHFlm1azi/kgyWHDY8Jx8lBfdiV0ojg0TS1CAV+3GNvQ3k+z0kmfqhLkcWUo X-Received: by 2002:a05:6e02:19c6:b0:35f:f11b:c41e with SMTP id r6-20020a056e0219c600b0035ff11bc41emr20932227ill.1.1703999066944; Sat, 30 Dec 2023 21:04:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703999066; cv=none; d=google.com; s=arc-20160816; b=r4KJAxjYSARKCHPENNXgJlIql/mn7t/T9hAO808orr0D6eln0ipRvlS81FdP01yWKQ nITXLAVXfEYeAbI8DlOmooFhtjggYuu+wlLOBCZ0+f4MhVxzuRRKNgoKIH86bcr3lJ2q dbZbpM3Bx8LaMct7zPSHIqdKVv7oSMoc1lx89ggsWNvfzkOlJIHqZETwXTjoqi+AFdP6 B3lu90/gLf2YWUe9YO82xFkMSutE747qA51yNpCFjHpaLL/5KJQXcx3U0XU46YydVfjf uI2Ra5gq/H9hfvmABERBbc1QWFNs8kZ6guFj7VM/8J5BDG7ZQ6dTyNDMjsJg6s5VDI3U hPxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:feedback-id:references :in-reply-to:message-id:subject:cc:from:to:date:dkim-signature; bh=nMmY4lgSrVOhiGZvska8zO0P9lepPYf3Fiw+Sy4tIfM=; fh=PsnbK8gZ4eZSiF/O9d5dpgr6CuL/1pz8cu0fjhqYkzQ=; b=QnEuzgMaHxQerOqaEyFujldVskQcEgyoUDJ97d2BJN9rdZgWKFCn7jM5jWqDCnbcRC TsB3pwVUmtOiqn6w8oGu0hJLHY/IOrbrg0YPmqVfJuL/TtCvllemswf+qHAryD5jlDX1 aF4qBFTPmVhm8H95FLHiUBE+8GIUuCbte8GGef8RE8IC4FxDAel1FXGgmv597VeWnY+q 3BnKm/jy4PAYgeK9eRS4Kp/N/Jsjvx+Ge9Fizn/Ihr6lg4kb5C6+P5alcsZCZ7+uic71 6wWXPJII2g1X8596/e60IN7JDIm7ZLyqOYECUjOBIA/hPWodfCbBsfccZvAmaYVc4GbF SoGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@protonmail.com header.s=protonmail3 header.b=jr2j+Kfc; spf=pass (google.com: domain of linux-kernel+bounces-13632-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-13632-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=protonmail.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id h10-20020a170902b94a00b001d49dc1dbf6si3413784pls.295.2023.12.30.21.04.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Dec 2023 21:04:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-13632-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@protonmail.com header.s=protonmail3 header.b=jr2j+Kfc; spf=pass (google.com: domain of linux-kernel+bounces-13632-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-13632-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=protonmail.com 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id AAA0E283147 for ; Sun, 31 Dec 2023 05:04:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C81C54698; Sun, 31 Dec 2023 05:04:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=protonmail.com header.i=@protonmail.com header.b="jr2j+Kfc" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-4322.protonmail.ch (mail-4322.protonmail.ch [185.70.43.22]) (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 410CD258F for ; Sun, 31 Dec 2023 05:03:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=protonmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=protonmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1703999034; x=1704258234; bh=nMmY4lgSrVOhiGZvska8zO0P9lepPYf3Fiw+Sy4tIfM=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=jr2j+Kfc4KlGvnS8FgkLquzWm38h6gO/Dm8FrvOU5KyM+gSPjvfkFr8EZeaFjVD7A 6DewXceSr5rOj+JqkZVDf+yg14Ni5d0eYG/fKz1k/v1q7lMtOohYm8qdT+QQZrj3yw /jdIYshMvSabOI9FoE4/OjKXnfkpfLijeXzfCTcjjDIcuIn2fR0opr1WIgp0yO48BQ gDY2ccGLeCOwtReCvzlF2e663WorzVNdWrA+/sGbm9xQlIbcnRldTxZNvAMnGYj/g2 sI4vLxBF/E1b2YaCxb2gyImD6HGSrXltHyUCTa8JJAqGowJbg1zY01+wJBtJGsio7q QEPjXlt3CPUoA== Date: Sun, 31 Dec 2023 05:03:45 +0000 To: Kalle Valo , Larry Finger , =?utf-8?q?Michael_B=C3=BCsch?= , Julian Calaby From: Rahul Rameshbabu Cc: linux-wireless@vger.kernel.org, b43-dev@lists.infradead.org, linux-kernel@vger.kernel.org, Rahul Rameshbabu Subject: [PATCH wireless v2 2/4] wifi: b43: Stop/wake correct queue in PIO Tx path when QoS is disabled Message-ID: <20231231050300.122806-3-sergeantsagara@protonmail.com> In-Reply-To: <20231231050300.122806-1-sergeantsagara@protonmail.com> References: <20231231050300.122806-1-sergeantsagara@protonmail.com> Feedback-ID: 26003777:user:proton Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1786772525736162719 X-GMAIL-MSGID: 1786772525736162719 When QoS is disabled, the queue priority value will not map to the correct ieee80211 queue since there is only one queue. Stop/wake queue 0 when QoS is disabled to prevent trying to stop/wake a non-existent queue and failing to stop/wake the actual queue instantiated. Fixes: 5100d5ac81b9 ("b43: Add PIO support for PCMCIA devices") Signed-off-by: Rahul Rameshbabu Reviewed-by: Julian Calaby --- Notes: Changes: v1->v2: - Refactored logic with helpers (suggested by Larry Finger ) Issue Details: When PIO support was first introduced to the b43 driver in commit 5100d5ac81b9 ("b43: Add PIO support for PCMCIA devices"), four queues were allocated for different QoS priorities for video, voice, best effort, and background. This was modelled after commit e6f5b934fba8 ("b43: Add QOS support"), which has the following issue. The core networking stack maps these priorities in the skb, and these mappings are noted in the ring's queue_prio member. When disabling QoS in the driver, the skb will still contain the mapping for the core stack while only one queue is actually considered active (the best effort queue). In the situation that QoS is disabled, b43 needs to pass 0 to ieee80211 queue functions since the number of queues is set to 1 in the struct ieee80211_hw queues member. drivers/net/wireless/broadcom/b43/pio.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/broadcom/b43/pio.c b/drivers/net/wireless/broadcom/b43/pio.c index 0cf70fdb60a6..e41f2f5b4c26 100644 --- a/drivers/net/wireless/broadcom/b43/pio.c +++ b/drivers/net/wireless/broadcom/b43/pio.c @@ -525,7 +525,7 @@ int b43_pio_tx(struct b43_wldev *dev, struct sk_buff *skb) if (total_len > (q->buffer_size - q->buffer_used)) { /* Not enough memory on the queue. */ err = -EBUSY; - ieee80211_stop_queue(dev->wl->hw, skb_get_queue_mapping(skb)); + b43_stop_queue(dev, skb_get_queue_mapping(skb)); q->stopped = true; goto out; } @@ -552,7 +552,7 @@ int b43_pio_tx(struct b43_wldev *dev, struct sk_buff *skb) if (((q->buffer_size - q->buffer_used) < roundup(2 + 2 + 6, 4)) || (q->free_packet_slots == 0)) { /* The queue is full. */ - ieee80211_stop_queue(dev->wl->hw, skb_get_queue_mapping(skb)); + b43_stop_queue(dev, skb_get_queue_mapping(skb)); q->stopped = true; } @@ -587,7 +587,7 @@ void b43_pio_handle_txstatus(struct b43_wldev *dev, list_add(&pack->list, &q->packets_list); if (q->stopped) { - ieee80211_wake_queue(dev->wl->hw, q->queue_prio); + b43_wake_queue(dev, q->queue_prio); q->stopped = false; } } From patchwork Sun Dec 31 05:03:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rahul Rameshbabu X-Patchwork-Id: 184089 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp3370164dyb; Sat, 30 Dec 2023 21:05:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IFmcVFXSQMzL8JeSFYZ17QF791hrMtPiuVj8B0s+EmYDqXTcwcOkG+Z8XZb7BpdeVfHX4Gt X-Received: by 2002:a05:6808:448e:b0:3bb:c657:f5a4 with SMTP id eq14-20020a056808448e00b003bbc657f5a4mr10462237oib.114.1703999105908; Sat, 30 Dec 2023 21:05:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703999105; cv=none; d=google.com; s=arc-20160816; b=UY/HzUwoXIbxPGlP7ZYLa1+E0FSprkGxWM3rx3ttnH12b2YThtDGt9lay1m39z3b00 RjDJXoAIHEfHikWLu1sPEW+CB4H+hVpQXDIz8fRcPCDynIBvNZl9QmaRisQ4pwfcfc1P L6tWpGJWu+658aTdoeaUO0ibknBtgoE4RHgU6bE/NbLaqkJlOxa4+EQp4U68WbXaw+v9 KF85BCG7O/l67YmLiZ0DK7UsiN2uPN7rUXGmWDEfd5E6jWC767ChyxZYbvcyDX8XMcqG ev+jebJm6EH9g/C8x86Vjkzfu5TZNdqoidypBzl5b2fMmF5M3q2rVcMmMfMEKIRQ1fCM FJ/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:feedback-id:references :in-reply-to:message-id:subject:cc:from:to:date:dkim-signature; bh=NmMPrf58wJ+F6E+Z9exyRV+1aoIrZhkWoXl0KSFnTL8=; fh=PsnbK8gZ4eZSiF/O9d5dpgr6CuL/1pz8cu0fjhqYkzQ=; b=uL18jAm+kl8aslaDY4Vs1EfQB2BNoGSIOYsczqQp+XIvKYP+2fj/j4uofgJUaK4Ac1 c4dJjVd/j03G8jx+gyzjQzlpBrxsebsiwgdJs1BozXb0ShCibzebHuZuVv6b17IWbqdQ VQ3MK3ByiXFNv+U9FByjyCbQNBDY8H0joaV3ODO1mmKVG++2ZggVodqLbDNb/YjKU+uj RSPubFfQU6NYIvBo9/afFkfpU+RJnrO1d2Ivm6iLaba+PhlrlN5pMSp60y1oJDyEhPF/ EKEzVKCMM/H+pExUPIGebsGLoebVZc60/1w8ezmNdPHJ6Wo2km47GZuFIPNsEnbaVoJ5 aVVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@protonmail.com header.s=protonmail3 header.b=d53RqzNm; spf=pass (google.com: domain of linux-kernel+bounces-13634-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-13634-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=protonmail.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id e1-20020a17090301c100b001d0cc15ffddsi17254871plh.154.2023.12.30.21.05.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Dec 2023 21:05:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-13634-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@protonmail.com header.s=protonmail3 header.b=d53RqzNm; spf=pass (google.com: domain of linux-kernel+bounces-13634-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-13634-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=protonmail.com 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id C9810283168 for ; Sun, 31 Dec 2023 05:04:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B6281A930; Sun, 31 Dec 2023 05:04:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=protonmail.com header.i=@protonmail.com header.b="d53RqzNm" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-4322.protonmail.ch (mail-4322.protonmail.ch [185.70.43.22]) (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 C30BB8C19 for ; Sun, 31 Dec 2023 05:04:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=protonmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=protonmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1703999044; x=1704258244; bh=NmMPrf58wJ+F6E+Z9exyRV+1aoIrZhkWoXl0KSFnTL8=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=d53RqzNmwVXdT0sdMUyczQg3vCLBYpudkcdSeDv2z9O8kr5RRNoxoeSN0wIM4Wu55 s0Mjy/VXwTgV9ZdLes4EFNC5/6uoqz4A3RX20LoSHmj7TkfWfJa1WJPjA1guCSQQzR Tr+4bt6qNyftRGhw+9+ZKoi9/N2UilHADgG+vRVTovZpIe8PvQYTlTWK+atiMf8LFb 5NIJbjbGjhJ0J4D1uDbMFw2Vuov+d081qOkg8FaZIj4lUpQY604ePhQqG6em1T1+yz 26U/ebp18KHovz6W0yN8gSiq3t6P2ZfabKCChawC5WOC3qmhaofHeQG6X2tUEZpJfS R4LwqPKYCoi/w== Date: Sun, 31 Dec 2023 05:03:51 +0000 To: Kalle Valo , Larry Finger , =?utf-8?q?Michael_B=C3=BCsch?= , Julian Calaby From: Rahul Rameshbabu Cc: linux-wireless@vger.kernel.org, b43-dev@lists.infradead.org, linux-kernel@vger.kernel.org, Rahul Rameshbabu Subject: [PATCH wireless v2 3/4] wifi: b43: Stop correct queue in DMA worker when QoS is disabled Message-ID: <20231231050300.122806-4-sergeantsagara@protonmail.com> In-Reply-To: <20231231050300.122806-1-sergeantsagara@protonmail.com> References: <20231231050300.122806-1-sergeantsagara@protonmail.com> Feedback-ID: 26003777:user:proton Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1786772566583442857 X-GMAIL-MSGID: 1786772566583442857 When QoS is disabled, the queue priority value will not map to the correct ieee80211 queue since there is only one queue. Stop queue 0 when QoS is disabled to prevent trying to stop a non-existent queue and failing to stop the actual queue instantiated. Fixes: bad691946966 ("b43: avoid packet losses in the dma worker code.") Signed-off-by: Rahul Rameshbabu Reviewed-by: Julian Calaby --- Notes: Changes: v1->v2: - Refactored logic with helpers (suggested by Larry Finger ) Issue Details: When QoS was first introduced to the b43 driver in commit e6f5b934fba8 ("b43: Add QOS support"), four rings were allocated for different QoS priorities for video, voice, best effort, and background. The core networking stack maps these priorities in the skb, and these mappings are noted in the ring's queue_prio member. When disabling QoS in the driver, the skb will still contain the mapping for the core stack while only one queue is actually considered active (the best effort queue). In the situation that QoS is disabled, b43 needs to pass 0 to ieee80211 queue functions since the number of queues is set to 1 in the struct ieee80211_hw queues member. This issue was then extended to the changes in commit bad691946966 ("b43: avoid packet losses in the dma worker code."). drivers/net/wireless/broadcom/b43/main.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/broadcom/b43/main.c b/drivers/net/wireless/broadcom/b43/main.c index 92ca0b2ca286..97d8bdeaa06c 100644 --- a/drivers/net/wireless/broadcom/b43/main.c +++ b/drivers/net/wireless/broadcom/b43/main.c @@ -3603,7 +3603,7 @@ static void b43_tx_work(struct work_struct *work) err = b43_dma_tx(dev, skb); if (err == -ENOSPC) { wl->tx_queue_stopped[queue_num] = true; - ieee80211_stop_queue(wl->hw, queue_num); + b43_stop_queue(dev, queue_num); skb_queue_head(&wl->tx_queue[queue_num], skb); break; } @@ -3627,6 +3627,7 @@ static void b43_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb) { struct b43_wl *wl = hw_to_b43_wl(hw); + u16 skb_queue_mapping; if (unlikely(skb->len < 2 + 2 + 6)) { /* Too short, this can't be a valid frame. */ @@ -3635,12 +3636,12 @@ static void b43_op_tx(struct ieee80211_hw *hw, } B43_WARN_ON(skb_shinfo(skb)->nr_frags); - skb_queue_tail(&wl->tx_queue[skb->queue_mapping], skb); - if (!wl->tx_queue_stopped[skb->queue_mapping]) { + skb_queue_mapping = skb_get_queue_mapping(skb); + skb_queue_tail(&wl->tx_queue[skb_queue_mapping], skb); + if (!wl->tx_queue_stopped[skb_queue_mapping]) ieee80211_queue_work(wl->hw, &wl->tx_work); - } else { - ieee80211_stop_queue(wl->hw, skb->queue_mapping); - } + else + b43_stop_queue(wl->current_dev, skb_queue_mapping); } static void b43_qos_params_upload(struct b43_wldev *dev,