software/drivers/sd8887/src/wlan/mlan/mlan_11n_rxreorder.c
/**
 *  @brief This function will dispatch all packets sequentially
 *          from start_win until a hole is found and adjust the
 *          start_win appropriately
 *
 *  @param priv             A pointer to mlan_private
 *  @param rx_reor_tbl_ptr  A pointer to structure RxReorderTbl
 *
 *  @return                 MLAN_STATUS_SUCCESS
 */
@brief This function will dispatch all packets sequentially
from start_win until a hole is found and adjust the
start_win appropriately

@param priv             A pointer to mlan_private
@param rx_reor_tbl_ptr  A pointer to structure RxReorderTbl


@brief This function will dispatch all packets sequentially from start_win until a hole is found and adjust the start_win appropriately @param priv A pointer to mlan_private @param rx_reor_tbl_ptr A pointer to structure RxReorderTbl
static mlan_status
wlan_11n_scan_and_dispatch(t_void *priv, RxReorderTbl *rx_reor_tbl_ptr)
{
	int i, j, xchg;
	mlan_status ret = MLAN_STATUS_SUCCESS;
	void *rx_tmp_ptr = MNULL;
	mlan_private *pmpriv = (mlan_private *)priv;
	ENTER();
	for (i = 0; i < rx_reor_tbl_ptr->win_size; ++i) {
		pmpriv->adapter->callbacks.moal_spin_lock(pmpriv->adapter->
							  pmoal_handle,
							  pmpriv->rx_pkt_lock);
		if (!rx_reor_tbl_ptr->rx_reorder_ptr[i]) {
			pmpriv->adapter->callbacks.moal_spin_unlock(pmpriv->
								    adapter->
								    pmoal_handle,
								    pmpriv->
								    rx_pkt_lock);
			break;
		}
		rx_tmp_ptr = rx_reor_tbl_ptr->rx_reorder_ptr[i];
		rx_reor_tbl_ptr->rx_reorder_ptr[i] = MNULL;
		pmpriv->adapter->callbacks.moal_spin_unlock(pmpriv->adapter->
							    pmoal_handle,
							    pmpriv->
							    rx_pkt_lock);
		wlan_11n_dispatch_pkt(priv, rx_tmp_ptr, rx_reor_tbl_ptr);
	}
	pmpriv->adapter->callbacks.moal_spin_lock(pmpriv->adapter->pmoal_handle,
						  pmpriv->rx_pkt_lock);
	if (i > 0) {
		xchg = rx_reor_tbl_ptr->win_size - i;
		for (j = 0; j < xchg; ++j) {
			rx_reor_tbl_ptr->rx_reorder_ptr[j] =
				rx_reor_tbl_ptr->rx_reorder_ptr[i + j];
			rx_reor_tbl_ptr->rx_reorder_ptr[i + j] = MNULL;
		}
	}
	rx_reor_tbl_ptr->start_win = (rx_reor_tbl_ptr->start_win + i)
		& (MAX_TID_VALUE - 1);
	pmpriv->adapter->callbacks.moal_spin_unlock(pmpriv->adapter->
						    pmoal_handle,
						    pmpriv->rx_pkt_lock);
	LEAVE();
	return ret;
}
static mlan_status wlan_11n_scan_and_dispatch ( t_void * priv , RxReorderTbl * rx_reor_tbl_ptr ) { int i , j , xchg ; mlan_status ret = MLAN_STATUS_SUCCESS ; void * rx_tmp_ptr = MNULL ; mlan_private * pmpriv = ( mlan_private * ) priv ; ENTER ( ) ; for ( i = 0 ; i < rx_reor_tbl_ptr -> win_size ; ++ i ) { pmpriv -> adapter -> callbacks . moal_spin_lock ( pmpriv -> adapter -> pmoal_handle , pmpriv -> rx_pkt_lock ) ; if ( ! rx_reor_tbl_ptr -> rx_reorder_ptr [ i ] ) { pmpriv -> adapter -> callbacks . moal_spin_unlock ( pmpriv -> adapter -> pmoal_handle , pmpriv -> rx_pkt_lock ) ; break ; } rx_tmp_ptr = rx_reor_tbl_ptr -> rx_reorder_ptr [ i ] ; rx_reor_tbl_ptr -> rx_reorder_ptr [ i ] = MNULL ; pmpriv -> adapter -> callbacks . moal_spin_unlock ( pmpriv -> adapter -> pmoal_handle , pmpriv -> rx_pkt_lock ) ; wlan_11n_dispatch_pkt ( priv , rx_tmp_ptr , rx_reor_tbl_ptr ) ; } pmpriv -> adapter -> callbacks . moal_spin_lock ( pmpriv -> adapter -> pmoal_handle , pmpriv -> rx_pkt_lock ) ; if ( i > 0 ) { xchg = rx_reor_tbl_ptr -> win_size - i ; for ( j = 0 ; j < xchg ; ++ j ) { rx_reor_tbl_ptr -> rx_reorder_ptr [ j ] = rx_reor_tbl_ptr -> rx_reorder_ptr [ i + j ] ; rx_reor_tbl_ptr -> rx_reorder_ptr [ i + j ] = MNULL ; } } rx_reor_tbl_ptr -> start_win = ( rx_reor_tbl_ptr -> start_win + i ) & ( MAX_TID_VALUE - 1 ) ; pmpriv -> adapter -> callbacks . moal_spin_unlock ( pmpriv -> adapter -> pmoal_handle , pmpriv -> rx_pkt_lock ) ; LEAVE ( ) ; return ret ; }
@brief This function will dispatch all packets sequentially
          from start_win until a hole is found and adjust the
          start_win appropriately
@brief This function will dispatch all packets sequentially from start_win until a hole is found and adjust the start_win appropriately
/*
	 * We don't have a circular buffer, hence use rotation to simulate
	 * circular buffer
	 */