2021-11-13 04:29:52

by Jupiter

[permalink] [raw]
Subject: mwifiex_sdio and mwifiex failure

Hi,

I am work on a Linux embedded IoT device including both 4G LTE and
WiFi modems, I use linux-firmware-sd8801 and Marvell driver
mwifiex_sdio.ko and mwifiex.ko drivers, it works well for a couple of
days, then the WiFi failed which could be caused by low WiFi signal
strength level, but that should not cause the mwifiex_sdio errors.
While the connman was able to switch from WiFi connection to 4G LTE
connection automatically, following error messages popped up in
console and kernel logs every second to consume lots of resources
despite the 4G LTE being connected and worked perfectly.
...............
[924785.415505] mwifiex_sdio mmc0:0001:1: PREP_CMD: card is removed
[924807.818102] mwifiex_sdio mmc0:0001:1: Ignore scan. Card removed or
firmware in bad state
[924808.406775] mwifiex_sdio mmc0:0001:1: PREP_CMD: card is removed
...........

I am not quite sure if the error message indicated the mwifiex_sdio or
kernel crash or not, but given the 4G LTE was connected fine, the
device was still in good operation, I don't think it is a kernel crash
sign.

My questions are:

(a) Is there any way to recover the mwifiex_sdio or reset
mwifiex_sdio? I tried modprobe -r mwifiex_sdio, modprobe mwifiex_sdio
and modprobe mwifiex, but that crashed my debug console despite the
device was still in good operation. I could only make it recover by
rebooting the device which was not a good solution as it was operated
24 / 7.

(b) If there is no way to recover or reset mwifiex_sdio, are there any
methods to suppress mwifiex_sdio endless error messages to both debug
console and to kernel logs?

Thank you.

Kind regards,

- jh


2021-11-18 05:44:12

by Jupiter

[permalink] [raw]
Subject: Re: mwifiex_sdio and mwifiex failure

Hi,

After debugging, I figured out why mwifiex failed and could not be
recovered, but I don't understand why, appreciate anyone's kind
advice.

I have both mwifiex_sdio and mwifiex modules installed during kernel
booting, here is how I manually made it failure:

# lsmod
Module Size Used by
mwifiex_sdio 36864 0
mwifiex 278528 1 mwifiex_sdio
option 45056 0
usb_wwan 20480 1 option
usbserial 36864 2 option,usb_wwan
evbug 16384 0

# ifconfig
mlan0 Link encap:Ethernet HWaddr D4:CA:6E:A4:E9:D4
inet addr:192.168.0.102 Bcast:192.168.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:107 errors:0 dropped:0 overruns:0 frame:0
TX packets:113 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:13059 (12.7 KiB) TX bytes:13989 (13.6 KiB)

Now I made it failure:

# modprobe -r mwifiex_sdio
[ 1609.691798] mwifiex_sdio mmc0:0001:1: info: shutdown mwifiex...
[ 1609.774118] mwifiex_sdio mmc0:0001:1: PREP_CMD: card is removed
[ 1610.019431] mwifiex_sdio mmc0:0001:1: deleting the crypto keys

# lsmod
Module Size Used by
option 45056 0
usb_wwan 20480 1 option
usbserial 36864 2 option,usb_wwan
evbug 16384 0

The WiFi interface was gone.

# modprobe mwifiex_sdio
[ 1634.073391] mwifiex_sdio mmc0:0001:1: WLAN FW already running! Skip FW dnld
[ 1634.080781] mwifiex_sdio mmc0:0001:1: WLAN FW is active

[ 1644.176847] mwifiex_sdio mmc0:0001:1: mwifiex_cmd_timeout_func:
Timeout cmd id = 0xa9, act = 0x0
[ 1644.186272] mwifiex_sdio mmc0:0001:1: num_data_h2c_failure = 0
[ 1644.192181] mwifiex_sdio mmc0:0001:1: num_cmd_h2c_failure = 0
[ 1644.198224] mwifiex_sdio mmc0:0001:1: is_cmd_timedout = 1
[ 1644.203691] mwifiex_sdio mmc0:0001:1: num_tx_timeout = 0
[ 1644.209181] mwifiex_sdio mmc0:0001:1: last_cmd_index = 1
[ 1644.214563] mwifiex_sdio mmc0:0001:1: last_cmd_id: 00 00 a9 00 00
00 00 00 00 00
[ 1644.222127] mwifiex_sdio mmc0:0001:1: last_cmd_act: 00 00 00 00 00
00 00 00 00 00
[ 1644.229767] mwifiex_sdio mmc0:0001:1: last_cmd_resp_index = 0
[ 1644.235576] mwifiex_sdio mmc0:0001:1: last_cmd_resp_id: 00 00 00 00
00 00 00 00 00 00
[ 1644.243565] mwifiex_sdio mmc0:0001:1: last_event_index = 0
[ 1644.249200] mwifiex_sdio mmc0:0001:1: last_event: 00 00 00 00 00 00
00 00 00 00
[ 1644.256667] mwifiex_sdio mmc0:0001:1: data_sent=0 cmd_sent=0
[ 1644.262386] mwifiex_sdio mmc0:0001:1: ps_mode=0 ps_state=0
[ 1644.277044] mwifiex_sdio mmc0:0001:1: info: _mwifiex_fw_dpc:
unregister device

That made mwifiex_sdio failed and no longer be able to be recovered

# lsmod
Module Size Used by
mwifiex_sdio 36864 0
mwifiex 278528 1 mwifiex_sdio
option 45056 0
usb_wwan 20480 1 option
usbserial 36864 2 option,usb_wwan
evbug 16384 0

# ifconfig
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:102 errors:0 dropped:0 overruns:0 frame:0
TX packets:102 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:8222 (8.0 KiB) TX bytes:8222 (8.0 KiB)

Is it because restoring mwifiex_sdio could not restore crypto keys?

Could you please advise why running modprobe mwifiex_sdio is not working?

Thank you very much.

Kind regards,

- jupiter


On 11/13/21, Jupiter <[email protected]> wrote:
> Hi,
>
> I am work on a Linux embedded IoT device including both 4G LTE and
> WiFi modems, I use linux-firmware-sd8801 and Marvell driver
> mwifiex_sdio.ko and mwifiex.ko drivers, it works well for a couple of
> days, then the WiFi failed which could be caused by low WiFi signal
> strength level, but that should not cause the mwifiex_sdio errors.
> While the connman was able to switch from WiFi connection to 4G LTE
> connection automatically, following error messages popped up in
> console and kernel logs every second to consume lots of resources
> despite the 4G LTE being connected and worked perfectly.
> ...............
> [924785.415505] mwifiex_sdio mmc0:0001:1: PREP_CMD: card is removed
> [924807.818102] mwifiex_sdio mmc0:0001:1: Ignore scan. Card removed or
> firmware in bad state
> [924808.406775] mwifiex_sdio mmc0:0001:1: PREP_CMD: card is removed
> ...........
>
> I am not quite sure if the error message indicated the mwifiex_sdio or
> kernel crash or not, but given the 4G LTE was connected fine, the
> device was still in good operation, I don't think it is a kernel crash
> sign.
>
> My questions are:
>
> (a) Is there any way to recover the mwifiex_sdio or reset
> mwifiex_sdio? I tried modprobe -r mwifiex_sdio, modprobe mwifiex_sdio
> and modprobe mwifiex, but that crashed my debug console despite the
> device was still in good operation. I could only make it recover by
> rebooting the device which was not a good solution as it was operated
> 24 / 7.
>
> (b) If there is no way to recover or reset mwifiex_sdio, are there any
> methods to suppress mwifiex_sdio endless error messages to both debug
> console and to kernel logs?
>
> Thank you.
>
> Kind regards,
>
> - jh
>


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