Commit ded2b0fd authored by zhenghuangkun's avatar zhenghuangkun

Merge remote-tracking branch 'remotes/origin/develop' into fujitsu_lte_contribution

parents 632bcce8 9deb41b6
......@@ -357,7 +357,7 @@ int wake_eNB_rxtx(PHY_VARS_eNB *eNB, uint16_t sfn, uint16_t sf) {
// lock the TX mutex and make sure the thread is ready
if (pthread_mutex_timedlock(&L1_proc->mutex,&wait) != 0) {
LOG_E( PHY, "[eNB] ERROR pthread_mutex_lock for eNB RXTX thread %d (IC %d)\n", L1_proc->subframe_rx&1,L1_proc->instance_cnt );
exit_fun( "error locking mutex_rxtx" );
//exit_fun( "error locking mutex_rxtx" );
return(-1);
}
static int busy_log_cnt=0;
......@@ -396,7 +396,7 @@ int wake_eNB_rxtx(PHY_VARS_eNB *eNB, uint16_t sfn, uint16_t sf) {
// the thread can now be woken up
if (pthread_cond_signal(&L1_proc->cond) != 0) {
LOG_E( PHY, "[eNB] ERROR pthread_cond_signal for eNB RXn-TXnp4 thread\n");
exit_fun( "ERROR pthread_cond_signal" );
//exit_fun( "ERROR pthread_cond_signal" );
return(-1);
}
......
......@@ -321,6 +321,7 @@ schedule_SR (module_id_t module_idP,
UE_info_t *UE_info = &eNB->UE_info;
nfapi_ul_config_request_t *ul_req = NULL;
nfapi_ul_config_request_body_t *ul_req_body = NULL;
LTE_PhysicalConfigDedicated_t *physicalConfigDedicated = NULL;
LTE_SchedulingRequestConfig_t *SRconfig = NULL;
nfapi_ul_config_sr_information sr;
......@@ -331,11 +332,11 @@ schedule_SR (module_id_t module_idP,
if (!UE_info->active[UE_id]) {
continue;
}
if (UE_info->UE_template[CC_id][UE_id].physicalConfigDedicated == NULL) continue;
if ((SRconfig = UE_info->UE_template[CC_id][UE_id].physicalConfigDedicated->schedulingRequestConfig) != NULL) {
if (SRconfig->present == LTE_SchedulingRequestConfig_PR_setup) {
physicalConfigDedicated = UE_info->UE_template[CC_id][UE_id].physicalConfigDedicated;
if (physicalConfigDedicated == NULL) continue;
SRconfig = UE_info->UE_template[CC_id][UE_id].physicalConfigDedicated->schedulingRequestConfig;
//if ((SRconfig = UE_info->UE_template[CC_id][UE_id].physicalConfigDedicated->schedulingRequestConfig) != NULL) {
if ((physicalConfigDedicated != NULL) && (SRconfig != NULL) && (SRconfig->present == LTE_SchedulingRequestConfig_PR_setup)) {
if (SRconfig->choice.setup.sr_ConfigIndex <= 4) { // 5 ms SR period
if ((subframeP % 5) != SRconfig->choice.setup.sr_ConfigIndex) continue;
} else if (SRconfig->choice.setup.sr_ConfigIndex <= 14) { // 10 ms SR period
......@@ -350,7 +351,11 @@ schedule_SR (module_id_t module_idP,
if ((subframeP % 2) != (SRconfig->choice.setup.sr_ConfigIndex - 155)) continue;
}
} // SRconfig->present == SchedulingRequestConfig_PR_setup)
} // SRconfig = UE_info->UE_template[CC_id][UE_id].physicalConfigDedicated->schedulingRequestConfig)!=NULL)
else{
LOG_E(MAC,"schedule_SR : frame %d subframe %d UE_id %d physicalConfigDedicated SRconfig %p\n",frameP,subframeP,UE_id,SRconfig);
continue;
}
//} // SRconfig = UE_list->UE_template[CC_id][UE_id].physicalConfigDedicated->schedulingRequestConfig)!=NULL)
/* If we get here there is some PUCCH1 reception to schedule for SR */
ul_req = &(eNB->UL_req[CC_id]);
......@@ -1158,7 +1163,7 @@ void update_ue_timers(module_id_t module_idP,frame_t frameP, sub_frame_t subfram
ue_context_p->ue_context.ue_rrc_inactivity_timer++;
}
if (ue_context_p->ue_context.ue_reestablishment_timer > 0) {
if ((ue_context_p->ue_context.ue_reestablishment_timer > 0) && (ue_context_p->ue_context.ue_reestablishment_timer_thres > 0)) {
ue_context_p->ue_context.ue_reestablishment_timer++;
}
......
......@@ -1122,6 +1122,7 @@ generate_Msg4(module_id_t module_idP,
dl_req_body->number_dci++;
dl_req_body->number_pdu++;
ra->state = WAITMSG4ACK;
ra->msg4_count = 1;
LOG_D(MAC,"[eNB %d][RAPROC] Frame %d, Subframe %d: state:WAITMSG4ACK\n", module_idP, frameP, subframeP);
// increment Absolute subframe by 8 for Msg4 retransmission
LOG_D(MAC,
......@@ -1352,6 +1353,11 @@ check_Msg4_retransmission(module_id_t module_idP, int CC_idP,
if ((ra->Msg4_frame == frameP)
&& (ra->Msg4_subframe == subframeP)) {
//ra->wait_ack_Msg4++;
if(ra->msg4_count > 4){
LOG_I(MAC, "Msg4 Retransmission count reach max, put UE %x into freeList\n", ra->rnti);
put_UE_in_freelist(module_idP, ra->rnti, 1);
return;
}
// we have to schedule a retransmission
dl_req->sfn_sf = frameP<<4 | subframeP;
first_rb = 0;
......@@ -1431,6 +1437,7 @@ check_Msg4_retransmission(module_id_t module_idP, int CC_idP,
dci_dl_pdu_rel8.cce_idx);
// prepare frame for retransmission
get_retransmission_timing(mac->common_channels[CC_idP].tdd_Config,&ra->Msg4_frame,&ra->Msg4_subframe);
ra->msg4_count++;
LOG_W(MAC,
"[eNB %d][RAPROC] CC_id %d Frame %d, subframeP %d: Msg4 not acknowledged, adding ue specific dci (rnti %x) for RA (Msg4 Retransmission round %d in %d.%d)\n",
module_idP, CC_idP, frameP, subframeP, ra->rnti,
......@@ -1672,6 +1679,7 @@ cancel_ra_proc(module_id_t module_idP, int CC_id, frame_t frameP,
ra[i].RRC_timer = 20;
ra[i].rnti = 0;
ra[i].msg3_round = 0;
ra[i].msg4_count = 0;
LOG_D(MAC,"[eNB %d][RAPROC] CC_id %d Frame %d Canceled RA procedure for UE rnti %x\n", module_idP, CC_id, frameP, rnti);
}
}
......@@ -1688,5 +1696,6 @@ void clear_ra_proc(module_id_t module_idP, int CC_id, frame_t frameP) {
ra[i].RRC_timer = 20;
ra[i].rnti = 0;
ra[i].msg3_round = 0;
ra[i].msg4_count = 0;
}
}
......@@ -759,13 +759,16 @@ rx_sdu(const module_id_t enb_mod_idP,
UE_template_ptr = &UE_info->UE_template[CC_idP][UE_id];
}
} else {
LOG_D(MAC, "[eNB %d][RAPROC] CC_id %d Frame %d CCCH: Received Msg3 from already registered UE %d: length %d, offset %ld\n",
LOG_E(MAC, "[eNB %d][RAPROC] CC_id %d Frame %d CCCH: Received Msg3 from already registered UE %d: length %d, offset %ld\n",
enb_mod_idP,
CC_idP,
frameP,
UE_id,
rx_lengths[i],
payload_ptr - sduP);
cancel_ra_proc(enb_mod_idP, CC_idP, frameP, current_rnti);
fill_nfapi_rnti_release(enb_mod_idP, current_rnti);
break;
// kill RA proc
}
......
......@@ -1161,6 +1161,7 @@ typedef struct {
int msg4_TBsize;
/// MCS used for Msg4
int msg4_mcs;
uint8_t msg4_count;
uint8_t rach_resource_type;
uint8_t msg2_mpdcch_repetition_cnt;
int msg2_mpdcch_done;
......
......@@ -862,7 +862,9 @@ rrc_eNB_free_mem_UE_context(
memset(ue_context_pP->ue_context.DRB_active, 0, sizeof(ue_context_pP->ue_context.DRB_active));
if (ue_context_pP->ue_context.physicalConfigDedicated) {
ASN_STRUCT_FREE(asn_DEF_LTE_PhysicalConfigDedicated, ue_context_pP->ue_context.physicalConfigDedicated);
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_LTE_PhysicalConfigDedicated, ue_context_pP->ue_context.physicalConfigDedicated);
memset(ue_context_pP->ue_context.physicalConfigDedicated,0,sizeof(struct LTE_PhysicalConfigDedicated));
free(ue_context_pP->ue_context.physicalConfigDedicated);
ue_context_pP->ue_context.physicalConfigDedicated = NULL;
}
......@@ -2317,7 +2319,7 @@ rrc_eNB_generate_RRCConnectionRelease(
#endif
size = do_RRCConnectionRelease(ctxt_pP->module_id, buffer,rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id));
ue_context_pP->ue_context.ue_reestablishment_timer = 0;
//ue_context_pP->ue_context.ue_reestablishment_timer = 0;
ue_context_pP->ue_context.ue_release_timer = 0;
ue_context_pP->ue_context.ue_rrc_inactivity_timer = 0;
LOG_I(RRC,
......@@ -7894,7 +7896,7 @@ rrc_eNB_decode_ccch(
LOG_E(RRC,
PROTOCOL_RRC_CTXT_UE_FMT" LTE_RRCConnectionReestablishmentRequest without UE context, let's reject the UE\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP));
rrc_eNB_generate_RRCConnectionReestablishmentReject(ctxt_pP, ue_context_p, CC_id);
rrc_eNB_generate_RRCConnectionReestablishmentReject(ctxt_pP, NULL, CC_id);
break;
}
......@@ -7905,8 +7907,7 @@ rrc_eNB_decode_ccch(
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
rrcConnectionReestablishmentRequest->ue_Identity.physCellId,
RC.rrc[ctxt_pP->module_id]->carrier[CC_id].physCellId);
rrc_eNB_generate_RRCConnectionReestablishmentReject_unknown_UE(ctxt_pP,
CC_id);
rrc_eNB_generate_RRCConnectionReestablishmentReject(ctxt_pP, NULL, CC_id);
break;
}
......@@ -7923,21 +7924,7 @@ rrc_eNB_decode_ccch(
LOG_E(RRC,
PROTOCOL_RRC_CTXT_UE_FMT" LTE_RRCConnectionReestablishmentRequest c_RNTI range error, let's reject the UE\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP));
rrc_eNB_generate_RRCConnectionReestablishmentReject_unknown_UE(ctxt_pP,
CC_id);
break;
}
c_rnti = BIT_STRING_to_uint16(&rrcConnectionReestablishmentRequest->ue_Identity.c_RNTI);
LOG_D(RRC, "c_rnti is %x\n", c_rnti);
ue_context_p = rrc_eNB_get_ue_context(RC.rrc[ctxt_pP->module_id], c_rnti);
if (ue_context_p == NULL) {
LOG_E(RRC,
PROTOCOL_RRC_CTXT_UE_FMT" LTE_RRCConnectionReestablishmentRequest without UE context, let's reject the UE\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP));
rrc_eNB_generate_RRCConnectionReestablishmentReject_unknown_UE(ctxt_pP,
CC_id);
rrc_eNB_generate_RRCConnectionReestablishmentReject(ctxt_pP, NULL, CC_id);
break;
}
......@@ -7947,7 +7934,7 @@ rrc_eNB_decode_ccch(
LOG_E(RRC,
PROTOCOL_RRC_CTXT_UE_FMT" LTE_RRCConnectionReestablishmentRequest without UE_id(MAC) rnti %x, let's reject the UE\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),c_rnti);
rrc_eNB_generate_RRCConnectionReestablishmentReject(ctxt_pP, ue_context_p, CC_id);
rrc_eNB_generate_RRCConnectionReestablishmentReject(ctxt_pP, NULL, CC_id);
break;
}
......@@ -7978,7 +7965,7 @@ rrc_eNB_decode_ccch(
LOG_E(RRC,
PROTOCOL_RRC_CTXT_UE_FMT" RRCConnectionReestablishmentRequest without UE_id(MAC) previous rnti %x, let's reject the UE\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),previous_rnti);
rrc_eNB_generate_RRCConnectionReestablishmentReject(ctxt_pP, ue_context_p, CC_id);
rrc_eNB_generate_RRCConnectionReestablishmentReject(ctxt_pP, NULL, CC_id);
break;
}
......@@ -7998,11 +7985,12 @@ rrc_eNB_decode_ccch(
LOG_E(RRC,
PROTOCOL_RRC_CTXT_UE_FMT" LTE_RRCConnectionReestablishmentRequest (UE %x c-plane is not end), let's reject the UE\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),c_rnti);
rrc_eNB_generate_RRCConnectionReestablishmentReject(ctxt_pP, ue_context_p, CC_id);
rrc_eNB_generate_RRCConnectionReestablishmentReject(ctxt_pP, NULL, CC_id);
break;
}
if(ue_context_p->ue_context.ue_reestablishment_timer > 0) {
if(ue_context_p->ue_context.ue_reestablishment_timer < 960){
LOG_E(RRC,
PROTOCOL_RRC_CTXT_UE_FMT" RRRCConnectionReconfigurationComplete(Previous) don't receive, delete the Previous UE,\nprevious Status %d, new Status RRC_RECONFIGURED\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
......@@ -8027,6 +8015,13 @@ rrc_eNB_decode_ccch(
ue_context_p->ue_context.e_rab[e_rab].status = E_RAB_STATUS_FAILED;
}
}
}else{
LOG_E(RRC,
PROTOCOL_RRC_CTXT_UE_FMT" RRRCConnectionReconfigurationComplete(Previous) will wait timeout, let's reject the UE\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP));
rrc_eNB_generate_RRCConnectionReestablishmentReject(ctxt_pP, NULL, CC_id);
break;
}
}
LOG_D(RRC,
......@@ -8297,11 +8292,12 @@ rrc_eNB_decode_ccch(
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
random_value);
if (NODE_IS_MONOLITHIC(RC.rrc[ctxt_pP->module_id]->node_type)) {
if (rrc_mac_remove_ue(ctxt_pP->module_id,ctxt_pP->rnti) == -1) {
LOG_E(RRC, "rrc_mac_remove_ue failed\n");
ASN_STRUCT_FREE(asn_DEF_LTE_UL_CCCH_Message,ul_ccch_msg);
return -1;
}
//if (rrc_mac_remove_ue(ctxt_pP->module_id,ctxt_pP->rnti) == -1) {
// LOG_E(RRC, "rrc_mac_remove_ue failed\n");
// ASN_STRUCT_FREE(asn_DEF_LTE_UL_CCCH_Message,ul_ccch_msg);
// return -1;
//}
put_UE_in_freelist(ctxt_pP->module_id,ctxt_pP->rnti,0);
}
else if (NODE_IS_CU(RC.rrc[ctxt_pP->module_id]->node_type)) {
MessageDef *m = itti_alloc_new_message(TASK_RRC_ENB, F1AP_UE_CONTEXT_RELEASE_CMD);
......@@ -9770,13 +9766,14 @@ void rrc_subframe_process(protocol_ctxt_t *const ctxt_pP, const int CC_id) {
}
}
if (ue_context_p->ue_context.ue_reestablishment_timer > 0) {
if ((ue_context_p->ue_context.ue_reestablishment_timer > 0)&&(ue_context_p->ue_context.ue_reestablishment_timer_thres > 0)) {
if (ue_context_p->ue_context.ue_reestablishment_timer >= ue_context_p->ue_context.ue_reestablishment_timer_thres) {
LOG_I(RRC, "Removing UE %x instance because of reestablishment_timer timeout\n",
ue_context_p->ue_context.rnti);
ue_context_p->ue_context.ul_failure_timer = 20000; // lead to send S1 UE_CONTEXT_RELEASE_REQ
removed_ue_count = add_ue_to_remove(ue_to_be_removed, removed_ue_count, ue_context_p);
ue_context_p->ue_context.ue_reestablishment_timer = 0;
//ue_context_p->ue_context.ue_reestablishment_timer = 0;
ue_context_p->ue_context.ue_reestablishment_timer_thres = 0;
break; // break RB_FOREACH
}
}
......@@ -9804,7 +9801,7 @@ void rrc_subframe_process(protocol_ctxt_t *const ctxt_pP, const int CC_id) {
ue_to_be_removed[cur_ue]->ue_context.ue_release_timer_s1 = 1;
ue_to_be_removed[cur_ue]->ue_context.ue_release_timer_thres_s1 = 100;
ue_to_be_removed[cur_ue]->ue_context.ue_release_timer = 0;
ue_to_be_removed[cur_ue]->ue_context.ue_reestablishment_timer = 0;
//ue_to_be_removed[cur_ue]->ue_context.ue_reestablishment_timer = 0;
}
rrc_eNB_free_UE(ctxt_pP->module_id, ue_to_be_removed[cur_ue]);
......
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