diff --git a/openair-cn/GTPV1-U/gtpv1u_eNB.c b/openair-cn/GTPV1-U/gtpv1u_eNB.c index 3e7d4b2c6e7cf554b9015be087eb20f763da776e..08405e26b10ff6f9ac6aaf475cd9cb07e2c55f3a 100644 --- a/openair-cn/GTPV1-U/gtpv1u_eNB.c +++ b/openair-cn/GTPV1-U/gtpv1u_eNB.c @@ -58,19 +58,15 @@ #undef GTP_DUMP_SOCKET -extern boolean_t - pdcp_data_req( - const module_id_t enb_mod_idP, - const module_id_t ue_mod_idP, - const frame_t frameP, - const eNB_flag_t enb_flagP, - const srb_flag_t srb_flagP, - const rb_id_t rb_idP, - const mui_t muiP, - const confirm_t confirmP, - const sdu_size_t sdu_buffer_sizeP, - unsigned char *const sdu_buffer_pP, - const pdcp_transmission_mode_t modeP); +extern boolean_t pdcp_data_req( + const protocol_ctxt_t* const ctxt_pP, + const srb_flag_t srb_flagP, + const rb_id_t rb_idP, + const mui_t muiP, + const confirm_t confirmP, + const sdu_size_t sdu_buffer_sizeP, + unsigned char *const sdu_buffer_pP, + const pdcp_transmission_mode_t modeP); static int @@ -282,6 +278,7 @@ NwGtpv1uRcT gtpv1u_eNB_process_stack_req( teid_t teid = 0; hashtable_rc_t hash_rc = HASH_TABLE_KEY_NOT_EXISTS; gtpv1u_teid_data_t *gtpv1u_teid_data_p = NULL; + protocol_ctxt_t ctxt; switch(pUlpApi->apiType) { /* Here there are two type of messages handled: @@ -319,12 +316,13 @@ NwGtpv1uRcT gtpv1u_eNB_process_stack_req( #endif #warning "LG eps bearer mapping to DRB id to do (offset -4)" + ctxt.enb_module_id = gtpv1u_teid_data_p->enb_id; + ctxt.ue_module_id = gtpv1u_teid_data_p->ue_id; + ctxt.frame = 0; + ctxt.enb_flag = ENB_FLAG_YES; result = pdcp_data_req( - gtpv1u_teid_data_p->enb_id, - gtpv1u_teid_data_p->ue_id, - 0, // frame TO DO - ENB_FLAG_YES, + &ctxt, SRB_FLAG_NO, (gtpv1u_teid_data_p->eps_bearer_id) ? gtpv1u_teid_data_p->eps_bearer_id - 4: 5-4, 0, // mui diff --git a/openair-cn/OPENAIRHSS/INSTALL b/openair-cn/OPENAIRHSS/INSTALL index a1e89e18ad20c227845f2099cb9894c799265d19..2099840756e6302d837dcd51b5dcd6262f7adb16 100644 --- a/openair-cn/OPENAIRHSS/INSTALL +++ b/openair-cn/OPENAIRHSS/INSTALL @@ -1,7 +1,7 @@ Installation Instructions ************************* -Copyright (C) 1994-1996, 1999-2002, 2004-2011 Free Software Foundation, +Copyright (C) 1994-1996, 1999-2002, 2004-2013 Free Software Foundation, Inc. Copying and distribution of this file, with or without modification, @@ -12,8 +12,8 @@ without warranty of any kind. Basic Installation ================== - Briefly, the shell commands `./configure; make; make install' should -configure, build, and install this package. The following + Briefly, the shell command `./configure && make && make install' +should configure, build, and install this package. The following more-detailed instructions are generic; see the `README' file for instructions specific to this package. Some packages provide this `INSTALL' file but do not implement all of the features documented @@ -309,9 +309,10 @@ causes the specified `gcc' to be used as the C compiler (unless it is overridden in the site shell script). Unfortunately, this technique does not work for `CONFIG_SHELL' due to -an Autoconf bug. Until the bug is fixed you can use this workaround: +an Autoconf limitation. Until the limitation is lifted, you can use +this workaround: - CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash + CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash `configure' Invocation ====================== @@ -367,4 +368,3 @@ operates. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. - diff --git a/openair2/COMMON/platform_types.h b/openair2/COMMON/platform_types.h index a73ff60cb048f0b1cd72403c2ca19563d5400a38..11286b8cfb8261308f0cdca58a3439d882fd688a 100755 --- a/openair2/COMMON/platform_types.h +++ b/openair2/COMMON/platform_types.h @@ -170,4 +170,16 @@ typedef enum config_action_e { //----------------------------------------------------------------------------- typedef uint32_t teid_t; // tunnel endpoint identifier typedef uint8_t ebi_t; // eps bearer id + + + +//----------------------------------------------------------------------------- +// +//----------------------------------------------------------------------------- +typedef struct protocol_ctxt_s { + module_id_t enb_module_id; /*!< \brief Virtualized enb module identifier, Not used if eNB_flagP = 0. */ + module_id_t ue_module_id; /*!< \brief Virtualized ue module identifier */ + frame_t frame; /*!< \brief LTE Frame number.*/ + eNB_flag_t enb_flag; /*!< \brief Flag to indicate eNB (1) or UE (0) */ +} protocol_ctxt_t; #endif diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c index 9aa37c988a0cb7aae37b0d6ff39f05e5c8ca8db4..2bec1a8842d8d2aede5aba69c7203f395da1cd90 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler.c +++ b/openair2/LAYER2/MAC/eNB_scheduler.c @@ -83,6 +83,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, unsigned int nCCE[MAX_NUM_CCs]; int mbsfn_status[MAX_NUM_CCs]; uint32_t RBalloc[MAX_NUM_CCs]; + protocol_ctxt_t ctxt; #ifdef EXMIMO int ret; #endif @@ -181,14 +182,18 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, //if (subframeP%5 == 0) //#ifdef EXMIMO - pdcp_run(frameP, 1, 0, module_idP); + ctxt.enb_module_id = module_idP; + ctxt.ue_module_id = 0; + ctxt.frame = frameP; + ctxt.enb_flag = ENB_FLAG_YES; + pdcp_run(&ctxt); //#endif // check HO rrc_rx_tx(module_idP, - frameP, - 1, - module_idP, + frameP, + 1, + module_idP, CC_id); #ifdef Rel10 diff --git a/openair2/LAYER2/MAC/ue_procedures.c b/openair2/LAYER2/MAC/ue_procedures.c index 8d1bf3b254f0a50e75d0360e9796f21348813b9b..4611088076dc5b21c5f9cbe568633387fd132c96 100644 --- a/openair2/LAYER2/MAC/ue_procedures.c +++ b/openair2/LAYER2/MAC/ue_procedures.c @@ -1321,6 +1321,7 @@ UE_L2_STATE_t ue_scheduler(module_id_t module_idP,frame_t frameP, sub_frame_t su // int8_t lcg_id; struct RACH_ConfigCommon *rach_ConfigCommon = (struct RACH_ConfigCommon *)NULL; #ifdef EXMIMO + protocol_ctxt_t ctxt; int ret; #endif #if defined(ENABLE_ITTI) @@ -1366,7 +1367,11 @@ UE_L2_STATE_t ue_scheduler(module_id_t module_idP,frame_t frameP, sub_frame_t su //Rrc_xface->Frame_index=Mac_rlc_xface->frameP; //if (subframe%5 == 0) #ifdef EXMIMO - pdcp_run(frameP, 0, module_idP, eNB_indexP); + ctxt.enb_module_id = eNB_indexP; + ctxt.ue_module_id = module_idP; + ctxt.frame = frameP; + ctxt.enb_flag = ENB_FLAG_NO; + pdcp_run(&ctxt); #endif UE_mac_inst[module_idP].frame = frameP; UE_mac_inst[module_idP].subframe = subframeP; diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c index 12a87b6b61877b4da7bed0c35e9f9b2231506bb3..16b5e03fe36efee76a9b910535c88d816ddbd57f 100755 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c @@ -82,10 +82,7 @@ extern int otg_rx_pkt( int src, int dst, int ctime, char *buffer_tx, unsigned in * code at targets/TEST/PDCP/test_pdcp.c:test_pdcp_data_req() */ boolean_t pdcp_data_req( - const module_id_t enb_mod_idP, - const module_id_t ue_mod_idP, - const frame_t frameP, - const eNB_flag_t enb_flagP, + const protocol_ctxt_t* const ctxt_pP, const srb_flag_t srb_flagP, const rb_id_t rb_idP, const mui_t muiP, @@ -105,41 +102,42 @@ boolean_t pdcp_data_req( rlc_op_status_t rlc_status; boolean_t ret = TRUE; + vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_DATA_REQ,VCD_FUNCTION_IN); - AssertError (enb_mod_idP < NUMBER_OF_eNB_MAX, return FALSE, "eNB id is too high (%u/%d) %u %u!\n", enb_mod_idP, NUMBER_OF_eNB_MAX, ue_mod_idP, rb_idP); - AssertError (ue_mod_idP < NUMBER_OF_UE_MAX, return FALSE, "UE id is too high (%u/%d) %u %u!\n", ue_mod_idP, NUMBER_OF_UE_MAX, enb_mod_idP, rb_idP); + AssertError (ctxt_pP->enb_module_id < NUMBER_OF_eNB_MAX, return FALSE, "eNB id is too high (%u/%d) %u %u!\n", ctxt_pP->enb_module_id, NUMBER_OF_eNB_MAX, ctxt_pP->ue_module_id, rb_idP); + AssertError (ctxt_pP->ue_module_id < NUMBER_OF_UE_MAX, return FALSE, "UE id is too high (%u/%d) %u %u!\n", ctxt_pP->ue_module_id, NUMBER_OF_UE_MAX, ctxt_pP->enb_module_id, rb_idP); if (modeP == PDCP_TRANSMISSION_MODE_TRANSPARENT) { - AssertError (rb_idP < NB_RB_MBMS_MAX, return FALSE, "RB id is too high (%u/%d) %u %u!\n", rb_idP, NB_RB_MBMS_MAX, ue_mod_idP, enb_mod_idP); + AssertError (rb_idP < NB_RB_MBMS_MAX, return FALSE, "RB id is too high (%u/%d) %u %u!\n", rb_idP, NB_RB_MBMS_MAX, ctxt_pP->ue_module_id, ctxt_pP->enb_module_id); } else { if (srb_flagP) { - AssertError (rb_idP < 2, return FALSE, "RB id is too high (%u/%d) %u %u!\n", rb_idP, 2, ue_mod_idP, enb_mod_idP); + AssertError (rb_idP < 2, return FALSE, "RB id is too high (%u/%d) %u %u!\n", rb_idP, 2, ctxt_pP->ue_module_id, ctxt_pP->enb_module_id); } else { - AssertError (rb_idP < maxDRB, return FALSE, "RB id is too high (%u/%d) %u %u!\n", rb_idP, maxDRB, ue_mod_idP, enb_mod_idP); + AssertError (rb_idP < maxDRB, return FALSE, "RB id is too high (%u/%d) %u %u!\n", rb_idP, maxDRB, ctxt_pP->ue_module_id, ctxt_pP->enb_module_id); } } - if (enb_flagP == ENB_FLAG_NO) { + if (ctxt_pP->enb_flag == ENB_FLAG_NO) { if (srb_flagP) { - pdcp_p = &pdcp_array_srb_ue[ue_mod_idP][rb_idP-1]; + pdcp_p = &pdcp_array_srb_ue[ctxt_pP->ue_module_id][rb_idP-1]; } else { - pdcp_p = &pdcp_array_drb_ue[ue_mod_idP][rb_idP-1]; + pdcp_p = &pdcp_array_drb_ue[ctxt_pP->ue_module_id][rb_idP-1]; } } else { if (srb_flagP) { - pdcp_p = &pdcp_array_srb_eNB[enb_mod_idP][ue_mod_idP][rb_idP-1]; + pdcp_p = &pdcp_array_srb_eNB[ctxt_pP->enb_module_id][ctxt_pP->ue_module_id][rb_idP-1]; } else { - pdcp_p = &pdcp_array_drb_eNB[enb_mod_idP][ue_mod_idP][rb_idP-1]; + pdcp_p = &pdcp_array_drb_eNB[ctxt_pP->enb_module_id][ctxt_pP->ue_module_id][rb_idP-1]; } } if ((pdcp_p->instanciated_instance == FALSE) && (modeP != PDCP_TRANSMISSION_MODE_TRANSPARENT)) { - if (enb_flagP == ENB_FLAG_NO) { + if (ctxt_pP->enb_flag == ENB_FLAG_NO) { LOG_W(PDCP, "[UE %d] Instance is not configured for eNB %d, rb_id %d Ignoring SDU...\n", - ue_mod_idP, enb_mod_idP, rb_idP); + ctxt_pP->ue_module_id, ctxt_pP->enb_module_id, rb_idP); } else { LOG_W(PDCP, "[eNB %d] Instance is not configured for UE %d, rb_id %d Ignoring SDU...\n", - enb_mod_idP, ue_mod_idP, rb_idP); + ctxt_pP->enb_module_id, ctxt_pP->ue_module_id, rb_idP); } return FALSE; } @@ -158,10 +156,10 @@ boolean_t pdcp_data_req( mac_xface->macphy_exit("PDCP sdu buffer size > MAX_IP_PACKET_SIZE"); } - if (enb_flagP == ENB_FLAG_NO) - start_meas(&eNB_pdcp_stats[enb_mod_idP].data_req); + if (ctxt_pP->enb_flag == ENB_FLAG_NO) + start_meas(&eNB_pdcp_stats[ctxt_pP->enb_module_id].data_req); else - start_meas(&UE_pdcp_stats[ue_mod_idP].data_req); + start_meas(&UE_pdcp_stats[ctxt_pP->ue_module_id].data_req); // PDCP transparent mode for MBMS traffic @@ -176,21 +174,21 @@ boolean_t pdcp_data_req( (unsigned char*)&pdcp_pdu_p->data[0], sdu_buffer_sizeP); #endif - rlc_status = rlc_data_req(enb_mod_idP, ue_mod_idP, frameP, enb_flagP, srb_flagP, MBMS_FLAG_YES, rb_idP, muiP, confirmP, sdu_buffer_sizeP, pdcp_pdu_p); + rlc_status = rlc_data_req(ctxt_pP, srb_flagP, MBMS_FLAG_YES, rb_idP, muiP, confirmP, sdu_buffer_sizeP, pdcp_pdu_p); } else { rlc_status = RLC_OP_STATUS_OUT_OF_RESSOURCES; LOG_W(PDCP,"[FRAME %5u][%s][PDCP][MOD %u/%u][RB %u] PDCP_DATA_REQ SDU DROPPED, OUT OF MEMORY \n", - frameP, - (enb_flagP) ? "eNB" : "UE", - enb_mod_idP, - ue_mod_idP, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rb_idP); #if defined(STOP_ON_IP_TRAFFIC_OVERLOAD) AssertFatal(0, "[FRAME %5u][%s][PDCP][MOD %u/%u][RB %u] PDCP_DATA_REQ SDU DROPPED, OUT OF MEMORY \n", - frameP, - (enb_flagP) ? "eNB" : "UE", - enb_mod_idP, - ue_mod_idP, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rb_idP); #endif } @@ -206,9 +204,9 @@ boolean_t pdcp_data_req( pdcp_pdu_size = sdu_buffer_sizeP + pdcp_header_len + pdcp_tailer_len; LOG_D(PDCP, "Data request notification for PDCP entity %s enb id %u ue_id %u and radio bearer ID %d pdu size %d (header%d, trailer%d)\n", - (enb_flagP) ? "eNB" : "UE", - enb_mod_idP, - ue_mod_idP, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rb_idP, pdcp_pdu_size, pdcp_header_len, @@ -235,10 +233,10 @@ boolean_t pdcp_data_req( memset(&pdcp_pdu_p->data[sdu_buffer_sizeP + pdcp_header_len],0,PDCP_CONTROL_PLANE_DATA_PDU_MAC_I_SIZE); if (pdcp_serialize_control_plane_data_pdu_with_SRB_sn_buffer((unsigned char*)pdcp_pdu_p->data, &pdu_header) == FALSE) { LOG_E(PDCP, "Cannot fill PDU buffer with relevant header fields!\n"); - if (enb_flagP == ENB_FLAG_NO) - stop_meas(&eNB_pdcp_stats[enb_mod_idP].data_req); + if (ctxt_pP->enb_flag == ENB_FLAG_NO) + stop_meas(&eNB_pdcp_stats[ctxt_pP->enb_module_id].data_req); else - stop_meas(&UE_pdcp_stats[ue_mod_idP].data_req); + stop_meas(&UE_pdcp_stats[ctxt_pP->ue_module_id].data_req); vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_DATA_REQ,VCD_FUNCTION_OUT); return FALSE; } @@ -249,10 +247,10 @@ boolean_t pdcp_data_req( current_sn = pdu_header.sn ; if (pdcp_serialize_user_plane_data_pdu_with_long_sn_buffer((unsigned char*)pdcp_pdu_p->data, &pdu_header) == FALSE) { LOG_E(PDCP, "Cannot fill PDU buffer with relevant header fields!\n"); - if (enb_flagP == ENB_FLAG_NO) - stop_meas(&eNB_pdcp_stats[enb_mod_idP].data_req); + if (ctxt_pP->enb_flag == ENB_FLAG_NO) + stop_meas(&eNB_pdcp_stats[ctxt_pP->enb_module_id].data_req); else - stop_meas(&UE_pdcp_stats[ue_mod_idP].data_req); + stop_meas(&UE_pdcp_stats[ctxt_pP->ue_module_id].data_req); vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_DATA_REQ,VCD_FUNCTION_OUT); return FALSE; } @@ -265,10 +263,10 @@ boolean_t pdcp_data_req( LOG_E(PDCP, "There must be a problem with PDCP initialization, ignoring this PDU...\n"); free_mem_block(pdcp_pdu_p); - if (enb_flagP == ENB_FLAG_NO) - stop_meas(&eNB_pdcp_stats[enb_mod_idP].data_req); + if (ctxt_pP->enb_flag == ENB_FLAG_NO) + stop_meas(&eNB_pdcp_stats[ctxt_pP->enb_module_id].data_req); else - stop_meas(&UE_pdcp_stats[ue_mod_idP].data_req); + stop_meas(&UE_pdcp_stats[ctxt_pP->ue_module_id].data_req); vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_DATA_REQ,VCD_FUNCTION_OUT); return FALSE; } @@ -289,23 +287,24 @@ boolean_t pdcp_data_req( (((pdcp_p->cipheringAlgorithm) != 0) || ((pdcp_p->integrityProtAlgorithm) != 0))) { - if (enb_flagP == ENB_FLAG_NO) - start_meas(&eNB_pdcp_stats[enb_mod_idP].apply_security); + if (ctxt_pP->enb_flag == ENB_FLAG_NO) + start_meas(&eNB_pdcp_stats[ctxt_pP->enb_module_id].apply_security); else - start_meas(&UE_pdcp_stats[ue_mod_idP].apply_security); - - pdcp_apply_security(pdcp_p, - srb_flagP, - rb_idP % maxDRB, - pdcp_header_len, - current_sn, - pdcp_pdu_p->data, - sdu_buffer_sizeP); - - if (enb_flagP == ENB_FLAG_NO) - stop_meas(&eNB_pdcp_stats[enb_mod_idP].apply_security); + start_meas(&UE_pdcp_stats[ctxt_pP->ue_module_id].apply_security); + + pdcp_apply_security(ctxt_pP, + pdcp_p, + srb_flagP, + rb_idP % maxDRB, + pdcp_header_len, + current_sn, + pdcp_pdu_p->data, + sdu_buffer_sizeP); + + if (ctxt_pP->enb_flag == ENB_FLAG_NO) + stop_meas(&eNB_pdcp_stats[ctxt_pP->enb_module_id].apply_security); else - stop_meas(&UE_pdcp_stats[ue_mod_idP].apply_security); + stop_meas(&UE_pdcp_stats[ctxt_pP->ue_module_id].apply_security); } #endif @@ -317,16 +316,16 @@ boolean_t pdcp_data_req( //util_flush_hex_octets(PDCP, (unsigned char*)pdcp_pdu->data, pdcp_pdu_size); } else { LOG_E(PDCP, "Cannot create a mem_block for a PDU!\n"); - if (enb_flagP == ENB_FLAG_NO) - stop_meas(&eNB_pdcp_stats[enb_mod_idP].data_req); + if (ctxt_pP->enb_flag == ENB_FLAG_NO) + stop_meas(&eNB_pdcp_stats[ctxt_pP->enb_module_id].data_req); else - stop_meas(&UE_pdcp_stats[ue_mod_idP].data_req); + stop_meas(&UE_pdcp_stats[ctxt_pP->ue_module_id].data_req); #if defined(STOP_ON_IP_TRAFFIC_OVERLOAD) AssertFatal(0, "[FRAME %5u][%s][PDCP][MOD %u/%u][RB %u] PDCP_DATA_REQ SDU DROPPED, OUT OF MEMORY \n", - frameP, - (enb_flagP) ? "eNB" : "UE", - enb_mod_idP, - ue_mod_idP, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rb_idP); #endif vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_DATA_REQ,VCD_FUNCTION_OUT); @@ -343,7 +342,7 @@ boolean_t pdcp_data_req( LOG_F(PDCP,"%02x ", ((uint8_t*)pdcp_pdu_p->data)[i]); LOG_F(PDCP,"\n"); #endif - rlc_status = rlc_data_req(enb_mod_idP, ue_mod_idP, frameP, enb_flagP, srb_flagP, MBMS_FLAG_NO, rb_idP, muiP, confirmP, pdcp_pdu_size, pdcp_pdu_p); + rlc_status = rlc_data_req(ctxt_pP, srb_flagP, MBMS_FLAG_NO, rb_idP, muiP, confirmP, pdcp_pdu_size, pdcp_pdu_p); } switch (rlc_status) { @@ -371,17 +370,17 @@ boolean_t pdcp_data_req( ret= FALSE; break; } - if (enb_flagP == ENB_FLAG_NO) - stop_meas(&eNB_pdcp_stats[enb_mod_idP].data_req); + if (ctxt_pP->enb_flag == ENB_FLAG_NO) + stop_meas(&eNB_pdcp_stats[ctxt_pP->enb_module_id].data_req); else - stop_meas(&UE_pdcp_stats[ue_mod_idP].data_req); + stop_meas(&UE_pdcp_stats[ctxt_pP->ue_module_id].data_req); /* * Control arrives here only if rlc_data_req() returns RLC_OP_STATUS_OK * so we return TRUE afterwards */ /* if (rb_id>=DTCH) { - if (enb_flagP == 1) { + if (ctxt_pP->enb_flag == 1) { Pdcp_stats_tx[module_id][(rb_id & RAB_OFFSET2 )>> RAB_SHIFT2][(rb_id & RAB_OFFSET)-DTCH]++; Pdcp_stats_tx_bytes[module_id][(rb_id & RAB_OFFSET2 )>> RAB_SHIFT2][(rb_id & RAB_OFFSET)-DTCH] += sdu_buffer_size; } else { @@ -396,10 +395,7 @@ boolean_t pdcp_data_req( boolean_t pdcp_data_ind( - const module_id_t enb_mod_idP, - const module_id_t ue_mod_idP, - const frame_t frameP, - const eNB_flag_t enb_flagP, + const protocol_ctxt_t* const ctxt_pP, const srb_flag_t srb_flagP, const MBMS_flag_t MBMS_flagP, const rb_id_t rb_idP, @@ -425,27 +421,27 @@ boolean_t pdcp_data_ind( vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_DATA_IND,VCD_FUNCTION_IN); #ifdef OAI_EMU - if (enb_flagP) { - AssertFatal ((enb_mod_idP >= oai_emulation.info.first_enb_local) && (oai_emulation.info.nb_enb_local > 0), + if (ctxt_pP->enb_flag) { + AssertFatal ((ctxt_pP->enb_module_id == oai_emulation.info.first_enb_local) && (oai_emulation.info.nb_enb_local > 0), "eNB module id is too low (%u/%d)!\n", - enb_mod_idP, + ctxt_pP->enb_module_id, oai_emulation.info.first_enb_local); - AssertFatal ((enb_mod_idP < (oai_emulation.info.first_enb_local + oai_emulation.info.nb_enb_local)) && (oai_emulation.info.nb_enb_local > 0), + AssertFatal ((ctxt_pP->enb_module_id < (oai_emulation.info.first_enb_local + oai_emulation.info.nb_enb_local)) && (oai_emulation.info.nb_enb_local > 0), "eNB module id is too high (%u/%d)!\n", - enb_mod_idP, + ctxt_pP->enb_module_id, oai_emulation.info.first_enb_local + oai_emulation.info.nb_enb_local); - AssertFatal (ue_mod_idP < NB_UE_INST, + AssertFatal (ctxt_pP->ue_module_id < NB_UE_INST, "UE module id is too high (%u/%d)!\n", - ue_mod_idP, + ctxt_pP->ue_module_id, oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local); } else { - AssertFatal (ue_mod_idP < (oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local), + AssertFatal (ctxt_pP->ue_module_id < (oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local), "UE module id is too high (%u/%d)!\n", - ue_mod_idP, + ctxt_pP->ue_module_id, oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local); - AssertFatal (ue_mod_idP >= oai_emulation.info.first_ue_local, + AssertFatal (ctxt_pP->ue_module_id >= oai_emulation.info.first_ue_local, "UE module id is too low (%u/%d)!\n", - ue_mod_idP, + ctxt_pP->ue_module_id, oai_emulation.info.first_ue_local); } #endif @@ -458,51 +454,51 @@ boolean_t pdcp_data_ind( #endif if (MBMS_flagP) { - AssertError (rb_idP < NB_RB_MBMS_MAX, return FALSE, "RB id is too high (%u/%d) %u %u!\n", rb_idP, NB_RB_MBMS_MAX, ue_mod_idP, enb_mod_idP); - if (enb_flagP == ENB_FLAG_NO) { + AssertError (rb_idP < NB_RB_MBMS_MAX, return FALSE, "RB id is too high (%u/%d) %u %u!\n", rb_idP, NB_RB_MBMS_MAX, ctxt_pP->ue_module_id, ctxt_pP->enb_module_id); + if (ctxt_pP->enb_flag == ENB_FLAG_NO) { LOG_I(PDCP, "e-MBMS Data indication notification for PDCP entity from eNB %u to UE %u " - "and radio bearer ID %d rlc sdu size %d enb_flagP %d\n", - enb_mod_idP, ue_mod_idP, rb_idP, sdu_buffer_sizeP, enb_flagP); + "and radio bearer ID %d rlc sdu size %d ctxt_pP->enb_flag %d\n", + ctxt_pP->enb_module_id, ctxt_pP->ue_module_id, rb_idP, sdu_buffer_sizeP, ctxt_pP->enb_flag); } else { LOG_I(PDCP, "Data indication notification for PDCP entity from UE %u to eNB %u " - "and radio bearer ID %d rlc sdu size %d enb_flagP %d eNB_id %d\n", - ue_mod_idP, enb_mod_idP , rb_idP, sdu_buffer_sizeP, enb_flagP, enb_mod_idP); + "and radio bearer ID %d rlc sdu size %d ctxt_pP->enb_flag %d eNB_id %d\n", + ctxt_pP->ue_module_id, ctxt_pP->enb_module_id , rb_idP, sdu_buffer_sizeP, ctxt_pP->enb_flag, ctxt_pP->enb_module_id); } } else { rb_id = rb_idP % maxDRB; - AssertError (rb_id < maxDRB, return FALSE, "RB id is too high (%u/%d) %u %u!\n", rb_id, maxDRB, ue_mod_idP, enb_mod_idP); - AssertError (rb_id > 0, return FALSE, "RB id is too low (%u/%d) %u %u!\n", rb_id, maxDRB, ue_mod_idP, enb_mod_idP); - if (enb_flagP == ENB_FLAG_NO) { + AssertError (rb_id < maxDRB, return FALSE, "RB id is too high (%u/%d) %u %u!\n", rb_id, maxDRB, ctxt_pP->ue_module_id, ctxt_pP->enb_module_id); + AssertError (rb_id > 0, return FALSE, "RB id is too low (%u/%d) %u %u!\n", rb_id, maxDRB, ctxt_pP->ue_module_id, ctxt_pP->enb_module_id); + if (ctxt_pP->enb_flag == ENB_FLAG_NO) { if (srb_flagP) { - pdcp_p = &pdcp_array_srb_ue[ue_mod_idP][rb_id-1]; + pdcp_p = &pdcp_array_srb_ue[ctxt_pP->ue_module_id][rb_id-1]; #if 0 LOG_D(PDCP, "Data indication notification for PDCP entity from eNB %u to UE %u " - "and signalling radio bearer ID %d rlc sdu size %d enb_flagP %d\n", - enb_mod_idP, ue_mod_idP, rb_id, sdu_buffer_sizeP, enb_flagP); + "and signalling radio bearer ID %d rlc sdu size %d ctxt_pP->enb_flag %d\n", + ctxt_pP->enb_module_id, ctxt_pP->ue_module_id, rb_id, sdu_buffer_sizeP, ctxt_pP->enb_flag); #endif } else { - pdcp_p = &pdcp_array_drb_ue[ue_mod_idP][rb_id-1]; + pdcp_p = &pdcp_array_drb_ue[ctxt_pP->ue_module_id][rb_id-1]; #if 0 LOG_D(PDCP, "Data indication notification for PDCP entity from eNB %u to UE %u " - "and data radio bearer ID %d rlc sdu size %d enb_flagP %d\n", - enb_mod_idP, ue_mod_idP, rb_id, sdu_buffer_sizeP, enb_flagP); + "and data radio bearer ID %d rlc sdu size %d ctxt_pP->enb_flag %d\n", + ctxt_pP->enb_module_id, ctxt_pP->ue_module_id, rb_id, sdu_buffer_sizeP, ctxt_pP->enb_flag); #endif } } else { if (srb_flagP) { - pdcp_p = &pdcp_array_srb_eNB[enb_mod_idP][ue_mod_idP][rb_id-1]; + pdcp_p = &pdcp_array_srb_eNB[ctxt_pP->enb_module_id][ctxt_pP->ue_module_id][rb_id-1]; #if 0 LOG_D(PDCP, "Data indication notification for PDCP entity from UE %u to eNB %u " - "and signalling radio bearer ID %d rlc sdu size %d enb_flagP %d eNB_id %d\n", - ue_mod_idP, enb_mod_idP , rb_id, sdu_buffer_sizeP, enb_flagP, enb_mod_idP); + "and signalling radio bearer ID %d rlc sdu size %d ctxt_pP->enb_flag %d eNB_id %d\n", + ctxt_pP->ue_module_id, ctxt_pP->enb_module_id , rb_id, sdu_buffer_sizeP, ctxt_pP->enb_flag, ctxt_pP->enb_module_id); #endif } else { - pdcp_p = &pdcp_array_drb_eNB[enb_mod_idP][ue_mod_idP][rb_id-1]; + pdcp_p = &pdcp_array_drb_eNB[ctxt_pP->enb_module_id][ctxt_pP->ue_module_id][rb_id-1]; #if 0 LOG_D(PDCP, "Data indication notification for PDCP entity from UE %u to eNB %u " - "and data radio bearer ID %d rlc sdu size %d enb_flagP %d eNB_id %d\n", - ue_mod_idP, enb_mod_idP , rb_id, sdu_buffer_sizeP, enb_flagP, enb_mod_idP); + "and data radio bearer ID %d rlc sdu size %d ctxt_pP->enb_flag %d eNB_id %d\n", + ctxt_pP->ue_module_id, ctxt_pP->enb_module_id , rb_id, sdu_buffer_sizeP, ctxt_pP->enb_flag, ctxt_pP->enb_module_id); #endif } @@ -516,10 +512,10 @@ boolean_t pdcp_data_ind( return FALSE; } - if (enb_flagP) - start_meas(&eNB_pdcp_stats[enb_mod_idP].data_ind); + if (ctxt_pP->enb_flag) + start_meas(&eNB_pdcp_stats[ctxt_pP->enb_module_id].data_ind); else - start_meas(&UE_pdcp_stats[ue_mod_idP].data_ind); + start_meas(&UE_pdcp_stats[ctxt_pP->ue_module_id].data_ind); /* * Parse the PDU placed at the beginning of SDU to check @@ -552,10 +548,10 @@ boolean_t pdcp_data_ind( if (sdu_buffer_sizeP < pdcp_header_len + pdcp_tailer_len ) { LOG_W(PDCP, "Incoming (from RLC) SDU is short of size (size:%d)! Ignoring...\n", sdu_buffer_sizeP); free_mem_block(sdu_buffer_pP); - if (enb_flagP) - stop_meas(&eNB_pdcp_stats[enb_mod_idP].data_ind); + if (ctxt_pP->enb_flag) + stop_meas(&eNB_pdcp_stats[ctxt_pP->enb_module_id].data_ind); else - stop_meas(&UE_pdcp_stats[ue_mod_idP].data_ind); + stop_meas(&UE_pdcp_stats[ctxt_pP->ue_module_id].data_ind); vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_DATA_IND,VCD_FUNCTION_OUT); return FALSE; } @@ -569,7 +565,7 @@ boolean_t pdcp_data_ind( else LOG_D(PDCP, "Passing piggybacked SDU to RRC ...\n");*/ } else { - LOG_W(PDCP, "Incoming PDU has an unexpected sequence number (%d), RX window snychronisation have probably been lost!\n", sequence_number); + LOG_W(PDCP, "Incoming PDU has an unexpected sequence number (%d), RX window synchronisation have probably been lost!\n", sequence_number); /* * XXX Till we implement in-sequence delivery and duplicate discarding * mechanism all out-of-order packets will be delivered to RRC/IP @@ -586,38 +582,39 @@ boolean_t pdcp_data_ind( if (srb_flagP){ #if defined(ENABLE_SECURITY) if (pdcp_p->security_activated == 1) { - if (enb_flagP == ENB_FLAG_NO) - start_meas(&eNB_pdcp_stats[enb_mod_idP].validate_security); + if (ctxt_pP->enb_flag == ENB_FLAG_NO) + start_meas(&eNB_pdcp_stats[ctxt_pP->enb_module_id].validate_security); else - start_meas(&UE_pdcp_stats[ue_mod_idP].validate_security); + start_meas(&UE_pdcp_stats[ctxt_pP->ue_module_id].validate_security); - pdcp_validate_security(pdcp_p, + pdcp_validate_security(ctxt_pP, + pdcp_p, srb_flagP, rb_idP, pdcp_header_len, sequence_number, sdu_buffer_pP->data, sdu_buffer_sizeP - pdcp_tailer_len); - if (enb_flagP == ENB_FLAG_NO) - stop_meas(&eNB_pdcp_stats[enb_mod_idP].validate_security); + if (ctxt_pP->enb_flag == ENB_FLAG_NO) + stop_meas(&eNB_pdcp_stats[ctxt_pP->enb_module_id].validate_security); else - stop_meas(&UE_pdcp_stats[ue_mod_idP].validate_security); + stop_meas(&UE_pdcp_stats[ctxt_pP->ue_module_id].validate_security); } #endif //rrc_lite_data_ind(module_id, //Modified MW - L2 Interface - pdcp_rrc_data_ind(enb_mod_idP, - ue_mod_idP, - frameP, - enb_flagP, + pdcp_rrc_data_ind(ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, + ctxt_pP->frame, + ctxt_pP->enb_flag, rb_id, sdu_buffer_sizeP - pdcp_header_len - pdcp_tailer_len, (uint8_t*)&sdu_buffer_pP->data[pdcp_header_len]); free_mem_block(sdu_buffer_pP); // free_mem_block(new_sdu); - if (enb_flagP) - stop_meas(&eNB_pdcp_stats[enb_mod_idP].data_ind); + if (ctxt_pP->enb_flag) + stop_meas(&eNB_pdcp_stats[ctxt_pP->enb_module_id].data_ind); else - stop_meas(&UE_pdcp_stats[ue_mod_idP].data_ind); + stop_meas(&UE_pdcp_stats[ctxt_pP->ue_module_id].data_ind); vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_DATA_IND,VCD_FUNCTION_OUT); return TRUE; } @@ -627,22 +624,24 @@ boolean_t pdcp_data_ind( payload_offset=pdcp_header_len;// PDCP_USER_PLANE_DATA_PDU_LONG_SN_HEADER_SIZE; #if defined(ENABLE_SECURITY) if (pdcp_p->security_activated == 1) { - if (enb_flagP == ENB_FLAG_NO) - start_meas(&eNB_pdcp_stats[enb_mod_idP].validate_security); + if (ctxt_pP->enb_flag == ENB_FLAG_NO) + start_meas(&eNB_pdcp_stats[ctxt_pP->enb_module_id].validate_security); else - start_meas(&UE_pdcp_stats[ue_mod_idP].validate_security); + start_meas(&UE_pdcp_stats[ctxt_pP->ue_module_id].validate_security); - pdcp_validate_security(pdcp_p, - srb_flagP, - rb_idP, - pdcp_header_len, - sequence_number, - sdu_buffer_pP->data, - sdu_buffer_sizeP - pdcp_tailer_len); - if (enb_flagP == ENB_FLAG_NO) - stop_meas(&eNB_pdcp_stats[enb_mod_idP].validate_security); + pdcp_validate_security( + ctxt_pP, + pdcp_p, + srb_flagP, + rb_idP, + pdcp_header_len, + sequence_number, + sdu_buffer_pP->data, + sdu_buffer_sizeP - pdcp_tailer_len); + if (ctxt_pP->enb_flag == ENB_FLAG_NO) + stop_meas(&eNB_pdcp_stats[ctxt_pP->enb_module_id].validate_security); else - stop_meas(&UE_pdcp_stats[ue_mod_idP].validate_security); + stop_meas(&UE_pdcp_stats[ctxt_pP->ue_module_id].validate_security); } @@ -666,19 +665,19 @@ boolean_t pdcp_data_ind( sdu_buffer_sizeP - payload_offset); #endif - src_id = (enb_flagP == ENB_FLAG_NO) ? enb_mod_idP : ue_mod_idP + NB_eNB_INST; - dst_id = (enb_flagP == ENB_FLAG_NO) ? ue_mod_idP + NB_eNB_INST: enb_mod_idP; + src_id = (ctxt_pP->enb_flag == ENB_FLAG_NO) ? ctxt_pP->enb_module_id : ctxt_pP->ue_module_id + NB_eNB_INST; + dst_id = (ctxt_pP->enb_flag == ENB_FLAG_NO) ? ctxt_pP->ue_module_id + NB_eNB_INST: ctxt_pP->enb_module_id; ctime = oai_emulation.info.time_ms; // avg current simulation time in ms : we may get the exact time through OCG? LOG_D(PDCP, "Check received buffer : enb_flag %d rab id %d (src %d, dst %d)\n", - enb_flagP, rb_id, src_id, dst_id); + ctxt_pP->enb_flag, rb_id, src_id, dst_id); if (otg_rx_pkt(src_id, dst_id,ctime,&sdu_buffer_pP->data[payload_offset], sdu_buffer_sizeP - payload_offset ) == 0 ) { free_mem_block(sdu_buffer_pP); - if (enb_flagP) - stop_meas(&eNB_pdcp_stats[enb_mod_idP].data_ind); + if (ctxt_pP->enb_flag) + stop_meas(&eNB_pdcp_stats[ctxt_pP->enb_module_id].data_ind); else - stop_meas(&UE_pdcp_stats[ue_mod_idP].data_ind); + stop_meas(&UE_pdcp_stats[ctxt_pP->ue_module_id].data_ind); vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_DATA_IND,VCD_FUNCTION_OUT); return TRUE; } @@ -687,10 +686,10 @@ boolean_t pdcp_data_ind( if (otg_enabled==1) { LOG_D(OTG,"Discarding received packed\n"); free_mem_block(sdu_buffer_pP); - if (enb_flagP) - stop_meas(&eNB_pdcp_stats[enb_mod_idP].data_ind); + if (ctxt_pP->enb_flag) + stop_meas(&eNB_pdcp_stats[ctxt_pP->enb_module_id].data_ind); else - stop_meas(&UE_pdcp_stats[ue_mod_idP].data_ind); + stop_meas(&UE_pdcp_stats[ctxt_pP->ue_module_id].data_ind); vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_DATA_IND,VCD_FUNCTION_OUT); return TRUE; } @@ -706,7 +705,7 @@ boolean_t pdcp_data_ind( * PDCP header) */ #if defined(LINK_PDCP_TO_GTPV1U) - if ((TRUE == enb_flagP) && (FALSE == srb_flagP)) { + if ((TRUE == ctxt_pP->enb_flag) && (FALSE == srb_flagP)) { //LOG_T(PDCP,"Sending to GTPV1U %d bytes\n", sdu_buffer_sizeP - payload_offset); gtpu_buffer_p = itti_malloc(TASK_PDCP_ENB, TASK_GTPV1_U, sdu_buffer_sizeP - payload_offset + GTPU_HEADER_OVERHEAD_MAX); @@ -717,7 +716,7 @@ boolean_t pdcp_data_ind( GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).buffer = gtpu_buffer_p; GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).length = sdu_buffer_sizeP - payload_offset; GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).offset = GTPU_HEADER_OVERHEAD_MAX; - GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).ue_index = ue_mod_idP; + GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).ue_index = ctxt_pP->ue_module_id; GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).rab_id = rb_id + 4; itti_send_msg_to_task(TASK_GTPV1_U, INSTANCE_DEFAULT, message_p); packet_forwarded = TRUE; @@ -740,15 +739,15 @@ boolean_t pdcp_data_ind( // Here there is no virtualization possible // set ((pdcp_data_ind_header_t *) new_sdu_p->data)->inst for IP layer here - if (enb_flagP == ENB_FLAG_NO) { + if (ctxt_pP->enb_flag == ENB_FLAG_NO) { ((pdcp_data_ind_header_t *) new_sdu_p->data)->rb_id = rb_id; #if defined(OAI_EMU) - ((pdcp_data_ind_header_t *) new_sdu_p->data)->inst = ue_mod_idP + oai_emulation.info.nb_enb_local - oai_emulation.info.first_ue_local; + ((pdcp_data_ind_header_t *) new_sdu_p->data)->inst = ctxt_pP->ue_module_id + oai_emulation.info.nb_enb_local - oai_emulation.info.first_ue_local; #endif } else { - ((pdcp_data_ind_header_t *) new_sdu_p->data)->rb_id = rb_id + (ue_mod_idP * maxDRB); + ((pdcp_data_ind_header_t *) new_sdu_p->data)->rb_id = rb_id + (ctxt_pP->ue_module_id * maxDRB); #if defined(OAI_EMU) - ((pdcp_data_ind_header_t *) new_sdu_p->data)->inst = enb_mod_idP - oai_emulation.info.first_enb_local; + ((pdcp_data_ind_header_t *) new_sdu_p->data)->inst = ctxt_pP->enb_module_id - oai_emulation.info.first_enb_local; #endif } @@ -769,7 +768,7 @@ boolean_t pdcp_data_ind( * XXX Following two actions are identical, is there a merge error? */ - /*if (enb_flagP == 1) { + /*if (ctxt_pP->enb_flag == 1) { Pdcp_stats_rx[module_id][(rb_idP & RAB_OFFSET2) >> RAB_SHIFT2][(rb_idP & RAB_OFFSET) - DTCH]++; Pdcp_stats_rx_bytes[module_id][(rb_idP & RAB_OFFSET2) >> RAB_SHIFT2][(rb_idP & RAB_OFFSET) - DTCH] += sdu_buffer_sizeP; } else { @@ -781,47 +780,44 @@ boolean_t pdcp_data_ind( #if defined(STOP_ON_IP_TRAFFIC_OVERLOAD) else { AssertFatal(0, "[FRAME %5u][%s][PDCP][MOD %u/%u][RB %u] PDCP_DATA_IND SDU DROPPED, OUT OF MEMORY \n", - frameP, - (enb_flagP) ? "eNB" : "UE", - enb_mod_idP, - ue_mod_idP, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rb_id); } #endif free_mem_block(sdu_buffer_pP); - if (enb_flagP) - stop_meas(&eNB_pdcp_stats[enb_mod_idP].data_ind); + if (ctxt_pP->enb_flag) + stop_meas(&eNB_pdcp_stats[ctxt_pP->enb_module_id].data_ind); else - stop_meas(&UE_pdcp_stats[ue_mod_idP].data_ind); + stop_meas(&UE_pdcp_stats[ctxt_pP->ue_module_id].data_ind); vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_DATA_IND,VCD_FUNCTION_OUT); return TRUE; } //----------------------------------------------------------------------------- -void pdcp_run ( - const frame_t frameP, - const eNB_flag_t enb_flagP, - const module_id_t ue_mod_idP, - const module_id_t enb_mod_idP) { +void pdcp_run (const protocol_ctxt_t* const ctxt_pP) { //----------------------------------------------------------------------------- #if defined(ENABLE_ITTI) MessageDef *msg_p; const char *msg_name; instance_t instance; int result; + protocol_ctxt_t ctxt; #endif - if (enb_flagP) - start_meas(&eNB_pdcp_stats[enb_mod_idP].pdcp_run); + if (ctxt_pP->enb_flag) + start_meas(&eNB_pdcp_stats[ctxt_pP->enb_module_id].pdcp_run); else - start_meas(&UE_pdcp_stats[ue_mod_idP].pdcp_run); + start_meas(&UE_pdcp_stats[ctxt_pP->ue_module_id].pdcp_run); vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_RUN, VCD_FUNCTION_IN); #if defined(ENABLE_ITTI) do { // Checks if a message has been sent to PDCP sub-task - itti_poll_msg (enb_flagP ? TASK_PDCP_ENB : TASK_PDCP_UE, &msg_p); + itti_poll_msg (ctxt_pP->enb_flag ? TASK_PDCP_ENB : TASK_PDCP_UE, &msg_p); if (msg_p != NULL) { msg_name = ITTI_MSG_NAME (msg_p); @@ -829,15 +825,17 @@ void pdcp_run ( switch (ITTI_MSG_ID(msg_p)) { case RRC_DCCH_DATA_REQ: - LOG_D(PDCP, "Received %s from %s: instance %d, frame %d, enb_flagP %d, rb_id %d, muiP %d, confirmP %d, mode %d\n", + LOG_D(PDCP, "Received %s from %s: instance %d, frame %d, ctxt_pP->enb_flag %d, rb_id %d, muiP %d, confirmP %d, mode %d\n", msg_name, ITTI_MSG_ORIGIN_NAME(msg_p), instance, RRC_DCCH_DATA_REQ (msg_p).frame, RRC_DCCH_DATA_REQ (msg_p).enb_flag, RRC_DCCH_DATA_REQ (msg_p).rb_id, RRC_DCCH_DATA_REQ (msg_p).muip, RRC_DCCH_DATA_REQ (msg_p).confirmp, RRC_DCCH_DATA_REQ (msg_p).mode); - result = pdcp_data_req (RRC_DCCH_DATA_REQ (msg_p).eNB_index, - RRC_DCCH_DATA_REQ (msg_p).ue_index, - RRC_DCCH_DATA_REQ (msg_p).frame, - RRC_DCCH_DATA_REQ (msg_p).enb_flag, + ctxt.enb_module_id = RRC_DCCH_DATA_REQ (msg_p).eNB_index; + ctxt.ue_module_id = RRC_DCCH_DATA_REQ (msg_p).ue_index; + ctxt.frame = RRC_DCCH_DATA_REQ (msg_p).frame; + ctxt.enb_flag = RRC_DCCH_DATA_REQ (msg_p).enb_flag; + + result = pdcp_data_req (&ctxt, SRB_FLAG_YES, RRC_DCCH_DATA_REQ (msg_p).rb_id, RRC_DCCH_DATA_REQ (msg_p).muip, @@ -893,53 +891,50 @@ void pdcp_run ( int ue_id=0; int read_otg=1; // add check for other rb_ids later - if (enb_flagP == ENB_FLAG_NO) { - if (pdcp_array_drb_ue[ue_mod_idP][drb_id-1].instanciated_instance != TRUE ) + if (ctxt_pP->enb_flag == ENB_FLAG_NO) { + if (pdcp_array_drb_ue[ctxt_pP->ue_module_id][drb_id-1].instanciated_instance != TRUE ) read_otg=0; } else { for (ue_id=0; ue_id < NB_UE_INST; ue_id++) - if (pdcp_array_drb_eNB[enb_mod_idP][ue_id][drb_id-1].instanciated_instance != TRUE ){ + if (pdcp_array_drb_eNB[ctxt_pP->enb_module_id][ue_id][drb_id-1].instanciated_instance != TRUE ){ read_otg =0; break; } } if (read_otg == 1 ) - pdcp_fifo_read_input_sdus_from_otg(frameP, enb_flagP, ue_mod_idP, enb_mod_idP); + pdcp_fifo_read_input_sdus_from_otg(ctxt_pP); #endif // IP/NAS -> PDCP traffic : TX, read the pkt from the upper layer buffer #if defined(LINK_PDCP_TO_GTPV1U) - if (enb_flagP == ENB_FLAG_NO) + if (ctxt_pP->enb_flag == ENB_FLAG_NO) #endif { - pdcp_fifo_read_input_sdus(frameP, enb_flagP, ue_mod_idP, enb_mod_idP); + pdcp_fifo_read_input_sdus(ctxt_pP); } // PDCP -> NAS/IP traffic: RX - if (enb_flagP) - start_meas(&eNB_pdcp_stats[enb_mod_idP].pdcp_ip); + if (ctxt_pP->enb_flag) + start_meas(&eNB_pdcp_stats[ctxt_pP->enb_module_id].pdcp_ip); else - start_meas(&UE_pdcp_stats[ue_mod_idP].pdcp_ip); + start_meas(&UE_pdcp_stats[ctxt_pP->ue_module_id].pdcp_ip); - pdcp_fifo_flush_sdus(frameP, enb_flagP, enb_mod_idP, ue_mod_idP); + pdcp_fifo_flush_sdus(ctxt_pP); - if (enb_flagP) - stop_meas(&eNB_pdcp_stats[enb_mod_idP].pdcp_ip); + if (ctxt_pP->enb_flag) + stop_meas(&eNB_pdcp_stats[ctxt_pP->enb_module_id].pdcp_ip); else - stop_meas(&UE_pdcp_stats[ue_mod_idP].pdcp_ip); + stop_meas(&UE_pdcp_stats[ctxt_pP->ue_module_id].pdcp_ip); - if (enb_flagP) - stop_meas(&eNB_pdcp_stats[enb_mod_idP].pdcp_run); + if (ctxt_pP->enb_flag) + stop_meas(&eNB_pdcp_stats[ctxt_pP->enb_module_id].pdcp_run); else - stop_meas(&UE_pdcp_stats[ue_mod_idP].pdcp_run); + stop_meas(&UE_pdcp_stats[ctxt_pP->ue_module_id].pdcp_run); vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_RUN, VCD_FUNCTION_OUT); } -boolean_t pdcp_remove_UE( - const module_id_t enb_mod_idP, - const module_id_t ue_mod_idP, - const frame_t frameP) { +boolean_t pdcp_remove_UE(const protocol_ctxt_t* const ctxt_pP) { pdcp_t *pdcp_p = NULL; @@ -949,7 +944,7 @@ boolean_t pdcp_remove_UE( // check and remove SRBs first for (srb_id=0;srb_id<2;srb_id++) { - pdcp_p = &pdcp_array_srb_eNB[enb_mod_idP][ue_mod_idP][srb_id-1]; + pdcp_p = &pdcp_array_srb_eNB[ctxt_pP->enb_module_id][ctxt_pP->ue_module_id][srb_id-1]; if (pdcp_p->instanciated_instance == TRUE) { pdcp_p->instanciated_instance = FALSE; pdcp_p->lcid = 0; @@ -977,11 +972,10 @@ boolean_t pdcp_remove_UE( free(pdcp_p->kRRCenc); } } - } for (drb_id=0;drb_id<maxDRB;drb_id++) { - pdcp_p = &pdcp_array_drb_eNB[enb_mod_idP][ue_mod_idP][drb_id-1]; + pdcp_p = &pdcp_array_drb_eNB[ctxt_pP->enb_module_id][ctxt_pP->ue_module_id][drb_id-1]; if (pdcp_p->instanciated_instance == TRUE) { pdcp_p->instanciated_instance = FALSE; pdcp_p->lcid = 0; @@ -1018,10 +1012,7 @@ boolean_t pdcp_remove_UE( boolean_t rrc_pdcp_config_asn1_req ( - const module_id_t enb_mod_idP, - const module_id_t ue_mod_idP, - const frame_t frameP, - const eNB_flag_t enb_flagP, + const protocol_ctxt_t* const ctxt_pP, SRB_ToAddModList_t *const srb2add_list_pP, DRB_ToAddModList_t *const drb2add_list_pP, DRB_ToReleaseList_t *const drb2release_list_pP, @@ -1056,10 +1047,10 @@ boolean_t rrc_pdcp_config_asn1_req ( MBMS_SessionInfo_r9_t *MBMS_SessionInfo_p = NULL; #endif - if (enb_flagP == ENB_FLAG_NO) { - LOG_D(PDCP, "[UE %u] CONFIG REQ ASN1 for eNB %u\n", ue_mod_idP, enb_mod_idP); + if (ctxt_pP->enb_flag == ENB_FLAG_NO) { + LOG_D(PDCP, "[UE %u] CONFIG REQ ASN1 for eNB %u\n", ctxt_pP->ue_module_id, ctxt_pP->enb_module_id); } else { - LOG_D(PDCP, "[eNB %u] CONFIG REQ ASN1 for UE %u\n", enb_mod_idP, ue_mod_idP); + LOG_D(PDCP, "[eNB %u] CONFIG REQ ASN1 for UE %u\n", ctxt_pP->enb_module_id, ctxt_pP->ue_module_id); } // srb2add_list does not define pdcp config, we use rlc info to setup the pdcp dcch0 and dcch1 channels @@ -1070,10 +1061,10 @@ boolean_t rrc_pdcp_config_asn1_req ( rlc_type = RLC_MODE_AM; lc_id = srb_id + 2; - if (enb_flagP == ENB_FLAG_NO) { - pdcp_p = &pdcp_array_srb_ue[ue_mod_idP][srb_id-1]; + if (ctxt_pP->enb_flag == ENB_FLAG_NO) { + pdcp_p = &pdcp_array_srb_ue[ctxt_pP->ue_module_id][srb_id-1]; } else { - pdcp_p = &pdcp_array_srb_eNB[enb_mod_idP][ue_mod_idP][srb_id-1]; + pdcp_p = &pdcp_array_srb_eNB[ctxt_pP->enb_module_id][ctxt_pP->ue_module_id][srb_id-1]; } @@ -1092,24 +1083,22 @@ boolean_t rrc_pdcp_config_asn1_req ( case RLC_Config_PR_NOTHING: break; default: - pdcp_config_req_asn1 (pdcp_p, - enb_mod_idP, - ue_mod_idP, - frameP, - enb_flagP, // not really required - SRB_FLAG_YES, - rlc_type, - action, - lc_id, - mch_id, - srb_id, - srb_sn, - 0, // drb_report - 0, // header compression - security_modeP, - kRRCenc_pP, - kRRCint_pP, - kUPenc_pP); + pdcp_config_req_asn1 ( + ctxt_pP, + pdcp_p, + SRB_FLAG_YES, + rlc_type, + action, + lc_id, + mch_id, + srb_id, + srb_sn, + 0, // drb_report + 0, // header compression + security_modeP, + kRRCenc_pP, + kRRCint_pP, + kUPenc_pP); break; } break; @@ -1117,7 +1106,7 @@ boolean_t rrc_pdcp_config_asn1_req ( // already the default values break; default: - DevParam(srb_toaddmod_p->rlc_Config->present, ue_mod_idP, enb_mod_idP); + DevParam(srb_toaddmod_p->rlc_Config->present, ctxt_pP->ue_module_id, ctxt_pP->enb_module_id); break; } } @@ -1135,12 +1124,12 @@ boolean_t rrc_pdcp_config_asn1_req ( lc_id = drb_id + 2; - DevCheck4(drb_id < maxDRB, drb_id, maxDRB, ue_mod_idP, enb_mod_idP); + DevCheck4(drb_id < maxDRB, drb_id, maxDRB, ctxt_pP->ue_module_id, ctxt_pP->enb_module_id); - if (enb_flagP == ENB_FLAG_NO) { - pdcp_p = &pdcp_array_drb_ue[ue_mod_idP][drb_id-1]; + if (ctxt_pP->enb_flag == ENB_FLAG_NO) { + pdcp_p = &pdcp_array_drb_ue[ctxt_pP->ue_module_id][drb_id-1]; } else { - pdcp_p = &pdcp_array_drb_eNB[enb_mod_idP][ue_mod_idP][drb_id-1]; + pdcp_p = &pdcp_array_drb_eNB[ctxt_pP->enb_module_id][ctxt_pP->ue_module_id][drb_id-1]; } if (pdcp_p->instanciated_instance == TRUE) @@ -1194,27 +1183,25 @@ boolean_t rrc_pdcp_config_asn1_req ( break; default: LOG_W(PDCP,"[MOD_id %u/%u][RB %u] unknown drb_toaddmod->PDCP_Config->headerCompression->present \n", - enb_mod_idP, ue_mod_idP, drb_id); + ctxt_pP->enb_module_id, ctxt_pP->ue_module_id, drb_id); break; } - pdcp_config_req_asn1 (pdcp_p, - enb_mod_idP, - ue_mod_idP, - frameP, - enb_flagP, // not really required - SRB_FLAG_NO, - rlc_type, - action, - lc_id, - mch_id, - drb_id, - drb_sn, - drb_report, - header_compression_profile, - security_modeP, - kRRCenc_pP, - kRRCint_pP, - kUPenc_pP); + pdcp_config_req_asn1 ( + ctxt_pP, + pdcp_p, + SRB_FLAG_NO, + rlc_type, + action, + lc_id, + mch_id, + drb_id, + drb_sn, + drb_report, + header_compression_profile, + security_modeP, + kRRCenc_pP, + kRRCint_pP, + kUPenc_pP); } } } @@ -1224,30 +1211,28 @@ boolean_t rrc_pdcp_config_asn1_req ( pdrb_id_p = drb2release_list_pP->list.array[cnt]; drb_id = *pdrb_id_p; lc_id = drb_id + 2; - if (enb_flagP == ENB_FLAG_NO) { - pdcp_p = &pdcp_array_drb_ue[ue_mod_idP][drb_id-1]; + if (ctxt_pP->enb_flag == ENB_FLAG_NO) { + pdcp_p = &pdcp_array_drb_ue[ctxt_pP->ue_module_id][drb_id-1]; } else { - pdcp_p = &pdcp_array_drb_eNB[enb_mod_idP][ue_mod_idP][drb_id-1]; + pdcp_p = &pdcp_array_drb_eNB[ctxt_pP->enb_module_id][ctxt_pP->ue_module_id][drb_id-1]; } action = CONFIG_ACTION_REMOVE; - pdcp_config_req_asn1 (pdcp_p, - enb_mod_idP, - ue_mod_idP, - frameP, - enb_flagP, // not really required - SRB_FLAG_NO, - rlc_type, - action, - lc_id, - mch_id, - drb_id, - 0, - 0, - 0, - security_modeP, - kRRCenc_pP, - kRRCint_pP, - kUPenc_pP); + pdcp_config_req_asn1 ( + ctxt_pP, + pdcp_p, + SRB_FLAG_NO, + rlc_type, + action, + lc_id, + mch_id, + drb_id, + 0, + 0, + 0, + security_modeP, + kRRCenc_pP, + kRRCint_pP, + kUPenc_pP); } } @@ -1261,16 +1246,16 @@ boolean_t rrc_pdcp_config_asn1_req ( mch_id = MBMS_SessionInfo_p->tmgi_r9.serviceId_r9.buf[2]; //serviceId is 3-octet string // can set the mch_id = i - if (enb_flagP) { + if (ctxt_pP->enb_flag) { drb_id = (mch_id * maxSessionPerPMCH ) + lc_id ;//+ (maxDRB + 3)*MAX_MOBILES_PER_ENB; // 1 - if (pdcp_mbms_array_eNB[enb_mod_idP][mch_id][lc_id].instanciated_instance == TRUE) { + if (pdcp_mbms_array_eNB[ctxt_pP->enb_module_id][mch_id][lc_id].instanciated_instance == TRUE) { action = CONFIG_ACTION_MBMS_MODIFY; }else { action = CONFIG_ACTION_MBMS_ADD; } } else { drb_id = (mch_id * maxSessionPerPMCH ) + lc_id; // + (maxDRB + 3); // 15 - if (pdcp_mbms_array_ue[ue_mod_idP][mch_id][lc_id].instanciated_instance == TRUE) { + if (pdcp_mbms_array_ue[ctxt_pP->ue_module_id][mch_id][lc_id].instanciated_instance == TRUE) { action = CONFIG_ACTION_MBMS_MODIFY; } else { action = CONFIG_ACTION_MBMS_ADD; @@ -1278,24 +1263,21 @@ boolean_t rrc_pdcp_config_asn1_req ( } pdcp_config_req_asn1 ( - NULL, // unused for MBMS - enb_mod_idP, - ue_mod_idP, - frameP, - enb_flagP, - SRB_FLAG_NO, - RLC_MODE_NONE, - action, - lc_id, - mch_id, - drb_id, - 0, // unused for MBMS - 0, // unused for MBMS - 0, // unused for MBMS - 0, // unused for MBMS - NULL, // unused for MBMS - NULL, // unused for MBMS - NULL); // unused for MBMS + ctxt_pP, + NULL, // unused for MBMS + SRB_FLAG_NO, + RLC_MODE_NONE, + action, + lc_id, + mch_id, + drb_id, + 0, // unused for MBMS + 0, // unused for MBMS + 0, // unused for MBMS + 0, // unused for MBMS + NULL, // unused for MBMS + NULL, // unused for MBMS + NULL); // unused for MBMS } } } @@ -1305,31 +1287,30 @@ boolean_t rrc_pdcp_config_asn1_req ( } -boolean_t pdcp_config_req_asn1 (pdcp_t *pdcp_pP, - module_id_t enb_mod_idP, - module_id_t ue_mod_idP, - frame_t frameP, - eNB_flag_t enb_flagP, - srb_flag_t srb_flagP, - rlc_mode_t rlc_modeP, - config_action_t actionP, - uint16_t lc_idP, - uint16_t mch_idP, - rb_id_t rb_idP, - uint8_t rb_snP, - uint8_t rb_reportP, - uint16_t header_compression_profileP, - uint8_t security_modeP, - uint8_t *kRRCenc_pP, - uint8_t *kRRCint_pP, - uint8_t *kUPenc_pP) +boolean_t +pdcp_config_req_asn1 ( + const protocol_ctxt_t* const ctxt_pP, + pdcp_t * const pdcp_pP, + const srb_flag_t srb_flagP, + const rlc_mode_t rlc_modeP, + const config_action_t actionP, + const uint16_t lc_idP, + const uint16_t mch_idP, + const rb_id_t rb_idP, + const uint8_t rb_snP, + const uint8_t rb_reportP, + const uint16_t header_compression_profileP, + const uint8_t security_modeP, + uint8_t *const kRRCenc_pP, + uint8_t *const kRRCint_pP, + uint8_t *const kUPenc_pP) { switch (actionP) { case CONFIG_ACTION_ADD: DevAssert(pdcp_pP != NULL); pdcp_pP->instanciated_instance = TRUE; - pdcp_pP->is_ue = (enb_flagP == ENB_FLAG_NO) ? TRUE : FALSE; + pdcp_pP->is_ue = (ctxt_pP->enb_flag == ENB_FLAG_NO) ? TRUE : FALSE; pdcp_pP->is_srb = (srb_flagP == SRB_FLAG_YES) ? TRUE : FALSE; pdcp_pP->lcid = lc_idP; pdcp_pP->rb_id = rb_idP; @@ -1355,24 +1336,32 @@ boolean_t pdcp_config_req_asn1 (pdcp_t *pdcp_pP, pdcp_pP->first_missing_pdu = -1; pdcp_pP->rx_hfn_offset = 0; - if (enb_flagP == ENB_FLAG_NO) { + if (ctxt_pP->enb_flag == ENB_FLAG_NO) { LOG_I(PDCP, "[UE %d] Config request : Action ADD for eNB %d: Frame %d LCID %d (rb id %d) " "configured with SN size %d bits and RLC %s\n", - ue_mod_idP, enb_mod_idP, frameP, lc_idP, rb_idP, pdcp_pP->seq_num_size, + ctxt_pP->ue_module_id, ctxt_pP->enb_module_id, ctxt_pP->frame, lc_idP, rb_idP, pdcp_pP->seq_num_size, (rlc_modeP == RLC_MODE_AM ) ? "AM" : (rlc_modeP == RLC_MODE_TM) ? "TM" : "UM"); } else { LOG_D(PDCP, "[eNB %d] Config request : Action ADD for UE %d: Frame %d LCID %d (rb id %d) " "configured with SN size %d bits and RLC %s\n", - enb_mod_idP, ue_mod_idP, frameP, lc_idP, rb_idP, pdcp_pP->seq_num_size, + ctxt_pP->enb_module_id, ctxt_pP->ue_module_id, ctxt_pP->frame, lc_idP, rb_idP, pdcp_pP->seq_num_size, (rlc_modeP == RLC_MODE_AM) ? "AM" : (rlc_modeP == RLC_MODE_TM) ? "TM" : "UM"); } /* Setup security */ if (security_modeP != 0xff) { - pdcp_config_set_security(pdcp_pP, enb_mod_idP, ue_mod_idP, frameP, enb_flagP, rb_idP, lc_idP, security_modeP, kRRCenc_pP, kRRCint_pP, kUPenc_pP); + pdcp_config_set_security( + ctxt_pP, + pdcp_pP, + rb_idP, + lc_idP, + security_modeP, + kRRCenc_pP, + kRRCint_pP, + kUPenc_pP); } - LOG_D(PDCP, "[FRAME %5u][%s][PDCP][MOD %u/%u][RB %u]\n", frameP, (enb_flagP == ENB_FLAG_NO) ? "UE" : "eNB", enb_mod_idP, ue_mod_idP, rb_idP); + LOG_D(PDCP, "[FRAME %5u][%s][PDCP][MOD %u/%u][RB %u]\n", ctxt_pP->frame, (ctxt_pP->enb_flag == ENB_FLAG_NO) ? "UE" : "eNB", ctxt_pP->enb_module_id, ctxt_pP->ue_module_id, rb_idP); break; case CONFIG_ACTION_MODIFY: @@ -1383,7 +1372,15 @@ boolean_t pdcp_config_req_asn1 (pdcp_t *pdcp_pP, /* Setup security */ if (security_modeP != 0xff) { - pdcp_config_set_security(pdcp_pP, enb_mod_idP, ue_mod_idP, frameP, enb_flagP, rb_idP, lc_idP, security_modeP, kRRCenc_pP, kRRCint_pP, kUPenc_pP); + pdcp_config_set_security( + ctxt_pP, + pdcp_pP, + rb_idP, + lc_idP, + security_modeP, + kRRCenc_pP, + kRRCint_pP, + kUPenc_pP); } if (rb_snP == PDCP_Config__rlc_UM__pdcp_SN_Size_len7bits) { @@ -1394,15 +1391,15 @@ boolean_t pdcp_config_req_asn1 (pdcp_t *pdcp_pP, pdcp_pP->seq_num_size=5; } - if (enb_flagP == ENB_FLAG_NO) { + if (ctxt_pP->enb_flag == ENB_FLAG_NO) { LOG_I(PDCP,"[UE %d] Config request : Action MODIFY for eNB %d: Frame %d LCID %d " "RB id %d configured with SN size %d and RLC %s \n", - ue_mod_idP, enb_mod_idP, frameP, lc_idP, rb_idP, rb_snP, + ctxt_pP->ue_module_id, ctxt_pP->enb_module_id, ctxt_pP->frame, lc_idP, rb_idP, rb_snP, (rlc_modeP == RLC_MODE_AM) ? "AM" : (rlc_modeP == RLC_MODE_TM) ? "TM" : "UM"); } else { LOG_D(PDCP,"[eNB %d] Config request : Action MODIFY for UE %d: Frame %d LCID %d " "RB id %d configured with SN size %d and RLC %s \n", - enb_mod_idP, ue_mod_idP, frameP, lc_idP, rb_idP, rb_snP, + ctxt_pP->enb_module_id, ctxt_pP->ue_module_id, ctxt_pP->frame, lc_idP, rb_idP, rb_snP, (rlc_modeP == RLC_MODE_AM) ? "AM" : (rlc_modeP == RLC_MODE_TM) ? "TM" : "UM"); } break; @@ -1424,12 +1421,12 @@ boolean_t pdcp_config_req_asn1 (pdcp_t *pdcp_pP, pdcp_pP->first_missing_pdu = -1; pdcp_pP->security_activated = 0; - if (enb_flagP == ENB_FLAG_NO) { + if (ctxt_pP->enb_flag == ENB_FLAG_NO) { LOG_I(PDCP, "[UE %d] Config request : CONFIG_ACTION_REMOVE for eNB %d: Frame %d LCID %d RBID %d configured\n", - ue_mod_idP, enb_mod_idP, frameP, lc_idP, rb_idP); + ctxt_pP->ue_module_id, ctxt_pP->enb_module_id, ctxt_pP->frame, lc_idP, rb_idP); } else { LOG_D(PDCP, "[eNB %d] Config request : CONFIG_ACTION_REMOVE for UE %d: Frame %d LCID %d RBID %d configured\n", - enb_mod_idP, ue_mod_idP, frameP, lc_idP, rb_idP); + ctxt_pP->enb_module_id, ctxt_pP->ue_module_id, ctxt_pP->frame, lc_idP, rb_idP); } /* Security keys */ if (pdcp_pP->kUPenc != NULL) { @@ -1445,43 +1442,49 @@ boolean_t pdcp_config_req_asn1 (pdcp_t *pdcp_pP, #if defined(Rel10) case CONFIG_ACTION_MBMS_ADD: case CONFIG_ACTION_MBMS_MODIFY: - if (enb_flagP == ENB_FLAG_NO) { + if (ctxt_pP->enb_flag == ENB_FLAG_NO) { LOG_I(PDCP,"[UE %d] Config request for eNB %d: %s: Frame %d service_id/mch index %d, session_id/lcid %d, rbid %d configured\n", - ue_mod_idP, enb_mod_idP, actionP == CONFIG_ACTION_MBMS_ADD ? "CONFIG_ACTION_MBMS_ADD" : "CONFIG_ACTION_MBMS_MODIFY", frameP, mch_idP, lc_idP, rb_idP); + ctxt_pP->ue_module_id, ctxt_pP->enb_module_id, actionP == CONFIG_ACTION_MBMS_ADD ? "CONFIG_ACTION_MBMS_ADD" : "CONFIG_ACTION_MBMS_MODIFY", ctxt_pP->frame, mch_idP, lc_idP, rb_idP); } else { LOG_D(PDCP,"[eNB %d] Config request for UE %d: %s: Frame %d service_id/mch index %d, session_id/lcid %d, rbid %d configured\n", - enb_mod_idP, ue_mod_idP, actionP == CONFIG_ACTION_MBMS_ADD ? "CONFIG_ACTION_MBMS_ADD" : "CONFIG_ACTION_MBMS_MODIFY", frameP, mch_idP, lc_idP, rb_idP); + ctxt_pP->enb_module_id, ctxt_pP->ue_module_id, actionP == CONFIG_ACTION_MBMS_ADD ? "CONFIG_ACTION_MBMS_ADD" : "CONFIG_ACTION_MBMS_MODIFY", ctxt_pP->frame, mch_idP, lc_idP, rb_idP); } - if (enb_flagP == 1) { - pdcp_mbms_array_eNB[enb_mod_idP][mch_idP][lc_idP].instanciated_instance = TRUE ; - pdcp_mbms_array_eNB[enb_mod_idP][mch_idP][lc_idP].rb_id = rb_idP; + if (ctxt_pP->enb_flag == 1) { + pdcp_mbms_array_eNB[ctxt_pP->enb_module_id][mch_idP][lc_idP].instanciated_instance = TRUE ; + pdcp_mbms_array_eNB[ctxt_pP->enb_module_id][mch_idP][lc_idP].rb_id = rb_idP; } else { - pdcp_mbms_array_ue[ue_mod_idP][mch_idP][lc_idP].instanciated_instance = TRUE ; - pdcp_mbms_array_ue[ue_mod_idP][mch_idP][lc_idP].rb_id = rb_idP; + pdcp_mbms_array_ue[ctxt_pP->ue_module_id][mch_idP][lc_idP].instanciated_instance = TRUE ; + pdcp_mbms_array_ue[ctxt_pP->ue_module_id][mch_idP][lc_idP].rb_id = rb_idP; } break; #endif case CONFIG_ACTION_SET_SECURITY_MODE: - pdcp_config_set_security(pdcp_pP, enb_mod_idP, ue_mod_idP, frameP, enb_flagP, rb_idP, lc_idP, security_modeP, kRRCenc_pP, kRRCint_pP, kUPenc_pP); + pdcp_config_set_security( + ctxt_pP, + pdcp_pP, + rb_idP, + lc_idP, + security_modeP, + kRRCenc_pP, + kRRCint_pP, + kUPenc_pP); break; default: - DevParam(actionP, enb_mod_idP, ue_mod_idP); + DevParam(actionP, ctxt_pP->enb_module_id, ctxt_pP->ue_module_id); break; } return 0; } -void pdcp_config_set_security(pdcp_t *pdcp_pP, - module_id_t enb_mod_idP, - module_id_t ue_mod_idP, - frame_t frameP, - eNB_flag_t enb_flagP, - rb_id_t rb_idP, - uint16_t lc_idP, - uint8_t security_modeP, - uint8_t *kRRCenc, - uint8_t *kRRCint, - uint8_t *kUPenc) +void pdcp_config_set_security( + const protocol_ctxt_t* const ctxt_pP, + pdcp_t * const pdcp_pP, + const rb_id_t rb_idP, + const uint16_t lc_idP, + const uint8_t security_modeP, + uint8_t * const kRRCenc, + uint8_t * const kRRCint, + uint8_t * const kUPenc) { DevAssert(pdcp_pP != NULL); @@ -1489,21 +1492,21 @@ void pdcp_config_set_security(pdcp_t *pdcp_pP, pdcp_pP->cipheringAlgorithm = security_modeP & 0x0f; pdcp_pP->integrityProtAlgorithm = (security_modeP>>4) & 0xf; - if (enb_flagP == ENB_FLAG_NO) { + if (ctxt_pP->enb_flag == ENB_FLAG_NO) { LOG_D(PDCP,"[UE %d][RB %02d] Set security mode : CONFIG_ACTION_SET_SECURITY_MODE: " "Frame %d cipheringAlgorithm %d integrityProtAlgorithm %d\n", - ue_mod_idP, + ctxt_pP->ue_module_id, rb_idP, - frameP, + ctxt_pP->frame, pdcp_pP->cipheringAlgorithm, pdcp_pP->integrityProtAlgorithm); } else { LOG_D(PDCP,"[eNB %d][UE %d][RB %02d] Set security mode : CONFIG_ACTION_SET_SECURITY_MODE: " "Frame %d cipheringAlgorithm %d integrityProtAlgorithm %d\n", - enb_mod_idP, - ue_mod_idP, + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rb_idP, - frameP, + ctxt_pP->frame, pdcp_pP->cipheringAlgorithm, pdcp_pP->integrityProtAlgorithm); } @@ -1518,21 +1521,27 @@ void pdcp_config_set_security(pdcp_t *pdcp_pP, } } -void rrc_pdcp_config_req (module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t frameP, eNB_flag_t enb_flagP, srb_flag_t srb_flagP, uint32_t actionP, rb_id_t rb_idP, uint8_t security_modeP) +void +rrc_pdcp_config_req ( + const protocol_ctxt_t* const ctxt_pP, + const srb_flag_t srb_flagP, + const uint32_t actionP, + const rb_id_t rb_idP, + const uint8_t security_modeP) { pdcp_t *pdcp_p = NULL; - if (enb_flagP == ENB_FLAG_NO) { + if (ctxt_pP->enb_flag == ENB_FLAG_NO) { if (srb_flagP) { - pdcp_p = &pdcp_array_srb_ue[ue_mod_idP][rb_idP-1]; + pdcp_p = &pdcp_array_srb_ue[ctxt_pP->ue_module_id][rb_idP-1]; } else { - pdcp_p = &pdcp_array_drb_ue[ue_mod_idP][rb_idP-1]; + pdcp_p = &pdcp_array_drb_ue[ctxt_pP->ue_module_id][rb_idP-1]; } } else { if (srb_flagP) { - pdcp_p = &pdcp_array_srb_eNB[enb_mod_idP][ue_mod_idP][rb_idP-1]; + pdcp_p = &pdcp_array_srb_eNB[ctxt_pP->enb_module_id][ctxt_pP->ue_module_id][rb_idP-1]; } else { - pdcp_p = &pdcp_array_drb_eNB[enb_mod_idP][ue_mod_idP][rb_idP-1]; + pdcp_p = &pdcp_array_drb_eNB[ctxt_pP->enb_module_id][ctxt_pP->ue_module_id][rb_idP-1]; } } @@ -1544,7 +1553,7 @@ void rrc_pdcp_config_req (module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame pdcp_p->instanciated_instance = TRUE; pdcp_p->is_srb = srb_flagP; pdcp_p->rb_id = rb_idP; - if (enb_flagP == ENB_FLAG_NO) { + if (ctxt_pP->enb_flag == ENB_FLAG_NO) { pdcp_p->is_ue = TRUE; } else { pdcp_p->is_ue = FALSE; @@ -1564,7 +1573,7 @@ void rrc_pdcp_config_req (module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame } pdcp_p->first_missing_pdu = -1; LOG_D(PDCP,"[%s %d] Config request : Action ADD: Frame %d radio bearer id %d configured\n", - (enb_flagP) ? "eNB" : "UE", (enb_flagP) ? enb_mod_idP : ue_mod_idP, frameP, rb_idP); + (ctxt_pP->enb_flag) ? "eNB" : "UE", (ctxt_pP->enb_flag) ? ctxt_pP->enb_module_id : ctxt_pP->ue_module_id, ctxt_pP->frame, rb_idP); break; case CONFIG_ACTION_MODIFY: break; @@ -1579,7 +1588,7 @@ void rrc_pdcp_config_req (module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame pdcp_p->first_missing_pdu = -1; pdcp_p->security_activated = 0; LOG_D(PDCP,"[%s %d] Config request : CONFIG_ACTION_REMOVE: Frame %d radio bearer id %d configured\n", - (enb_flagP) ? "eNB" : "UE", (enb_flagP) ? enb_mod_idP : ue_mod_idP, frameP, rb_idP); + (ctxt_pP->enb_flag) ? "eNB" : "UE", (ctxt_pP->enb_flag) ? ctxt_pP->enb_module_id : ctxt_pP->ue_module_id, ctxt_pP->frame, rb_idP); break; case CONFIG_ACTION_SET_SECURITY_MODE: @@ -1587,7 +1596,7 @@ void rrc_pdcp_config_req (module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame pdcp_p->cipheringAlgorithm= security_modeP & 0x0f; pdcp_p->integrityProtAlgorithm = (security_modeP>>4) & 0xf; LOG_D(PDCP,"[%s %d]Set security mode : CONFIG_ACTION_SET_SECURITY_MODE: Frame %d cipheringAlgorithm %d integrityProtAlgorithm %d\n", - (enb_flagP) ? "eNB" : "UE", (enb_flagP) ? enb_mod_idP : ue_mod_idP, frameP, + (ctxt_pP->enb_flag) ? "eNB" : "UE", (ctxt_pP->enb_flag) ? ctxt_pP->enb_module_id : ctxt_pP->ue_module_id, ctxt_pP->frame, pdcp_p->cipheringAlgorithm, pdcp_p->integrityProtAlgorithm ); } else { @@ -1595,7 +1604,7 @@ void rrc_pdcp_config_req (module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame } break; default: - DevParam(actionP, ue_mod_idP, enb_mod_idP); + DevParam(actionP, ctxt_pP->ue_module_id, ctxt_pP->enb_module_id); break; } } diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.h b/openair2/LAYER2/PDCP_v10.1.0/pdcp.h index ef6110d769af3241bf7d3c0e6d40ee57a29112a5..0621372b9b2dba4499bc463a3e13f21e67197788 100755 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.h +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.h @@ -197,27 +197,21 @@ typedef struct pdcp_mbms_t { * under targets/TEST/PDCP/ */ -/*! \fn boolean_t pdcp_data_req(module_id_t , module_id_t , frame_t , eNB_flag_t , srb_flag_t , rb_id_t , mui_t , confirm_t ,sdu_size_t , unsigned char* , pdcp_transmission_mode_t ) +/*! \fn boolean_t pdcp_data_req(const protocol_ctxt_t* const , srb_flag_t , rb_id_t , mui_t , confirm_t ,sdu_size_t , unsigned char* , pdcp_transmission_mode_t ) * \brief This functions handles data transfer requests coming either from RRC or from IP -* \param[in] enb_mod_idP Virtualized enb module identifier, Not used if eNB_flagP = 0. -* \param[in] ue_mod_idP Virtualized ue module identifier. -* \param[in] frame Frame number -* \param[in] Shows if relevant PDCP entity is part of an eNB or a UE -* \param[in] rab_id Radio Bearer ID +* \param[in] ctxt_pP Running context. +* \param[in] rab_id Radio Bearer ID * \param[in] muiP * \param[in] confirmP * \param[in] sdu_buffer_size Size of incoming SDU in bytes -* \param[in] sdu_buffer Buffer carrying SDU -* \param[in] mode flag to indicate whether the userplane data belong to the control plane or data plane or transparent +* \param[in] sdu_buffer Buffer carrying SDU +* \param[in] mode flag to indicate whether the userplane data belong to the control plane or data plane or transparent * \return TRUE on success, FALSE otherwise * \note None * @ingroup _pdcp */ public_pdcp(boolean_t pdcp_data_req( - const module_id_t eNB_id, - const module_id_t UE_id, - const frame_t frame, - const eNB_flag_t eNB_flag, + const protocol_ctxt_t* const ctxt_pP, const srb_flag_t srb_flagP, const rb_id_t rb_id, const mui_t muiP, @@ -226,12 +220,9 @@ public_pdcp(boolean_t pdcp_data_req( unsigned char* const sdu_buffer, const pdcp_transmission_mode_t mode)); -/*! \fn boolean_t pdcp_data_ind(module_id_t, module_id_t, frame_t, eNB_flag_t, srb_flag_t, MBMS_flag_t, rb_id_t, sdu_size_t, mem_block_t*, boolean_t) +/*! \fn boolean_t pdcp_data_ind(const protocol_ctxt_t* const, srb_flag_t, MBMS_flag_t, rb_id_t, sdu_size_t, mem_block_t*, boolean_t) * \brief This functions handles data transfer indications coming from RLC -* \param[in] enb_mod_idP Virtualized enb module identifier, Not used if eNB_flagP = 0. -* \param[in] ue_mod_idP Virtualized ue module identifier. -* \param[in] frame Frame number -* \param[in] Shows if relevant PDCP entity is part of an eNB or a UE +* \param[in] ctxt_pP Running context. * \param[in] Shows if rb is SRB * \param[in] Tells if MBMS traffic * \param[in] rab_id Radio Bearer ID @@ -243,22 +234,16 @@ public_pdcp(boolean_t pdcp_data_req( * @ingroup _pdcp */ public_pdcp(boolean_t pdcp_data_ind( - const module_id_t eNB_id, - const module_id_t UE_id, - const frame_t frame, - const eNB_flag_t eNB_flag, + const protocol_ctxt_t* const ctxt_pP, const srb_flag_t srb_flagP, const MBMS_flag_t MBMS_flagP, const rb_id_t rb_id, const sdu_size_t sdu_buffer_size, mem_block_t* const sdu_buffer)); -/*! \fn void rrc_pdcp_config_req(module_id_t , module_id_t ,frame_t,eNB_flag_t,uint32_t,rb_id_t,uint8_t) +/*! \fn void rrc_pdcp_config_req(const protocol_ctxt_t* const ,uint32_t,rb_id_t,uint8_t) * \brief This functions initializes relevant PDCP entity -* \param[in] enb_mod_idP Virtualized enb module identifier, Not used if eNB_flagP = 0. -* \param[in] ue_mod_idP Virtualized ue module identifier. -* \param[in] frameP frame counter (TTI) -* \param[in] eNB_flagP flag indicating the node type +* \param[in] ctxt_pP Running context. * \param[in] actionP flag for action: add, remove , modify * \param[in] rb_idP Radio Bearer ID of relevant PDCP entity * \param[in] security_modeP Radio Bearer ID of relevant PDCP entity @@ -267,21 +252,15 @@ public_pdcp(boolean_t pdcp_data_ind( * @ingroup _pdcp */ public_pdcp(void rrc_pdcp_config_req ( - const module_id_t enb_idP, - const module_id_t ue_idP, - const frame_t frameP, - const eNB_flag_t eNB_flagP, + const protocol_ctxt_t* const ctxt_pP, const srb_flag_t srb_flagP, const uint32_t actionP, const rb_id_t rb_idP, const uint8_t security_modeP);) -/*! \fn bool rrc_pdcp_config_asn1_req (module_id_t module_id, frame_t frame, eNB_flag_t eNB_flag, SRB_ToAddModList_t* srb2add_list, DRB_ToAddModList_t* drb2add_list, DRB_ToReleaseList_t* drb2release_list) +/*! \fn bool rrc_pdcp_config_asn1_req (const protocol_ctxt_t* const , SRB_ToAddModList_t* srb2add_list, DRB_ToAddModList_t* drb2add_list, DRB_ToReleaseList_t* drb2release_list) * \brief Function for RRC to configure a Radio Bearer. -* \param[in] enb_mod_idP Virtualized enb module identifier. -* \param[in] ue_mod_idP Virtualized ue module identifier. -* \param[in] frame Frame index. -* \param[in] eNB_flag Flag to indicate eNB (1) or UE (0) +* \param[in] ctxt_pP Running context. * \param[in] index index of UE or eNB depending on the eNB_flag * \param[in] srb2add_list SRB configuration list to be created. * \param[in] drb2add_list DRB configuration list to be created. @@ -294,10 +273,7 @@ public_pdcp(void rrc_pdcp_config_req ( */ public_pdcp( boolean_t rrc_pdcp_config_asn1_req ( - const module_id_t eNB_idP, - const module_id_t ue_idP, - const frame_t frameP, - const eNB_flag_t eNB_flagP, + const protocol_ctxt_t* const ctxt_pP, SRB_ToAddModList_t *const srb2add_list, DRB_ToAddModList_t *const drb2add_list, DRB_ToReleaseList_t *const drb2release_list, @@ -310,8 +286,9 @@ boolean_t rrc_pdcp_config_asn1_req ( #endif )); -/*! \fn boolean_t pdcp_config_req_asn1 (module_id_t module_id, frame_t frame, eNB_flag_t eNB_flag, srb_flag_t srb_flagP, uint32_t action, rb_id_t rb_id, uint8_t rb_sn, uint8_t rb_report, uint16_t header_compression_profile, uint8_t security_mode) +/*! \fn boolean_t pdcp_config_req_asn1 (const protocol_ctxt_t* const ctxt_pP, srb_flag_t srb_flagP, uint32_t action, rb_id_t rb_id, uint8_t rb_sn, uint8_t rb_report, uint16_t header_compression_profile, uint8_t security_mode) * \brief Function for RRC to configure a Radio Bearer. +* \param[in] ctxt_pP Running context. * \param[in] pdcp_pP Pointer on PDCP structure. * \param[in] enb_mod_idP Virtualized enb module identifier, Not used if eNB_flagP = 0. * \param[in] ue_mod_idP Virtualized ue module identifier. @@ -330,11 +307,8 @@ boolean_t rrc_pdcp_config_asn1_req ( * \return A status about the processing, OK or error code. */ public_pdcp(boolean_t pdcp_config_req_asn1 ( + const protocol_ctxt_t* const ctxt_pP, pdcp_t *const pdcp_pP, - const module_id_t enb_idP, - const module_id_t ue_idP, - const frame_t frameP, - const eNB_flag_t eNB_flagP, const srb_flag_t srb_flagP, const rlc_mode_t rlc_mode, const uint32_t action, @@ -350,43 +324,33 @@ public_pdcp(boolean_t pdcp_config_req_asn1 ( uint8_t *const kUPenc)); -/*! \fn boolean_t pdcp_remove_UE(const module_id_t enb_mod_idP,const module_id_t ue_mod_idP,const frame_t frameP) +/*! \fn boolean_t pdcp_remove_UE(const protocol_ctxt_t* const ctxt_pP) * \brief Function for RRC to configure a Radio Bearer clear all PDCP resources for a particular UE -* \param[in] enb_mod_idP index of eNB -* \param[in] enb_mod_idP index of UE -* \param[in] frameP frame +* \param[in] ctxt_pP Running context. * \return A status about the processing, OK or error code. */ public_pdcp(boolean_t pdcp_remove_UE( - const module_id_t enb_mod_idP, - const module_id_t ue_mod_idP, - const frame_t frameP)); + const protocol_ctxt_t* const ctxt_pP)); -/*! \fn void rrc_pdcp_config_release(module_id_t, rb_id_t) +/*! \fn void rrc_pdcp_config_release( const protocol_ctxt_t* const, rb_id_t) * \brief This functions is unused -* \param[in] module_id Module ID of relevant PDCP entity +* \param[in] ctxt_pP Running context. * \param[in] rab_id Radio Bearer ID of relevant PDCP entity * \return none * \note None * @ingroup _pdcp */ -//public_pdcp(void rrc_pdcp_config_release (module_id_t, rb_id_t);) +//public_pdcp(void rrc_pdcp_config_release ( const protocol_ctxt_t* const ctxt_pP, rb_id_t);) -/*! \fn void pdcp_run(frame_t, eNB_flag_t, module_id_t,module_id_t) +/*! \fn void pdcp_run(const protocol_ctxt_t* const ctxt_pP) * \brief Runs PDCP entity to let it handle incoming/outgoing SDUs -* \param[in] frame Frame number -* \param[in] eNB_flag Indicates if this PDCP entity belongs to an eNB or to a UE -* \param[in] enb_mod_idP Virtualized enb module identifier, Not used if eNB_flagP = 0. -* \param[in] ue_mod_idP Virtualized ue module identifier. +* \param[in] ctxt_pP Running context. * \return none * \note None * @ingroup _pdcp */ public_pdcp(void pdcp_run ( - const frame_t frameP, - const eNB_flag_t eNB_flagP, - const module_id_t ue_mod_idP, - const module_id_t enb_mod_idP);) + const protocol_ctxt_t* const ctxt_pP);) public_pdcp(int pdcp_module_init (void);) public_pdcp(void pdcp_module_cleanup (void);) public_pdcp(void pdcp_layer_init (void);) @@ -397,23 +361,13 @@ public_pdcp(int pdcp_netlink_init (void);) #define NAS2PDCP_FIFO 22 protected_pdcp_fifo(int pdcp_fifo_flush_sdus ( - const frame_t frameP, - const eNB_flag_t eNB_flagP, - const module_id_t enb_idP, - const module_id_t ue_mod_idP);) + const protocol_ctxt_t* const ctxt_pP);) protected_pdcp_fifo(int pdcp_fifo_read_input_sdus_remaining_bytes ( - const frame_t frameP, - const eNB_flag_t eNB_flagP);) + const protocol_ctxt_t* const ctxt_pP);) protected_pdcp_fifo(int pdcp_fifo_read_input_sdus ( - const frame_t frameP, - const eNB_flag_t eNB_flagP, - const module_id_t ue_mod_idP, - const module_id_t enb_mod_idP);) + const protocol_ctxt_t* const ctxt_pP);) protected_pdcp_fifo(void pdcp_fifo_read_input_sdus_from_otg ( - const frame_t frameP, - const eNB_flag_t eNB_flagP, - const module_id_t ue_mod_idP, - const module_id_t enb_mod_idP);) + const protocol_ctxt_t* const ctxt_pP);) //----------------------------------------------------------------------------- @@ -481,7 +435,7 @@ public_pdcp(pdcp_stats_t UE_pdcp_stats[NUMBER_OF_UE_MAX];) public_pdcp(pdcp_stats_t eNB_pdcp_stats[NUMBER_OF_eNB_MAX];) protected_pdcp(pdcp_t pdcp_array_srb_ue[NUMBER_OF_UE_MAX][2];) protected_pdcp(pdcp_t pdcp_array_drb_ue[NUMBER_OF_UE_MAX][maxDRB];) -public_pdcp(pdcp_t pdcp_array_srb_eNB[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX][2];) +public_pdcp(pdcp_t pdcp_array_srb_eNB[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX][2];) protected_pdcp(pdcp_t pdcp_array_drb_eNB[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX][maxDRB];) #if defined(Rel10) public_pdcp(pdcp_mbms_t pdcp_mbms_array_ue[NUMBER_OF_UE_MAX][maxServiceCount][maxSessionPerPMCH];) // some constants from openair2/RRC/LITE/MESSAGES/asn1_constants.h diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c index 9316a83acc3e7c514ff32c8670a0b57385fad1da..937f764dfd4661aa6e9f2c6413820e2347b739f0 100755 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c @@ -100,7 +100,7 @@ extern Packet_OTG_List_t *otg_pdcp_buffer; pdcp_data_req_header_t pdcp_read_header_g; //----------------------------------------------------------------------------- -int pdcp_fifo_flush_sdus(frame_t frameP, eNB_flag_t enb_flagP, module_id_t enb_mod_idP, module_id_t ue_mod_idP) +int pdcp_fifo_flush_sdus(const protocol_ctxt_t* const ctxt_pP) { //----------------------------------------------------------------------------- @@ -123,18 +123,18 @@ int pdcp_fifo_flush_sdus(frame_t frameP, eNB_flag_t enb_flagP, module_id_t enb_m #endif #if defined(LINK_PDCP_TO_GTPV1U) - if (enb_flagP) { + if (ctxt_pP->enb_flag) { AssertFatal(0, "Now execution should not go here"); LOG_D(PDCP,"Sending to GTPV1U %d bytes\n", ((pdcp_data_ind_header_t *)(sdu_p->data))->data_size); /*message_p = itti_alloc_new_message(TASK_PDCP_ENB, GTPV1U_TUNNEL_DATA_REQ); GTPV1U_TUNNEL_DATA_REQ(message_p).buffer = &(((uint8_t *) sdu_p->data)[sizeof (pdcp_data_ind_header_t)]); GTPV1U_TUNNEL_DATA_REQ(message_p).length = ((pdcp_data_ind_header_t *)(sdu_p->data))->data_size; - GTPV1U_TUNNEL_DATA_REQ(message_p).ue_module_id = ue_mod_idP; + GTPV1U_TUNNEL_DATA_REQ(message_p).ue_module_id = ctxt_pP->ue_module_id; GTPV1U_TUNNEL_DATA_REQ(message_p).rab_id; = ((pdcp_data_ind_header_t *)(sdu_p->data))->rb_id; */ gtpv1u_new_data_req( - enb_mod_idP, //gtpv1u_data_t *gtpv1u_data_p, - ue_mod_idP,//rb_id/maxDRB, TO DO UE ID + ctxt_pP->enb_module_id, //gtpv1u_data_t *gtpv1u_data_p, + ctxt_pP->ue_module_id,//rb_id/maxDRB, TO DO UE ID ((pdcp_data_ind_header_t *)(sdu_p->data))->rb_id + 4, &(((uint8_t *) sdu_p->data)[sizeof (pdcp_data_ind_header_t)]), ((pdcp_data_ind_header_t *)(sdu_p->data))->data_size); @@ -150,7 +150,7 @@ int pdcp_fifo_flush_sdus(frame_t frameP, eNB_flag_t enb_flagP, module_id_t enb_m #endif /* defined(ENABLE_USE_MME) */ #ifdef PDCP_DEBUG LOG_I(PDCP, "PDCP->IP TTI %d INST %d: Preparing %d Bytes of data from rab %d to Nas_mesh\n", - frameP, ((pdcp_data_ind_header_t *)(sdu_p->data))->inst, + ctxt_pP->frame, ((pdcp_data_ind_header_t *)(sdu_p->data))->inst, ((pdcp_data_ind_header_t *)(sdu_p->data))->data_size, ((pdcp_data_ind_header_t *)(sdu_p->data))->rb_id); #endif //PDCP_DEBUG cont = 0; @@ -179,7 +179,7 @@ int pdcp_fifo_flush_sdus(frame_t frameP, eNB_flag_t enb_flagP, module_id_t enb_m #ifdef PDCP_DEBUG LOG_I(PDCP, "Frame %d Sent %d Bytes of header to Nas_mesh\n", - frameP, + ctxt_pP->frame, bytes_wrote); #endif //PDCP_DEBUG @@ -210,7 +210,7 @@ int pdcp_fifo_flush_sdus(frame_t frameP, eNB_flag_t enb_flagP, module_id_t enb_m #ifdef PDCP_DEBUG LOG_I(PDCP, "PDCP->IP Frame %d INST %d: Sent %d Bytes of data from rab %d to Nas_mesh\n", - frameP, + ctxt_pP->frame, ((pdcp_data_ind_header_t *)(sdu_p->data))->inst, bytes_wrote, ((pdcp_data_ind_header_t *)(sdu_p->data))->rb_id); @@ -222,7 +222,7 @@ int pdcp_fifo_flush_sdus(frame_t frameP, eNB_flag_t enb_flagP, module_id_t enb_m // LOG_D(PDCP, "rb sent a sdu qos_sap %d\n", sapiP); LOG_D(PDCP, "[FRAME %05d][xxx][PDCP][MOD xx/xx][RB %u][--- PDCP_DATA_IND / %d Bytes --->][IP][INSTANCE %u][RB %u]\n", - frameP, + ctxt_pP->frame, ((pdcp_data_ind_header_t *)(sdu_p->data))->rb_id, ((pdcp_data_ind_header_t *)(sdu_p->data))->data_size, ((pdcp_data_ind_header_t *)(sdu_p->data))->inst, @@ -271,13 +271,13 @@ int pdcp_fifo_flush_sdus(frame_t frameP, eNB_flag_t enb_flagP, module_id_t enb_m if ((pdcp_2_nas_irq > 0)) { #ifdef PDCP_DEBUG LOG_I(PDCP, "Frame %d : Trigger NAS RX interrupt\n", - frameP); + ctxt_pP->frame); #endif //PDCP_DEBUG rt_pend_linux_srq (pdcp_2_nas_irq); } else { LOG_E(PDCP, "Frame %d: ERROR IF IP STACK WANTED : NOTIF PACKET(S) pdcp_2_nas_irq not initialized : %d\n", - frameP, + ctxt_pP->frame, pdcp_2_nas_irq); } } @@ -292,7 +292,7 @@ int pdcp_fifo_flush_sdus(frame_t frameP, eNB_flag_t enb_flagP, module_id_t enb_m * returns zero value if whole bytes that had to be read were not read at all * returns a negative value if an error was encountered while reading the rt fifo */ -int pdcp_fifo_read_input_sdus_remaining_bytes (frame_t frameP, eNB_flag_t enb_flagP) +int pdcp_fifo_read_input_sdus_remaining_bytes (const protocol_ctxt_t* const ctxt_pP) { //----------------------------------------------------------------------------- sdu_size_t bytes_read = 0; @@ -320,7 +320,7 @@ int pdcp_fifo_read_input_sdus_remaining_bytes (frame_t frameP, eNB_flag_t enb_fl } else { #ifdef PDCP_DEBUG LOG_I(PDCP, "Frame %d: IP->RADIO RECEIVED COMPLETE SDU size %d inst %d rb %d\n", - frameP, + ctxt_pP->frame, pdcp_input_sdu_size_read, pdcp_input_header.inst, pdcp_input_header.rb_id); @@ -330,7 +330,7 @@ int pdcp_fifo_read_input_sdus_remaining_bytes (frame_t frameP, eNB_flag_t enb_fl pdcp_read_header_g.inst = 0; #endif - if (enb_flagP == 0) { + if (ctxt_pP->enb_flag == 0) { ue_inst = pdcp_read_header_g.inst; rb_id = pdcp_read_header_g.rb_id; enb_inst = 0; @@ -355,8 +355,8 @@ int pdcp_fifo_read_input_sdus_remaining_bytes (frame_t frameP, eNB_flag_t enb_fl if (pdcp_input_header.rb_id != 0) { LOG_D(PDCP, "[FRAME %5u][%s][IP][INSTANCE %u][RB %u][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %u/%u][RB %u]\n", - frameP, - (enb_flagP) ? "eNB" : "UE", + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", pdcp_read_header_g.inst, pdcp_read_header_g.rb_id, pdcp_read_header_g.data_size, @@ -366,10 +366,7 @@ int pdcp_fifo_read_input_sdus_remaining_bytes (frame_t frameP, eNB_flag_t enb_fl if (pdcp_p->instanciated_instance) { result = pdcp_data_req ( - enb_inst, - ue_inst, - frameP, - enb_flagP, + ctxt_pP, SRB_FLAG_NO, rb_id % maxDRB, RLC_MUI_UNDEFINED, @@ -382,8 +379,8 @@ int pdcp_fifo_read_input_sdus_remaining_bytes (frame_t frameP, eNB_flag_t enb_fl } else if ((pdcp_input_header.traffic_type == TRAFFIC_IPV6_TYPE_MULTICAST) || (pdcp_input_header.traffic_type == TRAFFIC_IPV4_TYPE_MULTICAST)) { LOG_D(PDCP, "[FRAME %5u][%s][IP][INSTANCE %u][RB %u][--- PDCP_DATA_REQ on MBMS bearer/ %d Bytes --->][PDCP][MOD %u/%u][RB %u]\n", - frameP, - (enb_flagP) ? "eNB" : "UE", + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", pdcp_read_header_g.inst, pdcp_read_header_g.rb_id, pdcp_read_header_g.data_size, @@ -393,10 +390,7 @@ int pdcp_fifo_read_input_sdus_remaining_bytes (frame_t frameP, eNB_flag_t enb_fl if (pdcp_p->instanciated_instance) { result = pdcp_data_req ( - enb_inst, - ue_inst, - frameP, - enb_flagP, + ctxt_pP, SRB_FLAG_NO, rb_id, RLC_MUI_UNDEFINED, @@ -407,7 +401,7 @@ int pdcp_fifo_read_input_sdus_remaining_bytes (frame_t frameP, eNB_flag_t enb_fl AssertFatal (result == TRUE, "PDCP data request failed!\n"); } - } else if (enb_flagP) { + } else if (ctxt_pP->enb_flag) { // is a broadcast packet, we have to send this packet on all default RABS of all connected UEs LOG_D(PDCP, "Checking if could sent on default rabs\n"); for (ue_inst = 0; ue_inst < NUMBER_OF_UE_MAX; ue_inst++) { @@ -415,8 +409,8 @@ int pdcp_fifo_read_input_sdus_remaining_bytes (frame_t frameP, eNB_flag_t enb_fl pdcp_p = &pdcp_array_drb_eNB[enb_inst][ue_inst][DEFAULT_RAB_ID-1]; if (pdcp_p->instanciated_instance) { LOG_D(PDCP, "[FRAME %5u][%s][IP][INSTANCE %u][RB %u][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %u/%u][RB DEFAULT_RAB_ID %u]\n", - frameP, - (enb_flagP) ? "eNB" : "UE", + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", pdcp_read_header_g.inst, pdcp_read_header_g.rb_id, pdcp_read_header_g.data_size, @@ -424,10 +418,7 @@ int pdcp_fifo_read_input_sdus_remaining_bytes (frame_t frameP, eNB_flag_t enb_fl ue_inst, DEFAULT_RAB_ID); result = pdcp_data_req ( - enb_inst, - ue_inst, - frameP, - enb_flagP, + ctxt_pP, SRB_FLAG_NO, DEFAULT_RAB_ID, RLC_MUI_UNDEFINED, @@ -441,8 +432,8 @@ int pdcp_fifo_read_input_sdus_remaining_bytes (frame_t frameP, eNB_flag_t enb_fl } else { LOG_D(PDCP, "Forcing send on DEFAULT_RAB_ID\n"); LOG_D(PDCP, "[FRAME %5u][%s][IP][INSTANCE %u][RB %u][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %u/%u][RB DEFAULT_RAB_ID %u]\n", - frameP, - (enb_flagP) ? "eNB" : "UE", + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", pdcp_read_header_g.inst, pdcp_read_header_g.rb_id, pdcp_read_header_g.data_size, @@ -450,10 +441,7 @@ int pdcp_fifo_read_input_sdus_remaining_bytes (frame_t frameP, eNB_flag_t enb_fl ue_inst, DEFAULT_RAB_ID); result = pdcp_data_req ( - enb_inst, - ue_inst, - frameP, - enb_flagP, + ctxt_pP, SRB_FLAG_NO, DEFAULT_RAB_ID, RLC_MUI_UNDEFINED, @@ -475,7 +463,7 @@ int pdcp_fifo_read_input_sdus_remaining_bytes (frame_t frameP, eNB_flag_t enb_fl } //----------------------------------------------------------------------------- -int pdcp_fifo_read_input_sdus (frame_t frameP, eNB_flag_t enb_flagP, module_id_t ue_mod_idP, module_id_t enb_mod_idP) +int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP) { #ifdef NAS_NETLINK # if defined(ENABLE_PDCP_NETLINK_FIFO) @@ -485,37 +473,37 @@ int pdcp_fifo_read_input_sdus (frame_t frameP, eNB_flag_t enb_flagP, module_id_t pdcp_transmission_mode_t pdcp_mode = PDCP_TRANSMISSION_MODE_UNKNOWN; struct pdcp_netlink_element_s *data = NULL; - while (pdcp_netlink_dequeue_element(enb_mod_idP, ue_mod_idP, enb_flagP, &data) != 0) { + while (pdcp_netlink_dequeue_element(ctxt_pP->enb_module_id, ctxt_pP->ue_module_id, ctxt_pP->enb_flag, &data) != 0) { DevAssert(data != NULL); - if (enb_flagP == 0) { + if (ctxt_pP->enb_flag == 0) { rab_id = data->pdcp_read_header.rb_id % maxDRB; - pdcp = &pdcp_array_drb_ue[ue_mod_idP][rab_id-1]; + pdcp = &pdcp_array_drb_ue[ctxt_pP->ue_module_id][rab_id-1]; } else { rab_id = data->pdcp_read_header.rb_id % maxDRB; - ue_mod_idP = data->pdcp_read_header.rb_id / maxDRB; - pdcp = &pdcp_array_drb_eNB[enb_mod_idP][ue_mod_idP][rab_id-1]; + ctxt_pP->ue_module_id = data->pdcp_read_header.rb_id / maxDRB; + pdcp = &pdcp_array_drb_eNB[ctxt_pP->enb_module_id][ctxt_pP->ue_module_id][rab_id-1]; } - if (enb_flagP) { - AssertFatal ((enb_mod_idP >= oai_emulation.info.first_enb_local) && (oai_emulation.info.nb_enb_local > 0), + if (ctxt_pP->enb_flag) { + AssertFatal ((ctxt_pP->enb_module_id >= oai_emulation.info.first_enb_local) && (oai_emulation.info.nb_enb_local > 0), "eNB module id is too low (%u/%d)!\n", - enb_mod_idP, + ctxt_pP->enb_module_id, oai_emulation.info.first_enb_local); - AssertFatal ((enb_mod_idP < (oai_emulation.info.first_enb_local + oai_emulation.info.nb_enb_local)) && (oai_emulation.info.nb_enb_local > 0), + AssertFatal ((ctxt_pP->enb_module_id < (oai_emulation.info.first_enb_local + oai_emulation.info.nb_enb_local)) && (oai_emulation.info.nb_enb_local > 0), "eNB module id is too high (%u/%d)!\n", - enb_mod_idP, + ctxt_pP->enb_module_id, oai_emulation.info.first_enb_local + oai_emulation.info.nb_enb_local); - AssertFatal (ue_mod_idP < NB_UE_INST, + AssertFatal (ctxt_pP->ue_module_id < NB_UE_INST, "UE module id is too high (%u/%d)!\n", - ue_mod_idP, + ctxt_pP->ue_module_id, oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local); } else { - AssertFatal (ue_mod_idP < (oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local), + AssertFatal (ctxt_pP->ue_module_id < (oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local), "UE module id is too high (%u/%d)!\n", - ue_mod_idP, + ctxt_pP->ue_module_id, oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local); - AssertFatal (ue_mod_idP >= oai_emulation.info.first_ue_local, + AssertFatal (ctxt_pP->ue_module_id >= oai_emulation.info.first_ue_local, "UE module id is too low (%u/%d)!\n", - ue_mod_idP, + ctxt_pP->ue_module_id, oai_emulation.info.first_ue_local); } AssertFatal (rab_id < maxDRB, "RB id is too high (%u/%d)!\n", rab_id, maxDRB); @@ -524,13 +512,13 @@ int pdcp_fifo_read_input_sdus (frame_t frameP, eNB_flag_t enb_flagP, module_id_t if (pdcp->instanciated_instance) { LOG_D(PDCP, "[FRAME %05d][%s][IP][INSTANCE %u][RB %u][--- PDCP_DATA_REQ " "/ %d Bytes --->][PDCP][MOD %u/%u][RB %u]\n", - frameP, - (enb_flagP) ? "eNB" : "UE", + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", data->pdcp_read_header.inst, data->pdcp_read_header.rb_id, data->pdcp_read_header.data_size, - enb_mod_idP, - ue_mod_idP, + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rab_id); #ifdef OAI_NW_DRIVER_TYPE_ETHERNET if ((data->pdcp_read_header.traffic_type == TRAFFIC_IPV6_TYPE_MULTICAST) /*TRAFFIC_IPV6_TYPE_MULTICAST */ || @@ -551,10 +539,10 @@ int pdcp_fifo_read_input_sdus (frame_t frameP, eNB_flag_t enb_flagP, module_id_t #else // NASMESH driver does not curreenlty support multicast traffic pdcp_mode = PDCP_TRANSMISSION_MODE_DATA; #endif - pdcp_data_req(enb_mod_idP, - ue_mod_idP, - frameP, - enb_flagP, + pdcp_data_req(ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, + ctxt_pP->frame, + ctxt_pP->enb_flag, SRB_FLAG_NO, rab_id % maxDRB, RLC_MUI_UNDEFINED, @@ -563,24 +551,24 @@ int pdcp_fifo_read_input_sdus (frame_t frameP, eNB_flag_t enb_flagP, module_id_t data->data, pdcp_mode); } else { - LOG_E(PDCP, "Received packet for non-instanciated instance %u with rb_id %u, UE_index %d, enb_flagP %d eNB_index %d\n", - data->pdcp_read_header.inst, data->pdcp_read_header.rb_id, ue_mod_idP, enb_flagP,enb_mod_idP); + LOG_E(PDCP, "Received packet for non-instanciated instance %u with rb_id %u, UE_index %d, ctxt_pP->enb_flag %d eNB_index %d\n", + data->pdcp_read_header.inst, data->pdcp_read_header.rb_id, ctxt_pP->ue_module_id, ctxt_pP->enb_flag,ctxt_pP->enb_module_id); } - } else if (enb_flagP) { + } else if (ctxt_pP->enb_flag) { /* rb_id = 0, thus interpreated as broadcast and transported as * multiple unicast is a broadcast packet, we have to send this * packet on all default RABS of all connected UEs */ LOG_D(PDCP, "eNB Try Forcing send on DEFAULT_RAB_ID first_ue_local %u nb_ue_local %u\n", oai_emulation.info.first_ue_local, oai_emulation.info.nb_ue_local); for (ue_id = 0; ue_id < NB_UE_INST; ue_id++) { - pdcp = &pdcp_array_drb_eNB[enb_mod_idP][ue_id][DEFAULT_RAB_ID-1]; + pdcp = &pdcp_array_drb_eNB[ctxt_pP->enb_module_id][ue_id][DEFAULT_RAB_ID-1]; if (pdcp->instanciated_instance) { LOG_D(PDCP, "eNB Try Forcing send on DEFAULT_RAB_ID UE %d\n", ue_id); pdcp_data_req( - enb_mod_idP, + ctxt_pP->enb_module_id, ue_id, - frameP, - enb_flagP, + ctxt_pP->frame, + ctxt_pP->enb_flag, SRB_FLAG_NO, DEFAULT_RAB_ID, RLC_MUI_UNDEFINED, @@ -593,10 +581,10 @@ int pdcp_fifo_read_input_sdus (frame_t frameP, eNB_flag_t enb_flagP, module_id_t } else { LOG_D(PDCP, "Forcing send on DEFAULT_RAB_ID\n"); pdcp_data_req( - enb_mod_idP, - ue_mod_idP, - frameP, - enb_flagP, + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, + ctxt_pP->frame, + ctxt_pP->enb_flag, SRB_FLAG_NO, DEFAULT_RAB_ID, RLC_MUI_UNDEFINED, @@ -653,31 +641,31 @@ int pdcp_fifo_read_input_sdus (frame_t frameP, eNB_flag_t enb_flagP, module_id_t #ifdef OAI_EMU // overwrite function input parameters, because only one netlink socket for all instances if (pdcp_read_header_g.inst < oai_emulation.info.nb_enb_local) { - enb_flagP = 1; - ue_mod_idP = pdcp_read_header_g.rb_id / maxDRB + oai_emulation.info.first_ue_local; - enb_mod_idP = pdcp_read_header_g.inst + oai_emulation.info.first_enb_local; + ctxt_pP->enb_flag = 1; + ctxt_pP->ue_module_id = pdcp_read_header_g.rb_id / maxDRB + oai_emulation.info.first_ue_local; + ctxt_pP->enb_module_id = pdcp_read_header_g.inst + oai_emulation.info.first_enb_local; rab_id = pdcp_read_header_g.rb_id % maxDRB; } else { - enb_flagP = 0; - ue_mod_idP = pdcp_read_header_g.inst - oai_emulation.info.nb_enb_local + oai_emulation.info.first_ue_local; - enb_mod_idP = 0; + ctxt_pP->enb_flag = 0; + ctxt_pP->ue_module_id = pdcp_read_header_g.inst - oai_emulation.info.nb_enb_local + oai_emulation.info.first_ue_local; + ctxt_pP->enb_module_id = 0; rab_id = pdcp_read_header_g.rb_id; } - AssertFatal (enb_mod_idP >= oai_emulation.info.first_enb_local, + AssertFatal (ctxt_pP->enb_module_id >= oai_emulation.info.first_enb_local, "eNB inst is too low (%u/%d)!\n", - enb_mod_idP, + ctxt_pP->enb_module_id, oai_emulation.info.first_enb_local); - AssertFatal (enb_mod_idP < (oai_emulation.info.first_enb_local + oai_emulation.info.nb_enb_local), + AssertFatal (ctxt_pP->enb_module_id < (oai_emulation.info.first_enb_local + oai_emulation.info.nb_enb_local), "eNB inst is too high (%u/%d)!\n", - enb_mod_idP, + ctxt_pP->enb_module_id, oai_emulation.info.first_enb_local + oai_emulation.info.nb_enb_local); - AssertFatal (ue_mod_idP >= oai_emulation.info.first_ue_local, + AssertFatal (ctxt_pP->ue_module_id >= oai_emulation.info.first_ue_local, "UE inst is too low (%u/%d)!\n", - ue_mod_idP, + ctxt_pP->ue_module_id, oai_emulation.info.first_ue_local); - AssertFatal (ue_mod_idP < (oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local), + AssertFatal (ctxt_pP->ue_module_id < (oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local), "UE inst is too high (%u/%d)!\n", - ue_mod_idP, + ctxt_pP->ue_module_id, oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local); AssertFatal (rab_id < maxDRB, "RB id is too high (%u/%d)!\n", rab_id, maxDRB); /*LGpdcp_read_header.inst = (pdcp_read_header_g.inst >= oai_emulation.info.nb_enb_local) ? \ @@ -686,24 +674,24 @@ int pdcp_fifo_read_input_sdus (frame_t frameP, eNB_flag_t enb_flagP, module_id_t #else pdcp_read_header_g.inst = 0; #warning "TO DO CORRCT VALUES FOR ue mod id, enb mod id" - if (enb_flagP) { - ue_mod_idP = 0; - enb_mod_idP = 0; + if (ctxt_pP->enb_flag) { + ctxt_pP->ue_module_id = 0; + ctxt_pP->enb_module_id = 0; rab_id = pdcp_read_header_g.rb_id % maxDRB; } else { - ue_mod_idP = 0; - enb_mod_idP = 0; + ctxt_pP->ue_module_id = 0; + ctxt_pP->enb_module_id = 0; rab_id = pdcp_read_header_g.rb_id % maxDRB; } #endif - if (enb_flagP) { + if (ctxt_pP->enb_flag) { if (rab_id != 0) { rab_id = rab_id % maxDRB; - if (pdcp_array_drb_eNB[enb_mod_idP][ue_mod_idP][rab_id-1].instanciated_instance) { + if (pdcp_array_drb_eNB[ctxt_pP->enb_module_id][ctxt_pP->ue_module_id][rab_id-1].instanciated_instance) { #ifdef PDCP_DEBUG LOG_I(PDCP, "[FRAME %5u][eNB][NETLINK][IP->PDCP] INST %d: Received socket with length %d (nlmsg_len = %d) on Rab %d \n", - frameP, + ctxt_pP->frame, pdcp_read_header_g.inst, len, nas_nlh_rx->nlmsg_len-sizeof(struct nlmsghdr), @@ -711,15 +699,15 @@ int pdcp_fifo_read_input_sdus (frame_t frameP, eNB_flag_t enb_flagP, module_id_t #endif LOG_D(PDCP, "[FRAME %5u][eNB][IP][INSTANCE %u][RB %u][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %u/%u][RB %u]\n", - frameP, + ctxt_pP->frame, pdcp_read_header_g.inst, pdcp_read_header_g.rb_id, pdcp_read_header_g.data_size, - enb_mod_idP, - ue_mod_idP, + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rab_id); - pdcp_data_req(enb_mod_idP,ue_mod_idP,frameP, enb_flagP,SRB_FLAG_NO, + pdcp_data_req(ctxt_pP->enb_module_id,ctxt_pP->ue_module_id,ctxt_pP->frame, ctxt_pP->enb_flag,SRB_FLAG_NO, rab_id, RLC_MUI_UNDEFINED, RLC_SDU_CONFIRM_NO, @@ -728,32 +716,32 @@ int pdcp_fifo_read_input_sdus (frame_t frameP, eNB_flag_t enb_flagP, module_id_t PDCP_TRANSMISSION_MODE_DATA); } else { LOG_D(PDCP, "[FRAME %5u][eNB][IP][INSTANCE %u][RB %u][--- PDCP_DATA_REQ / %d Bytes ---X][PDCP][MOD %u/%u][RB %u] NON INSTANCIATED INSTANCE, DROPPED\n", - frameP, + ctxt_pP->frame, pdcp_read_header_g.inst, pdcp_read_header_g.rb_id, pdcp_read_header_g.data_size, - enb_mod_idP, - ue_mod_idP, + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rab_id); } } else { // rb_id =0, thus interpreated as broadcast and transported as multiple unicast // is a broadcast packet, we have to send this packet on all default RABS of all connected UEs #warning CODE TO BE REVIEWED, ONLY WORK FOR SIMPLE TOPOLOGY CASES - for (ue_mod_idP = 0; ue_mod_idP < NB_UE_INST; ue_mod_idP++) { - if (pdcp_array_drb_eNB[enb_mod_idP][ue_mod_idP][rab_id-1].instanciated_instance == TRUE) { + for (ctxt_pP->ue_module_id = 0; ctxt_pP->ue_module_id < NB_UE_INST; ctxt_pP->ue_module_id++) { + if (pdcp_array_drb_eNB[ctxt_pP->enb_module_id][ctxt_pP->ue_module_id][rab_id-1].instanciated_instance == TRUE) { LOG_D(PDCP, "[FRAME %5u][eNB][IP][INSTANCE %u][RB %u][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %u/%u][RB DEFAULT_RAB_ID %u]\n", - frameP, + ctxt_pP->frame, pdcp_read_header_g.inst, pdcp_read_header_g.rb_id, pdcp_read_header_g.data_size, - enb_mod_idP, - ue_mod_idP, + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, DEFAULT_RAB_ID); pdcp_data_req ( - enb_mod_idP, - ue_mod_idP, - frameP, - enb_flagP, + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, + ctxt_pP->frame, + ctxt_pP->enb_flag, SRB_FLAG_NO, DEFAULT_RAB_ID, RLC_MUI_UNDEFINED, @@ -766,30 +754,30 @@ int pdcp_fifo_read_input_sdus (frame_t frameP, eNB_flag_t enb_flagP, module_id_t } } else { if (rab_id != 0) { - if (pdcp_array_drb_ue[ue_mod_idP][rab_id-1].instanciated_instance) { + if (pdcp_array_drb_ue[ctxt_pP->ue_module_id][rab_id-1].instanciated_instance) { #ifdef PDCP_DEBUG LOG_I(PDCP, "[FRAME %5u][UE][NETLINK][IP->PDCP] INST %d: Received socket with length %d (nlmsg_len = %d) on Rab %d \n", - frameP, + ctxt_pP->frame, pdcp_read_header_g.inst, len, nas_nlh_rx->nlmsg_len-sizeof(struct nlmsghdr), pdcp_read_header_g.rb_id); LOG_D(PDCP, "[FRAME %5u][UE][IP][INSTANCE %u][RB %u][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %u/%u][RB %u]\n", - frameP, + ctxt_pP->frame, pdcp_read_header_g.inst, pdcp_read_header_g.rb_id, pdcp_read_header_g.data_size, - enb_mod_idP, - ue_mod_idP, + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rab_id); #endif pdcp_data_req( - enb_mod_idP, - ue_mod_idP, - frameP, - enb_flagP, + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, + ctxt_pP->frame, + ctxt_pP->enb_flag, SRB_FLAG_NO, rab_id, RLC_MUI_UNDEFINED, @@ -799,29 +787,29 @@ int pdcp_fifo_read_input_sdus (frame_t frameP, eNB_flag_t enb_flagP, module_id_t PDCP_TRANSMISSION_MODE_DATA); } else { LOG_D(PDCP, "[FRAME %5u][UE][IP][INSTANCE %u][RB %u][--- PDCP_DATA_REQ / %d Bytes ---X][PDCP][MOD %u/%u][RB %u] NON INSTANCIATED INSTANCE, DROPPED\n", - frameP, + ctxt_pP->frame, pdcp_read_header_g.inst, pdcp_read_header_g.rb_id, pdcp_read_header_g.data_size, - enb_mod_idP, - ue_mod_idP, + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rab_id); } } else { LOG_D(PDCP, "Forcing send on DEFAULT_RAB_ID\n"); LOG_D(PDCP, "[FRAME %5u][eNB][IP][INSTANCE %u][RB %u][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %u/%u][RB DEFAULT_RAB_ID %u]\n", - frameP, + ctxt_pP->frame, pdcp_read_header_g.inst, pdcp_read_header_g.rb_id, pdcp_read_header_g.data_size, - enb_mod_idP, - ue_mod_idP, + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, DEFAULT_RAB_ID); pdcp_data_req ( - enb_mod_idP, - ue_mod_idP, - frameP, - enb_flagP, + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, + ctxt_pP->frame, + ctxt_pP->enb_flag, SRB_FLAG_NO, DEFAULT_RAB_ID, RLC_MUI_UNDEFINED, @@ -844,7 +832,7 @@ int pdcp_fifo_read_input_sdus (frame_t frameP, eNB_flag_t enb_flagP, module_id_t } -void pdcp_fifo_read_input_sdus_from_otg (frame_t frameP, eNB_flag_t enb_flagP, module_id_t ue_mod_idP, module_id_t enb_mod_idP) { +void pdcp_fifo_read_input_sdus_from_otg (const protocol_ctxt_t* const ctxt_pP) { unsigned char *otg_pkt=NULL; module_id_t src_id, module_id; // src for otg module_id_t dst_id; // dst for otg @@ -855,17 +843,19 @@ void pdcp_fifo_read_input_sdus_from_otg (frame_t frameP, eNB_flag_t enb_flagP, m Packet_otg_elt_t *otg_pkt_info=NULL; int result; - src_id = enb_mod_idP; + protocol_ctxt_t ctxt; + + src_id = ctxt_pP->enb_module_id; // we need to add conditions to avoid transmitting data when the UE is not RRC connected. #if defined(USER_MODE) && defined(OAI_EMU) if (oai_emulation.info.otg_enabled ==1 ){ - module_id = (enb_flagP == 1) ? enb_mod_idP : ue_mod_idP+NB_eNB_INST; - //rb_id = (enb_flagP == 1) ? enb_mod_idP * MAX_NUM_RB + DTCH : (NB_eNB_INST + UE_index -1 ) * MAX_NUM_RB + DTCH ; + module_id = (ctxt_pP->enb_flag == 1) ? ctxt_pP->enb_module_id : ctxt_pP->ue_module_id+NB_eNB_INST; + //rb_id = (ctxt_pP->enb_flag == 1) ? ctxt_pP->enb_module_id * MAX_NUM_RB + DTCH : (NB_eNB_INST + UE_index -1 ) * MAX_NUM_RB + DTCH ; src_id = module_id; while ((otg_pkt_info = pkt_list_remove_head(&(otg_pdcp_buffer[module_id]))) != NULL) { LOG_I(OTG,"Mod_id %d Frame %d Got a packet (%p), HEAD of otg_pdcp_buffer[%d] is %p and Nb elements is %d\n", - module_id,frameP, otg_pkt_info, module_id, pkt_list_get_head(&(otg_pdcp_buffer[module_id])), otg_pdcp_buffer[module_id].nb_elements); + module_id,ctxt_pP->frame, otg_pkt_info, module_id, pkt_list_get_head(&(otg_pdcp_buffer[module_id])), otg_pdcp_buffer[module_id].nb_elements); //otg_pkt_info = pkt_list_remove_head(&(otg_pdcp_buffer[module_id])); dst_id = (otg_pkt_info->otg_pkt).dst_id; module_id = (otg_pkt_info->otg_pkt).module_id; @@ -875,19 +865,19 @@ void pdcp_fifo_read_input_sdus_from_otg (frame_t frameP, eNB_flag_t enb_flagP, m // LOG_I(PDCP,"pdcp_fifo, pdcp mode is= %d\n",pdcp_mode); // generate traffic if the ue is rrc reconfigured state - // if (mac_get_rrc_status(module_id, enb_flagP, dst_id ) > 2 /*RRC_CONNECTED*/) { // not needed: this test is already done in update_otg_enb + // if (mac_get_rrc_status(module_id, ctxt_pP->enb_flag, dst_id ) > 2 /*RRC_CONNECTED*/) { // not needed: this test is already done in update_otg_enb otg_pkt = (unsigned char*) (otg_pkt_info->otg_pkt).sdu_buffer; pkt_size = (otg_pkt_info->otg_pkt).sdu_buffer_size; if (otg_pkt != NULL) { if (is_ue == 0 ) { - /*rlc_util_print_hex_octets(PDCP, + /*rlc_util_print_hex_octets(PDCP, otg_pkt, pkt_size); - */ + */ //rb_id = (/*NB_eNB_INST +*/ dst_id -1 ) * MAX_NUM_RB + DTCH; LOG_D(OTG,"[eNB %d] Frame %d sending packet %d from module %d on rab id %d (src %d, dst %d) pkt size %d for pdcp mode %d\n", - enb_mod_idP, frameP, pkt_cnt_enb++, module_id, rb_id, module_id, dst_id, pkt_size, pdcp_mode); - result = pdcp_data_req(enb_mod_idP, dst_id, frameP, enb_flagP, SRB_FLAG_NO, rb_id, RLC_MUI_UNDEFINED, RLC_SDU_CONFIRM_NO, pkt_size, otg_pkt,pdcp_mode); + ctxt_pP->enb_module_id, ctxt_pP->frame, pkt_cnt_enb++, module_id, rb_id, module_id, dst_id, pkt_size, pdcp_mode); + result = pdcp_data_req(ctxt_pP->enb_module_id, dst_id, ctxt_pP->frame, ctxt_pP->enb_flag, SRB_FLAG_NO, rb_id, RLC_MUI_UNDEFINED, RLC_SDU_CONFIRM_NO, pkt_size, otg_pkt,pdcp_mode); AssertFatal (result == TRUE, "PDCP data request failed!\n"); } else { @@ -895,11 +885,14 @@ void pdcp_fifo_read_input_sdus_from_otg (frame_t frameP, eNB_flag_t enb_flagP, m LOG_D(OTG,"[UE %d] Frame %d: sending packet %d from module %d on rab id %d (src %d, dst %d) pkt size %d\n", - ue_mod_idP, frameP, pkt_cnt_ue++, src_id, rb_id, src_id, dst_id, pkt_size); - result = pdcp_data_req( dst_id, - ue_mod_idP, - frameP, - enb_flagP, + ctxt_pP->ue_module_id, ctxt_pP->frame, pkt_cnt_ue++, src_id, rb_id, src_id, dst_id, pkt_size); + + ctxt.enb_module_id = dst_id; + ctxt.ue_module_id = ue_module_id; + ctxt.frame = ctxt_pP->frame; + ctxt.enb_flag = ctxt_pP->enb_flag; + + result = pdcp_data_req( &ctxt, SRB_FLAG_NO, rb_id, RLC_MUI_UNDEFINED, @@ -912,24 +905,36 @@ void pdcp_fifo_read_input_sdus_from_otg (frame_t frameP, eNB_flag_t enb_flagP, m free(otg_pkt); otg_pkt = NULL; } - // } //else LOG_D(OTG,"frameP %d enb %d-> ue %d link not yet established state %d \n", frameP, eNB_index,dst_id - NB_eNB_INST, mac_get_rrc_status(module_id, enb_flagP, dst_id - NB_eNB_INST)); + // } //else LOG_D(OTG,"ctxt_pP->frame %d enb %d-> ue %d link not yet established state %d \n", ctxt_pP->frame, eNB_index,dst_id - NB_eNB_INST, mac_get_rrc_status(module_id, ctxt_pP->enb_flag, dst_id - NB_eNB_INST)); } } #else - if ((otg_enabled==1) && (enb_flagP == 1)) { // generate DL traffic + if ((otg_enabled==1) && (ctxt_pP->enb_flag == 1)) { // generate DL traffic unsigned int ctime=0; - ctime = frameP * 100; + ctime = ctxt_pP->frame * 100; + + /*if ((mac_get_rrc_status(eNB_index, ctxt_pP->enb_flag, 0 ) > 2) && + (mac_get_rrc_status(eNB_index, ctxt_pP->enb_flag, 1 ) > 2)) { */ + ctxt.enb_module_id = ctxt_pP->enb_module_id; + ctxt.frame = ctxt_pP->frame; + ctxt.enb_flag = ctxt_pP->enb_flag; - /*if ((mac_get_rrc_status(eNB_index, enb_flagP, 0 ) > 2) && - (mac_get_rrc_status(eNB_index, enb_flagP, 1 ) > 2)) { */ for (dst_id = 0; dst_id<NUMBER_OF_UE_MAX; dst_id++) { - if (mac_get_rrc_status(enb_mod_idP, enb_flagP, dst_id ) > 2) { + if (mac_get_rrc_status(ctxt_pP->enb_module_id, ctxt_pP->enb_flag, dst_id ) > 2) { otg_pkt=packet_gen(src_id, dst_id, 0, ctime, &pkt_size); if (otg_pkt != NULL){ rb_id = dst_id * maxDRB + DTCH; - pdcp_data_req(enb_mod_idP, dst_id, frameP, enb_flagP, SRB_FLAG_NO, rb_id, RLC_MUI_UNDEFINED, RLC_SDU_CONFIRM_NO,pkt_size, otg_pkt, PDCP_TRANSMISSION_MODE_DATA); - LOG_I(OTG,"send packet from module %d on rab id %d (src %d, dst %d) pkt size %d\n", enb_mod_idP, rb_id, src_id, dst_id, pkt_size); + ctxt.ue_module_id = dst_id; + pdcp_data_req(&ctxt, + SRB_FLAG_NO, + rb_id, + RLC_MUI_UNDEFINED, + RLC_SDU_CONFIRM_NO, + pkt_size, + otg_pkt, + PDCP_TRANSMISSION_MODE_DATA); + LOG_I(OTG,"send packet from module %d on rab id %d (src %d, dst %d) pkt size %d\n", ctxt_pP->enb_module_id, rb_id, src_id, dst_id, pkt_size); free(otg_pkt); } /*else { @@ -937,7 +942,7 @@ void pdcp_fifo_read_input_sdus_from_otg (frame_t frameP, eNB_flag_t enb_flagP, m }*/ } /*else { - LOG_I(OTG,"rrc_status (src %d, dst %d) = %d\n",src_id, dst_id, mac_get_rrc_status(src_id, enb_flagP, dst_id )); + LOG_I(OTG,"rrc_status (src %d, dst %d) = %d\n",src_id, dst_id, mac_get_rrc_status(src_id, ctxt_pP->enb_flag, dst_id )); }*/ } } diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_netlink.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_netlink.c index 76d272c46d0ed500883564328077bb795fdb9572..2200c953fbb38b8d3aadde9fdb6f766ea20a01a4 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_netlink.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_netlink.c @@ -156,7 +156,7 @@ int pdcp_netlink_init(void) { * should be avoided if we want a reliable link. */ if (pthread_create(&pdcp_netlink_thread, &attr, pdcp_netlink_thread_fct, NULL) != 0) { - LOG_E(PDCP, "[NETLINK]Failed to create new thread for Netlink/PDCP communcation (%d:%s)\n", + LOG_E(PDCP, "[NETLINK]Failed to create new thread for Netlink/PDCP communication (%d:%s)\n", errno, strerror(errno)); exit(EXIT_FAILURE); } @@ -164,23 +164,20 @@ int pdcp_netlink_init(void) { return 0; } -int pdcp_netlink_dequeue_element( - module_id_t enb_mod_idP, - module_id_t ue_mod_idP, - eNB_flag_t eNB_flagP, +int pdcp_netlink_dequeue_element(const protocol_ctxt_t* const ctxt_pP, struct pdcp_netlink_element_s **data_ppP) { int ret = 0; - if (eNB_flagP) { - ret = lfds611_queue_dequeue(pdcp_netlink_queue_enb[enb_mod_idP], (void **)data_ppP); + if (ctxt_pP->enb_flag) { + ret = lfds611_queue_dequeue(pdcp_netlink_queue_enb[ctxt_pP->enb_module_id], (void **)data_ppP); if (ret != 0) { - LOG_D(PDCP,"[NETLINK]De-queueing packet for eNB instance %d\n", enb_mod_idP); + LOG_D(PDCP,"[NETLINK]De-queueing packet for eNB instance %d\n", ctxt_pP->enb_module_id); } } else { - ret = lfds611_queue_dequeue(pdcp_netlink_queue_ue[ue_mod_idP], (void **)data_ppP); + ret = lfds611_queue_dequeue(pdcp_netlink_queue_ue[ctxt_pP->ue_module_id], (void **)data_ppP); if (ret != 0) { - LOG_D(PDCP, "[NETLINK]De-queueing packet for UE instance %d\n", ue_mod_idP); + LOG_D(PDCP, "[NETLINK]De-queueing packet for UE instance %d\n", ctxt_pP->ue_module_id); } } @@ -219,7 +216,7 @@ void *pdcp_netlink_thread_fct(void *arg) { for (nas_nlh_rx = (struct nlmsghdr *) nl_rx_buf; NLMSG_OK(nas_nlh_rx, (unsigned int)len); nas_nlh_rx = NLMSG_NEXT (nas_nlh_rx, len)) { - start_meas(&ip_pdcp_stats_tmp); + start_meas(&ip_pdcp_stats_tmp); /* There is no need to check for nlmsg_type because * the header is not set in our drivers. */ @@ -272,8 +269,8 @@ void *pdcp_netlink_thread_fct(void *arg) { /* Enqueue the element in the right queue */ lfds611_queue_guaranteed_enqueue(pdcp_netlink_queue_enb[new_data_p->pdcp_read_header.inst], new_data_p); - stop_meas(&ip_pdcp_stats_tmp); - copy_meas(&eNB_pdcp_stats[new_data_p->pdcp_read_header.inst].pdcp_ip,&ip_pdcp_stats_tmp); + stop_meas(&ip_pdcp_stats_tmp); + copy_meas(&eNB_pdcp_stats[new_data_p->pdcp_read_header.inst].pdcp_ip,&ip_pdcp_stats_tmp); } else { if (pdcp_netlink_nb_element_ue[new_data_p->pdcp_read_header.inst] > PDCP_QUEUE_NB_ELEMENTS) { @@ -285,8 +282,8 @@ void *pdcp_netlink_thread_fct(void *arg) { /* Enqueue the element in the right queue */ lfds611_queue_guaranteed_enqueue(pdcp_netlink_queue_ue[new_data_p->pdcp_read_header.inst], new_data_p); - stop_meas(&ip_pdcp_stats_tmp); - copy_meas(&UE_pdcp_stats[new_data_p->pdcp_read_header.inst].pdcp_ip,&ip_pdcp_stats_tmp); + stop_meas(&ip_pdcp_stats_tmp); + copy_meas(&UE_pdcp_stats[new_data_p->pdcp_read_header.inst].pdcp_ip,&ip_pdcp_stats_tmp); } } } diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_primitives.h b/openair2/LAYER2/PDCP_v10.1.0/pdcp_primitives.h index 13677f975a8defa72fef5c7810d008328dea965b..8b923429e1ef24a0f480d939decdc6d4fa0021a3 100755 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_primitives.h +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_primitives.h @@ -174,23 +174,29 @@ boolean_t pdcp_serialize_user_plane_data_pdu_with_long_sn_buffer(unsigned char* boolean_t pdcp_serialize_control_pdu_for_pdcp_status_report(unsigned char* pdu_buffer, \ uint8_t bitmap[512], pdcp_control_pdu_for_pdcp_status_report* pdu); -int pdcp_netlink_dequeue_element(module_id_t enb_mod_idP, module_id_t ue_mod_idP, eNB_flag_t eNB_flagP, +int pdcp_netlink_dequeue_element(const protocol_ctxt_t* const ctxt_pP, struct pdcp_netlink_element_s **data_ppP); -void pdcp_config_set_security(pdcp_t *pdcp_pP, module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t frameP, eNB_flag_t eNB_flagP, rb_id_t rb_idP, +void pdcp_config_set_security(const protocol_ctxt_t* const ctxt_pP, pdcp_t *pdcp_pP, rb_id_t rb_idP, uint16_t lc_idP, uint8_t security_modeP, uint8_t *kRRCenc_pP, uint8_t *kRRCint_pP, uint8_t *kUPenc_pP); #if defined(ENABLE_SECURITY) -int pdcp_apply_security(pdcp_t *pdcp_entity, - srb_flag_t srb_flagP, - rb_id_t rb_id, - uint8_t pdcp_header_len, uint16_t current_sn, uint8_t *pdcp_pdu_buffer, - uint16_t sdu_buffer_size); - -int pdcp_validate_security(pdcp_t *pdcp_entity, - srb_flag_t srb_flagP, - rb_id_t rb_id, - uint8_t pdcp_header_len, uint16_t current_sn, uint8_t *pdcp_pdu_buffer, +int pdcp_apply_security(const protocol_ctxt_t* const ctxt_pP, + pdcp_t *pdcp_entity, + srb_flag_t srb_flagP, + rb_id_t rb_id, + uint8_t pdcp_header_len, + uint16_t current_sn, + uint8_t *pdcp_pdu_buffer, + uint16_t sdu_buffer_size); + +int pdcp_validate_security(const protocol_ctxt_t* const ctxt_pP, + pdcp_t *pdcp_entity, + srb_flag_t srb_flagP, + rb_id_t rb_id, + uint8_t pdcp_header_len, + uint16_t current_sn, + uint8_t *pdcp_pdu_buffer, uint16_t sdu_buffer_size); #endif /* defined(ENABLE_SECURITY) */ diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_security.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_security.c index 201a25b234ebbf3cb7af9c142791132aeaeff461..2968bb740126de8a9e80a207f9075f11771675b1 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_security.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_security.c @@ -49,12 +49,17 @@ #if defined(ENABLE_SECURITY) static -uint32_t pdcp_get_next_count_tx(pdcp_t *pdcp_entity, srb_flag_t srb_flagP, uint16_t pdcp_sn); +uint32_t pdcp_get_next_count_tx(pdcp_t *const pdcp_entity, const srb_flag_t srb_flagP, const uint16_t pdcp_sn); static -uint32_t pdcp_get_next_count_rx(pdcp_t *pdcp_entity, srb_flag_t srb_flagP, uint16_t pdcp_sn); +uint32_t pdcp_get_next_count_rx(pdcp_t *const pdcp_entity, const srb_flag_t srb_flagP, const uint16_t pdcp_sn); +//----------------------------------------------------------------------------- static -uint32_t pdcp_get_next_count_tx(pdcp_t *pdcp_entity, srb_flag_t srb_flagP, uint16_t pdcp_sn) +uint32_t pdcp_get_next_count_tx( + pdcp_t * const pdcp_entity, + const srb_flag_t srb_flagP, + const uint16_t pdcp_sn + ) { uint32_t count; /* For TX COUNT = TX_HFN << length of SN | pdcp SN */ @@ -73,8 +78,12 @@ uint32_t pdcp_get_next_count_tx(pdcp_t *pdcp_entity, srb_flag_t srb_flagP, uint1 return count; } +//----------------------------------------------------------------------------- static -uint32_t pdcp_get_next_count_rx(pdcp_t *pdcp_entity, srb_flag_t srb_flagP, uint16_t pdcp_sn) +uint32_t pdcp_get_next_count_rx( + pdcp_t * const pdcp_entity, + const srb_flag_t srb_flagP, + const uint16_t pdcp_sn) { uint32_t count; /* For RX COUNT = RX_HFN << length of SN | pdcp SN of received PDU */ @@ -97,13 +106,19 @@ uint32_t pdcp_get_next_count_rx(pdcp_t *pdcp_entity, srb_flag_t srb_flagP, uint1 return count; } -int pdcp_apply_security(pdcp_t *pdcp_entity, - srb_flag_t srb_flagP, - rb_id_t rb_id, - uint8_t pdcp_header_len, - uint16_t current_sn, - uint8_t *pdcp_pdu_buffer, - uint16_t sdu_buffer_size) + +//----------------------------------------------------------------------------- +int +pdcp_apply_security( + const protocol_ctxt_t* const ctxtP, + pdcp_t *const pdcp_entity, + const srb_flag_t srb_flagP, + const rb_id_t rb_id, + const uint8_t pdcp_header_len, + const uint16_t current_sn, + uint8_t * const pdcp_pdu_buffer, + const uint16_t sdu_buffer_size + ) { uint8_t *buffer_encrypted = NULL; stream_cipher_t encrypt_params; @@ -161,13 +176,18 @@ int pdcp_apply_security(pdcp_t *pdcp_entity, return 0; } -int pdcp_validate_security(pdcp_t *pdcp_entity, - srb_flag_t srb_flagP, - rb_id_t rb_id, - uint8_t pdcp_header_len, - uint16_t current_sn, - uint8_t *pdcp_pdu_buffer, - uint16_t sdu_buffer_size) +//----------------------------------------------------------------------------- +int +pdcp_validate_security( + const protocol_ctxt_t* const ctxtP, + pdcp_t * const pdcp_entity, + const srb_flag_t srb_flagP, + const rb_id_t rb_id, + const uint8_t pdcp_header_len, + const uint16_t current_sn, + uint8_t *const pdcp_pdu_buffer, + const uint16_t sdu_buffer_size + ) { uint8_t *buffer_decrypted = NULL; stream_cipher_t decrypt_params; diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.c index 5e0381c6362b7280ec85d864560c5eb2939a5c6d..572ee4f64d8e5954ce8b279327ffc56f0d18a386 100755 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.c +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.c @@ -57,7 +57,9 @@ extern rlc_am_control_pdu_info_t g_rlc_am_control_pdu_info; //----------------------------------------------------------------------------- uint32_t -rlc_am_get_buffer_occupancy_in_bytes (rlc_am_entity_t *rlc_pP,frame_t frameP) +rlc_am_get_buffer_occupancy_in_bytes ( + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t * const rlc_pP) { //----------------------------------------------------------------------------- uint32_t max_li_overhead; @@ -68,7 +70,7 @@ rlc_am_get_buffer_occupancy_in_bytes (rlc_am_entity_t *rlc_pP,frame_t frameP) if (rlc_pP->t_status_prohibit.running == 0) { #ifdef TRACE_RLC_AM_BO if (((15 + rlc_pP->num_nack_sn*(10+1) + rlc_pP->num_nack_so*(15+15+1) + 7) >> 3) > 0) { - LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u] BO : CONTROL PDU %d bytes \n", frameP, rlc_pP->module_id, rlc_pP->rb_id, ((15 + rlc_pP->num_nack_sn*(10+1) + rlc_pP->num_nack_so*(15+15+1) + 7) >> 3)); + LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u] BO : CONTROL PDU %d bytes \n", ctxt_pP->frame, rlc_pP->module_id, rlc_pP->rb_id, ((15 + rlc_pP->num_nack_sn*(10+1) + rlc_pP->num_nack_so*(15+15+1) + 7) >> 3)); } #endif return ((15 + rlc_pP->num_nack_sn*(10+1) + rlc_pP->num_nack_so*(15+15+1) + 7) >> 3); @@ -90,33 +92,36 @@ rlc_am_get_buffer_occupancy_in_bytes (rlc_am_entity_t *rlc_pP,frame_t frameP) #ifdef TRACE_RLC_AM_BO if ((rlc_pP->status_buffer_occupancy + rlc_pP->retransmission_buffer_occupancy + rlc_pP->sdu_buffer_occupancy + max_li_overhead + header_overhead) > 0) { - LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u] BO : STATUS BUFFER %d bytes \n", frameP, rlc_pP->module_id, rlc_pP->rb_id, rlc_pP->status_buffer_occupancy); - LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u] BO : RETRANS BUFFER %d bytes \n", frameP, rlc_pP->module_id,rlc_pP->rb_id, rlc_pP->retransmission_buffer_occupancy); - LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u] BO : SDU BUFFER %d bytes + li_overhead %d bytes header_overhead %d bytes (nb sdu not segmented %d)\n", frameP, rlc_pP->module_id,rlc_pP->rb_id, rlc_pP->sdu_buffer_occupancy, max_li_overhead, header_overhead, rlc_pP->nb_sdu_no_segmented); + LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u] BO : STATUS BUFFER %d bytes \n", ctxt_pP->frame, rlc_pP->module_id, rlc_pP->rb_id, rlc_pP->status_buffer_occupancy); + LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u] BO : RETRANS BUFFER %d bytes \n", ctxt_pP->frame, rlc_pP->module_id,rlc_pP->rb_id, rlc_pP->retransmission_buffer_occupancy); + LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u] BO : SDU BUFFER %d bytes + li_overhead %d bytes header_overhead %d bytes (nb sdu not segmented %d)\n", ctxt_pP->frame, rlc_pP->module_id,rlc_pP->rb_id, rlc_pP->sdu_buffer_occupancy, max_li_overhead, header_overhead, rlc_pP->nb_sdu_no_segmented); } #endif return rlc_pP->status_buffer_occupancy + rlc_pP->retransmission_buffer_occupancy + rlc_pP->sdu_buffer_occupancy + max_li_overhead + header_overhead; } //----------------------------------------------------------------------------- -void rlc_am_release (rlc_am_entity_t *rlc_pP) +void +rlc_am_release ( + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t * const rlc_pP + ) //----------------------------------------------------------------------------- { } //----------------------------------------------------------------------------- -void config_req_rlc_am ( - module_id_t enb_module_idP, - module_id_t ue_module_idP, - frame_t frameP, - eNB_flag_t eNB_flagP, - srb_flag_t srb_flagP, - rlc_am_info_t *config_am_pP, - rb_id_t rb_idP) +void +config_req_rlc_am ( + const protocol_ctxt_t* const ctxt_pP, + const srb_flag_t srb_flagP, + rlc_am_info_t * const config_am_pP, + const rb_id_t rb_idP + ) { //----------------------------------------------------------------------------- rlc_union_t *rlc_union_p = NULL; rlc_am_entity_t *l_rlc_p = NULL; - hash_key_t key = RLC_COLL_KEY_VALUE(enb_module_idP, ue_module_idP, eNB_flagP, rb_idP, srb_flagP); + hash_key_t key = RLC_COLL_KEY_VALUE(ctxt_pP->enb_module_id, ctxt_pP->ue_module_id, ctxt_pP->enb_flag, rb_idP, srb_flagP); hashtable_rc_t h_rc; h_rc = hashtable_get(rlc_coll_p, key, (void**)&rlc_union_p); @@ -124,22 +129,22 @@ void config_req_rlc_am ( l_rlc_p = &rlc_union_p->rlc.am; LOG_D(RLC, "[FRAME %5u][%s][RRC][MOD %u/%u][][--- CONFIG_REQ (max_retx_threshold=%d poll_pdu=%d poll_byte=%d t_poll_retransmit=%d t_reord=%d t_status_prohibit=%d) --->][RLC_AM][MOD %u/%u][RB %u]\n", - frameP, - ( eNB_flagP > 0) ? "eNB":"UE", - enb_module_idP, - ue_module_idP, + ctxt_pP->frame, + ( ctxt_pP->enb_flag > 0) ? "eNB":"UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, config_am_pP->max_retx_threshold, config_am_pP->poll_pdu, config_am_pP->poll_byte, config_am_pP->t_poll_retransmit, config_am_pP->t_reordering, config_am_pP->t_status_prohibit, - enb_module_idP, - ue_module_idP, + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rb_idP); - rlc_am_init(l_rlc_p,frameP); - rlc_am_set_debug_infos(l_rlc_p, frameP, eNB_flagP, enb_module_idP, ue_module_idP, rb_idP, srb_flagP); - rlc_am_configure(l_rlc_p,frameP, + rlc_am_init(ctxt_pP, l_rlc_p); + rlc_am_set_debug_infos(ctxt_pP, l_rlc_p, srb_flagP, rb_idP); + rlc_am_configure(ctxt_pP, l_rlc_p, config_am_pP->max_retx_threshold, config_am_pP->poll_pdu, config_am_pP->poll_byte, @@ -148,12 +153,12 @@ void config_req_rlc_am ( config_am_pP->t_status_prohibit); } else { LOG_E(RLC, "[FRAME %5u][%s][RRC][MOD %u/%u][][--- CONFIG_REQ --->][RLC_AM][MOD %u/%u][RB %u] RLC NOT FOUND\n", - frameP, - (eNB_flagP) ? "eNB" : "UE", - enb_module_idP, - ue_module_idP, - enb_module_idP, - ue_module_idP, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rb_idP); } } @@ -166,18 +171,15 @@ uint32_t t_StatusProhibit_tab[T_StatusProhibit_spare8]={0,5,10,15,20,25,30,35,40 //----------------------------------------------------------------------------- void config_req_rlc_am_asn1 ( - const module_id_t enb_module_idP, - const module_id_t ue_module_idP, - const frame_t frameP, - const eNB_flag_t eNB_flagP, - const srb_flag_t srb_flagP, - const struct RLC_Config__am * const config_am_pP, - const rb_id_t rb_idP) + const protocol_ctxt_t* const ctxt_pP, + const srb_flag_t srb_flagP, + const struct RLC_Config__am * const config_am_pP, + const rb_id_t rb_idP) { //----------------------------------------------------------------------------- rlc_union_t *rlc_union_p = NULL; rlc_am_entity_t *l_rlc_p = NULL; - hash_key_t key = RLC_COLL_KEY_VALUE(enb_module_idP, ue_module_idP, eNB_flagP, rb_idP, srb_flagP); + hash_key_t key = RLC_COLL_KEY_VALUE(ctxt_pP->enb_module_id, ctxt_pP->ue_module_id, ctxt_pP->enb_flag, rb_idP, srb_flagP); hashtable_rc_t h_rc; h_rc = hashtable_get(rlc_coll_p, key, (void**)&rlc_union_p); @@ -191,24 +193,23 @@ void config_req_rlc_am_asn1 ( (config_am_pP->dl_AM_RLC.t_StatusProhibit<T_StatusProhibit_spare8) ){ LOG_D(RLC, "[FRAME %5u][%s][RRC][MOD %u/%u][][--- CONFIG_REQ (max_retx_threshold=%d poll_pdu=%d poll_byte=%d t_poll_retransmit=%d t_reord=%d t_status_prohibit=%d) --->][RLC_AM][MOD %u/%u][RB %u]\n", - frameP, - (eNB_flagP) ? "eNB" : "UE", - enb_module_idP, - ue_module_idP, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, maxRetxThreshold_tab[config_am_pP->ul_AM_RLC.maxRetxThreshold], pollPDU_tab[config_am_pP->ul_AM_RLC.pollPDU], pollByte_tab[config_am_pP->ul_AM_RLC.pollByte], PollRetransmit_tab[config_am_pP->ul_AM_RLC.t_PollRetransmit], am_t_Reordering_tab[config_am_pP->dl_AM_RLC.t_Reordering], t_StatusProhibit_tab[config_am_pP->dl_AM_RLC.t_StatusProhibit], - enb_module_idP, - ue_module_idP, + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rb_idP); - rlc_am_init(l_rlc_p,frameP); - rlc_am_set_debug_infos(l_rlc_p, frameP, eNB_flagP, srb_flagP, enb_module_idP, ue_module_idP, rb_idP); - rlc_am_configure(l_rlc_p, - frameP, + rlc_am_init(ctxt_pP, l_rlc_p); + rlc_am_set_debug_infos(ctxt_pP, l_rlc_p, srb_flagP, rb_idP); + rlc_am_configure(ctxt_pP, l_rlc_p, maxRetxThreshold_tab[config_am_pP->ul_AM_RLC.maxRetxThreshold], pollPDU_tab[config_am_pP->ul_AM_RLC.pollPDU], pollByte_tab[config_am_pP->ul_AM_RLC.pollByte], @@ -218,61 +219,63 @@ void config_req_rlc_am_asn1 ( } else { LOG_D(RLC, "[FRAME %5u][%s][RRC][MOD %u/%u][][--- ILLEGAL CONFIG_REQ (max_retx_threshold=%d poll_pdu=%d poll_byte=%d t_poll_retransmit=%d t_reord=%d t_status_prohibit=%d) --->][RLC_AM][MOD %u/%u][RB %u], RLC-AM NOT CONFIGURED\n", - frameP, - (eNB_flagP) ? "eNB" : "UE", - enb_module_idP, - ue_module_idP, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, config_am_pP->ul_AM_RLC.maxRetxThreshold, config_am_pP->ul_AM_RLC.pollPDU, config_am_pP->ul_AM_RLC.pollByte, config_am_pP->ul_AM_RLC.t_PollRetransmit, config_am_pP->dl_AM_RLC.t_Reordering, config_am_pP->dl_AM_RLC.t_StatusProhibit, - enb_module_idP, - ue_module_idP, + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rb_idP); } } else { LOG_E(RLC, "[FRAME %5u][%s][RRC][MOD %u/%u][][--- CONFIG_REQ --->][RLC_AM][MOD %u/%u][RB %u] RLC NOT FOUND\n", - frameP, - (eNB_flagP) ? "eNB" : "UE", - enb_module_idP, - ue_module_idP, - enb_module_idP, - ue_module_idP, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rb_idP); } } //----------------------------------------------------------------------------- -void rlc_am_stat_req (rlc_am_entity_t *rlc_pP, - unsigned int* stat_tx_pdcp_sdu, - unsigned int* stat_tx_pdcp_bytes, - unsigned int* stat_tx_pdcp_sdu_discarded, - unsigned int* stat_tx_pdcp_bytes_discarded, - unsigned int* stat_tx_data_pdu, - unsigned int* stat_tx_data_bytes, - unsigned int* stat_tx_retransmit_pdu_by_status, - unsigned int* stat_tx_retransmit_bytes_by_status, - unsigned int* stat_tx_retransmit_pdu, - unsigned int* stat_tx_retransmit_bytes, - unsigned int* stat_tx_control_pdu, - unsigned int* stat_tx_control_bytes, - unsigned int* stat_rx_pdcp_sdu, - unsigned int* stat_rx_pdcp_bytes, - unsigned int* stat_rx_data_pdus_duplicate, - unsigned int* stat_rx_data_bytes_duplicate, - unsigned int* stat_rx_data_pdu, - unsigned int* stat_rx_data_bytes, - unsigned int* stat_rx_data_pdu_dropped, - unsigned int* stat_rx_data_bytes_dropped, - unsigned int* stat_rx_data_pdu_out_of_window, - unsigned int* stat_rx_data_bytes_out_of_window, - unsigned int* stat_rx_control_pdu, - unsigned int* stat_rx_control_bytes, - unsigned int* stat_timer_reordering_timed_out, - unsigned int* stat_timer_poll_retransmit_timed_out, - unsigned int* stat_timer_status_prohibit_timed_out) +void rlc_am_stat_req ( + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t * const rlc_pP, + unsigned int* stat_tx_pdcp_sdu, + unsigned int* stat_tx_pdcp_bytes, + unsigned int* stat_tx_pdcp_sdu_discarded, + unsigned int* stat_tx_pdcp_bytes_discarded, + unsigned int* stat_tx_data_pdu, + unsigned int* stat_tx_data_bytes, + unsigned int* stat_tx_retransmit_pdu_by_status, + unsigned int* stat_tx_retransmit_bytes_by_status, + unsigned int* stat_tx_retransmit_pdu, + unsigned int* stat_tx_retransmit_bytes, + unsigned int* stat_tx_control_pdu, + unsigned int* stat_tx_control_bytes, + unsigned int* stat_rx_pdcp_sdu, + unsigned int* stat_rx_pdcp_bytes, + unsigned int* stat_rx_data_pdus_duplicate, + unsigned int* stat_rx_data_bytes_duplicate, + unsigned int* stat_rx_data_pdu, + unsigned int* stat_rx_data_bytes, + unsigned int* stat_rx_data_pdu_dropped, + unsigned int* stat_rx_data_bytes_dropped, + unsigned int* stat_rx_data_pdu_out_of_window, + unsigned int* stat_rx_data_bytes_out_of_window, + unsigned int* stat_rx_control_pdu, + unsigned int* stat_rx_control_bytes, + unsigned int* stat_timer_reordering_timed_out, + unsigned int* stat_timer_poll_retransmit_timed_out, + unsigned int* stat_timer_status_prohibit_timed_out) //----------------------------------------------------------------------------- { *stat_tx_pdcp_sdu = rlc_pP->stat_tx_pdcp_sdu; @@ -306,7 +309,10 @@ void rlc_am_stat_req (rlc_am_entity_t *rlc_pP, } //----------------------------------------------------------------------------- void -rlc_am_get_pdus (rlc_am_entity_t *rlc_pP, frame_t frameP) +rlc_am_get_pdus ( + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t * const rlc_pP + ) { //----------------------------------------------------------------------------- int display_flag = 0; @@ -337,21 +343,21 @@ rlc_am_get_pdus (rlc_am_entity_t *rlc_pP, frame_t frameP) // When a STATUS PDU has been delivered to lower layer, the receiving side of an AM RLC entity shall: // - start t-StatusProhibit. if (rlc_pP->t_status_prohibit.running == 0) { - rlc_am_send_status_pdu(rlc_pP,frameP); + rlc_am_send_status_pdu(ctxt_pP, rlc_pP); mem_block_t* pdu = list_remove_head(&rlc_pP->control_pdu_list); if (pdu) { list_add_tail_eurecom (pdu, &rlc_pP->pdus_to_mac_layer); rlc_pP->status_requested = 0; - rlc_am_start_timer_status_prohibit(rlc_pP,frameP); + rlc_am_start_timer_status_prohibit(ctxt_pP, rlc_pP); return; } } else { LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u] DELAYED SENT STATUS PDU BECAUSE T-STATUS-PROHIBIT RUNNING (TIME-OUT FRAME %5u)\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_module_id) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, rlc_pP->t_status_prohibit.frame_time_out); } @@ -362,7 +368,7 @@ rlc_am_get_pdus (rlc_am_entity_t *rlc_pP, frame_t frameP) if ( ((rlc_am_tx_control_pdu_management_t*)(pdu->data))->size <= rlc_pP->nb_bytes_requested_by_mac) { pdu = list_remove_head(&rlc_pP->control_pdu_list); #ifdef TRACE_RLC_AM_TX - msg ("[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u] SEND CONTROL PDU\n", ((rlc_am_entity_t *) rlc_pP)->module_id,((rlc_am_entity_t *) rlc_pP)->rb_id, frameP); + msg ("[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u] SEND CONTROL PDU\n", ((rlc_am_entity_t *) rlc_pP)->module_id,((rlc_am_entity_t *) rlc_pP)->rb_id, ctxt_pP->frame); #endif list_add_tail_eurecom (pdu, &rlc_pP->pdus_to_mac_layer); rlc_pP->nb_bytes_requested_by_mac = rlc_pP->nb_bytes_requested_by_mac - ((rlc_am_tx_control_pdu_management_t*)(pdu->data))->size; @@ -384,12 +390,12 @@ rlc_am_get_pdus (rlc_am_entity_t *rlc_pP, frame_t frameP) tx_data_pdu_management = &rlc_pP->pdu_retrans_buffer[rlc_pP->first_retrans_pdu_sn]; if ((tx_data_pdu_management->header_and_payload_size <= rlc_pP->nb_bytes_requested_by_mac) && (tx_data_pdu_management->retx_count >= 0) && (tx_data_pdu_management->nack_so_start == 0) && (tx_data_pdu_management->nack_so_stop == 0x7FFF)) { - mem_block_t* copy = rlc_am_retransmit_get_copy(rlc_pP, frameP,rlc_pP->first_retrans_pdu_sn); + mem_block_t* copy = rlc_am_retransmit_get_copy(ctxt_pP, rlc_pP, rlc_pP->first_retrans_pdu_sn); LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u] RE-SEND DATA PDU SN %04d %d BYTES\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_module_id) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, rlc_pP->first_retrans_pdu_sn, tx_data_pdu_management->header_and_payload_size); @@ -407,10 +413,10 @@ rlc_am_get_pdus (rlc_am_entity_t *rlc_pP, frame_t frameP) return; } else if ((tx_data_pdu_management->retx_count >= 0) && (rlc_pP->nb_bytes_requested_by_mac >= RLC_AM_MIN_SEGMENT_SIZE_REQUEST)) { LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u] SEND SEGMENT OF DATA PDU SN %04d MAC BYTES %d SIZE %d RTX COUNT %d nack_so_start %d nack_so_stop %04X(hex)\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_module_id) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, rlc_pP->first_retrans_pdu_sn, rlc_pP->nb_bytes_requested_by_mac, @@ -420,15 +426,15 @@ rlc_am_get_pdus (rlc_am_entity_t *rlc_pP, frame_t frameP) tx_data_pdu_management->nack_so_stop); mem_block_t* copy = rlc_am_retransmit_get_subsegment( - rlc_pP, - frameP, - rlc_pP->first_retrans_pdu_sn, - &rlc_pP->nb_bytes_requested_by_mac); + ctxt_pP, + rlc_pP, + rlc_pP->first_retrans_pdu_sn, + &rlc_pP->nb_bytes_requested_by_mac); LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u] SEND SEGMENT OF DATA PDU SN %04d (NEW SO %05d)\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_module_id) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, rlc_pP->first_retrans_pdu_sn, tx_data_pdu_management->nack_so_start); @@ -448,10 +454,10 @@ rlc_am_get_pdus (rlc_am_entity_t *rlc_pP, frame_t frameP) (!(rlc_pP->pdu_retrans_buffer[rlc_pP->first_retrans_pdu_sn].flags.retransmit))) { rlc_pP->first_retrans_pdu_sn = (rlc_pP->first_retrans_pdu_sn+1) & RLC_AM_SN_MASK; LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u] UPDATED first_retrans_pdu_sn SN %04d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_module_id) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, rlc_pP->first_retrans_pdu_sn); }; @@ -462,18 +468,18 @@ rlc_am_get_pdus (rlc_am_entity_t *rlc_pP, frame_t frameP) rlc_pP->first_retrans_pdu_sn = -1; display_flag = 0; LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u] CLEAR first_retrans_pdu_sn\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_module_id) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id); } if (display_flag > 0) { LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u] UPDATED first_retrans_pdu_sn %04d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_module_id) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, rlc_pP->first_retrans_pdu_sn); } @@ -482,14 +488,14 @@ rlc_am_get_pdus (rlc_am_entity_t *rlc_pP, frame_t frameP) /* ONLY ONE TB PER TTI if ((tx_data_pdu_management->retx_count >= 0) && (rlc_pP->nb_bytes_requested_by_mac < RLC_AM_MIN_SEGMENT_SIZE_REQUEST)) { #ifdef TRACE_RLC_AM_TX - msg ("[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u] BREAK LOOP ON RETRANSMISSION BECAUSE ONLY %d BYTES ALLOWED TO TRANSMIT BY MAC\n",frameP, ((rlc_am_entity_t *) rlc_pP)->module_id,((rlc_am_entity_t *) rlc_pP)->rb_id, rlc_pP->nb_bytes_requested_by_mac); + msg ("[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u] BREAK LOOP ON RETRANSMISSION BECAUSE ONLY %d BYTES ALLOWED TO TRANSMIT BY MAC\n",ctxt_pP->frame, ((rlc_am_entity_t *) rlc_pP)->module_id,((rlc_am_entity_t *) rlc_pP)->rb_id, rlc_pP->nb_bytes_requested_by_mac); #endif break; }*/ } } if ((rlc_pP->nb_bytes_requested_by_mac > 2) && (rlc_pP->vt_s != rlc_pP->vt_ms)) { - rlc_am_segment_10(rlc_pP,frameP); + rlc_am_segment_10(ctxt_pP, rlc_pP); list_add_list (&rlc_pP->segmentation_pdu_list, &rlc_pP->pdus_to_mac_layer); if (rlc_pP->pdus_to_mac_layer.head != NULL) { rlc_pP->stat_tx_data_pdu += 1; @@ -497,20 +503,22 @@ rlc_am_get_pdus (rlc_am_entity_t *rlc_pP, frame_t frameP) return; } } - if ((rlc_pP->pdus_to_mac_layer.head == NULL) && (rlc_am_is_timer_poll_retransmit_timed_out(rlc_pP)) && (rlc_pP->nb_bytes_requested_by_mac > 2)) { - rlc_am_retransmit_any_pdu(rlc_pP,frameP); + if ((rlc_pP->pdus_to_mac_layer.head == NULL) && + (rlc_am_is_timer_poll_retransmit_timed_out(ctxt_pP, rlc_pP)) && + (rlc_pP->nb_bytes_requested_by_mac > 2)) { + rlc_am_retransmit_any_pdu(ctxt_pP, rlc_pP); return; } else { LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u] COULD NOT RETRANSMIT ANY PDU BECAUSE ", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_module_id) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id); if (rlc_pP->pdus_to_mac_layer.head != NULL) { LOG_D(RLC, "THERE ARE SOME PDUS READY TO TRANSMIT "); } - if (!(rlc_am_is_timer_poll_retransmit_timed_out(rlc_pP))) { + if (!(rlc_am_is_timer_poll_retransmit_timed_out(ctxt_pP, rlc_pP))) { LOG_D(RLC, "TIMER POLL DID NOT TIMED OUT (RUNNING = %d NUM PDUS TO RETRANS = %d NUM BYTES TO RETRANS = %d) ", rlc_pP->t_poll_retransmit.running, rlc_pP->retrans_num_pdus, rlc_pP->retrans_num_bytes_to_retransmit); } if (rlc_pP->nb_bytes_requested_by_mac <= 2) { @@ -522,17 +530,21 @@ rlc_am_get_pdus (rlc_am_entity_t *rlc_pP, frame_t frameP) default: LOG_E(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u] MAC_DATA_REQ UNKNOWN PROTOCOL STATE 0x%02X\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_module_id) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, rlc_pP->protocol_state); } } //----------------------------------------------------------------------------- void -rlc_am_rx (void *arg_pP, frame_t frameP, eNB_flag_t eNB_flagP, struct mac_data_ind data_indP) +rlc_am_rx ( + const protocol_ctxt_t* const ctxt_pP, + void * const arg_pP, + struct mac_data_ind data_indP + ) { //----------------------------------------------------------------------------- @@ -546,7 +558,7 @@ rlc_am_rx (void *arg_pP, frame_t frameP, eNB_flag_t eNB_flagP, struct mac_data_i break; case RLC_DATA_TRANSFER_READY_STATE: - rlc_am_receive_routing (rlc, frameP, eNB_flagP, data_indP); + rlc_am_receive_routing (ctxt_pP, rlc, data_indP); break; default: @@ -556,7 +568,11 @@ rlc_am_rx (void *arg_pP, frame_t frameP, eNB_flag_t eNB_flagP, struct mac_data_i //----------------------------------------------------------------------------- struct mac_status_resp -rlc_am_mac_status_indication (void *rlc_pP, frame_t frameP, uint16_t tb_sizeP, struct mac_status_ind tx_statusP) +rlc_am_mac_status_indication ( + const protocol_ctxt_t* const ctxt_pP, + void * const rlc_pP, + const uint16_t tb_sizeP, + struct mac_status_ind tx_statusP) { //----------------------------------------------------------------------------- struct mac_status_resp status_resp; @@ -572,31 +588,31 @@ rlc_am_mac_status_indication (void *rlc_pP, frame_t frameP, uint16_t tb_sizeP, s status_resp.head_sdu_is_segmented = 0; status_resp.rlc_info.rlc_protocol_state = rlc->protocol_state; - if (rlc->last_frame_status_indication != frameP) { - rlc_am_check_timer_poll_retransmit(rlc,frameP); - rlc_am_check_timer_reordering(rlc,frameP); - rlc_am_check_timer_status_prohibit(rlc,frameP); + if (rlc->last_frame_status_indication != ctxt_pP->frame) { + rlc_am_check_timer_poll_retransmit(ctxt_pP, rlc); + rlc_am_check_timer_reordering(ctxt_pP, rlc); + rlc_am_check_timer_status_prohibit(ctxt_pP, rlc); } - rlc->last_frame_status_indication = frameP; + rlc->last_frame_status_indication = ctxt_pP->frame; rlc->nb_bytes_requested_by_mac = tb_sizeP; - status_resp.buffer_occupancy_in_bytes = rlc_am_get_buffer_occupancy_in_bytes(rlc,frameP); + status_resp.buffer_occupancy_in_bytes = rlc_am_get_buffer_occupancy_in_bytes(ctxt_pP, rlc); if ((rlc->input_sdus[rlc->current_sdu_index].mem_block != NULL) && (status_resp.buffer_occupancy_in_bytes)) { //status_resp.buffer_occupancy_in_bytes += ((rlc_am_entity_t *) rlc)->tx_header_min_length_in_bytes; status_resp.buffer_occupancy_in_pdus = rlc->nb_sdu; - diff_time = frameP - ((rlc_am_tx_sdu_management_t *) (rlc->input_sdus[rlc->current_sdu_index].mem_block->data))->sdu_creation_time; + diff_time = ctxt_pP->frame - ((rlc_am_tx_sdu_management_t *) (rlc->input_sdus[rlc->current_sdu_index].mem_block->data))->sdu_creation_time; - status_resp.head_sdu_creation_time = (diff_time > 0 ) ? (uint32_t) diff_time : (uint32_t)(0xffffffff - diff_time + frameP) ; + status_resp.head_sdu_creation_time = (diff_time > 0 ) ? (uint32_t) diff_time : (uint32_t)(0xffffffff - diff_time + ctxt_pP->frame) ; sdu_size = ((rlc_am_tx_sdu_management_t *) (rlc->input_sdus[rlc->current_sdu_index].mem_block->data))->sdu_size; sdu_remaining_size = ((rlc_am_tx_sdu_management_t *) (rlc->input_sdus[rlc->current_sdu_index].mem_block->data))->sdu_remaining_size; status_resp.head_sdu_remaining_size_to_send = sdu_remaining_size; if (sdu_size == sdu_remaining_size) { - status_resp.head_sdu_is_segmented = 0; + status_resp.head_sdu_is_segmented = 0; } else { status_resp.head_sdu_is_segmented = 1; @@ -609,7 +625,7 @@ rlc_am_mac_status_indication (void *rlc_pP, frame_t frameP, uint16_t tb_sizeP, s #ifdef TRACE_RLC_AM_TX_STATUS if (tb_sizeP > 0) { LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u] MAC_STATUS_INDICATION (DATA) %d bytes -> %d bytes\n", - frameP, + ctxt_pP->frame, (rlc->is_enb) ? "eNB" : "UE", rlc->enb_module_id, rlc->ue_module_id, @@ -618,11 +634,11 @@ rlc_am_mac_status_indication (void *rlc_pP, frame_t frameP, uint16_t tb_sizeP, s status_resp.buffer_occupancy_in_bytes); /*if ((tx_statusP.tx_status == MAC_TX_STATUS_SUCCESSFUL) && (tx_statusP.no_pdu)) { msg ("[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u] MAC_STATUS_INDICATION TX STATUS SUCCESSFUL %d PDUs\n",rlc->module_id, -rlc->rb_id, frameP, tx_statusP.no_pdu); +rlc->rb_id, ctxt_pP->frame, tx_statusP.no_pdu); } if ((tx_statusP.tx_status == MAC_TX_STATUS_UNSUCCESSFUL) && (tx_statusP.no_pdu)) { msg ("[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u] MAC_STATUS_INDICATION TX STATUS UNSUCCESSFUL %d PDUs\n",rlc->module_id, rlc->rb_id, -frameP, tx_statusP.no_pdu); +ctxt_pP->frame, tx_statusP.no_pdu); }*/ } #endif @@ -630,7 +646,10 @@ frameP, tx_statusP.no_pdu); } //----------------------------------------------------------------------------- struct mac_data_req -rlc_am_mac_data_request (void *rlc_pP, frame_t frameP) +rlc_am_mac_data_request ( + const protocol_ctxt_t* const ctxt_pP, + void * const rlc_pP + ) { //----------------------------------------------------------------------------- struct mac_data_req data_req; @@ -650,22 +669,22 @@ rlc_am_mac_data_request (void *rlc_pP, frame_t frameP) int octet_index, index; #endif - rlc_am_get_pdus (rlc_pP,frameP); + rlc_am_get_pdus (ctxt_pP, rlc_pP); list_init (&data_req.data, NULL); list_add_list (&l_rlc_p->pdus_to_mac_layer, &data_req.data); //((rlc_am_entity_t *) rlc_pP)->tx_pdus += data_req.data.nb_elements; if ((nb_bytes_requested_by_mac + data_req.data.nb_elements) > 0) { LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u] MAC_DATA_REQUEST %05d BYTES REQUESTED -> %d TBs\n", - frameP, - (l_rlc_p->is_enb) ? "eNB" : "UE", - l_rlc_p->enb_module_id, - l_rlc_p->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, l_rlc_p->rb_id, nb_bytes_requested_by_mac, data_req.data.nb_elements); } - data_req.buffer_occupancy_in_bytes = rlc_am_get_buffer_occupancy_in_bytes(l_rlc_p,frameP); + data_req.buffer_occupancy_in_bytes = rlc_am_get_buffer_occupancy_in_bytes(ctxt_pP, l_rlc_p); data_req.rlc_info.rlc_protocol_state = l_rlc_p->protocol_state; #ifdef TRACE_RLC_AM_PDU @@ -679,7 +698,7 @@ rlc_am_mac_data_request (void *rlc_pP, frame_t frameP) tb_size_in_bytes = ((struct mac_tb_req *) (tb_p->data))->tb_size; if ((((struct mac_tb_req *) (tb_p->data))->data_ptr[0] & RLC_DC_MASK) == RLC_DC_DATA_PDU ) { - if (rlc_am_get_data_pdu_infos(frameP,rlc_am_pdu_sn_10_p, tb_size_in_bytes, &pdu_info) >= 0) { + if (rlc_am_get_data_pdu_infos(ctxt_pP,rlc_am_pdu_sn_10_p, tb_size_in_bytes, &pdu_info) >= 0) { # if defined(ENABLE_ITTI) message_string_size += sprintf(&message_string[message_string_size], "Bearer : %u\n", l_rlc_p->rb_id); message_string_size += sprintf(&message_string[message_string_size], "PDU size : %u\n", tb_size_in_bytes); @@ -734,17 +753,17 @@ rlc_am_mac_data_request (void *rlc_pP, frame_t frameP) } message_string_size += sprintf(&message_string[message_string_size], " |\n"); - msg_p = itti_alloc_new_message_sized (l_rlc_p->is_enb > 0 ? TASK_RLC_ENB:TASK_RLC_UE , RLC_AM_DATA_PDU_REQ, message_string_size + sizeof (IttiMsgText)); + msg_p = itti_alloc_new_message_sized (ctxt_pP->enb_flag > 0 ? TASK_RLC_ENB:TASK_RLC_UE , RLC_AM_DATA_PDU_REQ, message_string_size + sizeof (IttiMsgText)); msg_p->ittiMsg.rlc_am_data_pdu_req.size = message_string_size; memcpy(&msg_p->ittiMsg.rlc_am_data_pdu_req.text, message_string, message_string_size); - if (l_rlc_p->is_enb) { - itti_send_msg_to_task(TASK_UNKNOWN, l_rlc_p->enb_module_id, msg_p); + if (ctxt_pP->enb_flag) { + itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->enb_module_id, msg_p); } else { - itti_send_msg_to_task(TASK_UNKNOWN, l_rlc_p->ue_module_id + NB_eNB_INST, msg_p); + itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->ue_module_id + NB_eNB_INST, msg_p); } # else - rlc_am_display_data_pdu_infos(l_rlc_p, frameP, &pdu_info); + rlc_am_display_data_pdu_infos(ctxt_pP, l_rlc_p, &pdu_info); # endif } } else { @@ -770,14 +789,14 @@ rlc_am_mac_data_request (void *rlc_pP, frame_t frameP) message_string_size += sprintf(&message_string[message_string_size], " NACK SN %04d", g_rlc_am_control_pdu_info.nack_list[num_nack].nack_sn); } } - msg_p = itti_alloc_new_message_sized (l_rlc_p->is_enb > 0 ? TASK_RLC_ENB:TASK_RLC_UE , RLC_AM_STATUS_PDU_REQ, message_string_size + sizeof (IttiMsgText)); + msg_p = itti_alloc_new_message_sized (ctxt_pP->enb_flag > 0 ? TASK_RLC_ENB:TASK_RLC_UE , RLC_AM_STATUS_PDU_REQ, message_string_size + sizeof (IttiMsgText)); msg_p->ittiMsg.rlc_am_status_pdu_req.size = message_string_size; memcpy(&msg_p->ittiMsg.rlc_am_status_pdu_req.text, message_string, message_string_size); - if (l_rlc_p->is_enb) { - itti_send_msg_to_task(TASK_UNKNOWN, l_rlc_p->enb_module_id, msg_p); + if (ctxt_pP->enb_flag) { + itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->enb_module_id, msg_p); } else { - itti_send_msg_to_task(TASK_UNKNOWN, l_rlc_p->ue_module_id + NB_eNB_INST, msg_p); + itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->ue_module_id + NB_eNB_INST, msg_p); } # endif } @@ -790,7 +809,11 @@ rlc_am_mac_data_request (void *rlc_pP, frame_t frameP) } //----------------------------------------------------------------------------- void -rlc_am_mac_data_indication (void *rlc_pP, frame_t frameP, eNB_flag_t eNB_flagP, struct mac_data_ind data_indP) +rlc_am_mac_data_indication ( + const protocol_ctxt_t* const ctxt_pP, + void * const rlc_pP, + struct mac_data_ind data_indP + ) { //----------------------------------------------------------------------------- rlc_am_entity_t *l_rlc_p = (rlc_am_entity_t *) rlc_pP; @@ -822,7 +845,7 @@ rlc_am_mac_data_indication (void *rlc_pP, frame_t frameP, eNB_flag_t eNB_flagP, tb_size_in_bytes = ((struct mac_tb_ind *) (tb_p->data))->size; if ((((struct mac_tb_ind *) (tb_p->data))->data_ptr[0] & RLC_DC_MASK) == RLC_DC_DATA_PDU ) { - if (rlc_am_get_data_pdu_infos(frameP,rlc_am_pdu_sn_10_p, tb_size_in_bytes, &pdu_info) >= 0) { + if (rlc_am_get_data_pdu_infos(ctxt_pP,rlc_am_pdu_sn_10_p, tb_size_in_bytes, &pdu_info) >= 0) { # if defined(ENABLE_ITTI) message_string_size += sprintf(&message_string[message_string_size], "Bearer : %u\n", l_rlc_p->rb_id); message_string_size += sprintf(&message_string[message_string_size], "PDU size : %u\n", tb_size_in_bytes); @@ -877,17 +900,17 @@ rlc_am_mac_data_indication (void *rlc_pP, frame_t frameP, eNB_flag_t eNB_flagP, } message_string_size += sprintf(&message_string[message_string_size], " |\n"); - msg_p = itti_alloc_new_message_sized (l_rlc_p->is_enb > 0 ? TASK_RLC_ENB:TASK_RLC_UE , RLC_AM_DATA_PDU_IND, message_string_size + sizeof (IttiMsgText)); + msg_p = itti_alloc_new_message_sized (ctxt_pP->enb_flag > 0 ? TASK_RLC_ENB:TASK_RLC_UE , RLC_AM_DATA_PDU_IND, message_string_size + sizeof (IttiMsgText)); msg_p->ittiMsg.rlc_am_data_pdu_ind.size = message_string_size; memcpy(&msg_p->ittiMsg.rlc_am_data_pdu_ind.text, message_string, message_string_size); - if (l_rlc_p->is_enb) { - itti_send_msg_to_task(TASK_UNKNOWN, l_rlc_p->enb_module_id, msg_p); + if (ctxt_pP->enb_flag) { + itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->enb_module_id, msg_p); } else { - itti_send_msg_to_task(TASK_UNKNOWN, l_rlc_p->ue_module_id + NB_eNB_INST, msg_p); + itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->ue_module_id + NB_eNB_INST, msg_p); } # else - rlc_am_display_data_pdu_infos(l_rlc_p, frameP, &pdu_info); + rlc_am_display_data_pdu_infos(ctxt_pP, l_rlc_p, &pdu_info); # endif } } else { @@ -912,14 +935,14 @@ rlc_am_mac_data_indication (void *rlc_pP, frame_t frameP, eNB_flag_t eNB_flagP, message_string_size += sprintf(&message_string[message_string_size], " NACK SN %04d", g_rlc_am_control_pdu_info.nack_list[num_nack].nack_sn); } } - msg_p = itti_alloc_new_message_sized (l_rlc_p->is_enb > 0 ? TASK_RLC_ENB:TASK_RLC_UE , RLC_AM_STATUS_PDU_IND, message_string_size + sizeof (IttiMsgText)); + msg_p = itti_alloc_new_message_sized (ctxt_pP->enb_flag > 0 ? TASK_RLC_ENB:TASK_RLC_UE , RLC_AM_STATUS_PDU_IND, message_string_size + sizeof (IttiMsgText)); msg_p->ittiMsg.rlc_am_status_pdu_ind.size = message_string_size; memcpy(&msg_p->ittiMsg.rlc_am_status_pdu_ind.text, message_string, message_string_size); - if (l_rlc_p->is_enb) { - itti_send_msg_to_task(TASK_UNKNOWN, l_rlc_p->enb_module_id, msg_p); + if (ctxt_pP->enb_flag) { + itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->enb_module_id, msg_p); } else { - itti_send_msg_to_task(TASK_UNKNOWN, l_rlc_p->ue_module_id + NB_eNB_INST, msg_p); + itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->ue_module_id + NB_eNB_INST, msg_p); } # endif } @@ -928,12 +951,15 @@ rlc_am_mac_data_indication (void *rlc_pP, frame_t frameP, eNB_flag_t eNB_flagP, } } #endif - rlc_am_rx (rlc_pP, frameP, eNB_flagP, data_indP); + rlc_am_rx (ctxt_pP, rlc_pP, data_indP); } //----------------------------------------------------------------------------- void -rlc_am_data_req (void *rlc_pP, frame_t frameP, mem_block_t * sdu_pP) +rlc_am_data_req ( + const protocol_ctxt_t* const ctxt_pP, + void * const rlc_pP, + mem_block_t * const sdu_pP) { //----------------------------------------------------------------------------- rlc_am_entity_t *l_rlc_p = (rlc_am_entity_t *) rlc_pP; @@ -998,14 +1024,14 @@ rlc_am_data_req (void *rlc_pP, frame_t frameP, mem_block_t * sdu_pP) message_string_size += sprintf(&message_string[message_string_size], " |\n"); # if defined(ENABLE_ITTI) - msg_p = itti_alloc_new_message_sized (l_rlc_p->is_enb > 0 ? TASK_RLC_ENB:TASK_RLC_UE , RLC_AM_SDU_REQ, message_string_size + sizeof (IttiMsgText)); + msg_p = itti_alloc_new_message_sized (ctxt_pP->enb_flag > 0 ? TASK_RLC_ENB:TASK_RLC_UE , RLC_AM_SDU_REQ, message_string_size + sizeof (IttiMsgText)); msg_p->ittiMsg.rlc_am_sdu_req.size = message_string_size; memcpy(&msg_p->ittiMsg.rlc_am_sdu_req.text, message_string, message_string_size); - if (l_rlc_p->is_enb) { - itti_send_msg_to_task(TASK_UNKNOWN, l_rlc_p->enb_module_id, msg_p); + if (ctxt_pP->enb_flag) { + itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->enb_module_id, msg_p); } else { - itti_send_msg_to_task(TASK_UNKNOWN, l_rlc_p->ue_module_id + NB_eNB_INST, msg_p); + itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->ue_module_id + NB_eNB_INST, msg_p); } # else LOG_T(RLC, "%s", message_string); @@ -1026,7 +1052,7 @@ rlc_am_data_req (void *rlc_pP, frame_t frameP, mem_block_t * sdu_pP) l_rlc_p->input_sdus[l_rlc_p->next_sdu_index].first_byte = (uint8_t*)(&sdu_pP->data[data_offset]); l_rlc_p->input_sdus[l_rlc_p->next_sdu_index].sdu_remaining_size = l_rlc_p->input_sdus[l_rlc_p->next_sdu_index].sdu_size; l_rlc_p->input_sdus[l_rlc_p->next_sdu_index].sdu_segmented_size = 0; - l_rlc_p->input_sdus[l_rlc_p->next_sdu_index].sdu_creation_time = frameP; + l_rlc_p->input_sdus[l_rlc_p->next_sdu_index].sdu_creation_time = ctxt_pP->frame; l_rlc_p->input_sdus[l_rlc_p->next_sdu_index].nb_pdus = 0; l_rlc_p->input_sdus[l_rlc_p->next_sdu_index].nb_pdus_ack = 0; //l_rlc_p->input_sdus[l_rlc_p->next_sdu_index].nb_pdus_time = 0; @@ -1038,10 +1064,10 @@ rlc_am_data_req (void *rlc_pP, frame_t frameP, mem_block_t * sdu_pP) //l_rlc_p->input_sdus[l_rlc_p->next_sdu_index].li_index_for_discard = -1; l_rlc_p->next_sdu_index = (l_rlc_p->next_sdu_index + 1) % RLC_AM_SDU_CONTROL_BUFFER_SIZE; LOG_I(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u] RLC_AM_DATA_REQ size %d Bytes, NB SDU %d current_sdu_index=%d next_sdu_index=%d conf %d mui %d\n", - frameP, - (l_rlc_p->is_enb) ? "eNB" : "UE", - l_rlc_p->enb_module_id, - l_rlc_p->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, l_rlc_p->rb_id, data_size, l_rlc_p->nb_sdu, @@ -1051,10 +1077,10 @@ rlc_am_data_req (void *rlc_pP, frame_t frameP, mem_block_t * sdu_pP) mui); } else { LOG_W(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u] RLC_AM_DATA_REQ BUFFER FULL, NB SDU %d current_sdu_index=%d next_sdu_index=%d size_input_sdus_buffer=%d\n", - frameP, - (l_rlc_p->is_enb) ? "eNB" : "UE", - l_rlc_p->enb_module_id, - l_rlc_p->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, l_rlc_p->rb_id, l_rlc_p->nb_sdu, l_rlc_p->current_sdu_index, @@ -1066,10 +1092,10 @@ rlc_am_data_req (void *rlc_pP, frame_t frameP, mem_block_t * sdu_pP) free_mem_block (sdu_pP); #if defined(STOP_ON_IP_TRAFFIC_OVERLOAD) AssertFatal(0, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u] RLC_AM_DATA_REQ size %d Bytes, SDU DROPPED, INPUT BUFFER OVERFLOW NB SDU %d current_sdu_index=%d next_sdu_index=%d \n", - frameP, - (l_rlc_p->is_enb) ? "eNB" : "UE", - l_rlc_p->enb_module_id, - l_rlc_p->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, l_rlc_p->rb_id, data_size, l_rlc_p->nb_sdu, diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.h b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.h index 4e9fe2650bd19fbbf48234d6f4a958851b90fc77..eb141fe59af6e50868e0f5cf6e1ebc3c74d15202 100755 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.h +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.h @@ -86,57 +86,50 @@ -/*! \fn void rlc_am_release (rlc_am_entity_t *rlcP) +/*! \fn void rlc_am_release (const protocol_ctxt_t* const ctxtP, rlc_am_entity_t * const rlc_pP) * \brief Empty function, TO DO. -* \param[in] rlcP RLC AM protocol instance pointer. +* \param[in] ctxt_pP Running context. +* \param[in] rlc_pP RLC AM protocol instance pointer. */ -public_rlc_am(void rlc_am_release (rlc_am_entity_t * const rlcP);) +public_rlc_am(void rlc_am_release ( + const protocol_ctxt_t* const ctxtP, + rlc_am_entity_t * const rlc_pP);) /** @addtogroup _rlc_am_init_impl_ * @{ */ -/*! \fn void config_req_rlc_am (const frame_t frame, const eNB_flag_t eNB_flagP, const srb_flag_t srb_flagP, const module_id_t enb_module_idP, const module_id_t ue_module_idP, rlc_am_info_t * config_amP, rb_id_t rb_idP) +/*! \fn void config_req_rlc_am (const protocol_ctxt_t* const ctxtP, const srb_flag_t srb_flagP, rlc_am_info_t * config_amP, rb_id_t rb_idP) * \brief Configure the UL and DL parameters of the RLC AM -* \param[in] frame Frame index. -* \param[in] eNB_flag Flag to indicate eNB (1) or UE (0) +* \param[in] ctxt_pP Running context. * \param[in] srb_flagP Flag to indicate signalling radio bearer (1) or data radio bearer (0). -* \param[in] enb_module_idP eNB Virtualized module identifier. -* \param[in] ue_module_idP UE Virtualized module identifier. * \param[in] config_amP Configuration parameters for RLC AM instance. * \param[in] rb_idP Radio bearer identifier. */ public_rlc_am(void config_req_rlc_am ( - const frame_t frame, - const eNB_flag_t eNB_flagP, - const srb_flag_t srb_flagP, - const module_id_t enb_module_idP, - const module_id_t ue_module_idP, - const rlc_am_info_t * const config_amP, - const rb_id_t rb_idP);) + const protocol_ctxt_t* const ctxtP, + const srb_flag_t srb_flagP, + const rlc_am_info_t * const config_amP, + const rb_id_t rb_idP);) -/*! \fn void config_req_rlc_am_asn1 (const frame_t frame, const eNB_flag_t eNB_flagP, const srb_flag_t srb_flagP, const module_id_t enb_module_idP, const module_id_t ue_module_idP, struct RLC_Config__am * config_amP, rb_id_t rb_idP) +/*! \fn void config_req_rlc_am_asn1 (const protocol_ctxt_t* const ctxtP, const srb_flag_t srb_flagP, struct RLC_Config__am * config_amP, rb_id_t rb_idP) * \brief Configure the UL and DL parameters of the RLC AM with the asn1c autogenerated pameters structs -* \param[in] frame Frame index. -* \param[in] eNB_flag Flag to indicate eNB (1) or UE (0) +* \param[in] ctxt_pP Running context. * \param[in] srb_flagP Flag to indicate signalling radio bearer (1) or data radio bearer (0). -* \param[in] enb_module_idP eNB Virtualized module identifier. -* \param[in] ue_module_idP UE Virtualized module identifier. * \param[in] config_amP Configuration parameters for RLC AM instance. * \param[in] rb_idP Radio bearer identifier. */ public_rlc_am(void config_req_rlc_am_asn1 ( - const const frame_t frame, - const eNB_flag_t eNB_flagP, - const srb_flag_t srb_flagP, - const module_id_t enb_module_idP, - const module_id_t ue_module_idP, - const struct RLC_Config__am * const config_amP, - const rb_id_t rb_idP);) + const protocol_ctxt_t* const ctxtP, + const srb_flag_t srb_flagP, + const struct RLC_Config__am * const config_amP, + const rb_id_t rb_idP);) /** @} */ -/*! \fn void rlc_am_stat_req (rlc_am_entity_t *rlcP, +/*! \fn void rlc_am_stat_req ( + const protocol_ctxt_t* const ctxtP, + rlc_am_entity_t * const rlc_pP, unsigned int* stat_tx_pdcp_sdu, unsigned int* stat_tx_pdcp_bytes, unsigned int* stat_tx_pdcp_sdu_discarded, @@ -165,7 +158,8 @@ public_rlc_am(void config_req_rlc_am_asn1 ( unsigned int* stat_timer_poll_retransmit_timed_out, unsigned int* stat_timer_status_prohibit_timed_out) * \brief Request TX and RX statistics of a RLC AM protocol instance. -* \param[in] rlcP RLC AM protocol instance pointer. +* \param[in] ctxt_pP Running context. +* \param[in] rlc_pP RLC AM protocol instance pointer. * \param[out] stat_tx_pdcp_sdu Number of SDUs coming from upper layers. * \param[out] stat_tx_pdcp_bytes Number of bytes coming from upper layers. * \param[out] stat_tx_pdcp_sdu_discarded Number of discarded SDUs coming from upper layers. @@ -194,83 +188,84 @@ public_rlc_am(void config_req_rlc_am_asn1 ( * \param[out] stat_timer_poll_retransmit_timed_out Number of times the timer "poll_retransmit" has timed-out. * \param[out] stat_timer_status_prohibit_timed_out Number of times the timer "status_prohibit" has timed-out. */ -public_rlc_am(void rlc_am_stat_req (rlc_am_entity_t *rlcP, - unsigned int* stat_tx_pdcp_sdu, - unsigned int* stat_tx_pdcp_bytes, - unsigned int* stat_tx_pdcp_sdu_discarded, - unsigned int* stat_tx_pdcp_bytes_discarded, - unsigned int* stat_tx_data_pdu, - unsigned int* stat_tx_data_bytes, - unsigned int* stat_tx_retransmit_pdu_by_status, - unsigned int* stat_tx_retransmit_bytes_by_status, - unsigned int* stat_tx_retransmit_pdu, - unsigned int* stat_tx_retransmit_bytes, - unsigned int* stat_tx_control_pdu, - unsigned int* stat_tx_control_bytes, - unsigned int* stat_rx_pdcp_sdu, - unsigned int* stat_rx_pdcp_bytes, - unsigned int* stat_rx_data_pdus_duplicate, - unsigned int* stat_rx_data_bytes_duplicate, - unsigned int* stat_rx_data_pdu, - unsigned int* stat_rx_data_bytes, - unsigned int* stat_rx_data_pdu_dropped, - unsigned int* stat_rx_data_bytes_dropped, - unsigned int* stat_rx_data_pdu_out_of_window, - unsigned int* stat_rx_data_bytes_out_of_window, - unsigned int* stat_rx_control_pdu, - unsigned int* stat_rx_control_bytes, - unsigned int* stat_timer_reordering_timed_out, - unsigned int* stat_timer_poll_retransmit_timed_out, - unsigned int* stat_timer_status_prohibit_timed_out);) +public_rlc_am(void rlc_am_stat_req ( + const protocol_ctxt_t* const ctxtP, + rlc_am_entity_t * const rlc_pP, + unsigned int* stat_tx_pdcp_sdu, + unsigned int* stat_tx_pdcp_bytes, + unsigned int* stat_tx_pdcp_sdu_discarded, + unsigned int* stat_tx_pdcp_bytes_discarded, + unsigned int* stat_tx_data_pdu, + unsigned int* stat_tx_data_bytes, + unsigned int* stat_tx_retransmit_pdu_by_status, + unsigned int* stat_tx_retransmit_bytes_by_status, + unsigned int* stat_tx_retransmit_pdu, + unsigned int* stat_tx_retransmit_bytes, + unsigned int* stat_tx_control_pdu, + unsigned int* stat_tx_control_bytes, + unsigned int* stat_rx_pdcp_sdu, + unsigned int* stat_rx_pdcp_bytes, + unsigned int* stat_rx_data_pdus_duplicate, + unsigned int* stat_rx_data_bytes_duplicate, + unsigned int* stat_rx_data_pdu, + unsigned int* stat_rx_data_bytes, + unsigned int* stat_rx_data_pdu_dropped, + unsigned int* stat_rx_data_bytes_dropped, + unsigned int* stat_rx_data_pdu_out_of_window, + unsigned int* stat_rx_data_bytes_out_of_window, + unsigned int* stat_rx_control_pdu, + unsigned int* stat_rx_control_bytes, + unsigned int* stat_timer_reordering_timed_out, + unsigned int* stat_timer_poll_retransmit_timed_out, + unsigned int* stat_timer_status_prohibit_timed_out);) -/*! \fn void rlc_am_get_pdus (void *rlcP) +/*! \fn void rlc_am_get_pdus (const protocol_ctxt_t* const ctxtP, void * const rlc_pP) * \brief Request the segmentation of SDUs based on status previously sent by MAC. -* \param[in] rlcP RLC AM protocol instance pointer. +* \param[in] ctxt_pP Running context. +* \param[in] rlc_pP RLC AM protocol instance pointer. */ -private_rlc_am( void rlc_am_get_pdus (void *argP);) +private_rlc_am( void rlc_am_get_pdus (const protocol_ctxt_t* const ctxtP,void * const rlc_pP);) -/*! \fn void rlc_am_rx (void *rlcP, uint32_t frame, const eNB_flag_t eNB_flag, struct mac_data_ind data_indication) +/*! \fn void rlc_am_rx (const protocol_ctxt_t* const ctxtP,void * const rlc_pP, struct mac_data_ind data_indication) * \brief Process the received PDUs from lower layer. -* \param[in] rlcP RLC AM protocol instance pointer. -* \param[in] frame Frame index. -* \param[in] eNB_flag Flag to indicate eNB (1) or UE (0). +* \param[in] ctxt_pP Running context. +* \param[in] rlc_pP RLC AM protocol instance pointer. * \param[in] data_indication PDUs from MAC. */ -protected_rlc_am( void rlc_am_rx (void *, const frame_t frame, struct mac_data_ind);) +protected_rlc_am( void rlc_am_rx (const protocol_ctxt_t* const ctxtP,void * const rlc_pP, struct mac_data_ind);) -/*! \fn struct mac_status_resp rlc_am_mac_status_indication (void *rlcP, uint32_t frame,uint16_t tbs_sizeP, struct mac_status_ind tx_statusP) +/*! \fn struct mac_status_resp rlc_am_mac_status_indication (const protocol_ctxt_t* const ctxtP,void * const rlc_pP, uint16_t tbs_sizeP, struct mac_status_ind tx_statusP) * \brief Request the maximum number of bytes that can be served by RLC instance to MAC and fix the amount of bytes requested by MAC for next RLC transmission. -* \param[in] rlcP RLC AM protocol instance pointer. -* \param[in] frame Frame index. +* \param[in] ctxt_pP Running context. +* \param[in] rlc_pP RLC AM protocol instance pointer. * \param[in] tbs_sizeP Number of bytes requested by MAC for next transmission. * \param[in] tx_statusP Transmission status given by MAC on previous MAC transmission of the PDU. * \return The maximum number of bytes that can be served by RLC instance to MAC. */ -public_rlc_am( struct mac_status_resp rlc_am_mac_status_indication (void *rlcP, const frame_t frame, uint16_t tbs_sizeP, struct mac_status_ind tx_statusP);) +public_rlc_am( struct mac_status_resp rlc_am_mac_status_indication (const protocol_ctxt_t* const ctxtP, void * const rlc_pP, uint16_t tbs_sizeP, struct mac_status_ind tx_statusP);) -/*! \fn struct mac_data_req rlc_am_mac_data_request (void *rlcP, uint32_t frame) +/*! \fn struct mac_data_req rlc_am_mac_data_request (const protocol_ctxt_t* const ctxtP,void * const rlc_pP) * \brief Gives PDUs to lower layer MAC. -* \param[in] rlcP RLC AM protocol instance pointer. -* \param[in] frame Frame index. +* \param[in] ctxt_pP Running context. +* \param[in] rlc_pP RLC AM protocol instance pointer. * \return A PDU of the previously requested number of bytes, and the updated maximum number of bytes that can be served by RLC instance to MAC for next RLC transmission. */ -public_rlc_am( struct mac_data_req rlc_am_mac_data_request (void *rlcP, const frame_t frame);) +public_rlc_am( struct mac_data_req rlc_am_mac_data_request (const protocol_ctxt_t* const ctxtP,void * const rlc_pP);) -/*! \fn void rlc_am_mac_data_indication (void *rlcP, uint32_t frame, const eNB_flag_t eNB_flag, struct mac_data_ind data_indP) +/*! \fn void rlc_am_mac_data_indication (const protocol_ctxt_t* const ctxtP,void * const rlc_pP, struct mac_data_ind data_indP) * \brief Receive PDUs from lower layer MAC. -* \param[in] rlcP RLC UM protocol instance pointer. -* \param[in] frame Frame index. -* \param[in] eNB_flag Flag to indicate eNB (1) or UE (0). +* \param[in] ctxt_pP Running context. +* \param[in] rlc_pP RLC AM protocol instance pointer. * \param[in] data_indP PDUs from MAC. */ -public_rlc_am( void rlc_am_mac_data_indication (void *rlcP, const frame_t frame, const eNB_flag_t eNB_flag, struct mac_data_ind data_indP);) +public_rlc_am( void rlc_am_mac_data_indication (const protocol_ctxt_t* const ctxtP,void * const rlc_pP, struct mac_data_ind data_indP);) -/*! \fn void rlc_am_data_req (void *rlcP, uint32_t frame, mem_block_t *sduP) +/*! \fn void rlc_am_data_req (const protocol_ctxt_t* const ctxtP,void * const rlc_pP, mem_block_t *sduP) * \brief Interface with higher layers, buffer higher layer SDUS for transmission. -* \param[in] rlcP RLC AM protocol instance pointer. -* \param[in] frame Frame index. +* \param[in] ctxt_pP Running context. +* \param[in] rlc_pP RLC AM protocol instance pointer. * \param[in] sduP SDU. (A struct rlc_am_data_req is mapped on sduP->data.) */ -public_rlc_am( void rlc_am_data_req (void *rlcP, const frame_t frame, mem_block_t *sduP);) +public_rlc_am( void rlc_am_data_req (const protocol_ctxt_t* const ctxtP,void * const rlc_pP, mem_block_t *sduP);) /** @} */ # endif diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_entity.h b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_entity.h index 8977072ff45248c12e3387856bc2eb47c55ae4c5..1b948749b864aa36b26ce229f57c8d3f38aada1c 100755 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_entity.h +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_entity.h @@ -57,12 +57,12 @@ * \brief Structure containing a RLC AM instance protocol variables, statistic variables, allocation variables, buffers and other miscellaneous variables. */ typedef struct rlc_am_entity_s { - module_id_t enb_module_id; /*!< \brief eNB Virtualization index for this protocol instance. */ - module_id_t ue_module_id; /*!< \brief UE Virtualization index for this protocol instance. */ + //module_id_t enb_module_id; /*!< \brief eNB Virtualization index for this protocol instance. */ + //module_id_t ue_module_id; /*!< \brief UE Virtualization index for this protocol instance. */ rb_id_t rb_id; /*!< \brief Radio bearer identifier, for statistics and trace purpose. */ logical_chan_id_t channel_id; /*!< \brief Transport channel identifier. */ boolean_t is_data_plane; /*!< \brief To know if the RLC belongs to a data radio bearer or a signalling radio bearer, for statistics and trace purpose. */ - boolean_t is_enb; /*!< \brief To know if the RLC belongs to a eNB or UE. */ + //boolean_t is_enb; /*!< \brief To know if the RLC belongs to a eNB or UE. */ rlc_buffer_occupancy_t sdu_buffer_occupancy; /*!< \brief Number of bytes of unsegmented SDUs. */ rlc_buffer_occupancy_t retransmission_buffer_occupancy; /*!< \brief Number of bytes of PDUs in retransmission buffer waiting for a ACK. */ diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_in_sdu.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_in_sdu.c index 014e797f6d760f8b8a25cd068b128de08d674e0b..097a4dd582a33a880751f5bf5691d9f6fe1dc980 100755 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_in_sdu.c +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_in_sdu.c @@ -43,9 +43,9 @@ #define TRACE_RLC_AM_FREE_SDU //----------------------------------------------------------------------------- void rlc_am_free_in_sdu( - rlc_am_entity_t *const rlcP, - const frame_t frameP, - const unsigned int index_in_bufferP) + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t *const rlcP, + const unsigned int index_in_bufferP) //----------------------------------------------------------------------------- { if (index_in_bufferP <= RLC_AM_SDU_CONTROL_BUFFER_SIZE) { @@ -69,10 +69,10 @@ void rlc_am_free_in_sdu( } #ifdef TRACE_RLC_AM_FREE_SDU LOG_D(RLC, "[FRAME %05d][%s][RLC_AM][MOD %u/%u][RB %u][FREE SDU] SDU INDEX %03d current_sdu_index=%d next_sdu_index=%d nb_sdu_no_segmented=%d\n", - frameP, - (rlcP->is_enb) ? "eNB" : "UE", - rlcP->enb_module_id, - rlcP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlcP->rb_id, index_in_bufferP, rlcP->current_sdu_index, @@ -82,9 +82,11 @@ void rlc_am_free_in_sdu( } // called when segmentation is done //----------------------------------------------------------------------------- -void rlc_am_free_in_sdu_data( - rlc_am_entity_t *const rlcP, - const unsigned int index_in_bufferP) +void +rlc_am_free_in_sdu_data( + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t* const rlcP, + const unsigned int index_in_bufferP) //----------------------------------------------------------------------------- { if (index_in_bufferP <= RLC_AM_SDU_CONTROL_BUFFER_SIZE) { @@ -97,7 +99,10 @@ void rlc_am_free_in_sdu_data( } } //----------------------------------------------------------------------------- -signed int rlc_am_in_sdu_is_empty(rlc_am_entity_t *const rlcP) +signed int +rlc_am_in_sdu_is_empty( + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t *const rlcP) //----------------------------------------------------------------------------- { if (rlcP->nb_sdu == 0) { diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_in_sdu.h b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_in_sdu.h index c1029d3037adaeeae49818ca70b536fde17f123c..19cc5c2a8e9a3f2547f75246a0b1171467f7300c 100755 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_in_sdu.h +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_in_sdu.h @@ -57,30 +57,32 @@ # define public_rlc_am_in_sdu(x) extern x # endif # endif -/*! \fn void rlc_am_free_in_sdu (rlc_am_entity_t *rlcP, frame_t frameP, unsigned int index_in_bufferP) +/*! \fn void rlc_am_free_in_sdu (const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t *rlcP, unsigned int index_in_bufferP) * \brief Free a higher layer SDU stored in input_sdus[] buffer. +* \param[in] ctxtP Running context. * \param[in] rlcP RLC AM protocol instance pointer. -* \param[in] frame Frame index. * \param[in] index_in_bufferP Position index of the SDU. * \note Update also the RLC AM instance variables nb_sdu, current_sdu_index, nb_sdu_no_segmented. */ -protected_rlc_am_in_sdu(void rlc_am_free_in_sdu (rlc_am_entity_t *rlcP, frame_t frameP, unsigned int index_in_bufferP);) +protected_rlc_am_in_sdu(void rlc_am_free_in_sdu (const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t *rlcP, unsigned int index_in_bufferP);) -/*! \fn void rlc_am_free_in_sdu_data (rlc_am_entity_t *rlcP, unsigned int index_in_bufferP) +/*! \fn void rlc_am_free_in_sdu_data (const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t *rlcP, unsigned int index_in_bufferP) * \brief Free a higher layer SDU data part, the SDU is stored in input_sdus[] buffer. +* \param[in] ctxtP Running context. * \param[in] rlcP RLC AM protocol instance pointer. * \param[in] index_in_bufferP Position index of the SDU. * \note This procedure is called when the SDU segmentation is done for this SDU. Update also the RLC AM instance variable nb_sdu_no_segmented. */ -protected_rlc_am_in_sdu(void rlc_am_free_in_sdu_data (rlc_am_entity_t *rlcP, unsigned int index_in_bufferP);) +protected_rlc_am_in_sdu(void rlc_am_free_in_sdu_data (const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t *rlcP, unsigned int index_in_bufferP);) -/*! \fn signed int rlc_am_in_sdu_is_empty(rlc_am_entity_t *rlcP) +/*! \fn signed int rlc_am_in_sdu_is_empty(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t *rlcP) * \brief Indicates if the input SDU buffer for incoming higher layer SDUs is empty or not. +* \param[in] ctxtP Running context. * \param[in] rlcP RLC AM protocol instance pointer. * \return 1 if the buffer is empty, else 0. */ -protected_rlc_am_in_sdu(signed int rlc_am_in_sdu_is_empty(rlc_am_entity_t *rlcP);) +protected_rlc_am_in_sdu(signed int rlc_am_in_sdu_is_empty(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t *rlcP);) /** @} */ # endif diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_init.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_init.c index 4da8be7c9c6eabe4f4dcb23efbe8f232de9543da..3e9c95df1c9c833ad9b648182abf486159e797d5 100755 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_init.c +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_init.c @@ -36,13 +36,16 @@ #include "LAYER2/MAC/extern.h" #include "UTIL/LOG/log.h" //----------------------------------------------------------------------------- -void rlc_am_init(rlc_am_entity_t *rlc_pP, frame_t frameP) +void +rlc_am_init( + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t *const rlc_pP) //----------------------------------------------------------------------------- { if (rlc_pP->initialized == TRUE) { - LOG_D(RLC, "[FRAME %5u][RLC_AM][MOD XX][RB XX][INIT] INITIALIZATION ALREADY DONE, DOING NOTHING\n", frameP); + LOG_D(RLC, "[FRAME %5u][RLC_AM][MOD XX][RB XX][INIT] INITIALIZATION ALREADY DONE, DOING NOTHING\n", ctxt_pP->frame); } else { - LOG_D(RLC, "[FRAME %5u][RLC_AM][MOD XX][RB XX][INIT] INITIALIZATION: STATE VARIABLES, BUFFERS, LISTS\n", frameP); + LOG_D(RLC, "[FRAME %5u][RLC_AM][MOD XX][RB XX][INIT] INITIALIZATION: STATE VARIABLES, BUFFERS, LISTS\n", ctxt_pP->frame); memset(rlc_pP, 0, sizeof(rlc_am_entity_t)); list2_init(&rlc_pP->receiver_buffer, "RX BUFFER"); @@ -56,8 +59,8 @@ void rlc_am_init(rlc_am_entity_t *rlc_pP, frame_t frameP) #warning "cast the rlc retrans buffer to uint32" // rlc_pP->pdu_retrans_buffer = calloc(1, (uint16_t)((unsigned int)RLC_AM_PDU_RETRANSMISSION_BUFFER_SIZE*(unsigned int)sizeof(rlc_am_tx_data_pdu_management_t))); rlc_pP->pdu_retrans_buffer = calloc(1, (uint32_t)((unsigned int)RLC_AM_PDU_RETRANSMISSION_BUFFER_SIZE*(unsigned int)sizeof(rlc_am_tx_data_pdu_management_t))); - LOG_D(RLC, "[FRAME %5u][RLC_AM][MOD XX][RB XX][INIT] input_sdus[] = %p element size=%d\n", frameP, rlc_pP->input_sdus,sizeof(rlc_am_tx_sdu_management_t)); - LOG_D(RLC, "[FRAME %5u][RLC_AM][MOD XX][RB XX][INIT] pdu_retrans_buffer[] = %p element size=%d\n", frameP, rlc_pP->pdu_retrans_buffer,sizeof(rlc_am_tx_data_pdu_management_t)); + LOG_D(RLC, "[FRAME %5u][RLC_AM][MOD XX][RB XX][INIT] input_sdus[] = %p element size=%d\n", ctxt_pP->frame, rlc_pP->input_sdus,sizeof(rlc_am_tx_sdu_management_t)); + LOG_D(RLC, "[FRAME %5u][RLC_AM][MOD XX][RB XX][INIT] pdu_retrans_buffer[] = %p element size=%d\n", ctxt_pP->frame, rlc_pP->pdu_retrans_buffer,sizeof(rlc_am_tx_data_pdu_management_t)); // TX state variables //rlc_pP->vt_a = 0; @@ -81,7 +84,10 @@ void rlc_am_init(rlc_am_entity_t *rlc_pP, frame_t frameP) } } //----------------------------------------------------------------------------- -void rlc_am_reestablish(rlc_am_entity_t *rlc_pP, frame_t frameP) +void +rlc_am_reestablish( + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t* const rlc_pP) //----------------------------------------------------------------------------- { /* @@ -98,7 +104,7 @@ void rlc_am_reestablish(rlc_am_entity_t *rlc_pP, frame_t frameP) * - stop and reset all timers; * - reset all state variables to their initial values. */ - LOG_D(RLC, "[FRAME %5u][RLC_AM][MOD XX][RB XX][REESTABLISH] RE-INIT STATE VARIABLES, BUFFERS, LISTS\n", frameP); + LOG_D(RLC, "[FRAME %5u][RLC_AM][MOD XX][RB XX][REESTABLISH] RE-INIT STATE VARIABLES, BUFFERS, LISTS\n", ctxt_pP->frame); #warning TODO when possible reassemble RLC SDUs from any byte segments of AMD PDUs with SN inf VR(MR) list2_free(&rlc_pP->receiver_buffer); @@ -133,13 +139,16 @@ void rlc_am_reestablish(rlc_am_entity_t *rlc_pP, frame_t frameP) } //----------------------------------------------------------------------------- -void rlc_am_cleanup(rlc_am_entity_t *rlc_pP) +void +rlc_am_cleanup( + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t* const rlc_pP) //----------------------------------------------------------------------------- { LOG_I(RLC, "[FRAME ?????][%s][RLC_AM][MOD %u/%u][RB %u][CLEANUP]\n", - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id); list2_free(&rlc_pP->receiver_buffer); @@ -177,22 +186,24 @@ void rlc_am_cleanup(rlc_am_entity_t *rlc_pP) memset(rlc_pP, 0, sizeof(rlc_am_entity_t)); } //----------------------------------------------------------------------------- -void rlc_am_configure(rlc_am_entity_t *rlc_pP, - frame_t frameP, - uint16_t max_retx_thresholdP, - uint16_t poll_pduP, - uint16_t poll_byteP, - uint32_t t_poll_retransmitP, - uint32_t t_reorderingP, - uint32_t t_status_prohibitP) +void +rlc_am_configure( + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t *const rlc_pP, + const uint16_t max_retx_thresholdP, + const uint16_t poll_pduP, + const uint16_t poll_byteP, + const uint32_t t_poll_retransmitP, + const uint32_t t_reorderingP, + const uint32_t t_status_prohibitP) //----------------------------------------------------------------------------- { if (rlc_pP->configured == TRUE) { LOG_I(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][RECONFIGURE] max_retx_threshold %d poll_pdu %d poll_byte %d t_poll_retransmit %d t_reordering %d t_status_prohibit %d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, max_retx_thresholdP, poll_pduP, @@ -211,10 +222,10 @@ void rlc_am_configure(rlc_am_entity_t *rlc_pP, rlc_pP->t_status_prohibit.time_out = t_status_prohibitP; } else { LOG_I(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][CONFIGURE] max_retx_threshold %d poll_pdu %d poll_byte %d t_poll_retransmit %d t_reordering %d t_status_prohibit %d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, max_retx_thresholdP, poll_pduP, @@ -229,42 +240,39 @@ void rlc_am_configure(rlc_am_entity_t *rlc_pP, rlc_pP->protocol_state = RLC_DATA_TRANSFER_READY_STATE; - rlc_am_init_timer_poll_retransmit(rlc_pP, t_poll_retransmitP); - rlc_am_init_timer_reordering (rlc_pP, t_reorderingP); - rlc_am_init_timer_status_prohibit(rlc_pP, t_status_prohibitP); + rlc_am_init_timer_poll_retransmit(ctxt_pP, rlc_pP, t_poll_retransmitP); + rlc_am_init_timer_reordering (ctxt_pP, rlc_pP, t_reorderingP); + rlc_am_init_timer_status_prohibit(ctxt_pP, rlc_pP, t_status_prohibitP); rlc_pP->configured = TRUE; } } //----------------------------------------------------------------------------- -void rlc_am_set_debug_infos(rlc_am_entity_t *rlc_pP, - frame_t frameP, - eNB_flag_t eNB_flagP, - srb_flag_t srb_flagP, - module_id_t enb_module_idP, - module_id_t ue_module_idP, - rb_id_t rb_idP) +void +rlc_am_set_debug_infos( + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t *const rlc_pP, + const srb_flag_t srb_flagP, + const rb_id_t rb_idP) //----------------------------------------------------------------------------- { LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][SET DEBUG INFOS] module_id %d rb_id %d is SRB %d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rb_idP, - enb_module_idP, - ue_module_idP, + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rb_idP, (srb_flagP) ? "TRUE" : "FALSE"); - rlc_pP->enb_module_id = enb_module_idP; - rlc_pP->ue_module_id = ue_module_idP; + rlc_pP->rb_id = rb_idP; if (srb_flagP) { rlc_pP->is_data_plane = 0; } else { rlc_pP->is_data_plane = 1; } - rlc_pP->is_enb = eNB_flagP; } diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_init.h b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_init.h index 30de3bfb6506b1d121ca29e222627adb39997612..464a3db97582b2d312225785d1c7f6688a4d1a18 100755 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_init.h +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_init.h @@ -78,23 +78,24 @@ typedef volatile struct { } rlc_am_info_t; //----------------------------------------------------------------------------- -/*! \fn void rlc_am_init (rlc_am_entity_t* rlc_pP,frame_t frameP) +/*! \fn void rlc_am_init (const protocol_ctxt_t* const ctxtP, rlc_am_entity_t * const rlc_pP) * \brief Initialize the RLC AM protocol instance, reset variables, allocate buffers, lists, then, the next step in order have a running RLC AM instance is to configure and set debug informations for this RLC instance. -* \param[in] rlc_pP RLC AM protocol instance pointer. -* \param[in] frame Frame index +* \param[in] ctxtP Running context. +* \param[in] rlc_pP RLC AM protocol instance pointer. */ -public_rlc_am_init( void rlc_am_init (rlc_am_entity_t* rlc_pP,frame_t frameP);) +public_rlc_am_init( void rlc_am_init (const protocol_ctxt_t* const ctxtP, rlc_am_entity_t* rlc_pP);) -/*! \fn void rlc_am_cleanup(rlc_am_entity_t* rlc_pP) +/*! \fn void rlc_am_cleanup(const protocol_ctxt_t* const ctxtP, rlc_am_entity_t *const rlc_pP) * \brief Free all memory resources allocated and kept by this RLC AM instance. -* \param[in] rlc_pP RLC AM protocol instance pointer. +* \param[in] ctxtP Running context. +* \param[in] rlc_pP RLC AM protocol instance pointer. */ -public_rlc_am_init( void rlc_am_cleanup(rlc_am_entity_t* rlc_pP);) +public_rlc_am_init( void rlc_am_cleanup(const protocol_ctxt_t* const ctxtP, rlc_am_entity_t* rlc_pP);) -/*! \fn void rlc_am_configure(rlc_am_entity_t *rlc_pP, frame_t frameP, uint16_t max_retx_thresholdP, uint16_t poll_pduP, uint16_t poll_byteP, uint32_t t_poll_retransmitP, uint32_t t_reorderingP, uint32_t t_status_prohibitP) +/*! \fn void rlc_am_configure(const protocol_ctxt_t* const ctxtP, rlc_am_entity_t * const rlc_pP, uint16_t max_retx_thresholdP, uint16_t poll_pduP, uint16_t poll_byteP, uint32_t t_poll_retransmitP, uint32_t t_reorderingP, uint32_t t_status_prohibitP) * \brief Set RLC AM protocol parameters. -* \param[in] rlc_pP RLC AM protocol instance pointer. -* \param[in] frame Frame index +* \param[in] ctxtP Running context. +* \param[in] rlc_pP RLC AM protocol instance pointer. * \param[in] max_retx_thresholdP Limit the number of retransmissions of an AMD PDU. * \param[in] poll_pduP Trigger a poll for every poll_pduP PDUs. @@ -103,25 +104,22 @@ AMD PDU. * \param[in] t_reorderingP This timer is used by the receiving side of an AM RLC entity in order to detect loss of RLC PDUs at lower layer, value in frames. * \param[in] t_status_prohibitP This timer is used by the receiving side of an AM RLC entity in order to prohibit transmission of a STATUS PDU, value in frames. */ -public_rlc_am_init( void rlc_am_configure(rlc_am_entity_t *rlc_pP, - frame_t frameP, - uint16_t max_retx_thresholdP, - uint16_t poll_pduP, - uint16_t poll_byteP, - uint32_t t_poll_retransmitP, - uint32_t t_reorderingP, - uint32_t t_status_prohibitP);) +public_rlc_am_init( void rlc_am_configure(const protocol_ctxt_t* const ctxtP, + rlc_am_entity_t * const rlc_pP, + const uint16_t max_retx_thresholdP, + const uint16_t poll_pduP, + const uint16_t poll_byteP, + const uint32_t t_poll_retransmitP, + const uint32_t t_reorderingP, + const uint32_t t_status_prohibitP);) -/*! \fn void rlc_am_set_debug_infos(rlc_am_entity_t *rlc_pP, frame_t frameP, eNB_flag_t eNB_flagP, srb_flag_t srb_flagP, module_id_t enb_module_idP, module_id_t ue_module_idP, rb_id_t rb_idP) +/*! \fn void rlc_am_set_debug_infos(const protocol_ctxt_t* const ctxtP, rlc_am_entity_t * const rlc_pP, const srb_flag_t srb_flagP, const rb_id_t rb_idP) * \brief Set informations that will be displayed in traces, helping the debug process. -* \param[in] rlc_pP RLC AM protocol instance pointer. -* \param[in] frame Frame index -* \param[in] eNB_flag Flag to indicate eNB (1) or UE (0) +* \param[in] ctxtP Running context. +* \param[in] rlc_pP RLC AM protocol instance pointer. * \param[in] srb_flagP Flag to indicate signalling radio bearer (1) or data radio bearer (0). -* \param[in] enb_module_idP eNB Virtualization variable, module identifier. -* \param[in] ue_module_idP UE Virtualization variable, module identifier. * \param[in] rb_idP Radio bearer identifier. */ -public_rlc_am_init( void rlc_am_set_debug_infos(rlc_am_entity_t *rlc_pP, frame_t frameP, eNB_flag_t eNB_flagP, srb_flag_t srb_flagP, module_id_t enb_module_idP, module_id_t ue_module_idP, rb_id_t rb_idP);) +public_rlc_am_init( void rlc_am_set_debug_infos(const protocol_ctxt_t* const ctxtP, rlc_am_entity_t * const rlc_pP, const srb_flag_t srb_flagP, const rb_id_t rb_idP);) /** @} */ #endif diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_reassembly.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_reassembly.c index fcb12a38bb9ca40ef8ec7decc53eeb1ca853d439..c209e852a44b3340e4368b05c374a7ffecaa69bb 100755 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_reassembly.c +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_reassembly.c @@ -42,20 +42,28 @@ //#define TRACE_RLC_AM_RX_DECODE //----------------------------------------------------------------------------- -inline void rlc_am_clear_rx_sdu (rlc_am_entity_t *rlc_pP) +inline void +rlc_am_clear_rx_sdu ( + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t * const rlc_pP) //----------------------------------------------------------------------------- { rlc_pP->output_sdu_size_to_write = 0; } //----------------------------------------------------------------------------- -void rlc_am_reassembly (uint8_t * src_pP, int32_t lengthP, rlc_am_entity_t *rlc_pP, frame_t frameP) +void +rlc_am_reassembly ( + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t * const rlc_pP, + uint8_t * src_pP, + const int32_t lengthP) //----------------------------------------------------------------------------- { LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][REASSEMBLY PAYLOAD] reassembly() %d bytes\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, lengthP); @@ -73,17 +81,17 @@ void rlc_am_reassembly (uint8_t * src_pP, int32_t lengthP, rlc_am_entity_t *rlc_ rlc_pP->output_sdu_size_to_write += lengthP; } else { LOG_E(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][REASSEMBLY PAYLOAD] ERROR SDU SIZE OVERFLOW SDU GARBAGED\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id); #if defined(STOP_ON_IP_TRAFFIC_OVERLOAD) AssertFatal(0, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u] RLC_AM_DATA_IND, SDU SIZE OVERFLOW SDU GARBAGED\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id); #endif // erase SDU @@ -91,23 +99,26 @@ void rlc_am_reassembly (uint8_t * src_pP, int32_t lengthP, rlc_am_entity_t *rlc_ } } else { LOG_E(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][REASSEMBLY PAYLOAD] ERROR OUTPUT SDU IS NULL\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id); #if defined(STOP_ON_IP_TRAFFIC_OVERLOAD) AssertFatal(0, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u] RLC_AM_DATA_IND, SDU DROPPED, OUT OF MEMORY\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id); #endif } } //----------------------------------------------------------------------------- -void rlc_am_send_sdu (rlc_am_entity_t *rlc_pP,frame_t frameP, eNB_flag_t eNB_flagP) +void +rlc_am_send_sdu ( + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t * const rlc_pP) //----------------------------------------------------------------------------- { # if defined(TRACE_RLC_UM_PDU) @@ -119,10 +130,10 @@ void rlc_am_send_sdu (rlc_am_entity_t *rlc_pP,frame_t frameP, eNB_flag_t eNB_fla if ((rlc_pP->output_sdu_in_construction)) { LOG_D(RLC, "\n\n\n[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][SEND_SDU] %d bytes sdu %p\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, rlc_pP->output_sdu_size_to_write, rlc_pP->output_sdu_in_construction); @@ -169,26 +180,22 @@ void rlc_am_send_sdu (rlc_am_entity_t *rlc_pP,frame_t frameP, eNB_flag_t eNB_fla message_string_size += sprintf(&message_string[message_string_size], " |\n"); # if defined(ENABLE_ITTI) - msg_p = itti_alloc_new_message_sized (rlc_pP->is_enb > 0 ? TASK_RLC_ENB:TASK_RLC_UE , + msg_p = itti_alloc_new_message_sized (ctxt_pP->enb_flag > 0 ? TASK_RLC_ENB:TASK_RLC_UE , RLC_AM_SDU_IND, message_string_size + sizeof (IttiMsgText)); msg_p->ittiMsg.rlc_am_sdu_ind.size = message_string_size; memcpy(&msg_p->ittiMsg.rlc_am_sdu_ind.text, message_string, message_string_size); - if (rlc_pP->is_enb) { - itti_send_msg_to_task(TASK_UNKNOWN, rlc_pP->enb_module_id, msg_p); + if (ctxt_pP->enb_flag) { + itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->enb_module_id, msg_p); } else { - itti_send_msg_to_task(TASK_UNKNOWN, rlc_pP->ue_module_id + NB_eNB_INST, msg_p); + itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->ue_module_id + NB_eNB_INST, msg_p); } # else LOG_T(RLC, "%s", message_string); # endif # endif - rlc_data_ind ( - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, - frameP, - eNB_flagP, + rlc_data_ind (ctxt_pP, BOOL_NOT(rlc_pP->is_data_plane), MBMS_FLAG_NO, rlc_pP->rb_id, @@ -198,19 +205,19 @@ void rlc_am_send_sdu (rlc_am_entity_t *rlc_pP,frame_t frameP, eNB_flag_t eNB_fla rlc_pP->output_sdu_in_construction = NULL; } else { LOG_E(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][SEND_SDU] ERROR SIZE <= 0 ... DO NOTHING, SET SDU SIZE TO 0\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id); //msg("[RLC_AM][MOD %d] Freeing mem_block ...\n", rlc_pP->module_id); //free_mem_block (rlc_pP->output_sdu_in_construction); AssertFatal(3==4, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][%s %u] SEND SDU REQUESTED %d bytes", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, (rlc_pP->is_data_plane) ? "DRB" : "SRB", rlc_pP->rb_id, rlc_pP->output_sdu_size_to_write); @@ -219,73 +226,77 @@ void rlc_am_send_sdu (rlc_am_entity_t *rlc_pP,frame_t frameP, eNB_flag_t eNB_fla } } //----------------------------------------------------------------------------- -void rlc_am_reassemble_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP, eNB_flag_t eNB_flagP, mem_block_t* tb_pP) { +void +rlc_am_reassemble_pdu( + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t * const rlc_pP, + mem_block_t * const tb_pP) { //----------------------------------------------------------------------------- int i,j; rlc_am_pdu_info_t* pdu_info = &((rlc_am_rx_pdu_management_t*)(tb_pP->data))->pdu_info; LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][REASSEMBLY PDU] TRY REASSEMBLY PDU SN=%03d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, pdu_info->sn); #ifdef TRACE_RLC_AM_RX_DECODE - rlc_am_display_data_pdu_infos(rlc_pP, frameP, pdu_info); + rlc_am_display_data_pdu_infos(ctxt_pP, rlc_pP, pdu_info); #endif if (pdu_info->e == RLC_E_FIXED_PART_DATA_FIELD_FOLLOW) { switch (pdu_info->fi) { case RLC_FI_1ST_BYTE_DATA_IS_1ST_BYTE_SDU_LAST_BYTE_DATA_IS_LAST_BYTE_SDU: LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][REASSEMBLY PDU] TRY REASSEMBLY PDU NO E_LI FI=11 (00)\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id); // one complete SDU - rlc_am_send_sdu(rlc_pP,frameP,eNB_flagP); // may be not necessary - rlc_am_reassembly (pdu_info->payload, pdu_info->payload_size, rlc_pP,frameP); - rlc_am_send_sdu(rlc_pP,frameP,eNB_flagP); // may be not necessary + rlc_am_send_sdu(ctxt_pP, rlc_pP); // may be not necessary + rlc_am_reassembly (ctxt_pP, rlc_pP, pdu_info->payload, pdu_info->payload_size); + rlc_am_send_sdu(ctxt_pP, rlc_pP); // may be not necessary //rlc_pP->reassembly_missing_sn_detected = 0; break; case RLC_FI_1ST_BYTE_DATA_IS_1ST_BYTE_SDU_LAST_BYTE_DATA_IS_NOT_LAST_BYTE_SDU: LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][REASSEMBLY PDU] TRY REASSEMBLY PDU NO E_LI FI=10 (01)\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id); // one beginning segment of SDU in PDU - rlc_am_send_sdu(rlc_pP,frameP,eNB_flagP); // may be not necessary - rlc_am_reassembly (pdu_info->payload, pdu_info->payload_size, rlc_pP,frameP); + rlc_am_send_sdu(ctxt_pP, rlc_pP); // may be not necessary + rlc_am_reassembly (ctxt_pP, rlc_pP,pdu_info->payload, pdu_info->payload_size); //rlc_pP->reassembly_missing_sn_detected = 0; break; case RLC_FI_1ST_BYTE_DATA_IS_NOT_1ST_BYTE_SDU_LAST_BYTE_DATA_IS_LAST_BYTE_SDU: LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][REASSEMBLY PDU] TRY REASSEMBLY PDU NO E_LI FI=01 (10)\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id); // one last segment of SDU //if (rlc_pP->reassembly_missing_sn_detected == 0) { - rlc_am_reassembly (pdu_info->payload, pdu_info->payload_size, rlc_pP,frameP); - rlc_am_send_sdu(rlc_pP,frameP,eNB_flagP); + rlc_am_reassembly (ctxt_pP, rlc_pP, pdu_info->payload, pdu_info->payload_size); + rlc_am_send_sdu(ctxt_pP, rlc_pP); //} // else { clear sdu already done //rlc_pP->reassembly_missing_sn_detected = 0; break; case RLC_FI_1ST_BYTE_DATA_IS_NOT_1ST_BYTE_SDU_LAST_BYTE_DATA_IS_NOT_LAST_BYTE_SDU: LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][REASSEMBLY PDU] TRY REASSEMBLY PDU NO E_LI FI=00 (11)\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id); //if (rlc_pP->reassembly_missing_sn_detected == 0) { // one whole segment of SDU in PDU - rlc_am_reassembly (pdu_info->payload, pdu_info->payload_size, rlc_pP,frameP); + rlc_am_reassembly (ctxt_pP, rlc_pP, pdu_info->payload, pdu_info->payload_size); //} else { // rlc_pP->reassembly_missing_sn_detected = 1; // not necessary but for readability of the code //} @@ -300,10 +311,10 @@ void rlc_am_reassemble_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP, eNB_flag_t e switch (pdu_info->fi) { case RLC_FI_1ST_BYTE_DATA_IS_1ST_BYTE_SDU_LAST_BYTE_DATA_IS_LAST_BYTE_SDU: LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][REASSEMBLY PDU] TRY REASSEMBLY PDU FI=11 (00) Li=", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id); for (i=0; i < pdu_info->num_li; i++) { LOG_D(RLC, "%d ",pdu_info->li_list[i]); @@ -311,26 +322,26 @@ void rlc_am_reassemble_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP, eNB_flag_t e LOG_D(RLC, "\n"); //msg(" remaining size %d\n",size); // N complete SDUs - rlc_am_send_sdu(rlc_pP,frameP,eNB_flagP); + rlc_am_send_sdu(ctxt_pP, rlc_pP); j = 0; for (i = 0; i < pdu_info->num_li; i++) { - rlc_am_reassembly (&pdu_info->payload[j], pdu_info->li_list[i], rlc_pP,frameP); - rlc_am_send_sdu(rlc_pP,frameP,eNB_flagP); + rlc_am_reassembly (ctxt_pP, rlc_pP, &pdu_info->payload[j], pdu_info->li_list[i]); + rlc_am_send_sdu(ctxt_pP, rlc_pP); j = j + pdu_info->li_list[i]; } if (pdu_info->hidden_size > 0) { // normally should always be > 0 but just for help debug // data is already ok, done by last loop above - rlc_am_reassembly (&pdu_info->payload[j], pdu_info->hidden_size, rlc_pP,frameP); - rlc_am_send_sdu(rlc_pP,frameP,eNB_flagP); + rlc_am_reassembly (ctxt_pP, rlc_pP, &pdu_info->payload[j], pdu_info->hidden_size); + rlc_am_send_sdu(ctxt_pP, rlc_pP); } //rlc_pP->reassembly_missing_sn_detected = 0; break; case RLC_FI_1ST_BYTE_DATA_IS_1ST_BYTE_SDU_LAST_BYTE_DATA_IS_NOT_LAST_BYTE_SDU: LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][REASSEMBLY PDU] TRY REASSEMBLY PDU FI=10 (01) Li=", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id); for (i=0; i < pdu_info->num_li; i++) { LOG_D(RLC, "%d ",pdu_info->li_list[i]); @@ -338,25 +349,25 @@ void rlc_am_reassemble_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP, eNB_flag_t e LOG_D(RLC, "\n"); //msg(" remaining size %d\n",size); // N complete SDUs + one segment of SDU in PDU - rlc_am_send_sdu(rlc_pP,frameP,eNB_flagP); + rlc_am_send_sdu(ctxt_pP, rlc_pP); j = 0; for (i = 0; i < pdu_info->num_li; i++) { - rlc_am_reassembly (&pdu_info->payload[j], pdu_info->li_list[i], rlc_pP,frameP); - rlc_am_send_sdu(rlc_pP,frameP,eNB_flagP); + rlc_am_reassembly (ctxt_pP, rlc_pP, &pdu_info->payload[j], pdu_info->li_list[i]); + rlc_am_send_sdu(ctxt_pP, rlc_pP); j = j + pdu_info->li_list[i]; } if (pdu_info->hidden_size > 0) { // normally should always be > 0 but just for help debug // data is already ok, done by last loop above - rlc_am_reassembly (&pdu_info->payload[j], pdu_info->hidden_size, rlc_pP, frameP); + rlc_am_reassembly (ctxt_pP, rlc_pP, &pdu_info->payload[j], pdu_info->hidden_size); } //rlc_pP->reassembly_missing_sn_detected = 0; break; case RLC_FI_1ST_BYTE_DATA_IS_NOT_1ST_BYTE_SDU_LAST_BYTE_DATA_IS_LAST_BYTE_SDU: LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][REASSEMBLY PDU] TRY REASSEMBLY PDU FI=01 (10) Li=", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id); for (i=0; i < pdu_info->num_li; i++) { LOG_D(RLC, "%d ",pdu_info->li_list[i]); @@ -366,23 +377,23 @@ void rlc_am_reassemble_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP, eNB_flag_t e // one last segment of SDU + N complete SDUs in PDU j = 0; for (i = 0; i < pdu_info->num_li; i++) { - rlc_am_reassembly (&pdu_info->payload[j], pdu_info->li_list[i], rlc_pP,frameP); - rlc_am_send_sdu(rlc_pP,frameP,eNB_flagP); + rlc_am_reassembly (ctxt_pP, rlc_pP, &pdu_info->payload[j], pdu_info->li_list[i]); + rlc_am_send_sdu(ctxt_pP, rlc_pP); j = j + pdu_info->li_list[i]; } if (pdu_info->hidden_size > 0) { // normally should always be > 0 but just for help debug // data is already ok, done by last loop above - rlc_am_reassembly (&pdu_info->payload[j], pdu_info->hidden_size, rlc_pP,frameP); - rlc_am_send_sdu(rlc_pP,frameP,eNB_flagP); + rlc_am_reassembly (ctxt_pP, rlc_pP, &pdu_info->payload[j], pdu_info->hidden_size); + rlc_am_send_sdu(ctxt_pP, rlc_pP); } //rlc_pP->reassembly_missing_sn_detected = 0; break; case RLC_FI_1ST_BYTE_DATA_IS_NOT_1ST_BYTE_SDU_LAST_BYTE_DATA_IS_NOT_LAST_BYTE_SDU: LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][REASSEMBLY PDU] TRY REASSEMBLY PDU FI=00 (11) Li=", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id); for (i=0; i < pdu_info->num_li; i++) { LOG_D(RLC, "%d ",pdu_info->li_list[i]); @@ -391,13 +402,13 @@ void rlc_am_reassemble_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP, eNB_flag_t e //msg(" remaining size %d\n",size); j = 0; for (i = 0; i < pdu_info->num_li; i++) { - rlc_am_reassembly (&pdu_info->payload[j], pdu_info->li_list[i], rlc_pP,frameP); - rlc_am_send_sdu(rlc_pP,frameP,eNB_flagP); + rlc_am_reassembly (ctxt_pP, rlc_pP, &pdu_info->payload[j], pdu_info->li_list[i]); + rlc_am_send_sdu(ctxt_pP, rlc_pP); j = j + pdu_info->li_list[i]; } if (pdu_info->hidden_size > 0) { // normally should always be > 0 but just for help debug // data is already ok, done by last loop above - rlc_am_reassembly (&pdu_info->payload[j], pdu_info->hidden_size, rlc_pP,frameP); + rlc_am_reassembly (ctxt_pP, rlc_pP, &pdu_info->payload[j], pdu_info->hidden_size); } else { #ifdef USER_MODE //assert (5!=5); diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_reassembly.h b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_reassembly.h index b7513eb9c5549fab41ede37075bf3b50af33b914..d4cb8a4373b6e5132b147c1d23865192fcb19a45 100755 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_reassembly.h +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_reassembly.h @@ -56,36 +56,36 @@ # define public_rlc_am_reassembly(x) extern x # endif # endif -/*! \fn void rlc_am_clear_rx_sdu (rlc_am_entity_t *rlc_pP) +/*! \fn void rlc_am_clear_rx_sdu (const protocol_ctxt_t* const ctxtP, rlc_am_entity_t * const rlc_pP) * \brief Reset the data cursor index in the output SDU buffer to zero. +* \param[in] ctxtP Running context. * \param[in] rlc_pP RLC AM protocol instance pointer. */ -private_rlc_am_reassembly( void rlc_am_clear_rx_sdu (rlc_am_entity_t *rlc_pP);) +private_rlc_am_reassembly( void rlc_am_clear_rx_sdu (const protocol_ctxt_t* const ctxtP, rlc_am_entity_t * const rlc_pP);) -/*! \fn void rlc_am_reassembly (uint8_t * srcP, int32_t lengthP, rlc_am_entity_t *rlc_pP,frame_t frameP) +/*! \fn void rlc_am_reassembly (const protocol_ctxt_t* const ctxtP, rlc_am_entity_t * const rlc_pPuint8_t * srcP, int32_t lengthP) * \brief Concatenate datas at the tail of the output SDU in construction. This SDU in construction will be sent to higher layer. -* \param[in] srcP Pointer on data to be reassemblied. -* \param[in] lengthP Length of data to be reassemblied. +* \param[in] ctxtP Running context. * \param[in] rlc_pP RLC AM protocol instance pointer. -* \param[in] frameP Frame index. +* \param[in] srcP Pointer on data to be reassemblied. +* \param[in] lengthP Length of data to be reassemblied. */ -private_rlc_am_reassembly( void rlc_am_reassembly (uint8_t * srcP, int32_t lengthP, rlc_am_entity_t *rlc_pP,frame_t frameP);) +private_rlc_am_reassembly( void rlc_am_reassembly (const protocol_ctxt_t* const ctxtP, rlc_am_entity_t * const rlc_pP, uint8_t * srcP, int32_t lengthP);) /*! \fn void rlc_am_send_sdu (rlc_am_entity_t *rlc_pP,frame_t frameP) * \brief Send the output SDU in construction to higher layer. +* \param[in] ctxtP Running context. * \param[in] rlc_pP RLC AM protocol instance pointer. -* \param[in] frameP Frame index. */ -private_rlc_am_reassembly( void rlc_am_send_sdu (rlc_am_entity_t *rlc_pP,frame_t frameP, eNB_flag_t eNB_flagP);) +private_rlc_am_reassembly( void rlc_am_send_sdu (const protocol_ctxt_t* const ctxtP, rlc_am_entity_t * const rlc_pP);) -/*! \fn void rlc_am_reassemble_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP, uint8_t eNB_flagP, mem_block_t* tb_pP) +/*! \fn void rlc_am_reassemble_pdu(const protocol_ctxt_t* const ctxtP, rlc_am_entity_t * const rlc_pP, const mem_block_t* const tb_pP) * \brief Reassembly a RLC AM PDU, depending of the content of this PDU, data will be reassemblied to the current output SDU, the current will be sent to higher layers or not, after or before the reassembly, or no send of SDU will be triggered, depending on FI field in PDU header. +* \param[in] ctxtP Running context. * \param[in] rlc_pP RLC AM protocol instance pointer. -* \param[in] frameP Frame index. -* \param[in] eNB_flagP Flag to indicate eNB (1) or UE (0). * \param[in] tb_pP RLC AM PDU embedded in a mem_block_t. */ -protected_rlc_am_reassembly( void rlc_am_reassemble_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP, eNB_flag_t eNB_flagP, mem_block_t* tb_pP);) +protected_rlc_am_reassembly( void rlc_am_reassemble_pdu(const protocol_ctxt_t* const ctxtP, rlc_am_entity_t * const rlc_pP, mem_block_t* const tb_pP);) /** @} */ #endif diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_receiver.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_receiver.c index 866044cab0e09fb72e48e968b0e1eda24be17be4..fcb028a238847cf6088828944bf4ab251a82b717 100755 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_receiver.c +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_receiver.c @@ -42,7 +42,12 @@ //#define DEBUG_RLC_AM_DISPLAY_TB_DATA //#define RLC_AM_GENERATE_ERRORS //----------------------------------------------------------------------------- -signed int rlc_am_get_data_pdu_infos(const const frame_t frameP, rlc_am_pdu_sn_10_t* header_pP, int16_t total_sizeP, rlc_am_pdu_info_t* pdu_info_pP) +signed int +rlc_am_get_data_pdu_infos( + const protocol_ctxt_t* const ctxt_pP, + rlc_am_pdu_sn_10_t* header_pP, + int16_t total_sizeP, + rlc_am_pdu_info_t* pdu_info_pP) //----------------------------------------------------------------------------- { memset(pdu_info_pP, 0, sizeof (rlc_am_pdu_info_t)); @@ -97,7 +102,7 @@ signed int rlc_am_get_data_pdu_infos(const const frame_t frameP, rlc_am_pdu_sn_1 pdu_info_pP->num_li = pdu_info_pP->num_li + 1; if (pdu_info_pP->num_li > RLC_AM_MAX_SDU_IN_PDU) { LOG_E(RLC, "[FRAME %5u][RLC_AM][MOD XX][RB XX][GET PDU INFO] SN %04d TOO MANY LIs ", - frameP, + ctxt_pP->frame, pdu_info_pP->sn); return -2; } @@ -115,13 +120,17 @@ signed int rlc_am_get_data_pdu_infos(const const frame_t frameP, rlc_am_pdu_sn_1 return 0; } else { LOG_W(RLC, "[FRAME %5u][RLC_AM][MOD XX][RB XX][GET DATA PDU INFO] SN %04d ERROR CONTROL PDU ", - frameP, + ctxt_pP->frame, pdu_info_pP->sn); return -1; } } //----------------------------------------------------------------------------- -void rlc_am_display_data_pdu_infos(rlc_am_entity_t * const rlc_pP, const const frame_t frameP, rlc_am_pdu_info_t* pdu_info_pP) +void +rlc_am_display_data_pdu_infos( + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t * const rlc_pP, + rlc_am_pdu_info_t* pdu_info_pP) //----------------------------------------------------------------------------- { int num_li; @@ -129,10 +138,10 @@ void rlc_am_display_data_pdu_infos(rlc_am_entity_t * const rlc_pP, const const f if (pdu_info_pP->d_c) { if (pdu_info_pP->rf) { LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][DISPLAY DATA PDU] RX DATA PDU SN %04d FI %1d SO %05d LSF %01d POLL %1d ", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, pdu_info_pP->sn, pdu_info_pP->fi, @@ -140,10 +149,10 @@ void rlc_am_display_data_pdu_infos(rlc_am_entity_t * const rlc_pP, const const f pdu_info_pP->lsf, pdu_info_pP->p); } else { LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][DISPLAY DATA PDU] RX DATA PDU SN %04d FI %1d POLL %1d ", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, pdu_info_pP->sn, pdu_info_pP->fi, @@ -158,16 +167,20 @@ void rlc_am_display_data_pdu_infos(rlc_am_entity_t * const rlc_pP, const const f LOG_D(RLC, "\n"); } else { LOG_E(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][DISPLAY DATA PDU] ERROR RX CONTROL PDU\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id); } } // assumed the sn of the tb_p is equal to VR(MS) //----------------------------------------------------------------------------- -void rlc_am_rx_update_vr_ms(rlc_am_entity_t * const rlc_pP, const const frame_t frameP, mem_block_t* tb_pP) +void +rlc_am_rx_update_vr_ms( + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t * const rlc_pP, + mem_block_t* tb_pP) //----------------------------------------------------------------------------- { //rlc_am_pdu_info_t* pdu_info_p = &((rlc_am_rx_pdu_management_t*)(tb_pP->data))->pdu_info; @@ -181,10 +194,10 @@ void rlc_am_rx_update_vr_ms(rlc_am_entity_t * const rlc_pP, const const frame_t if (((rlc_am_rx_pdu_management_t*)(cursor_p->data))->all_segments_received == 0) { #ifdef TRACE_RLC_AM_RX LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][UPDATE VR(MS)] UPDATED VR(MS) %04d -> %04d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, rlc_pP->vr_ms, pdu_info_cursor_p->sn); #endif @@ -195,10 +208,10 @@ void rlc_am_rx_update_vr_ms(rlc_am_entity_t * const rlc_pP, const const frame_t } while (cursor_p != NULL); #ifdef TRACE_RLC_AM_RX LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][UPDATE VR(MS)] UPDATED VR(MS) %04d -> %04d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, rlc_pP->vr_ms, (pdu_info_cursor_p->sn + 1) & RLC_AM_SN_MASK); @@ -208,7 +221,11 @@ void rlc_am_rx_update_vr_ms(rlc_am_entity_t * const rlc_pP, const const frame_t } // assumed the sn of the tb_p is equal to VR(R) //----------------------------------------------------------------------------- -void rlc_am_rx_update_vr_r(rlc_am_entity_t * const rlc_pP,const const frame_t frameP,mem_block_t* tb_pP) +void +rlc_am_rx_update_vr_r( + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t * const rlc_pP, + mem_block_t* tb_pP) //----------------------------------------------------------------------------- { rlc_am_pdu_info_t* pdu_info_cursor_p = NULL; @@ -224,10 +241,10 @@ void rlc_am_rx_update_vr_r(rlc_am_entity_t * const rlc_pP,const const frame_t fr } #ifdef TRACE_RLC_AM_RX LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][UPDATE VR(R)] UPDATED VR(R) %04d -> %04d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, rlc_pP->vr_r, (pdu_info_cursor_p->sn + 1) & RLC_AM_SN_MASK); @@ -246,7 +263,10 @@ void rlc_am_rx_update_vr_r(rlc_am_entity_t * const rlc_pP,const const frame_t fr } //----------------------------------------------------------------------------- void -rlc_am_receive_routing (rlc_am_entity_t * const rlc_pP, const const frame_t frameP, const eNB_flag_t eNB_flagP, struct mac_data_ind data_indP) +rlc_am_receive_routing ( + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t * const rlc_pP, + struct mac_data_ind data_indP) //----------------------------------------------------------------------------- { mem_block_t *tb_p = NULL; @@ -261,21 +281,21 @@ rlc_am_receive_routing (rlc_am_entity_t * const rlc_pP, const const frame_t fram if ((*first_byte_p & 0x80) == 0x80) { rlc_pP->stat_rx_data_bytes += tb_size_in_bytes; rlc_pP->stat_rx_data_pdu += 1; - rlc_am_receive_process_data_pdu (rlc_pP, frameP, eNB_flagP, tb_p, first_byte_p, tb_size_in_bytes); + rlc_am_receive_process_data_pdu (ctxt_pP, rlc_pP, tb_p, first_byte_p, tb_size_in_bytes); } else { rlc_pP->stat_rx_control_bytes += tb_size_in_bytes; rlc_pP->stat_rx_control_pdu += 1; - rlc_am_receive_process_control_pdu (rlc_pP, frameP, tb_p, &first_byte_p, &tb_size_in_bytes); + rlc_am_receive_process_control_pdu (ctxt_pP, rlc_pP, tb_p, &first_byte_p, &tb_size_in_bytes); // Test if remaining bytes not processed (up to know, highest probability is bug in MAC) AssertFatal( tb_size_in_bytes == 0, "Remaining %d bytes following a control PDU", tb_size_in_bytes); } LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][RX ROUTING] VR(R)=%03d VR(MR)=%03d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, rlc_pP->vr_r, rlc_pP->vr_mr); @@ -283,7 +303,13 @@ rlc_am_receive_routing (rlc_am_entity_t * const rlc_pP, const const frame_t fram } // end while } //----------------------------------------------------------------------------- -void rlc_am_receive_process_data_pdu (rlc_am_entity_t * const rlc_pP, const const frame_t frameP, const eNB_flag_t eNB_flagP, mem_block_t* tb_pP, uint8_t* first_byte_pP, uint16_t tb_size_in_bytesP) +void +rlc_am_receive_process_data_pdu ( + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t * const rlc_pP, + mem_block_t* tb_pP, + uint8_t* first_byte_pP, + uint16_t tb_size_in_bytesP) //----------------------------------------------------------------------------- { // 5.1.3.2 Receive operations @@ -315,25 +341,25 @@ void rlc_am_receive_process_data_pdu (rlc_am_entity_t * const rlc_pP, const cons rlc_am_pdu_info_t* pdu_info_p = &((rlc_am_rx_pdu_management_t*)(tb_pP->data))->pdu_info; rlc_am_pdu_sn_10_t* rlc_am_pdu_sn_10_p = (rlc_am_pdu_sn_10_t*)first_byte_pP; - if (rlc_am_get_data_pdu_infos(frameP,rlc_am_pdu_sn_10_p, tb_size_in_bytesP, pdu_info_p) >= 0) { + if (rlc_am_get_data_pdu_infos(ctxt_pP,rlc_am_pdu_sn_10_p, tb_size_in_bytesP, pdu_info_p) >= 0) { ((rlc_am_rx_pdu_management_t*)(tb_pP->data))->all_segments_received = 0; - if (rlc_am_in_rx_window(rlc_pP, pdu_info_p->sn)) { + if (rlc_am_in_rx_window(ctxt_pP, rlc_pP, pdu_info_p->sn)) { if (pdu_info_p->p) { LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][PROCESS RX PDU] POLL BIT SET, STATUS REQUESTED:\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id); rlc_pP->status_requested = 1; } LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][PROCESS RX PDU] VR(R) %04d VR(H) %04d VR(MR) %04d VR(MS) %04d VR(X) %04d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, rlc_pP->vr_r, rlc_pP->vr_h, @@ -341,24 +367,24 @@ void rlc_am_receive_process_data_pdu (rlc_am_entity_t * const rlc_pP, const cons rlc_pP->vr_ms, rlc_pP->vr_x); - if (rlc_am_rx_list_insert_pdu(rlc_pP, frameP,tb_pP) < 0) { + if (rlc_am_rx_list_insert_pdu(ctxt_pP, rlc_pP,tb_pP) < 0) { rlc_pP->stat_rx_data_pdu_dropped += 1; rlc_pP->stat_rx_data_bytes_dropped += tb_size_in_bytesP; free_mem_block (tb_pP); LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][PROCESS RX PDU] PDU DISCARDED, STATUS REQUESTED:\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id); rlc_pP->status_requested = 1; #if defined(RLC_STOP_ON_LOST_PDU) AssertFatal( 0 == 1, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u] LOST PDU DETECTED\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id); #endif } else { @@ -396,45 +422,45 @@ void rlc_am_receive_process_data_pdu (rlc_am_entity_t * const rlc_pP, const cons #ifdef TRACE_RLC_AM_RX LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][PROCESS RX PDU] RX LIST AFTER INSERTION:\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id); rlc_am_rx_list_display(rlc_pP, "rlc_am_receive_process_data_pdu AFTER INSERTION "); #endif - if (rlc_am_sn_gte_vr_h(rlc_pP, pdu_info_p->sn) > 0) { + if (rlc_am_sn_gte_vr_h(ctxt_pP, rlc_pP, pdu_info_p->sn) > 0) { rlc_pP->vr_h = (pdu_info_p->sn + 1) & RLC_AM_SN_MASK; } - rlc_am_rx_check_all_byte_segments(rlc_pP, frameP, tb_pP); + rlc_am_rx_check_all_byte_segments(ctxt_pP, rlc_pP, tb_pP); if ((pdu_info_p->sn == rlc_pP->vr_ms) && (((rlc_am_rx_pdu_management_t*)(tb_pP->data))->all_segments_received)) { - rlc_am_rx_update_vr_ms(rlc_pP, frameP, tb_pP); + rlc_am_rx_update_vr_ms(ctxt_pP, rlc_pP, tb_pP); } if (pdu_info_p->sn == rlc_pP->vr_r) { if (((rlc_am_rx_pdu_management_t*)(tb_pP->data))->all_segments_received) { - rlc_am_rx_update_vr_r(rlc_pP, frameP, tb_pP); + rlc_am_rx_update_vr_r(ctxt_pP, rlc_pP, tb_pP); rlc_pP->vr_mr = (rlc_pP->vr_r + RLC_AM_WINDOW_SIZE) & RLC_AM_SN_MASK; } - rlc_am_rx_list_reassemble_rlc_sdus(rlc_pP,frameP,eNB_flagP); + rlc_am_rx_list_reassemble_rlc_sdus(ctxt_pP, rlc_pP); } if (rlc_pP->t_reordering.running) { - if ((rlc_pP->vr_x == rlc_pP->vr_r) || ((rlc_am_in_rx_window(rlc_pP, pdu_info_p->sn) == 0) && (rlc_pP->vr_x != rlc_pP->vr_mr))) { - rlc_am_stop_and_reset_timer_reordering(rlc_pP,frameP); + if ((rlc_pP->vr_x == rlc_pP->vr_r) || ((rlc_am_in_rx_window(ctxt_pP, rlc_pP, pdu_info_p->sn) == 0) && (rlc_pP->vr_x != rlc_pP->vr_mr))) { + rlc_am_stop_and_reset_timer_reordering(ctxt_pP, rlc_pP); } } if (!(rlc_pP->t_reordering.running)) { if (rlc_pP->vr_h != rlc_pP->vr_r) { // - if VR (H) > VR(R) translated to - if VR (H) != VR(R) - rlc_am_start_timer_reordering(rlc_pP,frameP); + rlc_am_start_timer_reordering(ctxt_pP, rlc_pP); rlc_pP->vr_x = rlc_pP->vr_h; } } } LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][PROCESS RX PDU] VR(R) %04d VR(H) %04d VR(MS) %04d VR(MR) %04d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, rlc_pP->vr_r, rlc_pP->vr_h, @@ -445,10 +471,10 @@ void rlc_am_receive_process_data_pdu (rlc_am_entity_t * const rlc_pP, const cons rlc_pP->stat_rx_data_bytes_out_of_window += tb_size_in_bytesP; free_mem_block (tb_pP); LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][PROCESS RX PDU] PDU OUT OF RX WINDOW, DISCARDED, STATUS REQUESTED:\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id); rlc_pP->status_requested = 1; } diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_receiver.h b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_receiver.h index 3e6d254277af3b594b8679738ce6d28844f135ff..27b80ba14ddd82dec0c0dd5b6e043c6ed583dc02 100755 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_receiver.h +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_receiver.h @@ -56,60 +56,58 @@ # define public_rlc_am_receiver(x) extern x # endif # endif -/*! \fn signed int rlc_am_get_data_pdu_infos(const frame_t frameP, rlc_am_pdu_sn_10_t* headerP, int16_t sizeP, rlc_am_pdu_info_t* pdu_infoP) +/*! \fn signed int rlc_am_get_data_pdu_infos( const protocol_ctxt_t* const ctxt_pP, rlc_am_pdu_sn_10_t* headerP, int16_t sizeP, rlc_am_pdu_info_t* pdu_infoP) * \brief Extract PDU informations (header fields, data size, etc) from the serialized PDU. -* \param[in] frame Frame index. +* \param[in] ctxt_pP Running context. * \param[in] headerP RLC AM header PDU pointer. * \param[in] sizeP Size of RLC AM PDU. * \param[in] pdu_infoP Structure containing extracted informations from PDU. * \return 0 if no error was encountered during the parsing of the PDU, else -1; */ -protected_rlc_am_receiver( signed int rlc_am_get_data_pdu_infos(const frame_t frameP, rlc_am_pdu_sn_10_t* headerP, int16_t sizeP, rlc_am_pdu_info_t* pdu_infoP)); +protected_rlc_am_receiver( signed int rlc_am_get_data_pdu_infos(const protocol_ctxt_t* const ctxt_pP, rlc_am_pdu_sn_10_t* headerP, int16_t sizeP, rlc_am_pdu_info_t* pdu_infoP)); -/*! \fn void rlc_am_display_data_pdu_infos(rlc_am_entity_t * const rlc_pP, const frame_t frameP, rlc_am_pdu_info_t* pdu_infoP) +/*! \fn void rlc_am_display_data_pdu_infos(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t * const rlc_pP, rlc_am_pdu_info_t* pdu_infoP) * \brief Display RLC AM PDU informations. -* \param[in] rlc_pP RLC AM protocol instance pointer. -* \param[in] frame Frame index. +* \param[in] ctxt_pP Running context. +* \param[in] rlc_pP RLC AM protocol instance pointer. * \param[in] pdu_infoP Structure containing extracted informations of a PDU. */ -protected_rlc_am_receiver( void rlc_am_display_data_pdu_infos(rlc_am_entity_t * const rlc_pP, const frame_t frameP, rlc_am_pdu_info_t* pdu_infoP);) +protected_rlc_am_receiver( void rlc_am_display_data_pdu_infos(const protocol_ctxt_t* const ctxt_pP,rlc_am_entity_t * const rlc_pP, rlc_am_pdu_info_t* pdu_infoP);) -/*! \fn void rlc_am_rx_update_vr_ms(rlc_am_entity_t * const rlc_pP,mem_block_t* tb_pP) +/*! \fn void rlc_am_rx_update_vr_ms(const protocol_ctxt_t* const ctxt_pP,rlc_am_entity_t * const rlc_pP,mem_block_t* tb_pP) * \brief Update RLC AM protocol variable VR(MS). -* \param[in] rlc_pP RLC AM protocol instance pointer. -* \param[in] frame Frame index. -* \param[in] tb_pP PDU embedded in a mem_block_t struct. +* \param[in] ctxt_pP Running context. +* \param[in] rlc_pP RLC AM protocol instance pointer. +* \param[in] tb_pP PDU embedded in a mem_block_t struct. * \note It is assumed that the sequence number of the transport block is equal to VR(MS) */ -protected_rlc_am_receiver( void rlc_am_rx_update_vr_ms(rlc_am_entity_t * const rlc_pP,const frame_t frameP, mem_block_t* tb_pP);) +protected_rlc_am_receiver( void rlc_am_rx_update_vr_ms(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t * const rlc_pP, mem_block_t* tb_pP);) -/*! \fn void rlc_am_rx_update_vr_r (rlc_am_entity_t * const rlc_pP,const frame_t frameP,mem_block_t* tb_pP) +/*! \fn void rlc_am_rx_update_vr_r (const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t * const rlc_pP,mem_block_t* tb_pP) * \brief Update RLC AM protocol variable VR(R). -* \param[in] rlc_pP RLC AM protocol instance pointer. -* \param[in] frame Frame index. -* \param[in] tb_pP PDU embedded in a mem_block_t struct. +* \param[in] ctxt_pP Running context. +* \param[in] rlc_pP RLC AM protocol instance pointer. +* \param[in] tb_pP PDU embedded in a mem_block_t struct. * \note It is assumed that the sequence number of the transport block is equal to VR(R) */ -protected_rlc_am_receiver( void rlc_am_rx_update_vr_r (rlc_am_entity_t * const rlc_pP,const frame_t frameP, mem_block_t* tb_pP);) +protected_rlc_am_receiver( void rlc_am_rx_update_vr_r (const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t * const rlc_pP, mem_block_t* tb_pP);) -/*! \fn void rlc_am_receive_routing (rlc_am_entity_t * const rlc_pP, const frame_t frameP, uint8_t eNB_flagP, struct mac_data_ind data_indP) +/*! \fn void rlc_am_receive_routing (const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t * const rlc_pP, struct mac_data_ind data_indP) * \brief Convert transport blocks received from MAC layer into RLC AM PDUs, and dispatch to the right processing block these PDUS upon their type (CONTROL/DATA). -* \param[in] rlc_pP RLC AM protocol instance pointer. -* \param[in] frame Frame index. -* \param[in] eNB_flagP Flag to indicate eNB (1) or UE (0). +* \param[in] ctxt_pP Running context. +* \param[in] rlc_pP RLC AM protocol instance pointer. * \param[in] data_indP Transport blocks received from MAC layer. */ -protected_rlc_am_receiver( void rlc_am_receive_routing (rlc_am_entity_t * const rlc_pP, const frame_t frameP, const eNB_flag_t eNB_flagP, struct mac_data_ind data_indP)); +protected_rlc_am_receiver( void rlc_am_receive_routing (const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t * const rlc_pP, struct mac_data_ind data_indP)); -/*! \fn void rlc_am_receive_process_data_pdu (rlc_am_entity_t * const rlc_pP, const frame_t frameP, uint8_t eNB_flagP, mem_block_t* tb_pP, uint8_t* first_byteP, uint16_t tb_size_in_bytesP) +/*! \fn void rlc_am_receive_process_data_pdu (const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t * const rlc_pP, mem_block_t* tb_pP, uint8_t* first_byteP, uint16_t tb_size_in_bytesP) * \brief Process an incoming data PDU received from MAC layer. +* \param[in] ctxt_pP Running context. * \param[in] rlc_pP RLC AM protocol instance pointer. -* \param[in] frame Frame index. -* \param[in] eNB_flagP Flag to indicate eNB (1) or UE (0). * \param[in] tb_pP PDU embedded in a mem_block_t struct. * \param[in] first_byteP Pointer on first byte of the PDU. * \param[in] tb_size_in_bytesP Transport block size in bytes (same as PDU size in bytes). */ -private_rlc_am_receiver( void rlc_am_receive_process_data_pdu (rlc_am_entity_t * const rlc_pP, const frame_t frameP, const eNB_flag_t eNB_flagP, mem_block_t* tb_pP, uint8_t* first_byteP, uint16_t tb_size_in_bytesP)); +private_rlc_am_receiver( void rlc_am_receive_process_data_pdu (const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t * const rlc_pP, mem_block_t* tb_pP, uint8_t* first_byteP, uint16_t tb_size_in_bytesP)); /** @} */ # endif diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_retransmit.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_retransmit.c index 977aa26f1d66bc95d6dcd7f7d2fd1db6871da630..a619f7745c957f25cc4183757e57235f55bff059 100755 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_retransmit.c +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_retransmit.c @@ -41,8 +41,8 @@ //#define TRACE_RLC_AM_ACK //----------------------------------------------------------------------------- void rlc_am_nack_pdu ( + const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t *const rlc_pP, - const frame_t frameP, const rlc_sn_t snP, const sdu_size_t so_startP, const sdu_size_t so_endP) @@ -74,25 +74,25 @@ void rlc_am_nack_pdu ( // increasing order among calls refering to only one status PDU // and among time //----------------------------------------- - if (rlc_pP->pdu_retrans_buffer[snP].last_nack_time != frameP) { - rlc_pP->pdu_retrans_buffer[snP].last_nack_time = frameP; - rlc_am_clear_holes(rlc_pP, snP); + if (rlc_pP->pdu_retrans_buffer[snP].last_nack_time != ctxt_pP->frame) { + rlc_pP->pdu_retrans_buffer[snP].last_nack_time = ctxt_pP->frame; + rlc_am_clear_holes(ctxt_pP, rlc_pP, snP); } if (!((so_startP == 0) && (so_endP == 0x7FFF))) { rlc_pP->num_nack_so += 1; } - rlc_am_add_hole(rlc_pP, frameP, snP, so_startP, so_endP); + rlc_am_add_hole(ctxt_pP, rlc_pP, snP, so_startP, so_endP); if (rlc_pP->first_retrans_pdu_sn < 0) { rlc_pP->first_retrans_pdu_sn = snP; - } else if (rlc_am_tx_sn1_gt_sn2(rlc_pP, rlc_pP->first_retrans_pdu_sn, snP)){ + } else if (rlc_am_tx_sn1_gt_sn2(ctxt_pP, rlc_pP, rlc_pP->first_retrans_pdu_sn, snP)){ rlc_pP->first_retrans_pdu_sn = snP; } LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][NACK-PDU] NACK PDU SN %04d previous retx_count %d 1ST_RETRANS_PDU %04d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, snP, rlc_pP->pdu_retrans_buffer[snP].retx_count, @@ -116,20 +116,20 @@ void rlc_am_nack_pdu ( #ifdef TEST_RLC_AM rlc_am_v9_3_0_test_data_conf (rlc_pP->module_id, rlc_pP->rb_id, rlc_pP->input_sdus[sdu_index].mui, RLC_SDU_CONFIRM_NO); #else - rlc_data_conf(rlc_pP->enb_module_id, rlc_pP->ue_module_id, frameP, rlc_pP->is_enb, rlc_pP->rb_id, rlc_pP->input_sdus[sdu_index].mui, RLC_SDU_CONFIRM_NO, rlc_pP->is_data_plane); + rlc_data_conf(ctxt_pP, rlc_pP->rb_id, rlc_pP->input_sdus[sdu_index].mui, RLC_SDU_CONFIRM_NO, rlc_pP->is_data_plane); #endif rlc_pP->stat_tx_pdcp_sdu_discarded += 1; rlc_pP->stat_tx_pdcp_bytes_discarded += rlc_pP->input_sdus[sdu_index].sdu_size; - rlc_am_free_in_sdu(rlc_pP, frameP, sdu_index); + rlc_am_free_in_sdu(ctxt_pP, rlc_pP, sdu_index); } } } } else { LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][NACK-PDU] ERROR NACK MISSING PDU SN %05d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, snP); //assert(2==3); @@ -137,9 +137,9 @@ void rlc_am_nack_pdu ( } //----------------------------------------------------------------------------- void rlc_am_ack_pdu ( - rlc_am_entity_t *const rlc_pP, - const frame_t frameP, - const rlc_sn_t snP) + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t *const rlc_pP, + const rlc_sn_t snP) //----------------------------------------------------------------------------- { mem_block_t* mb_p = rlc_pP->pdu_retrans_buffer[snP].mem_block; @@ -153,10 +153,10 @@ void rlc_am_ack_pdu ( free_mem_block(mb_p); rlc_pP->pdu_retrans_buffer[snP].mem_block = NULL; LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][ACK-PDU] ACK PDU SN %05d previous retx_count %d \n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, snP, rlc_pP->pdu_retrans_buffer[snP].retx_count); @@ -182,16 +182,13 @@ void rlc_am_ack_pdu ( RLC_SDU_CONFIRM_YES); #else rlc_data_conf( - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, - frameP, - rlc_pP->is_enb, + ctxt_pP, rlc_pP->rb_id, rlc_pP->input_sdus[sdu_index].mui, RLC_SDU_CONFIRM_YES, rlc_pP->is_data_plane); #endif - rlc_am_free_in_sdu(rlc_pP, frameP, sdu_index); + rlc_am_free_in_sdu(ctxt_pP, rlc_pP, sdu_index); } } // 7.1... @@ -213,10 +210,10 @@ void rlc_am_ack_pdu ( rlc_pP->vt_ms = (rlc_pP->vt_a + RLC_AM_WINDOW_SIZE) & RLC_AM_SN_MASK; LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][ACK-PDU] UPDATED VT(A) %04d VT(MS) %04d VT(S) %04d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, rlc_pP->vt_a, rlc_pP->vt_ms, @@ -227,10 +224,10 @@ void rlc_am_ack_pdu ( rlc_pP->first_retrans_pdu_sn = (rlc_pP->first_retrans_pdu_sn + 1) & RLC_AM_SN_MASK; if (rlc_pP->pdu_retrans_buffer[rlc_pP->first_retrans_pdu_sn].retx_count >= 0) { LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][ACK-PDU] UPDATED first_retrans_pdu_sn -> %04d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, rlc_pP->first_retrans_pdu_sn); break; @@ -239,20 +236,20 @@ void rlc_am_ack_pdu ( if (rlc_pP->vt_s == rlc_pP->first_retrans_pdu_sn) { rlc_pP->first_retrans_pdu_sn = -1; LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][ACK-PDU] UPDATED first_retrans_pdu_sn -> %04d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, rlc_pP->first_retrans_pdu_sn); } } } else { LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][ACK-PDU] WARNING ACK PDU SN %05d -> NO PDU TO ACK\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, snP); if (mb_p != NULL) { @@ -272,10 +269,10 @@ void rlc_am_ack_pdu ( rlc_pP->vt_ms = (rlc_pP->vt_a + RLC_AM_WINDOW_SIZE) & RLC_AM_SN_MASK; LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][ACK-PDU] UPDATED VT(A) %04d VT(MS) %04d VT(S) %04d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, rlc_pP->vt_a, rlc_pP->vt_ms, @@ -286,9 +283,9 @@ void rlc_am_ack_pdu ( } //----------------------------------------------------------------------------- mem_block_t* rlc_am_retransmit_get_copy ( - rlc_am_entity_t *const rlc_pP, - const frame_t frameP, - const rlc_sn_t snP) + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t *const rlc_pP, + const rlc_sn_t snP) //----------------------------------------------------------------------------- { mem_block_t* mb_original_p = rlc_pP->pdu_retrans_buffer[snP].mem_block; @@ -305,7 +302,7 @@ mem_block_t* rlc_am_retransmit_get_copy ( pdu_mngt->flags.retransmit = 0; - rlc_am_pdu_polling(rlc_pP, frameP, pdu_p, pdu_mngt->payload_size); + rlc_am_pdu_polling(ctxt_pP, rlc_pP, pdu_p, pdu_mngt->payload_size); return mb_copy; } else { return NULL; @@ -313,10 +310,10 @@ mem_block_t* rlc_am_retransmit_get_copy ( } //----------------------------------------------------------------------------- mem_block_t* rlc_am_retransmit_get_subsegment( - rlc_am_entity_t *const rlc_pP, - const frame_t frameP, - const rlc_sn_t snP, - sdu_size_t * const sizeP /* in-out*/) + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t *const rlc_pP, + const rlc_sn_t snP, + sdu_size_t * const sizeP /* in-out*/) //----------------------------------------------------------------------------- { @@ -376,19 +373,19 @@ mem_block_t* rlc_am_retransmit_get_subsegment( ((struct mac_tb_req*)(mb_sub_segment_p->data))->data_ptr = (uint8_t*)&(mb_sub_segment_p->data[sizeof(struct mac_tb_req)]); - if (rlc_am_get_data_pdu_infos(frameP,pdu_original_p, rlc_pP->pdu_retrans_buffer[snP].header_and_payload_size, &pdu_info) >= 0) { + if (rlc_am_get_data_pdu_infos(ctxt_pP,pdu_original_p, rlc_pP->pdu_retrans_buffer[snP].header_and_payload_size, &pdu_info) >= 0) { int li_index = 0; int start_offset = rlc_pP->pdu_retrans_buffer[snP].nack_so_start; int stop_offset = rlc_pP->pdu_retrans_buffer[snP].nack_so_stop; LOG_D(RLC, "\n[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][RE-SEGMENT] ORIGINAL PDU SN %04d:\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, snP); - rlc_am_display_data_pdu_infos(rlc_pP, frameP,&pdu_info); + rlc_am_display_data_pdu_infos(ctxt_pP, rlc_pP, &pdu_info); // all 15 bits set to 1 (indicate that the missing portion of the AMD PDU includes all bytes // to the last byte of the AMD PDU) @@ -396,10 +393,10 @@ mem_block_t* rlc_am_retransmit_get_subsegment( rlc_pP->pdu_retrans_buffer[snP].nack_so_stop = rlc_pP->pdu_retrans_buffer[snP].payload_size - 1; stop_offset = rlc_pP->pdu_retrans_buffer[snP].nack_so_stop; LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][RE-SEGMENT] UPDATED RETRANS PDU SN %04d nack_so_stop FROM 0x7FFF to %05d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, snP, stop_offset); } @@ -446,32 +443,32 @@ mem_block_t* rlc_am_retransmit_get_subsegment( //------------------------------------------------------- // set MAX payload size that can be copied // first constraint : the size of the hole to retransmit - rlc_am_get_next_hole(rlc_pP, frameP, snP, &start_offset, &stop_offset); + rlc_am_get_next_hole(ctxt_pP, rlc_pP, snP, &start_offset, &stop_offset); max_copy_payload_size = stop_offset - start_offset + 1; assert(max_copy_payload_size > 0); assert(test_pdu_remaining_size > 0); LOG_T(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][RE-SEGMENT] HOLE FOUND SO %d -> %d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, start_offset, stop_offset); LOG_T(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][RE-SEGMENT] ORIGINAL FI %d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, (pdu_original_p->b1 & 0x18) >> 3); // second constraint the size of the pdu_p requested by MAC layer if (max_copy_payload_size > test_pdu_remaining_size) { LOG_T(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][RE-SEGMENT] CUT max_copy_payload_size with test_pdu_remaining_size %d -> %d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, max_copy_payload_size, test_pdu_remaining_size); @@ -487,26 +484,26 @@ mem_block_t* rlc_am_retransmit_get_subsegment( //.find the li corresponding to the nack_so_start (start_offset) if (pdu_info.num_li > 0) { LOG_T(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][RE-SEGMENT] ORIGINAL NUM LI %d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, pdu_info.num_li); while ((li_index < pdu_info.num_li) && (continue_fill_pdu_with_pdu)) { LOG_T(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][RE-SEGMENT] FIND LI %d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, pdu_info.li_list[li_index]); if (max_copy_payload_size > test_pdu_remaining_size) { LOG_T(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][RE-SEGMENT] CUT max_copy_payload_size with test_pdu_remaining_size %d -> %d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, max_copy_payload_size, test_pdu_remaining_size); @@ -521,35 +518,35 @@ mem_block_t* rlc_am_retransmit_get_subsegment( if (test_start_offset < test_li_sum) { LOG_T(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][RE-SEGMENT] test_start_offset < test_li_sum %d < %d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, test_start_offset, test_li_sum); /*if (test_max_copy_payload_size > (test_li_sum - test_start_offset)) { #ifdef TRACE_RLC_AM_RESEGMENT - LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][RE-SEGMENT] CUT test_max_copy_payload_size with test_li_sum - test_start_offset %d -> %d\n",frameP, rlc_pP->module_id, rlc_pP->rb_id, test_max_copy_payload_size, test_li_sum - test_start_offset); + LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][RE-SEGMENT] CUT test_max_copy_payload_size with test_li_sum - test_start_offset %d -> %d\n",ctxt_pP->frame, rlc_pP->module_id, rlc_pP->rb_id, test_max_copy_payload_size, test_li_sum - test_start_offset); #endif test_max_copy_payload_size = test_li_sum - test_start_offset; }*/ if ((max_copy_payload_size + test_start_offset) < test_li_sum) { LOG_T(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][RE-SEGMENT] (max_copy_payload_size %d + test_start_offset %d) < test_li_sum %d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, max_copy_payload_size, test_start_offset, test_li_sum); LOG_T(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][RE-SEGMENT] COPY SO %d -> %d %d BYTES\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, test_start_offset , test_start_offset + max_copy_payload_size - 1, @@ -563,18 +560,18 @@ mem_block_t* rlc_am_retransmit_get_subsegment( } else if ((max_copy_payload_size + test_start_offset) == test_li_sum) { LOG_T(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][RE-SEGMENT] (max_copy_payload_size + test_start_offset) == test_li_sum %d == %d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, (max_copy_payload_size + test_start_offset) , test_li_sum); LOG_T(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][RE-SEGMENT] COPY SO %d -> %d %d BYTES\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, test_start_offset , test_start_offset + max_copy_payload_size - 1, @@ -588,19 +585,19 @@ mem_block_t* rlc_am_retransmit_get_subsegment( } else if ((max_copy_payload_size + test_start_offset - (test_li_length_in_bytes ^ 3)) > test_li_sum) { LOG_T(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][RE-SEGMENT] (max_copy_payload_size + test_start_offset - (test_li_length_in_bytes ^ 3)) > test_li_sum %d > %d\n SET LI %d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, (max_copy_payload_size + test_start_offset) + (test_li_length_in_bytes ^ 3), test_li_sum, test_li_sum - test_start_offset); LOG_T(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][RE-SEGMENT] COPY SO %d -> %d %d BYTES\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, test_start_offset , test_li_sum - 1, @@ -615,10 +612,10 @@ mem_block_t* rlc_am_retransmit_get_subsegment( max_copy_payload_size = max_copy_payload_size - test_li_sum + test_start_offset - test_li_length_in_bytes; LOG_T(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][RE-SEGMENT] NOW max_copy_payload_size %d BYTES test_start_offset %d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, max_copy_payload_size, test_li_sum); @@ -628,18 +625,18 @@ mem_block_t* rlc_am_retransmit_get_subsegment( } else { LOG_T(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][RE-SEGMENT] (test_max_copy_payload_size + test_start_offset ) > test_li_sum %d > %d\n NO REMAINING SIZE FOR LI", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, (max_copy_payload_size + test_start_offset), test_li_sum); LOG_T(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][RE-SEGMENT] COPY SO %d -> %d %d BYTES\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, test_start_offset , test_li_sum - 1, @@ -659,10 +656,10 @@ mem_block_t* rlc_am_retransmit_get_subsegment( // and it cant be the first data field of the original PDU } else if (test_start_offset == test_li_sum) { LOG_T(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][RE-SEGMENT] (test_start_offset == test_li_sum) %d == %d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, test_start_offset , test_li_sum); @@ -680,10 +677,10 @@ mem_block_t* rlc_am_retransmit_get_subsegment( if (max_copy_payload_size > test_pdu_remaining_size) { LOG_T(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][RE-SEGMENT] TRYING HIDDEN SIZE...CUT max_copy_payload_size with test_pdu_remaining_size %d -> %d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, max_copy_payload_size, test_pdu_remaining_size); @@ -693,10 +690,10 @@ mem_block_t* rlc_am_retransmit_get_subsegment( if ((max_copy_payload_size + test_start_offset) >= (pdu_info.hidden_size + test_li_sum)) { test_pdu_copy_size += (pdu_info.hidden_size + test_li_sum - test_start_offset); LOG_T(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][RE-SEGMENT] COPYING WHOLE REMAINING SIZE %d (max_copy_payload_size %d, test_start_offset %d, pdu_info.hidden_size %d test_li_sum %d test_pdu_copy_size %d)\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, pdu_info.hidden_size + test_li_sum - test_start_offset, max_copy_payload_size, @@ -708,10 +705,10 @@ mem_block_t* rlc_am_retransmit_get_subsegment( not_test_fi = (not_test_fi & 0x2) | (not_fi_original & 0x1); // set b0 idendical to the b0 of the non segmented PDU } else { LOG_T(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][RE-SEGMENT] COPYING REMAINING SIZE %d (/%d)\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, max_copy_payload_size, pdu_info.hidden_size); @@ -722,10 +719,10 @@ mem_block_t* rlc_am_retransmit_get_subsegment( } } else { // num_li == 0 LOG_T(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][RE-SEGMENT] (num_li == 0)\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id); test_pdu_copy_size = max_copy_payload_size; if ((stop_offset == (start_offset + max_copy_payload_size - 1)) && (stop_offset == rlc_pP->pdu_retrans_buffer[snP].payload_size - 1)) { @@ -774,19 +771,19 @@ mem_block_t* rlc_am_retransmit_get_subsegment( *sizeP = *sizeP - 1; } LOG_T(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][RE-SEGMENT] ADD LI %d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, test_li_list[fill_num_li]); } } else { LOG_T(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][RE-SEGMENT] ADD NO LI\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id); fill_payload_p = (uint8_t*)e_li_sub_segment; } @@ -806,10 +803,10 @@ mem_block_t* rlc_am_retransmit_get_subsegment( rlc_pP->pdu_retrans_buffer[snP].flags.retransmit = 0; LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][RE-SEGMENT] RE-SEND DATA PDU SN %04d SO %d %d BYTES PAYLOAD %d BYTES LSF!\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, snP, start_offset, @@ -818,10 +815,10 @@ mem_block_t* rlc_am_retransmit_get_subsegment( } else { LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][RE-SEGMENT] RE-SEND DATA PDU SN %04d SO %d %d BYTES PAYLOAD %d BYTES\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, snP, start_offset, @@ -836,13 +833,13 @@ mem_block_t* rlc_am_retransmit_get_subsegment( //--------------------------------------------------------------- // update nack_so_start //--------------------------------------------------------------- - rlc_am_remove_hole(rlc_pP, frameP, snP, start_offset, test_pdu_copy_size+start_offset - 1); + rlc_am_remove_hole(ctxt_pP, rlc_pP, snP, start_offset, test_pdu_copy_size+start_offset - 1); //rlc_pP->pdu_retrans_buffer[snP].nack_so_start = rlc_pP->pdu_retrans_buffer[snP].nack_so_start + test_pdu_copy_size; LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][RE-SEGMENT] RE-SEND DATA PDU SN %04d NOW nack_so_start %d nack_so_stop %d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, snP, rlc_pP->pdu_retrans_buffer[snP].nack_so_start, @@ -853,22 +850,22 @@ mem_block_t* rlc_am_retransmit_get_subsegment( }*/ } else { LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][RE-SEGMENT] COULD NOT GET INFO FOR DATA PDU SN %04d -> RETURN NULL\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, snP); return NULL; } - rlc_am_pdu_polling(rlc_pP, frameP, pdu_sub_segment_p, test_pdu_copy_size); + rlc_am_pdu_polling(ctxt_pP, rlc_pP, pdu_sub_segment_p, test_pdu_copy_size); return mb_sub_segment_p; } else { LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][RE-SEGMENT] RE-SEND DATA PDU SN %04d BUT NO PDU AVAILABLE -> RETURN NULL\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, snP); assert(3==4); @@ -877,9 +874,9 @@ mem_block_t* rlc_am_retransmit_get_subsegment( } //----------------------------------------------------------------------------- void rlc_am_tx_buffer_display ( - rlc_am_entity_t* const rlc_pP, - const frame_t frameP, - char* const message_pP) + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t* const rlc_pP, + char* const message_pP) //----------------------------------------------------------------------------- { rlc_sn_t sn = rlc_pP->vt_a; @@ -887,20 +884,20 @@ void rlc_am_tx_buffer_display ( if (message_pP) { LOG_D(RLC, "\n[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u] Retransmission buffer %s VT(A)=%04d VT(S)=%04d:", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, message_pP, rlc_pP->vt_a, rlc_pP->vt_s); } else { LOG_D(RLC, "\n[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u] Retransmission buffer VT(A)=%04d VT(S)=%04d:", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, rlc_pP->vt_a, rlc_pP->vt_s); @@ -932,8 +929,8 @@ void rlc_am_tx_buffer_display ( } //----------------------------------------------------------------------------- void rlc_am_retransmit_any_pdu( - rlc_am_entity_t* const rlc_pP, - const frame_t frameP) + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t* const rlc_pP) //----------------------------------------------------------------------------- { rlc_sn_t sn = (rlc_pP->vt_s - 1) & RLC_AM_SN_MASK; @@ -944,10 +941,10 @@ void rlc_am_retransmit_any_pdu( rlc_am_pdu_sn_10_t* pdu_sn_10_p = NULL; LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][FORCE-TRAFFIC] rlc_am_retransmit_any_pdu()\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id); while (sn != sn_end) { if (rlc_pP->pdu_retrans_buffer[sn].mem_block != NULL) { @@ -957,21 +954,21 @@ void rlc_am_retransmit_any_pdu( } if (rlc_pP->pdu_retrans_buffer[sn].header_and_payload_size <= rlc_pP->nb_bytes_requested_by_mac) { LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][FORCE-TRAFFIC] RE-SEND DATA PDU SN %04d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, sn); - rlc_am_nack_pdu (rlc_pP, frameP, sn, 0, 0x7FFF); + rlc_am_nack_pdu (ctxt_pP, rlc_pP, sn, 0, 0x7FFF); // no need for update rlc_pP->nb_bytes_requested_by_mac - pdu_p = rlc_am_retransmit_get_copy(rlc_pP, frameP, sn); + pdu_p = rlc_am_retransmit_get_copy(ctxt_pP, rlc_pP, sn); pdu_sn_10_p = (rlc_am_pdu_sn_10_t*) (&pdu_p->data[sizeof(struct mac_tb_req)]); - rlc_am_pdu_polling(rlc_pP, frameP, pdu_sn_10_p, rlc_pP->pdu_retrans_buffer[sn].header_and_payload_size); + rlc_am_pdu_polling(ctxt_pP, rlc_pP, pdu_sn_10_p, rlc_pP->pdu_retrans_buffer[sn].header_and_payload_size); pdu_sn_10_p->b1 = pdu_sn_10_p->b1 | 0x20; rlc_pP->c_pdu_without_poll = 0; rlc_pP->c_byte_without_poll = 0; //rlc_pP->poll_sn = (rlc_pP->vt_s -1) & RLC_AM_SN_MASK; - rlc_am_start_timer_poll_retransmit(rlc_pP,frameP); + rlc_am_start_timer_poll_retransmit(ctxt_pP, rlc_pP); rlc_pP->stat_tx_data_pdu += 1; rlc_pP->stat_tx_retransmit_pdu += 1; rlc_pP->stat_tx_data_bytes += ((struct mac_tb_req*)(pdu_p->data))->tb_size; @@ -986,22 +983,22 @@ void rlc_am_retransmit_any_pdu( // so re-segment a pdu_p if possible if (found_pdu) { LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][FORCE-TRAFFIC] SEND SEGMENT OF DATA PDU SN %04d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, found_pdu_sn); if (rlc_pP->nb_bytes_requested_by_mac > 4) { - rlc_am_nack_pdu (rlc_pP, frameP, found_pdu_sn, 0, 0x7FFF); - pdu_p = rlc_am_retransmit_get_subsegment(rlc_pP, frameP, found_pdu_sn, &rlc_pP->nb_bytes_requested_by_mac); + rlc_am_nack_pdu (ctxt_pP, rlc_pP, found_pdu_sn, 0, 0x7FFF); + pdu_p = rlc_am_retransmit_get_subsegment(ctxt_pP, rlc_pP, found_pdu_sn, &rlc_pP->nb_bytes_requested_by_mac); pdu_sn_10_p = (rlc_am_pdu_sn_10_t*) (&pdu_p->data[sizeof(struct mac_tb_req)]); - rlc_am_pdu_polling(rlc_pP, frameP, pdu_sn_10_p, rlc_pP->pdu_retrans_buffer[found_pdu_sn].header_and_payload_size); + rlc_am_pdu_polling(ctxt_pP, rlc_pP, pdu_sn_10_p, rlc_pP->pdu_retrans_buffer[found_pdu_sn].header_and_payload_size); pdu_sn_10_p->b1 = pdu_sn_10_p->b1 | 0x20; rlc_pP->c_pdu_without_poll = 0; rlc_pP->c_byte_without_poll = 0; //rlc_pP->poll_sn = (rlc_pP->vt_s -1) & RLC_AM_SN_MASK; - rlc_am_start_timer_poll_retransmit(rlc_pP,frameP); + rlc_am_start_timer_poll_retransmit(ctxt_pP, rlc_pP); rlc_pP->stat_tx_data_pdu += 1; rlc_pP->stat_tx_retransmit_pdu += 1; rlc_pP->stat_tx_data_bytes += ((struct mac_tb_req*)(pdu_p->data))->tb_size; @@ -1010,10 +1007,10 @@ void rlc_am_retransmit_any_pdu( return; } else { LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][FORCE-TRAFFIC] ... BUT NOT ENOUGH BYTES ALLOWED BY MAC %0d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, rlc_pP->nb_bytes_requested_by_mac); } diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_retransmit.h b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_retransmit.h index caefa359825a58a12dfc528e685152e0da716006..bae78809ad65f1f961e786cd7f8c6883e08c5609 100755 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_retransmit.h +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_retransmit.h @@ -57,78 +57,78 @@ # define public_rlc_am_retransmit(x) extern x # endif # endif -/*! \fn void rlc_am_nack_pdu (rlc_am_entity_t *rlcP, frame_t frameP, uint16_t snP, sdu_size_t so_startP, sdu_size_t so_endP) +/*! \fn void rlc_am_nack_pdu (const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t *rlcP, uint16_t snP, sdu_size_t so_startP, sdu_size_t so_endP) * \brief The RLC AM PDU which have the sequence number snP is marked NACKed with segment offset fields. +* \param[in] ctxtP Running context. * \param[in] rlcP RLC AM protocol instance pointer. -* \param[in] frameP Frame index. * \param[in] snP Sequence number of the PDU that is negative acknowledged. * \param[in] so_startP Start of the segment offset of the PDU that . * \param[in] so_endP Transport blocks received from MAC layer. * \note It may appear a new hole in the retransmission buffer depending on the segment offset informations. Depending on the state of the retransmission buffer, negative confirmation can be sent to higher layers about the drop by the RLC AM instance of a particular SDU. */ protected_rlc_am_retransmit(void rlc_am_nack_pdu ( - rlc_am_entity_t *const rlcP, - const frame_t frameP, - const rlc_sn_t snP, - const sdu_size_t so_startP, - const sdu_size_t so_endP);) + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t *const rlcP, + const rlc_sn_t snP, + const sdu_size_t so_startP, + const sdu_size_t so_endP);) -/*! \fn void rlc_am_ack_pdu (rlc_am_entity_t *rlcP, frame_t frameP, rlc_sn_t snP) +/*! \fn void rlc_am_ack_pdu (const protocol_ctxt_t* const ctxt_pP,rlc_am_entity_t *rlcP, rlc_sn_t snP) * \brief The RLC AM PDU which have the sequence number snP is marked ACKed. +* \param[in] ctxtP Running context. * \param[in] rlcP RLC AM protocol instance pointer. -* \param[in] frameP Frame index. * \param[in] snP Sequence number of the PDU that is acknowledged. * \note Depending on the state of the retransmission buffer, positive confirmation can be sent to higher layers about the receiving by the peer RLC AM instance of a particular SDU. */ protected_rlc_am_retransmit(void rlc_am_ack_pdu ( - rlc_am_entity_t *const rlcP, - const frame_t frameP, - const rlc_sn_t snP);) + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t *const rlcP, + const rlc_sn_t snP);) -/*! \fn mem_block_t* rlc_am_retransmit_get_copy (rlc_am_entity_t *rlcP, frame_t frameP, rlc_sn_t snP) +/*! \fn mem_block_t* rlc_am_retransmit_get_copy (const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t *rlcP, rlc_sn_t snP) * \brief The RLC AM PDU which have the sequence number snP is marked ACKed. +* \param[in] ctxtP Running context. * \param[in] rlcP RLC AM protocol instance pointer. -* \param[in] frameP Frame index. * \param[in] snP Sequence number of the PDU to be copied. * \return A copy of the PDU having sequence number equal to parameter snP. */ protected_rlc_am_retransmit(mem_block_t* rlc_am_retransmit_get_copy ( - rlc_am_entity_t *const rlcP, - const frame_t frameP, - const rlc_sn_t snP)); + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t *const rlcP, + const rlc_sn_t snP)); -/*! \fn mem_block_t* rlc_am_retransmit_get_subsegment (rlc_am_entity_t *rlcP, frame_t frameP, rlc_sn_t snP, sdu_size_t *sizeP) +/*! \fn mem_block_t* rlc_am_retransmit_get_subsegment (const protocol_ctxt_t* const ctxt_pP,rlc_am_entity_t *rlcP,rlc_sn_t snP, sdu_size_t *sizeP) * \brief The RLC AM PDU which have the sequence number snP is marked ACKed. +* \param[in] ctxtP Running context. * \param[in] rlcP RLC AM protocol instance pointer. -* \param[in] frameP Frame index * \param[in] snP Sequence number of the PDU to be copied. * \param[in,out] sizeP Maximum size allowed for the subsegment, it is updated with the amount of bytes not used (sizeP[out] = sizeP[in] - size of segment). * \return A copy of a segment of the PDU having sequence number equal to parameter snP. */ protected_rlc_am_retransmit(mem_block_t* rlc_am_retransmit_get_subsegment ( - rlc_am_entity_t *const rlcP, - const frame_t frameP, - const rlc_sn_t snP, - sdu_size_t *const sizeP)); + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t *const rlcP, + const rlc_sn_t snP, + sdu_size_t *const sizeP)); -/*! \fn void rlc_am_retransmit_any_pdu(rlc_am_entity_t* rlcP,frame_t frameP) +/*! \fn void rlc_am_retransmit_any_pdu(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* rlcP) * \brief Retransmit any PDU in order to unblock peer entity, if no suitable PDU is found (depending on requested MAC size) to be retransmitted, then try to retransmit a subsegment of any PDU. +* \param[in] ctxtP Running context. * \param[in] rlcP RLC AM protocol instance pointer. -* \param[in] frameP Frame index. */ protected_rlc_am_retransmit(void rlc_am_retransmit_any_pdu( - rlc_am_entity_t* const rlcP, - const frame_t frameP);) + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t* const rlcP);) -/*! \fn void rlc_am_tx_buffer_display (rlc_am_entity_t* rlcP, frame_t frameP, char* message_pP) +/*! \fn void rlc_am_tx_buffer_display (const protocol_ctxt_t* const ctxt_pP,rlc_am_entity_t* rlcP, char* message_pP) * \brief Display the dump of the retransmission buffer. +* \param[in] ctxtP Running context. * \param[in] rlcP RLC AM protocol instance pointer. -* \param[in] frameP Frame index. * \param[in] message_pP Message to be displayed along with the display of the dump of the retransmission buffer. */ protected_rlc_am_retransmit(void rlc_am_tx_buffer_display ( - rlc_am_entity_t* const rlcP, - const frame_t frameP, - char* const message_pP);) + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t* const rlcP, + char* const message_pP);) /** @} */ # endif diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_rx_list.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_rx_list.c index a7524ce1ab01b436f6cbcbb315772e33c418487a..3e1d1e7690f557d40714937af7145b47b577c520 100755 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_rx_list.c +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_rx_list.c @@ -44,7 +44,11 @@ // returns 0 if success // returns neg value if failure //----------------------------------------------------------------------------- -signed int rlc_am_rx_list_insert_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP, mem_block_t* tb_pP) +signed int +rlc_am_rx_list_insert_pdu( + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t* const rlc_pP, + mem_block_t* const tb_pP) //----------------------------------------------------------------------------- { rlc_am_pdu_info_t* pdu_info_p = &((rlc_am_rx_pdu_management_t*)(tb_pP->data))->pdu_info; @@ -67,10 +71,10 @@ signed int rlc_am_rx_list_insert_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP, me if ((pdu_info_previous_cursor_p->sn == pdu_info_p->sn)) { if (pdu_info_p->rf != pdu_info_previous_cursor_p->rf) { LOG_N(RLC, "[FRAME %05u][%s][RLC_AM][MOD %u/%u][RB %u][INSERT PDU] LINE %d RX PDU SN %04d WRONG RF -> DROPPED (vr(mr) < vr(r) and sn >= vr(r))\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, __LINE__, pdu_info_p->sn); @@ -78,10 +82,10 @@ signed int rlc_am_rx_list_insert_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP, me } else if (pdu_info_p->rf == 1) { if ((pdu_info_previous_cursor_p->so + pdu_info_previous_cursor_p->payload_size - 1) >= pdu_info_p->so) { LOG_N(RLC, "[FRAME %05u][%s][RLC_AM][MOD %u/%u][RB %u][INSERT PDU] LINE %d RX PDU SN %04d SO OVERLAP -> DROPPED (vr(mr) < vr(r) and sn >= vr(r))\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, __LINE__, pdu_info_p->sn); @@ -91,10 +95,10 @@ signed int rlc_am_rx_list_insert_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP, me } } LOG_D(RLC, "[FRAME %05u][%s][RLC_AM][MOD %u/%u][RB %u][INSERT PDU] LINE %d RX PDU SN %04d (vr(mr) > vr(r))\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, __LINE__, pdu_info_p->sn); @@ -104,10 +108,10 @@ signed int rlc_am_rx_list_insert_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP, me } else if (pdu_info_p->sn == pdu_info_cursor_p->sn) { if (pdu_info_cursor_p->rf == 0) { LOG_N(RLC, "[FRAME %05u][%s][RLC_AM][MOD %u/%u][RB %u][INSERT PDU] LINE %d RX PDU SN %04d DUPLICATE -> DROPPED\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, __LINE__, pdu_info_p->sn); @@ -121,10 +125,10 @@ signed int rlc_am_rx_list_insert_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP, me if ((pdu_info_previous_cursor_p->so + pdu_info_previous_cursor_p->payload_size - 1) < pdu_info_p->so) { LOG_D(RLC, "[FRAME %05u][%s][RLC_AM][MOD %u/%u][RB %u][INSERT PDU] LINE %d RX PDU SN %04d SEGMENT OFFSET %05d (vr(mr) < vr(r) and sn >= vr(r))\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, __LINE__, pdu_info_p->sn, @@ -133,10 +137,10 @@ signed int rlc_am_rx_list_insert_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP, me return 0; } else { LOG_N(RLC, "[FRAME %05u][%s][RLC_AM][MOD %u/%u][RB %u][INSERT PDU] LINE %d RX PDU SN %04d OVERLAP PREVIOUS SO DUPLICATE -> DROPPED\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, __LINE__, pdu_info_p->sn); @@ -145,10 +149,10 @@ signed int rlc_am_rx_list_insert_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP, me } } LOG_D(RLC, "[FRAME %05u][%s][RLC_AM][MOD %u/%u][RB %u][INSERT PDU] LINE %d RX PDU SN %04d SEGMENT OFFSET %05d (vr(mr) < vr(r) and sn >= vr(r))\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, __LINE__, pdu_info_p->sn, @@ -158,10 +162,10 @@ signed int rlc_am_rx_list_insert_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP, me } else if (pdu_info_p->so <= pdu_info_cursor_p->so) { LOG_N(RLC, "[FRAME %05u][%s][RLC_AM][MOD %u/%u][RB %u][INSERT PDU] LINE %d RX PDU SN %04d OVERLAP SO DUPLICATE -> DROPPED\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, __LINE__, pdu_info_p->sn); @@ -169,10 +173,10 @@ signed int rlc_am_rx_list_insert_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP, me } } else { LOG_N(RLC, "[FRAME %05u][%s][RLC_AM][MOD %u/%u][RB %u][INSERT PDU] LINE %d RX PDU SN %04d DROPPED\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, __LINE__, pdu_info_p->sn); @@ -187,10 +191,10 @@ signed int rlc_am_rx_list_insert_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP, me } if (cursor_p != NULL) { LOG_D(RLC, "[FRAME %05u][%s][RLC_AM][MOD %u/%u][RB %u][INSERT PDU] LINE %d RX PDU SN %04d (vr(mr) < vr(r) and sn >= vr(r))\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, __LINE__, pdu_info_p->sn); @@ -199,10 +203,10 @@ signed int rlc_am_rx_list_insert_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP, me } else { if (pdu_info_cursor_p->rf == 0) { LOG_D(RLC, "[FRAME %05u][%s][RLC_AM][MOD %u/%u][RB %u][INSERT PDU] LINE %d RX PDU SN %04d (vr(mr) < vr(r) and vr(h) > vr(r) and sn >= vr(r))\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, __LINE__, pdu_info_p->sn); @@ -211,10 +215,10 @@ signed int rlc_am_rx_list_insert_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP, me } else if ((pdu_info_p->rf == 1) && (pdu_info_cursor_p->rf == 1) && (pdu_info_p->sn == pdu_info_cursor_p->sn)) { if ((pdu_info_cursor_p->so + pdu_info_cursor_p->payload_size - 1) < pdu_info_p->so) { LOG_D(RLC, "[FRAME %05u][%s][RLC_AM][MOD %u/%u][RB %u][INSERT PDU] LINE %d RX PDU SN %04d (vr(mr) < vr(r) and vr(h) > vr(r) and sn >= vr(r))\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, __LINE__, pdu_info_p->sn); @@ -222,10 +226,10 @@ signed int rlc_am_rx_list_insert_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP, me return 0; } else { LOG_N(RLC, "[FRAME %05u][%s][RLC_AM][MOD %u/%u][RB %u][INSERT PDU] LINE %d RX PDU SN %04d DROPPED\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, __LINE__, pdu_info_p->sn); @@ -233,10 +237,10 @@ signed int rlc_am_rx_list_insert_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP, me } } else if (pdu_info_p->sn != pdu_info_cursor_p->sn) { LOG_D(RLC, "[FRAME %05u][%s][RLC_AM][MOD %u/%u][RB %u][INSERT PDU] LINE %d RX PDU SN %04d (vr(mr) < vr(r) and vr(h) > vr(r) and sn >= vr(r))\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, __LINE__, pdu_info_p->sn); @@ -245,10 +249,10 @@ signed int rlc_am_rx_list_insert_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP, me } } LOG_N(RLC, "[FRAME %05u][%s][RLC_AM][MOD %u/%u][RB %u][INSERT PDU] LINE %d RX PDU SN %04d DROPPED\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, __LINE__, pdu_info_p->sn); @@ -264,20 +268,20 @@ signed int rlc_am_rx_list_insert_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP, me if ((pdu_info_previous_cursor_p->sn == pdu_info_cursor_p->sn)) { if (pdu_info_p->rf != pdu_info_previous_cursor_p->rf) { LOG_N(RLC, "[FRAME %05u][%s][RLC_AM][MOD %u/%u][RB %u][INSERT PDU] LINE %d RX PDU SN %04d WRONG RF -> DROPPED (vr(mr) < vr(r) and sn >= vr(r))\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, __LINE__, pdu_info_p->sn); return -2; } else if (pdu_info_p->rf == 1) { if ((pdu_info_p->so + pdu_info_p->payload_size - 1) >= pdu_info_previous_cursor_p->so) { LOG_N(RLC, "[FRAME %05u][%s][RLC_AM][MOD %u/%u][RB %u][INSERT PDU] LINE %d RX PDU SN %04d SO OVERLAP -> DROPPED (vr(mr) < vr(r) and sn >= vr(r))\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, __LINE__, pdu_info_p->sn); @@ -287,10 +291,10 @@ signed int rlc_am_rx_list_insert_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP, me } } LOG_D(RLC, "[FRAME %05u][%s][RLC_AM][MOD %u/%u][RB %u][INSERT PDU] LINE %d RX PDU SN %04d (vr(mr) < vr(r))\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, __LINE__, pdu_info_p->sn); @@ -299,10 +303,10 @@ signed int rlc_am_rx_list_insert_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP, me } else if (pdu_info_p->sn == pdu_info_cursor_p->sn) { if (pdu_info_cursor_p->rf == 0) { LOG_N(RLC, "[FRAME %05u][%s][RLC_AM][MOD %u/%u][RB %u][INSERT PDU] LINE %d RX PDU SN %04d DUPLICATE -> DROPPED\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, __LINE__, pdu_info_p->sn); @@ -316,10 +320,10 @@ signed int rlc_am_rx_list_insert_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP, me if ((pdu_info_p->so + pdu_info_p->payload_size - 1) < pdu_info_previous_cursor_p->so) { LOG_D(RLC, "[FRAME %05u][%s][RLC_AM][MOD %u/%u][RB %u][INSERT PDU] LINE %d RX PDU SN %04d SEGMENT OFFSET %05d (vr(mr) < vr(r) and sn < vr(r))\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, __LINE__, pdu_info_p->sn, @@ -328,10 +332,10 @@ signed int rlc_am_rx_list_insert_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP, me return 0; } else { LOG_N(RLC, "[FRAME %05u][%s][RLC_AM][MOD %u/%u][RB %u][INSERT PDU] LINE %d RX PDU SN %04d OVERLAP PREVIOUS SO DUPLICATE -> DROPPED\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, __LINE__, pdu_info_p->sn); @@ -340,10 +344,10 @@ signed int rlc_am_rx_list_insert_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP, me } } LOG_D(RLC, "[FRAME %05u][%s][RLC_AM][MOD %u/%u][RB %u][INSERT PDU] LINE %d RX PDU SN %04d SEGMENT OFFSET %05d (vr(mr) < vr(r) and sn < vr(r))\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, __LINE__, pdu_info_p->sn, @@ -353,10 +357,10 @@ signed int rlc_am_rx_list_insert_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP, me } else if (pdu_info_cursor_p->so <= pdu_info_p->so) { LOG_N(RLC, "[FRAME %05u][%s][RLC_AM][MOD %u/%u][RB %u][INSERT PDU] LINE %d RX PDU SN %04d OVERLAP SO DUPLICATE -> DROPPED\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, __LINE__, pdu_info_p->sn); @@ -364,10 +368,10 @@ signed int rlc_am_rx_list_insert_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP, me } } else { LOG_N(RLC, "[FRAME %05u][%s][RLC_AM][MOD %u/%u][RB %u][INSERT PDU] LINE %d RX PDU SN %04d DROPPED\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, __LINE__, pdu_info_p->sn); @@ -382,10 +386,10 @@ signed int rlc_am_rx_list_insert_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP, me } if (cursor_p != NULL) { LOG_D(RLC, "[FRAME %05u][%s][RLC_AM][MOD %u/%u][RB %u][INSERT PDU] LINE %d RX PDU SN %04d (vr(mr) < vr(r) and sn < vr(r))\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, __LINE__, pdu_info_p->sn); @@ -394,10 +398,10 @@ signed int rlc_am_rx_list_insert_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP, me } else { if (pdu_info_cursor_p->rf == 0) { LOG_D(RLC, "[FRAME %05u][%s][RLC_AM][MOD %u/%u][RB %u][INSERT PDU] LINE %d RX PDU SN %04d (vr(mr) < vr(r) and vr(h) > vr(r) and sn >= vr(r))\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, __LINE__, pdu_info_p->sn); @@ -406,10 +410,10 @@ signed int rlc_am_rx_list_insert_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP, me } else if ((pdu_info_p->rf == 1) && (pdu_info_cursor_p->rf == 1) && (pdu_info_p->sn == pdu_info_cursor_p->sn)) { if ((pdu_info_cursor_p->so + pdu_info_cursor_p->payload_size - 1) < pdu_info_p->so) { LOG_D(RLC, "[FRAME %05u][%s][RLC_AM][MOD %u/%u][RB %u][INSERT PDU] LINE %d RX PDU SN %04d (vr(mr) < vr(r) and vr(h) > vr(r) and sn >= vr(r))\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, __LINE__, pdu_info_p->sn); @@ -417,10 +421,10 @@ signed int rlc_am_rx_list_insert_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP, me return 0; } else { LOG_N(RLC, "[FRAME %05u][%s][RLC_AM][MOD %u/%u][RB %u][INSERT PDU] LINE %d RX PDU SN %04d DROPPED\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, __LINE__, pdu_info_p->sn); @@ -428,10 +432,10 @@ signed int rlc_am_rx_list_insert_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP, me } } else if (pdu_info_p->sn != pdu_info_cursor_p->sn) { LOG_D(RLC, "[FRAME %05u][%s][RLC_AM][MOD %u/%u][RB %u][INSERT PDU] LINE %d RX PDU SN %04d (vr(mr) < vr(r) and vr(h) > vr(r) and sn >= vr(r))\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, __LINE__, pdu_info_p->sn); @@ -440,10 +444,10 @@ signed int rlc_am_rx_list_insert_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP, me } } LOG_N(RLC, "[FRAME %05u][%s][RLC_AM][MOD %u/%u][RB %u][INSERT PDU] LINE %d RX PDU SN %04d DROPPED\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, __LINE__, pdu_info_p->sn); @@ -452,7 +456,7 @@ signed int rlc_am_rx_list_insert_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP, me } else { // (pdu_info_p->vr_mr > rlc_pP->vr_r), > and not >= // FAR MORE SIMPLE CASE while (cursor_p != NULL){ - //msg ("[FRAME %05u][%s][RLC_AM][MOD %u/%u][RB %u][INSERT PDU] LINE %d cursor_p %p\n", frameP, rlc_pP->module_id, rlc_pP->rb_id, __LINE__, cursor_p); + //msg ("[FRAME %05u][%s][RLC_AM][MOD %u/%u][RB %u][INSERT PDU] LINE %d cursor_p %p\n", ctxt_pP->frame, rlc_pP->module_id, rlc_pP->rb_id, __LINE__, cursor_p); pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info; if (pdu_info_p->sn < pdu_info_cursor_p->sn) { @@ -461,10 +465,10 @@ signed int rlc_am_rx_list_insert_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP, me if ((pdu_info_previous_cursor_p->sn == pdu_info_p->sn)) { if (pdu_info_p->rf != pdu_info_previous_cursor_p->rf) { LOG_N(RLC, "[FRAME %05u][%s][RLC_AM][MOD %u/%u][RB %u][INSERT PDU] LINE %d RX PDU SN %04d WRONG RF -> DROPPED (vr(mr) > vr(r))\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, __LINE__, pdu_info_p->sn); @@ -472,10 +476,10 @@ signed int rlc_am_rx_list_insert_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP, me } else if (pdu_info_p->rf == 1) { if ((pdu_info_previous_cursor_p->so + pdu_info_previous_cursor_p->payload_size - 1) >= pdu_info_p->so) { LOG_N(RLC, "[FRAME %05u][%s][RLC_AM][MOD %u/%u][RB %u][INSERT PDU] LINE %d RX PDU SN %04d SO OVERLAP -> DROPPED (vr(mr) > vr(r))\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, __LINE__, pdu_info_p->sn); @@ -485,10 +489,10 @@ signed int rlc_am_rx_list_insert_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP, me } } LOG_D(RLC, "[FRAME %05u][%s][RLC_AM][MOD %u/%u][RB %u][INSERT PDU] LINE %d RX PDU SN %04d (vr(mr) > vr(r))\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, __LINE__, pdu_info_p->sn); @@ -498,10 +502,10 @@ signed int rlc_am_rx_list_insert_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP, me } else if (pdu_info_p->sn == pdu_info_cursor_p->sn) { if (pdu_info_cursor_p->rf == 0) { LOG_N(RLC, "[FRAME %05u][%s][RLC_AM][MOD %u/%u][RB %u][INSERT PDU] LINE %d RX PDU SN %04d WRONG RF -> DROPPED (vr(mr) > vr(r))\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, __LINE__, pdu_info_p->sn); @@ -516,19 +520,19 @@ signed int rlc_am_rx_list_insert_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP, me if ((pdu_info_previous_cursor_p->so + pdu_info_previous_cursor_p->payload_size - 1) < pdu_info_p->so) { LOG_D(RLC, "[FRAME %05u][%s][RLC_AM][MOD %u/%u][RB %u][INSERT PDU] LINE %d RX PDU SN %04d SEGMENT OFFSET %05d (vr(mr) > vr(r) and sn >= vr(r))\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, __LINE__, pdu_info_p->sn, pdu_info_p->so); LOG_D(RLC, "[FRAME %05u][%s][RLC_AM][MOD %u/%u][RB %u][INSERT PDU] PREVIOUS SO %d PAYLOAD SIZE %d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, pdu_info_previous_cursor_p->so, pdu_info_previous_cursor_p->payload_size); @@ -536,10 +540,10 @@ signed int rlc_am_rx_list_insert_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP, me return 0; } else { LOG_N(RLC, "[FRAME %05u][%s][RLC_AM][MOD %u/%u][RB %u][INSERT PDU] LINE %d RX PDU SN %04d OVERLAP PREVIOUS SO DUPLICATE -> DROPPED\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, __LINE__, pdu_info_p->sn); @@ -548,10 +552,10 @@ signed int rlc_am_rx_list_insert_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP, me } } LOG_D(RLC, "[FRAME %05u][%s][RLC_AM][MOD %u/%u][RB %u][INSERT PDU] LINE %d RX PDU SN %04d SEGMENT OFFSET %05d (vr(mr) > vr(r) and sn >= vr(r))\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, __LINE__, pdu_info_p->sn, @@ -560,10 +564,10 @@ signed int rlc_am_rx_list_insert_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP, me return 0; } else if (pdu_info_p->so <= pdu_info_cursor_p->so) { LOG_N(RLC, "[FRAME %05u][%s][RLC_AM][MOD %u/%u][RB %u][INSERT PDU] LINE %d RX PDU SN %04d OVERLAP SO DUPLICATE -> DROPPED\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, __LINE__, pdu_info_p->sn); @@ -571,10 +575,10 @@ signed int rlc_am_rx_list_insert_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP, me } } else { LOG_N(RLC, "[FRAME %05u][%s][RLC_AM][MOD %u/%u][RB %u][INSERT PDU] LINE %d RX PDU SN %04d DROPPED\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, __LINE__, pdu_info_p->sn); @@ -585,10 +589,10 @@ signed int rlc_am_rx_list_insert_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP, me cursor_p = cursor_p->next; } LOG_D(RLC, "[FRAME %05u][%s][RLC_AM][MOD %u/%u][RB %u][INSERT PDU] LINE %d RX PDU SN %04d (vr(mr) > vr(r))(last inserted)\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, __LINE__, pdu_info_p->sn); @@ -599,10 +603,10 @@ signed int rlc_am_rx_list_insert_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP, me return 0; } else { LOG_N(RLC, "[FRAME %05u][%s][RLC_AM][MOD %u/%u][RB %u][INSERT PDU] LINE %d RX PDU SN %04d OVERLAP SO DUPLICATE -> DROPPED\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, __LINE__, pdu_info_p->sn); @@ -615,10 +619,10 @@ signed int rlc_am_rx_list_insert_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP, me } } else { LOG_D(RLC, "[FRAME %05u][%s][RLC_AM][MOD %u/%u][RB %u][INSERT PDU] LINE %d RX PDU SN %04d (only inserted)\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, __LINE__, pdu_info_p->sn); @@ -626,17 +630,21 @@ signed int rlc_am_rx_list_insert_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP, me return 0; } LOG_N(RLC, "[FRAME %05u][%s][RLC_AM][MOD %u/%u][RB %u][INSERT PDU] LINE %d RX PDU SN %04d DROPPED @4\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, __LINE__, pdu_info_p->sn); return -1; } //----------------------------------------------------------------------------- -void rlc_am_rx_check_all_byte_segments(rlc_am_entity_t* rlc_pP, frame_t frameP, mem_block_t* tb_pP) +void +rlc_am_rx_check_all_byte_segments( + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t* const rlc_pP, + mem_block_t* const tb_pP) //----------------------------------------------------------------------------- { rlc_am_pdu_info_t *pdu_info_p = &((rlc_am_rx_pdu_management_t*)(tb_pP->data))->pdu_info; @@ -702,7 +710,7 @@ void rlc_am_rx_check_all_byte_segments(rlc_am_entity_t* rlc_pP, frame_t frameP, } if (pdu_info_p->lsf > 0) { //msg("rlc_am_rx_check_all_byte_segments(%d) @8\n",sn); - rlc_am_rx_mark_all_segments_received(rlc_pP, frameP, first_cursor_p); + rlc_am_rx_mark_all_segments_received(ctxt_pP, rlc_pP, first_cursor_p); } } last_end_so = pdu_info_p->so + pdu_info_p->payload_size; @@ -713,7 +721,11 @@ void rlc_am_rx_check_all_byte_segments(rlc_am_entity_t* rlc_pP, frame_t frameP, } } //----------------------------------------------------------------------------- -void rlc_am_rx_mark_all_segments_received(rlc_am_entity_t* rlc_pP, frame_t frameP, mem_block_t* fisrt_segment_tbP) +void +rlc_am_rx_mark_all_segments_received( + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t* const rlc_pP, + mem_block_t* const fisrt_segment_tbP) //----------------------------------------------------------------------------- { rlc_am_pdu_info_t* pdu_info_p = &((rlc_am_rx_pdu_management_t*)(fisrt_segment_tbP->data))->pdu_info; @@ -724,10 +736,10 @@ void rlc_am_rx_mark_all_segments_received(rlc_am_entity_t* rlc_pP, frame_t frame cursor_p = fisrt_segment_tbP; if (cursor_p) { LOG_D(RLC, "[FRAME %05u][%s][RLC_AM][MOD %u/%u][RB %u][PROCESS RX PDU] ALL SEGMENTS RECEIVED SN %04d:\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, sn); do { @@ -742,7 +754,10 @@ void rlc_am_rx_mark_all_segments_received(rlc_am_entity_t* rlc_pP, frame_t frame } } //----------------------------------------------------------------------------- -void rlc_am_rx_list_reassemble_rlc_sdus(rlc_am_entity_t* rlc_pP,frame_t frameP, uint8_t eNB_flag) +void +rlc_am_rx_list_reassemble_rlc_sdus( + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t* const rlc_pP) //----------------------------------------------------------------------------- { mem_block_t* cursor_p = NULL; @@ -758,7 +773,7 @@ void rlc_am_rx_list_reassemble_rlc_sdus(rlc_am_entity_t* rlc_pP,frame_t frameP, do { if (rlc_am_rx_pdu_management_p->all_segments_received > 0) { cursor_p = list2_remove_head(&rlc_pP->receiver_buffer); - rlc_am_reassemble_pdu(rlc_pP, frameP, eNB_flag, cursor_p); + rlc_am_reassemble_pdu(ctxt_pP, rlc_pP, cursor_p); rlc_am_rx_old_pdu_management = rlc_am_rx_pdu_management_p; cursor_p = list2_get_head(&rlc_pP->receiver_buffer); if (cursor_p == NULL) { @@ -770,10 +785,10 @@ void rlc_am_rx_list_reassemble_rlc_sdus(rlc_am_entity_t* rlc_pP,frame_t frameP, if (list2_get_head(&rlc_pP->receiver_buffer) != cursor_p) { AssertFatal( 0 == 1, "[FRAME %05u][%s][RLC_AM][MOD %u/%u][RB %u] LOST PDU DETECTED\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id); } #endif @@ -784,7 +799,10 @@ void rlc_am_rx_list_reassemble_rlc_sdus(rlc_am_entity_t* rlc_pP,frame_t frameP, } //----------------------------------------------------------------------------- mem_block_t * -list2_insert_before_element (mem_block_t * element_to_insert_pP, mem_block_t * element_pP, list2_t * list_pP) +list2_insert_before_element ( + mem_block_t * element_to_insert_pP, + mem_block_t * element_pP, + list2_t * list_pP) //----------------------------------------------------------------------------- { if ((element_to_insert_pP != NULL) && (element_pP != NULL)) { @@ -806,7 +824,10 @@ list2_insert_before_element (mem_block_t * element_to_insert_pP, mem_block_t * e } //----------------------------------------------------------------------------- mem_block_t * -list2_insert_after_element (mem_block_t * element_to_insert_pP, mem_block_t * element_pP, list2_t * list_pP) +list2_insert_after_element ( + mem_block_t * element_to_insert_pP, + mem_block_t * element_pP, + list2_t * list_pP) //----------------------------------------------------------------------------- { @@ -828,7 +849,10 @@ list2_insert_after_element (mem_block_t * element_to_insert_pP, mem_block_t * el } } //----------------------------------------------------------------------------- -void rlc_am_rx_list_display (rlc_am_entity_t* rlc_pP, char* message_pP) +void +rlc_am_rx_list_display ( + const rlc_am_entity_t* const rlc_pP, + char* message_pP) //----------------------------------------------------------------------------- { mem_block_t *cursor_p = NULL; diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_rx_list.h b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_rx_list.h index 7b765c0311a5869675aec1af49902795c226411d..2f57c3859e22d12310ec5f23f5ab14899211c3b7 100755 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_rx_list.h +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_rx_list.h @@ -66,38 +66,37 @@ #include "PHY/defs.h" //----------------------------------------------------------------------------- -/*! \fn signed int rlc_am_rx_list_insert_pdu(rlc_am_entity_t* rlcP frame_t frameP, mem_block_t* tbP) +/*! \fn signed int rlc_am_rx_list_insert_pdu(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlcP , mem_block_t* const tbP) * \brief Insert a PDU in the RX buffer (implemented with a list). +* \param[in] ctxt_pP Running context. * \param[in] rlcP RLC AM protocol instance pointer. -* \param[in] frame Frame index. * \param[in] tbP A PDU embedded in a mem_block_t. * \return Zero if the PDU could be inserted in the RX buffer, a negative value if the PDU could not be inserted. */ -protected_rlc_am_rx_list( signed int rlc_am_rx_list_insert_pdu(rlc_am_entity_t* rlcP, frame_t frameP, mem_block_t* tbP);) +protected_rlc_am_rx_list( signed int rlc_am_rx_list_insert_pdu(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlcP, mem_block_t* const tbP);) -/*! \fn void rlc_am_rx_check_all_byte_segments(rlc_am_entity_t* rlcP, frame_t frameP, mem_block_t* tbP) +/*! \fn void rlc_am_rx_check_all_byte_segments(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlcP, mem_block_t* const tbP) * \brief Check if all sub-segments of a PDU are received, if yes then call rlc_am_rx_mark_all_segments_received() procedure. +* \param[in] ctxt_pP Running context. * \param[in] rlcP RLC AM protocol instance pointer. -* \param[in] frame Frame index. * \param[in] tbP A PDU embedded in a mem_block_t. */ -protected_rlc_am_rx_list( void rlc_am_rx_check_all_byte_segments(rlc_am_entity_t* rlcP, frame_t frameP, mem_block_t* tbP);) +protected_rlc_am_rx_list( void rlc_am_rx_check_all_byte_segments(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlcP, mem_block_t* const tbP);) -/*! \fn void rlc_am_rx_mark_all_segments_received (rlc_am_entity_t* rlcP, frame_t frameP, mem_block_t* first_segment_tbP) +/*! \fn void rlc_am_rx_mark_all_segments_received (const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlcP, mem_block_t* const first_segment_tbP) * \brief Mark all PDUs having the same sequence number as first_segment_tbP with the information that all segments have been received. +* \param[in] ctxt_pP Running context. * \param[in] rlcP RLC AM protocol instance pointer. -* \param[in] frame Frame index. * \param[in] first_segment_tbP A PDU embedded in a mem_block_t, it is the first PDU in the RX buffer (list) that have its sequence number. */ -protected_rlc_am_rx_list( void rlc_am_rx_mark_all_segments_received(rlc_am_entity_t* rlcP, frame_t frameP, mem_block_t* first_segment_tbP);) +protected_rlc_am_rx_list( void rlc_am_rx_mark_all_segments_received(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlcP, mem_block_t* const first_segment_tbP);) -/*! \fn void rlc_am_rx_list_reassemble_rlc_sdus(rlc_am_entity_t* rlcP,frame_t frameP,uint8_t eNB_flag) +/*! \fn void rlc_am_rx_list_reassemble_rlc_sdus(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlcP) * \brief Reassembly all SDUS that it is possible to reassembly by parsing the RX buffer and looking for PDUs having the flag 'all segments received'. +* \param[in] ctxt_pP Running context. * \param[in] rlcP RLC AM protocol instance pointer. -* \param[in] frame Frame index. -* \param[in] eNB_flag Flag to indicate eNB (1) or UE (0). */ -protected_rlc_am_rx_list( void rlc_am_rx_list_reassemble_rlc_sdus(rlc_am_entity_t* rlcP,frame_t frameP,uint8_t eNB_flag);) +protected_rlc_am_rx_list( void rlc_am_rx_list_reassemble_rlc_sdus(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlcP);) /*! \fn mem_block_t* list2_insert_before_element (mem_block_t * element_to_insertP, mem_block_t * elementP, list2_t * listP) * \brief Insert a PDU embedded in a mem_block_t in a list at a position before a designated element of the list. @@ -115,11 +114,11 @@ public_rlc_am_rx_list( mem_block_t* list2_insert_before_element (mem_block_t * e */ public_rlc_am_rx_list( mem_block_t* list2_insert_after_element (mem_block_t * element_to_insertP, mem_block_t * elementP, list2_t * listP);) -/*! \fn void rlc_am_rx_list_display (rlc_am_entity_t* rlcP, char* messageP) +/*! \fn void rlc_am_rx_list_display (const rlc_am_entity_t* const rlcP, char* messageP) * \brief Display the dump of the RX buffer. * \param[in] rlcP RLC AM protocol instance pointer. * \param[in] messageP Message to be displayed along with the display of the dump of the RX buffer. */ -protected_rlc_am_rx_list( void rlc_am_rx_list_display (rlc_am_entity_t* rlcP, char* messageP);) +protected_rlc_am_rx_list( void rlc_am_rx_list_display (const rlc_am_entity_t* const rlcP, char* messageP);) /** @} */ #endif diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_segment.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_segment.c index d14d6ad740aa93ddf057bad9cd0aec3a512df0ef..774796b052b1a907f5141f9e749bd7cd4cd84445 100755 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_segment.c +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_segment.c @@ -43,10 +43,10 @@ //----------------------------------------------------------------------------- void rlc_am_pdu_polling ( - rlc_am_entity_t *const rlc_pP, - const frame_t frameP, - rlc_am_pdu_sn_10_t *const pdu_pP, - const int16_t payload_sizeP) + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t *const rlc_pP, + rlc_am_pdu_sn_10_t *const pdu_pP, + const int16_t payload_sizeP) //----------------------------------------------------------------------------- { // 5.2.2 Polling @@ -88,36 +88,36 @@ void rlc_am_pdu_polling ( if (rlc_pP->c_pdu_without_poll >= rlc_pP->poll_pdu) { LOG_T(RLC, "[FRAME %05d][%s][RLC_AM][MOD %u/%u][RB %u][POLL] SET POLL BECAUSE TX NUM PDU THRESHOLD %d HAS BEEN REACHED\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, rlc_pP->poll_pdu); } if (rlc_pP->c_pdu_without_poll >= rlc_pP->poll_pdu) { LOG_T(RLC, "[FRAME %05d][%s][RLC_AM][MOD %u/%u][RB %u][POLL] SET POLL BECAUSE TX NUM BYTES THRESHOLD %d HAS BEEN REACHED\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, rlc_pP->poll_byte); } if ((rlc_pP->sdu_buffer_occupancy == 0) && (rlc_pP->retrans_num_bytes_to_retransmit == 0)) { LOG_T(RLC, "[FRAME %05d][%s][RLC_AM][MOD %u/%u][RB %u][POLL] SET POLL BECAUSE TX BUFFERS ARE EMPTY\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id); } if (rlc_pP->vt_s == rlc_pP->vt_ms) { LOG_T(RLC, "[FRAME %05d][%s][RLC_AM][MOD %u/%u][RB %u][POLL] SET POLL BECAUSE OF WINDOW STALLING\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id); } pdu_pP->b1 = pdu_pP->b1 | 0x20; @@ -126,9 +126,9 @@ void rlc_am_pdu_polling ( rlc_pP->poll_sn = (rlc_pP->vt_s -1) & RLC_AM_SN_MASK; //optimisation if (!rlc_pP->t_poll_retransmit.running) { - rlc_am_start_timer_poll_retransmit(rlc_pP,frameP); + rlc_am_start_timer_poll_retransmit(ctxt_pP, rlc_pP); //optimisation } else { - //optimisation rlc_pP->t_poll_retransmit.frame_time_out = frameP + rlc_pP->t_poll_retransmit.time_out; + //optimisation rlc_pP->t_poll_retransmit.frame_time_out = ctxt_pP->frame + rlc_pP->t_poll_retransmit.time_out; //optimisation } } else { pdu_pP->b1 = pdu_pP->b1 & 0xDF; @@ -136,8 +136,8 @@ void rlc_am_pdu_polling ( } //----------------------------------------------------------------------------- void rlc_am_segment_10 ( - rlc_am_entity_t *const rlc_pP, - const frame_t frameP) + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t *const rlc_pP) { //----------------------------------------------------------------------------- list_t pdus; @@ -171,10 +171,10 @@ void rlc_am_segment_10 ( signed int max_li_overhead = 0; LOG_T(RLC, "[FRAME %05d][%s][RLC_AM][MOD %u/%u][RB %u][SEGMENT] rlc_pP->current_sdu_index %d rlc_pP->next_sdu_index %d rlc_pP->input_sdus[rlc_pP->current_sdu_index].mem_block %p sdu_buffer_occupancy %d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, rlc_pP->current_sdu_index, rlc_pP->next_sdu_index, @@ -184,7 +184,7 @@ void rlc_am_segment_10 ( return; } - //msg ("[FRAME %05d][%s][RLC_AM][MOD %u/%u][RB %u][SEGMENT]\n", rlc_pP->module_id, rlc_pP->rb_id, frameP); + //msg ("[FRAME %05d][%s][RLC_AM][MOD %u/%u][RB %u][SEGMENT]\n", rlc_pP->module_id, rlc_pP->rb_id, ctxt_pP->frame); list_init (&pdus, NULL); // param string identifying the list is NULL pdu_mem_p = NULL; @@ -192,10 +192,10 @@ void rlc_am_segment_10 ( pthread_mutex_lock(&rlc_pP->lock_input_sdus); while ((rlc_pP->input_sdus[rlc_pP->current_sdu_index].mem_block) && (nb_bytes_to_transmit > 0) ) { LOG_T(RLC, "[FRAME %05d][%s][RLC_AM][MOD %u/%u][RB %u][SEGMENT] nb_bytes_to_transmit %d BO %d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, nb_bytes_to_transmit, rlc_pP->sdu_buffer_occupancy); @@ -207,46 +207,46 @@ void rlc_am_segment_10 ( max_li_overhead = (((rlc_pP->nb_sdu_no_segmented - 1) * 3) / 2) + ((rlc_pP->nb_sdu_no_segmented - 1) % 2); } LOG_T(RLC, "[FRAME %05d][%s][RLC_AM][MOD %u/%u][RB %u][SEGMENT] max_li_overhead %d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, max_li_overhead); if (nb_bytes_to_transmit >= (rlc_pP->sdu_buffer_occupancy + RLC_AM_HEADER_MIN_SIZE + max_li_overhead)) { data_pdu_size = rlc_pP->sdu_buffer_occupancy + RLC_AM_HEADER_MIN_SIZE + max_li_overhead; LOG_T(RLC, "[FRAME %05d][%s][RLC_AM][MOD %u/%u][RB %u][SEGMENT] alloc PDU size %d bytes to contain not all bytes requested by MAC but all BO of RLC@1\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, data_pdu_size); } else { data_pdu_size = nb_bytes_to_transmit; LOG_T(RLC, "[FRAME %05d][%s][RLC_AM][MOD %u/%u][RB %u][SEGMENT] alloc PDU size %d bytes to contain all bytes requested by MAC@1\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, data_pdu_size); } if (!(pdu_mem_p = get_free_mem_block (data_pdu_size + sizeof(struct mac_tb_req)))) { LOG_C(RLC, "[FRAME %05d][%s][RLC_AM][MOD %u/%u][RB %u][SEGMENT] ERROR COULD NOT GET NEW PDU, EXIT\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id); pthread_mutex_unlock(&rlc_pP->lock_input_sdus); return; } LOG_T(RLC, "[FRAME %05d][%s][RLC_AM][MOD %u/%u][RB %u][SEGMENT] get new PDU %d bytes\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, data_pdu_size); pdu_remaining_size = data_pdu_size - RLC_AM_HEADER_MIN_SIZE; @@ -314,10 +314,10 @@ void rlc_am_segment_10 ( } } else { LOG_T(RLC, "[FRAME %05d][%s][RLC_AM][MOD %u/%u][RB %u][SEGMENT] sdu_mngt_p->sdu_remaining_size=%d test_pdu_remaining_size=%d test_li_length_in_bytes=%d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, sdu_mngt_p->sdu_remaining_size, test_pdu_remaining_size, @@ -344,10 +344,10 @@ void rlc_am_segment_10 ( // Do the real filling of the pdu_p //---------------------------------------- LOG_T(RLC, "[FRAME %05d][%s][RLC_AM][MOD %u/%u][RB %u] data shift %d Bytes num_li %d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, ((test_num_li*3) +1) >> 1, test_num_li); @@ -368,19 +368,19 @@ void rlc_am_segment_10 ( sdu_mngt_p = &rlc_pP->input_sdus[rlc_pP->current_sdu_index]; if (sdu_mngt_p->sdu_segmented_size == 0) { LOG_T(RLC, "[FRAME %05d][%s][RLC_AM][MOD %u/%u][RB %u][SEGMENT] GET NEW SDU %p AVAILABLE SIZE %d Bytes\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, sdu_mngt_p, sdu_mngt_p->sdu_remaining_size); } else { LOG_T(RLC, "[FRAME %05d][%s][RLC_AM][MOD %u/%u][RB %u][SEGMENT] GET AGAIN SDU %p REMAINING AVAILABLE SIZE %d Bytes / %d Bytes LENGTH \n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, sdu_mngt_p, sdu_mngt_p->sdu_remaining_size, @@ -390,13 +390,13 @@ void rlc_am_segment_10 ( if (sdu_mngt_p->sdu_remaining_size > pdu_remaining_size) { LOG_T(RLC, "[FRAME %05d][%s][RLC_AM][MOD %u/%u][RB %u][SEGMENT] Filling all remaining PDU with %d bytes\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, pdu_remaining_size); - //msg ("[FRAME %05d][%s][RLC_AM][MOD %u/%u][RB %u][SEGMENT] pdu_mem_p %p pdu_p %p pdu_p->data %p data %p data_sdu_p %p pdu_remaining_size %d\n", rlc_pP->module_id, rlc_pP->rb_id, frameP, pdu_mem_p, pdu_p, pdu_p->data, data, data_sdu_p,pdu_remaining_size); + //msg ("[FRAME %05d][%s][RLC_AM][MOD %u/%u][RB %u][SEGMENT] pdu_mem_p %p pdu_p %p pdu_p->data %p data %p data_sdu_p %p pdu_remaining_size %d\n", rlc_pP->module_id, rlc_pP->rb_id, ctxt_pP->frame, pdu_mem_p, pdu_p, pdu_p->data, data, data_sdu_p,pdu_remaining_size); memcpy(data, data_sdu_p, pdu_remaining_size); pdu_mngt_p->payload_size += pdu_remaining_size; @@ -408,19 +408,19 @@ void rlc_am_segment_10 ( continue_fill_pdu_with_sdu = 0; pdu_remaining_size = 0; LOG_T(RLC, "[FRAME %05d][%s][RLC_AM][MOD %u/%u][RB %u][SEGMENT] sdu_remaining_size %d bytes sdu_segmented_size %d bytes\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, sdu_mngt_p->sdu_remaining_size, sdu_mngt_p->sdu_segmented_size); } else if (sdu_mngt_p->sdu_remaining_size == pdu_remaining_size) { LOG_T(RLC, "[FRAME %05d][%s][RLC_AM][MOD %u/%u][RB %u][SEGMENT] Exactly Filling remaining PDU with %d remaining bytes of SDU\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, pdu_remaining_size); memcpy(data, data_sdu_p, pdu_remaining_size); @@ -428,7 +428,7 @@ void rlc_am_segment_10 ( // free SDU rlc_pP->sdu_buffer_occupancy -= sdu_mngt_p->sdu_remaining_size; - rlc_am_free_in_sdu_data(rlc_pP, rlc_pP->current_sdu_index); + rlc_am_free_in_sdu_data(ctxt_pP, rlc_pP, rlc_pP->current_sdu_index); //free_mem_block (rlc_pP->input_sdus[rlc_pP->current_sdu_index]); //rlc_pP->input_sdus[rlc_pP->current_sdu_index] = NULL; //rlc_pP->nb_sdu -= 1; @@ -441,10 +441,10 @@ void rlc_am_segment_10 ( } else if ((sdu_mngt_p->sdu_remaining_size + (li_length_in_bytes ^ 3)) < pdu_remaining_size ) { if (fill_num_li == (RLC_AM_MAX_SDU_IN_PDU - 1)) { LOG_T(RLC, "[FRAME %05d][%s][RLC_AM][MOD %u/%u][RB %u][SEGMENT] [SIZE %d] REACHING RLC_AM_MAX_SDU_IN_PDU LIs -> STOP SEGMENTATION FOR THIS PDU SDU\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, sdu_mngt_p->sdu_remaining_size); memcpy(data, data_sdu_p, sdu_mngt_p->sdu_remaining_size); @@ -452,7 +452,7 @@ void rlc_am_segment_10 ( pdu_remaining_size = 0; //Forced to 0 pdu_remaining_size - sdu_mngt_p->sdu_remaining_size; // free SDU rlc_pP->sdu_buffer_occupancy -= sdu_mngt_p->sdu_remaining_size; - rlc_am_free_in_sdu_data(rlc_pP, rlc_pP->current_sdu_index); + rlc_am_free_in_sdu_data(ctxt_pP, rlc_pP, rlc_pP->current_sdu_index); //rlc_pP->input_sdus[rlc_pP->current_sdu_index] = NULL; //rlc_pP->nb_sdu -= 1; rlc_pP->current_sdu_index = (rlc_pP->current_sdu_index + 1) % RLC_AM_SDU_CONTROL_BUFFER_SIZE; @@ -462,10 +462,10 @@ void rlc_am_segment_10 ( fi_last_byte_pdu_is_last_byte_sdu = 1; } else { LOG_T(RLC, "[FRAME %05d][%s][RLC_AM][MOD %u/%u][RB %u][SEGMENT] Filling PDU with %d all remaining bytes of SDU\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, sdu_mngt_p->sdu_remaining_size); memcpy(data, data_sdu_p, sdu_mngt_p->sdu_remaining_size); @@ -485,10 +485,10 @@ void rlc_am_segment_10 ( e_li_p->b1 = e_li_p->b1 | (sdu_mngt_p->sdu_remaining_size >> 4); e_li_p->b2 = sdu_mngt_p->sdu_remaining_size << 4; LOG_T(RLC, "[FRAME %05d][%s][RLC_AM][MOD %u/%u][RB %u][SEGMENT] set e_li_p->b1=0x%02X set e_li_p->b2=0x%02X fill_num_li=%d test_num_li=%d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, e_li_p->b1, e_li_p->b2, @@ -503,10 +503,10 @@ void rlc_am_segment_10 ( e_li_p->b2 = e_li_p->b2 | (sdu_mngt_p->sdu_remaining_size >> 8); e_li_p->b3 = sdu_mngt_p->sdu_remaining_size & 0xFF; LOG_T(RLC, "[FRAME %05d][%s][RLC_AM][MOD %u/%u][RB %u][SEGMENT] set e_li_p->b2=0x%02X set e_li_p->b3=0x%02X fill_num_li=%d test_num_li=%d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, e_li_p->b2, e_li_p->b3, @@ -520,7 +520,7 @@ void rlc_am_segment_10 ( rlc_pP->sdu_buffer_occupancy -= sdu_mngt_p->sdu_remaining_size; sdu_mngt_p->sdu_remaining_size = 0; - rlc_am_free_in_sdu_data(rlc_pP, rlc_pP->current_sdu_index); + rlc_am_free_in_sdu_data(ctxt_pP, rlc_pP, rlc_pP->current_sdu_index); //free_mem_block (rlc_pP->input_sdus[rlc_pP->current_sdu_index]); //rlc_pP->input_sdus[rlc_pP->current_sdu_index] = NULL; //rlc_pP->nb_sdu -= 1; @@ -528,10 +528,10 @@ void rlc_am_segment_10 ( } } else { LOG_T(RLC, "[FRAME %05d][%s][RLC_AM][MOD %u/%u][RB %u][SEGMENT] Filling PDU with %d all remaining bytes of SDU and reduce TB size by %d bytes\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, sdu_mngt_p->sdu_remaining_size, pdu_remaining_size - sdu_mngt_p->sdu_remaining_size); @@ -543,7 +543,7 @@ void rlc_am_segment_10 ( pdu_remaining_size = pdu_remaining_size - sdu_mngt_p->sdu_remaining_size; // free SDU rlc_pP->sdu_buffer_occupancy -= sdu_mngt_p->sdu_remaining_size; - rlc_am_free_in_sdu_data(rlc_pP, rlc_pP->current_sdu_index); + rlc_am_free_in_sdu_data(ctxt_pP, rlc_pP, rlc_pP->current_sdu_index); //rlc_pP->input_sdus[rlc_pP->current_sdu_index] = NULL; //rlc_pP->nb_sdu -= 1; rlc_pP->current_sdu_index = (rlc_pP->current_sdu_index + 1) % RLC_AM_SDU_CONTROL_BUFFER_SIZE; @@ -570,10 +570,10 @@ void rlc_am_segment_10 ( pdu_p->b1 = pdu_p->b1 | 0x04; } LOG_T(RLC, "[FRAME %05d][%s][RLC_AM][MOD %u/%u][RB %u][SEGMENT] SEND PDU SN %04d SIZE %d BYTES PAYLOAD SIZE %d BYTES\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, rlc_pP->vt_s, data_pdu_size - pdu_remaining_size, @@ -592,7 +592,7 @@ void rlc_am_segment_10 ( pdu_tb_req_p->tb_size = data_pdu_size - pdu_remaining_size; #warning "why 3000: changed to RLC_SDU_MAX_SIZE " assert(pdu_tb_req_p->tb_size < RLC_SDU_MAX_SIZE ); - rlc_am_pdu_polling(rlc_pP, frameP,pdu_p, pdu_mngt_p->payload_size); + rlc_am_pdu_polling(ctxt_pP, rlc_pP, pdu_p, pdu_mngt_p->payload_size); //list_add_tail_eurecom (pdu_mem_p, &rlc_pP->segmentation_pdu_list); pdu_mngt_p->mem_block = pdu_mem_p; @@ -609,7 +609,7 @@ void rlc_am_segment_10 ( //nb_bytes_to_transmit = nb_bytes_to_transmit - data_pdu_size; nb_bytes_to_transmit = 0; // 1 PDU only - mem_block_t* copy = rlc_am_retransmit_get_copy (rlc_pP, frameP,(rlc_pP->vt_s-1) & RLC_AM_SN_MASK); + mem_block_t* copy = rlc_am_retransmit_get_copy (ctxt_pP, rlc_pP, (rlc_pP->vt_s-1) & RLC_AM_SN_MASK); list_add_tail_eurecom (copy, &rlc_pP->segmentation_pdu_list); } diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_segment.h b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_segment.h index 0855638ba4813a01697e87805514f1dca704da1f..99de4b1f7686cbd52ce1f21e4afdc8c27c599520 100755 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_segment.h +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_segment.h @@ -58,20 +58,20 @@ # endif # endif -/*! \fn void rlc_am_pdu_polling (rlc_am_entity_t *rlcP, frame_t frameP, rlc_am_pdu_sn_10_t *pduP, int16_t payload_sizeP) +/*! \fn void rlc_am_pdu_polling (const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t *const rlcP, rlc_am_pdu_sn_10_t *pduP, int16_t payload_sizeP) * \brief Set or not the poll bit in the PDU header depending on RLC AM protocol variables. +* \param[in] ctxt_pP Running context. * \param[in] rlcP RLC AM protocol instance pointer. -* \param[in[ frame Frame index. * \param[in] pduP Pointer on the header of the PDU in order to be able to set the poll bit if necessary. * \param[in] payload_sizeP Size of the payload of the PDU. */ -protected_rlc_am_segment(void rlc_am_pdu_polling (rlc_am_entity_t *rlcP, frame_t frameP, rlc_am_pdu_sn_10_t *pduP, int16_t payload_sizeP);) +protected_rlc_am_segment(void rlc_am_pdu_polling (const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t *const rlcP, rlc_am_pdu_sn_10_t *pduP, int16_t payload_sizeP);) -/*! \fn void rlc_am_segment_10 (rlc_am_entity_t *rlcP) +/*! \fn void rlc_am_segment_10 (const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t * const rlcP) * \brief Segment a PDU with 10 bits sequence number, based on segmentation information given by MAC (size to transmit). +* \param[in] ctxt_pP Running context. * \param[in] rlcP RLC AM protocol instance pointer. -* \param[in[ frame Frame index. */ -protected_rlc_am_segment(void rlc_am_segment_10 (rlc_am_entity_t *rlcP,frame_t frameP);) +protected_rlc_am_segment(void rlc_am_segment_10 (const protocol_ctxt_t* const ctxt_pP,rlc_am_entity_t *const rlcP);) /** @} */ # endif diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_segments_holes.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_segments_holes.c index 842bb485302686a1363c29f5dd1a6054471bd5e4..dbfd906a71c917102f00cf335a0eaabe108250d8 100755 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_segments_holes.c +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_segments_holes.c @@ -36,17 +36,19 @@ //----------------------------------------------------------------------------- void rlc_am_clear_holes ( - rlc_am_entity_t * const rlc_pP, - const rlc_sn_t snP) + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t *const rlc_pP, + const rlc_sn_t snP) //----------------------------------------------------------------------------- { rlc_pP->pdu_retrans_buffer[snP].num_holes = 0; } //----------------------------------------------------------------------------- void rlc_am_shift_down_holes ( - rlc_am_entity_t *const rlc_pP, - const rlc_sn_t snP, - const int indexP) + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t *const rlc_pP, + const rlc_sn_t snP, + const int indexP) //----------------------------------------------------------------------------- { int i; @@ -58,9 +60,10 @@ void rlc_am_shift_down_holes ( } //----------------------------------------------------------------------------- void rlc_am_shift_up_holes ( - rlc_am_entity_t *const rlc_pP, - const rlc_sn_t snP, - const int indexP) + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t *const rlc_pP, + const rlc_sn_t snP, + const int indexP) //----------------------------------------------------------------------------- { // shift include indexP @@ -74,20 +77,20 @@ void rlc_am_shift_up_holes ( } //----------------------------------------------------------------------------- void rlc_am_remove_hole ( - rlc_am_entity_t *const rlc_pP, - const frame_t frameP, - const rlc_sn_t snP, - const sdu_size_t so_startP, - const sdu_size_t so_stopP) + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t *const rlc_pP, + const rlc_sn_t snP, + const sdu_size_t so_startP, + const sdu_size_t so_stopP) //----------------------------------------------------------------------------- { int i; #ifdef TRACE_RLC_AM_HOLE LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][HOLE] REMOVE HOLE SN %04d so_startP %05d so_stopP %05d rlc_pP->pdu_retrans_buffer[snP].nack_so_start %05d rlc_pP->pdu_retrans_buffer[snP].nack_so_stop %05d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, snP, so_startP, @@ -102,10 +105,10 @@ void rlc_am_remove_hole ( assert(so_stopP <= rlc_pP->pdu_retrans_buffer[snP].nack_so_stop); #ifdef TRACE_RLC_AM_HOLE LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][HOLE] REMOVE HOLE SN %04d MODIFIED nack_so_start %05d->%05d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, snP, rlc_pP->pdu_retrans_buffer[snP].nack_so_start, @@ -121,7 +124,7 @@ void rlc_am_remove_hole ( for (i = 0; i < rlc_pP->pdu_retrans_buffer[snP].num_holes; i++) { if (so_startP <= rlc_pP->pdu_retrans_buffer[snP].hole_so_start[i]) { if (so_stopP >= rlc_pP->pdu_retrans_buffer[snP].hole_so_stop[i]) { - rlc_am_shift_down_holes(rlc_pP, snP, i); + rlc_am_shift_down_holes(ctxt_pP, rlc_pP, snP, i); i = i - 1; } else { rlc_pP->pdu_retrans_buffer[snP].hole_so_start[i] = so_stopP; @@ -134,10 +137,10 @@ void rlc_am_remove_hole ( } #ifdef TRACE_RLC_AM_HOLE LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][HOLE] REMOVE HOLE SN %04d NOW nack_so_start %05d nack_so_stop %05d num holes %d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, snP, rlc_pP->pdu_retrans_buffer[snP].nack_so_start, @@ -150,7 +153,7 @@ void rlc_am_remove_hole ( if (so_startP <= rlc_pP->pdu_retrans_buffer[snP].hole_so_stop[i]) { if (so_stopP < rlc_pP->pdu_retrans_buffer[snP].hole_so_stop[i]) { // BAD CASE: 1 HOLE IS SPLITTED IN 2 HOLES - rlc_am_shift_up_holes(rlc_pP, snP, i+1); + rlc_am_shift_up_holes(ctxt_pP, rlc_pP, snP, i+1); rlc_pP->pdu_retrans_buffer[snP].hole_so_start[i+1] = so_startP+1; rlc_pP->pdu_retrans_buffer[snP].hole_so_stop[i+1] = rlc_pP->pdu_retrans_buffer[snP].hole_so_stop[i]; @@ -171,10 +174,10 @@ void rlc_am_remove_hole ( } #ifdef TRACE_RLC_AM_HOLE LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][HOLE] REMOVE HOLE SN %04d NOW nack_so_start %05d nack_so_stop %05d num holes %d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, snP, rlc_pP->pdu_retrans_buffer[snP].nack_so_start, @@ -185,11 +188,11 @@ void rlc_am_remove_hole ( } //----------------------------------------------------------------------------- void rlc_am_get_next_hole ( - rlc_am_entity_t *const rlc_pP, - const frame_t frameP, - const rlc_sn_t snP, - sdu_size_t* const so_startP, - sdu_size_t* const so_stopP) + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t *const rlc_pP, + const rlc_sn_t snP, + sdu_size_t* const so_startP, + sdu_size_t* const so_stopP) //----------------------------------------------------------------------------- { if (rlc_pP->pdu_retrans_buffer[snP].num_holes == 0) { @@ -197,10 +200,10 @@ void rlc_am_get_next_hole ( *so_stopP = rlc_pP->pdu_retrans_buffer[snP].nack_so_stop; #ifdef TRACE_RLC_AM_HOLE LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][HOLE] rlc_am_get_next_hole(SN %04d) %05d->%05d (NUM HOLES == 0)\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, snP, *so_startP, @@ -211,10 +214,10 @@ void rlc_am_get_next_hole ( *so_stopP = rlc_pP->pdu_retrans_buffer[snP].hole_so_stop[0]; #ifdef TRACE_RLC_AM_HOLE LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][HOLE] rlc_am_get_next_hole(SN %04d) %05d->%05d (NUM HOLES == %d)\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, snP, *so_startP, @@ -225,11 +228,11 @@ void rlc_am_get_next_hole ( } //----------------------------------------------------------------------------- void rlc_am_add_hole ( - rlc_am_entity_t *const rlc_pP, - const frame_t frameP, - const rlc_sn_t snP, - sdu_size_t so_startP, - sdu_size_t so_stopP) + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t *const rlc_pP, + const rlc_sn_t snP, + const sdu_size_t so_startP, + sdu_size_t so_stopP) //----------------------------------------------------------------------------- { int i, hole_index; @@ -246,10 +249,10 @@ void rlc_am_add_hole ( rlc_pP->pdu_retrans_buffer[snP].nack_so_stop = so_stopP; #ifdef TRACE_RLC_AM_HOLE LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][HOLE] SN %04d GLOBAL NACK 0->%05d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, snP, so_stopP); @@ -272,10 +275,10 @@ void rlc_am_add_hole ( rlc_pP->pdu_retrans_buffer[snP].nack_so_stop = so_stopP; #ifdef TRACE_RLC_AM_HOLE LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][HOLE] FIRST HOLE SN %04d GLOBAL NACK %05d->%05d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, snP, so_startP, @@ -306,10 +309,10 @@ void rlc_am_add_hole ( rlc_pP->pdu_retrans_buffer[snP].num_holes += 1; #ifdef TRACE_RLC_AM_HOLE LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][HOLE] INSERT %d th HOLE SN %04d GLOBAL NACK %05d->%05d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, rlc_pP->pdu_retrans_buffer[snP].num_holes, snP, @@ -333,10 +336,10 @@ void rlc_am_add_hole ( rlc_pP->pdu_retrans_buffer[snP].nack_so_stop = so_stopP; #ifdef TRACE_RLC_AM_HOLE LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][HOLE] INSERT THE %d th LAST HOLE SN %04d GLOBAL NACK %05d->%05d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, rlc_pP->pdu_retrans_buffer[snP].num_holes, snP, diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_segments_holes.h b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_segments_holes.h index eaea1a3312fdba1e9aa67ee9ab3b5567062302f7..24263c16f18d14cde0c1835c8e990488967c13b3 100755 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_segments_holes.h +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_segments_holes.h @@ -58,58 +58,60 @@ # define public_rlc_am_segments_holes(x) extern x # endif # endif -/*! \fn void rlc_am_clear_holes (rlc_am_entity_t *rlcP, rlc_sn_t snP) +/*! \fn void rlc_am_clear_holes (const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t * const rlcP, rlc_sn_t snP) * \brief Remove all marked holes for PDU with sequence number "snP". +* \param[in] ctxt_pP Running context. * \param[in] rlcP RLC AM protocol instance pointer. * \param[in] snP Sequence number. */ protected_rlc_am_segments_holes(void rlc_am_clear_holes ( - rlc_am_entity_t *const rlcP, - const rlc_sn_t snP);) + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t *const rlcP, + const rlc_sn_t snP);) -/*! \fn void rlc_am_remove_hole (rlc_am_entity_t *rlcP, frame_t frameP, rlc_sn_t snP, sdu_size_t so_startP, sdu_size_t so_stopP) +/*! \fn void rlc_am_remove_hole (const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t * const rlcP, rlc_sn_t snP, sdu_size_t so_startP, sdu_size_t so_stopP) * \brief Remove for PDU with sequence number "snP" a NACK for byte segment offset [so_startP, so_stopP]. +* \param[in] ctxt_pP Running context. * \param[in] rlcP RLC AM protocol instance pointer. -* \param[in[ frame Frame index. * \param[in] snP Sequence number. * \param[in] so_startP Start of segment offset. * \param[in] so_stopP End of segment offset. */ protected_rlc_am_segments_holes(void rlc_am_remove_hole ( - rlc_am_entity_t *const rlcP, - const frame_t frameP, - const rlc_sn_t snP, - const sdu_size_t so_startP, - const sdu_size_t so_stopP);) + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t *const rlcP, + const rlc_sn_t snP, + const sdu_size_t so_startP, + const sdu_size_t so_stopP);) -/*! \fn void rlc_am_get_next_hole (rlc_am_entity_t *rlcP, frame_t frameP, rlc_sn_t snP, sdu_size_t* so_startP, sdu_size_t* so_stopP) +/*! \fn void rlc_am_get_next_hole (const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t * const rlcP, rlc_sn_t snP, sdu_size_t* so_startP, sdu_size_t* so_stopP) * \brief Get for PDU with sequence number "snP" the first hole start and stop parameters. +* \param[in] ctxt_pP Running context. * \param[in] rlcP RLC AM protocol instance pointer. -* \param[in[ frame Frame index. * \param[in] snP Sequence number. * \param[in,out] so_startP Start of segment offset. * \param[in,out] so_stopP End of segment offset. */ protected_rlc_am_segments_holes(void rlc_am_get_next_hole ( - rlc_am_entity_t *const rlcP, - const frame_t frameP, - const rlc_sn_t snP, - sdu_size_t* const so_startP, - sdu_size_t* const so_stopP);) + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t *const rlcP, + const rlc_sn_t snP, + sdu_size_t* const so_startP, + sdu_size_t* const so_stopP);) -/*! \fn void rlc_am_add_hole (rlc_am_entity_t *rlcP, frame_t frameP, rlc_sn_t snP, sdu_size_t so_startP, sdu_size_t so_stopP) +/*! \fn void rlc_am_add_hole (const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t * const rlcP, rlc_sn_t snP, sdu_size_t so_startP, sdu_size_t so_stopP) * \brief Mark for PDU with sequence number "snP" a NACK for byte segment offset [so_startP, so_stopP]. +* \param[in] ctxt_pP Running context. * \param[in] rlcP RLC AM protocol instance pointer. -* \param[in[ frame Frame index. * \param[in] snP Sequence number. * \param[in,out] so_startP Start of segment offset. * \param[in,out] so_stopP End of segment offset. */ protected_rlc_am_segments_holes(void rlc_am_add_hole ( - rlc_am_entity_t *const rlcP, - const frame_t frameP, - const rlc_sn_t snP, - sdu_size_t so_startP, - sdu_size_t so_stopP);) + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t *const rlcP, + const rlc_sn_t snP, + const sdu_size_t so_startP, + sdu_size_t so_stopP);) /** @} */ #endif diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_status_report.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_status_report.c index 15642cca7022af1b51ec68458312cbc19aea69d0..2497ed562d4489193d2705dab52cf4f505d5bfef 100755 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_status_report.c +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_status_report.c @@ -41,14 +41,19 @@ #include "rlc_am.h" #include "LAYER2/MAC/extern.h" #include "UTIL/LOG/log.h" -#define TRACE_STATUS_CREATION + +//#define TRACE_STATUS_CREATION 1 rlc_am_control_pdu_info_t g_rlc_am_control_pdu_info; # if defined(ENABLE_ITTI) //----------------------------------------------------------------------------- -void rlc_am_itti_display_status_ind_infos(const rlc_am_entity_t const * rlc_pP, const rlc_am_control_pdu_info_t const * pdu_info_pP) +void +rlc_am_itti_display_status_ind_infos( + const protocol_ctxt_t* const ctxt_pP, + const rlc_am_entity_t *const rlc_pP, + const rlc_am_control_pdu_info_t *const pdu_info_pP) //----------------------------------------------------------------------------- { char message_string[1000]; @@ -72,14 +77,14 @@ void rlc_am_itti_display_status_ind_infos(const rlc_am_entity_t const * rlc_pP, } message_string_size += sprintf(&message_string[message_string_size], "\n"); - msg_p = itti_alloc_new_message_sized (rlc_pP->is_enb > 0 ? TASK_RLC_ENB:TASK_RLC_UE , RLC_AM_STATUS_PDU_IND, message_string_size + sizeof (IttiMsgText)); + msg_p = itti_alloc_new_message_sized (ctxt_pP->enb_flag > 0 ? TASK_RLC_ENB:TASK_RLC_UE , RLC_AM_STATUS_PDU_IND, message_string_size + sizeof (IttiMsgText)); msg_p->ittiMsg.rlc_am_status_pdu_ind.size = message_string_size; memcpy(&msg_p->ittiMsg.rlc_am_status_pdu_ind.text, message_string, message_string_size); - if (rlc_pP->is_enb) { - itti_send_msg_to_task(TASK_UNKNOWN, rlc_pP->enb_module_id, msg_p); + if (ctxt_pP->enb_flag) { + itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->enb_module_id, msg_p); } else { - itti_send_msg_to_task(TASK_UNKNOWN, rlc_pP->ue_module_id + NB_eNB_INST, msg_p); + itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->ue_module_id + NB_eNB_INST, msg_p); } } } @@ -87,21 +92,25 @@ void rlc_am_itti_display_status_ind_infos(const rlc_am_entity_t const * rlc_pP, # endif //----------------------------------------------------------------------------- -uint16_t rlc_am_read_bit_field(uint8_t** data_ppP, unsigned int* bit_pos_pP, signed int bits_to_readP) { +uint16_t rlc_am_read_bit_field( + uint8_t** data_ppP, + unsigned int* bit_pos_pP, + const signed int bits_to_readP) { //----------------------------------------------------------------------------- uint16_t value = 0; unsigned int bits_read = 0; + signed int bits_to_read = bits_to_readP; do { // bits read > bits to read - if ((8 - *bit_pos_pP) > bits_to_readP) { + if ((8 - *bit_pos_pP) > bits_to_read) { bits_read = 8 - *bit_pos_pP; - value = (value << bits_to_readP) | ((((uint16_t)(**data_ppP)) & (uint16_t)(0x00FF >> *bit_pos_pP)) >> (bits_read - -bits_to_readP)); - *bit_pos_pP = *bit_pos_pP + bits_to_readP; + value = (value << bits_to_read) | ((((uint16_t)(**data_ppP)) & (uint16_t)(0x00FF >> *bit_pos_pP)) >> (bits_read - + bits_to_read)); + *bit_pos_pP = *bit_pos_pP + bits_to_read; return value; // bits read == bits to read - } else if ((8 - *bit_pos_pP) == bits_to_readP) { - value = (value << bits_to_readP) | (((uint16_t)(**data_ppP)) & (uint16_t)(0x00FF >> *bit_pos_pP)); + } else if ((8 - *bit_pos_pP) == bits_to_read) { + value = (value << bits_to_read) | (((uint16_t)(**data_ppP)) & (uint16_t)(0x00FF >> *bit_pos_pP)); *bit_pos_pP = 0; *data_ppP = *data_ppP + 1; return value; @@ -111,41 +120,52 @@ bits_to_readP)); value = (value << bits_read) | ((((uint16_t)(**data_ppP)) & (uint16_t)(0x00FF >> *bit_pos_pP))); *bit_pos_pP = 0; *data_ppP = *data_ppP + 1; - bits_to_readP = bits_to_readP - bits_read; + bits_to_read = bits_to_read - bits_read; } - } while (bits_to_readP > 0); + } while (bits_to_read > 0); return value; } //----------------------------------------------------------------------------- -void rlc_am_write8_bit_field(uint8_t** data_ppP, unsigned int* bit_pos_pP, signed int bits_to_writeP, uint8_t valueP) { +void +rlc_am_write8_bit_field( + uint8_t** data_ppP, + unsigned int* bit_pos_pP, + const signed int bits_to_writeP, + const uint8_t valueP) { //----------------------------------------------------------------------------- unsigned int available_bits; + signed int bits_to_write= bits_to_writeP; do { available_bits = 8 - *bit_pos_pP; // available_bits > bits to write - if (available_bits > bits_to_writeP) { - **data_ppP = **data_ppP | (((valueP & (((uint8_t)0xFF) >> (available_bits - bits_to_writeP)))) << (available_bits - -bits_to_writeP)); - *bit_pos_pP = *bit_pos_pP + bits_to_writeP; + if (available_bits > bits_to_write) { + **data_ppP = **data_ppP | (((valueP & (((uint8_t)0xFF) >> (available_bits - bits_to_write)))) << (available_bits - + bits_to_write)); + *bit_pos_pP = *bit_pos_pP + bits_to_write; return; // bits read == bits to read - } else if (available_bits == bits_to_writeP) { - **data_ppP = **data_ppP | (valueP & (((uint8_t)0xFF) >> (8 - bits_to_writeP))); + } else if (available_bits == bits_to_write) { + **data_ppP = **data_ppP | (valueP & (((uint8_t)0xFF) >> (8 - bits_to_write))); *bit_pos_pP = 0; *data_ppP = *data_ppP + 1; return; // available_bits < bits to write } else { - **data_ppP = **data_ppP | (valueP >> (bits_to_writeP - available_bits)); + **data_ppP = **data_ppP | (valueP >> (bits_to_write - available_bits)); *bit_pos_pP = 0; *data_ppP = *data_ppP + 1; - bits_to_writeP = bits_to_writeP - available_bits; + bits_to_write = bits_to_write - available_bits; } - } while (bits_to_writeP > 0); + } while (bits_to_write > 0); } //----------------------------------------------------------------------------- -void rlc_am_write16_bit_field(uint8_t** data_ppP, unsigned int* bit_pos_pP, signed int bits_to_writeP, uint16_t valueP) { +void +rlc_am_write16_bit_field( + uint8_t** data_ppP, + unsigned int* bit_pos_pP, + signed int bits_to_writeP, + const uint16_t valueP) { //----------------------------------------------------------------------------- assert(bits_to_writeP <= 16); @@ -157,7 +177,11 @@ void rlc_am_write16_bit_field(uint8_t** data_ppP, unsigned int* bit_pos_pP, sign } } //----------------------------------------------------------------------------- -signed int rlc_am_get_control_pdu_infos(rlc_am_pdu_sn_10_t* header_pP, sdu_size_t *total_size_pP, rlc_am_control_pdu_info_t* pdu_info_pP) +signed int +rlc_am_get_control_pdu_infos( + rlc_am_pdu_sn_10_t* const header_pP, + sdu_size_t * const total_size_pP, + rlc_am_control_pdu_info_t* const pdu_info_pP) //----------------------------------------------------------------------------- { memset(pdu_info_pP, 0, sizeof (rlc_am_control_pdu_info_t)); @@ -214,7 +238,10 @@ signed int rlc_am_get_control_pdu_infos(rlc_am_pdu_sn_10_t* header_pP, sdu_size_ } } //----------------------------------------------------------------------------- -void rlc_am_display_control_pdu_infos(rlc_am_control_pdu_info_t* pdu_info_pP) +void +rlc_am_display_control_pdu_infos( + const rlc_am_control_pdu_info_t* const pdu_info_pP + ) //----------------------------------------------------------------------------- { int num_nack; @@ -237,7 +264,13 @@ void rlc_am_display_control_pdu_infos(rlc_am_control_pdu_info_t* pdu_info_pP) } } //----------------------------------------------------------------------------- -void rlc_am_receive_process_control_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP, mem_block_t* tb_pP, uint8_t** first_byte_ppP, sdu_size_t *tb_size_in_bytes_pP) +void +rlc_am_receive_process_control_pdu( + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t *const rlc_pP, + mem_block_t* const tb_pP, + uint8_t** first_byte_ppP, + sdu_size_t * const tb_size_in_bytes_pP) //----------------------------------------------------------------------------- { rlc_am_pdu_sn_10_t *rlc_am_pdu_sn_10_p = (rlc_am_pdu_sn_10_t*)*first_byte_ppP; @@ -245,12 +278,12 @@ void rlc_am_receive_process_control_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP, if (rlc_am_get_control_pdu_infos(rlc_am_pdu_sn_10_p, tb_size_in_bytes_pP, &g_rlc_am_control_pdu_info) >= 0) { - rlc_am_tx_buffer_display(rlc_pP, frameP, " TX BUFFER BEFORE PROCESS OF STATUS PDU"); + rlc_am_tx_buffer_display(ctxt_pP, rlc_pP, " TX BUFFER BEFORE PROCESS OF STATUS PDU"); LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u] RX CONTROL PDU VT(A) %04d VT(S) %04d POLL_SN %04d ACK_SN %04d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, rlc_pP->vt_a, rlc_pP->vt_s, @@ -286,16 +319,16 @@ void rlc_am_receive_process_control_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP, assert(ack_sn < RLC_AM_SN_MODULO); assert(g_rlc_am_control_pdu_info.num_nack < RLC_AM_MAX_NACK_IN_STATUS_PDU); - if (rlc_am_in_tx_window(rlc_pP, ack_sn) > 0) { + if (rlc_am_in_tx_window(ctxt_pP, rlc_pP, ack_sn) > 0) { rlc_pP->num_nack_so = 0; rlc_pP->num_nack_sn = 0; if (g_rlc_am_control_pdu_info.num_nack == 0) { while (sn_cursor != ack_sn) { if (sn_cursor == rlc_pP->poll_sn) { - rlc_am_stop_and_reset_timer_poll_retransmit(rlc_pP,frameP); + rlc_am_stop_and_reset_timer_poll_retransmit(ctxt_pP, rlc_pP); } - rlc_am_ack_pdu(rlc_pP, frameP, sn_cursor); + rlc_am_ack_pdu(ctxt_pP, rlc_pP, sn_cursor); sn_cursor = (sn_cursor + 1) & RLC_AM_SN_MASK; } } else { @@ -303,15 +336,18 @@ void rlc_am_receive_process_control_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP, nack_sn = g_rlc_am_control_pdu_info.nack_list[nack_index].nack_sn; while (sn_cursor != ack_sn) { if (sn_cursor == rlc_pP->poll_sn) { - rlc_am_stop_and_reset_timer_poll_retransmit(rlc_pP,frameP); + rlc_am_stop_and_reset_timer_poll_retransmit(ctxt_pP, rlc_pP); } if (sn_cursor != nack_sn) { - rlc_am_ack_pdu(rlc_pP, frameP, sn_cursor); + rlc_am_ack_pdu(ctxt_pP, + rlc_pP, + sn_cursor); } else { - rlc_am_nack_pdu (rlc_pP, frameP, - sn_cursor, - g_rlc_am_control_pdu_info.nack_list[nack_index].so_start, - g_rlc_am_control_pdu_info.nack_list[nack_index].so_end); + rlc_am_nack_pdu (ctxt_pP, + rlc_pP, + sn_cursor, + g_rlc_am_control_pdu_info.nack_list[nack_index].so_start, + g_rlc_am_control_pdu_info.nack_list[nack_index].so_end); nack_index = nack_index + 1; if (nack_index == g_rlc_am_control_pdu_info.num_nack) { @@ -331,27 +367,32 @@ void rlc_am_receive_process_control_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP, } } else { LOG_N(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u] WARNING CONTROL PDU ACK SN OUT OF WINDOW\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id); } } else { LOG_W(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u] ERROR IN DECODING CONTROL PDU\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id); } *first_byte_ppP = (uint8_t*)((uint64_t)*first_byte_ppP + initial_pdu_size - *tb_size_in_bytes_pP); free_mem_block(tb_pP); - rlc_am_tx_buffer_display(rlc_pP, frameP, NULL); + rlc_am_tx_buffer_display(ctxt_pP, rlc_pP, NULL); } //----------------------------------------------------------------------------- -int rlc_am_write_status_pdu(frame_t frameP, rlc_am_pdu_sn_10_t* rlc_am_pdu_sn_10_pP, rlc_am_control_pdu_info_t* pdu_info_pP) +int +rlc_am_write_status_pdu( + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t *const rlc_pP, + rlc_am_pdu_sn_10_t* const rlc_am_pdu_sn_10_pP, + rlc_am_control_pdu_info_t* const pdu_info_pP) //----------------------------------------------------------------------------- { unsigned int bit_pos = 4; // range from 0 (MSB/left) to 7 (LSB/right) @@ -381,12 +422,16 @@ int rlc_am_write_status_pdu(frame_t frameP, rlc_am_pdu_sn_10_t* rlc_am_pdu_sn_10 } #ifdef TRACE_STATUS_CREATION LOG_D(RLC, "[FRAME %5u][RLC_AM][MOD XX][RB XX] WROTE STATUS PDU %d BYTES\n", - frameP, num_bytes); + ctxt_pP->frame, num_bytes); #endif return num_bytes; } //----------------------------------------------------------------------------- -void rlc_am_send_status_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP) +void +rlc_am_send_status_pdu( + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t *const rlc_pP + ) //----------------------------------------------------------------------------- { // When STATUS reporting has been triggered, the receiving side of an AM RLC entity shall: @@ -427,10 +472,10 @@ void rlc_am_send_status_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP) nb_bits_to_transmit = nb_bits_to_transmit - 15; #ifdef TRACE_STATUS_CREATION LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][SEND-STATUS] nb_bits_to_transmit %d (15 already allocated for header)\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, nb_bits_to_transmit); rlc_am_rx_list_display(rlc_pP, " DISPLAY BEFORE CONSTRUCTION OF STATUS REPORT"); @@ -440,7 +485,7 @@ void rlc_am_send_status_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP) pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info; sn_cursor = pdu_info_cursor_p->sn; - while (rlc_am_in_rx_window(rlc_pP, sn_cursor) == 0) { + while (rlc_am_in_rx_window(ctxt_pP, rlc_pP, sn_cursor) == 0) { cursor_p = cursor_p->next; previous_sn_cursor = sn_cursor; @@ -448,10 +493,10 @@ void rlc_am_send_status_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP) sn_cursor = pdu_info_cursor_p->sn; #ifdef TRACE_STATUS_CREATION LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][SEND-STATUS] LINE %d FIND VR(R) <= SN sn_cursor %04d -> %04d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, __LINE__, previous_sn_cursor, @@ -467,10 +512,10 @@ void rlc_am_send_status_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP) sn_cursor = pdu_info_cursor_p->sn; #ifdef TRACE_STATUS_CREATION LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][SEND-STATUS] LINE %d LOOPING sn_cursor %04d previous sn_cursor %04d \n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, __LINE__, sn_cursor, @@ -489,10 +534,10 @@ void rlc_am_send_status_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP) sn_cursor = pdu_info_cursor_p->sn; #ifdef TRACE_STATUS_CREATION LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][SEND-STATUS] LINE %d NOW sn_cursor %04d \n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, __LINE__, sn_cursor); @@ -502,10 +547,10 @@ void rlc_am_send_status_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP) control_pdu_info.ack_sn = (sn_cursor + 1) & RLC_AM_SN_MASK; #ifdef TRACE_STATUS_CREATION LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][SEND-STATUS] LINE %d PREPARE SENDING ACK SN %04d \n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, __LINE__, control_pdu_info.ack_sn); @@ -514,10 +559,10 @@ void rlc_am_send_status_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP) control_pdu_info.ack_sn = (previous_sn_cursor + 1) & RLC_AM_SN_MASK; #ifdef TRACE_STATUS_CREATION LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][SEND-STATUS] LINE %d PREPARE SENDING ACK SN %04d (CASE PREVIOUS SN)\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, __LINE__, control_pdu_info.ack_sn); @@ -542,10 +587,10 @@ void rlc_am_send_status_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP) nb_bits_to_transmit = nb_bits_to_transmit - 12; #ifdef TRACE_STATUS_CREATION LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][SEND-STATUS] LINE %d PREPARE SENDING NACK %04d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, __LINE__, previous_sn_cursor); @@ -554,10 +599,10 @@ void rlc_am_send_status_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP) control_pdu_info.ack_sn = (previous_sn_cursor + 1) & RLC_AM_SN_MASK; #ifdef TRACE_STATUS_CREATION LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][SEND-STATUS] LINE %d NO MORE BITS FOR SENDING NACK %04d -> ABORT AND SET FINAL ACK %04d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, __LINE__, previous_sn_cursor, @@ -573,10 +618,10 @@ void rlc_am_send_status_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP) waited_so = 0; #ifdef TRACE_STATUS_CREATION LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][SEND-STATUS] if (all_segments_received == 0) \n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id); #endif do { @@ -591,10 +636,10 @@ void rlc_am_send_status_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP) nb_bits_to_transmit = nb_bits_to_transmit - 42; #ifdef TRACE_STATUS_CREATION LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][SEND-STATUS] LINE %d PREPARE SENDING NACK %04d SO START %05d SO END %05d (CASE SO %d > WAITED SO %d)\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, __LINE__, sn_cursor, @@ -608,10 +653,10 @@ void rlc_am_send_status_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP) waited_so = 0x7FFF; #ifdef TRACE_STATUS_CREATION LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][SEND-STATUS] LINE %d SN %04d SET WAITED SO 0x7FFF)\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, __LINE__, sn_cursor); #endif @@ -620,10 +665,10 @@ void rlc_am_send_status_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP) waited_so = pdu_info_cursor_p->so + pdu_info_cursor_p->payload_size; #ifdef TRACE_STATUS_CREATION LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][SEND-STATUS] LINE %d SN %04d SET WAITED SO %d @1\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, __LINE__, sn_cursor, @@ -643,10 +688,10 @@ void rlc_am_send_status_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP) #ifdef TRACE_STATUS_CREATION LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][SEND-STATUS] LINE %d SN %04d SET WAITED SO %d @2\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, __LINE__, sn_cursor, waited_so); @@ -680,10 +725,10 @@ void rlc_am_send_status_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP) nb_bits_to_transmit = nb_bits_to_transmit - 42; #ifdef TRACE_STATUS_CREATION LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][SEND-STATUS] LINE %d PREPARE SENDING NACK %04d SO START %05d SO END %05d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, __LINE__, previous_sn_cursor, @@ -707,10 +752,10 @@ void rlc_am_send_status_pdu(rlc_am_entity_t* rlc_pP, frame_t frameP) control_pdu_info.ack_sn = rlc_pP->vr_r; #ifdef TRACE_STATUS_CREATION LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][SEND-STATUS] LINE %d PREPARE SENDING ACK %04d = VR(R)\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, __LINE__, control_pdu_info.ack_sn); @@ -722,14 +767,14 @@ end_push_nack: control_pdu_info.nack_list[control_pdu_info.num_nack - 1].e1 = 0; } //msg ("[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u] nb_bits_to_transmit %d\n", - // rlc_pP->module_id, rlc_pP->rb_id, frameP,nb_bits_to_transmit); + // rlc_pP->module_id, rlc_pP->rb_id, ctxt_pP->frame,nb_bits_to_transmit); #ifdef TRACE_STATUS_CREATION LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][SEND-STATUS] LINE %d PREPARE SENDING ACK %04d NUM NACK %d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, __LINE__, control_pdu_info.ack_sn, @@ -740,10 +785,10 @@ end_push_nack: #ifdef TRACE_STATUS_CREATION LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][SEND-STATUS] LINE %d forecast pdu_size %d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, __LINE__, pdu_size); @@ -754,16 +799,16 @@ end_push_nack: ((struct mac_tb_req*)(tb_p->data))->data_ptr = (uint8_t*)&(tb_p->data[sizeof(struct mac_tb_req)]); // warning reuse of pdu_size - pdu_size = rlc_am_write_status_pdu(frameP,(rlc_am_pdu_sn_10_t*)(((struct mac_tb_req*)(tb_p->data))->data_ptr), &control_pdu_info); + pdu_size = rlc_am_write_status_pdu(ctxt_pP, rlc_pP,(rlc_am_pdu_sn_10_t*)(((struct mac_tb_req*)(tb_p->data))->data_ptr), &control_pdu_info); ((struct mac_tb_req*)(tb_p->data))->tb_size = pdu_size; //assert((((struct mac_tb_req*)(tb_p->data))->tb_size) < 3000); #ifdef TRACE_STATUS_CREATION LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][SEND-STATUS] SEND STATUS PDU SIZE %d, rlc_pP->nb_bytes_requested_by_mac %d, nb_bits_to_transmit>>3 %d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, pdu_size, rlc_pP->nb_bytes_requested_by_mac, diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_status_report.h b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_status_report.h index d12ec9039ff6bfd6c47c5c3c361db10102b0c54b..c8a35b98715074252d111ca3262295403b09f0c8 100755 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_status_report.h +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_status_report.h @@ -65,25 +65,25 @@ #include "PHY/defs.h" //----------------------------------------------------------------------------- -/*! \fn uint16_t rlc_am_read_bit_field (uint8_t** dataP, unsigned int* bit_posP, signed int bits_to_readP) +/*! \fn uint16_t rlc_am_read_bit_field (uint8_t** dataP, unsigned int* bit_posP, const signed int bits_to_readP) * \brief Read N bits in a byte area seen as a bit-field with the help of a byte index and a modulo 8 bit index. * \param[in,out] dataP Data pointer on area to read, updated after the read. * \param[in,out] bit_posP Last ending read bit position, updated after the read. * \param[in] bits_to_readP Number of bits to read (max 16). * \return Value read on 16 bits, bits read are shifted to least significant bits of returned short value. */ -protected_rlc_am_status_report( uint16_t rlc_am_read_bit_field (uint8_t** dataP, unsigned int* bit_posP, signed int bits_to_readP);) +protected_rlc_am_status_report( uint16_t rlc_am_read_bit_field (uint8_t** dataP, unsigned int* bit_posP, const signed int bits_to_readP);) -/*! \fn void rlc_am_write8_bit_field(uint8_t** dataP, unsigned int* bit_posP, signed int bits_to_writeP, uint8_t valueP) +/*! \fn void rlc_am_write8_bit_field(uint8_t** dataP, unsigned int* bit_posP, signed int bits_to_writeP, const uint8_t valueP) * \brief Write N bits (max 8) in a byte area seen as a bit-field with the help of a byte index and a modulo 8 bit index. * \param[in,out] dataP Data pointer on area to write, updated after the write. * \param[in,out] bit_posP Last ending read write position, updated after the write. * \param[in] bits_to_writeP Number of bits to write (max 8). * \param[in] valueP Value to write. */ -protected_rlc_am_status_report(void rlc_am_write8_bit_field(uint8_t** dataP, unsigned int* bit_posP, signed int bits_to_writeP, uint8_t valueP);) +protected_rlc_am_status_report(void rlc_am_write8_bit_field(uint8_t** dataP, unsigned int* bit_posP, signed int bits_to_writeP, const uint8_t valueP);) -/*! \fn void rlc_am_write16_bit_field(uint8_t** dataP, unsigned int* bit_posP, signed int bits_to_writeP, uint16_t valueP) +/*! \fn void rlc_am_write16_bit_field(uint8_t** dataP, unsigned int* bit_posP, signed int bits_to_writeP, const uint16_t valueP) * \brief Write N bits (max 16) in a byte area seen as a bit-field with the help of a byte index and a modulo 8 bit index. * \param[in,out] dataP Data pointer on area to write, updated after the write. * \param[in,out] bit_posP Last ending read write position, updated after the write. @@ -91,57 +91,64 @@ protected_rlc_am_status_report(void rlc_am_write8_bit_field(uint8_t** dat * \param[in] valueP Value to write. */ protected_rlc_am_status_report(void rlc_am_write16_bit_field( - uint8_t** dataP, - unsigned int* bit_posP, - signed int bits_to_writeP, - uint16_t valueP);) + uint8_t** dataP, + unsigned int* bit_posP, + signed int bits_to_writeP, + const uint16_t valueP);) -/*! \fn signed int rlc_am_get_control_pdu_infos (rlc_am_pdu_sn_10_t* headerP, sdu_size_t *total_sizeP, rlc_am_control_pdu_info_t* pdu_infoP) +/*! \fn signed int rlc_am_get_control_pdu_infos (rlc_am_pdu_sn_10_t* const headerP, sdu_size_t * const total_sizeP, rlc_am_control_pdu_info_t* const pdu_infoP) * \brief Retrieve control PDU informations from a serialized control PDU. * \param[in] headerP Pointer on the header of the RLC AM PDU. * \param[in] total_size_pP Pointer on PDU size in bytes. * \param[in,out] pdu_infoP Struct containing interpreted PDU control informations. */ protected_rlc_am_status_report( signed int rlc_am_get_control_pdu_infos ( - rlc_am_pdu_sn_10_t* headerP, - sdu_size_t *total_size_pP, - rlc_am_control_pdu_info_t* pdu_infoP);) + rlc_am_pdu_sn_10_t* const headerP, + sdu_size_t * const total_size_pP, + rlc_am_control_pdu_info_t* const pdu_infoP);) -/*! \fn void rlc_am_display_control_pdu_infos(rlc_am_control_pdu_info_t* pdu_infoP) +/*! \fn void rlc_am_display_control_pdu_infos(const rlc_am_control_pdu_info_t* const pdu_infoP) * \brief Dump on LOG output the informations contained in the pdu_infoP structure. * \param[in] pdu_infoP Struct containing interpreted PDU control informations. */ -protected_rlc_am_status_report( void rlc_am_display_control_pdu_infos(rlc_am_control_pdu_info_t* pdu_infoP);) +protected_rlc_am_status_report( void rlc_am_display_control_pdu_infos(const rlc_am_control_pdu_info_t* const pdu_infoP);) -/*! \fn void rlc_am_receive_process_control_pdu(rlc_am_entity_t* rlcP, frame_t frameP, mem_block_t* tbP, uint8_t* first_byte, uint16_t tb_size_in_bytes) +/*! \fn void rlc_am_receive_process_control_pdu(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlc_pP, mem_block_t* const tbP, uint8_t* first_byte, const uint16_t tb_size_in_bytes) * \brief Process the informations contained in the control PDU. -* \param[in] rlcP RLC AM protocol instance pointer. -* \param[in] frame Frame index. +* \param[in] ctxt_pP Running context. +* \param[in] rlc_pP RLC AM protocol instance pointer. * \param[in] tbP Control PDU embedded in a mem_block_t structure. * \param[in] first_byte Pointer on first byte of control PDU. * \param[in] tb_size_in_bytes Pointer on size of serialized control PDU in bytes. */ protected_rlc_am_status_report( void rlc_am_receive_process_control_pdu( - rlc_am_entity_t* rlcP, - frame_t frameP, - mem_block_t* tbP, - uint8_t** first_byte, - sdu_size_t *tb_size_in_bytes);) + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t* const rlc_pP, + mem_block_t* const tbP, + uint8_t** first_byte, + sdu_size_t * const tb_size_in_bytes);) -/*! \fn int rlc_am_write_status_pdu(frame_t frameP,rlc_am_pdu_sn_10_t* rlc_am_pdu_sn_10P, rlc_am_control_pdu_info_t* pdu_infoP) +/*! \fn int rlc_am_write_status_pdu(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlc_pP, rlc_am_pdu_sn_10_t* const rlc_am_pdu_sn_10P, rlc_am_control_pdu_info_t* const pdu_infoP) * \brief Remove all marked holes for PDU with sequence number "snP". -* \param[in] frame Frame index. +* \param[in] ctxt_pP Running context. +* \param[in] rlc_pP RLC AM protocol instance pointer. * \param[in] rlc_am_pdu_sn_10P Pointer on the header of the RLC AM control PDU. * \param[in] pdu_infoP Struct containing PDU control informations elements. * \return The number of bytes that have been written. */ -protected_rlc_am_status_report(int rlc_am_write_status_pdu(frame_t frameP, rlc_am_pdu_sn_10_t* rlc_am_pdu_sn_10P, rlc_am_control_pdu_info_t* pdu_infoP);) +protected_rlc_am_status_report(int rlc_am_write_status_pdu( + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t *const rlc_pP, + rlc_am_pdu_sn_10_t* const rlc_am_pdu_sn_10P, + rlc_am_control_pdu_info_t* const pdu_infoP);) -/*! \fn void rlc_am_send_status_pdu(rlc_am_entity_t* rlcP, frame_t frameP) +/*! \fn void rlc_am_send_status_pdu(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlc_pP) * \brief Send a status PDU based on the receiver buffer content. -* \param[in] rlcP RLC AM protocol instance pointer. -* \param[in] frame Frame index. +* \param[in] ctxt_pP Running context. +* \param[in] rlc_pP RLC AM protocol instance pointer. */ -protected_rlc_am_status_report(void rlc_am_send_status_pdu(rlc_am_entity_t* rlcP, frame_t frameP);) +protected_rlc_am_status_report(void rlc_am_send_status_pdu( + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t *const rlc_pP);) /** @} */ #endif diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_poll_retransmit.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_poll_retransmit.c index 89d804488f77e5144f1a7edbca4ee8d0f7ba37ac..bb8f4253b920255933f8f968fdcbc60fdc122e98 100755 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_poll_retransmit.c +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_poll_retransmit.c @@ -37,9 +37,11 @@ #include "LAYER2/MAC/extern.h" #include "UTIL/LOG/log.h" //----------------------------------------------------------------------------- -void rlc_am_check_timer_poll_retransmit( - rlc_am_entity_t *const rlc_pP, - const frame_t frameP) +void +rlc_am_check_timer_poll_retransmit( + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t * const rlc_pP + ) //----------------------------------------------------------------------------- { // 5.2.2.3 Expiry of t-PollRetransmit @@ -59,50 +61,56 @@ void rlc_am_check_timer_poll_retransmit( // +-----------+------------------+----------+ //FRAME # 0 FRAME MAX ((rlc_pP->t_poll_retransmit.frame_start < rlc_pP->t_poll_retransmit.frame_time_out) && - ((frameP >= rlc_pP->t_poll_retransmit.frame_time_out) || - (frameP < rlc_pP->t_poll_retransmit.frame_start))) || + ((ctxt_pP->frame >= rlc_pP->t_poll_retransmit.frame_time_out) || + (ctxt_pP->frame < rlc_pP->t_poll_retransmit.frame_start))) || // CASE 2: time out start // +-----------+------------------+----------+ // |***********| |**********| // +-----------+------------------+----------+ //FRAME # 0 FRAME MAX VALUE ((rlc_pP->t_poll_retransmit.frame_start > rlc_pP->t_poll_retransmit.frame_time_out) && - (frameP < rlc_pP->t_poll_retransmit.frame_start) && (frameP >= rlc_pP->t_poll_retransmit.frame_time_out)) + (ctxt_pP->frame < rlc_pP->t_poll_retransmit.frame_start) && (ctxt_pP->frame >= rlc_pP->t_poll_retransmit.frame_time_out)) ) { - //if (rlc_pP->t_poll_retransmit.frame_time_out <= frameP) { + //if (rlc_pP->t_poll_retransmit.frame_time_out <= ctxt_pP->frame) { rlc_pP->t_poll_retransmit.running = 0; rlc_pP->t_poll_retransmit.timed_out = 1; rlc_pP->stat_timer_poll_retransmit_timed_out += 1; LOG_D(RLC, "[FRAME %05d][%s][RLC_AM][MOD %u/%u][RB %u][T_POLL_RETRANSMIT] TIME-OUT\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id); //#warning TO DO rlc_am_check_timer_poll_retransmit - rlc_pP->t_poll_retransmit.frame_time_out = frameP + rlc_pP->t_poll_retransmit.time_out; + rlc_pP->t_poll_retransmit.frame_time_out = ctxt_pP->frame + rlc_pP->t_poll_retransmit.time_out; } } } //----------------------------------------------------------------------------- -int rlc_am_is_timer_poll_retransmit_timed_out(rlc_am_entity_t *const rlc_pP) +int +rlc_am_is_timer_poll_retransmit_timed_out( + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t * const rlc_pP + ) //----------------------------------------------------------------------------- { return rlc_pP->t_poll_retransmit.timed_out; } //----------------------------------------------------------------------------- -void rlc_am_stop_and_reset_timer_poll_retransmit( - rlc_am_entity_t *const rlc_pP, - const frame_t frameP) +void +rlc_am_stop_and_reset_timer_poll_retransmit( + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t * const rlc_pP + ) //----------------------------------------------------------------------------- { LOG_D(RLC, "[FRAME %05d][%s][RLC_AM][MOD %u/%u][RB %u][T_POLL_RETRANSMIT] STOPPED AND RESET\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id); rlc_pP->t_poll_retransmit.running = 0; rlc_pP->t_poll_retransmit.frame_time_out = 0; @@ -110,27 +118,31 @@ void rlc_am_stop_and_reset_timer_poll_retransmit( rlc_pP->t_poll_retransmit.timed_out = 0; } //----------------------------------------------------------------------------- -void rlc_am_start_timer_poll_retransmit( - rlc_am_entity_t *const rlc_pP, - const frame_t frameP) +void +rlc_am_start_timer_poll_retransmit( + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t * const rlc_pP + ) //----------------------------------------------------------------------------- { rlc_pP->t_poll_retransmit.running = 1; - rlc_pP->t_poll_retransmit.frame_time_out = frameP + rlc_pP->t_poll_retransmit.time_out; - rlc_pP->t_poll_retransmit.frame_start = frameP; + rlc_pP->t_poll_retransmit.frame_time_out = ctxt_pP->frame + rlc_pP->t_poll_retransmit.time_out; + rlc_pP->t_poll_retransmit.frame_start = ctxt_pP->frame; rlc_pP->t_poll_retransmit.timed_out = 0; LOG_D(RLC, "[FRAME %05d][%s][RLC_AM][MOD %u/%u][RB %u][T_POLL_RETRANSMIT] STARTED (TIME-OUT = FRAME %05d)\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, rlc_pP->t_poll_retransmit.frame_time_out); } //----------------------------------------------------------------------------- -void rlc_am_init_timer_poll_retransmit( - rlc_am_entity_t *const rlc_pP, - const uint32_t time_outP) +void +rlc_am_init_timer_poll_retransmit( + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t * const rlc_pP, + const uint32_t time_outP) //----------------------------------------------------------------------------- { rlc_pP->t_poll_retransmit.running = 0; diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_poll_retransmit.h b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_poll_retransmit.h index 476571e6d9e7998c19913b9a6444a2cee290f14f..cf868feb008d9a23ee14957a51fc6f4433a57f48 100755 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_poll_retransmit.h +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_poll_retransmit.h @@ -58,47 +58,55 @@ # endif # endif -/*! \fn void rlc_am_check_timer_poll_retransmit(rlc_am_entity_t *rlc_pP,frame_t frameP) +/*! \fn void rlc_am_check_timer_poll_retransmit(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlc_pP) * \brief Check if timer Poll-retransmit has timed-out, if so it is stopped and has the status "timed-out". -* \param[in] rlc_pP RLC AM protocol instance pointer. -* \param[in] frame Frame index +* \param[in] ctxt_pP Running context. +* \param[in] rlc_pP RLC AM protocol instance pointer. + */ protected_rlc_am_timer_poll_retransmit(void rlc_am_check_timer_poll_retransmit( - rlc_am_entity_t *const rlc_pP, - const frame_t frameP)); + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t* const rlc_pP)); -/*! \fn int rlc_am_is_timer_poll_retransmit_timed_out(rlc_am_entity_t *rlc_pP) +/*! \fn int rlc_am_is_timer_poll_retransmit_timed_out(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlc_pP) * \brief Boolean function, check if timer Poll-retransmit has timed-out. -* \param[in] rlc_pP RLC AM protocol instance pointer. +* \param[in] ctxt_pP Running context. +* \param[in] rlc_pP RLC AM protocol instance pointer. * \return 1 if timer Poll-retransmit has timed-out, else 0. */ -protected_rlc_am_timer_poll_retransmit(int rlc_am_is_timer_poll_retransmit_timed_out(rlc_am_entity_t *const rlc_pP);) +protected_rlc_am_timer_poll_retransmit(int rlc_am_is_timer_poll_retransmit_timed_out( + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t* const rlc_pP);) -/*! \fn void rlc_am_stop_and_reset_timer_poll_retransmit(rlc_am_entity_t *rlc_pP,frame_t frameP) +/*! \fn void rlc_am_stop_and_reset_timer_poll_retransmit(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlc_pP) * \brief Stop and reset the timer Poll-retransmit. -* \param[in] rlc_pP RLC AM protocol instance pointer. -* \param[in] frame Frame index +* \param[in] ctxt_pP Running context. +* \param[in] rlc_pP RLC AM protocol instance pointer. + */ protected_rlc_am_timer_poll_retransmit(void rlc_am_stop_and_reset_timer_poll_retransmit( - rlc_am_entity_t *const rlc_pP, - const frame_t frameP);) + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t* const rlc_pP);) -/*! \fn void rlc_am_start_timer_poll_retransmit(rlc_am_entity_t *rlc_pP,frame_t frameP) +/*! \fn void rlc_am_start_timer_poll_retransmit(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlc_pP) * \brief Re-arm (based on RLC AM config parameter) and start timer Poll-retransmit. -* \param[in] rlc_pP RLC AM protocol instance pointer. +* \param[in] ctxt_pP Running context. +* \param[in] rlc_pP RLC AM protocol instance pointer. * \param[in] frame Frame index */ protected_rlc_am_timer_poll_retransmit(void rlc_am_start_timer_poll_retransmit( - rlc_am_entity_t *const rlc_pP, - const frame_t frameP);) + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t* const rlc_pP);) -/*! \fn void rlc_am_init_timer_poll_retransmit(rlc_am_entity_t *rlc_pP, uint32_t time_outP) +/*! \fn void rlc_am_init_timer_poll_retransmit(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlc_pP, const uint32_t time_outP) * \brief Initialize the timer Poll-retransmit with RLC AM time-out config parameter. -* \param[in] rlc_pP RLC AM protocol instance pointer. +* \param[in] ctxt_pP Running context. +* \param[in] rlc_pP RLC AM protocol instance pointer. * \param[in] time_outP Time-out in frame units. */ protected_rlc_am_timer_poll_retransmit(void rlc_am_init_timer_poll_retransmit( - rlc_am_entity_t *const rlc_pP, - const uint32_t time_outP);) + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t* const rlc_pP, + const uint32_t time_outP);) /** @} */ #endif diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_reordering.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_reordering.c index 7ecd84b752a8f590d1990613e8477adbddac8d15..97be045ea80c1ce3a42c41e2ecab8dfe45245822 100755 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_reordering.c +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_reordering.c @@ -37,7 +37,10 @@ # include "LAYER2/MAC/extern.h" #include "UTIL/LOG/log.h" //----------------------------------------------------------------------------- -void rlc_am_check_timer_reordering(rlc_am_entity_t *rlc_pP,frame_t frameP) +void +rlc_am_check_timer_reordering( + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t * const rlc_pP) //----------------------------------------------------------------------------- { return ; // for debug @@ -51,17 +54,17 @@ void rlc_am_check_timer_reordering(rlc_am_entity_t *rlc_pP,frame_t frameP) // +-----------+------------------+----------+ //FRAME # 0 FRAME MAX ((rlc_pP->t_reordering.frame_start < rlc_pP->t_reordering.frame_time_out) && - ((frameP >= rlc_pP->t_reordering.frame_time_out) || - (frameP < rlc_pP->t_reordering.frame_start))) || + ((ctxt_pP->frame >= rlc_pP->t_reordering.frame_time_out) || + (ctxt_pP->frame < rlc_pP->t_reordering.frame_start))) || // CASE 2: time out start // +-----------+------------------+----------+ // |***********| |**********| // +-----------+------------------+----------+ //FRAME # 0 FRAME MAX VALUE ((rlc_pP->t_reordering.frame_start > rlc_pP->t_reordering.frame_time_out) && - (frameP < rlc_pP->t_reordering.frame_start) && (frameP >= rlc_pP->t_reordering.frame_time_out)) + (ctxt_pP->frame < rlc_pP->t_reordering.frame_start) && (ctxt_pP->frame >= rlc_pP->t_reordering.frame_time_out)) ) { - //if (rlc_pP->t_reordering.frame_time_out == frameP) { + //if (rlc_pP->t_reordering.frame_time_out == ctxt_pP->frame) { // 5.1.3.2.4 Actions when t-Reordering expires // When t-Reordering expires, the receiving side of an AM RLC entity shall: // - update VR(MS) to the SN of the first AMD PDU with SN >= VR(X) for which not all byte segments have been @@ -86,7 +89,7 @@ void rlc_am_check_timer_reordering(rlc_am_entity_t *rlc_pP,frame_t frameP) // NOT VERY SURE ABOUT THAT, THINK ABOUT IT rlc_pP->vr_ms = (pdu_info->sn + 1) & RLC_AM_SN_MASK; - if (rlc_am_sn_gte_vr_x(rlc_pP, pdu_info->sn)) { + if (rlc_am_sn_gte_vr_x(ctxt_pP, rlc_pP, pdu_info->sn)) { if (((rlc_am_rx_pdu_management_t*)(cursor->data))->all_segments_received == 0) { rlc_pP->vr_ms = pdu_info->sn; break; @@ -95,22 +98,22 @@ void rlc_am_check_timer_reordering(rlc_am_entity_t *rlc_pP,frame_t frameP) cursor = cursor->next; } while (cursor != NULL); LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][T-REORDERING] TIME-OUT UPDATED VR(MS) %04d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, rlc_pP->vr_ms); } - if (rlc_am_sn_gt_vr_ms(rlc_pP, rlc_pP->vr_h)) { + if (rlc_am_sn_gt_vr_ms(ctxt_pP, rlc_pP, rlc_pP->vr_h)) { rlc_pP->vr_x = rlc_pP->vr_h; - rlc_pP->t_reordering.frame_time_out = frameP + rlc_pP->t_reordering.time_out; + rlc_pP->t_reordering.frame_time_out = ctxt_pP->frame + rlc_pP->t_reordering.time_out; LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][T-REORDERING] TIME-OUT, RESTARTED T-REORDERING, UPDATED VR(X) to VR(R) %04d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, rlc_pP->vr_x); } @@ -120,14 +123,17 @@ void rlc_am_check_timer_reordering(rlc_am_entity_t *rlc_pP,frame_t frameP) } } //----------------------------------------------------------------------------- -void rlc_am_stop_and_reset_timer_reordering(rlc_am_entity_t *rlc_pP,frame_t frameP) +void +rlc_am_stop_and_reset_timer_reordering( + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t * const rlc_pP) //----------------------------------------------------------------------------- { LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][T-REORDERING] STOPPED AND RESET\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id); rlc_pP->t_reordering.running = 0; rlc_pP->t_reordering.frame_time_out = 0; @@ -135,23 +141,30 @@ void rlc_am_stop_and_reset_timer_reordering(rlc_am_entity_t *rlc_pP,frame_t fram rlc_pP->t_reordering.timed_out = 0; } //----------------------------------------------------------------------------- -void rlc_am_start_timer_reordering(rlc_am_entity_t *rlc_pP,frame_t frameP) +void +rlc_am_start_timer_reordering( + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t * const rlc_pP) //----------------------------------------------------------------------------- { rlc_pP->t_reordering.running = 1; - rlc_pP->t_reordering.frame_time_out = frameP + rlc_pP->t_reordering.time_out; - rlc_pP->t_reordering.frame_start = frameP; + rlc_pP->t_reordering.frame_time_out = ctxt_pP->frame + rlc_pP->t_reordering.time_out; + rlc_pP->t_reordering.frame_start = ctxt_pP->frame; rlc_pP->t_reordering.timed_out = 0; LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][T-REORDERING] STARTED (TIME-OUT = FRAME %5u)\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, rlc_pP->t_reordering.frame_time_out); } //----------------------------------------------------------------------------- -void rlc_am_init_timer_reordering(rlc_am_entity_t *rlc_pP, uint32_t time_outP) +void +rlc_am_init_timer_reordering( + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t * const rlc_pP, + const uint32_t time_outP) //----------------------------------------------------------------------------- { rlc_pP->t_reordering.running = 0; diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_reordering.h b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_reordering.h index 6d06cac4a76331c19f8396ea75fd173266cef328..a4d9f70a5990182ded605e81f385c27a87a76d27 100755 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_reordering.h +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_reordering.h @@ -57,32 +57,42 @@ # endif # endif -/*! \fn void rlc_am_check_timer_reordering(rlc_am_entity_t *rlc_pP,frame_t frameP) +/*! \fn void rlc_am_check_timer_reordering(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlc_pP) * \brief Check if timer reordering has timed-out, if so it is stopped and has the status "timed-out". -* \param[in] rlc_pP RLC AM protocol instance pointer. -* \param[in] frameP Frame index +* \param[in] ctxt_pP Running context. +* \param[in] rlc_pP RLC AM protocol instance pointer. */ -protected_rlc_am_timer_reordering(void rlc_am_check_timer_reordering(rlc_am_entity_t *rlc_pP,frame_t frameP)); +protected_rlc_am_timer_reordering(void rlc_am_check_timer_reordering( + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t* const rlc_pP)); -/*! \fn void rlc_am_stop_and_reset_timer_reordering(rlc_am_entity_t *rlc_pP,frame_t frameP) +/*! \fn void rlc_am_stop_and_reset_timer_reordering(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlc_pP) * \brief Stop and reset the timer reordering. -* \param[in] rlc_pP RLC AM protocol instance pointer. -* \param[in] frameP Frame index. +* \param[in] ctxt_pP Running context. +* \param[in] rlc_pP RLC AM protocol instance pointer. */ -protected_rlc_am_timer_reordering(void rlc_am_stop_and_reset_timer_reordering(rlc_am_entity_t *rlc_pP,frame_t frameP);) +protected_rlc_am_timer_reordering(void rlc_am_stop_and_reset_timer_reordering( + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t* const rlc_pP);) -/*! \fn void rlc_am_start_timer_reordering(rlc_am_entity_t *rlc_pP,frame_t frameP) +/*! \fn void rlc_am_start_timer_reordering(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlc_pP) * \brief Re-arm (based on RLC AM config parameter) and start timer reordering. -* \param[in] rlc_pP RLC AM protocol instance pointer. -* \param[in] frameP Frame index. +* \param[in] ctxt_pP Running context. +* \param[in] rlc_pP RLC AM protocol instance pointer. */ -protected_rlc_am_timer_reordering(void rlc_am_start_timer_reordering(rlc_am_entity_t *rlc_pP,frame_t frameP);) +protected_rlc_am_timer_reordering(void rlc_am_start_timer_reordering( + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t* const rlc_pP);) -/*! \fn void rlc_am_init_timer_reordering(rlc_am_entity_t *rlc_pP, uint32_t time_outP) +/*! \fn void rlc_am_init_timer_reordering(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlc_pP, const uint32_t time_outP) * \brief Initialize the timer reordering with RLC AM time-out config parameter. -* \param[in] rlc_pP RLC AM protocol instance pointer. +* \param[in] ctxt_pP Running context. +* \param[in] rlc_pP RLC AM protocol instance pointer. * \param[in] time_outP Time-out in frameP units. */ -protected_rlc_am_timer_reordering(void rlc_am_init_timer_reordering(rlc_am_entity_t *rlc_pP, uint32_t time_outP);) +protected_rlc_am_timer_reordering(void rlc_am_init_timer_reordering( + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t* const rlc_pP, + const uint32_t time_outP);) /** @} */ #endif diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_status_prohibit.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_status_prohibit.c index 469853debecc270a5cf0fd7d478e6b1c7548d403..0607e94b914eb8ed42aa694209feae96b9e8fc08 100755 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_status_prohibit.c +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_status_prohibit.c @@ -37,9 +37,10 @@ #include "LAYER2/MAC/extern.h" #include "UTIL/LOG/log.h" //----------------------------------------------------------------------------- -void rlc_am_check_timer_status_prohibit( - rlc_am_entity_t * const rlc_pP, - const frame_t frameP) +void +rlc_am_check_timer_status_prohibit( + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t * const rlc_pP) //----------------------------------------------------------------------------- { if (rlc_pP->t_status_prohibit.time_out > 0) { @@ -51,47 +52,49 @@ void rlc_am_check_timer_status_prohibit( // +-----------+------------------+----------+ //FRAME # 0 FRAME MAX ((rlc_pP->t_status_prohibit.frame_start < rlc_pP->t_status_prohibit.frame_time_out) && - ((frameP >= rlc_pP->t_status_prohibit.frame_time_out) || - (frameP < rlc_pP->t_status_prohibit.frame_start))) || + ((ctxt_pP->frame >= rlc_pP->t_status_prohibit.frame_time_out) || + (ctxt_pP->frame < rlc_pP->t_status_prohibit.frame_start))) || // CASE 2: time out start // +-----------+------------------+----------+ // |***********| |**********| // +-----------+------------------+----------+ //FRAME # 0 FRAME MAX VALUE ((rlc_pP->t_status_prohibit.frame_start > rlc_pP->t_status_prohibit.frame_time_out) && - (frameP < rlc_pP->t_status_prohibit.frame_start) && (frameP >= rlc_pP->t_status_prohibit.frame_time_out)) + (ctxt_pP->frame < rlc_pP->t_status_prohibit.frame_start) && (ctxt_pP->frame >= rlc_pP->t_status_prohibit.frame_time_out)) ) { - //if ((rlc_pP->t_status_prohibit.frame_time_out <= frameP) && (rlc_pP->t_status_prohibit.frame_start)) { + //if ((rlc_pP->t_status_prohibit.frame_time_out <= ctxt_pP->frame) && (rlc_pP->t_status_prohibit.frame_start)) { rlc_pP->t_status_prohibit.running = 0; rlc_pP->t_status_prohibit.timed_out = 1; rlc_pP->stat_timer_status_prohibit_timed_out += 1; LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][T-STATUS-PROHIBIT] TIME-OUT\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id); //#warning TO DO rlc_am_check_timer_status_prohibit - rlc_am_stop_and_reset_timer_status_prohibit(rlc_pP, frameP); - //rlc_pP->t_status_prohibit.frame_time_out = frameP + rlc_pP->t_status_prohibit.time_out; + rlc_am_stop_and_reset_timer_status_prohibit(ctxt_pP, rlc_pP); + //rlc_pP->t_status_prohibit.frame_time_out = ctxt_pP->frame + rlc_pP->t_status_prohibit.time_out; } } } } //----------------------------------------------------------------------------- -void rlc_am_stop_and_reset_timer_status_prohibit( - rlc_am_entity_t *const rlc_pP, - const frame_t frameP) +void +rlc_am_stop_and_reset_timer_status_prohibit( + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t *const rlc_pP +) //----------------------------------------------------------------------------- { if (rlc_pP->t_status_prohibit.time_out > 0) { LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][T-STATUS-PROHIBIT] STOPPED AND RESET\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id); rlc_pP->t_status_prohibit.running = 0; rlc_pP->t_status_prohibit.frame_time_out = 0; @@ -100,21 +103,23 @@ void rlc_am_stop_and_reset_timer_status_prohibit( } } //----------------------------------------------------------------------------- -void rlc_am_start_timer_status_prohibit( - rlc_am_entity_t *const rlc_pP, - const frame_t frameP) +void +rlc_am_start_timer_status_prohibit( + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t *const rlc_pP +) //----------------------------------------------------------------------------- { if (rlc_pP->t_status_prohibit.time_out > 0) { rlc_pP->t_status_prohibit.running = 1; - rlc_pP->t_status_prohibit.frame_time_out = rlc_pP->t_status_prohibit.time_out + frameP; - rlc_pP->t_status_prohibit.frame_start = frameP; + rlc_pP->t_status_prohibit.frame_time_out = rlc_pP->t_status_prohibit.time_out + ctxt_pP->frame; + rlc_pP->t_status_prohibit.frame_start = ctxt_pP->frame; rlc_pP->t_status_prohibit.timed_out = 0; LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u][T-STATUS-PROHIBIT] STARTED (TIME-OUT = FRAME %5u)\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, rlc_pP->t_status_prohibit.frame_time_out); LOG_D(RLC, "TIME-OUT = FRAME %5u\n", rlc_pP->t_status_prohibit.frame_time_out); @@ -122,8 +127,9 @@ void rlc_am_start_timer_status_prohibit( } //----------------------------------------------------------------------------- void rlc_am_init_timer_status_prohibit( - rlc_am_entity_t *const rlc_pP, - const uint32_t time_outP) + const protocol_ctxt_t* const ctxt_pP, + rlc_am_entity_t *const rlc_pP, + const uint32_t time_outP) //----------------------------------------------------------------------------- { rlc_pP->t_status_prohibit.running = 0; diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_status_prohibit.h b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_status_prohibit.h index 5cc3d3f68b4e83ecf5df501e5e6b88153d942290..cf6ffc06bcf244a397300ba445803ca095f5b630 100755 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_status_prohibit.h +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_status_prohibit.h @@ -57,32 +57,33 @@ # endif # endif -/*! \fn void rlc_am_check_timer_status_prohibit(rlc_am_entity_t *rlc_pP,frame_t frameP) +/*! \fn void rlc_am_check_timer_status_prohibit(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlc_pP) * \brief Check if timer status-prohibit has timed-out, if so it is stopped and has the status "timed-out". -* \param[in] rlc_pP RLC AM protocol instance pointer. -* \param[in] frameP Frame index +* \param[in] ctxt_pP Running context. +* \param[in] rlc_pP RLC AM protocol instance pointer. */ -protected_rlc_am_timer_status_prohibit(void rlc_am_check_timer_status_prohibit(rlc_am_entity_t *rlc_pP,frame_t frameP)); +protected_rlc_am_timer_status_prohibit(void rlc_am_check_timer_status_prohibit(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlc_pP)); -/*! \fn void rlc_am_stop_and_reset_timer_status_prohibit(rlc_am_entity_t *rlc_pP) +/*! \fn void rlc_am_stop_and_reset_timer_status_prohibit(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlc_pP) * \brief Stop and reset the timer status-prohibit. -* \param[in] rlc_pP RLC AM protocol instance pointer. -* \param[in] frameP Frame index +* \param[in] ctxt_pP Running context. +* \param[in] rlc_pP RLC AM protocol instance pointer. */ -protected_rlc_am_timer_status_prohibit(void rlc_am_stop_and_reset_timer_status_prohibit(rlc_am_entity_t *rlc_pP,frame_t frameP);) +protected_rlc_am_timer_status_prohibit(void rlc_am_stop_and_reset_timer_status_prohibit(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlc_pP);) -/*! \fn void rlc_am_start_timer_status_prohibit(rlc_am_entity_t *rlc_pP,frame_t frameP) +/*! \fn void rlc_am_start_timer_status_prohibit(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlc_pP) * \brief Re-arm (based on RLC AM config parameter) and start timer status-prohibit. -* \param[in] rlc_pP RLC AM protocol instance pointer. -* \param[in] frameP Frame index +* \param[in] ctxt_pP Running context. +* \param[in] rlc_pP RLC AM protocol instance pointer. */ -protected_rlc_am_timer_status_prohibit(void rlc_am_start_timer_status_prohibit(rlc_am_entity_t *rlc_pP,frame_t frameP);) +protected_rlc_am_timer_status_prohibit(void rlc_am_start_timer_status_prohibit(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlc_pP);) -/*! \fn void rlc_am_init_timer_status_prohibit(rlc_am_entity_t *rlc_pP, uint32_t time_outP) +/*! \fn void rlc_am_init_timer_status_prohibit(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlc_pP, const uint32_t time_outP) * \brief Initialize the timer status-prohibit with RLC AM time-out config parameter. -* \param[in] rlc_pP RLC AM protocol instance pointer. +* \param[in] ctxt_pP Running context. +* \param[in] rlc_pP RLC AM protocol instance pointer. * \param[in] time_outP Time-out in frameP units. */ -protected_rlc_am_timer_status_prohibit(void rlc_am_init_timer_status_prohibit(rlc_am_entity_t *rlc_pP, uint32_t time_outP);) +protected_rlc_am_timer_status_prohibit(void rlc_am_init_timer_status_prohibit(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlc_pP, const uint32_t time_outP);) /** @} */ #endif diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_windows.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_windows.c index 04aef773999da4e2865ccb6234069304b782af7b..06c624cadc88522f0fc07abacdcd4f6be62e6a1d 100755 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_windows.c +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_windows.c @@ -39,7 +39,10 @@ #include "rlc_am.h" #include "UTIL/LOG/log.h" //----------------------------------------------------------------------------- -signed int rlc_am_in_tx_window(rlc_am_entity_t* rlc_pP, rlc_sn_t snP) +signed int rlc_am_in_tx_window( + const protocol_ctxt_t* const ctxt_pP, + const rlc_am_entity_t* const rlc_pP, + const rlc_sn_t snP) //----------------------------------------------------------------------------- { rlc_usn_t shifted_sn; @@ -57,7 +60,11 @@ signed int rlc_am_in_tx_window(rlc_am_entity_t* rlc_pP, rlc_sn_t snP) } } //----------------------------------------------------------------------------- -signed int rlc_am_in_rx_window(rlc_am_entity_t* rlc_pP, rlc_sn_t snP) +signed int +rlc_am_in_rx_window( + const protocol_ctxt_t* const ctxt_pP, + const rlc_am_entity_t* const rlc_pP, + const rlc_sn_t snP) //----------------------------------------------------------------------------- { rlc_usn_t shifted_sn; @@ -75,7 +82,11 @@ signed int rlc_am_in_rx_window(rlc_am_entity_t* rlc_pP, rlc_sn_t snP) } } //----------------------------------------------------------------------------- -signed int rlc_am_sn_gte_vr_h(rlc_am_entity_t* rlc_pP, rlc_sn_t snP) +signed int +rlc_am_sn_gte_vr_h( + const protocol_ctxt_t* const ctxt_pP, + const rlc_am_entity_t* const rlc_pP, + const rlc_sn_t snP) //----------------------------------------------------------------------------- { rlc_usn_t shifted_sn; @@ -93,7 +104,10 @@ signed int rlc_am_sn_gte_vr_h(rlc_am_entity_t* rlc_pP, rlc_sn_t snP) } } //----------------------------------------------------------------------------- -signed int rlc_am_sn_gte_vr_x(rlc_am_entity_t* rlc_pP, rlc_sn_t snP) +signed int rlc_am_sn_gte_vr_x( + const protocol_ctxt_t* const ctxt_pP, + const rlc_am_entity_t* const rlc_pP, + const rlc_sn_t snP) //----------------------------------------------------------------------------- { rlc_usn_t shifted_sn; @@ -111,7 +125,11 @@ signed int rlc_am_sn_gte_vr_x(rlc_am_entity_t* rlc_pP, rlc_sn_t snP) } } //----------------------------------------------------------------------------- -signed int rlc_am_sn_gt_vr_ms(rlc_am_entity_t* rlc_pP, rlc_sn_t snP) +signed int +rlc_am_sn_gt_vr_ms( + const protocol_ctxt_t* const ctxt_pP, + const rlc_am_entity_t* const rlc_pP, + const rlc_sn_t snP) //----------------------------------------------------------------------------- { rlc_usn_t shifted_sn; @@ -129,7 +147,12 @@ signed int rlc_am_sn_gt_vr_ms(rlc_am_entity_t* rlc_pP, rlc_sn_t snP) } } //----------------------------------------------------------------------------- -signed int rlc_am_tx_sn1_gt_sn2(rlc_am_entity_t* rlc_pP, rlc_sn_t sn1P, rlc_sn_t sn2P) +signed int +rlc_am_tx_sn1_gt_sn2( + const protocol_ctxt_t* const ctxt_pP, + const rlc_am_entity_t* const rlc_pP, + const rlc_sn_t sn1P, + const rlc_sn_t sn2P) //----------------------------------------------------------------------------- { rlc_usn_t shifted_sn; @@ -147,7 +170,12 @@ signed int rlc_am_tx_sn1_gt_sn2(rlc_am_entity_t* rlc_pP, rlc_sn_t sn1P, rlc_sn_t } } //----------------------------------------------------------------------------- -signed int rlc_am_rx_sn1_gt_sn2(rlc_am_entity_t* rlc_pP, rlc_sn_t sn1P, rlc_sn_t sn2P) +signed int +rlc_am_rx_sn1_gt_sn2( + const protocol_ctxt_t* const ctxt_pP, + const rlc_am_entity_t* const rlc_pP, + const rlc_sn_t sn1P, + const rlc_sn_t sn2P) //----------------------------------------------------------------------------- { rlc_usn_t shifted_sn; diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_windows.h b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_windows.h index 6710c4746e6f62c01b442d6fcb920b634512b787..70c431d1357b60c6c3d4711d2eba4dbd2a7e8595 100755 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_windows.h +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_windows.h @@ -58,62 +58,92 @@ # endif # endif -/*! \fn signed int rlc_am_in_tx_window(rlc_am_entity_t* rlc_pP, rlc_sn_t snP) +/*! \fn signed int rlc_am_in_tx_window(const protocol_ctxt_t* const ctxt_pP,const rlc_am_entity_t* const rlc_pP, const rlc_sn_t snP) * \brief Boolean function, check if sequence number is VT(A) <= snP < VT(MS). -* \param[in] rlc_pP RLC AM protocol instance pointer. +* \param[in] ctxt_pP Running context. +* \param[in] rlc_pP RLC AM protocol instance pointer. * \param[in] snP Sequence number. * \return 1 if snP in tx window, else 0. */ -protected_rlc_am_windows(signed int rlc_am_in_tx_window(rlc_am_entity_t* rlc_pP, rlc_sn_t snP);) +protected_rlc_am_windows(signed int rlc_am_in_tx_window( + const protocol_ctxt_t* const ctxt_pP, + const rlc_am_entity_t* const rlc_pP, + const rlc_sn_t snP);) -/*! \fn signed int rlc_am_in_rx_window(rlc_am_entity_t* rlc_pP, rlc_sn_t snP) +/*! \fn signed int rlc_am_in_rx_window(const protocol_ctxt_t* const ctxt_pP,const rlc_am_entity_t* const rlc_pP, const rlc_sn_t snP) * \brief Boolean function, check if sequence number is VR(R) <= snP < VR(MR). -* \param[in] rlc_pP RLC AM protocol instance pointer. +* \param[in] ctxt_pP Running context. +* \param[in] rlc_pP RLC AM protocol instance pointer. * \param[in] snP Sequence number. * \return 1 if snP in rx window, else 0. */ -protected_rlc_am_windows(signed int rlc_am_in_rx_window(rlc_am_entity_t* rlc_pP, rlc_sn_t snP);) +protected_rlc_am_windows(signed int rlc_am_in_rx_window( + const protocol_ctxt_t* const ctxt_pP, + const rlc_am_entity_t* const rlc_pP, + const rlc_sn_t snP);) -/*! \fn signed int rlc_am_sn_gte_vr_h (rlc_am_entity_t* rlc_pP, rlc_sn_t snP) +/*! \fn signed int rlc_am_sn_gte_vr_h (const protocol_ctxt_t* const ctxt_pP,const rlc_am_entity_t* const rlc_pP, const rlc_sn_t snP) * \brief Boolean function, check if sequence number is greater than or equal VR(R). -* \param[in] rlc_pP RLC AM protocol instance pointer. +* \param[in] ctxt_pP Running context. +* \param[in] rlc_pP RLC AM protocol instance pointer. * \param[in] snP Sequence number. * \return 1 if sequence number is greater than or equal VR(R), else 0. */ -protected_rlc_am_windows(signed int rlc_am_sn_gte_vr_h (rlc_am_entity_t* rlc_pP, rlc_sn_t snP);) +protected_rlc_am_windows(signed int rlc_am_sn_gte_vr_h ( + const protocol_ctxt_t* const ctxt_pP, + const rlc_am_entity_t* const rlc_pP, + const rlc_sn_t snP);) -/*! \fn signed int rlc_am_sn_gte_vr_x (rlc_am_entity_t* rlc_pP, rlc_sn_t snP) +/*! \fn signed int rlc_am_sn_gte_vr_x (const protocol_ctxt_t* const ctxt_pP,const rlc_am_entity_t* const rlc_pP, const rlc_sn_t snP) * \brief Boolean function, check if sequence number is greater than or equal VR(X). -* \param[in] rlc_pP RLC AM protocol instance pointer. +* \param[in] ctxt_pP Running context. +* \param[in] rlc_pP RLC AM protocol instance pointer. * \param[in] snP Sequence number. * \return 1 if sequence number is greater than or equal VR(X), else 0. */ -protected_rlc_am_windows(signed int rlc_am_sn_gte_vr_x (rlc_am_entity_t* rlc_pP, rlc_sn_t snP);) +protected_rlc_am_windows(signed int rlc_am_sn_gte_vr_x ( + const protocol_ctxt_t* const ctxt_pP, + const rlc_am_entity_t* const rlc_pP, + const rlc_sn_t snP);) -/*! \fn signed int rlc_am_sn_gt_vr_ms (rlc_am_entity_t* rlc_pP, rlc_sn_t snP) +/*! \fn signed int rlc_am_sn_gt_vr_ms (const protocol_ctxt_t* const ctxt_pP,const rlc_am_entity_t* const rlc_pP, const rlc_sn_t snP) * \brief Boolean function, check if sequence number is greater than VR(MS). -* \param[in] rlc_pP RLC AM protocol instance pointer. +* \param[in] ctxt_pP Running context. +* \param[in] rlc_pP RLC AM protocol instance pointer. * \param[in] snP Sequence number. * \return 1 if sequence number is greater than VR(MS), else 0. */ -protected_rlc_am_windows(signed int rlc_am_sn_gt_vr_ms(rlc_am_entity_t* rlc_pP, rlc_sn_t snP);) +protected_rlc_am_windows(signed int rlc_am_sn_gt_vr_ms( + const protocol_ctxt_t* const ctxt_pP, + const rlc_am_entity_t* const rlc_pP, + const rlc_sn_t snP);) -/*! \fn signed int rlc_am_tx_sn1_gt_sn2 (rlc_am_entity_t* rlc_pP, rlc_sn_t sn1P, rlc_sn_t sn2P) +/*! \fn signed int rlc_am_tx_sn1_gt_sn2 (const protocol_ctxt_t* const ctxt_pP,const rlc_am_entity_t* const rlc_pP, const rlc_sn_t sn1P, const rlc_sn_t sn2P) * \brief Boolean function, in the context of the tx window, check if sn1P is greater than sn2P. -* \param[in] rlc_pP RLC AM protocol instance pointer. +* \param[in] ctxt_pP Running context. +* \param[in] rlc_pP RLC AM protocol instance pointer. * \param[in] sn1P Sequence number. * \param[in] sn2P Sequence number. * \return 1 if sn1P is greater than sn2P, else 0. */ -protected_rlc_am_windows(signed int rlc_am_tx_sn1_gt_sn2(rlc_am_entity_t* rlc_pP, rlc_sn_t sn1P, rlc_sn_t sn2P);) +protected_rlc_am_windows(signed int rlc_am_tx_sn1_gt_sn2( + const protocol_ctxt_t* const ctxt_pP, + const rlc_am_entity_t* const rlc_pP, + const rlc_sn_t sn1P, + const rlc_sn_t sn2P);) -/*! \fn signed int rlc_am_rx_sn1_gt_sn2(rlc_am_entity_t* rlc_pP, rlc_sn_t sn1P, rlc_sn_t sn2P) +/*! \fn signed int rlc_am_rx_sn1_gt_sn2(const protocol_ctxt_t* const ctxt_pP,const rlc_am_entity_t* const rlc_pP, const rlc_sn_t sn1P, const rlc_sn_t sn2P) * \brief Boolean function, in the context of the rx window, check if sn1P is greater than sn2P. -* \param[in] rlc_pP RLC AM protocol instance pointer. +* \param[in] ctxt_pP Running context. +* \param[in] rlc_pP RLC AM protocol instance pointer. * \param[in] sn1P Sequence number. * \param[in] sn2P Sequence number. * \return 1 if sn1P is greater than sn2P, else 0. */ -protected_rlc_am_windows(signed int rlc_am_rx_sn1_gt_sn2(rlc_am_entity_t* rlc_pP, rlc_sn_t sn1P, rlc_sn_t sn2P);) +protected_rlc_am_windows(signed int rlc_am_rx_sn1_gt_sn2( + const protocol_ctxt_t* const ctxt_pP, + const rlc_am_entity_t* const rlc_pP, + const rlc_sn_t sn1P, + const rlc_sn_t sn2P);) /** @} */ # endif diff --git a/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm.c b/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm.c index 601e04999b226e2b8fd512b5b6b99b9971dc0289..a75d2c6d80c34765c4ad3acfd8de423bb52c3343 100755 --- a/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm.c +++ b/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm.c @@ -40,12 +40,11 @@ //----------------------------------------------------------------------------- void rlc_tm_send_sdu ( - rlc_tm_entity_t * const rlc_pP, - const frame_t frameP, - const eNB_flag_t eNB_flag, - const boolean_t error_indicationP, - uint8_t * const srcP, - const sdu_size_t length_in_bitsP) + const protocol_ctxt_t* const ctxt_pP, + rlc_tm_entity_t * const rlc_pP, + const boolean_t error_indicationP, + uint8_t * const srcP, + const sdu_size_t length_in_bitsP) { //----------------------------------------------------------------------------- int length_in_bytes; @@ -71,15 +70,12 @@ rlc_tm_send_sdu ( memcpy (&rlc_pP->output_sdu_in_construction->data[rlc_pP->output_sdu_size_to_write], srcP, length_in_bytes); rlc_data_ind ( - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, - frameP, - eNB_flag, - BOOL_NOT(rlc_pP->is_data_plane), - MBMS_FLAG_NO, - rlc_pP->rb_id, - length_in_bytes, - rlc_pP->output_sdu_in_construction); + ctxt_pP, + BOOL_NOT(rlc_pP->is_data_plane), + MBMS_FLAG_NO, + rlc_pP->rb_id, + length_in_bytes, + rlc_pP->output_sdu_in_construction); rlc_pP->output_sdu_in_construction = NULL; } else { msg ("[RLC_TM %p][SEND_SDU] ERROR OUTPUT SDU IS NULL\n", rlc_pP); @@ -88,7 +84,8 @@ rlc_tm_send_sdu ( //----------------------------------------------------------------------------- void rlc_tm_no_segment ( - rlc_tm_entity_t *const rlc_pP + const protocol_ctxt_t* const ctxt_pP, + rlc_tm_entity_t *const rlc_pP ) { //----------------------------------------------------------------------------- @@ -129,10 +126,9 @@ rlc_tm_no_segment ( //----------------------------------------------------------------------------- void rlc_tm_rx ( - void *const argP, - const frame_t frameP, - const eNB_flag_t eNB_flagP, - struct mac_data_ind data_indP) + const protocol_ctxt_t* const ctxt_pP, + void * const argP, + struct mac_data_ind data_indP) { //----------------------------------------------------------------------------- @@ -146,7 +142,7 @@ rlc_tm_rx ( ((struct rlc_tm_rx_pdu_management *) (tb_p->data))->first_byte = first_byte_p; - rlc_tm_send_sdu (rlc_p, frameP, eNB_flagP, (((struct mac_tb_ind *) (tb_p->data))->error_indication), first_byte_p, data_indP.tb_size); + rlc_tm_send_sdu (ctxt_pP, rlc_p, (((struct mac_tb_ind *) (tb_p->data))->error_indication), first_byte_p, data_indP.tb_size); free_mem_block (tb_p); } } @@ -154,9 +150,10 @@ rlc_tm_rx ( //----------------------------------------------------------------------------- struct mac_status_resp rlc_tm_mac_status_indication ( - void *const rlc_pP, - const tb_size_t tb_sizeP, - struct mac_status_ind tx_statusP) + const protocol_ctxt_t* const ctxt_pP, + void * const rlc_pP, + const tb_size_t tb_sizeP, + struct mac_status_ind tx_statusP) { //----------------------------------------------------------------------------- struct mac_status_resp status_resp; @@ -172,14 +169,14 @@ rlc_tm_mac_status_indication ( //----------------------------------------------------------------------------- struct mac_data_req rlc_tm_mac_data_request ( - void * const rlc_pP, - const frame_t frameP) + const protocol_ctxt_t* const ctxt_pP, + void * const rlc_pP) { //----------------------------------------------------------------------------- rlc_tm_entity_t *l_rlc_p = (rlc_tm_entity_t *) rlc_pP; struct mac_data_req data_req; - rlc_tm_no_segment (l_rlc_p); + rlc_tm_no_segment (ctxt_pP, l_rlc_p); list_init (&data_req.data, NULL); list_add_list (&l_rlc_p->pdus_to_mac_layer, &data_req.data); @@ -188,11 +185,11 @@ rlc_tm_mac_data_request ( data_req.rlc_info.rlc_protocol_state = l_rlc_p->protocol_state; if (data_req.data.nb_elements > 0) { LOG_D(RLC, "[RLC_TM][%s][MOD %02u/%02u][RB %d][FRAME %05d] MAC_DATA_REQUEST %d TBs\n", - (l_rlc_p->is_enb) ? "eNB" : "UE", - l_rlc_p->enb_module_id, - l_rlc_p->ue_module_id, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, l_rlc_p->rb_id, - frameP, + ctxt_pP->frame, data_req.data.nb_elements); } @@ -202,40 +199,40 @@ rlc_tm_mac_data_request ( //----------------------------------------------------------------------------- void rlc_tm_mac_data_indication ( - void * const rlc_pP, - const frame_t frameP, - const eNB_flag_t eNB_flag, - struct mac_data_ind data_indP) + const protocol_ctxt_t* const ctxt_pP, + void * const rlc_pP, + struct mac_data_ind data_indP) { //----------------------------------------------------------------------------- rlc_tm_entity_t *l_rlc_p = (rlc_tm_entity_t *) rlc_pP; if (data_indP.data.nb_elements > 0) { LOG_D(RLC, "[RLC_TM][%s][MOD %02u/%02u][RB %d][FRAME %05d] MAC_DATA_IND %d TBs\n", - (l_rlc_p->is_enb) ? "eNB" : "UE", - l_rlc_p->enb_module_id, - l_rlc_p->ue_module_id, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, l_rlc_p->rb_id, - frameP, + ctxt_pP->frame, data_indP.data.nb_elements); } - rlc_tm_rx (rlc_pP, frameP, eNB_flag, data_indP); + rlc_tm_rx (ctxt_pP, rlc_pP, data_indP); } //----------------------------------------------------------------------------- void rlc_tm_data_req ( - void *const rlc_pP, - mem_block_t *const sdu_pP) + const protocol_ctxt_t* const ctxt_pP, + void *const rlc_pP, + mem_block_t *const sdu_pP) { //----------------------------------------------------------------------------- rlc_tm_entity_t *rlc_p = (rlc_tm_entity_t *) rlc_pP; #ifdef DEBUG_RLC_TM_DATA_REQUEST LOG_D (RLC, "[RLC_TM][%s][MOD %02u/%02u] RLC_TM_DATA_REQ size %d Bytes, BO %ld , NB SDU %d current_sdu_index=%d next_sdu_index=%d\n", - (l_rlc_p->is_enb) ? "eNB" : "UE", - l_rlc_p->enb_module_id, - l_rlc_p->ue_module_id, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, ((struct rlc_um_data_req *) (sdu_pP->data))->data_size, rlc_p->buffer_occupancy, rlc_p->nb_sdu, diff --git a/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm.h b/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm.h index 2ce6f27b9a764f1260b6743b05e46e22f13535d2..e615ff811b6726862abcc1b024029b17c39cd3fe 100755 --- a/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm.h +++ b/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm.h @@ -67,9 +67,8 @@ /*! \fn void rlc_tm_send_sdu ( +* const protocol_ctxt_t* const ctxt_pP, * rlc_tm_entity_t * const rlc_pP, -* const frame_t frameP, -* const eNB_flag_t eNB_flag, * const boolean_t error_indicationP, * uint8_t * const srcP, * const sdu_size_t length_in_bitsP) @@ -80,67 +79,81 @@ * \param[in] length_in_bitsP Length of SDU in bits. */ private_rlc_tm(void rlc_tm_send_sdu ( - rlc_tm_entity_t * const rlc_pP, - const frame_t frameP, - const eNB_flag_t eNB_flag, - const boolean_t error_indicationP, - uint8_t * const srcP, - const sdu_size_t length_in_bitsP);) - -/*! \fn void rlc_tm_no_segment (rlc_tm_entity_t *rlcP) + const protocol_ctxt_t* const ctxt_pP, + rlc_tm_entity_t * const rlc_pP, + const boolean_t error_indicationP, + uint8_t * const srcP, + const sdu_size_t length_in_bitsP);) + +/*! \fn void rlc_tm_no_segment (const protocol_ctxt_t* const ctxt_pP, rlc_tm_entity_t * const rlcP) * \brief Schedule a SDU to be transmited by lower layers. +* \param[in] ctxtP Running context. * \param[in] rlcP RLC TM protocol instance pointer. */ -private_rlc_tm(void rlc_tm_no_segment (rlc_tm_entity_t *const rlcP);) +private_rlc_tm(void rlc_tm_no_segment ( + const protocol_ctxt_t* const ctxt_pP, + rlc_tm_entity_t *const rlcP);) -/*! \fn void rlc_tm_rx (void *const rlcP, const frame_t frameP, struct mac_data_ind data_indP) +/*! \fn void rlc_tm_rx (const protocol_ctxt_t* const ctxt_pP,void *const rlcP, struct mac_data_ind data_indP) * \brief Process the received PDUs from lower layer. +* \param[in] ctxtP Running context. * \param[in] rlcP RLC TM protocol instance pointer. -* \param[in] frameP Frame index. * \param[in] data_indP PDUs from MAC. */ private_rlc_tm( void rlc_tm_rx ( - void *const rlcP, - const frame_t frameP, - struct mac_data_ind data_indP);) + const protocol_ctxt_t* const ctxt_pP, + void *const rlcP, + struct mac_data_ind data_indP);) -/*! \fn struct mac_status_resp rlc_tm_mac_status_indication (void *rlcP, const frame_t frameP, uint16_t tbs_sizeP, struct mac_status_ind tx_statusP) +/*! \fn struct mac_status_resp rlc_tm_mac_status_indication (const protocol_ctxt_t* const ctxt_pP, void * const rlcP, const uint16_t tbs_sizeP, struct mac_status_ind tx_statusP) * \brief Request the maximum number of bytes that can be served by RLC instance to MAC and fix the amount of bytes requested by MAC for next RLC transmission. +* \param[in] ctxtP Running context. * \param[in] rlcP RLC TM protocol instance pointer. -* \param[in] frameP Frame index. * \param[in] tbs_sizeP Number of bytes requested by MAC for next transmission. * \param[in] tx_statusP Transmission status given by MAC on previous MAC transmission of the PDU. * \return The maximum number of bytes that can be served by RLC instance to MAC. */ -public_rlc_tm( struct mac_status_resp rlc_tm_mac_status_indication (void *rlcP, const frame_t frameP, uint16_t tb_sizeP, struct mac_status_ind tx_statusP);) +public_rlc_tm( struct mac_status_resp rlc_tm_mac_status_indication ( + const protocol_ctxt_t* const ctxt_pP, + void * const rlcP, + const uint16_t tb_sizeP, + struct mac_status_ind tx_statusP);) -/*! \fn struct mac_data_req rlc_tm_mac_data_request (void *rlcP, const frame_t frameP) +/*! \fn struct mac_data_req rlc_tm_mac_data_request (const protocol_ctxt_t* const ctxt_pP, void * const rlcP) * \brief Gives PDUs to lower layer MAC. +* \param[in] ctxtP Running context. * \param[in] rlcP RLC TM protocol instance pointer. -* \param[in] frameP Frame index. * \return A PDU of the previously requested number of bytes, and the updated maximum number of bytes that can be served by RLC instance to MAC for next RLC transmission. */ -public_rlc_tm( struct mac_data_req rlc_tm_mac_data_request (void *rlcP, const frame_t frameP);) +public_rlc_tm( struct mac_data_req rlc_tm_mac_data_request ( + const protocol_ctxt_t* const ctxt_pP, + void * const rlcP);) -/*! \fn void rlc_tm_mac_data_indication (void *rlcP, const frame_t frameP, uint8_t eNB_flag, struct mac_data_ind data_indP) +/*! \fn void rlc_tm_mac_data_indication (const protocol_ctxt_t* const ctxt_pP,void * const rlcP, struct mac_data_ind data_indP) * \brief Receive PDUs from lower layer MAC. -* \param[in] rlcP RLC TM protocol instance pointer. -* \param[in] frameP Frame Index. -* \param[in] eNB_flag Flag to indicate eNB (1) or UE (0). -* \param[in] data_indP PDUs from MAC. +* \param[in] ctxtP Running context. +* \param[in] rlcP RLC TM protocol instance pointer. +* \param[in] data_indP PDUs from MAC. */ -public_rlc_tm( void rlc_tm_mac_data_indication (void *rlcP, const frame_t frameP, uint8_t eNB_flag, struct mac_data_ind data_indP);) +public_rlc_tm( void rlc_tm_mac_data_indication ( + const protocol_ctxt_t* const ctxt_pP, + void * const rlcP, + struct mac_data_ind data_indP);) -/*! \fn void rlc_tm_data_req (void *rlcP, mem_block_t *sduP) +/*! \fn void rlc_tm_data_req (const protocol_ctxt_t* const ctxt_pP,void * const rlcP, mem_block_t * const sduP) * \brief Interface with higher layers, buffer higher layer SDUS for transmission. -* \param[in] rlcP RLC TM protocol instance pointer. -* \param[in] sduP SDU. (A struct rlc_tm_data_req is mapped on sduP->data.) +* \param[in] ctxtP Running context. +* \param[in] rlcP RLC TM protocol instance pointer. +* \param[in] sduP SDU. (A struct rlc_tm_data_req is mapped on sduP->data.) */ -public_rlc_tm( void rlc_tm_data_req (void *rlcP, mem_block_t *sduP);) +public_rlc_tm( void rlc_tm_data_req ( + const protocol_ctxt_t* const ctxt_pP, + void * const rlcP, + mem_block_t * const sduP);) /** @} */ # endif diff --git a/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm_entity.h b/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm_entity.h index b12a0b7f964bfb14546cdc0ada126308d0beee05..11f24a5ad3d3bcf1eb14cdf5ef5c2ed1cfb82faf 100755 --- a/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm_entity.h +++ b/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm_entity.h @@ -47,8 +47,8 @@ * \brief Structure containing a RLC TM instance protocol variables, allocation variables, buffers and other miscellaneous variables. */ typedef struct rlc_tm_entity { - module_id_t enb_module_id; /*!< \brief eNB Virtualization index for this protocol instance, meaningful if is_enb is set. */ - module_id_t ue_module_id; /*!< \brief UE Virtualization index for this protocol instance, meaningful if is_enb is set. */ + //module_id_t enb_module_id; /*!< \brief eNB Virtualization index for this protocol instance, meaningful if is_enb is set. */ + //module_id_t ue_module_id; /*!< \brief UE Virtualization index for this protocol instance, meaningful if is_enb is set. */ boolean_t allocation; /*!< \brief Boolean for rlc_tm_entity_t struct allocation. */ rlc_protocol_state_t protocol_state; /*!< \brief Protocol state, can be RLC_NULL_STATE, RLC_DATA_TRANSFER_READY_STATE, RLC_LOCAL_SUSPEND_STATE. */ boolean_t is_uplink_downlink; /*!< \brief Is this instance is a transmitter, a receiver or both? */ @@ -56,7 +56,7 @@ typedef struct rlc_tm_entity { // for stats and trace purpose : logical_chan_id_t channel_id; /*!< \brief Transport channel identifier. */ rb_id_t rb_id; /*!< \brief Radio bearer identifier, for statistics and trace purpose. */ - boolean_t is_enb; /*!< \brief To know if the RLC belongs to a eNB or UE. */ + //boolean_t is_enb; /*!< \brief To know if the RLC belongs to a eNB or UE. */ //----------------------------- // tranmission //----------------------------- diff --git a/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm_init.c b/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm_init.c index 2258b8a82584d10b99e542d14ae561d92a2c9991..c6e762273c7b1f7c0d7659cb93a5918955651cc3 100755 --- a/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm_init.c +++ b/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm_init.c @@ -33,51 +33,52 @@ #include "LAYER2/MAC/extern.h" //----------------------------------------------------------------------------- void config_req_rlc_tm ( - const module_id_t enb_module_idP, - const module_id_t ue_module_idP, - const frame_t frameP, - const eNB_flag_t eNB_flagP, - const srb_flag_t srb_flagP, - const rlc_tm_info_t * const config_tmP, - const rb_id_t rb_idP) + const protocol_ctxt_t* const ctxt_pP, + const srb_flag_t srb_flagP, + const rlc_tm_info_t * const config_tmP, + const rb_id_t rb_idP + ) { //----------------------------------------------------------------------------- rlc_union_t *rlc_union_p = NULL; rlc_tm_entity_t *rlc_p = NULL; - hash_key_t key = RLC_COLL_KEY_VALUE(enb_module_idP, ue_module_idP, eNB_flagP, rb_idP, srb_flagP); + hash_key_t key = RLC_COLL_KEY_VALUE(ctxt_pP->enb_module_id, ctxt_pP->ue_module_id, ctxt_pP->enb_flag, rb_idP, srb_flagP); hashtable_rc_t h_rc; h_rc = hashtable_get(rlc_coll_p, key, (void**)&rlc_union_p); if (h_rc == HASH_TABLE_OK) { rlc_p = &rlc_union_p->rlc.tm; LOG_D(RLC, "[FRAME %05d][%s][RRC][MOD %u/%u][][--- CONFIG_REQ (is_uplink_downlink=%d) --->][RLC_TM][MOD %u/%u][RB %u]\n", - frameP, - ( eNB_flagP > 0) ? "eNB":"UE", - enb_module_idP, - ue_module_idP, + ctxt_pP->frame, + ( ctxt_pP->enb_flag > 0) ? "eNB":"UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, config_tmP->is_uplink_downlink, - enb_module_idP, - ue_module_idP, + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rb_idP); - rlc_tm_init(rlc_p); + rlc_tm_init(ctxt_pP, rlc_p); rlc_p->protocol_state = RLC_DATA_TRANSFER_READY_STATE; - rlc_tm_set_debug_infos(rlc_p, frameP, eNB_flagP, enb_module_idP, ue_module_idP, rb_idP, srb_flagP); - rlc_tm_configure(rlc_p, config_tmP->is_uplink_downlink); + rlc_tm_set_debug_infos(ctxt_pP, rlc_p, rb_idP, srb_flagP); + rlc_tm_configure(ctxt_pP, rlc_p, config_tmP->is_uplink_downlink); } else { LOG_E(RLC, "[FRAME %05d][%s][RRC][MOD %u/%u][][--- CONFIG_REQ --->][RLC_TM][MOD %u/%u][RB %u], RLC NOT FOUND\n", - frameP, - ( eNB_flagP > 0) ? "eNB":"UE", - enb_module_idP, - ue_module_idP, - enb_module_idP, - ue_module_idP, + ctxt_pP->frame, + ( ctxt_pP->enb_flag > 0) ? "eNB":"UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rb_idP); } } //----------------------------------------------------------------------------- -void rlc_tm_init (rlc_tm_entity_t * const rlcP) +void rlc_tm_init ( + const protocol_ctxt_t* const ctxt_pP, + rlc_tm_entity_t * const rlcP + ) { //----------------------------------------------------------------------------- int saved_allocation = rlcP->allocation; @@ -105,7 +106,11 @@ void rlc_tm_init (rlc_tm_entity_t * const rlcP) } //----------------------------------------------------------------------------- -void rlc_tm_reset_state_variables (struct rlc_tm_entity * const rlcP) +void +rlc_tm_reset_state_variables ( + const protocol_ctxt_t* const ctxt_pP, + struct rlc_tm_entity * const rlcP + ) { //----------------------------------------------------------------------------- rlcP->output_sdu_size_to_write = 0; @@ -116,7 +121,10 @@ void rlc_tm_reset_state_variables (struct rlc_tm_entity * const rlcP) } //----------------------------------------------------------------------------- void -rlc_tm_cleanup (rlc_tm_entity_t * const rlcP) +rlc_tm_cleanup ( + const protocol_ctxt_t* const ctxt_pP, + rlc_tm_entity_t * const rlcP + ) { //----------------------------------------------------------------------------- int index; @@ -141,43 +149,37 @@ rlc_tm_cleanup (rlc_tm_entity_t * const rlcP) //----------------------------------------------------------------------------- void rlc_tm_configure( - rlc_tm_entity_t * const rlcP, - const boolean_t is_uplink_downlinkP) + const protocol_ctxt_t* const ctxt_pP, + rlc_tm_entity_t * const rlcP, + const boolean_t is_uplink_downlinkP) { //----------------------------------------------------------------------------- rlcP->is_uplink_downlink = is_uplink_downlinkP; - rlc_tm_reset_state_variables (rlcP); + rlc_tm_reset_state_variables (ctxt_pP, rlcP); } //----------------------------------------------------------------------------- void rlc_tm_set_debug_infos( - rlc_tm_entity_t * const rlcP, - const module_id_t enb_module_idP, - const module_id_t ue_module_idP, - const frame_t frameP, - const eNB_flag_t eNB_flagP, - const srb_flag_t srb_flagP, - const rb_id_t rb_idP) + const protocol_ctxt_t* const ctxt_pP, + rlc_tm_entity_t * const rlcP, + const srb_flag_t srb_flagP, + const rb_id_t rb_idP) //----------------------------------------------------------------------------- { - msg ("[FRAME %05d][%s][RLC_TM][MOD %02u/%02u][RB %u][SET DEBUG INFOS] enb module_id %d ue module_id %d rb_id %d srb_flag %d\n", - frameP, - (eNB_flagP) ? "eNB" : "UE", - enb_module_idP, - ue_module_idP, + msg ("[FRAME %05d][%s][RLC_TM][MOD %02u/%02u][RB %u][SET DEBUG INFOS] rb_id %d srb_flag %d\n", + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rb_idP, - enb_module_idP, - ue_module_idP, rb_idP, srb_flagP); - rlcP->enb_module_id = enb_module_idP; - rlcP->ue_module_id = ue_module_idP; + rlcP->rb_id = rb_idP; if (srb_flagP) { rlcP->is_data_plane = 0; } else { rlcP->is_data_plane = 1; } - rlcP->is_enb = eNB_flagP; } diff --git a/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm_init.h b/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm_init.h index ed1fb41d00ba3c9df941b9ff6659693018b85ce6..729968162f64ef16658f8b23f602cd73ba0fd6c8 100755 --- a/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm_init.h +++ b/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm_init.h @@ -71,76 +71,68 @@ typedef volatile struct rlc_tm_info_s{ /*! \fn void config_req_rlc_tm (void config_req_rlc_tm ( - const module_id_t enb_module_idP, - const module_id_t ue_module_idP, - const frame_t frameP, - const eNB_flag_t eNB_flagP, + const protocol_ctxt_t* const ctxt_pP, const srb_flag_t srb_flagP, const rlc_tm_info_t * const config_tmP, const rb_id_t rb_idP, const srb_flag_t srb_flagP) * \brief Allocate memory for RLC TM instance, reset protocol variables, and set protocol parameters. -* \param[in] frameP Frame index. -* \param[in] eNB_flag Flag to indicate eNB (1) or UE (0) * \param[in] srb_flagP Flag to indicate SRB (1) or DRB (0) -* \param[in] enb_module_idP eNB Virtualized module identifier. -* \param[in] ue_module_idP UE Virtualized module identifier. * \param[in] config_tmP Configuration parameters for RLC TM instance. * \param[in] rb_idP Radio bearer identifier. * \param[in] srb_flagP Flag to indicate signalling radio bearer (1) or data radio bearer (0). */ public_rlc_tm_init( void config_req_rlc_tm ( - const module_id_t enb_module_idP, - const module_id_t ue_module_idP, - const frame_t frameP, - const eNB_flag_t eNB_flagP, - const srb_flag_t srb_flagP, - const rlc_tm_info_t * const config_tmP, - const rb_id_t rb_idP);) + const protocol_ctxt_t* const ctxt_pP, + const srb_flag_t srb_flagP, + const rlc_tm_info_t * const config_tmP, + const rb_id_t rb_idP);) -/*! \fn void rlc_tm_init (rlc_tm_entity_t *rlcP) +/*! \fn void rlc_tm_init (const protocol_ctxt_t* const ctxt_pP, rlc_tm_entity_t * const rlcP) * \brief Initialize a RLC TM protocol instance, initialize all variables, lists, allocate buffers for making this instance ready to be configured with protocol configuration parameters. After this initialization the RLC TM protocol instance will be in RLC_NULL_STATE state. * \param[in] rlcP RLC TM protocol instance pointer. */ -protected_rlc_tm_init(void rlc_tm_init (rlc_tm_entity_t * const rlcP);) +protected_rlc_tm_init(void rlc_tm_init ( + const protocol_ctxt_t* const ctxt_pP, + rlc_tm_entity_t * const rlcP);) -/*! \fn void rlc_tm_reset_state_variables (rlc_tm_entity_t *rlcP) +/*! \fn void rlc_tm_reset_state_variables (const protocol_ctxt_t* const ctxt_pP, rlc_tm_entity_t * const rlcP) * \brief Reset protocol variables and state variables to initial values. * \param[in] rlcP RLC TM protocol instance pointer. */ -protected_rlc_tm_init(void rlc_tm_reset_state_variables (rlc_tm_entity_t * const rlcP);) +protected_rlc_tm_init(void rlc_tm_reset_state_variables ( + const protocol_ctxt_t* const ctxt_pP, + rlc_tm_entity_t * const rlcP);) -/*! \fn void rlc_tm_cleanup(rlc_tm_entity_t *rlcP) +/*! \fn void rlc_tm_cleanup(const protocol_ctxt_t* const ctxt_pP,rlc_tm_entity_t * const rlcP) * \brief Free all allocated memory (lists and buffers) previously allocated by this RLC TM instance. * \param[in] rlcP RLC TM protocol instance pointer. */ -public_rlc_tm_init( void rlc_tm_cleanup(rlc_tm_entity_t * const rlcP);) +public_rlc_tm_init( void rlc_tm_cleanup( + const protocol_ctxt_t* const ctxt_pP, + rlc_tm_entity_t * const rlcP);) -/*! \fn void rlc_tm_configure(rlc_tm_entity_t * const rlcP, const boolean_t is_uplink_downlinkP) +/*! \fn void rlc_tm_configure(const protocol_ctxt_t* const ctxt_pP,rlc_tm_entity_t * const rlcP, const boolean_t is_uplink_downlinkP) * \brief Configure RLC TM protocol parameters. * \param[in] rlcP RLC TM protocol instance pointer. * \param[in] is_uplink_downlinkP Is this instance is TRANSMITTER_ONLY, RECEIVER_ONLY, or TRANSMITTER_AND_RECEIVER. */ -protected_rlc_tm_init(void rlc_tm_configure(rlc_tm_entity_t * const rlcP, const boolean_t is_uplink_downlinkP);) +protected_rlc_tm_init(void rlc_tm_configure( + const protocol_ctxt_t* const ctxt_pP, + rlc_tm_entity_t * const rlcP, + const boolean_t is_uplink_downlinkP);) -/*! \fn void rlc_tm_set_debug_infos(rlc_tm_entity_t *rlcP, const frame_t frameP, uint8_t eNB_flagP, const module_id_t enb_module_idP, const module_id_t ue_module_idP, const rb_id_t rb_idP, const srb_flag_t srb_flagP) +/*! \fn void rlc_tm_set_debug_infos(const protocol_ctxt_t* const ctxt_pP, rlc_tm_entity_t * const rlcP, const rb_id_t rb_idP, const srb_flag_t srb_flagP) * \brief Set debug informations for a RLC TM protocol instance, these informations are only for trace purpose. * \param[in] rlcP RLC TM protocol instance pointer. -* \param[in] enb_module_idP eNB Virtualized module identifier. -* \param[in] ue_module_idP UE Virtualized module identifier. -* \param[in] frameP Frame index. -* \param[in] eNB_flag Flag to indicate eNB (1) or UE (0) * \param[in] srb_flagP Flag to indicate signalling radio bearer (1) or data radio bearer (0). * \param[in] rb_idP Radio bearer identifier. */ protected_rlc_tm_init(void rlc_tm_set_debug_infos( - rlc_tm_entity_t * const rlcP, - const module_id_t enb_module_idP, - const module_id_t ue_module_idP, - const frame_t frameP, - const eNB_flag_t eNB_flagP, - const srb_flag_t srb_flagP, - const rb_id_t rb_idP);) + const protocol_ctxt_t* const ctxt_pP, + rlc_tm_entity_t * const rlcP, + const srb_flag_t srb_flagP, + const rb_id_t rb_idP);) /** @} */ # endif diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.c b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.c index 8aec96e8cf867bdaf32b3297f74adfbcf875b06a..83df86d9ce9be2e2164a179c4737460093f9207f 100755 --- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.c +++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.c @@ -104,7 +104,7 @@ rlc_um_get_buffer_occupancy (rlc_um_entity_t *rlc_pP) } //----------------------------------------------------------------------------- void -rlc_um_get_pdus (void *argP, frame_t frameP) +rlc_um_get_pdus (const protocol_ctxt_t* const ctxt_pP, void *argP) { //----------------------------------------------------------------------------- rlc_um_entity_t *rlc_p = (rlc_um_entity_t *) argP; @@ -140,10 +140,10 @@ rlc_um_get_pdus (void *argP, frame_t frameP) // SEND DATA TO MAC if (rlc_p->tx_sn_length == 10) { - rlc_um_segment_10 (rlc_p,frameP); + rlc_um_segment_10 (ctxt_pP, rlc_p); } if (rlc_p->tx_sn_length == 5) { - rlc_um_segment_5 (rlc_p,frameP); + rlc_um_segment_5 (ctxt_pP, rlc_p); } break; @@ -170,10 +170,10 @@ rlc_um_get_pdus (void *argP, frame_t frameP) default: LOG_E(RLC, "[FRAME %05d][%s][RLC_UM][MOD %02u/%02u][%s %02d] MAC_DATA_REQ UNKNOWN PROTOCOL STATE %02X hex\n", - frameP, - (rlc_p->is_enb) ? "eNB" : "UE", - rlc_p->enb_module_id, - rlc_p->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, (rlc_p->is_data_plane) ? "DRB" : "SRB", rlc_p->rb_id, rlc_p->protocol_state); @@ -182,7 +182,7 @@ rlc_um_get_pdus (void *argP, frame_t frameP) //----------------------------------------------------------------------------- void -rlc_um_rx (void *argP, frame_t frameP, eNB_flag_t eNB_flagP, struct mac_data_ind data_indP) +rlc_um_rx (const protocol_ctxt_t* const ctxt_pP, void *argP, struct mac_data_ind data_indP) { //----------------------------------------------------------------------------- rlc_um_entity_t *l_rlc_p = (rlc_um_entity_t *) argP; @@ -207,13 +207,13 @@ rlc_um_rx (void *argP, frame_t frameP, eNB_flag_t eNB_flagP, struct mac_data_ind // establishment, the RLC entity: // - is created; and // - enters the DATA_TRANSFER_READY state. - LOG_N(RLC, "[RLC_UM][MOD %02u/%02u] ERROR MAC_DATA_IND IN RLC_NULL_STATE\n", l_rlc_p->enb_module_id, l_rlc_p->ue_module_id); + LOG_N(RLC, "[RLC_UM][MOD %02u/%02u] ERROR MAC_DATA_IND IN RLC_NULL_STATE\n", ctxt_pP->enb_module_id, ctxt_pP->ue_module_id); /*if (data_indP.data.nb_elements > 0) { - LOG_D(RLC, "[FRAME %05d][%s][RLC_UM][MOD %02u/%02u][RB %02d] MAC_DATA_IND %d TBs\n", l_rlc_p->module_id, l_rlc_p->rb_id, frameP, data_indP.data.nb_elements); + LOG_D(RLC, "[FRAME %05d][%s][RLC_UM][MOD %02u/%02u][RB %02d] MAC_DATA_IND %d TBs\n", l_rlc_p->module_id, l_rlc_p->rb_id, ctxt_pP->frame, data_indP.data.nb_elements); rlc_p[l_rlc_p->module_id].m_mscgen_trace_length = sprintf(rlc_p[l_rlc_p->module_id].m_mscgen_trace, "[MSC_MSG][FRAME %05d][MAC_%s][MOD %02d][][--- MAC_DATA_IND/ %d TB(s) ", - frameP, - (l_rlc_p->is_enb) ? "eNB":"UE", + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB":"UE", l_rlc_p->module_id, data_indP.data.nb_elements); @@ -258,10 +258,10 @@ rlc_um_rx (void *argP, frame_t frameP, eNB_flag_t eNB_flagP, struct mac_data_ind #ifdef TRACE_RLC_UM_PDU if (data_indP.data.nb_elements > 0) { LOG_D(RLC, "[FRAME %05d][%s][RLC_UM][MOD %02u/%02u][%s %02d] MAC_DATA_IND %d TBs\n", - frameP, - (l_rlc_p->is_enb) ? "eNB" : "UE", - l_rlc_p->enb_module_id, - l_rlc_p->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, (l_rlc_p->is_data_plane) ? "DRB" : "SRB", l_rlc_p->rb_id, data_indP.data.nb_elements); @@ -270,7 +270,7 @@ rlc_um_rx (void *argP, frame_t frameP, eNB_flag_t eNB_flagP, struct mac_data_ind while (tb_p != NULL) { tb_size_in_bytes = ((struct mac_tb_ind *) (tb_p->data))->size; - rlc_um_get_pdu_infos(frameP,(rlc_um_pdu_sn_10_t*) ((struct mac_tb_ind *) (tb_p->data))->data_ptr, tb_size_in_bytes, &pdu_info, l_rlc_p->rx_sn_length); + rlc_um_get_pdu_infos(ctxt_pP->frame,(rlc_um_pdu_sn_10_t*) ((struct mac_tb_ind *) (tb_p->data))->data_ptr, tb_size_in_bytes, &pdu_info, l_rlc_p->rx_sn_length); message_string_size += sprintf(&message_string[message_string_size], "Bearer : %u\n", l_rlc_p->rb_id); message_string_size += sprintf(&message_string[message_string_size], "PDU size : %u\n", tb_size_in_bytes); message_string_size += sprintf(&message_string[message_string_size], "Header size : %u\n", pdu_info.header_size); @@ -316,14 +316,14 @@ rlc_um_rx (void *argP, frame_t frameP, eNB_flag_t eNB_flagP, struct mac_data_ind message_string_size += sprintf(&message_string[message_string_size], " |\n"); # if defined(ENABLE_ITTI) - msg_p = itti_alloc_new_message_sized (l_rlc_p->is_enb ? TASK_RLC_ENB:TASK_RLC_UE , RLC_UM_DATA_PDU_IND, message_string_size + sizeof (IttiMsgText)); + msg_p = itti_alloc_new_message_sized (ctxt_pP->enb_flag ? TASK_RLC_ENB:TASK_RLC_UE , RLC_UM_DATA_PDU_IND, message_string_size + sizeof (IttiMsgText)); msg_p->ittiMsg.rlc_um_data_pdu_ind.size = message_string_size; memcpy(&msg_p->ittiMsg.rlc_um_data_pdu_ind.text, message_string, message_string_size); - if (l_rlc_p->is_enb) { - itti_send_msg_to_task(TASK_UNKNOWN, l_rlc_p->enb_module_id, msg_p); + if (ctxt_pP->enb_flag) { + itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->enb_module_id, msg_p); } else { - itti_send_msg_to_task(TASK_UNKNOWN, l_rlc_p->ue_module_id + NB_eNB_INST, msg_p); + itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->ue_module_id + NB_eNB_INST, msg_p); } # else LOG_T(RLC, "%s", message_string); @@ -333,7 +333,7 @@ rlc_um_rx (void *argP, frame_t frameP, eNB_flag_t eNB_flagP, struct mac_data_ind } } #endif - rlc_um_receive (l_rlc_p, frameP, eNB_flagP, data_indP); + rlc_um_receive (ctxt_pP, l_rlc_p, data_indP); break; case RLC_LOCAL_SUSPEND_STATE: @@ -354,17 +354,17 @@ rlc_um_rx (void *argP, frame_t frameP, eNB_flag_t eNB_flagP, struct mac_data_ind // - modifies only the protocol parameters and timers as indicated by // upper layers. LOG_N(RLC, "[FRAME %05d][%s][RLC_UM][MOD %02u/%02u][%s %02d] RLC_LOCAL_SUSPEND_STATE\n", - frameP, - (l_rlc_p->is_enb) ? "eNB" : "UE", - l_rlc_p->enb_module_id, - l_rlc_p->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, (l_rlc_p->is_data_plane) ? "DRB" : "SRB", l_rlc_p->rb_id); /*if (data_indP.data.nb_elements > 0) { - LOG_D(RLC, "[FRAME %05d][%s][RLC_UM][MOD %02u/%02u][RB %02d] MAC_DATA_IND %d TBs\n", l_rlc_p->module_id, l_rlc_p->rb_id, frameP, data_indP.data.nb_elements); + LOG_D(RLC, "[FRAME %05d][%s][RLC_UM][MOD %02u/%02u][RB %02d] MAC_DATA_IND %d TBs\n", l_rlc_p->module_id, l_rlc_p->rb_id, ctxt_pP->frame, data_indP.data.nb_elements); rlc_p[l_rlc_p->module_id].m_mscgen_trace_length = sprintf(rlc_p[l_rlc_p->module_id].m_mscgen_trace, "[MSC_MSG][FRAME %05d][MAC_%s][MOD %02d][][--- MAC_DATA_IND/ %d TB(s) ", - frameP, - (l_rlc_p->is_enb) ? "eNB":"UE", + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB":"UE", l_rlc_p->module_id, data_indP.data.nb_elements); @@ -390,10 +390,10 @@ rlc_um_rx (void *argP, frame_t frameP, eNB_flag_t eNB_flagP, struct mac_data_ind default: LOG_E(RLC, "[FRAME %05d][%s][RLC_UM][MOD %02u/%02u][%s %02d] TX UNKNOWN PROTOCOL STATE %02X hex\n", - frameP, - (l_rlc_p->is_enb) ? "eNB" : "UE", - l_rlc_p->enb_module_id, - l_rlc_p->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, (l_rlc_p->is_data_plane) ? "DRB" : "SRB", l_rlc_p->rb_id, l_rlc_p->protocol_state); @@ -402,7 +402,7 @@ rlc_um_rx (void *argP, frame_t frameP, eNB_flag_t eNB_flagP, struct mac_data_ind //----------------------------------------------------------------------------- struct mac_status_resp -rlc_um_mac_status_indication (void *rlc_pP, frame_t frameP, eNB_flag_t eNB_flagP, uint16_t tbs_sizeP, struct mac_status_ind tx_statusP) +rlc_um_mac_status_indication (const protocol_ctxt_t* const ctxt_pP, void *rlc_pP, uint16_t tbs_sizeP, struct mac_status_ind tx_statusP) { //----------------------------------------------------------------------------- struct mac_status_resp status_resp; @@ -421,7 +421,7 @@ rlc_um_mac_status_indication (void *rlc_pP, frame_t frameP, eNB_flag_t eNB_flagP if (rlc_pP) { rlc_p = (rlc_um_entity_t *) rlc_pP; - rlc_um_check_timer_dar_time_out(rlc_p,frameP,eNB_flagP); + rlc_um_check_timer_dar_time_out(ctxt_pP, rlc_p); rlc_p->nb_bytes_requested_by_mac = tbs_sizeP; @@ -431,9 +431,9 @@ rlc_um_mac_status_indication (void *rlc_pP, frame_t frameP, eNB_flag_t eNB_flagP status_resp.buffer_occupancy_in_bytes += rlc_p->tx_header_min_length_in_bytes; status_resp.buffer_occupancy_in_pdus = rlc_p->input_sdus.nb_elements; - diff_time = frameP - ((struct rlc_um_tx_sdu_management *)mb_p->data)->sdu_creation_time; - status_resp.head_sdu_creation_time = (diff_time > 0 ) ? (uint32_t) diff_time : (uint32_t)(0xffffffff - diff_time + frameP) ; - //msg("rlc_p status for frameP %d diff time %d resp %d\n", frameP, diff_time,status_resp.head_sdu_creation_time) ; + diff_time = ctxt_pP->frame - ((struct rlc_um_tx_sdu_management *)mb_p->data)->sdu_creation_time; + status_resp.head_sdu_creation_time = (diff_time > 0 ) ? (uint32_t) diff_time : (uint32_t)(0xffffffff - diff_time + ctxt_pP->frame) ; + //msg("rlc_p status for ctxt_pP->frame %d diff time %d resp %d\n", ctxt_pP->frame, diff_time,status_resp.head_sdu_creation_time) ; sdu_size = ((struct rlc_um_tx_sdu_management *) mb_p->data)->sdu_size; sdu_remaining_size = ((struct rlc_um_tx_sdu_management *) mb_p->data)->sdu_remaining_size; @@ -454,10 +454,10 @@ rlc_um_mac_status_indication (void *rlc_pP, frame_t frameP, eNB_flag_t eNB_flagP #ifdef DEBUG_RLC_UM_TX_STATUS if ((((rlc_um_entity_t *) rlc_pP)->rb_id > 0) && (status_resp.buffer_occupancy_in_bytes > 0)) { LOG_D(RLC, "[FRAME %05d][%s][RLC_UM][MOD %02u/%02u][%s %02d] MAC_STATUS_INDICATION (DATA) %d bytes requested -> %d bytes available\n", - frameP, - (rlc_p->is_enb) ? "eNB" : "UE", - rlc_p->enb_module_id, - rlc_p->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, (rlc_p->is_data_plane) ? "DRB" : "SRB", rlc_p->rb_id, tbs_sizeP, @@ -465,20 +465,20 @@ rlc_um_mac_status_indication (void *rlc_pP, frame_t frameP, eNB_flag_t eNB_flagP if ((tx_statusP.tx_status == MAC_TX_STATUS_SUCCESSFUL) && (tx_statusP.no_pdu)) { LOG_D(RLC, "[FRAME %05d][%s][RLC_UM][MOD %02u/%02u][%s %02d] MAC_STATUS_INDICATION TX STATUS SUCCESSFUL %d PDUs\n", - frameP, - (rlc_p->is_enb) ? "eNB" : "UE", - rlc_p->enb_module_id, - rlc_p->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, (rlc_p->is_data_plane) ? "DRB" : "SRB", rlc_p->rb_id, tx_statusP.no_pdu); } if ((tx_statusP.tx_status == MAC_TX_STATUS_UNSUCCESSFUL) && (tx_statusP.no_pdu)) { LOG_D(RLC, "[FRAME %05d][%s][RLC_UM][MOD %02u/%02u][%s %02d] MAC_STATUS_INDICATION TX STATUS UNSUCCESSFUL %d PDUs\n", - frameP, - (rlc_p->is_enb) ? "eNB" : "UE", - rlc_p->enb_module_id, - rlc_p->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, (rlc_p->is_data_plane) ? "DRB" : "SRB", rlc_p->rb_id, tx_statusP.no_pdu); @@ -493,7 +493,7 @@ rlc_um_mac_status_indication (void *rlc_pP, frame_t frameP, eNB_flag_t eNB_flagP //----------------------------------------------------------------------------- struct mac_data_req -rlc_um_mac_data_request (void *rlc_pP,frame_t frameP) +rlc_um_mac_data_request (const protocol_ctxt_t* const ctxt_pP, void *rlc_pP) { //----------------------------------------------------------------------------- struct mac_data_req data_req; @@ -509,7 +509,7 @@ rlc_um_mac_data_request (void *rlc_pP,frame_t frameP) #endif rlc_um_entity_t *l_rlc_p = (rlc_um_entity_t *) rlc_pP; - rlc_um_get_pdus (rlc_pP,frameP); + rlc_um_get_pdus (ctxt_pP, rlc_pP); list_init (&data_req.data, NULL); list_add_list (&l_rlc_p->pdus_to_mac_layer, &data_req.data); @@ -526,10 +526,10 @@ rlc_um_mac_data_request (void *rlc_pP,frame_t frameP) tb_size_in_bytes = ((struct mac_tb_req *) (tb_p->data))->tb_size; LOG_D(RLC, "[FRAME %05d][%s][RLC_UM][MOD %02u/%02u][%s %02d] MAC_DATA_REQUEST TB SIZE %u\n", - frameP, - (l_rlc_p->is_enb) ? "eNB" : "UE", - l_rlc_p->enb_module_id, - l_rlc_p->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, (l_rlc_p->is_data_plane) ? "DRB" : "SRB", l_rlc_p->rb_id, ((struct mac_tb_req *) (tb_p->data))->tb_size); @@ -539,7 +539,7 @@ rlc_um_mac_data_request (void *rlc_pP,frame_t frameP) AssertFatal( tb_size_in_bytes > 0 , "RLC UM PDU LENGTH %d", tb_size_in_bytes); #ifdef TRACE_RLC_UM_PDU - rlc_um_get_pdu_infos(frameP,(rlc_um_pdu_sn_10_t*) ((struct mac_tb_req *) (tb_p->data))->data_ptr, tb_size_in_bytes, &pdu_info, l_rlc_p->rx_sn_length); + rlc_um_get_pdu_infos(ctxt_pP->frame,(rlc_um_pdu_sn_10_t*) ((struct mac_tb_req *) (tb_p->data))->data_ptr, tb_size_in_bytes, &pdu_info, l_rlc_p->rx_sn_length); message_string_size += sprintf(&message_string[message_string_size], "Bearer : %u\n", l_rlc_p->rb_id); message_string_size += sprintf(&message_string[message_string_size], "PDU size : %u\n", tb_size_in_bytes); message_string_size += sprintf(&message_string[message_string_size], "Header size : %u\n", pdu_info.header_size); @@ -585,14 +585,14 @@ rlc_um_mac_data_request (void *rlc_pP,frame_t frameP) message_string_size += sprintf(&message_string[message_string_size], " |\n"); # if defined(ENABLE_ITTI) - msg_p = itti_alloc_new_message_sized (l_rlc_p->is_enb > 0 ? TASK_RLC_ENB:TASK_RLC_UE , RLC_UM_DATA_PDU_REQ, message_string_size + sizeof (IttiMsgText)); + msg_p = itti_alloc_new_message_sized (ctxt_pP->enb_flag > 0 ? TASK_RLC_ENB:TASK_RLC_UE , RLC_UM_DATA_PDU_REQ, message_string_size + sizeof (IttiMsgText)); msg_p->ittiMsg.rlc_um_data_pdu_req.size = message_string_size; memcpy(&msg_p->ittiMsg.rlc_um_data_pdu_req.text, message_string, message_string_size); - if (l_rlc_p->is_enb) { - itti_send_msg_to_task(TASK_UNKNOWN, l_rlc_p->enb_module_id, msg_p); + if (ctxt_pP->enb_flag) { + itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->enb_module_id, msg_p); } else { - itti_send_msg_to_task(TASK_UNKNOWN, l_rlc_p->ue_module_id + NB_eNB_INST, msg_p); + itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->ue_module_id + NB_eNB_INST, msg_p); } # else LOG_T(RLC, "%s", message_string); @@ -606,16 +606,16 @@ rlc_um_mac_data_request (void *rlc_pP,frame_t frameP) //----------------------------------------------------------------------------- void -rlc_um_mac_data_indication (void *rlc_pP, frame_t frameP, eNB_flag_t eNB_flagP, struct mac_data_ind data_indP) +rlc_um_mac_data_indication (const protocol_ctxt_t* const ctxt_pP, void *rlc_pP, struct mac_data_ind data_indP) { //----------------------------------------------------------------------------- - rlc_um_rx (rlc_pP, frameP, eNB_flagP, data_indP); - rlc_um_check_timer_dar_time_out(rlc_pP,frameP,eNB_flagP); + rlc_um_rx (ctxt_pP, rlc_pP, data_indP); + rlc_um_check_timer_dar_time_out(ctxt_pP, rlc_pP); } //----------------------------------------------------------------------------- void -rlc_um_data_req (void *rlc_pP, frame_t frameP, mem_block_t *sdu_pP) +rlc_um_data_req (const protocol_ctxt_t* const ctxt_pP, void *rlc_pP, mem_block_t *sdu_pP) { //----------------------------------------------------------------------------- rlc_um_entity_t *rlc_p = (rlc_um_entity_t *) rlc_pP; @@ -634,10 +634,10 @@ rlc_um_data_req (void *rlc_pP, frame_t frameP, mem_block_t *sdu_pP) #endif LOG_D(RLC, "[FRAME %05d][%s][RLC_UM][MOD %02u/%02u][%s %02d] RLC_UM_DATA_REQ size %d Bytes, BO %d , NB SDU %d\n", - frameP, - (rlc_p->is_enb) ? "eNB" : "UE", - rlc_p->enb_module_id, - rlc_p->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, (rlc_p->is_data_plane) ? "DRB" : "SRB", rlc_p->rb_id, ((struct rlc_um_data_req *) (sdu_pP->data))->data_size, @@ -656,7 +656,7 @@ rlc_um_data_req (void *rlc_pP, frame_t frameP, mem_block_t *sdu_pP) ((struct rlc_um_tx_sdu_management *) (sdu_pP->data))->sdu_remaining_size = ((struct rlc_um_tx_sdu_management *) (sdu_pP->data))->sdu_size; ((struct rlc_um_tx_sdu_management *) (sdu_pP->data))->sdu_segmented_size = 0; - ((struct rlc_um_tx_sdu_management *) (sdu_pP->data))->sdu_creation_time = frameP; + ((struct rlc_um_tx_sdu_management *) (sdu_pP->data))->sdu_creation_time = ctxt_pP->frame; //rlc_p->next_sdu_index = (rlc_p->next_sdu_index + 1) % rlc_p->size_input_sdus_buffer; rlc_p->stat_tx_pdcp_sdu += 1; @@ -695,14 +695,14 @@ rlc_um_data_req (void *rlc_pP, frame_t frameP, mem_block_t *sdu_pP) message_string_size += sprintf(&message_string[message_string_size], " |\n"); # if defined(ENABLE_ITTI) - msg_p = itti_alloc_new_message_sized (rlc_p->is_enb > 0 ? TASK_RLC_ENB:TASK_RLC_UE , RLC_UM_SDU_REQ, message_string_size + sizeof (IttiMsgText)); + msg_p = itti_alloc_new_message_sized (ctxt_pP->enb_flag > 0 ? TASK_RLC_ENB:TASK_RLC_UE , RLC_UM_SDU_REQ, message_string_size + sizeof (IttiMsgText)); msg_p->ittiMsg.rlc_um_sdu_req.size = message_string_size; memcpy(&msg_p->ittiMsg.rlc_um_sdu_req.text, message_string, message_string_size); - if (rlc_p->is_enb) { - itti_send_msg_to_task(TASK_UNKNOWN, rlc_p->enb_module_id, msg_p); + if (ctxt_pP->enb_flag) { + itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->enb_module_id, msg_p); } else { - itti_send_msg_to_task(TASK_UNKNOWN, rlc_p->ue_module_id + NB_eNB_INST, msg_p); + itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->ue_module_id + NB_eNB_INST, msg_p); } #else LOG_T(RLC, "%s", message_string); @@ -712,26 +712,4 @@ rlc_um_data_req (void *rlc_pP, frame_t frameP, mem_block_t *sdu_pP) rlc_p->buffer_occupancy += ((struct rlc_um_tx_sdu_management *) (sdu_pP->data))->sdu_size; list_add_tail_eurecom(sdu_pP, &rlc_p->input_sdus); pthread_mutex_unlock(&rlc_p->lock_input_sdus); - - /*} else { - LOG_W(RLC, "[FRAME %05d][%s][RLC_UM][MOD %02u/%02u][RB %02d] RLC-UM_DATA_REQ input buffer full SDU garbaged\n", - frameP, - (rlc_p->is_enb) ? "eNB" : "UE", - rlc_p->enb_module_id, - rlc_p->ue_module_id, - rlc_p->rb_id); - rlc_p->stat_tx_pdcp_sdu += 1; - rlc_p->stat_tx_pdcp_bytes += ((struct rlc_um_tx_sdu_management *) (sdu_pP->data))->sdu_size; - rlc_p->stat_tx_pdcp_sdu_discarded += 1; - rlc_p->stat_tx_pdcp_bytes_discarded += ((struct rlc_um_tx_sdu_management *) (sdu_pP->data))->sdu_size; - free_mem_block (sdu_pP); -#if defined(STOP_ON_IP_TRAFFIC_OVERLOAD) - AssertFatal(0, "[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u] RLC_UM_DATA_REQ, SDU DROPPED, INPUT BUFFER OVERFLOW\n", - frameP, - (rlc_p->is_enb) ? "eNB" : "UE", - rlc_p->enb_module_id, - rlc_p->ue_module_id, - rlc_p->rb_id); -#endif - }*/ } diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.h b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.h index 1e6b18c5077be67ce705e220c6bde7f1f964596e..ca7b47b3d2ccaf037723f9daa78f646a16ccd857 100644 --- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.h +++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.h @@ -75,7 +75,7 @@ #endif -/*! \fn void rlc_um_stat_req (rlc_um_entity_t *rlcP, +/*! \fn void rlc_um_stat_req (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP, unsigned int* stat_tx_pdcp_sdu, unsigned int* stat_tx_pdcp_bytes, unsigned int* stat_tx_pdcp_sdu_discarded, @@ -94,7 +94,8 @@ unsigned int* stat_rx_data_bytes_out_of_window, unsigned int* stat_timer_reordering_timed_out) * \brief Request TX and RX statistics of a RLC AM protocol instance. -* \param[in] rlcP RLC AM protocol instance pointer. +* \param[in] ctxt_pP Running context. +* \param[in] rlc_pP RLC UM protocol instance pointer. * \param[out] stat_tx_pdcp_sdu Number of SDUs coming from upper layers. * \param[out] stat_tx_pdcp_bytes Number of bytes coming from upper layers. * \param[out] stat_tx_pdcp_sdu_discarded Number of discarded SDUs coming from upper layers. @@ -113,7 +114,7 @@ * \param[out] stat_rx_data_bytes_out_of_window Number of data bytes received out of the receive window. * \param[out] stat_timer_reordering_timed_out Number of times the timer "reordering" has timed-out. */ -public_rlc_um(void rlc_um_stat_req (rlc_um_entity_t *rlcP, +public_rlc_um(void rlc_um_stat_req (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP, unsigned int* stat_tx_pdcp_sdu, unsigned int* stat_tx_pdcp_bytes, unsigned int* stat_tx_pdcp_sdu_discarded, @@ -132,57 +133,55 @@ public_rlc_um(void rlc_um_stat_req (rlc_um_entity_t *rlcP, unsigned int* stat_rx_data_bytes_out_of_window, unsigned int* stat_timer_reordering_timed_out);) -/*! \fn void rlc_um_get_pdus (void *rlcP) +/*! \fn void rlc_um_get_pdus (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP) * \brief Request the segmentation of SDUs based on status previously sent by MAC. -* \param[in] rlcP RLC UM protocol instance pointer. +* \param[in] ctxt_pP Running context. +* \param[in] rlc_pP RLC UM protocol instance pointer. */ -private_rlc_um( void rlc_um_get_pdus (void *rlcP);) +private_rlc_um( void rlc_um_get_pdus (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP);) -/*! \fn void rlc_um_rx (void *rlcP, uint32_t frame, uint8_t eNB_flag, struct mac_data_ind data_indication) +/*! \fn void rlc_um_rx (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP, struct mac_data_ind data_indication) * \brief Process the received PDUs from lower layer. -* \param[in] rlcP RLC UM protocol instance pointer. -* \param[in] frame Frame Index. -* \param[in] eNB_flag Flag to indicate eNB (1) or UE (0). +* \param[in] ctxt_pP Running context. +* \param[in] rlc_pP RLC UM protocol instance pointer. * \param[in] data_indication PDUs from MAC. */ -protected_rlc_um( void rlc_um_rx (void *rlcP, uint32_t frame, uint8_t eNB_flag, struct mac_data_ind data_indication);) +protected_rlc_um( void rlc_um_rx (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP, struct mac_data_ind data_indication);) -/*! \fn struct mac_status_resp rlc_um_mac_status_indication (void *rlcP, uint32_t frame, uint8_t eNB_flag, uint16_t tbs_sizeP, struct mac_status_ind tx_statusP) +/*! \fn struct mac_status_resp rlc_um_mac_status_indication (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP, uint16_t tbs_sizeP, struct mac_status_ind tx_statusP) * \brief Request the maximum number of bytes that can be served by RLC instance to MAC and fix the amount of bytes requested by MAC for next RLC transmission. -* \param[in] rlcP RLC UM protocol instance pointer. -* \param[in] frame Frame index. -* \param[in] eNB_flag Flag to indicate eNB (1) or UE (0). +* \param[in] ctxt_pP Running context. +* \param[in] rlc_pP RLC UM protocol instance pointer. * \param[in] tbs_sizeP Number of bytes requested by MAC for next transmission. * \param[in] tx_statusP Transmission status given by MAC on previous MAC transmission of the PDU. * \return The maximum number of bytes that can be served by RLC instance to MAC. */ -public_rlc_um( struct mac_status_resp rlc_um_mac_status_indication (void *rlcP, uint32_t frame, uint8_t eNB_flag, uint16_t tbs_sizeP, struct mac_status_ind tx_statusP);) +public_rlc_um( struct mac_status_resp rlc_um_mac_status_indication (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP, uint16_t tbs_sizeP, struct mac_status_ind tx_statusP);) -/*! \fn struct mac_data_req rlc_um_mac_data_request (void *rlcP, uint32_t frame) +/*! \fn struct mac_data_req rlc_um_mac_data_request (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP) * \brief Gives PDUs to lower layer MAC. -* \param[in] rlcP RLC UM protocol instance pointer. -* \param[in] frame Frame Index. +* \param[in] ctxt_pP Running context. +* \param[in] rlc_pP RLC UM protocol instance pointer. * \return A PDU of the previously requested number of bytes, and the updated maximum number of bytes that can be served by RLC instance to MAC for next RLC transmission. */ -public_rlc_um( struct mac_data_req rlc_um_mac_data_request (void *rlcP, uint32_t frame);) +public_rlc_um( struct mac_data_req rlc_um_mac_data_request (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP);) -/*! \fn void rlc_um_mac_data_indication (void *rlcP, uint32_t frame, uint8_t eNB_flag,struct mac_data_ind data_indP) +/*! \fn void rlc_um_mac_data_indication (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP,struct mac_data_ind data_indP) * \brief Receive PDUs from lower layer MAC. -* \param[in] rlcP RLC UM protocol instance pointer. -* \param[in] frame Frame index. -* \param[in] eNB_flag Flag to indicate eNB (1) or UE (0). -* \param[in] data_indP PDUs from MAC. +* \param[in] ctxt_pP Running context. +* \param[in] rlc_pP RLC UM protocol instance pointer. +* \param[in] data_indP PDUs from MAC. */ -public_rlc_um( void rlc_um_mac_data_indication (void *rlcP, uint32_t frame, uint8_t eNB_flag, struct mac_data_ind data_indP);) +public_rlc_um( void rlc_um_mac_data_indication (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP, struct mac_data_ind data_indP);) -/*! \fn void rlc_um_data_req (void *rlcP, uint32_t frame, mem_block_t *sduP) +/*! \fn void rlc_um_data_req (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP, mem_block_t *sduP) * \brief Interface with higher layers, buffer higher layer SDUS for transmission. -* \param[in] rlcP RLC UM protocol instance pointer. -* \param[in] frame Frame Index -* \param[in] sduP SDU. (A struct rlc_um_data_req is mapped on sduP->data.) +* \param[in] ctxt_pP Running context. +* \param[in] rlc_pP RLC UM protocol instance pointer. +* \param[in] sduP SDU. (A struct rlc_um_data_req is mapped on sduP->data.) */ -public_rlc_um( void rlc_um_data_req (void *rlcP, uint32_t frame, mem_block_t *sduP);) +public_rlc_um( void rlc_um_data_req (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP, mem_block_t *sduP);) /** @} */ # endif diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_control_primitives.c b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_control_primitives.c index f82c991e481b2881323d25489a38b6a759cda288..20d5c79acba7483fb519dcfdc1c49e522ba27320 100755 --- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_control_primitives.c +++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_control_primitives.c @@ -43,89 +43,84 @@ //----------------------------------------------------------------------------- void config_req_rlc_um ( - const module_id_t enb_module_idP, - const module_id_t ue_module_idP, - const frame_t frameP, - const eNB_flag_t eNB_flagP, - const srb_flag_t srb_flagP, - const rlc_um_info_t * const config_um_pP, - const rb_id_t rb_idP) + const protocol_ctxt_t* const ctxt_pP, + const srb_flag_t srb_flagP, + const rlc_um_info_t * const config_um_pP, + const rb_id_t rb_idP) { //----------------------------------------------------------------------------- rlc_union_t *rlc_union_p = NULL; rlc_um_entity_t *rlc_p = NULL; - hash_key_t key = RLC_COLL_KEY_VALUE(enb_module_idP, ue_module_idP, eNB_flagP, rb_idP, srb_flagP); + hash_key_t key = RLC_COLL_KEY_VALUE(ctxt_pP->enb_module_id, ctxt_pP->ue_module_id, ctxt_pP->enb_flag, rb_idP, srb_flagP); hashtable_rc_t h_rc; h_rc = hashtable_get(rlc_coll_p, key, (void**)&rlc_union_p); if (h_rc == HASH_TABLE_OK) { rlc_p = &rlc_union_p->rlc.um; LOG_D(RLC, "[FRAME %05d][%s][RRC][MOD %u/%u][][--- CONFIG_REQ timer_reordering=%d sn_field_length=%d is_mXch=%d --->][RLC_UM][MOD %u/%u][RB %u] \n", - frameP, - (eNB_flagP) ? "eNB" : "UE", - enb_module_idP, - ue_module_idP, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, config_um_pP->timer_reordering, config_um_pP->sn_field_length, config_um_pP->is_mXch, - enb_module_idP, - ue_module_idP, + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rb_idP); - rlc_um_init(rlc_p); - if (rlc_um_fsm_notify_event (rlc_p, RLC_UM_RECEIVE_CRLC_CONFIG_REQ_ENTER_DATA_TRANSFER_READY_STATE_EVENT)) { - rlc_um_set_debug_infos(rlc_p, enb_module_idP, ue_module_idP, frameP, eNB_flagP, srb_flagP, rb_idP); - rlc_um_configure(rlc_p, - frameP, - config_um_pP->timer_reordering, - config_um_pP->sn_field_length, - config_um_pP->sn_field_length, - config_um_pP->is_mXch); + rlc_um_init(ctxt_pP, rlc_p); + if (rlc_um_fsm_notify_event (ctxt_pP, rlc_p, RLC_UM_RECEIVE_CRLC_CONFIG_REQ_ENTER_DATA_TRANSFER_READY_STATE_EVENT)) { + rlc_um_set_debug_infos(ctxt_pP, rlc_p, srb_flagP, rb_idP); + rlc_um_configure( + ctxt_pP, + rlc_p, + config_um_pP->timer_reordering, + config_um_pP->sn_field_length, + config_um_pP->sn_field_length, + config_um_pP->is_mXch); } } else { LOG_E(RLC, "[FRAME %05d][%s][RRC][MOD %u/%u][][--- CONFIG_REQ --->][RLC_UM][MOD %u/%u][RB %u] RLC NOT FOUND\n", - frameP, - (eNB_flagP) ? "eNB" : "UE", - enb_module_idP, - ue_module_idP, - enb_module_idP, - ue_module_idP, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rb_idP); } } //----------------------------------------------------------------------------- const uint32_t const t_Reordering_tab[T_Reordering_spare1] = {0,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100,110,120,130,140,150,160,170,180,190,200}; void config_req_rlc_um_asn1 ( - const module_id_t enb_module_idP, - const module_id_t ue_module_idP, - const frame_t frameP, - const eNB_flag_t eNB_flagP, - const srb_flag_t srb_flagP, - const MBMS_flag_t mbms_flagP, - const mbms_session_id_t mbms_session_idP, - const mbms_service_id_t mbms_service_idP, - const UL_UM_RLC_t * const ul_rlc_pP, - const DL_UM_RLC_t * const dl_rlc_pP, - const rb_id_t rb_idP) + const protocol_ctxt_t* const ctxt_pP, + const srb_flag_t srb_flagP, + const MBMS_flag_t mbms_flagP, + const mbms_session_id_t mbms_session_idP, + const mbms_service_id_t mbms_service_idP, + const UL_UM_RLC_t * const ul_rlc_pP, + const DL_UM_RLC_t * const dl_rlc_pP, + const rb_id_t rb_idP) { uint32_t ul_sn_FieldLength = 0; uint32_t dl_sn_FieldLength = 0; uint32_t t_Reordering = 0; rlc_union_t *rlc_union_p = NULL; rlc_um_entity_t *rlc_p = NULL; - hash_key_t key = RLC_COLL_KEY_VALUE(enb_module_idP, ue_module_idP, eNB_flagP, rb_idP, srb_flagP); + hash_key_t key = RLC_COLL_KEY_VALUE(ctxt_pP->enb_module_id, ctxt_pP->ue_module_id, ctxt_pP->enb_flag, rb_idP, srb_flagP); hashtable_rc_t h_rc; #if defined(Rel10) if (mbms_flagP) { AssertFatal(dl_rlc_pP, "No RLC UM DL config"); AssertFatal(ul_rlc_pP == NULL, "RLC UM UL config present"); - key = RLC_COLL_KEY_MBMS_VALUE(enb_module_idP, ue_module_idP, eNB_flagP, mbms_service_idP, mbms_session_idP); + key = RLC_COLL_KEY_MBMS_VALUE(ctxt_pP->enb_module_id, ctxt_pP->ue_module_id, ctxt_pP->enb_flag, mbms_service_idP, mbms_session_idP); h_rc = hashtable_get(rlc_coll_p, key, (void**)&rlc_union_p); AssertFatal (h_rc == HASH_TABLE_OK, "RLC NOT FOUND enb id %u ue id %i enb flag %u service id %u, session id %u", - enb_module_idP, - ue_module_idP, - eNB_flagP, + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, + ctxt_pP->enb_flag, mbms_service_idP, mbms_session_idP); rlc_p = &rlc_union_p->rlc.um; @@ -133,12 +128,12 @@ void config_req_rlc_um_asn1 ( else #endif { - key = RLC_COLL_KEY_VALUE(enb_module_idP, ue_module_idP, eNB_flagP, rb_idP, srb_flagP); + key = RLC_COLL_KEY_VALUE(ctxt_pP->enb_module_id, ctxt_pP->ue_module_id, ctxt_pP->enb_flag, rb_idP, srb_flagP); h_rc = hashtable_get(rlc_coll_p, key, (void**)&rlc_union_p); AssertFatal (h_rc == HASH_TABLE_OK, "RLC NOT FOUND enb id %u ue id %i enb flag %u rb id %u, srb flag %u", - enb_module_idP, - ue_module_idP, - eNB_flagP, + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, + ctxt_pP->enb_flag, rb_idP, srb_flagP); rlc_p = &rlc_union_p->rlc.um; @@ -146,18 +141,18 @@ void config_req_rlc_um_asn1 ( //----------------------------------------------------------------------------- LOG_D(RLC, "[FRAME %05d][%s][RRC][MOD %u/%u][][--- CONFIG_REQ timer_reordering=%dms sn_field_length= --->][RLC_UM][MOD %u/%u][RB %u] \n", - frameP, - (eNB_flagP) ? "eNB" : "UE", - enb_module_idP, - ue_module_idP, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, (dl_rlc_pP->t_Reordering<31)?t_Reordering_tab[dl_rlc_pP->t_Reordering]:-1, - enb_module_idP, - ue_module_idP, + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rb_idP); - rlc_um_init(rlc_p); - if (rlc_um_fsm_notify_event (rlc_p, RLC_UM_RECEIVE_CRLC_CONFIG_REQ_ENTER_DATA_TRANSFER_READY_STATE_EVENT)) { - rlc_um_set_debug_infos(rlc_p, enb_module_idP, ue_module_idP, frameP, eNB_flagP, srb_flagP, rb_idP); + rlc_um_init(ctxt_pP, rlc_p); + if (rlc_um_fsm_notify_event (ctxt_pP, rlc_p, RLC_UM_RECEIVE_CRLC_CONFIG_REQ_ENTER_DATA_TRANSFER_READY_STATE_EVENT)) { + rlc_um_set_debug_infos(ctxt_pP,rlc_p, srb_flagP, rb_idP); if (ul_rlc_pP != NULL) { switch (ul_rlc_pP->sn_FieldLength) { case SN_FieldLength_size5: @@ -168,10 +163,10 @@ void config_req_rlc_um_asn1 ( break; default: LOG_E(RLC,"[FRAME %05d][%s][RLC_UM][MOD %u/%u][RB %u][CONFIGURE] INVALID Uplink sn_FieldLength %d, RLC NOT CONFIGURED\n", - frameP, - (rlc_p->is_enb) ? "eNB" : "UE", - rlc_p->enb_module_id, - rlc_p->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_p->rb_id, ul_rlc_pP->sn_FieldLength); return; @@ -188,10 +183,10 @@ void config_req_rlc_um_asn1 ( break; default: LOG_E(RLC,"[FRAME %05d][%s][RLC_UM][MOD %u/%u][RB %u][CONFIGURE] INVALID Downlink sn_FieldLength %d, RLC NOT CONFIGURED\n", - frameP, - (rlc_p->is_enb) ? "eNB" : "UE", - rlc_p->enb_module_id, - rlc_p->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_p->rb_id, dl_rlc_pP->sn_FieldLength); return; @@ -200,25 +195,23 @@ void config_req_rlc_um_asn1 ( t_Reordering = t_Reordering_tab[dl_rlc_pP->t_Reordering]; } else { LOG_E(RLC,"[FRAME %05d][%s][RLC_UM][MOD %u/%u][RB %u][CONFIGURE] INVALID T_Reordering %d, RLC NOT CONFIGURED\n", - frameP, - (rlc_p->is_enb) ? "eNB" : "UE", - rlc_p->enb_module_id, - rlc_p->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_p->rb_id, dl_rlc_pP->t_Reordering); return; } } - if (eNB_flagP > 0) { - rlc_um_configure(rlc_p, - frameP, + if (ctxt_pP->enb_flag > 0) { + rlc_um_configure(ctxt_pP,rlc_p, t_Reordering, ul_sn_FieldLength, dl_sn_FieldLength, mbms_flagP); } else { - rlc_um_configure(rlc_p, - frameP, + rlc_um_configure(ctxt_pP,rlc_p, t_Reordering, dl_sn_FieldLength, ul_sn_FieldLength, @@ -228,7 +221,10 @@ void config_req_rlc_um_asn1 ( } //----------------------------------------------------------------------------- void -rlc_um_init (rlc_um_entity_t * const rlc_pP) +rlc_um_init ( + const protocol_ctxt_t* const ctxt_pP, + rlc_um_entity_t * const rlc_pP + ) { //----------------------------------------------------------------------------- @@ -271,7 +267,10 @@ rlc_um_init (rlc_um_entity_t * const rlc_pP) } //----------------------------------------------------------------------------- void -rlc_um_reset_state_variables (rlc_um_entity_t * const rlc_pP) +rlc_um_reset_state_variables ( + const protocol_ctxt_t* const ctxt_pP, + rlc_um_entity_t * const rlc_pP + ) { //----------------------------------------------------------------------------- rlc_pP->buffer_occupancy = 0; @@ -286,7 +285,9 @@ rlc_um_reset_state_variables (rlc_um_entity_t * const rlc_pP) } //----------------------------------------------------------------------------- void -rlc_um_cleanup (rlc_um_entity_t * const rlc_pP) +rlc_um_cleanup ( + const protocol_ctxt_t* const ctxt_pP, + rlc_um_entity_t * const rlc_pP) { //----------------------------------------------------------------------------- int index; @@ -315,12 +316,12 @@ rlc_um_cleanup (rlc_um_entity_t * const rlc_pP) //----------------------------------------------------------------------------- void rlc_um_configure( - rlc_um_entity_t * const rlc_pP, - const frame_t frameP, - const uint32_t timer_reorderingP, - const uint32_t rx_sn_field_lengthP, - const uint32_t tx_sn_field_lengthP, - const uint32_t is_mXchP) + const protocol_ctxt_t* const ctxt_pP, + rlc_um_entity_t * const rlc_pP, + const uint32_t timer_reorderingP, + const uint32_t rx_sn_field_lengthP, + const uint32_t tx_sn_field_lengthP, + const uint32_t is_mXchP) //----------------------------------------------------------------------------- { if (rx_sn_field_lengthP == 10) { @@ -335,10 +336,10 @@ void rlc_um_configure( rlc_pP->rx_header_min_length_in_bytes = 1; } else if (rx_sn_field_lengthP != 0) { LOG_E(RLC, "[FRAME %05d][%s][RLC_UM][MOD %u/%u][RB %u][CONFIGURE] INVALID RX SN LENGTH %d BITS NOT IMPLEMENTED YET, RLC NOT CONFIGURED\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, rx_sn_field_lengthP); return; @@ -356,10 +357,10 @@ void rlc_um_configure( rlc_pP->tx_header_min_length_in_bytes = 1; } else if (tx_sn_field_lengthP != 0) { LOG_E(RLC, "[FRAME %05d][%s][RLC_UM][MOD %02d/%02][RB %u][CONFIGURE] INVALID RX SN LENGTH %d BITS NOT IMPLEMENTED YET, RLC NOT CONFIGURED\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rlc_pP->rb_id, tx_sn_field_lengthP); return; @@ -375,38 +376,31 @@ void rlc_um_configure( rlc_pP->last_reassemblied_missing_sn = rlc_pP->rx_sn_modulo - 1; rlc_pP->reassembly_missing_sn_detected = 0; // timers - rlc_um_init_timer_reordering(rlc_pP, timer_reorderingP); + rlc_um_init_timer_reordering(ctxt_pP,rlc_pP, timer_reorderingP); rlc_pP->first_pdu = 1; - rlc_um_reset_state_variables (rlc_pP); + rlc_um_reset_state_variables (ctxt_pP,rlc_pP); } //----------------------------------------------------------------------------- void rlc_um_set_debug_infos( - rlc_um_entity_t * const rlc_pP, - const module_id_t enb_module_idP, - const module_id_t ue_module_idP, - const frame_t frameP, - const eNB_flag_t eNB_flagP, - const srb_flag_t srb_flagP, - const rb_id_t rb_idP) + const protocol_ctxt_t* const ctxt_pP, + rlc_um_entity_t * const rlc_pP, + const srb_flag_t srb_flagP, + const rb_id_t rb_idP) //----------------------------------------------------------------------------- { LOG_D(RLC, "[FRAME %05d][%s][RLC_UM][SET DEBUG INFOS] enb_module_id %u ue_module_id %u rb_id %d srb_flag %d\n", - frameP, - (eNB_flagP) ? "eNB" : "UE", - enb_module_idP, - ue_module_idP, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rb_idP, srb_flagP); - - rlc_pP->enb_module_id = enb_module_idP; - rlc_pP->ue_module_id = ue_module_idP; rlc_pP->rb_id = rb_idP; if (srb_flagP) { rlc_pP->is_data_plane = 0; } else { rlc_pP->is_data_plane = 1; } - rlc_pP->is_enb = eNB_flagP; } diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_control_primitives.h b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_control_primitives.h index 2014045ec8e01ced09afd7cc4cdb69aa40d72911..e9c691114b7c5d5f7db6431fa5b81b73d237e885 100644 --- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_control_primitives.h +++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_control_primitives.h @@ -75,134 +75,116 @@ typedef volatile struct { /*! \fn void config_req_rlc_um ( - * const module_id_t enb_module_idP, - * const module_id_t ue_module_idP, - * const frame_t frameP, - * const eNB_flag_t eNB_flagP, + * const protocol_ctxt_t* const ctxt_pP, * const srb_flag_t srb_flagP, * const rlc_um_info_t * const config_umP, * const rb_id_t rb_idP) * \brief Allocate memory for RLC UM instance, reset protocol variables, and set protocol parameters. After this configuration the RLC UM protocol instance will be in RLC_DATA_TRANSFER_READY_STATE state. -* \param[in] frameP Frame index. -* \param[in] eNB_flag Flag to indicate eNB (1) or UE (0) +* \param[in] ctxt_pP Running context. * \param[in] srb_flagP Flag to indicate signalling radio bearer (1) or data radio bearer (0). -* \param[in] enb_module_idP eNB Virtualized module identifier. -* \param[in] ue_module_idP UE Virtualized module identifier. * \param[in] config_umP Configuration parameters for RLC UM instance. * \param[in] rb_idP Radio bearer identifier. */ public_rlc_um_control_primitives( void config_req_rlc_um ( - const module_id_t enb_module_idP, - const module_id_t ue_module_idP, - const frame_t frameP, - const eNB_flag_t eNB_flagP, - const srb_flag_t srb_flagP, - const rlc_um_info_t * const config_umP, - const rb_id_t rb_idP);) + const protocol_ctxt_t* const ctxt_pP, + const srb_flag_t srb_flagP, + const rlc_um_info_t * const config_umP, + const rb_id_t rb_idP);) /*! \fn void config_req_rlc_um_asn1 ( - * const module_id_t enb_module_idP, - * const module_id_t ue_module_idP, - * const frame_t frameP, - * const eNB_flag_t eNB_flagP, + * const protocol_ctxt_t* const ctxt_pP, * const srb_flag_t srb_flagP, * const MBMS_flag_t mbms_flagP, * const mbms_session_id_t mbms_session_idP, * const mbms_service_id_t mbms_service_idP, - * const UL_UM_RLC_t* const ul_rlcP, - * const DL_UM_RLC_t* const dl_rlcP, + * const UL_UM_RLC_t* const ul_rlc_pP, + * const DL_UM_RLC_t* const dl_rlc_pP, * const rb_id_t rb_idP) * \brief Allocate memory for RLC UM instance, reset protocol variables, and set protocol parameters. After this configuration the RLC UM protocol instance will be in RLC_DATA_TRANSFER_READY_STATE state. -* \param[in] frameP Frame index. -* \param[in] eNB_flagP Flag to indicate eNB (1) or UE (0) +* \param[in] ctxt_pP Running context. * \param[in] srb_flagP Flag to indicate signalling radio bearer (1) or data radio bearer (0). * \param[in] mbms_flagP Flag to indicate if this RLC is configured for MBMS. -* \param[in] enb_module_idP eNB Virtualized module identifier. -* \param[in] ue_module_idP UE Virtualized module identifier. * \param[in] mbms_session_idP MBMS session id. * \param[in] mbms_service_idP MBMS service id. -* \param[in] ul_rlcP Configuration parameters for RLC UM UL instance. -* \param[in] dl_rlcP Configuration parameters for RLC UM DL instance. +* \param[in] ul_rlc_pP Configuration parameters for RLC UM UL instance. +* \param[in] dl_rlc_pP Configuration parameters for RLC UM DL instance. * \param[in] rb_idP Radio bearer identifier. */ public_rlc_um_control_primitives( void config_req_rlc_um_asn1 ( - const module_id_t enb_module_idP, - const module_id_t ue_module_idP, - const frame_t frameP, - const eNB_flag_t eNB_flagP, - const srb_flag_t srb_flagP, - const MBMS_flag_t mbms_flagP, - const mbms_session_id_t mbms_session_idP, - const mbms_service_id_t mbms_service_idP, - const UL_UM_RLC_t * const ul_rlcP, - const DL_UM_RLC_t * const dl_rlcP, - const rb_id_t rb_idP);) - -/*! \fn void rlc_um_init (rlc_um_entity_t *rlcP) + const protocol_ctxt_t* const ctxt_pP, + const srb_flag_t srb_flagP, + const MBMS_flag_t mbms_flagP, + const mbms_session_id_t mbms_session_idP, + const mbms_service_id_t mbms_service_idP, + const UL_UM_RLC_t * const ul_rlc_pP, + const DL_UM_RLC_t * const dl_rlc_pP, + const rb_id_t rb_idP);) + +/*! \fn void rlc_um_init (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP) * \brief Initialize a RLC UM protocol instance, initialize all variables, lists, allocate buffers for making this instance ready to be configured with protocol configuration parameters. After this initialization the RLC UM protocol instance will be in RLC_NULL_STATE state. -* \param[in] rlcP RLC UM protocol instance pointer. +* \param[in] ctxtP Running context. +* \param[in] rlc_pP RLC UM protocol instance pointer. */ -protected_rlc_um_control_primitives(void rlc_um_init (rlc_um_entity_t * const rlcP);) +protected_rlc_um_control_primitives(void rlc_um_init ( + const protocol_ctxt_t* const ctxt_pP, + rlc_um_entity_t * const rlc_pP);) -/*! \fn void rlc_um_reset_state_variables (rlc_um_entity_t *rlcP) +/*! \fn void rlc_um_reset_state_variables (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP) * \brief Reset protocol variables and state variables to initial values. -* \param[in] rlcP RLC UM protocol instance pointer. +* \param[in] ctxtP Running context. +* \param[in] rlc_pP RLC UM protocol instance pointer. */ -protected_rlc_um_control_primitives(void rlc_um_reset_state_variables (rlc_um_entity_t * const rlcP);) +protected_rlc_um_control_primitives(void rlc_um_reset_state_variables ( + const protocol_ctxt_t* const ctxt_pP, + rlc_um_entity_t * const rlc_pP);) -/*! \fn void rlc_um_cleanup(rlc_um_entity_t *rlcP) +/*! \fn void rlc_um_cleanup(const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP) * \brief Free all allocated memory (lists and buffers) previously allocated by this RLC UM instance. -* \param[in] rlcP RLC UM protocol instance pointer. +* \param[in] ctxtP Running context. +* \param[in] rlc_pP RLC UM protocol instance pointer. */ -public_rlc_um_control_primitives( void rlc_um_cleanup(rlc_um_entity_t * const rlcP);) +public_rlc_um_control_primitives( void rlc_um_cleanup( + const protocol_ctxt_t* const ctxt_pP, + rlc_um_entity_t * const rlc_pP);) /*! \fn void rlc_um_configure( - * rlc_um_entity_t * const rlcP, - * const frame_t frameP, + * const protocol_ctxt_t* const ctxt_pP, + * rlc_um_entity_t * const rlc_pP, * const uint32_t timer_reorderingP, * const uint32_t rx_sn_field_lengthP, * const uint32_t tx_sn_field_lengthP, * const uint32_t is_mXchP) * \brief Configure RLC UM protocol parameters. -* \param[in] rlcP RLC UM protocol instance pointer. -* \param[in] frameP Frame index. +* \param[in] ctxtP Running context. +* \param[in] rlc_pP RLC UM protocol instance pointer. * \param[in] timer_reorderingP t-Reordering timer initialization value, units in frameP. * \param[in] rx_sn_field_lengthP Length of the sequence number, 5 or 10 bits in reception. * \param[in] tx_sn_field_lengthP Length of the sequence number, 5 or 10 bits in transmission. * \param[in] is_mXchP Is the radio bearer for MCCH, MTCH. */ protected_rlc_um_control_primitives(void rlc_um_configure( - rlc_um_entity_t *const rlcP, - const frame_t frameP, - const uint32_t timer_reorderingP, - const uint32_t rx_sn_field_lengthP, - const uint32_t tx_sn_field_lengthP, - const uint32_t is_mXchP);) + const protocol_ctxt_t* const ctxt_pP, + rlc_um_entity_t *const rlc_pP, + const uint32_t timer_reorderingP, + const uint32_t rx_sn_field_lengthP, + const uint32_t tx_sn_field_lengthP, + const uint32_t is_mXchP);) /*! \fn void rlc_um_set_debug_infos( - * rlc_um_entity_t * const rlcP, - * const module_id_t enb_module_idP, - * const module_id_t ue_module_idP, - * const frame_t frameP, - * const eNB_flag_t eNB_flagP, - * const srb_flag_t srb_flagP, - * const rb_id_t rb_idP) +* const protocol_ctxt_t* const ctxt_pP, +* rlc_um_entity_t * const rlc_pP, +* const srb_flag_t srb_flagP, +* const rb_id_t rb_idP) * \brief Set debug informations for a RLC UM protocol instance, these informations are only for trace purpose. -* \param[in] rlcP RLC UM protocol instance pointer. -* \param[in] frameP Frame index. -* \param[in] eNB_flag Flag to indicate eNB (1) or UE (0) -* \param[in] enb_module_idP eNB Virtualized module identifier. -* \param[in] ue_module_idP UE Virtualized module identifier. +* \param[in] ctxtP Running context. +* \param[in] rlc_pP RLC UM protocol instance pointer. * \param[in] rb_idP Radio bearer identifier. * \param[in] srb_flagP Flag to indicate signalling radio bearer (1) or data radio bearer (0). */ protected_rlc_um_control_primitives(void rlc_um_set_debug_infos( - rlc_um_entity_t * const rlcP, - const module_id_t enb_module_idP, - const module_id_t ue_module_idP, - const frame_t frameP, - const eNB_flag_t eNB_flagP, - const srb_flag_t srb_flagP, - const rb_id_t rb_idP);) + const protocol_ctxt_t* const ctxt_pP, + rlc_um_entity_t * const rlc_pP, + const srb_flag_t srb_flagP, + const rb_id_t rb_idP);) /** @} */ # endif diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_dar.c b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_dar.c index c161ba8e7ce55fead6ed393def6c6095c3702554..dbf0e79a826268ccfe16e1dd46b92c5085829125 100644 --- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_dar.c +++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_dar.c @@ -44,11 +44,11 @@ //#define TRACE_RLC_UM_RX 1 //----------------------------------------------------------------------------- signed int rlc_um_get_pdu_infos( - const frame_t frameP, - rlc_um_pdu_sn_10_t * const header_pP, - const sdu_size_t total_sizeP, - rlc_um_pdu_info_t * const pdu_info_pP, - const uint8_t sn_lengthP) + const protocol_ctxt_t* const ctxt_pP, + rlc_um_pdu_sn_10_t * const header_pP, + const sdu_size_t total_sizeP, + rlc_um_pdu_info_t * const pdu_info_pP, + const uint8_t sn_lengthP) //----------------------------------------------------------------------------- { sdu_size_t sum_li = 0; @@ -102,7 +102,7 @@ signed int rlc_um_get_pdu_infos( } AssertFatal( pdu_info_pP->num_li <= RLC_UM_SEGMENT_NB_MAX_LI_PER_PDU, "[FRAME %05u][RLC_UM][MOD XX][RB XX][GET PDU INFO] SN %04d TOO MANY LIs ", - frameP, + ctxt_pP->frame, pdu_info_pP->sn); sum_li += pdu_info_pP->li_list[pdu_info_pP->num_li]; @@ -163,7 +163,12 @@ int rlc_um_read_length_indicators(unsigned char**data_ppP, rlc_um_e_li_t* e_liP, return 0; } //----------------------------------------------------------------------------- -void rlc_um_try_reassembly(rlc_um_entity_t *rlc_pP, frame_t frameP, eNB_flag_t eNB_flagP, rlc_sn_t start_snP, rlc_sn_t end_snP) { +void +rlc_um_try_reassembly( + const protocol_ctxt_t* const ctxt_pP, + rlc_um_entity_t * rlc_pP, + rlc_sn_t start_snP, + rlc_sn_t end_snP) { //----------------------------------------------------------------------------- mem_block_t *pdu_mem_p = NULL; struct mac_tb_ind *tb_ind_p = NULL; @@ -185,10 +190,10 @@ void rlc_um_try_reassembly(rlc_um_entity_t *rlc_pP, frame_t frameP, eNB_flag_t e #if defined (TRACE_RLC_UM_DAR) LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][%s %u] Line %u TRY REASSEMBLY FROM PDU SN=%03d+1 TO PDU SN=%03d SN Length = %d bits\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, (rlc_pP->is_data_plane) ? "DRB" : "SRB", rlc_pP->rb_id, __LINE__, @@ -213,27 +218,27 @@ void rlc_um_try_reassembly(rlc_um_entity_t *rlc_pP, frame_t frameP, eNB_flag_t e if ((rlc_pP->last_reassemblied_sn+1)%rlc_pP->rx_sn_modulo != sn) { #if defined (TRACE_RLC_UM_DAR) LOG_W(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][%s %u] Line %u FINDING a HOLE in RLC UM SN: CLEARING OUTPUT SDU BECAUSE NEW SN (%03d) TO REASSEMBLY NOT CONTIGUOUS WITH LAST REASSEMBLIED SN (%03d)\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, (rlc_pP->is_data_plane) ? "DRB" : "SRB", rlc_pP->rb_id, __LINE__, sn, rlc_pP->last_reassemblied_sn); #endif - rlc_um_clear_rx_sdu(rlc_pP); + rlc_um_clear_rx_sdu(ctxt_pP, rlc_pP); } rlc_pP->last_reassemblied_sn = sn; tb_ind_p = (struct mac_tb_ind *)(pdu_mem_p->data); if (rlc_pP->rx_sn_length == 10) { #if defined (TRACE_RLC_UM_DAR) LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][%s %u] Line %u TRY REASSEMBLY 10 PDU SN=%03d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, (rlc_pP->is_data_plane) ? "DRB" : "SRB", rlc_pP->rb_id, __LINE__, @@ -247,10 +252,10 @@ void rlc_um_try_reassembly(rlc_um_entity_t *rlc_pP, frame_t frameP, eNB_flag_t e } else { #if defined (TRACE_RLC_UM_DAR) LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][%s %u] Line TRY REASSEMBLY 5 PDU SN=%03d Byte 0=%02X\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, (rlc_pP->is_data_plane) ? "DRB" : "SRB", rlc_pP->rb_id, __LINE__, @@ -264,10 +269,10 @@ void rlc_um_try_reassembly(rlc_um_entity_t *rlc_pP, frame_t frameP, eNB_flag_t e data_p = &tb_ind_p->data_ptr[1]; #if defined (TRACE_RLC_UM_DAR) LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][%s %u] Line %u e=%01X fi=%01X\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, (rlc_pP->is_data_plane) ? "DRB" : "SRB", rlc_pP->rb_id, __LINE__, @@ -280,54 +285,54 @@ void rlc_um_try_reassembly(rlc_um_entity_t *rlc_pP, frame_t frameP, eNB_flag_t e case RLC_FI_1ST_BYTE_DATA_IS_1ST_BYTE_SDU_LAST_BYTE_DATA_IS_LAST_BYTE_SDU: #if defined (TRACE_RLC_UM_DAR) LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][%s %u] Line %u TRY REASSEMBLY PDU NO E_LI FI=11 (00)\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, (rlc_pP->is_data_plane) ? "DRB" : "SRB", rlc_pP->rb_id, __LINE__); #endif // one complete SDU - //LGrlc_um_send_sdu(rlc_pP,frameP,eNB_flagP); // may be not necessary - rlc_um_clear_rx_sdu(rlc_pP); - rlc_um_reassembly (data_p, size, rlc_pP,frameP); - rlc_um_send_sdu(rlc_pP,frameP,eNB_flagP); + //LGrlc_um_send_sdu(rlc_pP,ctxt_pP->frame,ctxt_pP->enb_flag); // may be not necessary + rlc_um_clear_rx_sdu(ctxt_pP, rlc_pP); + rlc_um_reassembly (ctxt_pP, rlc_pP, data_p, size); + rlc_um_send_sdu(ctxt_pP, rlc_pP); rlc_pP->reassembly_missing_sn_detected = 0; break; case RLC_FI_1ST_BYTE_DATA_IS_1ST_BYTE_SDU_LAST_BYTE_DATA_IS_NOT_LAST_BYTE_SDU: #if defined (TRACE_RLC_UM_DAR) LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][%s %u] Line %u TRY REASSEMBLY PDU NO E_LI FI=10 (01)\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, (rlc_pP->is_data_plane) ? "DRB" : "SRB", rlc_pP->rb_id, __LINE__); #endif // one beginning segment of SDU in PDU - //LG rlc_um_send_sdu(rlc_pP,frameP,eNB_flagP); // may be not necessary - rlc_um_clear_rx_sdu(rlc_pP); - rlc_um_reassembly (data_p, size, rlc_pP,frameP); + //LG rlc_um_send_sdu(rlc_pP,ctxt_pP->frame,ctxt_pP->enb_flag); // may be not necessary + rlc_um_clear_rx_sdu(ctxt_pP, rlc_pP); + rlc_um_reassembly (ctxt_pP, rlc_pP, data_p, size); rlc_pP->reassembly_missing_sn_detected = 0; break; case RLC_FI_1ST_BYTE_DATA_IS_NOT_1ST_BYTE_SDU_LAST_BYTE_DATA_IS_LAST_BYTE_SDU: #if defined (TRACE_RLC_UM_DAR) LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][%s %u] Line %u TRY REASSEMBLY PDU NO E_LI FI=01 (10)\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, (rlc_pP->is_data_plane) ? "DRB" : "SRB", rlc_pP->rb_id, __LINE__); #endif // one last segment of SDU if (rlc_pP->reassembly_missing_sn_detected == 0) { - rlc_um_reassembly (data_p, size, rlc_pP,frameP); - rlc_um_send_sdu(rlc_pP,frameP,eNB_flagP); + rlc_um_reassembly (ctxt_pP, rlc_pP, data_p, size); + rlc_um_send_sdu(ctxt_pP, rlc_pP); } else { //clear sdu already done rlc_pP->stat_rx_data_pdu_dropped += 1; @@ -338,40 +343,40 @@ void rlc_um_try_reassembly(rlc_um_entity_t *rlc_pP, frame_t frameP, eNB_flag_t e case RLC_FI_1ST_BYTE_DATA_IS_NOT_1ST_BYTE_SDU_LAST_BYTE_DATA_IS_NOT_LAST_BYTE_SDU: #if defined (TRACE_RLC_UM_DAR) LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][%s %u] Line %u TRY REASSEMBLY PDU NO E_LI FI=00 (11)\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, (rlc_pP->is_data_plane) ? "DRB" : "SRB", rlc_pP->rb_id, __LINE__); #endif if (rlc_pP->reassembly_missing_sn_detected == 0) { // one whole segment of SDU in PDU - rlc_um_reassembly (data_p, size, rlc_pP,frameP); + rlc_um_reassembly (ctxt_pP, rlc_pP, data_p, size); } else { #if defined (TRACE_RLC_UM_DAR) LOG_W(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][%s %u] Line %u TRY REASSEMBLY PDU NO E_LI FI=00 (11) MISSING SN DETECTED\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, (rlc_pP->is_data_plane) ? "DRB" : "SRB", rlc_pP->rb_id, __LINE__); #endif //LOG_D(RLC, "[MSC_NBOX][FRAME %05u][%s][RLC_UM][MOD %u/%u][RB %u][Missing SN detected][RLC_UM][MOD %u/%u][RB %u]\n", - // frameP, rlc_pP->module_id,rlc_pP->rb_id, rlc_pP->module_id,rlc_pP->rb_id); + // ctxt_pP->frame, rlc_pP->module_id,rlc_pP->rb_id, rlc_pP->module_id,rlc_pP->rb_id); rlc_pP->reassembly_missing_sn_detected = 1; // not necessary but for readability of the code rlc_pP->stat_rx_data_pdu_dropped += 1; rlc_pP->stat_rx_data_bytes_dropped += tb_ind_p->size; #if defined(RLC_STOP_ON_LOST_PDU) AssertFatal( rlc_pP->reassembly_missing_sn_detected == 1, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][%s %u] MISSING PDU DETECTED\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, (rlc_pP->is_data_plane) ? "DRB" : "SRB", rlc_pP->rb_id); #endif @@ -380,10 +385,10 @@ void rlc_um_try_reassembly(rlc_um_entity_t *rlc_pP, frame_t frameP, eNB_flag_t e break; default: AssertFatal( 0 , "[FRAME %05u][%s][RLC_UM][MOD %u/%u][%s %u] TRY REASSEMBLY SHOULD NOT GO HERE\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, (rlc_pP->is_data_plane) ? "DRB" : "SRB", rlc_pP->rb_id); } @@ -393,10 +398,10 @@ void rlc_um_try_reassembly(rlc_um_entity_t *rlc_pP, frame_t frameP, eNB_flag_t e case RLC_FI_1ST_BYTE_DATA_IS_1ST_BYTE_SDU_LAST_BYTE_DATA_IS_LAST_BYTE_SDU: #if defined (TRACE_RLC_UM_DAR) LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][%s %u] Line %u TRY REASSEMBLY PDU FI=11 (00) Li=", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, (rlc_pP->is_data_plane) ? "DRB" : "SRB", rlc_pP->rb_id, __LINE__); @@ -407,28 +412,28 @@ void rlc_um_try_reassembly(rlc_um_entity_t *rlc_pP, frame_t frameP, eNB_flag_t e LOG_D(RLC, " remaining size %d\n",size); #endif // N complete SDUs - //LGrlc_um_send_sdu(rlc_pP,frameP,eNB_flagP); - rlc_um_clear_rx_sdu(rlc_pP); + //LGrlc_um_send_sdu(rlc_pP,ctxt_pP->frame,ctxt_pP->enb_flag); + rlc_um_clear_rx_sdu(ctxt_pP, rlc_pP); for (i = 0; i < num_li; i++) { - rlc_um_reassembly (data_p, li_array[i], rlc_pP,frameP); - rlc_um_send_sdu(rlc_pP,frameP,eNB_flagP); + rlc_um_reassembly (ctxt_pP, rlc_pP, data_p, li_array[i]); + rlc_um_send_sdu(ctxt_pP, rlc_pP); data_p = &data_p[li_array[i]]; } if (size > 0) { // normally should always be > 0 but just for help debug // data_p is already ok, done by last loop above - rlc_um_reassembly (data_p, size, rlc_pP,frameP); - rlc_um_send_sdu(rlc_pP,frameP,eNB_flagP); + rlc_um_reassembly (ctxt_pP, rlc_pP, data_p, size); + rlc_um_send_sdu(ctxt_pP, rlc_pP); } rlc_pP->reassembly_missing_sn_detected = 0; break; case RLC_FI_1ST_BYTE_DATA_IS_1ST_BYTE_SDU_LAST_BYTE_DATA_IS_NOT_LAST_BYTE_SDU: #if defined (TRACE_RLC_UM_DAR) LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][%s %u] Line %u TRY REASSEMBLY PDU FI=10 (01) Li=", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, (rlc_pP->is_data_plane) ? "DRB" : "SRB", rlc_pP->rb_id, __LINE__); @@ -438,26 +443,26 @@ void rlc_um_try_reassembly(rlc_um_entity_t *rlc_pP, frame_t frameP, eNB_flag_t e LOG_D(RLC, " remaining size %d\n",size); #endif // N complete SDUs + one segment of SDU in PDU - //LG rlc_um_send_sdu(rlc_pP,frameP,eNB_flagP); - rlc_um_clear_rx_sdu(rlc_pP); + //LG rlc_um_send_sdu(rlc_pP,ctxt_pP->frame,ctxt_pP->enb_flag); + rlc_um_clear_rx_sdu(ctxt_pP, rlc_pP); for (i = 0; i < num_li; i++) { - rlc_um_reassembly (data_p, li_array[i], rlc_pP,frameP); - rlc_um_send_sdu(rlc_pP,frameP,eNB_flagP); + rlc_um_reassembly (ctxt_pP, rlc_pP, data_p, li_array[i]); + rlc_um_send_sdu(ctxt_pP, rlc_pP); data_p = &data_p[li_array[i]]; } if (size > 0) { // normally should always be > 0 but just for help debug // data_p is already ok, done by last loop above - rlc_um_reassembly (data_p, size, rlc_pP,frameP); + rlc_um_reassembly (ctxt_pP, rlc_pP, data_p, size); } rlc_pP->reassembly_missing_sn_detected = 0; break; case RLC_FI_1ST_BYTE_DATA_IS_NOT_1ST_BYTE_SDU_LAST_BYTE_DATA_IS_LAST_BYTE_SDU: #if defined (TRACE_RLC_UM_DAR) LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][%s %u] Line %u TRY REASSEMBLY PDU FI=01 (10) Li=", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, (rlc_pP->is_data_plane) ? "DRB" : "SRB", rlc_pP->rb_id, __LINE__); @@ -477,24 +482,24 @@ void rlc_um_try_reassembly(rlc_um_entity_t *rlc_pP, frame_t frameP, eNB_flag_t e // one last segment of SDU + N complete SDUs in PDU for (i = reassembly_start_index; i < num_li; i++) { - rlc_um_reassembly (data_p, li_array[i], rlc_pP,frameP); - rlc_um_send_sdu(rlc_pP,frameP,eNB_flagP); + rlc_um_reassembly (ctxt_pP, rlc_pP, data_p, li_array[i]); + rlc_um_send_sdu(ctxt_pP, rlc_pP); data_p = &data_p[li_array[i]]; } if (size > 0) { // normally should always be > 0 but just for help debug // data_p is already ok, done by last loop above - rlc_um_reassembly (data_p, size, rlc_pP,frameP); - rlc_um_send_sdu(rlc_pP,frameP,eNB_flagP); + rlc_um_reassembly (ctxt_pP, rlc_pP, data_p, size); + rlc_um_send_sdu(ctxt_pP, rlc_pP); } rlc_pP->reassembly_missing_sn_detected = 0; break; case RLC_FI_1ST_BYTE_DATA_IS_NOT_1ST_BYTE_SDU_LAST_BYTE_DATA_IS_NOT_LAST_BYTE_SDU: #if defined (TRACE_RLC_UM_DAR) LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][%s %u] Line %u TRY REASSEMBLY PDU FI=00 (11) Li=", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, (rlc_pP->is_data_plane) ? "DRB" : "SRB", rlc_pP->rb_id, __LINE__); @@ -506,10 +511,10 @@ void rlc_um_try_reassembly(rlc_um_entity_t *rlc_pP, frame_t frameP, eNB_flag_t e if (rlc_pP->reassembly_missing_sn_detected) { #if defined (TRACE_RLC_UM_DAR) LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][%s %u] Line %u DISCARD FIRST LI %d", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, (rlc_pP->is_data_plane) ? "DRB" : "SRB", rlc_pP->rb_id, __LINE__, @@ -524,19 +529,19 @@ void rlc_um_try_reassembly(rlc_um_entity_t *rlc_pP, frame_t frameP, eNB_flag_t e } for (i = reassembly_start_index; i < num_li; i++) { - rlc_um_reassembly (data_p, li_array[i], rlc_pP,frameP); - rlc_um_send_sdu(rlc_pP,frameP,eNB_flagP); + rlc_um_reassembly (ctxt_pP, rlc_pP, data_p, li_array[i]); + rlc_um_send_sdu(ctxt_pP, rlc_pP); data_p = &data_p[li_array[i]]; } if (size > 0) { // normally should always be > 0 but just for help debug // data_p is already ok, done by last loop above - rlc_um_reassembly (data_p, size, rlc_pP,frameP); + rlc_um_reassembly (ctxt_pP, rlc_pP, data_p, size); } else { AssertFatal( 0 !=0, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][%s %u] SHOULD NOT GO HERE\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, (rlc_pP->is_data_plane) ? "DRB" : "SRB", rlc_pP->rb_id); //rlc_pP->stat_rx_data_pdu_dropped += 1; @@ -547,10 +552,10 @@ void rlc_um_try_reassembly(rlc_um_entity_t *rlc_pP, frame_t frameP, eNB_flag_t e default: #if defined (TRACE_RLC_UM_DAR) LOG_W(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][%s %u] Line %u Missing SN detected\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, (rlc_pP->is_data_plane) ? "DRB" : "SRB", rlc_pP->rb_id, __LINE__); @@ -562,10 +567,10 @@ void rlc_um_try_reassembly(rlc_um_entity_t *rlc_pP, frame_t frameP, eNB_flag_t e #if defined(RLC_STOP_ON_LOST_PDU) AssertFatal( rlc_pP->reassembly_missing_sn_detected == 1, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][%s %u] MISSING PDU DETECTED\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, (rlc_pP->is_data_plane) ? "DRB" : "SRB", rlc_pP->rb_id); #endif @@ -574,10 +579,10 @@ void rlc_um_try_reassembly(rlc_um_entity_t *rlc_pP, frame_t frameP, eNB_flag_t e } #if defined (TRACE_RLC_UM_DAR) LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][%s %u] Line %u REMOVE PDU FROM DAR BUFFER SN=%03d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, (rlc_pP->is_data_plane) ? "DRB" : "SRB", rlc_pP->rb_id, __LINE__, @@ -589,24 +594,24 @@ void rlc_um_try_reassembly(rlc_um_entity_t *rlc_pP, frame_t frameP, eNB_flag_t e rlc_pP->last_reassemblied_missing_sn = sn; #if defined (TRACE_RLC_UM_DAR) LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][%s %u] Line %u Missing SN %04d detected, clearing RX SDU\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, (rlc_pP->is_data_plane) ? "DRB" : "SRB", rlc_pP->rb_id, __LINE__, sn); #endif rlc_pP->reassembly_missing_sn_detected = 1; - rlc_um_clear_rx_sdu(rlc_pP); + rlc_um_clear_rx_sdu(ctxt_pP, rlc_pP); #if defined(RLC_STOP_ON_LOST_PDU) AssertFatal( rlc_pP->reassembly_missing_sn_detected == 1, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][%s %u] MISSING PDU DETECTED\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, (rlc_pP->is_data_plane) ? "DRB" : "SRB", rlc_pP->rb_id); #endif @@ -618,10 +623,10 @@ void rlc_um_try_reassembly(rlc_um_entity_t *rlc_pP, frame_t frameP, eNB_flag_t e } #if defined (TRACE_RLC_UM_DAR) LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][%s %u] Line %u TRIED REASSEMBLY VR(UR)=%03d VR(UX)=%03d VR(UH)=%03d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, (rlc_pP->is_data_plane) ? "DRB" : "SRB", rlc_pP->rb_id, __LINE__, @@ -633,15 +638,18 @@ void rlc_um_try_reassembly(rlc_um_entity_t *rlc_pP, frame_t frameP, eNB_flag_t e vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_UM_TRY_REASSEMBLY,VCD_FUNCTION_OUT); } //----------------------------------------------------------------------------- -void rlc_um_stop_and_reset_timer_reordering(rlc_um_entity_t *rlc_pP,frame_t frameP) +void +rlc_um_stop_and_reset_timer_reordering( + const protocol_ctxt_t* const ctxt_pP, + rlc_um_entity_t * rlc_pP) //----------------------------------------------------------------------------- { #if defined (TRACE_RLC_UM_DAR) LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][%s %u][T-REORDERING] STOPPED AND RESET\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, (rlc_pP->is_data_plane) ? "DRB" : "SRB", rlc_pP->rb_id); #endif @@ -651,26 +659,33 @@ void rlc_um_stop_and_reset_timer_reordering(rlc_um_entity_t *rlc_pP,frame_t fram rlc_pP->t_reordering.timed_out = 0; } //----------------------------------------------------------------------------- -void rlc_um_start_timer_reordering(rlc_um_entity_t *rlc_pP,frame_t frameP) +void +rlc_um_start_timer_reordering( + const protocol_ctxt_t* const ctxt_pP, + rlc_um_entity_t * rlc_pP) //----------------------------------------------------------------------------- { rlc_pP->t_reordering.running = 1; - rlc_pP->t_reordering.frame_time_out = frameP + rlc_pP->t_reordering.time_out; - rlc_pP->t_reordering.frame_start = frameP; + rlc_pP->t_reordering.frame_time_out = ctxt_pP->frame + rlc_pP->t_reordering.time_out; + rlc_pP->t_reordering.frame_start = ctxt_pP->frame; rlc_pP->t_reordering.timed_out = 0; #if defined (TRACE_RLC_UM_DAR) LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][%s %u][T-REORDERING] STARTED (TIME-OUT = FRAME %05u)\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, (rlc_pP->is_data_plane) ? "DRB" : "SRB", rlc_pP->rb_id, rlc_pP->t_reordering.frame_time_out); #endif } //----------------------------------------------------------------------------- -void rlc_um_init_timer_reordering(rlc_um_entity_t *rlc_pP, uint32_t time_outP) +void +rlc_um_init_timer_reordering( + const protocol_ctxt_t* const ctxt_pP, + rlc_um_entity_t * const rlc_pP, + uint32_t time_outP) //----------------------------------------------------------------------------- { rlc_pP->t_reordering.running = 0; @@ -680,7 +695,9 @@ void rlc_um_init_timer_reordering(rlc_um_entity_t *rlc_pP, uint32_t time_outP) rlc_pP->t_reordering.timed_out = 0; } //----------------------------------------------------------------------------- -void rlc_um_check_timer_dar_time_out(rlc_um_entity_t *rlc_pP, frame_t frameP, eNB_flag_t eNB_flagP) { +void rlc_um_check_timer_dar_time_out( + const protocol_ctxt_t* const ctxt_pP, + rlc_um_entity_t * const rlc_pP) { //----------------------------------------------------------------------------- signed int in_window; rlc_usn_t old_vr_ur; @@ -695,18 +712,18 @@ void rlc_um_check_timer_dar_time_out(rlc_um_entity_t *rlc_pP, frame_t frameP, eN // +-----------+------------------+----------+ //FRAME # 0 FRAME MAX ((rlc_pP->t_reordering.frame_start < rlc_pP->t_reordering.frame_time_out) && - ((frameP >= rlc_pP->t_reordering.frame_time_out) || - (frameP < rlc_pP->t_reordering.frame_start))) || + ((ctxt_pP->frame >= rlc_pP->t_reordering.frame_time_out) || + (ctxt_pP->frame < rlc_pP->t_reordering.frame_start))) || // CASE 2: time out start // +-----------+------------------+----------+ // |***********| |**********| // +-----------+------------------+----------+ //FRAME # 0 FRAME MAX VALUE ((rlc_pP->t_reordering.frame_start > rlc_pP->t_reordering.frame_time_out) && - (frameP < rlc_pP->t_reordering.frame_start) && (frameP >= rlc_pP->t_reordering.frame_time_out)) + (ctxt_pP->frame < rlc_pP->t_reordering.frame_start) && (ctxt_pP->frame >= rlc_pP->t_reordering.frame_time_out)) ) { - //if ((uint32_t)((uint32_t)rlc_pP->timer_reordering + (uint32_t)rlc_pP->timer_reordering_init) <= frameP) { + //if ((uint32_t)((uint32_t)rlc_pP->timer_reordering + (uint32_t)rlc_pP->timer_reordering_init) <= ctxt_pP->frame) { // 5.1.2.2.4 Actions when t-Reordering expires // When t-Reordering expires, the receiving UM RLC entity shall: // -update VR(UR) to the SN of the first UMD PDU with SN >= VR(UX) that has not been received; @@ -717,48 +734,48 @@ void rlc_um_check_timer_dar_time_out(rlc_um_entity_t *rlc_pP, frame_t frameP, eN rlc_pP->stat_timer_reordering_timed_out += 1; #if defined (TRACE_RLC_UM_DAR) LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][%s %u]*****************************************************\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, (rlc_pP->is_data_plane) ? "DRB" : "SRB", rlc_pP->rb_id); LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][%s %u]* T I M E - O U T *\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, (rlc_pP->is_data_plane) ? "DRB" : "SRB", rlc_pP->rb_id); LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][%s %u]*****************************************************\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, (rlc_pP->is_data_plane) ? "DRB" : "SRB", rlc_pP->rb_id); LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][%s %u] TIMER t-Reordering expiration\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, (rlc_pP->is_data_plane) ? "DRB" : "SRB", rlc_pP->rb_id); - LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][%s %u] timer_reordering=%d frameP=%d expire frameP %d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][%s %u] timer_reordering=%d ctxt_pP->frame=%d expire ctxt_pP->frame %d\n", + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, (rlc_pP->is_data_plane) ? "DRB" : "SRB", rlc_pP->rb_id, rlc_pP->t_reordering.time_out, rlc_pP->t_reordering.frame_time_out, - frameP); + ctxt_pP->frame); LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][%s %u] set VR(UR)=%03d to", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, (rlc_pP->is_data_plane) ? "DRB" : "SRB", rlc_pP->rb_id, rlc_pP->vr_ur); @@ -767,25 +784,25 @@ void rlc_um_check_timer_dar_time_out(rlc_um_entity_t *rlc_pP, frame_t frameP, eN old_vr_ur = rlc_pP->vr_ur; rlc_pP->vr_ur = rlc_pP->vr_ux; - while (rlc_um_get_pdu_from_dar_buffer(rlc_pP, rlc_pP->vr_ur)) { + while (rlc_um_get_pdu_from_dar_buffer(ctxt_pP, rlc_pP, rlc_pP->vr_ur)) { rlc_pP->vr_ur = (rlc_pP->vr_ur+1)%rlc_pP->rx_sn_modulo; } #if defined (TRACE_RLC_UM_DAR) LOG_D(RLC, " %d", rlc_pP->vr_ur); LOG_D(RLC, "\n"); #endif - rlc_um_try_reassembly(rlc_pP,frameP,eNB_flagP,old_vr_ur, rlc_pP->vr_ur); + rlc_um_try_reassembly(ctxt_pP, rlc_pP ,old_vr_ur, rlc_pP->vr_ur); - in_window = rlc_um_in_window(rlc_pP, frameP, rlc_pP->vr_ur, rlc_pP->vr_uh, rlc_pP->vr_uh); + in_window = rlc_um_in_window(ctxt_pP, rlc_pP, rlc_pP->vr_ur, rlc_pP->vr_uh, rlc_pP->vr_uh); if (in_window == 2) { - rlc_um_start_timer_reordering(rlc_pP, frameP); + rlc_um_start_timer_reordering(ctxt_pP, rlc_pP); rlc_pP->vr_ux = rlc_pP->vr_uh; #if defined (TRACE_RLC_UM_DAR) LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][%s %u] restarting t-Reordering set VR(UX) to %d (VR(UH)>VR(UR))\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, (rlc_pP->is_data_plane) ? "DRB" : "SRB", rlc_pP->rb_id, rlc_pP->vr_ux); @@ -793,15 +810,15 @@ void rlc_um_check_timer_dar_time_out(rlc_um_entity_t *rlc_pP, frame_t frameP, eN } else { #if defined (TRACE_RLC_UM_DAR) LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][%s %u] STOP t-Reordering VR(UX) = %03d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, (rlc_pP->is_data_plane) ? "DRB" : "SRB", rlc_pP->rb_id, rlc_pP->vr_ux); #endif - rlc_um_stop_and_reset_timer_reordering(rlc_pP, frameP); + rlc_um_stop_and_reset_timer_reordering(ctxt_pP, rlc_pP); } pthread_mutex_unlock(&rlc_pP->lock_dar_buffer); } @@ -811,15 +828,18 @@ void rlc_um_check_timer_dar_time_out(rlc_um_entity_t *rlc_pP, frame_t frameP, eN } //----------------------------------------------------------------------------- inline mem_block_t * -rlc_um_remove_pdu_from_dar_buffer(rlc_um_entity_t *rlc_pP, rlc_usn_t snP) +rlc_um_remove_pdu_from_dar_buffer( + const protocol_ctxt_t* const ctxt_pP, + rlc_um_entity_t * const rlc_pP, + rlc_usn_t snP) { //----------------------------------------------------------------------------- mem_block_t * pdu_p = rlc_pP->dar_buffer[snP]; #if defined (TRACE_RLC_UM_DAR) LOG_D(RLC, "[FRAME ?????][%s][RLC_UM][MOD %u/%u][%s %u] REMOVE PDU FROM DAR BUFFER SN=%03d\n", - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, (rlc_pP->is_data_plane) ? "DRB" : "SRB", rlc_pP->rb_id, snP); @@ -829,22 +849,26 @@ rlc_um_remove_pdu_from_dar_buffer(rlc_um_entity_t *rlc_pP, rlc_usn_t snP) } //----------------------------------------------------------------------------- inline mem_block_t * -rlc_um_get_pdu_from_dar_buffer(rlc_um_entity_t *rlc_pP, rlc_usn_t snP) +rlc_um_get_pdu_from_dar_buffer(const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP, rlc_usn_t snP) { //----------------------------------------------------------------------------- return rlc_pP->dar_buffer[snP]; } //----------------------------------------------------------------------------- inline void -rlc_um_store_pdu_in_dar_buffer(rlc_um_entity_t *rlc_pP, frame_t frameP, mem_block_t *pdu_pP, rlc_usn_t snP) +rlc_um_store_pdu_in_dar_buffer( + const protocol_ctxt_t* const ctxt_pP, + rlc_um_entity_t * const rlc_pP, + mem_block_t *pdu_pP, + rlc_usn_t snP) { //----------------------------------------------------------------------------- #if defined (TRACE_RLC_UM_DAR) LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][%s %u] STORE PDU IN DAR BUFFER SN=%03d VR(UR)=%03d VR(UX)=%03d VR(UH)=%03d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, (rlc_pP->is_data_plane) ? "DRB" : "SRB", rlc_pP->rb_id, snP, @@ -861,7 +885,13 @@ rlc_um_store_pdu_in_dar_buffer(rlc_um_entity_t *rlc_pP, frame_t frameP, mem_bloc // returns 1 if lower_bound == sn // returns 2 if higher_bound == sn // returns 3 if higher_bound == sn == lower_bound -inline signed int rlc_um_in_window(rlc_um_entity_t *rlc_pP, frame_t frameP, rlc_sn_t lower_boundP, rlc_sn_t snP, rlc_sn_t higher_boundP) { +inline signed int +rlc_um_in_window( + const protocol_ctxt_t* const ctxt_pP, + rlc_um_entity_t * const rlc_pP, + rlc_sn_t lower_boundP, + rlc_sn_t snP, + rlc_sn_t higher_boundP) { //----------------------------------------------------------------------------- rlc_sn_t modulus = (rlc_sn_t)rlc_pP->vr_uh - rlc_pP->rx_um_window_size; @@ -877,10 +907,10 @@ inline signed int rlc_um_in_window(rlc_um_entity_t *rlc_pP, frame_t frameP, rlc_ if ( lower_boundP > snP) { #ifdef TRACE_RLC_UM_RX LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][%s %u] %d not in WINDOW[%03d:%03d] (SN<LOWER BOUND)\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, (rlc_pP->is_data_plane) ? "DRB" : "SRB", rlc_pP->rb_id, sn, @@ -892,10 +922,10 @@ inline signed int rlc_um_in_window(rlc_um_entity_t *rlc_pP, frame_t frameP, rlc_ if ( higher_boundP < snP) { #ifdef TRACE_RLC_UM_RX LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][%s %u] %d not in WINDOW[%03d:%03d] (SN>HIGHER BOUND) <=> %d not in WINDOW[%03d:%03d]\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, (rlc_pP->is_data_plane) ? "DRB" : "SRB", rlc_pP->rb_id, sn, @@ -911,10 +941,10 @@ inline signed int rlc_um_in_window(rlc_um_entity_t *rlc_pP, frame_t frameP, rlc_ if ( higher_boundP == snP) { #ifdef TRACE_RLC_UM_RX LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][%s %u] %d in WINDOW[%03d:%03d] (SN=HIGHER BOUND=LOWER BOUND)\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, (rlc_pP->is_data_plane) ? "DRB" : "SRB", rlc_pP->rb_id, sn, @@ -925,10 +955,10 @@ inline signed int rlc_um_in_window(rlc_um_entity_t *rlc_pP, frame_t frameP, rlc_ } #ifdef TRACE_RLC_UM_RX LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][%s %u] %d in WINDOW[%03d:%03d] (SN=LOWER BOUND)\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, (rlc_pP->is_data_plane) ? "DRB" : "SRB", rlc_pP->rb_id, sn, @@ -940,10 +970,10 @@ inline signed int rlc_um_in_window(rlc_um_entity_t *rlc_pP, frame_t frameP, rlc_ if ( higher_boundP == snP) { #ifdef TRACE_RLC_UM_RX LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][%s %u] %d in WINDOW[%03d:%03d] (SN=HIGHER BOUND)\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, (rlc_pP->is_data_plane) ? "DRB" : "SRB", rlc_pP->rb_id, sn, @@ -956,26 +986,29 @@ inline signed int rlc_um_in_window(rlc_um_entity_t *rlc_pP, frame_t frameP, rlc_ } //----------------------------------------------------------------------------- -inline signed int rlc_um_in_reordering_window(rlc_um_entity_t *rlc_pP, frame_t frameP, rlc_sn_t snP) { +inline signed int +rlc_um_in_reordering_window( + const protocol_ctxt_t* const ctxt_pP, + rlc_um_entity_t * const rlc_pP, + const rlc_sn_t snP) { //----------------------------------------------------------------------------- rlc_sn_t modulus = (signed int)rlc_pP->vr_uh - rlc_pP->rx_um_window_size; - rlc_sn_t sn = snP; - snP = (snP - modulus) % rlc_pP->rx_sn_modulo; + rlc_sn_t sn_mod = (snP - modulus) % rlc_pP->rx_sn_modulo; - if ( 0 <= snP) { - if (snP < rlc_pP->rx_um_window_size) { + if ( 0 <= sn_mod) { + if (sn_mod < rlc_pP->rx_um_window_size) { #if defined (TRACE_RLC_UM_DAR) LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][%s %u] %d IN REORDERING WINDOW[%03d:%03d[ SN %d IN [%03d:%03d[ VR(UR)=%03d VR(UH)=%03d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, (rlc_pP->is_data_plane) ? "DRB" : "SRB", rlc_pP->rb_id, - snP, + sn_mod, 0, rlc_pP->rx_um_window_size, - sn, + snP, (signed int)rlc_pP->vr_uh - rlc_pP->rx_um_window_size, rlc_pP->vr_uh, rlc_pP->vr_ur, @@ -987,32 +1020,32 @@ inline signed int rlc_um_in_reordering_window(rlc_um_entity_t *rlc_pP, frame_t f #if defined (TRACE_RLC_UM_DAR) if (modulus < 0) { LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][%s %u] %d NOT IN REORDERING WINDOW[%03d:%03d[ SN %d NOT IN [%03d:%03d[ VR(UR)=%03d VR(UH)=%03d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, (rlc_pP->is_data_plane) ? "DRB" : "SRB", rlc_pP->rb_id, - snP, + sn_mod, modulus + 1024, rlc_pP->rx_um_window_size, - sn, + snP, modulus + 1024 , rlc_pP->vr_uh, rlc_pP->vr_ur, rlc_pP->vr_uh); } else { LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][%s %u] %d NOT IN REORDERING WINDOW[%03d:%03d[ SN %d NOT IN [%03d:%03d[ VR(UR)=%03d VR(UH)=%03d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, (rlc_pP->is_data_plane) ? "DRB" : "SRB", rlc_pP->rb_id, - snP, + sn_mod, modulus, rlc_pP->rx_um_window_size, - sn, + snP, modulus , rlc_pP->vr_uh, rlc_pP->vr_ur, @@ -1023,7 +1056,12 @@ inline signed int rlc_um_in_reordering_window(rlc_um_entity_t *rlc_pP, frame_t f } //----------------------------------------------------------------------------- void -rlc_um_receive_process_dar (rlc_um_entity_t *rlc_pP, frame_t frameP, eNB_flag_t eNB_flagP, mem_block_t *pdu_mem_pP,rlc_um_pdu_sn_10_t *pdu_pP, sdu_size_t tb_sizeP) +rlc_um_receive_process_dar ( + const protocol_ctxt_t* const ctxt_pP, + rlc_um_entity_t * const rlc_pP, + mem_block_t * pdu_mem_pP, + rlc_um_pdu_sn_10_t * const pdu_pP, + const sdu_size_t tb_sizeP) { //----------------------------------------------------------------------------- // 36.322v9.3.0 section 5.1.2.2.1: @@ -1059,7 +1097,7 @@ rlc_um_receive_process_dar (rlc_um_entity_t *rlc_pP, frame_t frameP, eNB_flag_t } pthread_mutex_lock(&rlc_pP->lock_dar_buffer); - in_window = rlc_um_in_window(rlc_pP, frameP, rlc_pP->vr_uh - rlc_pP->rx_um_window_size, sn, rlc_pP->vr_ur); + in_window = rlc_um_in_window(ctxt_pP, rlc_pP, rlc_pP->vr_uh - rlc_pP->rx_um_window_size, sn, rlc_pP->vr_ur); #if defined(DEBUG_RLC_PAYLOAD) rlc_util_print_hex_octets(RLC, &pdu_pP->b1, tb_sizeP); @@ -1074,10 +1112,10 @@ rlc_um_receive_process_dar (rlc_um_entity_t *rlc_pP, frame_t frameP, eNB_flag_t if ((in_window == 1) || (in_window == 0)){ #if defined (TRACE_RLC_UM_DAR) LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][%s %u] RX PDU VR(UH) – UM_Window_Size) <= SN %d < VR(UR) -> GARBAGE\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, (rlc_pP->is_data_plane) ? "DRB" : "SRB", rlc_pP->rb_id, sn); @@ -1090,15 +1128,15 @@ rlc_um_receive_process_dar (rlc_um_entity_t *rlc_pP, frame_t frameP, eNB_flag_t vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_UM_RECEIVE_PROCESS_DAR, VCD_FUNCTION_OUT); return; } - if ((rlc_um_get_pdu_from_dar_buffer(rlc_pP, sn))) { - in_window = rlc_um_in_window(rlc_pP, frameP, rlc_pP->vr_ur, sn, rlc_pP->vr_uh); + if ((rlc_um_get_pdu_from_dar_buffer(ctxt_pP, rlc_pP, sn))) { + in_window = rlc_um_in_window(ctxt_pP, rlc_pP, rlc_pP->vr_ur, sn, rlc_pP->vr_uh); if (in_window == 0){ #if defined (TRACE_RLC_UM_DAR) LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][%s %u] RX PDU VR(UR) < SN %d < VR(UH) and RECEIVED BEFORE-> GARBAGE\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, (rlc_pP->is_data_plane) ? "DRB" : "SRB", rlc_pP->rb_id, sn); @@ -1117,18 +1155,18 @@ rlc_um_receive_process_dar (rlc_um_entity_t *rlc_pP, frame_t frameP, eNB_flag_t rlc_pP->stat_rx_data_bytes_duplicate += tb_sizeP; #if defined (TRACE_RLC_UM_DAR) LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][%s %u] RX PDU SN %03d REMOVE OLD PDU BEFORE STORING NEW PDU\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, (rlc_pP->is_data_plane) ? "DRB" : "SRB", rlc_pP->rb_id, sn); #endif - mem_block_t *pdu = rlc_um_remove_pdu_from_dar_buffer(rlc_pP, sn); + mem_block_t *pdu = rlc_um_remove_pdu_from_dar_buffer(ctxt_pP, rlc_pP, sn); free_mem_block(pdu); } - rlc_um_store_pdu_in_dar_buffer(rlc_pP, frameP, pdu_mem_pP, sn); + rlc_um_store_pdu_in_dar_buffer(ctxt_pP, rlc_pP, pdu_mem_pP, sn); // -if x falls outside of the reordering window: @@ -1140,13 +1178,13 @@ rlc_um_receive_process_dar (rlc_um_entity_t *rlc_pP, frame_t frameP, eNB_flag_t // // -if VR(UR) falls outside of the reordering window: // -set VR(UR) to (VR(UH) – UM_Window_Size); - if (rlc_um_in_reordering_window(rlc_pP, frameP, sn) < 0) { + if (rlc_um_in_reordering_window(ctxt_pP, rlc_pP, sn) < 0) { #if defined (TRACE_RLC_UM_DAR) LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][%s %u] RX PDU SN %d OUTSIDE REORDERING WINDOW VR(UH)=%d UM_Window_Size=%d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, (rlc_pP->is_data_plane) ? "DRB" : "SRB", rlc_pP->rb_id, sn, @@ -1155,23 +1193,23 @@ rlc_um_receive_process_dar (rlc_um_entity_t *rlc_pP, frame_t frameP, eNB_flag_t #endif rlc_pP->vr_uh = (sn + 1) % rlc_pP->rx_sn_modulo; - if (rlc_um_in_reordering_window(rlc_pP, frameP, rlc_pP->vr_ur) != 0) { + if (rlc_um_in_reordering_window(ctxt_pP, rlc_pP, rlc_pP->vr_ur) != 0) { in_window = rlc_pP->vr_uh - rlc_pP->rx_um_window_size; if (in_window < 0) { in_window = in_window + rlc_pP->rx_sn_modulo; } - rlc_um_try_reassembly(rlc_pP, frameP, eNB_flagP, rlc_pP->vr_ur, in_window); + rlc_um_try_reassembly(ctxt_pP, rlc_pP, rlc_pP->vr_ur, in_window); } - if (rlc_um_in_reordering_window(rlc_pP, frameP, rlc_pP->vr_ur) < 0) { + if (rlc_um_in_reordering_window(ctxt_pP, rlc_pP, rlc_pP->vr_ur) < 0) { #if defined (TRACE_RLC_UM_DAR) LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][%s %u] VR(UR) %d OUTSIDE REORDERING WINDOW SET TO VR(UH) – UM_Window_Size = %d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, (rlc_pP->is_data_plane) ? "DRB" : "SRB", rlc_pP->rb_id, rlc_pP->vr_ur, @@ -1187,12 +1225,12 @@ rlc_um_receive_process_dar (rlc_um_entity_t *rlc_pP, frame_t frameP, eNB_flag_t // remove RLC headers when doing so and deliver the reassembled RLC // SDUs to upper layer in ascending order of the RLC SN if not // delivered before; - if ((sn == rlc_pP->vr_ur) && rlc_um_get_pdu_from_dar_buffer(rlc_pP, rlc_pP->vr_ur)) { + if ((sn == rlc_pP->vr_ur) && rlc_um_get_pdu_from_dar_buffer(ctxt_pP, rlc_pP, rlc_pP->vr_ur)) { //sn_tmp = rlc_pP->vr_ur; do { rlc_pP->vr_ur = (rlc_pP->vr_ur+1) % rlc_pP->rx_sn_modulo; - } while (rlc_um_get_pdu_from_dar_buffer(rlc_pP, rlc_pP->vr_ur) && (rlc_pP->vr_ur != rlc_pP->vr_uh)); - rlc_um_try_reassembly(rlc_pP, frameP, eNB_flagP, sn, rlc_pP->vr_ur); + } while (rlc_um_get_pdu_from_dar_buffer(ctxt_pP, rlc_pP, rlc_pP->vr_ur) && (rlc_pP->vr_ur != rlc_pP->vr_uh)); + rlc_um_try_reassembly(ctxt_pP, rlc_pP, sn, rlc_pP->vr_ur); } // -if t-Reordering is running: @@ -1202,38 +1240,38 @@ rlc_um_receive_process_dar (rlc_um_entity_t *rlc_pP, frame_t frameP, eNB_flag_t // -stop and reset t-Reordering; if (rlc_pP->t_reordering.running) { if (rlc_pP->vr_uh != rlc_pP->vr_ux) { - in_window = rlc_um_in_reordering_window(rlc_pP, frameP, rlc_pP->vr_ux); + in_window = rlc_um_in_reordering_window(ctxt_pP, rlc_pP, rlc_pP->vr_ux); if (in_window < 0) { #if defined (TRACE_RLC_UM_DAR) LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][%s %u] STOP and RESET t-Reordering because VR(UX) falls outside of the reordering window and VR(UX)=%d is not equal to VR(UH)=%d -or- VR(UX) <= VR(UR)\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, (rlc_pP->is_data_plane) ? "DRB" : "SRB", rlc_pP->rb_id, rlc_pP->vr_ux, rlc_pP->vr_uh); #endif - rlc_um_stop_and_reset_timer_reordering(rlc_pP, frameP); + rlc_um_stop_and_reset_timer_reordering(ctxt_pP, rlc_pP); } } } if (rlc_pP->t_reordering.running) { - in_window = rlc_um_in_window(rlc_pP, frameP, rlc_pP->vr_ur, rlc_pP->vr_ux, rlc_pP->vr_uh); + in_window = rlc_um_in_window(ctxt_pP, rlc_pP, rlc_pP->vr_ur, rlc_pP->vr_ux, rlc_pP->vr_uh); if ((in_window == -2) || (in_window == 1)) { #if defined (TRACE_RLC_UM_DAR) LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][%s %u] STOP and RESET t-Reordering because VR(UX) falls outside of the reordering window and VR(UX)=%d is not equal to VR(UH)=%d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, (rlc_pP->is_data_plane) ? "DRB" : "SRB", rlc_pP->rb_id, rlc_pP->vr_ux, rlc_pP->vr_uh); #endif - rlc_um_stop_and_reset_timer_reordering(rlc_pP, frameP); + rlc_um_stop_and_reset_timer_reordering(ctxt_pP, rlc_pP); } } // -if t-Reordering is not running (includes the case when t-Reordering is @@ -1242,16 +1280,16 @@ rlc_um_receive_process_dar (rlc_um_entity_t *rlc_pP, frame_t frameP, eNB_flag_t // -start t-Reordering; // -set VR(UX) to VR(UH). if (rlc_pP->t_reordering.running == 0) { - in_window = rlc_um_in_window(rlc_pP, frameP, rlc_pP->vr_ur, rlc_pP->vr_uh, rlc_pP->vr_uh); + in_window = rlc_um_in_window(ctxt_pP, rlc_pP, rlc_pP->vr_ur, rlc_pP->vr_uh, rlc_pP->vr_uh); if (in_window == 2) { - rlc_um_start_timer_reordering(rlc_pP, frameP); + rlc_um_start_timer_reordering(ctxt_pP, rlc_pP); rlc_pP->vr_ux = rlc_pP->vr_uh; #if defined (TRACE_RLC_UM_DAR) LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][%s %u] RESTART t-Reordering set VR(UX) to VR(UH) =%d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, (rlc_pP->is_data_plane) ? "DRB" : "SRB", rlc_pP->rb_id, rlc_pP->vr_ux); diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_dar.h b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_dar.h index e0973319d315dd1617d5e96b06fa8df2c992d2b7..63ef77fbd2e8c0a4d64384445db5828e562c1c03 100644 --- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_dar.h +++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_dar.h @@ -62,9 +62,9 @@ # define public_rlc_um_dar(x) extern x # endif # endif -/*! \fn signed int rlc_um_get_pdu_infos(frame_t frameP,rlc_um_pdu_sn_10_t* header_pP, int16_t total_sizeP, rlc_um_pdu_info_t* pdu_info_pP, uint8_t sn_lengthP) +/*! \fn signed int rlc_um_get_pdu_infos(const protocol_ctxt_t* const ctxt_pP,rlc_um_pdu_sn_10_t* header_pP, int16_t total_sizeP, rlc_um_pdu_info_t* pdu_info_pP, uint8_t sn_lengthP) * \brief Extract PDU informations (header fields, data size, etc) from the serialized PDU. -* \param[in] frameP Frame index. +* \param[in] ctxt_pP Running context. * \param[in] header_pP RLC UM header PDU pointer. * \param[in] total_sizeP Size of RLC UM PDU. * \param[in] pdu_info_pP Structure containing extracted informations from PDU. @@ -72,11 +72,11 @@ * \return 0 if no error was encountered during the parsing of the PDU, else -1; */ protected_rlc_um_dar( signed int rlc_um_get_pdu_infos( - const frame_t frameP, - rlc_um_pdu_sn_10_t * const header_pP, - const sdu_size_t total_sizeP, - rlc_um_pdu_info_t * const pdu_info_pP, - const uint8_t sn_lengthP)); + const protocol_ctxt_t* const ctxt_pP, + rlc_um_pdu_sn_10_t * const header_pP, + const sdu_size_t total_sizeP, + rlc_um_pdu_info_t * const pdu_info_pP, + const uint8_t sn_lengthP)); /*! \fn int rlc_um_read_length_indicators(unsigned char**data_ppP, rlc_um_e_li_t* e_li_pP, unsigned int* li_array_pP, unsigned int *num_li_pP, sdu_size_t *data_size_pP) * \brief Reset protocol variables and state variables to initial values. @@ -89,97 +89,101 @@ protected_rlc_um_dar( signed int rlc_um_get_pdu_infos( */ private_rlc_um_dar( int rlc_um_read_length_indicators(unsigned char**data_ppP, rlc_um_e_li_t* e_li_pP, unsigned int* li_array_pP, unsigned int *num_li_pP, sdu_size_t *data_size_pP)); -/*! \fn void rlc_um_try_reassembly (rlc_um_entity_t *rlc_pP, frame_t frameP, eNB_flag_t eNB_flagP, rlc_sn_t start_snP, rlc_sn_t end_snP) +/*! \fn void rlc_um_try_reassembly (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP, rlc_sn_t start_snP, rlc_sn_t end_snP) * \brief Try reassembly PDUs from DAR buffer, starting at sequence number snP. +* \param[in] ctxt_pP Running context. * \param[in] rlc_pP RLC UM protocol instance pointer. * \param[in] frameP Frame index. -* \param[in] eNB_flagP Flag to indicate eNB (1) or UE (0). * \param[in] start_snP First PDU to be reassemblied if possible. * \param[in] end_snP Last excluded highest sequence number of PDU to be reassemblied. */ -private_rlc_um_dar( void rlc_um_try_reassembly (rlc_um_entity_t *rlc_pP, frame_t frameP, eNB_flag_t eNB_flagP, rlc_sn_t start_snP, rlc_sn_t end_snP)); +private_rlc_um_dar( void rlc_um_try_reassembly (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP, const rlc_sn_t start_snP, const rlc_sn_t end_snP)); -/*! \fn void rlc_um_check_timer_reordering(rlc_um_entity_t *rlc_pP,frame_t frameP) +/*! \fn void rlc_um_check_timer_reordering(rlc_um_entity_t * const rlc_pP,frame_t frameP) * \brief Check if timer reordering has timed-out, if so it is stopped and has the status "timed-out". +* \param[in] ctxt_pP Running context. * \param[in] rlc_pP RLC UM protocol instance pointer. * \param[in] frameP Frame index */ -protected_rlc_um_dar(void rlc_um_check_timer_reordering(rlc_um_entity_t *rlc_pP,frame_t frameP)); +protected_rlc_um_dar(void rlc_um_check_timer_reordering(const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t *const rlc_pP)); -/*! \fn void rlc_um_stop_and_reset_timer_reordering(rlc_um_entity_t *rlc_pP,frame_t frameP) +/*! \fn void rlc_um_stop_and_reset_timer_reordering(const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP) * \brief Stop and reset the timer reordering. +* \param[in] ctxt_pP Running context. * \param[in] rlc_pP RLC UM protocol instance pointer. * \param[in] frameP Frame index. */ -protected_rlc_um_dar(void rlc_um_stop_and_reset_timer_reordering(rlc_um_entity_t *rlc_pP,frame_t frameP);) +protected_rlc_um_dar(void rlc_um_stop_and_reset_timer_reordering(const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t *const rlc_pP);) -/*! \fn void rlc_um_start_timer_reordering(rlc_um_entity_t *rlc_pP,frame_t frameP) +/*! \fn void rlc_um_start_timer_reordering(const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP) * \brief Re-arm (based on RLC UM config parameter) and start timer reordering. +* \param[in] ctxt_pP Running context. * \param[in] rlc_pP RLC UM protocol instance pointer. * \param[in] frameP Frame index. */ -protected_rlc_um_dar(void rlc_um_start_timer_reordering(rlc_um_entity_t *rlc_pP,frame_t frameP);) +protected_rlc_um_dar(void rlc_um_start_timer_reordering(const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP);) -/*! \fn void rlc_um_init_timer_reordering(rlc_um_entity_t *rlc_pP, uint32_t time_outP) +/*! \fn void rlc_um_init_timer_reordering(rlc_um_entity_t * const rlc_pP, uint32_t time_outP) * \brief Initialize the timer reordering with RLC UM time-out config parameter. +* \param[in] ctxt_pP Running context. * \param[in] rlc_pP RLC UM protocol instance pointer. * \param[in] time_outP Time-out in frameP units. */ -protected_rlc_um_dar(void rlc_um_init_timer_reordering(rlc_um_entity_t *rlc_pP, uint32_t time_outP);) +protected_rlc_um_dar(void rlc_um_init_timer_reordering(const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP, const uint32_t time_outP);) -/*! \fn void rlc_um_check_timer_dar_time_out(rlc_um_entity_t *rlc_pP,frame_t frameP,eNB_flag_t eNB_flagP) +/*! \fn void rlc_um_check_timer_dar_time_out(const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP,) * \brief Check if t-Reordering expires and take the appropriate actions as described in 3GPP specifications. +* \param[in] ctxt_pP Running context. * \param[in] rlc_pP RLC UM protocol instance pointer. -* \param[in] frameP Frame index. -* \param[in] eNB_flagP Flag to indicate eNB(1) or UE (1) */ -protected_rlc_um_dar( void rlc_um_check_timer_dar_time_out(rlc_um_entity_t *rlc_pP,frame_t frameP,eNB_flag_t eNB_flagP)); +protected_rlc_um_dar( void rlc_um_check_timer_dar_time_out(const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP)); -/*! \fn mem_block_t *rlc_um_remove_pdu_from_dar_buffer(rlc_um_entity_t *rlc_pP, uint16_t snP) +/*! \fn mem_block_t *rlc_um_remove_pdu_from_dar_buffer(rlc_um_entity_t * const rlc_pP, uint16_t snP) * \brief Remove the PDU with sequence number snP from the DAR buffer and return it. +* \param[in] ctxt_pP Running context. * \param[in] rlc_pP RLC UM protocol instance pointer. * \param[in] snP Sequence number. * \return The PDU stored in the DAR buffer having sequence number snP, else return NULL. */ -private_rlc_um_dar( mem_block_t *rlc_um_remove_pdu_from_dar_buffer(rlc_um_entity_t *rlc_pP, uint16_t snP)); +private_rlc_um_dar( mem_block_t *rlc_um_remove_pdu_from_dar_buffer(const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP, const uint16_t snP)); -/*! \fn mem_block_t *rlc_um_remove_pdu_from_dar_buffer(rlc_um_entity_t *rlc_pP, uint16_t snP) +/*! \fn mem_block_t *rlc_um_remove_pdu_from_dar_buffer(const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP, const uint16_t snP) * \brief Get the PDU with sequence number snP from the DAR buffer. +* \param[in] ctxt_pP Running context. * \param[in] rlc_pP RLC UM protocol instance pointer. * \param[in] snP Sequence number. * \return The PDU stored in the DAR buffer having sequence number snP, else return NULL. */ -protected_rlc_um_dar( inline mem_block_t* rlc_um_get_pdu_from_dar_buffer(rlc_um_entity_t *rlc_pP, uint16_t snP)); +protected_rlc_um_dar( inline mem_block_t* rlc_um_get_pdu_from_dar_buffer(const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP, const uint16_t snP)); -/*! \fn signed int rlc_um_in_window(rlc_um_entity_t *rlc_pP, frame_t frameP, rlc_sn_t lower_boundP, rlc_sn_t snP, rlc_sn_t higher_boundP) +/*! \fn signed int rlc_um_in_window(const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP,rlc_sn_t lower_boundP, rlc_sn_t snP, rlc_sn_t higher_boundP) * \brief Compute if the sequence number of a PDU is in a window . +* \param[in] ctxt_pP Running context. * \param[in] rlc_pP RLC UM protocol instance pointer. -* \param[in] frameP Frame index. * \param[in] lower_boundP Lower bound of a window. * \param[in] snP Sequence number of a theorical PDU. * \param[in] higher_boundP Higher bound of a window. * \return -2 if lower_boundP > sn, -1 if higher_boundP < sn, 0 if lower_boundP < sn < higher_boundP, 1 if lower_boundP == sn, 2 if higher_boundP == sn, 3 if higher_boundP == sn == lower_boundP. */ -protected_rlc_um_dar(inline signed int rlc_um_in_window(rlc_um_entity_t *rlc_pP, frame_t frameP, rlc_sn_t lower_boundP, rlc_sn_t snP, rlc_sn_t higher_boundP)); +protected_rlc_um_dar(inline signed int rlc_um_in_window(const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP, const rlc_sn_t lower_boundP, const rlc_sn_t snP, const rlc_sn_t higher_boundP)); -/*! \fn signed int rlc_um_in_reordering_window(rlc_um_entity_t *rlc_pP, frame_t frameP, rlc_sn_t snP) +/*! \fn signed int rlc_um_in_reordering_window(const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP, const rlc_sn_t snP) * \brief Compute if the sequence number of a PDU is in a window . +* \param[in] ctxt_pP Running context. * \param[in] rlc_pP RLC UM protocol instance pointer. -* \param[in] frameP Frame index. * \param[in] snP Sequence number of a theorical PDU. * \return 0 if snP is in reordering window, else -1. */ -protected_rlc_um_dar(inline signed int rlc_um_in_reordering_window(rlc_um_entity_t *rlc_pP, frame_t frameP, rlc_sn_t snP)); +protected_rlc_um_dar(inline signed int rlc_um_in_reordering_window(const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP, const rlc_sn_t snP)); -/*! \fn void rlc_um_receive_process_dar (rlc_um_entity_t *rlc_pP, frame_t frameP, eNB_flag_t eNB_flagP, mem_block_t *pdu_mem_pP,rlc_um_pdu_sn_10_t *pdu_pP, sdu_size_t tb_sizeP) +/*! \fn void rlc_um_receive_process_dar (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP, mem_block_t *pdu_mem_pP,rlc_um_pdu_sn_10_t * const pdu_pP, const sdu_size_t tb_sizeP) * \brief Apply the DAR process for a PDU: put it in DAR buffer and try to reassembly or discard it. +* \param[in] ctxt_pP Running context. * \param[in] rlc_pP RLC UM protocol instance pointer. -* \param[in] frameP Frame index. -* \param[in] eNB_flagP Flag to indicated eNB (1) or UE (0). * \param[in] pdu_mem_pP mem_block_t wrapper for a UM PDU . * \param[in] pdu_pP Pointer on the header of the UM PDU. * \param[in] tb_sizeP Size of the UM PDU. */ -protected_rlc_um_dar(void rlc_um_receive_process_dar (rlc_um_entity_t *rlc_pP, frame_t frameP, eNB_flag_t eNB_flagP, mem_block_t *pdu_mem_pP,rlc_um_pdu_sn_10_t *pdu_pP, sdu_size_t tb_sizeP)); +protected_rlc_um_dar(void rlc_um_receive_process_dar (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP, mem_block_t * pdu_mem_pP,rlc_um_pdu_sn_10_t * const pdu_pP, const sdu_size_t tb_sizeP)); /** @} */ # endif diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_entity.h b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_entity.h index 1109a9f7c664e1c00a3957e4ad2461887dc8458c..32b9d2b8b945765d393bc27d2ca10ddbe53375d5 100755 --- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_entity.h +++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_entity.h @@ -60,13 +60,13 @@ typedef struct rlc_um_timer_s { */ typedef struct rlc_um_entity_s { - module_id_t enb_module_id; /*!< \brief eNB Virtualization index for this protocol instance. */ - module_id_t ue_module_id; /*!< \brief UE Virtualization index for this protocol instance. */ + //module_id_t enb_module_id; /*!< \brief eNB Virtualization index for this protocol instance. */ + //module_id_t ue_module_id; /*!< \brief UE Virtualization index for this protocol instance. */ boolean_t initialized; /*!< \brief Boolean for rlc_am_entity_t struct initialization. */ boolean_t is_uplink_downlink; /*!< \brief Is this instance is a transmitter, a receiver or both? */ rlc_protocol_state_t protocol_state; /*!< \brief Protocol state, can be RLC_NULL_STATE, RLC_DATA_TRANSFER_READY_STATE, RLC_LOCAL_SUSPEND_STATE. */ boolean_t is_data_plane; /*!< \brief To know if the RLC belongs to a data radio bearer or a signalling radio bearer, for statistics and trace purpose. */ - boolean_t is_enb; /*!< \brief To know if the RLC belongs to a eNB or UE. */ + //boolean_t is_enb; /*!< \brief To know if the RLC belongs to a eNB or UE. */ boolean_t is_mxch; /*!< \brief To know if the RLC belongs to a MBMS bearer. */ //----------------------------- // PROTOCOL VARIABLES diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_fsm.c b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_fsm.c index 44e5003d30a24b3b800521667c2fa4c4e8602087..993b28fb886e080c04da57c7594ffd31bce7f8e2 100755 --- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_fsm.c +++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_fsm.c @@ -38,7 +38,9 @@ //----------------------------------------------------------------------------- int -rlc_um_fsm_notify_event (rlc_um_entity_t *rlc_pP, uint8_t eventP) +rlc_um_fsm_notify_event ( + const protocol_ctxt_t* const ctxtP, + rlc_um_entity_t *rlc_pP, uint8_t eventP) { //----------------------------------------------------------------------------- @@ -50,9 +52,9 @@ rlc_um_fsm_notify_event (rlc_um_entity_t *rlc_pP, uint8_t eventP) switch (eventP) { case RLC_UM_RECEIVE_CRLC_CONFIG_REQ_ENTER_DATA_TRANSFER_READY_STATE_EVENT: LOG_D(RLC, "[RLC_UM][%s][MOD %u/%u][RB %u] FSM RLC_NULL_STATE -> RLC_DATA_TRANSFER_READY_STATE\n", - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + (ctxtP->enb_flag) ? "eNB" : "UE", + ctxtP->enb_module_id, + ctxtP->ue_module_id, rlc_pP->rb_id); rlc_pP->protocol_state = RLC_DATA_TRANSFER_READY_STATE; return 1; @@ -60,9 +62,9 @@ rlc_um_fsm_notify_event (rlc_um_entity_t *rlc_pP, uint8_t eventP) default: LOG_E(RLC, "[RLC_UM][%s][MOD %u/%u][RB %u] FSM WARNING PROTOCOL ERROR - EVENT %02X hex NOT EXPECTED FROM NULL_STATE\n", - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + (ctxtP->enb_flag) ? "eNB" : "UE", + ctxtP->enb_module_id, + ctxtP->ue_module_id, rlc_pP->rb_id, eventP); mac_xface->macphy_exit("RLC-UM FSM WARNING PROTOCOL ERROR - EVENT NOT EXPECTED FROM NULL_STATE"); @@ -76,9 +78,9 @@ rlc_um_fsm_notify_event (rlc_um_entity_t *rlc_pP, uint8_t eventP) switch (eventP) { case RLC_UM_RECEIVE_CRLC_CONFIG_REQ_ENTER_NULL_STATE_EVENT: LOG_D(RLC, "[RLC_UM][%s][MOD %u/%u][RB %u] FSM RLC_DATA_TRANSFER_READY_STATE -> RLC_NULL_STATE\n", - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + (ctxtP->enb_flag) ? "eNB" : "UE", + ctxtP->enb_module_id, + ctxtP->ue_module_id, rlc_pP->rb_id); rlc_pP->protocol_state = RLC_NULL_STATE; return 1; @@ -87,9 +89,9 @@ rlc_um_fsm_notify_event (rlc_um_entity_t *rlc_pP, uint8_t eventP) case RLC_UM_RECEIVE_CRLC_SUSPEND_REQ_EVENT: case RLC_UM_TRANSMIT_CRLC_SUSPEND_CNF_EVENT: LOG_N(RLC, "[RLC_UM][%s][MOD %u/%u][RB %u] FSM RLC_DATA_TRANSFER_READY_STATE -> RLC_LOCAL_SUSPEND_STATE\n", - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + (ctxtP->enb_flag) ? "eNB" : "UE", + ctxtP->enb_module_id, + ctxtP->ue_module_id, rlc_pP->rb_id); rlc_pP->protocol_state = RLC_LOCAL_SUSPEND_STATE; return 1; @@ -97,9 +99,9 @@ rlc_um_fsm_notify_event (rlc_um_entity_t *rlc_pP, uint8_t eventP) default: LOG_E(RLC, "[RLC_UM][%s][MOD %u/%u][RB %u] FSM WARNING PROTOCOL ERROR - EVENT %02X hex NOT EXPECTED FROM DATA_TRANSFER_READY_STATE\n", - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + (ctxtP->enb_flag) ? "eNB" : "UE", + ctxtP->enb_module_id, + ctxtP->ue_module_id, rlc_pP->rb_id, eventP); return 0; @@ -112,9 +114,9 @@ rlc_um_fsm_notify_event (rlc_um_entity_t *rlc_pP, uint8_t eventP) switch (eventP) { case RLC_UM_RECEIVE_CRLC_CONFIG_REQ_ENTER_NULL_STATE_EVENT: LOG_N(RLC, "[RLC_UM][%s][MOD %u/%u][RB %u] FSM RLC_LOCAL_SUSPEND_STATE -> RLC_NULL_STATE\n", - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + (ctxtP->enb_flag) ? "eNB" : "UE", + ctxtP->enb_module_id, + ctxtP->ue_module_id, rlc_pP->rb_id); rlc_pP->protocol_state = RLC_NULL_STATE; return 1; @@ -122,9 +124,9 @@ rlc_um_fsm_notify_event (rlc_um_entity_t *rlc_pP, uint8_t eventP) case RLC_UM_RECEIVE_CRLC_RESUME_REQ_EVENT: LOG_N(RLC, "[RLC_UM][%s][MOD %u/%u][RB %u] FSM RLC_LOCAL_SUSPEND_STATE -> RLC_DATA_TRANSFER_READY_STATE\n", - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + (ctxtP->enb_flag) ? "eNB" : "UE", + ctxtP->enb_module_id, + ctxtP->ue_module_id, rlc_pP->rb_id); rlc_pP->protocol_state = RLC_DATA_TRANSFER_READY_STATE; return 1; @@ -132,9 +134,9 @@ rlc_um_fsm_notify_event (rlc_um_entity_t *rlc_pP, uint8_t eventP) default: LOG_E(RLC, "[RLC_UM][%s][MOD %u/%u][RB %u] FSM WARNING PROTOCOL ERROR - EVENT %02X hex NOT EXPECTED FROM RLC_LOCAL_SUSPEND_STATE\n", - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + (ctxtP->enb_flag) ? "eNB" : "UE", + ctxtP->enb_module_id, + ctxtP->ue_module_id, rlc_pP->rb_id, eventP); return 0; @@ -143,9 +145,9 @@ rlc_um_fsm_notify_event (rlc_um_entity_t *rlc_pP, uint8_t eventP) default: LOG_E(RLC, "[RLC_UM][%s][MOD %u/%u][RB %u] FSM ERROR UNKNOWN STATE %d\n", - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + (ctxtP->enb_flag) ? "eNB" : "UE", + ctxtP->enb_module_id, + ctxtP->ue_module_id, rlc_pP->rb_id, rlc_pP->protocol_state); return 0; diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_fsm.h b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_fsm.h index bab1d1f27d78ba199adcd308bf497efbe9b42f45..04e3a094998a8a5ee6e3814e3128415de5f4a373 100644 --- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_fsm.h +++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_fsm.h @@ -60,8 +60,9 @@ # include "platform_types.h" # include "rlc_um_entity.h" //----------------------------------------------------------------------------- -/*! \fn int rlc_um_fsm_notify_event (rlc_um_entity_t *rlcP, uint8_t eventP) +/*! \fn int rlc_um_fsm_notify_event (const protocol_ctxt_t* const ctxtP, rlc_um_entity_t *rlcP, uint8_t eventP) * \brief Send an event to the RLC UM finite state machine. +* \param[in] ctxtP Running context. * \param[in] rlcP RLC UM protocol instance pointer. * \param[in] eventP Event (#RLC_UM_RECEIVE_CRLC_CONFIG_REQ_ENTER_NULL_STATE_EVENT, * #RLC_UM_RECEIVE_CRLC_CONFIG_REQ_ENTER_DATA_TRANSFER_READY_STATE_EVENT, @@ -71,6 +72,6 @@ * \return 1 if no error was encountered, 0 if the event was not processed. * \Note This FSM is not LTE 9.3.0 compliant, it has to be modified or removed. */ -protected_rlc_um_fsm(int rlc_um_fsm_notify_event (rlc_um_entity_t *rlcP, uint8_t eventP)); +protected_rlc_um_fsm(int rlc_um_fsm_notify_event (const protocol_ctxt_t* const ctxtP, rlc_um_entity_t *rlcP, uint8_t eventP)); /** @} */ # endif diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_reassembly.c b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_reassembly.c index ba02bf724f53a4452ce7c541182ca6e7246dd305..78f8ba64dd2bbb8526ed085c5e3f3efc9b013018 100755 --- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_reassembly.c +++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_reassembly.c @@ -48,7 +48,7 @@ //----------------------------------------------------------------------------- inline void -rlc_um_clear_rx_sdu (rlc_um_entity_t *rlc_pP) +rlc_um_clear_rx_sdu (const protocol_ctxt_t* const ctxtP, rlc_um_entity_t *rlc_pP) { //----------------------------------------------------------------------------- rlc_pP->output_sdu_size_to_write = 0; @@ -56,16 +56,16 @@ rlc_um_clear_rx_sdu (rlc_um_entity_t *rlc_pP) //----------------------------------------------------------------------------- void -rlc_um_reassembly (uint8_t * src_pP, int32_t lengthP, rlc_um_entity_t *rlc_pP, frame_t frameP) +rlc_um_reassembly (const protocol_ctxt_t* const ctxtP, rlc_um_entity_t *rlc_pP, uint8_t * src_pP, int32_t lengthP) { //----------------------------------------------------------------------------- sdu_size_t sdu_max_size; LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][%s %u][REASSEMBLY] reassembly() %d bytes %d bytes already reassemblied\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxtP->frame, + (ctxtP->enb_flag) ? "eNB" : "UE", + ctxtP->enb_module_id, + ctxtP->ue_module_id, (rlc_pP->is_data_plane) ? "DRB" : "SRB", rlc_pP->rb_id, lengthP, @@ -95,10 +95,10 @@ rlc_um_reassembly (uint8_t * src_pP, int32_t lengthP, rlc_um_entity_t *rlc_pP, f #ifdef TRACE_RLC_UM_DISPLAY_ASCII_DATA rlc_pP->output_sdu_in_construction->data[rlc_pP->output_sdu_size_to_write] = 0; LOG_T(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][%s %u][REASSEMBLY] DATA :", - frameP - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxtP->frame + (ctxtP->enb_flag) ? "eNB" : "UE", + ctxtP->enb_module_id, + ctxtP->ue_module_id, (rlc_pP->is_data_plane) ? "DRB" : "SRB", rlc_pP->rb_id); rlc_util_print_hex_octets(RLC, (unsigned char*)rlc_pP->output_sdu_in_construction->data, rlc_pP->output_sdu_size_to_write); @@ -106,18 +106,18 @@ rlc_um_reassembly (uint8_t * src_pP, int32_t lengthP, rlc_um_entity_t *rlc_pP, f } else { #if defined(STOP_ON_IP_TRAFFIC_OVERLOAD) AssertFatal(0, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][%s %u] RLC_UM_DATA_IND, SDU TOO BIG, DROPPED\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxtP->frame, + (ctxtP->enb_flag) ? "eNB" : "UE", + ctxtP->enb_module_id, + ctxtP->ue_module_id, (rlc_pP->is_data_plane) ? "DRB" : "SRB", rlc_pP->rb_id); #endif LOG_E(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][%s %u][REASSEMBLY] [max_sdu size %d] ERROR SDU SIZE OVERFLOW SDU GARBAGED\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxtP->frame, + (ctxtP->enb_flag) ? "eNB" : "UE", + ctxtP->enb_module_id, + ctxtP->ue_module_id, (rlc_pP->is_data_plane) ? "DRB" : "SRB", rlc_pP->rb_id, sdu_max_size); @@ -126,18 +126,18 @@ rlc_um_reassembly (uint8_t * src_pP, int32_t lengthP, rlc_um_entity_t *rlc_pP, f } } else { LOG_E(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][%s %u][REASSEMBLY]ERROR OUTPUT SDU IS NULL\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxtP->frame, + (ctxtP->enb_flag) ? "eNB" : "UE", + ctxtP->enb_module_id, + ctxtP->ue_module_id, (rlc_pP->is_data_plane) ? "DRB" : "SRB", rlc_pP->rb_id); #if defined(STOP_ON_IP_TRAFFIC_OVERLOAD) AssertFatal(0, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][%s %u] RLC_UM_DATA_IND, SDU DROPPED, OUT OF MEMORY\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxtP->frame, + (ctxtP->enb_flag) ? "eNB" : "UE", + ctxtP->enb_module_id, + ctxtP->ue_module_id, (rlc_pP->is_data_plane) ? "DRB" : "SRB", rlc_pP->rb_id); #endif @@ -146,16 +146,16 @@ rlc_um_reassembly (uint8_t * src_pP, int32_t lengthP, rlc_um_entity_t *rlc_pP, f } //----------------------------------------------------------------------------- void -rlc_um_send_sdu (rlc_um_entity_t *rlc_pP,frame_t frameP, eNB_flag_t eNB_flagP) +rlc_um_send_sdu (const protocol_ctxt_t* const ctxtP, rlc_um_entity_t *rlc_pP) { //----------------------------------------------------------------------------- if ((rlc_pP->output_sdu_in_construction)) { LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][%s %u] SEND_SDU to upper layers %d bytes sdu %p\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxtP->frame, + (ctxtP->enb_flag) ? "eNB" : "UE", + ctxtP->enb_module_id, + ctxtP->ue_module_id, (rlc_pP->is_data_plane) ? "DRB" : "SRB", rlc_pP->rb_id, rlc_pP->output_sdu_size_to_write, @@ -168,22 +168,19 @@ rlc_um_send_sdu (rlc_um_entity_t *rlc_pP,frame_t frameP, eNB_flag_t eNB_flagP) #ifdef TRACE_RLC_UM_DISPLAY_ASCII_DATA rlc_pP->output_sdu_in_construction->data[rlc_pP->output_sdu_size_to_write] = 0; LOG_T(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][%s %u][SEND_SDU] DATA :", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxtP->frame, + (ctxtP->enb_flag) ? "eNB" : "UE", + ctxtP->enb_module_id, + ctxtP->ue_module_id, (rlc_pP->is_data_plane) ? "DRB" : "SRB", rlc_pP->rb_id); rlc_util_print_hex_octets(RLC, rlc_pP->output_sdu_in_construction->data, rlc_pP->output_sdu_size_to_write); #endif rlc_um_v9_3_0_test_data_ind (rlc_pP->module_id, rlc_pP->rb_id, rlc_pP->output_sdu_size_to_write, rlc_pP->output_sdu_in_construction); #else - // msg("[RLC] DATA IND ON MOD_ID %d RB ID %d, size %d\n",rlc_pP->module_id, rlc_pP->rb_id, frameP,rlc_pP->output_sdu_size_to_write); + // msg("[RLC] DATA IND ON MOD_ID %d RB ID %d, size %d\n",rlc_pP->module_id, rlc_pP->rb_id, ctxtP->frame,rlc_pP->output_sdu_size_to_write); rlc_data_ind ( - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, - frameP, - eNB_flagP, + ctxtP, BOOL_NOT(rlc_pP->is_data_plane), rlc_pP->is_mxch, rlc_pP->rb_id, @@ -193,10 +190,10 @@ rlc_um_send_sdu (rlc_um_entity_t *rlc_pP,frame_t frameP, eNB_flag_t eNB_flagP) rlc_pP->output_sdu_in_construction = NULL; } else { LOG_E(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][%s %u][SEND_SDU] ERROR SIZE <= 0 ... DO NOTHING, SET SDU SIZE TO 0\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxtP->frame, + (ctxtP->enb_flag) ? "eNB" : "UE", + ctxtP->enb_module_id, + ctxtP->ue_module_id, (rlc_pP->is_data_plane) ? "DRB" : "SRB", rlc_pP->rb_id); } diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_reassembly.h b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_reassembly.h index 3d40a35ce80b4383e0e0deff95cf06c5d1ac7d92..7a2c13e5e4ad91fd14ee87210ef85fce3b3497cb 100644 --- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_reassembly.h +++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_reassembly.h @@ -59,27 +59,27 @@ # endif # include "rlc_um_entity.h" //----------------------------------------------------------------------------- -/*! \fn void rlc_um_clear_rx_sdu (rlc_um_entity_t *rlcP) +/*! \fn void rlc_um_clear_rx_sdu (const protocol_ctxt_t* const ctxtP, rlc_um_entity_t *rlcP) * \brief Erase the SDU in construction. +* \param[in] ctxtP Running context. * \param[in] rlcP RLC UM protocol instance pointer. */ -protected_rlc_um_reassembly(void rlc_um_clear_rx_sdu (rlc_um_entity_t *rlcP)); +protected_rlc_um_reassembly(void rlc_um_clear_rx_sdu (const protocol_ctxt_t* const ctxtP, rlc_um_entity_t *rlcP)); /*! \fn void rlc_um_reassembly (uint8_t * srcP, int32_t lengthP, rlc_um_entity_t *rlcP, frame_t frame) * \brief Reassembly lengthP bytes to the end of the SDU in construction. +* \param[in] ctxtP Running context. +* \param[in] rlcP RLC UM protocol instance pointer. * \param[in] srcP Pointer on data to be reassemblied. * \param[in] lengthP Length to reassembly. -* \param[in] rlcP RLC UM protocol instance pointer. -* \param[in] frame Frame index. */ -protected_rlc_um_reassembly(void rlc_um_reassembly (uint8_t * srcP, int32_t lengthP, rlc_um_entity_t *rlcP, frame_t frame)); +protected_rlc_um_reassembly(void rlc_um_reassembly (const protocol_ctxt_t* const ctxtP, rlc_um_entity_t *rlcP, uint8_t * srcP, int32_t lengthP)); -/*! \fn void rlc_um_send_sdu (rlc_um_entity_t *rlcP,frame_t frame,eNB_flag_t eNB_flagP) +/*! \fn void rlc_um_send_sdu (const protocol_ctxt_t* const ctxtP, rlc_um_entity_t *rlcP) * \brief Send SDU if any reassemblied to upper layer. +* \param[in] ctxtP Running context. * \param[in] rlcP RLC UM protocol instance pointer. -* \param[in] frameP Frame index. -* \param[in] eNB_flagP Boolean to know if rlcP is in eNB (1 or true), or in UE (0 or false). */ -protected_rlc_um_reassembly(void rlc_um_send_sdu (rlc_um_entity_t *rlcP,frame_t frameP,eNB_flag_t eNB_flagP)); +protected_rlc_um_reassembly(void rlc_um_send_sdu (const protocol_ctxt_t* const ctxtP, rlc_um_entity_t *rlcP)); /** @} */ # endif diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_receiver.c b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_receiver.c index f8f2e6188bbbdc0ae88b6f7397e3b3633eb35b03..251922a82cfd3a005693dbe0581509c75c917f45 100755 --- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_receiver.c +++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_receiver.c @@ -42,7 +42,11 @@ //#define DEBUG_RLC_UM_RX 1 //----------------------------------------------------------------------------- -void rlc_um_display_rx_window(rlc_um_entity_t *rlc_pP) +void +rlc_um_display_rx_window( + const protocol_ctxt_t* const ctxtP, + rlc_um_entity_t * const rlc_pP + ) //----------------------------------------------------------------------------- { unsigned long sn = 0; @@ -103,7 +107,7 @@ void rlc_um_display_rx_window(rlc_um_entity_t *rlc_pP) strcpy(color, RLC_FG_COLOR_RED); } - if (rlc_um_get_pdu_from_dar_buffer(rlc_pP, sn)) { + if (rlc_um_get_pdu_from_dar_buffer(ctxtP, rlc_pP, sn)) { // test RLC_REVERSE_VIDEO if (str_index <= 2) str[str_index] = '.'; LOG_T(RLC, "%s%s%s", color, RLC_REVERSE_VIDEO, str); @@ -119,7 +123,10 @@ void rlc_um_display_rx_window(rlc_um_entity_t *rlc_pP) //----------------------------------------------------------------------------- void -rlc_um_receive (rlc_um_entity_t *rlc_pP, frame_t frameP, eNB_flag_t eNB_flagP, struct mac_data_ind data_indP) +rlc_um_receive ( + const protocol_ctxt_t* const ctxtP, + rlc_um_entity_t * const rlc_pP, + struct mac_data_ind data_indP) { //----------------------------------------------------------------------------- @@ -136,7 +143,7 @@ rlc_um_receive (rlc_um_entity_t *rlc_pP, frame_t frameP, eNB_flag_t eNB_flagP, s rlc_pP->stat_rx_data_pdu += 1; if (tb_size_in_bytes > 0) { - rlc_um_receive_process_dar (rlc_pP, frameP, eNB_flagP, tb_p, (rlc_um_pdu_sn_10_t *)first_byte_p, tb_size_in_bytes); + rlc_um_receive_process_dar (ctxtP, rlc_pP, tb_p, (rlc_um_pdu_sn_10_t *)first_byte_p, tb_size_in_bytes); #if defined(DEBUG_RLC_UM_RX) LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][%s %u] VR(UR)=%03d VR(UX)=%03d VR(UH)=%03d\n", frameP, @@ -148,7 +155,7 @@ rlc_um_receive (rlc_um_entity_t *rlc_pP, frame_t frameP, eNB_flag_t eNB_flagP, s rlc_pP->vr_ur, rlc_pP->vr_ux, rlc_pP->vr_uh); - //rlc_um_display_rx_window(rlc_pP); comented because bad display + //rlc_um_display_rx_window(rlc_pP); commented because bad display #endif } } diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_receiver.h b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_receiver.h index 4687f1807bb6a474d61850975a525db5b60f6141..560957a50fe97c36ba226f49af3a2688600fab8a 100644 --- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_receiver.h +++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_receiver.h @@ -59,19 +59,19 @@ # include "rlc_um_entity.h" # include "mac_primitives.h" -/*! \fn void rlc_um_display_rx_window(rlc_um_entity_t *rlc_pP) +/*! \fn void rlc_um_display_rx_window(const protocol_ctxt_t* const ctxtP,rlc_um_entity_t * const rlc_pP) * \brief Display the content of the RX buffer, the output stream is targeted to TTY terminals because of escape sequences. +* \param[in] ctxtP Running context. * \param[in] rlc_pP RLC UM protocol instance pointer. */ -protected_rlc_um_receiver( void rlc_um_display_rx_window(rlc_um_entity_t *rlc_pP);) +protected_rlc_um_receiver( void rlc_um_display_rx_window(const protocol_ctxt_t* const ctxtP, rlc_um_entity_t * const rlc_pP);) -/*! \fn void rlc_um_receive (rlc_um_entity_t *rlc_pP, frame_t frameP, struct mac_data_ind data_indP) +/*! \fn void rlc_um_receive (const protocol_ctxt_t* const ctxtP, rlc_um_entity_t * const rlc_pP, struct mac_data_ind data_indP) * \brief Handle the MAC data indication, retreive the transport blocks and send them one by one to the DAR process. +* \param[in] ctxtP Running context. * \param[in] rlc_pP RLC UM protocol instance pointer. -* \param[in] frameP Frame index. -* \param[in] eNB_flagP Flag to indicated eNB (1) or UE (0). * \param[in] data_indP Data indication structure containing transport block received from MAC layer. */ -protected_rlc_um_receiver( void rlc_um_receive (rlc_um_entity_t *rlc_pP, frame_t frameP, eNB_flag_t eNB_flagP, struct mac_data_ind data_indP)); +protected_rlc_um_receiver( void rlc_um_receive (const protocol_ctxt_t* const ctxtP, rlc_um_entity_t * const rlc_pP, struct mac_data_ind data_indP)); /** @} */ # endif diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_segment.c b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_segment.c index 8e78dd9a9161ac09bc456d751deb1406ccb23e3a..8348b6a509d417504efbf911cb1ac08a2c7c95bc 100755 --- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_segment.c +++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_segment.c @@ -45,7 +45,7 @@ //#define TRACE_RLC_UM_SEGMENT 1 //----------------------------------------------------------------------------- void -rlc_um_segment_10 (rlc_um_entity_t *rlc_pP,frame_t frameP) +rlc_um_segment_10 (const protocol_ctxt_t* const ctxtP, rlc_um_entity_t *rlc_pP) { //----------------------------------------------------------------------------- list_t pdus; @@ -79,10 +79,10 @@ rlc_um_segment_10 (rlc_um_entity_t *rlc_pP,frame_t frameP) if (nb_bytes_to_transmit < 3) { #if defined(TRACE_RLC_UM_SEGMENT) LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][RB %u] NO SEGMENTATION nb_bytes to transmit = %d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxtP->frame, + (ctxtP->enb_flag) ? "eNB" : "UE", + ctxtP->enb_module_id, + ctxtP->ue_module_id, rlc_pP->rb_id, nb_bytes_to_transmit); #endif @@ -90,10 +90,10 @@ rlc_um_segment_10 (rlc_um_entity_t *rlc_pP,frame_t frameP) } #if defined(TRACE_RLC_UM_SEGMENT) LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][RB %u] SEGMENT10\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxtP->frame, + (ctxtP->enb_flag) ? "eNB" : "UE", + ctxtP->enb_module_id, + ctxtP->ue_module_id, rlc_pP->rb_id); #endif list_init (&pdus, NULL); // param string identifying the list is NULL @@ -105,10 +105,10 @@ rlc_um_segment_10 (rlc_um_entity_t *rlc_pP,frame_t frameP) #if defined(TRACE_RLC_UM_SEGMENT) LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][RB %u] SEGMENT10 nb_bytes_to_transmit %d BO %d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxtP->frame, + (ctxtP->enb_flag) ? "eNB" : "UE", + ctxtP->enb_module_id, + ctxtP->ue_module_id, rlc_pP->rb_id, nb_bytes_to_transmit, rlc_pP->buffer_occupancy); @@ -124,10 +124,10 @@ rlc_um_segment_10 (rlc_um_entity_t *rlc_pP,frame_t frameP) data_pdu_size = rlc_pP->buffer_occupancy + rlc_pP->tx_header_min_length_in_bytes + max_li_overhead; #if defined(TRACE_RLC_UM_SEGMENT) LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][RB %u] SEGMENT10 alloc PDU size %d bytes to contain not all bytes requested by MAC but all BO of RLC@1\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxtP->frame, + (ctxtP->enb_flag) ? "eNB" : "UE", + ctxtP->enb_module_id, + ctxtP->ue_module_id, rlc_pP->rb_id, data_pdu_size); #endif @@ -135,10 +135,10 @@ rlc_um_segment_10 (rlc_um_entity_t *rlc_pP,frame_t frameP) data_pdu_size = nb_bytes_to_transmit; #if defined(TRACE_RLC_UM_SEGMENT) LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][RB %u] SEGMENT10 alloc PDU size %d bytes to contain all bytes requested by MAC@1\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxtP->frame, + (ctxtP->enb_flag) ? "eNB" : "UE", + ctxtP->enb_module_id, + ctxtP->ue_module_id, rlc_pP->rb_id, data_pdu_size); #endif @@ -146,10 +146,10 @@ rlc_um_segment_10 (rlc_um_entity_t *rlc_pP,frame_t frameP) if (!(pdu_mem_p = get_free_mem_block (data_pdu_size + sizeof(struct mac_tb_req)))) { #if defined(TRACE_RLC_UM_SEGMENT) LOG_E(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][RB %u] SEGMENT10 ERROR COULD NOT GET NEW PDU, EXIT\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxtP->frame, + (ctxtP->enb_flag) ? "eNB" : "UE", + ctxtP->enb_module_id, + ctxtP->ue_module_id, rlc_pP->rb_id); #endif pthread_mutex_unlock(&rlc_pP->lock_input_sdus); @@ -157,10 +157,10 @@ rlc_um_segment_10 (rlc_um_entity_t *rlc_pP,frame_t frameP) } #if defined(TRACE_RLC_UM_SEGMENT) LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][RB %u] SEGMENT10 get new PDU %d bytes\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxtP->frame, + (ctxtP->enb_flag) ? "eNB" : "UE", + ctxtP->enb_module_id, + ctxtP->ue_module_id, rlc_pP->rb_id, data_pdu_size); #endif @@ -219,10 +219,10 @@ rlc_um_segment_10 (rlc_um_entity_t *rlc_pP,frame_t frameP) } else { #if defined(TRACE_RLC_UM_SEGMENT) LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][RB %u] SEGMENT10 sdu_mngt_p->sdu_remaining_size=%d test_pdu_remaining_size=%d test_li_length_in_bytes=%d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxtP->frame, + (ctxtP->enb_flag) ? "eNB" : "UE", + ctxtP->enb_module_id, + ctxtP->ue_module_id, rlc_pP->rb_id, sdu_mngt_p->sdu_remaining_size, test_pdu_remaining_size, @@ -248,10 +248,10 @@ rlc_um_segment_10 (rlc_um_entity_t *rlc_pP,frame_t frameP) //---------------------------------------- #if defined(TRACE_RLC_UM_SEGMENT) LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][RB %u] data shift %d Bytes num_li %d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxtP->frame, + (ctxtP->enb_flag) ? "eNB" : "UE", + ctxtP->enb_module_id, + ctxtP->ue_module_id, rlc_pP->rb_id, ((test_num_li*3) +1) >> 1, test_num_li); @@ -276,10 +276,10 @@ rlc_um_segment_10 (rlc_um_entity_t *rlc_pP,frame_t frameP) if (sdu_mngt_p->sdu_segmented_size == 0) { #if defined(TRACE_RLC_UM_SEGMENT) LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][RB %u] SEGMENT10 GET NEW SDU %p AVAILABLE SIZE %d Bytes\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxtP->frame, + (ctxtP->enb_flag) ? "eNB" : "UE", + ctxtP->enb_module_id, + ctxtP->ue_module_id, rlc_pP->rb_id, sdu_mngt_p, sdu_mngt_p->sdu_remaining_size); @@ -287,10 +287,10 @@ rlc_um_segment_10 (rlc_um_entity_t *rlc_pP,frame_t frameP) } else { #if defined(TRACE_RLC_UM_SEGMENT) LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][RB %u] SEGMENT10 GET AGAIN SDU %p REMAINING AVAILABLE SIZE %d Bytes / %d Bytes \n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxtP->frame, + (ctxtP->enb_flag) ? "eNB" : "UE", + ctxtP->enb_module_id, + ctxtP->ue_module_id, rlc_pP->rb_id, sdu_mngt_p, sdu_mngt_p->sdu_remaining_size, @@ -302,17 +302,17 @@ rlc_um_segment_10 (rlc_um_entity_t *rlc_pP,frame_t frameP) if (sdu_mngt_p->sdu_remaining_size > pdu_remaining_size) { #if defined(TRACE_RLC_UM_SEGMENT) LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][RB %u] SEGMENT10 Filling all remaining PDU with %d bytes\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxtP->frame, + (ctxtP->enb_flag) ? "eNB" : "UE", + ctxtP->enb_module_id, + ctxtP->ue_module_id, rlc_pP->rb_id, pdu_remaining_size); LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][RB %u] SEGMENT10 pdu_mem_p %p pdu_mem_p->data %p pdu_p %p pdu_p->data %p data %p data_sdu_p %p pdu_remaining_size %d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxtP->frame, + (ctxtP->enb_flag) ? "eNB" : "UE", + ctxtP->enb_module_id, + ctxtP->ue_module_id, rlc_pP->rb_id, pdu_mem_p, pdu_mem_p->data, @@ -334,10 +334,10 @@ rlc_um_segment_10 (rlc_um_entity_t *rlc_pP,frame_t frameP) } else if (sdu_mngt_p->sdu_remaining_size == pdu_remaining_size) { #if defined(TRACE_RLC_UM_SEGMENT) LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][RB %u] SEGMENT10 Exactly Filling remaining PDU with %d remaining bytes of SDU\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxtP->frame, + (ctxtP->enb_flag) ? "eNB" : "UE", + ctxtP->enb_module_id, + ctxtP->ue_module_id, rlc_pP->rb_id, pdu_remaining_size); #endif @@ -358,10 +358,10 @@ rlc_um_segment_10 (rlc_um_entity_t *rlc_pP,frame_t frameP) } else if ((sdu_mngt_p->sdu_remaining_size + (li_length_in_bytes ^ 3)) < pdu_remaining_size ) { #if defined(TRACE_RLC_UM_SEGMENT) LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][RB %u] SEGMENT10 Filling PDU with %d all remaining bytes of SDU\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxtP->frame, + (ctxtP->enb_flag) ? "eNB" : "UE", + ctxtP->enb_module_id, + ctxtP->ue_module_id, rlc_pP->rb_id, sdu_mngt_p->sdu_remaining_size); #endif @@ -382,10 +382,10 @@ rlc_um_segment_10 (rlc_um_entity_t *rlc_pP,frame_t frameP) e_li_p->b2 = sdu_mngt_p->sdu_remaining_size << 4; #if defined(TRACE_RLC_UM_SEGMENT) LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][RB %u] SEGMENT10 set e_li_p->b1=%02X set e_li_p->b2=%02X fill_num_li=%d test_num_li=%d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxtP->frame, + (ctxtP->enb_flag) ? "eNB" : "UE", + ctxtP->enb_module_id, + ctxtP->ue_module_id, rlc_pP->rb_id, e_li_p->b1, e_li_p->b2, @@ -402,10 +402,10 @@ rlc_um_segment_10 (rlc_um_entity_t *rlc_pP,frame_t frameP) e_li_p->b3 = sdu_mngt_p->sdu_remaining_size & 0xFF; #if defined(TRACE_RLC_UM_SEGMENT) LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][RB %u] SEGMENT10 set e_li_p->b2=%02X set e_li_p->b3=%02X fill_num_li=%d test_num_li=%d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxtP->frame, + (ctxtP->enb_flag) ? "eNB" : "UE", + ctxtP->enb_module_id, + ctxtP->ue_module_id, rlc_pP->rb_id, e_li_p->b2, e_li_p->b3, @@ -427,10 +427,10 @@ rlc_um_segment_10 (rlc_um_entity_t *rlc_pP,frame_t frameP) } else { #if defined(TRACE_RLC_UM_SEGMENT) LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][RB %u] SEGMENT10 Filling PDU with %d all remaining bytes of SDU and reduce TB size by %d bytes\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxtP->frame, + (ctxtP->enb_flag) ? "eNB" : "UE", + ctxtP->enb_module_id, + ctxtP->ue_module_id, rlc_pP->rb_id, sdu_mngt_p->sdu_remaining_size, pdu_remaining_size - sdu_mngt_p->sdu_remaining_size); @@ -492,7 +492,7 @@ rlc_um_segment_10 (rlc_um_entity_t *rlc_pP,frame_t frameP) } //----------------------------------------------------------------------------- void -rlc_um_segment_5 (rlc_um_entity_t *rlc_pP,frame_t frameP) +rlc_um_segment_5 (const protocol_ctxt_t* const ctxtP, rlc_um_entity_t *rlc_pP) { //----------------------------------------------------------------------------- list_t pdus; @@ -526,10 +526,10 @@ rlc_um_segment_5 (rlc_um_entity_t *rlc_pP,frame_t frameP) if (nb_bytes_to_transmit < 2) { #if defined(TRACE_RLC_UM_SEGMENT) LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][RB %u] NO SEGMENTATION5 nb_bytes to transmit = %d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxtP->frame, + (ctxtP->enb_flag) ? "eNB" : "UE", + ctxtP->enb_module_id, + ctxtP->ue_module_id, rlc_pP->rb_id, nb_bytes_to_transmit); #endif @@ -537,10 +537,10 @@ rlc_um_segment_5 (rlc_um_entity_t *rlc_pP,frame_t frameP) } #if defined(TRACE_RLC_UM_SEGMENT) LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][RB %u] SEGMENT5\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxtP->frame, + (ctxtP->enb_flag) ? "eNB" : "UE", + ctxtP->enb_module_id, + ctxtP->ue_module_id, rlc_pP->rb_id); #endif list_init (&pdus, NULL); // param string identifying the list is NULL @@ -550,10 +550,10 @@ rlc_um_segment_5 (rlc_um_entity_t *rlc_pP,frame_t frameP) while ((list_get_head(&rlc_pP->input_sdus)) && (nb_bytes_to_transmit > 0)) { #if defined(TRACE_RLC_UM_SEGMENT) LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][RB %u] SEGMENT5 nb_bytes_to_transmit %d BO %d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxtP->frame, + (ctxtP->enb_flag) ? "eNB" : "UE", + ctxtP->enb_module_id, + ctxtP->ue_module_id, rlc_pP->rb_id, nb_bytes_to_transmit, rlc_pP->buffer_occupancy); @@ -569,10 +569,10 @@ rlc_um_segment_5 (rlc_um_entity_t *rlc_pP,frame_t frameP) data_pdu_size = rlc_pP->buffer_occupancy + rlc_pP->tx_header_min_length_in_bytes + max_li_overhead; #if defined(TRACE_RLC_UM_SEGMENT) LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][RB %u] SEGMENT5 alloc PDU size %d bytes to contain not all bytes requested by MAC but all BO of RLC@1\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxtP->frame, + (ctxtP->enb_flag) ? "eNB" : "UE", + ctxtP->enb_module_id, + ctxtP->ue_module_id, rlc_pP->rb_id, data_pdu_size); #endif @@ -580,10 +580,10 @@ rlc_um_segment_5 (rlc_um_entity_t *rlc_pP,frame_t frameP) data_pdu_size = nb_bytes_to_transmit; #if defined(TRACE_RLC_UM_SEGMENT) LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][RB %u] SEGMENT5 alloc PDU size %d bytes to contain all bytes requested by MAC@1\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxtP->frame, + (ctxtP->enb_flag) ? "eNB" : "UE", + ctxtP->enb_module_id, + ctxtP->ue_module_id, rlc_pP->rb_id, data_pdu_size); #endif @@ -591,10 +591,10 @@ rlc_um_segment_5 (rlc_um_entity_t *rlc_pP,frame_t frameP) if (!(pdu_mem_p = get_free_mem_block (data_pdu_size + sizeof(struct mac_tb_req)))) { #if defined(TRACE_RLC_UM_SEGMENT) LOG_E(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][RB %u] SEGMENT5 ERROR COULD NOT GET NEW PDU, EXIT\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxtP->frame, + (ctxtP->enb_flag) ? "eNB" : "UE", + ctxtP->enb_module_id, + ctxtP->ue_module_id, rlc_pP->rb_id); #endif pthread_mutex_unlock(&rlc_pP->lock_input_sdus); @@ -602,10 +602,10 @@ rlc_um_segment_5 (rlc_um_entity_t *rlc_pP,frame_t frameP) } #if defined(TRACE_RLC_UM_SEGMENT) LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][RB %u] SEGMENT5 get new PDU %d bytes\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxtP->frame, + (ctxtP->enb_flag) ? "eNB" : "UE", + ctxtP->enb_module_id, + ctxtP->ue_module_id, rlc_pP->rb_id, data_pdu_size); #endif @@ -665,10 +665,10 @@ rlc_um_segment_5 (rlc_um_entity_t *rlc_pP,frame_t frameP) } else { #if defined(TRACE_RLC_UM_SEGMENT) LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][RB %u] SEGMENT5 sdu_mngt_p->sdu_remaining_size=%d test_pdu_remaining_size=%d test_li_length_in_bytes=%d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxtP->frame, + (ctxtP->enb_flag) ? "eNB" : "UE", + ctxtP->enb_module_id, + ctxtP->ue_module_id, rlc_pP->rb_id, sdu_mngt_p->sdu_remaining_size, test_pdu_remaining_size, @@ -695,10 +695,10 @@ rlc_um_segment_5 (rlc_um_entity_t *rlc_pP,frame_t frameP) //---------------------------------------- #if defined(TRACE_RLC_UM_SEGMENT) LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][RB %u] data shift %d Bytes num_li %d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxtP->frame, + (ctxtP->enb_flag) ? "eNB" : "UE", + ctxtP->enb_module_id, + ctxtP->ue_module_id, rlc_pP->rb_id, ((test_num_li*3) +1) >> 1, test_num_li); @@ -723,10 +723,10 @@ rlc_um_segment_5 (rlc_um_entity_t *rlc_pP,frame_t frameP) if (sdu_mngt_p->sdu_segmented_size == 0) { #if defined(TRACE_RLC_UM_SEGMENT) LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][RB %u] SEGMENT5 GET NEW SDU %p AVAILABLE SIZE %d Bytes\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxtP->frame, + (ctxtP->enb_flag) ? "eNB" : "UE", + ctxtP->enb_module_id, + ctxtP->ue_module_id, rlc_pP->rb_id, sdu_mngt_p, sdu_mngt_p->sdu_remaining_size); @@ -734,10 +734,10 @@ rlc_um_segment_5 (rlc_um_entity_t *rlc_pP,frame_t frameP) } else { #if defined(TRACE_RLC_UM_SEGMENT) LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][RB %u] SEGMENT5 GET AGAIN SDU %p REMAINING AVAILABLE SIZE %d Bytes / %d Bytes \n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxtP->frame, + (ctxtP->enb_flag) ? "eNB" : "UE", + ctxtP->enb_module_id, + ctxtP->ue_module_id, rlc_pP->rb_id, sdu_mngt_p, sdu_mngt_p->sdu_remaining_size, @@ -749,17 +749,17 @@ rlc_um_segment_5 (rlc_um_entity_t *rlc_pP,frame_t frameP) if (sdu_mngt_p->sdu_remaining_size > pdu_remaining_size) { #if defined(TRACE_RLC_UM_SEGMENT) LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][RB %u] SEGMENT5 Filling all remaining PDU with %d bytes\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxtP->frame, + (ctxtP->enb_flag) ? "eNB" : "UE", + ctxtP->enb_module_id, + ctxtP->ue_module_id, rlc_pP->rb_id, pdu_remaining_size); LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][RB %u] SEGMENT5 pdu_mem_p %p pdu_p %p pdu_p->data %p data %p data_sdu_p %p pdu_remaining_size %d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxtP->frame, + (ctxtP->enb_flag) ? "eNB" : "UE", + ctxtP->enb_module_id, + ctxtP->ue_module_id, rlc_pP->rb_id, pdu_mem_p, pdu_p, @@ -780,10 +780,10 @@ rlc_um_segment_5 (rlc_um_entity_t *rlc_pP,frame_t frameP) } else if (sdu_mngt_p->sdu_remaining_size == pdu_remaining_size) { #if defined(TRACE_RLC_UM_SEGMENT) LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][RB %u] SEGMENT5 Exactly Filling remaining PDU with %d remaining bytes of SDU\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxtP->frame, + (ctxtP->enb_flag) ? "eNB" : "UE", + ctxtP->enb_module_id, + ctxtP->ue_module_id, rlc_pP->rb_id, pdu_remaining_size); #endif @@ -802,10 +802,10 @@ rlc_um_segment_5 (rlc_um_entity_t *rlc_pP,frame_t frameP) } else if ((sdu_mngt_p->sdu_remaining_size + (li_length_in_bytes ^ 3)) < pdu_remaining_size ) { #if defined(TRACE_RLC_UM_SEGMENT) LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][RB %u] SEGMENT5 Filling PDU with %d all remaining bytes of SDU\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxtP->frame, + (ctxtP->enb_flag) ? "eNB" : "UE", + ctxtP->enb_module_id, + ctxtP->ue_module_id, rlc_pP->rb_id, sdu_mngt_p->sdu_remaining_size); #endif @@ -826,10 +826,10 @@ rlc_um_segment_5 (rlc_um_entity_t *rlc_pP,frame_t frameP) e_li_p->b2 = sdu_mngt_p->sdu_remaining_size << 4; #if defined(TRACE_RLC_UM_SEGMENT) LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][RB %u] SEGMENT5 set e_li_p->b1=%02X set e_li_p->b2=%02X fill_num_li=%d test_num_li=%d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxtP->frame, + (ctxtP->enb_flag) ? "eNB" : "UE", + ctxtP->enb_module_id, + ctxtP->ue_module_id, rlc_pP->rb_id, e_li_p->b1, e_li_p->b2, @@ -846,10 +846,10 @@ rlc_um_segment_5 (rlc_um_entity_t *rlc_pP,frame_t frameP) e_li_p->b3 = sdu_mngt_p->sdu_remaining_size & 0xFF; #if defined(TRACE_RLC_UM_SEGMENT) LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][RB %u] SEGMENT5 set e_li_p->b2=%02X set e_li_p->b3=%02X fill_num_li=%d test_num_li=%d\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxtP->frame, + (ctxtP->enb_flag) ? "eNB" : "UE", + ctxtP->enb_module_id, + ctxtP->ue_module_id, rlc_pP->rb_id, e_li_p->b2, e_li_p->b3, @@ -871,10 +871,10 @@ rlc_um_segment_5 (rlc_um_entity_t *rlc_pP,frame_t frameP) } else { #if defined(TRACE_RLC_UM_SEGMENT) LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][RB %u] SEGMENT5 Filling PDU with %d all remaining bytes of SDU and reduce TB size by %d bytes\n", - frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - rlc_pP->enb_module_id, - rlc_pP->ue_module_id, + ctxtP->frame, + (ctxtP->enb_flag) ? "eNB" : "UE", + ctxtP->enb_module_id, + ctxtP->ue_module_id, rlc_pP->rb_id, sdu_mngt_p->sdu_remaining_size, pdu_remaining_size - sdu_mngt_p->sdu_remaining_size); diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_segment.h b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_segment.h index 8e1d054c166be83a5699345a745e7b3a2ca3288c..ec9d72851c49c319f7cb47898c186086cb10c232 100644 --- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_segment.h +++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_segment.h @@ -62,19 +62,19 @@ # define public_rlc_um_segment(x) extern x # endif # endif -/*! \fn void rlc_um_segment_10 (rlc_um_entity_t *rlcP,frame_t frame) +/*! \fn void rlc_um_segment_10 (const protocol_ctxt_t* const ctxtP, rlc_um_entity_t *rlcP) * \brief Segmentation procedure with 10 bits sequence number, segment the first SDU in buffer and create a PDU of the size (nb_bytes_to_transmit) requested by MAC if possible and put it in the list "pdus_to_mac_layer". +* \param[in] ctxtP Running context. * \param[in] rlcP RLC UM protocol instance pointer. -* \param[in] frame Frame Index. */ -protected_rlc_um_segment(void rlc_um_segment_10 (rlc_um_entity_t *rlcP,frame_t frame)); +protected_rlc_um_segment(void rlc_um_segment_10 (const protocol_ctxt_t* const ctxtP, rlc_um_entity_t *rlcP)); -/*! \fn void rlc_um_segment_5 (rlc_um_entity_t *rlcP,frame_t frame) +/*! \fn void rlc_um_segment_5 (const protocol_ctxt_t* const ctxtP, rlc_um_entity_t *rlcP) * \brief Segmentation procedure with 5 bits sequence number, segment the first SDU in buffer and create a PDU of the size (nb_bytes_to_transmit) requested by MAC if possible and put it in the list "pdus_to_mac_layer". +* \param[in] ctxtP Running context. * \param[in] rlcP RLC UM protocol instance pointer. -* \param[in] frame Frame Index. */ -protected_rlc_um_segment(void rlc_um_segment_5 (rlc_um_entity_t *rlcP,frame_t frame)); +protected_rlc_um_segment(void rlc_um_segment_5 (const protocol_ctxt_t* const ctxtP, rlc_um_entity_t *rlcP)); /** @} */ # endif diff --git a/openair2/LAYER2/RLC/rlc.c b/openair2/LAYER2/RLC/rlc.c index ef72da852c7701b6c363c18d3727a9822829c5a3..320849bda8314cb7bfeffc4e4f5f880c03b541a0 100644 --- a/openair2/LAYER2/RLC/rlc.c +++ b/openair2/LAYER2/RLC/rlc.c @@ -44,15 +44,12 @@ #include "assertions.h" extern boolean_t pdcp_data_ind( - const module_id_t enb_mod_idP, - const module_id_t ue_mod_idP, - const frame_t frameP, - const eNB_flag_t enb_flagP, - const srb_flag_t srb_flagP, - const MBMS_flag_t MBMS_flagP, - const rb_id_t rb_idP, - const sdu_size_t sdu_buffer_sizeP, - mem_block_t* const sdu_buffer_pP); + const protocol_ctxt_t* const ctxt_pP, + const srb_flag_t srb_flagP, + const MBMS_flag_t MBMS_flagP, + const rb_id_t rb_idP, + const sdu_size_t sdu_buffer_sizeP, + mem_block_t* const sdu_buffer_pP); #define DEBUG_RLC_PDCP_INTERFACE 1 //#define DEBUG_RLC_PAYLOAD 1 @@ -102,39 +99,36 @@ void rlc_util_print_hex_octets(comp_name_t componentP, unsigned char* dataP, con #endif //----------------------------------------------------------------------------- rlc_op_status_t rlc_stat_req ( - const module_id_t enb_module_idP, - const module_id_t ue_module_idP, - const frame_t frameP, - const eNB_flag_t enb_flagP, - const srb_flag_t srb_flagP, - const rb_id_t rb_idP, - unsigned int* stat_tx_pdcp_sdu, - unsigned int* stat_tx_pdcp_bytes, - unsigned int* stat_tx_pdcp_sdu_discarded, - unsigned int* stat_tx_pdcp_bytes_discarded, - unsigned int* stat_tx_data_pdu, - unsigned int* stat_tx_data_bytes, - unsigned int* stat_tx_retransmit_pdu_by_status, - unsigned int* stat_tx_retransmit_bytes_by_status, - unsigned int* stat_tx_retransmit_pdu, - unsigned int* stat_tx_retransmit_bytes, - unsigned int* stat_tx_control_pdu, - unsigned int* stat_tx_control_bytes, - unsigned int* stat_rx_pdcp_sdu, - unsigned int* stat_rx_pdcp_bytes, - unsigned int* stat_rx_data_pdus_duplicate, - unsigned int* stat_rx_data_bytes_duplicate, - unsigned int* stat_rx_data_pdu, - unsigned int* stat_rx_data_bytes, - unsigned int* stat_rx_data_pdu_dropped, - unsigned int* stat_rx_data_bytes_dropped, - unsigned int* stat_rx_data_pdu_out_of_window, - unsigned int* stat_rx_data_bytes_out_of_window, - unsigned int* stat_rx_control_pdu, - unsigned int* stat_rx_control_bytes, - unsigned int* stat_timer_reordering_timed_out, - unsigned int* stat_timer_poll_retransmit_timed_out, - unsigned int* stat_timer_status_prohibit_timed_out) { + const protocol_ctxt_t* const ctxtP, + const srb_flag_t srb_flagP, + const rb_id_t rb_idP, + unsigned int* stat_tx_pdcp_sdu, + unsigned int* stat_tx_pdcp_bytes, + unsigned int* stat_tx_pdcp_sdu_discarded, + unsigned int* stat_tx_pdcp_bytes_discarded, + unsigned int* stat_tx_data_pdu, + unsigned int* stat_tx_data_bytes, + unsigned int* stat_tx_retransmit_pdu_by_status, + unsigned int* stat_tx_retransmit_bytes_by_status, + unsigned int* stat_tx_retransmit_pdu, + unsigned int* stat_tx_retransmit_bytes, + unsigned int* stat_tx_control_pdu, + unsigned int* stat_tx_control_bytes, + unsigned int* stat_rx_pdcp_sdu, + unsigned int* stat_rx_pdcp_bytes, + unsigned int* stat_rx_data_pdus_duplicate, + unsigned int* stat_rx_data_bytes_duplicate, + unsigned int* stat_rx_data_pdu, + unsigned int* stat_rx_data_bytes, + unsigned int* stat_rx_data_pdu_dropped, + unsigned int* stat_rx_data_bytes_dropped, + unsigned int* stat_rx_data_pdu_out_of_window, + unsigned int* stat_rx_data_bytes_out_of_window, + unsigned int* stat_rx_control_pdu, + unsigned int* stat_rx_control_bytes, + unsigned int* stat_timer_reordering_timed_out, + unsigned int* stat_timer_poll_retransmit_timed_out, + unsigned int* stat_timer_status_prohibit_timed_out) { //----------------------------------------------------------------------------- rlc_mode_t rlc_mode = RLC_MODE_NONE; rlc_union_t *rlc_union_p = NULL; @@ -142,32 +136,32 @@ rlc_op_status_t rlc_stat_req ( hashtable_rc_t h_rc; #ifdef OAI_EMU - if (enb_flagP) { - AssertFatal ((enb_module_idP >= oai_emulation.info.first_enb_local) && (oai_emulation.info.nb_enb_local > 0), + if (ctxtP->enb_flag) { + AssertFatal ((ctxtP->enb_module_id >= oai_emulation.info.first_enb_local) && (oai_emulation.info.nb_enb_local > 0), "eNB module id is too low (%u/%d)!\n", - enb_module_idP, + ctxtP->enb_module_id, oai_emulation.info.first_enb_local); - AssertFatal ((enb_module_idP < (oai_emulation.info.first_enb_local + oai_emulation.info.nb_enb_local)) && (oai_emulation.info.nb_enb_local > 0), + AssertFatal ((ctxtP->enb_module_id < (oai_emulation.info.first_enb_local + oai_emulation.info.nb_enb_local)) && (oai_emulation.info.nb_enb_local > 0), "eNB module id is too high (%u/%d)!\n", - enb_module_idP, + ctxtP->enb_module_id, oai_emulation.info.first_enb_local + oai_emulation.info.nb_enb_local); - AssertFatal (ue_module_idP < NB_UE_INST, + AssertFatal (ctxtP->ue_module_id < NB_UE_INST, "UE module id is too high (%u/%d)!\n", - ue_module_idP, + ctxtP->ue_module_id, oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local); } else { - AssertFatal (ue_module_idP < (oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local), + AssertFatal (ctxtP->ue_module_id < (oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local), "UE module id is too high (%u/%d)!\n", - ue_module_idP, + ctxtP->ue_module_id, oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local); - AssertFatal (ue_module_idP >= oai_emulation.info.first_ue_local, + AssertFatal (ctxtP->ue_module_id >= oai_emulation.info.first_ue_local, "UE module id is too low (%u/%d)!\n", - ue_module_idP, + ctxtP->ue_module_id, oai_emulation.info.first_ue_local); } #endif AssertFatal (rb_idP < NB_RB_MAX, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX); - key = RLC_COLL_KEY_VALUE(enb_module_idP, ue_module_idP, enb_flagP, rb_idP, srb_flagP); + key = RLC_COLL_KEY_VALUE(ctxtP->enb_module_id, ctxtP->ue_module_id, ctxtP->enb_flag, rb_idP, srb_flagP); h_rc = hashtable_get(rlc_coll_p, key, (void**)&rlc_union_p); if (h_rc == HASH_TABLE_OK) { rlc_mode = rlc_union_p->mode; @@ -205,7 +199,8 @@ rlc_op_status_t rlc_stat_req ( break; case RLC_MODE_AM: - rlc_am_stat_req(&rlc_union_p->rlc.am, + rlc_am_stat_req(ctxtP, + &rlc_union_p->rlc.am, stat_tx_pdcp_sdu, stat_tx_pdcp_bytes, stat_tx_pdcp_sdu_discarded, @@ -249,7 +244,8 @@ rlc_op_status_t rlc_stat_req ( *stat_rx_data_bytes_out_of_window = 0; *stat_timer_poll_retransmit_timed_out = 0; *stat_timer_status_prohibit_timed_out = 0; - rlc_um_stat_req (&rlc_union_p->rlc.um, + rlc_um_stat_req (ctxtP, + &rlc_union_p->rlc.um, stat_tx_pdcp_sdu, stat_tx_pdcp_bytes, stat_tx_pdcp_sdu_discarded, @@ -334,10 +330,7 @@ rlc_op_status_t rlc_stat_req ( } //----------------------------------------------------------------------------- -rlc_op_status_t rlc_data_req (const module_id_t enb_module_idP, - const module_id_t ue_module_idP, - const frame_t frameP, - const eNB_flag_t enb_flagP, +rlc_op_status_t rlc_data_req (const protocol_ctxt_t* const ctxtP, const srb_flag_t srb_flagP, const MBMS_flag_t MBMS_flagP, const rb_id_t rb_idP, @@ -358,9 +351,9 @@ rlc_op_status_t rlc_data_req (const module_id_t enb_module_idP, #endif #ifdef DEBUG_RLC_DATA_REQ LOG_D(RLC,"rlc_data_req: %s enb id %u ue id %u, rb_id %u (MAX %d), muip %d, confirmP %d, sud_sizeP %d, sdu_pP %p\n", - (enb_flagP) ? "eNB" : "UE", - enb_module_idP, - ue_module_idP, + (ctxtP->enb_flag) ? "eNB" : "UE", + ctxtP->enb_module_id, + ctxtP->ue_module_id, rb_idP, NB_RAB_MAX, muiP, @@ -373,27 +366,27 @@ rlc_op_status_t rlc_data_req (const module_id_t enb_module_idP, AssertFatal(MBMS_flagP == 0, "MBMS_flagP %u", MBMS_flagP); #endif #ifdef OAI_EMU - if (enb_flagP) { - AssertFatal ((enb_module_idP >= oai_emulation.info.first_enb_local) && (oai_emulation.info.nb_enb_local > 0), + if (ctxtP->enb_flag) { + AssertFatal ((ctxtP->enb_module_id >= oai_emulation.info.first_enb_local) && (oai_emulation.info.nb_enb_local > 0), "eNB module id is too low (%u/%d)!\n", - enb_module_idP, + ctxtP->enb_module_id, oai_emulation.info.first_enb_local); - AssertFatal ((enb_module_idP < (oai_emulation.info.first_enb_local + oai_emulation.info.nb_enb_local)) && (oai_emulation.info.nb_enb_local > 0), + AssertFatal ((ctxtP->enb_module_id < (oai_emulation.info.first_enb_local + oai_emulation.info.nb_enb_local)) && (oai_emulation.info.nb_enb_local > 0), "eNB module id is too high (%u/%d)!\n", - enb_module_idP, + ctxtP->enb_module_id, oai_emulation.info.first_enb_local + oai_emulation.info.nb_enb_local); - AssertFatal (ue_module_idP < NB_UE_INST, + AssertFatal (ctxtP->ue_module_id < NB_UE_INST, "UE module id is too high (%u/%d)!\n", - ue_module_idP, + ctxtP->ue_module_id, oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local); } else { - AssertFatal (ue_module_idP < (oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local), + AssertFatal (ctxtP->ue_module_id < (oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local), "UE module id is too high (%u/%d)!\n", - ue_module_idP, + ctxtP->ue_module_id, oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local); - AssertFatal (ue_module_idP >= oai_emulation.info.first_ue_local, + AssertFatal (ctxtP->ue_module_id >= oai_emulation.info.first_ue_local, "UE module id is too low (%u/%d)!\n", - ue_module_idP, + ctxtP->ue_module_id, oai_emulation.info.first_ue_local); } #endif @@ -413,18 +406,18 @@ rlc_op_status_t rlc_data_req (const module_id_t enb_module_idP, #ifdef Rel10 if (MBMS_flagP == TRUE) { - if (enb_flagP) { - log_ch_id = rlc_mbms_enb_get_lcid_by_rb_id(enb_module_idP,rb_idP); - mbms_id_p = &rlc_mbms_lcid2service_session_id_eNB[enb_module_idP][log_ch_id]; + if (ctxtP->enb_flag) { + log_ch_id = rlc_mbms_enb_get_lcid_by_rb_id(ctxtP->enb_module_id,rb_idP); + mbms_id_p = &rlc_mbms_lcid2service_session_id_eNB[ctxtP->enb_module_id][log_ch_id]; } else { - log_ch_id = rlc_mbms_ue_get_lcid_by_rb_id(ue_module_idP,rb_idP); - mbms_id_p = &rlc_mbms_lcid2service_session_id_ue[ue_module_idP][log_ch_id]; + log_ch_id = rlc_mbms_ue_get_lcid_by_rb_id(ctxtP->ue_module_id,rb_idP); + mbms_id_p = &rlc_mbms_lcid2service_session_id_ue[ctxtP->ue_module_id][log_ch_id]; } - key = RLC_COLL_KEY_MBMS_VALUE(enb_module_idP, ue_module_idP, enb_flagP, mbms_id_p->service_id, mbms_id_p->session_id); + key = RLC_COLL_KEY_MBMS_VALUE(ctxtP->enb_module_id, ctxtP->ue_module_id, ctxtP->enb_flag, mbms_id_p->service_id, mbms_id_p->session_id); } else #endif { - key = RLC_COLL_KEY_VALUE(enb_module_idP, ue_module_idP, enb_flagP, rb_idP, srb_flagP); + key = RLC_COLL_KEY_VALUE(ctxtP->enb_module_id, ctxtP->ue_module_id, ctxtP->enb_flag, rb_idP, srb_flagP); } h_rc = hashtable_get(rlc_coll_p, key, (void**)&rlc_union_p); @@ -437,10 +430,10 @@ rlc_op_status_t rlc_data_req (const module_id_t enb_module_idP, if (MBMS_flagP == 0) { LOG_D(RLC, "[FRAME %5u][%s][RLC][INST %u/%u][RB %u] Display of rlc_data_req:\n", - frameP, - (enb_flagP) ? "eNB" : "UE", - enb_module_idP, - ue_module_idP, + ctxtP->frame, + (ctxtP->enb_flag) ? "eNB" : "UE", + ctxtP->enb_module_id, + ctxtP->ue_module_id, rb_idP); #if defined(DEBUG_RLC_PAYLOAD) rlc_util_print_hex_octets(RLC, (unsigned char*)sdu_pP->data, sdu_sizeP); @@ -453,11 +446,11 @@ rlc_op_status_t rlc_data_req (const module_id_t enb_module_idP, case RLC_MODE_NONE: free_mem_block(sdu_pP); LOG_E(RLC, "Received RLC_MODE_NONE as rlc_type for %s eNB id %u, ue id %u, rb_id %u\n", - (enb_flagP) ? "eNB" : "UE", - enb_module_idP, - ue_module_idP, + (ctxtP->enb_flag) ? "eNB" : "UE", + ctxtP->enb_module_id, + ctxtP->ue_module_id, rb_idP); - vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_REQ,VCD_FUNCTION_OUT); + vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_REQ,VCD_FUNCTION_OUT); return RLC_OP_STATUS_BAD_PARAMETER; case RLC_MODE_AM: @@ -479,24 +472,24 @@ rlc_op_status_t rlc_data_req (const module_id_t enb_module_idP, LOG_D(RLC, "%s\n",RLC_FG_BRIGHT_COLOR_RED); LOG_D(RLC, "[FRAME %5u][%s][%s][INST %u/%u][%s %u][--- RLC_AM_DATA_REQ/%d Bytes --->][RLC_AM][INST %u/%u][%s %u]\n", - frameP, - (enb_flagP) ? "eNB" : "UE", + ctxtP->frame, + (ctxtP->enb_flag) ? "eNB" : "UE", (srb_flagP) ? "RRC" : "PDCP", - enb_module_idP, - ue_module_idP, + ctxtP->enb_module_id, + ctxtP->ue_module_id, (srb_flagP) ? "SRB" : "DRB", rb_idP, sdu_sizeP, - enb_module_idP, - ue_module_idP, + ctxtP->enb_module_id, + ctxtP->ue_module_id, (srb_flagP) ? "SRB" : "DRB", rb_idP); LOG_D(RLC, "%s\n",RLC_FG_COLOR_DEFAULT); - rlc_am_data_req(&rlc_union_p->rlc.am, frameP, new_sdu_p); - vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_REQ,VCD_FUNCTION_OUT); + rlc_am_data_req(ctxtP, &rlc_union_p->rlc.am, new_sdu_p); + vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_REQ,VCD_FUNCTION_OUT); return RLC_OP_STATUS_OK; } else { - vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_REQ,VCD_FUNCTION_OUT); + vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_REQ,VCD_FUNCTION_OUT); return RLC_OP_STATUS_INTERNAL_ERROR; } break; @@ -515,20 +508,20 @@ rlc_op_status_t rlc_data_req (const module_id_t enb_module_idP, //LOG_D(RLC, "%s\n",RLC_FG_BRIGHT_COLOR_RED); LOG_D(RLC, "[FRAME %5u][%s][%s][INST %u/%u][%s %u][--- RLC_UM_DATA_REQ/%d Bytes --->][RLC_UM][INST %u/%u][%s %u]\n", - frameP, - (enb_flagP) ? "eNB" : "UE", + ctxtP->frame, + (ctxtP->enb_flag) ? "eNB" : "UE", (srb_flagP) ? "RRC" : "PDCP", - enb_module_idP, - ue_module_idP, + ctxtP->enb_module_id, + ctxtP->ue_module_id, (srb_flagP) ? "SRB" : "DRB", rb_idP, sdu_sizeP, - enb_module_idP, - ue_module_idP, + ctxtP->enb_module_id, + ctxtP->ue_module_id, (srb_flagP) ? "SRB" : "DRB", rb_idP); //LOG_D(RLC, "%s\n",RLC_FG_COLOR_DEFAULT); - rlc_um_data_req(&rlc_union_p->rlc.um, frameP, new_sdu_p); + rlc_um_data_req(ctxtP, &rlc_union_p->rlc.um, new_sdu_p); //free_mem_block(new_sdu); vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_REQ,VCD_FUNCTION_OUT); @@ -552,20 +545,20 @@ rlc_op_status_t rlc_data_req (const module_id_t enb_module_idP, free_mem_block(sdu_pP); LOG_D(RLC, "%s\n",RLC_FG_BRIGHT_COLOR_RED); LOG_D(RLC, "[FRAME %5u][%s][%s][INST %u/%u][%s %u][--- RLC_TM_DATA_REQ/%d Bytes --->][RLC_TM][INST %u/%u][%s %u]\n", - frameP, - (enb_flagP) ? "eNB" : "UE", + ctxtP->frame, + (ctxtP->enb_flag) ? "eNB" : "UE", (srb_flagP) ? "RRC" : "PDCP", - enb_module_idP, - ue_module_idP, + ctxtP->enb_module_id, + ctxtP->ue_module_id, (srb_flagP) ? "SRB" : "DRB", rb_idP, sdu_sizeP, - enb_module_idP, - ue_module_idP, + ctxtP->enb_module_id, + ctxtP->ue_module_id, (srb_flagP) ? "SRB" : "DRB", rb_idP); LOG_D(RLC, "%s\n",RLC_FG_COLOR_DEFAULT); - rlc_tm_data_req(&rlc_union_p->rlc.tm, new_sdu_p); + rlc_tm_data_req(ctxtP, &rlc_union_p->rlc.tm, new_sdu_p); vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_REQ,VCD_FUNCTION_OUT); return RLC_OP_STATUS_OK; } else { @@ -598,18 +591,18 @@ rlc_op_status_t rlc_data_req (const module_id_t enb_module_idP, free_mem_block(sdu_pP); LOG_D(RLC, "%s\n",RLC_FG_BRIGHT_COLOR_RED); LOG_D(RLC, "[FRAME %5u][%s][%s][INST %u/%u][RB %u][--- RLC_UM_DATA_REQ/%d Bytes (MBMS) --->][RLC_UM][INST %u/%u][RB %u]\n", - frameP, - (enb_flagP) ? "eNB" : "UE", + ctxtP->frame, + (ctxtP->enb_flag) ? "eNB" : "UE", (srb_flagP) ? "RRC" : "PDCP", - enb_module_idP, - ue_module_idP, + ctxtP->enb_module_id, + ctxtP->ue_module_id, rb_idP, sdu_sizeP, - enb_module_idP, - ue_module_idP, + ctxtP->enb_module_id, + ctxtP->ue_module_id, rb_idP); LOG_D(RLC, "%s\n",RLC_FG_COLOR_DEFAULT); - rlc_um_data_req(&rlc_union_p->rlc.um, frameP, new_sdu_p); + rlc_um_data_req(ctxtP, &rlc_union_p->rlc.um, new_sdu_p); //free_mem_block(new_sdu); vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_REQ,VCD_FUNCTION_OUT); @@ -640,24 +633,21 @@ rlc_op_status_t rlc_data_req (const module_id_t enb_module_idP, //----------------------------------------------------------------------------- void rlc_data_ind ( - const module_id_t enb_module_idP, - const module_id_t ue_module_idP, - const frame_t frameP, - const eNB_flag_t enb_flagP, - const srb_flag_t srb_flagP, - const MBMS_flag_t MBMS_flagP, - const rb_id_t rb_idP, - const sdu_size_t sdu_sizeP, - mem_block_t *sdu_pP) { + const protocol_ctxt_t* const ctxtP, + const srb_flag_t srb_flagP, + const MBMS_flag_t MBMS_flagP, + const rb_id_t rb_idP, + const sdu_size_t sdu_sizeP, + mem_block_t *sdu_pP) { //----------------------------------------------------------------------------- #if defined(DEBUG_RLC_PAYLOAD) LOG_D(RLC, "[FRAME %5u][%s][RLC][INST %u/%u][%s %u] Display of rlc_data_ind: size %u\n", - frameP, - (enb_flagP) ? "eNB" : "UE", - enb_module_idP, - ue_module_idP, + ctxtP->frame, + (ctxtP->enb_flag) ? "eNB" : "UE", + ctxtP->enb_module_id, + ctxtP->ue_module_id, (srb_flagP) ? "SRB" : "DRB", rb_idP, sdu_sizeP); @@ -665,23 +655,20 @@ void rlc_data_ind ( rlc_util_print_hex_octets(RLC, (unsigned char*)sdu_pP->data, sdu_sizeP); #endif LOG_D(RLC, "[FRAME %5u][%s][RLC][INST %u/%u][%s %u][--- RLC_DATA_IND/%d Bytes --->][PDCP][INST %u/%u][%s %u]\n", - frameP, - (enb_flagP) ? "eNB" : "UE", - enb_module_idP, - ue_module_idP, + ctxtP->frame, + (ctxtP->enb_flag) ? "eNB" : "UE", + ctxtP->enb_module_id, + ctxtP->ue_module_id, (srb_flagP) ? "SRB" : "DRB", rb_idP, sdu_sizeP, - enb_module_idP, - ue_module_idP, + ctxtP->enb_module_id, + ctxtP->ue_module_id, (srb_flagP) ? "SRB" : "DRB", rb_idP); pdcp_data_ind ( - enb_module_idP, - ue_module_idP, - frameP, - enb_flagP, + ctxtP, srb_flagP, MBMS_flagP, rb_idP, @@ -689,10 +676,7 @@ void rlc_data_ind ( sdu_pP); } //----------------------------------------------------------------------------- -void rlc_data_conf (const module_id_t enb_module_idP, - const module_id_t ue_module_idP, - const frame_t frameP, - const eNB_flag_t enb_flagP, +void rlc_data_conf (const protocol_ctxt_t* const ctxtP, const srb_flag_t srb_flagP, const rb_id_t rb_idP, const mui_t muiP, @@ -703,20 +687,20 @@ void rlc_data_conf (const module_id_t enb_module_idP, if (rlc_rrc_data_conf != NULL) { LOG_D(RLC, "%s\n",RLC_FG_BRIGHT_COLOR_RED); LOG_D(RLC, "[FRAME %5u][%s][RLC_AM][INST %u/%u][%s %u][--- RLC_DATA_CONF /MUI %d --->][%s][INST %u/%u][][RLC_DATA_CONF/ MUI %d]\n", - frameP, - (enb_flagP) ? "eNB" : "UE", - enb_module_idP, - ue_module_idP, + ctxtP->frame, + (ctxtP->enb_flag) ? "eNB" : "UE", + ctxtP->enb_module_id, + ctxtP->ue_module_id, (srb_flagP) ? "SRB" : "DRB", rb_idP, muiP, (srb_flagP) ? "RRC" : "PDCP", - enb_module_idP, - ue_module_idP, + ctxtP->enb_module_id, + ctxtP->ue_module_id, muiP); LOG_D(RLC, "%s\n",RLC_FG_COLOR_DEFAULT); - rlc_rrc_data_conf (enb_module_idP , ue_module_idP, enb_flagP, rb_idP , muiP, statusP); + rlc_rrc_data_conf (ctxtP, rb_idP , muiP, statusP); } } } diff --git a/openair2/LAYER2/RLC/rlc.h b/openair2/LAYER2/RLC/rlc.h index 2d09baaa1c71a4c4d357d30e502573a8c0f31ff1..aefef53707fbb825e8c3b2b385adc2e2674bec48 100755 --- a/openair2/LAYER2/RLC/rlc.h +++ b/openair2/LAYER2/RLC/rlc.h @@ -151,7 +151,7 @@ typedef struct { rlc_buffer_occupancy_t pdus_in_buffer; /*!< \brief Number of PDUs buffered in RLC protocol instance (OBSOLETE). */ frame_t head_sdu_creation_time; /*!< \brief Head SDU creation time. */ sdu_size_t head_sdu_remaining_size_to_send; /*!< \brief remaining size of sdu: could be the total size or the remaining size of already segmented sdu */ - boolean_t head_sdu_is_segmented; /*!< \brief 0 if head SDU has not been segmented, 1 if already segmeneted */ + boolean_t head_sdu_is_segmented; /*!< \brief 0 if head SDU has not been segmented, 1 if already segmented */ } mac_rlc_status_resp_t; @@ -168,6 +168,8 @@ typedef struct { } dummy; } mac_rlc_max_rx_header_size_t; + + //----------------------------------------------------------------------------- // PRIVATE INTERNALS OF RLC //----------------------------------------------------------------------------- @@ -176,38 +178,28 @@ typedef struct { #define RLC_MAX_LC ((max_val_DRB_Identity+1)* NUMBER_OF_UE_MAX) protected_rlc(void (*rlc_rrc_data_ind)( - const module_id_t eNB_inst, - const module_id_t UE_inst, - const frame_t frameP, - const eNB_flag_t eNB_flagP, - const rb_id_t rb_idP, - const sdu_size_t sdu_sizeP, - uint8_t * const sduP);) + const protocol_ctxt_t* const ctxtP, + const rb_id_t rb_idP, + const sdu_size_t sdu_sizeP, + uint8_t * const sduP);) protected_rlc(void (*rlc_rrc_data_conf)( - const module_id_t eNB_inst, - const module_id_t UE_inst, - const eNB_flag_t eNB_flagP, - const rb_id_t rb_idP, - const mui_t muiP, - const rlc_tx_status_t statusP);) + const protocol_ctxt_t* const ctxtP, + const rb_id_t rb_idP, + const mui_t muiP, + const rlc_tx_status_t statusP);) typedef void (rrc_data_ind_cb_t)( - const module_id_t eNB_inst, - const module_id_t UE_inst, - const frame_t frameP, - const eNB_flag_t eNB_flagP, - const rb_id_t rb_idP, - const sdu_size_t sdu_sizeP, - uint8_t * const sduP); + const protocol_ctxt_t* const ctxtP, + const rb_id_t rb_idP, + const sdu_size_t sdu_sizeP, + uint8_t * const sduP); typedef void (rrc_data_conf_cb_t)( - const module_id_t eNB_inst, - const module_id_t UE_inst, - const eNB_flag_t eNB_flagP, - const rb_id_t rb_idP, - const mui_t muiP, - const rlc_tx_status_t statusP); + const protocol_ctxt_t* const ctxtP, + const rb_id_t rb_idP, + const mui_t muiP, + const rlc_tx_status_t statusP); /*! \struct rlc_t @@ -308,12 +300,9 @@ private_rlc_mac(struct mac_data_ind mac_rlc_deserialize_tb (char*, tb_size_t, // PUBLIC INTERFACE WITH RRC //----------------------------------------------------------------------------- #ifdef Rel10 -/*! \fn rlc_op_status_t rrc_rlc_config_asn1_req (const module_id_t enb_mod_idP, const module_id_t ue_mod_idP, const frame_t frameP, const eNB_flag_t eNB_flagP, const srb_flag_t srb_flagP, const SRB_ToAddMod_t* const srb2addmod, const DRB_ToAddModList_t* const drb2add_listP, const DRB_ToReleaseList_t* const drb2release_listP, const PMCH_InfoList_r9_t * const pmch_info_listP) +/*! \fn rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t* const ctxtP, const srb_flag_t srb_flagP, const SRB_ToAddMod_t* const srb2addmod, const DRB_ToAddModList_t* const drb2add_listP, const DRB_ToReleaseList_t* const drb2release_listP, const PMCH_InfoList_r9_t * const pmch_info_listP) * \brief Function for RRC to configure a Radio Bearer. -* \param[in] enb_mod_idP Virtualized enb module identifier, Not used if eNB_flagP = 0. -* \param[in] ue_mod_idP Virtualized ue module identifier. -* \param[in] frameP Frame index. -* \param[in] eNB_flagP Flag to indicate eNB (1) or UE (0) +* \param[in] ctxtP Running context. * \param[in] srb2add_listP SRB configuration list to be created. * \param[in] drb2add_listP DRB configuration list to be created. * \param[in] drb2release_listP DRB configuration list to be released. @@ -321,100 +310,77 @@ private_rlc_mac(struct mac_data_ind mac_rlc_deserialize_tb (char*, tb_size_t, * \return A status about the processing, OK or error code. */ public_rlc_rrc( rlc_op_status_t rrc_rlc_config_asn1_req ( - const module_id_t, - const module_id_t, - const frame_t, - const eNB_flag_t, - const SRB_ToAddModList_t* const , - const DRB_ToAddModList_t* const , - const DRB_ToReleaseList_t* const , - const PMCH_InfoList_r9_t * const pmch_info_listP);) + const protocol_ctxt_t* const, + const SRB_ToAddModList_t* const , + const DRB_ToAddModList_t* const , + const DRB_ToReleaseList_t* const , + const PMCH_InfoList_r9_t * const pmch_info_listP);) #else -/*! \fn rlc_op_status_t rrc_rlc_config_asn1_req (const module_id_t enb_mod_idP, const module_id_t ue_mod_idP, const frame_t frameP, const eNB_flag_t eNB_flagP, const srb_flag_t srb_flagP, const SRB_ToAddModList_t* const srb2add_listP, const DRB_ToAddModList_t* const drb2add_listP, const DRB_ToReleaseList_t* const drb2release_listP) +/*! \fn rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t* const ctxtP, const SRB_ToAddModList_t* const srb2add_listP, const DRB_ToAddModList_t* const drb2add_listP, const DRB_ToReleaseList_t* const drb2release_listP) * \brief Function for RRC to configure a Radio Bearer. -* \param[in] enb_mod_idP Virtualized enb module identifier, Not used if eNB_flagP = 0. -* \param[in] ue_mod_idP Virtualized ue module identifier. -* \param[in] frameP Frame index. -* \param[in] eNB_flagP Flag to indicate eNB (1) or UE (0) +* \param[in] ctxtP Running context. * \param[in] srb2add_listP SRB configuration list to be created. * \param[in] drb2add_listP DRB configuration list to be created. * \param[in] drb2release_listP DRB configuration list to be released. * \return A status about the processing, OK or error code. */ public_rlc_rrc( rlc_op_status_t rrc_rlc_config_asn1_req ( - const module_id_t, - const module_id_t, - const frame_t, - const eNB_flag_t, - const SRB_ToAddModList_t* const , - const DRB_ToAddModList_t* const , - const DRB_ToReleaseList_t* const );) + const protocol_ctxt_t* const, + const SRB_ToAddModList_t* const , + const DRB_ToAddModList_t* const , + const DRB_ToReleaseList_t* const );) #endif /*! \fn void rb_free_rlc_union (void *rlcu_pP) * \brief Free the rlc memory contained in the RLC embedded in the rlc_union_t * struct pointed by of the rlcu_pP parameter. Free the rlc_union_t struct also. + * \param[in] ctxtP Running context. * \param[in] rlcu_pP Pointer on the rlc_union_t struct. */ public_rlc_rrc(void - rb_free_rlc_union (void *rlcu_pP);) + rb_free_rlc_union (const protocol_ctxt_t* const ctxt_pP, void *rlcu_pP);) -/*! \fn rlc_op_status_t rrc_rlc_remove_ue (const module_id_t enb_mod_idP, const module_id_t ue_mod_idP, const frame_t frameP, const eNB_flag_t eNB_flagP) +/*! \fn rlc_op_status_t rrc_rlc_remove_ue (const protocol_ctxt_t* const ctxtP) * \brief Remove all RLC protocol instances from all radio bearers allocated to a UE. - * \param[in] enb_mod_idP Virtualized enb module identifier, Not used if eNB_flagP = 0. - * \param[in] ue_mod_idP Virtualized ue module identifier. - * \param[in] frameP Frame index. - * \param[in] eNB_flagP Flag to indicate eNB (1) or UE (0) + * \param[in] ctxtP Running context. * \return A status about the processing, OK or error code. */ -public_rlc_rrc(rlc_op_status_t rrc_rlc_remove_ue (const module_id_t enb_mod_idP,const module_id_t ue_mod_idP,const frame_t frameP,const eNB_flag_t eNB_flag);) +public_rlc_rrc(rlc_op_status_t rrc_rlc_remove_ue (const protocol_ctxt_t* const);) -/*! \fn rlc_op_status_t rrc_rlc_remove_rlc (const module_id_t enb_mod_idP, const module_id_t ue_mod_idP, const frame_t frameP, const eNB_flag_t eNB_flagP, const srb_flag_t srb_flagP, const MBMS_flag_t MBMS_flagP, const rb_id_t rb_idP) +/*! \fn rlc_op_status_t rrc_rlc_remove_rlc (const protocol_ctxt_t* const ctxtP, const srb_flag_t srb_flagP, const MBMS_flag_t MBMS_flagP, const rb_id_t rb_idP) * \brief Remove a RLC protocol instance from a radio bearer. -* \param[in] enb_mod_idP Virtualized enb module identifier, Not used if eNB_flagP = 0. -* \param[in] ue_mod_idP Virtualized ue module identifier. -* \param[in] frameP Frame index. -* \param[in] eNB_flagP Flag to indicate eNB (1) or UE (0) -* \param[in] srb_flagP Flag to indicate SRB (1) or DRB (0) -* \param[in] MBMS_flag Flag to indicate whether this is an MBMS service (1) or not (0) -* \param[in] rb_idP Radio bearer identifier. +* \param[in] ctxtP Running context. +* \param[in] srb_flagP Flag to indicate SRB (1) or DRB (0) +* \param[in] MBMS_flag Flag to indicate whether this is an MBMS service (1) or not (0) +* \param[in] rb_idP Radio bearer identifier. * \return A status about the processing, OK or error code. */ -public_rlc_rrc(rlc_op_status_t rrc_rlc_remove_rlc (const module_id_t , const module_id_t , const frame_t , const eNB_flag_t , const srb_flag_t, const MBMS_flag_t, const rb_id_t );) +public_rlc_rrc(rlc_op_status_t rrc_rlc_remove_rlc (const protocol_ctxt_t* const, const srb_flag_t, const MBMS_flag_t, const rb_id_t );) -/*! \fn rlc_union_t* rrc_rlc_add_rlc (const module_id_t enb_mod_idP, const module_id_t ue_mod_idP, const frame_t frameP, const eNB_flag_t eNB_flagP, const srb_flag_t srb_flagP, const MBMS_flag_t MBMS_flagP, const rb_id_t rb_idP, logical_chan_id_t chan_idP, rlc_mode_t rlc_modeP) +/*! \fn rlc_union_t* rrc_rlc_add_rlc (const protocol_ctxt_t* const ctxtP, const srb_flag_t srb_flagP, const MBMS_flag_t MBMS_flagP, const rb_id_t rb_idP, logical_chan_id_t chan_idP, rlc_mode_t rlc_modeP) * \brief Add a RLC protocol instance to a radio bearer. -* \param[in] enb_mod_idP Virtualized enb module identifier, Not used if eNB_flagP = 0. -* \param[in] ue_mod_idP Virtualized ue module identifier. -* \param[in] frameP Frame index. -* \param[in] eNB_flagP Flag to indicate eNB (1) or UE (0) -* \param[in] srb_flagP Flag to indicate SRB (1) or DRB (0) -* \param[in] MBMS_flag Flag to indicate whether this is an MBMS service (1) or not (0) -* \param[in] rb_idP Radio bearer identifier. -* \param[in] chan_idP Logical channel identifier. -* \param[in] rlc_modeP Mode of RLC (AM, UM, TM). +* \param[in] ctxtP Running context. +* \param[in] srb_flagP Flag to indicate SRB (1) or DRB (0) +* \param[in] MBMS_flag Flag to indicate whether this is an MBMS service (1) or not (0) +* \param[in] rb_idP Radio bearer identifier. +* \param[in] chan_idP Logical channel identifier. +* \param[in] rlc_modeP Mode of RLC (AM, UM, TM). * \return A status about the processing, OK or error code. */ -private_rlc_rrc(rlc_union_t* rrc_rlc_add_rlc (const module_id_t, const module_id_t, const frame_t, const eNB_flag_t, const srb_flag_t, const MBMS_flag_t MBMS_flagP, const rb_id_t, logical_chan_id_t, rlc_mode_t);) +private_rlc_rrc(rlc_union_t* rrc_rlc_add_rlc (const protocol_ctxt_t* const, const srb_flag_t, const MBMS_flag_t MBMS_flagP, const rb_id_t, logical_chan_id_t, rlc_mode_t);) /*! \fn rlc_op_status_t rrc_rlc_config_req ( - const module_id_t enb_mod_idP, - const module_id_t ue_mod_idP, - const frame_t frameP, - const eNB_flag_t eNB_flagP, + const protocol_ctxt_t* const ctxtP, const srb_flag_t srb_flagP, const MBMS_flag_t MBMS_flagP, config_action_t actionP, const rb_id_t rb_idP, rlc_info_t rlc_infoP) * \brief Function for RRC to configure a Radio Bearer. -* \param[in] enb_mod_idP Virtualized enb module identifier, Not used if eNB_flagP = 0. -* \param[in] ue_mod_idP Virtualized ue module identifier. -* \param[in] frameP Frame index. -* \param[in] eNB_flagP Flag to indicate eNB (1) or UE (0) +* \param[in] ctxtP Running context. * \param[in] srb_flagP Flag to indicate SRB (1) or DRB (0) * \param[in] MBMS_flag Flag to indicate whether this is an MBMS service (1) or not (0) * \param[in] actionP Action for this radio bearer (add, modify, remove). @@ -423,22 +389,16 @@ private_rlc_rrc(rlc_union_t* rrc_rlc_add_rlc (const module_id_t, const mod * \return A status about the processing, OK or error code. */ public_rlc_rrc( rlc_op_status_t rrc_rlc_config_req ( - const module_id_t, - const module_id_t, - const frame_t, - const eNB_flag_t , - const srb_flag_t, - const MBMS_flag_t, - config_action_t, - const rb_id_t, - rlc_info_t );) - -/*! \fn rlc_op_status_t rrc_rlc_data_req (const module_id_t enb_mod_idP, const module_id_t ue_mod_idP, const frame_t frameP, const eNB_flag_t eNB_flagP, const MBMS_flag_t MBMS_flagP, const rb_id_t rb_idP, mui_t muiP, confirm_t confirmP, sdu_size_t sdu_sizeP, char* sduP) + const protocol_ctxt_t* const, + const srb_flag_t, + const MBMS_flag_t, + config_action_t, + const rb_id_t, + rlc_info_t );) + +/*! \fn rlc_op_status_t rrc_rlc_data_req (const protocol_ctxt_t* const ctxtP, const MBMS_flag_t MBMS_flagP, const rb_id_t rb_idP, mui_t muiP, confirm_t confirmP, sdu_size_t sdu_sizeP, char* sduP) * \brief Function for RRC to send a SDU through a Signalling Radio Bearer. -* \param[in] enb_mod_idP Virtualized enb module identifier, Not used if eNB_flagP = 0. -* \param[in] ue_mod_idP Virtualized ue module identifier. -* \param[in] frameP Frame index -* \param[in] eNB_flagP Flag to indicate eNB (1) or UE (0) +* \param[in] ctxtP Running context. * \param[in] MBMS_flag Flag to indicate whether this is an MBMS service (1) or not (0) * \param[in] rb_idP Radio bearer identifier. * \param[in] muiP Message Unit identifier. @@ -447,9 +407,9 @@ public_rlc_rrc( rlc_op_status_t rrc_rlc_config_req ( * \param[in] sduP SDU. * \return A status about the processing, OK or error code. */ -public_rlc_rrc( rlc_op_status_t rrc_rlc_data_req (const module_id_t, const module_id_t, const frame_t, const eNB_flag_t, const MBMS_flag_t, const rb_id_t, mui_t, confirm_t, sdu_size_t, char *);) +public_rlc_rrc( rlc_op_status_t rrc_rlc_data_req (const protocol_ctxt_t* const , const MBMS_flag_t, const rb_id_t, mui_t, confirm_t, sdu_size_t, char *);) -/*! \fn void rrc_rlc_register_rrc ( void (*rrc_data_indP) (const module_id_t enb_mod_idP, const module_id_t ue_mod_idP, const frame_t frameP, const eNB_flag_t eNB_flagP, const rb_id_t rb_idP, sdu_size_t sdu_sizeP, char* sduP), void (*rrc_data_confP) (const module_id_t enb_mod_idP, const module_id_t ue_mod_idP, const rb_id_t rb_idP, mui_t muiP, rlc_tx_status_t statusP) +/*! \fn void rrc_rlc_register_rrc ( void (*rrc_data_indP) (const protocol_ctxt_t* const ctxtP, const rb_id_t rb_idP, sdu_size_t sdu_sizeP, char* sduP), void (*rrc_data_confP) (const protocol_ctxt_t* const ctxtP, const rb_id_t rb_idP, mui_t muiP, rlc_tx_status_t statusP) * \brief This function is called by RRC to register its DATA-INDICATE and DATA-CONFIRM handlers to RLC layer. * \param[in] rrc_data_indP Pointer on RRC data indicate function. * \param[in] rrc_data_confP Pointer on RRC data confirm callback function. @@ -480,7 +440,6 @@ public_rlc_mac(tbs_size_t mac_rlc_data_req (const module_id_t, co * \param[in] eNB_flagP Flag to indicate eNB (1) or UE (0) * \param[in] MBMS_flagP Flag to indicate whether this is the MBMS service (1) or not (0) * \param[in] rb_idP Radio bearer identifier. -* \param[in] frameP Frame index. * \param[in] bufferP Memory area containing the transport blocks sent by MAC. * \param[in] tb_sizeP Size of a transport block in bits. * \param[in] num_tbP Number of transport blocks. @@ -517,12 +476,9 @@ public_rlc(void rlc_util_print_hex_octets( -/*! \fn rlc_op_status_t rlc_data_req (const module_id_t enb_mod_idP, const module_id_t ue_mod_idP, const frame_t frameP, const eNB_flag_t eNB_flagP, const srb_flag_t srb_flagP, const MBMS_flag_t MBMS_flagP, const rb_id_t rb_idP, mui_t muiP, confirm_t confirmP, sdu_size_t sdu_sizeP, mem_block_t *sduP) +/*! \fn rlc_op_status_t rlc_data_req (const protocol_ctxt_t* const ctxtP, const srb_flag_t srb_flagP, const MBMS_flag_t MBMS_flagP, const rb_id_t rb_idP, mui_t muiP, confirm_t confirmP, sdu_size_t sdu_sizeP, mem_block_t *sduP) * \brief Interface with higher layers, map request to the RLC corresponding to the radio bearer. -* \param[in] enb_mod_idP Virtualized enb module identifier, Not used if eNB_flagP = 0. -* \param[in] ue_mod_idP Virtualized ue module identifier. -* \param[in] frameP Frame index. -* \param[in] eNB_flagP Flag to indicate eNB (1) or UE (0) +* \param[in] ctxtP Running context. * \param[in] srb_flagP Flag to indicate SRB (1) or DRB (0) * \param[in] MBMS_flagP Flag to indicate whether this is the MBMS service (1) or not (0) * \param[in] rb_idP Radio bearer identifier. @@ -533,24 +489,18 @@ public_rlc(void rlc_util_print_hex_octets( * \return A status about the processing, OK or error code. */ public_rlc(rlc_op_status_t rlc_data_req ( - const module_id_t , - const module_id_t , - const frame_t , - const eNB_flag_t , - const srb_flag_t, - const MBMS_flag_t , - const rb_id_t , - const mui_t , - const confirm_t , - const sdu_size_t , - mem_block_t * const);) - -/*! \fn void rlc_data_ind (const module_id_t enb_mod_idP, const module_id_t ue_mod_idP, const frame_t frameP, const eNB_flag_t eNB_flagP, const srb_flag_t srb_flagP, const MBMS_flag_t MBMS_flagP, const rb_id_t rb_idP, const sdu_size_t sdu_sizeP, mem_block_t* sduP) { + const protocol_ctxt_t* const, + const srb_flag_t, + const MBMS_flag_t , + const rb_id_t , + const mui_t , + const confirm_t , + const sdu_size_t , + mem_block_t * const);) + +/*! \fn void rlc_data_ind (const protocol_ctxt_t* const ctxtP, const srb_flag_t srb_flagP, const MBMS_flag_t MBMS_flagP, const rb_id_t rb_idP, const sdu_size_t sdu_sizeP, mem_block_t* sduP) { * \brief Interface with higher layers, route SDUs coming from RLC protocol instances to upper layer instance. -* \param[in] enb_mod_idP Virtualized enb module identifier, Not used if eNB_flagP = 0. -* \param[in] ue_mod_idP Virtualized ue module identifier. -* \param[in] frameP Frame index -* \param[in] eNB_flagP Flag to indicate eNB (1) or UE (0) +* \param[in] ctxtP Running context. * \param[in] srb_flagP Flag to indicate SRB (1) or DRB (0) * \param[in] MBMS_flagP Flag to indicate whether this is the MBMS service (1) or not (0) * \param[in] rb_idP Radio bearer identifier. @@ -558,44 +508,32 @@ public_rlc(rlc_op_status_t rlc_data_req ( * \param[in] sduP SDU. */ public_rlc(void rlc_data_ind( - const module_id_t , - const module_id_t , - const frame_t , - const eNB_flag_t , - const srb_flag_t, - const MBMS_flag_t , - const rb_id_t, - const sdu_size_t, - mem_block_t* const);) - - -/*! \fn void rlc_data_conf (const module_id_t enb_mod_idP, const module_id_t ue_mod_idP, const frame_t frameP, const eNB_flag_t eNB_flagP, const srb_flag_t srb_flagP, const rb_id_t rb_idP, const mui_t muiP, const rlc_tx_status_t statusP) + const protocol_ctxt_t* const, + const srb_flag_t, + const MBMS_flag_t , + const rb_id_t, + const sdu_size_t, + mem_block_t* const);) + + +/*! \fn void rlc_data_conf (const protocol_ctxt_t* const ctxtP, const srb_flag_t srb_flagP, const rb_id_t rb_idP, const mui_t muiP, const rlc_tx_status_t statusP) * \brief Interface with higher layers, confirm to upper layer the transmission status for a SDU stamped with a MUI, scheduled for transmission. -* \param[in] enb_mod_idP Virtualized enb module identifier, Not used if eNB_flagP = 0. -* \param[in] ue_mod_idP Virtualized ue module identifier. -* \param[in] frameP Frame index -* \param[in] eNB_flagP Flag to indicate eNB (1) or UE (0) +* \param[in] ctxtP Running context. * \param[in] srb_flagP Flag to indicate SRB (1) or DRB (0) * \param[in] rb_idP Radio bearer identifier. * \param[in] muiP Message Unit identifier. * \param[in] statusP Status of the transmission (RLC_SDU_CONFIRM_YES, RLC_SDU_CONFIRM_NO). */ public_rlc(void rlc_data_conf( - const module_id_t, - const module_id_t, - const frame_t, - const eNB_flag_t , - const srb_flag_t, - const rb_id_t, - const mui_t, - const rlc_tx_status_t );) + const protocol_ctxt_t* const, + const srb_flag_t, + const rb_id_t, + const mui_t, + const rlc_tx_status_t );) /*! \fn rlc_op_status_t rlc_stat_req ( - const module_id_t enb_mod_idP, - const module_id_t ue_mod_idP, - const frame_t frameP, - const eNB_flag_t eNB_flagP, + const protocol_ctxt_t* const ctxtP, const srb_flag_t srb_flagP, const rb_id_t rb_idP, unsigned int* stat_tx_pdcp_sdu, @@ -627,10 +565,7 @@ public_rlc(void rlc_data_conf( unsigned int* stat_timer_status_prohibit_timed_out) * \brief Request RLC statistics of a particular radio bearer. -* \param[in] enb_mod_idP Virtualized enb module identifier, Not used if eNB_flagP = 0. -* \param[in] ue_mod_idP Virtualized ue module identifier. -* \param[in] frameP -* \param[in] eNB_flag Flag to indicate eNB (1) or UE (0) +* \param[in] ctxtP Running context. * \param[in] srb_flagP Flag to indicate signalling radio bearer (1) or data radio bearer (0). * \param[in] rb_idP . * \param[out] stat_tx_pdcp_sdu Number of SDUs coming from upper layers. @@ -663,10 +598,7 @@ public_rlc(void rlc_data_conf( */ public_rlc(rlc_op_status_t rlc_stat_req ( - const module_id_t enb_mod_idP, - const module_id_t ue_mod_idP, - const frame_t frameP, - const eNB_flag_t eNB_flagP, + const protocol_ctxt_t* const ctxtP, const srb_flag_t srb_flagP, const rb_id_t rb_idP, unsigned int* const stat_tx_pdcp_sdu, diff --git a/openair2/LAYER2/RLC/rlc_mac.c b/openair2/LAYER2/RLC/rlc_mac.c index 084c7b42debe8ece681d9ee14ce086dd95e6228a..01b2cded7b161baa98fc88039183bac7d0fa5299 100644 --- a/openair2/LAYER2/RLC/rlc_mac.c +++ b/openair2/LAYER2/RLC/rlc_mac.c @@ -136,6 +136,12 @@ tbs_size_t mac_rlc_data_req( hashtable_rc_t h_rc; srb_flag_t srb_flag = (channel_idP <= 2) ? SRB_FLAG_YES : SRB_FLAG_NO; tbs_size_t ret_tb_size = 0; + protocol_ctxt_t ctxt; + + ctxt.enb_module_id = enb_module_idP; + ctxt.ue_module_id = ue_module_idP; + ctxt.frame = frameP; + ctxt.enb_flag = enb_flagP; vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_MAC_RLC_DATA_REQ,VCD_FUNCTION_IN); #ifdef DEBUG_MAC_INTERFACE @@ -205,17 +211,17 @@ tbs_size_t mac_rlc_data_req( break; case RLC_MODE_AM: - data_request = rlc_am_mac_data_request(&rlc_union_p->rlc.am, frameP); + data_request = rlc_am_mac_data_request(&ctxt, &rlc_union_p->rlc.am); ret_tb_size =mac_rlc_serialize_tb(buffer_pP, data_request.data); break; case RLC_MODE_UM: - data_request = rlc_um_mac_data_request(&rlc_union_p->rlc.um, frameP); + data_request = rlc_um_mac_data_request(&ctxt, &rlc_union_p->rlc.um); ret_tb_size = mac_rlc_serialize_tb(buffer_pP, data_request.data); break; case RLC_MODE_TM: - data_request = rlc_tm_mac_data_request(&rlc_union_p->rlc.tm, frameP); + data_request = rlc_tm_mac_data_request(&ctxt, &rlc_union_p->rlc.tm); ret_tb_size = mac_rlc_serialize_tb(buffer_pP, data_request.data); break; default:; @@ -231,10 +237,10 @@ void mac_rlc_data_ind ( const eNB_flag_t enb_flagP, const MBMS_flag_t MBMS_flagP, const logical_chan_id_t channel_idP, - char *buffer_pP, + char *buffer_pP, const tb_size_t tb_sizeP, - num_tb_t num_tbP, - crc_t *crcs_pP) { + num_tb_t num_tbP, + crc_t *crcs_pP) { //----------------------------------------------------------------------------- rb_id_t rb_id = 0; rlc_mode_t rlc_mode = RLC_MODE_NONE; @@ -243,6 +249,12 @@ void mac_rlc_data_ind ( hash_key_t key = HASHTABLE_QUESTIONABLE_KEY_VALUE; hashtable_rc_t h_rc; srb_flag_t srb_flag = (channel_idP <= 2) ? SRB_FLAG_YES : SRB_FLAG_NO; + protocol_ctxt_t ctxt; + + ctxt.enb_module_id = enb_module_idP; + ctxt.ue_module_id = ue_module_idP; + ctxt.frame = frameP; + ctxt.enb_flag = enb_flagP; vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_MAC_RLC_DATA_IND,VCD_FUNCTION_IN); #ifdef DEBUG_MAC_INTERFACE @@ -326,21 +338,21 @@ void mac_rlc_data_ind ( #ifdef DEBUG_MAC_INTERFACE LOG_D(RLC, "MAC DATA IND TO RLC_AM MOD_ID %s enb id %u ue id %u \n", (enb_flagP) ? "eNB" : "UE", enb_module_idP, ue_module_idP); #endif - rlc_am_mac_data_indication(&rlc_union_p->rlc.am, frameP, enb_flagP, data_ind); + rlc_am_mac_data_indication(&ctxt, &rlc_union_p->rlc.am, data_ind); break; case RLC_MODE_UM: #ifdef DEBUG_MAC_INTERFACE LOG_D(RLC, "MAC DATA IND TO RLC_UM MOD_ID %s enb id %u ue id %u \n", (enb_flagP) ? "eNB" : "UE", enb_module_idP, ue_module_idP); #endif - rlc_um_mac_data_indication(&rlc_union_p->rlc.um, frameP, enb_flagP, data_ind); + rlc_um_mac_data_indication(&ctxt, &rlc_union_p->rlc.um, data_ind); break; case RLC_MODE_TM: #ifdef DEBUG_MAC_INTERFACE LOG_D(RLC, "MAC DATA IND TO RLC_TM MOD_ID %s enb id %u ue id %u \n", (enb_flagP) ? "eNB" : "UE", enb_module_idP, ue_module_idP); #endif - rlc_tm_mac_data_indication(&rlc_union_p->rlc.tm, frameP, enb_flagP, data_ind); + rlc_tm_mac_data_indication(&ctxt, &rlc_union_p->rlc.tm, data_ind); break; } @@ -367,6 +379,12 @@ mac_rlc_status_resp_t mac_rlc_status_ind( hash_key_t key = HASHTABLE_QUESTIONABLE_KEY_VALUE; hashtable_rc_t h_rc; srb_flag_t srb_flag = (channel_idP <= 2) ? SRB_FLAG_YES : SRB_FLAG_NO; + protocol_ctxt_t ctxt; + + ctxt.enb_module_id = enb_module_idP; + ctxt.ue_module_id = ue_module_idP; + ctxt.frame = frameP; + ctxt.enb_flag = enb_flagP; vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_MAC_RLC_STATUS_IND,VCD_FUNCTION_IN); memset (&mac_rlc_status_resp, 0, sizeof(mac_rlc_status_resp_t)); @@ -448,7 +466,7 @@ mac_rlc_status_resp_t mac_rlc_status_ind( break; case RLC_MODE_AM: - status_resp = rlc_am_mac_status_indication(&rlc_union_p->rlc.am, frameP, tb_sizeP, tx_status); + status_resp = rlc_am_mac_status_indication(&ctxt, &rlc_union_p->rlc.am, tb_sizeP, tx_status); mac_rlc_status_resp.bytes_in_buffer = status_resp.buffer_occupancy_in_bytes; mac_rlc_status_resp.head_sdu_creation_time = status_resp.head_sdu_creation_time; mac_rlc_status_resp.head_sdu_remaining_size_to_send = status_resp.head_sdu_remaining_size_to_send; @@ -457,7 +475,7 @@ mac_rlc_status_resp_t mac_rlc_status_ind( break; case RLC_MODE_UM: - status_resp = rlc_um_mac_status_indication(&rlc_union_p->rlc.um, frameP, enb_flagP, tb_sizeP, tx_status); + status_resp = rlc_um_mac_status_indication(&ctxt, &rlc_union_p->rlc.um, tb_sizeP, tx_status); mac_rlc_status_resp.bytes_in_buffer = status_resp.buffer_occupancy_in_bytes; mac_rlc_status_resp.pdus_in_buffer = status_resp.buffer_occupancy_in_pdus; mac_rlc_status_resp.head_sdu_creation_time = status_resp.head_sdu_creation_time; @@ -467,7 +485,7 @@ mac_rlc_status_resp_t mac_rlc_status_ind( break; case RLC_MODE_TM: - status_resp = rlc_tm_mac_status_indication(&rlc_union_p->rlc.tm, frameP, tb_sizeP, tx_status); + status_resp = rlc_tm_mac_status_indication(&ctxt, &rlc_union_p->rlc.tm, tb_sizeP, tx_status); mac_rlc_status_resp.bytes_in_buffer = status_resp.buffer_occupancy_in_bytes; mac_rlc_status_resp.pdus_in_buffer = status_resp.buffer_occupancy_in_pdus; // return mac_rlc_status_resp; diff --git a/openair2/LAYER2/RLC/rlc_mpls.c b/openair2/LAYER2/RLC/rlc_mpls.c index ddf3b41ac5fedee03b856a66dc5ca3758ca90a4f..a731fe5d93f57194799c9113da18f53484fc61e8 100644 --- a/openair2/LAYER2/RLC/rlc_mpls.c +++ b/openair2/LAYER2/RLC/rlc_mpls.c @@ -40,14 +40,12 @@ //----------------------------------------------------------------------------- rlc_op_status_t mpls_rlc_data_req ( - const module_id_t enb_module_idP, - const module_id_t ue_module_idP, - const frame_t frame, - const rb_id_t rb_idP, - const sdu_size_t sdu_sizeP, - mem_block_t* const sduP) { + const protocol_ctxt_t* const ctxtP, + const rb_id_t rb_idP, + const sdu_size_t sdu_sizeP, + mem_block_t* const sduP) { //----------------------------------------------------------------------------- // third arg should be set to 1 or 0 - return rlc_data_req(enb_module_idP, ue_module_idP, frame, ENB_FLAG_NO, SRB_FLAG_NO, MBMS_FLAG_NO, rb_idP, RLC_MUI_UNDEFINED, RLC_SDU_CONFIRM_NO, sdu_sizeP, sduP); + return rlc_data_req(ctxtP, SRB_FLAG_NO, MBMS_FLAG_NO, rb_idP, RLC_MUI_UNDEFINED, RLC_SDU_CONFIRM_NO, sdu_sizeP, sduP); } diff --git a/openair2/LAYER2/RLC/rlc_rrc.c b/openair2/LAYER2/RLC/rlc_rrc.c index cf29c3add76556c188f261459710ea9fde70da1d..ed9d611fa35014d20c78c8c80125db2f3b93513e 100644 --- a/openair2/LAYER2/RLC/rlc_rrc.c +++ b/openair2/LAYER2/RLC/rlc_rrc.c @@ -56,10 +56,7 @@ #include "LAYER2/MAC/extern.h" #include "assertions.h" //----------------------------------------------------------------------------- -rlc_op_status_t rrc_rlc_config_asn1_req (const module_id_t enb_mod_idP, - const module_id_t ue_mod_idP, - const frame_t frameP, - const eNB_flag_t enb_flagP, +rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP, const SRB_ToAddModList_t * const srb2add_listP, const DRB_ToAddModList_t * const drb2add_listP, const DRB_ToReleaseList_t * const drb2release_listP @@ -90,33 +87,33 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const module_id_t enb_mod_idP #endif LOG_D(RLC, "[FRAME %5u][%s][RLC_RRC][MOD %u/%u] CONFIG REQ ASN1 \n", - frameP, - (enb_flagP) ? "eNB" : "UE", - enb_mod_idP, - ue_mod_idP); + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id); #ifdef OAI_EMU - if (enb_flagP) { - AssertFatal ((enb_mod_idP >= oai_emulation.info.first_enb_local) && (oai_emulation.info.nb_enb_local > 0), + if (ctxt_pP->enb_flag) { + AssertFatal ((ctxt_pP->enb_module_id >= oai_emulation.info.first_enb_local) && (oai_emulation.info.nb_enb_local > 0), "eNB module id is too low (%u/%d)!\n", - enb_mod_idP, + ctxt_pP->enb_module_id, oai_emulation.info.first_enb_local); - AssertFatal ((enb_mod_idP < (oai_emulation.info.first_enb_local + oai_emulation.info.nb_enb_local)) && (oai_emulation.info.nb_enb_local > 0), + AssertFatal ((ctxt_pP->enb_module_id < (oai_emulation.info.first_enb_local + oai_emulation.info.nb_enb_local)) && (oai_emulation.info.nb_enb_local > 0), "eNB module id is too high (%u/%d)!\n", - enb_mod_idP, + ctxt_pP->enb_module_id, oai_emulation.info.first_enb_local + oai_emulation.info.nb_enb_local); - AssertFatal (ue_mod_idP < NB_UE_INST, + AssertFatal (ctxt_pP->ue_module_id < NB_UE_INST, "UE module id is too high (%u/%d)!\n", - ue_mod_idP, + ctxt_pP->ue_module_id, oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local); } else { - AssertFatal (ue_mod_idP < (oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local), + AssertFatal (ctxt_pP->ue_module_id < (oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local), "UE module id is too high (%u/%d)!\n", - ue_mod_idP, + ctxt_pP->ue_module_id, oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local); - AssertFatal (ue_mod_idP >= oai_emulation.info.first_ue_local, + AssertFatal (ctxt_pP->ue_module_id >= oai_emulation.info.first_ue_local, "UE module id is too low (%u/%d)!\n", - ue_mod_idP, + ctxt_pP->ue_module_id, oai_emulation.info.first_ue_local); } #endif @@ -137,125 +134,110 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const module_id_t enb_mod_idP case RLC_Config_PR_NOTHING: break; case RLC_Config_PR_am: - if (rrc_rlc_add_rlc (enb_mod_idP, ue_mod_idP, frameP, enb_flagP, SRB_FLAG_YES, MBMS_FLAG_NO, rb_id, lc_id, RLC_MODE_AM) != NULL) { + if (rrc_rlc_add_rlc (ctxt_pP, SRB_FLAG_YES, MBMS_FLAG_NO, rb_id, lc_id, RLC_MODE_AM) != NULL) { config_req_rlc_am_asn1 ( - enb_mod_idP, - ue_mod_idP, - frameP, - enb_flagP, - SRB_FLAG_YES, - &srb_toaddmod_p->rlc_Config->choice.explicitValue.choice.am, - rb_id); + ctxt_pP, + SRB_FLAG_YES, + &srb_toaddmod_p->rlc_Config->choice.explicitValue.choice.am, + rb_id); } else { LOG_E(RLC, "[FRAME %5u][%s][RLC_RRC][MOD %u/%u] ERROR IN ALLOCATING SRB %d \n", - frameP, - (enb_flagP) ? "eNB" : "UE", - enb_mod_idP, - ue_mod_idP, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rb_id); } break; case RLC_Config_PR_um_Bi_Directional: - if (rrc_rlc_add_rlc (enb_mod_idP, ue_mod_idP, frameP, enb_flagP, SRB_FLAG_YES, MBMS_FLAG_NO, rb_id, lc_id, RLC_MODE_UM) != NULL) { + if (rrc_rlc_add_rlc (ctxt_pP, SRB_FLAG_YES, MBMS_FLAG_NO, rb_id, lc_id, RLC_MODE_UM) != NULL) { config_req_rlc_um_asn1( - enb_mod_idP, - ue_mod_idP, - frameP, - enb_flagP, - SRB_FLAG_YES, - MBMS_FLAG_NO, - UNUSED_PARAM_MBMS_SESSION_ID, - UNUSED_PARAM_MBMS_SERVICE_ID, - &srb_toaddmod_p->rlc_Config->choice.explicitValue.choice.um_Bi_Directional.ul_UM_RLC, - &srb_toaddmod_p->rlc_Config->choice.explicitValue.choice.um_Bi_Directional.dl_UM_RLC, - rb_id); + ctxt_pP, + SRB_FLAG_YES, + MBMS_FLAG_NO, + UNUSED_PARAM_MBMS_SESSION_ID, + UNUSED_PARAM_MBMS_SERVICE_ID, + &srb_toaddmod_p->rlc_Config->choice.explicitValue.choice.um_Bi_Directional.ul_UM_RLC, + &srb_toaddmod_p->rlc_Config->choice.explicitValue.choice.um_Bi_Directional.dl_UM_RLC, + rb_id); } else { LOG_E(RLC, "[FRAME %5u][%s][RLC_RRC][MOD %u/%u] ERROR IN ALLOCATING SRB %d \n", - frameP, - (enb_flagP) ? "eNB" : "UE", - enb_mod_idP, - ue_mod_idP, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rb_id); } break; case RLC_Config_PR_um_Uni_Directional_UL: - if (rrc_rlc_add_rlc (enb_mod_idP, ue_mod_idP, frameP, enb_flagP, SRB_FLAG_YES, MBMS_FLAG_NO, rb_id, lc_id, RLC_MODE_UM) != NULL) { + if (rrc_rlc_add_rlc (ctxt_pP, SRB_FLAG_YES, MBMS_FLAG_NO, rb_id, lc_id, RLC_MODE_UM) != NULL) { config_req_rlc_um_asn1( - enb_mod_idP, - ue_mod_idP, - frameP, - enb_flagP, - SRB_FLAG_YES, - MBMS_FLAG_NO, - UNUSED_PARAM_MBMS_SESSION_ID, - UNUSED_PARAM_MBMS_SERVICE_ID, - &srb_toaddmod_p->rlc_Config->choice.explicitValue.choice.um_Uni_Directional_UL.ul_UM_RLC, - NULL, - rb_id); + ctxt_pP, + SRB_FLAG_YES, + MBMS_FLAG_NO, + UNUSED_PARAM_MBMS_SESSION_ID, + UNUSED_PARAM_MBMS_SERVICE_ID, + &srb_toaddmod_p->rlc_Config->choice.explicitValue.choice.um_Uni_Directional_UL.ul_UM_RLC, + NULL, + rb_id); } else { LOG_E(RLC, "[FRAME %5u][%s][RLC_RRC][MOD %u/%u] ERROR IN ALLOCATING SRB %d \n", - frameP, - (enb_flagP) ? "eNB" : "UE", - enb_mod_idP, - ue_mod_idP, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rb_id); } break; case RLC_Config_PR_um_Uni_Directional_DL: - if (rrc_rlc_add_rlc (enb_mod_idP, ue_mod_idP, frameP, enb_flagP, SRB_FLAG_YES, MBMS_FLAG_NO, rb_id, lc_id, RLC_MODE_UM) != NULL) { + if (rrc_rlc_add_rlc (ctxt_pP, SRB_FLAG_YES, MBMS_FLAG_NO, rb_id, lc_id, RLC_MODE_UM) != NULL) { config_req_rlc_um_asn1( - enb_mod_idP, - ue_mod_idP, - frameP, - enb_flagP, - SRB_FLAG_YES, - MBMS_FLAG_NO, - UNUSED_PARAM_MBMS_SESSION_ID, - UNUSED_PARAM_MBMS_SERVICE_ID, - NULL, - &srb_toaddmod_p->rlc_Config->choice.explicitValue.choice.um_Uni_Directional_DL.dl_UM_RLC, - rb_id); + ctxt_pP, + SRB_FLAG_YES, + MBMS_FLAG_NO, + UNUSED_PARAM_MBMS_SESSION_ID, + UNUSED_PARAM_MBMS_SERVICE_ID, + NULL, + &srb_toaddmod_p->rlc_Config->choice.explicitValue.choice.um_Uni_Directional_DL.dl_UM_RLC, + rb_id); } else { LOG_E(RLC, "[FRAME %5u][%s][RLC_RRC][MOD %u/%u] ERROR IN ALLOCATING SRB %d \n", - frameP, - (enb_flagP) ? "eNB" : "UE", - enb_mod_idP, - ue_mod_idP, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rb_id); } break; default: LOG_E(RLC, "[FRAME %5u][%s][RLC_RRC][MOD %u/%u] UNKNOWN RLC CONFIG %d \n", - frameP, - (enb_flagP) ? "eNB" : "UE", - enb_mod_idP, - ue_mod_idP, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, srb_toaddmod_p->rlc_Config->choice.explicitValue.present); break; } break; case SRB_ToAddMod__rlc_Config_PR_defaultValue: #warning TO DO SRB_ToAddMod__rlc_Config_PR_defaultValue - if (rrc_rlc_add_rlc (enb_mod_idP, ue_mod_idP, frameP, enb_flagP, SRB_FLAG_YES, MBMS_FLAG_NO, rb_id, lc_id, RLC_MODE_UM) != NULL) { + if (rrc_rlc_add_rlc (ctxt_pP, SRB_FLAG_YES, MBMS_FLAG_NO, rb_id, lc_id, RLC_MODE_UM) != NULL) { config_req_rlc_um_asn1( - enb_mod_idP, - ue_mod_idP, - frameP, - enb_flagP, - SRB_FLAG_YES, - MBMS_FLAG_NO, - UNUSED_PARAM_MBMS_SESSION_ID, - UNUSED_PARAM_MBMS_SERVICE_ID, - NULL, // TO DO DEFAULT CONFIG - NULL, // TO DO DEFAULT CONFIG - rb_id); + ctxt_pP, + SRB_FLAG_YES, + MBMS_FLAG_NO, + UNUSED_PARAM_MBMS_SESSION_ID, + UNUSED_PARAM_MBMS_SERVICE_ID, + NULL, // TO DO DEFAULT CONFIG + NULL, // TO DO DEFAULT CONFIG + rb_id); } else { LOG_D(RLC, "[FRAME %5u][%s][RLC_RRC][MOD %u/%u] ERROR IN ALLOCATING SRB %d \n", - frameP, - (enb_flagP) ? "eNB" : "UE", - enb_mod_idP, - ue_mod_idP, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rb_id); } break; @@ -280,71 +262,59 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const module_id_t enb_mod_idP case RLC_Config_PR_NOTHING: break; case RLC_Config_PR_am: - if (rrc_rlc_add_rlc (enb_mod_idP, ue_mod_idP, frameP, enb_flagP, SRB_FLAG_NO, MBMS_FLAG_NO, drb_id, lc_id, RLC_MODE_AM) != NULL) { + if (rrc_rlc_add_rlc (ctxt_pP, SRB_FLAG_NO, MBMS_FLAG_NO, drb_id, lc_id, RLC_MODE_AM) != NULL) { config_req_rlc_am_asn1 ( - enb_mod_idP, - ue_mod_idP, - frameP, - enb_flagP, - SRB_FLAG_NO, - &drb_toaddmod_p->rlc_Config->choice.am, - drb_id); + ctxt_pP, + SRB_FLAG_NO, + &drb_toaddmod_p->rlc_Config->choice.am, + drb_id); } break; case RLC_Config_PR_um_Bi_Directional: - if (rrc_rlc_add_rlc (enb_mod_idP, ue_mod_idP, frameP, enb_flagP, SRB_FLAG_NO, MBMS_FLAG_NO, drb_id, lc_id, RLC_MODE_UM) != NULL) { + if (rrc_rlc_add_rlc (ctxt_pP, SRB_FLAG_NO, MBMS_FLAG_NO, drb_id, lc_id, RLC_MODE_UM) != NULL) { config_req_rlc_um_asn1( - enb_mod_idP, - ue_mod_idP, - frameP, - enb_flagP, - SRB_FLAG_NO, - MBMS_FLAG_NO, - UNUSED_PARAM_MBMS_SESSION_ID, - UNUSED_PARAM_MBMS_SERVICE_ID, - &drb_toaddmod_p->rlc_Config->choice.um_Bi_Directional.ul_UM_RLC, - &drb_toaddmod_p->rlc_Config->choice.um_Bi_Directional.dl_UM_RLC, - drb_id); + ctxt_pP, + SRB_FLAG_NO, + MBMS_FLAG_NO, + UNUSED_PARAM_MBMS_SESSION_ID, + UNUSED_PARAM_MBMS_SERVICE_ID, + &drb_toaddmod_p->rlc_Config->choice.um_Bi_Directional.ul_UM_RLC, + &drb_toaddmod_p->rlc_Config->choice.um_Bi_Directional.dl_UM_RLC, + drb_id); } break; case RLC_Config_PR_um_Uni_Directional_UL: - if (rrc_rlc_add_rlc (enb_mod_idP, ue_mod_idP, frameP, enb_flagP, SRB_FLAG_NO, MBMS_FLAG_NO, drb_id, lc_id, RLC_MODE_UM) != NULL) { + if (rrc_rlc_add_rlc (ctxt_pP, SRB_FLAG_NO, MBMS_FLAG_NO, drb_id, lc_id, RLC_MODE_UM) != NULL) { config_req_rlc_um_asn1( - enb_mod_idP, - ue_mod_idP, - frameP, - enb_flagP, - SRB_FLAG_NO, - MBMS_FLAG_NO, - UNUSED_PARAM_MBMS_SESSION_ID, - UNUSED_PARAM_MBMS_SERVICE_ID, - &drb_toaddmod_p->rlc_Config->choice.um_Uni_Directional_UL.ul_UM_RLC, - NULL, - drb_id); + ctxt_pP, + SRB_FLAG_NO, + MBMS_FLAG_NO, + UNUSED_PARAM_MBMS_SESSION_ID, + UNUSED_PARAM_MBMS_SERVICE_ID, + &drb_toaddmod_p->rlc_Config->choice.um_Uni_Directional_UL.ul_UM_RLC, + NULL, + drb_id); } break; case RLC_Config_PR_um_Uni_Directional_DL: - if (rrc_rlc_add_rlc (enb_mod_idP, ue_mod_idP, frameP, enb_flagP, SRB_FLAG_NO, MBMS_FLAG_NO, drb_id, lc_id, RLC_MODE_UM) != NULL) { + if (rrc_rlc_add_rlc (ctxt_pP, SRB_FLAG_NO, MBMS_FLAG_NO, drb_id, lc_id, RLC_MODE_UM) != NULL) { config_req_rlc_um_asn1( - enb_mod_idP, - ue_mod_idP, - frameP, - enb_flagP, - SRB_FLAG_NO, - MBMS_FLAG_NO, - UNUSED_PARAM_MBMS_SESSION_ID, - UNUSED_PARAM_MBMS_SERVICE_ID, - NULL, - &drb_toaddmod_p->rlc_Config->choice.um_Uni_Directional_DL.dl_UM_RLC, - drb_id); + ctxt_pP, + SRB_FLAG_NO, + MBMS_FLAG_NO, + UNUSED_PARAM_MBMS_SESSION_ID, + UNUSED_PARAM_MBMS_SERVICE_ID, + NULL, + &drb_toaddmod_p->rlc_Config->choice.um_Uni_Directional_DL.dl_UM_RLC, + drb_id); } break; default: LOG_W(RLC, "[FRAME %5u][%s][RLC_RRC][MOD %u/%u][RB %u] unknown drb_toaddmod_p->rlc_Config->present \n", - frameP, - (enb_flagP) ? "eNB" : "UE", - enb_mod_idP, - ue_mod_idP, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, drb_id); } } @@ -353,7 +323,11 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const module_id_t enb_mod_idP if (drb2release_listP != NULL) { for (cnt=0;cnt<drb2release_listP->list.count;cnt++) { pdrb_id = drb2release_listP->list.array[cnt]; - rrc_rlc_remove_rlc(enb_mod_idP, ue_mod_idP, frameP, enb_flagP, SRB_FLAG_NO, MBMS_FLAG_NO, *pdrb_id); + rrc_rlc_remove_rlc( + ctxt_pP, + SRB_FLAG_NO, + MBMS_FLAG_NO, + *pdrb_id); } } @@ -369,40 +343,37 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const module_id_t enb_mod_idP mbms_service_id = MBMS_SessionInfo_p->tmgi_r9.serviceId_r9.buf[2]; //serviceId is 3-octet string // can set the mch_id = i - if (enb_flagP) { + if (ctxt_pP->enb_flag) { rb_id = (mbms_service_id * maxSessionPerPMCH ) + mbms_session_id;//+ (maxDRB + 3) * MAX_MOBILES_PER_ENB; // 1 - rlc_mbms_lcid2service_session_id_eNB[enb_mod_idP][lc_id].service_id = mbms_service_id; - rlc_mbms_lcid2service_session_id_eNB[enb_mod_idP][lc_id].session_id = mbms_session_id; + rlc_mbms_lcid2service_session_id_eNB[ctxt_pP->enb_module_id][lc_id].service_id = mbms_service_id; + rlc_mbms_lcid2service_session_id_eNB[ctxt_pP->enb_module_id][lc_id].session_id = mbms_session_id; - rlc_mbms_enb_set_lcid_by_rb_id(enb_mod_idP,rb_id,lc_id); + rlc_mbms_enb_set_lcid_by_rb_id(ctxt_pP->enb_module_id,rb_id,lc_id); } else { rb_id = (mbms_service_id * maxSessionPerPMCH ) + mbms_session_id; // + (maxDRB + 3); // 15 - rlc_mbms_lcid2service_session_id_ue[ue_mod_idP][lc_id].service_id = mbms_service_id; - rlc_mbms_lcid2service_session_id_ue[ue_mod_idP][lc_id].session_id = mbms_session_id; - rlc_mbms_ue_set_lcid_by_rb_id(ue_mod_idP,rb_id,lc_id); + rlc_mbms_lcid2service_session_id_ue[ctxt_pP->ue_module_id][lc_id].service_id = mbms_service_id; + rlc_mbms_lcid2service_session_id_ue[ctxt_pP->ue_module_id][lc_id].session_id = mbms_session_id; + rlc_mbms_ue_set_lcid_by_rb_id(ctxt_pP->ue_module_id,rb_id,lc_id); } - key = RLC_COLL_KEY_MBMS_VALUE(enb_mod_idP, ue_mod_idP, enb_flagP, mbms_service_id, mbms_session_id); + key = RLC_COLL_KEY_MBMS_VALUE(ctxt_pP->enb_module_id, ctxt_pP->ue_module_id, ctxt_pP->enb_flag, mbms_service_id, mbms_session_id); h_rc = hashtable_get(rlc_coll_p, key, (void**)&rlc_union_p); if (h_rc == HASH_TABLE_KEY_NOT_EXISTS) { rlc_union_p = rrc_rlc_add_rlc ( - enb_mod_idP, - ue_mod_idP, - frameP, - enb_flagP, - SRB_FLAG_NO, - MBMS_FLAG_YES, - rb_id, - lc_id, - RLC_MODE_UM); + ctxt_pP, + SRB_FLAG_NO, + MBMS_FLAG_YES, + rb_id, + lc_id, + RLC_MODE_UM); AssertFatal(rlc_union_p != NULL, "ADD MBMS RLC UM FAILED"); } LOG_D(RLC, "[FRAME %5u][%s][RLC_RRC][MOD %u/%u] CONFIG REQ MBMS ASN1 LC ID %u RB ID %u SESSION ID %u SERVICE ID %u\n", - frameP, - (enb_flagP) ? "eNB" : "UE", - enb_mod_idP, - ue_mod_idP, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, lc_id, rb_id, mbms_session_id, @@ -412,33 +383,32 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const module_id_t enb_mod_idP dl_um_rlc.t_Reordering = T_Reordering_ms0; config_req_rlc_um_asn1 ( - enb_mod_idP, - ue_mod_idP, - frameP, - enb_flagP, - SRB_FLAG_NO, - MBMS_FLAG_YES, - mbms_session_id, - mbms_service_id, - NULL, - &dl_um_rlc, - rb_id); + ctxt_pP, + SRB_FLAG_NO, + MBMS_FLAG_YES, + mbms_session_id, + mbms_service_id, + NULL, + &dl_um_rlc, + rb_id); } } } #endif LOG_D(RLC, "[FRAME %5u][%s][RLC_RRC][MOD %u/%u] CONFIG REQ ASN1 END \n", - frameP, - (enb_flagP) ? "eNB" : "UE", - enb_flagP, - enb_mod_idP, - ue_mod_idP); + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_flag, + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id); return RLC_OP_STATUS_OK; } //----------------------------------------------------------------------------- void -rb_free_rlc_union (void *rlcu_pP) +rb_free_rlc_union ( + const protocol_ctxt_t* const ctxt_pP, + void *rlcu_pP) { //----------------------------------------------------------------------------- rlc_union_t * rlcu_p; @@ -446,13 +416,13 @@ rb_free_rlc_union (void *rlcu_pP) rlcu_p = (rlc_union_t *)(rlcu_pP); switch (rlcu_p->mode) { case RLC_MODE_AM: - rlc_am_cleanup(&rlcu_p->rlc.am); + rlc_am_cleanup(ctxt_pP, &rlcu_p->rlc.am); break; case RLC_MODE_UM: - rlc_um_cleanup(&rlcu_p->rlc.um); + rlc_um_cleanup(ctxt_pP, &rlcu_p->rlc.um); break; case RLC_MODE_TM: - rlc_tm_cleanup(&rlcu_p->rlc.tm); + rlc_tm_cleanup(ctxt_pP, &rlcu_p->rlc.tm); break; default: LOG_W(RLC, @@ -471,27 +441,18 @@ rb_free_rlc_union (void *rlcu_pP) //----------------------------------------------------------------------------- rlc_op_status_t rrc_rlc_remove_ue ( - const module_id_t enb_mod_idP, - const module_id_t ue_mod_idP, - const frame_t frameP, - const eNB_flag_t enb_flagP) { + const protocol_ctxt_t* const ctxt_pP) { //----------------------------------------------------------------------------- rb_id_t rb_id; for (rb_id = 1; rb_id <= 2; rb_id++) { - rrc_rlc_remove_rlc(enb_mod_idP, - ue_mod_idP, - frameP, - enb_flagP, + rrc_rlc_remove_rlc(ctxt_pP, SRB_FLAG_YES, MBMS_FLAG_NO, rb_id); } for (rb_id = 1; rb_id <= maxDRB; rb_id++) { - rrc_rlc_remove_rlc(enb_mod_idP, - ue_mod_idP, - frameP, - enb_flagP, + rrc_rlc_remove_rlc(ctxt_pP, SRB_FLAG_NO, MBMS_FLAG_NO, rb_id); @@ -501,13 +462,10 @@ rlc_op_status_t rrc_rlc_remove_ue ( //----------------------------------------------------------------------------- rlc_op_status_t rrc_rlc_remove_rlc ( - const module_id_t enb_mod_idP, - const module_id_t ue_mod_idP, - const frame_t frameP, - const eNB_flag_t enb_flagP, - const srb_flag_t srb_flagP, - const MBMS_flag_t MBMS_flagP, - const rb_id_t rb_idP) { + const protocol_ctxt_t* const ctxt_pP, + const srb_flag_t srb_flagP, + const MBMS_flag_t MBMS_flagP, + const rb_id_t rb_idP) { //----------------------------------------------------------------------------- logical_chan_id_t lcid = 0; hash_key_t key = HASHTABLE_QUESTIONABLE_KEY_VALUE; @@ -517,53 +475,53 @@ rlc_op_status_t rrc_rlc_remove_rlc ( rlc_mbms_id_t *mbms_id_p = NULL; #endif #ifdef OAI_EMU - AssertFatal ((enb_mod_idP >= oai_emulation.info.first_enb_local) && (oai_emulation.info.nb_enb_local > 0), + AssertFatal ((ctxt_pP->enb_module_id >= oai_emulation.info.first_enb_local) && (oai_emulation.info.nb_enb_local > 0), "eNB module id is too low (%u/%d)!\n", - enb_mod_idP, + ctxt_pP->enb_module_id, oai_emulation.info.first_enb_local); - AssertFatal (enb_mod_idP < (oai_emulation.info.first_enb_local + oai_emulation.info.nb_enb_local), + AssertFatal (ctxt_pP->enb_module_id < (oai_emulation.info.first_enb_local + oai_emulation.info.nb_enb_local), "eNB module id is too high (%u/%d)!\n", - enb_mod_idP, + ctxt_pP->enb_module_id, oai_emulation.info.first_enb_local + oai_emulation.info.nb_enb_local); - if (enb_flagP) { - AssertFatal (ue_mod_idP < NB_UE_INST, + if (ctxt_pP->enb_flag) { + AssertFatal (ctxt_pP->ue_module_id < NB_UE_INST, "UE module id is too high (%u/%d)!\n", - ue_mod_idP, + ctxt_pP->ue_module_id, oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local); } else { - AssertFatal (ue_mod_idP < (oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local), + AssertFatal (ctxt_pP->ue_module_id < (oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local), "UE module id is too high (%u/%d)!\n", - ue_mod_idP, + ctxt_pP->ue_module_id, oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local); - AssertFatal (ue_mod_idP >= oai_emulation.info.first_ue_local, + AssertFatal (ctxt_pP->ue_module_id >= oai_emulation.info.first_ue_local, "UE module id is too low (%u/%d)!\n", - ue_mod_idP, + ctxt_pP->ue_module_id, oai_emulation.info.first_ue_local); } #endif #ifdef Rel10 if (MBMS_flagP == TRUE) { - if (enb_flagP) { - lcid = rlc_mbms_enb_get_lcid_by_rb_id(enb_mod_idP,rb_idP); - mbms_id_p = &rlc_mbms_lcid2service_session_id_eNB[enb_mod_idP][lcid]; + if (ctxt_pP->enb_flag) { + lcid = rlc_mbms_enb_get_lcid_by_rb_id(ctxt_pP->enb_module_id,rb_idP); + mbms_id_p = &rlc_mbms_lcid2service_session_id_eNB[ctxt_pP->enb_module_id][lcid]; - rlc_mbms_lcid2service_session_id_eNB[enb_mod_idP][lcid].service_id = 0; - rlc_mbms_lcid2service_session_id_eNB[enb_mod_idP][lcid].session_id = 0; - rlc_mbms_rbid2lcid_ue[enb_mod_idP][rb_idP] = RLC_LC_UNALLOCATED; + rlc_mbms_lcid2service_session_id_eNB[ctxt_pP->enb_module_id][lcid].service_id = 0; + rlc_mbms_lcid2service_session_id_eNB[ctxt_pP->enb_module_id][lcid].session_id = 0; + rlc_mbms_rbid2lcid_ue[ctxt_pP->enb_module_id][rb_idP] = RLC_LC_UNALLOCATED; } else { - lcid = rlc_mbms_ue_get_lcid_by_rb_id(ue_mod_idP,rb_idP); - mbms_id_p = &rlc_mbms_lcid2service_session_id_ue[ue_mod_idP][lcid]; + lcid = rlc_mbms_ue_get_lcid_by_rb_id(ctxt_pP->ue_module_id,rb_idP); + mbms_id_p = &rlc_mbms_lcid2service_session_id_ue[ctxt_pP->ue_module_id][lcid]; - rlc_mbms_lcid2service_session_id_eNB[ue_mod_idP][lcid].service_id = 0; - rlc_mbms_lcid2service_session_id_eNB[ue_mod_idP][lcid].session_id = 0; - rlc_mbms_rbid2lcid_ue[ue_mod_idP][rb_idP] = RLC_LC_UNALLOCATED; + rlc_mbms_lcid2service_session_id_eNB[ctxt_pP->ue_module_id][lcid].service_id = 0; + rlc_mbms_lcid2service_session_id_eNB[ctxt_pP->ue_module_id][lcid].session_id = 0; + rlc_mbms_rbid2lcid_ue[ctxt_pP->ue_module_id][rb_idP] = RLC_LC_UNALLOCATED; } - key = RLC_COLL_KEY_MBMS_VALUE(enb_mod_idP, ue_mod_idP, enb_flagP, mbms_id_p->service_id, mbms_id_p->session_id); + key = RLC_COLL_KEY_MBMS_VALUE(ctxt_pP->enb_module_id, ctxt_pP->ue_module_id, ctxt_pP->enb_flag, mbms_id_p->service_id, mbms_id_p->session_id); } else #endif { - key = RLC_COLL_KEY_VALUE(enb_mod_idP, ue_mod_idP, enb_flagP, rb_idP, srb_flagP); + key = RLC_COLL_KEY_VALUE(ctxt_pP->enb_module_id, ctxt_pP->ue_module_id, ctxt_pP->enb_flag, rb_idP, srb_flagP); } @@ -573,41 +531,41 @@ rlc_op_status_t rrc_rlc_remove_rlc ( if (h_rc == HASH_TABLE_OK) { switch (rlc_union_p->mode) { case RLC_MODE_AM: - rlc_am_cleanup(&rlc_union_p->rlc.am); + rlc_am_cleanup(ctxt_pP, &rlc_union_p->rlc.am); break; case RLC_MODE_UM: - rlc_um_cleanup(&rlc_union_p->rlc.um); + rlc_um_cleanup(ctxt_pP, &rlc_union_p->rlc.um); break; case RLC_MODE_TM: - rlc_tm_cleanup(&rlc_union_p->rlc.tm); + rlc_tm_cleanup(ctxt_pP, &rlc_union_p->rlc.tm); break; default: break; } h_rc = hashtable_remove(rlc_coll_p, key); LOG_D(RLC, "[Frame %05u][%s][RLC_RRC][INST %u/%u][%s %u] RELEASED %s\n", - frameP, - (enb_flagP) ? "eNB" : "UE", - enb_mod_idP, - ue_mod_idP, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, (srb_flagP) ? "SRB" : "DRB", rb_idP, (srb_flagP) ? "SRB" : "DRB"); } else if (h_rc == HASH_TABLE_KEY_NOT_EXISTS) { LOG_W(RLC, "[Frame %05u][%s][RLC_RRC][INST %u/%u][%s %u] RELEASE : RLC NOT FOUND %s\n", - frameP, - (enb_flagP) ? "eNB" : "UE", - enb_mod_idP, - ue_mod_idP, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, (srb_flagP) ? "SRB" : "DRB", rb_idP, (srb_flagP) ? "SRB" : "DRB"); } else { LOG_E(RLC, "[Frame %05u][%s][RLC_RRC][INST %u/%u][%s %u] RELEASE : INTERNAL ERROR %s\n", - frameP, - (enb_flagP) ? "eNB" : "UE", - enb_mod_idP, - ue_mod_idP, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, (srb_flagP) ? "SRB" : "DRB", rb_idP, (srb_flagP) ? "SRB" : "DRB"); } @@ -616,15 +574,12 @@ rlc_op_status_t rrc_rlc_remove_rlc ( } //----------------------------------------------------------------------------- rlc_union_t* rrc_rlc_add_rlc ( - const module_id_t enb_mod_idP, - const module_id_t ue_mod_idP, - const frame_t frameP, - const eNB_flag_t enb_flagP, - const srb_flag_t srb_flagP, - const MBMS_flag_t MBMS_flagP, - const rb_id_t rb_idP, - const logical_chan_id_t chan_idP, - const rlc_mode_t rlc_modeP) { + const protocol_ctxt_t* const ctxt_pP, + const srb_flag_t srb_flagP, + const MBMS_flag_t MBMS_flagP, + const rb_id_t rb_idP, + const logical_chan_id_t chan_idP, + const rlc_mode_t rlc_modeP) { //----------------------------------------------------------------------------- hash_key_t key = HASHTABLE_QUESTIONABLE_KEY_VALUE; hashtable_rc_t h_rc; @@ -635,27 +590,27 @@ rlc_union_t* rrc_rlc_add_rlc ( #endif #ifdef OAI_EMU - if (enb_flagP) { - AssertFatal ((enb_mod_idP >= oai_emulation.info.first_enb_local) && (oai_emulation.info.nb_enb_local > 0), + if (ctxt_pP->enb_flag) { + AssertFatal ((ctxt_pP->enb_module_id >= oai_emulation.info.first_enb_local) && (oai_emulation.info.nb_enb_local > 0), "eNB module id is too low (%u/%d)!\n", - enb_mod_idP, + ctxt_pP->enb_module_id, oai_emulation.info.first_enb_local); - AssertFatal ((enb_mod_idP < (oai_emulation.info.first_enb_local + oai_emulation.info.nb_enb_local)) && (oai_emulation.info.nb_enb_local > 0), + AssertFatal ((ctxt_pP->enb_module_id < (oai_emulation.info.first_enb_local + oai_emulation.info.nb_enb_local)) && (oai_emulation.info.nb_enb_local > 0), "eNB module id is too high (%u/%d)!\n", - enb_mod_idP, + ctxt_pP->enb_module_id, oai_emulation.info.first_enb_local + oai_emulation.info.nb_enb_local); - AssertFatal (ue_mod_idP < NB_UE_INST, + AssertFatal (ctxt_pP->ue_module_id < NB_UE_INST, "UE module id is too high (%u/%d)!\n", - ue_mod_idP, + ctxt_pP->ue_module_id, oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local); } else { - AssertFatal (ue_mod_idP < (oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local), + AssertFatal (ctxt_pP->ue_module_id < (oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local), "UE module id is too high (%u/%d)!\n", - ue_mod_idP, + ctxt_pP->ue_module_id, oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local); - AssertFatal (ue_mod_idP >= oai_emulation.info.first_ue_local, + AssertFatal (ctxt_pP->ue_module_id >= oai_emulation.info.first_ue_local, "UE module id is too low (%u/%d)!\n", - ue_mod_idP, + ctxt_pP->ue_module_id, oai_emulation.info.first_ue_local); } #endif @@ -666,39 +621,39 @@ rlc_union_t* rrc_rlc_add_rlc ( #ifdef Rel10 if (MBMS_flagP == TRUE) { - if (enb_flagP) { - lcid = rlc_mbms_enb_get_lcid_by_rb_id(enb_mod_idP,rb_idP); + if (ctxt_pP->enb_flag) { + lcid = rlc_mbms_enb_get_lcid_by_rb_id(ctxt_pP->enb_module_id,rb_idP); LOG_I(RLC, - "[Frame %05u] lcid %d = rlc_mbms_enb_get_lcid_by_rb_id(enb_mod_idP %u, rb_idP %u)\n", - frameP,lcid, enb_mod_idP, rb_idP); + "[Frame %05u] lcid %d = rlc_mbms_enb_get_lcid_by_rb_id(ctxt_pP->enb_module_id %u, rb_idP %u)\n", + ctxt_pP->frame,lcid, ctxt_pP->enb_module_id, rb_idP); - mbms_id_p = &rlc_mbms_lcid2service_session_id_eNB[enb_mod_idP][lcid]; + mbms_id_p = &rlc_mbms_lcid2service_session_id_eNB[ctxt_pP->enb_module_id][lcid]; - //LG 2014-04-15rlc_mbms_lcid2service_session_id_eNB[enb_mod_idP][lcid].service_id = 0; - //LG 2014-04-15rlc_mbms_lcid2service_session_id_eNB[enb_mod_idP][lcid].session_id = 0; - //LG 2014-04-15rlc_mbms_rbid2lcid_eNB[enb_mod_idP][rb_idP] = RLC_LC_UNALLOCATED; + //LG 2014-04-15rlc_mbms_lcid2service_session_id_eNB[ctxt_pP->enb_module_id][lcid].service_id = 0; + //LG 2014-04-15rlc_mbms_lcid2service_session_id_eNB[ctxt_pP->enb_module_id][lcid].session_id = 0; + //LG 2014-04-15rlc_mbms_rbid2lcid_eNB[ctxt_pP->enb_module_id][rb_idP] = RLC_LC_UNALLOCATED; } else { - lcid = rlc_mbms_ue_get_lcid_by_rb_id(ue_mod_idP,rb_idP); - mbms_id_p = &rlc_mbms_lcid2service_session_id_ue[ue_mod_idP][lcid]; + lcid = rlc_mbms_ue_get_lcid_by_rb_id(ctxt_pP->ue_module_id,rb_idP); + mbms_id_p = &rlc_mbms_lcid2service_session_id_ue[ctxt_pP->ue_module_id][lcid]; - //LG 2014-04-15rlc_mbms_lcid2service_session_id_eNB[ue_mod_idP][lcid].service_id = 0; - //LG 2014-04-15rlc_mbms_lcid2service_session_id_eNB[ue_mod_idP][lcid].session_id = 0; - //LG 2014-04-15rlc_mbms_rbid2lcid_ue[ue_mod_idP][rb_idP] = RLC_LC_UNALLOCATED; + //LG 2014-04-15rlc_mbms_lcid2service_session_id_eNB[ctxt_pP->ue_module_id][lcid].service_id = 0; + //LG 2014-04-15rlc_mbms_lcid2service_session_id_eNB[ctxt_pP->ue_module_id][lcid].session_id = 0; + //LG 2014-04-15rlc_mbms_rbid2lcid_ue[ctxt_pP->ue_module_id][rb_idP] = RLC_LC_UNALLOCATED; } - key = RLC_COLL_KEY_MBMS_VALUE(enb_mod_idP, ue_mod_idP, enb_flagP, mbms_id_p->service_id, mbms_id_p->session_id); + key = RLC_COLL_KEY_MBMS_VALUE(ctxt_pP->enb_module_id, ctxt_pP->ue_module_id, ctxt_pP->enb_flag, mbms_id_p->service_id, mbms_id_p->session_id); } else #endif { - key = RLC_COLL_KEY_VALUE(enb_mod_idP, ue_mod_idP, enb_flagP, rb_idP, srb_flagP); + key = RLC_COLL_KEY_VALUE(ctxt_pP->enb_module_id, ctxt_pP->ue_module_id, ctxt_pP->enb_flag, rb_idP, srb_flagP); } h_rc = hashtable_get(rlc_coll_p, key, (void**)&rlc_union_p); if (h_rc == HASH_TABLE_OK) { LOG_W(RLC, "[Frame %05u][%s][RLC_RRC][INST %u/%u][%s %u] rrc_rlc_add_rlc , already exist %s\n", - frameP, - (enb_flagP) ? "eNB" : "UE", - enb_mod_idP, - ue_mod_idP, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, (srb_flagP) ? "SRB" : "DRB", rb_idP, (srb_flagP) ? "SRB" : "DRB"); @@ -711,20 +666,20 @@ rlc_union_t* rrc_rlc_add_rlc ( #ifdef Rel10 if (MBMS_flagP == TRUE) { LOG_I(RLC, "[Frame %05u][%s][RLC_RRC][INST %u/%u] RLC service id %u session id %u rrc_rlc_add_rlc\n", - frameP, - (enb_flagP) ? "eNB" : "UE", - enb_mod_idP, - ue_mod_idP, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, mbms_id_p->service_id, mbms_id_p->session_id); } else #endif { LOG_I(RLC, "[Frame %05u][%s][RLC_RRC][INST %u/%u][%s %u] rrc_rlc_add_rlc %s\n", - frameP, - (enb_flagP) ? "eNB" : "UE", - enb_mod_idP, - ue_mod_idP, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, (srb_flagP) ? "SRB" : "DRB", rb_idP, (srb_flagP) ? "SRB" : "DRB"); @@ -733,10 +688,10 @@ rlc_union_t* rrc_rlc_add_rlc ( return rlc_union_p; } else { LOG_E(RLC, "[Frame %05u][%s][RLC_RRC][INST %u/%u][%s %u] rrc_rlc_add_rlc FAILED %s\n", - frameP, - (enb_flagP) ? "eNB" : "UE", - enb_mod_idP, - ue_mod_idP, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, (srb_flagP) ? "SRB" : "DRB", rb_idP, (srb_flagP) ? "SRB" : "DRB"); @@ -746,10 +701,10 @@ rlc_union_t* rrc_rlc_add_rlc ( } } else { LOG_E(RLC, "[Frame %05u][%s][RLC_RRC][INST %u/%u][%s %u] rrc_rlc_add_rlc , INTERNAL ERROR %s\n", - frameP, - (enb_flagP) ? "eNB" : "UE", - enb_mod_idP, - ue_mod_idP, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, (srb_flagP) ? "SRB" : "DRB", rb_idP, (srb_flagP) ? "SRB" : "DRB"); @@ -758,47 +713,44 @@ rlc_union_t* rrc_rlc_add_rlc ( } //----------------------------------------------------------------------------- rlc_op_status_t rrc_rlc_config_req ( - const module_id_t enb_mod_idP, - const module_id_t ue_mod_idP, - const frame_t frameP, - const eNB_flag_t enb_flagP, - const srb_flag_t srb_flagP, - const MBMS_flag_t mbms_flagP, - const config_action_t actionP, - const rb_id_t rb_idP, - const rlc_info_t rlc_infoP) { + const protocol_ctxt_t* const ctxt_pP, + const srb_flag_t srb_flagP, + const MBMS_flag_t mbms_flagP, + const config_action_t actionP, + const rb_id_t rb_idP, + const rlc_info_t rlc_infoP) { //----------------------------------------------------------------------------- rlc_op_status_t status; LOG_D(RLC, "[FRAME %05u][%s][RLC][MOD %u/%u] CONFIG_REQ for Rab %u\n", - frameP, - (enb_flagP) ? "eNB" : "UE", - enb_mod_idP, - ue_mod_idP, + ctxt_pP->frame, + (ctxt_pP->enb_flag) ? "eNB" : "UE", + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rb_idP); #ifdef OAI_EMU - if (enb_flagP) { - AssertFatal ((enb_mod_idP >= oai_emulation.info.first_enb_local) && (oai_emulation.info.nb_enb_local > 0), + if (ctxt_pP->enb_flag) { + AssertFatal ((ctxt_pP->enb_module_id >= oai_emulation.info.first_enb_local) && (oai_emulation.info.nb_enb_local > 0), "eNB module id is too low (%u/%d)!\n", - enb_mod_idP, + ctxt_pP->enb_module_id, oai_emulation.info.first_enb_local); - AssertFatal ((enb_mod_idP < (oai_emulation.info.first_enb_local + oai_emulation.info.nb_enb_local)) && (oai_emulation.info.nb_enb_local > 0), + AssertFatal ((ctxt_pP->enb_module_id < (oai_emulation.info.first_enb_local + oai_emulation.info.nb_enb_local)) && (oai_emulation.info.nb_enb_local > 0), "eNB module id is too high (%u/%d)!\n", - enb_mod_idP, + ctxt_pP->enb_module_id, oai_emulation.info.first_enb_local + oai_emulation.info.nb_enb_local); - AssertFatal (ue_mod_idP < NB_UE_INST, + AssertFatal (ctxt_pP->ue_module_id < NB_UE_INST, "UE module id is too high (%u/%d)!\n", - ue_mod_idP, + ctxt_pP->ue_module_id, oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local); } else { - AssertFatal (ue_mod_idP < (oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local), + AssertFatal (ctxt_pP->ue_module_id < (oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local), "UE module id is too high (%u/%d)!\n", - ue_mod_idP, + ctxt_pP->ue_module_id, oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local); - AssertFatal (ue_mod_idP >= oai_emulation.info.first_ue_local, + AssertFatal (ctxt_pP->ue_module_id >= oai_emulation.info.first_ue_local, "UE module id is too low (%u/%d)!\n", - ue_mod_idP, + ctxt_pP->ue_module_id, oai_emulation.info.first_ue_local); } #endif @@ -806,7 +758,7 @@ rlc_op_status_t rrc_rlc_config_req ( switch (actionP) { case CONFIG_ACTION_ADD: - if (rrc_rlc_add_rlc(enb_mod_idP, ue_mod_idP, frameP, enb_flagP, srb_flagP, MBMS_FLAG_NO, rb_idP, rb_idP, rlc_infoP.rlc_mode) != NULL) { + if (rrc_rlc_add_rlc(ctxt_pP, srb_flagP, MBMS_FLAG_NO, rb_idP, rb_idP, rlc_infoP.rlc_mode) != NULL) { return RLC_OP_STATUS_INTERNAL_ERROR; } // no break, fall to next case @@ -814,49 +766,40 @@ rlc_op_status_t rrc_rlc_config_req ( switch (rlc_infoP.rlc_mode) { case RLC_MODE_AM: LOG_I(RLC, "[Frame %05u][UE][RLC_RRC][INST %u/%u][RB %u] MODIFY RB AM\n", - frameP, - enb_mod_idP, - ue_mod_idP, + ctxt_pP->frame, + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rb_idP); config_req_rlc_am( - enb_mod_idP, - ue_mod_idP, - frameP, - enb_flagP, - srb_flagP, - &rlc_infoP.rlc.rlc_am_info, - rb_idP); + ctxt_pP, + srb_flagP, + &rlc_infoP.rlc.rlc_am_info, + rb_idP); break; case RLC_MODE_UM: LOG_I(RLC, "[Frame %05u][UE][RLC_RRC][INST %u/%u][RB %u] MODIFY RB UM\n", - frameP, - enb_mod_idP, - ue_mod_idP, + ctxt_pP->frame, + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rb_idP); config_req_rlc_um( - enb_mod_idP, - ue_mod_idP, - frameP, - enb_flagP, - srb_flagP, - &rlc_infoP.rlc.rlc_um_info, - rb_idP); + ctxt_pP, + srb_flagP, + &rlc_infoP.rlc.rlc_um_info, + rb_idP); break; case RLC_MODE_TM: LOG_I(RLC, "[Frame %05u][UE][RLC_RRC][INST %u/%u][RB %u] MODIFY RB TM\n", - frameP, - enb_mod_idP, - ue_mod_idP, + ctxt_pP->frame, + ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, rb_idP); config_req_rlc_tm( - enb_mod_idP, - ue_mod_idP, - frameP, - enb_flagP, - srb_flagP, - &rlc_infoP.rlc.rlc_tm_info, - rb_idP); + ctxt_pP, + srb_flagP, + &rlc_infoP.rlc.rlc_tm_info, + rb_idP); break; default: return RLC_OP_STATUS_BAD_PARAMETER; @@ -864,7 +807,7 @@ rlc_op_status_t rrc_rlc_config_req ( break; case CONFIG_ACTION_REMOVE: - return rrc_rlc_remove_rlc(enb_mod_idP, ue_mod_idP, frameP, enb_flagP, srb_flagP, mbms_flagP, rb_idP); + return rrc_rlc_remove_rlc(ctxt_pP, srb_flagP, mbms_flagP, rb_idP); break; default: return RLC_OP_STATUS_BAD_PARAMETER; @@ -874,23 +817,20 @@ rlc_op_status_t rrc_rlc_config_req ( } //----------------------------------------------------------------------------- rlc_op_status_t rrc_rlc_data_req ( - const module_id_t enb_mod_idP, - const module_id_t ue_mod_idP, - const frame_t frameP, - const eNB_flag_t enb_flagP, - const MBMS_flag_t MBMS_flagP, - const rb_id_t rb_idP, - const mui_t muiP, - const confirm_t confirmP, - const sdu_size_t sdu_sizeP, - char* sduP) { + const protocol_ctxt_t* const ctxt_pP, + const MBMS_flag_t MBMS_flagP, + const rb_id_t rb_idP, + const mui_t muiP, + const confirm_t confirmP, + const sdu_size_t sdu_sizeP, + char* sduP) { //----------------------------------------------------------------------------- mem_block_t* sdu; sdu = get_free_mem_block(sdu_sizeP); if (sdu != NULL) { memcpy (sdu->data, sduP, sdu_sizeP); - return rlc_data_req(enb_mod_idP, ue_mod_idP, frameP, enb_flagP, SRB_FLAG_YES, MBMS_flagP, rb_idP, muiP, confirmP, sdu_sizeP, sdu); + return rlc_data_req(ctxt_pP, SRB_FLAG_YES, MBMS_flagP, rb_idP, muiP, confirmP, sdu_sizeP, sdu); } else { return RLC_OP_STATUS_INTERNAL_ERROR; } diff --git a/openair2/RRC/L2_INTERFACE/openair_rrc_L2_interface.c b/openair2/RRC/L2_INTERFACE/openair_rrc_L2_interface.c index efda592110010446c588577062fc020c8f977fa4..1a566d940b96ceda8e1208df5cbf8288efab8ce1 100644 --- a/openair2/RRC/L2_INTERFACE/openair_rrc_L2_interface.c +++ b/openair2/RRC/L2_INTERFACE/openair_rrc_L2_interface.c @@ -99,9 +99,15 @@ int8_t mac_rrc_data_ind(module_id_t module_idP, frame_t frameP, rb_id_t srb_idP, } /********************************************************************************************************************/ -void rlcrrc_data_ind(module_id_t enb_instP, module_id_t ue_instP, frame_t frameP, eNB_flag_t eNB_flagP, rb_id_t srb_idP, sdu_size_t sdu_lenP,uint8_t *buffer_pP){ -/********************************************************************************************************************/ - rrc_lite_data_ind(enb_instP, ue_instP,frameP,eNB_flagP,srb_idP,sdu_lenP,buffer_pP); +void rlcrrc_data_ind(const protocol_ctxt_t* const ctxt_pP, rb_id_t srb_idP, sdu_size_t sdu_lenP,uint8_t *buffer_pP){ +/********************************************************************************************************************/ + rrc_lite_data_ind(ctxt_pP->enb_module_id, + ctxt_pP->ue_module_id, + ctxt_pP->frame, + ctxt_pP->enb_flag, + srb_idP, + sdu_lenP, + buffer_pP); } /********************************************************************************************************************/ diff --git a/openair2/RRC/L2_INTERFACE/openair_rrc_L2_interface.h b/openair2/RRC/L2_INTERFACE/openair_rrc_L2_interface.h index 4da407b472ff70529d840ab5758fe8ff36ce8396..ae076f1e08b6375e45b93933c700e30954cafc5a 100644 --- a/openair2/RRC/L2_INTERFACE/openair_rrc_L2_interface.h +++ b/openair2/RRC/L2_INTERFACE/openair_rrc_L2_interface.h @@ -51,7 +51,7 @@ void mac_lite_sync_ind(module_id_t module_idP, uint8_t statusP); void mac_rrc_meas_ind(module_id_t, MAC_MEAS_REQ_ENTRY*); -void rlcrrc_data_ind(module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t frameP, eNB_flag_t eNB_flagP, rb_id_t rb_idP, sdu_size_t sdu_sizeP, uint8_t *buffer_pP); +void rlcrrc_data_ind(const protocol_ctxt_t* const ctxt_pP, rb_id_t rb_idP, sdu_size_t sdu_sizeP, uint8_t *buffer_pP); uint8_t pdcp_rrc_data_req(module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t frameP, eNB_flag_t eNB_flagP, rb_id_t rb_idP, mui_t muiP, boolean_t confirmP, sdu_size_t sdu_buffer_size, uint8_t* sdu_buffer, uint8_t mode); diff --git a/openair2/RRC/LITE/L2_interface.c b/openair2/RRC/LITE/L2_interface.c index dca8162e8949589146269c4ed833c9c3ed7d6950..61ed87dd1867b546554689a5f0abf5f79a770a9d 100644 --- a/openair2/RRC/LITE/L2_interface.c +++ b/openair2/RRC/LITE/L2_interface.c @@ -520,7 +520,13 @@ uint8_t rrc_lite_data_req(module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame } #else - return pdcp_data_req (enb_mod_idP, ue_mod_idP, frameP, enb_flagP, SRB_FLAG_YES, rb_idP, muiP, confirmP, sdu_size, buffer_pP, mode); + protocol_ctxt_t ctxt; + ctxt.enb_module_id = enb_mod_idP; + ctxt.ue_module_id = ue_mod_idP; + ctxt.frame = frameP; + ctxt.enb_flag = enb_flagP; + + return pdcp_data_req (&ctxt, SRB_FLAG_YES, rb_idP, muiP, confirmP, sdu_size, buffer_pP, mode); #endif } diff --git a/openair2/RRC/LITE/rrc_UE.c b/openair2/RRC/LITE/rrc_UE.c index b5fa79ac6f9f78003f6375911f40673e10995c89..3e0737d27a0bca8c69df5599649ea7b9f869631b 100644 --- a/openair2/RRC/LITE/rrc_UE.c +++ b/openair2/RRC/LITE/rrc_UE.c @@ -815,6 +815,7 @@ rrc_ue_process_radioResourceConfigDedicated(module_id_t ue_mod_idP, frame_t fram long SRB_id,DRB_id; int i,cnt; LogicalChannelConfig_t *SRB1_logicalChannelConfig,*SRB2_logicalChannelConfig; + protocol_ctxt_t ctxt; #ifdef CBA uint8_t cba_found = 0; uint16_t cba_RNTI; @@ -885,8 +886,12 @@ rrc_ue_process_radioResourceConfigDedicated(module_id_t ue_mod_idP, frame_t fram UE_rrc_inst[ue_mod_idP].kenb, &kRRCint); #endif -// Refresh SRBs - rrc_pdcp_config_asn1_req(eNB_index,ue_mod_idP,frameP,0, + ctxt.enb_module_id = eNB_index; + ctxt.ue_module_id = ue_mod_idP; + ctxt.frame = frameP; + ctxt.enb_flag = ENB_FLAG_NO; + // Refresh SRBs + rrc_pdcp_config_asn1_req(&ctxt, radioResourceConfigDedicated->srb_ToAddModList, (DRB_ToAddModList_t*)NULL, (DRB_ToReleaseList_t*)NULL, @@ -901,7 +906,7 @@ rrc_ue_process_radioResourceConfigDedicated(module_id_t ue_mod_idP, frame_t fram ); // Refresh SRBs - rrc_rlc_config_asn1_req(eNB_index,ue_mod_idP,frameP,0, + rrc_rlc_config_asn1_req(&ctxt, radioResourceConfigDedicated->srb_ToAddModList, (DRB_ToAddModList_t*)NULL, (DRB_ToReleaseList_t*)NULL @@ -1048,8 +1053,12 @@ rrc_ue_process_radioResourceConfigDedicated(module_id_t ue_mod_idP, frame_t fram UE_rrc_inst[ue_mod_idP].kenb, &kUPenc); #endif + ctxt.enb_module_id = eNB_index; + ctxt.ue_module_id = ue_mod_idP; + ctxt.frame = frameP; + ctxt.enb_flag = ENB_FLAG_NO; // Refresh DRBs - rrc_pdcp_config_asn1_req(eNB_index, ue_mod_idP,frameP,0, + rrc_pdcp_config_asn1_req(&ctxt, (SRB_ToAddModList_t*)NULL, radioResourceConfigDedicated->drb_ToAddModList, (DRB_ToReleaseList_t*)NULL, @@ -1064,7 +1073,7 @@ rrc_ue_process_radioResourceConfigDedicated(module_id_t ue_mod_idP, frame_t fram ); // Refresh DRBs - rrc_rlc_config_asn1_req(eNB_index,ue_mod_idP,frameP,0, + rrc_rlc_config_asn1_req(&ctxt, (SRB_ToAddModList_t*)NULL, radioResourceConfigDedicated->drb_ToAddModList, (DRB_ToReleaseList_t*)NULL @@ -1416,7 +1425,8 @@ void rrc_ue_process_rrcConnectionReconfiguration(module_id_t ue_mod_idP, frame_t /* 36.331, 5.3.5.4 Reception of an RRCConnectionReconfiguration including the mobilityControlInfo by the UE (handover) */ void rrc_ue_process_mobilityControlInfo(uint8_t eNB_index, uint8_t UE_id, frame_t frameP, struct MobilityControlInfo *mobilityControlInfo) { - module_id_t ue_mod_idP = UE_id; + module_id_t ue_mod_idP = UE_id; + protocol_ctxt_t ctxt; /* DRB_ToReleaseList_t* drb2release_list; DRB_Identity_t *lcid; @@ -1436,16 +1446,20 @@ void rrc_ue_process_mobilityControlInfo(uint8_t eNB_index, uint8_t UE_id, frame_ } */ + ctxt.enb_module_id = eNB_index; + ctxt.ue_module_id = ue_mod_idP; + ctxt.frame = frameP; + ctxt.enb_flag = ENB_FLAG_NO; //Removing SRB1 and SRB2 and DRB0 LOG_N(RRC,"[UE %d] : Update needed for rrc_pdcp_config_req (deprecated) and rrc_rlc_config_req commands(deprecated)\n", UE_id); - rrc_pdcp_config_req (eNB_index, UE_id, frameP, ENB_FLAG_NO, SRB_FLAG_YES, CONFIG_ACTION_REMOVE, DCCH,UNDEF_SECURITY_MODE); - rrc_rlc_config_req(eNB_index, ue_mod_idP,frameP,ENB_FLAG_NO, SRB_FLAG_YES, MBMS_FLAG_NO, CONFIG_ACTION_REMOVE,ue_mod_idP+DCCH,Rlc_info_am_config); + rrc_pdcp_config_req (&ctxt, SRB_FLAG_YES, CONFIG_ACTION_REMOVE, DCCH,UNDEF_SECURITY_MODE); + rrc_rlc_config_req(&ctxt, SRB_FLAG_YES, MBMS_FLAG_NO, CONFIG_ACTION_REMOVE,ue_mod_idP+DCCH,Rlc_info_am_config); - rrc_pdcp_config_req (eNB_index, UE_id, frameP, ENB_FLAG_NO, SRB_FLAG_YES, CONFIG_ACTION_REMOVE, DCCH1,UNDEF_SECURITY_MODE); - rrc_rlc_config_req(eNB_index, ue_mod_idP,frameP,ENB_FLAG_NO, SRB_FLAG_YES,CONFIG_ACTION_REMOVE, MBMS_FLAG_NO,ue_mod_idP+DCCH1,Rlc_info_am_config); + rrc_pdcp_config_req (&ctxt, SRB_FLAG_YES, CONFIG_ACTION_REMOVE, DCCH1,UNDEF_SECURITY_MODE); + rrc_rlc_config_req(&ctxt, SRB_FLAG_YES,CONFIG_ACTION_REMOVE, MBMS_FLAG_NO,ue_mod_idP+DCCH1,Rlc_info_am_config); - rrc_pdcp_config_req (eNB_index, UE_id, frameP, ENB_FLAG_NO, SRB_FLAG_NO, CONFIG_ACTION_REMOVE, DTCH,UNDEF_SECURITY_MODE); - rrc_rlc_config_req(eNB_index, ue_mod_idP,frameP,ENB_FLAG_NO, SRB_FLAG_NO,CONFIG_ACTION_REMOVE, MBMS_FLAG_NO,ue_mod_idP+DTCH,Rlc_info_um); + rrc_pdcp_config_req (&ctxt, SRB_FLAG_NO, CONFIG_ACTION_REMOVE, DTCH,UNDEF_SECURITY_MODE); + rrc_rlc_config_req(&ctxt, SRB_FLAG_NO,CONFIG_ACTION_REMOVE, MBMS_FLAG_NO,ue_mod_idP+DTCH,Rlc_info_um); /* rrc_pdcp_config_asn1_req(NB_eNB_INST+ue_mod_idP,frameP, 0,eNB_index, NULL, // SRB_ToAddModList @@ -2188,12 +2202,20 @@ void dump_sib2(SystemInformationBlockType2_t *sib2) { LOG_D(RRC,"timeAlignmentTimerCommon : %ld\n", sib2->timeAlignmentTimerCommon); } -void dump_sib3(SystemInformationBlockType3_t *sib3) { +void +dump_sib3( + SystemInformationBlockType3_t *sib3 + ) +{ } #ifdef Rel10 -void dump_sib13(SystemInformationBlockType13_r9_t *sib13) { +void +dump_sib13( + SystemInformationBlockType13_r9_t *sib13 + ) +{ LOG_D(RRC,"[RRC][UE] Dumping SIB13\n"); LOG_D(RRC,"[RRC][UE] dumping sib13 second time\n"); @@ -2206,7 +2228,14 @@ void dump_sib13(SystemInformationBlockType13_r9_t *sib13) { //const char SIBPeriod[7][7]= {"80ms\0","160ms\0","320ms\0","640ms\0","1280ms\0","2560ms\0","5120ms\0"}; -int decode_SI(module_id_t ue_mod_idP, frame_t frameP,uint8_t eNB_index,uint8_t si_window) { +int +decode_SI( + module_id_t ue_mod_idP, + frame_t frameP, + uint8_t eNB_index, + uint8_t si_window + ) +{ SystemInformation_t **si=&UE_rrc_inst[ue_mod_idP].si[eNB_index][si_window]; int i; @@ -2400,7 +2429,13 @@ int decode_SI(module_id_t ue_mod_idP, frame_t frameP,uint8_t eNB_index,uint8_t s } // layer 3 filtering of RSRP (EUTRA) measurements: 36.331, Sec. 5.5.3.2 -void ue_meas_filtering(module_id_t ue_mod_idP, frame_t frameP,uint8_t eNB_index){ +void +ue_meas_filtering( + module_id_t ue_mod_idP, + frame_t frameP, + uint8_t eNB_index + ) +{ float a = UE_rrc_inst[ue_mod_idP].filter_coeff_rsrp; // 'a' in 36.331 Sec. 5.5.3.2 float a1 = UE_rrc_inst[ue_mod_idP].filter_coeff_rsrq; //float rsrp_db, rsrq_db; @@ -2467,7 +2502,13 @@ void ue_meas_filtering(module_id_t ue_mod_idP, frame_t frameP,uint8_t eNB_index) } //Below routine implements Measurement Reporting procedure from 36.331 Section 5.5.5 -void rrc_ue_generate_MeasurementReport(module_id_t eNB_id, module_id_t UE_id, frame_t frameP) { +void +rrc_ue_generate_MeasurementReport( + module_id_t eNB_id, + module_id_t UE_id, + frame_t frameP + ) +{ uint8_t buffer[32], size; uint8_t i; @@ -2480,6 +2521,12 @@ void rrc_ue_generate_MeasurementReport(module_id_t eNB_id, module_id_t UE_id, fr float rsrp_filtered, rsrq_filtered; static frame_t pframe=0; int result; + protocol_ctxt_t ctxt; + + ctxt.enb_module_id = eNB_id; + ctxt.ue_module_id = UE_id; + ctxt.frame = frameP; + ctxt.enb_flag = ENB_FLAG_NO; @@ -2515,12 +2562,12 @@ void rrc_ue_generate_MeasurementReport(module_id_t eNB_id, module_id_t UE_id, fr pframe=frameP; LOG_D(RRC, "[UE %d] Frame %d: doing MeasReport: servingCell(%d) targetCell(%d) rsrp_s(%ld) rsrq_s(%ld) rsrp_t(%ld) rsrq_t(%ld) \n", UE_id, frameP, cellId,targetCellId,rsrp_s,rsrq_s,rsrp_t,rsrq_t); - size = do_MeasurementReport(UE_id, buffer,measId,targetCellId,rsrp_s,rsrq_s,rsrp_t,rsrq_t); + size = do_MeasurementReport(UE_id, buffer,measId,targetCellId,rsrp_s,rsrq_s,rsrp_t,rsrq_t); LOG_I(RRC, "[UE %d] Frame %d : Generating Measurement Report for eNB %d\n", UE_id, frameP, eNB_id); LOG_D(RLC, "[MSC_MSG][FRAME %05d][RRC_UE][UE %02d][][--- PDCP_DATA_REQ/%d Bytes (MeasurementReport to eNB %d MUI %d) --->][PDCP][MOD %02d][RB %02d]\n", frameP, UE_id, size, eNB_id, rrc_mui, eNB_id, DCCH); - result = pdcp_data_req(eNB_id, UE_id, frameP, ENB_FLAG_NO, SRB_FLAG_YES, DCCH, rrc_mui++, 0, size, buffer, PDCP_TRANSMISSION_MODE_DATA); + result = pdcp_data_req(&ctxt, SRB_FLAG_YES, DCCH, rrc_mui++, 0, size, buffer, PDCP_TRANSMISSION_MODE_DATA); AssertFatal (result == TRUE, "PDCP data request failed!\n"); //LOG_D(RRC, "[UE %d] Frame %d Sending MeasReport (%d bytes) through DCCH%d to PDCP \n",ue_mod_idP,frameP, size, DCCH); } @@ -2531,7 +2578,13 @@ void rrc_ue_generate_MeasurementReport(module_id_t eNB_id, module_id_t UE_id, fr } // Measurement report triggering, described in 36.331 Section 5.5.4.1: called periodically -void ue_measurement_report_triggering(module_id_t ue_mod_idP, frame_t frameP,uint8_t eNB_index) { +void +ue_measurement_report_triggering( + module_id_t ue_mod_idP, + frame_t frameP, + uint8_t eNB_index + ) +{ uint8_t i,j; Hysteresis_t hys; TimeToTrigger_t ttt_ms; diff --git a/openair2/RRC/LITE/rrc_common.c b/openair2/RRC/LITE/rrc_common.c index 91366248f8cfaf720ac2b036282ac5aae47c6e4d..54bfef6ebd92cfd80b324130940dd6e5cc4c8d76 100644 --- a/openair2/RRC/LITE/rrc_common.c +++ b/openair2/RRC/LITE/rrc_common.c @@ -301,6 +301,13 @@ void rrc_top_cleanup(void) { void rrc_t310_expiration(const frame_t frameP, uint8_t Mod_id, uint8_t eNB_index) { + protocol_ctxt_t ctxt; + + ctxt.enb_module_id = eNB_index; + ctxt.ue_module_id = Mod_id; + ctxt.frame = frameP; + ctxt.enb_flag = ENB_FLAG_NO; + if (UE_rrc_inst[Mod_id].Info[eNB_index].State != RRC_CONNECTED) { LOG_D(RRC, "Timer 310 expired, going to RRC_IDLE\n"); UE_rrc_inst[Mod_id].Info[eNB_index].State = RRC_IDLE; @@ -315,10 +322,17 @@ void rrc_t310_expiration(const frame_t frameP, uint8_t Mod_id, uint8_t eNB_index if (UE_rrc_inst[Mod_id].Srb2[eNB_index].Active == 1) { msg ("[RRC Inst %d] eNB_index %d, Remove RB %d\n ", Mod_id, eNB_index, UE_rrc_inst[Mod_id].Srb2[eNB_index].Srb_info.Srb_id); - rrc_pdcp_config_req (eNB_index, Mod_id, frameP, ENB_FLAG_NO, SRB_FLAG_YES, CONFIG_ACTION_REMOVE, - UE_rrc_inst[Mod_id].Srb2[eNB_index].Srb_info.Srb_id, 0); - rrc_rlc_config_req (eNB_index, Mod_id, frameP, ENB_FLAG_NO, SRB_FLAG_YES, MBMS_FLAG_NO, CONFIG_ACTION_REMOVE, - UE_rrc_inst[Mod_id].Srb2[eNB_index].Srb_info.Srb_id, Rlc_info_um); + rrc_pdcp_config_req (&ctxt, + SRB_FLAG_YES, + CONFIG_ACTION_REMOVE, + UE_rrc_inst[Mod_id].Srb2[eNB_index].Srb_info.Srb_id, + 0); + rrc_rlc_config_req (&ctxt, + SRB_FLAG_YES, + MBMS_FLAG_NO, + CONFIG_ACTION_REMOVE, + UE_rrc_inst[Mod_id].Srb2[eNB_index].Srb_info.Srb_id, + Rlc_info_um); UE_rrc_inst[Mod_id].Srb2[eNB_index].Active = 0; UE_rrc_inst[Mod_id].Srb2[eNB_index].Status = IDLE; UE_rrc_inst[Mod_id].Srb2[eNB_index].Next_check_frame = 0; diff --git a/openair2/RRC/LITE/rrc_eNB.c b/openair2/RRC/LITE/rrc_eNB.c index f358f4227343ad46e14ea1b0c90ef7d9263911b6..9e9fd4467003f62601fed69fe8874fbfc887cf4d 100644 --- a/openair2/RRC/LITE/rrc_eNB.c +++ b/openair2/RRC/LITE/rrc_eNB.c @@ -526,11 +526,13 @@ static module_id_t rrc_eNB_get_next_free_UE_index( return (UE_MODULE_INVALID); } -void rrc_eNB_free_UE_index( - module_id_t enb_mod_idP, - module_id_t ue_mod_idP, - int frameP) { +void +rrc_eNB_free_UE_index( + module_id_t enb_mod_idP, + module_id_t ue_mod_idP, + int frameP) { + protocol_ctxt_t ctxt; DRB_ToAddModList_t *DRB_configList = eNB_rrc_inst[enb_mod_idP].DRB_configList[ue_mod_idP]; SRB_ToAddModList_t *SRB_configList = eNB_rrc_inst[enb_mod_idP].SRB_configList[ue_mod_idP]; @@ -552,8 +554,14 @@ void rrc_eNB_free_UE_index( #endif eNB_rrc_inst[enb_mod_idP].Info.UE[ue_mod_idP].Status = RRC_IDLE; eNB_rrc_inst[enb_mod_idP].Info.UE_list[ue_mod_idP] = 0; - rrc_rlc_remove_ue(enb_mod_idP, ue_mod_idP, frameP,ENB_FLAG_YES); - pdcp_remove_UE(enb_mod_idP, ue_mod_idP, frameP); + + ctxt.enb_module_id = enb_mod_idP; + ctxt.ue_module_id = ue_mod_idP; + ctxt.frame = frameP; + ctxt.enb_flag = ENB_FLAG_YES; + + rrc_rlc_remove_ue(&ctxt); + pdcp_remove_UE(&ctxt); free(eNB_rrc_inst[enb_mod_idP].SRB_configList[ue_mod_idP]); } @@ -1437,11 +1445,19 @@ void rrc_eNB_process_handoverPreparationInformation( /*------------------------------------------------------------------------------*/ void check_handovers( module_id_t enb_mod_idP, - frame_t frameP) { + frame_t frameP + ) +{ uint8_t i; int result; + protocol_ctxt_t ctxt; + ctxt.enb_module_id = enb_mod_idP; + ctxt.frame = frameP; + ctxt.enb_flag = ENB_FLAG_YES; for (i = 0; i < NUMBER_OF_UE_MAX; i++) { + ctxt.ue_module_id = i; + if (eNB_rrc_inst[enb_mod_idP].handover_info[i] != NULL) { if (eNB_rrc_inst[enb_mod_idP].handover_info[i]->ho_prepare == 0xFF) { LOG_D(RRC, @@ -1457,9 +1473,11 @@ void check_handovers( "[eNB %d] Frame %d: handover Command received for new UE_idx %d current eNB %d target eNB: %d \n", enb_mod_idP, frameP, i, enb_mod_idP, eNB_rrc_inst[enb_mod_idP].handover_info[i]->modid_t); //rrc_eNB_process_handoverPreparationInformation(enb_mod_idP,frameP,i); - result = pdcp_data_req(enb_mod_idP, i, frameP, ENB_FLAG_YES, SRB_FLAG_YES, + result = pdcp_data_req(&ctxt, + SRB_FLAG_YES, DCCH, - rrc_eNB_mui++, FALSE, + rrc_eNB_mui++, + FALSE, eNB_rrc_inst[enb_mod_idP].handover_info[i]->size, eNB_rrc_inst[enb_mod_idP].handover_info[i]->buf, 1); AssertFatal(result == TRUE, "PDCP data request failed!\n"); @@ -1537,6 +1555,12 @@ void rrc_eNB_generate_RRCConnectionReconfiguration_handover( // phy config dedicated PhysicalConfigDedicated_t *physicalConfigDedicated2; struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *dedicatedInfoNASList; + protocol_ctxt_t ctxt; + + ctxt.enb_module_id = enb_mod_idP; + ctxt.ue_module_id = ue_mod_idP; + ctxt.frame = frameP; + ctxt.enb_flag = ENB_FLAG_YES; LOG_D(RRC, "[eNB %d] Frame %d: handover preparation: get the newSourceUEIdentity (C-RNTI): ", enb_mod_idP, frameP); for (i = 0; i < 2; i++) { @@ -2227,7 +2251,7 @@ void rrc_eNB_generate_RRCConnectionReconfiguration_handover( // rrc_pdcp_config_req (enb_mod_idP, frameP, 1, CONFIG_ACTION_ADD, idx, UNDEF_SECURITY_MODE); // rrc_rlc_config_req(enb_mod_idP,frameP,1,CONFIG_ACTION_ADD,Idx,SIGNALLING_RADIO_BEARER,Rlc_info_am_config); - rrc_pdcp_config_asn1_req(enb_mod_idP, ue_mod_idP, frameP, 1, + rrc_pdcp_config_asn1_req(&ctxt, eNB_rrc_inst[enb_mod_idP].SRB_configList[ue_mod_idP], (DRB_ToAddModList_t *) NULL, (DRB_ToReleaseList_t *) NULL, 0xff, NULL, NULL, NULL #ifdef Rel10 @@ -2235,7 +2259,7 @@ void rrc_eNB_generate_RRCConnectionReconfiguration_handover( #endif ); - rrc_rlc_config_asn1_req(enb_mod_idP, ue_mod_idP, frameP, 1, + rrc_rlc_config_asn1_req(&ctxt, eNB_rrc_inst[enb_mod_idP].SRB_configList[ue_mod_idP], (DRB_ToAddModList_t *) NULL, (DRB_ToReleaseList_t *) NULL #ifdef Rel10 @@ -2366,6 +2390,12 @@ void rrc_eNB_process_RRCConnectionReconfigurationComplete( DRB_ToAddModList_t *DRB_configList = eNB_rrc_inst[enb_mod_idP].DRB_configList[ue_mod_idP]; SRB_ToAddModList_t *SRB_configList = eNB_rrc_inst[enb_mod_idP].SRB_configList[ue_mod_idP]; + protocol_ctxt_t ctxt; + + ctxt.enb_module_id = enb_mod_idP; + ctxt.ue_module_id = ue_mod_idP; + ctxt.frame = frameP; + ctxt.enb_flag = ENB_FLAG_YES; #if defined(ENABLE_SECURITY) /* Derive the keys from kenb */ @@ -2410,30 +2440,29 @@ void rrc_eNB_process_RRCConnectionReconfigurationComplete( } #endif // Refresh SRBs/DRBs - rrc_pdcp_config_asn1_req(enb_mod_idP, ue_mod_idP, frameP, ENB_FLAG_YES, - NULL, //LG-RK 14/05/2014 SRB_configList, - DRB_configList, (DRB_ToReleaseList_t *) NULL, - /*eNB_rrc_inst[enb_mod_idP].ciphering_algorithm[ue_mod_idP] | + rrc_pdcp_config_asn1_req( + &ctxt, + NULL, //LG-RK 14/05/2014 SRB_configList, + DRB_configList, (DRB_ToReleaseList_t *) NULL, + /*eNB_rrc_inst[enb_mod_idP].ciphering_algorithm[ue_mod_idP] | (eNB_rrc_inst[enb_mod_idP].integrity_algorithm[ue_mod_idP] << 4), - */ - 0xff, // already configured during the securitymodecommand - kRRCenc, - kRRCint, - kUPenc + */ + 0xff, // already configured during the securitymodecommand + kRRCenc, + kRRCint, + kUPenc #ifdef Rel10 - , (PMCH_InfoList_r9_t *) NULL + , (PMCH_InfoList_r9_t *) NULL #endif ); // Refresh SRBs/DRBs - rrc_rlc_config_asn1_req(enb_mod_idP, - ue_mod_idP, - frameP, - 1, - NULL, //LG-RK 14/05/2014 SRB_configList, - DRB_configList, - (DRB_ToReleaseList_t *) NULL + rrc_rlc_config_asn1_req( + &ctxt, + NULL, //LG-RK 14/05/2014 SRB_configList, + DRB_configList, + (DRB_ToReleaseList_t *) NULL #ifdef Rel10 - , (PMCH_InfoList_r9_t *) NULL + , (PMCH_InfoList_r9_t *) NULL #endif ); @@ -2524,10 +2553,10 @@ void rrc_eNB_process_RRCConnectionReconfigurationComplete( (uint8_t *) NULL, (uint16_t *) NULL, NULL, NULL, NULL, (MBSFN_SubframeConfigList_t *) NULL #ifdef Rel10 - , 0, (MBSFN_AreaInfoList_r9_t *) NULL, (PMCH_InfoList_r9_t *) NULL + , 0, (MBSFN_AreaInfoList_r9_t *) NULL, (PMCH_InfoList_r9_t *) NULL #endif #ifdef CBA - , eNB_rrc_inst[enb_mod_idP].num_active_cba_groups, eNB_rrc_inst[enb_mod_idP].cba_rnti[0] + , eNB_rrc_inst[enb_mod_idP].num_active_cba_groups, eNB_rrc_inst[enb_mod_idP].cba_rnti[0] #endif ); @@ -2538,8 +2567,13 @@ void rrc_eNB_process_RRCConnectionReconfigurationComplete( /* rrc_pdcp_config_req (enb_mod_idP, frameP, 1, CONFIG_ACTION_REMOVE, (ue_mod_idP * NB_RB_MAX) + DRB2LCHAN[i],UNDEF_SECURITY_MODE); */ - rrc_rlc_config_req(enb_mod_idP, ue_mod_idP, frameP, ENB_FLAG_YES, SRB_FLAG_NO, MBMS_FLAG_NO, CONFIG_ACTION_REMOVE, - DRB2LCHAN[i], Rlc_info_um); + rrc_rlc_config_req( + &ctxt, + SRB_FLAG_NO, + MBMS_FLAG_NO, + CONFIG_ACTION_REMOVE, + DRB2LCHAN[i], + Rlc_info_um); } eNB_rrc_inst[enb_mod_idP].DRB_active[ue_mod_idP][i] = 0; LOG_D(RRC, @@ -2790,6 +2824,11 @@ int rrc_eNB_decode_ccch( RRCConnectionRequest_r8_IEs_t *rrcConnectionRequest; RRCConnectionReestablishmentRequest_r8_IEs_t *rrcConnectionReestablishmentRequest; int i, rval; + protocol_ctxt_t ctxt; + + ctxt.enb_module_id = enb_mod_idP; + ctxt.frame = frameP; + ctxt.enb_flag = ENB_FLAG_YES; //memset(ul_ccch_msg,0,sizeof(UL_CCCH_Message_t)); @@ -2858,15 +2897,14 @@ int rrc_eNB_decode_ccch( "[FRAME %05d][MAC_eNB][MOD %02d][][--- MAC_DATA_IND (rrcConnectionReestablishmentRequest on SRB0) -->][RRC_eNB][MOD %02d][]\n", frameP, enb_mod_idP, enb_mod_idP); - rrcConnectionReestablishmentRequest = &ul_ccch_msg->message.choice.c1.choice.rrcConnectionReestablishmentRequest.criticalExtensions.choice.rrcConnectionReestablishmentRequest_r8; + rrcConnectionReestablishmentRequest = &ul_ccch_msg->message.choice.c1.choice.rrcConnectionReestablishmentRequest.criticalExtensions.choice.rrcConnectionReestablishmentRequest_r8; LOG_I(RRC, "[eNB %d] Frame %d UE %d: RRCConnectionReestablishmentRequest cause %s\n", enb_mod_idP, frameP, ue_mod_id, - ((rrcConnectionReestablishmentRequest->reestablishmentCause == ReestablishmentCause_otherFailure) ? "Other Failure" : - (rrcConnectionReestablishmentRequest->reestablishmentCause == ReestablishmentCause_handoverFailure) ? "Handover Failure" : - "reconfigurationFailure")); - /* - { + ((rrcConnectionReestablishmentRequest->reestablishmentCause == ReestablishmentCause_otherFailure) ? "Other Failure" : + (rrcConnectionReestablishmentRequest->reestablishmentCause == ReestablishmentCause_handoverFailure) ? "Handover Failure" : + "reconfigurationFailure")); + /*{ uint64_t c_rnti = 0; memcpy(((uint8_t *) & c_rnti) + 3, rrcConnectionReestablishmentRequest.UE_identity.c_RNTI.buf, @@ -2893,16 +2931,18 @@ int rrc_eNB_decode_ccch( "[FRAME %05d][MAC_eNB][MOD %02d][][--- MAC_DATA_IND (rrcConnectionRequest on SRB0) -->][RRC_eNB][MOD %02d][]\n", frameP, enb_mod_idP, enb_mod_idP); - rrcConnectionRequest = &ul_ccch_msg->message.choice.c1.choice.rrcConnectionRequest.criticalExtensions.choice.rrcConnectionRequest_r8; + rrcConnectionRequest = &ul_ccch_msg->message.choice.c1.choice.rrcConnectionRequest.criticalExtensions.choice.rrcConnectionRequest_r8; { uint64_t random_value = 0; - memcpy(((uint8_t *) & random_value) + 3, rrcConnectionRequest->ue_Identity.choice.randomValue.buf, rrcConnectionRequest->ue_Identity.choice.randomValue.size); ue_mod_id = rrc_eNB_get_next_free_UE_index(enb_mod_idP, random_value); } if (ue_mod_id != UE_MODULE_INVALID) { + ctxt.ue_module_id = ue_mod_id; + + #if defined(ENABLE_ITTI) /* Check s-TMSI presence in message */ eNB_rrc_inst[enb_mod_idP].Info.UE[ue_mod_id].Initialue_identity_s_TMSI.presence = @@ -2966,7 +3006,7 @@ int rrc_eNB_decode_ccch( // rrc_rlc_config_req(enb_mod_idP,frameP,1,CONFIG_ACTION_ADD,Idx,SIGNALLING_RADIO_BEARER,Rlc_info_am_config); - rrc_pdcp_config_asn1_req(enb_mod_idP, ue_mod_id, frameP, 1, + rrc_pdcp_config_asn1_req(&ctxt, eNB_rrc_inst[enb_mod_idP].SRB_configList[ue_mod_id], (DRB_ToAddModList_t *) NULL, (DRB_ToReleaseList_t *) NULL, 0xff, NULL, NULL, NULL @@ -2975,7 +3015,7 @@ int rrc_eNB_decode_ccch( # endif ); - rrc_rlc_config_asn1_req(enb_mod_idP, ue_mod_id, frameP, 1, + rrc_rlc_config_asn1_req(&ctxt, eNB_rrc_inst[enb_mod_idP].SRB_configList[ue_mod_id], (DRB_ToAddModList_t *) NULL, (DRB_ToReleaseList_t *) NULL # ifdef Rel10 diff --git a/openair2/RRC/LITE/rrc_eNB_S1AP.c b/openair2/RRC/LITE/rrc_eNB_S1AP.c index 0f99e533c7c2590650d497d6ed05b0fe12d1866d..59a3bac262f445092e915085dda19a389947c320 100644 --- a/openair2/RRC/LITE/rrc_eNB_S1AP.c +++ b/openair2/RRC/LITE/rrc_eNB_S1AP.c @@ -291,7 +291,8 @@ static void rrc_pdcp_config_security(uint8_t enb_mod_idP, uint8_t ue_mod_idP, ui uint8_t *kRRCint = NULL; uint8_t *kUPenc = NULL; pdcp_t *pdcp_p = NULL; - static int print_keys= 1; + static int print_keys= 1; + protocol_ctxt_t ctxt; /* Derive the keys from kenb */ if (SRB_configList != NULL) { derive_key_up_enc(eNB_rrc_inst[enb_mod_idP].ciphering_algorithm[ue_mod_idP], @@ -330,21 +331,23 @@ static void rrc_pdcp_config_security(uint8_t enb_mod_idP, uint8_t ue_mod_idP, ui pdcp_p = &pdcp_array_srb_eNB[enb_mod_idP][ue_mod_idP][DCCH-1]; - - pdcp_config_set_security(pdcp_p, - enb_mod_idP, - ue_mod_idP, - 0, - ENB_FLAG_YES, - DCCH, - DCCH+2, - (send_security_mode_command == TRUE) ? - 0 | (eNB_rrc_inst[enb_mod_idP].integrity_algorithm[ue_mod_idP] << 4) : - (eNB_rrc_inst[enb_mod_idP].ciphering_algorithm[ue_mod_idP] ) | - (eNB_rrc_inst[enb_mod_idP].integrity_algorithm[ue_mod_idP] << 4), - kRRCenc, - kRRCint, - kUPenc); + + ctxt.enb_module_id = enb_mod_idP; + ctxt.ue_module_id = ue_mod_idP; + ctxt.frame = 0; + ctxt.enb_flag = ENB_FLAG_YES; + pdcp_config_set_security( + &ctxt, + pdcp_p, + DCCH, + DCCH+2, + (send_security_mode_command == TRUE) ? + 0 | (eNB_rrc_inst[enb_mod_idP].integrity_algorithm[ue_mod_idP] << 4) : + (eNB_rrc_inst[enb_mod_idP].ciphering_algorithm[ue_mod_idP] ) | + (eNB_rrc_inst[enb_mod_idP].integrity_algorithm[ue_mod_idP] << 4), + kRRCenc, + kRRCint, + kUPenc); #endif } diff --git a/openair2/RRC/NAS/nas_config.h b/openair2/RRC/NAS/nas_config.h index 02ec8e1942ccafea242f11b420c3cfddcfd7abfd..654cb978c5a378bb51cc12634324478ec1c8cfa8 100755 --- a/openair2/RRC/NAS/nas_config.h +++ b/openair2/RRC/NAS/nas_config.h @@ -113,7 +113,7 @@ void setBaseNetAddress(char* baseAddr); * \note * @ingroup ????? */ -char* getBaseNetAddress(); +char* getBaseNetAddress(void); /*! \fn void setNetMask(char*) * \brief This function sets the new default network mask used @@ -129,7 +129,7 @@ void setNetMask(char* baseAddr); * \note * @ingroup ????? */ -char* getNetMask(); +char* getNetMask(void); /*! \fn coid setBroadcastAddress(char*) * \brief This function sets the new broadcast address used @@ -145,7 +145,7 @@ void setBroadcastAddress(char* baseAddr); * \note * @ingroup ????? */ -char* getBroadcastAddress(); +char* getBroadcastAddress(void); int bringInterfaceUp(char *interfaceName, int up);