software/drivers/sd8887/src/wlan/mlan/mlan_sdio.c
/**
 *  @brief Deaggregate single port aggregation packet
 *
 *  @param pmadapter  A pointer to mlan_adapter structure
 *  @param buf	A pointer to aggregated data packet
 *  @param len
 *
 *  @return		N/A
 */
@brief Deaggregate single port aggregation packet
@param pmadapter  A pointer to mlan_adapter structure
@param buf  A pointer to aggregated data packet
@param len

@return             N/A
@brief Deaggregate single port aggregation packet @param pmadapter A pointer to mlan_adapter structure @param buf A pointer to aggregated data packet @param len @return N / A
void
wlan_decode_spa_buffer(mlan_adapter *pmadapter, t_u8 *buf, t_u32 len)
{
	int total_pkt_len;
	t_u8 block_num = 0;
	t_u16 block_size = 0;
	t_u8 *data;
	t_u32 pkt_len, pkt_type = 0;
	mlan_buffer *mbuf_deaggr = MNULL;
	ENTER();
	data = (t_u8 *)buf;
	total_pkt_len = len;
	if (total_pkt_len < pmadapter->sdio_rx_block_size) {
		PRINTM(MERROR, "Invalid sp aggr packet size=%d\n",
		       total_pkt_len);
		goto done;
	}
	while (total_pkt_len >= (OFFSET_OF_SDIO_HEADER + INTF_HEADER_LEN)) {
		block_num = *(data + OFFSET_OF_BLOCK_NUMBER);
		block_size = pmadapter->sdio_rx_block_size * block_num;
		if (block_size > total_pkt_len) {
			PRINTM(MERROR,
			       "Error in pkt, block_num=%d, pkt_len=%d\n",
			       block_num, total_pkt_len);
			break;
		}
		pkt_len =
			wlan_le16_to_cpu(*(t_u16 *)
					 (data + OFFSET_OF_SDIO_HEADER));
		pkt_type =
			wlan_le16_to_cpu(*(t_u16 *)
					 (data + OFFSET_OF_SDIO_HEADER + 2));
		if ((pkt_len + OFFSET_OF_SDIO_HEADER) > block_size) {
			PRINTM(MERROR,
			       "Error in pkt, pkt_len=%d, block_size=%d\n",
			       pkt_len, block_size);
			break;
		}
		mbuf_deaggr =
			wlan_alloc_mlan_buffer(pmadapter,
					       pkt_len - INTF_HEADER_LEN,
					       MLAN_RX_HEADER_LEN,
					       MOAL_ALLOC_MLAN_BUFFER);
		if (mbuf_deaggr == MNULL) {
			PRINTM(MERROR, "Error allocating daggr mlan_buffer\n");
			break;
		}
		memcpy(pmadapter, mbuf_deaggr->pbuf + mbuf_deaggr->data_offset,
		       data + OFFSET_OF_SDIO_HEADER + INTF_HEADER_LEN,
		       pkt_len - INTF_HEADER_LEN);
		mbuf_deaggr->data_len = pkt_len - INTF_HEADER_LEN;
		wlan_handle_rx_packet(pmadapter, mbuf_deaggr);
		data += block_size;
		total_pkt_len -= block_size;
		if (total_pkt_len < pmadapter->sdio_rx_block_size)
			break;
	}
done:
	LEAVE();
	return;
}
void wlan_decode_spa_buffer ( mlan_adapter * pmadapter , t_u8 * buf , t_u32 len ) { int total_pkt_len ; t_u8 block_num = 0 ; t_u16 block_size = 0 ; t_u8 * data ; t_u32 pkt_len , pkt_type = 0 ; mlan_buffer * mbuf_deaggr = MNULL ; ENTER ( ) ; data = ( t_u8 * ) buf ; total_pkt_len = len ; if ( total_pkt_len < pmadapter -> sdio_rx_block_size ) { PRINTM ( MERROR , " \n " , total_pkt_len ) ; goto done ; } while ( total_pkt_len >= ( OFFSET_OF_SDIO_HEADER + INTF_HEADER_LEN ) ) { block_num = * ( data + OFFSET_OF_BLOCK_NUMBER ) ; block_size = pmadapter -> sdio_rx_block_size * block_num ; if ( block_size > total_pkt_len ) { PRINTM ( MERROR , " \n " , block_num , total_pkt_len ) ; break ; } pkt_len = wlan_le16_to_cpu ( * ( t_u16 * ) ( data + OFFSET_OF_SDIO_HEADER ) ) ; pkt_type = wlan_le16_to_cpu ( * ( t_u16 * ) ( data + OFFSET_OF_SDIO_HEADER + 2 ) ) ; if ( ( pkt_len + OFFSET_OF_SDIO_HEADER ) > block_size ) { PRINTM ( MERROR , " \n " , pkt_len , block_size ) ; break ; } mbuf_deaggr = wlan_alloc_mlan_buffer ( pmadapter , pkt_len - INTF_HEADER_LEN , MLAN_RX_HEADER_LEN , MOAL_ALLOC_MLAN_BUFFER ) ; if ( mbuf_deaggr == MNULL ) { PRINTM ( MERROR , " \n " ) ; break ; } memcpy ( pmadapter , mbuf_deaggr -> pbuf + mbuf_deaggr -> data_offset , data + OFFSET_OF_SDIO_HEADER + INTF_HEADER_LEN , pkt_len - INTF_HEADER_LEN ) ; mbuf_deaggr -> data_len = pkt_len - INTF_HEADER_LEN ; wlan_handle_rx_packet ( pmadapter , mbuf_deaggr ) ; data += block_size ; total_pkt_len -= block_size ; if ( total_pkt_len < pmadapter -> sdio_rx_block_size ) break ; } done : LEAVE ( ) ; return ; }
@brief Deaggregate single port aggregation packet
  @param pmadapter  A pointer to mlan_adapter structure
  @param buf  A pointer to aggregated data packet
  @param len
@brief Deaggregate single port aggregation packet @param pmadapter A pointer to mlan_adapter structure @param buf A pointer to aggregated data packet @param len