Example #1
0
/* any station allocated can be searched by hash list */
struct sta_info *r8712_get_stainfo(struct sta_priv *pstapriv, u8 *hwaddr)
{
	unsigned long	 irqL;
	struct list_head *plist, *phead;
	struct sta_info *psta = NULL;
	u32	index;

	if (hwaddr == NULL)
		return NULL;
	index = wifi_mac_hash(hwaddr);
	spin_lock_irqsave(&pstapriv->sta_hash_lock, irqL);
	phead = &(pstapriv->sta_hash[index]);
	plist = phead->next;
	while (!end_of_queue_search(phead, plist)) {
		psta = container_of(plist, struct sta_info, hash_list);
		if ((!memcmp(psta->hwaddr, hwaddr, ETH_ALEN))) {
			/* if found the matched address */
			break;
		}
		psta = NULL;
		plist = plist->next;
	}
	spin_unlock_irqrestore(&pstapriv->sta_hash_lock, irqL);
	return psta;
}
struct sta_info *r8712_get_stainfo(struct sta_priv *pstapriv, u8 *hwaddr)
{
	unsigned long	 irqL;
	struct list_head *plist, *phead;
	struct sta_info *psta = NULL;
	u32	index;

	if (hwaddr == NULL)
		return NULL;
	index = wifi_mac_hash(hwaddr);
	spin_lock_irqsave(&pstapriv->sta_hash_lock, irqL);
	phead = &(pstapriv->sta_hash[index]);
	plist = get_next(phead);
	while ((end_of_queue_search(phead, plist)) == false) {
		psta = LIST_CONTAINOR(plist, struct sta_info, hash_list);
		if ((!memcmp(psta->hwaddr, hwaddr, ETH_ALEN))) {
			/*                              */
			break;
		}
		psta = NULL;
		plist = get_next(plist);
	}
	spin_unlock_irqrestore(&pstapriv->sta_hash_lock, irqL);
	return psta;
}
struct sta_info *r8712_alloc_stainfo(struct sta_priv *pstapriv, u8 *hwaddr)
{
	uint tmp_aid;
	s32	index;
	struct list_head *phash_list;
	struct sta_info	*psta;
	struct  __queue *pfree_sta_queue;
	struct recv_reorder_ctrl *preorder_ctrl;
	int i = 0;
	u16  wRxSeqInitialValue = 0xffff;
	unsigned long flags;

	pfree_sta_queue = &pstapriv->free_sta_queue;
	spin_lock_irqsave(&(pfree_sta_queue->lock), flags);
	if (_queue_empty(pfree_sta_queue) == true)
		psta = NULL;
	else {
		psta = LIST_CONTAINOR(get_next(&pfree_sta_queue->queue),
				      struct sta_info, list);
		list_delete(&(psta->list));
		tmp_aid = psta->aid;
		_init_stainfo(psta);
		memcpy(psta->hwaddr, hwaddr, ETH_ALEN);
		index = wifi_mac_hash(hwaddr);
		if (index >= NUM_STA) {
			psta = NULL;
			goto exit;
		}
		phash_list = &(pstapriv->sta_hash[index]);
		list_insert_tail(&psta->hash_list, phash_list);
		pstapriv->asoc_sta_count++ ;

/*                                                                         
                                                                                
                                                                         
                                                   
 */
		for (i = 0; i < 16; i++)
			memcpy(&psta->sta_recvpriv.rxcache.tid_rxseq[i],
				&wRxSeqInitialValue, 2);
		/*                                         */
		for (i = 0; i < 16 ; i++) {
			preorder_ctrl = &psta->recvreorder_ctrl[i];
			preorder_ctrl->padapter = pstapriv->padapter;
			preorder_ctrl->indicate_seq = 0xffff;
			preorder_ctrl->wend_b = 0xffff;
			preorder_ctrl->wsize_b = 64;
			_init_queue(&preorder_ctrl->pending_recvframe_queue);
			r8712_init_recv_timer(preorder_ctrl);
		}
	}
exit:
	spin_unlock_irqrestore(&(pfree_sta_queue->lock), flags);
	return psta;
}
/* any station allocated can be searched by hash list */
struct sta_info *rtw_get_stainfo(struct sta_priv *pstapriv, u8 *hwaddr)
{

    _irqL	 irqL;

    _list	*plist, *phead;

    struct sta_info *psta = NULL;

    u32	index;

    u8 *addr;

    u8 bc_addr[ETH_ALEN] = {0xff,0xff,0xff,0xff,0xff,0xff};

    _func_enter_;

    if(hwaddr==NULL)
        return NULL;

    if(IS_MCAST(hwaddr))
    {
        addr = bc_addr;
    }
    else
    {
        addr = hwaddr;
    }

    index = wifi_mac_hash(addr);

    _enter_critical_bh(&pstapriv->sta_hash_lock, &irqL);

    phead = &(pstapriv->sta_hash[index]);
    plist = get_next(phead);


    while ((rtw_end_of_queue_search(phead, plist)) == _FALSE)
    {

        psta = LIST_CONTAINOR(plist, struct sta_info, hash_list);

        if ((_rtw_memcmp(psta->hwaddr, addr, ETH_ALEN))== _TRUE)
        {   // if found the matched address
            break;
        }
        psta=NULL;
        plist = get_next(plist);
    }

    _exit_critical_bh(&pstapriv->sta_hash_lock, &irqL);
    _func_exit_;
    return psta;

}
Example #5
0
struct sta_info *r8712_alloc_stainfo(struct sta_priv *pstapriv, u8 *hwaddr)
{
	uint tmp_aid;
	s32	index;
	struct list_head *phash_list;
	struct sta_info	*psta;
	struct  __queue *pfree_sta_queue;
	struct recv_reorder_ctrl *preorder_ctrl;
	int i = 0;
	u16  wRxSeqInitialValue = 0xffff;
	unsigned long flags;

	pfree_sta_queue = &pstapriv->free_sta_queue;
	spin_lock_irqsave(&(pfree_sta_queue->lock), flags);
	if (_queue_empty(pfree_sta_queue) == true)
		psta = NULL;
	else {
		psta = LIST_CONTAINOR(get_next(&pfree_sta_queue->queue),
				      struct sta_info, list);
		list_delete(&(psta->list));
		tmp_aid = psta->aid;
		_init_stainfo(psta);
		memcpy(psta->hwaddr, hwaddr, ETH_ALEN);
		index = wifi_mac_hash(hwaddr);
		if (index >= NUM_STA) {
			psta = NULL;
			goto exit;
		}
		phash_list = &(pstapriv->sta_hash[index]);
		list_insert_tail(&psta->hash_list, phash_list);
		pstapriv->asoc_sta_count++;

/* For the SMC router, the sequence number of first packet of WPS handshake
 * will be 0. In this case, this packet will be dropped by recv_decache function
 * if we use the 0x00 as the default value for tid_rxseq variable. So, we
 * initialize the tid_rxseq variable as the 0xffff.
 */
		for (i = 0; i < 16; i++)
			memcpy(&psta->sta_recvpriv.rxcache.tid_rxseq[i],
				&wRxSeqInitialValue, 2);
		/* for A-MPDU Rx reordering buffer control */
		for (i = 0; i < 16; i++) {
			preorder_ctrl = &psta->recvreorder_ctrl[i];
			preorder_ctrl->padapter = pstapriv->padapter;
			preorder_ctrl->indicate_seq = 0xffff;
			preorder_ctrl->wend_b = 0xffff;
			preorder_ctrl->wsize_b = 64;
			_init_queue(&preorder_ctrl->pending_recvframe_queue);
			r8712_init_recv_timer(preorder_ctrl);
		}
	}
exit:
	spin_unlock_irqrestore(&(pfree_sta_queue->lock), flags);
	return psta;
}
Example #6
0
/* any station allocated can be searched by hash list */
struct sta_info *rtw_get_stainfo(struct sta_priv *pstapriv, u8 *hwaddr)
{
	_list	*plist, *phead;
	struct sta_info *psta = NULL;
	u32	index;
	u8 *addr;
	u8 bc_addr[ETH_ALEN] = {0xff,0xff,0xff,0xff,0xff,0xff};

_func_enter_;

	if(hwaddr==NULL)
		return NULL;

	if(IS_MCAST(hwaddr))
	{
		addr = bc_addr;
	}
	else
	{
		addr = hwaddr;
	}

	index = wifi_mac_hash(addr);

	spin_lock_bh(&pstapriv->sta_hash_lock);

	phead = &(pstapriv->sta_hash[index]);
	plist = get_next(phead);


	while (phead != plist)
	{

		psta = LIST_CONTAINOR(plist, struct sta_info, hash_list);

		if ((!memcmp(psta->hwaddr, addr, ETH_ALEN)))
		{ // if found the matched address
			break;
		}
		psta=NULL;
		plist = get_next(plist);
	}

	spin_unlock_bh(&pstapriv->sta_hash_lock);
_func_exit_;
	return psta;

}
Example #7
0
/* any station allocated can be searched by hash list */
struct sta_info *get_stainfo(struct sta_priv *pstapriv, u8 *hwaddr)
{

	_irqL	 irqL;

	_list	*plist, *phead;

	struct sta_info *psta = NULL;
	
	u32	index;

_func_enter_;

	if(hwaddr==NULL)
		return NULL;
		

	index = wifi_mac_hash(hwaddr);

	//_enter_critical_bh(&pstapriv->sta_hash_lock, &irqL);
	_enter_critical(&pstapriv->sta_hash_lock, &irqL);
	
	phead = &(pstapriv->sta_hash[index]);
	plist = get_next(phead);


	while ((end_of_queue_search(phead, plist)) == _FALSE)
	{
	
		psta = LIST_CONTAINOR(plist, struct sta_info, hash_list);
		
		if ((_memcmp(psta->hwaddr,hwaddr, ETH_ALEN))== _TRUE) 
		{ // if found the matched address
			break;
		}
		psta=NULL;
		plist = get_next(plist);
	}

	//_exit_critical_bh(&pstapriv->sta_hash_lock, &irqL);
	_exit_critical(&pstapriv->sta_hash_lock, &irqL);
_func_exit_;	
	return psta;
	
}
Example #8
0
/* any station allocated can be searched by hash list */
struct sta_info *rtw_get_stainfo(struct sta_priv *pstapriv, u8 *hwaddr)
{
	struct list_head	*plist, *phead;
	struct sta_info *psta = NULL;
	u32 index;
	u8 *addr;
	u8 bc_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};

	if (!hwaddr)
		return NULL;

	if (IS_MCAST(hwaddr))
		addr = bc_addr;
	else
		addr = hwaddr;

	index = wifi_mac_hash(addr);

	spin_lock_bh(&pstapriv->sta_hash_lock);

	phead = &(pstapriv->sta_hash[index]);
	plist = get_next(phead);


	while (phead != plist) {

		psta = LIST_CONTAINOR(plist, struct sta_info, hash_list);

		if ((!memcmp(psta->hwaddr, addr, ETH_ALEN)))
		 /*  if found the matched address */
			break;

		psta = NULL;
		plist = get_next(plist);
	}

	spin_unlock_bh(&pstapriv->sta_hash_lock);
	return psta;
}
Example #9
0
/* any station allocated can be searched by hash list */
struct sta_info *rtw_get_stainfo(struct sta_priv *pstapriv, u8 *hwaddr)
{
	struct list_head *plist, *phead;
	struct sta_info *psta = NULL;
	u32 index;
	u8 *addr;
	u8 bc_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};

	if (!hwaddr)
		return NULL;

	if (is_multicast_ether_addr(hwaddr))
		addr = bc_addr;
	else
		addr = hwaddr;

	index = wifi_mac_hash(addr);

	spin_lock_bh(&pstapriv->sta_hash_lock);

	phead = &pstapriv->sta_hash[index];
	plist = phead->next;

	while (phead != plist) {
		psta = container_of(plist, struct sta_info, hash_list);

		if ((!memcmp(psta->hwaddr, addr, ETH_ALEN)) == true) {
			/*  if found the matched address */
			break;
		}
		psta = NULL;
		plist = plist->next;
	}

	spin_unlock_bh(&pstapriv->sta_hash_lock);
	return psta;
}
Example #10
0
struct	sta_info *rtw_alloc_stainfo(struct sta_priv *pstapriv, u8 *hwaddr)
{
	unsigned long irqL, irqL2;
	s32	index;
	struct list_head *phash_list;
	struct sta_info	*psta;
	struct __queue *pfree_sta_queue;
	struct recv_reorder_ctrl *preorder_ctrl;
	int i = 0;
	u16  wRxSeqInitialValue = 0xffff;

_func_enter_;

	pfree_sta_queue = &pstapriv->free_sta_queue;

	_enter_critical_bh(&(pfree_sta_queue->lock), &irqL);

	if (_rtw_queue_empty(pfree_sta_queue) == true) {
		_exit_critical_bh(&(pfree_sta_queue->lock), &irqL);
		psta = NULL;
	} else {
		psta = LIST_CONTAINOR(get_next(&pfree_sta_queue->queue), struct sta_info, list);
		rtw_list_delete(&(psta->list));
		_exit_critical_bh(&(pfree_sta_queue->lock), &irqL);
		_rtw_init_stainfo(psta);
		_rtw_memcpy(psta->hwaddr, hwaddr, ETH_ALEN);
		index = wifi_mac_hash(hwaddr);
		RT_TRACE(_module_rtl871x_sta_mgt_c_,_drv_info_,("rtw_alloc_stainfo: index  = %x", index));
		if (index >= NUM_STA) {
			RT_TRACE(_module_rtl871x_sta_mgt_c_,_drv_err_,("ERROR=> rtw_alloc_stainfo: index >= NUM_STA"));
			psta= NULL;
			goto exit;
		}
		phash_list = &(pstapriv->sta_hash[index]);

		_enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL2);

		rtw_list_insert_tail(&psta->hash_list, phash_list);

		pstapriv->asoc_sta_count ++ ;

		_exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL2);

/*  Commented by Albert 2009/08/13 */
/*  For the SMC router, the sequence number of first packet of WPS handshake will be 0. */
/*  In this case, this packet will be dropped by recv_decache function if we use the 0x00 as the default value for tid_rxseq variable. */
/*  So, we initialize the tid_rxseq variable as the 0xffff. */

		for ( i = 0; i < 16; i++ )
		{
                     _rtw_memcpy( &psta->sta_recvpriv.rxcache.tid_rxseq[ i ], &wRxSeqInitialValue, 2 );
		}

		RT_TRACE(_module_rtl871x_sta_mgt_c_,_drv_info_,("alloc number_%d stainfo  with hwaddr = %x %x %x %x %x %x\n",
		pstapriv->asoc_sta_count , hwaddr[0], hwaddr[1], hwaddr[2],hwaddr[3],hwaddr[4],hwaddr[5]));

		init_addba_retry_timer(pstapriv->padapter, psta);

		/* for A-MPDU Rx reordering buffer control */
		for (i=0; i < 16 ; i++)
		{
			preorder_ctrl = &psta->recvreorder_ctrl[i];

			preorder_ctrl->padapter = pstapriv->padapter;

			preorder_ctrl->enable = false;

			preorder_ctrl->indicate_seq = 0xffff;
			preorder_ctrl->wend_b= 0xffff;
			preorder_ctrl->wsize_b = 64;/* 64; */

			_rtw_init_queue(&preorder_ctrl->pending_recvframe_queue);

			rtw_init_recv_timer(preorder_ctrl);
		}


		/* init for DM */
		psta->rssi_stat.UndecoratedSmoothedPWDB = (-1);
		psta->rssi_stat.UndecoratedSmoothedCCK = (-1);

		/* init for the sequence number of received management frame */
		psta->RxMgmtFrameSeqNum = 0xffff;
	}

exit:

_func_exit_;

	return psta;


}
Example #11
0
//struct	sta_info *rtw_alloc_stainfo(_queue *pfree_sta_queue, unsigned char *hwaddr)
struct	sta_info *rtw_alloc_stainfo(struct	sta_priv *pstapriv, u8 *hwaddr)
{
	uint tmp_aid;
	s32	index;
	_list	*phash_list;
	struct sta_info	*psta;
	_queue *pfree_sta_queue;
	struct recv_reorder_ctrl *preorder_ctrl;
	int i = 0;
	u16  wRxSeqInitialValue = 0xffff;

_func_enter_;

	pfree_sta_queue = &pstapriv->free_sta_queue;

	//spin_lock_bh(&(pfree_sta_queue->lock));
	spin_lock_bh(&(pstapriv->sta_hash_lock));
	if (list_empty(&pfree_sta_queue->queue))
	{
		//spin_unlock_bh(&(pfree_sta_queue->lock));
		spin_unlock_bh(&(pstapriv->sta_hash_lock));
		psta = NULL;
		return psta;
	}
	else
	{
		psta = LIST_CONTAINOR(get_next(&pfree_sta_queue->queue), struct sta_info, list);

		list_del_init(&(psta->list));

		//spin_unlock_bh(&(pfree_sta_queue->lock));

		tmp_aid = psta->aid;

		_rtw_init_stainfo(psta);

		psta->padapter = pstapriv->padapter;

		memcpy(psta->hwaddr, hwaddr, ETH_ALEN);

		index = wifi_mac_hash(hwaddr);

		RT_TRACE(_module_rtl871x_sta_mgt_c_,_drv_info_,("rtw_alloc_stainfo: index  = %x", index));

		if(index >= NUM_STA){
			RT_TRACE(_module_rtl871x_sta_mgt_c_,_drv_err_,("ERROR=> rtw_alloc_stainfo: index >= NUM_STA"));
			psta= NULL;
			goto exit;
		}
		phash_list = &(pstapriv->sta_hash[index]);

		//spin_lock_bh(&(pstapriv->sta_hash_lock));

		list_add_tail(&psta->hash_list, phash_list);

		pstapriv->asoc_sta_count ++ ;

		//spin_unlock_bh(&(pstapriv->sta_hash_lock));

// Commented by Albert 2009/08/13
// For the SMC router, the sequence number of first packet of WPS handshake will be 0.
// In this case, this packet will be dropped by recv_decache function if we use the 0x00 as the default value for tid_rxseq variable.
// So, we initialize the tid_rxseq variable as the 0xffff.

		for( i = 0; i < 16; i++ )
		{
                     memcpy( &psta->sta_recvpriv.rxcache.tid_rxseq[ i ], &wRxSeqInitialValue, 2 );
		}

		RT_TRACE(_module_rtl871x_sta_mgt_c_,_drv_info_,("alloc number_%d stainfo  with hwaddr = %x %x %x %x %x %x  \n",
		pstapriv->asoc_sta_count , hwaddr[0], hwaddr[1], hwaddr[2],hwaddr[3],hwaddr[4],hwaddr[5]));

		init_addba_retry_timer(pstapriv->padapter, psta);

		//for A-MPDU Rx reordering buffer control
		for(i=0; i < 16 ; i++)
		{
			preorder_ctrl = &psta->recvreorder_ctrl[i];

			preorder_ctrl->padapter = pstapriv->padapter;

			preorder_ctrl->enable = false;

			preorder_ctrl->indicate_seq = 0xffff;
			#ifdef DBG_RX_SEQ
			DBG_871X("DBG_RX_SEQ %s:%d IndicateSeq: %d\n", __FUNCTION__, __LINE__,
				preorder_ctrl->indicate_seq);
			#endif
			preorder_ctrl->wend_b= 0xffff;
			//preorder_ctrl->wsize_b = (NR_RECVBUFF-2);
			preorder_ctrl->wsize_b = 64;//64;

			_rtw_init_queue(&preorder_ctrl->pending_recvframe_queue);

			rtw_init_recv_timer(preorder_ctrl);
		}


		//init for DM
		psta->rssi_stat.UndecoratedSmoothedPWDB = (-1);
		psta->rssi_stat.UndecoratedSmoothedCCK = (-1);

		/* init for the sequence number of received management frame */
		psta->RxMgmtFrameSeqNum = 0xffff;

		//alloc mac id for non-bc/mc station,
		rtw_alloc_macid(pstapriv->padapter, psta);

	}

exit:

	spin_unlock_bh(&(pstapriv->sta_hash_lock));

_func_exit_;

	return psta;


}
Example #12
0
struct sta_info *rtw_alloc_stainfo(struct sta_priv *pstapriv, u8 *hwaddr)
{
	s32 index;
	struct list_head *phash_list;
	struct sta_info	*psta;
	struct __queue *pfree_sta_queue;
	struct recv_reorder_ctrl *preorder_ctrl;
	int i = 0;
	u16 wRxSeqInitialValue = 0xffff;

	pfree_sta_queue = &pstapriv->free_sta_queue;

	spin_lock_bh(&pfree_sta_queue->lock);
	psta = list_first_entry_or_null(&pfree_sta_queue->queue,
					struct sta_info, list);
	if (!psta) {
		spin_unlock_bh(&pfree_sta_queue->lock);
	} else {
		list_del_init(&psta->list);
		spin_unlock_bh(&pfree_sta_queue->lock);
		_rtw_init_stainfo(psta);
		memcpy(psta->hwaddr, hwaddr, ETH_ALEN);
		index = wifi_mac_hash(hwaddr);
		RT_TRACE(_module_rtl871x_sta_mgt_c_, _drv_info_, ("%s: index=%x", __func__, index));
		if (index >= NUM_STA) {
			RT_TRACE(_module_rtl871x_sta_mgt_c_, _drv_err_, ("ERROR => %s: index >= NUM_STA", __func__));
			psta = NULL;
			goto exit;
		}
		phash_list = &pstapriv->sta_hash[index];

		spin_lock_bh(&pstapriv->sta_hash_lock);
		list_add_tail(&psta->hash_list, phash_list);
		pstapriv->asoc_sta_count++;
		spin_unlock_bh(&pstapriv->sta_hash_lock);

/*  Commented by Albert 2009/08/13 */
/*  For the SMC router, the sequence number of first packet of WPS handshake will be 0. */
/*  In this case, this packet will be dropped by recv_decache function if we use the 0x00 as the default value for tid_rxseq variable. */
/*  So, we initialize the tid_rxseq variable as the 0xffff. */

		for (i = 0; i < 16; i++)
			memcpy(&psta->sta_recvpriv.rxcache.tid_rxseq[i], &wRxSeqInitialValue, 2);

		RT_TRACE(_module_rtl871x_sta_mgt_c_, _drv_info_,
			 ("alloc number_%d stainfo  with hwaddr = %pM\n",
			 pstapriv->asoc_sta_count, hwaddr));

		init_addba_retry_timer(pstapriv->padapter, psta);

		/* for A-MPDU Rx reordering buffer control */
		for (i = 0; i < 16; i++) {
			preorder_ctrl = &psta->recvreorder_ctrl[i];

			preorder_ctrl->padapter = pstapriv->padapter;

			preorder_ctrl->enable = false;

			preorder_ctrl->indicate_seq = 0xffff;
			preorder_ctrl->wend_b = 0xffff;
			preorder_ctrl->wsize_b = 64;/* 64; */

			_rtw_init_queue(&preorder_ctrl->pending_recvframe_queue);

			rtw_init_recv_timer(preorder_ctrl);
		}

		/* init for DM */
		psta->rssi_stat.UndecoratedSmoothedPWDB = -1;
		psta->rssi_stat.UndecoratedSmoothedCCK = -1;

		/* init for the sequence number of received management frame */
		psta->RxMgmtFrameSeqNum = 0xffff;
	}

exit:
	return psta;
}
//struct	sta_info *rtw_alloc_stainfo(_queue *pfree_sta_queue, unsigned char *hwaddr)
struct	sta_info *rtw_alloc_stainfo(struct	sta_priv *pstapriv, u8 *hwaddr)
{
    _irqL irqL, irqL2;
    uint tmp_aid;
    s32	index;
    _list	*phash_list;
    struct sta_info	*psta;
    _queue *pfree_sta_queue;
    struct recv_reorder_ctrl *preorder_ctrl;
    int i = 0;
    u16  wRxSeqInitialValue = 0xffff;

    _func_enter_;

    pfree_sta_queue = &pstapriv->free_sta_queue;

    _enter_critical_bh(&(pfree_sta_queue->lock), &irqL);

    if (_rtw_queue_empty(pfree_sta_queue) == _TRUE)
    {
        psta = NULL;
    }
    else
    {
        psta = LIST_CONTAINOR(get_next(&pfree_sta_queue->queue), struct sta_info, list);

        rtw_list_delete(&(psta->list));

        tmp_aid = psta->aid;

        _rtw_init_stainfo(psta);

        _rtw_memcpy(psta->hwaddr, hwaddr, ETH_ALEN);

        index = wifi_mac_hash(hwaddr);

        RT_TRACE(_module_rtl871x_sta_mgt_c_,_drv_info_,("rtw_alloc_stainfo: index  = %x", index));

        if(index >= NUM_STA) {
            RT_TRACE(_module_rtl871x_sta_mgt_c_,_drv_err_,("ERROR=> rtw_alloc_stainfo: index >= NUM_STA"));
            psta= NULL;
            goto exit;
        }
        phash_list = &(pstapriv->sta_hash[index]);

        _enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL2);

        rtw_list_insert_tail(&psta->hash_list, phash_list);

        pstapriv->asoc_sta_count ++ ;

        _exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL2);

// Commented by Albert 2009/08/13
// For the SMC router, the sequence number of first packet of WPS handshake will be 0.
// In this case, this packet will be dropped by recv_decache function if we use the 0x00 as the default value for tid_rxseq variable.
// So, we initialize the tid_rxseq variable as the 0xffff.

        for( i = 0; i < 16; i++ )
        {
            _rtw_memcpy( &psta->sta_recvpriv.rxcache.tid_rxseq[ i ], &wRxSeqInitialValue, 2 );
        }

        RT_TRACE(_module_rtl871x_sta_mgt_c_,_drv_info_,("alloc number_%d stainfo  with hwaddr = %x %x %x %x %x %x  \n",
                 pstapriv->asoc_sta_count , hwaddr[0], hwaddr[1], hwaddr[2],hwaddr[3],hwaddr[4],hwaddr[5]));

        init_addba_retry_timer(pstapriv->padapter, psta);

#ifdef CONFIG_TDLS
        psta->padapter = pstapriv->padapter;
        init_TPK_timer(pstapriv->padapter, psta);
        _init_workitem(&psta->option_workitem, TDLS_option_workitem_callback, psta);
        init_ch_switch_timer(pstapriv->padapter, psta);
        init_base_ch_timer(pstapriv->padapter, psta);
        _init_workitem(&psta->base_ch_workitem, base_channel_workitem_callback, psta);
        init_off_ch_timer(pstapriv->padapter, psta);
        _init_workitem(&psta->off_ch_workitem, off_channel_workitem_callback, psta);
#endif

        //for A-MPDU Rx reordering buffer control
        for(i=0; i < 16 ; i++)
        {
            preorder_ctrl = &psta->recvreorder_ctrl[i];

            preorder_ctrl->padapter = pstapriv->padapter;

            preorder_ctrl->enable = _FALSE;

            preorder_ctrl->indicate_seq = 0xffff;
#ifdef DBG_RX_SEQ
            DBG_871X("DBG_RX_SEQ %s:%d IndicateSeq: %d\n", __FUNCTION__, __LINE__,
                     preorder_ctrl->indicate_seq);
#endif
            preorder_ctrl->wend_b= 0xffff;
            //preorder_ctrl->wsize_b = (NR_RECVBUFF-2);
            preorder_ctrl->wsize_b = 64;//64;

            _rtw_init_queue(&preorder_ctrl->pending_recvframe_queue);

            rtw_init_recv_timer(preorder_ctrl);
        }

    }

exit:

    _exit_critical_bh(&(pfree_sta_queue->lock), &irqL);

    _func_exit_;

    return psta;


}
Example #14
0
//struct	sta_info *alloc_stainfo(_queue *pfree_sta_queue, unsigned char *hwaddr)
struct	sta_info *alloc_stainfo(struct	sta_priv *pstapriv, u8 *hwaddr) 
{	
	uint tmp_aid;
	s32	index;
	_list	*phash_list;
	struct sta_info	*psta;
	_queue *pfree_sta_queue;
	struct recv_reorder_ctrl *preorder_ctrl;
	int i = 0;
	u16  wRxSeqInitialValue = 0xffff;
	
_func_enter_;	

	pfree_sta_queue = &pstapriv->free_sta_queue;
	
	_spinlock(&(pfree_sta_queue->lock));

	if (_queue_empty(pfree_sta_queue) == _TRUE)
	{
		psta = NULL;
	}
	else
	{
		psta = LIST_CONTAINOR(get_next(&pfree_sta_queue->queue), struct sta_info, list);
		
		list_delete(&(psta->list));
		
		tmp_aid = psta->aid;	
	
		_init_stainfo(psta);

		_memcpy(psta->hwaddr, hwaddr, ETH_ALEN);

		index = wifi_mac_hash(hwaddr);

		RT_TRACE(_module_rtl871x_sta_mgt_c_,_drv_info_,("alloc_stainfo: index  = %x", index));

		if(index >= NUM_STA){
			RT_TRACE(_module_rtl871x_sta_mgt_c_,_drv_err_,("ERROR=> alloc_stainfo: index >= NUM_STA"));
			psta= NULL;	
			goto exit;
		}
		phash_list = &(pstapriv->sta_hash[index]);

		_spinlock(&(pstapriv->sta_hash_lock));

		list_insert_tail(&psta->hash_list, phash_list);

		pstapriv->asoc_sta_count ++ ;

		_spinunlock(&(pstapriv->sta_hash_lock));

// Commented by Albert 2009/08/13
// For the SMC router, the sequence number of first packet of WPS handshake will be 0.
// In this case, this packet will be dropped by recv_decache function if we use the 0x00 as the default value for tid_rxseq variable.
// So, we initialize the tid_rxseq variable as the 0xffff.

		for( i = 0; i < 16; i++ )
		{
                     _memcpy( &psta->sta_recvpriv.rxcache.tid_rxseq[ i ], &wRxSeqInitialValue, 2 );
		}

		RT_TRACE(_module_rtl871x_sta_mgt_c_,_drv_info_,("alloc number_%d stainfo  with hwaddr = %x %x %x %x %x %x  \n", 
		pstapriv->asoc_sta_count , hwaddr[0], hwaddr[1], hwaddr[2],hwaddr[3],hwaddr[4],hwaddr[5]));

		

		//for A-MPDU Rx reordering buffer control
		for(i=0; i < 16 ; i++)
		{
			preorder_ctrl = &psta->recvreorder_ctrl[i];

			preorder_ctrl->padapter = pstapriv->padapter;
		
			preorder_ctrl->enable = _FALSE;
		
			preorder_ctrl->indicate_seq = 0xffff;
			preorder_ctrl->wend_b= 0xffff;       
			//preorder_ctrl->wsize_b = (NR_RECVBUFF-2);
			preorder_ctrl->wsize_b = 64;//64;

			_init_queue(&preorder_ctrl->pending_recvframe_queue);

			init_recv_timer(preorder_ctrl);
		}

	}
	
exit:

	_spinunlock(&(pfree_sta_queue->lock));
	
_func_exit_;	

	return psta;


}