All of lore.kernel.org
 help / color / mirror / Atom feed
* warning in iwlwifi on monitor mode in 3.5.0-rc6-wl
@ 2012-07-11 14:05 Mohammed Shafi
  2012-07-11 14:18 ` Johannes Berg
  0 siblings, 1 reply; 7+ messages in thread
From: Mohammed Shafi @ 2012-07-11 14:05 UTC (permalink / raw)
  To: Johannes Berg, Emmanuel Grumbach, Guy, Wey-Yi W
  Cc: linux-wireless Mailing List

Hi all,

i got this warning in bringing up monitor mode with iwlwifi  in 3.5.0-rc6-wl

[ 4788.914848] iwlwifi 0000:03:00.0: Try to add interface when device not ready
[ 4788.914851] ------------[ cut here ]------------
[ 4788.914870] WARNING: at
/home/shafi/new-wireless-testing/wireless-testing/net/mac80211/iface.c:357
ieee80211_add_virtual_monitor+0x192/0x2b0 [mac80211]()
[ 4788.914872] Hardware name: 64756D6
[ 4788.914874] Modules linked in: iwldvm iwlwifi ath9k(O) mac80211(O)
ath9k_common(O) ath9k_hw(O) ath(O) cfg80211(O) binfmt_misc rfcomm
bridge stp llc bnep snd_hda_codec_conexant arc4 snd_hda_intel
snd_hda_codec i915 fbcon tileblit font bitblit snd_hwdep softcursor
snd_pcm_oss snd_mixer_oss snd_pcm drm_kms_helper snd_seq_dummy drm
coretemp thinkpad_acpi snd_seq_oss kvm pcmcia snd_seq_midi joydev
snd_rawmidi ath3k snd_seq_midi_event uvcvideo btusb snd_seq intel_agp
i2c_algo_bit videobuf2_core intel_gtt hid_generic bluetooth snd_timer
yenta_socket videodev pcmcia_rsrc psmouse snd_seq_device agpgart
usbhid pcmcia_core hid videobuf2_vmalloc videobuf2_memops lpc_ich snd
microcode tpm_tis snd_page_alloc serio_raw soundcore tpm lp video
nvram parport tpm_bios ahci libahci e1000e [last unloaded: cfg80211]
[ 4788.914967] Pid: 7486, comm: ifconfig Tainted: G           O 3.5.0-rc6-wl #25
[ 4788.914969] Call Trace:
[ 4788.914976]  [<c0136322>] warn_slowpath_common+0x72/0xa0
[ 4788.914991]  [<f98164b2>] ?
ieee80211_add_virtual_monitor+0x192/0x2b0 [mac80211]
[ 4788.915005]  [<f98164b2>] ?
ieee80211_add_virtual_monitor+0x192/0x2b0 [mac80211]
[ 4788.915008]  [<c0136372>] warn_slowpath_null+0x22/0x30
[ 4788.915022]  [<f98164b2>] ieee80211_add_virtual_monitor+0x192/0x2b0
[mac80211]
[ 4788.915027]  [<c06bb3c6>] ? printk+0x4d/0x4f
[ 4788.915041]  [<f98185ea>] ieee80211_set_monitor_enabled+0x1a/0x50 [mac80211]
[ 4788.915050]  [<f8fa5688>] cfg80211_update_iface_num+0x108/0x270 [cfg80211]
[ 4788.915058]  [<f8fa5dee>] cfg80211_netdev_notifier_call+0x5fe/0x640
[cfg80211]
[ 4788.915062]  [<c0690142>] ? packet_notifier+0x1c2/0x2b0
[ 4788.915066]  [<c0690156>] ? packet_notifier+0x1d6/0x2b0
[ 4788.915070]  [<c06c2982>] notifier_call_chain+0x42/0xf0
[ 4788.915075]  [<c0162d4f>] raw_notifier_call_chain+0x1f/0x30
[ 4788.915080]  [<c05b156c>] call_netdevice_notifiers+0x2c/0x60
[ 4788.915085]  [<c019738b>] ? trace_hardirqs_on+0xb/0x10
[ 4788.915088]  [<c05b209c>] __dev_open+0x5c/0xf0
[ 4788.915091]  [<c06bee35>] ? _raw_spin_unlock_bh+0x35/0x40
[ 4788.915095]  [<c05b0e29>] __dev_change_flags+0x109/0x170
[ 4788.915098]  [<c05b2003>] dev_change_flags+0x23/0x60
[ 4788.915102]  [<c061cf10>] devinet_ioctl+0x6a0/0x770
[ 4788.915106]  [<c061f725>] inet_ioctl+0x95/0xb0
[ 4788.915109]  [<c059d2b0>] sock_ioctl+0x70/0x270
[ 4788.915113]  [<c059d240>] ? sock_fasync+0xc0/0xc0
[ 4788.915117]  [<c02656a6>] do_vfs_ioctl+0x86/0x5a0
[ 4788.915121]  [<c016197b>] ? up_read+0x1b/0x30
[ 4788.915124]  [<c06c2714>] ? do_page_fault+0x244/0x470
[ 4788.915128]  [<c0255c75>] ? fget_light+0x355/0x410
[ 4788.915131]  [<c0163314>] ? __put_cred+0x34/0x50
[ 4788.915135]  [<c0265c37>] sys_ioctl+0x77/0x80
[ 4788.915139]  [<c06c65e3>] sysenter_do_call+0x12/0x38
[ 4788.915141] ---[ end trace 2b26c2a43fea3613 ]---
[ 4788.915146] ------------[ cut here ]------------
[ 4788.915160] WARNING: at
/home/shafi/new-wireless-testing/wireless-testing/net/mac80211/cfg.c:2993
ieee80211_set_monitor_enabled+0x4c/0x50 [mac80211]()
[ 4788.915161] Hardware name: 64756D6
[ 4788.915163] Modules linked in: iwldvm iwlwifi ath9k(O) mac80211(O)
ath9k_common(O) ath9k_hw(O) ath(O) cfg80211(O) binfmt_misc rfcomm
bridge stp llc bnep snd_hda_codec_conexant arc4 snd_hda_intel
snd_hda_codec i915 fbcon tileblit font bitblit snd_hwdep softcursor
snd_pcm_oss snd_mixer_oss snd_pcm drm_kms_helper snd_seq_dummy drm
coretemp thinkpad_acpi snd_seq_oss kvm pcmcia snd_seq_midi joydev
snd_rawmidi ath3k snd_seq_midi_event uvcvideo btusb snd_seq intel_agp
i2c_algo_bit videobuf2_core intel_gtt hid_generic bluetooth snd_timer
yenta_socket videodev pcmcia_rsrc psmouse snd_seq_device agpgart
usbhid pcmcia_core hid videobuf2_vmalloc videobuf2_memops lpc_ich snd
microcode tpm_tis snd_page_alloc serio_raw soundcore tpm lp video
nvram parport tpm_bios ahci libahci e1000e [last unloaded: cfg80211]
[ 4788.915231] Pid: 7486, comm: ifconfig Tainted: G        W  O 3.5.0-rc6-wl #25
[ 4788.915233] Call Trace:
[ 4788.915237]  [<c0136322>] warn_slowpath_common+0x72/0xa0
[ 4788.915251]  [<f981861c>] ? ieee80211_set_monitor_enabled+0x4c/0x50
[mac80211]
[ 4788.915265]  [<f981861c>] ? ieee80211_set_monitor_enabled+0x4c/0x50
[mac80211]
[ 4788.915268]  [<c0136372>] warn_slowpath_null+0x22/0x30
[ 4788.915282]  [<f981861c>] ieee80211_set_monitor_enabled+0x4c/0x50 [mac80211]
[ 4788.915289]  [<f8fa5688>] cfg80211_update_iface_num+0x108/0x270 [cfg80211]
[ 4788.915296]  [<f8fa5dee>] cfg80211_netdev_notifier_call+0x5fe/0x640
[cfg80211]
[ 4788.915299]  [<c0690142>] ? packet_notifier+0x1c2/0x2b0
[ 4788.915303]  [<c0690156>] ? packet_notifier+0x1d6/0x2b0
[ 4788.915307]  [<c06c2982>] notifier_call_chain+0x42/0xf0
[ 4788.915311]  [<c0162d4f>] raw_notifier_call_chain+0x1f/0x30
[ 4788.915314]  [<c05b156c>] call_netdevice_notifiers+0x2c/0x60
[ 4788.915317]  [<c019738b>] ? trace_hardirqs_on+0xb/0x10
[ 4788.915321]  [<c05b209c>] __dev_open+0x5c/0xf0
[ 4788.915324]  [<c06bee35>] ? _raw_spin_unlock_bh+0x35/0x40
[ 4788.915327]  [<c05b0e29>] __dev_change_flags+0x109/0x170
[ 4788.915331]  [<c05b2003>] dev_change_flags+0x23/0x60
[ 4788.915334]  [<c061cf10>] devinet_ioctl+0x6a0/0x770
[ 4788.915338]  [<c061f725>] inet_ioctl+0x95/0xb0
[ 4788.915341]  [<c059d2b0>] sock_ioctl+0x70/0x270
[ 4788.915344]  [<c059d240>] ? sock_fasync+0xc0/0xc0
[ 4788.915347]  [<c02656a6>] do_vfs_ioctl+0x86/0x5a0
[ 4788.915350]  [<c016197b>] ? up_read+0x1b/0x30
[ 4788.915353]  [<c06c2714>] ? do_page_fault+0x244/0x470
[ 4788.915357]  [<c0255c75>] ? fget_light+0x355/0x410
[ 4788.915360]  [<c0163314>] ? __put_cred+0x34/0x50
[ 4788.915363]  [<c0265c37>] sys_ioctl+0x77/0x80
[ 4788.915367]  [<c06c65e3>] sysenter_do_call+0x12/0x38
[ 4788.915368] ---[ end trace 2b26c2a43fea3614 ]---
[ 4788.915371]


-- 
thanks,
shafi

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: warning in iwlwifi on monitor mode in 3.5.0-rc6-wl
  2012-07-11 14:05 warning in iwlwifi on monitor mode in 3.5.0-rc6-wl Mohammed Shafi
@ 2012-07-11 14:18 ` Johannes Berg
  2012-07-11 14:24   ` Mohammed Shafi
  0 siblings, 1 reply; 7+ messages in thread
From: Johannes Berg @ 2012-07-11 14:18 UTC (permalink / raw)
  To: Mohammed Shafi
  Cc: Emmanuel Grumbach, Guy, Wey-Yi W, linux-wireless Mailing List,
	Michal Kazior

This isn't really related to iwlwifi...

Looks like this might be due to Michal's changes, maybe the monitor
callback is coming too early?

johannes


On Wed, 2012-07-11 at 19:35 +0530, Mohammed Shafi wrote:
> Hi all,
> 
> i got this warning in bringing up monitor mode with iwlwifi  in 3.5.0-rc6-wl
> 
> [ 4788.914848] iwlwifi 0000:03:00.0: Try to add interface when device not ready
> [ 4788.914851] ------------[ cut here ]------------
> [ 4788.914870] WARNING: at
> /home/shafi/new-wireless-testing/wireless-testing/net/mac80211/iface.c:357
> ieee80211_add_virtual_monitor+0x192/0x2b0 [mac80211]()
> [ 4788.914872] Hardware name: 64756D6
> [ 4788.914874] Modules linked in: iwldvm iwlwifi ath9k(O) mac80211(O)
> ath9k_common(O) ath9k_hw(O) ath(O) cfg80211(O) binfmt_misc rfcomm
> bridge stp llc bnep snd_hda_codec_conexant arc4 snd_hda_intel
> snd_hda_codec i915 fbcon tileblit font bitblit snd_hwdep softcursor
> snd_pcm_oss snd_mixer_oss snd_pcm drm_kms_helper snd_seq_dummy drm
> coretemp thinkpad_acpi snd_seq_oss kvm pcmcia snd_seq_midi joydev
> snd_rawmidi ath3k snd_seq_midi_event uvcvideo btusb snd_seq intel_agp
> i2c_algo_bit videobuf2_core intel_gtt hid_generic bluetooth snd_timer
> yenta_socket videodev pcmcia_rsrc psmouse snd_seq_device agpgart
> usbhid pcmcia_core hid videobuf2_vmalloc videobuf2_memops lpc_ich snd
> microcode tpm_tis snd_page_alloc serio_raw soundcore tpm lp video
> nvram parport tpm_bios ahci libahci e1000e [last unloaded: cfg80211]
> [ 4788.914967] Pid: 7486, comm: ifconfig Tainted: G           O 3.5.0-rc6-wl #25
> [ 4788.914969] Call Trace:
> [ 4788.914976]  [<c0136322>] warn_slowpath_common+0x72/0xa0
> [ 4788.914991]  [<f98164b2>] ?
> ieee80211_add_virtual_monitor+0x192/0x2b0 [mac80211]
> [ 4788.915005]  [<f98164b2>] ?
> ieee80211_add_virtual_monitor+0x192/0x2b0 [mac80211]
> [ 4788.915008]  [<c0136372>] warn_slowpath_null+0x22/0x30
> [ 4788.915022]  [<f98164b2>] ieee80211_add_virtual_monitor+0x192/0x2b0
> [mac80211]
> [ 4788.915027]  [<c06bb3c6>] ? printk+0x4d/0x4f
> [ 4788.915041]  [<f98185ea>] ieee80211_set_monitor_enabled+0x1a/0x50 [mac80211]
> [ 4788.915050]  [<f8fa5688>] cfg80211_update_iface_num+0x108/0x270 [cfg80211]
> [ 4788.915058]  [<f8fa5dee>] cfg80211_netdev_notifier_call+0x5fe/0x640
> [cfg80211]
> [ 4788.915062]  [<c0690142>] ? packet_notifier+0x1c2/0x2b0
> [ 4788.915066]  [<c0690156>] ? packet_notifier+0x1d6/0x2b0
> [ 4788.915070]  [<c06c2982>] notifier_call_chain+0x42/0xf0
> [ 4788.915075]  [<c0162d4f>] raw_notifier_call_chain+0x1f/0x30
> [ 4788.915080]  [<c05b156c>] call_netdevice_notifiers+0x2c/0x60
> [ 4788.915085]  [<c019738b>] ? trace_hardirqs_on+0xb/0x10
> [ 4788.915088]  [<c05b209c>] __dev_open+0x5c/0xf0
> [ 4788.915091]  [<c06bee35>] ? _raw_spin_unlock_bh+0x35/0x40
> [ 4788.915095]  [<c05b0e29>] __dev_change_flags+0x109/0x170
> [ 4788.915098]  [<c05b2003>] dev_change_flags+0x23/0x60
> [ 4788.915102]  [<c061cf10>] devinet_ioctl+0x6a0/0x770
> [ 4788.915106]  [<c061f725>] inet_ioctl+0x95/0xb0
> [ 4788.915109]  [<c059d2b0>] sock_ioctl+0x70/0x270
> [ 4788.915113]  [<c059d240>] ? sock_fasync+0xc0/0xc0
> [ 4788.915117]  [<c02656a6>] do_vfs_ioctl+0x86/0x5a0
> [ 4788.915121]  [<c016197b>] ? up_read+0x1b/0x30
> [ 4788.915124]  [<c06c2714>] ? do_page_fault+0x244/0x470
> [ 4788.915128]  [<c0255c75>] ? fget_light+0x355/0x410
> [ 4788.915131]  [<c0163314>] ? __put_cred+0x34/0x50
> [ 4788.915135]  [<c0265c37>] sys_ioctl+0x77/0x80
> [ 4788.915139]  [<c06c65e3>] sysenter_do_call+0x12/0x38
> [ 4788.915141] ---[ end trace 2b26c2a43fea3613 ]---
> [ 4788.915146] ------------[ cut here ]------------
> [ 4788.915160] WARNING: at
> /home/shafi/new-wireless-testing/wireless-testing/net/mac80211/cfg.c:2993
> ieee80211_set_monitor_enabled+0x4c/0x50 [mac80211]()
> [ 4788.915161] Hardware name: 64756D6
> [ 4788.915163] Modules linked in: iwldvm iwlwifi ath9k(O) mac80211(O)
> ath9k_common(O) ath9k_hw(O) ath(O) cfg80211(O) binfmt_misc rfcomm
> bridge stp llc bnep snd_hda_codec_conexant arc4 snd_hda_intel
> snd_hda_codec i915 fbcon tileblit font bitblit snd_hwdep softcursor
> snd_pcm_oss snd_mixer_oss snd_pcm drm_kms_helper snd_seq_dummy drm
> coretemp thinkpad_acpi snd_seq_oss kvm pcmcia snd_seq_midi joydev
> snd_rawmidi ath3k snd_seq_midi_event uvcvideo btusb snd_seq intel_agp
> i2c_algo_bit videobuf2_core intel_gtt hid_generic bluetooth snd_timer
> yenta_socket videodev pcmcia_rsrc psmouse snd_seq_device agpgart
> usbhid pcmcia_core hid videobuf2_vmalloc videobuf2_memops lpc_ich snd
> microcode tpm_tis snd_page_alloc serio_raw soundcore tpm lp video
> nvram parport tpm_bios ahci libahci e1000e [last unloaded: cfg80211]
> [ 4788.915231] Pid: 7486, comm: ifconfig Tainted: G        W  O 3.5.0-rc6-wl #25
> [ 4788.915233] Call Trace:
> [ 4788.915237]  [<c0136322>] warn_slowpath_common+0x72/0xa0
> [ 4788.915251]  [<f981861c>] ? ieee80211_set_monitor_enabled+0x4c/0x50
> [mac80211]
> [ 4788.915265]  [<f981861c>] ? ieee80211_set_monitor_enabled+0x4c/0x50
> [mac80211]
> [ 4788.915268]  [<c0136372>] warn_slowpath_null+0x22/0x30
> [ 4788.915282]  [<f981861c>] ieee80211_set_monitor_enabled+0x4c/0x50 [mac80211]
> [ 4788.915289]  [<f8fa5688>] cfg80211_update_iface_num+0x108/0x270 [cfg80211]
> [ 4788.915296]  [<f8fa5dee>] cfg80211_netdev_notifier_call+0x5fe/0x640
> [cfg80211]
> [ 4788.915299]  [<c0690142>] ? packet_notifier+0x1c2/0x2b0
> [ 4788.915303]  [<c0690156>] ? packet_notifier+0x1d6/0x2b0
> [ 4788.915307]  [<c06c2982>] notifier_call_chain+0x42/0xf0
> [ 4788.915311]  [<c0162d4f>] raw_notifier_call_chain+0x1f/0x30
> [ 4788.915314]  [<c05b156c>] call_netdevice_notifiers+0x2c/0x60
> [ 4788.915317]  [<c019738b>] ? trace_hardirqs_on+0xb/0x10
> [ 4788.915321]  [<c05b209c>] __dev_open+0x5c/0xf0
> [ 4788.915324]  [<c06bee35>] ? _raw_spin_unlock_bh+0x35/0x40
> [ 4788.915327]  [<c05b0e29>] __dev_change_flags+0x109/0x170
> [ 4788.915331]  [<c05b2003>] dev_change_flags+0x23/0x60
> [ 4788.915334]  [<c061cf10>] devinet_ioctl+0x6a0/0x770
> [ 4788.915338]  [<c061f725>] inet_ioctl+0x95/0xb0
> [ 4788.915341]  [<c059d2b0>] sock_ioctl+0x70/0x270
> [ 4788.915344]  [<c059d240>] ? sock_fasync+0xc0/0xc0
> [ 4788.915347]  [<c02656a6>] do_vfs_ioctl+0x86/0x5a0
> [ 4788.915350]  [<c016197b>] ? up_read+0x1b/0x30
> [ 4788.915353]  [<c06c2714>] ? do_page_fault+0x244/0x470
> [ 4788.915357]  [<c0255c75>] ? fget_light+0x355/0x410
> [ 4788.915360]  [<c0163314>] ? __put_cred+0x34/0x50
> [ 4788.915363]  [<c0265c37>] sys_ioctl+0x77/0x80
> [ 4788.915367]  [<c06c65e3>] sysenter_do_call+0x12/0x38
> [ 4788.915368] ---[ end trace 2b26c2a43fea3614 ]---
> [ 4788.915371]
> 
> 



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: warning in iwlwifi on monitor mode in 3.5.0-rc6-wl
  2012-07-11 14:18 ` Johannes Berg
@ 2012-07-11 14:24   ` Mohammed Shafi
  2012-07-11 14:29     ` Mohammed Shafi
  0 siblings, 1 reply; 7+ messages in thread
From: Mohammed Shafi @ 2012-07-11 14:24 UTC (permalink / raw)
  To: Johannes Berg
  Cc: Emmanuel Grumbach, Guy, Wey-Yi W, linux-wireless Mailing List,
	Michal Kazior

On Wed, Jul 11, 2012 at 7:48 PM, Johannes Berg
<johannes@sipsolutions.net> wrote:
> This isn't really related to iwlwifi...
>
> Looks like this might be due to Michal's changes, maybe the monitor
> callback is coming too early?

ath9k got bailed out of drv_add_interface as this flag
IEEE80211_HW_WANT_MONITOR_VIF
was not supported


>
> johannes
>
>
> On Wed, 2012-07-11 at 19:35 +0530, Mohammed Shafi wrote:
>> Hi all,
>>
>> i got this warning in bringing up monitor mode with iwlwifi  in 3.5.0-rc6-wl
>>
>> [ 4788.914848] iwlwifi 0000:03:00.0: Try to add interface when device not ready
>> [ 4788.914851] ------------[ cut here ]------------
>> [ 4788.914870] WARNING: at
>> /home/shafi/new-wireless-testing/wireless-testing/net/mac80211/iface.c:357
>> ieee80211_add_virtual_monitor+0x192/0x2b0 [mac80211]()
>> [ 4788.914872] Hardware name: 64756D6
>> [ 4788.914874] Modules linked in: iwldvm iwlwifi ath9k(O) mac80211(O)
>> ath9k_common(O) ath9k_hw(O) ath(O) cfg80211(O) binfmt_misc rfcomm
>> bridge stp llc bnep snd_hda_codec_conexant arc4 snd_hda_intel
>> snd_hda_codec i915 fbcon tileblit font bitblit snd_hwdep softcursor
>> snd_pcm_oss snd_mixer_oss snd_pcm drm_kms_helper snd_seq_dummy drm
>> coretemp thinkpad_acpi snd_seq_oss kvm pcmcia snd_seq_midi joydev
>> snd_rawmidi ath3k snd_seq_midi_event uvcvideo btusb snd_seq intel_agp
>> i2c_algo_bit videobuf2_core intel_gtt hid_generic bluetooth snd_timer
>> yenta_socket videodev pcmcia_rsrc psmouse snd_seq_device agpgart
>> usbhid pcmcia_core hid videobuf2_vmalloc videobuf2_memops lpc_ich snd
>> microcode tpm_tis snd_page_alloc serio_raw soundcore tpm lp video
>> nvram parport tpm_bios ahci libahci e1000e [last unloaded: cfg80211]
>> [ 4788.914967] Pid: 7486, comm: ifconfig Tainted: G           O 3.5.0-rc6-wl #25
>> [ 4788.914969] Call Trace:
>> [ 4788.914976]  [<c0136322>] warn_slowpath_common+0x72/0xa0
>> [ 4788.914991]  [<f98164b2>] ?
>> ieee80211_add_virtual_monitor+0x192/0x2b0 [mac80211]
>> [ 4788.915005]  [<f98164b2>] ?
>> ieee80211_add_virtual_monitor+0x192/0x2b0 [mac80211]
>> [ 4788.915008]  [<c0136372>] warn_slowpath_null+0x22/0x30
>> [ 4788.915022]  [<f98164b2>] ieee80211_add_virtual_monitor+0x192/0x2b0
>> [mac80211]
>> [ 4788.915027]  [<c06bb3c6>] ? printk+0x4d/0x4f
>> [ 4788.915041]  [<f98185ea>] ieee80211_set_monitor_enabled+0x1a/0x50 [mac80211]
>> [ 4788.915050]  [<f8fa5688>] cfg80211_update_iface_num+0x108/0x270 [cfg80211]
>> [ 4788.915058]  [<f8fa5dee>] cfg80211_netdev_notifier_call+0x5fe/0x640
>> [cfg80211]
>> [ 4788.915062]  [<c0690142>] ? packet_notifier+0x1c2/0x2b0
>> [ 4788.915066]  [<c0690156>] ? packet_notifier+0x1d6/0x2b0
>> [ 4788.915070]  [<c06c2982>] notifier_call_chain+0x42/0xf0
>> [ 4788.915075]  [<c0162d4f>] raw_notifier_call_chain+0x1f/0x30
>> [ 4788.915080]  [<c05b156c>] call_netdevice_notifiers+0x2c/0x60
>> [ 4788.915085]  [<c019738b>] ? trace_hardirqs_on+0xb/0x10
>> [ 4788.915088]  [<c05b209c>] __dev_open+0x5c/0xf0
>> [ 4788.915091]  [<c06bee35>] ? _raw_spin_unlock_bh+0x35/0x40
>> [ 4788.915095]  [<c05b0e29>] __dev_change_flags+0x109/0x170
>> [ 4788.915098]  [<c05b2003>] dev_change_flags+0x23/0x60
>> [ 4788.915102]  [<c061cf10>] devinet_ioctl+0x6a0/0x770
>> [ 4788.915106]  [<c061f725>] inet_ioctl+0x95/0xb0
>> [ 4788.915109]  [<c059d2b0>] sock_ioctl+0x70/0x270
>> [ 4788.915113]  [<c059d240>] ? sock_fasync+0xc0/0xc0
>> [ 4788.915117]  [<c02656a6>] do_vfs_ioctl+0x86/0x5a0
>> [ 4788.915121]  [<c016197b>] ? up_read+0x1b/0x30
>> [ 4788.915124]  [<c06c2714>] ? do_page_fault+0x244/0x470
>> [ 4788.915128]  [<c0255c75>] ? fget_light+0x355/0x410
>> [ 4788.915131]  [<c0163314>] ? __put_cred+0x34/0x50
>> [ 4788.915135]  [<c0265c37>] sys_ioctl+0x77/0x80
>> [ 4788.915139]  [<c06c65e3>] sysenter_do_call+0x12/0x38
>> [ 4788.915141] ---[ end trace 2b26c2a43fea3613 ]---
>> [ 4788.915146] ------------[ cut here ]------------
>> [ 4788.915160] WARNING: at
>> /home/shafi/new-wireless-testing/wireless-testing/net/mac80211/cfg.c:2993
>> ieee80211_set_monitor_enabled+0x4c/0x50 [mac80211]()
>> [ 4788.915161] Hardware name: 64756D6
>> [ 4788.915163] Modules linked in: iwldvm iwlwifi ath9k(O) mac80211(O)
>> ath9k_common(O) ath9k_hw(O) ath(O) cfg80211(O) binfmt_misc rfcomm
>> bridge stp llc bnep snd_hda_codec_conexant arc4 snd_hda_intel
>> snd_hda_codec i915 fbcon tileblit font bitblit snd_hwdep softcursor
>> snd_pcm_oss snd_mixer_oss snd_pcm drm_kms_helper snd_seq_dummy drm
>> coretemp thinkpad_acpi snd_seq_oss kvm pcmcia snd_seq_midi joydev
>> snd_rawmidi ath3k snd_seq_midi_event uvcvideo btusb snd_seq intel_agp
>> i2c_algo_bit videobuf2_core intel_gtt hid_generic bluetooth snd_timer
>> yenta_socket videodev pcmcia_rsrc psmouse snd_seq_device agpgart
>> usbhid pcmcia_core hid videobuf2_vmalloc videobuf2_memops lpc_ich snd
>> microcode tpm_tis snd_page_alloc serio_raw soundcore tpm lp video
>> nvram parport tpm_bios ahci libahci e1000e [last unloaded: cfg80211]
>> [ 4788.915231] Pid: 7486, comm: ifconfig Tainted: G        W  O 3.5.0-rc6-wl #25
>> [ 4788.915233] Call Trace:
>> [ 4788.915237]  [<c0136322>] warn_slowpath_common+0x72/0xa0
>> [ 4788.915251]  [<f981861c>] ? ieee80211_set_monitor_enabled+0x4c/0x50
>> [mac80211]
>> [ 4788.915265]  [<f981861c>] ? ieee80211_set_monitor_enabled+0x4c/0x50
>> [mac80211]
>> [ 4788.915268]  [<c0136372>] warn_slowpath_null+0x22/0x30
>> [ 4788.915282]  [<f981861c>] ieee80211_set_monitor_enabled+0x4c/0x50 [mac80211]
>> [ 4788.915289]  [<f8fa5688>] cfg80211_update_iface_num+0x108/0x270 [cfg80211]
>> [ 4788.915296]  [<f8fa5dee>] cfg80211_netdev_notifier_call+0x5fe/0x640
>> [cfg80211]
>> [ 4788.915299]  [<c0690142>] ? packet_notifier+0x1c2/0x2b0
>> [ 4788.915303]  [<c0690156>] ? packet_notifier+0x1d6/0x2b0
>> [ 4788.915307]  [<c06c2982>] notifier_call_chain+0x42/0xf0
>> [ 4788.915311]  [<c0162d4f>] raw_notifier_call_chain+0x1f/0x30
>> [ 4788.915314]  [<c05b156c>] call_netdevice_notifiers+0x2c/0x60
>> [ 4788.915317]  [<c019738b>] ? trace_hardirqs_on+0xb/0x10
>> [ 4788.915321]  [<c05b209c>] __dev_open+0x5c/0xf0
>> [ 4788.915324]  [<c06bee35>] ? _raw_spin_unlock_bh+0x35/0x40
>> [ 4788.915327]  [<c05b0e29>] __dev_change_flags+0x109/0x170
>> [ 4788.915331]  [<c05b2003>] dev_change_flags+0x23/0x60
>> [ 4788.915334]  [<c061cf10>] devinet_ioctl+0x6a0/0x770
>> [ 4788.915338]  [<c061f725>] inet_ioctl+0x95/0xb0
>> [ 4788.915341]  [<c059d2b0>] sock_ioctl+0x70/0x270
>> [ 4788.915344]  [<c059d240>] ? sock_fasync+0xc0/0xc0
>> [ 4788.915347]  [<c02656a6>] do_vfs_ioctl+0x86/0x5a0
>> [ 4788.915350]  [<c016197b>] ? up_read+0x1b/0x30
>> [ 4788.915353]  [<c06c2714>] ? do_page_fault+0x244/0x470
>> [ 4788.915357]  [<c0255c75>] ? fget_light+0x355/0x410
>> [ 4788.915360]  [<c0163314>] ? __put_cred+0x34/0x50
>> [ 4788.915363]  [<c0265c37>] sys_ioctl+0x77/0x80
>> [ 4788.915367]  [<c06c65e3>] sysenter_do_call+0x12/0x38
>> [ 4788.915368] ---[ end trace 2b26c2a43fea3614 ]---
>> [ 4788.915371]
>>
>>
>
>



-- 
thanks,
shafi

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: warning in iwlwifi on monitor mode in 3.5.0-rc6-wl
  2012-07-11 14:24   ` Mohammed Shafi
@ 2012-07-11 14:29     ` Mohammed Shafi
  2012-07-11 14:30       ` Johannes Berg
  2012-07-12 13:24       ` Johannes Berg
  0 siblings, 2 replies; 7+ messages in thread
From: Mohammed Shafi @ 2012-07-11 14:29 UTC (permalink / raw)
  To: Johannes Berg
  Cc: Emmanuel Grumbach, Guy, Wey-Yi W, linux-wireless Mailing List,
	Michal Kazior

On Wed, Jul 11, 2012 at 7:54 PM, Mohammed Shafi
<shafi.wireless@gmail.com> wrote:
> On Wed, Jul 11, 2012 at 7:48 PM, Johannes Berg
> <johannes@sipsolutions.net> wrote:
>> This isn't really related to iwlwifi...
>>
>> Looks like this might be due to Michal's changes, maybe the monitor
>> callback is coming too early?
>
> ath9k got bailed out of drv_add_interface as this flag
> IEEE80211_HW_WANT_MONITOR_VIF
> was not supported

Johannes, i had put few manual prints in mac80211 for something else, if you
want i can a give fresh call trace with proper function offsets.

>
>
>>
>> johannes
>>
>>
>> On Wed, 2012-07-11 at 19:35 +0530, Mohammed Shafi wrote:
>>> Hi all,
>>>
>>> i got this warning in bringing up monitor mode with iwlwifi  in 3.5.0-rc6-wl
>>>
>>> [ 4788.914848] iwlwifi 0000:03:00.0: Try to add interface when device not ready
>>> [ 4788.914851] ------------[ cut here ]------------
>>> [ 4788.914870] WARNING: at
>>> /home/shafi/new-wireless-testing/wireless-testing/net/mac80211/iface.c:357
>>> ieee80211_add_virtual_monitor+0x192/0x2b0 [mac80211]()
>>> [ 4788.914872] Hardware name: 64756D6
>>> [ 4788.914874] Modules linked in: iwldvm iwlwifi ath9k(O) mac80211(O)
>>> ath9k_common(O) ath9k_hw(O) ath(O) cfg80211(O) binfmt_misc rfcomm
>>> bridge stp llc bnep snd_hda_codec_conexant arc4 snd_hda_intel
>>> snd_hda_codec i915 fbcon tileblit font bitblit snd_hwdep softcursor
>>> snd_pcm_oss snd_mixer_oss snd_pcm drm_kms_helper snd_seq_dummy drm
>>> coretemp thinkpad_acpi snd_seq_oss kvm pcmcia snd_seq_midi joydev
>>> snd_rawmidi ath3k snd_seq_midi_event uvcvideo btusb snd_seq intel_agp
>>> i2c_algo_bit videobuf2_core intel_gtt hid_generic bluetooth snd_timer
>>> yenta_socket videodev pcmcia_rsrc psmouse snd_seq_device agpgart
>>> usbhid pcmcia_core hid videobuf2_vmalloc videobuf2_memops lpc_ich snd
>>> microcode tpm_tis snd_page_alloc serio_raw soundcore tpm lp video
>>> nvram parport tpm_bios ahci libahci e1000e [last unloaded: cfg80211]
>>> [ 4788.914967] Pid: 7486, comm: ifconfig Tainted: G           O 3.5.0-rc6-wl #25
>>> [ 4788.914969] Call Trace:
>>> [ 4788.914976]  [<c0136322>] warn_slowpath_common+0x72/0xa0
>>> [ 4788.914991]  [<f98164b2>] ?
>>> ieee80211_add_virtual_monitor+0x192/0x2b0 [mac80211]
>>> [ 4788.915005]  [<f98164b2>] ?
>>> ieee80211_add_virtual_monitor+0x192/0x2b0 [mac80211]
>>> [ 4788.915008]  [<c0136372>] warn_slowpath_null+0x22/0x30
>>> [ 4788.915022]  [<f98164b2>] ieee80211_add_virtual_monitor+0x192/0x2b0
>>> [mac80211]
>>> [ 4788.915027]  [<c06bb3c6>] ? printk+0x4d/0x4f
>>> [ 4788.915041]  [<f98185ea>] ieee80211_set_monitor_enabled+0x1a/0x50 [mac80211]
>>> [ 4788.915050]  [<f8fa5688>] cfg80211_update_iface_num+0x108/0x270 [cfg80211]
>>> [ 4788.915058]  [<f8fa5dee>] cfg80211_netdev_notifier_call+0x5fe/0x640
>>> [cfg80211]
>>> [ 4788.915062]  [<c0690142>] ? packet_notifier+0x1c2/0x2b0
>>> [ 4788.915066]  [<c0690156>] ? packet_notifier+0x1d6/0x2b0
>>> [ 4788.915070]  [<c06c2982>] notifier_call_chain+0x42/0xf0
>>> [ 4788.915075]  [<c0162d4f>] raw_notifier_call_chain+0x1f/0x30
>>> [ 4788.915080]  [<c05b156c>] call_netdevice_notifiers+0x2c/0x60
>>> [ 4788.915085]  [<c019738b>] ? trace_hardirqs_on+0xb/0x10
>>> [ 4788.915088]  [<c05b209c>] __dev_open+0x5c/0xf0
>>> [ 4788.915091]  [<c06bee35>] ? _raw_spin_unlock_bh+0x35/0x40
>>> [ 4788.915095]  [<c05b0e29>] __dev_change_flags+0x109/0x170
>>> [ 4788.915098]  [<c05b2003>] dev_change_flags+0x23/0x60
>>> [ 4788.915102]  [<c061cf10>] devinet_ioctl+0x6a0/0x770
>>> [ 4788.915106]  [<c061f725>] inet_ioctl+0x95/0xb0
>>> [ 4788.915109]  [<c059d2b0>] sock_ioctl+0x70/0x270
>>> [ 4788.915113]  [<c059d240>] ? sock_fasync+0xc0/0xc0
>>> [ 4788.915117]  [<c02656a6>] do_vfs_ioctl+0x86/0x5a0
>>> [ 4788.915121]  [<c016197b>] ? up_read+0x1b/0x30
>>> [ 4788.915124]  [<c06c2714>] ? do_page_fault+0x244/0x470
>>> [ 4788.915128]  [<c0255c75>] ? fget_light+0x355/0x410
>>> [ 4788.915131]  [<c0163314>] ? __put_cred+0x34/0x50
>>> [ 4788.915135]  [<c0265c37>] sys_ioctl+0x77/0x80
>>> [ 4788.915139]  [<c06c65e3>] sysenter_do_call+0x12/0x38
>>> [ 4788.915141] ---[ end trace 2b26c2a43fea3613 ]---
>>> [ 4788.915146] ------------[ cut here ]------------
>>> [ 4788.915160] WARNING: at
>>> /home/shafi/new-wireless-testing/wireless-testing/net/mac80211/cfg.c:2993
>>> ieee80211_set_monitor_enabled+0x4c/0x50 [mac80211]()
>>> [ 4788.915161] Hardware name: 64756D6
>>> [ 4788.915163] Modules linked in: iwldvm iwlwifi ath9k(O) mac80211(O)
>>> ath9k_common(O) ath9k_hw(O) ath(O) cfg80211(O) binfmt_misc rfcomm
>>> bridge stp llc bnep snd_hda_codec_conexant arc4 snd_hda_intel
>>> snd_hda_codec i915 fbcon tileblit font bitblit snd_hwdep softcursor
>>> snd_pcm_oss snd_mixer_oss snd_pcm drm_kms_helper snd_seq_dummy drm
>>> coretemp thinkpad_acpi snd_seq_oss kvm pcmcia snd_seq_midi joydev
>>> snd_rawmidi ath3k snd_seq_midi_event uvcvideo btusb snd_seq intel_agp
>>> i2c_algo_bit videobuf2_core intel_gtt hid_generic bluetooth snd_timer
>>> yenta_socket videodev pcmcia_rsrc psmouse snd_seq_device agpgart
>>> usbhid pcmcia_core hid videobuf2_vmalloc videobuf2_memops lpc_ich snd
>>> microcode tpm_tis snd_page_alloc serio_raw soundcore tpm lp video
>>> nvram parport tpm_bios ahci libahci e1000e [last unloaded: cfg80211]
>>> [ 4788.915231] Pid: 7486, comm: ifconfig Tainted: G        W  O 3.5.0-rc6-wl #25
>>> [ 4788.915233] Call Trace:
>>> [ 4788.915237]  [<c0136322>] warn_slowpath_common+0x72/0xa0
>>> [ 4788.915251]  [<f981861c>] ? ieee80211_set_monitor_enabled+0x4c/0x50
>>> [mac80211]
>>> [ 4788.915265]  [<f981861c>] ? ieee80211_set_monitor_enabled+0x4c/0x50
>>> [mac80211]
>>> [ 4788.915268]  [<c0136372>] warn_slowpath_null+0x22/0x30
>>> [ 4788.915282]  [<f981861c>] ieee80211_set_monitor_enabled+0x4c/0x50 [mac80211]
>>> [ 4788.915289]  [<f8fa5688>] cfg80211_update_iface_num+0x108/0x270 [cfg80211]
>>> [ 4788.915296]  [<f8fa5dee>] cfg80211_netdev_notifier_call+0x5fe/0x640
>>> [cfg80211]
>>> [ 4788.915299]  [<c0690142>] ? packet_notifier+0x1c2/0x2b0
>>> [ 4788.915303]  [<c0690156>] ? packet_notifier+0x1d6/0x2b0
>>> [ 4788.915307]  [<c06c2982>] notifier_call_chain+0x42/0xf0
>>> [ 4788.915311]  [<c0162d4f>] raw_notifier_call_chain+0x1f/0x30
>>> [ 4788.915314]  [<c05b156c>] call_netdevice_notifiers+0x2c/0x60
>>> [ 4788.915317]  [<c019738b>] ? trace_hardirqs_on+0xb/0x10
>>> [ 4788.915321]  [<c05b209c>] __dev_open+0x5c/0xf0
>>> [ 4788.915324]  [<c06bee35>] ? _raw_spin_unlock_bh+0x35/0x40
>>> [ 4788.915327]  [<c05b0e29>] __dev_change_flags+0x109/0x170
>>> [ 4788.915331]  [<c05b2003>] dev_change_flags+0x23/0x60
>>> [ 4788.915334]  [<c061cf10>] devinet_ioctl+0x6a0/0x770
>>> [ 4788.915338]  [<c061f725>] inet_ioctl+0x95/0xb0
>>> [ 4788.915341]  [<c059d2b0>] sock_ioctl+0x70/0x270
>>> [ 4788.915344]  [<c059d240>] ? sock_fasync+0xc0/0xc0
>>> [ 4788.915347]  [<c02656a6>] do_vfs_ioctl+0x86/0x5a0
>>> [ 4788.915350]  [<c016197b>] ? up_read+0x1b/0x30
>>> [ 4788.915353]  [<c06c2714>] ? do_page_fault+0x244/0x470
>>> [ 4788.915357]  [<c0255c75>] ? fget_light+0x355/0x410
>>> [ 4788.915360]  [<c0163314>] ? __put_cred+0x34/0x50
>>> [ 4788.915363]  [<c0265c37>] sys_ioctl+0x77/0x80
>>> [ 4788.915367]  [<c06c65e3>] sysenter_do_call+0x12/0x38
>>> [ 4788.915368] ---[ end trace 2b26c2a43fea3614 ]---
>>> [ 4788.915371]
>>>
>>>
>>
>>
>
>
>
> --
> thanks,
> shafi



-- 
thanks,
shafi

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: warning in iwlwifi on monitor mode in 3.5.0-rc6-wl
  2012-07-11 14:29     ` Mohammed Shafi
@ 2012-07-11 14:30       ` Johannes Berg
  2012-07-12 13:24       ` Johannes Berg
  1 sibling, 0 replies; 7+ messages in thread
From: Johannes Berg @ 2012-07-11 14:30 UTC (permalink / raw)
  To: Mohammed Shafi
  Cc: Emmanuel Grumbach, Guy, Wey-Yi W, linux-wireless Mailing List,
	Michal Kazior

On Wed, 2012-07-11 at 19:59 +0530, Mohammed Shafi wrote:
> On Wed, Jul 11, 2012 at 7:54 PM, Mohammed Shafi
> <shafi.wireless@gmail.com> wrote:
> > On Wed, Jul 11, 2012 at 7:48 PM, Johannes Berg
> > <johannes@sipsolutions.net> wrote:
> >> This isn't really related to iwlwifi...
> >>
> >> Looks like this might be due to Michal's changes, maybe the monitor
> >> callback is coming too early?
> >
> > ath9k got bailed out of drv_add_interface as this flag
> > IEEE80211_HW_WANT_MONITOR_VIF
> > was not supported
> 
> Johannes, i had put few manual prints in mac80211 for something else, if you
> want i can a give fresh call trace with proper function offsets.

Shouldn't be needed, no worries.

johannes


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: warning in iwlwifi on monitor mode in 3.5.0-rc6-wl
  2012-07-11 14:29     ` Mohammed Shafi
  2012-07-11 14:30       ` Johannes Berg
@ 2012-07-12 13:24       ` Johannes Berg
  2012-07-12 15:10         ` Mohammed Shafi
  1 sibling, 1 reply; 7+ messages in thread
From: Johannes Berg @ 2012-07-12 13:24 UTC (permalink / raw)
  To: Mohammed Shafi
  Cc: Emmanuel Grumbach, Guy, Wey-Yi W, linux-wireless Mailing List,
	Michal Kazior

This should fix it, can you confirm? I did tracing for various cases and
it looks correct to me.

johannes



From: Johannes Berg <johannes.berg@intel.com>
Date: Thu, 12 Jul 2012 15:19:36 +0200
Subject: [PATCH] cfg80211: fix set_monitor_enabled

When bringing monitor mode up with a driver using the
mac80211 virtual monitor interface this resulted in a
warning because cfg80211_update_iface_num() is called
from PRE_UP, which causes it to call mac80211 and the
low-level driver before the device is started.

For the case that another interface is added and the
monitor interface should be removed, this is correct.
However, in the case where a monitor interface is
added, it's not correct as the above.

To fix this, we need to split up the cases and track
whether or not "only monitor" is active so that the
code can correctly call into the driver when things
change.

Reported-by: Mohammed Shafi <shafi.wireless@gmail.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
 net/wireless/core.c |   62 ++++++++++++++++++++++++++++++++++++++-------------
 net/wireless/core.h |   10 ++++++++-
 net/wireless/util.c |    8 +++++--
 3 files changed, 61 insertions(+), 19 deletions(-)

diff --git a/net/wireless/core.c b/net/wireless/core.c
index 0557bb1..b63c450 100644
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -766,30 +766,56 @@ static void cfg80211_init_mon_chan(struct cfg80211_registered_device *rdev)
 }
 
 void cfg80211_update_iface_num(struct cfg80211_registered_device *rdev,
-			       enum nl80211_iftype iftype, int num)
+			       enum nl80211_iftype iftype,
+			       enum cfg80211_iface_action action)
 {
-	bool has_monitors_only_old = cfg80211_has_monitors_only(rdev);
-	bool has_monitors_only_new;
+	bool monitors_only;
+	int num;
 
 	ASSERT_RTNL();
 
+	switch (action) {
+	case CFG80211_IFACE_DOWN:
+		num = -1;
+		break;
+	case CFG80211_IFACE_PRE_UP:
+		num = 1;
+		break;
+	case CFG80211_IFACE_UP:
+		num = 0;
+		break;
+	default:
+		WARN_ON(1);
+		return;
+	}
+
 	rdev->num_running_ifaces += num;
 	if (iftype == NL80211_IFTYPE_MONITOR)
 		rdev->num_running_monitor_ifaces += num;
 
-	has_monitors_only_new = cfg80211_has_monitors_only(rdev);
-	if (has_monitors_only_new != has_monitors_only_old) {
+	monitors_only = cfg80211_has_monitors_only(rdev);
+
+	if (monitors_only && rdev->monitor_only_enabled)
+		return;
+
+	if (!monitors_only && !rdev->monitor_only_enabled)
+		return;
+
+	if (monitors_only) {
+		/* Do it in CFG80211_IFACE_UP instead */
+		if (action == CFG80211_IFACE_PRE_UP)
+			return;
 		if (rdev->ops->set_monitor_enabled)
-			rdev->ops->set_monitor_enabled(&rdev->wiphy,
-						       has_monitors_only_new);
-
-		if (!has_monitors_only_new) {
-			rdev->monitor_channel = NULL;
-			rdev->monitor_channel_type = NL80211_CHAN_NO_HT;
-		} else {
-			cfg80211_init_mon_chan(rdev);
-		}
+			rdev->ops->set_monitor_enabled(&rdev->wiphy, true);
+		cfg80211_init_mon_chan(rdev);
+	} else {
+		rdev->monitor_channel = NULL;
+		rdev->monitor_channel_type = NL80211_CHAN_NO_HT;
+		if (rdev->ops->set_monitor_enabled)
+			rdev->ops->set_monitor_enabled(&rdev->wiphy, false);
 	}
+
+	rdev->monitor_only_enabled = monitors_only;
 }
 
 static int cfg80211_netdev_notifier_call(struct notifier_block *nb,
@@ -895,7 +921,8 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb,
 		wdev->beacon_interval = 0;
 		break;
 	case NETDEV_DOWN:
-		cfg80211_update_iface_num(rdev, wdev->iftype, -1);
+		cfg80211_update_iface_num(rdev, wdev->iftype,
+					  CFG80211_IFACE_DOWN);
 		dev_hold(dev);
 		queue_work(cfg80211_wq, &wdev->cleanup_work);
 		break;
@@ -912,6 +939,8 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb,
 			mutex_unlock(&rdev->devlist_mtx);
 			dev_put(dev);
 		}
+		cfg80211_update_iface_num(rdev, wdev->iftype,
+					  CFG80211_IFACE_UP);
 		cfg80211_lock_rdev(rdev);
 		mutex_lock(&rdev->devlist_mtx);
 		wdev_lock(wdev);
@@ -1006,7 +1035,8 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb,
 		mutex_unlock(&rdev->devlist_mtx);
 		if (ret)
 			return notifier_from_errno(ret);
-		cfg80211_update_iface_num(rdev, wdev->iftype, 1);
+		cfg80211_update_iface_num(rdev, wdev->iftype,
+					  CFG80211_IFACE_PRE_UP);
 		break;
 	}
 
diff --git a/net/wireless/core.h b/net/wireless/core.h
index bac97da..b2b1db3 100644
--- a/net/wireless/core.h
+++ b/net/wireless/core.h
@@ -60,6 +60,7 @@ struct cfg80211_registered_device {
 	/* protected by RTNL only */
 	int num_running_ifaces;
 	int num_running_monitor_ifaces;
+	bool monitor_only_enabled;
 
 	struct ieee80211_channel *monitor_channel;
 	enum nl80211_channel_type monitor_channel_type;
@@ -480,8 +481,15 @@ int ieee80211_get_ratemask(struct ieee80211_supported_band *sband,
 int cfg80211_validate_beacon_int(struct cfg80211_registered_device *rdev,
 				 u32 beacon_int);
 
+enum cfg80211_iface_action {
+	CFG80211_IFACE_DOWN,
+	CFG80211_IFACE_PRE_UP,
+	CFG80211_IFACE_UP,
+};
+
 void cfg80211_update_iface_num(struct cfg80211_registered_device *rdev,
-			       enum nl80211_iftype iftype, int num);
+			       enum nl80211_iftype iftype,
+			       enum cfg80211_iface_action action);
 
 #define CFG80211_MAX_NUM_DIFFERENT_CHANNELS 10
 
diff --git a/net/wireless/util.c b/net/wireless/util.c
index 26f8cd3..37e9a3f 100644
--- a/net/wireless/util.c
+++ b/net/wireless/util.c
@@ -893,8 +893,12 @@ int cfg80211_change_iface(struct cfg80211_registered_device *rdev,
 	}
 
 	if (!err && ntype != otype && netif_running(dev)) {
-		cfg80211_update_iface_num(rdev, ntype, 1);
-		cfg80211_update_iface_num(rdev, otype, -1);
+		cfg80211_update_iface_num(rdev, ntype,
+					  CFG80211_IFACE_DOWN);
+		cfg80211_update_iface_num(rdev, ntype,
+					  CFG80211_IFACE_PRE_UP);
+		cfg80211_update_iface_num(rdev, otype,
+					  CFG80211_IFACE_UP);
 	}
 
 	return err;
-- 
1.7.10.4




^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: warning in iwlwifi on monitor mode in 3.5.0-rc6-wl
  2012-07-12 13:24       ` Johannes Berg
@ 2012-07-12 15:10         ` Mohammed Shafi
  0 siblings, 0 replies; 7+ messages in thread
From: Mohammed Shafi @ 2012-07-12 15:10 UTC (permalink / raw)
  To: Johannes Berg
  Cc: Emmanuel Grumbach, Guy, Wey-Yi W, linux-wireless Mailing List,
	Michal Kazior

Hi Johannes,

On Thu, Jul 12, 2012 at 6:54 PM, Johannes Berg
<johannes@sipsolutions.net> wrote:
> This should fix it, can you confirm? I did tracing for various cases and
> it looks correct to me.

i just applied this one and the other patch which solve lockdep
complaint of yours.
seems monitor iface working without warning. will be using it for some
more time,
will report if i see any issues

>
> johannes
>
>
>
> From: Johannes Berg <johannes.berg@intel.com>
> Date: Thu, 12 Jul 2012 15:19:36 +0200
> Subject: [PATCH] cfg80211: fix set_monitor_enabled
>
> When bringing monitor mode up with a driver using the
> mac80211 virtual monitor interface this resulted in a
> warning because cfg80211_update_iface_num() is called
> from PRE_UP, which causes it to call mac80211 and the
> low-level driver before the device is started.
>
> For the case that another interface is added and the
> monitor interface should be removed, this is correct.
> However, in the case where a monitor interface is
> added, it's not correct as the above.
>
> To fix this, we need to split up the cases and track
> whether or not "only monitor" is active so that the
> code can correctly call into the driver when things
> change.
>
> Reported-by: Mohammed Shafi <shafi.wireless@gmail.com>
> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
> ---
>  net/wireless/core.c |   62 ++++++++++++++++++++++++++++++++++++++-------------
>  net/wireless/core.h |   10 ++++++++-
>  net/wireless/util.c |    8 +++++--
>  3 files changed, 61 insertions(+), 19 deletions(-)
>
> diff --git a/net/wireless/core.c b/net/wireless/core.c
> index 0557bb1..b63c450 100644
> --- a/net/wireless/core.c
> +++ b/net/wireless/core.c
> @@ -766,30 +766,56 @@ static void cfg80211_init_mon_chan(struct cfg80211_registered_device *rdev)
>  }
>
>  void cfg80211_update_iface_num(struct cfg80211_registered_device *rdev,
> -                              enum nl80211_iftype iftype, int num)
> +                              enum nl80211_iftype iftype,
> +                              enum cfg80211_iface_action action)
>  {
> -       bool has_monitors_only_old = cfg80211_has_monitors_only(rdev);
> -       bool has_monitors_only_new;
> +       bool monitors_only;
> +       int num;
>
>         ASSERT_RTNL();
>
> +       switch (action) {
> +       case CFG80211_IFACE_DOWN:
> +               num = -1;
> +               break;
> +       case CFG80211_IFACE_PRE_UP:
> +               num = 1;
> +               break;
> +       case CFG80211_IFACE_UP:
> +               num = 0;
> +               break;
> +       default:
> +               WARN_ON(1);
> +               return;
> +       }
> +
>         rdev->num_running_ifaces += num;
>         if (iftype == NL80211_IFTYPE_MONITOR)
>                 rdev->num_running_monitor_ifaces += num;
>
> -       has_monitors_only_new = cfg80211_has_monitors_only(rdev);
> -       if (has_monitors_only_new != has_monitors_only_old) {
> +       monitors_only = cfg80211_has_monitors_only(rdev);
> +
> +       if (monitors_only && rdev->monitor_only_enabled)
> +               return;
> +
> +       if (!monitors_only && !rdev->monitor_only_enabled)
> +               return;
> +
> +       if (monitors_only) {
> +               /* Do it in CFG80211_IFACE_UP instead */
> +               if (action == CFG80211_IFACE_PRE_UP)
> +                       return;
>                 if (rdev->ops->set_monitor_enabled)
> -                       rdev->ops->set_monitor_enabled(&rdev->wiphy,
> -                                                      has_monitors_only_new);
> -
> -               if (!has_monitors_only_new) {
> -                       rdev->monitor_channel = NULL;
> -                       rdev->monitor_channel_type = NL80211_CHAN_NO_HT;
> -               } else {
> -                       cfg80211_init_mon_chan(rdev);
> -               }
> +                       rdev->ops->set_monitor_enabled(&rdev->wiphy, true);
> +               cfg80211_init_mon_chan(rdev);
> +       } else {
> +               rdev->monitor_channel = NULL;
> +               rdev->monitor_channel_type = NL80211_CHAN_NO_HT;
> +               if (rdev->ops->set_monitor_enabled)
> +                       rdev->ops->set_monitor_enabled(&rdev->wiphy, false);
>         }
> +
> +       rdev->monitor_only_enabled = monitors_only;
>  }
>
>  static int cfg80211_netdev_notifier_call(struct notifier_block *nb,
> @@ -895,7 +921,8 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb,
>                 wdev->beacon_interval = 0;
>                 break;
>         case NETDEV_DOWN:
> -               cfg80211_update_iface_num(rdev, wdev->iftype, -1);
> +               cfg80211_update_iface_num(rdev, wdev->iftype,
> +                                         CFG80211_IFACE_DOWN);
>                 dev_hold(dev);
>                 queue_work(cfg80211_wq, &wdev->cleanup_work);
>                 break;
> @@ -912,6 +939,8 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb,
>                         mutex_unlock(&rdev->devlist_mtx);
>                         dev_put(dev);
>                 }
> +               cfg80211_update_iface_num(rdev, wdev->iftype,
> +                                         CFG80211_IFACE_UP);
>                 cfg80211_lock_rdev(rdev);
>                 mutex_lock(&rdev->devlist_mtx);
>                 wdev_lock(wdev);
> @@ -1006,7 +1035,8 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb,
>                 mutex_unlock(&rdev->devlist_mtx);
>                 if (ret)
>                         return notifier_from_errno(ret);
> -               cfg80211_update_iface_num(rdev, wdev->iftype, 1);
> +               cfg80211_update_iface_num(rdev, wdev->iftype,
> +                                         CFG80211_IFACE_PRE_UP);
>                 break;
>         }
>
> diff --git a/net/wireless/core.h b/net/wireless/core.h
> index bac97da..b2b1db3 100644
> --- a/net/wireless/core.h
> +++ b/net/wireless/core.h
> @@ -60,6 +60,7 @@ struct cfg80211_registered_device {
>         /* protected by RTNL only */
>         int num_running_ifaces;
>         int num_running_monitor_ifaces;
> +       bool monitor_only_enabled;
>
>         struct ieee80211_channel *monitor_channel;
>         enum nl80211_channel_type monitor_channel_type;
> @@ -480,8 +481,15 @@ int ieee80211_get_ratemask(struct ieee80211_supported_band *sband,
>  int cfg80211_validate_beacon_int(struct cfg80211_registered_device *rdev,
>                                  u32 beacon_int);
>
> +enum cfg80211_iface_action {
> +       CFG80211_IFACE_DOWN,
> +       CFG80211_IFACE_PRE_UP,
> +       CFG80211_IFACE_UP,
> +};
> +
>  void cfg80211_update_iface_num(struct cfg80211_registered_device *rdev,
> -                              enum nl80211_iftype iftype, int num);
> +                              enum nl80211_iftype iftype,
> +                              enum cfg80211_iface_action action);
>
>  #define CFG80211_MAX_NUM_DIFFERENT_CHANNELS 10
>
> diff --git a/net/wireless/util.c b/net/wireless/util.c
> index 26f8cd3..37e9a3f 100644
> --- a/net/wireless/util.c
> +++ b/net/wireless/util.c
> @@ -893,8 +893,12 @@ int cfg80211_change_iface(struct cfg80211_registered_device *rdev,
>         }
>
>         if (!err && ntype != otype && netif_running(dev)) {
> -               cfg80211_update_iface_num(rdev, ntype, 1);
> -               cfg80211_update_iface_num(rdev, otype, -1);
> +               cfg80211_update_iface_num(rdev, ntype,
> +                                         CFG80211_IFACE_DOWN);
> +               cfg80211_update_iface_num(rdev, ntype,
> +                                         CFG80211_IFACE_PRE_UP);
> +               cfg80211_update_iface_num(rdev, otype,
> +                                         CFG80211_IFACE_UP);
>         }
>
>         return err;
> --
> 1.7.10.4
>
>
>



-- 
thanks,
shafi

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-07-12 15:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-11 14:05 warning in iwlwifi on monitor mode in 3.5.0-rc6-wl Mohammed Shafi
2012-07-11 14:18 ` Johannes Berg
2012-07-11 14:24   ` Mohammed Shafi
2012-07-11 14:29     ` Mohammed Shafi
2012-07-11 14:30       ` Johannes Berg
2012-07-12 13:24       ` Johannes Berg
2012-07-12 15:10         ` Mohammed Shafi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.