sta_info.c (10a7ba92c7ab6cbac3c805ab3ee0642e91f1da97) | sta_info.c (92747f17c431a75967b461bedbb36ff259acead1) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * Copyright 2002-2005, Instant802 Networks, Inc. 4 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> 5 * Copyright 2013-2014 Intel Mobile Communications GmbH 6 * Copyright (C) 2015 - 2017 Intel Deutschland GmbH 7 * Copyright (C) 2018-2023 Intel Corporation 8 */ --- 1260 unchanged lines hidden (view full) --- 1269 1270 if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN && 1271 rcu_access_pointer(sdata->u.vlan.sta) == sta) 1272 RCU_INIT_POINTER(sdata->u.vlan.sta, NULL); 1273 1274 return 0; 1275} 1276 | 1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * Copyright 2002-2005, Instant802 Networks, Inc. 4 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> 5 * Copyright 2013-2014 Intel Mobile Communications GmbH 6 * Copyright (C) 2015 - 2017 Intel Deutschland GmbH 7 * Copyright (C) 2018-2023 Intel Corporation 8 */ --- 1260 unchanged lines hidden (view full) --- 1269 1270 if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN && 1271 rcu_access_pointer(sdata->u.vlan.sta) == sta) 1272 RCU_INIT_POINTER(sdata->u.vlan.sta, NULL); 1273 1274 return 0; 1275} 1276 |
1277int sta_info_move_state(struct sta_info *sta, 1278 enum ieee80211_sta_state new_state) | 1277static int _sta_info_move_state(struct sta_info *sta, 1278 enum ieee80211_sta_state new_state, 1279 bool recalc) |
1279{ 1280 might_sleep(); 1281 1282 if (sta->sta_state == new_state) 1283 return 0; 1284 1285 /* check allowed transitions first */ 1286 --- 41 unchanged lines hidden (view full) --- 1328 if (sta->sta_state == IEEE80211_STA_AUTH) 1329 clear_bit(WLAN_STA_AUTH, &sta->_flags); 1330 break; 1331 case IEEE80211_STA_AUTH: 1332 if (sta->sta_state == IEEE80211_STA_NONE) { 1333 set_bit(WLAN_STA_AUTH, &sta->_flags); 1334 } else if (sta->sta_state == IEEE80211_STA_ASSOC) { 1335 clear_bit(WLAN_STA_ASSOC, &sta->_flags); | 1280{ 1281 might_sleep(); 1282 1283 if (sta->sta_state == new_state) 1284 return 0; 1285 1286 /* check allowed transitions first */ 1287 --- 41 unchanged lines hidden (view full) --- 1329 if (sta->sta_state == IEEE80211_STA_AUTH) 1330 clear_bit(WLAN_STA_AUTH, &sta->_flags); 1331 break; 1332 case IEEE80211_STA_AUTH: 1333 if (sta->sta_state == IEEE80211_STA_NONE) { 1334 set_bit(WLAN_STA_AUTH, &sta->_flags); 1335 } else if (sta->sta_state == IEEE80211_STA_ASSOC) { 1336 clear_bit(WLAN_STA_ASSOC, &sta->_flags); |
1336 ieee80211_recalc_min_chandef(sta->sdata, -1); 1337 if (!sta->sta.support_p2p_ps) 1338 ieee80211_recalc_p2p_go_ps_allowed(sta->sdata); | 1337 if (recalc) { 1338 ieee80211_recalc_min_chandef(sta->sdata, -1); 1339 if (!sta->sta.support_p2p_ps) 1340 ieee80211_recalc_p2p_go_ps_allowed(sta->sdata); 1341 } |
1339 } 1340 break; 1341 case IEEE80211_STA_ASSOC: 1342 if (sta->sta_state == IEEE80211_STA_AUTH) { 1343 set_bit(WLAN_STA_ASSOC, &sta->_flags); 1344 sta->assoc_at = ktime_get_boottime_ns(); | 1342 } 1343 break; 1344 case IEEE80211_STA_ASSOC: 1345 if (sta->sta_state == IEEE80211_STA_AUTH) { 1346 set_bit(WLAN_STA_ASSOC, &sta->_flags); 1347 sta->assoc_at = ktime_get_boottime_ns(); |
1345 ieee80211_recalc_min_chandef(sta->sdata, -1); 1346 if (!sta->sta.support_p2p_ps) 1347 ieee80211_recalc_p2p_go_ps_allowed(sta->sdata); | 1348 if (recalc) { 1349 ieee80211_recalc_min_chandef(sta->sdata, -1); 1350 if (!sta->sta.support_p2p_ps) 1351 ieee80211_recalc_p2p_go_ps_allowed(sta->sdata); 1352 } |
1348 } else if (sta->sta_state == IEEE80211_STA_AUTHORIZED) { 1349 ieee80211_vif_dec_num_mcast(sta->sdata); 1350 clear_bit(WLAN_STA_AUTHORIZED, &sta->_flags); 1351 ieee80211_clear_fast_xmit(sta); 1352 ieee80211_clear_fast_rx(sta); 1353 } 1354 break; 1355 case IEEE80211_STA_AUTHORIZED: --- 12 unchanged lines hidden (view full) --- 1368 break; 1369 } 1370 1371 sta->sta_state = new_state; 1372 1373 return 0; 1374} 1375 | 1353 } else if (sta->sta_state == IEEE80211_STA_AUTHORIZED) { 1354 ieee80211_vif_dec_num_mcast(sta->sdata); 1355 clear_bit(WLAN_STA_AUTHORIZED, &sta->_flags); 1356 ieee80211_clear_fast_xmit(sta); 1357 ieee80211_clear_fast_rx(sta); 1358 } 1359 break; 1360 case IEEE80211_STA_AUTHORIZED: --- 12 unchanged lines hidden (view full) --- 1373 break; 1374 } 1375 1376 sta->sta_state = new_state; 1377 1378 return 0; 1379} 1380 |
1376static void __sta_info_destroy_part2(struct sta_info *sta) | 1381int sta_info_move_state(struct sta_info *sta, 1382 enum ieee80211_sta_state new_state) |
1377{ | 1383{ |
1384 return _sta_info_move_state(sta, new_state, true); 1385} 1386 1387static void __sta_info_destroy_part2(struct sta_info *sta, bool recalc) 1388{ |
|
1378 struct ieee80211_local *local = sta->local; 1379 struct ieee80211_sub_if_data *sdata = sta->sdata; 1380 struct station_info *sinfo; 1381 int ret; 1382 1383 /* 1384 * NOTE: This assumes at least synchronize_net() was done 1385 * after _part1 and before _part2! 1386 */ 1387 1388 might_sleep(); 1389 lockdep_assert_held(&local->sta_mtx); 1390 1391 if (sta->sta_state == IEEE80211_STA_AUTHORIZED) { | 1389 struct ieee80211_local *local = sta->local; 1390 struct ieee80211_sub_if_data *sdata = sta->sdata; 1391 struct station_info *sinfo; 1392 int ret; 1393 1394 /* 1395 * NOTE: This assumes at least synchronize_net() was done 1396 * after _part1 and before _part2! 1397 */ 1398 1399 might_sleep(); 1400 lockdep_assert_held(&local->sta_mtx); 1401 1402 if (sta->sta_state == IEEE80211_STA_AUTHORIZED) { |
1392 ret = sta_info_move_state(sta, IEEE80211_STA_ASSOC); | 1403 ret = _sta_info_move_state(sta, IEEE80211_STA_ASSOC, recalc); |
1393 WARN_ON_ONCE(ret); 1394 } 1395 1396 /* Flush queues before removing keys, as that might remove them 1397 * from hardware, and then depending on the offload method, any 1398 * frames sitting on hardware queues might be sent out without 1399 * any encryption at all. 1400 */ --- 11 unchanged lines hidden (view full) --- 1412 __sta_info_recalc_tim(sta, true); 1413 1414 sta->dead = true; 1415 1416 local->num_sta--; 1417 local->sta_generation++; 1418 1419 while (sta->sta_state > IEEE80211_STA_NONE) { | 1404 WARN_ON_ONCE(ret); 1405 } 1406 1407 /* Flush queues before removing keys, as that might remove them 1408 * from hardware, and then depending on the offload method, any 1409 * frames sitting on hardware queues might be sent out without 1410 * any encryption at all. 1411 */ --- 11 unchanged lines hidden (view full) --- 1423 __sta_info_recalc_tim(sta, true); 1424 1425 sta->dead = true; 1426 1427 local->num_sta--; 1428 local->sta_generation++; 1429 1430 while (sta->sta_state > IEEE80211_STA_NONE) { |
1420 ret = sta_info_move_state(sta, sta->sta_state - 1); | 1431 ret = _sta_info_move_state(sta, sta->sta_state - 1, recalc); |
1421 if (ret) { 1422 WARN_ON_ONCE(1); 1423 break; 1424 } 1425 } 1426 1427 if (sta->uploaded) { 1428 ret = drv_sta_state(local, sdata, sta, IEEE80211_STA_NONE, --- 20 unchanged lines hidden (view full) --- 1449{ 1450 int err = __sta_info_destroy_part1(sta); 1451 1452 if (err) 1453 return err; 1454 1455 synchronize_net(); 1456 | 1432 if (ret) { 1433 WARN_ON_ONCE(1); 1434 break; 1435 } 1436 } 1437 1438 if (sta->uploaded) { 1439 ret = drv_sta_state(local, sdata, sta, IEEE80211_STA_NONE, --- 20 unchanged lines hidden (view full) --- 1460{ 1461 int err = __sta_info_destroy_part1(sta); 1462 1463 if (err) 1464 return err; 1465 1466 synchronize_net(); 1467 |
1457 __sta_info_destroy_part2(sta); | 1468 __sta_info_destroy_part2(sta, true); |
1458 1459 return 0; 1460} 1461 1462int sta_info_destroy_addr(struct ieee80211_sub_if_data *sdata, const u8 *addr) 1463{ 1464 struct sta_info *sta; 1465 int ret; --- 90 unchanged lines hidden (view full) --- 1556 (vlans && sdata->bss == sta->sdata->bss)) { 1557 if (!WARN_ON(__sta_info_destroy_part1(sta))) 1558 list_add(&sta->free_list, &free_list); 1559 ret++; 1560 } 1561 } 1562 1563 if (!list_empty(&free_list)) { | 1469 1470 return 0; 1471} 1472 1473int sta_info_destroy_addr(struct ieee80211_sub_if_data *sdata, const u8 *addr) 1474{ 1475 struct sta_info *sta; 1476 int ret; --- 90 unchanged lines hidden (view full) --- 1567 (vlans && sdata->bss == sta->sdata->bss)) { 1568 if (!WARN_ON(__sta_info_destroy_part1(sta))) 1569 list_add(&sta->free_list, &free_list); 1570 ret++; 1571 } 1572 } 1573 1574 if (!list_empty(&free_list)) { |
1575 bool support_p2p_ps = true; 1576 |
|
1564 synchronize_net(); | 1577 synchronize_net(); |
1565 list_for_each_entry_safe(sta, tmp, &free_list, free_list) 1566 __sta_info_destroy_part2(sta); | 1578 list_for_each_entry_safe(sta, tmp, &free_list, free_list) { 1579 if (!sta->sta.support_p2p_ps) 1580 support_p2p_ps = false; 1581 __sta_info_destroy_part2(sta, false); 1582 } 1583 1584 ieee80211_recalc_min_chandef(sdata, -1); 1585 if (!support_p2p_ps) 1586 ieee80211_recalc_p2p_go_ps_allowed(sdata); |
1567 } 1568 mutex_unlock(&local->sta_mtx); 1569 1570 return ret; 1571} 1572 1573void ieee80211_sta_expire(struct ieee80211_sub_if_data *sdata, 1574 unsigned long exp_time) --- 1409 unchanged lines hidden --- | 1587 } 1588 mutex_unlock(&local->sta_mtx); 1589 1590 return ret; 1591} 1592 1593void ieee80211_sta_expire(struct ieee80211_sub_if_data *sdata, 1594 unsigned long exp_time) --- 1409 unchanged lines hidden --- |