static void mlme_timeout_callback(struct ieee80211vap *vap, IEEE80211_STATUS ieeeStatus) { struct ieee80211_mlme_priv *mlme_priv = vap->iv_mlme_priv; int mlme_request_type = mlme_priv->im_request_type; IEEE80211_DPRINTF(vap, IEEE80211_MSG_MLME, "%s. Request type = %d\n", __func__, mlme_request_type); /* Request complete */ mlme_priv->im_request_type = MLME_REQ_NONE; switch(mlme_request_type) { case MLME_REQ_JOIN_INFRA: ASSERT(vap->iv_opmode != IEEE80211_M_IBSS); /* * Cancel the Join operation if it has not already completed */ if (MLME_STOP_WAITING_FOR_JOIN(mlme_priv) == TRUE) { IEEE80211_DPRINTF(vap, IEEE80211_MSG_MLME,"%s", "Cancelled the Join Operation as it took too long\n"); IEEE80211_DELIVER_EVENT_MLME_JOIN_COMPLETE_INFRA(vap, ieeeStatus); } break; case MLME_REQ_JOIN_ADHOC: ASSERT(vap->iv_opmode == IEEE80211_M_IBSS); /* * Cancel the Join operation if it has not already completed */ if (MLME_STOP_WAITING_FOR_JOIN(mlme_priv) == TRUE) { IEEE80211_DPRINTF(vap, IEEE80211_MSG_MLME,"%s", "Cancelled the Join Operation as it took too long\n"); IEEE80211_DELIVER_EVENT_MLME_JOIN_COMPLETE_ADHOC(vap, ieeeStatus); } break; case MLME_REQ_AUTH: /* * Cancel the auth operation if it has not already completed */ IEEE80211_DPRINTF(vap, IEEE80211_MSG_MLME,"%s", "Cancelled the Auth Operation as it took too long\n"); mlme_priv->im_expected_auth_seq_number = 0; IEEE80211_DELIVER_EVENT_MLME_AUTH_COMPLETE(vap, ieeeStatus); break; case MLME_REQ_ASSOC: /* * Cancel the assoc operation if it has not already completed */ IEEE80211_DPRINTF(vap, IEEE80211_MSG_MLME,"%s", "Cancelled the Assoc Operation as it took too long\n"); IEEE80211_DELIVER_EVENT_MLME_ASSOC_COMPLETE(vap, ieeeStatus, 0, NULL); break; case MLME_REQ_REASSOC: /* * Cancel the reassoc operation if it has not already completed */ IEEE80211_DPRINTF(vap, IEEE80211_MSG_MLME,"%s", "Cancelled the Reassoc Operation as it took too long\n"); IEEE80211_DELIVER_EVENT_MLME_REASSOC_COMPLETE(vap, ieeeStatus, 0, NULL); break; case MLME_REQ_NONE: IEEE80211_DPRINTF(vap, IEEE80211_MSG_MLME,"%s", "mlme_request_type is MLME_REQ_NONE, do nothing.\n"); break; default: ASSERT(0); break; } }
/* Receive assoc/reassoc response * - the caller of this routine validates the frame and ensures that the opmode == STA */ void ieee80211_mlme_recv_assoc_response(struct ieee80211_node *ni, int subtype, u_int16_t capability, u_int16_t status_code, u_int16_t aid, u_int8_t *ie_data, u_int32_t ie_length, wbuf_t wbuf) { struct ieee80211vap *vap = ni->ni_vap; struct ieee80211_mlme_priv *mlme_priv = vap->iv_mlme_priv; struct ieee80211com *ic = ni->ni_ic; int mlme_request_type = mlme_priv->im_request_type; int error; u_int32_t rxlinkspeed, txlinkspeed; /* bits/sec */ IEEE80211_DPRINTF(vap, IEEE80211_MSG_MLME, "%s im_request_type=%d status=%d (0x%08X)\n", __func__, mlme_priv->im_request_type, status_code, status_code); /* Ignore if no request in progress */ if ((mlme_priv->im_request_type != MLME_REQ_ASSOC) && (mlme_priv->im_request_type != MLME_REQ_REASSOC)) { IEEE80211_DPRINTF(vap, IEEE80211_MSG_MLME, "%s: Incorrect request type %d\n", __func__, mlme_priv->im_request_type); return; } if (!OS_CANCEL_TIMER(&mlme_priv->im_timeout_timer)) { IEEE80211_DPRINTF(vap, IEEE80211_MSG_MLME, "%s: Timed-out already\n", __func__); return; } if (status_code != IEEE80211_STATUS_SUCCESS) { goto complete; } /* Validate AID */ aid &= ~IEEE80211_FIELD_TYPE_AID; if ((aid > 2007) || (aid == 0)) { IEEE80211_DPRINTF(vap, IEEE80211_MSG_MLME, "%s: Association response contains invalid AID=%d\n", __func__, aid); status_code = IEEE80211_STATUS_UNSPECIFIED; goto complete; } error = mlme_process_asresp_elements(ni, ie_data, ie_length); if (error) { IEEE80211_DPRINTF(vap, IEEE80211_MSG_MLME, "%s: mlme_process_asresp_elements failed\n", __func__); status_code = IEEE80211_STATUS_UNSPECIFIED; goto complete; } /* Association successful */ complete: switch (mlme_priv->im_request_type) { case MLME_REQ_ASSOC: IEEE80211_DPRINTF(vap, IEEE80211_MSG_MLME, "%s: mlme_assoc_complete status %d\n", __func__, status_code); if (subtype != IEEE80211_FC0_SUBTYPE_ASSOC_RESP) { IEEE80211_DPRINTF(vap, IEEE80211_MSG_ANY, "%s: mlme_assoc_complete status type mismatched %d\n", __func__, subtype); return; } break; case MLME_REQ_REASSOC: IEEE80211_DPRINTF(vap, IEEE80211_MSG_MLME, "%s: mlme_reassoc_complete status %d\n", __func__, status_code); if (subtype != IEEE80211_FC0_SUBTYPE_REASSOC_RESP) { IEEE80211_DPRINTF(vap, IEEE80211_MSG_ANY, "%s: mlme_assoc_complete status type mismatched %d\n", __func__, subtype); return; } break; default: IEEE80211_DPRINTF(vap, IEEE80211_MSG_ANY, "%s: mlme_reassoc_complete status %d unexpected request type %d\n", __func__, status_code, mlme_priv->im_request_type); return; } /* Request complete */ mlme_priv->im_request_type = MLME_REQ_NONE; if (status_code == IEEE80211_STATUS_SUCCESS) { ASSERT(aid != 0); ni->ni_associd = aid; ni->ni_assoctime = OS_GET_TICKS() - ni->ni_assocstarttime; #if ATH_SUPPORT_HTC ieee80211_update_node_target(ni, ni->ni_vap); #endif /* Association successful, put underlying H/W into ready state */ ieee80211_vap_start(vap); /*AUTELAN-Added-Begin:Deleted by duanmingzhe for RIFS+LDPC issue*/ //if (ni->ni_htcap & IEEE80211_HTCAP_C_ADVCODING) // ic->ic_enable_rifs_ldpcwar(ni, 0); //else // ic->ic_enable_rifs_ldpcwar(ni, 1); /*AUTELAN-Added-End:Deleted by duanmingzhe for RIFS+LDPC issue*/ } /* indicate linkspeed */ mlme_get_linkrate(ni, &rxlinkspeed, &txlinkspeed); IEEE80211_DELIVER_EVENT_LINK_SPEED(vap, rxlinkspeed, txlinkspeed); /* Association complete (success or failure) */ switch (mlme_request_type) { case MLME_REQ_ASSOC: IEEE80211_DELIVER_EVENT_MLME_ASSOC_COMPLETE(vap, status_code, aid, wbuf); break; case MLME_REQ_REASSOC: IEEE80211_DELIVER_EVENT_MLME_REASSOC_COMPLETE(vap, status_code, aid, wbuf); break; default: break; } }