linux/drivers/net/wireless/rtlwifi
Olivier Langlois f78bccd79b rtlwifi: rtl8192ce: Fix too long disable of IRQs
rtl8192ce is disabling for too long the local interrupts during hw initiatialisation when performing scans

The observable symptoms in dmesg can be:

- underruns from ALSA playback
- clock freezes (tstamps do not change for several dmesg entries until irqs are finaly reenabled):

[  250.817669] rtlwifi:rtl_op_config():<0-0-0> 0x100
[  250.817685] rtl8192ce:_rtl92ce_phy_set_rf_power_state():<0-1-0> IPS Set eRf nic enable
[  250.817732] rtl8192ce:_rtl92ce_init_mac():<0-1-0> reg0xec:18051d59:11
[  250.817796] rtl8192ce:_rtl92ce_init_mac():<0-1-0> reg0xec:18051d59:11
[  250.817910] rtl8192ce:_rtl92ce_init_mac():<0-1-0> reg0xec:18051d59:11
[  250.818024] rtl8192ce:_rtl92ce_init_mac():<0-1-0> reg0xec:18051d59:11
[  250.818139] rtl8192ce:_rtl92ce_init_mac():<0-1-0> reg0xec:18051d59:11
[  250.818253] rtl8192ce:_rtl92ce_init_mac():<0-1-0> reg0xec:18051d59:11
[  250.818367] rtl8192ce:_rtl92ce_init_mac():<0-1-0> reg0xec:18051d59:11
[  250.818472] rtl8192ce:_rtl92ce_init_mac():<0-1-0> reg0xec:18051d59:11
[  250.818472] rtl8192ce:_rtl92ce_init_mac():<0-1-0> reg0xec:18051d59:11
[  250.818472] rtl8192ce:_rtl92ce_init_mac():<0-1-0> reg0xec:18051d59:11
[  250.818472] rtl8192ce:_rtl92ce_init_mac():<0-1-0> reg0xec:18051d59:11
[  250.818472] rtl8192ce:_rtl92ce_init_mac():<0-1-0> reg0xec:98053f15:10
[  250.818472] rtl8192ce:rtl92ce_sw_led_on():<0-1-0> LedAddr:4E ledpin=1
[  250.818472] rtl8192c_common:rtl92c_download_fw():<0-1-0> Firmware Version(49), Signature(0x88c1),Size(32)
[  250.818472] rtl8192ce:rtl92ce_enable_hw_security_config():<0-1-0> PairwiseEncAlgorithm = 0 GroupEncAlgorithm = 0
[  250.818472] rtl8192ce:rtl92ce_enable_hw_security_config():<0-1-0> The SECR-value cc
[  250.818472] rtl8192c_common:rtl92c_dm_check_txpower_tracking_thermal_meter():<0-1-0> Schedule TxPowerTracking direct call!!
[  250.818472] rtl8192c_common:rtl92c_dm_txpower_tracking_callback_thermalmeter():<0-1-0> rtl92c_dm_txpower_tracking_callback_thermalmeter
[  250.818472] rtl8192c_common:rtl92c_dm_txpower_tracking_callback_thermalmeter():<0-1-0> Readback Thermal Meter = 0xe pre thermal meter 0xf eeprom_thermalmeter 0xf
[  250.818472] rtl8192c_common:rtl92c_dm_txpower_tracking_callback_thermalmeter():<0-1-0> Initial pathA ele_d reg0xc80 = 0x40000000, ofdm_index=0xc
[  250.818472] rtl8192c_common:rtl92c_dm_txpower_tracking_callback_thermalmeter():<0-1-0> Initial reg0xa24 = 0x90e1317, cck_index=0xc, ch14 0
[  250.818472] rtl8192c_common:rtl92c_dm_txpower_tracking_callback_thermalmeter():<0-1-0> Readback Thermal Meter = 0xe pre thermal meter 0xf eeprom_thermalmeter 0xf delta 0x1 delta_lck 0x0 delta_iqk 0x0
[  250.818472] rtl8192c_common:rtl92c_dm_txpower_tracking_callback_thermalmeter():<0-1-0> <===
[  250.818472] rtl8192c_common:rtl92c_dm_initialize_txpower_tracking_thermalmeter():<0-1-0> pMgntInfo->txpower_tracking = 1
[  250.818472] rtl8192ce:rtl92ce_led_control():<0-1-0> ledaction 3
[  250.818472] rtl8192ce:rtl92ce_sw_led_on():<0-1-0> LedAddr:4E ledpin=1
[  250.818472] rtlwifi:rtl_ips_nic_on():<0-1-0> before spin_unlock_irqrestore
[  251.154656] PCM: Lost interrupts? [Q]-0 (stream=0, delta=15903, new_hw_ptr=293408, old_hw_ptr=277505)

The exact code flow that causes that is:

1. wpa_supplicant send a start_scan request to the nl80211 driver
2. mac80211 module call rtl_op_config with IEEE80211_CONF_CHANGE_IDLE
3.   rtl_ips_nic_on is called which disable local irqs
4.     rtl92c_phy_set_rf_power_state() is called
5.       rtl_ps_enable_nic() is called and hw_init()is executed and then the interrupts on the device are enabled

A good solution could be to refactor the code to avoid calling rtl92ce_hw_init() with the irqs disabled
but a quick and dirty solution that has proven to work is
to reenable the irqs during the function rtl92ce_hw_init().

I think that it is safe doing so since the device interrupt will only be enabled after the init function succeed.

Signed-off-by: Olivier Langlois <olivier@trillion01.com>
Cc: Stable <stable@vger.kernel.org>
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2014-02-13 14:58:12 -05:00
..
rtl8188ee rtlwifi: rtl8188ee: Fix typo in code 2013-12-05 14:56:40 -05:00
rtl8192c rtlwifi: rtl8192c-common: Fix sparse warning 2013-12-09 15:37:55 -05:00
rtl8192ce rtlwifi: rtl8192ce: Fix too long disable of IRQs 2014-02-13 14:58:12 -05:00
rtl8192cu rtlwifi: rtl8192cu: Add new device ID 2014-01-13 14:46:59 -05:00
rtl8192de rtlwifi: rtl8192de: Fix incorrect signal strength for unassociated AP 2013-11-11 14:42:44 -05:00
rtl8192se rtlwifi: rtl8192se: Fix incorrect signal strength for unassociated AP 2013-11-11 14:42:44 -05:00
rtl8723ae Merge git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next 2013-10-07 15:40:44 -04:00
base.c Merge branch 'for-john' of git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next 2014-01-13 14:40:59 -05:00
base.h rtlwifi: Implement a common rtl_phy_scan_operation_backup() routine 2013-10-03 16:24:30 -04:00
cam.c rtlwifi: slight optimization of addr compare 2013-12-26 13:31:35 -05:00
cam.h rtlwifi: Remove extern from function prototypes 2013-09-24 18:06:51 -07:00
core.c rtlwifi: Set the link state 2013-12-05 14:55:07 -05:00
core.h
debug.c rtlwifi: Fix build errors for unusual cases 2013-07-18 16:22:00 -04:00
debug.h rtlwifi: rtl8192c: rtl8192ce: rtl8192cu: rtl8192de: rtl8723ae: Add changes required by adding rtl81988ee 2013-04-01 16:20:53 -04:00
efuse.c rtlwifi: fix null dereference on efuse_word on kmalloc fail returns NULL 2013-11-11 14:38:58 -05:00
efuse.h rtlwifi: Remove extern from function prototypes 2013-09-24 18:06:51 -07:00
Kconfig rtlwifi: Fix build errors for unusual cases 2013-07-18 16:22:00 -04:00
Makefile rtlwifi: Fix build errors for unusual cases 2013-07-18 16:22:00 -04:00
pci.c Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2014-01-06 17:37:45 -05:00
pci.h rtlwifi: rtl8188ee: Enable recognition of RTL8188EE 2013-04-01 16:20:54 -04:00
ps.c rtlwifi: use ether_addr_equal_64bits 2014-01-03 15:36:59 -05:00
ps.h rtlwifi: Initialize power-setting callback for USB devices 2013-07-17 14:34:48 -04:00
rc.c mac80211/rc80211: add chandef to rate initialization 2013-07-16 09:58:02 +03:00
rc.h
regd.c rtlwifi: fix usage of freq_reg_info() 2013-12-05 14:54:51 -05:00
regd.h wireless: make the reg_notifier() void 2013-01-14 11:32:44 +01:00
stats.c rtlwifi: Add missing code to PWDB statics routine 2013-12-05 14:55:20 -05:00
stats.h
usb.c rtlwifi: Update beacon statistics for USB driver 2013-12-05 14:55:12 -05:00
usb.h rtlwifi: usb: defer rx processing to tasklet 2013-03-25 16:42:22 -04:00
wifi.h rtlwifi: Redo register save locations 2013-12-05 14:55:05 -05:00