software/drivers/sd8887/src/wlan/mlan/mlan_txrx.c
/**
 *  @brief This function checks the conditions and sends packet to device
 *
 *  @param priv	   A pointer to mlan_private structure
 *  @param pmbuf   A pointer to the mlan_buffer for process
 *  @param tx_param A pointer to mlan_tx_param structure
 *
 *  @return         MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING --success, otherwise failure
 */
@brief This function checks the conditions and sends packet to device
@param priv    A pointer to mlan_private structure
@param pmbuf   A pointer to the mlan_buffer for process
@param tx_param A pointer to mlan_tx_param structure


@brief This function checks the conditions and sends packet to device @param priv A pointer to mlan_private structure @param pmbuf A pointer to the mlan_buffer for process @param tx_param A pointer to mlan_tx_param structure
mlan_status
wlan_process_tx(pmlan_private priv, pmlan_buffer pmbuf, mlan_tx_param *tx_param)
{
	mlan_status ret = MLAN_STATUS_SUCCESS;
	pmlan_adapter pmadapter = priv->adapter;
	t_u8 *head_ptr = MNULL;
#ifdef DEBUG_LEVEL1
	t_u32 sec = 0, usec = 0;
#endif
#ifdef STA_SUPPORT
	TxPD *plocal_tx_pd = MNULL;
#endif
	ENTER();
	head_ptr = (t_u8 *)priv->ops.process_txpd(priv, pmbuf);
	if (!head_ptr) {
		pmbuf->status_code = MLAN_ERROR_PKT_INVALID;
		ret = MLAN_STATUS_FAILURE;
		goto done;
	}
#ifdef STA_SUPPORT
	if (GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_STA)
		plocal_tx_pd = (TxPD *)(head_ptr + priv->intf_hr_len);
#endif
	ret = wlan_sdio_host_to_card(pmadapter, MLAN_TYPE_DATA, pmbuf,
				     tx_param);
done:
	switch (ret) {
	case MLAN_STATUS_RESOURCE:
#ifdef STA_SUPPORT
		if ((GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_STA) &&
		    pmadapter->pps_uapsd_mode &&
		    (pmadapter->tx_lock_flag == MTRUE)) {
			pmadapter->tx_lock_flag = MFALSE;
			plocal_tx_pd->flags = 0;
		}
#endif
		PRINTM(MINFO, "MLAN_STATUS_RESOURCE is returned\n");
		break;
	case MLAN_STATUS_FAILURE:
		pmadapter->data_sent = MFALSE;
		PRINTM(MERROR, "Error: host_to_card failed: 0x%X\n", ret);
		pmadapter->dbg.num_tx_host_to_card_failure++;
		pmbuf->status_code = MLAN_ERROR_DATA_TX_FAIL;
		wlan_write_data_complete(pmadapter, pmbuf, ret);
		break;
	case MLAN_STATUS_PENDING:
		DBG_HEXDUMP(MDAT_D, "Tx", head_ptr + priv->intf_hr_len,
			    MIN(pmbuf->data_len + sizeof(TxPD),
				MAX_DATA_DUMP_LEN));
		break;
	case MLAN_STATUS_SUCCESS:
		DBG_HEXDUMP(MDAT_D, "Tx", head_ptr + priv->intf_hr_len,
			    MIN(pmbuf->data_len + sizeof(TxPD),
				MAX_DATA_DUMP_LEN));
		wlan_write_data_complete(pmadapter, pmbuf, ret);
		break;
	default:
		break;
	}
	if ((ret == MLAN_STATUS_SUCCESS) || (ret == MLAN_STATUS_PENDING)) {
		PRINTM_GET_SYS_TIME(MDATA, &sec, &usec);
		PRINTM_NETINTF(MDATA, priv);
		PRINTM(MDATA, "%lu.%06lu : Data => FW\n", sec, usec);
	}
	LEAVE();
	return ret;
}
mlan_status wlan_process_tx ( pmlan_private priv , pmlan_buffer pmbuf , mlan_tx_param * tx_param ) { mlan_status ret = MLAN_STATUS_SUCCESS ; pmlan_adapter pmadapter = priv -> adapter ; t_u8 * head_ptr = MNULL ; #ifdef DEBUG_LEVEL1 t_u32 sec = 0 , usec = 0 ; #endif #ifdef STA_SUPPORT TxPD * plocal_tx_pd = MNULL ; #endif ENTER ( ) ; head_ptr = ( t_u8 * ) priv -> ops . process_txpd ( priv , pmbuf ) ; if ( ! head_ptr ) { pmbuf -> status_code = MLAN_ERROR_PKT_INVALID ; ret = MLAN_STATUS_FAILURE ; goto done ; } #ifdef STA_SUPPORT if ( GET_BSS_ROLE ( priv ) == MLAN_BSS_ROLE_STA ) plocal_tx_pd = ( TxPD * ) ( head_ptr + priv -> intf_hr_len ) ; #endif ret = wlan_sdio_host_to_card ( pmadapter , MLAN_TYPE_DATA , pmbuf , tx_param ) ; done : switch ( ret ) { case MLAN_STATUS_RESOURCE : #ifdef STA_SUPPORT if ( ( GET_BSS_ROLE ( priv ) == MLAN_BSS_ROLE_STA ) && pmadapter -> pps_uapsd_mode && ( pmadapter -> tx_lock_flag == MTRUE ) ) { pmadapter -> tx_lock_flag = MFALSE ; plocal_tx_pd -> flags = 0 ; } #endif PRINTM ( MINFO , " \n " ) ; break ; case MLAN_STATUS_FAILURE : pmadapter -> data_sent = MFALSE ; PRINTM ( MERROR , " \n " , ret ) ; pmadapter -> dbg . num_tx_host_to_card_failure ++ ; pmbuf -> status_code = MLAN_ERROR_DATA_TX_FAIL ; wlan_write_data_complete ( pmadapter , pmbuf , ret ) ; break ; case MLAN_STATUS_PENDING : DBG_HEXDUMP ( MDAT_D , " " , head_ptr + priv -> intf_hr_len , MIN ( pmbuf -> data_len + sizeof ( TxPD ) , MAX_DATA_DUMP_LEN ) ) ; break ; case MLAN_STATUS_SUCCESS : DBG_HEXDUMP ( MDAT_D , " " , head_ptr + priv -> intf_hr_len , MIN ( pmbuf -> data_len + sizeof ( TxPD ) , MAX_DATA_DUMP_LEN ) ) ; wlan_write_data_complete ( pmadapter , pmbuf , ret ) ; break ; default : break ; } if ( ( ret == MLAN_STATUS_SUCCESS ) || ( ret == MLAN_STATUS_PENDING ) ) { PRINTM_GET_SYS_TIME ( MDATA , & sec , & usec ) ; PRINTM_NETINTF ( MDATA , priv ) ; PRINTM ( MDATA , " \n " , sec , usec ) ; } LEAVE ( ) ; return ret ; }
@brief This function checks the conditions and sends packet to device
  @param priv    A pointer to mlan_private structure
  @param pmbuf   A pointer to the mlan_buffer for process
  @param tx_param A pointer to mlan_tx_param structure
@brief This function checks the conditions and sends packet to device @param priv A pointer to mlan_private structure @param pmbuf A pointer to the mlan_buffer for process @param tx_param A pointer to mlan_tx_param structure