All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stanislaw Gruszka <sgruszka@redhat.com>
To: Markus Theil <markus.theil@tu-ilmenau.de>
Cc: nbd@nbd.name, linux-wireless@vger.kernel.org,
	lorenzo.bianconi@redhat.com
Subject: Re: [PATCH v8 6/6] mt76: mt76x02: add channel switch support for usb interfaces
Date: Mon, 25 Nov 2019 18:02:53 +0100	[thread overview]
Message-ID: <20191125170252.GC14273@redhat.com> (raw)
In-Reply-To: <7de34f93-ab33-400b-6b5b-d126bab43b97@tu-ilmenau.de>

On Mon, Nov 25, 2019 at 04:32:42PM +0100, Markus Theil wrote:
> 
> On 11/25/19 3:51 PM, Markus Theil wrote:
> > On 11/25/19 2:04 PM, Stanislaw Gruszka wrote:
> >> On Thu, Nov 21, 2019 at 07:00:01PM +0100, Markus Theil wrote:
> >>> diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_usb_core.c b/drivers/net/wireless/mediatek/mt76/mt76x02_usb_core.c
> >>> index 90c024f12302..b9bd6bfb2a9d 100644
> >>> --- a/drivers/net/wireless/mediatek/mt76/mt76x02_usb_core.c
> >>> +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_usb_core.c
> >>> @@ -210,6 +210,12 @@ static void mt76x02u_pre_tbtt_work(struct work_struct *work)
> >>>  
> >>>  	mt76x02_mac_set_beacon_prepare(dev);
> >>>  
> >>> +	mt76_csa_check(&dev->mt76);
> >>> +	if (dev->mt76.csa_complete) {
> >>> +		mt76_csa_finish(&dev->mt76);
> >>> +		goto out;
> >>> +	}
> >> mmio counterpart setup beacons on CSA, but do not sent buffered
> >> PS frames. Perhaps here we should do the same. However not sending
> >> beacons on one TBTT looks ok to me as well.
> >>
> >> Stanislaw
> >>
> > If I change the order of beacon iteration and csa check, the following warning in mac80211 gets triggered:
> >
> > 	/* the counter should never reach 0 */
> > 	WARN_ON_ONCE(!beacon->csa_current_counter);
> >
> > Dmesg output looks like this:
> >
> > [  153.829617] ------------[ cut here ]------------
> > [  153.829752] WARNING: CPU: 0 PID: 224 at net/mac80211/tx.c:4318 __ieee80211_csa_update_counter.isra.0.part.0+0x5/0x10 [mac80211]
> > [  153.829756] Modules linked in: ccm bridge stp llc nft_masq nft_chain_nat nf_nat nft_reject_inet nf_reject_ipv4 nf_reject_ipv6 nft_reject nft_ct nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 libcrc32c nf_tables_set nf_tables nfnetlink ath10k_pci amd64_edac_mod mt76x2u edac_mce_amd mt76x2_common ath10k_core mt76x02_usb kvm_amd mt76_usb mt76x02_lib mt76 kvm ath mac80211 irqbypass crct10dif_pclmul crc32_pclmul ghash_clmulni_intel cfg80211 pcengines_apuv2 gpio_keys_polled aesni_intel input_polldev crypto_simd gpio_amd_fch cryptd glue_helper igb pcspkr k10temp fam15h_power rfkill sp5100_tco i2c_piix4 libarc4 ccp i2c_algo_bit dca rng_core uio_pdrv_genirq uio leds_gpio evdev mac_hid pinctrl_amd coreboot_table acpi_cpufreq ip_tables x_tables ext4 crc32c_generic crc16 mbcache jbd2 sd_mod ahci sdhci_pci libahci cqhci libata sdhci crc32c_intel xhci_pci ehci_pci mmc_core xhci_hcd scsi_mod ehci_hcd gpio_keys
> > [  153.829948] CPU: 0 PID: 224 Comm: kworker/0:1H Not tainted 5.4.0-rc7-1-01110-g19b7e21c55c8 #32
> > [  153.829952] Hardware name: PC Engines apu2/apu2, BIOS v4.10.0.3 11/07/2019
> > [  153.829966] Workqueue: events_highpri mt76x02u_pre_tbtt_work [mt76x02_usb]
> > [  153.830067] RIP: 0010:__ieee80211_csa_update_counter.isra.0.part.0+0x5/0x10 [mac80211]
> > [  153.830077] Code: 4c 89 4a 18 c3 48 8b 47 10 4c 89 4f 10 48 89 4e 18 48 89 46 20 4c 89 08 eb a1 66 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 <0f> 0b c3 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 41 54 53 48 89 fb
> > [  153.830082] RSP: 0018:ffffbde8803d7c80 EFLAGS: 00010246
> > [  153.830089] RAX: 0000000000000003 RBX: ffffbde8803d7d20 RCX: ffffa3b01df8f658
> > [  153.830093] RDX: ffffbde8803d7d20 RSI: ffffa3b02901d450 RDI: ffffbde8803d7ce0
> > [  153.830097] RBP: ffffa3b0267007a0 R08: ffffffff8d011040 R09: 0000000000000000
> > [  153.830101] R10: ffffa3b029908098 R11: ffffa3b02ab2ab38 R12: 0000000000000000
> > [  153.830105] R13: ffffa3b02901d450 R14: 0000000000000000 R15: ffffa3b0284eae00
> > [  153.830111] FS:  0000000000000000(0000) GS:ffffa3b02aa00000(0000) knlGS:0000000000000000
> > [  153.830115] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> > [  153.830119] CR2: 00007fbb6b5c9f30 CR3: 0000000126ee2000 CR4: 00000000000406f0
> > [  153.830124] Call Trace:
> > [  153.830203]  __ieee80211_beacon_get+0x4c2/0x4d0 [mac80211]
> > [  153.830312]  ieee80211_beacon_get_tim+0x41/0x150 [mac80211]
> > [  153.830336]  mt76x02_update_beacon_iter+0x2d/0x40 [mt76x02_lib]
> > [  153.830352]  ? mt76x02_add_buffered_bc+0x80/0x80 [mt76x02_lib]
> > [  153.830420]  __iterate_interfaces+0x74/0x110 [mac80211]
> > [  153.830469]  ? mt76x02_add_buffered_bc+0x80/0x80 [mt76x02_lib]
> > [  153.830566]  ieee80211_iterate_interfaces+0x3a/0x50 [mac80211]
> > [  153.830580]  mt76x02u_pre_tbtt_work+0x96/0x220 [mt76x02_usb]
> > [  153.830600]  process_one_work+0x1e2/0x3b0
> > [  153.830610]  worker_thread+0x4a/0x3d0
> > [  153.830623]  kthread+0xfb/0x130
> > [  153.830631]  ? process_one_work+0x3b0/0x3b0
> > [  153.830639]  ? kthread_park+0x90/0x90
> > [  153.830650]  ret_from_fork+0x22/0x40
> > [  153.830665] ---[ end trace 7a658e5cbfd0f9d1 ]---
> >
> > Markus
> >
> In my current local changes I've decoupled checking csa_check and mt76_csa_finish, like it is in the mmio case. As usb has no tbtt interrupt,
> I just schedule a delayed work around the estimated beacon transmission time and finish csa there. I'll send another series, if this works.

I would prefer not to add yet another delayed work. Does the warning
still happen if you arrange code like this?

        mt76x02_mac_set_beacon_prepare(dev);

        ieee80211_iterate_active_interfaces(mt76_hw(dev),
                IEEE80211_IFACE_ITER_RESUME_ALL,
                mt76x02_update_beacon_iter, dev);

        mt76_csa_check(&dev->mt76);
        if (dev->mt76.csa_complete) {
                mt76_csa_finish(&dev->mt76);
                goto out;
        }

        nbeacons = hweight8(dev->mt76.beacon_mask);
        mt76x02_enqueue_buffered_bc(dev, &data, N_BCN_SLOTS - nbeacons);
	...
out:
        mt76x02_mac_set_beacon_finish(dev);
        mt76x02u_restart_pre_tbtt_timer(dev);



  reply	other threads:[~2019-11-25 17:03 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-21 17:59 [PATCH v8 0/6] mt76: channel switch support for USB devices Markus Theil
2019-11-21 17:59 ` [PATCH v8 1/6] mt76: mt76x02: ommit beacon slot clearing Markus Theil
2019-11-21 17:59 ` [PATCH v8 2/6] mt76: mt76x02: split beaconing Markus Theil
2019-11-25 13:00   ` Stanislaw Gruszka
2019-11-25 14:07     ` Markus Theil
2019-11-25 16:59       ` Stanislaw Gruszka
2019-11-25 17:12         ` Felix Fietkau
2019-11-25 17:32           ` Stanislaw Gruszka
2019-11-26 10:44           ` Stanislaw Gruszka
2019-11-21 17:59 ` [PATCH v8 3/6] mt76: mt76x02: add check for invalid vif idx Markus Theil
2019-11-24  3:30   ` kbuild test robot
2019-11-24  3:30     ` kbuild test robot
2019-11-21 17:59 ` [PATCH v8 4/6] mt76: mt76x02: remove a copy call for usb speedup Markus Theil
2019-11-25 12:49   ` Stanislaw Gruszka
2019-11-21 18:00 ` [PATCH v8 5/6] mt76: speed up usb bulk copy Markus Theil
2019-11-21 18:00 ` [PATCH v8 6/6] mt76: mt76x02: add channel switch support for usb interfaces Markus Theil
2019-11-25 13:04   ` Stanislaw Gruszka
2019-11-25 14:51     ` Markus Theil
2019-11-25 15:32       ` Markus Theil
2019-11-25 17:02         ` Stanislaw Gruszka [this message]
2019-11-25 18:30           ` Markus Theil
2019-11-25 18:40             ` Markus Theil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191125170252.GC14273@redhat.com \
    --to=sgruszka@redhat.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=lorenzo.bianconi@redhat.com \
    --cc=markus.theil@tu-ilmenau.de \
    --cc=nbd@nbd.name \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.