drivers/staging/rtl8723bs/core/rtw_sta_mgt.c

Source file repositories/reference/linux-study-clean/drivers/staging/rtl8723bs/core/rtw_sta_mgt.c

File Facts

System
Linux kernel
Corpus path
drivers/staging/rtl8723bs/core/rtw_sta_mgt.c
Extension
.c
Size
14808 bytes
Lines
551
Domain
Driver Families
Bucket
drivers/staging
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

list_for_each(plist, phead) {
				int i;

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

				for (i = 0; i < 16 ; i++) {
					preorder_ctrl = &psta->recvreorder_ctrl[i];
					timer_delete_sync(&preorder_ctrl->reordering_ctrl_timer);
				}
			}
		}
		spin_unlock_bh(&pstapriv->sta_hash_lock);
		/*===============================*/

		kfree_sta_priv_lock(pstapriv);

		vfree(pstapriv->pallocated_stainfo_buf);
	}
	return _SUCCESS;
}

/* 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)
{
	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)); */
	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);
		return NULL;
	}
	psta = container_of(get_next(&pfree_sta_queue->queue), struct sta_info, list);

	list_del_init(&psta->list);

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

	_rtw_init_stainfo(psta);

	psta->padapter = pstapriv->padapter;

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

	index = wifi_mac_hash(hwaddr);

	if (index >= NUM_STA) {
		spin_unlock_bh(&pstapriv->sta_hash_lock);
		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);

	timer_setup(&psta->addba_retry_timer, addba_timer_hdl, 0);

	/* 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;

Annotation

Implementation Notes