From e8cfcbe6077af003cead4fe1d09fa29539544e43 Mon Sep 17 00:00:00 2001 From: Melissa Elkadi Date: Fri, 11 Jun 2021 12:35:40 -0700 Subject: [PATCH] CFRA Procedure success commit pt. 1 This commit contains the changes to the OAI code in the NR UE and in nFAPI. - Filling crc_ind for msg3 - Updating pack/unpack of CRC_ind - Creating phy abstraction CRC_ind handling in VNF - Removal of old comments - Only sending on RACH in phy_stub - Calling nr_msg3_transmitted in scheduler for NSA mode --- executables/nr-ue.c | 4 +- nfapi/oai_integration/nfapi_vnf.c | 20 ++++- nfapi/open-nFAPI/nfapi/src/nfapi_p7.c | 77 +++++++++------- .../vnf/public_inc/nfapi_vnf_interface.h | 20 ++++- nfapi/open-nFAPI/vnf/src/vnf_p7.c | 9 +- openair1/SCHED_NR_UE/fapi_nr_ue_l1.c | 38 ++++++-- openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c | 2 +- openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c | 4 +- openair2/NR_PHY_INTERFACE/NR_IF_Module.c | 88 ++++++++----------- openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c | 24 ++++- 10 files changed, 178 insertions(+), 108 deletions(-) diff --git a/executables/nr-ue.c b/executables/nr-ue.c index 51e82c187c..ec5f3395cd 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -159,7 +159,7 @@ static void L1_nsa_prach_procedures(frame_t frame, int slot, fapi_nr_ul_config_p rach_ind->pdu_list[pdu_index].phy_cell_id = prach_pdu->phys_cell_id; rach_ind->pdu_list[pdu_index].symbol_index = prach_pdu->prach_start_symbol; rach_ind->pdu_list[pdu_index].slot_index = prach_pdu->prach_slot; - rach_ind->pdu_list[pdu_index].freq_index = prach_pdu->num_ra; //Melissa Fill these things from the prach pdu + rach_ind->pdu_list[pdu_index].freq_index = prach_pdu->num_ra; rach_ind->pdu_list[pdu_index].avg_rssi = 128; rach_ind->pdu_list[pdu_index].avg_snr = 0xff; // invalid for now @@ -226,6 +226,8 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg) LOG_E(NR_MAC, "mac->ul_config is null! \n"); continue; } + if (mac->ra.ra_state == RA_SUCCEEDED) + continue; mac->ul_config_request[2].number_pdus = 0; fapi_nr_ul_config_prach_pdu *prach_pdu = &ul_config->ul_config_list[ul_config->number_pdus].prach_config_pdu; diff --git a/nfapi/oai_integration/nfapi_vnf.c b/nfapi/oai_integration/nfapi_vnf.c index 6efe3bbb14..60cc6ef8aa 100644 --- a/nfapi/oai_integration/nfapi_vnf.c +++ b/nfapi/oai_integration/nfapi_vnf.c @@ -797,6 +797,22 @@ int phy_crc_indication(struct nfapi_vnf_p7_config *config, nfapi_crc_indication_ return 1; } +int phy_nr_crc_indication(struct nfapi_vnf_p7_config *config, nfapi_nr_crc_indication_t *ind) { + + LOG_I(NR_MAC, "In %s() NFAPI SFN/SF: %d/%d number_of_pdus :%u\n", + __FUNCTION__,ind->sfn, ind->slot, ind->number_crcs); + + if(NFAPI_MODE == NFAPI_MODE_VNF) + { + UL_INFO.crc_ind = *ind; + } + else + { + LOG_E(NR_MAC, "NFAPI_MODE = %d not NFAPI_MODE_VNF(2)\n", nfapi_getmode()); + } + return 1; +} + int phy_rx_indication(struct nfapi_vnf_p7_config *config, nfapi_rx_indication_t *ind) { struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0]; @@ -878,7 +894,7 @@ int phy_rx_indication(struct nfapi_vnf_p7_config *config, nfapi_rx_indication_t int phy_nr_rx_indication(struct nfapi_vnf_p7_config *config, nfapi_nr_rx_data_indication_t *ind) { - LOG_I(MAC, "Melissa in %s() NFAPI SFN/SF: %d/%d number_of_pdus :%u, and pdu %p\n", + LOG_I(NR_MAC, "In %s() NFAPI SFN/SF: %d/%d number_of_pdus :%u, and pdu %p\n", __FUNCTION__,ind->sfn, ind->slot, ind->number_of_pdus, ind->pdu_list[0].pdu); if(NFAPI_MODE == NFAPI_MODE_VNF) @@ -1178,7 +1194,7 @@ void *vnf_nr_p7_thread_start(void *ptr) { p7_vnf->config->sync_indication = &phy_sync_indication; p7_vnf->config->slot_indication = &phy_slot_indication; p7_vnf->config->harq_indication = &phy_harq_indication; - p7_vnf->config->crc_indication = &phy_crc_indication; + p7_vnf->config->nr_crc_indication = &phy_nr_crc_indication; p7_vnf->config->nr_rx_indication = &phy_nr_rx_indication; p7_vnf->config->nr_rach_indication = &phy_nr_rach_indication; p7_vnf->config->srs_indication = &phy_srs_indication; diff --git a/nfapi/open-nFAPI/nfapi/src/nfapi_p7.c b/nfapi/open-nFAPI/nfapi/src/nfapi_p7.c index c10c234d97..972a45e363 100755 --- a/nfapi/open-nFAPI/nfapi/src/nfapi_p7.c +++ b/nfapi/open-nFAPI/nfapi/src/nfapi_p7.c @@ -3382,7 +3382,10 @@ static uint8_t pack_nr_rx_data_indication_body(void* tlv, uint8_t **ppWritePacke push16(value->timing_advance, ppWritePackedMsg, end) && push16(value->rssi, ppWritePackedMsg, end) )) - return 0; + return 0; + + if(pusharray8(value->pdu, value->pdu_length, value->pdu_length, ppWritePackedMsg, end) == 0) + return 0; return 1; } @@ -3395,22 +3398,21 @@ static uint8_t pack_nr_rx_data_indication(void *msg, uint8_t **ppWritePackedMsg, push16(pNfapiMsg->slot , ppWritePackedMsg, end) && push16(pNfapiMsg->number_of_pdus, ppWritePackedMsg, end) )) - return 0; + return 0; - for(int i = 0; i < pNfapiMsg->number_of_pdus; i++) + for (int i = 0; i < pNfapiMsg->number_of_pdus; i++) { if(!pack_nr_rx_data_indication_body(&(pNfapiMsg->pdu_list[i]), ppWritePackedMsg, end)) - return 0; + return 0; } -return 1; + return 1; } //NR CRC INDICATION -static uint8_t pack_nr_crc_indication_body(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +static uint8_t pack_nr_crc_indication_body(nfapi_nr_crc_t* value, uint8_t **ppWritePackedMsg, uint8_t *end) { - nfapi_nr_crc_t* value = (nfapi_nr_crc_t*)tlv; if(!(push32(value->handle, ppWritePackedMsg, end) && push16(value->rnti, ppWritePackedMsg, end) && @@ -3437,9 +3439,9 @@ static uint8_t pack_nr_crc_indication(void *msg, uint8_t **ppWritePackedMsg, uin )) return 0; - for(int i=0; inumber_crcs;i++) + for (int i = 0; i < pNfapiMsg->number_crcs; i++) { - if(!pack_nr_crc_indication_body(pNfapiMsg->crc_list,ppWritePackedMsg,end)) + if(!pack_nr_crc_indication_body(&pNfapiMsg->crc_list[i], ppWritePackedMsg, end)) return 0; } @@ -6365,19 +6367,29 @@ static uint8_t unpack_tx_request(uint8_t **ppReadPackedMsg, uint8_t *end, void * //RX DATA INDICATION -static uint8_t unpack_nr_rx_data_indication_body(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +static uint8_t unpack_nr_rx_data_indication_body(nfapi_nr_rx_data_pdu_t* value, + uint8_t **ppReadPackedMsg, + uint8_t *end, + nfapi_p7_codec_config_t* config) { - nfapi_nr_rx_data_pdu_t* value = (nfapi_nr_rx_data_pdu_t*)tlv; - if(!(pull32(ppReadPackedMsg, &value->handle, end) && pull16(ppReadPackedMsg, &value->rnti, end) && pull8(ppReadPackedMsg, &value->harq_id, end) && pull16(ppReadPackedMsg, &value->pdu_length, end) && pull8(ppReadPackedMsg, &value->ul_cqi, end) && - pull16(ppReadPackedMsg, &value->timing_advance, end) && - pull16(ppReadPackedMsg, &value->rssi, end) + pull16(ppReadPackedMsg, &value->timing_advance, end) && + pull16(ppReadPackedMsg, &value->rssi, end) )) - return 0; + return 0; + + uint16_t length = value->pdu_length; + value->pdu = nfapi_p7_allocate(length, config); + + if (pullarray8(ppReadPackedMsg, value->pdu, length, length, end) == 0) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s pullarray8 failure\n", __FUNCTION__); + return 0; + } return 1; } @@ -6391,14 +6403,15 @@ static uint8_t unpack_nr_rx_data_indication(uint8_t **ppReadPackedMsg, uint8_t * pull16(ppReadPackedMsg, &pNfapiMsg->number_of_pdus, end) )) return 0; - if (pNfapiMsg->number_of_pdus > 0) { + if (pNfapiMsg->number_of_pdus > 0) + { pNfapiMsg->pdu_list = nfapi_p7_allocate(sizeof(*pNfapiMsg->pdu_list) * pNfapiMsg->number_of_pdus, config); } - for(int i=0; i < pNfapiMsg->number_of_pdus; i++) + for (int i = 0; i < pNfapiMsg->number_of_pdus; i++) { - if(!unpack_nr_rx_data_indication_body(&pNfapiMsg->pdu_list[i], ppReadPackedMsg, end)) - return 0; + if(!unpack_nr_rx_data_indication_body(&pNfapiMsg->pdu_list[i], ppReadPackedMsg, end, config)) + return 0; } return 1; @@ -6406,10 +6419,8 @@ return 1; //NR CRC INDICATION -static uint8_t unpack_nr_crc_indication_body(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_nr_crc_t* value = (nfapi_nr_crc_t*)tlv; - +static uint8_t unpack_nr_crc_indication_body(nfapi_nr_crc_t* value, uint8_t **ppReadPackedMsg, uint8_t *end) +{ if(!(pull32(ppReadPackedMsg, &value->handle, end) && pull16(ppReadPackedMsg, &value->rnti, end) && pull8(ppReadPackedMsg, &value->harq_id, end) && @@ -6420,20 +6431,13 @@ static uint8_t unpack_nr_crc_indication_body(void* tlv, uint8_t **ppReadPackedMs pull16(ppReadPackedMsg, &value->timing_advance, end) && pull16(ppReadPackedMsg, &value->rssi, end) )) - return 0; + return 0; return 1; } static uint8_t unpack_nr_crc_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) { - //uint8_t *ptr = *ppReadPackedMsg; - // printf("\n Read P7 message indication unpack: "); - // while(ptr < end){ - // printf(" %d ", *ptr); - // ptr++; - // } - // printf("\n"); nfapi_nr_crc_indication_t *pNfapiMsg = (nfapi_nr_crc_indication_t*)msg; if (!(pull16(ppReadPackedMsg, &pNfapiMsg->sfn , end) && @@ -6442,10 +6446,15 @@ static uint8_t unpack_nr_crc_indication(uint8_t **ppReadPackedMsg, uint8_t *end, )) return 0; - for(int i=0; inumber_crcs;i++) + if (pNfapiMsg->number_crcs > 0) + { + pNfapiMsg->crc_list = nfapi_p7_allocate(sizeof(*pNfapiMsg->crc_list) * pNfapiMsg->number_crcs, config); + } + + for (int i = 0; i < pNfapiMsg->number_crcs; i++) { - if(!unpack_nr_crc_indication_body(&pNfapiMsg->crc_list,ppReadPackedMsg,end)) - return 0; + if(!unpack_nr_crc_indication_body(&pNfapiMsg->crc_list[i], ppReadPackedMsg, end)) + return 0; } return 1; diff --git a/nfapi/open-nFAPI/vnf/public_inc/nfapi_vnf_interface.h b/nfapi/open-nFAPI/vnf/public_inc/nfapi_vnf_interface.h index 5c8180c768..036a0b10d6 100644 --- a/nfapi/open-nFAPI/vnf/public_inc/nfapi_vnf_interface.h +++ b/nfapi/open-nFAPI/vnf/public_inc/nfapi_vnf_interface.h @@ -729,6 +729,20 @@ typedef struct nfapi_vnf_p7_config */ int (*crc_indication)(struct nfapi_vnf_p7_config* config, nfapi_crc_indication_t* ind); + /*! A callback for the nrCRC.indication + * \param config A pointer to the vnf p7 configuration + * \param ind A data structure for the decoded nrCRC.indication This will + * have been allocated on the stack. + * \return not currently used. + * + * The ind may contain pointers to dyanmically allocated sub structures + * such as the pdu. The dyanmically allocated structure will + * be deallocated on return. If the client wishes to 'keep' the structures + * then the substructure pointers should be set to 0 and then the client should + * use the codec_config.deallocate function to release it at a future point + */ + int (*nr_crc_indication)(struct nfapi_vnf_p7_config* config, nfapi_nr_crc_indication_t* ind); + /*! A callback for the RX_ULSCH.indication * \param config A pointer to the vnf p7 configuration * \param ind A data structure for the decoded RX_ULSCH.indication This will @@ -746,9 +760,9 @@ typedef struct nfapi_vnf_p7_config */ int (*rx_indication)(struct nfapi_vnf_p7_config* config, nfapi_rx_indication_t* ind); - /*! A callback for the RACH.indication + /*! A callback for the nrRX.indication * \param config A pointer to the vnf p7 configuration - * \param ind A data structure for the decoded nrRACH.indication This will + * \param ind A data structure for the decoded nrRX.indication This will * have been allocated on the stack. * \return not currently used. * @@ -774,7 +788,7 @@ typedef struct nfapi_vnf_p7_config */ int (*rach_indication)(struct nfapi_vnf_p7_config* config, nfapi_rach_indication_t* ind); - /*! A callback for the RACH.indication + /*! A callback for the nrRACH.indication * \param config A pointer to the vnf p7 configuration * \param ind A data structure for the decoded nrRACH.indication This will * have been allocated on the stack. diff --git a/nfapi/open-nFAPI/vnf/src/vnf_p7.c b/nfapi/open-nFAPI/vnf/src/vnf_p7.c index a961eeee27..3e5caf5af2 100644 --- a/nfapi/open-nFAPI/vnf/src/vnf_p7.c +++ b/nfapi/open-nFAPI/vnf/src/vnf_p7.c @@ -1504,7 +1504,14 @@ void vnf_handle_nr_crc_indication(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_ { NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Failed to unpack message\n", __FUNCTION__); } - + else + { + NFAPI_TRACE(NFAPI_TRACE_INFO, "%s: Handling CRC Indication\n", __FUNCTION__); + if(vnf_p7->_public.nr_crc_indication) + { + (vnf_p7->_public.nr_crc_indication)(&vnf_p7->_public, &ind); + } + } } } diff --git a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c index 306a171dc6..99292994b5 100644 --- a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c +++ b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c @@ -46,13 +46,7 @@ const char *dl_pdu_type[]={"DCI", "DLSCH", "RA_DLSCH"}; const char *ul_pdu_type[]={"PRACH", "PUCCH", "PUSCH", "SRS"}; int8_t nr_ue_scheduled_response_stub(nr_scheduled_response_t *scheduled_response) { - /* Melissa, this is a hack. We are not calling nr_ue_scheduled_response - because it requires PHY_vars_UE_g. We are basically not using layer - one here so we are calling a stub version of this scheduled response. - The original scheduled_response sends downlink information for the DCIs. - The physical layer provides this information. We dont need this yet. - if we have a tx req we need to fill it and may need to go into the ul_config - to get other information. Need rnti., Fill rx_ind that goes up on socket */ + if(scheduled_response != NULL){ if (scheduled_response->ul_config != NULL){ @@ -71,6 +65,7 @@ int8_t nr_ue_scheduled_response_stub(nr_scheduled_response_t *scheduled_response { NR_UL_IND_t UL_INFO; nfapi_nr_rx_data_indication_t *rx_ind = &UL_INFO.rx_ind; + nfapi_nr_crc_indication_t *crc_ind = &UL_INFO.crc_ind; nfapi_nr_ue_pusch_pdu_t *pusch_config_pdu = &ul_config->ul_config_list[i].pusch_config_pdu; if (scheduled_response->tx_request) { @@ -81,16 +76,41 @@ int8_t nr_ue_scheduled_response_stub(nr_scheduled_response_t *scheduled_response fapi_nr_tx_request_body_t *tx_req_body = &scheduled_response->tx_request->tx_request_body[i]; rx_ind->pdu_list = CALLOC(1, sizeof(*rx_ind->pdu_list)); + rx_ind->pdu_list[i].handle = pusch_config_pdu->handle; + rx_ind->pdu_list[i].harq_id = pusch_config_pdu->pusch_data.harq_process_id; rx_ind->pdu_list[i].pdu = tx_req_body->pdu; rx_ind->pdu_list[i].pdu_length = tx_req_body->pdu_length; rx_ind->pdu_list[i].rnti = pusch_config_pdu->rnti; - rx_ind->pdu_list[i].handle = pusch_config_pdu->handle; + rx_ind->pdu_list[i].timing_advance = 0; + rx_ind->pdu_list[i].ul_cqi = 27; + LOG_I(PHY, "In %s: Filled rx_indwith tx_req \n", __FUNCTION__); + scheduled_response->tx_request->number_of_pdus = 0; - LOG_I(PHY, "Melissa In %s: Filled rx_indwith tx_req \n", __FUNCTION__); send_nsa_standalone_msg(&UL_INFO, rx_ind->header.message_id); free(rx_ind->pdu_list); } + if (scheduled_response->ul_config) + { + crc_ind->header.message_id = NFAPI_NR_PHY_MSG_TYPE_CRC_INDICATION; + crc_ind->number_crcs = scheduled_response->ul_config->number_pdus; + crc_ind->sfn = scheduled_response->ul_config->sfn; + crc_ind->slot = scheduled_response->ul_config->slot; + + crc_ind->crc_list = CALLOC(1, sizeof(*crc_ind->crc_list)); + crc_ind->crc_list[i].handle = pusch_config_pdu->handle; + crc_ind->crc_list[i].harq_id = pusch_config_pdu->pusch_data.harq_process_id; + crc_ind->crc_list[i].num_cb = pusch_config_pdu->pusch_data.num_cb; + crc_ind->crc_list[i].rnti = pusch_config_pdu->rnti; + crc_ind->crc_list[i].tb_crc_status = 0; + crc_ind->crc_list[i].timing_advance = 0; + crc_ind->crc_list[i].ul_cqi = 27; + LOG_I(PHY, "In %s: Filled crc_indwith ulconfig\n", __FUNCTION__); + + scheduled_response->ul_config->number_pdus = 0; + send_nsa_standalone_msg(&UL_INFO, crc_ind->header.message_id); + free(crc_ind->crc_list); + } break; } diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c index 63d6afe3da..865db8c81c 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c @@ -467,7 +467,7 @@ void nr_Msg3_transmitted(module_id_t mod_id, uint8_t CC_id, frame_t frameP, uint NR_RACH_ConfigCommon_t *nr_rach_ConfigCommon = mac->scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup; RA_config_t *ra = &mac->ra; - LOG_I(MAC,"Melissa In %s: [UE %d] Frame %d, CB-RA: starting contention resolution timer\n", __FUNCTION__, mod_id, frameP); + LOG_I(MAC,"In %s: [UE %d] Frame %d, CB-RA: starting contention resolution timer\n", __FUNCTION__, mod_id, frameP); // start contention resolution timer ra->RA_contention_resolution_cnt = (nr_rach_ConfigCommon->ra_ContentionResolutionTimer + 1) * 8; diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c index b4ab8956db..99412b7d2c 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c @@ -941,7 +941,7 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in tx_req.tx_request_body[0].pdu_index = j; tx_req.tx_request_body[0].pdu = ulsch_input_buffer; - if (ra->ra_state != RA_SUCCEEDED && !ra->cfra || get_softmodem_params()->nsa && ra->cfra && ra->ra_state==RA_SUCCEEDED){ //Melissa change this accordingly + if (ra->ra_state != RA_SUCCEEDED && !ra->cfra || get_softmodem_params()->nsa && ra->cfra && ra->ra_state==RA_SUCCEEDED){ nr_Msg3_transmitted(ul_info->module_id, ul_info->cc_id, ul_info->frame_tx, ul_info->gNB_index); } } @@ -1021,7 +1021,7 @@ int nr_ue_pusch_scheduler(NR_UE_MAC_INST_t *mac, } - LOG_I(MAC, "Melissa Elkadi In %s: currently at [%d.%d] UL transmission in [%d.%d] (k2 %d delta %d)\n", __FUNCTION__, current_frame, current_slot, *frame_tx, *slot_tx, k2, delta); + LOG_I(MAC, "In %s: currently at [%d.%d] UL transmission in [%d.%d] (k2 %d delta %d)\n", __FUNCTION__, current_frame, current_slot, *frame_tx, *slot_tx, k2, delta); return 0; diff --git a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c index 6d50d56fe1..2275366bcf 100644 --- a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c @@ -117,15 +117,16 @@ void handle_nr_uci(NR_UL_IND_t *UL_info) void handle_nr_ulsch(NR_UL_IND_t *UL_info) { - if (UL_info->rx_ind.number_of_pdus > 0 && UL_info->crc_ind.number_crcs > 0) { - for (int i = 0; i < UL_info->rx_ind.number_of_pdus; i++) { - for (int j = 0; j < UL_info->crc_ind.number_crcs; j++) { + // Melissa: TODO come back and differentiate between global UL_info and passed in arg + if (UL_INFO.rx_ind.number_of_pdus > 0 && UL_INFO.crc_ind.number_crcs > 0) { + for (int i = 0; i < UL_INFO.rx_ind.number_of_pdus; i++) { + for (int j = 0; j < UL_INFO.crc_ind.number_crcs; j++) { // find crc_indication j corresponding rx_indication i - const nfapi_nr_rx_data_pdu_t *rx = &UL_info->rx_ind.pdu_list[i]; - const nfapi_nr_crc_t *crc = &UL_info->crc_ind.crc_list[j]; - LOG_I(PHY, - "UL_info->crc_ind.pdu_list[%d].rnti:%04x " - "UL_info->rx_ind.pdu_list[%d].rnti:%04x\n", + const nfapi_nr_rx_data_pdu_t *rx = &UL_INFO.rx_ind.pdu_list[i]; + const nfapi_nr_crc_t *crc = &UL_INFO.crc_ind.crc_list[j]; + LOG_D(NR_PHY, + "UL_INFO.crc_ind.pdu_list[%d].rnti:%04x " + "UL_INFO.rx_ind.pdu_list[%d].rnti:%04x\n", j, crc->rnti, i, @@ -134,60 +135,43 @@ void handle_nr_ulsch(NR_UL_IND_t *UL_info) if (crc->rnti != rx->rnti) continue; - LOG_D(MAC, + LOG_D(NR_MAC, "%4d.%2d Calling rx_sdu (CRC %s/tb_crc_status %d)\n", - UL_info->frame, - UL_info->slot, + UL_INFO.frame, + UL_INFO.slot, crc->tb_crc_status ? "error" : "ok", crc->tb_crc_status); /* if CRC passes, pass PDU, otherwise pass NULL as error indication */ - //Gokul - // nr_rx_sdu(UL_info->module_id, - // UL_info->CC_id, - // UL_info->rx_ind.sfn, - // UL_info->rx_ind.slot, - // rx->rnti, - // crc->tb_crc_status ? NULL : rx->pdu, - // rx->pdu_length, - // rx->timing_advance, - // rx->ul_cqi, - // rx->rssi); - //handle_nr_ul_harq(UL_info->module_id, UL_info->frame, UL_info->slot, crc); + nr_rx_sdu(UL_INFO.module_id, + UL_INFO.CC_id, + UL_INFO.rx_ind.sfn, + UL_INFO.rx_ind.slot, + rx->rnti, + crc->tb_crc_status ? NULL : rx->pdu, + rx->pdu_length, + rx->timing_advance, + rx->ul_cqi, + rx->rssi); + handle_nr_ul_harq(UL_INFO.module_id, UL_INFO.frame, UL_INFO.slot, crc); break; - } // for (j=0;jcrc_ind.number_crcs;j++) - } // for (i=0;irx_ind.number_of_pdus;i++) + } // for (j=0;jcrc_ind.number_crcs = 0; - UL_info->rx_ind.number_of_pdus = 0; - } else if (UL_info->rx_ind.number_of_pdus != 0 - || UL_info->crc_ind.number_crcs != 0) { - LOG_E(PHY, + UL_INFO.crc_ind.number_crcs = 0; + UL_INFO.rx_ind.number_of_pdus = 0; + } else if (UL_INFO.rx_ind.number_of_pdus != 0 + || UL_INFO.crc_ind.number_crcs != 0) { + LOG_E(NR_PHY, "hoping not to have mis-match between CRC ind and RX ind - " "hopefully the missing message is coming shortly " "rx_ind:%d(SFN/SL:%d/%d) crc_ind:%d(SFN/SL:%d/%d) \n", - UL_info->rx_ind.number_of_pdus, - UL_info->rx_ind.sfn, - UL_info->rx_ind.slot, - UL_info->crc_ind.number_crcs, - UL_info->rx_ind.sfn, - UL_info->rx_ind.slot); - } else if (UL_INFO.rx_ind.number_of_pdus > 0) { - - for (int i = 0; i < UL_INFO.rx_ind.number_of_pdus; i++) - { - nr_rx_sdu(UL_INFO.module_id, - UL_INFO.CC_id, - UL_INFO.frame, - UL_INFO.slot, - UL_INFO.rx_ind.pdu_list[i].rnti, - UL_INFO.rx_ind.pdu_list[i].pdu, - UL_INFO.rx_ind.pdu_list[i].pdu_length, - UL_INFO.rx_ind.pdu_list[i].timing_advance, - UL_INFO.rx_ind.pdu_list[i].ul_cqi, - UL_INFO.rx_ind.pdu_list[i].rssi); - } - + UL_INFO.rx_ind.number_of_pdus, + UL_INFO.rx_ind.sfn, + UL_INFO.rx_ind.slot, + UL_INFO.crc_ind.number_crcs, + UL_INFO.rx_ind.sfn, + UL_INFO.rx_ind.slot); } } diff --git a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c index d4203d0352..0a8cce2c25 100644 --- a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c @@ -134,7 +134,7 @@ void send_nsa_standalone_msg(NR_UL_IND_t *UL_INFO, uint16_t msg_id) case NFAPI_NR_PHY_MSG_TYPE_RACH_INDICATION: { char buffer[NFAPI_MAX_PACKED_MESSAGE_SIZE]; - LOG_I(NR_MAC, "Melissa, this is RACH header id :%d", UL_INFO->rach_ind.header.message_id); + LOG_D(NR_MAC, "RACH header id :%d", UL_INFO->rach_ind.header.message_id); int encoded_size = nfapi_nr_p7_message_pack(&UL_INFO->rach_ind, buffer, sizeof(buffer), NULL); if (encoded_size <= 0) { @@ -154,7 +154,7 @@ void send_nsa_standalone_msg(NR_UL_IND_t *UL_INFO, uint16_t msg_id) case NFAPI_NR_PHY_MSG_TYPE_RX_DATA_INDICATION: { char buffer[NFAPI_MAX_PACKED_MESSAGE_SIZE]; - LOG_I(NR_MAC, "Melissa, this is RX header id :%d", UL_INFO->rx_ind.header.message_id); + LOG_D(NR_MAC, "RX header id :%d", UL_INFO->rx_ind.header.message_id); int encoded_size = nfapi_nr_p7_message_pack(&UL_INFO->rx_ind, buffer, sizeof(buffer), NULL); if (encoded_size <= 0) { @@ -172,7 +172,25 @@ void send_nsa_standalone_msg(NR_UL_IND_t *UL_INFO, uint16_t msg_id) break; } case NFAPI_NR_PHY_MSG_TYPE_CRC_INDICATION: - break; + { + char buffer[NFAPI_MAX_PACKED_MESSAGE_SIZE]; + LOG_D(NR_MAC, "CRC header id :%d", UL_INFO->crc_ind.header.message_id); + int encoded_size = nfapi_nr_p7_message_pack(&UL_INFO->crc_ind, buffer, sizeof(buffer), NULL); + if (encoded_size <= 0) + { + LOG_E(NR_MAC, "nfapi_nr_p7_message_pack has failed. Encoded size = %d\n", encoded_size); + return; + } + + LOG_I(NR_MAC, "NR_CRC_IND sent to Proxy, Size: %d Frame %d Slot %d Num PDUS %d\n", encoded_size, + UL_INFO->crc_ind.sfn, UL_INFO->crc_ind.slot, UL_INFO->crc_ind.number_crcs); + if (send(ue_tx_sock_descriptor, buffer, encoded_size, 0) < 0) + { + LOG_E(NR_MAC, "Send Proxy NR_UE failed\n"); + return; + } + break; + } case NFAPI_NR_PHY_MSG_TYPE_SRS_INDICATION: break; case NFAPI_NR_PHY_MSG_TYPE_UCI_INDICATION: