Commit 256c5ab0 authored by Cedric Roux's avatar Cedric Roux

improve crnti reception (still not correct, we need to reconfigure the UE)

TODO: if the UE did random access (followed by a MAC uplink with
CRNTI) because none of its scheduling request was granted, then
according to 36.321 5.4.4 the UE's MAC will notify RRC to release
PUCCH/SRS. According to 36.331 5.3.13 the UE will then apply
default configuration for CQI reporting and scheduling requests,
which basically means that the CQI requests won't work anymore and
that the UE won't do any scheduling request anymore as long as the
eNB doesn't reconfigure the UE.
We have to take care of this. As the code is, nothing is done and
the UE state in the eNB is wrong.
parent 599ba826
...@@ -73,10 +73,11 @@ void rx_sdu(const module_id_t enb_mod_idP, ...@@ -73,10 +73,11 @@ void rx_sdu(const module_id_t enb_mod_idP,
const uint16_t timing_advance, const uint16_t timing_advance,
const uint8_t ul_cqi) const uint8_t ul_cqi)
{ {
int current_rnti = rntiP;
unsigned char rx_ces[MAX_NUM_CE],num_ce,num_sdu,i,*payload_ptr; unsigned char rx_ces[MAX_NUM_CE],num_ce,num_sdu,i,*payload_ptr;
unsigned char rx_lcids[NB_RB_MAX]; unsigned char rx_lcids[NB_RB_MAX];
unsigned short rx_lengths[NB_RB_MAX]; unsigned short rx_lengths[NB_RB_MAX];
int UE_id = find_UE_id(enb_mod_idP,rntiP); int UE_id = find_UE_id(enb_mod_idP, current_rnti);
int RA_id; int RA_id;
int ii,j; int ii,j;
eNB_MAC_INST *eNB = RC.mac[enb_mod_idP]; eNB_MAC_INST *eNB = RC.mac[enb_mod_idP];
...@@ -97,14 +98,14 @@ void rx_sdu(const module_id_t enb_mod_idP, ...@@ -97,14 +98,14 @@ void rx_sdu(const module_id_t enb_mod_idP,
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RX_SDU,1); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RX_SDU,1);
if (opt_enabled == 1) { if (opt_enabled == 1) {
trace_pdu(0, sduP,sdu_lenP, 0, 3, rntiP, frameP, subframeP, 0,0); trace_pdu(0, sduP,sdu_lenP, 0, 3, current_rnti, frameP, subframeP, 0,0);
LOG_D(OPT,"[eNB %d][ULSCH] Frame %d rnti %x with size %d\n", LOG_D(OPT,"[eNB %d][ULSCH] Frame %d rnti %x with size %d\n",
enb_mod_idP, frameP, rntiP, sdu_lenP); enb_mod_idP, frameP, current_rnti, sdu_lenP);
} }
if (UE_id!=-1) { if (UE_id!=-1) {
LOG_D(MAC,"[eNB %d][PUSCH %d] CC_id %d Received ULSCH sdu round %d from PHY (rnti %x, UE_id %d) ul_cqi %d\n",enb_mod_idP,harq_pid,CC_idP, UE_list->UE_sched_ctrl[UE_id].round_UL[CC_idP][harq_pid], LOG_D(MAC,"[eNB %d][PUSCH %d] CC_id %d Received ULSCH sdu round %d from PHY (rnti %x, UE_id %d) ul_cqi %d\n",enb_mod_idP,harq_pid,CC_idP, UE_list->UE_sched_ctrl[UE_id].round_UL[CC_idP][harq_pid],
rntiP,UE_id,ul_cqi); current_rnti, UE_id,ul_cqi);
AssertFatal(UE_list->UE_sched_ctrl[UE_id].round_UL[CC_idP][harq_pid] < 8, AssertFatal(UE_list->UE_sched_ctrl[UE_id].round_UL[CC_idP][harq_pid] < 8,
"round >= 8\n"); "round >= 8\n");
...@@ -140,14 +141,14 @@ void rx_sdu(const module_id_t enb_mod_idP, ...@@ -140,14 +141,14 @@ void rx_sdu(const module_id_t enb_mod_idP,
} }
} }
else if ((RA_id = find_RA_id(enb_mod_idP,CC_idP,rntiP))!=-1) { // Check if this is an RA process for the rnti else if ((RA_id = find_RA_id(enb_mod_idP,CC_idP,current_rnti))!=-1) { // Check if this is an RA process for the rnti
AssertFatal(eNB->common_channels[CC_idP].radioResourceConfigCommon->rach_ConfigCommon.maxHARQ_Msg3Tx>1, AssertFatal(eNB->common_channels[CC_idP].radioResourceConfigCommon->rach_ConfigCommon.maxHARQ_Msg3Tx>1,
"maxHARQ %d should be greater than 1\n", "maxHARQ %d should be greater than 1\n",
(int)eNB->common_channels[CC_idP].radioResourceConfigCommon->rach_ConfigCommon.maxHARQ_Msg3Tx); (int)eNB->common_channels[CC_idP].radioResourceConfigCommon->rach_ConfigCommon.maxHARQ_Msg3Tx);
LOG_D(MAC,"[eNB %d][PUSCH %d] CC_id %d Received ULSCH sdu round %d from PHY (rnti %x, RA_id %d) ul_cqi %d\n",enb_mod_idP,harq_pid,CC_idP, LOG_D(MAC,"[eNB %d][PUSCH %d] CC_id %d Received ULSCH sdu round %d from PHY (rnti %x, RA_id %d) ul_cqi %d\n",enb_mod_idP,harq_pid,CC_idP,
RA_template[RA_id].msg3_round, RA_template[RA_id].msg3_round,
rntiP,RA_id,ul_cqi); current_rnti,RA_id,ul_cqi);
first_rb = RA_template->msg3_first_rb; first_rb = RA_template->msg3_first_rb;
...@@ -156,7 +157,7 @@ void rx_sdu(const module_id_t enb_mod_idP, ...@@ -156,7 +157,7 @@ void rx_sdu(const module_id_t enb_mod_idP,
RA_template[RA_id].msg3_round, RA_template[RA_id].msg3_round,
(int)eNB->common_channels[CC_idP].radioResourceConfigCommon->rach_ConfigCommon.maxHARQ_Msg3Tx); (int)eNB->common_channels[CC_idP].radioResourceConfigCommon->rach_ConfigCommon.maxHARQ_Msg3Tx);
if (RA_template[RA_id].msg3_round == eNB->common_channels[CC_idP].radioResourceConfigCommon->rach_ConfigCommon.maxHARQ_Msg3Tx-1) { if (RA_template[RA_id].msg3_round == eNB->common_channels[CC_idP].radioResourceConfigCommon->rach_ConfigCommon.maxHARQ_Msg3Tx-1) {
cancel_ra_proc(enb_mod_idP,CC_idP,frameP,rntiP); cancel_ra_proc(enb_mod_idP,CC_idP,frameP,current_rnti);
} }
else { else {
...@@ -171,15 +172,14 @@ void rx_sdu(const module_id_t enb_mod_idP, ...@@ -171,15 +172,14 @@ void rx_sdu(const module_id_t enb_mod_idP,
} }
} }
else { else {
LOG_W(MAC,"Cannot find UE or RA corresponding to ULSCH rnti %x, dropping it\n", LOG_W(MAC,"Cannot find UE or RA corresponding to ULSCH rnti %x, dropping it\n", current_rnti);
rntiP);
return; return;
} }
payload_ptr = parse_ulsch_header(sduP,&num_ce,&num_sdu,rx_ces,rx_lcids,rx_lengths,sdu_lenP); payload_ptr = parse_ulsch_header(sduP,&num_ce,&num_sdu,rx_ces,rx_lcids,rx_lengths,sdu_lenP);
T(T_ENB_MAC_UE_UL_PDU, T_INT(enb_mod_idP), T_INT(CC_idP), T_INT(rntiP), T_INT(frameP), T_INT(subframeP), T(T_ENB_MAC_UE_UL_PDU, T_INT(enb_mod_idP), T_INT(CC_idP), T_INT(current_rnti), T_INT(frameP), T_INT(subframeP),
T_INT(harq_pid), T_INT(sdu_lenP), T_INT(num_ce), T_INT(num_sdu)); T_INT(harq_pid), T_INT(sdu_lenP), T_INT(num_ce), T_INT(num_sdu));
T(T_ENB_MAC_UE_UL_PDU_WITH_DATA, T_INT(enb_mod_idP), T_INT(CC_idP), T_INT(rntiP), T_INT(frameP), T_INT(subframeP), T(T_ENB_MAC_UE_UL_PDU_WITH_DATA, T_INT(enb_mod_idP), T_INT(CC_idP), T_INT(current_rnti), T_INT(frameP), T_INT(subframeP),
T_INT(harq_pid), T_INT(sdu_lenP), T_INT(num_ce), T_INT(num_sdu), T_BUFFER(sduP, sdu_lenP)); T_INT(harq_pid), T_INT(sdu_lenP), T_INT(num_ce), T_INT(num_sdu), T_BUFFER(sduP, sdu_lenP));
eNB->eNB_stats[CC_idP].ulsch_bytes_rx=sdu_lenP; eNB->eNB_stats[CC_idP].ulsch_bytes_rx=sdu_lenP;
...@@ -191,7 +191,7 @@ void rx_sdu(const module_id_t enb_mod_idP, ...@@ -191,7 +191,7 @@ void rx_sdu(const module_id_t enb_mod_idP,
// control element // control element
for (i=0; i<num_ce; i++) { for (i=0; i<num_ce; i++) {
T(T_ENB_MAC_UE_UL_CE, T_INT(enb_mod_idP), T_INT(CC_idP), T_INT(rntiP), T_INT(frameP), T_INT(subframeP), T(T_ENB_MAC_UE_UL_CE, T_INT(enb_mod_idP), T_INT(CC_idP), T_INT(current_rnti), T_INT(frameP), T_INT(subframeP),
T_INT(rx_ces[i])); T_INT(rx_ces[i]));
switch (rx_ces[i]) { // implement and process BSR + CRNTI + switch (rx_ces[i]) { // implement and process BSR + CRNTI +
...@@ -206,28 +206,38 @@ void rx_sdu(const module_id_t enb_mod_idP, ...@@ -206,28 +206,38 @@ void rx_sdu(const module_id_t enb_mod_idP,
payload_ptr+=sizeof(POWER_HEADROOM_CMD); payload_ptr+=sizeof(POWER_HEADROOM_CMD);
break; break;
case CRNTI: case CRNTI: {
UE_id = find_UE_id(enb_mod_idP,(((uint16_t)payload_ptr[0])<<8) + payload_ptr[1]); int old_rnti = (((uint16_t)payload_ptr[0])<<8) + payload_ptr[1];
int old_UE_id = find_UE_id(enb_mod_idP, old_rnti);
LOG_D(MAC, "[eNB %d] Frame %d, Subframe %d CC_id %d MAC CE_LCID %d (ce %d/%d): CRNTI %x (UE_id %d) in Msg3\n", LOG_D(MAC, "[eNB %d] Frame %d, Subframe %d CC_id %d MAC CE_LCID %d (ce %d/%d): CRNTI %x (UE_id %d) in Msg3\n",
frameP,subframeP,enb_mod_idP, CC_idP, rx_ces[i], i,num_ce,(((uint16_t)payload_ptr[0])<<8) + payload_ptr[1],UE_id); enb_mod_idP, frameP, subframeP, CC_idP, rx_ces[i], i, num_ce, old_rnti, old_UE_id);
if (UE_id!=-1) { if (old_UE_id != -1) {
UE_list->UE_sched_ctrl[UE_id].ul_inactivity_timer=0; /* TODO: if the UE did random access (followed by a MAC uplink with
UE_list->UE_sched_ctrl[UE_id].ul_failure_timer=0; * CRNTI) because none of its scheduling request was granted, then
if (UE_list->UE_sched_ctrl[UE_id].ul_out_of_sync > 0) { * according to 36.321 5.4.4 the UE's MAC will notify RRC to release
UE_list->UE_sched_ctrl[UE_id].ul_out_of_sync=0; * PUCCH/SRS. According to 36.331 5.3.13 the UE will then apply
mac_eNB_rrc_ul_in_sync(enb_mod_idP,CC_idP,frameP,subframeP,(((uint16_t)payload_ptr[0])<<8) + payload_ptr[1]); * default configuration for CQI reporting and scheduling requests,
} * which basically means that the CQI requests won't work anymore and
printf("TODO: deal with CRNTI\n"); * that the UE won't do any scheduling request anymore as long as the
abort(); * eNB doesn't reconfigure the UE.
* We have to take care of this. As the code is, nothing is done and
* the UE state in the eNB is wrong.
*/
UE_id = old_UE_id;
UE_list->UE_sched_ctrl[UE_id].ul_inactivity_timer = 0;
UE_list->UE_sched_ctrl[UE_id].ul_failure_timer = 0;
if (UE_list->UE_sched_ctrl[UE_id].ul_out_of_sync > 0) {
UE_list->UE_sched_ctrl[UE_id].ul_out_of_sync = 0;
mac_eNB_rrc_ul_in_sync(enb_mod_idP, CC_idP, frameP, subframeP, old_rnti);
}
/* receiving CRNTI means that the current rnti has to go away */
cancel_ra_proc(enb_mod_idP,CC_idP,frameP,current_rnti);
current_rnti = old_rnti;
} }
crnti_rx=1; crnti_rx=1;
payload_ptr+=2; payload_ptr+=2;
/*
if (msg3_flagP != NULL) {
*msg3_flagP = 0;
}*/
break; break;
}
case TRUNCATED_BSR: case TRUNCATED_BSR:
case SHORT_BSR: { case SHORT_BSR: {
...@@ -367,9 +377,9 @@ abort(); ...@@ -367,9 +377,9 @@ abort();
for (i=0; i<num_sdu; i++) { for (i=0; i<num_sdu; i++) {
LOG_D(MAC,"SDU Number %d MAC Subheader SDU_LCID %d, length %d\n",i,rx_lcids[i],rx_lengths[i]); LOG_D(MAC,"SDU Number %d MAC Subheader SDU_LCID %d, length %d\n",i,rx_lcids[i],rx_lengths[i]);
T(T_ENB_MAC_UE_UL_SDU, T_INT(enb_mod_idP), T_INT(CC_idP), T_INT(rntiP), T_INT(frameP), T_INT(subframeP), T(T_ENB_MAC_UE_UL_SDU, T_INT(enb_mod_idP), T_INT(CC_idP), T_INT(current_rnti), T_INT(frameP), T_INT(subframeP),
T_INT(rx_lcids[i]), T_INT(rx_lengths[i])); T_INT(rx_lcids[i]), T_INT(rx_lengths[i]));
T(T_ENB_MAC_UE_UL_SDU_WITH_DATA, T_INT(enb_mod_idP), T_INT(CC_idP), T_INT(rntiP), T_INT(frameP), T_INT(subframeP), T(T_ENB_MAC_UE_UL_SDU_WITH_DATA, T_INT(enb_mod_idP), T_INT(CC_idP), T_INT(current_rnti), T_INT(frameP), T_INT(subframeP),
T_INT(rx_lcids[i]), T_INT(rx_lengths[i]), T_BUFFER(payload_ptr, rx_lengths[i])); T_INT(rx_lcids[i]), T_INT(rx_lengths[i]), T_BUFFER(payload_ptr, rx_lengths[i]));
switch (rx_lcids[i]) { switch (rx_lcids[i]) {
...@@ -381,7 +391,7 @@ abort(); ...@@ -381,7 +391,7 @@ abort();
} }
LOG_D(MAC,"[eNB %d][RAPROC] CC_id %d Frame %d, Received CCCH: %x.%x.%x.%x.%x.%x, Terminating RA procedure for UE rnti %x\n", LOG_D(MAC,"[eNB %d][RAPROC] CC_id %d Frame %d, Received CCCH: %x.%x.%x.%x.%x.%x, Terminating RA procedure for UE rnti %x\n",
enb_mod_idP,CC_idP,frameP, enb_mod_idP,CC_idP,frameP,
payload_ptr[0],payload_ptr[1],payload_ptr[2],payload_ptr[3],payload_ptr[4], payload_ptr[5], rntiP); payload_ptr[0],payload_ptr[1],payload_ptr[2],payload_ptr[3],payload_ptr[4], payload_ptr[5], current_rnti);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_TERMINATE_RA_PROC,1); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_TERMINATE_RA_PROC,1);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_TERMINATE_RA_PROC,0); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_TERMINATE_RA_PROC,0);
for (ii=0; ii<NB_RA_PROC_MAX; ii++) { for (ii=0; ii<NB_RA_PROC_MAX; ii++) {
...@@ -389,10 +399,10 @@ abort(); ...@@ -389,10 +399,10 @@ abort();
LOG_D(MAC,"[eNB %d][RAPROC] CC_id %d Checking proc %d : rnti (%x, %x), active %d\n", LOG_D(MAC,"[eNB %d][RAPROC] CC_id %d Checking proc %d : rnti (%x, %x), active %d\n",
enb_mod_idP, CC_idP, ii, enb_mod_idP, CC_idP, ii,
RA_template->rnti, rntiP, RA_template->rnti, current_rnti,
RA_template->RA_active); RA_template->RA_active);
if ((RA_template->rnti==rntiP) && if ((RA_template->rnti==current_rnti) &&
(RA_template->RA_active==TRUE)) { (RA_template->RA_active==TRUE)) {
//payload_ptr = parse_ulsch_header(msg3,&num_ce,&num_sdu,rx_ces,rx_lcids,rx_lengths,msg3_len); //payload_ptr = parse_ulsch_header(msg3,&num_ce,&num_sdu,rx_ces,rx_lcids,rx_lengths,msg3_len);
...@@ -422,7 +432,7 @@ abort(); ...@@ -422,7 +432,7 @@ abort();
enb_mod_idP, enb_mod_idP,
CC_idP, CC_idP,
frameP,subframeP, frameP,subframeP,
rntiP, current_rnti,
CCCH, CCCH,
(uint8_t*)payload_ptr, (uint8_t*)payload_ptr,
rx_lengths[i], rx_lengths[i],
...@@ -476,7 +486,7 @@ abort(); ...@@ -476,7 +486,7 @@ abort();
mac_rlc_data_ind( mac_rlc_data_ind(
enb_mod_idP, enb_mod_idP,
rntiP, current_rnti,
enb_mod_idP, enb_mod_idP,
frameP, frameP,
ENB_FLAG_YES, ENB_FLAG_YES,
...@@ -525,7 +535,7 @@ abort(); ...@@ -525,7 +535,7 @@ abort();
if ((rx_lengths[i] <SCH_PAYLOAD_SIZE_MAX) && (rx_lengths[i] > 0) ) { // MAX SIZE OF transport block if ((rx_lengths[i] <SCH_PAYLOAD_SIZE_MAX) && (rx_lengths[i] > 0) ) { // MAX SIZE OF transport block
mac_rlc_data_ind( mac_rlc_data_ind(
enb_mod_idP, enb_mod_idP,
rntiP, current_rnti,
enb_mod_idP, enb_mod_idP,
frameP, frameP,
ENB_FLAG_YES, ENB_FLAG_YES,
...@@ -558,7 +568,7 @@ abort(); ...@@ -558,7 +568,7 @@ abort();
} }
// Program ACK for PHICH // Program ACK for PHICH
LOG_D(MAC,"Programming PHICH ACK for rnti %x harq_pid %d (first_rb %d)\n",rntiP,harq_pid,first_rb); LOG_D(MAC,"Programming PHICH ACK for rnti %x harq_pid %d (first_rb %d)\n",current_rnti,harq_pid,first_rb);
nfapi_hi_dci0_request_body_t *hi_dci0_req = &eNB->HI_DCI0_req[CC_idP].hi_dci0_request_body; nfapi_hi_dci0_request_body_t *hi_dci0_req = &eNB->HI_DCI0_req[CC_idP].hi_dci0_request_body;
nfapi_hi_dci0_request_pdu_t *hi_dci0_pdu = &hi_dci0_req->hi_dci0_pdu_list[hi_dci0_req->number_of_dci+hi_dci0_req->number_of_hi]; nfapi_hi_dci0_request_pdu_t *hi_dci0_pdu = &hi_dci0_req->hi_dci0_pdu_list[hi_dci0_req->number_of_dci+hi_dci0_req->number_of_hi];
memset((void*)hi_dci0_pdu,0,sizeof(nfapi_hi_dci0_request_pdu_t)); memset((void*)hi_dci0_pdu,0,sizeof(nfapi_hi_dci0_request_pdu_t));
......
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