Commit 7807e677 authored by Wu Jing's avatar Wu Jing

fix RM902 base on sp3_master

parent 11d9a286
......@@ -191,7 +191,6 @@ struct mac_status_resp {
uint32_t head_sdu_remaining_size_to_send;
unsigned char head_sdu_is_segmented;
struct rlc_entity_info rlc_info; /*!< xxx*/
mui_t rrc_mui;
};
struct mac_tb_ind {
......
......@@ -1413,6 +1413,12 @@ typedef struct {
uint16_t num_UEs;
RRC_release_ctrl RRC_release_ctrl[NUMBER_OF_UE_MAX];
} RRC_release_list_t;
typedef struct {
uint8_t rrc_mui_num;
mui_t rrc_mui[128];
}mac_rlc_am_muilist_t;
#include "proto.h"
/*@}*/
#endif /*__LAYER2_MAC_DEFS_H__ */
......@@ -988,22 +988,36 @@ schedule_ue_spec(module_id_t module_idP,
&dlsch_buffer
[0]);
pthread_mutex_lock(&rrc_release_freelist);
if(rrc_release_info.num_UEs > 0){
if((rrc_release_info.num_UEs > 0) && (rlc_am_mui.rrc_mui_num > 0)){
uint16_t release_total = 0;
for(uint16_t release_num = 0;release_num < NUMBER_OF_UE_MAX;release_num++){
if(rrc_release_info.RRC_release_ctrl[release_num].flag > 0){
release_total++;
}else{
continue;
}
if(rrc_release_info.RRC_release_ctrl[release_num].flag == 1){
release_total++;
if( (rrc_release_info.RRC_release_ctrl[release_num].rnti == rnti) &&
(rrc_release_info.RRC_release_ctrl[release_num].rrc_eNB_mui == rlc_status.rrc_mui)){
rrc_release_info.RRC_release_ctrl[release_num].flag = 3;
if(rrc_release_info.RRC_release_ctrl[release_num].rnti == rnti){
for(uint16_t mui_num = 0;mui_num < rlc_am_mui.rrc_mui_num;mui_num++){
if(rrc_release_info.RRC_release_ctrl[release_num].rrc_eNB_mui == rlc_am_mui.rrc_mui[mui_num]){
rrc_release_info.RRC_release_ctrl[release_num].flag = 3;
LOG_D(MAC,"DLSCH Release send:index %d rnti %x mui %d mui_num %d flag 1->3\n",release_num,rnti,rlc_am_mui.rrc_mui[mui_num],mui_num);
break;
}
}
}
}
if(rrc_release_info.RRC_release_ctrl[release_num].flag == 2){
release_total++;
if( (rrc_release_info.RRC_release_ctrl[release_num].rnti == rnti) &&
(rrc_release_info.RRC_release_ctrl[release_num].rrc_eNB_mui == rlc_status.rrc_mui)){
rrc_release_info.RRC_release_ctrl[release_num].flag = 4;
if(rrc_release_info.RRC_release_ctrl[release_num].rnti == rnti){
for(uint16_t mui_num = 0;mui_num < rlc_am_mui.rrc_mui_num;mui_num++){
if(rrc_release_info.RRC_release_ctrl[release_num].rrc_eNB_mui == rlc_am_mui.rrc_mui[mui_num]){
rrc_release_info.RRC_release_ctrl[release_num].flag = 4;
LOG_D(MAC,"DLSCH Release send:index %d rnti %x mui %d mui_num %d flag 2->4\n",release_num,rnti,rlc_am_mui.rrc_mui[mui_num],mui_num);
break;
}
}
}
}
if(release_total >= rrc_release_info.num_UEs)
break;
......@@ -1013,21 +1027,24 @@ schedule_ue_spec(module_id_t module_idP,
RA_t *ra = &eNB->common_channels[CC_id].ra[0];
for (uint8_t ra_ii = 0; ra_ii < NB_RA_PROC_MAX; ra_ii++) {
if((ra[ra_ii].rnti == rnti) && (ra[ra_ii].state == MSGCRNTI) &&
(ra[ra_ii].crnti_rrc_mui == rlc_status.rrc_mui)){
ra[ra_ii].crnti_harq_pid = harq_pid;
ra[ra_ii].state = MSGCRNTI_ACK;
break;
if((ra[ra_ii].rnti == rnti) && (ra[ra_ii].state == MSGCRNTI)){
for(uint16_t mui_num = 0;mui_num < rlc_am_mui.rrc_mui_num;mui_num++){
if(ra[ra_ii].crnti_rrc_mui == rlc_am_mui.rrc_mui[mui_num]){
ra[ra_ii].crnti_harq_pid = harq_pid;
ra[ra_ii].state = MSGCRNTI_ACK;
break;
}
}
}
}
T(T_ENB_MAC_UE_DL_SDU, T_INT(module_idP),
T_INT(CC_id), T_INT(rnti), T_INT(frameP),
T_INT(subframeP), T_INT(harq_pid), T_INT(DCCH),
T_INT(sdu_lengths[0]));
LOG_D(MAC,
"[eNB %d][DCCH] CC_id %d Got %d bytes from RLC\n",
module_idP, CC_id, sdu_lengths[0]);
LOG_D(MAC,
"[eNB %d][DCCH] CC_id %d frame %d subframe %d UE_id %d/%x Got %d bytes bytes_in_buffer %d from release_num %d\n",
module_idP, CC_id, frameP, subframeP, UE_id, rnti, sdu_lengths[0],rlc_status.bytes_in_buffer,rrc_release_info.num_UEs);
sdu_length_total = sdu_lengths[0];
sdu_lcids[0] = DCCH;
UE_list->eNB_UE_stats[CC_id][UE_id].
......
......@@ -2277,6 +2277,27 @@ int rrc_mac_remove_ue(module_id_t mod_idP, rnti_t rntiP)
cancel_ra_proc(mod_idP, pCC_id, 0, rntiP);
}
pthread_mutex_lock(&rrc_release_freelist);
if(rrc_release_info.num_UEs > 0){
uint16_t release_total = 0;
for(uint16_t release_num = 0;release_num < NUMBER_OF_UE_MAX;release_num++){
if(rrc_release_info.RRC_release_ctrl[release_num].flag > 0){
release_total++;
}else{
continue;
}
if(rrc_release_info.RRC_release_ctrl[release_num].rnti == rntiP){
rrc_release_info.RRC_release_ctrl[release_num].flag = 0;
rrc_release_info.num_UEs--;
release_total--;
}
if(release_total >= rrc_release_info.num_UEs){
break;
}
}
}
pthread_mutex_unlock(&rrc_release_freelist);
return 0;
}
......@@ -3456,7 +3477,7 @@ allocate_CCEs(int module_idP, int CC_idP, frame_t frameP, sub_frame_t subframeP,
for (j = 0; j <= i; j++) {
if (dl_config_pdu[j].pdu_type ==
NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE)
LOG_I(MAC,
LOG_D(MAC,
"DCI %d/%d (%d,%d) : rnti %x dci format %d, aggreg %d nCCE %d / %d (num_pdcch_symbols %d)\n",
j,
DL_req->number_dci +
......@@ -3850,6 +3871,7 @@ extract_harq(module_id_t mod_idP, int CC_idP, int UE_id,
else
frame_tx = subframeP < 4 ? frameP -1 : frameP;
harq_pid = frame_subframe2_dl_harq_pid(cc->tdd_Config,frame_tx,subframe_tx);
RA_t *ra = &RC.mac[mod_idP]->common_channels[CC_idP].ra[0];
if(num_ack_nak==1){
if(harq_indication_tdd->harq_data[0].bundling.value_0==1){ //ack
......@@ -3860,9 +3882,18 @@ extract_harq(module_id_t mod_idP, int CC_idP, int UE_id,
if( sched_ctl->round[CC_idP][harq_pid]<8)
sched_ctl->round[CC_idP][harq_pid]++;
LOG_D(MAC,"frame %d subframe %d Nacking (%d,%d) harq_pid %d round %d\n",frameP,subframeP,frame_tx,subframe_tx,harq_pid,sched_ctl->round[CC_idP][harq_pid]);
if(sched_ctl->round[CC_idP][harq_pid] == 8){
for (uint8_t ra_i = 0; ra_i < NB_RA_PROC_MAX; ra_i++) {
if((ra[ra_i].rnti == rnti) && (ra[ra_i].state == WAITMSG4ACK)){
//Msg NACK num to MAC ,remove UE
// add UE info to freeList
LOG_I(RRC, "put UE %x into freeList\n", rnti);
put_UE_in_freelist(mod_idP, rnti, 1);
}
}
}
}
}
RA_t *ra = &RC.mac[mod_idP]->common_channels[CC_idP].ra[0];
for (uint8_t ra_i = 0; ra_i < NB_RA_PROC_MAX; ra_i++) {
if ((ra[ra_i].rnti == rnti) && (ra[ra_i].state == MSGCRNTI_ACK) && (ra[ra_i].crnti_harq_pid == harq_pid)) {
LOG_D(MAC,"CRNTI Reconfiguration: ACK %d rnti %x round %d frame %d subframe %d \n",harq_indication_tdd->harq_data[0].bundling.value_0,rnti,sched_ctl->round[CC_idP][harq_pid],frameP,subframeP);
......@@ -3936,8 +3967,19 @@ extract_harq(module_id_t mod_idP, int CC_idP, int UE_id,
if (pdu[0] == 1) { // ACK
sched_ctl->round[CC_idP][harq_pid] = 8; // release HARQ process
sched_ctl->tbcnt[CC_idP][harq_pid] = 0;
} else if (pdu[0] == 2 || pdu[0] == 4) // NAK (treat DTX as NAK)
} else if (pdu[0] == 2 || pdu[0] == 4){ // NAK (treat DTX as NAK)
sched_ctl->round[CC_idP][harq_pid]++; // increment round
if(sched_ctl->round[CC_idP][harq_pid] == 8){
for (uint8_t ra_i = 0; ra_i < NB_RA_PROC_MAX; ra_i++) {
if((ra[ra_i].rnti == rnti) && (ra[ra_i].state == WAITMSG4ACK)){
//Msg NACK num to MAC ,remove UE
// add UE info to freeList
LOG_I(RRC, "put UE %x into freeList\n", rnti);
put_UE_in_freelist(mod_idP, rnti, 1);
}
}
}
}
} else {
// one or two ACK/NAK bits
AssertFatal(num_ack_nak > 2,
......
......@@ -629,8 +629,9 @@ rx_sdu(const module_id_t enb_mod_idP,
ra[ii].rach_resource_type
#endif
)) == -1) {
AssertFatal(1 == 0,
"[MAC][eNB] Max user count reached\n");
LOG_E(MAC,"[MAC][eNB] Max user count reached\n");
cancel_ra_proc(enb_mod_idP, CC_idP, frameP,current_rnti);
break;
// kill RA procedure
} else
LOG_D(MAC,
......
......@@ -110,5 +110,5 @@ extern uint8_t new_dlsch_ue_select_tbl_in_use;
extern boolean_t pre_scd_activeUE[NUMBER_OF_UE_MAX];
extern eNB_UE_STATS pre_scd_eNB_UE_stats[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
#endif
extern mac_rlc_am_muilist_t rlc_am_mui;
#endif //DEF_H
......@@ -668,6 +668,10 @@ void dlsch_scheduler_pre_ue_select(
continue;
}
if(mac_eNB_get_rrc_status(module_idP,rnti) < RRC_CONNECTED){
continue;
}
ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id];
#if 0
if (ue_sched_ctl->ul_out_of_sync == 1) {
......@@ -774,6 +778,10 @@ void dlsch_scheduler_pre_ue_select(
if (rnti == NOT_A_RNTI)
continue;
if(mac_eNB_get_rrc_status(module_idP,rnti) < RRC_CONNECTED){
continue;
}
ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id];
#if 0
if (ue_sched_ctl->ul_out_of_sync == 1) {
......@@ -887,6 +895,10 @@ void dlsch_scheduler_pre_ue_select(
if (rnti == NOT_A_RNTI)
continue;
if(mac_eNB_get_rrc_status(module_idP,rnti) < RRC_CONNECTED){
continue;
}
ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id];
#if 0
if (ue_sched_ctl->ul_out_of_sync == 1) {
......@@ -1159,6 +1171,9 @@ void dlsch_scheduler_pre_processor (module_id_t Mod_id,
dlsch_ue_select[CC_id].ue_num = i+1;
break;
}
LOG_D(MAC,"DLSCH UE Select: frame %d subframe %d pre_nb_available_rbs %d(i %d UE_id %d nb_rbs_required %d nb_rbs_required_remaining %d average_rbs_per_user %d (temp_total rbs_count %d ue_num %d) available_prbs %d)\n",
frameP,subframeP,ue_sched_ctl->pre_nb_available_rbs[CC_id],i,UE_id,nb_rbs_required[CC_id][UE_id],nb_rbs_required_remaining[CC_id][UE_id],
average_rbs_per_user[CC_id],temp_total_rbs_count,temp_total_ue_count,RC.mac[Mod_id]->eNB_stats[CC_id].available_prbs);
#ifdef TM5
// TODO: data channel TM5: to be re-visited
#endif
......
......@@ -155,5 +155,5 @@ uint8_t new_dlsch_ue_select_tbl_in_use;
boolean_t pre_scd_activeUE[NUMBER_OF_UE_MAX];
eNB_UE_STATS pre_scd_eNB_UE_stats[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
#endif
mac_rlc_am_muilist_t rlc_am_mui;
#endif
......@@ -588,7 +588,6 @@ rlc_am_mac_status_indication (
sdu_size = ((rlc_am_tx_sdu_management_t *) (rlc->input_sdus[rlc->current_sdu_index].mem_block->data))->sdu_size;
sdu_remaining_size = ((rlc_am_tx_sdu_management_t *) (rlc->input_sdus[rlc->current_sdu_index].mem_block->data))->sdu_remaining_size;
status_resp.rrc_mui = rlc->input_sdus[rlc->current_sdu_index].mui;
status_resp.head_sdu_remaining_size_to_send = sdu_remaining_size;
if (sdu_size == sdu_remaining_size) {
......
......@@ -358,6 +358,8 @@ void rlc_am_segment_10 (
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
pdu_remaining_size);
//msg ("[FRAME %05d][%s][RLC_AM][MOD %u/%u][RB %u][SEGMENT] pdu_mem_p %p pdu_p %p pdu_p->data %p data %p data_sdu_p %p pdu_remaining_size %d\n", rlc_pP->module_id, rlc_pP->rb_id, ctxt_pP->frame, pdu_mem_p, pdu_p, pdu_p->data, data, data_sdu_p,pdu_remaining_size);
rlc_am_mui.rrc_mui[rlc_am_mui.rrc_mui_num] = sdu_mngt_p->mui;
rlc_am_mui.rrc_mui_num++;
memcpy(data, data_sdu_p, pdu_remaining_size);
pdu_mngt_p->payload_size += pdu_remaining_size;
......@@ -376,6 +378,9 @@ void rlc_am_segment_10 (
LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEGMENT] Exactly Filling remaining PDU with %d remaining bytes of SDU\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
pdu_remaining_size);
rlc_am_mui.rrc_mui[rlc_am_mui.rrc_mui_num] = sdu_mngt_p->mui;
rlc_am_mui.rrc_mui_num++;
memcpy(data, data_sdu_p, pdu_remaining_size);
pdu_mngt_p->payload_size += pdu_remaining_size;
......@@ -392,6 +397,8 @@ void rlc_am_segment_10 (
continue_fill_pdu_with_sdu = 0;
pdu_remaining_size = 0;
} else if ((sdu_mngt_p->sdu_remaining_size + (li_length_in_bytes ^ 3)) < pdu_remaining_size ) {
rlc_am_mui.rrc_mui[rlc_am_mui.rrc_mui_num] = sdu_mngt_p->mui;
rlc_am_mui.rrc_mui_num++;
if (fill_num_li == (RLC_AM_MAX_SDU_IN_PDU - 1)) {
LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEGMENT] [SIZE %d] REACHING RLC_AM_MAX_SDU_IN_PDU LIs -> STOP SEGMENTATION FOR THIS PDU SDU\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
......@@ -472,6 +479,9 @@ void rlc_am_segment_10 (
sdu_mngt_p->sdu_remaining_size,
pdu_remaining_size - sdu_mngt_p->sdu_remaining_size);
//assert(1!=1);
rlc_am_mui.rrc_mui[rlc_am_mui.rrc_mui_num] = sdu_mngt_p->mui;
rlc_am_mui.rrc_mui_num++;
memcpy(data, data_sdu_p, sdu_mngt_p->sdu_remaining_size);
pdu_mngt_p->payload_size += sdu_mngt_p->sdu_remaining_size;
pdu_remaining_size = pdu_remaining_size - sdu_mngt_p->sdu_remaining_size;
......
......@@ -151,7 +151,6 @@ typedef struct {
frame_t head_sdu_creation_time; /*!< \brief Head SDU creation time. */
sdu_size_t head_sdu_remaining_size_to_send; /*!< \brief remaining size of sdu: could be the total size or the remaining size of already segmented sdu */
boolean_t head_sdu_is_segmented; /*!< \brief 0 if head SDU has not been segmented, 1 if already segmented */
mui_t rrc_mui;
} mac_rlc_status_resp_t;
......
......@@ -192,6 +192,7 @@ tbs_size_t mac_rlc_data_req(
break;
case RLC_MODE_AM:
rlc_am_mui.rrc_mui_num = 0;
if (!enb_flagP) rlc_am_set_nb_bytes_requested_by_mac(&rlc_union_p->rlc.am,tb_sizeP);
data_request = rlc_am_mac_data_request(&ctxt, &rlc_union_p->rlc.am,enb_flagP);
ret_tb_size =mac_rlc_serialize_tb(buffer_pP, data_request.data);
......@@ -372,7 +373,6 @@ mac_rlc_status_resp_t mac_rlc_status_ind(
mac_rlc_status_resp.head_sdu_creation_time = status_resp.head_sdu_creation_time;
mac_rlc_status_resp.head_sdu_remaining_size_to_send = status_resp.head_sdu_remaining_size_to_send;
mac_rlc_status_resp.head_sdu_is_segmented = status_resp.head_sdu_is_segmented;
mac_rlc_status_resp.rrc_mui = status_resp.rrc_mui;
//return mac_rlc_status_resp;
break;
......
......@@ -831,7 +831,8 @@ rrc_eNB_free_UE(const module_id_t enb_mod_idP,const struct rrc_eNB_ue_context_s*
LOG_W(RRC, "[eNB %d] Removing UE RNTI %x\n", enb_mod_idP, rnti);
#if defined(ENABLE_USE_MME)
if( ue_context_pP->ue_context.ul_failure_timer >= 20000 ) {
if((ue_context_pP->ue_context.ul_failure_timer >= 20000) &&
(mac_eNB_get_rrc_status(enb_mod_idP,rnti) >= RRC_CONNECTED)) {
LOG_I(RRC, "[eNB %d] S1AP_UE_CONTEXT_RELEASE_REQ RNTI %x\n", enb_mod_idP, rnti);
rrc_eNB_send_S1AP_UE_CONTEXT_RELEASE_REQ(enb_mod_idP, ue_context_pP, S1AP_CAUSE_RADIO_NETWORK, 21); // send cause 21: connection with ue lost
/* From 3GPP 36300v10 p129 : 19.2.2.2.2 S1 UE Context Release Request (eNB triggered)
......@@ -2100,6 +2101,8 @@ rrc_eNB_generate_RRCConnectionRelease(
rrc_release_info.RRC_release_ctrl[release_num].rnti = ctxt_pP->rnti;
rrc_release_info.RRC_release_ctrl[release_num].rrc_eNB_mui = rrc_eNB_mui;
rrc_release_info.num_UEs++;
LOG_D(RRC,"Generate DLSCH Release send: index %d rnti %x mui %d flag %d \n",release_num,
ctxt_pP->rnti, rrc_eNB_mui,rrc_release_info.RRC_release_ctrl[release_num].flag);
break;
}
}
......
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