linux/drivers/net/wireless
Johannes Berg e372282241 iwlwifi: mvm: fix time event command handling race
Occasionally, we would run into this warning:

  iwlwifi 0000:02:00.0: U iwl_mvm_protect_session extend 0x2601: only 200 ms left
  iwlwifi 0000:02:00.0: U iwl_mvm_remove_time_event Removing TE 0x2601
  iwlwifi 0000:02:00.0: I iwl_pcie_enqueue_hcmd Sending command TIME_EVENT_CMD (#29), seq: 0x0925, 60 bytes at 37[5]:9
  iwlwifi 0000:02:00.0: U iwl_pcie_send_hcmd_sync Attempting to send sync command TIME_EVENT_CMD
  iwlwifi 0000:02:00.0: U iwl_pcie_send_hcmd_sync Setting HCMD_ACTIVE for command TIME_EVENT_CMD
  iwlwifi 0000:02:00.0: I iwl_pcie_enqueue_hcmd Sending command TIME_EVENT_CMD (#29), seq: 0x0926, 60 bytes at 38[6]:9
  iwlwifi 0000:02:00.0: U iwl_mvm_time_event_response TIME_EVENT_CMD response - UID = 0x2601
  iwlwifi 0000:02:00.0: I iwl_pcie_hcmd_complete Clearing HCMD_ACTIVE for command TIME_EVENT_CMD
  iwlwifi 0000:02:00.0: U iwl_mvm_rx_time_event_notif Time event notification - UID = 0x2701 action 1
  wlan0: associate with 00:0a:b8:55:a8:30 (try 2/3)
  ------------[ cut here ]------------
  WARNING: at drivers/net/wireless/iwlwifi/mvm/time-event.c:269 iwl_mvm_time_event_send_add+0x163/0x1a0 [iwlmvm]()
  Modules linked in: [...]
  Call Trace:
   [<c1046e42>] warn_slowpath_common+0x72/0xa0
   [<c1046e92>] warn_slowpath_null+0x22/0x30
   [<f8cad913>] iwl_mvm_time_event_send_add+0x163/0x1a0 [iwlmvm]
   [<f8cadead>] iwl_mvm_protect_session+0xcd/0x1c0 [iwlmvm]
   [<f8ca2087>] iwl_mvm_mac_mgd_prepare_tx+0x67/0xa0 [iwlmvm]
   [<f882a130>] ieee80211_sta_work+0x8f0/0x1070 [mac80211]

The reason is a problem with asynchronous vs. synchronous
commands, what happens here is the following:
 * TE 0x2601 is removed, the TIME_EVENT_CMD for that is async
 * a new TE (will be 0x2701) is created, the TIME_EVENT_CMD
   for that is sync and also uses a notification wait for the
   response (to avoid another race condition)
 * the response for the TE 0x2601 removal comes from the
   firmware, and is handled by the notification wait handler
   that's really waiting for the second response, but can't
   tell the difference, we therefore see the message
   "TIME_EVENT_CMD response - UID = 0x2601" instead of
   "TIME_EVENT_CMD response - UID = 0x2701".

Fix this issue by making the TE removal synchronous as well,
this means that we wait for the response to that command
first, before there's any chance of sending a new one.

Also, to detect such issues more easily in the future, add
a warning to the notification handler that detects them.

Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2013-02-18 20:18:07 +01:00
..
ath Merge branch 'for-linville' of git://github.com/kvalo/ath6kl 2013-02-15 14:06:32 -05:00
b43 Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless 2013-01-28 13:54:03 -05:00
b43legacy Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next into for-davem 2012-12-11 16:24:55 -05:00
brcm80211 brcmsmac: Remove unnecessary memset casts 2013-02-14 14:24:08 -05:00
hostap wireless: drivers: make use of WLAN_EID_VENDOR_SPECIFIC 2012-10-18 09:01:54 +02:00
ipw2x00 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2012-12-13 12:00:02 -08:00
iwlegacy Merge branch 'for-john' of git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next 2013-02-15 13:59:53 -05:00
iwlwifi iwlwifi: mvm: fix time event command handling race 2013-02-18 20:18:07 +01:00
libertas cfg80211: pass wiphy to cfg80211_ref_bss/put_bss 2013-02-11 18:44:52 +01:00
libertas_tf mac80211: move TX station pointer and restructure TX 2012-07-31 16:18:39 +02:00
mwifiex mwifiex: device specific sleep cookie handling for PCIe 2013-02-14 14:24:07 -05:00
orinoco cfg80211: pass wiphy to cfg80211_ref_bss/put_bss 2013-02-11 18:44:52 +01:00
p54 p54usb: corrected USB ID for T-Com Sinus 154 data II 2013-02-08 14:51:32 -05:00
prism54 prism54: bug in getting auth type 2013-01-22 16:01:29 -05:00
rt2x00 Merge branch 'for-john' of git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next 2013-02-15 13:59:53 -05:00
rtl818x rtl8187: remove __dev* attributes 2012-12-06 15:04:59 -05:00
rtlwifi Merge branch 'for-john' of git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next 2013-02-15 13:59:53 -05:00
ti Merge branch 'for-john' of git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next 2013-02-15 13:59:53 -05:00
zd1211rw treewide: fix typo of "suppport" in various comments 2012-11-19 14:13:52 +01:00
adm8211.c wireless: remove __dev* attributes 2012-12-06 15:04:55 -05:00
adm8211.h
airo.c wireless: remove __dev* attributes 2012-12-06 15:04:55 -05:00
airo.h
airo_cs.c
at76c50x-usb.c wireless: Convert dev_printk(KERN_<LEVEL> to dev_<level>( 2012-11-14 14:55:32 -05:00
at76c50x-usb.h
atmel.c treewide: fix typo of "suport" in various comments and Kconfig 2012-11-19 14:16:09 +01:00
atmel.h
atmel_cs.c
atmel_pci.c atmel: remove __dev* attributes 2012-12-06 15:04:56 -05:00
Kconfig drivers: remove reference to feature-removal-schedule.txt 2012-12-17 17:15:12 -08:00
mac80211_hwsim.c mac80211_hwsim: ask mac80211 to reserve space for chanctx.drv_priv 2013-02-15 09:41:45 +01:00
mac80211_hwsim.h
Makefile wireless: fix Atheros drivers compilation 2012-12-17 15:48:43 -05:00
mwl8k.c Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless 2013-02-14 14:23:33 -05:00
ray_cs.c drivers/net/wireless: need consider the not '\0' terminated string. 2013-01-22 16:01:29 -05:00
ray_cs.h
rayctl.h
rndis_wlan.c cfg80211: pass wiphy to cfg80211_ref_bss/put_bss 2013-02-11 18:44:52 +01:00
wl3501.h
wl3501_cs.c wl3501_cs: use is_broadcast_ether_addr() instead of memcmp() 2012-09-07 15:03:40 -04:00
zd1201.c
zd1201.h