From 4e1f08fd7e7c614a6138b0051a002e94e1f79307 Mon Sep 17 00:00:00 2001 From: Andrew Burger Date: Wed, 22 Jul 2020 12:01:15 -0700 Subject: [PATCH] Debugging after msg4 Problem --- nfapi/oai_integration/nfapi_vnf.c | 144 ++++++++++++++--------------- openair2/PHY_INTERFACE/IF_Module.c | 47 +++++----- 2 files changed, 98 insertions(+), 93 deletions(-) diff --git a/nfapi/oai_integration/nfapi_vnf.c b/nfapi/oai_integration/nfapi_vnf.c index 69d97f48d4..b9111d6125 100644 --- a/nfapi/oai_integration/nfapi_vnf.c +++ b/nfapi/oai_integration/nfapi_vnf.c @@ -440,17 +440,17 @@ int phy_rach_indication(struct nfapi_vnf_p7_config *config, nfapi_rach_indicatio printf("[VNF] RACH_IND eNB:%p sfn_sf:%d number_of_preambles:%d\n", eNB, NFAPI_SFNSF2DEC(ind->sfn_sf), ind->rach_indication_body.number_of_preambles); pthread_mutex_lock(&eNB->UL_INFO_mutex); if(NFAPI_MODE == NFAPI_MODE_VNF){ - int8_t index = -1; - for(uint8_t i= 0;i< NUM_NFPAI_SUBFRAME;i++){ - if((UL_RCC_INFO.rach_ind[i].header.message_id == 0) && (index == -1)){ - index = i; - break; - } - } - if(index == -1){ - LOG_E(MAC,"phy_rach_indication : num of rach reach max \n"); - return 0; - } + int8_t index = NFAPI_SFNSF2SF(ind->sfn_sf); + // for(uint8_t i= 0;i< NUM_NFPAI_SUBFRAME;i++){ + // if((UL_RCC_INFO.rach_ind[i].header.message_id == 0) && (index == -1)){ + // index = i; + // break; + // } + // } + // if(index == -1){ + // LOG_E(MAC,"phy_rach_indication : num of rach reach max \n"); + // return 0; + // } UL_RCC_INFO.rach_ind[index] = *ind; if (ind->rach_indication_body.number_of_preambles > 0) @@ -504,17 +504,17 @@ int phy_harq_indication(struct nfapi_vnf_p7_config *config, nfapi_harq_indicatio LOG_D(MAC, "%s() NFAPI SFN/SF:%d number_of_harqs:%u\n", __FUNCTION__, NFAPI_SFNSF2DEC(ind->sfn_sf), ind->harq_indication_body.number_of_harqs); pthread_mutex_lock(&eNB->UL_INFO_mutex); if(NFAPI_MODE == NFAPI_MODE_VNF){ - int8_t index = -1; - for(uint8_t i= 0;i< NUM_NFPAI_SUBFRAME;i++){ - if((UL_RCC_INFO.harq_ind[i].header.message_id == 0) && (index == -1)){ - index = i; - break; - } - } - if(index == -1){ - LOG_E(MAC,"phy_harq_indication : num of harq reach max \n"); - return 0; - } + int8_t index = NFAPI_SFNSF2SF(ind->sfn_sf); + // for(uint8_t i= 0;i< NUM_NFPAI_SUBFRAME;i++){ + // if((UL_RCC_INFO.harq_ind[i].header.message_id == 0) && (index == -1)){ + // index = i; + // break; + // } + // } + // if(index == -1){ + // LOG_E(MAC,"phy_harq_indication : num of harq reach max \n"); + // return 0; + // } UL_RCC_INFO.harq_ind[index] = *ind; if (ind->harq_indication_body.number_of_harqs > 0) @@ -540,20 +540,20 @@ int phy_crc_indication(struct nfapi_vnf_p7_config *config, nfapi_crc_indication_ struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0]; pthread_mutex_lock(&eNB->UL_INFO_mutex); if(NFAPI_MODE == NFAPI_MODE_VNF){ - int8_t index = -1; - for(uint8_t i= 0;i< NUM_NFPAI_SUBFRAME;i++){ - if((UL_RCC_INFO.crc_ind[i].header.message_id == 0) && (index == -1)){ - index = i; - } - if(UL_RCC_INFO.rx_ind[i].sfn_sf == ind->sfn_sf){ - index = i; - break; - } - } - if(index == -1){ - LOG_E(MAC,"phy_crc_indication : num of crc reach max \n"); - return 0; - } + int8_t index = NFAPI_SFNSF2SF(ind->sfn_sf); + // for(uint8_t i= 0;i< NUM_NFPAI_SUBFRAME;i++){ + // if((UL_RCC_INFO.crc_ind[i].header.message_id == 0) && (index == -1)){ + // index = i; + // } + // if(UL_RCC_INFO.rx_ind[i].sfn_sf == ind->sfn_sf){ + // index = i; + // break; + // } + // } + // if(index == -1){ + // LOG_E(MAC,"phy_crc_indication : num of crc reach max \n"); + // return 0; + // } UL_RCC_INFO.crc_ind[index] = *ind; if (ind->crc_indication_body.number_of_crcs > 0) @@ -605,20 +605,20 @@ int phy_rx_indication(struct nfapi_vnf_p7_config *config, nfapi_rx_indication_t pthread_mutex_lock(&eNB->UL_INFO_mutex); if(NFAPI_MODE == NFAPI_MODE_VNF){ - int8_t index = -1; - for(uint8_t i= 0;i< NUM_NFPAI_SUBFRAME;i++){ - if((UL_RCC_INFO.rx_ind[i].header.message_id == 0) && (index == -1)){ - index = i; - } - if(UL_RCC_INFO.crc_ind[i].sfn_sf == ind->sfn_sf){ - index = i; - break; - } - } - if(index == -1){ - LOG_E(MAC,"phy_rx_indication : num of rx reach max \n"); - return 0; - } + int8_t index = NFAPI_SFNSF2SF(ind->sfn_sf); + // for(uint8_t i= 0;i< NUM_NFPAI_SUBFRAME;i++){ + // if((UL_RCC_INFO.rx_ind[i].header.message_id == 0) && (index == -1)){ + // index = i; + // } + // if(UL_RCC_INFO.crc_ind[i].sfn_sf == ind->sfn_sf){ + // index = i; + // break; + // } + // } + // if(index == -1){ + // LOG_E(MAC,"phy_rx_indication : num of rx reach max \n"); + // return 0; + // } UL_RCC_INFO.rx_ind[index] = *ind; if (ind->rx_indication_body.number_of_pdus > 0) @@ -691,17 +691,17 @@ int phy_sr_indication(struct nfapi_vnf_p7_config *config, nfapi_sr_indication_t LOG_D(MAC, "%s() NFAPI SFN/SF:%d srs:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(ind->sfn_sf), ind->sr_indication_body.number_of_srs); pthread_mutex_lock(&eNB->UL_INFO_mutex); if(NFAPI_MODE == NFAPI_MODE_VNF){ - int8_t index = -1; - for(uint8_t i= 0;i< NUM_NFPAI_SUBFRAME;i++){ - if((UL_RCC_INFO.sr_ind[i].header.message_id == 0) && (index == -1)){ - index = i; - break; - } - } - if(index == -1){ - LOG_E(MAC,"phy_sr_indication : num of sr reach max \n"); - return 0; - } + int8_t index = NFAPI_SFNSF2SF(ind->sfn_sf); + // for(uint8_t i= 0;i< NUM_NFPAI_SUBFRAME;i++){ + // if((UL_RCC_INFO.sr_ind[i].header.message_id == 0) && (index == -1)){ + // index = i; + // break; + // } + // } + // if(index == -1){ + // LOG_E(MAC,"phy_sr_indication : num of sr reach max \n"); + // return 0; + // } UL_RCC_INFO.sr_ind[index] = *ind; LOG_D(MAC,"%s() UL_INFO[%d].sr_ind.sr_indication_body.number_of_srs:%d\n", __FUNCTION__, index, eNB->UL_INFO.sr_ind.sr_indication_body.number_of_srs); if (ind->sr_indication_body.number_of_srs > 0) @@ -742,17 +742,17 @@ int phy_cqi_indication(struct nfapi_vnf_p7_config *config, nfapi_cqi_indication_ LOG_D(MAC, "%s() NFAPI SFN/SF:%d number_of_cqis:%u\n", __FUNCTION__, NFAPI_SFNSF2DEC(ind->sfn_sf), ind->cqi_indication_body.number_of_cqis); pthread_mutex_lock(&eNB->UL_INFO_mutex); if(NFAPI_MODE == NFAPI_MODE_VNF){ - int8_t index = -1; - for(uint8_t i= 0;i< NUM_NFPAI_SUBFRAME;i++){ - if((UL_RCC_INFO.cqi_ind[i].header.message_id == 0) && (index == -1)){ - index = i; - break; - } - } - if(index == -1){ - LOG_E(MAC,"phy_cqi_indication : num of cqi reach max \n"); - return 0; - } + int8_t index = NFAPI_SFNSF2SF(ind->sfn_sf); + // for(uint8_t i= 0;i< NUM_NFPAI_SUBFRAME;i++){ + // if((UL_RCC_INFO.cqi_ind[i].header.message_id == 0) && (index == -1)){ + // index = i; + // break; + // } + // } + // if(index == -1){ + // LOG_E(MAC,"phy_cqi_indication : num of cqi reach max \n"); + // return 0; + // } UL_RCC_INFO.cqi_ind[index] = *ind; if (ind->cqi_indication_body.number_of_cqis > 0){ UL_RCC_INFO.cqi_ind[index].cqi_indication_body.cqi_pdu_list = malloc(sizeof(nfapi_cqi_indication_pdu_t)*ind->cqi_indication_body.number_of_cqis ); diff --git a/openair2/PHY_INTERFACE/IF_Module.c b/openair2/PHY_INTERFACE/IF_Module.c index d98c603d78..5a7f1f9290 100644 --- a/openair2/PHY_INTERFACE/IF_Module.c +++ b/openair2/PHY_INTERFACE/IF_Module.c @@ -22,27 +22,32 @@ extern UL_RCC_IND_t UL_RCC_INFO; uint16_t frame_cnt=0; void handle_rach(UL_IND_t *UL_info) { int i; + int j = UL_info->subframe; - if(NFAPI_MODE == NFAPI_MODE_VNF) { - for(uint8_t j = 0; j < NUM_NFPAI_SUBFRAME; j++) { - if (UL_RCC_INFO.rach_ind[j].rach_indication_body.number_of_preambles>0) { - AssertFatal(UL_RCC_INFO.rach_ind[j].rach_indication_body.number_of_preambles==1,"More than 1 preamble not supported\n"); - LOG_D(MAC,"UL_info[Frame %d, Subframe %d] Calling initiate_ra_proc RACH:SFN/SF:%d\n",UL_info->frame,UL_info->subframe, NFAPI_SFNSF2DEC(UL_RCC_INFO.rach_ind[j].sfn_sf)); - initiate_ra_proc(UL_info->module_id, - UL_info->CC_id, - NFAPI_SFNSF2SFN(UL_RCC_INFO.rach_ind[j].sfn_sf), - NFAPI_SFNSF2SF(UL_RCC_INFO.rach_ind[j].sfn_sf), - UL_RCC_INFO.rach_ind[j].rach_indication_body.preamble_list[0].preamble_rel8.preamble, - UL_RCC_INFO.rach_ind[j].rach_indication_body.preamble_list[0].preamble_rel8.timing_advance, - UL_RCC_INFO.rach_ind[j].rach_indication_body.preamble_list[0].preamble_rel8.rnti, - 0 - ); - free(UL_RCC_INFO.rach_ind[j].rach_indication_body.preamble_list); - UL_RCC_INFO.rach_ind[j].rach_indication_body.number_of_preambles = 0; - UL_RCC_INFO.rach_ind[j].header.message_id = 0; - } + if (NFAPI_MODE == NFAPI_MODE_VNF) + { + LOG_I(MAC, "handle_rach j: %d UL_RCC_INFO.rach_ind[j].rach_indication_body.number_of_preambles: %d\n", + j, UL_RCC_INFO.rach_ind[j].rach_indication_body.number_of_preambles); + if (UL_RCC_INFO.rach_ind[j].rach_indication_body.number_of_preambles > 0) + { + LOG_E(MAC, "UL_info[Frame %d, Subframe %d] Calling initiate_ra_proc RACH:Frame: %d Subframe: %d\n", + UL_info->frame, UL_info->subframe, NFAPI_SFNSF2SFN(UL_RCC_INFO.rach_ind[j].sfn_sf), NFAPI_SFNSF2SF(UL_RCC_INFO.rach_ind[j].sfn_sf)); + AssertFatal(UL_RCC_INFO.rach_ind[j].rach_indication_body.number_of_preambles == 1, "More than 1 preamble not supported\n"); // dump frame/sf and all things in UL_RCC_INFO + initiate_ra_proc(UL_info->module_id, + UL_info->CC_id, + NFAPI_SFNSF2SFN(UL_RCC_INFO.rach_ind[j].sfn_sf), + NFAPI_SFNSF2SF(UL_RCC_INFO.rach_ind[j].sfn_sf), + UL_RCC_INFO.rach_ind[j].rach_indication_body.preamble_list[0].preamble_rel8.preamble, + UL_RCC_INFO.rach_ind[j].rach_indication_body.preamble_list[0].preamble_rel8.timing_advance, + UL_RCC_INFO.rach_ind[j].rach_indication_body.preamble_list[0].preamble_rel8.rnti, + 0); + free(UL_RCC_INFO.rach_ind[j].rach_indication_body.preamble_list); + UL_RCC_INFO.rach_ind[j].rach_indication_body.number_of_preambles = 0; + UL_RCC_INFO.rach_ind[j].header.message_id = 0; } - } else { + } + else + { if (UL_info->rach_ind.rach_indication_body.number_of_preambles>0) { AssertFatal(UL_info->rach_ind.rach_indication_body.number_of_preambles==1,"More than 1 preamble not supported\n"); UL_info->rach_ind.rach_indication_body.number_of_preambles=0; @@ -695,7 +700,7 @@ void UL_indication(UL_IND_t *UL_info, L1_rxtx_proc_t *proc) { Sched_Rsp_t *sched_info = &Sched_INFO[module_id][CC_id]; IF_Module_t *ifi = if_inst[module_id]; eNB_MAC_INST *mac = RC.mac[module_id]; - LOG_D(PHY,"SFN/SF:%d%d module_id:%d CC_id:%d UL_info[rx_ind:%d harqs:%d crcs:%d cqis:%d preambles:%d sr_ind:%d]\n", + LOG_E(PHY,"SFN/SF:%d%d module_id:%d CC_id:%d UL_info[rx_ind:%d harqs:%d crcs:%d cqis:%d preambles:%d sr_ind:%d]\n", UL_info->frame,UL_info->subframe, module_id,CC_id, UL_info->rx_ind.rx_indication_body.number_of_pdus, UL_info->harq_ind.harq_indication_body.number_of_harqs, UL_info->crc_ind.crc_indication_body.number_of_crcs, @@ -787,7 +792,7 @@ IF_Module_t *IF_Module_init(int Mod_id) { AssertFatal(pthread_mutex_init(&if_inst[Mod_id]->if_mutex,NULL)==0, "allocation of if_inst[%d]->if_mutex fails\n",Mod_id); } - + memset(&UL_RCC_INFO, 0, sizeof(UL_RCC_INFO)); return if_inst[Mod_id]; }