diff --git a/nfapi/oai_integration/nfapi_vnf.c b/nfapi/oai_integration/nfapi_vnf.c index d5090f1c27d402a46f593e87ca9ba99638b626e7..3e69019de78395eca5aa8d105c9243bd1e187224 100644 --- a/nfapi/oai_integration/nfapi_vnf.c +++ b/nfapi/oai_integration/nfapi_vnf.c @@ -1220,7 +1220,7 @@ int oai_nfapi_tx_req(nfapi_tx_request_t *tx_req) nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config; tx_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!! tx_req->header.message_id = NFAPI_TX_REQUEST; - LOG_D(PHY, "[VNF] %s() TX_REQ sfn_sf:%d number_of_pdus:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(tx_req->sfn_sf), tx_req->tx_request_body.number_of_pdus); + LOG_I(PHY, "[VNF] %s() TX_REQ sfn_sf:%d number_of_pdus:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(tx_req->sfn_sf), tx_req->tx_request_body.number_of_pdus); int retval = nfapi_vnf_p7_tx_req(p7_config, tx_req); if (retval!=0) { diff --git a/openair2/LAYER2/MAC/ue_procedures.c b/openair2/LAYER2/MAC/ue_procedures.c index a0f18175d6dc62a6ac9f4721a792e122e1c58d5b..6689f762340d34c9e3fe784023d77976aa1160ae 100644 --- a/openair2/LAYER2/MAC/ue_procedures.c +++ b/openair2/LAYER2/MAC/ue_procedures.c @@ -160,7 +160,6 @@ void ue_init_mac(module_id_t module_idP) { UE_mac_inst[module_idP].SI_Decoded = 0; next_ra_frame = 0; next_Mod_id = 0; - tx_req_num_elems = 0; } } @@ -414,7 +413,7 @@ ue_send_sdu(module_id_t module_idP, if (payload_ptr != NULL) { for (i = 0; i < num_ce; i++) { - LOG_D(MAC, "ce %d : %d\n",i,rx_ces[i]); + LOG_I(MAC, "ce %d : %d\n",i,rx_ces[i]); switch (rx_ces[i]) { case UE_CONT_RES: LOG_I(MAC, diff --git a/openair2/PHY_INTERFACE/phy_stub_UE.c b/openair2/PHY_INTERFACE/phy_stub_UE.c index d0ff78748ed286a3afb4f868938bb9ed3664edd2..7020e102289161455764f6342577f4095536f1e9 100644 --- a/openair2/PHY_INTERFACE/phy_stub_UE.c +++ b/openair2/PHY_INTERFACE/phy_stub_UE.c @@ -757,7 +757,7 @@ void dl_config_req_UE_MAC_dci(int sfn, nfapi_dl_config_request_pdu_t *dci, nfapi_dl_config_request_pdu_t *dlsch, int num_ue, - nfapi_tx_request_pdu_t *tx_request_pdu_list) { + nfapi_tx_req_pdu_list_t *tx_req_pdu_list) { DevAssert(dci->pdu_type == NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE); DevAssert(dlsch->pdu_type == NFAPI_DL_CONFIG_DLSCH_PDU_TYPE); @@ -771,7 +771,7 @@ void dl_config_req_UE_MAC_dci(int sfn, } const int pdu_index = dlsch->dlsch_pdu.dlsch_pdu_rel8.pdu_index; - if (pdu_index < 0 || pdu_index >= tx_req_num_elems) { + if (pdu_index < 0 || pdu_index >= tx_req_pdu_list->num_pdus) { LOG_E(MAC, "%s(): Problem with receiving data: " "sfn/sf:%d.%d PDU size:%d, TX_PDU index: %d\n", @@ -780,21 +780,21 @@ void dl_config_req_UE_MAC_dci(int sfn, return; } - LOG_D(MAC, "%s() rnti value: 0x%x rnti type: %d\n", __func__, + LOG_I(MAC, "%s() rnti value: 0x%x rnti type: %d\n", __func__, rnti, rnti_type); if (rnti_type == 1) { // C-RNTI (Normal DLSCH case) for (int ue_id = 0; ue_id < num_ue; ue_id++) { if (UE_mac_inst[ue_id].crnti == rnti) { - LOG_D(MAC, + LOG_I(MAC, "%s() Received data: sfn/sf:%d.%d " "size:%d, TX_PDU index: %d, tx_req_num_elems: %d \n", __func__, sfn, sf, dci->pdu_size, dlsch->dlsch_pdu.dlsch_pdu_rel8.pdu_index, - tx_req_num_elems); + tx_req_pdu_list->num_pdus); ue_send_sdu(ue_id, 0, sfn, sf, - tx_request_pdu_list[pdu_index].segments[0].segment_data, - tx_request_pdu_list[pdu_index].segments[0].segment_length, + tx_req_pdu_list->pdus[pdu_index].segments[0].segment_data, + tx_req_pdu_list->pdus[pdu_index].segments[0].segment_length, 0); return; } @@ -806,16 +806,16 @@ void dl_config_req_UE_MAC_dci(int sfn, continue; ue_decode_si(ue_id, 0, sfn, 0, - tx_request_pdu_list[pdu_index].segments[0].segment_data, - tx_request_pdu_list[pdu_index].segments[0].segment_length); + tx_req_pdu_list->pdus[pdu_index].segments[0].segment_data, + tx_req_pdu_list->pdus[pdu_index].segments[0].segment_length); } } else if (rnti == 0xFFFE) { /* PI-RNTI */ for (int ue_id = 0; ue_id < num_ue; ue_id++) { LOG_I(MAC, "%s() Received paging message: sfn/sf:%d.%d\n", __func__, sfn, sf); ue_decode_p(ue_id, 0, sfn, 0, - tx_request_pdu_list[pdu_index].segments[0].segment_data, - tx_request_pdu_list[pdu_index].segments[0].segment_length); + tx_req_pdu_list->pdus[pdu_index].segments[0].segment_data, + tx_req_pdu_list->pdus[pdu_index].segments[0].segment_length); } } else if (rnti == 0x0002) { /* RA-RNTI */ for (int ue_id = 0; ue_id < num_ue; ue_id++) { @@ -837,10 +837,10 @@ void dl_config_req_UE_MAC_dci(int sfn, __func__, UE_mac_inst[ue_id].RA_prach_resources.ra_PreambleIndex); ue_process_rar(ue_id, 0, sfn, ra_rnti, //RA-RNTI - tx_request_pdu_list[pdu_index].segments[0].segment_data, + tx_req_pdu_list->pdus[pdu_index].segments[0].segment_data, &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); + tx_req_pdu_list->pdus[pdu_index].segments[0].segment_data); // 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 @@ -880,7 +880,7 @@ void dl_config_req_UE_MAC_mch(int sfn, int sf, nfapi_dl_config_request_pdu_t *mch, int num_ue, - nfapi_tx_request_pdu_t *tx_request_pdu_list) { + nfapi_tx_req_pdu_list_t *tx_req_pdu_list) { DevAssert(mch->pdu_type == NFAPI_DL_CONFIG_MCH_PDU_TYPE); for (int ue_id = 0; ue_id < num_ue; ue_id++) { @@ -895,7 +895,7 @@ void dl_config_req_UE_MAC_mch(int sfn, } else { const int pdu_index = mch->mch_pdu.mch_pdu_rel8.pdu_index; - if (pdu_index < 0 || pdu_index >= tx_req_num_elems) { + if (pdu_index < 0 || pdu_index >= tx_req_pdu_list->num_pdus) { LOG_E(MAC, "%s(): Problem with receiving data: " "sfn/sf:%d.%d PDU size:%d, TX_PDU index: %d\n", @@ -904,8 +904,8 @@ void dl_config_req_UE_MAC_mch(int sfn, return; } ue_send_mch_sdu(ue_id, 0, sfn, - tx_request_pdu_list[pdu_index].segments[0].segment_data, - tx_request_pdu_list[pdu_index].segments[0].segment_length, + tx_req_pdu_list->pdus[pdu_index].segments[0].segment_data, + tx_req_pdu_list->pdus[pdu_index].segments[0].segment_length, 0,0); } } @@ -928,17 +928,13 @@ void hi_dci0_req_UE_MAC(int sfn, } } -// TODO: Find a way to drop more un-wanted dl_config_reqs & tx_reqs -// In the current state we let alot of unecessary packets through -// during the ra-rnti/pi-rnti/si-rnti in the startup state before a c-rnti is assigned -// Right now we are just accepting all dl_config_req and tx_reqs -// when the c-rnti is 0 - Andrew -static bool is_my_dl_config_req(nfapi_dl_config_request_t *req) +static bool is_my_dl_config_req(const nfapi_dl_config_request_t *req) { - bool is_my_rnti = true; - const rnti_t my_rnti = UE_mac_inst[0].crnti; // 0 for standalone pnf mode. TODO: Make this more clear - Andrew - for (int i = 0; i < req->dl_config_request_body.number_pdu; i++) + const rnti_t my_rnti = UE_mac_inst[0].crnti; + int num_pdus = req->dl_config_request_body.number_pdu; + // look through list of pdus for rnti type 1 with my_rnti (normal dlsch case) + for (int i = 0; i < num_pdus; i++) { nfapi_dl_config_request_pdu_t *pdu = &req->dl_config_request_body.dl_config_pdu_list[i]; const int pdu_type = pdu->pdu_type; @@ -946,21 +942,128 @@ static bool is_my_dl_config_req(nfapi_dl_config_request_t *req) { const rnti_t dci_rnti = pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti; const int rnti_type = pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti_type; - if (rnti_type == 1 && dci_rnti != my_rnti) + if (rnti_type == 1 && dci_rnti == my_rnti) { - is_my_rnti = false; - LOG_I(MAC, "RNTI is not mine for pdu_type: %d my_rnti: 0x%x dci_rnti: 0x%x\n", - pdu_type, my_rnti, dci_rnti); + return true; } - else + } + else if(pdu_type != NFAPI_DL_CONFIG_DLSCH_PDU_TYPE) + { + return true; // Because these two pdu_types are coupled and we have to accept all other pdu_types + } + } + + // Look for broadcasted rnti types + for (int i = 0; i < num_pdus; i++) + { + nfapi_dl_config_request_pdu_t *pdu = &req->dl_config_request_body.dl_config_pdu_list[i]; + const int pdu_type = pdu->pdu_type; + if (pdu_type == NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE) + { + const int rnti_type = pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti_type; + if (rnti_type != 1) { - is_my_rnti = true; - break; + return true; } } } - return is_my_rnti; + + return false; +} + +static int get_dlsch_pdu_indicies(const nfapi_dl_config_request_t *req, int *pdu_indicies, size_t max_pdu_indicies) +{ + + const rnti_t my_rnti = UE_mac_inst[0].crnti; + int num_pdus = req->dl_config_request_body.number_pdu; + size_t num_pdu_indicies = 0; + for (int i = 0; i < num_pdus; i++) + { + nfapi_dl_config_request_pdu_t *pdu = &req->dl_config_request_body.dl_config_pdu_list[i]; + const int pdu_type = pdu->pdu_type; + if (pdu_type == NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE) + { + const rnti_t dci_rnti = pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti; + const int rnti_type = pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti_type; + if (rnti_type == 1 && dci_rnti != my_rnti && i + 1 < num_pdus) + { + if (num_pdu_indicies < max_pdu_indicies) + { + pdu_indicies[num_pdu_indicies++] = i + 1; // This an index of a dlsch pdu which contains a pdu_index field + } + i++; + } + } + } + + return num_pdu_indicies; +} + +typedef struct dlsch_pdu_indicies_t +{ + size_t num_indicies; + int *indicies; +}dlsch_pdu_indicies_t; + +static void print_lists(const dlsch_pdu_indicies_t *dlsch_list, const nfapi_tx_req_pdu_list_t *tx_pdu_list) +{ + const size_t max_result = 1024; + uint16_t num_pdus = tx_pdu_list->num_pdus; + char dlsch_result[max_result]; + char tx_pdu_result[max_result]; + + snprintf(dlsch_result, max_result, "dlsch_list::"); + snprintf(tx_pdu_result, max_result, "tx_pdu_list::"); + + for (size_t i = 0; i < num_pdus; ++i) + { + int dlsch_len = strlen(dlsch_result); + int tx_pdu_len = strlen(tx_pdu_result); + if (tx_pdu_len >= max_result - 1 || dlsch_len >= max_result - 1) + { + break; + } + snprintf(dlsch_result + dlsch_len, max_result - dlsch_len, " %d", dlsch_list->indicies[i]); + snprintf(tx_pdu_result + tx_pdu_len, max_result - tx_pdu_len, " %d", tx_pdu_list->pdus[i].pdu_index); + } + + LOG_E(MAC, "%s\n", dlsch_result); + LOG_E(MAC, "%s\n", tx_pdu_result); +} + +static bool match_dl_config_req(void *wanted_vp, void *candidate_vp) +{ + dlsch_pdu_indicies_t *wanted = wanted_vp; + const nfapi_tx_req_pdu_list_t *candidate = candidate_vp; + + int num_pdus = candidate->num_pdus; + if (wanted->num_indicies != num_pdus) + { + LOG_E(MAC, "tx_req_pdus not equal to dlsch_pdus:: %zu != %d\n", wanted->num_indicies, num_pdus); + return false; + } + for (int i = 0; i < num_pdus; ++i) + { + bool found = false; + const nfapi_tx_request_pdu_t *pdu = &candidate->pdus[i]; + for (int j = 0; j < num_pdus; ++j) + { + if (pdu->pdu_index == wanted->indicies[i]) + { + found = true; + break; + } + } + if (!found) + { + LOG_E(MAC, "Could not find tx_req_pdu index to match dlsch_index for pdu_index: %d\n", + pdu->pdu_index); + print_lists(wanted, candidate); + return false; + } + } + return true; } // The following set of memcpy functions should be getting called as callback @@ -969,15 +1072,29 @@ int memcpy_dl_config_req(L1_rxtx_proc_t *proc, nfapi_pnf_p7_config_t *pnf_p7, nfapi_dl_config_request_t *req) { - if (!is_my_dl_config_req(req)) + if (!is_my_dl_config_req(req) && req->dl_config_request_body.number_pdu <= 2) { - // TODO: Add in some kind of log or check to identify that what is being removed from the queue is correct. - Andrew + const size_t max_dlsch_pdu_indicies = 1024; + int dlsch_pdu_indicies[max_dlsch_pdu_indicies]; // Need to remove corresponding tx_req (comes before dl_config_req always) - void *p = unqueue(&tx_req_pdu_queue); - if (p) + int num_dlsch_pdu_indicies = get_dlsch_pdu_indicies(req, dlsch_pdu_indicies, max_dlsch_pdu_indicies); + if (num_dlsch_pdu_indicies == 0) { - free(p); + LOG_E(MAC, "COULD NOT FIND DLSCH_PDU_INDICIES for dl_config_req SFN.SF: %d.%d", + req->sfn_sf >> 4, req->sfn_sf & 15); + return 0; } + dlsch_pdu_indicies_t wanted = {num_dlsch_pdu_indicies, dlsch_pdu_indicies}; + nfapi_tx_req_pdu_list_t *matched = unqueue_matching(&tx_req_pdu_queue, match_dl_config_req, &wanted); + if (!matched) + { + LOG_W(MAC, "Could not unqueue_matching\n"); + return 0; + } + + LOG_E(MAC, "REMOVING.. dl_config_req & tx_req\n"); + free(matched); + return 0; } @@ -1007,6 +1124,7 @@ int memcpy_dl_config_req(L1_rxtx_proc_t *proc, if (!put_queue(&dl_config_req_queue, p)) { free(p); } + LOG_I(MAC, "DL_CONFIG_REQ QUEUE: %zu", dl_config_req_queue.num_items); return 0; } @@ -1071,10 +1189,30 @@ int memcpy_ul_config_req(L1_rxtx_proc_t *proc, nfapi_pnf_p7_config_t *pnf_p7, nf return 0; } +void nfapi_free_tx_req_pdu_list(nfapi_tx_req_pdu_list_t *list) +{ + // free all the p[i].segments[j].segment_data memory + int num_pdus = list->num_pdus; + nfapi_tx_request_pdu_t *pdus = list->pdus; + for (int i = 0; i < num_pdus; i++) { + int num_segments = pdus[i].num_segments; + for (int j = 0; j < num_segments; j++) { + free(pdus[i].segments[j].segment_data); + pdus[i].segments[j].segment_data = NULL; + } + } + free(list); +} + int memcpy_tx_req(nfapi_pnf_p7_config_t *pnf_p7, nfapi_tx_request_t *req) { - tx_req_num_elems = req->tx_request_body.number_of_pdus; - nfapi_tx_request_pdu_t *p = calloc(tx_req_num_elems, sizeof(nfapi_tx_request_pdu_t)); - for (int i = 0; i < tx_req_num_elems; i++) { + + int num_pdus = req->tx_request_body.number_of_pdus; + + nfapi_tx_req_pdu_list_t *list = calloc(1, sizeof(nfapi_tx_req_pdu_list_t) + num_pdus * sizeof(nfapi_tx_request_pdu_t)); + list->num_pdus = num_pdus; + nfapi_tx_request_pdu_t *p = list->pdus; + + for (int i = 0; i < num_pdus; i++) { p[i].num_segments = req->tx_request_body.tx_pdu_list[i].num_segments; p[i].pdu_index = req->tx_request_body.tx_pdu_list[i].pdu_index; p[i].pdu_length = req->tx_request_body.tx_pdu_list[i].pdu_length; @@ -1090,15 +1228,15 @@ int memcpy_tx_req(nfapi_pnf_p7_config_t *pnf_p7, nfapi_tx_request_t *req) { } } - if (!put_queue(&tx_req_pdu_queue, p)) { - free(p); + if (!put_queue(&tx_req_pdu_queue, list)) { + nfapi_free_tx_req_pdu_list(list); } return 0; } -int memcpy_hi_dci0_req (L1_rxtx_proc_t *proc, - nfapi_pnf_p7_config_t* pnf_p7, +int memcpy_hi_dci0_req (L1_rxtx_proc_t *proc, + nfapi_pnf_p7_config_t* pnf_p7, nfapi_hi_dci0_request_t* req) { nfapi_hi_dci0_request_t *p = (nfapi_hi_dci0_request_t *)malloc(sizeof(nfapi_hi_dci0_request_t)); //if(req!=0){ @@ -1132,7 +1270,7 @@ int memcpy_hi_dci0_req (L1_rxtx_proc_t *proc, if (!put_queue(&hi_dci0_req_queue, p)) { free(p); } - + LOG_I(MAC, "DCI0 QUEUE: %zu\n", hi_dci0_req_queue.num_items); return 0; } @@ -1304,7 +1442,7 @@ void *ue_standalone_pnf_task(void *context) else { // check to see if dl_config_req is null - LOG_D(MAC, "dl_config_req Frame: %u Subframe: %u\n", dl_config_req.sfn_sf >> 4, + LOG_I(MAC, "dl_config_req Frame: %u Subframe: %u\n", dl_config_req.sfn_sf >> 4, dl_config_req.sfn_sf & 15); memcpy_dl_config_req(NULL, NULL, &dl_config_req); } @@ -1322,7 +1460,7 @@ void *ue_standalone_pnf_task(void *context) else { // check to see if tx_req is null - LOG_D(MAC, "tx_req Frame: %u Subframe: %u\n", tx_req.sfn_sf >> 4, + LOG_I(MAC, "tx_req Frame: %u Subframe: %u\n", tx_req.sfn_sf >> 4, tx_req.sfn_sf & 15); memcpy_tx_req(NULL, &tx_req); } diff --git a/openair2/PHY_INTERFACE/phy_stub_UE.h b/openair2/PHY_INTERFACE/phy_stub_UE.h index 50981c4aa812a743943b1e9c57d226fcb363773e..135d01e977e857f811bd1f25ede6552a8f1f2a93 100644 --- a/openair2/PHY_INTERFACE/phy_stub_UE.h +++ b/openair2/PHY_INTERFACE/phy_stub_UE.h @@ -29,8 +29,6 @@ extern UL_IND_t *UL_INFO; /// Pointers to config_request types. Used from nfapi callback functions. //below 3 difinitions move to phy_stub_UE.c to add initialization when difinition. -int tx_req_num_elems; - //below 2 difinitions move to lte-ue.c to add initialization when difinition. //int next_ra_frame; //module_id_t next_Mod_id; @@ -99,12 +97,20 @@ void handle_nfapi_ul_pdu_UE_MAC(module_id_t Mod_id, uint16_t frame,uint8_t subframe,uint8_t srs_present, int index, nfapi_ul_config_request_t *ul_config_req); +typedef struct nfapi_tx_req_pdu_list_t +{ + int num_pdus; /* number .pdus[] objects */ + nfapi_tx_request_pdu_t pdus[]; /* see "struct hack" */ +} nfapi_tx_req_pdu_list_t; + +void nfapi_free_tx_req_pdu_list(nfapi_tx_req_pdu_list_t *); + void dl_config_req_UE_MAC_dci(int sfn, int sf, nfapi_dl_config_request_pdu_t *dci, nfapi_dl_config_request_pdu_t *dlsch, int num_ue, - nfapi_tx_request_pdu_t *tx_request_pdu_list); + nfapi_tx_req_pdu_list_t *); void dl_config_req_UE_MAC_bch(int sfn, int sf, nfapi_dl_config_request_pdu_t *bch, @@ -113,7 +119,7 @@ void dl_config_req_UE_MAC_mch(int sfn, int sf, nfapi_dl_config_request_pdu_t *bch, int num_ue, - nfapi_tx_request_pdu_t *tx_request_pdu_list); + nfapi_tx_req_pdu_list_t *); int tx_req_UE_MAC(nfapi_tx_request_t* req); @@ -154,9 +160,8 @@ char *nfapi_ul_config_req_to_string(nfapi_ul_config_request_t *req); const char *dl_pdu_type_to_string(uint8_t pdu_type); const char *ul_pdu_type_to_string(uint8_t pdu_type); - extern queue_t dl_config_req_queue; -extern queue_t tx_req_pdu_queue; +extern queue_t tx_req_pdu_queue; /* items in this queue are nfapi_tx_req_pdu_list_t* */ extern queue_t ul_config_req_queue; extern queue_t hi_dci0_req_queue; diff --git a/openair2/PHY_INTERFACE/queue.c b/openair2/PHY_INTERFACE/queue.c index 1ae902f18d8843196aa0f05d4f16c9c578d72e0f..af0fcc6f7cfb34edf00a81076e2e343a8e90b987 100644 --- a/openair2/PHY_INTERFACE/queue.c +++ b/openair2/PHY_INTERFACE/queue.c @@ -150,4 +150,4 @@ void *unqueue_matching(queue_t *q, queue_matcher_t *matcher, void *wanted) pthread_mutex_unlock(&q->mutex); return item; -} +} \ No newline at end of file diff --git a/targets/RT/USER/lte-ue.c b/targets/RT/USER/lte-ue.c index 9e710a21dd34696cfbafab80a720437ca8f80367..c5af20e186e2517bfac39ac8015c453280afc240 100644 --- a/targets/RT/USER/lte-ue.c +++ b/targets/RT/USER/lte-ue.c @@ -1088,9 +1088,9 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg) } last_sfn_sf = sfn_sf; - nfapi_tx_request_pdu_t *tx_request_pdu_list = get_queue(&tx_req_pdu_queue); + nfapi_tx_req_pdu_list_t *tx_req_pdu_list = get_queue(&tx_req_pdu_queue); nfapi_dl_config_request_t *dl_config_req = get_queue(&dl_config_req_queue); - if (tx_request_pdu_list) + if (tx_req_pdu_list) { uint64_t deadline = clock_usec() + 1000; if (!dl_config_req) @@ -1116,7 +1116,7 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg) nfapi_ul_config_request_t *ul_config_req = get_queue(&ul_config_req_queue); nfapi_hi_dci0_request_t *hi_dci0_req = get_queue(&hi_dci0_req_queue); - LOG_D(MAC, "received from proxy frame %d subframe %d\n", + LOG_I(MAC, "received from proxy frame %d subframe %d\n", 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; @@ -1126,19 +1126,18 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg) dl_num_pdus); if (dl_num_pdus > 0) { char *dl_str = nfapi_dl_config_req_to_string(dl_config_req); - LOG_D(MAC, "dl_config_req: %s\n", dl_str); + LOG_I(MAC, "dl_config_req: %s\n", dl_str); free(dl_str); } } - if (tx_request_pdu_list != NULL) { - LOG_D(MAC, "tx_req segments: %u\n", - tx_request_pdu_list->num_segments); + if (tx_req_pdu_list != NULL) { + LOG_D(MAC, "tx_req pdus: %d\n", tx_req_pdu_list->num_pdus); } if (ul_config_req != NULL) { uint8_t ul_num_pdus = ul_config_req->ul_config_request_body.number_of_pdus; if (ul_num_pdus > 0) { char *ul_str = nfapi_ul_config_req_to_string(ul_config_req); - LOG_D(MAC, "ul_config_req: %s\n", ul_str); + LOG_I(MAC, "ul_config_req: %s\n", ul_str); free(ul_str); } } @@ -1148,13 +1147,13 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg) NFAPI_SFNSF2SFN(hi_dci0_req->sfn_sf), NFAPI_SFNSF2SF(hi_dci0_req->sfn_sf)); } - if ((dl_config_req != NULL) != (tx_request_pdu_list != NULL)) { + if ((dl_config_req != NULL) != (tx_req_pdu_list != NULL)) { num_lone++; } else { num_pairs++; } - if (dl_config_req && tx_request_pdu_list) { + if (dl_config_req && tx_req_pdu_list) { if ((num_pairs % 1000) == 0) { LOG_I(MAC, "num_pairs:%d, num_lone:%d\n", num_pairs, num_lone); } @@ -1176,7 +1175,7 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg) pdu, dlsch, ue_num, - tx_request_pdu_list); + tx_req_pdu_list); } else if (pdu->pdu_type == NFAPI_DL_CONFIG_BCH_PDU_TYPE) { dl_config_req_UE_MAC_bch(NFAPI_SFNSF2SFN(dl_config_req->sfn_sf), NFAPI_SFNSF2SF(dl_config_req->sfn_sf), @@ -1187,7 +1186,7 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg) NFAPI_SFNSF2SF(dl_config_req->sfn_sf), pdu, ue_num, - tx_request_pdu_list); + tx_req_pdu_list); } } } @@ -1361,16 +1360,9 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg) dl_config_req = NULL; } - if (tx_request_pdu_list != NULL) { - for (int i = 0; i < tx_req_num_elems; i++) { - for (int j = 0; j < tx_request_pdu_list[i].num_segments; j++) { - free(tx_request_pdu_list[i].segments[j].segment_data); - tx_request_pdu_list[i].segments[j].segment_data = NULL; - } - } - tx_req_num_elems = 0; - free(tx_request_pdu_list); - tx_request_pdu_list = NULL; + if (tx_req_pdu_list != NULL) { + nfapi_free_tx_req_pdu_list(tx_req_pdu_list); + tx_req_pdu_list = NULL; } if (ul_config_req != NULL) { @@ -1475,7 +1467,7 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) dl_config_req = NULL; ul_config_req = NULL; hi_dci0_req = NULL; - tx_request_pdu_list = NULL; + tx_req_pdu_list = NULL; // waiting for all UE's threads set phy_stub_ticking->num_single_thread[ue_thread_id] = -1. do { @@ -1571,7 +1563,7 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) } } - if (dl_config_req && tx_request_pdu_list) { + if (dl_config_req && tx_req_pdu_list) { nfapi_dl_config_request_body_t* dl_config_req_body = &dl_config_req->dl_config_request_body; for (int i = 0; i < dl_config_req_body->number_pdu; ++i) { nfapi_dl_config_request_pdu_t* pdu = &dl_config_req_body->dl_config_pdu_list[i]; @@ -1785,16 +1777,16 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) dl_config_req = NULL; } - if(tx_request_pdu_list!=NULL) { + if(tx_req_pdu_list!=NULL) { for (int i = 0; i < tx_req_num_elems; i++) { - for (int j = 0; j < tx_request_pdu_list[i].num_segments; j++) { - free(tx_request_pdu_list[i].segments[j].segment_data); - tx_request_pdu_list[i].segments[j].segment_data = NULL; + for (int j = 0; j < tx_req_pdu_list[i].num_segments; j++) { + free(tx_req_pdu_list[i].segments[j].segment_data); + tx_req_pdu_list[i].segments[j].segment_data = NULL; } } tx_req_num_elems = 0; - free(tx_request_pdu_list); - tx_request_pdu_list = NULL; + free(tx_req_pdu_list); + tx_req_pdu_list = NULL; } if(ul_config_req!=NULL) {