software/drivers/sd8887/src/wlan/mlan/mlan_sdio.c
/**
 *  @brief This function sends aggr buf
 *
 *  @param pmadapter A pointer to mlan_adapter structure
 *  @return          MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE
 */
@brief This function sends aggr buf
@param pmadapter A pointer to mlan_adapter structure
@return          MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE
@brief This function sends aggr buf @param pmadapter A pointer to mlan_adapter structure @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE
mlan_status
wlan_send_mp_aggr_buf(mlan_adapter *pmadapter)
{
	mlan_status ret = MLAN_STATUS_SUCCESS;
	t_u32 cmd53_port = 0;
	t_u32 port_count = 0;
	mlan_buffer mbuf_aggr;
	t_u8 i = 0;
	t_u8 mp_aggr_pkt_limit = SDIO_MP_AGGR_DEF_PKT_LIMIT;
	ENTER();
	if (!pmadapter->mpa_tx.pkt_cnt) {
		LEAVE();
		return ret;
	}
	PRINTM(MINFO, "host_2_card_mp_aggr: Send aggregation buffer."
	       "%d %d\n", pmadapter->mpa_tx.start_port,
	       pmadapter->mpa_tx.ports);
	memset(pmadapter, &mbuf_aggr, 0, sizeof(mlan_buffer));
	if (!pmadapter->mpa_tx.buf && pmadapter->mpa_tx.pkt_cnt > 1) {
		mbuf_aggr.data_len = pmadapter->mpa_tx.buf_len;
		mbuf_aggr.pnext = mbuf_aggr.pprev = &mbuf_aggr;
		mbuf_aggr.use_count = 0;
		for (i = 0; i < pmadapter->mpa_tx.pkt_cnt; i++)
			wlan_link_buf_to_aggr(&mbuf_aggr,
					      pmadapter->mpa_tx.mbuf_arr[i]);
	} else {
		mbuf_aggr.pbuf = (t_u8 *)pmadapter->mpa_tx.buf;
		mbuf_aggr.data_len = pmadapter->mpa_tx.buf_len;
	}
	port_count = bitcount(pmadapter->mpa_tx.ports) - 1;
	cmd53_port =
		(pmadapter->ioport | SDIO_MPA_ADDR_BASE | (port_count << 8))
		+ pmadapter->mpa_tx.start_port;
	if (pmadapter->mpa_tx.pkt_cnt == 1)
		cmd53_port = pmadapter->ioport + pmadapter->mpa_tx.start_port;
	if (!pmadapter->mpa_tx.buf && pmadapter->mpa_tx.pkt_cnt == 1)
		ret = wlan_write_data_sync(pmadapter,
					   pmadapter->mpa_tx.mbuf_arr[0],
					   cmd53_port);
	else
		ret = wlan_write_data_sync(pmadapter, &mbuf_aggr, cmd53_port);
	if (!pmadapter->mpa_tx.buf) {
		for (i = 0; i < pmadapter->mpa_tx.pkt_cnt; i++) {
			wlan_write_data_complete(pmadapter,
						 pmadapter->mpa_tx.mbuf_arr[i],
						 MLAN_STATUS_SUCCESS);
		}
	}
	if (!(pmadapter->mp_wr_bitmap & (1 << pmadapter->curr_wr_port))
	    && (pmadapter->mpa_tx.pkt_cnt < mp_aggr_pkt_limit))
		pmadapter->mpa_sent_no_ports++;
	pmadapter->mpa_tx_count[pmadapter->mpa_tx.pkt_cnt - 1]++;
	pmadapter->last_mp_wr_bitmap[pmadapter->last_mp_index] =
		pmadapter->mp_wr_bitmap;
	pmadapter->last_mp_wr_ports[pmadapter->last_mp_index] = cmd53_port;
	pmadapter->last_mp_wr_len[pmadapter->last_mp_index] =
		pmadapter->mpa_tx.buf_len;
	pmadapter->last_curr_wr_port[pmadapter->last_mp_index] =
		pmadapter->curr_wr_port;
	memcpy(pmadapter,
	       (t_u8 *)&pmadapter->last_mp_wr_info[pmadapter->last_mp_index *
						   mp_aggr_pkt_limit],
	       (t_u8 *)pmadapter->mpa_tx.mp_wr_info,
	       sizeof(pmadapter->mpa_tx.mp_wr_info)
		);
	pmadapter->last_mp_index++;
	if (pmadapter->last_mp_index >= SDIO_MP_DBG_NUM)
		pmadapter->last_mp_index = 0;
	MP_TX_AGGR_BUF_RESET(pmadapter);
	LEAVE();
	return ret;
}
mlan_status wlan_send_mp_aggr_buf ( mlan_adapter * pmadapter ) { mlan_status ret = MLAN_STATUS_SUCCESS ; t_u32 cmd53_port = 0 ; t_u32 port_count = 0 ; mlan_buffer mbuf_aggr ; t_u8 i = 0 ; t_u8 mp_aggr_pkt_limit = SDIO_MP_AGGR_DEF_PKT_LIMIT ; ENTER ( ) ; if ( ! pmadapter -> mpa_tx . pkt_cnt ) { LEAVE ( ) ; return ret ; } PRINTM ( MINFO , " " " \n " , pmadapter -> mpa_tx . start_port , pmadapter -> mpa_tx . ports ) ; memset ( pmadapter , & mbuf_aggr , 0 , sizeof ( mlan_buffer ) ) ; if ( ! pmadapter -> mpa_tx . buf && pmadapter -> mpa_tx . pkt_cnt > 1 ) { mbuf_aggr . data_len = pmadapter -> mpa_tx . buf_len ; mbuf_aggr . pnext = mbuf_aggr . pprev = & mbuf_aggr ; mbuf_aggr . use_count = 0 ; for ( i = 0 ; i < pmadapter -> mpa_tx . pkt_cnt ; i ++ ) wlan_link_buf_to_aggr ( & mbuf_aggr , pmadapter -> mpa_tx . mbuf_arr [ i ] ) ; } else { mbuf_aggr . pbuf = ( t_u8 * ) pmadapter -> mpa_tx . buf ; mbuf_aggr . data_len = pmadapter -> mpa_tx . buf_len ; } port_count = bitcount ( pmadapter -> mpa_tx . ports ) - 1 ; cmd53_port = ( pmadapter -> ioport | SDIO_MPA_ADDR_BASE | ( port_count << 8 ) ) + pmadapter -> mpa_tx . start_port ; if ( pmadapter -> mpa_tx . pkt_cnt == 1 ) cmd53_port = pmadapter -> ioport + pmadapter -> mpa_tx . start_port ; if ( ! pmadapter -> mpa_tx . buf && pmadapter -> mpa_tx . pkt_cnt == 1 ) ret = wlan_write_data_sync ( pmadapter , pmadapter -> mpa_tx . mbuf_arr [ 0 ] , cmd53_port ) ; else ret = wlan_write_data_sync ( pmadapter , & mbuf_aggr , cmd53_port ) ; if ( ! pmadapter -> mpa_tx . buf ) { for ( i = 0 ; i < pmadapter -> mpa_tx . pkt_cnt ; i ++ ) { wlan_write_data_complete ( pmadapter , pmadapter -> mpa_tx . mbuf_arr [ i ] , MLAN_STATUS_SUCCESS ) ; } } if ( ! ( pmadapter -> mp_wr_bitmap & ( 1 << pmadapter -> curr_wr_port ) ) && ( pmadapter -> mpa_tx . pkt_cnt < mp_aggr_pkt_limit ) ) pmadapter -> mpa_sent_no_ports ++ ; pmadapter -> mpa_tx_count [ pmadapter -> mpa_tx . pkt_cnt - 1 ] ++ ; pmadapter -> last_mp_wr_bitmap [ pmadapter -> last_mp_index ] = pmadapter -> mp_wr_bitmap ; pmadapter -> last_mp_wr_ports [ pmadapter -> last_mp_index ] = cmd53_port ; pmadapter -> last_mp_wr_len [ pmadapter -> last_mp_index ] = pmadapter -> mpa_tx . buf_len ; pmadapter -> last_curr_wr_port [ pmadapter -> last_mp_index ] = pmadapter -> curr_wr_port ; memcpy ( pmadapter , ( t_u8 * ) & pmadapter -> last_mp_wr_info [ pmadapter -> last_mp_index * mp_aggr_pkt_limit ] , ( t_u8 * ) pmadapter -> mpa_tx . mp_wr_info , sizeof ( pmadapter -> mpa_tx . mp_wr_info ) ) ; pmadapter -> last_mp_index ++ ; if ( pmadapter -> last_mp_index >= SDIO_MP_DBG_NUM ) pmadapter -> last_mp_index = 0 ; MP_TX_AGGR_BUF_RESET ( pmadapter ) ; LEAVE ( ) ; return ret ; }
@brief This function sends aggr buf
  @param pmadapter A pointer to mlan_adapter structure
  @return          MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE
@brief This function sends aggr buf @param pmadapter A pointer to mlan_adapter structure @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE
/** only one packet */ /** free mlan buffer */