extern extStaDb_StaInfo_t *macMgtStaDbInit(vmacApInfo_t *vmacSta_p,IEEEtypes_MacAddr_t *staMacAddr, IEEEtypes_MacAddr_t *apMacAddr) { MIB_802DOT11 *mib=vmacSta_p->Mib802dot11; extStaDb_StaInfo_t StaInfo; extStaDb_StaInfo_t *StaInfo_p = NULL; struct wlprivate *wlpptr = NETDEV_PRIV_P(struct wlprivate, vmacSta_p->dev); PeerInfo_t PeerInfo; #ifdef DEBUG_PRINT printf("macMgtStaDbInit:: entered\n"); #endif WLDBG_ENTER(DBG_LEVEL_11); /* Station not in Stn table, hence add */ memcpy(&StaInfo.Addr, staMacAddr, sizeof(IEEEtypes_MacAddr_t)); memcpy(&StaInfo.Bssid, apMacAddr, sizeof(IEEEtypes_MacAddr_t)); StaInfo.State = UNAUTHENTICATED; StaInfo.PwrMode = PWR_MODE_ACTIVE; StaInfo.StnId = AssignStnId(); StaInfo.Aid = 0; StaInfo.AP = FALSE; #ifdef WDS_FEATURE StaInfo.wdsInfo = NULL; StaInfo.wdsPortInfo = NULL; #endif #ifdef CLIENT_SUPPORT StaInfo.Client = FALSE; #endif #ifdef APCFGUR StaInfo.UR = 0; #endif #ifdef STA_INFO_DB StaInfo.Sq1 = 0; StaInfo.Sq2 = 0; StaInfo.RSSI= 0; StaInfo.Rate= 0; #endif StaInfo.ClientMode = 0; StaInfo.mib_p= mib; StaInfo.dev = vmacSta_p->dev; if(*(mib->mib_ApMode)==AP_MODE_AandG) { if(memcmp(apMacAddr,vmacSta_p->macBssId,sizeof(IEEEtypes_MacAddr_t))) { StaInfo.ApMode=MIXED_MODE; } else { StaInfo.ApMode=AONLY_MODE; } } #ifdef AP_URPTR if (!mib_wbMode) #endif { if (extStaDb_AddSta(vmacSta_p,&StaInfo) != ADD_SUCCESS) { return NULL; } #ifdef NEW_OSIF_POWERSAVE psProcessNewStn(staMacAddr, StaInfo.StnId); #else NotifyNewStn(staMacAddr, StaInfo.StnId); #endif if ((StaInfo_p = extStaDb_GetStaInfo(vmacSta_p,staMacAddr, 1)) == NULL) { return NULL; } setStaPeerInfoApMode(wlpptr, StaInfo_p, &PeerInfo, *(wlpptr->vmacSta_p->Mib802dot11->mib_ApMode), NULL); StaInfo_p->FwStaPtr = wlFwSetNewStn(vmacSta_p->dev, (u_int8_t *)staMacAddr, StaInfo_p->Aid, StaInfo_p->StnId, 0, &PeerInfo,0,0); //add new station wlFwSetSecurity(vmacSta_p->dev,( u_int8_t *)staMacAddr); /* Init the state machines */ /* Init Auth Request Srv SM */ AuthReqSrvApCtor((AuthReqSrvAp *)&StaInfo_p->mgtAuthReq); mhsm_initialize(&StaInfo_p->mgtAuthReq.super,&StaInfo_p->mgtAuthReq.sTop); /* Init Auth Response Srv SM */ AuthRspSrvApCtor((AuthRspSrvAp *)&StaInfo_p->mgtAuthRsp); mhsm_initialize(&StaInfo_p->mgtAuthRsp.super,&StaInfo_p->mgtAuthRsp.sTop); /* Init Association Srv SM */ AssocSrvApCtor((AssocSrvAp *)&StaInfo_p->mgtAssoc); mhsm_initialize(&StaInfo_p->mgtAssoc.super,&StaInfo_p->mgtAssoc.sTop); #ifdef APCFGUR /* Init remote control Srv SM */ RemoteCtrlSrvCtor(&StaInfo_p->rmSrv); mhsm_initialize(&StaInfo_p->rmSrv.super,&StaInfo_p->rmSrv.sTop); StaInfo_p->rmSrv.userdata_p = (unsigned char *)StaInfo_p; #endif } StaInfo_p->mgtAssoc.userdata_p = (unsigned char *)StaInfo_p; StaInfo_p->mgtAuthReq.userdata_p = (unsigned char *)StaInfo_p; StaInfo_p->mgtAuthRsp.userdata_p = (unsigned char *)StaInfo_p; WLDBG_EXIT(DBG_LEVEL_11); return StaInfo_p; }
void InitClientInfo(UINT8 *macAddr_p, dot11MgtFrame_t *MgmtMsg_p, vmacEntry_t *clientVMacEntry_p, BOOLEAN isApMrvl) { struct net_device *pStaDev = (struct net_device *) clientVMacEntry_p->privInfo_p; struct wlprivate *wlpptrSta = NETDEV_PRIV_P(struct wlprivate, pStaDev); vmacApInfo_t *vmacSta_p = wlpptrSta->vmacSta_p; MIB_802DOT11 *mib = vmacSta_p->Mib802dot11; extStaDb_StaInfo_t StaInfo; extStaDb_StaInfo_t *StaInfo_p = NULL; extStaDb_StaInfo_t StaInfoRmAp; extStaDb_StaInfo_t *StaInfoRmAp_p = NULL; #ifdef V6FW extStaDb_StaInfo_t StaInfoClient; extStaDb_StaInfo_t *StaInfoClient_p = NULL; #endif PeerInfo_t *pPeerInfo = NULL; //UINT32 Aid, StnId; UINT8 QosInfo = 0; UINT8 i = 0; STA_SECURITY_MIBS * pStaSecurityMibs = NULL; memset(&StaInfo, 0, sizeof(extStaDb_StaInfo_t)); if (!initParentAp) { parentApAid = AssignAid(); parentApStnId = AssignStnId(); initParentAp = 1; #ifdef V6FW ClientAid = AssignAid(); ClientStnId = AssignStnId(); #endif } memset(&StaInfoRmAp, 0, sizeof(extStaDb_StaInfo_t)); if ((StaInfoRmAp_p = extStaDb_GetStaInfo(wlpptrSta->vmacSta_p,(IEEEtypes_MacAddr_t *)macAddr_p, 1)) == NULL) { memcpy(&StaInfoRmAp.Addr, macAddr_p, sizeof(IEEEtypes_MacAddr_t)); StaInfoRmAp.StnId = parentApStnId; StaInfoRmAp.Aid = parentApAid; StaInfoRmAp.AP = FALSE; StaInfoRmAp.Client = TRUE; StaInfoRmAp.mib_p = wlpptrSta->vmacSta_p->Mib802dot11; StaInfoRmAp.dev = pStaDev; extStaDb_AddSta(wlpptrSta->vmacSta_p, &StaInfoRmAp); if ((StaInfoRmAp_p = extStaDb_GetStaInfo(wlpptrSta->vmacSta_p,(IEEEtypes_MacAddr_t *)macAddr_p, 1)) == NULL) { printk("InitClientInfo: ERROR - cannot add host Client Remote AP to station database. \n"); return; } } StaInfo_p = StaInfoRmAp_p; #ifdef V6FW memset(&StaInfoClient, 0, sizeof(extStaDb_StaInfo_t)); if ((StaInfoClient_p = extStaDb_GetStaInfo(wlpptrSta->vmacSta_p,(IEEEtypes_MacAddr_t *)MgmtMsg_p->Hdr.DestAddr, 1)) == NULL) { memcpy(&StaInfoClient.Addr, MgmtMsg_p->Hdr.DestAddr, sizeof(IEEEtypes_MacAddr_t)); StaInfoClient.StnId = ClientStnId; StaInfoClient.Aid = ClientAid; StaInfoClient.AP = FALSE; StaInfoClient.Client = TRUE; StaInfoClient.mib_p = wlpptrSta->vmacSta_p->Mib802dot11; StaInfoClient.dev = pStaDev; extStaDb_AddSta(wlpptrSta->vmacSta_p, &StaInfoClient); if ((StaInfoClient_p = extStaDb_GetStaInfo(wlpptrSta->vmacSta_p,(IEEEtypes_MacAddr_t *)MgmtMsg_p->Hdr.DestAddr, 1)) == NULL) { printk("InitClientInfo: ERROR - Cannot add Host Client MAC to station database. \n"); return; } } #endif // Set the Peer info. pPeerInfo = sme_GetClientPeerInfo(clientVMacEntry_p); memset(pPeerInfo, 0, sizeof(PeerInfo_t)); setClientPeerInfo(clientVMacEntry_p, MgmtMsg_p, pPeerInfo, StaInfo_p, &QosInfo, mib); #ifdef V6FW setClientPeerInfo(clientVMacEntry_p, MgmtMsg_p, pPeerInfo, StaInfoClient_p, &QosInfo, mib); #endif #ifdef AMPDU_SUPPORT free_any_pending_ampdu_pck(pStaDev,StaInfo_p->Aid); for(i=0;i<3;i++) /** Reset the ampdu reorder pck anyway **/ wlpptrSta->wlpd_p->AmpduPckReorder[StaInfo_p->Aid].AddBaReceive[i]=FALSE; /** clear Ba flag **/ #ifdef V6FW free_any_pending_ampdu_pck(pStaDev,StaInfoClient_p->Aid); for(i=0;i<3;i++) /** Reset the ampdu reorder pck anyway **/ wlpptrSta->wlpd_p->AmpduPckReorder[StaInfoClient_p->Aid].AddBaReceive[i]=FALSE; /** clear Ba flag **/ #endif if (*wlpptrSta->vmacSta_p->Mib802dot11->mib_AmpduTx) { memset(&StaInfo_p->aggr11n.startbytid[0], 0, 8); memset(&StaInfo_p->aggr11n.onbytid[0], 0, 8); StaInfo_p->aggr11n.type &= ~WL_WLAN_TYPE_AMPDU; #ifdef V6FW memset(&StaInfoClient_p->aggr11n.startbytid[0], 0, 8); memset(&StaInfoClient_p->aggr11n.onbytid[0], 0, 8); StaInfoClient_p->aggr11n.type &= ~WL_WLAN_TYPE_AMPDU; #endif AddHT_IE(vmacSta_p,&StaInfo_p->HtElem); } #endif if ((*(wlpptrSta->vmacSta_p->Mib802dot11->pMib_11nAggrMode)&WL_MODE_AMSDU_TX_MASK )== 0) { /* if AMSDU disabled locally then setup stainfo accordingly */ StaInfo_p->aggr11n.threshold = 0; StaInfo_p->aggr11n.cap = 0; #ifdef V6FW StaInfoClient_p->aggr11n.threshold = 0; StaInfoClient_p->aggr11n.cap = 0; #endif } else if (*(wlpptrSta->vmacSta_p->Mib802dot11->pMib_11nAggrMode)& WL_MODE_AMSDU_TX_4K) { /* if AMSDU set to 4k locally then setup stainfo as per this*/ StaInfo_p->aggr11n.cap = 1; if(!(*(wlpptrSta->vmacSta_p->Mib802dot11->pMib_11nAggrMode) & WL_MODE_AMPDU_TX)) { StaInfo_p->aggr11n.type |= WL_WLAN_TYPE_AMSDU; } #ifdef V6FW StaInfoClient_p->aggr11n.cap = 1; if(!(*(wlpptrSta->vmacSta_p->Mib802dot11->pMib_11nAggrMode) & WL_MODE_AMPDU_TX)) StaInfoClient_p->aggr11n.type |= WL_WLAN_TYPE_AMSDU; #endif } if (mib->Privacy->RSNEnabled && !mib->RSNConfigWPA2->WPA2OnlyEnabled) { pStaSecurityMibs = sme_GetStaSecurityMibsPtr(clientVMacEntry_p); if ((pStaSecurityMibs->thisStaRsnIE_p->ElemId == 221 || pStaSecurityMibs->thisStaRsnIE_p->ElemId == 48) &&(pStaSecurityMibs->thisStaRsnIE_p->PwsKeyCipherList[3] == 2)) { // TKIP disable non -Marvell AP aggregation if(!isApMrvl) { StaInfo_p->aggr11n.threshold = 0; StaInfo_p->aggr11n.thresholdBackUp = StaInfo_p->aggr11n.threshold; #ifdef V6FW StaInfoClient_p->aggr11n.threshold = 0; StaInfoClient_p->aggr11n.thresholdBackUp = StaInfo_p->aggr11n.threshold; #endif } } } if(!isApMrvl && mib->Privacy->PrivInvoked) { StaInfo_p->aggr11n.threshold = 0; StaInfo_p->aggr11n.thresholdBackUp = StaInfo_p->aggr11n.threshold; #ifdef V6FW StaInfoClient_p->aggr11n.threshold = 0; StaInfoClient_p->aggr11n.thresholdBackUp = StaInfo_p->aggr11n.threshold; #endif } /* First remove station even if not added to station database. */ /* Remove AP entry into FW STADB */ wlFwSetNewStn(wlpptrSta->master,(u_int8_t *)macAddr_p, parentApAid, parentApStnId, 2, pPeerInfo, QosInfo, StaInfo_p->IsStaQSTA); #ifdef V6FW wlFwSetNewStn(wlpptrSta->master,(u_int8_t *)MgmtMsg_p->Hdr.DestAddr, ClientAid, ClientStnId, 2, pPeerInfo, QosInfo, StaInfoClient_p->IsStaQSTA); #endif /* Add AP entry into FW STADB */ wlFwSetNewStn(wlpptrSta->master,(u_int8_t *)macAddr_p, parentApAid, parentApStnId, 0, pPeerInfo, QosInfo, StaInfo_p->IsStaQSTA); #ifdef V6FW wlFwSetNewStn(wlpptrSta->master,(u_int8_t *)MgmtMsg_p->Hdr.DestAddr, ClientAid, ClientStnId, 0, pPeerInfo, QosInfo, StaInfoClient_p->IsStaQSTA); #endif wlFwSetSecurity(pStaDev,macAddr_p); #ifdef V6FW wlFwSetSecurity(pStaDev,(u_int8_t *)MgmtMsg_p->Hdr.DestAddr); #endif return; }