Bug 241253

Summary: if_rtwn_usb module leaves device loaded on system shutdown
Product: Base System Reporter: rocky
Component: wirelessAssignee: freebsd-wireless (Nobody) <wireless>
Status: New ---    
Severity: Affects Only Me CC: cioby.service
Priority: ---    
Version: 12.1-RELEASE   
Hardware: arm64   
OS: Any   

Description rocky 2019-10-15 03:11:27 UTC
TP Link wn823n usb wifi adaptor will only work on removal/reinsertion of adaptor. Testing shows that on reboot the adaptor is left in an undesirable state and once system is initialised no longer works.
Cold boot the device will still work.
The only way to keep the device operational across reboot (warm boot) is to stop devd/devfs and kldunload the module (currently using /etc/rc.shutdown.local).
Comment 1 rocky 2019-10-16 04:32:45 UTC
Further investigation shows the device also has difficulties with flag setting under hostapd.
Starting hostapd shows the application requiring a few hours before achieving S+ state, appearing to hang at an uninterruptable D+ state requiring a reboot to break. Once running, ifconfig still shows a status of No Carrier, even though enabling hostap wlanmode via ifconfig showed a status of Running. (TP Link 725n has no problem).
Could it be that the device is unable to change flag settings in time for reboot?
Firmware incompatibility issue?
Comment 2 rocky 2019-10-16 07:21:44 UTC
(In reply to rocky from comment #1)
Correction - not just a reboot: a complete cold boot (shutdown -p) is required, harking back to the difficulties first reported of the device being in an undesirable state once system has shutdown. This even with the workaround (stop devd, unload kernel module) suggested being applied.
Comment 3 rocky 2019-10-18 00:51:44 UTC
The 725n model that also uses the rtl8188eu chipset (1T1R v 2T2R) also has an error on reboot (hostap mode):

rtwn0: rtwn_tx_beacon_check: cannot push beacon into chip, error 60!            
rtwn0: unable to push beacon into the chip, error 60                            
rtwn0: rtwn_newstate: could not move to RUN state
Comment 4 Cristian Ciobanu 2020-09-29 19:32:49 UTC
I have the same error as the one shown in comment #3

rtwn0: rtwn_tx_beacon_check: cannot push beacon into chip, error 60!            
rtwn0: unable to push beacon into the chip, error 60                            
rtwn0: rtwn_newstate: could not move to RUN state

I'm using an D-link DWA 131 Rev. E USB wifi adapter in hostap mode. The chipset is Realtek RTL8192EU.

I have tested this on 3 different systems, FreeBSD 12, FreeBSD 13 and OPNsense 20.7.3.

On the CLI the WLAN interface is shown as up and running but the status is no carrier. All drivers and firmware were loaded successfully. On the rtwn man page I see the device is on the supported list. https://www.freebsd.org/cgi/man.cgi?query=rtwn_usb&sektion=4&apropos=0&manpath=FreeBSD+12.1-RELEASE+and+Ports