hal/rtl8192e/pci/pci_ops_linux.c
u32 rtl8192ee_check_txdesc_closed(_adapter *padapter, u32 queue_idx, u32 index)
{

	struct mlme_priv		*pmlmepriv = &(padapter->mlmepriv);
	static u8 stop_report_count = 0;
	u16 check_state = _TRUE;
	u16	desc_idx_hw = 0, desc_idx_host = 0;
	u32	tmp_4bytes = 0;
	bool is_desc_closed = _FALSE;


	/* For normal driver, check Read/Write Point each interrupt wastes CPU utilization. */
#if (MP_DRIVER == 0)	/* normal driver */
	if (stop_report_count > 15 || !pmlmepriv->LinkDetectInfo.bBusyTraffic)
		check_state = _TRUE;
	else
		check_state = _FALSE;
#endif

	buf_desc_debug("TX:enter %s(%d): queue_idx = %d, desc_index = %04x, stop_report_count = %d, check_state = %d\n", __FUNCTION__, __LINE__, queue_idx, index, stop_report_count, check_state);

	if (!check_state) {
		is_desc_closed = _FALSE;
		return is_desc_closed;
	}

	if ((queue_idx == BCN_QUEUE_INX)) {
		/* For 92C download reserved page by BEACON_QUEUE. */
		is_desc_closed = _TRUE;
		return is_desc_closed;
	}

	if (RTW_CANNOT_RUN(padapter)) {
		/* For 92C download reserved page by BEACON_QUEUE. */
		is_desc_closed = _TRUE;
		return is_desc_closed;
	}

	tmp_4bytes = rtw_read32(padapter, get_txbd_rw_reg(queue_idx));
	desc_idx_hw = (u16)((tmp_4bytes >> 16) & 0x7ff);
	desc_idx_host = (u16)(tmp_4bytes & 0x7ff);

#ifdef BUF_DESC_DEBUG
	_draw_queue(padapter, queue_idx);
#endif

	if (desc_idx_host > desc_idx_hw) {
		if (index < desc_idx_host && index >= desc_idx_hw)
			is_desc_closed = _FALSE;
		else
			is_desc_closed = _TRUE;
	} else if (desc_idx_host < desc_idx_hw) {
		if (index >= desc_idx_host && index < desc_idx_hw)
			is_desc_closed = _TRUE;
		else
			is_desc_closed = _FALSE;
	} else { /* if(desc_idx_host == desc_idx_hw) */
		if (index != desc_idx_hw)
			is_desc_closed = _TRUE;
		else
			is_desc_closed = _FALSE;
	}

	if (queue_idx < BCN_QUEUE_INX) {
		if (!is_desc_closed)
			stop_report_count++;
		else
			stop_report_count = 0;
	}

	buf_desc_debug("TX:exit %s(%d): r/w reg = 0x%08x, desc_idx_host = %04x, desc_idx_hw = %04x, is_desc_closed = %d, stop_report_count = %d\n", __FUNCTION__, __LINE__, tmp_4bytes, desc_idx_host,
		       desc_idx_hw, is_desc_closed, stop_report_count);

	return is_desc_closed;

}
/*
  *		Read pointer is h/w descriptor index
  *		Write pointer is host desciptor index: For tx side, if own bit is set in packet index n,
  *									      host pointer (write pointer) point to index n + 1.
  */
Read pointer is h/w descriptor index
Write pointer is host desciptor index: For tx side, if own bit is set in packet index n,
host pointer (write pointer) point to index n + 1.
Read pointer is h / w descriptor index Write pointer is host desciptor index : For tx side if own bit is set in packet index n host pointer ( write pointer ) point to index n + 1 .
u32 rtl8192ee_check_txdesc_closed(_adapter *padapter, u32 queue_idx, u32 index)
{
	struct mlme_priv		*pmlmepriv = &(padapter->mlmepriv);
	static u8 stop_report_count = 0;
	u16 check_state = _TRUE;
	u16	desc_idx_hw = 0, desc_idx_host = 0;
	u32	tmp_4bytes = 0;
	bool is_desc_closed = _FALSE;
#if (MP_DRIVER == 0)	
	if (stop_report_count > 15 || !pmlmepriv->LinkDetectInfo.bBusyTraffic)
		check_state = _TRUE;
	else
		check_state = _FALSE;
#endif
	buf_desc_debug("TX:enter %s(%d): queue_idx = %d, desc_index = %04x, stop_report_count = %d, check_state = %d\n", __FUNCTION__, __LINE__, queue_idx, index, stop_report_count, check_state);
	if (!check_state) {
		is_desc_closed = _FALSE;
		return is_desc_closed;
	}
	if ((queue_idx == BCN_QUEUE_INX)) {
		is_desc_closed = _TRUE;
		return is_desc_closed;
	}
	if (RTW_CANNOT_RUN(padapter)) {
		is_desc_closed = _TRUE;
		return is_desc_closed;
	}
	tmp_4bytes = rtw_read32(padapter, get_txbd_rw_reg(queue_idx));
	desc_idx_hw = (u16)((tmp_4bytes >> 16) & 0x7ff);
	desc_idx_host = (u16)(tmp_4bytes & 0x7ff);
#ifdef BUF_DESC_DEBUG
	_draw_queue(padapter, queue_idx);
#endif
	if (desc_idx_host > desc_idx_hw) {
		if (index < desc_idx_host && index >= desc_idx_hw)
			is_desc_closed = _FALSE;
		else
			is_desc_closed = _TRUE;
	} else if (desc_idx_host < desc_idx_hw) {
		if (index >= desc_idx_host && index < desc_idx_hw)
			is_desc_closed = _TRUE;
		else
			is_desc_closed = _FALSE;
	} else { 
		if (index != desc_idx_hw)
			is_desc_closed = _TRUE;
		else
			is_desc_closed = _FALSE;
	}
	if (queue_idx < BCN_QUEUE_INX) {
		if (!is_desc_closed)
			stop_report_count++;
		else
			stop_report_count = 0;
	}
	buf_desc_debug("TX:exit %s(%d): r/w reg = 0x%08x, desc_idx_host = %04x, desc_idx_hw = %04x, is_desc_closed = %d, stop_report_count = %d\n", __FUNCTION__, __LINE__, tmp_4bytes, desc_idx_host,
		       desc_idx_hw, is_desc_closed, stop_report_count);
	return is_desc_closed;
}
u32 rtl8192ee_check_txdesc_closed ( _adapter * padapter , u32 queue_idx , u32 index ) { struct mlme_priv * pmlmepriv = & ( padapter -> mlmepriv ) ; static u8 stop_report_count = 0 ; u16 check_state = _TRUE ; u16 desc_idx_hw = 0 , desc_idx_host = 0 ; u32 tmp_4bytes = 0 ; bool is_desc_closed = _FALSE ; #if ( MP_DRIVER == 0 ) if ( stop_report_count > 15 || ! pmlmepriv -> LinkDetectInfo . bBusyTraffic ) check_state = _TRUE ; else check_state = _FALSE ; #endif buf_desc_debug ( " \n " , __FUNCTION__ , __LINE__ , queue_idx , index , stop_report_count , check_state ) ; if ( ! check_state ) { is_desc_closed = _FALSE ; return is_desc_closed ; } if ( ( queue_idx == BCN_QUEUE_INX ) ) { is_desc_closed = _TRUE ; return is_desc_closed ; } if ( RTW_CANNOT_RUN ( padapter ) ) { is_desc_closed = _TRUE ; return is_desc_closed ; } tmp_4bytes = rtw_read32 ( padapter , get_txbd_rw_reg ( queue_idx ) ) ; desc_idx_hw = ( u16 ) ( ( tmp_4bytes >> 16 ) & 0x7ff ) ; desc_idx_host = ( u16 ) ( tmp_4bytes & 0x7ff ) ; #ifdef BUF_DESC_DEBUG _draw_queue ( padapter , queue_idx ) ; #endif if ( desc_idx_host > desc_idx_hw ) { if ( index < desc_idx_host && index >= desc_idx_hw ) is_desc_closed = _FALSE ; else is_desc_closed = _TRUE ; } else if ( desc_idx_host < desc_idx_hw ) { if ( index >= desc_idx_host && index < desc_idx_hw ) is_desc_closed = _TRUE ; else is_desc_closed = _FALSE ; } else { if ( index != desc_idx_hw ) is_desc_closed = _TRUE ; else is_desc_closed = _FALSE ; } if ( queue_idx < BCN_QUEUE_INX ) { if ( ! is_desc_closed ) stop_report_count ++ ; else stop_report_count = 0 ; } buf_desc_debug ( " \n " , __FUNCTION__ , __LINE__ , tmp_4bytes , desc_idx_host , desc_idx_hw , is_desc_closed , stop_report_count ) ; return is_desc_closed ; }
Read pointer is h/w descriptor index
             Write pointer is host desciptor index: For tx side, if own bit is set in packet index n,
                                                                           host pointer (write pointer) point to index n + 1.
Read pointer is h / w descriptor index Write pointer is host desciptor index : For tx side if own bit is set in packet index n host pointer ( write pointer ) point to index n + 1 .
/* For normal driver, check Read/Write Point each interrupt wastes CPU utilization. */ /* normal driver */ /* For 92C download reserved page by BEACON_QUEUE. */ /* For 92C download reserved page by BEACON_QUEUE. */ /* if(desc_idx_host == desc_idx_hw) */