From 506000cdc9f992b8dcdb0bad2ea6a1709a40f113 Mon Sep 17 00:00:00 2001 From: Andrew Burger Date: Sat, 5 Sep 2020 10:30:32 -0700 Subject: [PATCH 01/31] Saving work --- nfapi/open-nFAPI/vnf/src/vnf_p7.c | 1 + openair2/COMMON/platform_constants.h | 2 +- openair2/LAYER2/MAC/eNB_scheduler.c | 22 ++++++++++++++++++---- openair2/LAYER2/MAC/rar_tools_ue.c | 4 +++- openair2/PHY_INTERFACE/phy_stub_UE.c | 3 ++- targets/RT/USER/lte-ue.c | 13 +++++++++---- 6 files changed, 34 insertions(+), 11 deletions(-) diff --git a/nfapi/open-nFAPI/vnf/src/vnf_p7.c b/nfapi/open-nFAPI/vnf/src/vnf_p7.c index d852893545..d06e5bfe4e 100644 --- a/nfapi/open-nFAPI/vnf/src/vnf_p7.c +++ b/nfapi/open-nFAPI/vnf/src/vnf_p7.c @@ -1269,6 +1269,7 @@ void vnf_handle_timing_info(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7) if (vnf_p7 && vnf_p7->p7_connections) { int16_t vnf_pnf_sfnsf_delta = NFAPI_SFNSF2DEC(vnf_p7->p7_connections[0].sfn_sf) - NFAPI_SFNSF2DEC(ind.last_sfn_sf); + printf("vnf_pnf_sfnsf_delta = %d adjusting now\n", vnf_pnf_sfnsf_delta); fflush(stdout); //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() PNF:SFN/SF:%d VNF:SFN/SF:%d deltaSFNSF:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(ind.last_sfn_sf), NFAPI_SFNSF2DEC(vnf_p7->p7_connections[0].sfn_sf), vnf_pnf_sfnsf_delta); diff --git a/openair2/COMMON/platform_constants.h b/openair2/COMMON/platform_constants.h index 1eb58b16b2..8749b876b0 100644 --- a/openair2/COMMON/platform_constants.h +++ b/openair2/COMMON/platform_constants.h @@ -84,7 +84,7 @@ #define MAX_eNB 2 #define MAX_gNB 2 #else - #define MAX_MOBILES_PER_ENB 4 + #define MAX_MOBILES_PER_ENB 20 // This was maxed at 4 Why? -Andrew #define MAX_MOBILES_PER_ENB_NB_IoT 4 #define MAX_MOBILES_PER_GNB 2//16 #define MAX_eNB 2 diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c index b1fa26379a..d43e8fee2e 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler.c +++ b/openair2/LAYER2/MAC/eNB_scheduler.c @@ -571,16 +571,30 @@ eNB_dlsch_ulsch_scheduler(module_id_t module_idP, UE_sched_ctrl_t *UE_scheduling_control = NULL; start_meas(&(eNB->eNB_scheduler)); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ULSCH_SCHEDULER, VCD_FUNCTION_IN); - - if ((frameP == eNB->frame && subframeP <= eNB->subframe) || (frameP == ((eNB->frame + 1023) & 1023))) + // TODO: Better solution needed this is the first + // 3 indications of this function on startup + // 1303275.278188 [MAC] XXX 0.0 -> 0.4 = 4 + // 1303275.279443 [MAC] XXX 0.4 -> 639.5 = 6391 + // 1303275.348686 [MAC] XXX 646.3 -> 646.3 = 0 + int delta = (frameP * 10 + subframeP) - (eNB->frame * 10 + eNB->subframe); + if (delta < 0) { - LOG_E(MAC, "Scheduler being called twice for same subframe SF.SFN: %u.%u\n", frameP, subframeP); + delta += 10240; // sfn_sf decimal values range from 0 to 10239 + } + // If we ever see a difference this big something is very wrong + // This threshold is arbitrary + if (delta > 8500 || delta == 0) // 900 frames + { + LOG_I(MAC, "scheduler ignoring outerspace %d.%d -> %d.%d = %d\n", + eNB->frame, eNB->subframe, frameP, subframeP, delta); return; } + LOG_I(MAC, "Entering dlsch_ulsch scheduler %d.%d -> %d.%d = %d\n", + eNB->frame, eNB->subframe, frameP, subframeP, delta); + eNB->frame = frameP; eNB->subframe = subframeP; - LOG_I(MAC, "Entering dlsch_ulsch scheduler Frame: %u Subframe: %u\n", frameP, subframeP); for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { mbsfn_status[CC_id] = 0; /* Clear vrb_maps */ diff --git a/openair2/LAYER2/MAC/rar_tools_ue.c b/openair2/LAYER2/MAC/rar_tools_ue.c index 611aaf865b..865165f4cd 100644 --- a/openair2/LAYER2/MAC/rar_tools_ue.c +++ b/openair2/LAYER2/MAC/rar_tools_ue.c @@ -67,6 +67,7 @@ uint16_t ue_process_rar(const module_id_t module_idP, const int CC_id, const fra LOG_D(PHY, "Found RAR with the intended RAPID %d\n", rarh->RAPID); rar = (uint8_t *) (dlsch_buffer + n_rarh + (n_rarpy - 1) * 6); + UE_mac_inst[module_idP].UE_mode[0] = RA_RESPONSE; break; } @@ -77,9 +78,10 @@ uint16_t ue_process_rar(const module_id_t module_idP, const int CC_id, const fra } if (rarh->E == 0) { - LOG_I(PHY, + LOG_I(MAC, "No RAR found with the intended RAPID. The closest RAPID in all RARs is %d\n", best_rx_rapid); + UE_mac_inst[module_idP].UE_mode[0] = PRACH; break; } else { rarh++; diff --git a/openair2/PHY_INTERFACE/phy_stub_UE.c b/openair2/PHY_INTERFACE/phy_stub_UE.c index d9f5e2cbaa..7493ac5479 100644 --- a/openair2/PHY_INTERFACE/phy_stub_UE.c +++ b/openair2/PHY_INTERFACE/phy_stub_UE.c @@ -832,7 +832,8 @@ void dl_config_req_UE_MAC_dci(int sfn, &UE_mac_inst[ue_id].crnti, //t-crnti UE_mac_inst[ue_id].RA_prach_resources.ra_PreambleIndex, tx_request_pdu_list[pdu_index].segments[0].segment_data); - UE_mac_inst[ue_id].UE_mode[0] = RA_RESPONSE; + // UE_mac_inst[ue_id].UE_mode[0] = RA_RESPONSE; + LOG_I(MAC, "setting UE_MODE now: %d\n", UE_mac_inst[ue_id].UE_mode[0]); // Expecting an UL_CONFIG_ULSCH_PDU to enable Msg3 Txon (first // ULSCH Txon for the UE) UE_mac_inst[ue_id].first_ULSCH_Tx = 1; diff --git a/targets/RT/USER/lte-ue.c b/targets/RT/USER/lte-ue.c index b7b9114aee..554a564e95 100644 --- a/targets/RT/USER/lte-ue.c +++ b/targets/RT/USER/lte-ue.c @@ -1166,16 +1166,21 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg) if (UE->mode != loop_through_memory) { // We make the start of RA between consecutive UEs differ by 20 frames //if ((UE_mac_inst[Mod_id].UE_mode[0] == PRACH && Mod_id == 0) || (UE_mac_inst[Mod_id].UE_mode[0] == PRACH && Mod_id>0 && rx_frame >= UE_mac_inst[Mod_id-1].ra_frame + 20) ) { - if (UE_mac_inst[ue_Mod_id].UE_mode[0] == PRACH && ue_Mod_id == next_Mod_id) { + LOG_I(MAC, "UE_mode: %d\n", UE_mac_inst[ue_Mod_id].UE_mode[0]); + if (UE_mac_inst[ue_Mod_id].UE_mode[0] == PRACH) { //&& ue_Mod_id == next_Mod_id) { next_ra_frame++; - if (next_ra_frame > 500) { + // if (next_ra_frame > 500) { // check if we have PRACH opportunity + LOG_I(MAC, "is_prach_subframe(): %d\n", + is_prach_subframe(&UE->frame_parms, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf))); if (is_prach_subframe(&UE->frame_parms, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf)) && UE_mac_inst[ue_Mod_id].SI_Decoded == 1) { // The one working strangely... //if (is_prach_subframe(&UE->frame_parms,NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf) && Mod_id == (module_id_t) init_ra_UE) ) { PRACH_RESOURCES_t *prach_resources = ue_get_rach(ue_Mod_id, 0, NFAPI_SFNSF2SFN(sfn_sf), 0, NFAPI_SFNSF2SF(sfn_sf)); if (prach_resources != NULL) { - UE_mac_inst[ue_Mod_id].ra_frame = rx_frame; + LOG_I(MAC, "preamble_received_tar_power: %d\n", + prach_resources->ra_PREAMBLE_RECEIVED_TARGET_POWER); + UE_mac_inst[ue_Mod_id].ra_frame = NFAPI_SFNSF2SFN(sfn_sf); // Is this why RACH comes in late to proxy? - Andrew LOG_D(MAC, "UE_phy_stub_thread_rxn_txnp4 before RACH, Mod_id: %d frame %d subframe %d\n", ue_Mod_id, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf)); fill_rach_indication_UE_MAC(ue_Mod_id, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf), UL_INFO, prach_resources->ra_PreambleIndex, prach_resources->ra_RNTI); sent_any = true; @@ -1188,7 +1193,7 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg) //ue_prach_procedures(ue,proc,eNB_id,abstraction_flag,mode); } - } + // } } // mode is PRACH // Substitute call to phy_procedures Tx with call to phy_stub functions in order to trigger From 851170379c535bb7a4415b2bdf8c552b78f8e0fe Mon Sep 17 00:00:00 2001 From: Andrew Burger Date: Sun, 6 Sep 2020 11:01:17 -0700 Subject: [PATCH 02/31] Log_As --- nfapi/oai_integration/nfapi_vnf.c | 2 +- targets/RT/USER/lte-ue.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/nfapi/oai_integration/nfapi_vnf.c b/nfapi/oai_integration/nfapi_vnf.c index 388b4441b3..3a7da25aea 100644 --- a/nfapi/oai_integration/nfapi_vnf.c +++ b/nfapi/oai_integration/nfapi_vnf.c @@ -1182,7 +1182,7 @@ int oai_nfapi_dl_config_req(nfapi_dl_config_request_t *dl_config_req) { { uint16_t dl_rnti = dl_config_req->dl_config_request_body.dl_config_pdu_list[i].dlsch_pdu.dlsch_pdu_rel8.rnti; uint16_t numPDUs = dl_config_req->dl_config_request_body.number_pdu; - LOG_I(MAC, "(OAI eNB) Sending dl_config_req at VNF during Frame: %d and Subframe: %d," + LOG_A(MAC, "(OAI eNB) Sending dl_config_req at VNF during Frame: %d and Subframe: %d," " with a RNTI value of: %x and with number of PDUs: %u\n", NFAPI_SFNSF2SFN(dl_config_req->sfn_sf),NFAPI_SFNSF2SF(dl_config_req->sfn_sf), dl_rnti, numPDUs); } diff --git a/targets/RT/USER/lte-ue.c b/targets/RT/USER/lte-ue.c index 554a564e95..9c916be4d7 100644 --- a/targets/RT/USER/lte-ue.c +++ b/targets/RT/USER/lte-ue.c @@ -1048,7 +1048,7 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg) NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf)); if (dl_config_req != NULL) { uint16_t dl_num_pdus = dl_config_req->dl_config_request_body.number_pdu; - LOG_W(MAC, "(OAI UE) Received dl_config_req from proxy at Frame: %d, Subframe: %d," + LOG_A(MAC, "(OAI UE) Received dl_config_req from proxy at Frame: %d, Subframe: %d," " with number of PDUs: %u\n", NFAPI_SFNSF2SFN(dl_config_req->sfn_sf), NFAPI_SFNSF2SF(dl_config_req->sfn_sf), dl_num_pdus); From 3483f7ad36e83352ca4dd629886829ff50d390f0 Mon Sep 17 00:00:00 2001 From: Andrew Burger Date: Sun, 6 Sep 2020 11:31:55 -0700 Subject: [PATCH 03/31] New timing members --- openair2/PHY_INTERFACE/phy_stub_UE.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/openair2/PHY_INTERFACE/phy_stub_UE.c b/openair2/PHY_INTERFACE/phy_stub_UE.c index 7493ac5479..b79cb96180 100644 --- a/openair2/PHY_INTERFACE/phy_stub_UE.c +++ b/openair2/PHY_INTERFACE/phy_stub_UE.c @@ -948,6 +948,9 @@ int memcpy_dl_config_req(L1_rxtx_proc_t *proc, req->dl_config_request_body.dl_config_pdu_list[i]; } + LOG_A(MAC, "dl_config_req in memcpy Frame: %d Subframe: %d", + p->sfn_sf >> 4, p->sfn_sf & 15); + if (!put_queue(&dl_config_req_queue, p)) { free(p); } @@ -1214,6 +1217,8 @@ void *ue_standalone_pnf_task(void *context) } else { + LOG_A(MAC, "dl_config_req fresh off socket Frame: %d Subframe: %d", + dl_config_req.sfn_sf >> 4, dl_config_req.sfn_sf & 15); // check to see if dl_config_req is null memcpy_dl_config_req(NULL, NULL, &dl_config_req); } From d089d4a28969df86f17558ca5d87a49a7585ad1b Mon Sep 17 00:00:00 2001 From: Andrew Burger Date: Sun, 6 Sep 2020 11:45:18 -0700 Subject: [PATCH 04/31] Additional warning/Analysis logs --- openair2/PHY_INTERFACE/phy_stub_UE.c | 4 ++-- targets/RT/USER/lte-ue.c | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/openair2/PHY_INTERFACE/phy_stub_UE.c b/openair2/PHY_INTERFACE/phy_stub_UE.c index b79cb96180..f7967b0111 100644 --- a/openair2/PHY_INTERFACE/phy_stub_UE.c +++ b/openair2/PHY_INTERFACE/phy_stub_UE.c @@ -948,7 +948,7 @@ int memcpy_dl_config_req(L1_rxtx_proc_t *proc, req->dl_config_request_body.dl_config_pdu_list[i]; } - LOG_A(MAC, "dl_config_req in memcpy Frame: %d Subframe: %d", + LOG_A(MAC, "dl_config_req in memcpy Frame: %d Subframe: %d\n", p->sfn_sf >> 4, p->sfn_sf & 15); if (!put_queue(&dl_config_req_queue, p)) { @@ -1217,7 +1217,7 @@ void *ue_standalone_pnf_task(void *context) } else { - LOG_A(MAC, "dl_config_req fresh off socket Frame: %d Subframe: %d", + LOG_A(MAC, "dl_config_req fresh off socket Frame: %d Subframe: %d\n", dl_config_req.sfn_sf >> 4, dl_config_req.sfn_sf & 15); // check to see if dl_config_req is null memcpy_dl_config_req(NULL, NULL, &dl_config_req); diff --git a/targets/RT/USER/lte-ue.c b/targets/RT/USER/lte-ue.c index 9c916be4d7..ab19ff9741 100644 --- a/targets/RT/USER/lte-ue.c +++ b/targets/RT/USER/lte-ue.c @@ -1030,6 +1030,7 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg) int num_pairs = 0; int num_lone = 0; + int last_sfn_sf = -1; while (!oai_exit) { bool sent_any = false; @@ -1037,7 +1038,14 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg) LOG_E(MAC, "sem_wait() error\n"); abort(); } + int sfn_sf = current_sfn_sf; + if (sfn_sf == last_sfn_sf) + { + LOG_W(MAC, "repeated sfn_sf = %d.%d\n", + sfn_sf >> 4, sfn_sf & 15); + } + last_sfn_sf = sfn_sf; nfapi_dl_config_request_t *dl_config_req = get_queue(&dl_config_req_queue); nfapi_tx_request_pdu_t *tx_request_pdu_list = get_queue(&tx_req_pdu_queue); From 465f1a77e049125fc442ba6af2f00b512f72291f Mon Sep 17 00:00:00 2001 From: Andrew Burger Date: Tue, 8 Sep 2020 10:31:36 -0700 Subject: [PATCH 05/31] New prach procedures --- openair2/COMMON/platform_constants.h | 4 +- openair2/LAYER2/MAC/ue_procedures.c | 2 +- openair2/PHY_INTERFACE/phy_stub_UE.c | 2 +- targets/RT/USER/lte-ue.c | 57 ++++++++++++++++------------ 4 files changed, 36 insertions(+), 29 deletions(-) diff --git a/openair2/COMMON/platform_constants.h b/openair2/COMMON/platform_constants.h index 8749b876b0..f5bcb82c00 100644 --- a/openair2/COMMON/platform_constants.h +++ b/openair2/COMMON/platform_constants.h @@ -84,8 +84,8 @@ #define MAX_eNB 2 #define MAX_gNB 2 #else - #define MAX_MOBILES_PER_ENB 20 // This was maxed at 4 Why? -Andrew - #define MAX_MOBILES_PER_ENB_NB_IoT 4 + #define MAX_MOBILES_PER_ENB 256 // This was maxed at 4 Why? -Andrew + #define MAX_MOBILES_PER_ENB_NB_IoT 256 #define MAX_MOBILES_PER_GNB 2//16 #define MAX_eNB 2 #define MAX_gNB 2 diff --git a/openair2/LAYER2/MAC/ue_procedures.c b/openair2/LAYER2/MAC/ue_procedures.c index 531aee0267..3161a0ed57 100644 --- a/openair2/LAYER2/MAC/ue_procedures.c +++ b/openair2/LAYER2/MAC/ue_procedures.c @@ -2603,7 +2603,7 @@ ue_scheduler(const module_id_t module_idP, if(NFAPI_MODE==NFAPI_UE_STUB_PNF || NFAPI_MODE==NFAPI_MODE_STANDALONE_PNF) { // phy_stub mode // Modification for phy_stub mode operation here. We only need to make sure that the ue_mode is back to // PRACH state. - LOG_I(MAC, "nfapi_mode3: Setting UE_mode to PRACH 2 \n"); + LOG_A(MAC, "nfapi_mode3: Setting UE_mode to PRACH 2 \n"); UE_mac_inst[module_idP].UE_mode[eNB_indexP] = PRACH; //ra_failed(module_idP,CC_id,eNB_index);UE_mac_inst[module_idP].RA_contention_resolution_timer_active = 0; } else { diff --git a/openair2/PHY_INTERFACE/phy_stub_UE.c b/openair2/PHY_INTERFACE/phy_stub_UE.c index f7967b0111..155b8cf8d5 100644 --- a/openair2/PHY_INTERFACE/phy_stub_UE.c +++ b/openair2/PHY_INTERFACE/phy_stub_UE.c @@ -921,7 +921,7 @@ void hi_dci0_req_UE_MAC(int sfn, // The following set of memcpy functions should be getting called as callback // functions from pnf_p7_subframe_ind. -int memcpy_dl_config_req(L1_rxtx_proc_t *proc, +int memcpy_dl_config_req(L1_rxtx_proc_t *proc, nfapi_pnf_p7_config_t *pnf_p7, nfapi_dl_config_request_t *req) { diff --git a/targets/RT/USER/lte-ue.c b/targets/RT/USER/lte-ue.c index ab19ff9741..5bde93a6b6 100644 --- a/targets/RT/USER/lte-ue.c +++ b/targets/RT/USER/lte-ue.c @@ -1044,6 +1044,7 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg) { LOG_W(MAC, "repeated sfn_sf = %d.%d\n", sfn_sf >> 4, sfn_sf & 15); + continue; } last_sfn_sf = sfn_sf; @@ -1171,38 +1172,44 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg) // Prepare the future Tx data if ((subframe_select(&UE->frame_parms, NFAPI_SFNSF2SF(sfn_sf)) == SF_UL) || (UE->frame_parms.frame_type == FDD)) - if (UE->mode != loop_through_memory) { + if (UE->mode != loop_through_memory) + { // We make the start of RA between consecutive UEs differ by 20 frames //if ((UE_mac_inst[Mod_id].UE_mode[0] == PRACH && Mod_id == 0) || (UE_mac_inst[Mod_id].UE_mode[0] == PRACH && Mod_id>0 && rx_frame >= UE_mac_inst[Mod_id-1].ra_frame + 20) ) { + if (UE_mac_inst[ue_Mod_id].UE_mode[0] == RA_RESPONSE && + is_prach_subframe(&UE->frame_parms, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf))) + { + UE_mac_inst[ue_Mod_id].UE_mode[0] = PRACH; + } LOG_I(MAC, "UE_mode: %d\n", UE_mac_inst[ue_Mod_id].UE_mode[0]); - if (UE_mac_inst[ue_Mod_id].UE_mode[0] == PRACH) { //&& ue_Mod_id == next_Mod_id) { + if (UE_mac_inst[ue_Mod_id].UE_mode[0] == PRACH) + { //&& ue_Mod_id == next_Mod_id) { next_ra_frame++; // if (next_ra_frame > 500) { - // check if we have PRACH opportunity - LOG_I(MAC, "is_prach_subframe(): %d\n", - is_prach_subframe(&UE->frame_parms, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf))); - if (is_prach_subframe(&UE->frame_parms, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf)) && UE_mac_inst[ue_Mod_id].SI_Decoded == 1) { - // The one working strangely... - //if (is_prach_subframe(&UE->frame_parms,NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf) && Mod_id == (module_id_t) init_ra_UE) ) { - PRACH_RESOURCES_t *prach_resources = ue_get_rach(ue_Mod_id, 0, NFAPI_SFNSF2SFN(sfn_sf), 0, NFAPI_SFNSF2SF(sfn_sf)); - if (prach_resources != NULL) { - LOG_I(MAC, "preamble_received_tar_power: %d\n", - prach_resources->ra_PREAMBLE_RECEIVED_TARGET_POWER); - UE_mac_inst[ue_Mod_id].ra_frame = NFAPI_SFNSF2SFN(sfn_sf); // Is this why RACH comes in late to proxy? - Andrew - LOG_D(MAC, "UE_phy_stub_thread_rxn_txnp4 before RACH, Mod_id: %d frame %d subframe %d\n", ue_Mod_id, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf)); - fill_rach_indication_UE_MAC(ue_Mod_id, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf), UL_INFO, prach_resources->ra_PreambleIndex, prach_resources->ra_RNTI); - sent_any = true; - Msg1_transmitted(ue_Mod_id, 0, NFAPI_SFNSF2SFN(sfn_sf), 0); - UE_mac_inst[ue_Mod_id].UE_mode[0] = RA_RESPONSE; - next_Mod_id = ue_Mod_id + 1; - //next_ra_frame = (rx_frame + 20)%1000; - next_ra_frame = 0; - } - - //ue_prach_procedures(ue,proc,eNB_id,abstraction_flag,mode); + // check if we have PRACH opportunity + if (is_prach_subframe(&UE->frame_parms, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf)) && UE_mac_inst[ue_Mod_id].SI_Decoded == 1) + { + // The one working strangely... + //if (is_prach_subframe(&UE->frame_parms,NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf) && Mod_id == (module_id_t) init_ra_UE) ) { + PRACH_RESOURCES_t *prach_resources = ue_get_rach(ue_Mod_id, 0, NFAPI_SFNSF2SFN(sfn_sf), 0, NFAPI_SFNSF2SF(sfn_sf)); + if (prach_resources != NULL) + { + LOG_I(MAC, "preamble_received_tar_power: %d\n", + prach_resources->ra_PREAMBLE_RECEIVED_TARGET_POWER); + UE_mac_inst[ue_Mod_id].ra_frame = NFAPI_SFNSF2SFN(sfn_sf); // Is this why RACH comes in late to proxy? - Andrew + LOG_D(MAC, "UE_phy_stub_thread_rxn_txnp4 before RACH, Mod_id: %d frame %d subframe %d\n", ue_Mod_id, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf)); + fill_rach_indication_UE_MAC(ue_Mod_id, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf), UL_INFO, prach_resources->ra_PreambleIndex, prach_resources->ra_RNTI); + sent_any = true; + Msg1_transmitted(ue_Mod_id, 0, NFAPI_SFNSF2SFN(sfn_sf), 0); + UE_mac_inst[ue_Mod_id].UE_mode[0] = RA_RESPONSE; + next_Mod_id = ue_Mod_id + 1; + //next_ra_frame = (rx_frame + 20)%1000; + next_ra_frame = 0; } + //ue_prach_procedures(ue,proc,eNB_id,abstraction_flag,mode); + } // } - } // mode is PRACH + } // mode is PRACH // Substitute call to phy_procedures Tx with call to phy_stub functions in order to trigger // UE Tx procedures directly at the MAC layer, based on the received ul_config requests from the vnf (eNB). From 96b5525d8832a6f7730d4fa904ec7531ec167a10 Mon Sep 17 00:00:00 2001 From: Andrew Burger Date: Tue, 8 Sep 2020 10:50:46 -0700 Subject: [PATCH 06/31] removal of LOG_A messages --- openair2/LAYER2/MAC/ue_procedures.c | 2 +- openair2/PHY_INTERFACE/phy_stub_UE.c | 4 ++-- targets/RT/USER/lte-ue.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/openair2/LAYER2/MAC/ue_procedures.c b/openair2/LAYER2/MAC/ue_procedures.c index 3161a0ed57..531aee0267 100644 --- a/openair2/LAYER2/MAC/ue_procedures.c +++ b/openair2/LAYER2/MAC/ue_procedures.c @@ -2603,7 +2603,7 @@ ue_scheduler(const module_id_t module_idP, if(NFAPI_MODE==NFAPI_UE_STUB_PNF || NFAPI_MODE==NFAPI_MODE_STANDALONE_PNF) { // phy_stub mode // Modification for phy_stub mode operation here. We only need to make sure that the ue_mode is back to // PRACH state. - LOG_A(MAC, "nfapi_mode3: Setting UE_mode to PRACH 2 \n"); + LOG_I(MAC, "nfapi_mode3: Setting UE_mode to PRACH 2 \n"); UE_mac_inst[module_idP].UE_mode[eNB_indexP] = PRACH; //ra_failed(module_idP,CC_id,eNB_index);UE_mac_inst[module_idP].RA_contention_resolution_timer_active = 0; } else { diff --git a/openair2/PHY_INTERFACE/phy_stub_UE.c b/openair2/PHY_INTERFACE/phy_stub_UE.c index 155b8cf8d5..05d303e595 100644 --- a/openair2/PHY_INTERFACE/phy_stub_UE.c +++ b/openair2/PHY_INTERFACE/phy_stub_UE.c @@ -948,7 +948,7 @@ int memcpy_dl_config_req(L1_rxtx_proc_t *proc, req->dl_config_request_body.dl_config_pdu_list[i]; } - LOG_A(MAC, "dl_config_req in memcpy Frame: %d Subframe: %d\n", + LOG_I(MAC, "dl_config_req in memcpy Frame: %d Subframe: %d\n", p->sfn_sf >> 4, p->sfn_sf & 15); if (!put_queue(&dl_config_req_queue, p)) { @@ -1217,7 +1217,7 @@ void *ue_standalone_pnf_task(void *context) } else { - LOG_A(MAC, "dl_config_req fresh off socket Frame: %d Subframe: %d\n", + LOG_I(MAC, "dl_config_req fresh off socket Frame: %d Subframe: %d\n", dl_config_req.sfn_sf >> 4, dl_config_req.sfn_sf & 15); // check to see if dl_config_req is null memcpy_dl_config_req(NULL, NULL, &dl_config_req); diff --git a/targets/RT/USER/lte-ue.c b/targets/RT/USER/lte-ue.c index 5bde93a6b6..083607117f 100644 --- a/targets/RT/USER/lte-ue.c +++ b/targets/RT/USER/lte-ue.c @@ -1057,7 +1057,7 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg) NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf)); if (dl_config_req != NULL) { uint16_t dl_num_pdus = dl_config_req->dl_config_request_body.number_pdu; - LOG_A(MAC, "(OAI UE) Received dl_config_req from proxy at Frame: %d, Subframe: %d," + LOG_I(MAC, "(OAI UE) Received dl_config_req from proxy at Frame: %d, Subframe: %d," " with number of PDUs: %u\n", NFAPI_SFNSF2SFN(dl_config_req->sfn_sf), NFAPI_SFNSF2SF(dl_config_req->sfn_sf), dl_num_pdus); From 25f8761b845b3cad6987d9c593be0569caf0335e Mon Sep 17 00:00:00 2001 From: Andrew Burger Date: Tue, 8 Sep 2020 11:15:44 -0700 Subject: [PATCH 07/31] whoops --- nfapi/oai_integration/nfapi_vnf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nfapi/oai_integration/nfapi_vnf.c b/nfapi/oai_integration/nfapi_vnf.c index 3a7da25aea..388b4441b3 100644 --- a/nfapi/oai_integration/nfapi_vnf.c +++ b/nfapi/oai_integration/nfapi_vnf.c @@ -1182,7 +1182,7 @@ int oai_nfapi_dl_config_req(nfapi_dl_config_request_t *dl_config_req) { { uint16_t dl_rnti = dl_config_req->dl_config_request_body.dl_config_pdu_list[i].dlsch_pdu.dlsch_pdu_rel8.rnti; uint16_t numPDUs = dl_config_req->dl_config_request_body.number_pdu; - LOG_A(MAC, "(OAI eNB) Sending dl_config_req at VNF during Frame: %d and Subframe: %d," + LOG_I(MAC, "(OAI eNB) Sending dl_config_req at VNF during Frame: %d and Subframe: %d," " with a RNTI value of: %x and with number of PDUs: %u\n", NFAPI_SFNSF2SFN(dl_config_req->sfn_sf),NFAPI_SFNSF2SF(dl_config_req->sfn_sf), dl_rnti, numPDUs); } From 821ef8572a2d9fc864b136dc216d16462b4be94f Mon Sep 17 00:00:00 2001 From: Andrew Burger Date: Tue, 8 Sep 2020 12:14:26 -0700 Subject: [PATCH 08/31] RRCConnectionsetup happening too early --- openair2/COMMON/platform_constants.h | 4 ++-- targets/RT/USER/lte-ue.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/openair2/COMMON/platform_constants.h b/openair2/COMMON/platform_constants.h index f5bcb82c00..e36656e43d 100644 --- a/openair2/COMMON/platform_constants.h +++ b/openair2/COMMON/platform_constants.h @@ -84,8 +84,8 @@ #define MAX_eNB 2 #define MAX_gNB 2 #else - #define MAX_MOBILES_PER_ENB 256 // This was maxed at 4 Why? -Andrew - #define MAX_MOBILES_PER_ENB_NB_IoT 256 + #define MAX_MOBILES_PER_ENB 5 // This was maxed at 4 Why? -Andrew + #define MAX_MOBILES_PER_ENB_NB_IoT 5 #define MAX_MOBILES_PER_GNB 2//16 #define MAX_eNB 2 #define MAX_gNB 2 diff --git a/targets/RT/USER/lte-ue.c b/targets/RT/USER/lte-ue.c index 083607117f..5f57033d8e 100644 --- a/targets/RT/USER/lte-ue.c +++ b/targets/RT/USER/lte-ue.c @@ -1185,7 +1185,7 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg) if (UE_mac_inst[ue_Mod_id].UE_mode[0] == PRACH) { //&& ue_Mod_id == next_Mod_id) { next_ra_frame++; - // if (next_ra_frame > 500) { + if (next_ra_frame > 500) { // check if we have PRACH opportunity if (is_prach_subframe(&UE->frame_parms, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf)) && UE_mac_inst[ue_Mod_id].SI_Decoded == 1) { @@ -1208,7 +1208,7 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg) } //ue_prach_procedures(ue,proc,eNB_id,abstraction_flag,mode); } - // } + } } // mode is PRACH // Substitute call to phy_procedures Tx with call to phy_stub functions in order to trigger From 96d7214c68fb20dbe8ffbec1cbff8a6b6001f3f6 Mon Sep 17 00:00:00 2001 From: Andrew Burger Date: Tue, 8 Sep 2020 14:50:20 -0700 Subject: [PATCH 09/31] Changing constants --- openair2/COMMON/platform_constants.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openair2/COMMON/platform_constants.h b/openair2/COMMON/platform_constants.h index e36656e43d..e1dc28a71b 100644 --- a/openair2/COMMON/platform_constants.h +++ b/openair2/COMMON/platform_constants.h @@ -84,8 +84,8 @@ #define MAX_eNB 2 #define MAX_gNB 2 #else - #define MAX_MOBILES_PER_ENB 5 // This was maxed at 4 Why? -Andrew - #define MAX_MOBILES_PER_ENB_NB_IoT 5 + #define MAX_MOBILES_PER_ENB 20 // This was maxed at 4 Why? -Andrew + #define MAX_MOBILES_PER_ENB_NB_IoT 20 #define MAX_MOBILES_PER_GNB 2//16 #define MAX_eNB 2 #define MAX_gNB 2 From 915be291cb377f4838f4060eb9471ef01038ee77 Mon Sep 17 00:00:00 2001 From: Andrew Burger Date: Tue, 8 Sep 2020 14:57:55 -0700 Subject: [PATCH 10/31] Damn Fujitsu --- targets/COMMON/openairinterface5g_limits.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/targets/COMMON/openairinterface5g_limits.h b/targets/COMMON/openairinterface5g_limits.h index aa99eee048..995b8d7c3b 100644 --- a/targets/COMMON/openairinterface5g_limits.h +++ b/targets/COMMON/openairinterface5g_limits.h @@ -14,7 +14,7 @@ // now , if we use --mu option in UE, compiling error will occur. // This problem will be fixed in the future. # ifndef UESIM_EXPANSION -# define NUMBER_OF_UE_MAX 4 +# define NUMBER_OF_UE_MAX 20 # define NUMBER_OF_NR_UE_MAX 4 # define NUMBER_OF_UCI_VARS_MAX 14 # define NUMBER_OF_CONNECTED_eNB_MAX 1 From 3d394948548e09005b70d9a96c304f5aaff7b8b9 Mon Sep 17 00:00:00 2001 From: Andrew Burger Date: Wed, 9 Sep 2020 09:30:22 -0700 Subject: [PATCH 11/31] Logging cqi issue re emerging --- nfapi/oai_integration/nfapi_vnf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nfapi/oai_integration/nfapi_vnf.c b/nfapi/oai_integration/nfapi_vnf.c index 388b4441b3..96b44ae35a 100644 --- a/nfapi/oai_integration/nfapi_vnf.c +++ b/nfapi/oai_integration/nfapi_vnf.c @@ -1271,8 +1271,8 @@ int oai_nfapi_ul_config_req(nfapi_ul_config_request_t *ul_config_req) { { continue; } - LOG_I(MAC, "ul_config_req num_pdus: %u pdu_number: %d pdu_type: %u\n", - num_pdus, i, pdu_type); + LOG_I(MAC, "ul_config_req num_pdus: %u pdu_number: %d pdu_type: %u SFN.SF: %d.%d\n", + num_pdus, i, pdu_type, ul_config_req->sfn_sf >> 4, ul_config_req->sfn_sf & 15); for (int j = i + 1; j < num_pdus; j++) { uint8_t pdu_type2 = ul_config_req->ul_config_request_body.ul_config_pdu_list[j].pdu_type; From 90af41e68e93a75d997e4457b7a78addff050281 Mon Sep 17 00:00:00 2001 From: Andrew Burger Date: Sat, 12 Sep 2020 14:47:31 -0700 Subject: [PATCH 12/31] Logging buflen of rx_ind data --- openair2/PHY_INTERFACE/phy_stub_UE.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/openair2/PHY_INTERFACE/phy_stub_UE.c b/openair2/PHY_INTERFACE/phy_stub_UE.c index 05d303e595..1b56a64fac 100644 --- a/openair2/PHY_INTERFACE/phy_stub_UE.c +++ b/openair2/PHY_INTERFACE/phy_stub_UE.c @@ -95,9 +95,11 @@ void fill_rx_indication_UE_MAC(module_id_t Mod_id, pdu->rx_indication_rel9.tl.tag = NFAPI_RX_INDICATION_REL9_TAG; pdu->rx_indication_rel9.timing_advance_r9 = 0; + // What is this? - Andrew // ulsch_buffer is necessary to keep its value. pdu->data = malloc(buflen); memcpy(pdu->data, ulsch_buffer, buflen); + LOG_I(MAC, "buflen of rx_ind pdu_data = %u\n", buflen); // estimate timing advance for MAC timing_advance_update = 0; // Don't know what to put here pdu->rx_indication_rel8.timing_advance = timing_advance_update; From 348fcb47b2a6e21198292ec0229da083a1c13320 Mon Sep 17 00:00:00 2001 From: Andrew Burger Date: Sat, 12 Sep 2020 15:04:13 -0700 Subject: [PATCH 13/31] Logging --- openair2/PHY_INTERFACE/phy_stub_UE.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openair2/PHY_INTERFACE/phy_stub_UE.c b/openair2/PHY_INTERFACE/phy_stub_UE.c index 1b56a64fac..73dbdcb319 100644 --- a/openair2/PHY_INTERFACE/phy_stub_UE.c +++ b/openair2/PHY_INTERFACE/phy_stub_UE.c @@ -99,7 +99,8 @@ void fill_rx_indication_UE_MAC(module_id_t Mod_id, // ulsch_buffer is necessary to keep its value. pdu->data = malloc(buflen); memcpy(pdu->data, ulsch_buffer, buflen); - LOG_I(MAC, "buflen of rx_ind pdu_data = %u\n", buflen); + LOG_I(MAC, "buflen of rx_ind pdu_data = %u SFN.SF: %d.%d\n", buflen, + frame, subframe); // estimate timing advance for MAC timing_advance_update = 0; // Don't know what to put here pdu->rx_indication_rel8.timing_advance = timing_advance_update; From 1655324b6939c32c114b220c7f62d03e1d9cfd87 Mon Sep 17 00:00:00 2001 From: Andrew Burger Date: Tue, 15 Sep 2020 13:35:23 -0700 Subject: [PATCH 14/31] Some logging --- nfapi/open-nFAPI/nfapi/src/nfapi_p7.c | 34 +++++++++++++++++++++++++++ openair2/PHY_INTERFACE/phy_stub_UE.c | 6 +++++ 2 files changed, 40 insertions(+) diff --git a/nfapi/open-nFAPI/nfapi/src/nfapi_p7.c b/nfapi/open-nFAPI/nfapi/src/nfapi_p7.c index b4d1653fce..cf24f551d8 100755 --- a/nfapi/open-nFAPI/nfapi/src/nfapi_p7.c +++ b/nfapi/open-nFAPI/nfapi/src/nfapi_p7.c @@ -37,6 +37,31 @@ #include #include +static const char *hexdump(const void *data, size_t data_len, char *out, size_t out_len) +{ + char *p = out; + char *endp = out + out_len; + const uint8_t *q = data; + snprintf(p, endp - p, "[%zu]", data_len); + p += strlen(p); + for (size_t i = 0; i < data_len; ++i) + { + if (p >= endp) + { + static const char ellipses[] = "..."; + char *s = endp - sizeof(ellipses); + if (s >= p) + { + strcpy(s, ellipses); + } + break; + } + snprintf(p, endp - p, " %02X", *q++); + p += strlen(p); + } + return out; +} + extern int nfapi_unpack_p7_vendor_extension(nfapi_p7_message_header_t* header, uint8_t **ppReadPackedMsg, void* user_data); extern int nfapi_pack_p7_vendor_extension(nfapi_p7_message_header_t* header, uint8_t **ppWritePackedMsg, void* user_data); @@ -6109,6 +6134,8 @@ int nfapi_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUn nfapi_p7_message_header_t *pMessageHeader = (nfapi_p7_message_header_t*)pUnpackedBuf; uint8_t *pReadPackedMessage = pMessageBuf; uint8_t *end = pMessageBuf + messageBufLen; + uint8_t *end_unpacked_buf = pUnpackedBuf + unpackedBufLen; + uint8_t *start_unpacked_buf = pUnpackedBuf; if (pMessageBuf == NULL || pUnpackedBuf == NULL) { @@ -6317,6 +6344,13 @@ int nfapi_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUn break; } + if (pMessageHeader->message_id == NFAPI_RX_ULSCH_INDICATION) + { + char foobar[1024]; + NFAPI_TRACE(NFAPI_TRACE_ERROR, "Biden %s:%d: %s\n", __FUNCTION__, + __LINE__, hexdump(pUnpackedBuf, end_unpacked_buf - start_unpacked_buf, foobar, sizeof(foobar))); + } + if(result == 0) return -1; else diff --git a/openair2/PHY_INTERFACE/phy_stub_UE.c b/openair2/PHY_INTERFACE/phy_stub_UE.c index 73dbdcb319..75bb239ce3 100644 --- a/openair2/PHY_INTERFACE/phy_stub_UE.c +++ b/openair2/PHY_INTERFACE/phy_stub_UE.c @@ -1330,6 +1330,12 @@ const char *hexdump(const void *data, size_t data_len, char *out, size_t out_len LOG_I(MAC, "RX_IND sent to Proxy, Size: %d Frame %d Subframe %d rx_ind.tl.length: %u num_pdus: %u\n", encoded_size, NFAPI_SFNSF2SFN(UL->rx_ind.sfn_sf), NFAPI_SFNSF2SF(UL->rx_ind.sfn_sf), UL->rx_ind.rx_indication_body.tl.length, UL->rx_ind.rx_indication_body.number_of_pdus); + nfapi_rx_indication_t test_ind; + if (nfapi_p7_message_unpack(buffer, encoded_size, &test_ind, sizeof(test_ind), NULL) < 0) + { + LOG_E(MAC, "could not unpack rx_ind right after packing encoded_size: %d\n" encoded_size); + abort(); + } break; case NFAPI_RX_CQI_INDICATION: encoded_size = nfapi_p7_message_pack(&UL->cqi_ind, buffer, sizeof(buffer), NULL); // Check pdu->ul_cqi_information.channel = 1 From 791347d5dad7c171755a833008c412a3b479c67a Mon Sep 17 00:00:00 2001 From: Andrew Burger Date: Tue, 15 Sep 2020 13:36:22 -0700 Subject: [PATCH 15/31] forgot comma --- openair2/PHY_INTERFACE/phy_stub_UE.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/PHY_INTERFACE/phy_stub_UE.c b/openair2/PHY_INTERFACE/phy_stub_UE.c index 75bb239ce3..29f0b8f413 100644 --- a/openair2/PHY_INTERFACE/phy_stub_UE.c +++ b/openair2/PHY_INTERFACE/phy_stub_UE.c @@ -1333,7 +1333,7 @@ const char *hexdump(const void *data, size_t data_len, char *out, size_t out_len nfapi_rx_indication_t test_ind; if (nfapi_p7_message_unpack(buffer, encoded_size, &test_ind, sizeof(test_ind), NULL) < 0) { - LOG_E(MAC, "could not unpack rx_ind right after packing encoded_size: %d\n" encoded_size); + LOG_E(MAC, "could not unpack rx_ind right after packing encoded_size: %d\n", encoded_size); abort(); } break; From 9339b063153352d9911755190a5d7abe9d0b0088 Mon Sep 17 00:00:00 2001 From: Andrew Burger Date: Tue, 15 Sep 2020 13:45:34 -0700 Subject: [PATCH 16/31] pack unpack --- openair2/PHY_INTERFACE/phy_stub_UE.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/openair2/PHY_INTERFACE/phy_stub_UE.c b/openair2/PHY_INTERFACE/phy_stub_UE.c index 29f0b8f413..ac39c1c4fc 100644 --- a/openair2/PHY_INTERFACE/phy_stub_UE.c +++ b/openair2/PHY_INTERFACE/phy_stub_UE.c @@ -1336,6 +1336,12 @@ const char *hexdump(const void *data, size_t data_len, char *out, size_t out_len LOG_E(MAC, "could not unpack rx_ind right after packing encoded_size: %d\n", encoded_size); abort(); } + char test_buffer[1024]; + int encoded_size2 = nfapi_p7_message_pack(&test_ind, test_buffer, sizeof(test_buffer), NULL); + if (encoded_size2 < 0) + { + LOG_E(MAC, "could not pack rx_ind right after unpacking encoded_size2: %d\n", encoded_size2); + } break; case NFAPI_RX_CQI_INDICATION: encoded_size = nfapi_p7_message_pack(&UL->cqi_ind, buffer, sizeof(buffer), NULL); // Check pdu->ul_cqi_information.channel = 1 From e19cee63865316c9f46151c30989f0841456f5a8 Mon Sep 17 00:00:00 2001 From: Andrew Burger Date: Tue, 15 Sep 2020 14:12:42 -0700 Subject: [PATCH 17/31] hexdumping packed buffer --- openair2/PHY_INTERFACE/phy_stub_UE.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/openair2/PHY_INTERFACE/phy_stub_UE.c b/openair2/PHY_INTERFACE/phy_stub_UE.c index ac39c1c4fc..07ba917ba9 100644 --- a/openair2/PHY_INTERFACE/phy_stub_UE.c +++ b/openair2/PHY_INTERFACE/phy_stub_UE.c @@ -1312,6 +1312,7 @@ const char *hexdump(const void *data, size_t data_len, char *out, size_t out_len { int encoded_size = -1; char buffer[1024]; + char dump[1024]; switch (msg_type) { case NFAPI_RACH_INDICATION: @@ -1327,9 +1328,10 @@ const char *hexdump(const void *data, size_t data_len, char *out, size_t out_len break; case NFAPI_RX_ULSCH_INDICATION: encoded_size = nfapi_p7_message_pack(&UL->rx_ind, buffer, sizeof(buffer), NULL); - LOG_I(MAC, "RX_IND sent to Proxy, Size: %d Frame %d Subframe %d rx_ind.tl.length: %u num_pdus: %u\n", + LOG_I(MAC, "RX_IND sent to Proxy, Size: %d Frame %d Subframe %d rx_ind.tl.length: %u num_pdus: %u\nHexDUMP %s\n", encoded_size, NFAPI_SFNSF2SFN(UL->rx_ind.sfn_sf), NFAPI_SFNSF2SF(UL->rx_ind.sfn_sf), - UL->rx_ind.rx_indication_body.tl.length, UL->rx_ind.rx_indication_body.number_of_pdus); + UL->rx_ind.rx_indication_body.tl.length, UL->rx_ind.rx_indication_body.number_of_pdus, + hexdump(buffer, encoded_size, dump, sizeof(dump))); nfapi_rx_indication_t test_ind; if (nfapi_p7_message_unpack(buffer, encoded_size, &test_ind, sizeof(test_ind), NULL) < 0) { From 8852bb19c9a1cec5f8edb58c220988bec21ea4f5 Mon Sep 17 00:00:00 2001 From: Andrew Burger Date: Tue, 15 Sep 2020 14:44:43 -0700 Subject: [PATCH 18/31] Adding hexdump logs in unpack --- nfapi/open-nFAPI/nfapi/src/nfapi_p7.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/nfapi/open-nFAPI/nfapi/src/nfapi_p7.c b/nfapi/open-nFAPI/nfapi/src/nfapi_p7.c index cf24f551d8..bda7b4e9a2 100755 --- a/nfapi/open-nFAPI/nfapi/src/nfapi_p7.c +++ b/nfapi/open-nFAPI/nfapi/src/nfapi_p7.c @@ -4971,7 +4971,9 @@ static uint8_t unpack_rx_indication_body_value(void* tlv, uint8_t **ppReadPacked // pdu end is past buffer end return 0; } - + char foo[1024]; + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s:%d: %s\n", __FUNCTION__, + __LINE__, hexdump(*ppReadPackedMsg, end - *ppReadPackedMsg, foo, sizeof(foo))); if(pull16(ppReadPackedMsg, &value->number_of_pdus, end) == 0) return 0; @@ -4999,6 +5001,8 @@ static uint8_t unpack_rx_indication_body_value(void* tlv, uint8_t **ppReadPacked nfapi_rx_indication_pdu_t* pdu = 0; while((uint8_t*)(*ppReadPackedMsg) < rxBodyEnd && (uint8_t*)(*ppReadPackedMsg) < rxPduEnd) { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s:%d: %s\n", __FUNCTION__, + __LINE__, hexdump(*ppReadPackedMsg, end - *ppReadPackedMsg, foo, sizeof(foo))); nfapi_tl_t generic_tl; if( unpack_tl(ppReadPackedMsg, &generic_tl, end) == 0) return 0; @@ -5009,6 +5013,8 @@ static uint8_t unpack_rx_indication_body_value(void* tlv, uint8_t **ppReadPacked { pdu = &(value->rx_pdu_list[i++]); pdu->rx_ue_information.tl = generic_tl; + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s:%d: %s\n", __FUNCTION__, + __LINE__, hexdump(*ppReadPackedMsg, end - *ppReadPackedMsg, foo, sizeof(foo))); if(unpack_rx_ue_information_value(&pdu->rx_ue_information, ppReadPackedMsg, end) == 0) return 0; } @@ -5018,6 +5024,8 @@ static uint8_t unpack_rx_indication_body_value(void* tlv, uint8_t **ppReadPacked if(pdu != 0) { pdu->rx_indication_rel8.tl = generic_tl; + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s:%d: %s\n", __FUNCTION__, + __LINE__, hexdump(*ppReadPackedMsg, end - *ppReadPackedMsg, foo, sizeof(foo))); if(unpack_rx_indication_rel8_value(&pdu->rx_indication_rel8, ppReadPackedMsg, end) == 0) return 0; @@ -5051,6 +5059,8 @@ static uint8_t unpack_rx_indication_body_value(void* tlv, uint8_t **ppReadPacked if(pdu != 0) { pdu->rx_indication_rel9.tl = generic_tl; + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s:%d: %s\n", __FUNCTION__, + __LINE__, hexdump(*ppReadPackedMsg, end - *ppReadPackedMsg, foo, sizeof(foo))); if(unpack_rx_indication_rel9_value(&pdu->rx_indication_rel9, ppReadPackedMsg, end) == 0) return 0; } @@ -5071,10 +5081,14 @@ static uint8_t unpack_rx_indication_body_value(void* tlv, uint8_t **ppReadPacked { uint32_t length = value->rx_pdu_list[idx].rx_indication_rel8.length; value->rx_pdu_list[idx].data = nfapi_p7_allocate(length, config); + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s:%d: %s\n", __FUNCTION__, + __LINE__, hexdump(*ppReadPackedMsg, end - *ppReadPackedMsg, foo, sizeof(foo))); if(pullarray8(ppReadPackedMsg, value->rx_pdu_list[idx].data, length, length, end) == 0) { return 0; } + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s:%d: %s\n", __FUNCTION__, + __LINE__, hexdump(*ppReadPackedMsg, end - *ppReadPackedMsg, foo, sizeof(foo))); } } From 6cef6c340c1ed811db6a78a13e466471181b4109 Mon Sep 17 00:00:00 2001 From: Andrew Burger Date: Tue, 15 Sep 2020 16:23:52 -0700 Subject: [PATCH 19/31] print function for rx_ind --- openair2/PHY_INTERFACE/phy_stub_UE.c | 36 ++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/openair2/PHY_INTERFACE/phy_stub_UE.c b/openair2/PHY_INTERFACE/phy_stub_UE.c index 07ba917ba9..2d578ebacd 100644 --- a/openair2/PHY_INTERFACE/phy_stub_UE.c +++ b/openair2/PHY_INTERFACE/phy_stub_UE.c @@ -1308,6 +1308,41 @@ const char *hexdump(const void *data, size_t data_len, char *out, size_t out_len return out; } +static void print_rx_ind(nfapi_rx_indication_t *p) +{ + printf("Printing RX_IND fields\n"); + printf("header.message_id: %u\n", p->header.message_id); + printf("header.phy_id: %u\n", p->header.phy_id); + printf("header.message_id: %u\n", p->header.message_id); + printf("header.m_segment_sequence: %u\n", p->header.m_segment_sequence); + printf("header.checksum: %u\n", p->header.checksum); + printf("header.transmit_timestamp: %u\n", p->header.transmit_timestamp); + printf("sfn_sf: %u\n", p->sfn_sf); + printf("rx_indication_body.tl.tag: 0x%x\n", p->rx_indication_body.tl.tag); + printf("rx_indication_body.tl.length: %u\n", p->rx_indication_body.tl.length); + printf("rx_indication_body.number_of_pdus: %u\n", p->rx_indication_body.number_of_pdus); + + nfapi_rx_indication_pdu_t *pdu = p->rx_indication_body.rx_pdu_list; + for (int i = 0; i < p->rx_indication_body.number_of_pdus; i++) + { + printf("pdu %d nfapi_rx_ue_information.tl.tag: 0x%x\n", i, pdu->rx_ue_information.tl.tag); + printf("pdu %d nfapi_rx_ue_information.tl.length: %u\n", i, pdu->rx_ue_information.tl.length); + printf("pdu %d nfapi_rx_ue_information.handle: %u\n", i, pdu->rx_ue_information.handle); + printf("pdu %d nfapi_rx_ue_information.rnti: %u\n", i, pdu->rx_ue_information.rnti); + printf("pdu %d nfapi_rx_indication_rel8.tl.tag: 0x%x\n", i, pdu->rx_indication_rel8.tl.tag); + printf("pdu %d nfapi_rx_indication_rel8.tl.length: %u\n", i, pdu->rx_indication_rel8.tl.length); + printf("pdu %d nfapi_rx_indication_rel8.length: %u\n", i, pdu->rx_indication_rel8.length); + printf("pdu %d nfapi_rx_indication_rel8.offset: %u\n", i, pdu->rx_indication_rel8.offset); + printf("pdu %d nfapi_rx_indication_rel8.ul_cqi: %u\n", i, pdu->rx_indication_rel8.ul_cqi); + printf("pdu %d nfapi_rx_indication_rel8.timing_advance: %u\n", i, pdu->rx_indication_rel8.timing_advance); + printf("pdu %d nfapi_rx_indication_rel9.tl.tag: 0x%x\n", i, pdu->rx_indication_rel9.tl.tag); + printf("pdu %d nfapi_rx_indication_rel9.tl.length: %u\n", i, pdu->rx_indication_rel9.tl.length); + printf("pdu %d nfapi_rx_indication_rel9.timing_advance_r9: %u\n", i, pdu->rx_indication_rel9.timing_advance_r9); + } + + fflush(stdout); +} + void send_standalone_msg(UL_IND_t *UL, nfapi_message_id_e msg_type) { int encoded_size = -1; @@ -1327,6 +1362,7 @@ const char *hexdump(const void *data, size_t data_len, char *out, size_t out_len UL->crc_ind.crc_indication_body.number_of_crcs); break; case NFAPI_RX_ULSCH_INDICATION: + print_rx_ind(&UL->rx_ind); encoded_size = nfapi_p7_message_pack(&UL->rx_ind, buffer, sizeof(buffer), NULL); LOG_I(MAC, "RX_IND sent to Proxy, Size: %d Frame %d Subframe %d rx_ind.tl.length: %u num_pdus: %u\nHexDUMP %s\n", encoded_size, NFAPI_SFNSF2SFN(UL->rx_ind.sfn_sf), NFAPI_SFNSF2SF(UL->rx_ind.sfn_sf), From 2d657b5e30f759067706ee0607bd1ebd7a9e15b3 Mon Sep 17 00:00:00 2001 From: Andrew Burger Date: Tue, 15 Sep 2020 16:54:08 -0700 Subject: [PATCH 20/31] another rx_ind print --- openair2/PHY_INTERFACE/phy_stub_UE.c | 1 + 1 file changed, 1 insertion(+) diff --git a/openair2/PHY_INTERFACE/phy_stub_UE.c b/openair2/PHY_INTERFACE/phy_stub_UE.c index 2d578ebacd..cec62e2cee 100644 --- a/openair2/PHY_INTERFACE/phy_stub_UE.c +++ b/openair2/PHY_INTERFACE/phy_stub_UE.c @@ -1374,6 +1374,7 @@ static void print_rx_ind(nfapi_rx_indication_t *p) LOG_E(MAC, "could not unpack rx_ind right after packing encoded_size: %d\n", encoded_size); abort(); } + print_rx_ind(&test_ind); char test_buffer[1024]; int encoded_size2 = nfapi_p7_message_pack(&test_ind, test_buffer, sizeof(test_buffer), NULL); if (encoded_size2 < 0) From 6ed8610a53f4cb3a52c3a9bf436f5f35524e9bf6 Mon Sep 17 00:00:00 2001 From: Andrew Burger Date: Wed, 16 Sep 2020 09:54:52 -0700 Subject: [PATCH 21/31] Fix for rx_ind --- nfapi/open-nFAPI/nfapi/src/nfapi_p7.c | 212 ++++++++++++++------------ 1 file changed, 112 insertions(+), 100 deletions(-) diff --git a/nfapi/open-nFAPI/nfapi/src/nfapi_p7.c b/nfapi/open-nFAPI/nfapi/src/nfapi_p7.c index bda7b4e9a2..362ef8ccd3 100755 --- a/nfapi/open-nFAPI/nfapi/src/nfapi_p7.c +++ b/nfapi/open-nFAPI/nfapi/src/nfapi_p7.c @@ -4956,37 +4956,39 @@ static uint8_t unpack_rx_indication_rel9_value(void *tlv, uint8_t **ppReadPacked return (pull16(ppReadPackedMsg, &value->timing_advance_r9, end)); } -static uint8_t unpack_rx_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +static uint8_t unpack_rx_indication_body_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config) { - nfapi_rx_indication_body_t* value = (nfapi_rx_indication_body_t*)tlv; + nfapi_rx_indication_body_t *value = (nfapi_rx_indication_body_t *)tlv; - // the rxBodyEnd points to the end of the cqi PDU's - uint8_t* rxBodyEnd = *ppReadPackedMsg + value->tl.length; - uint8_t* rxPduEnd = rxBodyEnd; + // the rxBodyEnd points to the end of the cqi PDU's Is this a problem? -Andrew + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s value->tl.length in unpack: %u \n", __FUNCTION__, + value->tl.length); + uint8_t *rxBodyEnd = *ppReadPackedMsg + value->tl.length; - uint8_t* numberOfPdusAddress = *ppReadPackedMsg; - - if(rxBodyEnd > end) + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s rxBodyEnd: %p end: %p\n", __FUNCTION__, + rxBodyEnd, end); + if (rxBodyEnd > end) { // pdu end is past buffer end return 0; } char foo[1024]; - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s:%d: %s\n", __FUNCTION__, - __LINE__, hexdump(*ppReadPackedMsg, end - *ppReadPackedMsg, foo, sizeof(foo))); - if(pull16(ppReadPackedMsg, &value->number_of_pdus, end) == 0) + // NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s:%d: %s\n", __FUNCTION__, + // __LINE__, hexdump(*ppReadPackedMsg, end - *ppReadPackedMsg, foo, sizeof(foo))); + + if (pull16(ppReadPackedMsg, &value->number_of_pdus, end) == 0) return 0; - if(value->number_of_pdus > NFAPI_RX_IND_MAX_PDU) + if (value->number_of_pdus > NFAPI_RX_IND_MAX_PDU) { NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of rx ind pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_pdus, NFAPI_RX_IND_MAX_PDU); - return 0; + return 0; } - if(value->number_of_pdus > 0) + if (value->number_of_pdus > 0) { - value->rx_pdu_list = (nfapi_rx_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_rx_indication_pdu_t) * value->number_of_pdus, config); - if(value->rx_pdu_list == NULL) + value->rx_pdu_list = (nfapi_rx_indication_pdu_t *)nfapi_p7_allocate(sizeof(nfapi_rx_indication_pdu_t) * value->number_of_pdus, config); + if (value->rx_pdu_list == NULL) { NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate rx ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_pdus); return 0; @@ -4996,102 +4998,112 @@ static uint8_t unpack_rx_indication_body_value(void* tlv, uint8_t **ppReadPacked { value->rx_pdu_list = 0; } - - uint8_t i = 0; - nfapi_rx_indication_pdu_t* pdu = 0; - while((uint8_t*)(*ppReadPackedMsg) < rxBodyEnd && (uint8_t*)(*ppReadPackedMsg) < rxPduEnd) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s:%d: %s\n", __FUNCTION__, - __LINE__, hexdump(*ppReadPackedMsg, end - *ppReadPackedMsg, foo, sizeof(foo))); - nfapi_tl_t generic_tl; - if( unpack_tl(ppReadPackedMsg, &generic_tl, end) == 0) - return 0; - switch(generic_tl.tag) + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number_of_pdus = %u\n", __FUNCTION__, value->number_of_pdus); + for (int i = 0; i < value->number_of_pdus; i++) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s i = %u\n", __FUNCTION__, i); + nfapi_tl_t generic_tl; + + // NFAPI_RX_UE_INFORMATION_TAG + // NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s:%d: %s\n", __FUNCTION__, + // __LINE__, hexdump(*ppReadPackedMsg, end - *ppReadPackedMsg, foo, sizeof(foo))); + if (unpack_tl(ppReadPackedMsg, &generic_tl, end) == 0) { - case NFAPI_RX_UE_INFORMATION_TAG: - { - pdu = &(value->rx_pdu_list[i++]); - pdu->rx_ue_information.tl = generic_tl; - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s:%d: %s\n", __FUNCTION__, - __LINE__, hexdump(*ppReadPackedMsg, end - *ppReadPackedMsg, foo, sizeof(foo))); - if(unpack_rx_ue_information_value(&pdu->rx_ue_information, ppReadPackedMsg, end) == 0) - return 0; - } - break; - case NFAPI_RX_INDICATION_REL8_TAG: - { - if(pdu != 0) - { - pdu->rx_indication_rel8.tl = generic_tl; - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s:%d: %s\n", __FUNCTION__, - __LINE__, hexdump(*ppReadPackedMsg, end - *ppReadPackedMsg, foo, sizeof(foo))); - if(unpack_rx_indication_rel8_value(&pdu->rx_indication_rel8, ppReadPackedMsg, end) == 0) - return 0; - - if(pdu->rx_indication_rel8.offset > 0) - { - // Need to check that the data is within the tlv - if(numberOfPdusAddress + pdu->rx_indication_rel8.offset + pdu->rx_indication_rel8.length <= rxBodyEnd) - { - // If this the first pdu set the rxPduEnd - if(numberOfPdusAddress + pdu->rx_indication_rel8.offset < rxPduEnd) - { - rxPduEnd = numberOfPdusAddress + pdu->rx_indication_rel8.offset; - - if(rxPduEnd > end) - { - // pdu end is past buffer end - return 0; - } - } - } - else - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME: the rx data is outside of the tlv\n"); - } - } - } - } - break; - case NFAPI_RX_INDICATION_REL9_TAG: - { - if(pdu != 0) - { - pdu->rx_indication_rel9.tl = generic_tl; - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s:%d: %s\n", __FUNCTION__, - __LINE__, hexdump(*ppReadPackedMsg, end - *ppReadPackedMsg, foo, sizeof(foo))); - if(unpack_rx_indication_rel9_value(&pdu->rx_indication_rel9, ppReadPackedMsg, end) == 0) - return 0; - } - } - break; - default: - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "RX_ULSCH.indication Invalid pdu type %d \n", generic_tl.tag ); - } - break; + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s unpack_tl failed\n", __FUNCTION__); + return 0; + } + + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s generic_tl.tag = 0x%x length = %u\n", __FUNCTION__, generic_tl.tag, generic_tl.length); + + if (generic_tl.tag != NFAPI_RX_UE_INFORMATION_TAG) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s generic_tl.tag wrong\n", __FUNCTION__); + return 0; + } + nfapi_rx_indication_pdu_t *pdu = &value->rx_pdu_list[i]; + pdu->rx_ue_information.tl = generic_tl; + // NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s:%d: %s\n", __FUNCTION__, + // __LINE__, hexdump(*ppReadPackedMsg, end - *ppReadPackedMsg, foo, sizeof(foo))); + if (unpack_rx_ue_information_value(&pdu->rx_ue_information, ppReadPackedMsg, end) == 0) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s unpack_rx_ue_info failure\n", __FUNCTION__); + return 0; + } + + // NFAPI_RX_INDICATION_REL8_TAG + // NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s:%d: %s\n", __FUNCTION__, + // __LINE__, hexdump(*ppReadPackedMsg, end - *ppReadPackedMsg, foo, sizeof(foo))); + if (unpack_tl(ppReadPackedMsg, &generic_tl, end) == 0) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s unpack_tl failed\n", __FUNCTION__); + return 0; + } + + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s generic_tl.tag = 0x%x length = %u\n", __FUNCTION__, generic_tl.tag, generic_tl.length); + + if (generic_tl.tag != NFAPI_RX_INDICATION_REL8_TAG) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s generic_tl.tag wrong\n", __FUNCTION__); + return 0; + } + pdu->rx_indication_rel8.tl = generic_tl; + // NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s:%d: %s\n", __FUNCTION__, + // __LINE__, hexdump(*ppReadPackedMsg, end - *ppReadPackedMsg, foo, sizeof(foo))); + if (unpack_rx_indication_rel8_value(&pdu->rx_indication_rel8, ppReadPackedMsg, end) == 0) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s unpack_rx_indication_rel8 failure\n", __FUNCTION__); + return 0; + } + //What is offset not stripping 10 bytes + NFAPI_TRACE(NFAPI_TRACE_INFO, "%s pdu->rx_indication_rel8.offset = %u", __FUNCTION__, + pdu->rx_indication_rel8.offset); + + // NFAPI_RX_INDICATION_REL9_TAG + // NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s:%d: %s\n", __FUNCTION__, + // __LINE__, hexdump(*ppReadPackedMsg, end - *ppReadPackedMsg, foo, sizeof(foo))); + if (unpack_tl(ppReadPackedMsg, &generic_tl, end) == 0) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s unpack_tl failed\n", __FUNCTION__); + return 0; + } + + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s generic_tl.tag = 0x%x length = %u\n", __FUNCTION__, generic_tl.tag, generic_tl.length); + + if (generic_tl.tag != NFAPI_RX_INDICATION_REL9_TAG) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s generic_tl.tag wrong\n", __FUNCTION__); + return 0; + } + pdu->rx_indication_rel9.tl = generic_tl; + // NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s:%d: %s\n", __FUNCTION__, + // __LINE__, hexdump(*ppReadPackedMsg, end - *ppReadPackedMsg, foo, sizeof(foo))); + if (unpack_rx_indication_rel9_value(&pdu->rx_indication_rel9, ppReadPackedMsg, end) == 0) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s unpack_rx_indication_rel9 failure\n", __FUNCTION__); + return 0; } } - - uint8_t idx = 0; - for(idx = 0; idx < value->number_of_pdus; ++idx) + + for (int i = 0; i < value->number_of_pdus; ++i) { - if(value->rx_pdu_list[idx].rx_indication_rel8.tl.tag == NFAPI_RX_INDICATION_REL8_TAG) + nfapi_rx_indication_pdu_t *pdu = &value->rx_pdu_list[i]; + if (pdu->rx_indication_rel8.tl.tag == NFAPI_RX_INDICATION_REL8_TAG) { - uint32_t length = value->rx_pdu_list[idx].rx_indication_rel8.length; - value->rx_pdu_list[idx].data = nfapi_p7_allocate(length, config); - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s:%d: %s\n", __FUNCTION__, - __LINE__, hexdump(*ppReadPackedMsg, end - *ppReadPackedMsg, foo, sizeof(foo))); - if(pullarray8(ppReadPackedMsg, value->rx_pdu_list[idx].data, length, length, end) == 0) + uint32_t length = pdu->rx_indication_rel8.length; + // NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s:%d: %s\n", __FUNCTION__, + // __LINE__, hexdump(*ppReadPackedMsg, end - *ppReadPackedMsg, foo, sizeof(foo))); + if (pullarray8(ppReadPackedMsg, pdu->data, length, length, end) == 0) { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s pullarray8 failure\n", __FUNCTION__); return 0; } - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s:%d: %s\n", __FUNCTION__, - __LINE__, hexdump(*ppReadPackedMsg, end - *ppReadPackedMsg, foo, sizeof(foo))); + // NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s:%d: %s\n", __FUNCTION__, + // __LINE__, hexdump(*ppReadPackedMsg, end - *ppReadPackedMsg, foo, sizeof(foo))); } } + NFAPI_TRACE(NFAPI_TRACE_INFO, "%s Success!\n", __FUNCTION__); return 1; } From 7045166f682ef63ba9a142a1fe367362b789e2a4 Mon Sep 17 00:00:00 2001 From: Andrew Burger Date: Wed, 16 Sep 2020 10:44:05 -0700 Subject: [PATCH 22/31] cant unpack rx_ind in UE --- openair2/PHY_INTERFACE/phy_stub_UE.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/openair2/PHY_INTERFACE/phy_stub_UE.c b/openair2/PHY_INTERFACE/phy_stub_UE.c index cec62e2cee..0fb3966690 100644 --- a/openair2/PHY_INTERFACE/phy_stub_UE.c +++ b/openair2/PHY_INTERFACE/phy_stub_UE.c @@ -1368,19 +1368,19 @@ static void print_rx_ind(nfapi_rx_indication_t *p) encoded_size, NFAPI_SFNSF2SFN(UL->rx_ind.sfn_sf), NFAPI_SFNSF2SF(UL->rx_ind.sfn_sf), UL->rx_ind.rx_indication_body.tl.length, UL->rx_ind.rx_indication_body.number_of_pdus, hexdump(buffer, encoded_size, dump, sizeof(dump))); - nfapi_rx_indication_t test_ind; - if (nfapi_p7_message_unpack(buffer, encoded_size, &test_ind, sizeof(test_ind), NULL) < 0) - { - LOG_E(MAC, "could not unpack rx_ind right after packing encoded_size: %d\n", encoded_size); - abort(); - } - print_rx_ind(&test_ind); - char test_buffer[1024]; - int encoded_size2 = nfapi_p7_message_pack(&test_ind, test_buffer, sizeof(test_buffer), NULL); - if (encoded_size2 < 0) - { - LOG_E(MAC, "could not pack rx_ind right after unpacking encoded_size2: %d\n", encoded_size2); - } + // nfapi_rx_indication_t test_ind; + // if (nfapi_p7_message_unpack(buffer, encoded_size, &test_ind, sizeof(test_ind), NULL) < 0) + // { + // LOG_E(MAC, "could not unpack rx_ind right after packing encoded_size: %d\n", encoded_size); + // abort(); + // } + // print_rx_ind(&test_ind); + // char test_buffer[1024]; + // int encoded_size2 = nfapi_p7_message_pack(&test_ind, test_buffer, sizeof(test_buffer), NULL); + // if (encoded_size2 < 0) + // { + // LOG_E(MAC, "could not pack rx_ind right after unpacking encoded_size2: %d\n", encoded_size2); + // } break; case NFAPI_RX_CQI_INDICATION: encoded_size = nfapi_p7_message_pack(&UL->cqi_ind, buffer, sizeof(buffer), NULL); // Check pdu->ul_cqi_information.channel = 1 From fc0673bdd1cb05cc5d1496e607ec48aafc2186d8 Mon Sep 17 00:00:00 2001 From: Andrew Burger Date: Thu, 17 Sep 2020 12:27:42 -0700 Subject: [PATCH 23/31] Allocating memory for new oai unpack rx_ind func --- nfapi/open-nFAPI/nfapi/src/nfapi_p7.c | 1 + 1 file changed, 1 insertion(+) diff --git a/nfapi/open-nFAPI/nfapi/src/nfapi_p7.c b/nfapi/open-nFAPI/nfapi/src/nfapi_p7.c index 362ef8ccd3..5130dd6e63 100755 --- a/nfapi/open-nFAPI/nfapi/src/nfapi_p7.c +++ b/nfapi/open-nFAPI/nfapi/src/nfapi_p7.c @@ -5091,6 +5091,7 @@ static uint8_t unpack_rx_indication_body_value(void *tlv, uint8_t **ppReadPacked if (pdu->rx_indication_rel8.tl.tag == NFAPI_RX_INDICATION_REL8_TAG) { uint32_t length = pdu->rx_indication_rel8.length; + value->rx_pdu_list[i].data = nfapi_p7_allocate(length, config); // NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s:%d: %s\n", __FUNCTION__, // __LINE__, hexdump(*ppReadPackedMsg, end - *ppReadPackedMsg, foo, sizeof(foo))); if (pullarray8(ppReadPackedMsg, pdu->data, length, length, end) == 0) From 08e52445a44c5214434ca736c5c4af6004f75650 Mon Sep 17 00:00:00 2001 From: Andrew Burger Date: Fri, 18 Sep 2020 09:11:56 -0700 Subject: [PATCH 24/31] Before testing --- nfapi/oai_integration/nfapi_vnf.c | 54 +++++++++++++++---------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/nfapi/oai_integration/nfapi_vnf.c b/nfapi/oai_integration/nfapi_vnf.c index 96b44ae35a..84ffa8e945 100644 --- a/nfapi/oai_integration/nfapi_vnf.c +++ b/nfapi/oai_integration/nfapi_vnf.c @@ -760,7 +760,7 @@ int phy_cqi_indication(struct nfapi_vnf_p7_config *config, nfapi_cqi_indication_ NFAPI_SFNSF2SF(ind->sfn_sf), ind->cqi_indication_body.number_of_cqis); } - analyze_cqi_pdus_for_duplicates(ind); + // analyze_cqi_pdus_for_duplicates(ind); for (int i=0; i < ind->cqi_indication_body.number_of_cqis; i++) { nfapi_cqi_indication_pdu_t *src_pdu = &ind->cqi_indication_body.cqi_pdu_list[i]; @@ -1263,32 +1263,32 @@ int oai_nfapi_ul_config_req(nfapi_ul_config_request_t *ul_config_req) { ul_config_req->ul_config_request_body.rach_prach_frequency_resources, ul_config_req->ul_config_request_body.srs_present); int retval = nfapi_vnf_p7_ul_config_req(p7_config, ul_config_req); - uint8_t num_pdus = ul_config_req->ul_config_request_body.number_of_pdus; - for (int i = 0; i < num_pdus; i++) - { - uint8_t pdu_type = ul_config_req->ul_config_request_body.ul_config_pdu_list[i].pdu_type; - if (pdu_type != 1) - { - continue; - } - LOG_I(MAC, "ul_config_req num_pdus: %u pdu_number: %d pdu_type: %u SFN.SF: %d.%d\n", - num_pdus, i, pdu_type, ul_config_req->sfn_sf >> 4, ul_config_req->sfn_sf & 15); - for (int j = i + 1; j < num_pdus; j++) - { - uint8_t pdu_type2 = ul_config_req->ul_config_request_body.ul_config_pdu_list[j].pdu_type; - if (pdu_type == pdu_type2) - { - uint16_t rnti_i = ul_config_req->ul_config_request_body.ul_config_pdu_list[i].ulsch_cqi_ri_pdu.ulsch_pdu.ulsch_pdu_rel8.rnti; - uint16_t rnti_j = ul_config_req->ul_config_request_body.ul_config_pdu_list[j].ulsch_cqi_ri_pdu.ulsch_pdu.ulsch_pdu_rel8.rnti; - if (is_ue_same(rnti_i, rnti_j)) - { - LOG_E(MAC, "Problem, two cqis being sent to a single UE for rnti %x\n", - rnti_i); - abort(); - } - } - } - } + // uint8_t num_pdus = ul_config_req->ul_config_request_body.number_of_pdus; + // for (int i = 0; i < num_pdus; i++) + // { + // uint8_t pdu_type = ul_config_req->ul_config_request_body.ul_config_pdu_list[i].pdu_type; + // if (pdu_type != 1) + // { + // continue; + // } + // LOG_I(MAC, "ul_config_req num_pdus: %u pdu_number: %d pdu_type: %u SFN.SF: %d.%d\n", + // num_pdus, i, pdu_type, ul_config_req->sfn_sf >> 4, ul_config_req->sfn_sf & 15); + // for (int j = i + 1; j < num_pdus; j++) + // { + // uint8_t pdu_type2 = ul_config_req->ul_config_request_body.ul_config_pdu_list[j].pdu_type; + // if (pdu_type == pdu_type2) + // { + // uint16_t rnti_i = ul_config_req->ul_config_request_body.ul_config_pdu_list[i].ulsch_cqi_ri_pdu.ulsch_pdu.ulsch_pdu_rel8.rnti; + // uint16_t rnti_j = ul_config_req->ul_config_request_body.ul_config_pdu_list[j].ulsch_cqi_ri_pdu.ulsch_pdu.ulsch_pdu_rel8.rnti; + // if (is_ue_same(rnti_i, rnti_j)) + // { + // LOG_E(MAC, "Problem, two cqis being sent to a single UE for rnti %x\n", + // rnti_i); + // abort(); + // } + // } + // } + // } if (retval!=0) { LOG_E(PHY, "%s() Problem sending retval:%d\n", __FUNCTION__, retval); From 78744a4f7a9cd91f5f378ae3ae16004d24e90ff6 Mon Sep 17 00:00:00 2001 From: Andrew Burger Date: Fri, 18 Sep 2020 13:16:32 -0700 Subject: [PATCH 25/31] Added dropping multi cqis --- nfapi/oai_integration/nfapi_vnf.c | 97 ++++++++++++++++++++++--------- 1 file changed, 70 insertions(+), 27 deletions(-) diff --git a/nfapi/oai_integration/nfapi_vnf.c b/nfapi/oai_integration/nfapi_vnf.c index 84ffa8e945..05aaded7f5 100644 --- a/nfapi/oai_integration/nfapi_vnf.c +++ b/nfapi/oai_integration/nfapi_vnf.c @@ -1253,6 +1253,35 @@ int oai_nfapi_hi_dci0_req(nfapi_hi_dci0_request_t *hi_dci0_req) { return retval; } +static bool remove_ul_config_req_pdu(uint16_t index, nfapi_ul_config_request_t *ul_config_req) +{ + uint8_t num_pdus = ul_config_req->ul_config_request_body.number_of_pdus; + nfapi_ul_config_request_pdu_t *pdu_list = ul_config_req->ul_config_request_body.ul_config_pdu_list; + + if (index > num_pdus) + { + return false; + } + // last element of the list + if (index == ul_config_req->ul_config_request_body.number_of_pdus) + { + ul_config_req->ul_config_request_body.number_of_pdus--; + return true; + } + + // All other element locations + for(int i = index; i < num_pdus; i++) + { + pdu_list[i] = pdu_list[i + 1]; + } + + ul_config_req->ul_config_request_body.number_of_pdus--; + + return true; +} + +#define MAX_DROPPED_INDICIES 10 + int oai_nfapi_ul_config_req(nfapi_ul_config_request_t *ul_config_req) { nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config; ul_config_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!! @@ -1261,34 +1290,48 @@ int oai_nfapi_ul_config_req(nfapi_ul_config_request_t *ul_config_req) { LOG_D(PHY, "[VNF] %s() UL_CONFIG Frame: %d Subframe: %d PDUs:%d rach_prach_frequency_resources:%d srs_present:%d\n", __FUNCTION__, NFAPI_SFNSF2SFN(ul_config_req->sfn_sf), NFAPI_SFNSF2SF(ul_config_req->sfn_sf), ul_config_req->ul_config_request_body.number_of_pdus, ul_config_req->ul_config_request_body.rach_prach_frequency_resources, ul_config_req->ul_config_request_body.srs_present); - int retval = nfapi_vnf_p7_ul_config_req(p7_config, ul_config_req); - // uint8_t num_pdus = ul_config_req->ul_config_request_body.number_of_pdus; - // for (int i = 0; i < num_pdus; i++) - // { - // uint8_t pdu_type = ul_config_req->ul_config_request_body.ul_config_pdu_list[i].pdu_type; - // if (pdu_type != 1) - // { - // continue; - // } - // LOG_I(MAC, "ul_config_req num_pdus: %u pdu_number: %d pdu_type: %u SFN.SF: %d.%d\n", - // num_pdus, i, pdu_type, ul_config_req->sfn_sf >> 4, ul_config_req->sfn_sf & 15); - // for (int j = i + 1; j < num_pdus; j++) - // { - // uint8_t pdu_type2 = ul_config_req->ul_config_request_body.ul_config_pdu_list[j].pdu_type; - // if (pdu_type == pdu_type2) - // { - // uint16_t rnti_i = ul_config_req->ul_config_request_body.ul_config_pdu_list[i].ulsch_cqi_ri_pdu.ulsch_pdu.ulsch_pdu_rel8.rnti; - // uint16_t rnti_j = ul_config_req->ul_config_request_body.ul_config_pdu_list[j].ulsch_cqi_ri_pdu.ulsch_pdu.ulsch_pdu_rel8.rnti; - // if (is_ue_same(rnti_i, rnti_j)) - // { - // LOG_E(MAC, "Problem, two cqis being sent to a single UE for rnti %x\n", - // rnti_i); - // abort(); - // } - // } - // } - // } + uint16_t num_dropped_indicies = 0; + uint16_t *dropped_indicies = malloc(MAX_DROPPED_INDICIES * sizeof(uint16_t)); + uint8_t num_pdus = ul_config_req->ul_config_request_body.number_of_pdus; + for (int i = 0; i < num_pdus; i++) + { + uint8_t pdu_type = ul_config_req->ul_config_request_body.ul_config_pdu_list[i].pdu_type; + if (pdu_type != 1) + { + continue; + } + LOG_I(MAC, "ul_config_req num_pdus: %u pdu_number: %d pdu_type: %u SFN.SF: %d.%d\n", + num_pdus, i, pdu_type, ul_config_req->sfn_sf >> 4, ul_config_req->sfn_sf & 15); + for (int j = i + 1; j < num_pdus; j++) + { + uint8_t pdu_type2 = ul_config_req->ul_config_request_body.ul_config_pdu_list[j].pdu_type; + if (pdu_type == pdu_type2) + { + uint16_t rnti_i = ul_config_req->ul_config_request_body.ul_config_pdu_list[i].ulsch_cqi_ri_pdu.ulsch_pdu.ulsch_pdu_rel8.rnti; + uint16_t rnti_j = ul_config_req->ul_config_request_body.ul_config_pdu_list[j].ulsch_cqi_ri_pdu.ulsch_pdu.ulsch_pdu_rel8.rnti; + if (is_ue_same(rnti_i, rnti_j)) + { + dropped_indicies[i] = j; + num_dropped_indicies++; + LOG_E(MAC, "Problem, two cqis being sent to a single UE for rnti %x dropping one\n", + rnti_i); + } + } + } + } + + for (int i = 0; i < num_dropped_indicies; i++) + { + if (!remove_ul_config_req_pdu(dropped_indicies[i], ul_config_req)) + { + LOG_E(MAC, "%s() Unable to drop bad ul_config_req PDU\n", __FUNCTION__); + abort(); + } + } + free(dropped_indicies); + + int retval = nfapi_vnf_p7_ul_config_req(p7_config, ul_config_req); if (retval!=0) { LOG_E(PHY, "%s() Problem sending retval:%d\n", __FUNCTION__, retval); From d3747fe12205ba9249f39f08b56bbcea4213fda0 Mon Sep 17 00:00:00 2001 From: Andrew Burger Date: Fri, 18 Sep 2020 13:55:48 -0700 Subject: [PATCH 26/31] non-used code --- nfapi/oai_integration/nfapi_vnf.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/nfapi/oai_integration/nfapi_vnf.c b/nfapi/oai_integration/nfapi_vnf.c index 05aaded7f5..f45a4878be 100644 --- a/nfapi/oai_integration/nfapi_vnf.c +++ b/nfapi/oai_integration/nfapi_vnf.c @@ -760,7 +760,7 @@ int phy_cqi_indication(struct nfapi_vnf_p7_config *config, nfapi_cqi_indication_ NFAPI_SFNSF2SF(ind->sfn_sf), ind->cqi_indication_body.number_of_cqis); } - // analyze_cqi_pdus_for_duplicates(ind); + analyze_cqi_pdus_for_duplicates(ind); for (int i=0; i < ind->cqi_indication_body.number_of_cqis; i++) { nfapi_cqi_indication_pdu_t *src_pdu = &ind->cqi_indication_body.cqi_pdu_list[i]; @@ -1262,14 +1262,7 @@ static bool remove_ul_config_req_pdu(uint16_t index, nfapi_ul_config_request_t * { return false; } - // last element of the list - if (index == ul_config_req->ul_config_request_body.number_of_pdus) - { - ul_config_req->ul_config_request_body.number_of_pdus--; - return true; - } - // All other element locations for(int i = index; i < num_pdus; i++) { pdu_list[i] = pdu_list[i + 1]; From f383a5bc5b2c31c6c7fedab791a6dcd3b498a59d Mon Sep 17 00:00:00 2001 From: Andrew Burger Date: Fri, 18 Sep 2020 14:24:20 -0700 Subject: [PATCH 27/31] Wrong code --- nfapi/oai_integration/nfapi_vnf.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/nfapi/oai_integration/nfapi_vnf.c b/nfapi/oai_integration/nfapi_vnf.c index f45a4878be..c5d305e4ea 100644 --- a/nfapi/oai_integration/nfapi_vnf.c +++ b/nfapi/oai_integration/nfapi_vnf.c @@ -1253,7 +1253,7 @@ int oai_nfapi_hi_dci0_req(nfapi_hi_dci0_request_t *hi_dci0_req) { return retval; } -static bool remove_ul_config_req_pdu(uint16_t index, nfapi_ul_config_request_t *ul_config_req) +static bool remove_ul_config_req_pdu(int index, nfapi_ul_config_request_t *ul_config_req) { uint8_t num_pdus = ul_config_req->ul_config_request_body.number_of_pdus; nfapi_ul_config_request_pdu_t *pdu_list = ul_config_req->ul_config_request_body.ul_config_pdu_list; @@ -1262,7 +1262,14 @@ static bool remove_ul_config_req_pdu(uint16_t index, nfapi_ul_config_request_t * { return false; } + // last element of the list + if (index == num_pdus) + { + ul_config_req->ul_config_request_body.number_of_pdus--; + return true; + } + // All other element locations for(int i = index; i < num_pdus; i++) { pdu_list[i] = pdu_list[i + 1]; @@ -1285,7 +1292,7 @@ int oai_nfapi_ul_config_req(nfapi_ul_config_request_t *ul_config_req) { ul_config_req->ul_config_request_body.rach_prach_frequency_resources, ul_config_req->ul_config_request_body.srs_present); uint16_t num_dropped_indicies = 0; - uint16_t *dropped_indicies = malloc(MAX_DROPPED_INDICIES * sizeof(uint16_t)); + int dropped_indicies[MAX_DROPPED_INDICIES]; uint8_t num_pdus = ul_config_req->ul_config_request_body.number_of_pdus; for (int i = 0; i < num_pdus; i++) { @@ -1305,7 +1312,8 @@ int oai_nfapi_ul_config_req(nfapi_ul_config_request_t *ul_config_req) { uint16_t rnti_j = ul_config_req->ul_config_request_body.ul_config_pdu_list[j].ulsch_cqi_ri_pdu.ulsch_pdu.ulsch_pdu_rel8.rnti; if (is_ue_same(rnti_i, rnti_j)) { - dropped_indicies[i] = j; + assert (num_dropped_indicies < MAX_DROPPED_INDICIES); + dropped_indicies[num_dropped_indicies] = j; num_dropped_indicies++; LOG_E(MAC, "Problem, two cqis being sent to a single UE for rnti %x dropping one\n", rnti_i); @@ -1322,7 +1330,6 @@ int oai_nfapi_ul_config_req(nfapi_ul_config_request_t *ul_config_req) { abort(); } } - free(dropped_indicies); int retval = nfapi_vnf_p7_ul_config_req(p7_config, ul_config_req); From fe6d713988a8c1006e6c552291aea9d1826c13ac Mon Sep 17 00:00:00 2001 From: Andrew Burger Date: Fri, 18 Sep 2020 16:58:16 -0700 Subject: [PATCH 28/31] Cleaning up merge request --- nfapi/oai_integration/nfapi_vnf.c | 2 +- nfapi/open-nFAPI/nfapi/src/nfapi_p7.c | 25 ++++------------------ openair2/COMMON/platform_constants.h | 5 ++++- openair2/LAYER2/MAC/eNB_scheduler.c | 2 +- openair2/PHY_INTERFACE/phy_stub_UE.c | 30 ++++----------------------- 5 files changed, 14 insertions(+), 50 deletions(-) diff --git a/nfapi/oai_integration/nfapi_vnf.c b/nfapi/oai_integration/nfapi_vnf.c index b942c06f9f..845fd39daa 100644 --- a/nfapi/oai_integration/nfapi_vnf.c +++ b/nfapi/oai_integration/nfapi_vnf.c @@ -1280,7 +1280,7 @@ static bool remove_ul_config_req_pdu(int index, nfapi_ul_config_request_t *ul_co return true; } -#define MAX_DROPPED_INDICIES 10 +#define MAX_DROPPED_INDICIES 500 int oai_nfapi_ul_config_req(nfapi_ul_config_request_t *ul_config_req) { nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config; diff --git a/nfapi/open-nFAPI/nfapi/src/nfapi_p7.c b/nfapi/open-nFAPI/nfapi/src/nfapi_p7.c index 5130dd6e63..6fea90f860 100755 --- a/nfapi/open-nFAPI/nfapi/src/nfapi_p7.c +++ b/nfapi/open-nFAPI/nfapi/src/nfapi_p7.c @@ -4960,7 +4960,6 @@ static uint8_t unpack_rx_indication_body_value(void *tlv, uint8_t **ppReadPacked { nfapi_rx_indication_body_t *value = (nfapi_rx_indication_body_t *)tlv; - // the rxBodyEnd points to the end of the cqi PDU's Is this a problem? -Andrew NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s value->tl.length in unpack: %u \n", __FUNCTION__, value->tl.length); uint8_t *rxBodyEnd = *ppReadPackedMsg + value->tl.length; @@ -4972,9 +4971,6 @@ static uint8_t unpack_rx_indication_body_value(void *tlv, uint8_t **ppReadPacked // pdu end is past buffer end return 0; } - char foo[1024]; - // NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s:%d: %s\n", __FUNCTION__, - // __LINE__, hexdump(*ppReadPackedMsg, end - *ppReadPackedMsg, foo, sizeof(foo))); if (pull16(ppReadPackedMsg, &value->number_of_pdus, end) == 0) return 0; @@ -5006,8 +5002,6 @@ static uint8_t unpack_rx_indication_body_value(void *tlv, uint8_t **ppReadPacked nfapi_tl_t generic_tl; // NFAPI_RX_UE_INFORMATION_TAG - // NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s:%d: %s\n", __FUNCTION__, - // __LINE__, hexdump(*ppReadPackedMsg, end - *ppReadPackedMsg, foo, sizeof(foo))); if (unpack_tl(ppReadPackedMsg, &generic_tl, end) == 0) { NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s unpack_tl failed\n", __FUNCTION__); @@ -5021,10 +5015,10 @@ static uint8_t unpack_rx_indication_body_value(void *tlv, uint8_t **ppReadPacked NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s generic_tl.tag wrong\n", __FUNCTION__); return 0; } + nfapi_rx_indication_pdu_t *pdu = &value->rx_pdu_list[i]; + pdu->rx_ue_information.tl = generic_tl; - // NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s:%d: %s\n", __FUNCTION__, - // __LINE__, hexdump(*ppReadPackedMsg, end - *ppReadPackedMsg, foo, sizeof(foo))); if (unpack_rx_ue_information_value(&pdu->rx_ue_information, ppReadPackedMsg, end) == 0) { NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s unpack_rx_ue_info failure\n", __FUNCTION__); @@ -5032,8 +5026,6 @@ static uint8_t unpack_rx_indication_body_value(void *tlv, uint8_t **ppReadPacked } // NFAPI_RX_INDICATION_REL8_TAG - // NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s:%d: %s\n", __FUNCTION__, - // __LINE__, hexdump(*ppReadPackedMsg, end - *ppReadPackedMsg, foo, sizeof(foo))); if (unpack_tl(ppReadPackedMsg, &generic_tl, end) == 0) { NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s unpack_tl failed\n", __FUNCTION__); @@ -5048,8 +5040,6 @@ static uint8_t unpack_rx_indication_body_value(void *tlv, uint8_t **ppReadPacked return 0; } pdu->rx_indication_rel8.tl = generic_tl; - // NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s:%d: %s\n", __FUNCTION__, - // __LINE__, hexdump(*ppReadPackedMsg, end - *ppReadPackedMsg, foo, sizeof(foo))); if (unpack_rx_indication_rel8_value(&pdu->rx_indication_rel8, ppReadPackedMsg, end) == 0) { NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s unpack_rx_indication_rel8 failure\n", __FUNCTION__); @@ -5060,8 +5050,6 @@ static uint8_t unpack_rx_indication_body_value(void *tlv, uint8_t **ppReadPacked pdu->rx_indication_rel8.offset); // NFAPI_RX_INDICATION_REL9_TAG - // NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s:%d: %s\n", __FUNCTION__, - // __LINE__, hexdump(*ppReadPackedMsg, end - *ppReadPackedMsg, foo, sizeof(foo))); if (unpack_tl(ppReadPackedMsg, &generic_tl, end) == 0) { NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s unpack_tl failed\n", __FUNCTION__); @@ -5076,8 +5064,6 @@ static uint8_t unpack_rx_indication_body_value(void *tlv, uint8_t **ppReadPacked return 0; } pdu->rx_indication_rel9.tl = generic_tl; - // NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s:%d: %s\n", __FUNCTION__, - // __LINE__, hexdump(*ppReadPackedMsg, end - *ppReadPackedMsg, foo, sizeof(foo))); if (unpack_rx_indication_rel9_value(&pdu->rx_indication_rel9, ppReadPackedMsg, end) == 0) { NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s unpack_rx_indication_rel9 failure\n", __FUNCTION__); @@ -5092,19 +5078,16 @@ static uint8_t unpack_rx_indication_body_value(void *tlv, uint8_t **ppReadPacked { uint32_t length = pdu->rx_indication_rel8.length; value->rx_pdu_list[i].data = nfapi_p7_allocate(length, config); - // NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s:%d: %s\n", __FUNCTION__, - // __LINE__, hexdump(*ppReadPackedMsg, end - *ppReadPackedMsg, foo, sizeof(foo))); + if (pullarray8(ppReadPackedMsg, pdu->data, length, length, end) == 0) { NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s pullarray8 failure\n", __FUNCTION__); return 0; } - // NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s:%d: %s\n", __FUNCTION__, - // __LINE__, hexdump(*ppReadPackedMsg, end - *ppReadPackedMsg, foo, sizeof(foo))); + } } - NFAPI_TRACE(NFAPI_TRACE_INFO, "%s Success!\n", __FUNCTION__); return 1; } diff --git a/openair2/COMMON/platform_constants.h b/openair2/COMMON/platform_constants.h index e1dc28a71b..df010b1d6b 100644 --- a/openair2/COMMON/platform_constants.h +++ b/openair2/COMMON/platform_constants.h @@ -84,7 +84,10 @@ #define MAX_eNB 2 #define MAX_gNB 2 #else - #define MAX_MOBILES_PER_ENB 20 // This was maxed at 4 Why? -Andrew + // TODO: Change after gaining stability on 20 UES or less + // Make sure when changing these two fields to also change + // "NUMBER_OF_UE_MAX" constant in targets/COMMON/openairinterface5g_limits.h - Andrew + #define MAX_MOBILES_PER_ENB 20 #define MAX_MOBILES_PER_ENB_NB_IoT 20 #define MAX_MOBILES_PER_GNB 2//16 #define MAX_eNB 2 diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c index d43e8fee2e..ac5131174b 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler.c +++ b/openair2/LAYER2/MAC/eNB_scheduler.c @@ -583,7 +583,7 @@ eNB_dlsch_ulsch_scheduler(module_id_t module_idP, } // If we ever see a difference this big something is very wrong // This threshold is arbitrary - if (delta > 8500 || delta == 0) // 900 frames + if (delta > 8500 || delta == 0) // 850 frames { LOG_I(MAC, "scheduler ignoring outerspace %d.%d -> %d.%d = %d\n", eNB->frame, eNB->subframe, frameP, subframeP, delta); diff --git a/openair2/PHY_INTERFACE/phy_stub_UE.c b/openair2/PHY_INTERFACE/phy_stub_UE.c index 6ead4c07a3..19dcfa9caa 100644 --- a/openair2/PHY_INTERFACE/phy_stub_UE.c +++ b/openair2/PHY_INTERFACE/phy_stub_UE.c @@ -95,8 +95,6 @@ void fill_rx_indication_UE_MAC(module_id_t Mod_id, pdu->rx_indication_rel9.tl.tag = NFAPI_RX_INDICATION_REL9_TAG; pdu->rx_indication_rel9.timing_advance_r9 = 0; - // What is this? - Andrew - // ulsch_buffer is necessary to keep its value. pdu->data = malloc(buflen); memcpy(pdu->data, ulsch_buffer, buflen); LOG_I(MAC, "buflen of rx_ind pdu_data = %u SFN.SF: %d.%d\n", buflen, @@ -951,9 +949,6 @@ int memcpy_dl_config_req(L1_rxtx_proc_t *proc, req->dl_config_request_body.dl_config_pdu_list[i]; } - LOG_I(MAC, "dl_config_req in memcpy Frame: %d Subframe: %d\n", - p->sfn_sf >> 4, p->sfn_sf & 15); - if (!put_queue(&dl_config_req_queue, p)) { free(p); } @@ -1220,8 +1215,6 @@ void *ue_standalone_pnf_task(void *context) } else { - LOG_I(MAC, "dl_config_req fresh off socket Frame: %d Subframe: %d\n", - dl_config_req.sfn_sf >> 4, dl_config_req.sfn_sf & 15); // check to see if dl_config_req is null memcpy_dl_config_req(NULL, NULL, &dl_config_req); } @@ -1347,7 +1340,7 @@ static void print_rx_ind(nfapi_rx_indication_t *p) { int encoded_size = -1; char buffer[1024]; - char dump[1024]; + switch (msg_type) { case NFAPI_RACH_INDICATION: @@ -1362,28 +1355,13 @@ static void print_rx_ind(nfapi_rx_indication_t *p) UL->crc_ind.crc_indication_body.number_of_crcs); break; case NFAPI_RX_ULSCH_INDICATION: - print_rx_ind(&UL->rx_ind); encoded_size = nfapi_p7_message_pack(&UL->rx_ind, buffer, sizeof(buffer), NULL); - LOG_I(MAC, "RX_IND sent to Proxy, Size: %d Frame %d Subframe %d rx_ind.tl.length: %u num_pdus: %u\nHexDUMP %s\n", + LOG_I(MAC, "RX_IND sent to Proxy, Size: %d Frame %d Subframe %d rx_ind.tl.length: %u num_pdus: %u\n", encoded_size, NFAPI_SFNSF2SFN(UL->rx_ind.sfn_sf), NFAPI_SFNSF2SF(UL->rx_ind.sfn_sf), - UL->rx_ind.rx_indication_body.tl.length, UL->rx_ind.rx_indication_body.number_of_pdus, - hexdump(buffer, encoded_size, dump, sizeof(dump))); - // nfapi_rx_indication_t test_ind; - // if (nfapi_p7_message_unpack(buffer, encoded_size, &test_ind, sizeof(test_ind), NULL) < 0) - // { - // LOG_E(MAC, "could not unpack rx_ind right after packing encoded_size: %d\n", encoded_size); - // abort(); - // } - // print_rx_ind(&test_ind); - // char test_buffer[1024]; - // int encoded_size2 = nfapi_p7_message_pack(&test_ind, test_buffer, sizeof(test_buffer), NULL); - // if (encoded_size2 < 0) - // { - // LOG_E(MAC, "could not pack rx_ind right after unpacking encoded_size2: %d\n", encoded_size2); - // } + UL->rx_ind.rx_indication_body.tl.length, UL->rx_ind.rx_indication_body.number_of_pdus); break; case NFAPI_RX_CQI_INDICATION: - encoded_size = nfapi_p7_message_pack(&UL->cqi_ind, buffer, sizeof(buffer), NULL); // Check pdu->ul_cqi_information.channel = 1 + encoded_size = nfapi_p7_message_pack(&UL->cqi_ind, buffer, sizeof(buffer), NULL); LOG_I(MAC, "CQI_IND sent to Proxy, Size: %d num_cqis: %u\n", encoded_size, UL->cqi_ind.cqi_indication_body.number_of_cqis); break; From 634872b611891752caac8274008ac07a0d5c336a Mon Sep 17 00:00:00 2001 From: Andrew Burger Date: Fri, 18 Sep 2020 17:27:42 -0700 Subject: [PATCH 29/31] Changing back to 10 max indicies --- nfapi/oai_integration/nfapi_vnf.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/nfapi/oai_integration/nfapi_vnf.c b/nfapi/oai_integration/nfapi_vnf.c index 845fd39daa..8388c65d37 100644 --- a/nfapi/oai_integration/nfapi_vnf.c +++ b/nfapi/oai_integration/nfapi_vnf.c @@ -1262,12 +1262,6 @@ static bool remove_ul_config_req_pdu(int index, nfapi_ul_config_request_t *ul_co { return false; } - // last element of the list - if (index == num_pdus) - { - ul_config_req->ul_config_request_body.number_of_pdus--; - return true; - } // All other element locations for(int i = index; i < num_pdus; i++) @@ -1280,7 +1274,7 @@ static bool remove_ul_config_req_pdu(int index, nfapi_ul_config_request_t *ul_co return true; } -#define MAX_DROPPED_INDICIES 500 +#define MAX_DROPPED_INDICIES 10 int oai_nfapi_ul_config_req(nfapi_ul_config_request_t *ul_config_req) { nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config; From 129b95eec5b26b79da8977fc717fe5a096614d5f Mon Sep 17 00:00:00 2001 From: Andrew Burger Date: Fri, 18 Sep 2020 17:28:21 -0700 Subject: [PATCH 30/31] removing comment --- nfapi/oai_integration/nfapi_vnf.c | 1 - 1 file changed, 1 deletion(-) diff --git a/nfapi/oai_integration/nfapi_vnf.c b/nfapi/oai_integration/nfapi_vnf.c index 8388c65d37..063b1d9252 100644 --- a/nfapi/oai_integration/nfapi_vnf.c +++ b/nfapi/oai_integration/nfapi_vnf.c @@ -1263,7 +1263,6 @@ static bool remove_ul_config_req_pdu(int index, nfapi_ul_config_request_t *ul_co return false; } - // All other element locations for(int i = index; i < num_pdus; i++) { pdu_list[i] = pdu_list[i + 1]; From 516de3ae9c8b658fd17d29b0400d35e91b331f8d Mon Sep 17 00:00:00 2001 From: Andrew Burger Date: Sat, 19 Sep 2020 11:30:03 -0700 Subject: [PATCH 31/31] fixing remove ul_config_req pdu func --- nfapi/oai_integration/nfapi_vnf.c | 73 +++++++++------------- nfapi/open-nFAPI/nfapi/src/nfapi_p7.c | 11 +--- openair2/COMMON/platform_constants.h | 2 - targets/COMMON/openairinterface5g_limits.h | 10 +++ 4 files changed, 42 insertions(+), 54 deletions(-) diff --git a/nfapi/oai_integration/nfapi_vnf.c b/nfapi/oai_integration/nfapi_vnf.c index 063b1d9252..8b03425daf 100644 --- a/nfapi/oai_integration/nfapi_vnf.c +++ b/nfapi/oai_integration/nfapi_vnf.c @@ -710,13 +710,9 @@ int phy_sr_indication(struct nfapi_vnf_p7_config *config, nfapi_sr_indication_t return 1; } -static bool is_ue_same(int ue_id_1, int ue_id_2) +static bool is_ue_same(uint16_t ue_id_1, uint16_t ue_id_2) { - if (ue_id_1 == ue_id_2) - { - return true; - } - return false; + return (ue_id_1 == ue_id_2); } static void analyze_cqi_pdus_for_duplicates(nfapi_cqi_indication_t *ind) @@ -731,8 +727,8 @@ static void analyze_cqi_pdus_for_duplicates(nfapi_cqi_indication_t *ind) for (int j = i + 1; j < num_cqis; j++) { - int rnti_i = ind->cqi_indication_body.cqi_pdu_list[i].rx_ue_information.rnti; - int rnti_j = ind->cqi_indication_body.cqi_pdu_list[j].rx_ue_information.rnti; + uint16_t rnti_i = ind->cqi_indication_body.cqi_pdu_list[i].rx_ue_information.rnti; + uint16_t rnti_j = ind->cqi_indication_body.cqi_pdu_list[j].rx_ue_information.rnti; if (is_ue_same(rnti_i, rnti_j)) { LOG_E(MAC, "Problem, two cqis received from a single UE for rnti %x\n", @@ -1253,28 +1249,25 @@ int oai_nfapi_hi_dci0_req(nfapi_hi_dci0_request_t *hi_dci0_req) { return retval; } -static bool remove_ul_config_req_pdu(int index, nfapi_ul_config_request_t *ul_config_req) +static void remove_ul_config_req_pdu(int index, nfapi_ul_config_request_t *ul_config_req) { - uint8_t num_pdus = ul_config_req->ul_config_request_body.number_of_pdus; + int num_pdus = ul_config_req->ul_config_request_body.number_of_pdus; nfapi_ul_config_request_pdu_t *pdu_list = ul_config_req->ul_config_request_body.ul_config_pdu_list; - if (index > num_pdus) + if (index >= num_pdus || index < 0) { - return false; + LOG_E(MAC, "%s() Unable to drop bad ul_config_req PDU\n", __FUNCTION__); + abort(); } - for(int i = index; i < num_pdus; i++) + for(int i = index; i + 1 < num_pdus; i++) { pdu_list[i] = pdu_list[i + 1]; } ul_config_req->ul_config_request_body.number_of_pdus--; - - return true; } -#define MAX_DROPPED_INDICIES 10 - int oai_nfapi_ul_config_req(nfapi_ul_config_request_t *ul_config_req) { nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config; ul_config_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!! @@ -1284,43 +1277,39 @@ int oai_nfapi_ul_config_req(nfapi_ul_config_request_t *ul_config_req) { __FUNCTION__, NFAPI_SFNSF2SFN(ul_config_req->sfn_sf), NFAPI_SFNSF2SF(ul_config_req->sfn_sf), ul_config_req->ul_config_request_body.number_of_pdus, ul_config_req->ul_config_request_body.rach_prach_frequency_resources, ul_config_req->ul_config_request_body.srs_present); - uint16_t num_dropped_indicies = 0; - int dropped_indicies[MAX_DROPPED_INDICIES]; - uint8_t num_pdus = ul_config_req->ul_config_request_body.number_of_pdus; + int num_pdus = ul_config_req->ul_config_request_body.number_of_pdus; + nfapi_ul_config_request_pdu_t *pdu_list = ul_config_req->ul_config_request_body.ul_config_pdu_list; for (int i = 0; i < num_pdus; i++) { - uint8_t pdu_type = ul_config_req->ul_config_request_body.ul_config_pdu_list[i].pdu_type; - if (pdu_type != 1) + uint8_t pdu_type = pdu_list[i].pdu_type; + if (pdu_type != NFAPI_UL_CONFIG_ULSCH_CQI_RI_PDU_TYPE) { continue; } + LOG_I(MAC, "ul_config_req num_pdus: %u pdu_number: %d pdu_type: %u SFN.SF: %d.%d\n", num_pdus, i, pdu_type, ul_config_req->sfn_sf >> 4, ul_config_req->sfn_sf & 15); + for (int j = i + 1; j < num_pdus; j++) { - uint8_t pdu_type2 = ul_config_req->ul_config_request_body.ul_config_pdu_list[j].pdu_type; - if (pdu_type == pdu_type2) + uint8_t pdu_type2 = pdu_list[j].pdu_type; + if (pdu_type != pdu_type2) { - uint16_t rnti_i = ul_config_req->ul_config_request_body.ul_config_pdu_list[i].ulsch_cqi_ri_pdu.ulsch_pdu.ulsch_pdu_rel8.rnti; - uint16_t rnti_j = ul_config_req->ul_config_request_body.ul_config_pdu_list[j].ulsch_cqi_ri_pdu.ulsch_pdu.ulsch_pdu_rel8.rnti; - if (is_ue_same(rnti_i, rnti_j)) - { - assert (num_dropped_indicies < MAX_DROPPED_INDICIES); - dropped_indicies[num_dropped_indicies] = j; - num_dropped_indicies++; - LOG_E(MAC, "Problem, two cqis being sent to a single UE for rnti %x dropping one\n", - rnti_i); - } + continue; } - } - } - for (int i = 0; i < num_dropped_indicies; i++) - { - if (!remove_ul_config_req_pdu(dropped_indicies[i], ul_config_req)) - { - LOG_E(MAC, "%s() Unable to drop bad ul_config_req PDU\n", __FUNCTION__); - abort(); + uint16_t rnti_i = pdu_list[i].ulsch_cqi_ri_pdu.ulsch_pdu.ulsch_pdu_rel8.rnti; + uint16_t rnti_j = pdu_list[j].ulsch_cqi_ri_pdu.ulsch_pdu.ulsch_pdu_rel8.rnti; + if (!is_ue_same(rnti_i, rnti_j)) + { + continue; + } + remove_ul_config_req_pdu(j, ul_config_req); + j--; + num_pdus--; + + LOG_E(MAC, "Problem, two cqis being sent to a single UE for rnti %x dropping one\n", + rnti_i); } } diff --git a/nfapi/open-nFAPI/nfapi/src/nfapi_p7.c b/nfapi/open-nFAPI/nfapi/src/nfapi_p7.c index 6fea90f860..4214fbf5fe 100755 --- a/nfapi/open-nFAPI/nfapi/src/nfapi_p7.c +++ b/nfapi/open-nFAPI/nfapi/src/nfapi_p7.c @@ -6144,8 +6144,6 @@ int nfapi_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUn nfapi_p7_message_header_t *pMessageHeader = (nfapi_p7_message_header_t*)pUnpackedBuf; uint8_t *pReadPackedMessage = pMessageBuf; uint8_t *end = pMessageBuf + messageBufLen; - uint8_t *end_unpacked_buf = pUnpackedBuf + unpackedBufLen; - uint8_t *start_unpacked_buf = pUnpackedBuf; if (pMessageBuf == NULL || pUnpackedBuf == NULL) { @@ -6354,16 +6352,9 @@ int nfapi_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUn break; } - if (pMessageHeader->message_id == NFAPI_RX_ULSCH_INDICATION) - { - char foobar[1024]; - NFAPI_TRACE(NFAPI_TRACE_ERROR, "Biden %s:%d: %s\n", __FUNCTION__, - __LINE__, hexdump(pUnpackedBuf, end_unpacked_buf - start_unpacked_buf, foobar, sizeof(foobar))); - } - if(result == 0) return -1; - else + else return 0; } diff --git a/openair2/COMMON/platform_constants.h b/openair2/COMMON/platform_constants.h index df010b1d6b..6d3e133975 100644 --- a/openair2/COMMON/platform_constants.h +++ b/openair2/COMMON/platform_constants.h @@ -85,8 +85,6 @@ #define MAX_gNB 2 #else // TODO: Change after gaining stability on 20 UES or less - // Make sure when changing these two fields to also change - // "NUMBER_OF_UE_MAX" constant in targets/COMMON/openairinterface5g_limits.h - Andrew #define MAX_MOBILES_PER_ENB 20 #define MAX_MOBILES_PER_ENB_NB_IoT 20 #define MAX_MOBILES_PER_GNB 2//16 diff --git a/targets/COMMON/openairinterface5g_limits.h b/targets/COMMON/openairinterface5g_limits.h index 995b8d7c3b..fe4f7b651d 100644 --- a/targets/COMMON/openairinterface5g_limits.h +++ b/targets/COMMON/openairinterface5g_limits.h @@ -1,6 +1,8 @@ #ifndef OPENAIRINTERFACE5G_LIMITS_H_ #define OPENAIRINTERFACE5G_LIMITS_H_ +#include "platform_constants.h" + #if 1 /*defined(CBMIMO1) || defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_LMSSDR) || defined(OAI_ADRV9371_ZC706)*/ # define NUMBER_OF_eNB_MAX 1 # define NUMBER_OF_gNB_MAX 1 @@ -107,4 +109,12 @@ and the other are using MAX_MOBILES_PER_ENB in for-loop. # endif #endif +#if MAX_MOBILES_PER_ENB != NUMBER_OF_UE_MAX +#error "Invalid configuration of UE's" +#endif + +#if MAX_MOBILES_PER_ENB_NB_IoT != NUMBER_OF_UE_MAX +#error "Invalid configuration of UE's" +#endif + #endif /* OPENAIRINTERFACE5G_LIMITS_H_ */