Commit e1367de0 authored by Haruki NAOI's avatar Haruki NAOI

Fix: RB allocate duplicate between Msg3 new-transmission and Msg3 re-transmission.

(cherry picked from commit 6a0584ae989c6e1a336125338a17db79d3764073)

# Conflicts:
#	openair2/LAYER2/MAC/eNB_scheduler_RA.c
#	openair2/LAYER2/MAC/rar_tools.c
#	openair2/RRC/LTE/MESSAGES/asn1_msg.c
parent 9dfd9468
...@@ -266,6 +266,8 @@ void generate_Msg2(module_id_t module_idP, ...@@ -266,6 +266,8 @@ void generate_Msg2(module_id_t module_idP,
LOG_E(MAC, "to_prb failed\n"); LOG_E(MAC, "to_prb failed\n");
return; return;
} }
RA_t *ra_temp;
uint8_t msg3_ra_flag = 0;
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) #if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
int rmax = 0; int rmax = 0;
int rep = 0; int rep = 0;
...@@ -584,7 +586,19 @@ void generate_Msg2(module_id_t module_idP, ...@@ -584,7 +586,19 @@ void generate_Msg2(module_id_t module_idP,
"Frame %d, Subframe %d: Setting Msg3 reception for Frame %d Subframe %d\n", "Frame %d, Subframe %d: Setting Msg3 reception for Frame %d Subframe %d\n",
frameP, subframeP, ra->Msg3_frame, frameP, subframeP, ra->Msg3_frame,
ra->Msg3_subframe); ra->Msg3_subframe);
fill_rar(module_idP, CC_idP, ra, frameP, cc[CC_idP].RAR_pdu.payload, N_RB_DL, 7); for (uint8_t i = 0; i < NB_RA_PROC_MAX; i++) {
ra_temp = (RA_t *) & cc[CC_idP].ra[i];
if((ra_temp != ra) && (ra_temp->state == WAITMSG3)){
if((ra->Msg3_frame == ra_temp->Msg3_frame) && (ra->Msg3_subframe == ra_temp->Msg3_subframe)){
LOG_E(PHY,"Msg3 sf_sfn repeated %d.%d msg2 frame %d subframe %d rnti %x ra_temp->msg3_first_rb %d\n",
ra->Msg3_frame,ra->Msg3_subframe,ra->Msg2_frame, ra->Msg2_subframe,ra->rnti,ra_temp->msg3_first_rb);
if(ra_temp->msg3_first_rb < 6){
msg3_ra_flag = 1;
}
}
}
}
fill_rar(module_idP, CC_idP, ra, frameP, cc[CC_idP].RAR_pdu.payload, N_RB_DL, 7, msg3_ra_flag);
add_msg3(module_idP, CC_idP, ra, frameP, subframeP); add_msg3(module_idP, CC_idP, ra, frameP, subframeP);
ra->state = WAITMSG3; ra->state = WAITMSG3;
ra->msg3_wait_time = 1; ra->msg3_wait_time = 1;
......
...@@ -4000,14 +4000,16 @@ void ulsch_scheduler_pre_processor_fairRR(module_id_t module_idP, ...@@ -4000,14 +4000,16 @@ void ulsch_scheduler_pre_processor_fairRR(module_id_t module_idP,
for ( ulsch_ue_num = 0; ulsch_ue_num < ulsch_ue_select[CC_id].ue_num; ulsch_ue_num++ ) { for ( ulsch_ue_num = 0; ulsch_ue_num < ulsch_ue_select[CC_id].ue_num; ulsch_ue_num++ ) {
UE_id = ulsch_ue_select[CC_id].list[ulsch_ue_num].UE_id; UE_id = ulsch_ue_select[CC_id].list[ulsch_ue_num].UE_id;
if (ulsch_ue_select[CC_id].list[ulsch_ue_num].ue_priority == SCH_UL_MSG3) { if (ulsch_ue_select[CC_id].list[ulsch_ue_num].ue_priority == SCH_UL_PRACH) {
first_rb[CC_id] += 3; first_rb[CC_id] = ulsch_ue_select[CC_id].list[ulsch_ue_num].start_rb+ulsch_ue_select[CC_id].list[ulsch_ue_num].nb_rb;
ue_num_temp--; ue_num_temp--;
continue; continue;
} }
if (ulsch_ue_select[CC_id].list[ulsch_ue_num].ue_priority == SCH_UL_PRACH) { if (ulsch_ue_select[CC_id].list[ulsch_ue_num].ue_priority == SCH_UL_MSG3) {
first_rb[CC_id] = ulsch_ue_select[CC_id].list[ulsch_ue_num].start_rb+ulsch_ue_select[CC_id].list[ulsch_ue_num].nb_rb; if(ulsch_ue_select[CC_id].list[ulsch_ue_num].start_rb >= first_rb[CC_id]){
first_rb[CC_id] = ulsch_ue_select[CC_id].list[ulsch_ue_num].start_rb+ulsch_ue_select[CC_id].list[ulsch_ue_num].nb_rb;
}
ue_num_temp--; ue_num_temp--;
continue; continue;
} }
...@@ -4288,14 +4290,29 @@ schedule_ulsch_fairRR(module_id_t module_idP, frame_t frameP, ...@@ -4288,14 +4290,29 @@ schedule_ulsch_fairRR(module_id_t module_idP, frame_t frameP,
cc = &mac->common_channels[CC_id]; cc = &mac->common_channels[CC_id];
frame_parms= &RC.eNB[module_idP][CC_id]->frame_parms; frame_parms= &RC.eNB[module_idP][CC_id]->frame_parms;
//PRACH
if (is_prach_subframe(frame_parms,sched_frame,sched_subframe)==1) {
ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].ue_priority = SCH_UL_PRACH;
ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].start_rb = get_prach_prb_offset(
frame_parms,
frame_parms->prach_config_common.prach_ConfigInfo.prach_ConfigIndex,
frame_parms->prach_config_common.prach_ConfigInfo.prach_FreqOffset,
0,//tdd_mapindex
frameP); //Nf --> shouldn't it be sched_frame ???
ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].nb_rb = 6;
ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].UE_id = -1;
ulsch_ue_select[CC_id].ue_num++;
}
// output of scheduling, the UE numbers in RBs, where it is in the code??? // output of scheduling, the UE numbers in RBs, where it is in the code???
// check if RA (Msg3) is active in this subframeP, if so skip the PRBs used for Msg3 // check if RA (Msg3) is active in this subframeP, if so skip the PRBs used for Msg3
// Msg3 is using 1 PRB so we need to increase first_rb accordingly // Msg3 is using 1 PRB so we need to increase first_rb accordingly
// not sure about the break (can there be more than 1 active RA procedure?) // not sure about the break (can there be more than 1 active RA procedure?)
for (i=0; i<NB_RA_PROC_MAX; i++) { for (i=0; i<NB_RA_PROC_MAX; i++) {
if ((cc->ra[i].state == WAITMSG3) &&(cc->ra[i].Msg3_subframe == sched_subframe)) { if ((cc->ra[i].state == WAITMSG3) &&
(cc->ra[i].Msg3_frame == sched_frame) &&
(cc->ra[i].Msg3_subframe == sched_subframe)) {
ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].ue_priority = SCH_UL_MSG3; ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].ue_priority = SCH_UL_MSG3;
#if 0
if (cc->tdd_Config == NULL) { if (cc->tdd_Config == NULL) {
if(frame_parms->N_RB_UL == 25) { if(frame_parms->N_RB_UL == 25) {
ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].start_rb = 1; ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].start_rb = 1;
...@@ -4321,27 +4338,16 @@ schedule_ulsch_fairRR(module_id_t module_idP, frame_t frameP, ...@@ -4321,27 +4338,16 @@ schedule_ulsch_fairRR(module_id_t module_idP, frame_t frameP,
ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].start_rb+=1; ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].start_rb+=1;
} }
} }
#endif
ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].nb_rb = 3; ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].start_rb = cc->ra[i].msg3_first_rb;
ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].nb_rb = cc->ra[i].msg3_nb_rb;
ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].UE_id = -1; ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].UE_id = -1;
ulsch_ue_select[CC_id].ue_num++; ulsch_ue_select[CC_id].ue_num++;
break; //break;
} }
} }
//PRACH
if (is_prach_subframe(frame_parms,sched_frame,sched_subframe)==1) {
ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].ue_priority = SCH_UL_PRACH;
ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].start_rb = get_prach_prb_offset(
frame_parms,
frame_parms->prach_config_common.prach_ConfigInfo.prach_ConfigIndex,
frame_parms->prach_config_common.prach_ConfigInfo.prach_FreqOffset,
0,//tdd_mapindex
frameP); //Nf --> shouldn't it be sched_frame ???
ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].nb_rb = 6;
ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].UE_id = -1;
ulsch_ue_select[CC_id].ue_num++;
}
} }
schedule_ulsch_rnti_fairRR(module_idP, frameP, subframeP, sched_subframe,ulsch_ue_select); schedule_ulsch_rnti_fairRR(module_idP, frameP, subframeP, sched_subframe,ulsch_ue_select);
...@@ -4474,18 +4480,19 @@ void schedule_ulsch_rnti_fairRR(module_id_t module_idP, ...@@ -4474,18 +4480,19 @@ void schedule_ulsch_rnti_fairRR(module_id_t module_idP,
} }
} }
//MSG3
if (ulsch_ue_select[CC_id].list[ulsch_ue_num].ue_priority == SCH_UL_MSG3) {
first_rb[CC_id] += 3;
continue;
}
//PRACH //PRACH
if (ulsch_ue_select[CC_id].list[ulsch_ue_num].ue_priority == SCH_UL_PRACH) { if (ulsch_ue_select[CC_id].list[ulsch_ue_num].ue_priority == SCH_UL_PRACH) {
first_rb[CC_id] = ulsch_ue_select[CC_id].list[ulsch_ue_num].start_rb+ulsch_ue_select[CC_id].list[ulsch_ue_num].nb_rb; first_rb[CC_id] = ulsch_ue_select[CC_id].list[ulsch_ue_num].start_rb+ulsch_ue_select[CC_id].list[ulsch_ue_num].nb_rb;
continue; continue;
} }
//MSG3
if (ulsch_ue_select[CC_id].list[ulsch_ue_num].ue_priority == SCH_UL_MSG3) {
if(ulsch_ue_select[CC_id].list[ulsch_ue_num].start_rb >= first_rb[CC_id]){
first_rb[CC_id] = ulsch_ue_select[CC_id].list[ulsch_ue_num].start_rb+ulsch_ue_select[CC_id].list[ulsch_ue_num].nb_rb;
}
continue;
}
UE_template = &UE_list->UE_template[CC_id][UE_id]; UE_template = &UE_list->UE_template[CC_id][UE_id];
UE_sched_ctrl = &UE_list->UE_sched_ctrl[UE_id]; UE_sched_ctrl = &UE_list->UE_sched_ctrl[UE_id];
harq_pid = subframe2harqpid(cc,sched_frame,sched_subframeP); harq_pid = subframe2harqpid(cc,sched_frame,sched_subframeP);
......
...@@ -328,7 +328,8 @@ unsigned short fill_rar(const module_id_t module_idP, ...@@ -328,7 +328,8 @@ unsigned short fill_rar(const module_id_t module_idP,
const frame_t frameP, const frame_t frameP,
uint8_t * const dlsch_buffer, uint8_t * const dlsch_buffer,
const uint16_t N_RB_UL, const uint16_t N_RB_UL,
const uint8_t input_buffer_length); const uint8_t input_buffer_length,
uint8_t msg3_ra_flag);
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) #if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
unsigned short fill_rar_br(eNB_MAC_INST * eNB, unsigned short fill_rar_br(eNB_MAC_INST * eNB,
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
* @ingroup _mac * @ingroup _mac
*/ */
#include "PHY/LTE_TRANSPORT/transport_common_proto.h"
#include "mac.h" #include "mac.h"
#include "mac_proto.h" #include "mac_proto.h"
#include "mac_extern.h" #include "mac_extern.h"
...@@ -53,7 +53,8 @@ fill_rar(const module_id_t module_idP, ...@@ -53,7 +53,8 @@ fill_rar(const module_id_t module_idP,
RA_t * ra, RA_t * ra,
const frame_t frameP, const frame_t frameP,
uint8_t * const dlsch_buffer, uint8_t * const dlsch_buffer,
const uint16_t N_RB_UL, const uint8_t input_buffer_length) const uint16_t N_RB_UL, const uint8_t input_buffer_length,
uint8_t msg3_ra_flag)
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
{ {
...@@ -76,6 +77,7 @@ fill_rar(const module_id_t module_idP, ...@@ -76,6 +77,7 @@ fill_rar(const module_id_t module_idP,
rar[0] = (uint8_t) (ra->timing_offset >> 4); // 7 MSBs of timing advance rar[0] = (uint8_t) (ra->timing_offset >> 4); // 7 MSBs of timing advance
rar[1] = (uint8_t) (ra->timing_offset << 4) & 0xf0; // 4 LSBs of timing advance rar[1] = (uint8_t) (ra->timing_offset << 4) & 0xf0; // 4 LSBs of timing advance
COMMON_channels_t *cc = &RC.mac[module_idP]->common_channels[CC_id]; COMMON_channels_t *cc = &RC.mac[module_idP]->common_channels[CC_id];
if(msg3_ra_flag == 0){
if(N_RB_UL == 25){ if(N_RB_UL == 25){
ra->msg3_first_rb = 1; ra->msg3_first_rb = 1;
}else{ }else{
...@@ -85,10 +87,15 @@ fill_rar(const module_id_t module_idP, ...@@ -85,10 +87,15 @@ fill_rar(const module_id_t module_idP,
ra->msg3_first_rb = 2; ra->msg3_first_rb = 2;
} }
} }
if(cc->tdd_Config){ }else{
if(cc->tdd_Config->subframeAssignment==2){ LTE_DL_FRAME_PARMS *frame_parms ;
ra->msg3_first_rb+=1; frame_parms= &RC.eNB[module_idP][CC_id]->frame_parms;
} ra->msg3_first_rb = 6+get_prach_prb_offset(
frame_parms,
frame_parms->prach_config_common.prach_ConfigInfo.prach_ConfigIndex,
frame_parms->prach_config_common.prach_ConfigInfo.prach_FreqOffset,
0,//tdd_mapindex
frameP);
} }
ra->msg3_nb_rb = 3; ra->msg3_nb_rb = 3;
uint16_t rballoc = mac_computeRIV(N_RB_UL, ra->msg3_first_rb, ra->msg3_nb_rb); // first PRB only for UL Grant uint16_t rballoc = mac_computeRIV(N_RB_UL, ra->msg3_first_rb, ra->msg3_nb_rb); // first PRB only for UL Grant
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment