X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=fapi_5g%2Fsource%2Fapi%2Ffapi2phy%2Fp7%2Fnr5g_fapi_proc_tx_data_req.c;h=dbb4bf4d64346b3b20313ed71e5a12d093e242ea;hb=2de97529a4c5a1922214ba0e6f0fb84cacbd0bc7;hp=74e631ad18109baab26d757b2499dd37260cb15f;hpb=9d66fca5c45c8b3e0d6eab6d51a90c8e9d2614dc;p=o-du%2Fphy.git diff --git a/fapi_5g/source/api/fapi2phy/p7/nr5g_fapi_proc_tx_data_req.c b/fapi_5g/source/api/fapi2phy/p7/nr5g_fapi_proc_tx_data_req.c index 74e631a..dbb4bf4 100644 --- a/fapi_5g/source/api/fapi2phy/p7/nr5g_fapi_proc_tx_data_req.c +++ b/fapi_5g/source/api/fapi2phy/p7/nr5g_fapi_proc_tx_data_req.c @@ -28,6 +28,7 @@ #include "nr5g_fapi_fapi2phy_api.h" #include "nr5g_fapi_fapi2phy_p7_proc.h" #include "nr5g_fapi_fapi2phy_p7_pvt_proc.h" +#include "nr5g_fapi_memory.h" /** @ingroup group_source_api_p7_fapi2phy_proc * @@ -43,6 +44,7 @@ * **/ uint8_t nr5g_fapi_tx_data_request( + bool is_urllc, p_nr5g_fapi_phy_instance_t p_phy_instance, fapi_tx_data_req_t * p_fapi_req, fapi_vendor_msg_t * p_fapi_vendor_msg) @@ -50,7 +52,6 @@ uint8_t nr5g_fapi_tx_data_request( PTXRequestStruct p_ia_tx_req; PMAC2PHY_QUEUE_EL p_list_elem; nr5g_fapi_stats_t *p_stats; - UNUSED(p_fapi_vendor_msg); if (NULL == p_phy_instance) { NR5G_FAPI_LOG(ERROR_LOG, ("[TX_Data.request] Invalid " "phy instance")); @@ -73,14 +74,14 @@ uint8_t nr5g_fapi_tx_data_request( } p_ia_tx_req = (PTXRequestStruct) (p_list_elem + 1); - nr5g_fapi_tx_data_req_to_phy_translation(p_phy_instance, p_fapi_req, - p_ia_tx_req); - nr5g_fapi_fapi2phy_add_to_api_list(p_list_elem); + nr5g_fapi_tx_data_req_to_phy_translation(p_phy_instance, p_fapi_req, p_fapi_vendor_msg, p_ia_tx_req); + nr5g_fapi_fapi2phy_add_to_api_list(is_urllc, p_list_elem); p_stats->iapi_stats.iapi_tx_req++; - NR5G_FAPI_LOG(DEBUG_LOG, ("[TX_Data.request][%d][%d,%d]", - p_phy_instance->phy_id, p_ia_tx_req->sSFN_Slot.nSFN, - p_ia_tx_req->sSFN_Slot.nSlot)); + NR5G_FAPI_LOG(DEBUG_LOG, ("[TX_Data.request][%u][%u,%u,%u] is_urllc %u", + p_phy_instance->phy_id, + p_ia_tx_req->sSFN_Slot.nSFN, p_ia_tx_req->sSFN_Slot.nSlot, + p_ia_tx_req->sSFN_Slot.nSym, is_urllc)); return SUCCESS; } @@ -100,37 +101,121 @@ uint8_t nr5g_fapi_tx_data_request( uint8_t nr5g_fapi_tx_data_req_to_phy_translation( p_nr5g_fapi_phy_instance_t p_phy_instance, fapi_tx_data_req_t * p_fapi_req, + fapi_vendor_msg_t * p_fapi_vendor_msg, PTXRequestStruct p_phy_req) { - uint16_t idx; - uint32_t tlv; +#define GATHER_SIZE 3 +#define GATHER_PDU_IDX 0 +#define GATHER_CW1 1 +#define GATHER_CW2 2 + int gather[FAPI_MAX_NUMBER_DL_PDUS_PER_TTI][GATHER_SIZE]; + int gathered_count = 0; + uint8_t *tag; + uint32_t length; + uint16_t idx, count, found; fapi_tx_pdu_desc_t *p_fapi_pdu = NULL; PDLPDUDataStruct p_phy_pdu = NULL; + NR5G_FAPI_MEMSET(gather, + (sizeof(int) * FAPI_MAX_NUMBER_DL_PDUS_PER_TTI * 3), -1, + (sizeof(int) * FAPI_MAX_NUMBER_DL_PDUS_PER_TTI * 3)); + NR5G_FAPI_MEMSET(p_phy_req, sizeof(TXRequestStruct), 0, + sizeof(TXRequestStruct)); p_phy_req->sMsgHdr.nMessageType = MSG_TYPE_PHY_TX_REQ; p_phy_req->sMsgHdr.nMessageLen = (uint16_t) sizeof(TXRequestStruct); p_phy_req->sSFN_Slot.nCarrierIdx = p_phy_instance->phy_id; p_phy_req->sSFN_Slot.nSFN = p_fapi_req->sfn; p_phy_req->sSFN_Slot.nSlot = p_fapi_req->slot; + + if (NULL != p_fapi_vendor_msg) { + nr5g_fapi_tx_data_req_to_phy_translation_vendor_ext(p_fapi_vendor_msg, + p_phy_req); + } + p_phy_req->nPDU = p_fapi_req->num_pdus; p_phy_pdu = (PDLPDUDataStruct) (p_phy_req + 1); + for (idx = 0; idx < p_fapi_req->num_pdus; idx++) { + found = FALSE; p_fapi_pdu = &p_fapi_req->pdu_desc[idx]; - for (tlv = 0; tlv < p_fapi_pdu->num_tlvs; tlv++) { + for (count = 0; count < gathered_count; count++) { + if (gather[count][GATHER_PDU_IDX] == p_fapi_pdu->pdu_index) { + found = TRUE; + break; + } + } + + if (found) { + gather[count][GATHER_CW2] = idx; + } else { + if (gathered_count < FAPI_MAX_NUMBER_DL_PDUS_PER_TTI) { + gather[gathered_count][GATHER_PDU_IDX] = p_fapi_pdu->pdu_index; + gather[gathered_count][GATHER_CW1] = idx; + gathered_count++; + } else { + NR5G_FAPI_LOG(ERROR_LOG, + ("exceeded Max DL Pdus supported per tti: %d [%d] ", + gathered_count, FAPI_MAX_NUMBER_DL_PDUS_PER_TTI)); + } + } + } + + for (count = 0; count < gathered_count; count++) { + p_phy_pdu->nPduLen1 = 0; + p_phy_pdu->nPduLen2 = 0; + p_phy_pdu->pPayload1 = NULL; + p_phy_pdu->pPayload2 = NULL; + if (gather[count][GATHER_CW1] >= 0) { + p_fapi_pdu = &p_fapi_req->pdu_desc[gather[count][GATHER_CW1]]; p_phy_pdu->nPduIdx = p_fapi_pdu->pdu_index; - p_phy_pdu->nPduLen1 = 0; - p_phy_pdu->nPduLen2 = 0; - p_phy_pdu->pPayload1 = NULL; - p_phy_pdu->pPayload2 = NULL; - if (tlv == 0) { - p_phy_pdu->nPduLen1 = p_fapi_pdu->tlvs[tlv].tl.length; - p_phy_pdu->pPayload1 = p_fapi_pdu->tlvs[tlv].value; + tag = (uint8_t *) & p_fapi_pdu->tlvs[0].tl.tag; + if (*tag == FAPI_TX_DATA_PTR_TO_PAYLOAD_64) { + tag++; + length = + (((uint32_t) * + tag) << 16) | (uint32_t) p_fapi_pdu->tlvs[0].tl.length; + p_phy_pdu->nPduLen1 = length; + p_phy_pdu->pPayload1 = p_fapi_pdu->tlvs[0].value; } else { - p_phy_pdu->nPduLen2 = p_fapi_pdu->tlvs[tlv].tl.length; - p_phy_pdu->pPayload2 = p_fapi_pdu->tlvs[tlv].value; + NR5G_FAPI_LOG(ERROR_LOG, + ("Only 64 bit Ptr to Payload in TX_DATA.req is supported")); + } + } + if (gather[count][GATHER_CW2] >= 0) { + p_fapi_pdu = &p_fapi_req->pdu_desc[gather[count][GATHER_CW2]]; + tag = (uint8_t *) & p_fapi_pdu->tlvs[0].tl.tag; + if (*tag == FAPI_TX_DATA_PTR_TO_PAYLOAD_64) { + tag++; + length = + (((uint32_t) * + tag) << 16) | (uint32_t) p_fapi_pdu->tlvs[0].tl.length; + p_phy_pdu->nPduLen2 = length; + p_phy_pdu->pPayload2 = p_fapi_pdu->tlvs[0].value; + } else { + NR5G_FAPI_LOG(ERROR_LOG, + ("Only 64 bit Ptr to Payload in TX_DATA.req is supported")); } } p_phy_pdu++; } return SUCCESS; } + + /** @ingroup group_source_api_p7_fapi2phy_proc + * + * @param[in] p_fapi_vendor_msg Pointer to FAPI TX_Data.request structure. + * @param[in] p_ia_tx_req Pointer to IAPI TX_Data.request structure. + * + * @return no return. + * + * @description + * This function fills fields for TX.Data structure that come from + * a vendor extension. + * +**/ +void nr5g_fapi_tx_data_req_to_phy_translation_vendor_ext( + fapi_vendor_msg_t * p_fapi_vendor_msg, + PTXRequestStruct p_phy_req) +{ + p_phy_req->sSFN_Slot.nSym = p_fapi_vendor_msg->p7_req_vendor.tx_data_req.sym; +} \ No newline at end of file