Commit cac00e34 authored by Raymond Knopp's avatar Raymond Knopp

temporary commit for debugging on another computer

parent fdb81c23
......@@ -44,6 +44,7 @@
#include "PHY/CODING/extern.h"
#include "PHY/CODING/lte_interleaver_inline.h"
#include "PHY/LTE_TRANSPORT/defs.h"
#include "PHY/LTE_TRANSPORT/proto.h"
#include "defs.h"
#include "UTIL/LOG/vcd_signal_dumper.h"
......@@ -104,8 +105,8 @@ void free_eNB_dlsch(LTE_eNB_DLSCH_t *dlsch)
free16(dlsch->harq_processes[i]->d[r],(96+12+3+(3*6144)));
dlsch->harq_processes[i]->d[r] = NULL;
}
}
}
free16(dlsch->harq_processes[i],sizeof(LTE_DL_eNB_HARQ_t));
dlsch->harq_processes[i] = NULL;
}
......@@ -204,20 +205,20 @@ LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,unsigned char Mdlharq,uint32_
for (i=0; i<Mdlharq; i++) {
dlsch->harq_processes[i]->round=0;
if (abstraction_flag==0) {
for (j=0; j<96; j++)
for (r=0; r<MAX_NUM_DLSCH_SEGMENTS/bw_scaling; r++) {
// printf("dlsch->harq_processes[%d]->d[%d] %p\n",i,r,dlsch->harq_processes[i]->d[r]);
if (dlsch->harq_processes[i]->d[r])
dlsch->harq_processes[i]->d[r][j] = LTE_NULL;
}
}
}
return(dlsch);
}
}
LOG_D(PHY, "new_eNB_dlsch exit flag %d, size of %ld\n",
LOG_D(PHY,"new_eNB_dlsch exit flag %d, size of %ld\n",
exit_flag, sizeof(LTE_eNB_DLSCH_t));
free_eNB_dlsch(dlsch);
return(NULL);
......@@ -225,7 +226,7 @@ LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,unsigned char Mdlharq,uint32_
}
void clean_eNb_dlsch(LTE_eNB_DLSCH_t *dlsch, uint8_t abstraction_flag)
void clean_eNb_dlsch(LTE_eNB_DLSCH_t *dlsch)
{
unsigned char Mdlharq;
......@@ -245,12 +246,11 @@ void clean_eNb_dlsch(LTE_eNB_DLSCH_t *dlsch, uint8_t abstraction_flag)
dlsch->harq_processes[i]->status = 0;
dlsch->harq_processes[i]->round = 0;
if (abstraction_flag==0) {
for (j=0; j<96; j++)
for (r=0; r<MAX_NUM_DLSCH_SEGMENTS; r++)
if (dlsch->harq_processes[i]->d[r])
dlsch->harq_processes[i]->d[r][j] = LTE_NULL;
}
}
}
}
......
......@@ -54,7 +54,7 @@
*/
void free_eNB_dlsch(LTE_eNB_DLSCH_t *dlsch);
void clean_eNb_dlsch(LTE_eNB_DLSCH_t *dlsch, uint8_t abstraction_flag);
void clean_eNb_dlsch(LTE_eNB_DLSCH_t *dlsch);
/** \fn new_eNB_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint8_t abstraction_flag)
\brief This function allocates structures for a particular DLSCH at eNB
......@@ -85,7 +85,7 @@ void free_ue_dlsch(LTE_UE_DLSCH_t *dlsch);
LTE_UE_DLSCH_t *new_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint8_t max_turbo_iterations,uint8_t N_RB_DL, uint8_t abstraction_flag);
void clean_eNb_ulsch(LTE_eNB_ULSCH_t *ulsch, uint8_t abstraction_flag);
void clean_eNb_ulsch(LTE_eNB_ULSCH_t *ulsch);
void free_ue_ulsch(LTE_UE_ULSCH_t *ulsch);
......
......@@ -179,7 +179,7 @@ LTE_eNB_ULSCH_t *new_eNB_ulsch(uint8_t Mdlharq,uint8_t max_turbo_iterations,uint
return(NULL);
}
void clean_eNb_ulsch(LTE_eNB_ULSCH_t *ulsch, uint8_t abstraction_flag)
void clean_eNb_ulsch(LTE_eNB_ULSCH_t *ulsch)
{
unsigned char Mdlharq;
......
......@@ -256,7 +256,7 @@
#define AMP_OVER_2 (AMP>>1)
/// Threshold for PUCCH Format 1 detection
#define PUCCH1_THRES 10
#define PUCCH1_THRES 7
/// Threshold for PUCCH Format 1a/1b detection
#define PUCCH1a_THRES 4
......
......@@ -405,7 +405,7 @@ void remove_harq_pid_from_freelist(LTE_eNB_DLSCH_t *DLSCH_ptr, int harq_pid);
int8_t find_ue(uint16_t rnti, PHY_VARS_eNB *phy_vars_eNB);
int32_t add_ue(int16_t rnti, PHY_VARS_eNB *phy_vars_eNB);
int32_t remove_ue(uint16_t rnti, PHY_VARS_eNB *phy_vars_eNB,uint8_t abstraction_flag);
int mac_phy_remove_ue(module_id_t Mod_idP,rnti_t rnti);
void process_timing_advance(module_id_t Mod_id,uint8_t CC_id,int16_t timing_advance);
void process_timing_advance_rar(PHY_VARS_UE *phy_vars_ue,uint16_t timing_advance);
......
......@@ -198,10 +198,10 @@ int32_t add_ue(int16_t rnti, PHY_VARS_eNB *phy_vars_eNB)
return(-1);
}
int32_t remove_ue(uint16_t rnti, PHY_VARS_eNB *phy_vars_eNB, uint8_t abstraction_flag)
{
int mac_phy_remove_ue(module_id_t Mod_idP,rnti_t rntiP) {
uint8_t i;
int j;
PHY_VARS_eNB *phy_vars_eNB = PHY_vars_eNB_g[Mod_idP];
for (i=0; i<NUMBER_OF_UE_MAX; i++) {
if ((phy_vars_eNB->dlsch_eNB[i]==NULL) || (phy_vars_eNB->ulsch_eNB[i]==NULL)) {
......@@ -209,14 +209,14 @@ int32_t remove_ue(uint16_t rnti, PHY_VARS_eNB *phy_vars_eNB, uint8_t abstraction
LOG_E(PHY,"Can't remove UE, not enough memory allocated\n");
return(-1);
} else {
if (phy_vars_eNB->eNB_UE_stats[i].crnti==rnti) {
MSC_LOG_EVENT(MSC_PHY_ENB, "0 Removed ue %"PRIx16" ", rnti);
if (phy_vars_eNB->eNB_UE_stats[i].crnti==rntiP) {
MSC_LOG_EVENT(MSC_PHY_ENB, "0 Removed ue %"PRIx16" ", rntiP);
#ifdef DEBUG_PHY_PROC
LOG_I(PHY,"eNB %d removing UE %d with rnti %x\n",phy_vars_eNB->Mod_id,i,rnti);
#endif
//msg("[PHY] UE_id %d\n",i);
clean_eNb_dlsch(phy_vars_eNB->dlsch_eNB[i][0], abstraction_flag);
clean_eNb_ulsch(phy_vars_eNB->ulsch_eNB[i],abstraction_flag);
clean_eNb_dlsch(phy_vars_eNB->dlsch_eNB[i][0]);
clean_eNb_ulsch(phy_vars_eNB->ulsch_eNB[i]);
//phy_vars_eNB->eNB_UE_stats[i].crnti = 0;
memset(&phy_vars_eNB->eNB_UE_stats[i],0,sizeof(LTE_eNB_UE_stats));
// mac_exit_wrapper("Removing UE");
......@@ -232,7 +232,7 @@ int32_t remove_ue(uint16_t rnti, PHY_VARS_eNB *phy_vars_eNB, uint8_t abstraction
}
}
MSC_LOG_EVENT(MSC_PHY_ENB, "0 Failed remove ue %"PRIx16" (not found)", rnti);
MSC_LOG_EVENT(MSC_PHY_ENB, "0 Failed remove ue %"PRIx16" (not found)", rntiP);
return(-1);
}
......@@ -3523,7 +3523,7 @@ void phy_procedures_eNB_RX(const unsigned char sched_subframe,PHY_VARS_eNB *phy_
frame,
phy_vars_eNB->eNB_UE_stats[i].crnti);
#endif
remove_ue(phy_vars_eNB->eNB_UE_stats[i].crnti,phy_vars_eNB,abstraction_flag);
mac_phy_remove_ue(phy_vars_eNB->eNB_UE_stats[i].crnti,phy_vars_eNB);
phy_vars_eNB->ulsch_eNB[(uint32_t)i]->Msg3_active = 0;
//phy_vars_eNB->ulsch_eNB[i]->harq_processes[harq_pid]->phich_active = 0;
......@@ -3670,7 +3670,7 @@ void phy_procedures_eNB_RX(const unsigned char sched_subframe,PHY_VARS_eNB *phy_
phy_vars_eNB->CC_id,
frame,
phy_vars_eNB->eNB_UE_stats[i].crnti);
remove_ue(phy_vars_eNB->eNB_UE_stats[i].crnti,phy_vars_eNB,abstraction_flag);
mac_phy_remove_ue(phy_vars_eNB->eNB_UE_stats[i].crnti,phy_vars_eNB);
phy_vars_eNB->ulsch_eNB[(uint32_t)i]->Msg3_active = 0;
}
......
......@@ -129,7 +129,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag,
eNB_mac_inst[module_idP].UE_list.UE_sched_ctrl[i].ul_inactivity_timer++;
if (mac_xface->get_eNB_UE_stats(module_idP, CC_id, rnti)==NULL) {
mac_remove_ue(module_idP, i, frameP, subframeP);
// mac_remove_ue(module_idP, i, frameP, subframeP);
}
else {
// check uplink failure
......@@ -210,7 +210,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag,
0);
}
else { // ra_pdcch_sent==1
LOG_I(MAC,"UE %d rnti %x: sent PDCCH order for RAPROC waiting (failure timer %d) \n",i,rnti,UE_list->UE_sched_ctrl[i].ul_failure_timer);
LOG_D(MAC,"UE %d rnti %x: sent PDCCH order for RAPROC waiting (failure timer %d) \n",i,rnti,UE_list->UE_sched_ctrl[i].ul_failure_timer);
if ((UE_list->UE_sched_ctrl[i].ul_failure_timer % 40) == 0)
UE_list->UE_sched_ctrl[i].ra_pdcch_order_sent=0; // resend every 4 frames
}
......
......@@ -287,44 +287,38 @@ int add_new_ue(module_id_t mod_idP, int cc_idP, rnti_t rntiP,int harq_pidP)
}
//------------------------------------------------------------------------------
int mac_remove_ue(module_id_t mod_idP, int ue_idP, int frameP, sub_frame_t subframeP)
int rrc_mac_remove_ue(module_id_t mod_idP,rnti_t rntiP)
//------------------------------------------------------------------------------
{
int prev,i, ret=-1;
rnti_t rnti;
UE_list_t *UE_list = &eNB_mac_inst[mod_idP].UE_list;
int pCC_id = UE_PCCID(mod_idP,ue_idP);
int UE_id = find_UE_id(mod_idP,rntiP);
int pCC_id = UE_PCCID(mod_idP,UE_id);
rnti = UE_list->UE_template[pCC_id][ue_idP].rnti;
LOG_I(MAC,"Removing UE %d from Primary CC_id %d (rnti %x)\n",ue_idP,pCC_id, rnti);
LOG_I(MAC,"Removing UE %d from Primary CC_id %d (rnti %x)\n",UE_id,pCC_id, rntiP);
dump_ue_list(UE_list,0);
// clear all remaining pending transmissions
UE_list->UE_template[pCC_id][ue_idP].bsr_info[LCGID0] = 0;
UE_list->UE_template[pCC_id][ue_idP].bsr_info[LCGID1] = 0;
UE_list->UE_template[pCC_id][ue_idP].bsr_info[LCGID2] = 0;
UE_list->UE_template[pCC_id][ue_idP].bsr_info[LCGID3] = 0;
UE_list->UE_template[pCC_id][ue_idP].ul_SR = 0;
UE_list->UE_template[pCC_id][ue_idP].rnti = NOT_A_RNTI;
UE_list->UE_template[pCC_id][ue_idP].ul_active = FALSE;
eNB_ulsch_info[mod_idP][pCC_id][ue_idP].rnti = NOT_A_RNTI;
eNB_ulsch_info[mod_idP][pCC_id][ue_idP].status = S_UL_NONE;
eNB_dlsch_info[mod_idP][pCC_id][ue_idP].rnti = NOT_A_RNTI;
eNB_dlsch_info[mod_idP][pCC_id][ue_idP].status = S_DL_NONE;
rrc_eNB_free_UE(
mod_idP,
rnti,
frameP,
subframeP);
UE_list->UE_template[pCC_id][UE_id].bsr_info[LCGID0] = 0;
UE_list->UE_template[pCC_id][UE_id].bsr_info[LCGID1] = 0;
UE_list->UE_template[pCC_id][UE_id].bsr_info[LCGID2] = 0;
UE_list->UE_template[pCC_id][UE_id].bsr_info[LCGID3] = 0;
UE_list->UE_template[pCC_id][UE_id].ul_SR = 0;
UE_list->UE_template[pCC_id][UE_id].rnti = NOT_A_RNTI;
UE_list->UE_template[pCC_id][UE_id].ul_active = FALSE;
eNB_ulsch_info[mod_idP][pCC_id][UE_id].rnti = NOT_A_RNTI;
eNB_ulsch_info[mod_idP][pCC_id][UE_id].status = S_UL_NONE;
eNB_dlsch_info[mod_idP][pCC_id][UE_id].rnti = NOT_A_RNTI;
eNB_dlsch_info[mod_idP][pCC_id][UE_id].status = S_DL_NONE;
prev = UE_list->head;
for (i=UE_list->head; i>=0; i=UE_list->next[i]) {
if (i == ue_idP) {
if (i == UE_id) {
// link prev to next in Active list
//if (prev==UE_list->head)
if (i==UE_list->head) {
......@@ -349,7 +343,7 @@ int mac_remove_ue(module_id_t mod_idP, int ue_idP, int frameP, sub_frame_t subfr
prev = UE_list->head_ul;
for (i=UE_list->head_ul; i>=0; i=UE_list->next_ul[i]) {
if (i == ue_idP) {
if (i == UE_id) {
// link prev to next in Active list
if (prev==UE_list->head_ul) {
UE_list->head_ul = UE_list->next_ul[i];
......@@ -370,7 +364,7 @@ int mac_remove_ue(module_id_t mod_idP, int ue_idP, int frameP, sub_frame_t subfr
return (0);
}
LOG_E(MAC,"error in mac_remove_ue(), could not find previous to %d in UE_list, should never happen, Dumping UE list\n",ue_idP);
LOG_E(MAC,"error in mac_remove_ue(), could not find previous to %d in UE_list, should never happen, Dumping UE list\n",UE_id);
dump_ue_list(UE_list,0);
mac_xface->macphy_exit("mac_remove_ue: Problem in UE_list");
return(-1);
......
......@@ -476,6 +476,7 @@ int l2_init(LTE_DL_FRAME_PARMS *frame_parms,int eMBMS_active, char *uecap_xer,ui
mac_xface->Msg1_transmitted = Msg1_tx;
mac_xface->ra_failed = ra_failed;
mac_xface->ra_succeeded = ra_succeeded;
mac_xface->mac_phy_remove_ue = mac_phy_remove_ue;
LOG_I(MAC,"[MAIN] init UE MAC functions \n");
mac_xface->ue_decode_si = ue_decode_si;
......
......@@ -499,7 +499,7 @@ uint8_t *parse_ulsch_header(uint8_t *mac_header,
int l2_init(LTE_DL_FRAME_PARMS *frame_parms,int eMBMS_active, char *uecap_xer, uint8_t cba_group_active, uint8_t HO_active);
int mac_init(void);
int add_new_ue(module_id_t Mod_id, int CC_id, rnti_t rnti,int harq_pid);
int mac_remove_ue(module_id_t Mod_id, int UE_id,int frameP, sub_frame_t subframeP);
int rrc_mac_remove_ue(module_id_t Mod_id, rnti_t rntiP);
int maxround(module_id_t Mod_id,uint16_t rnti,int frame,sub_frame_t subframe,uint8_t ul_flag);
......
......@@ -134,7 +134,7 @@ typedef struct {
/// get delta mcs for fast UL AMC
int16_t (*estimate_ue_tx_power)(uint32_t tbs, uint32_t nb_rb, uint8_t control_only, lte_prefix_type_t ncp, uint8_t use_srs);
int (*mac_phy_remove_ue)(module_id_t Mod_idP,rnti_t rntiP);
/// UE functions
/// reset the ue phy
......
......@@ -716,19 +716,47 @@ mac_eNB_get_rrc_status(
}
void mac_eNB_rrc_ul_failure(const module_id_t Mod_instP,
const int CC_id,
const int CC_idP,
const frame_t frameP,
const sub_frame_t subframeP,
const rnti_t rnti) {
const rnti_t rntiP) {
struct rrc_eNB_ue_context_s* ue_context_p = NULL;
ue_context_p = rrc_eNB_get_ue_context(
&eNB_rrc_inst[Mod_instP],
rntiP);
if (ue_context_p != NULL) {
LOG_I(RRC,"Frame %d, Subframe %d: UE %x UL failure, activating timer\n",rntiP);
ue_context_p->ue_context.ul_failure_timer=1;
}
else {
LOG_E(RRC,"Frame %d, Subframe %d: UE %x unknown \n",rntiP);
}
return;
}
void mac_eNB_rrc_ul_in_sync(const module_id_t Mod_instP,
const int CC_id,
const int CC_idP,
const frame_t frameP,
const sub_frame_t subframeP,
const rnti_t rnti) {
const rnti_t rntiP) {
struct rrc_eNB_ue_context_s* ue_context_p = NULL;
ue_context_p = rrc_eNB_get_ue_context(
&eNB_rrc_inst[Mod_instP],
rntiP);
if (ue_context_p != NULL) {
LOG_I(RRC,"Frame %d, Subframe %d: UE %x to UL in synch\n",rntiP);
ue_context_p->ue_context.ul_failure_timer=0;
}
else {
LOG_E(RRC,"Frame %d, Subframe %d: UE %x unknown \n",rntiP);
}
return;
}
......
......@@ -357,6 +357,7 @@ typedef struct eNB_RRC_UE_s {
transport_layer_addr_t enb_gtp_addrs[S1AP_MAX_E_RAB];
rb_id_t enb_gtp_ebi[S1AP_MAX_E_RAB];
#endif
uint32_t ul_failure_timer;
} eNB_RRC_UE_t;
typedef uid_t ue_uid_t;
......
......@@ -414,9 +414,10 @@ rrc_rx_tx(
uint8_t UE_id;
int32_t current_timestamp_ms, ref_timestamp_ms;
struct timeval ts;
struct rrc_eNB_ue_context_s* ue_context_p = NULL;
#ifdef LOCALIZATION
double estimated_distance;
struct rrc_eNB_ue_context_s* ue_context_p = NULL;
protocol_ctxt_t ctxt;
#endif
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_IN);
......@@ -517,6 +518,20 @@ rrc_rx_tx(
} else { // eNB
check_handovers(ctxt_pP);
// counetr, and get the value and aggregate
// check for UL failure
RB_FOREACH(ue_context_p, rrc_ue_tree_s, &(eNB_rrc_inst[ctxt_pP->module_id].rrc_ue_head)) {
if (ue_context_p->ue_context.ul_failure_timer>0) {
ue_context_p->ue_context.ul_failure_timer++;
if (ue_context_p->ue_context.ul_failure_timer == 1000) {
// remove UE after 1 second after MAC has indicated UL failure
LOG_I(RRC,"Removing UE %x instance\n",ue_context_p->ue_context.rnti);
}
}
}
#ifdef LOCALIZATION
/* for the localization, only primary CC_id might be relevant*/
......
......@@ -790,7 +790,6 @@ rrc_eNB_free_mem_UE_context(
}
//-----------------------------------------------------------------------------
// called by MAC layer only
// should be called when UE is lost by eNB
void
rrc_eNB_free_UE(
......@@ -836,6 +835,7 @@ rrc_eNB_free_UE(
#endif
ue_context_p->ue_context.Status = RRC_IDLE;
rrc_mac_remove_ue(enb_mod_idP,rntiP);
rrc_rlc_remove_ue(&ctxt);
pdcp_remove_UE(&ctxt);
......
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