| 2745 | } |
| 2746 | |
| 2747 | void |
| 2748 | ieee80211_node_join(struct ieee80211_node *ni, int resp) |
| 2749 | { |
| 2750 | struct ieee80211com *ic = ni->ni_ic; |
| 2751 | struct ieee80211vap *vap = ni->ni_vap; |
| 2752 | int newassoc; |
| 2753 | |
| 2754 | if (ni->ni_associd == 0) { |
| 2755 | uint16_t aid; |
| 2756 | |
| 2757 | KASSERT(vap->iv_aid_bitmap != NULL, ("no aid bitmap")); |
| 2758 | /* |
| 2759 | * It would be good to search the bitmap |
| 2760 | * more efficiently, but this will do for now. |
| 2761 | */ |
| 2762 | for (aid = 1; aid < vap->iv_max_aid; aid++) { |
| 2763 | if (!IEEE80211_AID_ISSET(vap, aid)) |
| 2764 | break; |
| 2765 | } |
| 2766 | if (aid >= vap->iv_max_aid) { |
| 2767 | IEEE80211_SEND_MGMT(ni, resp, IEEE80211_STATUS_TOOMANY); |
| 2768 | ieee80211_node_leave(ni); |
| 2769 | return; |
| 2770 | } |
| 2771 | ni->ni_associd = aid | 0xc000; |
| 2772 | ni->ni_jointime = time_uptime; |
| 2773 | IEEE80211_LOCK(ic); |
| 2774 | IEEE80211_AID_SET(vap, ni->ni_associd); |
| 2775 | vap->iv_sta_assoc++; |
| 2776 | |
| 2777 | if (IEEE80211_IS_CHAN_HT(ic->ic_bsschan)) |
| 2778 | ieee80211_ht_node_join(ni); |
| 2779 | if (IEEE80211_IS_CHAN_VHT(ic->ic_bsschan)) |
| 2780 | ieee80211_vht_node_join(ni); |
| 2781 | if (IEEE80211_IS_CHAN_ANYG(ic->ic_bsschan) && |
| 2782 | IEEE80211_IS_CHAN_FULL(ic->ic_bsschan)) |
| 2783 | ieee80211_node_join_11g(ni); |
| 2784 | IEEE80211_UNLOCK(ic); |
| 2785 | |
| 2786 | newassoc = 1; |
| 2787 | } else |
| 2788 | newassoc = 0; |
| 2789 | |
| 2790 | /* |
| 2791 | * XXX VHT - should log VHT channel width, etc |
| 2792 | */ |
| 2793 | IEEE80211_NOTE(vap, IEEE80211_MSG_ASSOC | IEEE80211_MSG_DEBUG, ni, |
| 2794 | "station associated at aid %d: %s preamble, %s slot time%s%s%s%s%s%s%s%s%s", |
| 2795 | IEEE80211_NODE_AID(ni), |
| 2796 | vap->iv_flags & IEEE80211_F_SHPREAMBLE ? "short" : "long", |
| 2797 | vap->iv_flags & IEEE80211_F_SHSLOT ? "short" : "long", |
| 2798 | vap->iv_flags & IEEE80211_F_USEPROT ? ", protection" : "", |
| 2799 | ni->ni_flags & IEEE80211_NODE_QOS ? ", QoS" : "", |
| 2800 | /* XXX update for VHT string */ |
| 2801 | ni->ni_flags & IEEE80211_NODE_HT ? |
| 2802 | (ni->ni_chw == 40 ? ", HT40" : ", HT20") : "", |
| 2803 | ni->ni_flags & IEEE80211_NODE_AMPDU ? " (+AMPDU)" : "", |
| 2804 | ni->ni_flags & IEEE80211_NODE_AMSDU ? " (+AMSDU)" : "", |
no test coverage detected