static void _init_stainfo(struct sta_info *psta) { _func_enter_; _memset((u8 *)psta, 0, sizeof (struct sta_info)); _spinlock_init(&psta->lock); _init_listhead(&psta->list); _init_listhead(&psta->hash_list); //_init_listhead(&psta->asoc_list); //_init_listhead(&psta->sleep_list); //_init_listhead(&psta->wakeup_list); _init_queue(&psta->sleep_q); psta->sleepq_len = 0; _init_sta_xmit_priv(&psta->sta_xmitpriv); _init_sta_recv_priv(&psta->sta_recvpriv); #ifdef CONFIG_NATIVEAP_MLME _init_listhead(&psta->asoc_list); _init_listhead(&psta->auth_list); #endif _func_exit_; }
void _init_queue(_queue *pqueue) { _init_listhead(&(pqueue->queue)); _spinlock_init(&(pqueue->lock)); }
u32 _init_sta_priv(struct sta_priv *pstapriv) { struct sta_info *psta; s32 i; _func_enter_; pstapriv->pallocated_stainfo_buf = _malloc (sizeof(struct sta_info) * NUM_STA+ 4); if(!pstapriv->pallocated_stainfo_buf) return _FAIL; pstapriv->pstainfo_buf = pstapriv->pallocated_stainfo_buf + 4 - ((unsigned int)(pstapriv->pallocated_stainfo_buf ) & 3); _init_queue(&pstapriv->free_sta_queue); _spinlock_init(&pstapriv->sta_hash_lock); //_init_queue(&pstapriv->asoc_q); pstapriv->asoc_sta_count = 0; _init_queue(&pstapriv->sleep_q); _init_queue(&pstapriv->wakeup_q); psta = (struct sta_info *)(pstapriv->pstainfo_buf); for(i = 0; i < NUM_STA; i++) { _init_stainfo(psta); _init_listhead(&(pstapriv->sta_hash[i])); list_insert_tail(&psta->list, get_list_head(&pstapriv->free_sta_queue)); psta++; } #ifdef CONFIG_NATIVEAP_MLME _init_listhead(&pstapriv->asoc_list); _init_listhead(&pstapriv->auth_list); //pstapriv->auth_to = ???; //pstapriv->assoc_to = ???; //pstapriv->expire_to = ???; #endif _func_exit_; return _SUCCESS; }
static void _init_stainfo(struct sta_info *psta) { _func_enter_; _memset((u8 *)psta, 0, sizeof (struct sta_info)); _spinlock_init(&psta->lock); _init_listhead(&psta->list); _init_listhead(&psta->hash_list); //_init_listhead(&psta->asoc_list); //_init_listhead(&psta->sleep_list); //_init_listhead(&psta->wakeup_list); _init_queue(&psta->sleep_q); psta->sleepq_len = 0; _init_sta_xmit_priv(&psta->sta_xmitpriv); _init_sta_recv_priv(&psta->sta_recvpriv); #ifdef CONFIG_AP_MODE _init_listhead(&psta->asoc_list); _init_listhead(&psta->auth_list); psta->expire_to = 0; psta->flags = 0; psta->capability = 0; #ifdef CONFIG_NATIVEAP_MLME psta->nonerp_set = 0; psta->no_short_slot_time_set = 0; psta->no_short_preamble_set = 0; psta->no_ht_gf_set = 0; psta->no_ht_set = 0; psta->ht_20mhz_set = 0; #endif #endif _func_exit_; }
void _init_sta_recv_priv(struct sta_recv_priv *psta_recvpriv) { _func_enter_; _memset((u8 *)psta_recvpriv, 0, sizeof (struct sta_recv_priv)); _spinlock_init(&psta_recvpriv->lock); //for(i=0; i<MAX_RX_NUMBLKS; i++) // _init_queue(&psta_recvpriv->blk_strms[i]); _init_queue(&psta_recvpriv->defrag_q); _func_exit_; }
u32 _init_sta_priv(struct sta_priv *pstapriv) { struct sta_info *psta; s32 i; _func_enter_; #ifdef MEM_ALLOC_REFINE pstapriv->pallocated_stainfo_buf = rtw_zvmalloc (sizeof(struct sta_info) * NUM_STA+ 4); #else pstapriv->pallocated_stainfo_buf = rtw_zmalloc (sizeof(struct sta_info) * NUM_STA+ 4); #endif if(!pstapriv->pallocated_stainfo_buf) return _FAIL; pstapriv->pstainfo_buf = pstapriv->pallocated_stainfo_buf + 4 - ((SIZE_PTR)(pstapriv->pallocated_stainfo_buf ) & 3); _init_queue(&pstapriv->free_sta_queue); _spinlock_init(&pstapriv->sta_hash_lock); //_init_queue(&pstapriv->asoc_q); pstapriv->asoc_sta_count = 0; _init_queue(&pstapriv->sleep_q); _init_queue(&pstapriv->wakeup_q); psta = (struct sta_info *)(pstapriv->pstainfo_buf); for(i = 0; i < NUM_STA; i++) { _init_stainfo(psta); _init_listhead(&(pstapriv->sta_hash[i])); list_insert_tail(&psta->list, get_list_head(&pstapriv->free_sta_queue)); psta++; } #ifdef CONFIG_AP_MODE pstapriv->sta_dz_bitmap = 0; pstapriv->tim_bitmap = 0; _init_listhead(&pstapriv->asoc_list); _init_listhead(&pstapriv->auth_list); pstapriv->auth_to = 3; // 3*2 = 6 sec pstapriv->assoc_to = 3; pstapriv->expire_to = 900;// 900*2 = 1800 sec = 30 min, expire after no any traffic. pstapriv->max_num_sta = NUM_STA; #endif _func_exit_; return _SUCCESS; }
sint _init_recv_priv(struct recv_priv *precvpriv, _adapter *padapter) { sint i; union recv_frame *precvframe; sint res=_SUCCESS; _func_enter_; _memset((unsigned char *)precvpriv, 0, sizeof (struct recv_priv)); _spinlock_init(&precvpriv->lock); _init_queue(&precvpriv->free_recv_queue); _init_queue(&precvpriv->recv_pending_queue); precvpriv->adapter = padapter; precvpriv->free_recvframe_cnt = NR_RECVFRAME; os_recv_resource_init(precvpriv, padapter); precvpriv->pallocated_frame_buf = _malloc(NR_RECVFRAME * sizeof(union recv_frame) + RXFRAME_ALIGN_SZ); if(precvpriv->pallocated_frame_buf==NULL){ res= _FAIL; goto exit; } _memset(precvpriv->pallocated_frame_buf, 0, NR_RECVFRAME * sizeof(union recv_frame) + RXFRAME_ALIGN_SZ); precvpriv->precv_frame_buf = precvpriv->pallocated_frame_buf + RXFRAME_ALIGN_SZ - ((uint) (precvpriv->pallocated_frame_buf) &(RXFRAME_ALIGN_SZ-1)); precvframe = (union recv_frame*) precvpriv->precv_frame_buf; for(i=0; i < NR_RECVFRAME ; i++) { _init_listhead(&(precvframe->u.list)); list_insert_tail(&(precvframe->u.list), &(precvpriv->free_recv_queue.queue)); res = os_recv_resource_alloc(padapter, precvframe); precvframe->u.hdr.adapter =padapter; precvframe++; } #ifdef CONFIG_USB_HCI precvpriv->rx_pending_cnt=1; _init_sema(&precvpriv->allrxreturnevt, 0); #endif res = init_recv_priv(precvpriv, padapter); exit: _func_exit_; return res; }