ieee80211_node.c (627bd78e3e2e60e0124e82577203acb5c793838f) | ieee80211_node.c (d20ff6e6805a5ad5b244b4e96e10ea824971a045) |
---|---|
1/*- 2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD 3 * 4 * Copyright (c) 2001 Atsushi Onoe 5 * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 432 unchanged lines hidden (view full) --- 441void 442ieee80211_reset_bss(struct ieee80211vap *vap) 443{ 444 struct ieee80211com *ic = vap->iv_ic; 445 struct ieee80211_node *ni, *obss; 446 447 ieee80211_node_table_reset(&ic->ic_sta, vap); 448 /* XXX multi-bss: wrong */ | 1/*- 2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD 3 * 4 * Copyright (c) 2001 Atsushi Onoe 5 * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 432 unchanged lines hidden (view full) --- 441void 442ieee80211_reset_bss(struct ieee80211vap *vap) 443{ 444 struct ieee80211com *ic = vap->iv_ic; 445 struct ieee80211_node *ni, *obss; 446 447 ieee80211_node_table_reset(&ic->ic_sta, vap); 448 /* XXX multi-bss: wrong */ |
449 ieee80211_reset_erp(ic); | 449 ieee80211_vap_reset_erp(vap); |
450 451 ni = ieee80211_alloc_node(&ic->ic_sta, vap, vap->iv_myaddr); 452 KASSERT(ni != NULL, ("unable to setup initial BSS node")); 453 obss = vap->iv_bss; 454 vap->iv_bss = ieee80211_ref_node(ni); 455 if (obss != NULL) { 456 copy_bss(ni, obss); 457 ni->ni_intval = ic->ic_bintval; --- 219 unchanged lines hidden (view full) --- 677 678 if (! ieee80211_ibss_merge_check(ni)) 679 return 0; 680 681 IEEE80211_DPRINTF(vap, IEEE80211_MSG_ASSOC, 682 "%s: new bssid %s: %s preamble, %s slot time%s\n", __func__, 683 ether_sprintf(ni->ni_bssid), 684 ic->ic_flags&IEEE80211_F_SHPREAMBLE ? "short" : "long", | 450 451 ni = ieee80211_alloc_node(&ic->ic_sta, vap, vap->iv_myaddr); 452 KASSERT(ni != NULL, ("unable to setup initial BSS node")); 453 obss = vap->iv_bss; 454 vap->iv_bss = ieee80211_ref_node(ni); 455 if (obss != NULL) { 456 copy_bss(ni, obss); 457 ni->ni_intval = ic->ic_bintval; --- 219 unchanged lines hidden (view full) --- 677 678 if (! ieee80211_ibss_merge_check(ni)) 679 return 0; 680 681 IEEE80211_DPRINTF(vap, IEEE80211_MSG_ASSOC, 682 "%s: new bssid %s: %s preamble, %s slot time%s\n", __func__, 683 ether_sprintf(ni->ni_bssid), 684 ic->ic_flags&IEEE80211_F_SHPREAMBLE ? "short" : "long", |
685 ic->ic_flags&IEEE80211_F_SHSLOT ? "short" : "long", | 685 vap->iv_flags&IEEE80211_F_SHSLOT ? "short" : "long", |
686 ic->ic_flags&IEEE80211_F_USEPROT ? ", protection" : "" 687 ); 688 return ieee80211_sta_join1(ieee80211_ref_node(ni)); 689} 690 691/* 692 * Calculate HT channel promotion flags for all vaps. 693 * This assumes ni_chan have been setup for each vap. --- 182 unchanged lines hidden (view full) --- 876 IEEE80211_F_DODEL | IEEE80211_F_JOIN); 877 878 ieee80211_setcurchan(ic, selbs->ni_chan); 879 /* 880 * Set the erp state (mostly the slot time) to deal with 881 * the auto-select case; this should be redundant if the 882 * mode is locked. 883 */ | 686 ic->ic_flags&IEEE80211_F_USEPROT ? ", protection" : "" 687 ); 688 return ieee80211_sta_join1(ieee80211_ref_node(ni)); 689} 690 691/* 692 * Calculate HT channel promotion flags for all vaps. 693 * This assumes ni_chan have been setup for each vap. --- 182 unchanged lines hidden (view full) --- 876 IEEE80211_F_DODEL | IEEE80211_F_JOIN); 877 878 ieee80211_setcurchan(ic, selbs->ni_chan); 879 /* 880 * Set the erp state (mostly the slot time) to deal with 881 * the auto-select case; this should be redundant if the 882 * mode is locked. 883 */ |
884 ieee80211_reset_erp(ic); | 884 ieee80211_vap_reset_erp(vap); |
885 ieee80211_wme_initparams(vap); 886 887 if (vap->iv_opmode == IEEE80211_M_STA) { 888 if (canreassoc) { 889 /* Reassociate */ 890 ieee80211_new_state(vap, IEEE80211_S_ASSOC, 1); 891 } else { 892 /* --- 1747 unchanged lines hidden (view full) --- 2640 2641/* 2642 * Handle a station joining an 11g network. 2643 */ 2644static void 2645ieee80211_node_join_11g(struct ieee80211_node *ni) 2646{ 2647 struct ieee80211com *ic = ni->ni_ic; | 885 ieee80211_wme_initparams(vap); 886 887 if (vap->iv_opmode == IEEE80211_M_STA) { 888 if (canreassoc) { 889 /* Reassociate */ 890 ieee80211_new_state(vap, IEEE80211_S_ASSOC, 1); 891 } else { 892 /* --- 1747 unchanged lines hidden (view full) --- 2640 2641/* 2642 * Handle a station joining an 11g network. 2643 */ 2644static void 2645ieee80211_node_join_11g(struct ieee80211_node *ni) 2646{ 2647 struct ieee80211com *ic = ni->ni_ic; |
2648 struct ieee80211vap *vap = ni->ni_vap; |
|
2648 2649 IEEE80211_LOCK_ASSERT(ic); 2650 2651 /* 2652 * Station isn't capable of short slot time. Bump 2653 * the count of long slot time stations and disable 2654 * use of short slot time. Note that the actual switch 2655 * over to long slot time use may not occur until the 2656 * next beacon transmission (per sec. 7.3.1.4 of 11g). 2657 */ 2658 if ((ni->ni_capinfo & IEEE80211_CAPINFO_SHORT_SLOTTIME) == 0) { 2659 ic->ic_longslotsta++; 2660 IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_ASSOC, ni, 2661 "station needs long slot time, count %d", 2662 ic->ic_longslotsta); | 2649 2650 IEEE80211_LOCK_ASSERT(ic); 2651 2652 /* 2653 * Station isn't capable of short slot time. Bump 2654 * the count of long slot time stations and disable 2655 * use of short slot time. Note that the actual switch 2656 * over to long slot time use may not occur until the 2657 * next beacon transmission (per sec. 7.3.1.4 of 11g). 2658 */ 2659 if ((ni->ni_capinfo & IEEE80211_CAPINFO_SHORT_SLOTTIME) == 0) { 2660 ic->ic_longslotsta++; 2661 IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_ASSOC, ni, 2662 "station needs long slot time, count %d", 2663 ic->ic_longslotsta); |
2663 /* XXX vap's w/ conflicting needs won't work */ | |
2664 if (!IEEE80211_IS_CHAN_108G(ic->ic_bsschan)) { 2665 /* 2666 * Don't force slot time when switched to turbo 2667 * mode as non-ERP stations won't be present; this 2668 * need only be done when on the normal G channel. 2669 */ | 2664 if (!IEEE80211_IS_CHAN_108G(ic->ic_bsschan)) { 2665 /* 2666 * Don't force slot time when switched to turbo 2667 * mode as non-ERP stations won't be present; this 2668 * need only be done when on the normal G channel. 2669 */ |
2670 ieee80211_set_shortslottime(ic, 0); | 2670 ieee80211_vap_set_shortslottime(vap, 0); |
2671 } 2672 } 2673 /* 2674 * If the new station is not an ERP station 2675 * then bump the counter and enable protection 2676 * if configured. 2677 */ 2678 if (!ieee80211_iserp_rateset(&ni->ni_rates)) { --- 73 unchanged lines hidden (view full) --- 2752 2753 /* 2754 * XXX VHT - should log VHT channel width, etc 2755 */ 2756 IEEE80211_NOTE(vap, IEEE80211_MSG_ASSOC | IEEE80211_MSG_DEBUG, ni, 2757 "station associated at aid %d: %s preamble, %s slot time%s%s%s%s%s%s%s%s", 2758 IEEE80211_NODE_AID(ni), 2759 ic->ic_flags & IEEE80211_F_SHPREAMBLE ? "short" : "long", | 2671 } 2672 } 2673 /* 2674 * If the new station is not an ERP station 2675 * then bump the counter and enable protection 2676 * if configured. 2677 */ 2678 if (!ieee80211_iserp_rateset(&ni->ni_rates)) { --- 73 unchanged lines hidden (view full) --- 2752 2753 /* 2754 * XXX VHT - should log VHT channel width, etc 2755 */ 2756 IEEE80211_NOTE(vap, IEEE80211_MSG_ASSOC | IEEE80211_MSG_DEBUG, ni, 2757 "station associated at aid %d: %s preamble, %s slot time%s%s%s%s%s%s%s%s", 2758 IEEE80211_NODE_AID(ni), 2759 ic->ic_flags & IEEE80211_F_SHPREAMBLE ? "short" : "long", |
2760 ic->ic_flags & IEEE80211_F_SHSLOT ? "short" : "long", | 2760 vap->iv_flags & IEEE80211_F_SHSLOT ? "short" : "long", |
2761 ic->ic_flags & IEEE80211_F_USEPROT ? ", protection" : "", 2762 ni->ni_flags & IEEE80211_NODE_QOS ? ", QoS" : "", 2763 /* XXX update for VHT string */ 2764 ni->ni_flags & IEEE80211_NODE_HT ? 2765 (ni->ni_chw == 40 ? ", HT40" : ", HT20") : "", 2766 ni->ni_flags & IEEE80211_NODE_AMPDU ? " (+AMPDU)" : "", 2767 ni->ni_flags & IEEE80211_NODE_MIMO_RTS ? " (+SMPS-DYN)" : 2768 ni->ni_flags & IEEE80211_NODE_MIMO_PS ? " (+SMPS)" : "", --- 36 unchanged lines hidden (view full) --- 2805 2806/* 2807 * Handle a station leaving an 11g network. 2808 */ 2809static void 2810ieee80211_node_leave_11g(struct ieee80211_node *ni) 2811{ 2812 struct ieee80211com *ic = ni->ni_ic; | 2761 ic->ic_flags & IEEE80211_F_USEPROT ? ", protection" : "", 2762 ni->ni_flags & IEEE80211_NODE_QOS ? ", QoS" : "", 2763 /* XXX update for VHT string */ 2764 ni->ni_flags & IEEE80211_NODE_HT ? 2765 (ni->ni_chw == 40 ? ", HT40" : ", HT20") : "", 2766 ni->ni_flags & IEEE80211_NODE_AMPDU ? " (+AMPDU)" : "", 2767 ni->ni_flags & IEEE80211_NODE_MIMO_RTS ? " (+SMPS-DYN)" : 2768 ni->ni_flags & IEEE80211_NODE_MIMO_PS ? " (+SMPS)" : "", --- 36 unchanged lines hidden (view full) --- 2805 2806/* 2807 * Handle a station leaving an 11g network. 2808 */ 2809static void 2810ieee80211_node_leave_11g(struct ieee80211_node *ni) 2811{ 2812 struct ieee80211com *ic = ni->ni_ic; |
2813 struct ieee80211vap *vap = ni->ni_vap; |
|
2813 2814 IEEE80211_LOCK_ASSERT(ic); 2815 2816 KASSERT(IEEE80211_IS_CHAN_ANYG(ic->ic_bsschan), 2817 ("not in 11g, bss %u:0x%x", ic->ic_bsschan->ic_freq, 2818 ic->ic_bsschan->ic_flags)); 2819 2820 /* --- 12 unchanged lines hidden (view full) --- 2833 * and not operating in IBSS mode (per spec). 2834 */ 2835 if ((ic->ic_caps & IEEE80211_C_SHSLOT) && 2836 ic->ic_opmode != IEEE80211_M_IBSS) { 2837 IEEE80211_DPRINTF(ni->ni_vap, 2838 IEEE80211_MSG_ASSOC, 2839 "%s: re-enable use of short slot time\n", 2840 __func__); | 2814 2815 IEEE80211_LOCK_ASSERT(ic); 2816 2817 KASSERT(IEEE80211_IS_CHAN_ANYG(ic->ic_bsschan), 2818 ("not in 11g, bss %u:0x%x", ic->ic_bsschan->ic_freq, 2819 ic->ic_bsschan->ic_flags)); 2820 2821 /* --- 12 unchanged lines hidden (view full) --- 2834 * and not operating in IBSS mode (per spec). 2835 */ 2836 if ((ic->ic_caps & IEEE80211_C_SHSLOT) && 2837 ic->ic_opmode != IEEE80211_M_IBSS) { 2838 IEEE80211_DPRINTF(ni->ni_vap, 2839 IEEE80211_MSG_ASSOC, 2840 "%s: re-enable use of short slot time\n", 2841 __func__); |
2841 ieee80211_set_shortslottime(ic, 1); | 2842 ieee80211_vap_set_shortslottime(vap, 1); |
2842 } 2843 } 2844 } 2845 /* 2846 * If a non-ERP station do the protection-related bookkeeping. 2847 */ 2848 if ((ni->ni_flags & IEEE80211_NODE_ERP) == 0) { 2849 KASSERT(ic->ic_nonerpsta > 0, --- 215 unchanged lines hidden --- | 2843 } 2844 } 2845 } 2846 /* 2847 * If a non-ERP station do the protection-related bookkeeping. 2848 */ 2849 if ((ni->ni_flags & IEEE80211_NODE_ERP) == 0) { 2850 KASSERT(ic->ic_nonerpsta > 0, --- 215 unchanged lines hidden --- |