int mwl_rx_init(struct ieee80211_hw *hw) { struct mwl_priv *priv; int rc; WLDBG_ENTER(DBG_LEVEL_4); BUG_ON(!hw); priv = hw->priv; BUG_ON(!priv); rc = mwl_rx_ring_alloc(priv); if (rc) { WLDBG_ERROR(DBG_LEVEL_4, "allocating RX ring failed"); } else { rc = mwl_rx_ring_init(priv); if (rc) { mwl_rx_ring_free(priv); WLDBG_ERROR(DBG_LEVEL_4, "initializing RX ring failed"); } } WLDBG_EXIT(DBG_LEVEL_4); return rc; }
/************************************************************************* * Function: * * Description: * * Input: * * Output: * **************************************************************************/ SINT8 evtDFSMsg(struct net_device *dev, UINT8 *message) { MhsmEvent_t dfsMsg; DfsCmd_t *dfsCmd_p; struct wlprivate *priv = NETDEV_PRIV_P(struct wlprivate, dev); struct wlprivate_data *wlpd_p = priv->wlpd_p ; WLDBG_ENTER(DBG_CLASS_INFO); if (message == NULL) { return 1; } if( !wlpd_p->pdfsApMain ) { return 1 ; } dfsCmd_p = (DfsCmd_t *)message; switch (dfsCmd_p->CmdType) { case DFS_CMD_CHANNEL_CHANGE : { DfsApMsg dfsApMsg ; WLDBG_INFO(DBG_LEVEL_15, "evtDFSMsg: DFS_CMD_CHANNEL_CHANGE message received. \n"); dfsApMsg.mgtMsg = (UINT8 *)(&(dfsCmd_p->Body.chInfo)); dfsMsg.event = CHANNEL_CHANGE_EVT; dfsMsg.pBody = (unsigned char *)&dfsApMsg ; mhsm_send_event(&wlpd_p->pdfsApMain->super, &dfsMsg); } break ; case DFS_CMD_RADAR_DETECTION: { DfsApMsg dfsApMsg ; WLDBG_INFO(DBG_LEVEL_15, "evtDFSMsg: DFS_CMD_RADAR_DETECTION message received. \n"); dfsApMsg.mgtMsg = (UINT8 *)(&(dfsCmd_p->Body.chInfo)); dfsMsg.event = RADAR_EVT; dfsMsg.pBody = (unsigned char *)&dfsApMsg ; mhsm_send_event(&wlpd_p->pdfsApMain->super, &dfsMsg); } break ; case DFS_CMD_WL_RESET: { DfsApMsg dfsApMsg ; WLDBG_INFO(DBG_LEVEL_15, "evtDFSMsg: DFS_CMD_WL_RESET message received. \n"); // dfsApMsg.mgtMsg = (UINT8 *)(&(dfsCmd_p->Body.chInfo)); dfsMsg.event = WL_RESET_EVT; dfsMsg.pBody = (unsigned char *)&dfsApMsg ; mhsm_send_event(&wlpd_p->pdfsApMain->super, &dfsMsg); } break ; default : return 1; } return 1; }
void mwl_rx_deinit(struct ieee80211_hw *hw) { struct mwl_priv *priv; WLDBG_ENTER(DBG_LEVEL_4); BUG_ON(!hw); priv = hw->priv; BUG_ON(!priv); mwl_rx_ring_cleanup(priv); mwl_rx_ring_free(priv); WLDBG_EXIT(DBG_LEVEL_4); }
void wlRxRingFree(struct net_device *netdev) { struct wlprivate *wlpptr = NETDEV_PRIV_P(struct wlprivate, netdev); WLDBG_ENTER(DBG_LEVEL_12); if (((struct wlprivate_data *)(wlpptr->wlpd_p))->descData[0].pRxRing != NULL) { wlRxRingCleanup(netdev); pci_free_consistent(wlpptr->pPciDev, MAX_NUM_RX_RING_BYTES, ((struct wlprivate_data *)(wlpptr->wlpd_p))->descData[0].pRxRing, ((struct wlprivate_data *)(wlpptr->wlpd_p))->descData[0].pPhysRxRing); ((struct wlprivate_data *)(wlpptr->wlpd_p))->descData[0].pRxRing = NULL; } ((struct wlprivate_data *)(wlpptr->wlpd_p))->descData[0].pNextRxDesc = NULL; WLDBG_EXIT(DBG_LEVEL_12); }
static int mwl_rx_refill(struct mwl_priv *priv, struct mwl_rx_desc *pdesc) { WLDBG_ENTER(DBG_LEVEL_4); BUG_ON(!priv); BUG_ON(!pdesc); pdesc->psk_buff = dev_alloc_skb(priv->desc_data[0].rx_buf_size); if (pdesc->psk_buff == NULL) goto nomem; if (skb_linearize(pdesc->psk_buff)) { dev_kfree_skb_any(pdesc->psk_buff); WLDBG_ERROR(DBG_LEVEL_4, "need linearize memory"); goto nomem; } skb_reserve(pdesc->psk_buff, SYSADPT_MIN_BYTES_HEADROOM); pdesc->status = EAGLE_RXD_STATUS_OK; pdesc->qos_ctrl = 0x0000; pdesc->channel = 0x00; pdesc->rssi = 0x00; pdesc->pkt_len = priv->desc_data[0].rx_buf_size; pdesc->pbuff_data = pdesc->psk_buff->data; pdesc->pphys_buff_data = ENDIAN_SWAP32(pci_map_single(priv->pdev, pdesc->psk_buff->data, priv->desc_data[0].rx_buf_size, PCI_DMA_BIDIRECTIONAL)); WLDBG_EXIT(DBG_LEVEL_4); return 0; nomem: WLDBG_EXIT_INFO(DBG_LEVEL_4, "no memory"); return -ENOMEM; }
void wlTxRingCleanup(struct net_device *netdev) { struct wlprivate *wlpptr = NETDEV_PRIV_P(struct wlprivate, netdev); int cleanedTxDescr = 0; int currDescr; int num; WLDBG_ENTER(DBG_LEVEL_12); for(num =0; num < NUM_OF_DESCRIPTOR_DATA; num++) { QUEUE_PURGE(&((struct wlprivate_data *)(wlpptr->wlpd_p))->txQ[num]); ((struct wlprivate_data *)(wlpptr->wlpd_p))->fwDescCnt[num] =0; if (((struct wlprivate_data *)(wlpptr->wlpd_p))->descData[num].pTxRing != NULL) { for (currDescr = 0; currDescr < MAX_NUM_TX_DESC; currDescr++) { if (CURR_TXD(num).pSkBuff != NULL) { WLDBG_INFO(DBG_LEVEL_12, "unmapped and free'd txdesc %i vaddr: 0x%p paddr: 0x%x", currDescr, CURR_TXD(num).pSkBuff->data, ENDIAN_SWAP32(CURR_TXD(num).PktPtr)); pci_unmap_single(wlpptr->pPciDev, ENDIAN_SWAP32(CURR_TXD(num).PktPtr), CURR_TXD(num).pSkBuff->len, PCI_DMA_TODEVICE); { WL_SKB_FREE(CURR_TXD(num).pSkBuff); } CURR_TXD(num).Status = ENDIAN_SWAP32(EAGLE_TXD_STATUS_IDLE); CURR_TXD(num).pSkBuff = NULL; CURR_TXD(num).PktPtr = 0; CURR_TXD(num).PktLen = 0; cleanedTxDescr++; } } } } WLDBG_EXIT_INFO(DBG_LEVEL_12, "cleaned %i TX descr", cleanedTxDescr); }
static void mwl_rx_ring_free(struct mwl_priv *priv) { WLDBG_ENTER(DBG_LEVEL_4); BUG_ON(!priv); if (priv->desc_data[0].prx_ring != NULL) { mwl_rx_ring_cleanup(priv); dma_free_coherent(&priv->pdev->dev, MAX_NUM_RX_RING_BYTES, priv->desc_data[0].prx_ring, priv->desc_data[0].pphys_rx_ring); priv->desc_data[0].prx_ring = NULL; } priv->desc_data[0].pnext_rx_desc = NULL; WLDBG_EXIT(DBG_LEVEL_4); }
void wlTxRingFree(struct net_device *netdev) { struct wlprivate *wlpptr = NETDEV_PRIV_P(struct wlprivate, netdev); int num; WLDBG_ENTER(DBG_LEVEL_12); if (((struct wlprivate_data *)(wlpptr->wlpd_p))->descData[0].pTxRing != NULL) pci_free_consistent(wlpptr->pPciDev, MAX_NUM_TX_RING_BYTES*NUM_OF_DESCRIPTOR_DATA, ((struct wlprivate_data *)(wlpptr->wlpd_p))->descData[0].pTxRing, ((struct wlprivate_data *)(wlpptr->wlpd_p))->descData[0].pPhysTxRing); for(num =0; num < NUM_OF_DESCRIPTOR_DATA; num++) { if (((struct wlprivate_data *)(wlpptr->wlpd_p))->descData[num].pTxRing != NULL) { ((struct wlprivate_data *)(wlpptr->wlpd_p))->descData[num].pTxRing = NULL; } ((struct wlprivate_data *)(wlpptr->wlpd_p))->descData[num].pStaleTxDesc = NULL; ((struct wlprivate_data *)(wlpptr->wlpd_p))->descData[num].pNextTxDesc = NULL; } WLDBG_EXIT(DBG_LEVEL_12); }
void wlRxRingCleanup(struct net_device *netdev) { struct wlprivate *wlpptr = NETDEV_PRIV_P(struct wlprivate, netdev); int currDescr; WLDBG_ENTER(DBG_LEVEL_12); if (((struct wlprivate_data *)(wlpptr->wlpd_p))->descData[0].pRxRing != NULL) { for (currDescr = 0; currDescr < MAX_NUM_RX_DESC; currDescr++) { if (CURR_RXD.pSkBuff != NULL) { if (skb_shinfo(CURR_RXD.pSkBuff)->nr_frags) { skb_shinfo(CURR_RXD.pSkBuff)->nr_frags = 0; } if (skb_shinfo(CURR_RXD.pSkBuff)->frag_list) { skb_shinfo(CURR_RXD.pSkBuff)->frag_list = NULL; } pci_unmap_single(wlpptr->pPciDev, ENDIAN_SWAP32(CURR_RXD.pPhysBuffData), ((struct wlprivate_data *)(wlpptr->wlpd_p))->descData[0].rxBufSize, PCI_DMA_FROMDEVICE); WL_SKB_FREE(CURR_RXD.pSkBuff); WLDBG_INFO(DBG_LEVEL_12, "unmapped+free'd rxdesc %i vaddr: 0x%p paddr: 0x%x len: %i", currDescr, CURR_RXD.pBuffData, ENDIAN_SWAP32(CURR_RXD.pPhysBuffData), ((struct wlprivate_data *)(wlpptr->wlpd_p))->descData[0].rxBufSize); CURR_RXD.pBuffData = NULL; CURR_RXD.pSkBuff = NULL; } } } WLDBG_EXIT(DBG_LEVEL_12); }
static void mwl_rx_ring_cleanup(struct mwl_priv *priv) { int curr_desc; WLDBG_ENTER(DBG_LEVEL_4); BUG_ON(!priv); if (priv->desc_data[0].prx_ring != NULL) { for (curr_desc = 0; curr_desc < SYSADPT_MAX_NUM_RX_DESC; curr_desc++) { if (CURR_RXD.psk_buff != NULL) { if (skb_shinfo(CURR_RXD.psk_buff)->nr_frags) skb_shinfo(CURR_RXD.psk_buff)->nr_frags = 0; if (skb_shinfo(CURR_RXD.psk_buff)->frag_list) skb_shinfo(CURR_RXD.psk_buff)->frag_list = NULL; pci_unmap_single(priv->pdev, ENDIAN_SWAP32(CURR_RXD.pphys_buff_data), priv->desc_data[0].rx_buf_size, PCI_DMA_FROMDEVICE); dev_kfree_skb_any(CURR_RXD.psk_buff); WLDBG_INFO(DBG_LEVEL_4, "unmapped+free'd rxdesc %i vaddr: 0x%p paddr: 0x%x len: %i", curr_desc, CURR_RXD.pbuff_data, ENDIAN_SWAP32(CURR_RXD.pphys_buff_data), priv->desc_data[0].rx_buf_size); CURR_RXD.pbuff_data = NULL; CURR_RXD.psk_buff = NULL; } } } WLDBG_EXIT(DBG_LEVEL_4); }
extern SINT8 evtDot11MgtMsg(vmacApInfo_t *vmacSta_p,UINT8 *message, struct sk_buff *skb) #endif { MIB_AUTH_ALG *mib_AuthAlg_p=vmacSta_p->Mib802dot11->AuthAlg; MhsmEvent_t smMsg; macmgmtQ_MgmtMsg3_t *MgmtMsg_p; extStaDb_StaInfo_t *StaInfo_p; if (message == NULL) { return 1; } WLDBG_ENTER(DBG_LEVEL_11); MgmtMsg_p = (macmgmtQ_MgmtMsg3_t *)message; #ifdef FILTER_BSSID if ( ( memcmp(MgmtMsg_p->Hdr.DestAddr, vmacSta_p->macStaAddr,sizeof(IEEEtypes_MacAddr_t)) || memcmp(MgmtMsg_p->Hdr.BssId, vmacSta_p->macBssId,sizeof(IEEEtypes_MacAddr_t)) ) && ( MgmtMsg_p->Hdr.FrmCtl.Subtype != IEEE_MSG_PROBE_RQST ) ) #else if (memcmp(MgmtMsg_p->Hdr.DestAddr, vmacSta_p->macStaAddr,sizeof(IEEEtypes_MacAddr_t)) && memcmp(MgmtMsg_p->Hdr.DestAddr, vmacSta_p->macStaAddr2,sizeof(IEEEtypes_MacAddr_t)) && (MgmtMsg_p->Hdr.FrmCtl.Subtype != IEEE_MSG_PROBE_RQST) ) #endif { WLDBG_ENTER_INFO(DBG_LEVEL_11,"mgt frame %d rxved %2x-%2x-%2x-%2x-%2x-%2x\n",MgmtMsg_p->Hdr.FrmCtl.Subtype, MgmtMsg_p->Hdr.DestAddr[0], MgmtMsg_p->Hdr.DestAddr[1], MgmtMsg_p->Hdr.DestAddr[2], MgmtMsg_p->Hdr.DestAddr[3], MgmtMsg_p->Hdr.DestAddr[4], MgmtMsg_p->Hdr.DestAddr[5]); return 1; } if (isMacAccessList(vmacSta_p, &(MgmtMsg_p->Hdr.SrcAddr)) != SUCCESS) { return 1; } if ((StaInfo_p = extStaDb_GetStaInfo(vmacSta_p,&MgmtMsg_p->Hdr.SrcAddr, 0)) == NULL) { if(MgmtMsg_p->Hdr.FrmCtl.Subtype == IEEE_MSG_AUTHENTICATE) { //added call to check other VAP's StaInfo_p if ((StaInfo_p = extStaDb_GetStaInfo(vmacSta_p,&MgmtMsg_p->Hdr.SrcAddr, 2))) { macMgmtRemoveSta(vmacSta_p, StaInfo_p); } if ((StaInfo_p = macMgtStaDbInit(vmacSta_p,&MgmtMsg_p->Hdr.SrcAddr,&MgmtMsg_p->Hdr.DestAddr)) == NULL) { WLDBG_ENTER_INFO(DBG_LEVEL_11,"init data base fail\n"); return 1; } } else if ((MgmtMsg_p->Hdr.FrmCtl.Subtype != IEEE_MSG_PROBE_RQST)) { if ((MgmtMsg_p->Hdr.FrmCtl.Subtype != IEEE_MSG_DEAUTHENTICATE) && (MgmtMsg_p->Hdr.FrmCtl.Subtype != IEEE_MSG_PROBE_RSP) ) { macMgmtMlme_SendDeauthenticateMsg(vmacSta_p,&MgmtMsg_p->Hdr.SrcAddr, 0, IEEEtypes_REASON_CLASS2_NONAUTH); } return 1; } } #ifdef AP_MAC_LINUX smMsg.devinfo = (void *) vmacSta_p; #endif switch (MgmtMsg_p->Hdr.FrmCtl.Subtype) { case IEEE_MSG_AUTHENTICATE: { AuthRspSrvApMsg authRspMsg; WLDBG_INFO(DBG_LEVEL_11, "IEEE_MSG_AUTHENTICATE message received. \n"); memcpy(authRspMsg.rspMac, MgmtMsg_p->Hdr.SrcAddr, 6); authRspMsg.arAlg_in = MgmtMsg_p->Body.Auth.AuthAlg; { if (mib_AuthAlg_p->Type == AUTH_OPEN_OR_SHARED_KEY) { authRspMsg.arAlg = authRspMsg.arAlg_in; } else { authRspMsg.arAlg = mib_AuthAlg_p->Type; } } authRspMsg.mgtMsg = (UINT8 *)MgmtMsg_p; smMsg.event = AuthOdd; smMsg.pBody = (unsigned char *)&authRspMsg; #ifdef AP_MAC_LINUX smMsg.info = (void *) skb; #endif mhsm_send_event((Mhsm_t *)&StaInfo_p->mgtAuthRsp.super, &smMsg); } break; case IEEE_MSG_ASSOCIATE_RQST: { WLDBG_INFO(DBG_LEVEL_11, "IEEE_MSG_ASSOCIATE_RQST message received. \n"); smMsg.event = AssocReq; smMsg.pBody = (unsigned char *)MgmtMsg_p; #ifdef AP_MAC_LINUX smMsg.info = (void *) skb; #endif mhsm_send_event((Mhsm_t *)&StaInfo_p->mgtAssoc.super,&smMsg); } break; case IEEE_MSG_REASSOCIATE_RQST: { WLDBG_INFO(DBG_LEVEL_11, "IEEE_MSG_REASSOCIATE_RQST message received. \n"); smMsg.event = ReAssocReq; smMsg.pBody = (unsigned char *)MgmtMsg_p; #ifdef AP_MAC_LINUX smMsg.info = (void *) skb; #endif mhsm_send_event((Mhsm_t *)&StaInfo_p->mgtAssoc.super, &smMsg); } break; case IEEE_MSG_DISASSOCIATE: { WLDBG_INFO(DBG_LEVEL_11, "IEEE_MSG_DISASSOCIATE message received. \n"); smMsg.event = DisAssoc; smMsg.pBody = (unsigned char *)MgmtMsg_p; #ifdef AP_MAC_LINUX smMsg.info = (void *) skb; #endif mhsm_send_event((Mhsm_t *)&StaInfo_p->mgtAssoc.super, &smMsg); } break; case IEEE_MSG_DEAUTHENTICATE: { WLDBG_INFO(DBG_LEVEL_11, "IEEE_MSG_DEAUTHENTICATE message received. \n"); smMsg.event = DeAuth; smMsg.pBody = (unsigned char *)MgmtMsg_p; #ifdef AP_MAC_LINUX smMsg.info = (void *) skb; #endif mhsm_send_event((Mhsm_t *)&StaInfo_p->mgtAuthRsp.super, &smMsg); } break; /* Could be handled by HW */ case IEEE_MSG_PROBE_RQST: { SyncSrvApMsg syncMsg; WLDBG_INFO(DBG_LEVEL_11, "IEEE_MSG_PROBE_RQST message received. \n"); syncMsg.opMode = infrastructure; syncMsg.mgtMsg = (UINT8 *)MgmtMsg_p; smMsg.event = ProbeReq; smMsg.pBody = (unsigned char *)&syncMsg; #ifdef AP_MAC_LINUX smMsg.info = (void *) skb; #endif mhsm_send_event((Mhsm_t *)&vmacSta_p->mgtSync.super, &smMsg); } break; #if defined(QOS_FEATURE)||defined(IEEE80211H) case IEEE_MSG_QOS_ACTION: { WLDBG_INFO(DBG_LEVEL_11, "IEEE_MSG_QOS_ACTION message received. \n"); if(MgmtMsg_p->Body.Action.Category == HT_CATEGORY) { switch (MgmtMsg_p->Body.Action.Action) { case ACTION_SMPS: { extern int wlFwSetMimoPsHt(struct net_device *netdev, UINT8 *addr, UINT8 enable, UINT8 mode); IEEEtypes_SM_PwrCtl_t *p = (IEEEtypes_SM_PwrCtl_t *)&MgmtMsg_p->Body.Act.Field.SmPwrCtl; WLDBG_INFO(DBG_LEVEL_11, "IEEE_MSG_QOS_ACTION MIMO PS HT message received. \n"); wlFwSetMimoPsHt(vmacSta_p->dev, (UINT8 *)MgmtMsg_p->Hdr.SrcAddr, p->Enable, p->Mode); break; } #ifdef INTOLERANT40 case ACTION_INFOEXCH: { extern void RecHTIntolerant(vmacApInfo_t *vmacSta_p,UINT8 enable); IEEEtypes_InfoExch_t *p = (IEEEtypes_InfoExch_t *)&MgmtMsg_p->Body.Act.Field.InfoExch; WLDBG_INFO(DBG_LEVEL_11, "IEEE_MSG_QOS_ACTION Info Exch HT message received. \n"); RecHTIntolerant(vmacSta_p,p->FortyMIntolerant); break; } #endif //#ifdef INTOLERANT40 default: break; } break; } #ifdef IEEE80211H if(TRUE == macMgmtMlme_80211hAct(vmacSta_p,(macmgmtQ_MgmtMsg3_t *) MgmtMsg_p)) /* if it's mine frame, then return true */ break; #endif /* IEEE80211H */ #ifdef COEXIST_20_40_SUPPORT if(TRUE == macMgmtMlme_80211PublicAction(vmacSta_p,(macmgmtQ_MgmtMsg3_t *) MgmtMsg_p)) /* if it's mine frame, then return true */ break; #endif #ifdef QOS_FEATURE /*smMsg.event = QoSAction; smMsg.pBody = MgmtMsg_p; mhsm_send_event((Mhsm_t *)&wlpptr->vmacSta_p->mgtSync.super, &smMsg);*/ macMgmtMlme_QoSAct(vmacSta_p,(macmgmtQ_MgmtMsg3_t *) MgmtMsg_p); break; #endif /* QOS_FEATURE */ } #endif default: break; } WLDBG_EXIT(DBG_LEVEL_11); return 0; }
void wlRecv(struct net_device *netdev) { struct wlprivate *wlpptr = NETDEV_PRIV_P(struct wlprivate, netdev); int work_done = 0; wlrxdesc_t *pCurrent = ((struct wlprivate_data *)(wlpptr->wlpd_p))->descData[0].pNextRxDesc; static Bool_e isFunctionBusy = WL_FALSE; int receivedHandled = 0; u_int32_t rxRdPtr; u_int32_t rxWrPtr; struct sk_buff *pRxSkBuff=NULL; WL_BUFF *wlb = NULL; void *pCurrentData; u_int8_t rxRate; int rxCount; int rssi; vmacApInfo_t *vmacSta_p = wlpptr->vmacSta_p; u_int32_t status; u_int32_t rssi_paths; WLDBG_ENTER(DBG_LEVEL_14); /* In a corner case the descriptors may be uninitialized and not usable, accessing these may cause a crash */ if (isFunctionBusy || (pCurrent == NULL)) { return; } isFunctionBusy = WL_TRUE; rxRdPtr = readl(wlpptr->ioBase0 + ((struct wlprivate_data *)(wlpptr->wlpd_p))->descData[0].rxDescRead); rxWrPtr = readl(wlpptr->ioBase0 + ((struct wlprivate_data *)(wlpptr->wlpd_p))->descData[0].rxDescWrite); while ((pCurrent->RxControl ==EAGLE_RXD_CTRL_DMA_OWN) && (work_done < vmacSta_p->work_to_do) ) { /* AUTOCHANNEL */ { if(vmacSta_p->StopTraffic) goto out; } /* AUTOCHANNEL */ rxCount = ENDIAN_SWAP16(pCurrent->PktLen); pRxSkBuff = pCurrent->pSkBuff; if (pRxSkBuff == NULL) { goto out; } pci_unmap_single(wlpptr->pPciDev, ENDIAN_SWAP32(pCurrent->pPhysBuffData), ((struct wlprivate_data *)(wlpptr->wlpd_p))->descData[0].rxBufSize, PCI_DMA_FROMDEVICE); pCurrentData = pCurrent->pBuffData; rxRate = pCurrent->Rate; status = (u_int32_t)pCurrent->Status; pRxSkBuff->protocol = 0; if(pCurrent->QosCtrl & IEEE_QOS_CTL_AMSDU) { pRxSkBuff->protocol |= WL_WLAN_TYPE_AMSDU; } rssi = (int)pCurrent->RSSI + W836X_RSSI_OFFSET; rssi_paths = *((u_int32_t *)&pCurrent->HwRssiInfo); if (skb_tailroom(pRxSkBuff) >= rxCount) { skb_put(pRxSkBuff, rxCount ); skb_pull(pRxSkBuff, 2); } else { WLDBG_INFO(DBG_LEVEL_14,"Not enough tail room =%x recvlen=%x, pCurrent=%x, pCurrentData=%x", WL_BUFF_TAILROOM(pRxSkBuff), rxCount,pCurrent, pCurrentData); WL_SKB_FREE(pRxSkBuff); goto out; } wlpptr->netDevStats->rx_packets++; wlb = WL_BUFF_PTR(pRxSkBuff); WL_PREPARE_BUF_INFO(pRxSkBuff); if(pCurrent->HtSig2 & 0x8 ) { u_int8_t ampdu_qos; /** use bit 3 for ampdu flag, and 0,1,2,3 for qos so as to save a register **/ ampdu_qos = 8|(pCurrent->QosCtrl&0x7); work_done+=ieee80211_input(wlpptr, wlb,rssi,rssi_paths,ampdu_qos,status); } else { u_int8_t ampdu_qos; /** use bit 3 for ampdu flag, and 0,1,2,3 for qos so as to save a register **/ ampdu_qos = 0|(pCurrent->QosCtrl&0x7); work_done+=ieee80211_input(wlpptr, wlb,rssi,rssi_paths,ampdu_qos,status); } wlpptr->netDevStats->rx_bytes += pRxSkBuff->len; { pCurrent->pSkBuff = dev_alloc_skb(((struct wlprivate_data *)(wlpptr->wlpd_p))->descData[0].rxBufSize); if (pCurrent->pSkBuff != NULL) { if(skb_linearize(pCurrent->pSkBuff)) { WL_SKB_FREE(pCurrent->pSkBuff); printk(KERN_ERR "%s: Need linearize memory\n", netdev->name); goto out; } skb_reserve(pCurrent->pSkBuff , MIN_BYTES_HEADROOM); pCurrent->Status = EAGLE_RXD_STATUS_OK; pCurrent->QosCtrl = 0x0000; pCurrent->Channel = 0x00; pCurrent->RSSI = 0x00; pCurrent->SQ2 = 0x00; pCurrent->PktLen = 6*netdev->mtu + NUM_EXTRA_RX_BYTES; pCurrent->pBuffData = pCurrent->pSkBuff->data; pCurrent->pPhysBuffData = ENDIAN_SWAP32(pci_map_single(wlpptr->pPciDev, pCurrent->pSkBuff->data, ((struct wlprivate_data *)(wlpptr->wlpd_p))->descData[0].rxBufSize/*+sizeof(struct skb_shared_info)*/, PCI_DMA_BIDIRECTIONAL)); } } out: receivedHandled++; pCurrent->RxControl = EAGLE_RXD_CTRL_DRIVER_OWN; pCurrent->QosCtrl =0; rxRdPtr = ENDIAN_SWAP32(pCurrent->pPhysNext); pCurrent = pCurrent->pNext; } writel(rxRdPtr, wlpptr->ioBase0 + ((struct wlprivate_data *)(wlpptr->wlpd_p))->descData[0].rxDescRead); ((struct wlprivate_data *)(wlpptr->wlpd_p))->descData[0].pNextRxDesc = pCurrent; isFunctionBusy = WL_FALSE; WLDBG_EXIT(DBG_LEVEL_14); }
/** public functions **/ int wlFwDownload(struct net_device *netdev) { struct wlprivate *wlpptr = NETDEV_PRIV_P(struct wlprivate, netdev); unsigned char *pFwImage = wlpptr->FwPointer;//&fmimage[0]; unsigned int currIteration = FW_MAX_NUM_CHECKS; //unsigned short firmwareBlockSize = FW_DOWNLOAD_BLOCK_SIZE; unsigned int FwReadySignature = FW_LOAD_STA_FWRDY_SIGNATURE; unsigned int OpMode = HostCmd_STA_MODE; unsigned int downloadSuccessful = 1; unsigned int sizeFwDownloaded = 0; //unsigned int remainingFwBytes = 0; unsigned int intCode; //unsigned int sizeSend = 0; //unsigned int sizeGood = 0; //unsigned int i, sizeBlock; //unsigned char useHelp = 0; //unsigned long dummy; unsigned long len; //unsigned short expectfield=0; //unsigned long loopcnt=0; WLDBG_ENTER(DBG_LEVEL_3); #ifdef NO_FW_DOWNLOAD printk("AP8X: This version does not support host fwdl!!!\n"); return SUCCESS; #endif wlFwReset(netdev); //FW before jumping to boot rom, it will enable PCIe transaction retry, wait for boot code to stop it. WL_MSEC_SLEEP(FW_CHECK_MSECS); writel(MACREG_A2HRIC_BIT_MASK, wlpptr->ioBase1 + MACREG_REG_A2H_INTERRUPT_CLEAR_SEL); writel(0x00,wlpptr->ioBase1+MACREG_REG_A2H_INTERRUPT_CAUSE); writel(0x00,wlpptr->ioBase1+MACREG_REG_A2H_INTERRUPT_MASK); writel(MACREG_A2HRIC_BIT_MASK, wlpptr->ioBase1 + MACREG_REG_A2H_INTERRUPT_STATUS_MASK); /** SC3 MFG FW no longer use this signature if (wlpptr->mfgEnable) { FwReadySignature = FW_LOAD_STA_FWRDY_SIGNATURE; OpMode = HostCmd_STA_MODE; printk("client mode\n"); } else */ { FwReadySignature = FW_LOAD_SOFTAP_FWRDY_SIGNATURE; OpMode = HostCmd_SOFTAP_MODE; } /* this routine interacts with SC2 bootrom to download firmware binary to the device. After DMA'd to SC2, the firmware could be deflated to reside on its respective blocks such as ITCM, DTCM, SQRAM, (or even DDR, AFTER DDR is init'd before fw download */ sizeFwDownloaded = 0; printk("fw download start 88\n"); /* Disable PFU before FWDL */ writel(0x100,wlpptr->ioBase1+0xE0E4); /* make sure SCRATCH2 C40 is clear, in case we are too quick */ while (readl(wlpptr->ioBase1 + 0xc40) == 0); while (sizeFwDownloaded < wlpptr->FwSize) { len = readl(wlpptr->ioBase1 + 0xc40); if(!len) break; /* this copies the next chunk of fw binary to be delivered */ memcpy((char *)&wlpptr->pCmdBuf[0],(pFwImage+sizeFwDownloaded),len); currIteration = FW_MAX_NUM_CHECKS; /* this is arbitrary per your platform; we use 0xffff */ /* this function writes pdata to c10, then write 2 to c18 */ wltriggerPciCmd_bootcode(netdev); /* NOTE: the following back to back checks on C1C is time sensitive, hence may need to be tweaked dependent on host processor. Time for SC2 to go from the write of event 2 to C1C == 2 is ~1300 nSec. Hence the checkings on host has to consider how efficient your code can be to meet this timing, or you can alternatively tweak this routines to fit your platform */ do { intCode = readl(wlpptr->ioBase1 + 0xc1c); if(intCode!=0) break; currIteration--; }while (currIteration); do { intCode = readl(wlpptr->ioBase1 + 0xc1c); if((intCode & MACREG_H2ARIC_BIT_DOOR_BELL) != MACREG_H2ARIC_BIT_DOOR_BELL) break; currIteration--; }while (currIteration); if (currIteration == 0) { /* This limited loop check allows you to exit gracefully without locking up your entire system just because fw download failed */ printk("Exhausted currIteration during fw download\n"); downloadSuccessful = 0; wlFwReset(netdev); return FAIL; } sizeFwDownloaded += len; } printk("FwSize = %d downloaded Size = %d currIteration %d\n", (int) wlpptr->FwSize, sizeFwDownloaded, currIteration); if (downloadSuccessful) { /* Now firware is downloaded successfully, so this part is to check whether fw can properly execute to an extent that write back signature to indicate its readiness to the host. NOTE: if your downloaded fw crashes, this signature checking will fail. This part is similar as SC1 */ writew(0x00, &wlpptr->pCmdBuf[1]); wltriggerPciCmd(netdev); currIteration = FW_MAX_NUM_CHECKS; do { currIteration--; writel(OpMode, wlpptr->ioBase1 + MACREG_REG_GEN_PTR); WL_MSEC_SLEEP(FW_CHECK_MSECS); intCode = readl(wlpptr->ioBase1 + MACREG_REG_INT_CODE); if (!(currIteration%0xff)) printk("%x;", intCode); } while ((currIteration) && (intCode != FwReadySignature)); if (currIteration == 0) { printk("Exhausted currIteration waiting for fw signature; firmware seems failed to operate\n"); downloadSuccessful = 0; wlFwReset(netdev); return TIMEOUT; } } printk("wlFwDownload complete\n"); writel(0x00, wlpptr->ioBase1 + MACREG_REG_INT_CODE); WLDBG_EXIT(DBG_LEVEL_3); return SUCCESS; }
static inline void mwl_rx_prepare_status(struct mwl_rx_desc *pdesc, struct ieee80211_rx_status *status) { WLDBG_ENTER(DBG_LEVEL_4); BUG_ON(!pdesc); BUG_ON(!status); memset(status, 0, sizeof(*status)); status->signal = -(pdesc->rssi + W836X_RSSI_OFFSET); switch (pdesc->rate.format) { case RX_RATE_INFO_FORMAT_11N: status->flag |= RX_FLAG_HT; if (pdesc->rate.bw == RX_RATE_INFO_HT40) status->flag |= RX_FLAG_40MHZ; if (pdesc->rate.gi == RX_RATE_INFO_SHORT_INTERVAL) status->flag |= RX_FLAG_SHORT_GI; break; case RX_RATE_INFO_FORMAT_11AC: status->flag |= RX_FLAG_VHT; if (pdesc->rate.bw == RX_RATE_INFO_HT40) status->flag |= RX_FLAG_40MHZ; if (pdesc->rate.bw == RX_RATE_INFO_HT80) status->vht_flag |= RX_VHT_FLAG_80MHZ; if (pdesc->rate.gi == RX_RATE_INFO_SHORT_INTERVAL) status->flag |= RX_FLAG_SHORT_GI; status->vht_nss = (pdesc->rate.nss + 1); break; } status->rate_idx = pdesc->rate.rt; if (pdesc->channel > BAND_24_CHANNEL_NUM) { status->band = IEEE80211_BAND_5GHZ; if ((!(status->flag & RX_FLAG_HT)) && (!(status->flag & RX_FLAG_VHT))) { status->rate_idx -= 5; if (status->rate_idx >= BAND_50_RATE_NUM) status->rate_idx = BAND_50_RATE_NUM - 1; } } else { status->band = IEEE80211_BAND_2GHZ; if ((!(status->flag & RX_FLAG_HT)) && (!(status->flag & RX_FLAG_VHT))) { if (status->rate_idx >= BAND_24_RATE_NUM) status->rate_idx = BAND_24_RATE_NUM - 1; } } status->freq = ieee80211_channel_to_frequency(pdesc->channel, status->band); /* check if status has a specific error bit (bit 7)set or indicates a general decrypt error */ if ((pdesc->status == GENERAL_DECRYPT_ERR) || (pdesc->status & DECRYPT_ERR_MASK)) { /* check if status is not equal to 0xFF * the 0xFF check is for backward compatibility */ if (pdesc->status != GENERAL_DECRYPT_ERR) { if (((pdesc->status & (~DECRYPT_ERR_MASK)) & TKIP_DECRYPT_MIC_ERR) && !((pdesc->status & (WEP_DECRYPT_ICV_ERR | TKIP_DECRYPT_ICV_ERR)))) { status->flag |= RX_FLAG_MMIC_ERROR; } } } WLDBG_EXIT(DBG_LEVEL_4); }
void mwl_rx_recv(unsigned long data) { struct ieee80211_hw *hw = (struct ieee80211_hw *)data; struct mwl_priv *priv; struct mwl_rx_desc *curr_desc; int work_done = 0; struct sk_buff *prx_skb = NULL; int pkt_len; struct ieee80211_rx_status status; struct mwl_vif *mwl_vif = NULL; struct ieee80211_hdr *wh; u32 status_mask; WLDBG_ENTER(DBG_LEVEL_4); BUG_ON(!hw); priv = hw->priv; BUG_ON(!priv); curr_desc = priv->desc_data[0].pnext_rx_desc; if (curr_desc == NULL) { status_mask = readl(priv->iobase1 + MACREG_REG_A2H_INTERRUPT_STATUS_MASK); writel(status_mask | MACREG_A2HRIC_BIT_RX_RDY, priv->iobase1 + MACREG_REG_A2H_INTERRUPT_STATUS_MASK); priv->is_rx_schedule = false; WLDBG_EXIT_INFO(DBG_LEVEL_4, "busy or no receiving packets"); return; } while ((curr_desc->rx_control == EAGLE_RXD_CTRL_DMA_OWN) && (work_done < priv->recv_limit)) { prx_skb = curr_desc->psk_buff; if (prx_skb == NULL) goto out; pci_unmap_single(priv->pdev, ENDIAN_SWAP32(curr_desc->pphys_buff_data), priv->desc_data[0].rx_buf_size, PCI_DMA_FROMDEVICE); pkt_len = curr_desc->pkt_len; if (skb_tailroom(prx_skb) < pkt_len) { WLDBG_PRINT("Critical error: not enough tail room =%x pkt_len=%x, curr_desc=%x, curr_desc_data=%x", skb_tailroom(prx_skb), pkt_len, curr_desc, curr_desc->pbuff_data); dev_kfree_skb_any(prx_skb); goto out; } if (curr_desc->channel != hw->conf.chandef.chan->hw_value) { dev_kfree_skb_any(prx_skb); goto out; } mwl_rx_prepare_status(curr_desc, &status); priv->noise = -curr_desc->noise_floor; wh = &((struct mwl_dma_data *)prx_skb->data)->wh; if (ieee80211_has_protected(wh->frame_control)) { /* Check if hw crypto has been enabled for * this bss. If yes, set the status flags * accordingly */ if (ieee80211_has_tods(wh->frame_control)) mwl_vif = mwl_rx_find_vif_bss(&priv->vif_list, wh->addr1); else mwl_vif = mwl_rx_find_vif_bss(&priv->vif_list, wh->addr2); if (mwl_vif != NULL && mwl_vif->is_hw_crypto_enabled) { /* * When MMIC ERROR is encountered * by the firmware, payload is * dropped and only 32 bytes of * mwl8k Firmware header is sent * to the host. * * We need to add four bytes of * key information. In it * MAC80211 expects keyidx set to * 0 for triggering Counter * Measure of MMIC failure. */ if (status.flag & RX_FLAG_MMIC_ERROR) { struct mwl_dma_data *tr; tr = (struct mwl_dma_data *)prx_skb->data; memset((void *)&(tr->data), 0, 4); pkt_len += 4; } if (!ieee80211_is_auth(wh->frame_control)) status.flag |= RX_FLAG_IV_STRIPPED | RX_FLAG_DECRYPTED | RX_FLAG_MMIC_STRIPPED; } } skb_put(prx_skb, pkt_len); mwl_rx_remove_dma_header(prx_skb, curr_desc->qos_ctrl); memcpy(IEEE80211_SKB_RXCB(prx_skb), &status, sizeof(status)); ieee80211_rx(hw, prx_skb); out: mwl_rx_refill(priv, curr_desc); curr_desc->rx_control = EAGLE_RXD_CTRL_DRIVER_OWN; curr_desc->qos_ctrl = 0; curr_desc = curr_desc->pnext; work_done++; } priv->desc_data[0].pnext_rx_desc = curr_desc; status_mask = readl(priv->iobase1 + MACREG_REG_A2H_INTERRUPT_STATUS_MASK); writel(status_mask | MACREG_A2HRIC_BIT_RX_RDY, priv->iobase1 + MACREG_REG_A2H_INTERRUPT_STATUS_MASK); priv->is_rx_schedule = false; WLDBG_EXIT(DBG_LEVEL_4); }
/************************************************************************* * Function: * * Description: * * Input: * * Output: * **************************************************************************/ extern SINT8 evtSmeCmdMsg(vmacApInfo_t *vmacSta_p,UINT8 *message) { MhsmEvent_t smMsg; macmgmtQ_SmeCmd_t * smeCmd_p; extStaDb_StaInfo_t *StaInfo_p; WLDBG_ENTER(DBG_CLASS_INFO); if (message == NULL) { return 1; } #ifdef AP_MAC_LINUX smMsg.devinfo = (void *) vmacSta_p; #endif smeCmd_p = (macmgmtQ_SmeCmd_t *)message; switch (smeCmd_p->CmdType) { case SME_CMD_DISASSOCIATE: { WLDBG_INFO(DBG_LEVEL_11, "evtSmeCmdMsg: SME_CMD_DISASSOCIATE message received. \n"); if ((StaInfo_p = extStaDb_GetStaInfo(vmacSta_p,&smeCmd_p->Body.AssocCmd.PeerStaAddr, 1)) == NULL) { return 1; } smMsg.event = MlmeDisAssoc_Req; smMsg.pBody = (UINT8 *)&(smeCmd_p->Body.AssocCmd); mhsm_send_event((Mhsm_t *)&StaInfo_p->mgtAssoc.super, &smMsg); } break; case SME_CMD_START: { SyncSrvApMsg syncMsg; WLDBG_INFO(DBG_LEVEL_11, "evtSmeCmdMsg: SME_CMD_START message received. \n"); syncMsg.opMode = infrastructure; syncMsg.mgtMsg = (UINT8 *)&(smeCmd_p->Body.StartCmd); smMsg.event = MlmeStart_Req; smMsg.pBody = (unsigned char *)&syncMsg; mhsm_send_event((Mhsm_t *)&vmacSta_p->mgtSync.super, &smMsg); } break; case SME_CMD_RESET: { SyncSrvApMsg syncMsg; WLDBG_INFO(DBG_LEVEL_11, "evtSmeCmdMsg: SME_CMD_RESET message received. \n"); syncMsg.mgtMsg = (UINT8 *)&(smeCmd_p->Body.ResetCmd); smMsg.event = ResetMAC; smMsg.pBody = (unsigned char *)&syncMsg; mhsm_send_event((Mhsm_t *)&vmacSta_p->mgtSync.super, &smMsg); } break; #if defined(AP_SITE_SURVEY) || defined(AUTOCHANNEL) case SME_CMD_SCAN: { SyncSrvApMsg syncMsg; WLDBG_INFO(DBG_LEVEL_11, "evtSmeCmdMsg: SME_CMD_SCAN message received. \n"); syncMsg.mgtMsg = (UINT8 *)&(smeCmd_p->Body.ScanCmd); smMsg.event = MlmeScan_Req; smMsg.pBody = (unsigned char *)&syncMsg; mhsm_send_event((Mhsm_t *)&vmacSta_p->mgtSync.super, &smMsg); } break; #endif /* AP_SITE_SURVEY */ #ifdef IEEE80211H case SME_CMD_MREQUEST: { SyncSrvApMsg syncMsg; WLDBG_INFO(DBG_LEVEL_11, "evtSmeCmdMsg: SME_CMD_MREQUEST message received. \n"); if (!IS_BROADCAST(&smeCmd_p->Body.MrequestCmd.PeerStaAddr)) { if ((StaInfo_p = extStaDb_GetStaInfo(vmacSta_p,&smeCmd_p->Body.MrequestCmd.PeerStaAddr, 1)) == NULL) { WLDBG_INFO(DBG_LEVEL_11, "evtSmeCmdMsg: SME_CMD_MREQUEST - no station found %x:%x:%x:%x:%x:%x] \n", smeCmd_p->Body.MrequestCmd.PeerStaAddr[0], smeCmd_p->Body.MrequestCmd.PeerStaAddr[1], smeCmd_p->Body.MrequestCmd.PeerStaAddr[2], smeCmd_p->Body.MrequestCmd.PeerStaAddr[3], smeCmd_p->Body.MrequestCmd.PeerStaAddr[4], smeCmd_p->Body.MrequestCmd.PeerStaAddr[5]); return 1; } } syncMsg.mgtMsg = (UINT8 *)&(smeCmd_p->Body.MrequestCmd); smMsg.event = MlmeMrequest_Req; smMsg.pBody = (unsigned char *)&syncMsg; mhsm_send_event((Mhsm_t *)&vmacSta_p->mgtSync.super, &smMsg); } break; case SME_CMD_MREPORT: { SyncSrvApMsg syncMsg; WLDBG_INFO(DBG_LEVEL_11, "evtSmeCmdMsg: SME_CMD_MREPORT message received. \n"); if ((StaInfo_p = extStaDb_GetStaInfo(vmacSta_p,&smeCmd_p->Body.MrequestCmd.PeerStaAddr, 1)) == NULL) { WLDBG_INFO(DBG_LEVEL_11, "evtSmeCmdMsg: SME_CMD_MREPORT - no station found %x:%x:%x:%x:%x:%x] \n", smeCmd_p->Body.MrequestCmd.PeerStaAddr[0], smeCmd_p->Body.MrequestCmd.PeerStaAddr[1], smeCmd_p->Body.MrequestCmd.PeerStaAddr[2], smeCmd_p->Body.MrequestCmd.PeerStaAddr[3], smeCmd_p->Body.MrequestCmd.PeerStaAddr[4], smeCmd_p->Body.MrequestCmd.PeerStaAddr[5]); return 1; } syncMsg.mgtMsg = (UINT8 *)&(smeCmd_p->Body.MreportCmd); smMsg.event = MlmeMreport_Req; smMsg.pBody = (unsigned char *)&syncMsg; mhsm_send_event((Mhsm_t *)&vmacSta_p->mgtSync.super, &smMsg); } break; case SMC_CMD_CHANNELSWITCH_REQ: { SyncSrvApMsg syncMsg; WLDBG_INFO(DBG_LEVEL_11, "evtSmeCmdMsg: SMC_CMD_CHANNELSWITCH_REQ message received. \n"); syncMsg.mgtMsg = (UINT8 *)&(smeCmd_p->Body.ChannelSwitchCmd); smMsg.event = MlmeChannelSwitch_Req; smMsg.pBody = (unsigned char *)&syncMsg; mhsm_send_event((Mhsm_t *)&vmacSta_p->mgtSync.super, &smMsg); } break; #endif /* IEEE80211H */ default: break; } WLDBG_EXIT(DBG_CLASS_INFO); return 0; }
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; }
extern void SmeMgmt(vmacApInfo_t *vmacSta_p,UINT32 eventsTriggered, UINT8 *msg) { MIB_802DOT11 *mib=vmacSta_p->Mib802dot11; MIB_STA_CFG *mib_StaCfg_p=vmacSta_p->Mib802dot11->StationConfig; smeQ_MgmtMsg_t *CfrmIndMsg_p; WLDBG_ENTER(DBG_LEVEL_11); { //eventsTriggered = os_EventWait(sysinfo_SME_MAIN_Q_EVENT, // SME_MAIN_EVENT_TRIGGERS, // OS_EVENT_WAITMODE_CLR_OR); /*------------------------------*/ /* Check for an error condition */ /*------------------------------*/ if (eventsTriggered == 0) { return; } else { /*---------------------------------------------------*/ /* Check for receipt of an 802.11 management message */ /*---------------------------------------------------*/ if (eventsTriggered & smeMain_MGMT_MSG_RCVD) { CfrmIndMsg_p = (smeQ_MgmtMsg_t *) msg; { switch (CfrmIndMsg_p->MsgType) { case SME_NOTIFY_START_CFRM: if (CfrmIndMsg_p->Msg.StartCfrm.Result == START_RESULT_SUCCESS) { } else if (CfrmIndMsg_p->Msg.StartCfrm.Result == START_RESULT_BSS_ALREADY_STARTED_OR_JOINED) { } else if (CfrmIndMsg_p->Msg.StartCfrm.Result == START_RESULT_INVALID_PARAMETERS) { } break; case SME_NOTIFY_RESET_CFRM: if (vmacSta_p->SmeState == SME_STATE_WAIT_FOR_RESET_CONFIRM) { SendStartCmd(vmacSta_p); } break; #ifdef IEEE80211H case SME_NOTIFY_ASSOC_IND: { extStaDb_StaInfo_t *staInfo = NULL; /* * AP is in A mode and doing spectrum management */ if (((*(mib->mib_ApMode) == AP_MODE_A_ONLY)||(*(mib->mib_ApMode)==AP_MODE_AandG)) && (mib_StaCfg_p->SpectrumManagementRequired == TRUE)) { #ifdef DEBUG_ENABLE printf("A new friend is coming\n\r"); #endif /* DEBUG_ENABLE */ if((staInfo = extStaDb_GetStaInfo(vmacSta_p,&CfrmIndMsg_p->Msg.AssocInd.PeerStaAddr, 0))) { /* Station IS capable of doing spectrum management */ if (staInfo->IsSpectrumMgmt == TRUE) { #ifdef DEBUG_ENABLE printf("Ask him measure this channel on behalf me\n\r"); #endif /* DEBUG_ENABLE */ #ifdef IEEE80211H_NOTWIFI SendMREQUESTCmd(vmacSta_p,&staInfo->Addr, RfSwitchChanA); #endif } } else { #ifdef DEBUG_ENABLE printf("Oops! Dest station not found\n\r"); #endif /* DEBUG_ENABLE */ } } } break; case SME_NOTIFY_REASSOC_IND: { extStaDb_StaInfo_t *staInfo = NULL; /* * AP is in A mode and doing spectrum management */ if (((*(mib->mib_ApMode) == AP_MODE_A_ONLY)||(*(mib->mib_ApMode)==AP_MODE_AandG)) && (mib_StaCfg_p->SpectrumManagementRequired == TRUE)) { #ifdef DEBUG_ENABLE printf("A new friend is coming\n\r"); #endif /* DEBUG_ENABLE */ if((staInfo = extStaDb_GetStaInfo(vmacSta_p, &CfrmIndMsg_p->Msg.ReassocInd.PeerStaAddr, 0))) { /* Station IS capable of doing spectrum management */ if (staInfo->IsSpectrumMgmt == TRUE) { #ifdef DEBUG_ENABLE printf("Ask him measure this channel on behalf me\n\r"); #endif /* DEBUG_ENABLE */ SendMREQUESTCmd(vmacSta_p,&staInfo->Addr, RfSwitchChanA); } } else { #ifdef DEBUG_ENABLE printf("Oops! Dest station not found\n\r"); #endif /* DEBUG_ENABLE */ } } } break; #ifdef MRVL_DFS /*Channel switch has been performed.*/ case SME_NOTIFY_CHANNELSWITCH_CFRM: { DfsCmd_t dfsCmd ; /* If channel change is successful, send the message to * the event dispatcher */ if( CfrmIndMsg_p->Msg.ChanSwitchCfrm.result) { dfsCmd.CmdType = DFS_CMD_CHANNEL_CHANGE ; memcpy( &dfsCmd.Body.chInfo , &CfrmIndMsg_p->Msg.ChanSwitchCfrm.chInfo, sizeof (DfsChanInfo) ); evtDFSMsg( vmacSta_p->dev, (UINT8 *)&dfsCmd ); } } break; /*Radar has been detected.*/ case SME_NOTIFY_RADAR_DETECTION_IND: { DfsCmd_t dfsCmd ; /* Send the radar detection message to * the event dispatcher */ dfsCmd.CmdType = DFS_CMD_RADAR_DETECTION ; memcpy( &dfsCmd.Body.chInfo , &CfrmIndMsg_p->Msg.RadarDetectionInd.chInfo, sizeof (DfsChanInfo) ); evtDFSMsg( vmacSta_p->dev, (UINT8 *)&dfsCmd ); } break; #endif //MRVL_DFS case SME_NOTIFY_MREQUEST_IND: smeMrequestIndProcess(vmacSta_p,&CfrmIndMsg_p->Msg.MrequestInd); break; case SME_NOTIFY_MREQUEST_CFRM: smeMrequestCfrmProcess(vmacSta_p,&CfrmIndMsg_p->Msg.MrequestCfrm); break; case SME_NOTIFY_MEASURE_CFRM: smeMeasureCfrmProcess(vmacSta_p,&CfrmIndMsg_p->Msg.MeasureCfrm); break; case SME_NOTIFY_MREPORT_IND: { extStaDb_StaInfo_t *staInfo = NULL; /* * AP is in A mode and doing spectrum management */ if (((*(mib->mib_ApMode) == AP_MODE_A_ONLY)||(*(mib->mib_ApMode)==AP_MODE_AandG)) && (mib_StaCfg_p->SpectrumManagementRequired == TRUE)) { staInfo = extStaDb_GetStaInfo(vmacSta_p,&CfrmIndMsg_p->Msg.MreportInd.PeerStaAddr, 0); #ifdef DEBUG_ENABLE printf("SME_NOTIFY_MREPORT_IND\n\r"); #endif /* DEBUG_ENABLE */ if(staInfo != NULL) { /* Station IS capable of doing spectrum management */ if (staInfo->IsSpectrumMgmt == TRUE) { #ifdef DEBUG_ENABLE printf("Process incoming MLME-MREPORT.ind\n\r"); #endif /* DEBUG_ENABLE */ smeMreportIndProcess(vmacSta_p,(IEEEtypes_MacAddr_t *)&staInfo->Addr, &CfrmIndMsg_p->Msg.MreportInd); } } else { #ifdef DEBUG_ENABLE printf("Oops! Dest station not found\n\r"); #endif /* DEBUG_ENABLE */ } } } break; case SME_NOTIFY_MREPORT_CFRM: smeMreportCfrmProcess(vmacSta_p,&CfrmIndMsg_p->Msg.MreportCfrm); break; case SME_NOTIFY_TPCADPT_CFRM: smeMTpcAdptCfrmdProcess(vmacSta_p,&CfrmIndMsg_p->Msg.TPCAdaptCfrm); break; case SMC_NOTIFY_CHANNELSWITCH_IND: smeChannelSwitchIndProcess(vmacSta_p,&CfrmIndMsg_p->Msg.ChannelSwitchInd); break; case SMC_NOTIFY_CHANNELSWITCH_CFRM: smeChannelSwitchCfrmProcess(vmacSta_p,&CfrmIndMsg_p->Msg.ChannelSwitchCfrm); break; #endif /* IEEE80211H */ default: break; } //pool_FreeBuf((char *)CfrmIndMsg_p); } } /*---------------------------------------*/ /* Check for receipt of a error messages */ /*---------------------------------------*/ } } WLDBG_EXIT(DBG_LEVEL_11); }