2021-11-19 21:36:54

by Jupiter

[permalink] [raw]
Subject: mwifiex reset buggy

Hi,

After days debugging, enabled CONFIG_MMC_DEBUG=y, I suspect the
mwifiex reset issue could still be a mwifiex bug.

I use firmware sd8801_uapsta.bin, it is able to connect to the WiFi
network, but reset either from WiFi modem or following command killed
WiFi, disabled mwifiex and wiped off /sys/kernel/debug/mwifiex/mlan0:

# echo 1 > /sys/kernel/debug/mwifiex/mlan0/reset

[ 416.311114] mwifiex_sdio mmc0:0001:1: Resetting per request
[ 416.333491] mwifiex_sdio mmc0:0001:1: info: successfully
disconnected from 34:08:04:12:b1:a2: reason code 3
[ 416.366368] mwifiex_sdio mmc0:0001:1: info: shutdown mwifiex...
[ 416.374812] mwifiex_sdio mmc0:0001:1: PREP_CMD: card is removed
[ 416.381431] mwifiex_sdio mmc0:0001:1: deleting the crypto keys
[ 416.387455] mwifiex_sdio mmc0:0001:1: PREP_CMD: card is removed
[ 416.393423] mwifiex_sdio mmc0:0001:1: deleting the crypto keys
[ 416.399401] mwifiex_sdio mmc0:0001:1: PREP_CMD: card is removed
[ 416.405364] mwifiex_sdio mmc0:0001:1: deleting the crypto keys
[ 416.411332] mwifiex_sdio mmc0:0001:1: PREP_CMD: card is removed
[ 416.417410] mwifiex_sdio mmc0:0001:1: deleting the crypto keys
[ 416.423293] mwifiex_sdio mmc0:0001:1: PREP_CMD: card is removed
[ 416.429349] mwifiex_sdio mmc0:0001:1: deleting the crypto keys
root@solar:~# [ 416.546386] mwifiex_sdio mmc0:0001:1: PREP_CMD: card is removed
[ 416.583278] mwifiex_sdio mmc0:0001:1: PREP_CMD: card is removed
[ 416.888906] IPv6: ADDRCONF(NETDEV_UP): sit0: link is not ready
[ 416.894822] IPv6: ADDRCONF(NETDEV_UP): wwan0: link is not ready
[ 417.302781] mwifiex_sdio mmc0:0001:1: WLAN FW already running! Skip FW dnld
[ 417.310149] mwifiex_sdio mmc0:0001:1: WLAN FW is active
[ 427.490344] mwifiex_sdio mmc0:0001:1: mwifiex_cmd_timeout_func:
Timeout cmd id = 0xa9, act = 0x0
[ 427.499732] mwifiex_sdio mmc0:0001:1: num_data_h2c_failure = 0
[ 427.505825] mwifiex_sdio mmc0:0001:1: num_cmd_h2c_failure = 0
[ 427.511751] mwifiex_sdio mmc0:0001:1: is_cmd_timedout = 1
[ 427.517216] mwifiex_sdio mmc0:0001:1: num_tx_timeout = 0
[ 427.522686] mwifiex_sdio mmc0:0001:1: last_cmd_index = 1
[ 427.528063] mwifiex_sdio mmc0:0001:1: last_cmd_id: 28 00 a9 00 07
01 07 01 24 00
[ 427.535612] mwifiex_sdio mmc0:0001:1: last_cmd_act: 13 00 00 00 00
00 00 00 34 08
[ 427.543248] mwifiex_sdio mmc0:0001:1: last_cmd_resp_index = 0
[ 427.549058] mwifiex_sdio mmc0:0001:1: last_cmd_resp_id: 28 80 07 81
07 81 07 81 24 80
[ 427.557033] mwifiex_sdio mmc0:0001:1: last_event_index = 3
[ 427.562670] mwifiex_sdio mmc0:0001:1: last_event: 0b 00 0a 00 0b 00
0a 00 0a 00
[ 427.570045] mwifiex_sdio mmc0:0001:1: data_sent=0 cmd_sent=0
[ 427.575852] mwifiex_sdio mmc0:0001:1: ps_mode=0 ps_state=0
[ 427.591087] mwifiex_sdio mmc0:0001:1: info: _mwifiex_fw_dpc:
unregister device

The /sys/kernel/debug/mwifiex/mlan0 was deleted:

# ls /sys/kernel/debug/mwifiex/

Looked at Douglas Anderson post "Fix Marvell WiFi reset by adding SDIO
API to replug card"
https://patchwork.kernel.org/project/linux-mmc/cover/[email protected]/,
I believe mwifiex should be able to replug card after reset, is it
still buggy or is it the firmware sd8801_uapsta.bin problem?

Thank you.

Kind regards,

- JH


2021-11-19 21:48:46

by Doug Anderson

[permalink] [raw]
Subject: Re: mwifiex reset buggy

Hi,

On Fri, Nov 19, 2021 at 1:36 PM Jupiter <[email protected]> wrote:
>
> Hi,
>
> After days debugging, enabled CONFIG_MMC_DEBUG=y, I suspect the
> mwifiex reset issue could still be a mwifiex bug.
>
> I use firmware sd8801_uapsta.bin, it is able to connect to the WiFi
> network, but reset either from WiFi modem or following command killed
> WiFi, disabled mwifiex and wiped off /sys/kernel/debug/mwifiex/mlan0:
>
> # echo 1 > /sys/kernel/debug/mwifiex/mlan0/reset
>
> [ 416.311114] mwifiex_sdio mmc0:0001:1: Resetting per request
> [ 416.333491] mwifiex_sdio mmc0:0001:1: info: successfully
> disconnected from 34:08:04:12:b1:a2: reason code 3
> [ 416.366368] mwifiex_sdio mmc0:0001:1: info: shutdown mwifiex...
> [ 416.374812] mwifiex_sdio mmc0:0001:1: PREP_CMD: card is removed
> [ 416.381431] mwifiex_sdio mmc0:0001:1: deleting the crypto keys
> [ 416.387455] mwifiex_sdio mmc0:0001:1: PREP_CMD: card is removed
> [ 416.393423] mwifiex_sdio mmc0:0001:1: deleting the crypto keys
> [ 416.399401] mwifiex_sdio mmc0:0001:1: PREP_CMD: card is removed
> [ 416.405364] mwifiex_sdio mmc0:0001:1: deleting the crypto keys
> [ 416.411332] mwifiex_sdio mmc0:0001:1: PREP_CMD: card is removed
> [ 416.417410] mwifiex_sdio mmc0:0001:1: deleting the crypto keys
> [ 416.423293] mwifiex_sdio mmc0:0001:1: PREP_CMD: card is removed
> [ 416.429349] mwifiex_sdio mmc0:0001:1: deleting the crypto keys
> root@solar:~# [ 416.546386] mwifiex_sdio mmc0:0001:1: PREP_CMD: card is removed
> [ 416.583278] mwifiex_sdio mmc0:0001:1: PREP_CMD: card is removed
> [ 416.888906] IPv6: ADDRCONF(NETDEV_UP): sit0: link is not ready
> [ 416.894822] IPv6: ADDRCONF(NETDEV_UP): wwan0: link is not ready
> [ 417.302781] mwifiex_sdio mmc0:0001:1: WLAN FW already running! Skip FW dnld
> [ 417.310149] mwifiex_sdio mmc0:0001:1: WLAN FW is active
> [ 427.490344] mwifiex_sdio mmc0:0001:1: mwifiex_cmd_timeout_func:
> Timeout cmd id = 0xa9, act = 0x0
> [ 427.499732] mwifiex_sdio mmc0:0001:1: num_data_h2c_failure = 0
> [ 427.505825] mwifiex_sdio mmc0:0001:1: num_cmd_h2c_failure = 0
> [ 427.511751] mwifiex_sdio mmc0:0001:1: is_cmd_timedout = 1
> [ 427.517216] mwifiex_sdio mmc0:0001:1: num_tx_timeout = 0
> [ 427.522686] mwifiex_sdio mmc0:0001:1: last_cmd_index = 1
> [ 427.528063] mwifiex_sdio mmc0:0001:1: last_cmd_id: 28 00 a9 00 07
> 01 07 01 24 00
> [ 427.535612] mwifiex_sdio mmc0:0001:1: last_cmd_act: 13 00 00 00 00
> 00 00 00 34 08
> [ 427.543248] mwifiex_sdio mmc0:0001:1: last_cmd_resp_index = 0
> [ 427.549058] mwifiex_sdio mmc0:0001:1: last_cmd_resp_id: 28 80 07 81
> 07 81 07 81 24 80
> [ 427.557033] mwifiex_sdio mmc0:0001:1: last_event_index = 3
> [ 427.562670] mwifiex_sdio mmc0:0001:1: last_event: 0b 00 0a 00 0b 00
> 0a 00 0a 00
> [ 427.570045] mwifiex_sdio mmc0:0001:1: data_sent=0 cmd_sent=0
> [ 427.575852] mwifiex_sdio mmc0:0001:1: ps_mode=0 ps_state=0
> [ 427.591087] mwifiex_sdio mmc0:0001:1: info: _mwifiex_fw_dpc:
> unregister device
>
> The /sys/kernel/debug/mwifiex/mlan0 was deleted:
>
> # ls /sys/kernel/debug/mwifiex/
>
> Looked at Douglas Anderson post "Fix Marvell WiFi reset by adding SDIO
> API to replug card"
> https://patchwork.kernel.org/project/linux-mmc/cover/[email protected]/,
> I believe mwifiex should be able to replug card after reset, is it
> still buggy or is it the firmware sd8801_uapsta.bin problem?

I think I blocked most of this stuff out of my mind and it's also been
over 2 years. ;-) ...but any chance that Bluetooth could somehow be
involved, too? I seem to remember that things got complicated because
we could have both functions going at once. I think I advocated for
keeping it simple and always doing a full unplug / replug of the card
to reset it, but from notes I guess upstream landed it so you need to
handle the two cases (just WiFi vs WiFi+BT) in totally different ways.

It looks like there's ongoing discussion going on in
https://issuetracker.google.com/172214846. Maybe something there would
be helpful?

-Doug

2021-11-20 00:16:50

by Jupiter

[permalink] [raw]
Subject: Re: mwifiex reset buggy

Hi Doug,

Thank you for your kindly response.

> I think I blocked most of this stuff out of my mind and it's also been
> over 2 years. ;-) ...but any chance that Bluetooth could somehow be
> involved, too? I seem to remember that things got complicated because
> we could have both functions going at once. I think I advocated for
> keeping it simple and always doing a full unplug / replug of the card
> to reset it, but from notes I guess upstream landed it so you need to
> handle the two cases (just WiFi vs WiFi+BT) in totally different ways.

I think the main issue is many of you tested the mwifiex reset on
Marvell card (or BT?), unfortunately I am using uBlox Lily module
which is a WiFi only no Bluetooth, it is a iMX6ULL custom design, MMC
and SDIO are based on iMX6ULL EVK. I don't think anyone tested mwifiex
reset on that card, to make it worse, I am new to mwifiex, I might be
able to assist with debugging, but certainly not in the position to
contribute to fixing it.

> It looks like there's ongoing discussion going on in
> https://issuetracker.google.com/172214846. Maybe something there would
> be helpful?

I am using mwifiex on kernel upstream v4.19.75, does that include your
fix? Do you have a patch I can add to my Yocto build? Should I make
comments to the discussion at
https://issuetracker.google.com/172214846?

Thank you very much Doug.

- JH

2021-11-23 04:39:26

by Jupiter

[permalink] [raw]
Subject: Re: mwifiex reset buggy

Hi Doug,

I have updated the kernel to 5.10.59 which should be guaranteed to
include your reset patch.

But I could not connect to the WiFi.

# ifconfig mlan0 up
[10262.988302] mwifiex_sdio mmc0:0001:1: host_to_card, write iomem
(1) failed: -110
[10262.996049] mwifiex_sdio mmc0:0001:1: write CFG reg failed
[10263.007337] mwifiex_sdio mmc0:0001:1: host_to_card, write iomem
(2) failed: -110
[10263.015299] mwifiex_sdio mmc0:0001:1: write CFG reg failed
[10263.021675] mwifiex_sdio mmc0:0001:1: host_to_card, write iomem
(3) failed: -110
[10263.029839] mwifiex_sdio mmc0:0001:1: write CFG reg failed
[10263.035386] mwifiex_sdio mmc0:0001:1: DNLD_CMD: host to card failed

# echo 1 > /sys/kernel/debug/mwifiex/mlan0/reset
[10517.451193] mwifiex_sdio mmc0:0001:1: Resetting per request
[10517.479235] mwifiex_sdio mmc0:0001:1: host_to_card, write iomem
(1) failed: -110
[10517.490283] mwifiex_sdio mmc0:0001:1: write CFG reg failed
[10517.498995] mwifiex_sdio mmc0:0001:1: host_to_card, write iomem
(2) failed: -110
[10517.509257] mwifiex_sdio mmc0:0001:1: write CFG reg failed
[10517.517649] mwifiex_sdio mmc0:0001:1: host_to_card, write iomem
(3) failed: -110
[10517.527838] mwifiex_sdio mmc0:0001:1: write CFG reg failed
[10517.533765] mwifiex_sdio mmc0:0001:1: DNLD_CMD: host to card failed

[10529.871099] mwifiex_sdio mmc0:0001:1: cmd_wait_q terminated: -110
[10529.883401] mwifiex_sdio mmc0:0001:1: PREP_CMD: FW in reset state
[10529.890488] mwifiex_sdio mmc0:0001:1: deleting the crypto keys
[10529.896573] mwifiex_sdio mmc0:0001:1: PREP_CMD: FW in reset state
[10529.903316] mwifiex_sdio mmc0:0001:1: deleting the crypto keys

[10530.014334] mwifiex_sdio mmc0:0001:1: DNLD_CMD: host to card failed
[10530.049847] mwifiex_sdio mmc0:0001:1: info: shutdown mwifiex...
[10530.239910] mwifiex_sdio mmc0:0001:1: PREP_CMD: card is removed
[10530.247919] mwifiex_sdio mmc0:0001:1: PREP_CMD: card is removed
[10530.268721] mwifiex_sdio mmc0:0001:1: PREP_CMD: card is removed
[10531.665962] mwifiex_sdio mmc0:0001:1: info: FW download over, size
255988 bytes
[10531.911608] mwifiex_sdio mmc0:0001:1: WLAN FW is active
[10531.964352] mwifiex_sdio mmc0:0001:1: CMD_RESP: cmd 0x242 error, result=0x2
[10531.971894] mwifiex_sdio mmc0:0001:1: mwifiex_process_cmdresp: cmd
0x242 failed during initialization
[10532.125947] mwifiex_sdio mmc0:0001:1: info: MWIFIEX VERSION:
mwifiex 1.0 (14.68.36.p204)
[10532.134573] mwifiex_sdio mmc0:0001:1: driver_version = mwifiex 1.0
(14.68.36.p204)

Again, the /sys/kernel/debug/mwifiex/mlan0 is removed, it is
completely broken for both WiFi modem reset and
/sys/kernel/debug/mwifiex/mlan0/reset, let me know your advice to
debug it or modify mwifiex source files.

Thank you.

Kind regards,

- JH

On 11/20/21, Jupiter <[email protected]> wrote:
> Hi Doug,
>
> Thank you for your kindly response.
>
>> I think I blocked most of this stuff out of my mind and it's also been
>> over 2 years. ;-) ...but any chance that Bluetooth could somehow be
>> involved, too? I seem to remember that things got complicated because
>> we could have both functions going at once. I think I advocated for
>> keeping it simple and always doing a full unplug / replug of the card
>> to reset it, but from notes I guess upstream landed it so you need to
>> handle the two cases (just WiFi vs WiFi+BT) in totally different ways.
>
> I think the main issue is many of you tested the mwifiex reset on
> Marvell card (or BT?), unfortunately I am using uBlox Lily module
> which is a WiFi only no Bluetooth, it is a iMX6ULL custom design, MMC
> and SDIO are based on iMX6ULL EVK. I don't think anyone tested mwifiex
> reset on that card, to make it worse, I am new to mwifiex, I might be
> able to assist with debugging, but certainly not in the position to
> contribute to fixing it.
>
>> It looks like there's ongoing discussion going on in
>> https://issuetracker.google.com/172214846. Maybe something there would
>> be helpful?
>
> I am using mwifiex on kernel upstream v4.19.75, does that include your
> fix? Do you have a patch I can add to my Yocto build? Should I make
> comments to the discussion at
> https://issuetracker.google.com/172214846?
>
> Thank you very much Doug.
>
> - JH
>


--
"A man can fail many times, but he isn't a failure until he begins to
blame somebody else."
-- John Burroughs

2021-12-01 21:19:34

by Doug Anderson

[permalink] [raw]
Subject: Re: mwifiex reset buggy

Hi,

On Mon, Nov 22, 2021 at 8:39 PM Jupiter <[email protected]> wrote:
>
> Hi Doug,
>
> I have updated the kernel to 5.10.59 which should be guaranteed to
> include your reset patch.
>
> But I could not connect to the WiFi.
>
> # ifconfig mlan0 up
> [10262.988302] mwifiex_sdio mmc0:0001:1: host_to_card, write iomem
> (1) failed: -110
> [10262.996049] mwifiex_sdio mmc0:0001:1: write CFG reg failed
> [10263.007337] mwifiex_sdio mmc0:0001:1: host_to_card, write iomem
> (2) failed: -110
> [10263.015299] mwifiex_sdio mmc0:0001:1: write CFG reg failed
> [10263.021675] mwifiex_sdio mmc0:0001:1: host_to_card, write iomem
> (3) failed: -110
> [10263.029839] mwifiex_sdio mmc0:0001:1: write CFG reg failed
> [10263.035386] mwifiex_sdio mmc0:0001:1: DNLD_CMD: host to card failed
>
> # echo 1 > /sys/kernel/debug/mwifiex/mlan0/reset
> [10517.451193] mwifiex_sdio mmc0:0001:1: Resetting per request
> [10517.479235] mwifiex_sdio mmc0:0001:1: host_to_card, write iomem
> (1) failed: -110
> [10517.490283] mwifiex_sdio mmc0:0001:1: write CFG reg failed
> [10517.498995] mwifiex_sdio mmc0:0001:1: host_to_card, write iomem
> (2) failed: -110
> [10517.509257] mwifiex_sdio mmc0:0001:1: write CFG reg failed
> [10517.517649] mwifiex_sdio mmc0:0001:1: host_to_card, write iomem
> (3) failed: -110
> [10517.527838] mwifiex_sdio mmc0:0001:1: write CFG reg failed
> [10517.533765] mwifiex_sdio mmc0:0001:1: DNLD_CMD: host to card failed
>
> [10529.871099] mwifiex_sdio mmc0:0001:1: cmd_wait_q terminated: -110
> [10529.883401] mwifiex_sdio mmc0:0001:1: PREP_CMD: FW in reset state
> [10529.890488] mwifiex_sdio mmc0:0001:1: deleting the crypto keys
> [10529.896573] mwifiex_sdio mmc0:0001:1: PREP_CMD: FW in reset state
> [10529.903316] mwifiex_sdio mmc0:0001:1: deleting the crypto keys
>
> [10530.014334] mwifiex_sdio mmc0:0001:1: DNLD_CMD: host to card failed
> [10530.049847] mwifiex_sdio mmc0:0001:1: info: shutdown mwifiex...
> [10530.239910] mwifiex_sdio mmc0:0001:1: PREP_CMD: card is removed
> [10530.247919] mwifiex_sdio mmc0:0001:1: PREP_CMD: card is removed
> [10530.268721] mwifiex_sdio mmc0:0001:1: PREP_CMD: card is removed
> [10531.665962] mwifiex_sdio mmc0:0001:1: info: FW download over, size
> 255988 bytes
> [10531.911608] mwifiex_sdio mmc0:0001:1: WLAN FW is active
> [10531.964352] mwifiex_sdio mmc0:0001:1: CMD_RESP: cmd 0x242 error, result=0x2
> [10531.971894] mwifiex_sdio mmc0:0001:1: mwifiex_process_cmdresp: cmd
> 0x242 failed during initialization
> [10532.125947] mwifiex_sdio mmc0:0001:1: info: MWIFIEX VERSION:
> mwifiex 1.0 (14.68.36.p204)
> [10532.134573] mwifiex_sdio mmc0:0001:1: driver_version = mwifiex 1.0
> (14.68.36.p204)
>
> Again, the /sys/kernel/debug/mwifiex/mlan0 is removed, it is
> completely broken for both WiFi modem reset and
> /sys/kernel/debug/mwifiex/mlan0/reset, let me know your advice to
> debug it or modify mwifiex source files.

Sorry, I think you're on your own here. I've only briefly touched upon
the Marvell reset code when I ran into trouble with it in the past but
it's definitely not something I have any real inside knowledge about.
My only suggestions would be to somehow get someone from Marvell (now
NXP I guess?) to help you debug or perhaps the people you got your
module from have some technical contacts that can help rope in someone
to help?

-Doug