Merge branch '320-code-cleanup-removal-of-if-0' into 'develop'
Resolve "Code cleanup - removal of "#if 0"" See merge request oai/openairinterface5g!329
This commit is contained in:
@@ -423,16 +423,6 @@ check_ul_failure(module_id_t module_idP, int CC_id, int UE_id,
|
||||
}
|
||||
}
|
||||
} // ul_failure_timer>0
|
||||
|
||||
#if 0
|
||||
/* U-plane inactivity timer is disabled. Uncomment to re-enable. */
|
||||
UE_list->UE_sched_ctrl[UE_id].uplane_inactivity_timer++;
|
||||
if(UE_list->UE_sched_ctrl[UE_id].uplane_inactivity_timer > (U_PLANE_INACTIVITY_VALUE*subframe_num(&RC.eNB[module_idP][CC_id]->frame_parms))){
|
||||
LOG_D(MAC,"UE %d rnti %x: U-Plane Failure after repeated PDCCH orders: Triggering RRC \n",UE_id,rnti);
|
||||
mac_eNB_rrc_uplane_failure(module_idP,CC_id,frameP,subframeP,rnti);
|
||||
UE_list->UE_sched_ctrl[UE_id].uplane_inactivity_timer = 0;
|
||||
}// time > 60s
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -597,12 +597,6 @@ schedule_ue_spec(module_id_t module_idP,slice_id_t slice_idP,
|
||||
int header_length_last;
|
||||
int header_length_total;
|
||||
|
||||
#if 0
|
||||
if (UE_list->head == -1) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
start_meas(&eNB->schedule_dlsch);
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
|
||||
(VCD_SIGNAL_DUMPER_FUNCTIONS_SCHEDULE_DLSCH, VCD_FUNCTION_IN);
|
||||
@@ -761,14 +755,6 @@ schedule_ue_spec(module_id_t module_idP,slice_id_t slice_idP,
|
||||
CC_id, UE_id, subframeP, S_DL_NONE);
|
||||
continue;
|
||||
}
|
||||
#warning RK->CR This old API call has to be revisited for FAPI, or logic must be changed
|
||||
#if 0
|
||||
/* add "fake" DCI to have CCE_allocation_infeasible work properly for next allocations */
|
||||
/* if we don't add it, next allocations may succeed but overall allocations may fail */
|
||||
/* will be removed at the end of this function */
|
||||
add_ue_spec_dci(&eNB->common_channels[CC_id].DCI_pdu, &(char[]) {
|
||||
0}, rnti, 1, aggregation, 1, format1, 0);
|
||||
#endif
|
||||
|
||||
nb_available_rb = ue_sched_ctl->pre_nb_available_rbs[CC_id];
|
||||
|
||||
@@ -1366,12 +1352,6 @@ schedule_ue_spec(module_id_t module_idP,slice_id_t slice_idP,
|
||||
dlsch_buffer, sdu_length_total);
|
||||
// memcpy(RC.mac[0].DLSCH_pdu[0][0].payload[0][offset],dcch_buffer,sdu_lengths[0]);
|
||||
|
||||
#if 0
|
||||
// fill remainder of DLSCH with random data
|
||||
for (j = 0; j < (TBS - sdu_length_total - offset); j++) {
|
||||
UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0][offset + sdu_length_total + j] = (char) (taus() & 0xff);
|
||||
}
|
||||
#endif
|
||||
// fill remainder of DLSCH with 0
|
||||
for (j = 0; j < (TBS - sdu_length_total - offset); j++) {
|
||||
UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0][offset + sdu_length_total + j] = 0;
|
||||
@@ -1868,18 +1848,6 @@ void schedule_PCH(module_id_t module_idP,frame_t frameP,sub_frame_t subframeP)
|
||||
if ((subframeP == 0 || subframeP == 1 || subframeP == 2 || subframeP == 4 || subframeP == 6 || subframeP == 9) ||
|
||||
(subframeP == 5 && ((frameP % 2) != 0 && (frameP % 8) != 1))) {
|
||||
switch (n_rb_dl) {
|
||||
#if 0
|
||||
case 6:
|
||||
n_gap = n_rb_dl/2; /* expect: 3 */
|
||||
n_vrb_dl = 2*((n_gap < (n_rb_dl - n_gap)) ? n_gap : (n_rb_dl - n_gap));; /* expect: 6 */
|
||||
first_rb = 0;
|
||||
break;
|
||||
case 15:
|
||||
n_gap = GAP_MAP[2][0]; /* expect: 8 */
|
||||
n_vrb_dl = 2*((n_gap < (n_rb_dl - n_gap)) ? n_gap : (n_rb_dl - n_gap)); /* expect: 14 */
|
||||
first_rb = 6;
|
||||
break;
|
||||
#endif
|
||||
case 25:
|
||||
n_gap = GAP_MAP[3][0]; /* expect: 12 */
|
||||
n_vrb_dl = 2*((n_gap < (n_rb_dl - n_gap)) ? n_gap : (n_rb_dl - n_gap)); /* expect: 24 */
|
||||
@@ -1906,18 +1874,6 @@ void schedule_PCH(module_id_t module_idP,frame_t frameP,sub_frame_t subframeP)
|
||||
}
|
||||
} else if (subframeP == 5 && ((frameP % 2) == 0 || (frameP % 8) == 1)) { // SIB + paging
|
||||
switch (n_rb_dl) {
|
||||
#if 0
|
||||
case 6:
|
||||
n_gap = n_rb_dl/2; /* expect: 3 */
|
||||
n_vrb_dl = 2*((n_gap < (n_rb_dl - n_gap)) ? n_gap : (n_rb_dl - n_gap));; /* expect: 6 */
|
||||
first_rb = 0;
|
||||
break;
|
||||
case 15:
|
||||
n_gap = GAP_MAP[2][0]; /* expect: 8 */
|
||||
n_vrb_dl = 2*((n_gap < (n_rb_dl - n_gap)) ? n_gap : (n_rb_dl - n_gap)); /* expect: 14 */
|
||||
first_rb = 10;
|
||||
break;
|
||||
#endif
|
||||
case 25:
|
||||
n_gap = GAP_MAP[3][0]; /* expect: 12 */
|
||||
n_vrb_dl = 2*((n_gap < (n_rb_dl - n_gap)) ? n_gap : (n_rb_dl - n_gap)); /* expect: 24 */
|
||||
|
||||
@@ -224,11 +224,6 @@ void dlsch_scheduler_pre_ue_select_fairRR(
|
||||
}
|
||||
|
||||
ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id];
|
||||
#if 0
|
||||
if (ue_sched_ctl->ul_out_of_sync == 1) {
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
harq_pid = frame_subframe2_dl_harq_pid(cc[CC_id].tdd_Config,frameP ,subframeP);
|
||||
|
||||
round = ue_sched_ctl->round[CC_id][harq_pid];
|
||||
@@ -334,14 +329,9 @@ void dlsch_scheduler_pre_ue_select_fairRR(
|
||||
}
|
||||
|
||||
ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id];
|
||||
#if 0
|
||||
if (ue_sched_ctl->ul_out_of_sync == 1) {
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
for(i = 0;i<dlsch_ue_select[CC_id].ue_num;i++){
|
||||
for(i = 0;i<dlsch_ue_select[CC_id].ue_num;i++){
|
||||
if(dlsch_ue_select[CC_id].list[i].UE_id == UE_id){
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(i < dlsch_ue_select[CC_id].ue_num)
|
||||
@@ -451,11 +441,6 @@ void dlsch_scheduler_pre_ue_select_fairRR(
|
||||
}
|
||||
|
||||
ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id];
|
||||
#if 0
|
||||
if (ue_sched_ctl->ul_out_of_sync == 1) {
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
for(i = 0;i<dlsch_ue_select[CC_id].ue_num;i++){
|
||||
if(dlsch_ue_select[CC_id].list[i].UE_id == UE_id){
|
||||
break;
|
||||
@@ -834,12 +819,6 @@ schedule_ue_spec_fairRR(module_id_t module_idP,
|
||||
int tdd_sfa;
|
||||
int ta_update;
|
||||
|
||||
#if 0
|
||||
if (UE_list->head == -1) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
start_meas(&eNB->schedule_dlsch);
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
|
||||
(VCD_SIGNAL_DUMPER_FUNCTIONS_SCHEDULE_DLSCH, VCD_FUNCTION_IN);
|
||||
@@ -976,14 +955,6 @@ schedule_ue_spec_fairRR(module_id_t module_idP,
|
||||
// update UL DAI after DLSCH scheduling
|
||||
set_ul_DAI(module_idP,UE_id,CC_id,frameP,subframeP);
|
||||
}
|
||||
//#warning RK->CR This old API call has to be revisited for FAPI, or logic must be changed
|
||||
#if 0
|
||||
/* add "fake" DCI to have CCE_allocation_infeasible work properly for next allocations */
|
||||
/* if we don't add it, next allocations may succeed but overall allocations may fail */
|
||||
/* will be removed at the end of this function */
|
||||
add_ue_spec_dci(&eNB->common_channels[CC_id].DCI_pdu, &(char[]) {
|
||||
0}, rnti, 1, aggregation, 1, format1, 0);
|
||||
#endif
|
||||
|
||||
nb_available_rb = ue_sched_ctl->pre_nb_available_rbs[CC_id];
|
||||
|
||||
@@ -2929,19 +2900,6 @@ void schedule_ulsch_rnti_fairRR(module_id_t module_idP,
|
||||
if(ulsch_ue_select[CC_id].list[ulsch_ue_num].ue_priority == SCH_UL_FIRST) {
|
||||
UE_template->scheduled_ul_bytes += get_TBS_UL(UE_template->mcs_UL[harq_pid],rb_table[rb_table_index]);
|
||||
UE_template->ul_SR = 0;
|
||||
#if 0
|
||||
LOG_D(MAC,"[eNB %d] CC_id %d UE %d/%x : adjusting ul_total_buffer, old %d, TBS %d\n", module_idP,CC_id,UE_id,rnti,UE_template->ul_total_buffer,get_TBS_UL(UE_template->mcs_UL[harq_pid],rb_table[rb_table_index]));
|
||||
if(ulsch_ue_select[CC_id].list[ulsch_ue_num].ul_total_buffer > 0){
|
||||
if (UE_template->ul_total_buffer > get_TBS_UL(UE_template->mcs_UL[harq_pid],rb_table[rb_table_index]))
|
||||
UE_template->ul_total_buffer -= get_TBS_UL(UE_template->mcs_UL[harq_pid],rb_table[rb_table_index]);
|
||||
else
|
||||
UE_template->ul_total_buffer = 0;
|
||||
LOG_D(MAC,"ul_total_buffer, new %d\n", UE_template->ul_total_buffer);
|
||||
} else {
|
||||
UE_template->ul_SR = 0;
|
||||
}
|
||||
LOG_D(MAC,"ul_total_buffer, new %d\n", UE_template->ul_total_buffer);
|
||||
#endif
|
||||
}
|
||||
if((ulsch_ue_select[CC_id].list[ulsch_ue_num].ue_priority == SCH_UL_INACTIVE) && (ULSCH_first_end == 0)) {
|
||||
ULSCH_first_end = 1;
|
||||
|
||||
@@ -1339,13 +1339,6 @@ fill_nfapi_harq_information(module_id_t module_idP,
|
||||
|
||||
AssertFatal(UE_id >= 0, "UE_id cannot be found, impossible\n");
|
||||
AssertFatal(UE_list != NULL, "UE_list is null\n");
|
||||
#if 0
|
||||
/* TODO: revisit, don't use Assert, it's perfectly possible to
|
||||
* have physicalConfigDedicated NULL here
|
||||
*/
|
||||
AssertFatal(UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated != NULL,
|
||||
"physicalConfigDedicated for rnti %x is null\n", rntiP);
|
||||
#endif
|
||||
|
||||
harq_information->harq_information_rel11.tl.tag = NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL11_TAG;
|
||||
harq_information->harq_information_rel11.num_ant_ports = 1;
|
||||
@@ -4298,14 +4291,6 @@ SR_indication(module_id_t mod_idP, int cc_idP, frame_t frameP,
|
||||
"[eNB %d][SR %x] Frame %d subframeP %d Signaling SR for UE %d on CC_id %d\n",
|
||||
mod_idP, rntiP, frameP, subframeP, UE_id, cc_idP);
|
||||
|
||||
#if 0
|
||||
UE_sched_ctrl *sched_ctl = &UE_list->UE_sched_ctrl[UE_id];
|
||||
|
||||
/* for the moment don't use ul_cqi from SR, value is too different from harq */
|
||||
sched_ctl->pucch1_snr[cc_idP] = ul_cqi;
|
||||
sched_ctl->pucch1_cqi_update[cc_idP] = 1;
|
||||
#endif
|
||||
|
||||
UE_list->UE_template[cc_idP][UE_id].ul_SR = 1;
|
||||
UE_list->UE_template[cc_idP][UE_id].ul_active = TRUE;
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
|
||||
|
||||
@@ -1575,34 +1575,6 @@ schedule_ulsch_rnti(module_id_t module_idP,
|
||||
T_INT(first_rb[CC_id]),
|
||||
T_INT(rb_table[rb_table_index]), T_INT(round));
|
||||
|
||||
#if 0
|
||||
/* This is done in rx_sdu, as it has to.
|
||||
* Since the code is a bit different, let's keep this version here for review, in case of problem.
|
||||
*/
|
||||
// fill in NAK information
|
||||
|
||||
hi_dci0_pdu = &hi_dci0_req_body->hi_dci0_pdu_list[hi_dci0_req_body->number_of_dci + hi_dci0_req_body->number_of_hi];
|
||||
memset((void *) hi_dci0_pdu, 0,
|
||||
sizeof(nfapi_hi_dci0_request_pdu_t));
|
||||
hi_dci0_pdu->pdu_type = NFAPI_HI_DCI0_HI_PDU_TYPE;
|
||||
hi_dci0_pdu->pdu_size = 2 + sizeof(nfapi_hi_dci0_hi_pdu);
|
||||
hi_dci0_pdu->hi_pdu.hi_pdu_rel8.tl.tag = NFAPI_HI_DCI0_REQUEST_HI_PDU_REL8_TAG;
|
||||
hi_dci0_pdu->hi_pdu.hi_pdu_rel8.resource_block_start = UE_template->first_rb_ul[harq_pid];
|
||||
hi_dci0_pdu->hi_pdu.hi_pdu_rel8.cyclic_shift_2_for_drms = UE_template->cshift[harq_pid];
|
||||
hi_dci0_pdu->hi_pdu.hi_pdu_rel8.hi_value = 0;
|
||||
hi_dci0_req_body->number_of_hi++;
|
||||
hi_dci0_req_body->sfnsf = sfnsf_add_subframe(sched_frame, sched_subframeP, 0);
|
||||
hi_dci0_req->sfn_sf = frameP<<4|subframeP;
|
||||
hi_dci0_req->header.message_id = NFAPI_HI_DCI0_REQUEST;
|
||||
|
||||
LOG_D(MAC,
|
||||
"[eNB %d][PUSCH %d/%x] CC_id %d Frame %d subframeP %d Scheduled (PHICH) UE %d (mcs %d, first rb %d, nb_rb %d, TBS %d, round %d)\n",
|
||||
module_idP, harq_pid, rnti, CC_id, frameP,
|
||||
subframeP, UE_id, UE_template->mcs_UL[harq_pid],
|
||||
UE_template->first_rb_ul[harq_pid],
|
||||
UE_template->nb_rb_ul[harq_pid],
|
||||
UE_template->TBS_UL[harq_pid], round);
|
||||
#endif
|
||||
// Add UL_config PDUs
|
||||
LOG_D(MAC,
|
||||
"[PUSCH %d] Frame %d, Subframe %d: Adding UL CONFIG.Request for UE %d/%x, ulsch_frame %d, ulsch_subframe %d\n",
|
||||
|
||||
@@ -130,11 +130,7 @@
|
||||
/*!\brief Maximum number od control elemenets */
|
||||
#define MAX_NUM_CE 5
|
||||
/*!\brief Maximum number of random access process */
|
||||
#if 0 // #if defined(USRP_REC_PLAY)
|
||||
#define NB_RA_PROC_MAX 1
|
||||
#else
|
||||
#define NB_RA_PROC_MAX 4
|
||||
#endif
|
||||
/*!\brief size of buffer status report table */
|
||||
#define BSR_TABLE_SIZE 64
|
||||
/*!\brief The power headroom reporting range is from -23 ...+40 dB and beyond, with step 1 */
|
||||
|
||||
@@ -430,36 +430,6 @@ static int ue_dl_compare(const void *_a, const void *_b, void *_params)
|
||||
}
|
||||
|
||||
return 0;
|
||||
#if 0
|
||||
/* The above order derives from the following. */
|
||||
if (round2 > round1) { // Check first if one of the UEs has an active HARQ process which needs service and swap order
|
||||
swap_UEs(UE_list, UE_id1, UE_id2, 0);
|
||||
} else if (round2 == round1) {
|
||||
// RK->NN : I guess this is for fairness in the scheduling. This doesn't make sense unless all UEs have the same configuration of logical channels. This should be done on the sum of all information that has to be sent. And still it wouldn't ensure fairness. It should be based on throughput seen by each UE or maybe using the head_sdu_creation_time, i.e. swap UEs if one is waiting longer for service.
|
||||
// for(j=0;j<MAX_NUM_LCID;j++){
|
||||
// if (eNB_mac_inst[Mod_id][pCC_id1].UE_template[UE_id1].dl_buffer_info[j] <
|
||||
// eNB_mac_inst[Mod_id][pCC_id2].UE_template[UE_id2].dl_buffer_info[j]){
|
||||
|
||||
// first check the buffer status for SRB1 and SRB2
|
||||
|
||||
if ((UE_list->UE_template[pCC_id1][UE_id1].dl_buffer_info[1] +
|
||||
UE_list->UE_template[pCC_id1][UE_id1].dl_buffer_info[2]) <
|
||||
(UE_list->UE_template[pCC_id2][UE_id2].dl_buffer_info[1] +
|
||||
UE_list->UE_template[pCC_id2][UE_id2].dl_buffer_info[2])) {
|
||||
swap_UEs(UE_list, UE_id1, UE_id2, 0);
|
||||
} else if (UE_list->UE_template[pCC_id1]
|
||||
[UE_id1].dl_buffer_head_sdu_creation_time_max <
|
||||
UE_list->UE_template[pCC_id2]
|
||||
[UE_id2].dl_buffer_head_sdu_creation_time_max) {
|
||||
swap_UEs(UE_list, UE_id1, UE_id2, 0);
|
||||
} else if (UE_list->UE_template[pCC_id1][UE_id1].dl_buffer_total <
|
||||
UE_list->UE_template[pCC_id2][UE_id2].dl_buffer_total) {
|
||||
swap_UEs(UE_list, UE_id1, UE_id2, 0);
|
||||
} else if (cqi1 < cqi2) {
|
||||
swap_UEs(UE_list, UE_id1, UE_id2, 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void decode_sorting_policy(module_id_t Mod_idP, slice_id_t slice_id) {
|
||||
@@ -499,10 +469,6 @@ void sort_UEs(module_id_t Mod_idP, slice_id_t slice_id, int frameP, sub_frame_t
|
||||
continue;
|
||||
if ((rnti = UE_RNTI(Mod_idP, i)) == NOT_A_RNTI)
|
||||
continue;
|
||||
#if 0
|
||||
if (UE_list->UE_sched_ctrl[i].ul_out_of_sync == 1)
|
||||
continue;
|
||||
#endif
|
||||
if (!ue_slice_membership(i, slice_id))
|
||||
continue;
|
||||
|
||||
@@ -522,78 +488,6 @@ void sort_UEs(module_id_t Mod_idP, slice_id_t slice_id, int frameP, sub_frame_t
|
||||
} else {
|
||||
UE_list->head = -1;
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
|
||||
int UE_id1, UE_id2;
|
||||
int pCC_id1, pCC_id2;
|
||||
int cqi1, cqi2, round1, round2;
|
||||
int i = 0, ii = 0; //,j=0;
|
||||
rnti_t rnti1, rnti2;
|
||||
|
||||
UE_list_t *UE_list = &RC.mac[Mod_idP]->UE_list;
|
||||
|
||||
for (i = UE_list->head; i >= 0; i = UE_list->next[i]) {
|
||||
|
||||
for (ii = UE_list->next[i]; ii >= 0; ii = UE_list->next[ii]) {
|
||||
|
||||
UE_id1 = i;
|
||||
rnti1 = UE_RNTI(Mod_idP, UE_id1);
|
||||
if (rnti1 == NOT_A_RNTI)
|
||||
continue;
|
||||
if (UE_list->UE_sched_ctrl[UE_id1].ul_out_of_sync == 1)
|
||||
continue;
|
||||
pCC_id1 = UE_PCCID(Mod_idP, UE_id1);
|
||||
cqi1 = maxcqi(Mod_idP, UE_id1); //
|
||||
round1 = maxround(Mod_idP, rnti1, frameP, subframeP, 0);
|
||||
|
||||
UE_id2 = ii;
|
||||
rnti2 = UE_RNTI(Mod_idP, UE_id2);
|
||||
if (rnti2 == NOT_A_RNTI)
|
||||
continue;
|
||||
if (UE_list->UE_sched_ctrl[UE_id2].ul_out_of_sync == 1)
|
||||
continue;
|
||||
cqi2 = maxcqi(Mod_idP, UE_id2);
|
||||
round2 = maxround(Mod_idP, rnti2, frameP, subframeP, 0); //mac_xface->get_ue_active_harq_pid(Mod_id,rnti2,subframe,&harq_pid2,&round2,0);
|
||||
pCC_id2 = UE_PCCID(Mod_idP, UE_id2);
|
||||
|
||||
if (round2 > round1) { // Check first if one of the UEs has an active HARQ process which needs service and swap order
|
||||
swap_UEs(UE_list, UE_id1, UE_id2, 0);
|
||||
} else if (round2 == round1) {
|
||||
// RK->NN : I guess this is for fairness in the scheduling. This doesn't make sense unless all UEs have the same configuration of logical channels. This should be done on the sum of all information that has to be sent. And still it wouldn't ensure fairness. It should be based on throughput seen by each UE or maybe using the head_sdu_creation_time, i.e. swap UEs if one is waiting longer for service.
|
||||
// for(j=0;j<MAX_NUM_LCID;j++){
|
||||
// if (eNB_mac_inst[Mod_id][pCC_id1].UE_template[UE_id1].dl_buffer_info[j] <
|
||||
// eNB_mac_inst[Mod_id][pCC_id2].UE_template[UE_id2].dl_buffer_info[j]){
|
||||
|
||||
// first check the buffer status for SRB1 and SRB2
|
||||
|
||||
if ((UE_list->UE_template[pCC_id1][UE_id1].
|
||||
dl_buffer_info[1] +
|
||||
UE_list->UE_template[pCC_id1][UE_id1].
|
||||
dl_buffer_info[2]) <
|
||||
(UE_list->UE_template[pCC_id2][UE_id2].
|
||||
dl_buffer_info[1] +
|
||||
UE_list->UE_template[pCC_id2][UE_id2].
|
||||
dl_buffer_info[2])) {
|
||||
swap_UEs(UE_list, UE_id1, UE_id2, 0);
|
||||
} else if (UE_list->UE_template[pCC_id1]
|
||||
[UE_id1].dl_buffer_head_sdu_creation_time_max <
|
||||
UE_list->UE_template[pCC_id2]
|
||||
[UE_id2].dl_buffer_head_sdu_creation_time_max) {
|
||||
swap_UEs(UE_list, UE_id1, UE_id2, 0);
|
||||
} else if (UE_list->UE_template[pCC_id1][UE_id1].
|
||||
dl_buffer_total <
|
||||
UE_list->UE_template[pCC_id2][UE_id2].
|
||||
dl_buffer_total) {
|
||||
swap_UEs(UE_list, UE_id1, UE_id2, 0);
|
||||
} else if (cqi1 < cqi2) {
|
||||
swap_UEs(UE_list, UE_id1, UE_id2, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void dlsch_scheduler_pre_processor_accounting(module_id_t Mod_id,
|
||||
@@ -638,10 +532,6 @@ void dlsch_scheduler_pre_processor_accounting(module_id_t Mod_id,
|
||||
|
||||
if (rnti == NOT_A_RNTI)
|
||||
continue;
|
||||
#if 0
|
||||
if (UE_list->UE_sched_ctrl[UE_id].ul_out_of_sync == 1)
|
||||
continue;
|
||||
#endif
|
||||
if (!ue_slice_membership(UE_id, slice_id))
|
||||
continue;
|
||||
|
||||
@@ -721,10 +611,6 @@ void dlsch_scheduler_pre_processor_accounting(module_id_t Mod_id,
|
||||
|
||||
if (rnti == NOT_A_RNTI)
|
||||
continue;
|
||||
#if 0
|
||||
if (UE_list->UE_sched_ctrl[UE_id].ul_out_of_sync == 1)
|
||||
continue;
|
||||
#endif
|
||||
if (!ue_slice_membership(UE_id, slice_id))
|
||||
continue;
|
||||
|
||||
@@ -797,10 +683,6 @@ void dlsch_scheduler_pre_processor_accounting(module_id_t Mod_id,
|
||||
// LOG_D(MAC,"UE %d rnti 0x\n", UE_id, rnti );
|
||||
if (rnti == NOT_A_RNTI)
|
||||
continue;
|
||||
#if 0
|
||||
if (UE_list->UE_sched_ctrl[UE_id].ul_out_of_sync == 1)
|
||||
continue;
|
||||
#endif
|
||||
if (!ue_slice_membership(UE_id, slice_id))
|
||||
continue;
|
||||
|
||||
@@ -1604,20 +1486,6 @@ void ulsch_scheduler_pre_processor(module_id_t module_idP,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* this logging is wrong, ue_sched_ctl may not be valid here
|
||||
* TODO: fix
|
||||
*/
|
||||
for (CC_id = 0; CC_id < RC.nb_mac_CC[module_idP]; CC_id++) {
|
||||
|
||||
if (total_allocated_rbs[CC_id] > 0) {
|
||||
LOG_D(MAC, "[eNB %d] total RB allocated for all UEs = %d/%d\n",
|
||||
module_idP, total_allocated_rbs[CC_id],
|
||||
ue_sched_ctl->max_rbs_allowed_slice_uplink[CC_id][slice_id] - first_rb[CC_id]);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
@@ -1803,31 +1671,6 @@ static int ue_ul_compare(const void *_a, const void *_b, void *_params)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
|
||||
#if 0
|
||||
/* The above order derives from the following.
|
||||
* The last case is not handled: "if (UE_list->UE_template[pCCid2][UE_id2].ul_total_buffer > 0 )"
|
||||
* I don't think it makes a big difference.
|
||||
*/
|
||||
if (round2 > round1) {
|
||||
swap_UEs(UE_list, UE_id1, UE_id2, 1);
|
||||
} else if (round2 == round1) {
|
||||
if (UE_list->UE_template[pCCid1][UE_id1].ul_buffer_info[LCGID0] <
|
||||
UE_list->UE_template[pCCid2][UE_id2].ul_buffer_info[LCGID0]) {
|
||||
swap_UEs(UE_list, UE_id1, UE_id2, 1);
|
||||
} else if (UE_list->UE_template[pCCid1][UE_id1].ul_total_buffer <
|
||||
UE_list->UE_template[pCCid2][UE_id2].ul_total_buffer) {
|
||||
swap_UEs(UE_list, UE_id1, UE_id2, 1);
|
||||
} else if (UE_list->UE_template[pCCid1][UE_id1].
|
||||
pre_assigned_mcs_ul <
|
||||
UE_list->UE_template[pCCid2][UE_id2].
|
||||
pre_assigned_mcs_ul) {
|
||||
if (UE_list->UE_template[pCCid2][UE_id2].ul_total_buffer > 0) {
|
||||
swap_UEs(UE_list, UE_id1, UE_id2, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void sort_ue_ul(module_id_t module_idP, int frameP, sub_frame_t subframeP)
|
||||
@@ -1862,71 +1705,4 @@ void sort_ue_ul(module_id_t module_idP, int frameP, sub_frame_t subframeP)
|
||||
} else {
|
||||
UE_list->head_ul = -1;
|
||||
}
|
||||
|
||||
#if 0
|
||||
int UE_id1, UE_id2;
|
||||
int pCCid1, pCCid2;
|
||||
int round1, round2;
|
||||
int i = 0, ii = 0;
|
||||
rnti_t rnti1, rnti2;
|
||||
|
||||
UE_list_t *UE_list = &RC.mac[module_idP]->UE_list;
|
||||
|
||||
for (i = UE_list->head_ul; i >= 0; i = UE_list->next_ul[i]) {
|
||||
|
||||
//LOG_I(MAC,"sort ue ul i %d\n",i);
|
||||
for (ii = UE_list->next_ul[i]; ii >= 0; ii = UE_list->next_ul[ii]) {
|
||||
//LOG_I(MAC,"sort ul ue 2 ii %d\n",ii);
|
||||
|
||||
UE_id1 = i;
|
||||
rnti1 = UE_RNTI(module_idP, UE_id1);
|
||||
|
||||
if (rnti1 == NOT_A_RNTI)
|
||||
continue;
|
||||
if (UE_list->UE_sched_ctrl[i].ul_out_of_sync == 1)
|
||||
continue;
|
||||
|
||||
|
||||
pCCid1 = UE_PCCID(module_idP, UE_id1);
|
||||
round1 = maxround(module_idP, rnti1, frameP, subframeP, 1);
|
||||
|
||||
UE_id2 = ii;
|
||||
rnti2 = UE_RNTI(module_idP, UE_id2);
|
||||
|
||||
if (rnti2 == NOT_A_RNTI)
|
||||
continue;
|
||||
if (UE_list->UE_sched_ctrl[UE_id2].ul_out_of_sync == 1)
|
||||
continue;
|
||||
|
||||
pCCid2 = UE_PCCID(module_idP, UE_id2);
|
||||
round2 = maxround(module_idP, rnti2, frameP, subframeP, 1);
|
||||
|
||||
if (round2 > round1) {
|
||||
swap_UEs(UE_list, UE_id1, UE_id2, 1);
|
||||
} else if (round2 == round1) {
|
||||
if (UE_list->
|
||||
UE_template[pCCid1][UE_id1].ul_buffer_info[LCGID0] <
|
||||
UE_list->UE_template[pCCid2][UE_id2].
|
||||
ul_buffer_info[LCGID0]) {
|
||||
swap_UEs(UE_list, UE_id1, UE_id2, 1);
|
||||
} else if (UE_list->UE_template[pCCid1][UE_id1].
|
||||
ul_total_buffer <
|
||||
UE_list->UE_template[pCCid2][UE_id2].
|
||||
ul_total_buffer) {
|
||||
swap_UEs(UE_list, UE_id1, UE_id2, 1);
|
||||
} else if (UE_list->
|
||||
UE_template[pCCid1][UE_id1].pre_assigned_mcs_ul
|
||||
<
|
||||
UE_list->
|
||||
UE_template[pCCid2][UE_id2].pre_assigned_mcs_ul)
|
||||
{
|
||||
if (UE_list->UE_template[pCCid2][UE_id2].
|
||||
ul_total_buffer > 0) {
|
||||
swap_UEs(UE_list, UE_id1, UE_id2, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -595,9 +595,7 @@ pdcp_data_ind(
|
||||
}
|
||||
|
||||
if (pdcp_is_rx_seq_number_valid(sequence_number, pdcp_p, srb_flagP) == TRUE) {
|
||||
#if 0
|
||||
LOG_T(PDCP, "Incoming PDU has a sequence number (%d) in accordance with RX window\n", sequence_number);
|
||||
#endif
|
||||
/* if (dc == PDCP_DATA_PDU )
|
||||
LOG_D(PDCP, "Passing piggybacked SDU to NAS driver...\n");
|
||||
else
|
||||
@@ -612,13 +610,9 @@ pdcp_data_ind(
|
||||
* XXX Till we implement in-sequence delivery and duplicate discarding
|
||||
* mechanism all out-of-order packets will be delivered to RRC/IP
|
||||
*/
|
||||
#if 0
|
||||
LOG_D(PDCP, "Ignoring PDU...\n");
|
||||
free_mem_block(sdu_buffer, __func__);
|
||||
LOG_W(PDCP, "Ignoring PDU...\n");
|
||||
free_mem_block(sdu_buffer_pP, __func__);
|
||||
return FALSE;
|
||||
#else
|
||||
//LOG_W(PDCP, "Delivering out-of-order SDU to upper layer...\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
// SRB1/2: control-plane data
|
||||
@@ -1019,29 +1013,6 @@ pdcp_run (
|
||||
}
|
||||
} while(msg_p != NULL);
|
||||
|
||||
# if 0
|
||||
{
|
||||
MessageDef *msg_resp_p;
|
||||
|
||||
msg_resp_p = itti_alloc_new_message(TASK_PDCP_ENB, MESSAGE_TEST);
|
||||
|
||||
itti_send_msg_to_task(TASK_RRC_ENB, 1, msg_resp_p);
|
||||
}
|
||||
{
|
||||
MessageDef *msg_resp_p;
|
||||
|
||||
msg_resp_p = itti_alloc_new_message(TASK_PDCP_ENB, MESSAGE_TEST);
|
||||
|
||||
itti_send_msg_to_task(TASK_ENB_APP, 2, msg_resp_p);
|
||||
}
|
||||
{
|
||||
MessageDef *msg_resp_p;
|
||||
|
||||
msg_resp_p = itti_alloc_new_message(TASK_PDCP_ENB, MESSAGE_TEST);
|
||||
|
||||
itti_send_msg_to_task(TASK_MAC_ENB, 3, msg_resp_p);
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// IP/NAS -> PDCP traffic : TX, read the pkt from the upper layer buffer
|
||||
|
||||
@@ -497,17 +497,6 @@ typedef struct {
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* Missing PDU information struct, a copy of this will be enqueued
|
||||
* into pdcp.missing_pdus for every missing PDU
|
||||
*/
|
||||
typedef struct pdcp_missing_pdu_info_t {
|
||||
pdcp_sn_t sequence_number;
|
||||
} pdcp_missing_pdu_info_t;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* PDCP limit values
|
||||
*/
|
||||
|
||||
@@ -128,9 +128,7 @@ boolean_t pdcp_advance_rx_window(pdcp_t* pdcp_entity)
|
||||
* Update sequence numbering state and Hyper Frame Number if SN has already reached
|
||||
* its max value (see 5.1 PDCP Data Transfer Procedures)
|
||||
*/
|
||||
#if 0
|
||||
LOG_D(PDCP, "Advancing RX window...\n");
|
||||
#endif
|
||||
|
||||
if (pdcp_entity->next_pdcp_rx_sn == pdcp_calculate_max_seq_num_for_given_size(pdcp_entity->seq_num_size)) {
|
||||
pdcp_entity->next_pdcp_rx_sn = 0;
|
||||
@@ -152,9 +150,7 @@ boolean_t pdcp_is_rx_seq_number_valid(uint16_t seq_num, pdcp_t* pdcp_entity,srb_
|
||||
|
||||
uint16_t reordering_window = 0;
|
||||
|
||||
#if 0
|
||||
LOG_D(PDCP, "Incoming RX Sequence number is %04d\n", seq_num);
|
||||
#endif
|
||||
|
||||
if (pdcp_is_seq_num_size_valid(pdcp_entity) == FALSE || pdcp_is_seq_num_valid(seq_num, pdcp_entity->seq_num_size) == FALSE) {
|
||||
return FALSE;
|
||||
@@ -165,9 +161,7 @@ boolean_t pdcp_is_rx_seq_number_valid(uint16_t seq_num, pdcp_t* pdcp_entity,srb_
|
||||
* (and to build PDCP Control PDU for PDCP status report)
|
||||
*/
|
||||
if (pdcp_mark_current_pdu_as_received(seq_num, pdcp_entity) == TRUE) {
|
||||
#if 0
|
||||
LOG_I(PDCP, "Received sequence number successfuly marked\n");
|
||||
#endif
|
||||
} else {
|
||||
LOG_W(PDCP, "Cannot mark received sequence number on the bitmap!\n");
|
||||
}
|
||||
@@ -192,13 +186,11 @@ boolean_t pdcp_is_rx_seq_number_valid(uint16_t seq_num, pdcp_t* pdcp_entity,srb_
|
||||
|
||||
// same the old next_pdcp_rx_sn to revert otherwise
|
||||
pdcp_entity->next_pdcp_rx_sn_before_integrity = pdcp_entity->next_pdcp_rx_sn;
|
||||
#if 0
|
||||
|
||||
if (seq_num != pdcp_entity->next_pdcp_rx_sn) {
|
||||
LOG_D(PDCP,"Re-adjusting the sequence number to %d\n", seq_num);
|
||||
}
|
||||
|
||||
#endif
|
||||
//set Next_PDCP_RX_SN to the received PDCP SN +1 ;
|
||||
pdcp_entity->next_pdcp_rx_sn = seq_num;
|
||||
pdcp_advance_rx_window(pdcp_entity); // + 1, and check if it is larger than Maximum_PDCP_SN:
|
||||
@@ -247,9 +239,7 @@ boolean_t pdcp_is_rx_seq_number_valid(uint16_t seq_num, pdcp_t* pdcp_entity,srb_
|
||||
//set Next_PDCP_RX_SN to the received PDCP SN +1 ;
|
||||
pdcp_entity->next_pdcp_rx_sn = seq_num;
|
||||
pdcp_advance_rx_window(pdcp_entity); // + 1, anc check if it is larger than Maximum_PDCP_SN:
|
||||
#if 0
|
||||
LOG_D(PDCP,"Re-adjusting the sequence number to %d\n", seq_num);
|
||||
#endif
|
||||
} else if (seq_num < pdcp_entity->next_pdcp_rx_sn) {
|
||||
// use COUNT based on RX_HFN and the received PDCP SN for deciphering the PDCP PDU;
|
||||
pdcp_entity->rx_hfn_offset = 0;
|
||||
@@ -311,12 +301,8 @@ boolean_t pdcp_mark_current_pdu_as_received(uint16_t seq_num, pdcp_t* pdcp_entit
|
||||
/*
|
||||
* Set relevant bit
|
||||
*/
|
||||
#if 0
|
||||
LOG_D(PDCP, "Marking %d. bit of %d. octet of status bitmap\n", (seq_num % 8) + 1, octet_index);
|
||||
#endif
|
||||
util_mark_nth_bit_of_octet(&pdcp_entity->missing_pdu_bitmap[octet_index], seq_num % 8);
|
||||
#if 0
|
||||
util_print_binary_representation((uint8_t*)"Current state of relevant octet: ", pdcp_entity->missing_pdu_bitmap[octet_index]);
|
||||
#endif
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -172,36 +172,6 @@ boolean_t rlc_am_nack_pdu (
|
||||
rlc_pP->retrans_num_pdus ++;
|
||||
}
|
||||
}
|
||||
|
||||
/* TODO: Move this part in UL SCH processing */
|
||||
#if 0
|
||||
if (rlc_pP->tx_data_pdu_buffer[snP].retx_count >= rlc_pP->max_retx_threshold) {
|
||||
for (pdu_sdu_index = 0; pdu_sdu_index < rlc_pP->tx_data_pdu_buffer[snP].nb_sdus; pdu_sdu_index++) {
|
||||
sdu_index = rlc_pP->tx_data_pdu_buffer[snP].sdus_index[pdu_sdu_index];
|
||||
assert(pdu_sdu_index < RLC_AM_MAX_SDU_IN_PDU);
|
||||
assert(sdu_index < RLC_AM_SDU_CONTROL_BUFFER_SIZE);
|
||||
rlc_pP->input_sdus[sdu_index].nb_pdus_ack += 1;
|
||||
|
||||
if (rlc_pP->input_sdus[sdu_index].nb_pdus_ack == rlc_pP->input_sdus[sdu_index].nb_pdus) {
|
||||
#if 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(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;
|
||||
MSC_LOG_EVENT((ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE,\
|
||||
"0 "PROTOCOL_RLC_AM_MSC_FMT" Dropped SDU mui %u cause max_retx %u reached",\
|
||||
PROTOCOL_RLC_AM_MSC_ARGS(ctxt_pP,rlc_pP),
|
||||
rlc_pP->input_sdus[sdu_index].mui,
|
||||
rlc_pP->max_retx_threshold);
|
||||
|
||||
rlc_am_free_in_sdu(ctxt_pP, rlc_pP, sdu_index);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[NACK-PDU] ERROR NACK MISSING PDU SN %05d\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
@@ -768,473 +738,6 @@ mem_block_t* rlc_am_retransmit_get_am_segment(
|
||||
return mem_pdu_segment_p;
|
||||
}
|
||||
|
||||
#if 0
|
||||
//-----------------------------------------------------------------------------
|
||||
mem_block_t* rlc_am_retransmit_get_subsegment(
|
||||
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*/)
|
||||
{
|
||||
|
||||
// 5.2 ARQ procedures
|
||||
// ARQ procedures are only performed by an AM RLC entity.
|
||||
// 5.2.1 Retransmission
|
||||
// The transmitting side of an AM RLC entity can receive a negative acknowledgement (notification of reception failure
|
||||
// by its peer AM RLC entity) for an AMD PDU or a portion of an AMD PDU by the following:
|
||||
// - STATUS PDU from its peer AM RLC entity.
|
||||
//
|
||||
// When receiving a negative acknowledgement for an AMD PDU or a portion of an AMD PDU by a STATUS PDU from
|
||||
// its peer AM RLC entity, the transmitting side of the AM RLC entity shall:
|
||||
// - if the SN of the corresponding AMD PDU falls within the range VT(A) <= SN < VT(S):
|
||||
// - consider the AMD PDU or the portion of the AMD PDU for which a negative acknowledgement was
|
||||
// received for retransmission.
|
||||
//
|
||||
// When an AMD PDU or a portion of an AMD PDU is considered for retransmission, the transmitting side of the AM
|
||||
// RLC entity shall:
|
||||
// - if the AMD PDU is considered for retransmission for the first time:
|
||||
// - set the RETX_COUNT associated with the AMD PDU to zero;
|
||||
// - else, if it (the AMD PDU or the portion of the AMD PDU that is considered for retransmission) is not pending
|
||||
// for retransmission already, or a portion of it is not pending for retransmission already:
|
||||
// - increment the RETX_COUNT;
|
||||
// - if RETX_COUNT = maxRetxThreshold:
|
||||
// - indicate to upper layers that max retransmission has been reached.
|
||||
//
|
||||
// When retransmitting an AMD PDU, the transmitting side of an AM RLC entity shall:
|
||||
// - if the AMD PDU can entirely fit within the total size of RLC PDU(s) indicated by lower layer at the particular
|
||||
// transmission opportunity:
|
||||
// - deliver the AMD PDU as it is except for the P field (the P field should be set according to sub clause 5.2.2) to
|
||||
// lower layer;
|
||||
// - otherwise:
|
||||
// - segment the AMD PDU, form a new AMD PDU segment which will fit within the total size of RLC PDU(s)
|
||||
// indicated by lower layer at the particular transmission opportunity and deliver the new AMD PDU segment
|
||||
// to lower layer.
|
||||
//
|
||||
// When retransmitting a portion of an AMD PDU, the transmitting side of an AM RLC entity shall:
|
||||
// - segment the portion of the AMD PDU as necessary, form a new AMD PDU segment which will fit within the
|
||||
// total size of RLC PDU(s) indicated by lower layer at the particular transmission opportunity and deliver the new
|
||||
// AMD PDU segment to lower layer.
|
||||
//
|
||||
// When forming a new AMD PDU segment, the transmitting side of an AM RLC entity shall:
|
||||
// - only map the Data field of the original AMD PDU to the Data field of the new AMD PDU segment;
|
||||
// - set the header of the new AMD PDU segment in accordance with the description in sub clause 6.;
|
||||
// - set the P field according to sub clause 5.2.2.
|
||||
|
||||
mem_block_t* mb_original_p = rlc_pP->tx_data_pdu_buffer[snP].mem_block;
|
||||
|
||||
if (mb_original_p != NULL) {
|
||||
mem_block_t* mb_sub_segment_p = get_free_mem_block(*sizeP + sizeof(struct mac_tb_req), __func__);
|
||||
if(mb_sub_segment_p == NULL) return NULL;
|
||||
rlc_am_pdu_sn_10_t* pdu_original_p = (rlc_am_pdu_sn_10_t*) (&mb_original_p->data[sizeof(struct mac_tb_req)]);
|
||||
rlc_am_pdu_sn_10_t* pdu_sub_segment_p = (rlc_am_pdu_sn_10_t*) (&mb_sub_segment_p->data[sizeof(struct mac_tb_req)]);
|
||||
rlc_am_pdu_info_t pdu_info;
|
||||
int max_copy_payload_size;
|
||||
//LG avoid WARNING int test_max_copy_payload_size;
|
||||
int test_pdu_copy_size = 0;
|
||||
|
||||
((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(ctxt_pP, rlc_pP, pdu_original_p, rlc_pP->tx_data_pdu_buffer[snP].header_and_payload_size, &pdu_info) >= 0) {
|
||||
int li_index = 0;
|
||||
int start_offset = rlc_pP->tx_data_pdu_buffer[snP].nack_so_start;
|
||||
int stop_offset = rlc_pP->tx_data_pdu_buffer[snP].nack_so_stop;
|
||||
|
||||
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] ORIGINAL PDU SN %04d:\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
snP);
|
||||
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)
|
||||
if (stop_offset == 0x7FFF) {
|
||||
rlc_pP->tx_data_pdu_buffer[snP].nack_so_stop = rlc_pP->tx_data_pdu_buffer[snP].payload_size - 1;
|
||||
stop_offset = rlc_pP->tx_data_pdu_buffer[snP].nack_so_stop;
|
||||
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] UPDATED RETRANS PDU SN %04d nack_so_stop FROM 0x7FFF to %05d\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
snP,
|
||||
stop_offset);
|
||||
}
|
||||
|
||||
// FIXED PART AMD PDU SEGMENT HEADER
|
||||
// 6.2.1.5 AMD PDU segment
|
||||
// AMD PDU segment consists of a Data field and an AMD PDU segment header.
|
||||
//
|
||||
// AMD PDU segment header consists of a fixed part (fields that are present for every AMD PDU segment) and an
|
||||
// extension part (fields that are present for an AMD PDU segment when necessary). The fixed part of the AMD PDU
|
||||
// segment header itself is byte aligned and consists of a D/C, a RF, a P, a FI, an E, a SN, a LSF and a SO. The extension
|
||||
// part of the AMD PDU segment header itself is byte aligned and consists of E(s) and LI(s).
|
||||
//
|
||||
// An AMD PDU segment header consists of an extension part only when more than one Data field elements are present
|
||||
// in the AMD PDU segment, in which case an E and a LI are present for every Data field element except the last.
|
||||
// Furthermore, when an AMD PDU segment header consists of an odd number of LI(s), four padding bits follow after the
|
||||
// last LI.
|
||||
|
||||
pdu_sub_segment_p->b1 = (pdu_original_p->b1 & 0x83) | 0x40;
|
||||
pdu_sub_segment_p->b2 = pdu_original_p->b2;
|
||||
pdu_sub_segment_p->data[0] = ((uint8_t)(start_offset >> 8));
|
||||
pdu_sub_segment_p->data[1] = ((uint8_t)(start_offset & 0xFF));
|
||||
|
||||
*sizeP = *sizeP - 4;
|
||||
|
||||
|
||||
int continue_fill_pdu_with_pdu = 1;
|
||||
int test_pdu_remaining_size = *sizeP;
|
||||
int test_num_li = 0;
|
||||
int fill_num_li ;
|
||||
int test_li_sum = 0;
|
||||
int not_test_fi = 0; // by default not 1st byte and not last byte af a SDU
|
||||
int test_start_offset;
|
||||
unsigned int test_li_length_in_bytes = 1;
|
||||
int16_t test_li_list[RLC_AM_MAX_SDU_IN_PDU];
|
||||
uint8_t* fill_payload_p;
|
||||
//int test_fi_last_byte_pdu_is_last_byte_sdu = 0;
|
||||
//int test_fi_first_byte_pdu_is_first_byte_sdu = 0;
|
||||
|
||||
rlc_am_e_li_t* e_li_sub_segment = (rlc_am_e_li_t*)(&pdu_sub_segment_p->data[2]);
|
||||
//int first_enter_in_start_offset_lt_li_sum = 1;
|
||||
int not_fi_original = ((pdu_original_p->b1 & 0x18) >> 3) ^ 3;
|
||||
|
||||
//-------------------------------------------------------
|
||||
// set MAX payload size that can be copied
|
||||
// first constraint : the size of the hole to retransmit
|
||||
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, PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] HOLE FOUND SO %d -> %d\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
start_offset,
|
||||
stop_offset);
|
||||
LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] ORIGINAL FI %d\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
(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, PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] CUT max_copy_payload_size with test_pdu_remaining_size %d -> %d\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
max_copy_payload_size,
|
||||
test_pdu_remaining_size);
|
||||
max_copy_payload_size = test_pdu_remaining_size;
|
||||
}
|
||||
|
||||
|
||||
if (start_offset == 0) {
|
||||
not_test_fi = (not_fi_original & 0x02);
|
||||
}
|
||||
|
||||
test_start_offset = start_offset;
|
||||
|
||||
//.find the li corresponding to the nack_so_start (start_offset)
|
||||
if (pdu_info.num_li > 0) {
|
||||
LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] ORIGINAL NUM LI %d\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
pdu_info.num_li);
|
||||
|
||||
while ((li_index < pdu_info.num_li) && (continue_fill_pdu_with_pdu)) {
|
||||
LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] FIND LI %d\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
pdu_info.li_list[li_index]);
|
||||
|
||||
if (max_copy_payload_size > test_pdu_remaining_size) {
|
||||
LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] CUT max_copy_payload_size with test_pdu_remaining_size %d -> %d\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
max_copy_payload_size,
|
||||
test_pdu_remaining_size);
|
||||
max_copy_payload_size = test_pdu_remaining_size;
|
||||
}
|
||||
|
||||
assert(max_copy_payload_size >= 0);
|
||||
assert(test_pdu_remaining_size >= 0);
|
||||
|
||||
test_li_sum += pdu_info.li_list[li_index];
|
||||
|
||||
//---------------------------------------------------------------
|
||||
if (test_start_offset < test_li_sum) {
|
||||
|
||||
LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] test_start_offset < test_li_sum %d < %d\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
test_start_offset,
|
||||
test_li_sum);
|
||||
/*if (test_max_copy_payload_size > (test_li_sum - test_start_offset)) {
|
||||
#if 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",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, PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] (max_copy_payload_size %d + test_start_offset %d) < test_li_sum %d\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
max_copy_payload_size,
|
||||
test_start_offset,
|
||||
test_li_sum);
|
||||
LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] COPY SO %d -> %d %d BYTES\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
test_start_offset ,
|
||||
test_start_offset + max_copy_payload_size - 1,
|
||||
max_copy_payload_size );
|
||||
assert(max_copy_payload_size > 0);
|
||||
continue_fill_pdu_with_pdu = 0;
|
||||
test_pdu_copy_size = test_pdu_copy_size + max_copy_payload_size;
|
||||
test_start_offset = test_start_offset + max_copy_payload_size;
|
||||
not_test_fi = not_test_fi & 0x02; // clear b0, last byte does not correspond to last byte of a SDU
|
||||
max_copy_payload_size = 0;
|
||||
|
||||
} else if ((max_copy_payload_size + test_start_offset) == test_li_sum) {
|
||||
LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] (max_copy_payload_size + test_start_offset) == test_li_sum %d == %d\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
(max_copy_payload_size + test_start_offset) ,
|
||||
test_li_sum);
|
||||
LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] COPY SO %d -> %d %d BYTES\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
test_start_offset ,
|
||||
test_start_offset + max_copy_payload_size - 1,
|
||||
max_copy_payload_size );
|
||||
assert(max_copy_payload_size > 0);
|
||||
continue_fill_pdu_with_pdu = 0;
|
||||
test_pdu_copy_size = test_pdu_copy_size + max_copy_payload_size;
|
||||
test_start_offset = test_start_offset + max_copy_payload_size;
|
||||
not_test_fi = not_test_fi | 0x01;// set b0, last byte does correspond to last byte of a SDU
|
||||
max_copy_payload_size = 0;
|
||||
|
||||
} else if ((max_copy_payload_size + test_start_offset - (test_li_length_in_bytes ^ 3)) > test_li_sum) {
|
||||
LOG_T(RLC,
|
||||
PROTOCOL_RLC_AM_CTXT_FMT"[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",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
(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, PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] COPY SO %d -> %d %d BYTES\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
test_start_offset ,
|
||||
test_li_sum - 1,
|
||||
test_li_sum - test_start_offset );
|
||||
assert((test_li_sum - test_start_offset) > 0);
|
||||
test_li_list[test_num_li++] = test_li_sum - test_start_offset;
|
||||
test_pdu_copy_size = test_pdu_copy_size + test_li_sum - test_start_offset;
|
||||
test_li_length_in_bytes = test_li_length_in_bytes ^ 3;
|
||||
|
||||
test_pdu_remaining_size = test_pdu_remaining_size - test_li_sum + test_start_offset -
|
||||
test_li_length_in_bytes;
|
||||
|
||||
max_copy_payload_size = max_copy_payload_size - test_li_sum + test_start_offset - test_li_length_in_bytes;
|
||||
LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] NOW max_copy_payload_size %d BYTES test_start_offset %d\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
max_copy_payload_size,
|
||||
test_li_sum);
|
||||
// normally the next while itereation will add bytes to PDU
|
||||
//not_test_fi = not_test_fi | 0x01; // set b0, last byte does correspond to last byte of a SDU
|
||||
test_start_offset = test_li_sum;
|
||||
|
||||
} else {
|
||||
LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] (test_max_copy_payload_size + test_start_offset ) > test_li_sum %d > %d\n NO REMAINING SIZE FOR LI",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
(max_copy_payload_size + test_start_offset),
|
||||
test_li_sum);
|
||||
LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] COPY SO %d -> %d %d BYTES\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
test_start_offset ,
|
||||
test_li_sum - 1,
|
||||
test_li_sum - test_start_offset );
|
||||
assert((test_li_sum - test_start_offset) > 0);
|
||||
continue_fill_pdu_with_pdu = 0;
|
||||
test_pdu_copy_size = test_pdu_copy_size + test_li_sum - test_start_offset;
|
||||
|
||||
test_pdu_remaining_size = test_pdu_remaining_size - test_li_sum + test_start_offset;
|
||||
|
||||
max_copy_payload_size = max_copy_payload_size - test_li_sum + test_start_offset;
|
||||
test_start_offset = test_li_sum;
|
||||
not_test_fi = not_test_fi | 0x01; // set b0, last byte does correspond to last byte of a SDU
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// start offset start at the begining of a SDU
|
||||
// and it cant be the first data field of the original PDU
|
||||
} else if (test_start_offset == test_li_sum) {
|
||||
LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] (test_start_offset == test_li_sum) %d == %d\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
test_start_offset ,
|
||||
test_li_sum);
|
||||
|
||||
if ((test_num_li == 0) && (test_pdu_copy_size == 0)) {
|
||||
not_test_fi = not_test_fi | 0x02; // set b1, first byte does correspond to first byte of a SDU
|
||||
}
|
||||
}
|
||||
|
||||
li_index = li_index + 1;
|
||||
}
|
||||
|
||||
if ((continue_fill_pdu_with_pdu > 0) &&
|
||||
(li_index == pdu_info.num_li) &&
|
||||
(pdu_info.hidden_size > 0) &&
|
||||
(test_pdu_remaining_size > 0) &&
|
||||
(max_copy_payload_size > 0) ) {
|
||||
|
||||
if (max_copy_payload_size > test_pdu_remaining_size) {
|
||||
LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] TRYING HIDDEN SIZE...CUT max_copy_payload_size with test_pdu_remaining_size %d -> %d\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
max_copy_payload_size,
|
||||
test_pdu_remaining_size);
|
||||
max_copy_payload_size = test_pdu_remaining_size;
|
||||
}
|
||||
|
||||
// remaining bytes to fill, redundant check, but ...
|
||||
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,
|
||||
PROTOCOL_RLC_AM_CTXT_FMT"[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",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
pdu_info.hidden_size + test_li_sum - test_start_offset,
|
||||
max_copy_payload_size,
|
||||
test_start_offset,
|
||||
pdu_info.hidden_size,
|
||||
test_li_sum,
|
||||
test_pdu_copy_size);
|
||||
test_start_offset = pdu_info.hidden_size + test_li_sum;
|
||||
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, PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] COPYING REMAINING SIZE %d (/%d)\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
max_copy_payload_size,
|
||||
pdu_info.hidden_size);
|
||||
test_pdu_copy_size += max_copy_payload_size;
|
||||
test_start_offset = test_start_offset + max_copy_payload_size;
|
||||
not_test_fi = not_test_fi & 0x2; // clear b0 because no SDU ending in this PDU
|
||||
}
|
||||
}
|
||||
} else { // num_li == 0
|
||||
LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] (num_li == 0)\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP));
|
||||
test_pdu_copy_size = max_copy_payload_size;
|
||||
|
||||
if ((stop_offset == (start_offset + max_copy_payload_size - 1)) && (stop_offset == rlc_pP->tx_data_pdu_buffer[snP].payload_size - 1)) {
|
||||
not_test_fi = (not_test_fi & 0x2) | (not_fi_original & 0x1); // set b0 idendical to the b0 of the non segmented PDU
|
||||
} else {
|
||||
not_test_fi = not_test_fi & 0x2; // clear b0 because no SDU ending in this PDU
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
/*if (stop_offset == (rlc_pP->tx_data_pdu_buffer[snP].payload_size - 1)) {
|
||||
test_fi = (test_fi & 0x02) | (fi_original & 0x01);
|
||||
}*/
|
||||
//---------------------------------------------------------------
|
||||
// write FI field in header
|
||||
//---------------------------------------------------------------
|
||||
pdu_sub_segment_p->b1 = pdu_sub_segment_p->b1 | (((not_test_fi << 3) ^ 0x18) & 0x18);
|
||||
//---------------------------------------------------------------
|
||||
// fill the segment pdu_p with Lis and data
|
||||
//---------------------------------------------------------------
|
||||
LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] fill the segment pdu_p with Lis and data, test_num_li %d\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP), test_num_li);
|
||||
|
||||
if (test_num_li > 0) {
|
||||
pdu_sub_segment_p->b1 = pdu_sub_segment_p->b1 | 0x04; // set E bit
|
||||
test_li_length_in_bytes = 1;
|
||||
|
||||
for (fill_num_li=0; fill_num_li < test_num_li; fill_num_li++) {
|
||||
test_li_length_in_bytes = test_li_length_in_bytes ^ 3;
|
||||
|
||||
if (test_li_length_in_bytes == 2) {
|
||||
if (fill_num_li == (test_num_li - 1)) {
|
||||
e_li_sub_segment->b1 = 0;
|
||||
} else {
|
||||
e_li_sub_segment->b1 = 0x80;
|
||||
}
|
||||
|
||||
e_li_sub_segment->b1 = e_li_sub_segment->b1 | (test_li_list[fill_num_li] >> 4);
|
||||
e_li_sub_segment->b2 = test_li_list[fill_num_li] << 4;
|
||||
fill_payload_p = (uint8_t*)(&e_li_sub_segment->b3);
|
||||
*sizeP = *sizeP - 2;
|
||||
} else {
|
||||
if (fill_num_li != (test_num_li - 1)) {
|
||||
e_li_sub_segment->b2 = e_li_sub_segment->b2 | 0x08;
|
||||
}
|
||||
|
||||
e_li_sub_segment->b2 = e_li_sub_segment->b2 | (test_li_list[fill_num_li] >> 8);
|
||||
e_li_sub_segment->b3 = test_li_list[fill_num_li] & 0xFF;
|
||||
e_li_sub_segment++;
|
||||
fill_payload_p = (uint8_t*)e_li_sub_segment;
|
||||
*sizeP = *sizeP - 1;
|
||||
}
|
||||
|
||||
LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] ADD LI %d\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
test_li_list[fill_num_li]);
|
||||
}
|
||||
} else {
|
||||
LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] ADD NO LI\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP));
|
||||
fill_payload_p = (uint8_t*)e_li_sub_segment;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// copy payload to retransmit
|
||||
//---------------------------------------------------------------
|
||||
memcpy(fill_payload_p,
|
||||
&rlc_pP->tx_data_pdu_buffer[snP].payload[start_offset],
|
||||
test_pdu_copy_size);
|
||||
|
||||
((struct mac_tb_req*)(mb_sub_segment_p->data))->tb_size = (tb_size_t)(((uint64_t)fill_payload_p)+ test_pdu_copy_size) - ((uint64_t)(&pdu_sub_segment_p->b1));
|
||||
|
||||
// set LSF
|
||||
if ((test_pdu_copy_size + start_offset) == rlc_pP->tx_data_pdu_buffer[snP].payload_size) {
|
||||
pdu_sub_segment_p->data[0] = pdu_sub_segment_p->data[0] | 0x80;
|
||||
|
||||
rlc_pP->tx_data_pdu_buffer[snP].flags.retransmit = 0;
|
||||
|
||||
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] RE-SEND DATA PDU SN %04d SO %d %d BYTES PAYLOAD %d BYTES LSF!\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
snP,
|
||||
start_offset,
|
||||
((struct mac_tb_req*)(mb_sub_segment_p->data))->tb_size,
|
||||
test_pdu_copy_size);
|
||||
} else {
|
||||
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] RE-SEND DATA PDU SN %04d SO %d %d BYTES PAYLOAD %d BYTES\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
snP,
|
||||
start_offset,
|
||||
((struct mac_tb_req*)(mb_sub_segment_p->data))->tb_size,
|
||||
test_pdu_copy_size);
|
||||
}
|
||||
|
||||
LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] *sizeP %d = *sizeP %d - test_pdu_copy_size %d\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
*sizeP - test_pdu_copy_size, *sizeP,
|
||||
test_pdu_copy_size);
|
||||
|
||||
*sizeP = *sizeP - test_pdu_copy_size;
|
||||
//---------------------------------------------------------------
|
||||
// update nack_so_start
|
||||
//---------------------------------------------------------------
|
||||
rlc_am_remove_hole(ctxt_pP, rlc_pP, snP, start_offset, test_pdu_copy_size+start_offset - 1);
|
||||
//rlc_pP->tx_data_pdu_buffer[snP].nack_so_start = rlc_pP->tx_data_pdu_buffer[snP].nack_so_start + test_pdu_copy_size;
|
||||
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] RE-SEND DATA PDU SN %04d NOW nack_so_start %d nack_so_stop %d\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
snP,
|
||||
rlc_pP->tx_data_pdu_buffer[snP].nack_so_start,
|
||||
rlc_pP->tx_data_pdu_buffer[snP].nack_so_stop);
|
||||
/*if (rlc_pP->tx_data_pdu_buffer[snP].nack_so_start == rlc_pP->tx_data_pdu_buffer[snP].nack_so_stop) {
|
||||
rlc_pP->tx_data_pdu_buffer[snP].nack_so_start = 0;
|
||||
rlc_pP->tx_data_pdu_buffer[snP].nack_so_stop = 0x7FFF;
|
||||
}*/
|
||||
} else {
|
||||
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] COULD NOT GET INFO FOR DATA PDU SN %04d -> RETURN NULL\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
snP);
|
||||
return NULL;
|
||||
}
|
||||
return mb_sub_segment_p;
|
||||
} else {
|
||||
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] RE-SEND DATA PDU SN %04d BUT NO PDU AVAILABLE -> RETURN NULL\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
snP);
|
||||
assert(3==4);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
//-----------------------------------------------------------------------------
|
||||
void rlc_am_tx_buffer_display (
|
||||
const protocol_ctxt_t* const ctxt_pP,
|
||||
@@ -1456,94 +959,3 @@ mem_block_t * rlc_am_get_pdu_to_retransmit(
|
||||
|
||||
return pdu_p;
|
||||
}
|
||||
|
||||
#if 0
|
||||
//-----------------------------------------------------------------------------
|
||||
void rlc_am_retransmit_any_pdu(
|
||||
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;
|
||||
rlc_sn_t sn_end = (rlc_pP->vt_a - 1) & RLC_AM_SN_MASK;
|
||||
int found_pdu = 0;
|
||||
rlc_sn_t found_pdu_sn = 0; // avoid warning
|
||||
mem_block_t* pdu_p = NULL;
|
||||
rlc_am_pdu_sn_10_t* pdu_sn_10_p = NULL;
|
||||
|
||||
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[FORCE-TRAFFIC] rlc_am_retransmit_any_pdu()\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP));
|
||||
|
||||
while (sn != sn_end) {
|
||||
if (rlc_pP->tx_data_pdu_buffer[sn].mem_block != NULL) {
|
||||
if (!found_pdu) {
|
||||
found_pdu = 1;
|
||||
found_pdu_sn = sn;
|
||||
}
|
||||
|
||||
if (rlc_pP->tx_data_pdu_buffer[sn].header_and_payload_size <= rlc_pP->nb_bytes_requested_by_mac) {
|
||||
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[FORCE-TRAFFIC] RE-SEND DATA PDU SN %04d\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
sn);
|
||||
#if MESSAGE_CHART_GENERATOR_RLC_MAC
|
||||
MSC_LOG_EVENT((ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE,\
|
||||
"0 "PROTOCOL_RLC_AM_MSC_FMT" RTX any pdu found SN %u",\
|
||||
PROTOCOL_RLC_AM_MSC_ARGS(ctxt_pP,rlc_pP), sn);
|
||||
#endif
|
||||
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(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(ctxt_pP, rlc_pP, pdu_sn_10_p, rlc_pP->tx_data_pdu_buffer[sn].header_and_payload_size,false);
|
||||
//BugFix: polling is checked and done in function above !
|
||||
//pdu_sn_10_p->b1 = pdu_sn_10_p->b1 | 0x20;
|
||||
//BugFix : pdu_without_poll and byte_without_poll are reset only if a Poll is transmitted
|
||||
//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_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;
|
||||
rlc_pP->stat_tx_retransmit_bytes += ((struct mac_tb_req*)(pdu_p->data))->tb_size;
|
||||
list_add_tail_eurecom (pdu_p, &rlc_pP->pdus_to_mac_layer);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
sn = (sn - 1) & RLC_AM_SN_MASK;
|
||||
}
|
||||
|
||||
// no pdu_p with correct size has been found
|
||||
// so re-segment a pdu_p if possible
|
||||
if (found_pdu) {
|
||||
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[FORCE-TRAFFIC] SEND SEGMENT OF DATA PDU SN %04d\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
found_pdu_sn);
|
||||
|
||||
if (rlc_pP->nb_bytes_requested_by_mac > 4) {
|
||||
#if MESSAGE_CHART_GENERATOR_RLC_MAC
|
||||
MSC_LOG_EVENT((ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE,\
|
||||
"0 "PROTOCOL_RLC_AM_MSC_FMT" RTX any pdu found SN %u (subseg)",\
|
||||
PROTOCOL_RLC_AM_MSC_ARGS(ctxt_pP,rlc_pP), found_pdu_sn);
|
||||
#endif
|
||||
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(ctxt_pP, rlc_pP, pdu_sn_10_p, rlc_pP->tx_data_pdu_buffer[found_pdu_sn].header_and_payload_size,false);
|
||||
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_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;
|
||||
rlc_pP->stat_tx_retransmit_bytes += ((struct mac_tb_req*)(pdu_p->data))->tb_size;
|
||||
list_add_tail_eurecom (pdu_p, &rlc_pP->pdus_to_mac_layer);
|
||||
return;
|
||||
} else {
|
||||
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[FORCE-TRAFFIC] ... BUT NOT ENOUGH BYTES ALLOWED BY MAC %0d\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
rlc_pP->nb_bytes_requested_by_mac);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -95,22 +95,6 @@ protected_rlc_am_retransmit(mem_block_t* rlc_am_retransmit_get_copy (
|
||||
rlc_am_entity_t *const rlcP,
|
||||
const rlc_sn_t snP));
|
||||
|
||||
#if 0
|
||||
/*! \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] 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 (
|
||||
const protocol_ctxt_t* const ctxt_pP,
|
||||
rlc_am_entity_t *const rlcP,
|
||||
const rlc_sn_t snP,
|
||||
sdu_size_t *const sizeP));
|
||||
#endif
|
||||
|
||||
/*! \fn mem_block_t* rlc_am_get_pdu_to_retransmit(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* rlcP)
|
||||
* \brief Find a PDU or PDU segment to retransmit.
|
||||
* \param[in] ctxtP Running context.
|
||||
@@ -120,17 +104,6 @@ protected_rlc_am_retransmit(mem_block_t* rlc_am_retransmit_get_subsegment (
|
||||
protected_rlc_am_retransmit(mem_block_t* rlc_am_get_pdu_to_retransmit(
|
||||
const protocol_ctxt_t* const ctxt_pP,
|
||||
rlc_am_entity_t* const rlcP);)
|
||||
#if 0
|
||||
/*! \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.
|
||||
*/
|
||||
protected_rlc_am_retransmit(void rlc_am_retransmit_any_pdu(
|
||||
const protocol_ctxt_t* const ctxt_pP,
|
||||
rlc_am_entity_t* const rlcP);)
|
||||
#endif
|
||||
|
||||
/*! \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.
|
||||
|
||||
@@ -927,459 +927,6 @@ rlc_am_rx_list_check_duplicate_insert_pdu(
|
||||
|
||||
return pdu_status;
|
||||
}
|
||||
#if 0
|
||||
// returns 0 if success
|
||||
// returns neg value if failure
|
||||
//-----------------------------------------------------------------------------
|
||||
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;
|
||||
rlc_am_pdu_info_t* pdu_info_cursor_p = NULL;
|
||||
rlc_am_pdu_info_t* pdu_info_previous_cursor_p = NULL;
|
||||
mem_block_t* cursor_p = NULL;
|
||||
mem_block_t* previous_cursor_p = NULL;
|
||||
cursor_p = rlc_pP->receiver_buffer.head;
|
||||
// it is assumed this pdu is in rx window
|
||||
|
||||
//TODO : check for duplicate
|
||||
// should be rewrite
|
||||
/* look for previous SN */
|
||||
|
||||
if (cursor_p) {
|
||||
if (rlc_pP->vr_mr < rlc_pP->vr_r) {
|
||||
if (pdu_info_p->sn >= rlc_pP->vr_r) {
|
||||
pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info;
|
||||
|
||||
while ((cursor_p != NULL) && (pdu_info_cursor_p->sn >= rlc_pP->vr_r)) { // LG added =
|
||||
if (pdu_info_p->sn < pdu_info_cursor_p->sn) {
|
||||
if (previous_cursor_p != NULL) {
|
||||
pdu_info_previous_cursor_p = &((rlc_am_rx_pdu_management_t*)(previous_cursor_p->data))->pdu_info;
|
||||
|
||||
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, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d WRONG RF -> DROPPED (vr(mr) < vr(r) and sn >= vr(r))\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
__LINE__,
|
||||
pdu_info_p->sn);
|
||||
return -2;
|
||||
} 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, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d SO OVERLAP -> DROPPED (vr(mr) < vr(r) and sn >= vr(r))\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
__LINE__,
|
||||
pdu_info_p->sn);
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d (vr(mr) > vr(r))\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
__LINE__,
|
||||
pdu_info_p->sn);
|
||||
list2_insert_before_element(tb_pP, cursor_p, &rlc_pP->receiver_buffer);
|
||||
return 0;
|
||||
|
||||
} else if (pdu_info_p->sn == pdu_info_cursor_p->sn) {
|
||||
if (pdu_info_cursor_p->rf == 0) {
|
||||
LOG_N(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d DUPLICATE -> DROPPED\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
__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_cursor_p->so) {
|
||||
|
||||
if (previous_cursor_p != NULL) {
|
||||
pdu_info_previous_cursor_p = &((rlc_am_rx_pdu_management_t*)(previous_cursor_p->data))->pdu_info;
|
||||
|
||||
if (pdu_info_previous_cursor_p->sn == pdu_info_cursor_p->sn) {
|
||||
if ((pdu_info_previous_cursor_p->so + pdu_info_previous_cursor_p->payload_size - 1) < pdu_info_p->so) {
|
||||
|
||||
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d SEGMENT OFFSET %05d (vr(mr) < vr(r) and sn >= vr(r))\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
__LINE__,
|
||||
pdu_info_p->sn,
|
||||
pdu_info_p->so);
|
||||
list2_insert_before_element(tb_pP, cursor_p, &rlc_pP->receiver_buffer);
|
||||
return 0;
|
||||
} else {
|
||||
LOG_N(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d OVERLAP PREVIOUS SO DUPLICATE -> DROPPED\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
__LINE__,
|
||||
pdu_info_p->sn);
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d SEGMENT OFFSET %05d (vr(mr) < vr(r) and sn >= vr(r))\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
__LINE__,
|
||||
pdu_info_p->sn,
|
||||
pdu_info_p->so);
|
||||
list2_insert_before_element(tb_pP, cursor_p, &rlc_pP->receiver_buffer);
|
||||
return 0;
|
||||
|
||||
} else if (pdu_info_p->so <= pdu_info_cursor_p->so) {
|
||||
LOG_N(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d OVERLAP SO DUPLICATE -> DROPPED\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
__LINE__,
|
||||
pdu_info_p->sn);
|
||||
return -2;
|
||||
}
|
||||
} else {
|
||||
LOG_N(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d DROPPED\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
__LINE__,
|
||||
pdu_info_p->sn);
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
|
||||
previous_cursor_p = cursor_p;
|
||||
cursor_p = cursor_p->next;
|
||||
|
||||
if (cursor_p != NULL) {
|
||||
pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info;
|
||||
}
|
||||
}
|
||||
|
||||
if (cursor_p != NULL) {
|
||||
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d (vr(mr) < vr(r) and sn >= vr(r))\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
__LINE__,
|
||||
pdu_info_p->sn);
|
||||
list2_insert_before_element(tb_pP, cursor_p, &rlc_pP->receiver_buffer);
|
||||
return 0;
|
||||
} else {
|
||||
if (pdu_info_cursor_p->rf == 0) {
|
||||
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d (vr(mr) < vr(r) and vr(h) > vr(r) and sn >= vr(r))\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
__LINE__,
|
||||
pdu_info_p->sn);
|
||||
list2_add_tail(tb_pP, &rlc_pP->receiver_buffer);
|
||||
return 0;
|
||||
} 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, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d (vr(mr) < vr(r) and vr(h) > vr(r) and sn >= vr(r))\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
__LINE__,
|
||||
pdu_info_p->sn);
|
||||
list2_add_tail(tb_pP, &rlc_pP->receiver_buffer);
|
||||
return 0;
|
||||
} else {
|
||||
LOG_N(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d DROPPED\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
__LINE__,
|
||||
pdu_info_p->sn);
|
||||
return -2;
|
||||
}
|
||||
} else if (pdu_info_p->sn != pdu_info_cursor_p->sn) {
|
||||
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d (vr(mr) < vr(r) and vr(h) > vr(r) and sn >= vr(r))\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
__LINE__,
|
||||
pdu_info_p->sn);
|
||||
list2_add_tail(tb_pP, &rlc_pP->receiver_buffer);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
LOG_N(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d DROPPED\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
__LINE__,
|
||||
pdu_info_p->sn);
|
||||
return -2;
|
||||
} else { // (pdu_info_p->sn < rlc_pP->vr_r)
|
||||
cursor_p = rlc_pP->receiver_buffer.tail;
|
||||
pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info;
|
||||
|
||||
while ((cursor_p != NULL) && (pdu_info_cursor_p->sn < rlc_pP->vr_r)) {
|
||||
//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) {
|
||||
if (previous_cursor_p != NULL) {
|
||||
pdu_info_previous_cursor_p = &((rlc_am_rx_pdu_management_t*)(previous_cursor_p->data))->pdu_info;
|
||||
|
||||
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, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d WRONG RF -> DROPPED (vr(mr) < vr(r) and sn >= vr(r))\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
__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, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d SO OVERLAP -> DROPPED (vr(mr) < vr(r) and sn >= vr(r))\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
__LINE__,
|
||||
pdu_info_p->sn);
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d (vr(mr) < vr(r))\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
__LINE__,
|
||||
pdu_info_p->sn);
|
||||
list2_insert_after_element(tb_pP, cursor_p, &rlc_pP->receiver_buffer);
|
||||
return 0;
|
||||
} else if (pdu_info_p->sn == pdu_info_cursor_p->sn) {
|
||||
if (pdu_info_cursor_p->rf == 0) {
|
||||
LOG_N(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d DUPLICATE -> DROPPED\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
__LINE__,
|
||||
pdu_info_p->sn);
|
||||
return -2;
|
||||
} else if (pdu_info_p->rf == 1) {
|
||||
if ((pdu_info_cursor_p->so + pdu_info_cursor_p->payload_size - 1) < pdu_info_p->so) {
|
||||
|
||||
if (previous_cursor_p != NULL) {
|
||||
pdu_info_previous_cursor_p = &((rlc_am_rx_pdu_management_t*)(previous_cursor_p->data))->pdu_info;
|
||||
|
||||
if (pdu_info_previous_cursor_p->sn == pdu_info_cursor_p->sn) {
|
||||
if ((pdu_info_p->so + pdu_info_p->payload_size - 1) < pdu_info_previous_cursor_p->so) {
|
||||
|
||||
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d SEGMENT OFFSET %05d (vr(mr) < vr(r) and sn < vr(r))\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
__LINE__,
|
||||
pdu_info_p->sn,
|
||||
pdu_info_p->so);
|
||||
list2_insert_after_element(tb_pP, cursor_p, &rlc_pP->receiver_buffer);
|
||||
return 0;
|
||||
} else {
|
||||
LOG_N(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d OVERLAP PREVIOUS SO DUPLICATE -> DROPPED\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
__LINE__,
|
||||
pdu_info_p->sn);
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d SEGMENT OFFSET %05d (vr(mr) < vr(r) and sn < vr(r))\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
__LINE__,
|
||||
pdu_info_p->sn,
|
||||
pdu_info_p->so);
|
||||
list2_insert_after_element(tb_pP, cursor_p, &rlc_pP->receiver_buffer);
|
||||
return 0;
|
||||
|
||||
} else if (pdu_info_cursor_p->so <= pdu_info_p->so) {
|
||||
LOG_N(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d OVERLAP SO DUPLICATE -> DROPPED\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
__LINE__,
|
||||
pdu_info_p->sn);
|
||||
return -2;
|
||||
}
|
||||
} else {
|
||||
LOG_N(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d DROPPED\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
__LINE__,
|
||||
pdu_info_p->sn);
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
|
||||
previous_cursor_p = cursor_p;
|
||||
cursor_p = cursor_p->previous;
|
||||
|
||||
if (cursor_p != NULL) {
|
||||
pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info;
|
||||
}
|
||||
}
|
||||
|
||||
if (cursor_p != NULL) {
|
||||
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d (vr(mr) < vr(r) and sn < vr(r))\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
__LINE__,
|
||||
pdu_info_p->sn);
|
||||
list2_insert_after_element(tb_pP, cursor_p, &rlc_pP->receiver_buffer);
|
||||
return 0;
|
||||
} else {
|
||||
if (pdu_info_cursor_p->rf == 0) {
|
||||
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d (vr(mr) < vr(r) and vr(h) > vr(r) and sn >= vr(r))\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
__LINE__,
|
||||
pdu_info_p->sn);
|
||||
list2_add_tail(tb_pP, &rlc_pP->receiver_buffer);
|
||||
return 0;
|
||||
} 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, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d (vr(mr) < vr(r) and vr(h) > vr(r) and sn >= vr(r))\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
__LINE__,
|
||||
pdu_info_p->sn);
|
||||
list2_add_tail(tb_pP, &rlc_pP->receiver_buffer);
|
||||
return 0;
|
||||
} else {
|
||||
LOG_N(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d DROPPED\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
__LINE__,
|
||||
pdu_info_p->sn);
|
||||
return -2;
|
||||
}
|
||||
} else if (pdu_info_p->sn != pdu_info_cursor_p->sn) {
|
||||
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d (vr(mr) < vr(r) and vr(h) > vr(r) and sn >= vr(r))\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
__LINE__,
|
||||
pdu_info_p->sn);
|
||||
list2_add_tail(tb_pP, &rlc_pP->receiver_buffer);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
LOG_N(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d DROPPED\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
__LINE__,
|
||||
pdu_info_p->sn);
|
||||
return -2;
|
||||
}
|
||||
} 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", 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) {
|
||||
|
||||
if (previous_cursor_p != NULL) {
|
||||
pdu_info_previous_cursor_p = &((rlc_am_rx_pdu_management_t*)(previous_cursor_p->data))->pdu_info;
|
||||
|
||||
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, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d WRONG RF -> DROPPED (vr(mr) > vr(r))\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
__LINE__,
|
||||
pdu_info_p->sn);
|
||||
return -2;
|
||||
} 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, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d SO OVERLAP -> DROPPED (vr(mr) > vr(r))\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
__LINE__,
|
||||
pdu_info_p->sn);
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d (vr(mr) > vr(r))\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
__LINE__,
|
||||
pdu_info_p->sn);
|
||||
list2_insert_before_element(tb_pP, cursor_p, &rlc_pP->receiver_buffer);
|
||||
return 0;
|
||||
|
||||
} else if (pdu_info_p->sn == pdu_info_cursor_p->sn) {
|
||||
if (pdu_info_cursor_p->rf == 0) {
|
||||
LOG_N(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d WRONG RF -> DROPPED (vr(mr) > vr(r))\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
__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_cursor_p->so) {
|
||||
|
||||
if (previous_cursor_p != NULL) {
|
||||
pdu_info_previous_cursor_p = &((rlc_am_rx_pdu_management_t*)(previous_cursor_p->data))->pdu_info;
|
||||
|
||||
if (pdu_info_previous_cursor_p->sn == pdu_info_cursor_p->sn) {
|
||||
if ((pdu_info_previous_cursor_p->so + pdu_info_previous_cursor_p->payload_size - 1) < pdu_info_p->so) {
|
||||
|
||||
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d SEGMENT OFFSET %05d (vr(mr) > vr(r) and sn >= vr(r))\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
__LINE__,
|
||||
pdu_info_p->sn,
|
||||
pdu_info_p->so);
|
||||
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] PREVIOUS SO %d PAYLOAD SIZE %d\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
pdu_info_previous_cursor_p->so,
|
||||
pdu_info_previous_cursor_p->payload_size);
|
||||
list2_insert_before_element(tb_pP, cursor_p, &rlc_pP->receiver_buffer);
|
||||
return 0;
|
||||
} else {
|
||||
LOG_N(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d OVERLAP PREVIOUS SO DUPLICATE -> DROPPED\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
__LINE__,
|
||||
pdu_info_p->sn);
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d SEGMENT OFFSET %05d (vr(mr) > vr(r) and sn >= vr(r))\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
__LINE__,
|
||||
pdu_info_p->sn,
|
||||
pdu_info_p->so);
|
||||
list2_insert_before_element(tb_pP, cursor_p, &rlc_pP->receiver_buffer);
|
||||
return 0;
|
||||
} else if (pdu_info_p->so <= pdu_info_cursor_p->so) {
|
||||
LOG_N(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d OVERLAP SO DUPLICATE -> DROPPED\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
__LINE__,
|
||||
pdu_info_p->sn);
|
||||
return -2;
|
||||
}
|
||||
} else {
|
||||
LOG_N(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d DROPPED\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
__LINE__,
|
||||
pdu_info_p->sn);
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
|
||||
previous_cursor_p = cursor_p;
|
||||
cursor_p = cursor_p->next;
|
||||
}
|
||||
|
||||
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d (vr(mr) > vr(r))(last inserted)\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
__LINE__,
|
||||
pdu_info_p->sn);
|
||||
|
||||
// pdu_info_cursor_p can not be NULL here
|
||||
if (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) {
|
||||
list2_add_tail(tb_pP, &rlc_pP->receiver_buffer);
|
||||
return 0;
|
||||
} else {
|
||||
LOG_N(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d OVERLAP SO DUPLICATE -> DROPPED\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
__LINE__,
|
||||
pdu_info_p->sn);
|
||||
return -2;
|
||||
}
|
||||
} else {
|
||||
list2_add_tail(tb_pP, &rlc_pP->receiver_buffer);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d (only inserted)\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
__LINE__,
|
||||
pdu_info_p->sn);
|
||||
list2_add_head(tb_pP, &rlc_pP->receiver_buffer);
|
||||
return 0;
|
||||
}
|
||||
|
||||
LOG_N(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[INSERT PDU] LINE %d RX PDU SN %04d DROPPED @4\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
__LINE__,
|
||||
pdu_info_p->sn);
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void
|
||||
|
||||
@@ -68,17 +68,6 @@
|
||||
*/
|
||||
protected_rlc_am_rx_list( rlc_am_rx_pdu_status_t rlc_am_rx_list_check_duplicate_insert_pdu(const protocol_ctxt_t* const ctxt_pP,rlc_am_entity_t* const rlc_pP,mem_block_t* const tb_pP);)
|
||||
|
||||
#if 0
|
||||
/*! \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] 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(const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t* const rlcP, mem_block_t* const tbP);)
|
||||
#endif
|
||||
|
||||
/*! \fn boolean_t rlc_am_rx_check_vr_reassemble(const protocol_ctxt_t* const ctxt_pP,const rlc_am_entity_t* const rlc_pP)
|
||||
* \brief Check if reassembly taking into account potential new vrR value
|
||||
* \param[in] ctxt_pP Running context.
|
||||
|
||||
@@ -19,301 +19,4 @@
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
#if 0
|
||||
#define RLC_AM_MODULE 1
|
||||
#define RLC_AM_SEGMENT_HOLES_C 1
|
||||
//-----------------------------------------------------------------------------
|
||||
#include "rlc_am.h"
|
||||
#include "LAYER2/MAC/extern.h"
|
||||
#include "UTIL/LOG/log.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void rlc_am_clear_holes (
|
||||
const protocol_ctxt_t* const ctxt_pP,
|
||||
rlc_am_entity_t *const rlc_pP,
|
||||
const rlc_sn_t snP)
|
||||
{
|
||||
rlc_pP->tx_data_pdu_buffer[snP].num_holes = 0;
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void rlc_am_shift_down_holes (
|
||||
const protocol_ctxt_t* const ctxt_pP,
|
||||
rlc_am_entity_t *const rlc_pP,
|
||||
const rlc_sn_t snP,
|
||||
const int indexP)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i=indexP; i < rlc_pP->tx_data_pdu_buffer[snP].num_holes - 1; i++) {
|
||||
rlc_pP->tx_data_pdu_buffer[snP].hole_so_start[i] = rlc_pP->tx_data_pdu_buffer[snP].hole_so_start[i+1];
|
||||
rlc_pP->tx_data_pdu_buffer[snP].hole_so_stop[i] = rlc_pP->tx_data_pdu_buffer[snP].hole_so_stop[i+1];
|
||||
}
|
||||
|
||||
rlc_pP->tx_data_pdu_buffer[snP].num_holes = rlc_pP->tx_data_pdu_buffer[snP].num_holes - 1;
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void rlc_am_shift_up_holes (
|
||||
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
|
||||
int i;
|
||||
|
||||
for (i=rlc_pP->tx_data_pdu_buffer[snP].num_holes; i > indexP; i--) {
|
||||
rlc_pP->tx_data_pdu_buffer[snP].hole_so_start[i] = rlc_pP->tx_data_pdu_buffer[snP].hole_so_start[i-1];
|
||||
rlc_pP->tx_data_pdu_buffer[snP].hole_so_stop[i] = rlc_pP->tx_data_pdu_buffer[snP].hole_so_stop[i-1];
|
||||
}
|
||||
|
||||
rlc_pP->tx_data_pdu_buffer[snP].num_holes = rlc_pP->tx_data_pdu_buffer[snP].num_holes + 1;
|
||||
assert(rlc_pP->tx_data_pdu_buffer[snP].num_holes < RLC_AM_MAX_HOLES_REPORT_PER_PDU);
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void rlc_am_remove_hole (
|
||||
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;
|
||||
#if TRACE_RLC_AM_HOLE
|
||||
LOG_D(RLC,
|
||||
PROTOCOL_RLC_AM_CTXT_FMT"[HOLE] REMOVE HOLE SN %04d so_startP %05d so_stopP %05d rlc_pP->tx_data_pdu_buffer[snP].nack_so_start %05d rlc_pP->tx_data_pdu_buffer[snP].nack_so_stop %05d\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
snP,
|
||||
so_startP,
|
||||
so_stopP,
|
||||
rlc_pP->tx_data_pdu_buffer[snP].nack_so_start,
|
||||
rlc_pP->tx_data_pdu_buffer[snP].nack_so_stop);
|
||||
#endif
|
||||
assert(so_startP <= so_stopP);
|
||||
|
||||
if (rlc_pP->tx_data_pdu_buffer[snP].num_holes == 0) {
|
||||
assert(so_startP == rlc_pP->tx_data_pdu_buffer[snP].nack_so_start);
|
||||
assert(so_stopP <= rlc_pP->tx_data_pdu_buffer[snP].nack_so_stop);
|
||||
#if TRACE_RLC_AM_HOLE
|
||||
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[HOLE] REMOVE HOLE SN %04d MODIFIED nack_so_start %05d->%05d\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
snP,
|
||||
rlc_pP->tx_data_pdu_buffer[snP].nack_so_start,
|
||||
so_stopP+1);
|
||||
#endif
|
||||
rlc_pP->tx_data_pdu_buffer[snP].nack_so_start = so_stopP+1;
|
||||
|
||||
if (rlc_pP->tx_data_pdu_buffer[snP].nack_so_start >= rlc_pP->tx_data_pdu_buffer[snP].nack_so_stop) {
|
||||
rlc_pP->tx_data_pdu_buffer[snP].nack_so_start = 0;
|
||||
rlc_pP->tx_data_pdu_buffer[snP].nack_so_stop = 0x7FFF;
|
||||
}
|
||||
} else {
|
||||
// normally should be removed in increasing order...
|
||||
for (i = 0; i < rlc_pP->tx_data_pdu_buffer[snP].num_holes; i++) {
|
||||
if (so_startP <= rlc_pP->tx_data_pdu_buffer[snP].hole_so_start[i]) {
|
||||
if (so_stopP >= rlc_pP->tx_data_pdu_buffer[snP].hole_so_stop[i]) {
|
||||
rlc_am_shift_down_holes(ctxt_pP, rlc_pP, snP, i);
|
||||
i = i - 1;
|
||||
} else {
|
||||
rlc_pP->tx_data_pdu_buffer[snP].hole_so_start[i] = so_stopP;
|
||||
|
||||
if (rlc_pP->tx_data_pdu_buffer[snP].num_holes == 0) {
|
||||
rlc_pP->tx_data_pdu_buffer[snP].nack_so_start = 0;
|
||||
rlc_pP->tx_data_pdu_buffer[snP].nack_so_stop = 0x7FFF;
|
||||
} else {
|
||||
rlc_pP->tx_data_pdu_buffer[snP].nack_so_start = rlc_pP->tx_data_pdu_buffer[snP].hole_so_start[0];
|
||||
rlc_pP->tx_data_pdu_buffer[snP].nack_so_stop = rlc_pP->tx_data_pdu_buffer[snP].hole_so_stop[rlc_pP->tx_data_pdu_buffer[snP].num_holes - 1];
|
||||
}
|
||||
|
||||
#if TRACE_RLC_AM_HOLE
|
||||
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[HOLE] REMOVE HOLE SN %04d NOW nack_so_start %05d nack_so_stop %05d num holes %d\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
snP,
|
||||
rlc_pP->tx_data_pdu_buffer[snP].nack_so_start,
|
||||
rlc_pP->tx_data_pdu_buffer[snP].nack_so_stop,
|
||||
rlc_pP->tx_data_pdu_buffer[snP].num_holes);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
} else if (so_startP > rlc_pP->tx_data_pdu_buffer[snP].hole_so_start[i]) {
|
||||
if (so_startP <= rlc_pP->tx_data_pdu_buffer[snP].hole_so_stop[i]) {
|
||||
if (so_stopP < rlc_pP->tx_data_pdu_buffer[snP].hole_so_stop[i]) {
|
||||
// BAD CASE: 1 HOLE IS SPLITTED IN 2 HOLES
|
||||
rlc_am_shift_up_holes(ctxt_pP, rlc_pP, snP, i+1);
|
||||
rlc_pP->tx_data_pdu_buffer[snP].hole_so_start[i+1] = so_startP+1;
|
||||
rlc_pP->tx_data_pdu_buffer[snP].hole_so_stop[i+1] = rlc_pP->tx_data_pdu_buffer[snP].hole_so_stop[i];
|
||||
rlc_pP->tx_data_pdu_buffer[snP].hole_so_stop[i] = so_startP - 1;
|
||||
} else {
|
||||
rlc_pP->tx_data_pdu_buffer[snP].hole_so_stop[i] = so_startP;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (rlc_pP->tx_data_pdu_buffer[snP].num_holes == 0) {
|
||||
rlc_pP->tx_data_pdu_buffer[snP].nack_so_start = 0;
|
||||
rlc_pP->tx_data_pdu_buffer[snP].nack_so_stop = 0x7FFF;
|
||||
} else {
|
||||
rlc_pP->tx_data_pdu_buffer[snP].nack_so_start = rlc_pP->tx_data_pdu_buffer[snP].hole_so_start[0];
|
||||
rlc_pP->tx_data_pdu_buffer[snP].nack_so_stop = rlc_pP->tx_data_pdu_buffer[snP].hole_so_stop[rlc_pP->tx_data_pdu_buffer[snP].num_holes - 1];
|
||||
}
|
||||
}
|
||||
|
||||
#if TRACE_RLC_AM_HOLE
|
||||
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[HOLE] REMOVE HOLE SN %04d NOW nack_so_start %05d nack_so_stop %05d num holes %d\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
snP,
|
||||
rlc_pP->tx_data_pdu_buffer[snP].nack_so_start,
|
||||
rlc_pP->tx_data_pdu_buffer[snP].nack_so_stop,
|
||||
rlc_pP->tx_data_pdu_buffer[snP].num_holes);
|
||||
#endif
|
||||
assert(rlc_pP->tx_data_pdu_buffer[snP].nack_so_start < rlc_pP->tx_data_pdu_buffer[snP].payload_size);
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void rlc_am_get_next_hole (
|
||||
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->tx_data_pdu_buffer[snP].num_holes == 0) {
|
||||
*so_startP = rlc_pP->tx_data_pdu_buffer[snP].nack_so_start;
|
||||
*so_stopP = rlc_pP->tx_data_pdu_buffer[snP].nack_so_stop;
|
||||
#if TRACE_RLC_AM_HOLE
|
||||
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[HOLE] rlc_am_get_next_hole(SN %04d) %05d->%05d (NUM HOLES == 0)\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
snP,
|
||||
*so_startP,
|
||||
*so_stopP);
|
||||
#endif
|
||||
} else {
|
||||
*so_startP = rlc_pP->tx_data_pdu_buffer[snP].hole_so_start[0];
|
||||
*so_stopP = rlc_pP->tx_data_pdu_buffer[snP].hole_so_stop[0];
|
||||
#if TRACE_RLC_AM_HOLE
|
||||
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[HOLE] rlc_am_get_next_hole(SN %04d) %05d->%05d (NUM HOLES == %d)\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
snP,
|
||||
*so_startP,
|
||||
*so_stopP,
|
||||
rlc_pP->tx_data_pdu_buffer[snP].num_holes);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void rlc_am_add_hole (
|
||||
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;
|
||||
|
||||
assert(so_startP <= so_stopP);
|
||||
assert(so_startP < 0x7FFF);
|
||||
assert(so_stopP <= 0x7FFF);
|
||||
|
||||
|
||||
// if global NACK
|
||||
if ((so_startP == 0) && ((so_stopP == 0x7FFF) || (so_stopP == rlc_pP->tx_data_pdu_buffer[snP].payload_size - 1))) {
|
||||
rlc_pP->tx_data_pdu_buffer[snP].num_holes = 0;
|
||||
rlc_pP->tx_data_pdu_buffer[snP].nack_so_start = so_startP;
|
||||
rlc_pP->tx_data_pdu_buffer[snP].nack_so_stop = so_stopP;
|
||||
#if TRACE_RLC_AM_HOLE
|
||||
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[HOLE] SN %04d GLOBAL NACK 0->%05d\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
snP,
|
||||
so_stopP);
|
||||
#endif
|
||||
assert(rlc_pP->tx_data_pdu_buffer[snP].nack_so_start < rlc_pP->tx_data_pdu_buffer[snP].payload_size);
|
||||
return;
|
||||
}
|
||||
|
||||
if (so_stopP == 0x7FFF) {
|
||||
so_stopP = rlc_pP->tx_data_pdu_buffer[snP].payload_size - 1;
|
||||
}
|
||||
|
||||
// first hole
|
||||
if (rlc_pP->tx_data_pdu_buffer[snP].num_holes == 0) {
|
||||
rlc_pP->tx_data_pdu_buffer[snP].hole_so_start[0] = so_startP;
|
||||
rlc_pP->tx_data_pdu_buffer[snP].hole_so_stop [0] = so_stopP;
|
||||
|
||||
rlc_pP->tx_data_pdu_buffer[snP].num_holes = 1;
|
||||
|
||||
rlc_pP->tx_data_pdu_buffer[snP].nack_so_start = so_startP;
|
||||
rlc_pP->tx_data_pdu_buffer[snP].nack_so_stop = so_stopP;
|
||||
#if TRACE_RLC_AM_HOLE
|
||||
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[HOLE] FIRST HOLE SN %04d GLOBAL NACK %05d->%05d\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
snP,
|
||||
so_startP,
|
||||
so_stopP);
|
||||
#endif
|
||||
assert(rlc_pP->tx_data_pdu_buffer[snP].nack_so_start < rlc_pP->tx_data_pdu_buffer[snP].payload_size);
|
||||
return;
|
||||
}
|
||||
|
||||
hole_index = 0;
|
||||
|
||||
while (hole_index < rlc_pP->tx_data_pdu_buffer[snP].num_holes) {
|
||||
if (so_stopP < rlc_pP->tx_data_pdu_buffer[snP].hole_so_start[hole_index]) {
|
||||
assert(rlc_pP->tx_data_pdu_buffer[snP].num_holes < RLC_AM_MAX_HOLES_REPORT_PER_PDU);
|
||||
|
||||
if (hole_index > 0) {
|
||||
assert(so_startP > rlc_pP->tx_data_pdu_buffer[snP].hole_so_stop[hole_index-1]);
|
||||
}
|
||||
|
||||
for (i=rlc_pP->tx_data_pdu_buffer[snP].num_holes; i >= hole_index; i--) {
|
||||
rlc_pP->tx_data_pdu_buffer[snP].hole_so_start[i] = rlc_pP->tx_data_pdu_buffer[snP].hole_so_start[i-1];
|
||||
rlc_pP->tx_data_pdu_buffer[snP].hole_so_stop[i] = rlc_pP->tx_data_pdu_buffer[snP].hole_so_stop[i-1];
|
||||
}
|
||||
|
||||
rlc_pP->tx_data_pdu_buffer[snP].hole_so_start[hole_index] = so_startP;
|
||||
rlc_pP->tx_data_pdu_buffer[snP].hole_so_stop[hole_index] = so_stopP;
|
||||
|
||||
// update nack "window" vars nack_so_start, nack_so_stop
|
||||
if (hole_index == 0) {
|
||||
rlc_pP->tx_data_pdu_buffer[snP].nack_so_start = so_startP;
|
||||
}
|
||||
|
||||
rlc_pP->tx_data_pdu_buffer[snP].num_holes += 1;
|
||||
#if TRACE_RLC_AM_HOLE
|
||||
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[HOLE] INSERT %d th HOLE SN %04d GLOBAL NACK %05d->%05d\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
rlc_pP->tx_data_pdu_buffer[snP].num_holes,
|
||||
snP,
|
||||
so_startP,
|
||||
so_stopP);
|
||||
#endif
|
||||
assert(rlc_pP->tx_data_pdu_buffer[snP].nack_so_start < rlc_pP->tx_data_pdu_buffer[snP].payload_size);
|
||||
assert(rlc_pP->tx_data_pdu_buffer[snP].num_holes < RLC_AM_MAX_HOLES_REPORT_PER_PDU);
|
||||
return;
|
||||
}
|
||||
|
||||
hole_index = hole_index + 1;
|
||||
}
|
||||
|
||||
// if here insert to the "tail"
|
||||
if (so_startP > rlc_pP->tx_data_pdu_buffer[snP].hole_so_stop[hole_index - 1]) {
|
||||
assert(rlc_pP->tx_data_pdu_buffer[snP].num_holes < RLC_AM_MAX_HOLES_REPORT_PER_PDU);
|
||||
rlc_pP->tx_data_pdu_buffer[snP].hole_so_start[hole_index] = so_startP;
|
||||
rlc_pP->tx_data_pdu_buffer[snP].hole_so_stop[hole_index] = so_stopP;
|
||||
rlc_pP->tx_data_pdu_buffer[snP].num_holes += 1;
|
||||
// update nack "window" vars nack_so_start, nack_so_stop
|
||||
rlc_pP->tx_data_pdu_buffer[snP].nack_so_stop = so_stopP;
|
||||
#if TRACE_RLC_AM_HOLE
|
||||
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[HOLE] INSERT THE %d th LAST HOLE SN %04d GLOBAL NACK %05d->%05d\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
rlc_pP->tx_data_pdu_buffer[snP].num_holes,
|
||||
snP,
|
||||
so_startP,
|
||||
so_stopP);
|
||||
#endif
|
||||
} else {
|
||||
assert(1==2);
|
||||
}
|
||||
|
||||
assert(rlc_pP->tx_data_pdu_buffer[snP].num_holes < RLC_AM_MAX_HOLES_REPORT_PER_PDU);
|
||||
assert(rlc_pP->tx_data_pdu_buffer[snP].nack_so_start < rlc_pP->tx_data_pdu_buffer[snP].payload_size);
|
||||
}
|
||||
#endif
|
||||
/* This file is empty. Might be deleted ? */
|
||||
|
||||
@@ -32,80 +32,5 @@
|
||||
* @ingroup _rlc_am_internal_segment_impl_
|
||||
* @{
|
||||
*/
|
||||
#if 0
|
||||
#ifndef __RLC_AM_SEGMENT_HOLES_H__
|
||||
# define __RLC_AM_SEGMENT_HOLES_H__
|
||||
//-----------------------------------------------------------------------------
|
||||
# ifdef RLC_AM_SEGMENT_HOLES_C
|
||||
# define private_rlc_am_segments_holes(x) x
|
||||
# define protected_rlc_am_segments_holes(x) x
|
||||
# define public_rlc_am_segments_holes(x) x
|
||||
# else
|
||||
# ifdef RLC_AM_MODULE
|
||||
# define private_rlc_am_segments_holes(x)
|
||||
# define protected_rlc_am_segments_holes(x) extern x
|
||||
# define public_rlc_am_segments_holes(x) extern x
|
||||
# else
|
||||
# define private_rlc_am_segments_holes(x)
|
||||
# define protected_rlc_am_segments_holes(x)
|
||||
# define public_rlc_am_segments_holes(x) extern x
|
||||
# endif
|
||||
# endif
|
||||
/*! \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 (
|
||||
const protocol_ctxt_t* const ctxt_pP,
|
||||
rlc_am_entity_t *const rlcP,
|
||||
const rlc_sn_t snP);)
|
||||
/* This file is empty. Should be removed */
|
||||
|
||||
/*! \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] 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 (
|
||||
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 (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] 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 (
|
||||
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 (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] 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 (
|
||||
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
|
||||
#endif
|
||||
|
||||
@@ -873,345 +873,3 @@ rlc_am_send_status_pdu(
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
//-----------------------------------------------------------------------------
|
||||
void
|
||||
rlc_am_send_status_pdu_backup(
|
||||
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:
|
||||
// - if t-StatusProhibit is not running:
|
||||
// - at the first transmission opportunity indicated by lower layer, construct a STATUS PDU and deliver it to lower layer;
|
||||
// - else:
|
||||
// - at the first transmission opportunity indicated by lower layer after t-StatusProhibit expires, construct a single
|
||||
// STATUS PDU even if status reporting was triggered several times while t-StatusProhibit was running and
|
||||
// deliver it to lower layer;
|
||||
//
|
||||
// When a STATUS PDU has been delivered to lower layer, the receiving side of an AM RLC entity shall:
|
||||
// - start t-StatusProhibit.
|
||||
//
|
||||
// When constructing a STATUS PDU, the AM RLC entity shall:
|
||||
// - for the AMD PDUs with SN such that VR(R) <= SN < VR(MR) that has not been completely received yet, in
|
||||
// increasing SN of PDUs and increasing byte segment order within PDUs, starting with SN = VR(R) up to
|
||||
// the point where the resulting STATUS PDU still fits to the total size of RLC PDU(s) indicated by lower layer:
|
||||
// - for an AMD PDU for which no byte segments have been received yet::
|
||||
// - include in the STATUS PDU a NACK_SN which is set to the SN of the AMD PDU;
|
||||
// - for a continuous sequence of byte segments of a partly received AMD PDU that have not been received yet:
|
||||
// - include in the STATUS PDU a set of NACK_SN, SOstart and SOend
|
||||
// - set the ACK_SN to the SN of the next not received RLC Data PDU which is not indicated as missing in the
|
||||
// resulting STATUS PDU.
|
||||
|
||||
signed int nb_bits_to_transmit = rlc_pP->nb_bytes_requested_by_mac << 3;
|
||||
rlc_am_control_pdu_info_t control_pdu_info;
|
||||
rlc_am_pdu_info_t *pdu_info_cursor_p = NULL;
|
||||
rlc_sn_t previous_sn_cursor = (rlc_pP->vr_r - 1) & RLC_AM_SN_MASK;
|
||||
rlc_sn_t sn_cursor = 0;
|
||||
mem_block_t *cursor_p = rlc_pP->receiver_buffer.head;
|
||||
int all_segments_received = 0;
|
||||
int waited_so = 0;
|
||||
mem_block_t *tb_p = NULL;
|
||||
sdu_size_t pdu_size = 0;
|
||||
|
||||
memset(&control_pdu_info, 0, sizeof(rlc_am_control_pdu_info_t));
|
||||
// header size
|
||||
nb_bits_to_transmit = nb_bits_to_transmit - 15;
|
||||
#if TRACE_RLC_AM_STATUS_CREATION
|
||||
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEND-STATUS] nb_bits_to_transmit %d (15 already allocated for header)\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
nb_bits_to_transmit);
|
||||
rlc_am_rx_list_display(rlc_pP, " DISPLAY BEFORE CONSTRUCTION OF STATUS REPORT");
|
||||
#endif
|
||||
|
||||
|
||||
if (cursor_p != NULL) {
|
||||
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_SN_IN_WINDOW(sn_cursor, rlc_pP->vr_r))) {
|
||||
cursor_p = cursor_p->next;
|
||||
previous_sn_cursor = sn_cursor;
|
||||
|
||||
pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info;
|
||||
sn_cursor = pdu_info_cursor_p->sn;
|
||||
#if TRACE_RLC_AM_STATUS_CREATION
|
||||
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEND-STATUS] LINE %d FIND VR(R) <= SN sn_cursor %04d -> %04d\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
__LINE__,
|
||||
previous_sn_cursor,
|
||||
sn_cursor);
|
||||
#endif
|
||||
}
|
||||
|
||||
// 12 bits = size of NACK_SN field + E1, E2 bits
|
||||
// 42 bits = size of NACK_SN field + SO_START, SO_END fields, E1, E2 bits
|
||||
while ((cursor_p != NULL) && (nb_bits_to_transmit >= 12)) {
|
||||
pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info;
|
||||
all_segments_received = ((rlc_am_rx_pdu_management_t*)(cursor_p->data))->all_segments_received;
|
||||
sn_cursor = pdu_info_cursor_p->sn;
|
||||
#if TRACE_RLC_AM_STATUS_CREATION
|
||||
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEND-STATUS] LINE %d LOOPING sn_cursor %04d previous sn_cursor %04d \n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
__LINE__,
|
||||
sn_cursor,
|
||||
previous_sn_cursor);
|
||||
#endif
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
// case resegmentation : several PDUs related to the same SN queued in list
|
||||
// -------------------------------------------------------------------------------
|
||||
if (sn_cursor == previous_sn_cursor) {
|
||||
do {
|
||||
cursor_p = cursor_p->next;
|
||||
|
||||
if (cursor_p != NULL) {
|
||||
pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info;
|
||||
all_segments_received = ((rlc_am_rx_pdu_management_t*)(cursor_p->data))->all_segments_received;
|
||||
sn_cursor = pdu_info_cursor_p->sn;
|
||||
#if TRACE_RLC_AM_STATUS_CREATION
|
||||
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEND-STATUS] LINE %d NOW sn_cursor %04d \n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
__LINE__,
|
||||
sn_cursor);
|
||||
#endif
|
||||
} else {
|
||||
if (all_segments_received) {
|
||||
control_pdu_info.ack_sn = (sn_cursor + 1) & RLC_AM_SN_MASK;
|
||||
#if TRACE_RLC_AM_STATUS_CREATION
|
||||
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEND-STATUS] LINE %d PREPARE SENDING ACK SN %04d \n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
__LINE__,
|
||||
control_pdu_info.ack_sn);
|
||||
#endif
|
||||
} else {
|
||||
control_pdu_info.ack_sn = (previous_sn_cursor + 1) & RLC_AM_SN_MASK;
|
||||
#if TRACE_RLC_AM_STATUS_CREATION
|
||||
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEND-STATUS] LINE %d PREPARE SENDING ACK SN %04d (CASE PREVIOUS SN)\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
__LINE__,
|
||||
control_pdu_info.ack_sn);
|
||||
#endif
|
||||
}
|
||||
|
||||
goto end_push_nack;
|
||||
}
|
||||
} while ((cursor_p != NULL) && (sn_cursor == previous_sn_cursor));
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
// simple case, PDU(s) is/are missing
|
||||
// -------------------------------------------------------------------------------
|
||||
while (((previous_sn_cursor + 1) & RLC_AM_SN_MASK) != sn_cursor) {
|
||||
if (nb_bits_to_transmit > 12) {
|
||||
previous_sn_cursor = (previous_sn_cursor + 1) & RLC_AM_SN_MASK;
|
||||
control_pdu_info.nack_list[control_pdu_info.num_nack].nack_sn = previous_sn_cursor;
|
||||
control_pdu_info.nack_list[control_pdu_info.num_nack].so_start = 0;
|
||||
control_pdu_info.nack_list[control_pdu_info.num_nack].so_end = 0x7ff;
|
||||
control_pdu_info.nack_list[control_pdu_info.num_nack].e1 = 1;
|
||||
control_pdu_info.nack_list[control_pdu_info.num_nack].e2 = 0;
|
||||
control_pdu_info.num_nack += 1;
|
||||
nb_bits_to_transmit = nb_bits_to_transmit - 12;
|
||||
#if TRACE_RLC_AM_STATUS_CREATION
|
||||
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEND-STATUS] LINE %d PREPARE SENDING NACK %04d\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
__LINE__,
|
||||
previous_sn_cursor);
|
||||
#endif
|
||||
} else {
|
||||
control_pdu_info.ack_sn = (previous_sn_cursor + 1) & RLC_AM_SN_MASK;
|
||||
#if TRACE_RLC_AM_STATUS_CREATION
|
||||
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEND-STATUS] LINE %d NO MORE BITS FOR SENDING NACK %04d -> ABORT AND SET FINAL ACK %04d\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
__LINE__,
|
||||
previous_sn_cursor,
|
||||
control_pdu_info.ack_sn);
|
||||
#endif
|
||||
goto end_push_nack;
|
||||
}
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
// not so simple case, a resegmented PDU(s) is missing
|
||||
// -------------------------------------------------------------------------------
|
||||
if (all_segments_received == 0) {
|
||||
waited_so = 0;
|
||||
#if TRACE_RLC_AM_STATUS_CREATION
|
||||
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEND-STATUS] if (all_segments_received == 0) \n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP));
|
||||
#endif
|
||||
|
||||
do {
|
||||
if (pdu_info_cursor_p->so > waited_so) {
|
||||
if (nb_bits_to_transmit >= 42) {
|
||||
control_pdu_info.nack_list[control_pdu_info.num_nack].nack_sn = sn_cursor;
|
||||
control_pdu_info.nack_list[control_pdu_info.num_nack].so_start = waited_so;
|
||||
control_pdu_info.nack_list[control_pdu_info.num_nack].so_end = pdu_info_cursor_p->so - 1;
|
||||
control_pdu_info.nack_list[control_pdu_info.num_nack].e1 = 1;
|
||||
control_pdu_info.nack_list[control_pdu_info.num_nack].e2 = 1;
|
||||
control_pdu_info.num_nack += 1;
|
||||
nb_bits_to_transmit = nb_bits_to_transmit - 42;
|
||||
#if TRACE_RLC_AM_STATUS_CREATION
|
||||
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEND-STATUS] LINE %d PREPARE SENDING NACK %04d SO START %05d SO END %05d (CASE SO %d > WAITED SO %d)\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
__LINE__,
|
||||
sn_cursor,
|
||||
waited_so,
|
||||
pdu_info_cursor_p->so - 1,
|
||||
pdu_info_cursor_p->so,
|
||||
waited_so);
|
||||
#endif
|
||||
|
||||
if (pdu_info_cursor_p->lsf == 1) { // last segment flag
|
||||
//waited_so = 0x7FF;
|
||||
waited_so = 0x7FFF;
|
||||
#if TRACE_RLC_AM_STATUS_CREATION
|
||||
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEND-STATUS] LINE %d SN %04d SET WAITED SO 0x7FFF)\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
__LINE__, sn_cursor);
|
||||
#endif
|
||||
//break;
|
||||
} else {
|
||||
waited_so = pdu_info_cursor_p->so + pdu_info_cursor_p->payload_size;
|
||||
#if TRACE_RLC_AM_STATUS_CREATION
|
||||
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEND-STATUS] LINE %d SN %04d SET WAITED SO %d @1\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
__LINE__,
|
||||
sn_cursor,
|
||||
waited_so);
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
control_pdu_info.ack_sn = sn_cursor;
|
||||
goto end_push_nack;
|
||||
}
|
||||
} else { //else { // pdu_info_cursor_p->so <= waited_so
|
||||
waited_so = pdu_info_cursor_p->so + pdu_info_cursor_p->payload_size;
|
||||
|
||||
if (pdu_info_cursor_p->lsf == 1) { // last segment flag
|
||||
//waited_so = 0x7FF;
|
||||
waited_so = 0x7FFF;
|
||||
}
|
||||
|
||||
#if TRACE_RLC_AM_STATUS_CREATION
|
||||
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEND-STATUS] LINE %d SN %04d SET WAITED SO %d @2\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
__LINE__,
|
||||
sn_cursor, waited_so);
|
||||
#endif
|
||||
}
|
||||
|
||||
cursor_p = cursor_p->next;
|
||||
|
||||
if (cursor_p != NULL) {
|
||||
pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info;
|
||||
all_segments_received = ((rlc_am_rx_pdu_management_t*)(cursor_p->data))->all_segments_received;
|
||||
previous_sn_cursor = sn_cursor;
|
||||
sn_cursor = pdu_info_cursor_p->sn;
|
||||
} else {
|
||||
// LG control_pdu_info.ack_sn = (previous_sn_cursor + 1) & RLC_AM_SN_MASK;
|
||||
control_pdu_info.ack_sn = previous_sn_cursor;
|
||||
goto end_push_nack;
|
||||
}
|
||||
} while ((cursor_p != NULL) && (sn_cursor == previous_sn_cursor));
|
||||
|
||||
// may be last segment of PDU not received
|
||||
//if ((sn_cursor != previous_sn_cursor) && (waited_so != 0x7FF)) {
|
||||
if ((sn_cursor != previous_sn_cursor) && (waited_so != 0x7FFF)) {
|
||||
if (nb_bits_to_transmit >= 42) {
|
||||
control_pdu_info.nack_list[control_pdu_info.num_nack].nack_sn = previous_sn_cursor;
|
||||
control_pdu_info.nack_list[control_pdu_info.num_nack].so_start = waited_so;
|
||||
//control_pdu_info.nack_list[control_pdu_info.num_nack].so_end = 0x7FF;
|
||||
control_pdu_info.nack_list[control_pdu_info.num_nack].so_end = 0x7FFF;
|
||||
control_pdu_info.nack_list[control_pdu_info.num_nack].e1 = 1;
|
||||
control_pdu_info.nack_list[control_pdu_info.num_nack].e2 = 1;
|
||||
control_pdu_info.num_nack += 1;
|
||||
nb_bits_to_transmit = nb_bits_to_transmit - 42;
|
||||
#if TRACE_RLC_AM_STATUS_CREATION
|
||||
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEND-STATUS] LINE %d PREPARE SENDING NACK %04d SO START %05d SO END %05d\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
__LINE__,
|
||||
previous_sn_cursor,
|
||||
waited_so,
|
||||
0x7FFF);
|
||||
#endif
|
||||
} else {
|
||||
control_pdu_info.ack_sn = previous_sn_cursor;
|
||||
goto end_push_nack;
|
||||
}
|
||||
}
|
||||
|
||||
waited_so = 0;
|
||||
} else {
|
||||
waited_so = 0;
|
||||
cursor_p = cursor_p->next;
|
||||
previous_sn_cursor = sn_cursor;
|
||||
}
|
||||
}
|
||||
|
||||
control_pdu_info.ack_sn = (previous_sn_cursor + 1) & RLC_AM_SN_MASK;
|
||||
} else {
|
||||
control_pdu_info.ack_sn = rlc_pP->vr_r;
|
||||
#if TRACE_RLC_AM_STATUS_CREATION
|
||||
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEND-STATUS] LINE %d PREPARE SENDING ACK %04d = VR(R)\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
__LINE__,
|
||||
control_pdu_info.ack_sn);
|
||||
#endif
|
||||
}
|
||||
|
||||
end_push_nack:
|
||||
|
||||
if (control_pdu_info.num_nack > 0) {
|
||||
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, ctxt_pP->frame,nb_bits_to_transmit);
|
||||
|
||||
#if TRACE_RLC_AM_STATUS_CREATION
|
||||
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEND-STATUS] LINE %d PREPARE SENDING ACK %04d NUM NACK %d\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
__LINE__,
|
||||
control_pdu_info.ack_sn,
|
||||
control_pdu_info.num_nack);
|
||||
#endif
|
||||
// encode the control pdu
|
||||
pdu_size = rlc_pP->nb_bytes_requested_by_mac - ((nb_bits_to_transmit - 7 )>> 3);
|
||||
|
||||
#if TRACE_RLC_AM_STATUS_CREATION
|
||||
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEND-STATUS] LINE %d forecast pdu_size %d\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
__LINE__,
|
||||
pdu_size);
|
||||
#endif
|
||||
tb_p = get_free_mem_block(sizeof(struct mac_tb_req) + pdu_size, __func__);
|
||||
if(tb_p == NULL) return;
|
||||
memset(tb_p->data, 0, sizeof(struct mac_tb_req) + pdu_size);
|
||||
//estimation only ((struct mac_tb_req*)(tb_p->data))->tb_size = pdu_size;
|
||||
((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(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);
|
||||
|
||||
#if TRACE_RLC_AM_STATUS_CREATION
|
||||
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEND-STATUS] SEND STATUS PDU SIZE %d, rlc_pP->nb_bytes_requested_by_mac %d, nb_bits_to_transmit>>3 %d\n",
|
||||
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
|
||||
pdu_size,
|
||||
rlc_pP->nb_bytes_requested_by_mac,
|
||||
nb_bits_to_transmit >> 3);
|
||||
#endif
|
||||
assert(pdu_size == (rlc_pP->nb_bytes_requested_by_mac - (nb_bits_to_transmit >> 3)));
|
||||
|
||||
// remaining bytes to transmit for RLC (retrans pdus and new data pdus)
|
||||
rlc_pP->nb_bytes_requested_by_mac = rlc_pP->nb_bytes_requested_by_mac - pdu_size;
|
||||
// put pdu in trans
|
||||
list_add_head(tb_p, &rlc_pP->control_pdu_list);
|
||||
rlc_pP->stat_tx_control_pdu += 1;
|
||||
rlc_pP->stat_tx_control_bytes += pdu_size;
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -237,24 +237,6 @@ void handle_ulsch(UL_IND_t *UL_info) {
|
||||
#define C do { size = 0; put(0); } while (0)
|
||||
#define A(...) do { char t[4096]; sprintf(t, __VA_ARGS__); append_string(t); } while (0)
|
||||
|
||||
#if 0
|
||||
|
||||
/* eats lots of ms at startup, disrupts realtime */
|
||||
static char *s;
|
||||
static int size;
|
||||
static int maxsize;
|
||||
|
||||
static void put(char x)
|
||||
{
|
||||
if (size == maxsize) {
|
||||
maxsize += 32768;
|
||||
s = realloc(s, maxsize); if (s == NULL) abort();
|
||||
}
|
||||
s[size++] = x;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
/* eats nothing at startup, but fixed size */
|
||||
#define SMAX 65536
|
||||
static char s[SMAX];
|
||||
@@ -267,8 +249,6 @@ static void put(char x)
|
||||
s[size++] = x;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static void append_string(char *t)
|
||||
{
|
||||
size--;
|
||||
|
||||
@@ -96,30 +96,6 @@ mac_rrc_data_req(
|
||||
RC.rrc[Mod_idP]->carrier[CC_id].SIB1,
|
||||
RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1);
|
||||
|
||||
#if 0 //defined(ENABLE_ITTI)
|
||||
{
|
||||
MessageDef *message_p;
|
||||
int sib1_size = RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1;
|
||||
int sdu_size = sizeof(RRC_MAC_BCCH_DATA_REQ (message_p).sdu);
|
||||
|
||||
if (sib1_size > sdu_size) {
|
||||
LOG_E(RRC, "SIB1 SDU larger than BCCH SDU buffer size (%d, %d)", sib1_size, sdu_size);
|
||||
sib1_size = sdu_size;
|
||||
}
|
||||
|
||||
message_p = itti_alloc_new_message (TASK_RRC_ENB, RRC_MAC_BCCH_DATA_REQ);
|
||||
RRC_MAC_BCCH_DATA_REQ (message_p).frame = frameP;
|
||||
RRC_MAC_BCCH_DATA_REQ (message_p).sdu_size = sib1_size;
|
||||
memset (RRC_MAC_BCCH_DATA_REQ (message_p).sdu, 0, BCCH_SDU_SIZE);
|
||||
memcpy (RRC_MAC_BCCH_DATA_REQ (message_p).sdu,
|
||||
RC.rrc[Mod_idP]->carrier[CC_id].SIB1,
|
||||
sib1_size);
|
||||
RRC_MAC_BCCH_DATA_REQ (message_p).enb_index = eNB_index;
|
||||
|
||||
itti_send_msg_to_task (TASK_MAC_ENB, ENB_MODULE_ID_TO_INSTANCE(Mod_idP), message_p);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_RRC
|
||||
LOG_T(RRC,"[eNB %d] Frame %d : BCCH request => SIB 1\n",Mod_idP,frameP);
|
||||
|
||||
@@ -137,30 +113,6 @@ mac_rrc_data_req(
|
||||
RC.rrc[Mod_idP]->carrier[CC_id].SIB23,
|
||||
RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB23);
|
||||
|
||||
#if 0 //defined(ENABLE_ITTI)
|
||||
{
|
||||
MessageDef *message_p;
|
||||
int sib23_size = RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB23;
|
||||
int sdu_size = sizeof(RRC_MAC_BCCH_DATA_REQ (message_p).sdu);
|
||||
|
||||
if (sib23_size > sdu_size) {
|
||||
LOG_E(RRC, "SIB23 SDU larger than BCCH SDU buffer size (%d, %d)", sib23_size, sdu_size);
|
||||
sib23_size = sdu_size;
|
||||
}
|
||||
|
||||
message_p = itti_alloc_new_message (TASK_RRC_ENB, RRC_MAC_BCCH_DATA_REQ);
|
||||
RRC_MAC_BCCH_DATA_REQ (message_p).frame = frameP;
|
||||
RRC_MAC_BCCH_DATA_REQ (message_p).sdu_size = sib23_size;
|
||||
memset (RRC_MAC_BCCH_DATA_REQ (message_p).sdu, 0, BCCH_SDU_SIZE);
|
||||
memcpy (RRC_MAC_BCCH_DATA_REQ (message_p).sdu,
|
||||
RC.rrc[Mod_idP]->carrier[CC_id].SIB23,
|
||||
sib23_size);
|
||||
RRC_MAC_BCCH_DATA_REQ (message_p).enb_index = eNB_index;
|
||||
|
||||
itti_send_msg_to_task (TASK_MAC_ENB, ENB_MODULE_ID_TO_INSTANCE(Mod_idP), message_p);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_RRC
|
||||
LOG_T(RRC,"[eNB %d] Frame %d BCCH request => SIB 2-3\n",Mod_idP,frameP);
|
||||
|
||||
@@ -205,28 +157,6 @@ mac_rrc_data_req(
|
||||
if(Srb_info->Tx_buffer.payload_size>0) { //Fill buffer
|
||||
LOG_D(RRC,"[eNB %d] CCCH (%p) has %d bytes (dest: %p, src %p)\n",Mod_idP,Srb_info,Srb_info->Tx_buffer.payload_size,buffer_pP,Srb_info->Tx_buffer.Payload);
|
||||
|
||||
#if 0 // defined(ENABLE_ITTI)
|
||||
{
|
||||
MessageDef *message_p;
|
||||
int ccch_size = Srb_info->Tx_buffer.payload_size;
|
||||
int sdu_size = sizeof(RRC_MAC_CCCH_DATA_REQ (message_p).sdu);
|
||||
|
||||
if (ccch_size > sdu_size) {
|
||||
LOG_E(RRC, "SDU larger than CCCH SDU buffer size (%d, %d)", ccch_size, sdu_size);
|
||||
ccch_size = sdu_size;
|
||||
}
|
||||
|
||||
message_p = itti_alloc_new_message (TASK_RRC_ENB, RRC_MAC_CCCH_DATA_REQ);
|
||||
RRC_MAC_CCCH_DATA_REQ (message_p).frame = frameP;
|
||||
RRC_MAC_CCCH_DATA_REQ (message_p).sdu_size = ccch_size;
|
||||
memset (RRC_MAC_CCCH_DATA_REQ (message_p).sdu, 0, CCCH_SDU_SIZE);
|
||||
memcpy (RRC_MAC_CCCH_DATA_REQ (message_p).sdu, Srb_info->Tx_buffer.Payload, ccch_size);
|
||||
RRC_MAC_CCCH_DATA_REQ (message_p).enb_index = eNB_index;
|
||||
|
||||
itti_send_msg_to_task (TASK_MAC_ENB, ENB_MODULE_ID_TO_INSTANCE(Mod_idP), message_p);
|
||||
}
|
||||
#endif
|
||||
|
||||
memcpy(buffer_pP,Srb_info->Tx_buffer.Payload,Srb_info->Tx_buffer.payload_size);
|
||||
Sdu_size = Srb_info->Tx_buffer.payload_size;
|
||||
Srb_info->Tx_buffer.payload_size=0;
|
||||
@@ -243,28 +173,6 @@ mac_rrc_data_req(
|
||||
LOG_D(RRC,"[eNB %d] PCCH (%p) has %d bytes\n",Mod_idP,&RC.rrc[Mod_idP]->carrier[CC_id].paging[mbsfn_sync_area],
|
||||
RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area]);
|
||||
|
||||
#if 0 //defined(ENABLE_ITTI)
|
||||
{
|
||||
MessageDef *message_p;
|
||||
int pcch_size = RC.rrc[Mod_idP]->arrier[CC_id].sizeof_paging[mbsfn_sync_area];
|
||||
int sdu_size = sizeof(RRC_MAC_PCCH_DATA_REQ (message_p).sdu);
|
||||
|
||||
if (pcch_size > sdu_size) {
|
||||
LOG_E(RRC, "SDU larger than PCCH SDU buffer size (%d, %d)", pcch_size, sdu_size);
|
||||
pcch_size = sdu_size;
|
||||
}
|
||||
|
||||
message_p = itti_alloc_new_message (TASK_RRC_ENB, RRC_MAC_PCCH_DATA_REQ);
|
||||
RRC_MAC_PCCH_DATA_REQ (message_p).frame = frameP;
|
||||
RRC_MAC_PCCH_DATA_REQ (message_p).sdu_size = pcch_size;
|
||||
memset (RRC_MAC_PCCH_DATA_REQ (message_p).sdu, 0, PCCH_SDU_SIZE);
|
||||
memcpy (RRC_MAC_PCCH_DATA_REQ (message_p).sdu, RC.rrc[Mod_idP]->carrier[CC_id].paging[mbsfn_sync_area], pcch_size);
|
||||
RRC_MAC_PCCH_DATA_REQ (message_p).enb_index = eNB_index;
|
||||
|
||||
itti_send_msg_to_task (TASK_MAC_ENB, ENB_MODULE_ID_TO_INSTANCE(Mod_idP), message_p);
|
||||
}
|
||||
#endif
|
||||
|
||||
memcpy(buffer_pP, RC.rrc[Mod_idP]->carrier[CC_id].paging[mbsfn_sync_area], RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area]);
|
||||
Sdu_size = RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area];
|
||||
RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area] = 0;
|
||||
@@ -280,32 +188,6 @@ mac_rrc_data_req(
|
||||
return 0; // this parameter is set in function init_mcch in rrc_eNB.c
|
||||
}
|
||||
|
||||
|
||||
#if 0 // defined(ENABLE_ITTI)
|
||||
{
|
||||
MessageDef *message_p;
|
||||
int mcch_size = RC.rrc[Mod_idP]->carrier[CC_id].sizeof_MCCH_MESSAGE[mbsfn_sync_area];
|
||||
int sdu_size = sizeof(RRC_MAC_MCCH_DATA_REQ (message_p).sdu);
|
||||
|
||||
if (mcch_size > sdu_size) {
|
||||
LOG_E(RRC, "SDU larger than MCCH SDU buffer size (%d, %d)", mcch_size, sdu_size);
|
||||
mcch_size = sdu_size;
|
||||
}
|
||||
|
||||
message_p = itti_alloc_new_message (TASK_RRC_ENB, RRC_MAC_MCCH_DATA_REQ);
|
||||
RRC_MAC_MCCH_DATA_REQ (message_p).frame = frameP;
|
||||
RRC_MAC_MCCH_DATA_REQ (message_p).sdu_size = mcch_size;
|
||||
memset (RRC_MAC_MCCH_DATA_REQ (message_p).sdu, 0, MCCH_SDU_SIZE);
|
||||
memcpy (RRC_MAC_MCCH_DATA_REQ (message_p).sdu,
|
||||
RC.rrc[Mod_idP]->carrier[CC_id].MCCH_MESSAGE[mbsfn_sync_area],
|
||||
mcch_size);
|
||||
RRC_MAC_MCCH_DATA_REQ (message_p).enb_index = eNB_index;
|
||||
RRC_MAC_MCCH_DATA_REQ (message_p).mbsfn_sync_area = mbsfn_sync_area;
|
||||
|
||||
itti_send_msg_to_task (TASK_MAC_ENB, ENB_MODULE_ID_TO_INSTANCE(Mod_idP), message_p);
|
||||
}
|
||||
#endif
|
||||
|
||||
memcpy(&buffer_pP[0],
|
||||
RC.rrc[Mod_idP]->carrier[CC_id].MCCH_MESSAGE[mbsfn_sync_area],
|
||||
RC.rrc[Mod_idP]->carrier[CC_id].sizeof_MCCH_MESSAGE[mbsfn_sync_area]);
|
||||
@@ -380,31 +262,6 @@ mac_rrc_data_ind(
|
||||
Srb_info = &RC.rrc[module_idP]->carrier[CC_id].Srb0;
|
||||
LOG_D(RRC,"[eNB %d] Received SDU for CCCH on SRB %d\n",module_idP,Srb_info->Srb_id);
|
||||
|
||||
#if 0 //defined(ENABLE_ITTI)
|
||||
{
|
||||
MessageDef *message_p;
|
||||
int msg_sdu_size = sizeof(RRC_MAC_CCCH_DATA_IND (message_p).sdu);
|
||||
|
||||
if (sdu_lenP > msg_sdu_size) {
|
||||
LOG_E(RRC, "SDU larger than CCCH SDU buffer size (%d, %d)", sdu_lenP, msg_sdu_size);
|
||||
sdu_size = msg_sdu_size;
|
||||
} else {
|
||||
sdu_size = sdu_lenP;
|
||||
}
|
||||
|
||||
message_p = itti_alloc_new_message (TASK_MAC_ENB, RRC_MAC_CCCH_DATA_IND);
|
||||
RRC_MAC_CCCH_DATA_IND (message_p).frame = frameP;
|
||||
RRC_MAC_CCCH_DATA_IND (message_p).sub_frame = sub_frameP;
|
||||
RRC_MAC_CCCH_DATA_IND (message_p).rnti = rntiP;
|
||||
RRC_MAC_CCCH_DATA_IND (message_p).sdu_size = sdu_size;
|
||||
RRC_MAC_CCCH_DATA_IND (message_p).CC_id = CC_id;
|
||||
memset (RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, CCCH_SDU_SIZE);
|
||||
memcpy (RRC_MAC_CCCH_DATA_IND (message_p).sdu, sduP, sdu_size);
|
||||
LOG_D(RRC,"[eNB %d] Sending message to RRC task\n",module_idP);
|
||||
itti_send_msg_to_task (TASK_RRC_ENB, ctxt.instance, message_p);
|
||||
}
|
||||
#else
|
||||
|
||||
// msg("\n******INST %d Srb_info %p, Srb_id=%d****\n\n",Mod_id,Srb_info,Srb_info->Srb_id);
|
||||
if (sdu_lenP > 0) {
|
||||
memcpy(Srb_info->Rx_buffer.Payload,sduP,sdu_lenP);
|
||||
@@ -422,7 +279,6 @@ mac_rrc_data_ind(
|
||||
ue_context_p->ue_context.Status = RRC_RECONFIGURED;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return(0);
|
||||
|
||||
|
||||
@@ -477,22 +477,6 @@ uint8_t do_SIB1(rrc_eNB_carrier_data_t *carrier,
|
||||
ASN_SEQUENCE_ADD(&schedulingInfo.sib_MappingInfo.list,&sib_type);
|
||||
ASN_SEQUENCE_ADD(&(*sib1)->schedulingInfoList.list,&schedulingInfo);
|
||||
|
||||
#if 0
|
||||
/* TODO: this is disabled for the moment because OAI UE does
|
||||
* not connect to OAI eNB with the current software.
|
||||
* See also TODO comment in do_SIB23.
|
||||
*/
|
||||
//TTN - This is for SIB18
|
||||
sib_type=SIB_Type_sibType18_v1250;
|
||||
ASN_SEQUENCE_ADD(&schedulingInfo.sib_MappingInfo.list,&sib_type);
|
||||
ASN_SEQUENCE_ADD(&(*sib1)->schedulingInfoList.list,&schedulingInfo);
|
||||
|
||||
//TTN - This is for SIB19
|
||||
sib_type=SIB_Type_sibType19_v1250;
|
||||
ASN_SEQUENCE_ADD(&schedulingInfo.sib_MappingInfo.list,&sib_type);
|
||||
ASN_SEQUENCE_ADD(&(*sib1)->schedulingInfoList.list,&schedulingInfo);
|
||||
#endif
|
||||
|
||||
// ASN_SEQUENCE_ADD(&schedulingInfo.sib_MappingInfo.list,NULL);
|
||||
|
||||
#if defined(ENABLE_ITTI)
|
||||
@@ -673,11 +657,6 @@ uint8_t do_SIB23(uint8_t Mod_id,
|
||||
|
||||
(*sib2)->ac_BarringInfo = NULL;
|
||||
#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0))
|
||||
#if 0
|
||||
(*sib2)->ssac_BarringForMMTEL_Voice_r9 = NULL;
|
||||
(*sib2)->ssac_BarringForMMTEL_Video_r9 = NULL;
|
||||
(*sib2)->ac_BarringForCSFB_r10 = NULL;
|
||||
#endif
|
||||
(*sib2)->ext1 = NULL;
|
||||
(*sib2)->ext2 = NULL;
|
||||
#endif
|
||||
@@ -970,12 +949,6 @@ uint8_t do_SIB23(uint8_t Mod_id,
|
||||
/// (*SIB3)
|
||||
#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0))
|
||||
(*sib3)->ext1 = NULL;
|
||||
#if 0
|
||||
(*sib3)->s_IntraSearch_v920=NULL;
|
||||
(*sib3)->s_NonIntraSearch_v920=NULL;
|
||||
(*sib3)->q_QualMin_r9=NULL;
|
||||
(*sib3)->threshServingLowQ_r9=NULL;
|
||||
#endif
|
||||
#endif
|
||||
(*sib3)->cellReselectionInfoCommon.q_Hyst=SystemInformationBlockType3__cellReselectionInfoCommon__q_Hyst_dB4;
|
||||
|
||||
@@ -1375,20 +1348,6 @@ uint8_t do_SIB23(uint8_t Mod_id,
|
||||
if (MBMS_flag > 0) {
|
||||
ASN_SEQUENCE_ADD(&bcch_message->message.choice.c1.choice.systemInformation.criticalExtensions.choice.systemInformation_r8.sib_TypeAndInfo.list,sib13_part);
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* TODO: this is disabled for the moment.
|
||||
* Maybe we shouldn't put this together with SIBs 2/3.
|
||||
* The problem is that the MAC message is now 92 bytes, which
|
||||
* is too much in the SIB scheduler (the scheduler allocates
|
||||
* 4 RBs with max MCS 8).
|
||||
*/
|
||||
//for D2D
|
||||
ASN_SEQUENCE_ADD(&bcch_message->message.choice.c1.choice.systemInformation.criticalExtensions.choice.systemInformation_r8.sib_TypeAndInfo.list, sib18_part);
|
||||
ASN_SEQUENCE_ADD(&bcch_message->message.choice.c1.choice.systemInformation.criticalExtensions.choice.systemInformation_r8.sib_TypeAndInfo.list, sib19_part);
|
||||
ASN_SEQUENCE_ADD(&bcch_message->message.choice.c1.choice.systemInformation.criticalExtensions.choice.systemInformation_r8.sib_TypeAndInfo.list, sib21_part);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef XER_PRINT
|
||||
|
||||
@@ -472,24 +472,6 @@ void init_SL_preconfig(UE_RRC_INST *UE, const uint8_t eNB_index )
|
||||
|
||||
#endif
|
||||
|
||||
#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0))
|
||||
//-----------------------------------------------------------------------------
|
||||
#if 0
|
||||
void init_MCCH_UE(module_id_t ue_mod_idP, uint8_t eNB_index)
|
||||
{
|
||||
int i;
|
||||
UE_rrc_inst[ue_mod_idP].sizeof_MCCH_MESSAGE[eNB_index] = 0;
|
||||
UE_rrc_inst[ue_mod_idP].MCCH_MESSAGE[eNB_index] = (uint8_t *)malloc16(32);
|
||||
UE_rrc_inst[ue_mod_idP].mcch_message[eNB_index] = (MBSFNAreaConfiguration_r9_t *)malloc16(sizeof(MBSFNAreaConfiguration_r9_t));
|
||||
|
||||
for (i=0; i<8; i++) { // MAX MBSFN Area
|
||||
UE_rrc_inst[ue_mod_idP].Info[eNB_index].MCCHStatus[i] = 0;
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void openair_rrc_ue_init_security( const protocol_ctxt_t* const ctxt_pP )
|
||||
{
|
||||
@@ -630,22 +612,6 @@ static const char const nas_attach_req_imsi[] = {
|
||||
};
|
||||
#endif /* !(defined(ENABLE_ITTI) && defined(ENABLE_USE_MME)) */
|
||||
|
||||
#if 0
|
||||
/* NAS Attach request with GUTI */
|
||||
static const char const nas_attach_req_guti[] = {
|
||||
0x07, 0x41,
|
||||
/* EPS Mobile identity = GUTI */
|
||||
0x71, 0x0B, 0xF6, 0x12, 0xF2, 0x01, 0x80, 0x00, 0x01, 0xE0, 0x00,
|
||||
0xDA, 0x1F,
|
||||
/* End of EPS Mobile Identity */
|
||||
0x02, 0xE0, 0xE0, 0x00, 0x20, 0x02, 0x03,
|
||||
0xD0, 0x11, 0x27, 0x1A, 0x80, 0x80, 0x21, 0x10, 0x01, 0x00, 0x00,
|
||||
0x10, 0x81, 0x06, 0x00, 0x00, 0x00, 0x00, 0x83, 0x06, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x0D, 0x00, 0x00, 0x0A, 0x00, 0x52, 0x12, 0xF2,
|
||||
0x01, 0x27, 0x11,
|
||||
};
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void
|
||||
rrc_t310_expiration(
|
||||
|
||||
@@ -698,54 +698,6 @@ rrc_eNB_get_next_free_ue_context(
|
||||
}
|
||||
}
|
||||
|
||||
#if 0 //!defined(ENABLE_USE_MME)
|
||||
void rrc_eNB_emulation_notify_ue_module_id(
|
||||
const module_id_t ue_module_idP,
|
||||
const rnti_t rntiP,
|
||||
const uint8_t cell_identity_byte0P,
|
||||
const uint8_t cell_identity_byte1P,
|
||||
const uint8_t cell_identity_byte2P,
|
||||
const uint8_t cell_identity_byte3P)
|
||||
{
|
||||
module_id_t enb_module_id;
|
||||
struct rrc_eNB_ue_context_s* ue_context_p = NULL;
|
||||
int CC_id;
|
||||
|
||||
// find enb_module_id
|
||||
for (enb_module_id = 0; enb_module_id < NUMBER_OF_eNB_MAX; enb_module_id++) {
|
||||
if(enb_module_id>0){ /*FIX LATER*/
|
||||
return;
|
||||
}
|
||||
for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
|
||||
if (&RC.rrc[enb_module_id]->carrier[CC_id].sib1 != NULL) {
|
||||
if (
|
||||
(&RC.rrc[enb_module_id]->carrier[CC_id].sib1->cellAccessRelatedInfo.cellIdentity.buf[0] == cell_identity_byte0P) &&
|
||||
(&RC.rrc[enb_module_id]->carrier[CC_id].sib1->cellAccessRelatedInfo.cellIdentity.buf[1] == cell_identity_byte1P) &&
|
||||
(&RC.rrc[enb_module_id]->carrier[CC_id].sib1->cellAccessRelatedInfo.cellIdentity.buf[2] == cell_identity_byte2P) &&
|
||||
(&RC.rrc[enb_module_id]->carrier[CC_id].sib1->cellAccessRelatedInfo.cellIdentity.buf[3] == cell_identity_byte3P)
|
||||
) {
|
||||
ue_context_p = rrc_eNB_get_ue_context(
|
||||
RC.rrc[enb_module_id],
|
||||
rntiP
|
||||
);
|
||||
|
||||
if (NULL != ue_context_p) {
|
||||
oai_emulation.info.eNB_ue_local_uid_to_ue_module_id[enb_module_id][ue_context_p->local_uid] = ue_module_idP;
|
||||
}
|
||||
|
||||
//return;
|
||||
}
|
||||
}
|
||||
}
|
||||
oai_emulation.info.eNB_ue_module_id_to_rnti[enb_module_id][ue_module_idP] = rntiP;
|
||||
}
|
||||
|
||||
AssertFatal(enb_module_id == NUMBER_OF_eNB_MAX,
|
||||
"Cell identity not found for ue module id %u rnti %x",
|
||||
ue_module_idP, rntiP);
|
||||
}
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void
|
||||
rrc_eNB_free_mem_UE_context(
|
||||
@@ -7990,44 +7942,6 @@ rrc_rx_tx(
|
||||
#if defined(ENABLE_USE_MME)
|
||||
#if defined(ENABLE_ITTI)
|
||||
rrc_eNB_generate_RRCConnectionRelease(ctxt_pP, ue_context_p);
|
||||
#if 0
|
||||
{
|
||||
int e_rab;
|
||||
MessageDef *msg_delete_tunnels_p = NULL;
|
||||
uint32_t eNB_ue_s1ap_id = ue_context_p->ue_context.eNB_ue_s1ap_id;
|
||||
MSC_LOG_TX_MESSAGE(MSC_RRC_ENB, MSC_GTPU_ENB, NULL,0, "0 GTPV1U_ENB_DELETE_TUNNEL_REQ rnti %x ", eNB_ue_s1ap_id);
|
||||
msg_delete_tunnels_p = itti_alloc_new_message(TASK_RRC_ENB, GTPV1U_ENB_DELETE_TUNNEL_REQ);
|
||||
memset(>PV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p), 0, sizeof(GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p)));
|
||||
// do not wait response
|
||||
GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).rnti = ue_context_p->ue_context.rnti;
|
||||
for (e_rab = 0; e_rab < ue_context_p->ue_context.nb_of_e_rabs; e_rab++) {
|
||||
GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).eps_bearer_id[GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).num_erab++] =
|
||||
ue_context_p->ue_context.enb_gtp_ebi[e_rab];
|
||||
// erase data
|
||||
ue_context_p->ue_context.enb_gtp_teid[e_rab] = 0;
|
||||
memset(&ue_context_p->ue_context.enb_gtp_addrs[e_rab], 0, sizeof(ue_context_p->ue_context.enb_gtp_addrs[e_rab]));
|
||||
ue_context_p->ue_context.enb_gtp_ebi[e_rab] = 0;
|
||||
}
|
||||
itti_send_msg_to_task(TASK_GTPV1_U, ctxt_pP->module_id, msg_delete_tunnels_p);
|
||||
MSC_LOG_TX_MESSAGE(
|
||||
MSC_RRC_ENB,
|
||||
MSC_S1AP_ENB,
|
||||
NULL,0,
|
||||
"0 S1AP_UE_CONTEXT_RELEASE_COMPLETE eNB_ue_s1ap_id 0x%06"PRIX32" ",
|
||||
eNB_ue_s1ap_id);
|
||||
|
||||
struct rrc_ue_s1ap_ids_s *rrc_ue_s1ap_ids = NULL;
|
||||
rrc_ue_s1ap_ids = rrc_eNB_S1AP_get_ue_ids(
|
||||
RC.rrc[ctxt_pP->module_id],
|
||||
0,
|
||||
eNB_ue_s1ap_id);
|
||||
if (NULL != rrc_ue_s1ap_ids) {
|
||||
rrc_eNB_S1AP_remove_ue_ids(
|
||||
RC.rrc[ctxt_pP->module_id],
|
||||
rrc_ue_s1ap_ids);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#else
|
||||
ue_to_be_removed = ue_context_p;
|
||||
|
||||
@@ -1289,63 +1289,6 @@ int rrc_eNB_process_S1AP_UE_CONTEXT_RELEASE_COMMAND (MessageDef *msg_p, const ch
|
||||
instance,
|
||||
eNB_ue_s1ap_id);
|
||||
*/
|
||||
#if 0
|
||||
{
|
||||
int e_rab;
|
||||
//int mod_id = 0;
|
||||
MessageDef *msg_delete_tunnels_p = NULL;
|
||||
|
||||
MSC_LOG_TX_MESSAGE(
|
||||
MSC_RRC_ENB,
|
||||
MSC_GTPU_ENB,
|
||||
NULL,0,
|
||||
"0 GTPV1U_ENB_DELETE_TUNNEL_REQ rnti %x ",
|
||||
eNB_ue_s1ap_id);
|
||||
|
||||
msg_delete_tunnels_p = itti_alloc_new_message(TASK_RRC_ENB, GTPV1U_ENB_DELETE_TUNNEL_REQ);
|
||||
memset(>PV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p),
|
||||
0,
|
||||
sizeof(GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p)));
|
||||
|
||||
// do not wait response
|
||||
GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).rnti = ue_context_p->ue_context.rnti;
|
||||
|
||||
for (e_rab = 0; e_rab < ue_context_p->ue_context.nb_of_e_rabs; e_rab++) {
|
||||
GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).eps_bearer_id[GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).num_erab++] =
|
||||
ue_context_p->ue_context.enb_gtp_ebi[e_rab];
|
||||
// erase data
|
||||
ue_context_p->ue_context.enb_gtp_teid[e_rab] = 0;
|
||||
memset(&ue_context_p->ue_context.enb_gtp_addrs[e_rab], 0, sizeof(ue_context_p->ue_context.enb_gtp_addrs[e_rab]));
|
||||
ue_context_p->ue_context.enb_gtp_ebi[e_rab] = 0;
|
||||
}
|
||||
|
||||
itti_send_msg_to_task(TASK_GTPV1_U, instance, msg_delete_tunnels_p);
|
||||
|
||||
|
||||
MSC_LOG_TX_MESSAGE(
|
||||
MSC_RRC_ENB,
|
||||
MSC_S1AP_ENB,
|
||||
NULL,0,
|
||||
"0 S1AP_UE_CONTEXT_RELEASE_COMPLETE eNB_ue_s1ap_id 0x%06"PRIX32" ",
|
||||
eNB_ue_s1ap_id);
|
||||
|
||||
MessageDef *msg_complete_p = NULL;
|
||||
msg_complete_p = itti_alloc_new_message(TASK_RRC_ENB, S1AP_UE_CONTEXT_RELEASE_COMPLETE);
|
||||
S1AP_UE_CONTEXT_RELEASE_COMPLETE(msg_complete_p).eNB_ue_s1ap_id = eNB_ue_s1ap_id;
|
||||
itti_send_msg_to_task(TASK_S1AP, instance, msg_complete_p);
|
||||
|
||||
rrc_ue_s1ap_ids = rrc_eNB_S1AP_get_ue_ids(
|
||||
RC.rrc[instance],
|
||||
UE_INITIAL_ID_INVALID,
|
||||
eNB_ue_s1ap_id);
|
||||
|
||||
if (NULL != rrc_ue_s1ap_ids) {
|
||||
rrc_eNB_S1AP_remove_ue_ids(
|
||||
RC.rrc[instance],
|
||||
rrc_ue_s1ap_ids);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,9 +155,6 @@ rrc_eNB_get_ue_context(
|
||||
memset(&temp, 0, sizeof(struct rrc_eNB_ue_context_s));
|
||||
/* eNB ue rrc id = 24 bits wide */
|
||||
temp.ue_id_rnti = rntiP;
|
||||
#if 0
|
||||
return RB_FIND(rrc_ue_tree_s, &rrc_instance_pP->rrc_ue_head, &temp);
|
||||
#endif
|
||||
struct rrc_eNB_ue_context_s *ue_context_p = NULL;
|
||||
ue_context_p = RB_FIND(rrc_ue_tree_s, &rrc_instance_pP->rrc_ue_head, &temp);
|
||||
if ( ue_context_p != NULL) {
|
||||
|
||||
@@ -879,46 +879,6 @@ void nfapi_log(char *file, char *func, int line, int comp, int level, const char
|
||||
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
|
||||
}
|
||||
|
||||
#endif
|
||||
#if 0
|
||||
LOG_params log_params;
|
||||
int len;
|
||||
|
||||
len = vsnprintf(log_params.l_buff_info, MAX_LOG_INFO-1, format, args);
|
||||
|
||||
//2 first parameters must be passed as 'const' to the thread function
|
||||
log_params.file = strdup(file);
|
||||
log_params.func = strdup(func);
|
||||
log_params.line = line;
|
||||
log_params.comp = PHY;//comp;
|
||||
log_params.level = 6; // INFO - level;
|
||||
log_params.format = format;
|
||||
log_params.len = len;
|
||||
|
||||
if (pthread_mutex_lock(&log_lock) != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
log_list_tail++;
|
||||
log_list[log_list_tail - 1] = log_params;
|
||||
|
||||
if (log_list_tail >= 1000) {
|
||||
log_list_tail = 0;
|
||||
}
|
||||
|
||||
if (log_list_nb_elements < 1000) {
|
||||
log_list_nb_elements++;
|
||||
}
|
||||
|
||||
if(pthread_cond_signal(&log_notify) != 0) {
|
||||
pthread_mutex_unlock(&log_lock);
|
||||
return;
|
||||
}
|
||||
|
||||
if(pthread_mutex_unlock(&log_lock) != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1121,261 +1081,6 @@ void *log_thread_function(void *list)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
/* This function does not work. When multiple threads call it at the same time
|
||||
* for the same component, both threads end up using the same buffer.
|
||||
* The output is the completely messed up/wrong.
|
||||
* Kept in case the fix below is not correct or acceptable.
|
||||
*/
|
||||
//log record, format, and print: executed in the main thread (mt)
|
||||
void logRecord_mt(const char *file, const char *func, int line, int comp,
|
||||
int level, const char *format, ...)
|
||||
{
|
||||
int len = 0;
|
||||
va_list args;
|
||||
log_component_t *c;
|
||||
char *log_start;
|
||||
char *log_end;
|
||||
|
||||
/* for no gcc warnings */
|
||||
(void)log_start;
|
||||
(void)log_end;
|
||||
|
||||
c = &g_log->log_component[comp];
|
||||
|
||||
// do not apply filtering for LOG_F
|
||||
// only log messages which are enabled and are below the global log level and component's level threshold
|
||||
if ((level != LOG_FILE) && ((level > c->level) || (level > g_log->level))) {
|
||||
/* if ((level != LOG_FILE) &&
|
||||
((level > c->level) ||
|
||||
(level > g_log->level) ||
|
||||
( c->level > g_log->level))) {
|
||||
*/
|
||||
return;
|
||||
}
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_LOG_RECORD,
|
||||
VCD_FUNCTION_IN);
|
||||
|
||||
va_start(args, format);
|
||||
|
||||
// adjust syslog level for TRACE messages
|
||||
if (g_log->syslog) {
|
||||
if (g_log->level > LOG_DEBUG) {
|
||||
g_log->level = LOG_DEBUG;
|
||||
}
|
||||
}
|
||||
|
||||
// make sure that for log trace the extra info is only printed once, reset when the level changes
|
||||
if ((level == LOG_FILE) || (c->flag == LOG_NONE) || (level == LOG_TRACE)) {
|
||||
log_start = c->log_buffer;
|
||||
len = vsnprintf(c->log_buffer, MAX_LOG_TOTAL-1, format, args);
|
||||
log_end = c->log_buffer + len;
|
||||
} else {
|
||||
if ( (g_log->flag & FLAG_COLOR) || (c->flag & FLAG_COLOR) ) {
|
||||
len += snprintf(&c->log_buffer[len], MAX_LOG_TOTAL - len, "%s",
|
||||
log_level_highlight_start[level]);
|
||||
}
|
||||
|
||||
log_start = c->log_buffer + len;
|
||||
|
||||
if ( (g_log->flag & FLAG_COMP) || (c->flag & FLAG_COMP) ) {
|
||||
len += snprintf(&c->log_buffer[len], MAX_LOG_TOTAL - len, "[%s]",
|
||||
g_log->log_component[comp].name);
|
||||
}
|
||||
|
||||
if ( (g_log->flag & FLAG_LEVEL) || (c->flag & FLAG_LEVEL) ) {
|
||||
len += snprintf(&c->log_buffer[len], MAX_LOG_TOTAL - len, "[%s]",
|
||||
g_log->level2string[level]);
|
||||
}
|
||||
|
||||
if ( (g_log->flag & FLAG_FUNCT) || (c->flag & FLAG_FUNCT) ) {
|
||||
len += snprintf(&c->log_buffer[len], MAX_LOG_TOTAL - len, "[%s] ",
|
||||
func);
|
||||
}
|
||||
|
||||
if ( (g_log->flag & FLAG_FILE_LINE) || (c->flag & FLAG_FILE_LINE) ) {
|
||||
len += snprintf(&c->log_buffer[len], MAX_LOG_TOTAL - len, "[%s:%d]",
|
||||
file, line);
|
||||
}
|
||||
|
||||
len += vsnprintf(&c->log_buffer[len], MAX_LOG_TOTAL - len, format, args);
|
||||
log_end = c->log_buffer + len;
|
||||
|
||||
if ( (g_log->flag & FLAG_COLOR) || (c->flag & FLAG_COLOR) ) {
|
||||
len += snprintf(&c->log_buffer[len], MAX_LOG_TOTAL - len, "%s",
|
||||
log_level_highlight_end[level]);
|
||||
}
|
||||
}
|
||||
|
||||
va_end(args);
|
||||
|
||||
// OAI printf compatibility
|
||||
if ((g_log->onlinelog == 1) && (level != LOG_FILE))
|
||||
fwrite(c->log_buffer, len, 1, stdout);
|
||||
|
||||
if (g_log->syslog) {
|
||||
syslog(g_log->level, "%s", c->log_buffer);
|
||||
}
|
||||
|
||||
if (g_log->filelog) {
|
||||
if (write(gfd, c->log_buffer, len) < len) {
|
||||
// TODO assert ?
|
||||
}
|
||||
}
|
||||
|
||||
if ((g_log->log_component[comp].filelog) && (level == LOG_FILE)) {
|
||||
if (write(g_log->log_component[comp].fd, c->log_buffer, len) < len) {
|
||||
// TODO assert ?
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(ENABLE_ITTI)
|
||||
|
||||
if (level <= LOG_DEBUG) {
|
||||
task_id_t origin_task_id = TASK_UNKNOWN;
|
||||
MessagesIds messages_id;
|
||||
MessageDef *message_p;
|
||||
size_t message_string_size;
|
||||
char *message_msg_p;
|
||||
|
||||
message_string_size = log_end - log_start;
|
||||
|
||||
#if !defined(DISABLE_ITTI_DETECT_SUB_TASK_ID)
|
||||
|
||||
/* Try to identify sub task ID from log information (comp, log_instance_type) */
|
||||
switch (comp) {
|
||||
case PHY:
|
||||
switch (log_instance_type) {
|
||||
case LOG_INSTANCE_ENB:
|
||||
origin_task_id = TASK_PHY_ENB;
|
||||
break;
|
||||
|
||||
case LOG_INSTANCE_UE:
|
||||
origin_task_id = TASK_PHY_UE;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case MAC:
|
||||
switch (log_instance_type) {
|
||||
case LOG_INSTANCE_ENB:
|
||||
origin_task_id = TASK_MAC_ENB;
|
||||
break;
|
||||
|
||||
case LOG_INSTANCE_UE:
|
||||
origin_task_id = TASK_MAC_UE;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case RLC:
|
||||
switch (log_instance_type) {
|
||||
case LOG_INSTANCE_ENB:
|
||||
origin_task_id = TASK_RLC_ENB;
|
||||
break;
|
||||
|
||||
case LOG_INSTANCE_UE:
|
||||
origin_task_id = TASK_RLC_UE;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case PDCP:
|
||||
switch (log_instance_type) {
|
||||
case LOG_INSTANCE_ENB:
|
||||
origin_task_id = TASK_PDCP_ENB;
|
||||
break;
|
||||
|
||||
case LOG_INSTANCE_UE:
|
||||
origin_task_id = TASK_PDCP_UE;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
switch (level) {
|
||||
case LOG_EMERG:
|
||||
case LOG_ALERT:
|
||||
case LOG_CRIT:
|
||||
case LOG_ERR:
|
||||
messages_id = ERROR_LOG;
|
||||
break;
|
||||
|
||||
case LOG_WARNING:
|
||||
messages_id = WARNING_LOG;
|
||||
break;
|
||||
|
||||
case LOG_NOTICE:
|
||||
messages_id = NOTICE_LOG;
|
||||
break;
|
||||
|
||||
case LOG_INFO:
|
||||
messages_id = INFO_LOG;
|
||||
break;
|
||||
|
||||
default:
|
||||
messages_id = DEBUG_LOG;
|
||||
break;
|
||||
}
|
||||
|
||||
message_p = itti_alloc_new_message_sized(origin_task_id, messages_id, message_string_size);
|
||||
|
||||
switch (level) {
|
||||
case LOG_EMERG:
|
||||
case LOG_ALERT:
|
||||
case LOG_CRIT:
|
||||
case LOG_ERR:
|
||||
message_msg_p = (char *) &message_p->ittiMsg.error_log;
|
||||
break;
|
||||
|
||||
case LOG_WARNING:
|
||||
message_msg_p = (char *) &message_p->ittiMsg.warning_log;
|
||||
break;
|
||||
|
||||
case LOG_NOTICE:
|
||||
message_msg_p = (char *) &message_p->ittiMsg.notice_log;
|
||||
break;
|
||||
|
||||
case LOG_INFO:
|
||||
message_msg_p = (char *) &message_p->ittiMsg.info_log;
|
||||
break;
|
||||
|
||||
default:
|
||||
message_msg_p = (char *) &message_p->ittiMsg.debug_log;
|
||||
break;
|
||||
}
|
||||
|
||||
memcpy(message_msg_p, log_start, message_string_size);
|
||||
|
||||
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_LOG_RECORD,
|
||||
VCD_FUNCTION_OUT);
|
||||
}
|
||||
#endif /* #if 0 */
|
||||
|
||||
//log record, format, and print: executed in the main thread (mt)
|
||||
void logRecord_mt(const char *file, const char *func, int line, int comp,
|
||||
int level, const char *format, ...)
|
||||
@@ -1729,15 +1434,7 @@ int set_comp_log(int component, int level, int verbosity, int interval)
|
||||
LOG_EMERG);
|
||||
DevCheck((interval >= 0) && (interval <= 0xFF), interval, 0, 0xFF);
|
||||
|
||||
#if 0
|
||||
if ((verbosity == LOG_NONE) || (verbosity == LOG_LOW) ||
|
||||
(verbosity == LOG_MED) || (verbosity == LOG_FULL) ||
|
||||
(verbosity == LOG_HIGH)) {
|
||||
g_log->log_component[component].flag = verbosity;
|
||||
}
|
||||
#else
|
||||
g_log->log_component[component].flag = verbosity;
|
||||
#endif
|
||||
|
||||
g_log->log_component[component].level = level;
|
||||
g_log->log_component[component].interval = interval;
|
||||
|
||||
@@ -46,17 +46,6 @@
|
||||
#define DIRECTION_DOWNLINK 1
|
||||
|
||||
/* SR: no need to declare following part: */
|
||||
#if 0
|
||||
/* rntiType */
|
||||
#define NO_RNTI 0
|
||||
#define P_RNTI 1
|
||||
#define RA_RNTI 2
|
||||
#define C_RNTI 3
|
||||
#define SI_RNTI 4
|
||||
#define SPS_RNTI 5
|
||||
#define M_RNTI 6
|
||||
#endif
|
||||
|
||||
typedef enum mac_lte_oob_event {
|
||||
ltemac_send_preamble,
|
||||
ltemac_send_sr,
|
||||
@@ -153,35 +142,6 @@ typedef struct mac_lte_info {
|
||||
guint16 oob_rnti[MAX_SRs];
|
||||
} mac_lte_info;
|
||||
|
||||
/* SR: no need to declare following part: */
|
||||
#if 0
|
||||
typedef struct mac_lte_tap_info {
|
||||
/* Info from context */
|
||||
guint16 rnti;
|
||||
guint16 ueid;
|
||||
guint8 rntiType;
|
||||
guint8 isPredefinedData;
|
||||
guint8 crcStatusValid;
|
||||
mac_lte_crc_status crcStatus;
|
||||
guint8 direction;
|
||||
|
||||
guint8 isPHYRetx;
|
||||
guint16 ueInTTI;
|
||||
|
||||
nstime_t time;
|
||||
|
||||
/* Number of bytes (which part is used depends upon context settings) */
|
||||
guint32 single_number_of_bytes;
|
||||
guint32 bytes_for_lcid[11];
|
||||
guint32 sdus_for_lcid[11];
|
||||
guint8 number_of_rars;
|
||||
|
||||
/* Number of padding bytes includes padding subheaders and trailing padding */
|
||||
guint16 padding_bytes;
|
||||
guint16 raw_length;
|
||||
} mac_lte_tap_info;
|
||||
#endif
|
||||
|
||||
/* Accessor function to check if a frame was considered to be ReTx */
|
||||
//int is_mac_lte_frame_retx(packet_info *pinfo, guint8 direction);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user