/*--------------------------------------------------------------------------- wpalPostTxMsg - Post a message to TX context so it can be processed in that context. Param: pPalContext - A PAL context PAL pMsg - a pointer to called allocated opaque object; ---------------------------------------------------------------------------*/ wpt_status wpalPostTxMsg(void *pPalContext, wpt_msg *pMsg) { wpt_status status = eWLAN_PAL_STATUS_E_FAILURE; vos_msg_t msg; if (NULL == pMsg) { WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR, "%s: NULL message pointer", __FUNCTION__); WPAL_ASSERT(0); return status; } msg.type = 0; //This field is not used because VOSS doesn't check it. msg.reserved = 0; msg.bodyval = 0; msg.bodyptr = pMsg; if(VOS_IS_STATUS_SUCCESS(vos_tx_mq_serialize(VOS_MQ_ID_WDI, &msg))) { status = eWLAN_PAL_STATUS_SUCCESS; } else { WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR, "%s fail to post msg %d\n", __FUNCTION__, pMsg->type); } return status; }
wpt_status wpalPostRxMsg(void *pPalContext, wpt_msg *pMsg) { wpt_status status = eWLAN_PAL_STATUS_E_FAILURE; vos_msg_t msg; if (NULL == pMsg) { WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR, "%s: NULL message pointer", __func__); WPAL_ASSERT(0); return status; } msg.type = 0; msg.reserved = 0; msg.bodyval = 0; msg.bodyptr = pMsg; if(VOS_IS_STATUS_SUCCESS(vos_rx_mq_serialize(VOS_MQ_ID_WDI, &msg))) { status = eWLAN_PAL_STATUS_SUCCESS; } else { WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR, "%s fail to post msg %d", __func__, pMsg->type); } return status; }
/*--------------------------------------------------------------------------- wpalPacketGetRawBuf – Return the starting buffer virtual address for the RAW flat buffer It is inline in hope of faster implementation for certain platform. For Winxp, it will be slow. Param: pPkt - pointer to a wpt_packet. Return: NULL - fail. Otherwise the address of the starting of the buffer ---------------------------------------------------------------------------*/ wpt_uint8 *wpalPacketGetRawBuf(wpt_packet *pPkt) { wpt_uint8 *pRet = NULL; // Validate the parameter pointers if (unlikely(NULL == pPkt)) { WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR, "%s : NULL packet pointer", __func__); return NULL; } //Since it is a flat buffer, all we need is to get one byte of offset 0 if( (eWLAN_PAL_PKT_TYPE_RX_RAW == WPAL_PACKET_GET_TYPE(pPkt)) || (eWLAN_PAL_PKT_TYPE_TX_802_11_MGMT == WPAL_PACKET_GET_TYPE(pPkt)) ) { vos_pkt_peek_data(WPAL_TO_VOS_PKT(pPkt), 0, (v_VOID_t**)&pRet, 1); WPAL_ASSERT(NULL != pRet); } return pRet; }/*wpalPacketGetRawBuf*/
wpt_uint8 *wpalPacketGetRawBuf(wpt_packet *pPkt) { wpt_uint8 *pRet = NULL; // if (unlikely(NULL == pPkt)) { WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR, "%s : NULL packet pointer", __func__); return NULL; } // if( (eWLAN_PAL_PKT_TYPE_RX_RAW == WPAL_PACKET_GET_TYPE(pPkt)) || (eWLAN_PAL_PKT_TYPE_TX_802_11_MGMT == WPAL_PACKET_GET_TYPE(pPkt)) ) { vos_pkt_peek_data(WPAL_TO_VOS_PKT(pPkt), 0, (v_VOID_t**)&pRet, 1); WPAL_ASSERT(NULL != pRet); } return pRet; }/* */
wpt_status wpalPostCtrlMsg(void *pPalContext, wpt_msg *pMsg) { wpt_status status = eWLAN_PAL_STATUS_E_FAILURE; vos_msg_t msg; if (NULL == pMsg) { WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR, "%s: NULL message pointer", __func__); WPAL_ASSERT(0); return status; } if ((WPAL_MC_MSG_SMD_NOTIF_OPEN_SIG == pMsg->type) || (WPAL_MC_MSG_SMD_NOTIF_DATA_SIG == pMsg->type)) { msg.type = pMsg->type; } else { msg.type = 0; } msg.reserved = 0; msg.bodyval = 0; msg.bodyptr = pMsg; if(VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MQ_ID_WDI, &msg))) { status = eWLAN_PAL_STATUS_SUCCESS; } else { WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR, "%s fail to post msg %d", __func__, pMsg->type); } return status; }
/*--------------------------------------------------------------------------- wpalUnlockPacket – Unmap the data buffer from dma so that cpu can regain ownership on it Param: pPacket – pointer to a wpt_packet Return: eWLAN_PAL_STATUS_SUCCESS - success ---------------------------------------------------------------------------*/ wpt_status wpalUnlockPacket( wpt_packet *pPacket) { wpt_iterator_info* pInfo; // Validate the parameter pointers if (unlikely(NULL == pPacket)) { WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR, "%s : NULL input pointer pPacket", __func__); return eWLAN_PAL_STATUS_E_INVAL; } pInfo = (wpt_iterator_info*)pPacket->pInternalData; // Validate pInfo if (unlikely(NULL == pInfo)) { WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_FATAL, "%s : NULL input pointer pInfo", __func__); return eWLAN_PAL_STATUS_E_INVAL; } switch(WPAL_PACKET_GET_TYPE(pPacket)) { /* For management frames, BD is allocated by WDI, header is in raw buffer, rest of the frame is also in raw buffer */ case eWLAN_PAL_PKT_TYPE_TX_802_11_MGMT: { /*TX Packets need to be DMA-ed to the device, perform DMA mapping accordingly */ itReturnOSPktAddrForDevice(pPacket, pInfo->pPhyAddr, pInfo->uLen); } break; /* Data packets - BD (allocated by WDI), header (in VOSS header), rest of the packet (DSM items) */ case eWLAN_PAL_PKT_TYPE_TX_802_11_DATA: case eWLAN_PAL_PKT_TYPE_TX_802_3_DATA: { /*TX Packets need to be DMA-ed to the device, perform DMA mapping accordingly */ itReturnOSPktAddrForDevice(pPacket, pInfo->pPhyAddr, pInfo->uLen); } break; /* For Raw RX, BD + header + rest of the packet is all contained in the raw buffer */ case eWLAN_PAL_PKT_TYPE_RX_RAW: { /*RX Packets need to be DMA-ed from the device, perform DMA mapping accordingly */ if(NULL == pInfo->pPhyAddr) { WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR, " WLAN_PAL: %s: RX frame was not locked properly", __func__); } else { itReturnOSPktAddrFromDevice(pPacket, pInfo->pPhyAddr, pInfo->uLen); } } break; default: { WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR, " WLAN_PAL: %s: Invalid packet type %d!", __func__, WPAL_PACKET_GET_TYPE(pPacket) ); WPAL_ASSERT(0); return eWLAN_PAL_STATUS_E_FAILURE; } } wpalMemoryFree(pInfo); pPacket->pInternalData = NULL; return eWLAN_PAL_STATUS_SUCCESS; }/*wpalUnlockPacket*/
/*--------------------------------------------------------------------------- wpalLockPacketForTransfer – Map the data buffer from dma so that the data is commited from cache and the cpu relinquishes ownership of the buffer Param: pPacket – pointer to a wpt_packet Return: eWLAN_PAL_STATUS_SUCCESS - success ---------------------------------------------------------------------------*/ wpt_status wpalLockPacketForTransfer( wpt_packet *pPacket) { void* pPhyData = NULL; wpt_iterator_info* pInfo = NULL; v_U16_t uLenData = 0; // Validate the parameter pointers if (unlikely(NULL == pPacket)) { WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR, "%s : NULL input pointer", __func__); return eWLAN_PAL_STATUS_E_INVAL; } switch(WPAL_PACKET_GET_TYPE(pPacket)) { /* For management frames, BD is allocated by WDI, header is in raw buffer, rest of the frame is also in raw buffer */ case eWLAN_PAL_PKT_TYPE_TX_802_11_MGMT: { /*TX Packets need to be DMA-ed to the device, perform DMA mapping accordingly */ pPhyData = (void*)itGetOSPktAddrForDevice( pPacket ); } break; /* Data packets - BD (allocated by WDI), header (in VOSS header), rest of the packet (DSM items) */ case eWLAN_PAL_PKT_TYPE_TX_802_11_DATA: case eWLAN_PAL_PKT_TYPE_TX_802_3_DATA: { /*TX Packets need to be DMA-ed to the device, perform DMA mapping accordingly */ pPhyData = (void*)itGetOSPktAddrForDevice( pPacket ); } break; /* For Raw RX, BD + header + rest of the packet is all contained in the raw buffer */ case eWLAN_PAL_PKT_TYPE_RX_RAW: { /*RX Packets need to be DMA-ed from the device, perform DMA mapping accordingly */ pPhyData = (void*)itGetOSPktAddrFromDevice( pPacket ); } break; default: { WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR, " WLAN_PAL: %s: Invalid packet type %d!", __func__, WPAL_PACKET_GET_TYPE(pPacket) ); WPAL_ASSERT(0); return eWLAN_PAL_STATUS_E_FAILURE; } } /*Get packet length*/ vos_pkt_get_packet_length(WPAL_TO_VOS_PKT(pPacket),&uLenData); /*Allocate memory for the current info*/ pInfo = wpalMemoryAllocate( sizeof(wpt_iterator_info) ); // Validate the memory allocation if (unlikely(NULL == pInfo)) { WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR, "%s : Failed to allocate memory ", __func__); return eWLAN_PAL_STATUS_E_INVAL; } pInfo->pPhyAddr = pPhyData; pInfo->uLen = uLenData; pPacket->pInternalData = pInfo; return eWLAN_PAL_STATUS_SUCCESS; }/*wpalLockPacketForTransfer*/
/** @brief This function is used by the DAL Core to to send a message over to the WLAN sub-system. Once a buffer has been passed into the Send Message API, CT takes full ownership of it and it is responsible for freeing the associated resources. (This prevents a memcpy in case of a deferred write) The messages transported through the CT on both RX and TX are flat memory buffers that can be accessed and manipulated through standard memory functions. @param wctsHandlehandle: received upon open pMsg: the message to be sent uLen: the length of the message @see @return 0 for success */ wpt_uint32 WCTS_SendMessage ( WCTS_HandleType wctsHandle, void* pMsg, wpt_uint32 uLen ) { WCTS_ControlBlockType* pWCTSCb = (WCTS_ControlBlockType*) wctsHandle; WCTS_BufferType* pBufferQueue; int len; int written = 0; int available; /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /*-------------------------------------------------------------------- Sanity check --------------------------------------------------------------------*/ if ((NULL == pWCTSCb) || (WCTS_CB_MAGIC != pWCTSCb->wctsMagic) || (NULL == pMsg) || (0 == uLen) || (0x7fffffff < uLen)) { WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR, "WCTS_SendMessage: Invalid parameters received."); WPAL_ASSERT(0); if (NULL != pMsg) { wpalMemoryFree(pMsg); } return eWLAN_PAL_STATUS_E_INVAL; } /* the SMD API uses int instead of uint, so change types here */ len = (int)uLen; if (WCTS_STATE_OPEN == pWCTSCb->wctsState) { available = smd_write_avail(pWCTSCb->wctsChannel); if (available >= len) { written = smd_write(pWCTSCb->wctsChannel, pMsg, len); } } else if (WCTS_STATE_DEFERRED == pWCTSCb->wctsState) { WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO, "WCTS_SendMessage: FIFO space not available, the packets will be queued"); } else { WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR, "WCTS_SendMessage: Channel in illegal state [%d].", pWCTSCb->wctsState); /* force following logic to reclaim the buffer */ written = -1; } if (-1 == written) { /*Something wrong*/ WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR, "WCTS_SendMessage: Failed to send message over the bus."); wpalMemoryFree(pMsg); WPAL_ASSERT(0); return eWLAN_PAL_STATUS_E_FAILURE; } else if (written == len) { /* Message sent! No deferred state, free the buffer*/ wpalMemoryFree(pMsg); } else { /* This much data cannot be written at this time, queue the rest of the data for later*/ pBufferQueue = wpalMemoryAllocate(sizeof(WCTS_BufferType)); if (NULL == pBufferQueue) { WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR, "WCTS_SendMessage: Cannot allocate memory for queuing the buffer"); wpalMemoryFree(pMsg); WPAL_ASSERT(0); return eWLAN_PAL_STATUS_E_NOMEM; } pBufferQueue->bufferSize = len; pBufferQueue->pBuffer = pMsg; wpal_list_insert_back(&pWCTSCb->wctsPendingQueue, &pBufferQueue->node); /* if we are not already in the deferred state, then transition to that state. when we do so, we enable the remote read interrupt so that we'll be notified when messages are read from the remote end */ if (WCTS_STATE_DEFERRED != pWCTSCb->wctsState) { /* Mark the state as deferred. Later: We may need to protect wctsState by locks*/ pWCTSCb->wctsState = WCTS_STATE_DEFERRED; smd_enable_read_intr(pWCTSCb->wctsChannel); } /*indicate to client that message was placed in deferred queue*/ return eWLAN_PAL_STATUS_E_RESOURCES; } return eWLAN_PAL_STATUS_SUCCESS; }/*WCTS_SendMessage*/
/** @brief Callback function for serializing WCTS Read processing in the control context @param pWCTSCb WCTS Control Block @see @return void */ static void WCTS_PALReadCallback ( WCTS_ControlBlockType* pWCTSCb ) { void* buffer; int packet_size; int available; int bytes_read; /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /*-------------------------------------------------------------------- Sanity check --------------------------------------------------------------------*/ if ((NULL == pWCTSCb) || (WCTS_CB_MAGIC != pWCTSCb->wctsMagic)) { WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR, "WCTS_PALReadCallback: Invalid parameter received."); return; } /* iterate until no more packets are available */ while (1) { /* check the length of the next packet */ packet_size = smd_cur_packet_size(pWCTSCb->wctsChannel); if (0 == packet_size) { /* No more data to be read */ return; } /* Check how much of the data is available */ available = smd_read_avail(pWCTSCb->wctsChannel); if (available < packet_size) { /* Entire packet not yet ready to be read -- There will be another notification when it is ready */ return; } buffer = wpalMemoryAllocate(packet_size); if (NULL == buffer) { WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR, "WCTS_PALReadCallback: Memory allocation failure"); WPAL_ASSERT(0); return; } bytes_read = smd_read(pWCTSCb->wctsChannel, buffer, packet_size); if (bytes_read != packet_size) { /*Some problem, do not forward it to WDI.*/ WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR, "WCTS_PALReadCallback: Failed to read data from SMD"); wpalMemoryFree(buffer); WPAL_ASSERT(0); return; } /* forward the message to the registered handler */ pWCTSCb->wctsRxMsgCB((WCTS_HandleType)pWCTSCb, buffer, packet_size, pWCTSCb->wctsRxMsgCBData); /* Free the allocated buffer*/ wpalMemoryFree(buffer); } } /*WCTS_PALReadCallback*/
wpt_uint32 WCTS_SendMessage ( WCTS_HandleType wctsHandle, void* pMsg, wpt_uint32 uLen ) { WCTS_ControlBlockType* pWCTSCb = (WCTS_ControlBlockType*) wctsHandle; WCTS_BufferType* pBufferQueue; int len; int written = 0; int available; if ((NULL == pWCTSCb) || (WCTS_CB_MAGIC != pWCTSCb->wctsMagic) || (NULL == pMsg) || (0 == uLen) || (0x7fffffff < uLen)) { WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR, "WCTS_SendMessage: Invalid parameters received."); WPAL_ASSERT(0); if (NULL != pMsg) { wpalMemoryFree(pMsg); } return eWLAN_PAL_STATUS_E_INVAL; } len = (int)uLen; if (WCTS_STATE_OPEN == pWCTSCb->wctsState) { available = smd_write_avail(pWCTSCb->wctsChannel); if (available >= len) { written = smd_write(pWCTSCb->wctsChannel, pMsg, len); } } else if (WCTS_STATE_DEFERRED == pWCTSCb->wctsState) { WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO, "WCTS_SendMessage: FIFO space not available, the packets will be queued"); } else { WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR, "WCTS_SendMessage: Channel in illegal state [%d].", pWCTSCb->wctsState); written = -1; } if (-1 == written) { WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR, "WCTS_SendMessage: Failed to send message over the bus."); wpalMemoryFree(pMsg); return eWLAN_PAL_STATUS_E_FAILURE; } else if (written == len) { wpalMemoryFree(pMsg); } else { /* This much data cannot be written at this time, queue the rest of the data for later*/ pBufferQueue = wpalMemoryAllocate(sizeof(WCTS_BufferType)); if (NULL == pBufferQueue) { WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR, "WCTS_SendMessage: Cannot allocate memory for queuing the buffer"); wpalMemoryFree(pMsg); WPAL_ASSERT(0); return eWLAN_PAL_STATUS_E_NOMEM; } pBufferQueue->bufferSize = len; pBufferQueue->pBuffer = pMsg; wpal_list_insert_back(&pWCTSCb->wctsPendingQueue, &pBufferQueue->node); if (WCTS_STATE_DEFERRED != pWCTSCb->wctsState) { pWCTSCb->wctsState = WCTS_STATE_DEFERRED; smd_enable_read_intr(pWCTSCb->wctsChannel); } return eWLAN_PAL_STATUS_E_RESOURCES; } return eWLAN_PAL_STATUS_SUCCESS; }
static void WCTS_PALReadCallback ( WCTS_ControlBlockType* pWCTSCb ) { void* buffer; int packet_size; int available; int bytes_read; if ((NULL == pWCTSCb) || (WCTS_CB_MAGIC != pWCTSCb->wctsMagic)) { WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR, "WCTS_PALReadCallback: Invalid parameter received."); return; } while (1) { packet_size = smd_cur_packet_size(pWCTSCb->wctsChannel); if (0 == packet_size) { return; } available = smd_read_avail(pWCTSCb->wctsChannel); if (available < packet_size) { return; } buffer = wpalMemoryAllocate(packet_size); if (NULL == buffer) { WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR, "WCTS_PALReadCallback: Memory allocation failure"); WPAL_ASSERT(0); return; } bytes_read = smd_read(pWCTSCb->wctsChannel, buffer, packet_size); if (bytes_read != packet_size) { WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR, "WCTS_PALReadCallback: Failed to read data from SMD"); wpalMemoryFree(buffer); WPAL_ASSERT(0); return; } pWCTSCb->wctsRxMsgCB((WCTS_HandleType)pWCTSCb, buffer, packet_size, pWCTSCb->wctsRxMsgCBData); wpalMemoryFree(buffer); } }
wpt_status wpalUnlockPacket( wpt_packet *pPacket) { wpt_iterator_info* pInfo; // if (unlikely(NULL == pPacket)) { WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR, "%s : NULL input pointer pPacket", __func__); return eWLAN_PAL_STATUS_E_INVAL; } pInfo = (wpt_iterator_info*)pPacket->pInternalData; // if (unlikely(NULL == pInfo)) { WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_FATAL, "%s : NULL input pointer pInfo", __func__); return eWLAN_PAL_STATUS_E_INVAL; } switch(WPAL_PACKET_GET_TYPE(pPacket)) { /* */ case eWLAN_PAL_PKT_TYPE_TX_802_11_MGMT: { /* */ itReturnOSPktAddrForDevice(pPacket, pInfo->pPhyAddr, pInfo->uLen); } break; /* */ case eWLAN_PAL_PKT_TYPE_TX_802_11_DATA: case eWLAN_PAL_PKT_TYPE_TX_802_3_DATA: { /* */ itReturnOSPktAddrForDevice(pPacket, pInfo->pPhyAddr, pInfo->uLen); } break; /* */ case eWLAN_PAL_PKT_TYPE_RX_RAW: { /* */ if(NULL == pInfo->pPhyAddr) { WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR, " WLAN_PAL: %s: RX frame was not locked properly", __func__); } else { itReturnOSPktAddrFromDevice(pPacket, pInfo->pPhyAddr, pInfo->uLen); } } break; default: { WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR, " WLAN_PAL: %s: Invalid packet type %d!", __func__, WPAL_PACKET_GET_TYPE(pPacket) ); WPAL_ASSERT(0); return eWLAN_PAL_STATUS_E_FAILURE; } } wpalMemoryFree(pInfo); pPacket->pInternalData = NULL; return eWLAN_PAL_STATUS_SUCCESS; }/* */
wpt_status wpalLockPacketForTransfer( wpt_packet *pPacket) { void* pPhyData = NULL; wpt_iterator_info* pInfo = NULL; v_U16_t uLenData = 0; // if (unlikely(NULL == pPacket)) { WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR, "%s : NULL input pointer", __func__); return eWLAN_PAL_STATUS_E_INVAL; } switch(WPAL_PACKET_GET_TYPE(pPacket)) { /* */ case eWLAN_PAL_PKT_TYPE_TX_802_11_MGMT: { /* */ pPhyData = (void*)itGetOSPktAddrForDevice( pPacket ); } break; /* */ case eWLAN_PAL_PKT_TYPE_TX_802_11_DATA: case eWLAN_PAL_PKT_TYPE_TX_802_3_DATA: { /* */ pPhyData = (void*)itGetOSPktAddrForDevice( pPacket ); } break; /* */ case eWLAN_PAL_PKT_TYPE_RX_RAW: { /* */ pPhyData = (void*)itGetOSPktAddrFromDevice( pPacket ); } break; default: { WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR, " WLAN_PAL: %s: Invalid packet type %d!", __func__, WPAL_PACKET_GET_TYPE(pPacket) ); WPAL_ASSERT(0); return eWLAN_PAL_STATUS_E_FAILURE; } } /* */ vos_pkt_get_packet_length(WPAL_TO_VOS_PKT(pPacket),&uLenData); /* */ pInfo = wpalMemoryAllocate( sizeof(wpt_iterator_info) ); // if (unlikely(NULL == pInfo)) { WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR, "%s : Failed to allocate memory ", __func__); return eWLAN_PAL_STATUS_E_INVAL; } pInfo->pPhyAddr = pPhyData; pInfo->uLen = uLenData; pPacket->pInternalData = pInfo; return eWLAN_PAL_STATUS_SUCCESS; }/* */