iface.c (e7d9facf0bab6d919342fea17c8cc0f65f8a0fe9) iface.c (55de908ab292c03f1eb280f51170ddb9c6b57e31)
1/*
2 * Interface handling (except master interface)
3 *
4 * Copyright 2002-2005, Instant802 Networks, Inc.
5 * Copyright 2005-2006, Devicescape Software, Inc.
6 * Copyright (c) 2006 Jiri Benc <jbenc@suse.cz>
7 * Copyright 2008, Johannes Berg <johannes@sipsolutions.net>
8 *

--- 366 unchanged lines hidden (view full) ---

375 }
376
377 ret = ieee80211_check_queues(sdata);
378 if (ret) {
379 kfree(sdata);
380 goto out_unlock;
381 }
382
1/*
2 * Interface handling (except master interface)
3 *
4 * Copyright 2002-2005, Instant802 Networks, Inc.
5 * Copyright 2005-2006, Devicescape Software, Inc.
6 * Copyright (c) 2006 Jiri Benc <jbenc@suse.cz>
7 * Copyright 2008, Johannes Berg <johannes@sipsolutions.net>
8 *

--- 366 unchanged lines hidden (view full) ---

375 }
376
377 ret = ieee80211_check_queues(sdata);
378 if (ret) {
379 kfree(sdata);
380 goto out_unlock;
381 }
382
383 ret = ieee80211_vif_use_channel(sdata, local->monitor_channel,
384 local->monitor_channel_type,
385 IEEE80211_CHANCTX_EXCLUSIVE);
386 if (ret) {
387 drv_remove_interface(local, sdata);
388 kfree(sdata);
389 goto out_unlock;
390 }
391
383 rcu_assign_pointer(local->monitor_sdata, sdata);
384 out_unlock:
385 mutex_unlock(&local->iflist_mtx);
386 return ret;
387}
388
389static void ieee80211_del_virtual_monitor(struct ieee80211_local *local)
390{

--- 7 unchanged lines hidden (view full) ---

398 sdata = rcu_dereference_protected(local->monitor_sdata,
399 lockdep_is_held(&local->iflist_mtx));
400 if (!sdata)
401 goto out_unlock;
402
403 rcu_assign_pointer(local->monitor_sdata, NULL);
404 synchronize_net();
405
392 rcu_assign_pointer(local->monitor_sdata, sdata);
393 out_unlock:
394 mutex_unlock(&local->iflist_mtx);
395 return ret;
396}
397
398static void ieee80211_del_virtual_monitor(struct ieee80211_local *local)
399{

--- 7 unchanged lines hidden (view full) ---

407 sdata = rcu_dereference_protected(local->monitor_sdata,
408 lockdep_is_held(&local->iflist_mtx));
409 if (!sdata)
410 goto out_unlock;
411
412 rcu_assign_pointer(local->monitor_sdata, NULL);
413 synchronize_net();
414
415 ieee80211_vif_release_channel(sdata);
416
406 drv_remove_interface(local, sdata);
407
408 kfree(sdata);
409 out_unlock:
410 mutex_unlock(&local->iflist_mtx);
411}
412
413/*

--- 246 unchanged lines hidden (view full) ---

660static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata,
661 bool going_down)
662{
663 struct ieee80211_local *local = sdata->local;
664 unsigned long flags;
665 struct sk_buff *skb, *tmp;
666 u32 hw_reconf_flags = 0;
667 int i;
417 drv_remove_interface(local, sdata);
418
419 kfree(sdata);
420 out_unlock:
421 mutex_unlock(&local->iflist_mtx);
422}
423
424/*

--- 246 unchanged lines hidden (view full) ---

671static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata,
672 bool going_down)
673{
674 struct ieee80211_local *local = sdata->local;
675 unsigned long flags;
676 struct sk_buff *skb, *tmp;
677 u32 hw_reconf_flags = 0;
678 int i;
668 enum nl80211_channel_type orig_ct;
669
670 clear_bit(SDATA_STATE_RUNNING, &sdata->state);
671
672 if (rcu_access_pointer(local->scan_sdata) == sdata)
673 ieee80211_scan_cancel(local);
674
675 /*
676 * Stop TX on this interface first.

--- 155 unchanged lines hidden (view full) ---

832 napi_disable(&local->napi);
833 ieee80211_clear_tx_pending(local);
834 ieee80211_stop_device(local);
835
836 /* no reconfiguring after stop! */
837 hw_reconf_flags = 0;
838 }
839
679
680 clear_bit(SDATA_STATE_RUNNING, &sdata->state);
681
682 if (rcu_access_pointer(local->scan_sdata) == sdata)
683 ieee80211_scan_cancel(local);
684
685 /*
686 * Stop TX on this interface first.

--- 155 unchanged lines hidden (view full) ---

842 napi_disable(&local->napi);
843 ieee80211_clear_tx_pending(local);
844 ieee80211_stop_device(local);
845
846 /* no reconfiguring after stop! */
847 hw_reconf_flags = 0;
848 }
849
840 /* Re-calculate channel-type, in case there are multiple vifs
841 * on different channel types.
842 */
843 orig_ct = local->_oper_channel_type;
844 ieee80211_set_channel_type(local, NULL, NL80211_CHAN_NO_HT);
845
846 /* do after stop to avoid reconfiguring when we stop anyway */
850 /* do after stop to avoid reconfiguring when we stop anyway */
847 if (hw_reconf_flags || (orig_ct != local->_oper_channel_type))
851 if (hw_reconf_flags)
848 ieee80211_hw_config(local, hw_reconf_flags);
849
850 spin_lock_irqsave(&local->queue_stop_reason_lock, flags);
851 for (i = 0; i < IEEE80211_MAX_QUEUES; i++) {
852 skb_queue_walk_safe(&local->pending[i], skb, tmp) {
853 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
854 if (info->control.vif == &sdata->vif) {
855 __skb_unlink(skb, &local->pending[i]);

--- 421 unchanged lines hidden (view full) ---

1277{
1278 int ret;
1279
1280 ASSERT_RTNL();
1281
1282 if (type == ieee80211_vif_type_p2p(&sdata->vif))
1283 return 0;
1284
852 ieee80211_hw_config(local, hw_reconf_flags);
853
854 spin_lock_irqsave(&local->queue_stop_reason_lock, flags);
855 for (i = 0; i < IEEE80211_MAX_QUEUES; i++) {
856 skb_queue_walk_safe(&local->pending[i], skb, tmp) {
857 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
858 if (info->control.vif == &sdata->vif) {
859 __skb_unlink(skb, &local->pending[i]);

--- 421 unchanged lines hidden (view full) ---

1281{
1282 int ret;
1283
1284 ASSERT_RTNL();
1285
1286 if (type == ieee80211_vif_type_p2p(&sdata->vif))
1287 return 0;
1288
1285 /* Setting ad-hoc mode on non-IBSS channel is not supported. */
1286 if (sdata->local->oper_channel->flags & IEEE80211_CHAN_NO_IBSS &&
1287 type == NL80211_IFTYPE_ADHOC)
1288 return -EOPNOTSUPP;
1289
1290 if (ieee80211_sdata_running(sdata)) {
1291 ret = ieee80211_runtime_change_iftype(sdata, type);
1292 if (ret)
1293 return ret;
1294 } else {
1295 /* Purge and reset type-dependent state. */
1296 ieee80211_teardown_sdata(sdata);
1297 ieee80211_setup_sdata(sdata, type);
1298 }
1299
1300 /* reset some values that shouldn't be kept across type changes */
1289 if (ieee80211_sdata_running(sdata)) {
1290 ret = ieee80211_runtime_change_iftype(sdata, type);
1291 if (ret)
1292 return ret;
1293 } else {
1294 /* Purge and reset type-dependent state. */
1295 ieee80211_teardown_sdata(sdata);
1296 ieee80211_setup_sdata(sdata, type);
1297 }
1298
1299 /* reset some values that shouldn't be kept across type changes */
1301 sdata->vif.bss_conf.basic_rates =
1302 ieee80211_mandatory_rates(sdata->local,
1303 sdata->local->oper_channel->band);
1304 sdata->drop_unencrypted = 0;
1305 if (type == NL80211_IFTYPE_STATION)
1306 sdata->u.mgd.use_4addr = false;
1307
1308 return 0;
1309}
1310
1311static void ieee80211_assign_perm_addr(struct ieee80211_local *local,

--- 338 unchanged lines hidden ---
1300 sdata->drop_unencrypted = 0;
1301 if (type == NL80211_IFTYPE_STATION)
1302 sdata->u.mgd.use_4addr = false;
1303
1304 return 0;
1305}
1306
1307static void ieee80211_assign_perm_addr(struct ieee80211_local *local,

--- 338 unchanged lines hidden ---