sta_info.c (95a0c7c2d6cfde3fb5fdb713428ed0df4d6bdd58) sta_info.c (4c02d62fa37a05254a87575c7d430819f77bd6c9)
1/*
2 * Copyright 2002-2005, Instant802 Networks, Inc.
3 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz>
4 * Copyright 2013-2014 Intel Mobile Communications GmbH
5 * Copyright (C) 2015 - 2017 Intel Deutschland GmbH
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as

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

324 INIT_WORK(&sta->drv_deliver_wk, sta_deliver_ps_frames);
325 INIT_WORK(&sta->ampdu_mlme.work, ieee80211_ba_session_work);
326 mutex_init(&sta->ampdu_mlme.mtx);
327#ifdef CONFIG_MAC80211_MESH
328 if (ieee80211_vif_is_mesh(&sdata->vif)) {
329 sta->mesh = kzalloc(sizeof(*sta->mesh), gfp);
330 if (!sta->mesh)
331 goto free;
1/*
2 * Copyright 2002-2005, Instant802 Networks, Inc.
3 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz>
4 * Copyright 2013-2014 Intel Mobile Communications GmbH
5 * Copyright (C) 2015 - 2017 Intel Deutschland GmbH
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as

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

324 INIT_WORK(&sta->drv_deliver_wk, sta_deliver_ps_frames);
325 INIT_WORK(&sta->ampdu_mlme.work, ieee80211_ba_session_work);
326 mutex_init(&sta->ampdu_mlme.mtx);
327#ifdef CONFIG_MAC80211_MESH
328 if (ieee80211_vif_is_mesh(&sdata->vif)) {
329 sta->mesh = kzalloc(sizeof(*sta->mesh), gfp);
330 if (!sta->mesh)
331 goto free;
332 sta->mesh->plink_sta = sta;
332 spin_lock_init(&sta->mesh->plink_lock);
333 if (ieee80211_vif_is_mesh(&sdata->vif) &&
334 !sdata->u.mesh.user_mpm)
333 spin_lock_init(&sta->mesh->plink_lock);
334 if (ieee80211_vif_is_mesh(&sdata->vif) &&
335 !sdata->u.mesh.user_mpm)
335 init_timer(&sta->mesh->plink_timer);
336 timer_setup(&sta->mesh->plink_timer, mesh_plink_timer,
337 0);
336 sta->mesh->nonpeer_pm = NL80211_MESH_POWER_ACTIVE;
337 }
338#endif
339
340 memcpy(sta->addr, addr, ETH_ALEN);
341 memcpy(sta->sta.addr, addr, ETH_ALEN);
342 sta->sta.max_rx_aggregation_subframes =
343 local->hw.max_rx_aggregation_subframes;

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

510
511 /* unwind on error */
512 for (; state > IEEE80211_STA_NOTEXIST; state--)
513 WARN_ON(drv_sta_state(local, sdata, sta, state, state - 1));
514
515 return err;
516}
517
338 sta->mesh->nonpeer_pm = NL80211_MESH_POWER_ACTIVE;
339 }
340#endif
341
342 memcpy(sta->addr, addr, ETH_ALEN);
343 memcpy(sta->sta.addr, addr, ETH_ALEN);
344 sta->sta.max_rx_aggregation_subframes =
345 local->hw.max_rx_aggregation_subframes;

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

512
513 /* unwind on error */
514 for (; state > IEEE80211_STA_NOTEXIST; state--)
515 WARN_ON(drv_sta_state(local, sdata, sta, state, state - 1));
516
517 return err;
518}
519
520static void
521ieee80211_recalc_p2p_go_ps_allowed(struct ieee80211_sub_if_data *sdata)
522{
523 struct ieee80211_local *local = sdata->local;
524 bool allow_p2p_go_ps = sdata->vif.p2p;
525 struct sta_info *sta;
526
527 rcu_read_lock();
528 list_for_each_entry_rcu(sta, &local->sta_list, list) {
529 if (sdata != sta->sdata ||
530 !test_sta_flag(sta, WLAN_STA_ASSOC))
531 continue;
532 if (!sta->sta.support_p2p_ps) {
533 allow_p2p_go_ps = false;
534 break;
535 }
536 }
537 rcu_read_unlock();
538
539 if (allow_p2p_go_ps != sdata->vif.bss_conf.allow_p2p_go_ps) {
540 sdata->vif.bss_conf.allow_p2p_go_ps = allow_p2p_go_ps;
541 ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_P2P_PS);
542 }
543}
544
518/*
519 * should be called with sta_mtx locked
520 * this function replaces the mutex lock
521 * with a RCU lock
522 */
523static int sta_info_insert_finish(struct sta_info *sta) __acquires(RCU)
524{
525 struct ieee80211_local *local = sta->local;

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

556 list_add_tail_rcu(&sta->list, &local->sta_list);
557
558 /* notify driver */
559 err = sta_info_insert_drv_state(local, sdata, sta);
560 if (err)
561 goto out_remove;
562
563 set_sta_flag(sta, WLAN_STA_INSERTED);
545/*
546 * should be called with sta_mtx locked
547 * this function replaces the mutex lock
548 * with a RCU lock
549 */
550static int sta_info_insert_finish(struct sta_info *sta) __acquires(RCU)
551{
552 struct ieee80211_local *local = sta->local;

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

583 list_add_tail_rcu(&sta->list, &local->sta_list);
584
585 /* notify driver */
586 err = sta_info_insert_drv_state(local, sdata, sta);
587 if (err)
588 goto out_remove;
589
590 set_sta_flag(sta, WLAN_STA_INSERTED);
591
592 if (sta->sta_state >= IEEE80211_STA_ASSOC) {
593 ieee80211_recalc_min_chandef(sta->sdata);
594 if (!sta->sta.support_p2p_ps)
595 ieee80211_recalc_p2p_go_ps_allowed(sta->sdata);
596 }
597
564 /* accept BA sessions now */
565 clear_sta_flag(sta, WLAN_STA_BLOCK_BA);
566
567 ieee80211_sta_debugfs_add(sta);
568 rate_control_add_sta_debugfs(sta);
569
570 sinfo->generation = local->sta_generation;
571 cfg80211_new_sta(sdata->dev, sta->sta.addr, sinfo, GFP_KERNEL);

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

1783 set_bit(tid, &sta->driver_buffered_tids);
1784 else
1785 clear_bit(tid, &sta->driver_buffered_tids);
1786
1787 sta_info_recalc_tim(sta);
1788}
1789EXPORT_SYMBOL(ieee80211_sta_set_buffered);
1790
598 /* accept BA sessions now */
599 clear_sta_flag(sta, WLAN_STA_BLOCK_BA);
600
601 ieee80211_sta_debugfs_add(sta);
602 rate_control_add_sta_debugfs(sta);
603
604 sinfo->generation = local->sta_generation;
605 cfg80211_new_sta(sdata->dev, sta->sta.addr, sinfo, GFP_KERNEL);

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

1817 set_bit(tid, &sta->driver_buffered_tids);
1818 else
1819 clear_bit(tid, &sta->driver_buffered_tids);
1820
1821 sta_info_recalc_tim(sta);
1822}
1823EXPORT_SYMBOL(ieee80211_sta_set_buffered);
1824
1791static void
1792ieee80211_recalc_p2p_go_ps_allowed(struct ieee80211_sub_if_data *sdata)
1793{
1794 struct ieee80211_local *local = sdata->local;
1795 bool allow_p2p_go_ps = sdata->vif.p2p;
1796 struct sta_info *sta;
1797
1798 rcu_read_lock();
1799 list_for_each_entry_rcu(sta, &local->sta_list, list) {
1800 if (sdata != sta->sdata ||
1801 !test_sta_flag(sta, WLAN_STA_ASSOC))
1802 continue;
1803 if (!sta->sta.support_p2p_ps) {
1804 allow_p2p_go_ps = false;
1805 break;
1806 }
1807 }
1808 rcu_read_unlock();
1809
1810 if (allow_p2p_go_ps != sdata->vif.bss_conf.allow_p2p_go_ps) {
1811 sdata->vif.bss_conf.allow_p2p_go_ps = allow_p2p_go_ps;
1812 ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_P2P_PS);
1813 }
1814}
1815
1816int sta_info_move_state(struct sta_info *sta,
1817 enum ieee80211_sta_state new_state)
1818{
1819 might_sleep();
1820
1821 if (sta->sta_state == new_state)
1822 return 0;
1823

--- 519 unchanged lines hidden ---
1825int sta_info_move_state(struct sta_info *sta,
1826 enum ieee80211_sta_state new_state)
1827{
1828 might_sleep();
1829
1830 if (sta->sta_state == new_state)
1831 return 0;
1832

--- 519 unchanged lines hidden ---