atheros_wifi/custom_src/stack_custom/cust_api_stack_txrx.c
A_STATUS custom_send_tcpip
   (
      QOSAL_VOID*          pCxt,
      DRV_BUFFER_PTR       db_ptr,
         /* [IN] the packet to send */
      uint_32              size,
         /* [IN] total size of the packet */
      uint_32              frags,
         /* [IN] total fragments in the packet */
      QOSAL_UINT8*         header,
      uint_32              header_size
      
   )
{ 
    A_STATUS error = A_OK;
    A_NETBUF* a_netbuf_ptr; 
    uint_32 total_hdr_size =  header_size;
    QOSAL_UINT8* payloadPtr = db_ptr->bufFragment[0].payload;
    
    /* create an atheros pcb and continue or fail. */
    do{    	
    	
      /*Get the netbuf pointer from TX packet*/
        a_netbuf_ptr = ((TX_PACKET_PTR)(payloadPtr - TX_PKT_OVERHEAD))->a_netbuf_ptr;

        a_netbuf_ptr->num_frags = (QOSAL_UINT8)frags;   

        A_NETBUF_PUT_DATA(a_netbuf_ptr, (QOSAL_UINT8*)header, total_hdr_size);
    	//ensure there is enough headroom to complete the tx operation
    	if (A_NETBUF_HEADROOM(a_netbuf_ptr) < sizeof(ATH_MAC_HDR) + sizeof(ATH_LLC_SNAP_HDR) +
            		sizeof(WMI_DATA_HDR) + HTC_HDR_LENGTH + WMI_MAX_TX_META_SZ) {
            error = A_NO_MEMORY;
            A_NETBUF_FREE(a_netbuf_ptr);
            break;   		
        }
    	//carry the original around until completion.
    	//it is freed by A_NETBUF_FREE  
    	a_netbuf_ptr->native_orig = db_ptr;       	
        
        if(A_OK != Api_DataTxStart(pCxt, (QOSAL_VOID*)a_netbuf_ptr)){
            error = A_ERROR;
            break;
    	} 	    
   	}while(0);
    
    if(error != A_OK){
		/* in the event of api failure, the original pcb should be returned to the caller un-touched
		 * and the a_netbuf_ptr should be freed */
		if(error != A_NO_MEMORY) 
			A_NETBUF_FREE((QOSAL_VOID*)a_netbuf_ptr);
	}          
    return error;
}
/*****************************************************************************/
/*  Custom_Api_Send - Entry point for driver interface to send a packet.
 *   This function is NOT called from within the driver.
 *      QOSAL_VOID           *pCxt - the driver context.
 *      DRV_BUFFER_PTR       db_ptr - packet object.
 *      uint_32              size - the length in bytes of pcb_ptr.
 *      uint_32              frags - the number of fragments in pcb_ptr.
 *      uint_32              flags - optional flags for transmit.      
 *****************************************************************************/
Entry point for driver interface to send a packet.
This function is NOT called from within the driver.
QOSAL_VOID           *pCxt - the driver context.
Entry point for driver interface to send a packet . This function is NOT called from within the driver . QOSAL_VOID * pCxt - the driver context .
A_STATUS custom_send_tcpip
   (
      QOSAL_VOID*          pCxt,
      DRV_BUFFER_PTR       db_ptr,
      uint_32              size,
      uint_32              frags,
      QOSAL_UINT8*         header,
      uint_32              header_size
   )
{ 
    A_STATUS error = A_OK;
    A_NETBUF* a_netbuf_ptr; 
    uint_32 total_hdr_size =  header_size;
    QOSAL_UINT8* payloadPtr = db_ptr->bufFragment[0].payload;
    do{    	
        a_netbuf_ptr = ((TX_PACKET_PTR)(payloadPtr - TX_PKT_OVERHEAD))->a_netbuf_ptr;
        a_netbuf_ptr->num_frags = (QOSAL_UINT8)frags;   
        A_NETBUF_PUT_DATA(a_netbuf_ptr, (QOSAL_UINT8*)header, total_hdr_size);
    	if (A_NETBUF_HEADROOM(a_netbuf_ptr) < sizeof(ATH_MAC_HDR) + sizeof(ATH_LLC_SNAP_HDR) +
            		sizeof(WMI_DATA_HDR) + HTC_HDR_LENGTH + WMI_MAX_TX_META_SZ) {
            error = A_NO_MEMORY;
            A_NETBUF_FREE(a_netbuf_ptr);
            break;   		
        }
    	a_netbuf_ptr->native_orig = db_ptr;       	
        if(A_OK != Api_DataTxStart(pCxt, (QOSAL_VOID*)a_netbuf_ptr)){
            error = A_ERROR;
            break;
    	} 	    
   	}while(0);
    if(error != A_OK){
		if(error != A_NO_MEMORY) 
			A_NETBUF_FREE((QOSAL_VOID*)a_netbuf_ptr);
	}          
    return error;
}
A_STATUS custom_send_tcpip ( QOSAL_VOID * pCxt , DRV_BUFFER_PTR db_ptr , uint_32 size , uint_32 frags , QOSAL_UINT8 * header , uint_32 header_size ) { A_STATUS error = A_OK ; A_NETBUF * a_netbuf_ptr ; uint_32 total_hdr_size = header_size ; QOSAL_UINT8 * payloadPtr = db_ptr -> bufFragment [ 0 ] . payload ; do { a_netbuf_ptr = ( ( TX_PACKET_PTR ) ( payloadPtr - TX_PKT_OVERHEAD ) ) -> a_netbuf_ptr ; a_netbuf_ptr -> num_frags = ( QOSAL_UINT8 ) frags ; A_NETBUF_PUT_DATA ( a_netbuf_ptr , ( QOSAL_UINT8 * ) header , total_hdr_size ) ; if ( A_NETBUF_HEADROOM ( a_netbuf_ptr ) < sizeof ( ATH_MAC_HDR ) + sizeof ( ATH_LLC_SNAP_HDR ) + sizeof ( WMI_DATA_HDR ) + HTC_HDR_LENGTH + WMI_MAX_TX_META_SZ ) { error = A_NO_MEMORY ; A_NETBUF_FREE ( a_netbuf_ptr ) ; break ; } a_netbuf_ptr -> native_orig = db_ptr ; if ( A_OK != Api_DataTxStart ( pCxt , ( QOSAL_VOID * ) a_netbuf_ptr ) ) { error = A_ERROR ; break ; } } while ( 0 ) ; if ( error != A_OK ) { if ( error != A_NO_MEMORY ) A_NETBUF_FREE ( ( QOSAL_VOID * ) a_netbuf_ptr ) ; } return error ; }
Custom_Api_Send - Entry point for driver interface to send a packet.
Custom_Api_Send - Entry point for driver interface to send a packet .
/* [IN] the packet to send */ /* [IN] total size of the packet */ /* [IN] total fragments in the packet */ /* create an atheros pcb and continue or fail. */ /*Get the netbuf pointer from TX packet*/ //ensure there is enough headroom to complete the tx operation //carry the original around until completion. //it is freed by A_NETBUF_FREE   /* in the event of api failure, the original pcb should be returned to the caller un-touched
		 * and the a_netbuf_ptr should be freed */