Commit e9d79295 authored by Vaibhav Shrivastava's avatar Vaibhav Shrivastava

Merge branch 'FRD_299_Changes' into Latest_3GPP_FRD_299

parents 4ed32230 9d5bb0c0
...@@ -191,65 +191,17 @@ int PRBalloc_to_locationandbandwidth(int NPRB,int RBstart) { ...@@ -191,65 +191,17 @@ int PRBalloc_to_locationandbandwidth(int NPRB,int RBstart) {
return(PRBalloc_to_locationandbandwidth0(NPRB,RBstart,275)); return(PRBalloc_to_locationandbandwidth0(NPRB,RBstart,275));
} }
/// Target code rate tables indexed by Imcs int cce_to_reg_interleaving(const int R, int k, int n_shift, const int C, int L, const int N_regs) {
/* TS 38.214 table 5.1.3.1-1 - MCS index table 1 for PDSCH */
uint16_t nr_target_code_rate_table1[29] = {120, 157, 193, 251, 308, 379, 449, 526, 602, 679, 340, 378, 434, 490, 553, \
616, 658, 438, 466, 517, 567, 616, 666, 719, 772, 822, 873, 910, 948};
/* TS 38.214 table 5.1.3.1-2 - MCS index table 2 for PDSCH */
// Imcs values 20 and 26 have been multiplied by 2 to avoid the floating point
uint16_t nr_target_code_rate_table2[28] = {120, 193, 308, 449, 602, 378, 434, 490, 553, 616, 658, 466, 517, 567, \
616, 666, 719, 772, 822, 873, 1365, 711, 754, 797, 841, 885, 1833, 948};
/* TS 38.214 table 5.1.3.1-3 - MCS index table 3 for PDSCH */
uint16_t nr_target_code_rate_table3[29] = {30, 40, 50, 64, 78, 99, 120, 157, 193, 251, 308, 379, 449, 526, 602, 340, \
378, 434, 490, 553, 616, 438, 466, 517, 567, 616, 666, 719, 772};
uint16_t nr_tbs_table[93] = {24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120, 128, 136, 144, 152, 160, 168, 176, 184, 192, 208, 224, 240, 256, 272, 288, 304, 320, \
336, 352, 368, 384, 408, 432, 456, 480, 504, 528, 552, 576, 608, 640, 672, 704, 736, 768, 808, 848, 888, 928, 984, 1032, 1064, 1128, 1160, 1192, 1224, 1256, \
1288, 1320, 1352, 1416, 1480, 1544, 1608, 1672, 1736, 1800, 1864, 1928, 2024, 2088, 2152, 2216, 2280, 2408, 2472, 2536, 2600, 2664, 2728, 2792, 2856, 2976, \
3104, 3240, 3368, 3496, 3624, 3752, 3824};
uint8_t nr_get_Qm(uint8_t Imcs, uint8_t table_idx) {
switch(table_idx) {
case 1:
return (((Imcs<10)||(Imcs==29))?2:((Imcs<17)||(Imcs==30))?4:((Imcs<29)||(Imcs==31))?6:-1);
break;
case 2:
return (((Imcs<5)||(Imcs==28))?2:((Imcs<11)||(Imcs==29))?4:((Imcs<20)||(Imcs==30))?6:((Imcs<28)||(Imcs==31))?8:-1);
break;
case 3:
return (((Imcs<15)||(Imcs==29))?2:((Imcs<21)||(Imcs==30))?4:((Imcs<29)||(Imcs==31))?6:-1);
break;
default:
AssertFatal(0, "Invalid MCS table index %d (expected in range [1,3])\n", table_idx);
return(0);
break;
}
}
uint32_t nr_get_code_rate(uint8_t Imcs, uint8_t table_idx) {
switch(table_idx) {
case 1:
return (nr_target_code_rate_table1[Imcs]);
break;
case 2:
return (nr_target_code_rate_table2[Imcs]);
break;
case 3: int f; // interleaving function
return (nr_target_code_rate_table3[Imcs]); if(R==0)
break; f = k;
else {
default: int c = k/R;
AssertFatal(0, "Invalid MCS table index %d (expected in range [1,3])\n", table_idx); int r = k % R;
return(0); f = (r * C + c + n_shift) % (N_regs / L);
break;
} }
return f;
} }
void get_coreset_rballoc(uint8_t *FreqDomainResource,int *n_rb,int *rb_offset) { void get_coreset_rballoc(uint8_t *FreqDomainResource,int *n_rb,int *rb_offset) {
...@@ -275,7 +227,8 @@ void get_coreset_rballoc(uint8_t *FreqDomainResource,int *n_rb,int *rb_offset) { ...@@ -275,7 +227,8 @@ void get_coreset_rballoc(uint8_t *FreqDomainResource,int *n_rb,int *rb_offset) {
*n_rb = 6*count; *n_rb = 6*count;
} }
int get_nb_periods_per_frame(uint8_t tdd_period) { int get_nb_periods_per_frame(uint8_t tdd_period)
{
int nb_periods_per_frame; int nb_periods_per_frame;
switch(tdd_period) { switch(tdd_period) {
...@@ -342,9 +295,9 @@ int get_dmrs_port(int nl, uint16_t dmrs_ports) ...@@ -342,9 +295,9 @@ int get_dmrs_port(int nl, uint16_t dmrs_ports)
return p; return p;
} }
lte_frame_type_t get_frame_type(uint16_t current_band, uint8_t scs_index) frame_type_t get_frame_type(uint16_t current_band, uint8_t scs_index)
{ {
lte_frame_type_t current_type; frame_type_t current_type;
int32_t delta_duplex = get_delta_duplex(current_band, scs_index); int32_t delta_duplex = get_delta_duplex(current_band, scs_index);
if (delta_duplex == 0) if (delta_duplex == 0)
...@@ -509,7 +462,6 @@ int get_nr_table_idx(int nr_bandP, uint8_t scs_index) { ...@@ -509,7 +462,6 @@ int get_nr_table_idx(int nr_bandP, uint8_t scs_index) {
return i; return i;
} }
int get_subband_size(int NPRB,int size) { int get_subband_size(int NPRB,int size) {
// implements table 5.2.1.4-2 from 36.214 // implements table 5.2.1.4-2 from 36.214
// //
...@@ -792,6 +744,5 @@ void SLIV2SL(int SLIV,int *S,int *L) { ...@@ -792,6 +744,5 @@ void SLIV2SL(int SLIV,int *S,int *L) {
*L=15-SLIVdiv14; *L=15-SLIVdiv14;
*S=13-SLIVmod14; *S=13-SLIVmod14;
} }
} }
...@@ -135,7 +135,6 @@ void rx_func(void *param) { ...@@ -135,7 +135,6 @@ void rx_func(void *param) {
int slot_rx = info->slot_rx; int slot_rx = info->slot_rx;
int frame_tx = info->frame_tx; int frame_tx = info->frame_tx;
int slot_tx = info->slot_tx; int slot_tx = info->slot_tx;
sl_ahead = sf_ahead*gNB->frame_parms.slots_per_subframe;
nfapi_nr_config_request_scf_t *cfg = &gNB->gNB_config; nfapi_nr_config_request_scf_t *cfg = &gNB->gNB_config;
int absslot_tx = info->timestamp_tx/gNB->frame_parms.get_samples_per_slot(slot_rx,&gNB->frame_parms); int absslot_tx = info->timestamp_tx/gNB->frame_parms.get_samples_per_slot(slot_rx,&gNB->frame_parms);
...@@ -188,15 +187,14 @@ void rx_func(void *param) { ...@@ -188,15 +187,14 @@ void rx_func(void *param) {
void clean_gNB_dlsch(NR_gNB_DLSCH_t *dlsch); void clean_gNB_dlsch(NR_gNB_DLSCH_t *dlsch);
int j; int j;
for (j = 0; j < NUMBER_OF_NR_ULSCH_MAX; j++) for (j = 0; j < NUMBER_OF_NR_ULSCH_MAX; j++)
if (gNB->ulsch[j][0]->rnti == rnti_to_remove[i]) { if (gNB->ulsch[j]->rnti == rnti_to_remove[i]) {
gNB->ulsch[j][0]->rnti = 0; gNB->ulsch[j]->rnti = 0;
gNB->ulsch[j][0]->harq_mask = 0; gNB->ulsch[j]->harq_mask = 0;
//clean_gNB_ulsch(gNB->ulsch[j][0]);
int h; int h;
for (h = 0; h < NR_MAX_ULSCH_HARQ_PROCESSES; h++) { for (h = 0; h < NR_MAX_ULSCH_HARQ_PROCESSES; h++) {
gNB->ulsch[j][0]->harq_processes[h]->status = SCH_IDLE; gNB->ulsch[j]->harq_processes[h]->status = SCH_IDLE;
gNB->ulsch[j][0]->harq_processes[h]->round = 0; gNB->ulsch[j]->harq_processes[h]->round = 0;
gNB->ulsch[j][0]->harq_processes[h]->handled = 0; gNB->ulsch[j]->harq_processes[h]->handled = 0;
} }
up_removed++; up_removed++;
} }
...@@ -221,7 +219,6 @@ void rx_func(void *param) { ...@@ -221,7 +219,6 @@ void rx_func(void *param) {
if (pthread_mutex_unlock(&rnti_to_remove_mutex)) exit(1); if (pthread_mutex_unlock(&rnti_to_remove_mutex)) exit(1);
// RX processing // RX processing
int tx_slot_type = nr_slot_select(cfg,frame_tx,slot_tx);
int rx_slot_type = nr_slot_select(cfg,frame_rx,slot_rx); int rx_slot_type = nr_slot_select(cfg,frame_rx,slot_rx);
if (rx_slot_type == NR_UPLINK_SLOT || rx_slot_type == NR_MIXED_SLOT) { if (rx_slot_type == NR_UPLINK_SLOT || rx_slot_type == NR_MIXED_SLOT) {
// UE-specific RX processing for subframe n // UE-specific RX processing for subframe n
...@@ -236,8 +233,7 @@ void rx_func(void *param) { ...@@ -236,8 +233,7 @@ void rx_func(void *param) {
gNB->common_vars.rxdataF[aa], gNB->common_vars.rxdataF[aa],
slot_rx, slot_rx,
0, 0,
gNB->frame_parms.Ncp==EXTENDED?12:14, gNB->frame_parms.Ncp==EXTENDED?12:14);
gNB->frame_parms.ofdm_symbol_size);
} }
phy_procedures_gNB_uespec_RX(gNB, frame_rx, slot_rx); phy_procedures_gNB_uespec_RX(gNB, frame_rx, slot_rx);
} }
...@@ -256,7 +252,8 @@ void rx_func(void *param) { ...@@ -256,7 +252,8 @@ void rx_func(void *param) {
gNB->if_inst->NR_UL_indication(&gNB->UL_INFO); gNB->if_inst->NR_UL_indication(&gNB->UL_INFO);
pthread_mutex_unlock(&gNB->UL_INFO_mutex); pthread_mutex_unlock(&gNB->UL_INFO_mutex);
stop_meas(&gNB->ul_indication_stats); stop_meas(&gNB->ul_indication_stats);
int tx_slot_type = nr_slot_select(cfg,frame_rx,slot_tx);
if (tx_slot_type == NR_DOWNLINK_SLOT || tx_slot_type == NR_MIXED_SLOT) { if (tx_slot_type == NR_DOWNLINK_SLOT || tx_slot_type == NR_MIXED_SLOT) {
notifiedFIFO_elt_t *res; notifiedFIFO_elt_t *res;
processingData_L1tx_t *syncMsg; processingData_L1tx_t *syncMsg;
...@@ -449,37 +446,19 @@ void init_gNB_Tpool(int inst) { ...@@ -449,37 +446,19 @@ void init_gNB_Tpool(int inst) {
gNB_L1_proc_t *proc = &gNB->proc; gNB_L1_proc_t *proc = &gNB->proc;
// ULSCH decoding threadpool // ULSCH decoding threadpool
gNB->threadPool = (tpool_t*)malloc(sizeof(tpool_t)); initTpool(get_softmodem_params()->threadPoolConfig, &gNB->threadPool, cpumeas(CPUMEAS_GETSTATE));
int numCPU = sysconf(_SC_NPROCESSORS_ONLN);
LOG_I(PHY,"Number of threads requested in config file: %d, Number of threads available on this machine: %d\n",gNB->thread_pool_size,numCPU);
int threadCnt = min(numCPU, gNB->thread_pool_size);
if (threadCnt < 2) LOG_E(PHY,"Number of threads for gNB should be more than 1. Allocated only %d\n",threadCnt);
char pool[80];
sprintf(pool,"-1");
int s_offset = 0;
for (int icpu=1; icpu<threadCnt; icpu++) {
sprintf(pool+2+s_offset,",-1");
s_offset += 3;
}
if (getenv("noThreads")) strcpy(pool, "n");
initTpool(pool, gNB->threadPool, cpumeas(CPUMEAS_GETSTATE));
// ULSCH decoder result FIFO // ULSCH decoder result FIFO
gNB->respDecode = (notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t)); initNotifiedFIFO(&gNB->respDecode);
initNotifiedFIFO(gNB->respDecode);
// L1 RX result FIFO // L1 RX result FIFO
gNB->resp_L1 = (notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t)); initNotifiedFIFO(&gNB->resp_L1);
initNotifiedFIFO(gNB->resp_L1); notifiedFIFO_elt_t *msg = newNotifiedFIFO_elt(sizeof(processingData_L1_t), 0, &gNB->resp_L1, rx_func);
notifiedFIFO_elt_t *msg = newNotifiedFIFO_elt(sizeof(processingData_L1_t),0,gNB->resp_L1,rx_func); pushNotifiedFIFO(&gNB->resp_L1, msg); // to unblock the process in the beginning
pushNotifiedFIFO(gNB->resp_L1,msg); // to unblock the process in the beginning
// L1 TX result FIFO // L1 TX result FIFO
gNB->L1_tx_free = (notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t)); initNotifiedFIFO(&gNB->L1_tx_free);
gNB->L1_tx_filled = (notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t)); initNotifiedFIFO(&gNB->L1_tx_filled);
gNB->L1_tx_out = (notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t)); initNotifiedFIFO(&gNB->L1_tx_out);
initNotifiedFIFO(gNB->L1_tx_free);
initNotifiedFIFO(gNB->L1_tx_filled);
initNotifiedFIFO(gNB->L1_tx_out);
// we create 2 threads for L1 tx processing // we create 2 threads for L1 tx processing
for (int i=0; i < 2; i++) { for (int i=0; i < 2; i++) {
...@@ -584,15 +563,9 @@ void init_eNB_afterRU(void) { ...@@ -584,15 +563,9 @@ void init_eNB_afterRU(void) {
gNB->RU_list[ru_id]->idx); gNB->RU_list[ru_id]->idx);
for (i=0; i<gNB->RU_list[ru_id]->nb_rx; aa++,i++) { for (i=0; i<gNB->RU_list[ru_id]->nb_rx; aa++,i++) {
LOG_I(PHY,"Attaching RU %d antenna %d to gNB antenna %d\n",gNB->RU_list[ru_id]->idx,i,aa); LOG_I(PHY,"Attaching RU %d antenna %d to gNB antenna %d\n",gNB->RU_list[ru_id]->idx,i,aa);
gNB->prach_vars.rxsigF[aa] = gNB->RU_list[ru_id]->prach_rxsigF[0][i]; gNB->prach_vars.rxsigF[aa] = gNB->RU_list[ru_id]->prach_rxsigF[0][i];
#if 0 gNB->common_vars.rxdataF[aa] = gNB->RU_list[ru_id]->common.rxdataF[i];
printf("before %p\n", gNB->common_vars.rxdataF[aa]);
#endif
gNB->common_vars.rxdataF[aa] = gNB->RU_list[ru_id]->common.rxdataF[i];
#if 0
printf("after %p\n", gNB->common_vars.rxdataF[aa]);
#endif
} }
} }
......
...@@ -100,7 +100,7 @@ int sync_var=-1; //!< protected by mutex \ref sync_mutex. ...@@ -100,7 +100,7 @@ int sync_var=-1; //!< protected by mutex \ref sync_mutex.
int config_sync_var=-1; int config_sync_var=-1;
volatile int start_gNB = 0; volatile int start_gNB = 0;
volatile int oai_exit = 0; int oai_exit = 0;
static int wait_for_sync = 0; static int wait_for_sync = 0;
...@@ -174,7 +174,7 @@ void sendFs6Ulharq(enum pckType type, int UEid, PHY_VARS_eNB *eNB, LTE_eNB_UCI * ...@@ -174,7 +174,7 @@ void sendFs6Ulharq(enum pckType type, int UEid, PHY_VARS_eNB *eNB, LTE_eNB_UCI *
extern void reset_opp_meas(void); extern void reset_opp_meas(void);
extern void print_opp_meas(void); extern void print_opp_meas(void);
//extern void *udp_eNB_task(void *args_p); extern void *udp_eNB_task(void *args_p);
int transmission_mode=1; int transmission_mode=1;
int emulate_rf = 0; int emulate_rf = 0;
...@@ -305,7 +305,7 @@ int create_gNB_tasks(uint32_t gnb_nb) { ...@@ -305,7 +305,7 @@ int create_gNB_tasks(uint32_t gnb_nb) {
/*if (itti_create_task (TASK_GNB_APP, gNB_app_task, NULL) < 0) { /*if (itti_create_task (TASK_GNB_APP, gNB_app_task, NULL) < 0) {
LOG_E(GNB_APP, "Create task for gNB APP failed\n"); LOG_E(GNB_APP, "Create task for gNB APP failed\n");
return -1; return -1;
}*/ }*/
if(itti_create_task(TASK_SCTP, sctp_eNB_task, NULL) < 0) { if(itti_create_task(TASK_SCTP, sctp_eNB_task, NULL) < 0) {
LOG_E(SCTP, "Create task for SCTP failed\n"); LOG_E(SCTP, "Create task for SCTP failed\n");
return -1; return -1;
...@@ -330,26 +330,20 @@ int create_gNB_tasks(uint32_t gnb_nb) { ...@@ -330,26 +330,20 @@ int create_gNB_tasks(uint32_t gnb_nb) {
char aprefix[MAX_OPTNAME_SIZE*2 + 8]; char aprefix[MAX_OPTNAME_SIZE*2 + 8];
sprintf(aprefix,"%s.[%i].%s",GNB_CONFIG_STRING_GNB_LIST,0,GNB_CONFIG_STRING_NETWORK_INTERFACES_CONFIG); sprintf(aprefix,"%s.[%i].%s",GNB_CONFIG_STRING_GNB_LIST,0,GNB_CONFIG_STRING_NETWORK_INTERFACES_CONFIG);
config_get( NETParams,sizeof(NETParams)/sizeof(paramdef_t),aprefix); config_get( NETParams,sizeof(NETParams)/sizeof(paramdef_t),aprefix);
for(int i = GNB_INTERFACE_NAME_FOR_NG_AMF_IDX; i <= GNB_IPV4_ADDRESS_FOR_NG_AMF_IDX; i++) { for(int i = GNB_INTERFACE_NAME_FOR_NG_AMF_IDX; i <= GNB_IPV4_ADDRESS_FOR_NG_AMF_IDX; i++) {
if( NETParams[i].strptr == NULL) { if( NETParams[i].strptr == NULL) {
LOG_E(NGAP, "No configuration in the file.\n"); LOG_E(NGAP, "No AMF configuration in the file.\n");
NGAP_CONF_MODE = 0;
} else { } else {
LOG_D(NGAP, "Configuration in the file: %s.\n",*NETParams[i].strptr); LOG_D(NGAP, "Configuration in the file: %s.\n",*NETParams[i].strptr);
} }
} }
if (gnb_nb > 0) { if (gnb_nb > 0) {
if(NGAP_CONF_MODE) { if (itti_create_task (TASK_NGAP, ngap_gNB_task, NULL) < 0) {
if (itti_create_task (TASK_NGAP, ngap_gNB_task, NULL) < 0) { LOG_E(NGAP, "Create task for NGAP failed\n");
LOG_E(NGAP, "Create task for NGAP failed\n"); return -1;
return -1;
}
} else {
LOG_I(NGAP, "Ngap task not created\n");
} }
} }
} }
...@@ -407,14 +401,13 @@ int create_gNB_tasks(uint32_t gnb_nb) { ...@@ -407,14 +401,13 @@ int create_gNB_tasks(uint32_t gnb_nb) {
return -1; return -1;
} }
//Use check on x2ap to consider the NSA scenario and check on AMF_MODE_ENABLED for the SA scenario //Use check on x2ap to consider the NSA scenario and check for SA scenario
if(is_x2ap_enabled() || AMF_MODE_ENABLED) { if(is_x2ap_enabled() || get_softmodem_params()->sa) {
if (itti_create_task (TASK_GTPV1_U, &gtpv1uTask, NULL) < 0) { if (itti_create_task (TASK_GTPV1_U, &gtpv1uTask, NULL) < 0) {
LOG_E(GTPU, "Create task for GTPV1U failed\n"); LOG_E(GTPU, "Create task for GTPV1U failed\n");
return -1; return -1;
} }
} }
} }
return 0; return 0;
...@@ -542,86 +535,6 @@ void terminate_task(task_id_t task_id, module_id_t mod_id) { ...@@ -542,86 +535,6 @@ void terminate_task(task_id_t task_id, module_id_t mod_id) {
//extern void free_transport(PHY_VARS_gNB *); //extern void free_transport(PHY_VARS_gNB *);
extern void nr_phy_free_RU(RU_t *); extern void nr_phy_free_RU(RU_t *);
int stop_L1L2(module_id_t gnb_id) {
LOG_W(GNB_APP, "stopping nr-softmodem\n");
oai_exit = 1;
if (!RC.ru) {
LOG_F(GNB_APP, "no RU configured\n");
return -1;
}
/* stop trx devices, multiple carrier currently not supported by RU */
if (RC.ru[gnb_id]) {
if (RC.ru[gnb_id]->rfdevice.trx_stop_func) {
RC.ru[gnb_id]->rfdevice.trx_stop_func(&RC.ru[gnb_id]->rfdevice);
LOG_I(GNB_APP, "turned off RU rfdevice\n");
} else {
LOG_W(GNB_APP, "can not turn off rfdevice due to missing trx_stop_func callback, proceeding anyway!\n");
}
if (RC.ru[gnb_id]->ifdevice.trx_stop_func) {
RC.ru[gnb_id]->ifdevice.trx_stop_func(&RC.ru[gnb_id]->ifdevice);
LOG_I(GNB_APP, "turned off RU ifdevice\n");
} else {
LOG_W(GNB_APP, "can not turn off ifdevice due to missing trx_stop_func callback, proceeding anyway!\n");
}
} else {
LOG_W(GNB_APP, "no RU found for index %d\n", gnb_id);
return -1;
}
/* these tasks need to pick up new configuration */
terminate_task(TASK_RRC_ENB, gnb_id);
LOG_I(GNB_APP, "calling kill_gNB_proc() for instance %d\n", gnb_id);
kill_gNB_proc(gnb_id);
LOG_I(GNB_APP, "calling kill_NR_RU_proc() for instance %d\n", gnb_id);
kill_NR_RU_proc(gnb_id);
oai_exit = 0;
//free_transport(RC.gNB[gnb_id]);
phy_free_nr_gNB(RC.gNB[gnb_id]);
nr_phy_free_RU(RC.ru[gnb_id]);
free_lte_top();
return 0;
}
/*
* Restart the nr-softmodem after it has been soft-stopped with stop_L1L2()
*/
int restart_L1L2(module_id_t gnb_id) {
RU_t *ru = RC.ru[gnb_id];
MessageDef *msg_p = NULL;
LOG_W(GNB_APP, "restarting nr-softmodem\n");
/* block threads */
sync_var = -1;
RC.gNB[gnb_id]->configured = 0;
RC.ru_mask |= (1 << ru->idx);
set_function_spec_param(RC.ru[gnb_id]);
LOG_I(GNB_APP, "attempting to create ITTI tasks\n");
// No more rrc thread, as many race conditions are hidden behind
rrc_enb_init();
itti_mark_task_ready(TASK_RRC_ENB);
/* pass a reconfiguration request which will configure everything down to
* RC.eNB[i][j]->frame_parms, too */
msg_p = itti_alloc_new_message(TASK_ENB_APP, 0, RRC_CONFIGURATION_REQ);
RRC_CONFIGURATION_REQ(msg_p) = RC.rrc[gnb_id]->configuration;
itti_send_msg_to_task(TASK_RRC_ENB, ENB_MODULE_ID_TO_INSTANCE(gnb_id), msg_p);
/* TODO XForms might need to be restarted, but it is currently (09/02/18)
* broken, so we cannot test it */
wait_gNBs();
init_RU_proc(ru);
ru->rf_map.card = 0;
ru->rf_map.chain = 0; /* CC_id + chain_offset;*/
wait_RUs();
init_eNB_afterRU();
printf("Sending sync to all threads\n");
pthread_mutex_lock(&sync_mutex);
sync_var=0;
pthread_cond_broadcast(&sync_cond);
pthread_mutex_unlock(&sync_mutex);
return 0;
}
static void wait_nfapi_init(char *thread_name) { static void wait_nfapi_init(char *thread_name) {
printf( "waiting for NFAPI PNF connection and population of global structure (%s)\n",thread_name); printf( "waiting for NFAPI PNF connection and population of global structure (%s)\n",thread_name);
pthread_mutex_lock( &nfapi_sync_mutex ); pthread_mutex_lock( &nfapi_sync_mutex );
...@@ -679,8 +592,6 @@ int main( int argc, char **argv ) { ...@@ -679,8 +592,6 @@ int main( int argc, char **argv ) {
} }
openair0_cfg[0].threequarter_fs = threequarter_fs; openair0_cfg[0].threequarter_fs = threequarter_fs;
AMF_MODE_ENABLED = get_softmodem_params()->sa;
NGAP_CONF_MODE = get_softmodem_params()->sa;
if (get_softmodem_params()->do_ra) if (get_softmodem_params()->do_ra)
AssertFatal(get_softmodem_params()->phy_test == 0,"RA and phy_test are mutually exclusive\n"); AssertFatal(get_softmodem_params()->phy_test == 0,"RA and phy_test are mutually exclusive\n");
...@@ -721,14 +632,6 @@ int main( int argc, char **argv ) { ...@@ -721,14 +632,6 @@ int main( int argc, char **argv ) {
int ret=create_gNB_tasks(1); int ret=create_gNB_tasks(1);
AssertFatal(ret==0,"cannot create ITTI tasks\n"); AssertFatal(ret==0,"cannot create ITTI tasks\n");
/* Start the agent. If it is turned off in the configuration, it won't start */
/*
RCconfig_nr_flexran();
for (i = 0; i < RC.nb_nr_L1_inst; i++) {
flexran_agent_start(i);
}
*/
// init UE_PF_PO and mutex lock // init UE_PF_PO and mutex lock
pthread_mutex_init(&ue_pf_po_mutex, NULL); pthread_mutex_init(&ue_pf_po_mutex, NULL);
memset (&UE_PF_PO[0][0], 0, sizeof(UE_PF_PO_t)*NUMBER_OF_UE_MAX*MAX_NUM_CCs); memset (&UE_PF_PO[0][0], 0, sizeof(UE_PF_PO_t)*NUMBER_OF_UE_MAX*MAX_NUM_CCs);
...@@ -765,9 +668,6 @@ int main( int argc, char **argv ) { ...@@ -765,9 +668,6 @@ int main( int argc, char **argv ) {
printf("NFAPI MODE:%s\n", nfapi_mode_str); printf("NFAPI MODE:%s\n", nfapi_mode_str);
if (NFAPI_MODE==NFAPI_MODE_VNF)
wait_nfapi_init("main?");
printf("START MAIN THREADS\n"); printf("START MAIN THREADS\n");
// start the main threads // start the main threads
number_of_cards = 1; number_of_cards = 1;
...@@ -836,44 +736,14 @@ int main( int argc, char **argv ) { ...@@ -836,44 +736,14 @@ int main( int argc, char **argv ) {
pthread_mutex_unlock(&sync_mutex); pthread_mutex_unlock(&sync_mutex);
} }
printf("About to call end_configmodule() from %s() %s:%d\n", __FUNCTION__, __FILE__, __LINE__);
// We have to set PARAMFLAG_NOFREE on right paramters before re-enabling end_configmodule()
//end_configmodule();
printf("Called end_configmodule() from %s() %s:%d\n", __FUNCTION__, __FILE__, __LINE__);
// wait for end of program // wait for end of program
printf("TYPE <CTRL-C> TO TERMINATE\n");
//getchar();
printf("Entering ITTI signals handler\n"); printf("Entering ITTI signals handler\n");
printf("TYPE <CTRL-C> TO TERMINATE\n"); printf("TYPE <CTRL-C> TO TERMINATE\n");
itti_wait_tasks_end(); itti_wait_tasks_end();
printf("Returned from ITTI signal handler\n"); printf("Returned from ITTI signal handler\n");
oai_exit=1; oai_exit=1;
printf("oai_exit=%d\n",oai_exit); printf("oai_exit=%d\n",oai_exit);
// stop threads
/*#ifdef XFORMS
printf("waiting for XFORMS thread\n");
if (do_forms==1) {
pthread_join(forms_thread,&status);
fl_hide_form(form_stats->stats_form);
fl_free_form(form_stats->stats_form);
fl_hide_form(form_stats_l2->stats_form);
fl_free_form(form_stats_l2->stats_form);
for(UE_id=0; UE_id<scope_enb_num_ue; UE_id++) {
for(CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
fl_hide_form(form_enb[CC_id][UE_id]->phy_scope_gNB);
fl_free_form(form_enb[CC_id][UE_id]->phy_scope_gNB);
}
}
}
#endif*/
printf("stopping MODEM threads\n");
// cleanup // cleanup
if (RC.nb_nr_L1_inst > 0) if (RC.nb_nr_L1_inst > 0)
stop_gNB(RC.nb_nr_L1_inst); stop_gNB(RC.nb_nr_L1_inst);
...@@ -891,7 +761,6 @@ int main( int argc, char **argv ) { ...@@ -891,7 +761,6 @@ int main( int argc, char **argv ) {
phy_free_nr_gNB(RC.gNB[inst]); phy_free_nr_gNB(RC.gNB[inst]);
} }
free_lte_top();
pthread_cond_destroy(&sync_cond); pthread_cond_destroy(&sync_cond);
pthread_mutex_destroy(&sync_mutex); pthread_mutex_destroy(&sync_mutex);
pthread_cond_destroy(&nfapi_sync_cond); pthread_cond_destroy(&nfapi_sync_cond);
...@@ -900,10 +769,7 @@ int main( int argc, char **argv ) { ...@@ -900,10 +769,7 @@ int main( int argc, char **argv ) {
// *** Handle per CC_id openair0 // *** Handle per CC_id openair0
for(ru_id=0; ru_id<NB_RU; ru_id++) { for(ru_id = 0; ru_id < RC.nb_RU; ru_id++) {
if (RC.ru[ru_id]->rfdevice.trx_end_func)
RC.ru[ru_id]->rfdevice.trx_end_func(&RC.ru[ru_id]->rfdevice);
if (RC.ru[ru_id]->ifdevice.trx_end_func) if (RC.ru[ru_id]->ifdevice.trx_end_func)
RC.ru[ru_id]->ifdevice.trx_end_func(&RC.ru[ru_id]->ifdevice); RC.ru[ru_id]->ifdevice.trx_end_func(&RC.ru[ru_id]->ifdevice);
} }
......
...@@ -31,9 +31,6 @@ ...@@ -31,9 +31,6 @@
#include "SCHED_NR_UE/defs.h" #include "SCHED_NR_UE/defs.h"
#include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h" #include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h"
#include "executables/softmodem-common.h" #include "executables/softmodem-common.h"
#include "LAYER2/nr_pdcp/nr_pdcp_entity.h"
#include "SCHED_NR_UE/pucch_uci_ue_nr.h"
#include "openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h"
#include "PHY/NR_REFSIG/refsig_defs_ue.h" #include "PHY/NR_REFSIG/refsig_defs_ue.h"
#include "radio/COMMON/common_lib.h" #include "radio/COMMON/common_lib.h"
...@@ -104,8 +101,6 @@ typedef enum { ...@@ -104,8 +101,6 @@ typedef enum {
si = 2 si = 2
} sync_mode_t; } sync_mode_t;
queue_t nr_rach_ind_queue;
static void *NRUE_phy_stub_standalone_pnf_task(void *arg); static void *NRUE_phy_stub_standalone_pnf_task(void *arg);
static size_t dump_L1_UE_meas_stats(PHY_VARS_NR_UE *ue, char *output, size_t max_len) static size_t dump_L1_UE_meas_stats(PHY_VARS_NR_UE *ue, char *output, size_t max_len)
...@@ -162,12 +157,6 @@ void init_nr_ue_vars(PHY_VARS_NR_UE *ue, ...@@ -162,12 +157,6 @@ void init_nr_ue_vars(PHY_VARS_NR_UE *ue,
ue->if_inst = nr_ue_if_module_init(0); ue->if_inst = nr_ue_if_module_init(0);
ue->dci_thres = 0; ue->dci_thres = 0;
// Setting UE mode to NOT_SYNCHED by default
for (gNB_id = 0; gNB_id < nb_connected_gNB; gNB_id++){
ue->UE_mode[gNB_id] = NOT_SYNCHED;
ue->prach_resources[gNB_id] = (NR_PRACH_RESOURCES_t *)malloc16_clear(sizeof(NR_PRACH_RESOURCES_t));
}
// initialize all signal buffers // initialize all signal buffers
init_nr_ue_signal(ue, nb_connected_gNB); init_nr_ue_signal(ue, nb_connected_gNB);
...@@ -199,47 +188,6 @@ void init_nrUE_standalone_thread(int ue_idx) ...@@ -199,47 +188,6 @@ void init_nrUE_standalone_thread(int ue_idx)
pthread_setname_np(phy_thread, "oai:nrue-stand-phy"); pthread_setname_np(phy_thread, "oai:nrue-stand-phy");
} }
static void L1_nsa_prach_procedures(frame_t frame, int slot, fapi_nr_ul_config_prach_pdu *prach_pdu)
{
NR_UE_MAC_INST_t *mac = get_mac_inst(0);
nfapi_nr_rach_indication_t *rach_ind = CALLOC(1, sizeof(*rach_ind));
rach_ind->sfn = frame;
rach_ind->slot = slot;
rach_ind->header.message_id = NFAPI_NR_PHY_MSG_TYPE_RACH_INDICATION;
uint8_t pdu_index = 0;
rach_ind->pdu_list = CALLOC(1, sizeof(*rach_ind->pdu_list));
rach_ind->number_of_pdus = 1;
rach_ind->pdu_list[pdu_index].phy_cell_id = prach_pdu->phys_cell_id;
rach_ind->pdu_list[pdu_index].symbol_index = prach_pdu->prach_start_symbol;
rach_ind->pdu_list[pdu_index].slot_index = prach_pdu->prach_slot;
rach_ind->pdu_list[pdu_index].freq_index = prach_pdu->num_ra;
rach_ind->pdu_list[pdu_index].avg_rssi = 128;
rach_ind->pdu_list[pdu_index].avg_snr = 0xff; // invalid for now
rach_ind->pdu_list[pdu_index].num_preamble = 1;
const int num_p = rach_ind->pdu_list[pdu_index].num_preamble;
rach_ind->pdu_list[pdu_index].preamble_list = calloc(num_p, sizeof(nfapi_nr_prach_indication_preamble_t));
uint8_t preamble_index = get_softmodem_params()->nsa ?
mac->ra.rach_ConfigDedicated->cfra->resources.choice.ssb->ssb_ResourceList.list.array[0]->ra_PreambleIndex :
mac->ra.ra_PreambleIndex;
rach_ind->pdu_list[pdu_index].preamble_list[0].preamble_index = preamble_index;
rach_ind->pdu_list[pdu_index].preamble_list[0].timing_advance = 0;
rach_ind->pdu_list[pdu_index].preamble_list[0].preamble_pwr = 0xffffffff;
if (!put_queue(&nr_rach_ind_queue, rach_ind))
{
for (int pdu_index = 0; pdu_index < rach_ind->number_of_pdus; pdu_index++)
{
free(rach_ind->pdu_list[pdu_index].preamble_list);
}
free(rach_ind->pdu_list);
free(rach_ind);
}
LOG_D(NR_MAC, "We have successfully filled the rach_ind queue with the recently filled rach ind\n");
}
static void process_queued_nr_nfapi_msgs(NR_UE_MAC_INST_t *mac, int sfn_slot) static void process_queued_nr_nfapi_msgs(NR_UE_MAC_INST_t *mac, int sfn_slot)
{ {
nfapi_nr_rach_indication_t *rach_ind = unqueue_matching(&nr_rach_ind_queue, MAX_QUEUE_SIZE, sfn_slot_matcher, &sfn_slot); nfapi_nr_rach_indication_t *rach_ind = unqueue_matching(&nr_rach_ind_queue, MAX_QUEUE_SIZE, sfn_slot_matcher, &sfn_slot);
...@@ -251,14 +199,12 @@ static void process_queued_nr_nfapi_msgs(NR_UE_MAC_INST_t *mac, int sfn_slot) ...@@ -251,14 +199,12 @@ static void process_queued_nr_nfapi_msgs(NR_UE_MAC_INST_t *mac, int sfn_slot)
NFAPI_SFNSLOT2SFN(mac->nr_ue_emul_l1.harq[i].active_ul_harq_sfn_slot), NFAPI_SFNSLOT2SFN(mac->nr_ue_emul_l1.harq[i].active_ul_harq_sfn_slot),
NFAPI_SFNSLOT2SLOT(mac->nr_ue_emul_l1.harq[i].active_ul_harq_sfn_slot), nr_ul_tti_req_queue.num_items); NFAPI_SFNSLOT2SLOT(mac->nr_ue_emul_l1.harq[i].active_ul_harq_sfn_slot), nr_ul_tti_req_queue.num_items);
nfapi_nr_ul_tti_request_t *ul_tti_request_crc = unqueue_matching(&nr_ul_tti_req_queue, MAX_QUEUE_SIZE, sfn_slot_matcher, &mac->nr_ue_emul_l1.harq[i].active_ul_harq_sfn_slot); nfapi_nr_ul_tti_request_t *ul_tti_request_crc = unqueue_matching(&nr_ul_tti_req_queue, MAX_QUEUE_SIZE, sfn_slot_matcher, &mac->nr_ue_emul_l1.harq[i].active_ul_harq_sfn_slot);
if (ul_tti_request_crc && ul_tti_request_crc->n_pdus > 0) if (ul_tti_request_crc && ul_tti_request_crc->n_pdus > 0) {
{
check_and_process_dci(NULL, NULL, NULL, ul_tti_request_crc); check_and_process_dci(NULL, NULL, NULL, ul_tti_request_crc);
} }
} }
if (rach_ind && rach_ind->number_of_pdus > 0) if (rach_ind && rach_ind->number_of_pdus > 0) {
{
NR_UL_IND_t UL_INFO = { NR_UL_IND_t UL_INFO = {
.rach_ind = *rach_ind, .rach_ind = *rach_ind,
}; };
...@@ -297,43 +243,6 @@ static void process_queued_nr_nfapi_msgs(NR_UE_MAC_INST_t *mac, int sfn_slot) ...@@ -297,43 +243,6 @@ static void process_queued_nr_nfapi_msgs(NR_UE_MAC_INST_t *mac, int sfn_slot)
} }
} }
static void check_nr_prach(NR_UE_MAC_INST_t *mac, nr_uplink_indication_t *ul_info, NR_PRACH_RESOURCES_t *prach_resources)
{
fapi_nr_ul_config_request_t *ul_config = get_ul_config_request(mac, ul_info->slot_tx);
if (!ul_config)
{
LOG_E(NR_MAC, "mac->ul_config is null! \n");
return;
}
if (mac->ra.ra_state != RA_SUCCEEDED)
{
AssertFatal(ul_config->number_pdus < sizeof(ul_config->ul_config_list) / sizeof(ul_config->ul_config_list[0]),
"Number of PDUS in ul_config = %d > ul_config_list num elements", ul_config->number_pdus);
fapi_nr_ul_config_prach_pdu *prach_pdu = &ul_config->ul_config_list[ul_config->number_pdus].prach_config_pdu;
uint8_t nr_prach = nr_ue_get_rach(prach_resources,
prach_pdu,
ul_info->module_id,
ul_info->cc_id,
ul_info->frame_tx,
ul_info->gNB_index,
ul_info->slot_tx);
if (nr_prach == 1)
{
L1_nsa_prach_procedures(ul_info->frame_tx, ul_info->slot_tx, prach_pdu);
ul_config->number_pdus = 0;
ul_info->ue_sched_mode = SCHED_ALL;
}
else if (nr_prach == 2)
{
LOG_I(NR_PHY, "In %s: [UE %d] RA completed, setting UE mode to PUSCH\n", __FUNCTION__, ul_info->module_id);
}
else if(nr_prach == 3)
{
LOG_I(NR_PHY, "In %s: [UE %d] RA failed, setting UE mode to PRACH\n", __FUNCTION__, ul_info->module_id);
}
}
}
static void send_vt_slot_ack(nfapi_ue_slot_indication_vt_t *vt_ue_slot_ind, uint16_t sfn_slot) static void send_vt_slot_ack(nfapi_ue_slot_indication_vt_t *vt_ue_slot_ind, uint16_t sfn_slot)
{ {
/** Send VT ACK for SLOT */ /** Send VT ACK for SLOT */
...@@ -366,8 +275,6 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg) ...@@ -366,8 +275,6 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg)
reset_queue(&nr_ul_dci_req_queue); reset_queue(&nr_ul_dci_req_queue);
reset_queue(&nr_ul_tti_req_queue); reset_queue(&nr_ul_tti_req_queue);
NR_PRACH_RESOURCES_t prach_resources;
memset(&prach_resources, 0, sizeof(prach_resources));
NR_UL_TIME_ALIGNMENT_t ul_time_alignment; NR_UL_TIME_ALIGNMENT_t ul_time_alignment;
memset(&ul_time_alignment, 0, sizeof(ul_time_alignment)); memset(&ul_time_alignment, 0, sizeof(ul_time_alignment));
int last_sfn_slot = -1; int last_sfn_slot = -1;
...@@ -430,7 +337,6 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg) ...@@ -430,7 +337,6 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg)
continue; continue;
} }
mac->ra.generate_nr_prach = 0;
int CC_id = 0; int CC_id = 0;
uint8_t gNB_id = 0; uint8_t gNB_id = 0;
nr_uplink_indication_t ul_info; nr_uplink_indication_t ul_info;
...@@ -443,7 +349,6 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg) ...@@ -443,7 +349,6 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg)
ul_info.slot_rx = slot; ul_info.slot_rx = slot;
ul_info.slot_tx = (slot + slot_ahead) % slots_per_frame; ul_info.slot_tx = (slot + slot_ahead) % slots_per_frame;
ul_info.frame_tx = (ul_info.slot_rx + slot_ahead >= slots_per_frame) ? ul_info.frame_rx + 1 : ul_info.frame_rx; ul_info.frame_tx = (ul_info.slot_rx + slot_ahead >= slots_per_frame) ? ul_info.frame_rx + 1 : ul_info.frame_rx;
ul_info.ue_sched_mode = SCHED_ALL;
if (pthread_mutex_lock(&mac->mutex_dl_info)) abort(); if (pthread_mutex_lock(&mac->mutex_dl_info)) abort();
...@@ -453,7 +358,6 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg) ...@@ -453,7 +358,6 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg)
mac->dl_info.module_id = mod_id; mac->dl_info.module_id = mod_id;
mac->dl_info.frame = frame; mac->dl_info.frame = frame;
mac->dl_info.slot = slot; mac->dl_info.slot = slot;
mac->dl_info.thread_id = 0;
mac->dl_info.dci_ind = NULL; mac->dl_info.dci_ind = NULL;
mac->dl_info.rx_ind = NULL; mac->dl_info.rx_ind = NULL;
if (ch_info) { if (ch_info) {
...@@ -466,8 +370,7 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg) ...@@ -466,8 +370,7 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg)
if (is_nr_DL_slot(get_softmodem_params()->nsa ? if (is_nr_DL_slot(get_softmodem_params()->nsa ?
mac->scc->tdd_UL_DL_ConfigurationCommon : mac->scc->tdd_UL_DL_ConfigurationCommon :
mac->scc_SIB->tdd_UL_DL_ConfigurationCommon, mac->scc_SIB->tdd_UL_DL_ConfigurationCommon,
ul_info.slot_rx)) ul_info.slot_rx)) {
{
LOG_D(NR_MAC, "slot_ind frame %d Slot %d. calling nr_ue_dl_ind() and nr_ue_dl_indication() from %s\n", ul_info.frame_rx, ul_info.slot_rx, __FUNCTION__); LOG_D(NR_MAC, "slot_ind frame %d Slot %d. calling nr_ue_dl_ind() and nr_ue_dl_indication() from %s\n", ul_info.frame_rx, ul_info.slot_rx, __FUNCTION__);
nr_ue_dl_indication(&mac->dl_info, &ul_time_alignment); nr_ue_dl_indication(&mac->dl_info, &ul_time_alignment);
} }
...@@ -480,9 +383,8 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg) ...@@ -480,9 +383,8 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg)
ul_info.slot_tx, mac->frame_type)) { ul_info.slot_tx, mac->frame_type)) {
LOG_D(NR_MAC, "Slot %d. calling nr_ue_ul_ind() and nr_ue_pucch_scheduler() from %s\n", ul_info.slot_tx, __FUNCTION__); LOG_D(NR_MAC, "Slot %d. calling nr_ue_ul_ind() and nr_ue_pucch_scheduler() from %s\n", ul_info.slot_tx, __FUNCTION__);
nr_ue_scheduler(NULL, &ul_info); nr_ue_scheduler(NULL, &ul_info);
nr_ue_prach_scheduler(mod_id, ul_info.frame_tx, ul_info.slot_tx, ul_info.thread_id); nr_ue_prach_scheduler(mod_id, ul_info.frame_tx, ul_info.slot_tx);
nr_ue_pucch_scheduler(mod_id, ul_info.frame_tx, ul_info.slot_tx, ul_info.thread_id); nr_ue_pucch_scheduler(mod_id, ul_info.frame_tx, ul_info.slot_tx, NULL);
check_nr_prach(mac, &ul_info, &prach_resources);
} }
if (!IS_SOFTMODEM_NOS1 && get_softmodem_params()->sa) { if (!IS_SOFTMODEM_NOS1 && get_softmodem_params()->sa) {
NR_UE_MAC_INST_t *mac = get_mac_inst(0); NR_UE_MAC_INST_t *mac = get_mac_inst(0);
...@@ -599,17 +501,7 @@ static void UE_synch(void *arg) { ...@@ -599,17 +501,7 @@ static void UE_synch(void *arg) {
openair0_cfg[UE->rf_map.card].rx_freq[0], openair0_cfg[UE->rf_map.card].rx_freq[0],
openair0_cfg[UE->rf_map.card].tx_freq[0]); openair0_cfg[UE->rf_map.card].tx_freq[0]);
if (UE->mode != loop_through_memory) { UE->rfdevice.trx_set_freq_func(&UE->rfdevice,&openair0_cfg[0]);
UE->rfdevice.trx_set_freq_func(&UE->rfdevice,&openair0_cfg[0],0);
//UE->rfdevice.trx_set_gains_func(&openair0,&openair0_cfg[0]);
//UE->rfdevice.trx_stop_func(&UE->rfdevice);
// sleep(1);
/*if (UE->rfdevice.trx_start_func(&UE->rfdevice) != 0 ) {
LOG_E(HW,"Could not start the device\n");
oai_exit=1;
}*/
}
if (UE->UE_scan_carrier == 1) { if (UE->UE_scan_carrier == 1) {
UE->UE_scan_carrier = 0; UE->UE_scan_carrier = 0;
} else { } else {
...@@ -628,8 +520,7 @@ static void UE_synch(void *arg) { ...@@ -628,8 +520,7 @@ static void UE_synch(void *arg) {
LOG_I(PHY, "Initial sync failed: trying carrier off %d Hz\n", freq_offset); LOG_I(PHY, "Initial sync failed: trying carrier off %d Hz\n", freq_offset);
if (UE->mode != loop_through_memory) UE->rfdevice.trx_set_freq_func(&UE->rfdevice,&openair0_cfg[0]);
UE->rfdevice.trx_set_freq_func(&UE->rfdevice,&openair0_cfg[0],0);
} }
} }
break; break;
...@@ -701,9 +592,6 @@ void processSlotTX(void *arg) { ...@@ -701,9 +592,6 @@ void processSlotTX(void *arg) {
nr_rxtx_thread_data_t *rxtxD = (nr_rxtx_thread_data_t *) arg; nr_rxtx_thread_data_t *rxtxD = (nr_rxtx_thread_data_t *) arg;
UE_nr_rxtx_proc_t *proc = &rxtxD->proc; UE_nr_rxtx_proc_t *proc = &rxtxD->proc;
PHY_VARS_NR_UE *UE = rxtxD->UE; PHY_VARS_NR_UE *UE = rxtxD->UE;
fapi_nr_config_request_t *cfg = &UE->nrUE_config;
int tx_slot_type = nr_ue_slot_select(cfg, proc->frame_tx, proc->nr_slot_tx);
uint8_t gNB_id = 0;
nr_phy_data_tx_t phy_data = {0}; nr_phy_data_tx_t phy_data = {0};
LOG_D(PHY,"%d.%d => slot type %d\n", proc->frame_tx, proc->nr_slot_tx, proc->tx_slot_type); LOG_D(PHY,"%d.%d => slot type %d\n", proc->frame_tx, proc->nr_slot_tx, proc->tx_slot_type);
...@@ -723,17 +611,13 @@ void processSlotTX(void *arg) { ...@@ -723,17 +611,13 @@ void processSlotTX(void *arg) {
ul_indication.slot_rx = proc->nr_slot_rx; ul_indication.slot_rx = proc->nr_slot_rx;
ul_indication.frame_tx = proc->frame_tx; ul_indication.frame_tx = proc->frame_tx;
ul_indication.slot_tx = proc->nr_slot_tx; ul_indication.slot_tx = proc->nr_slot_tx;
ul_indication.thread_id = proc->thread_id;
ul_indication.ue_sched_mode = rxtxD->ue_sched_mode;
ul_indication.phy_data = &phy_data; ul_indication.phy_data = &phy_data;
UE->if_inst->ul_indication(&ul_indication); UE->if_inst->ul_indication(&ul_indication);
stop_meas(&UE->ue_ul_indication_stats); stop_meas(&UE->ue_ul_indication_stats);
} }
if ((UE->mode != loop_through_memory) && (rxtxD->ue_sched_mode != NOT_PUSCH)) { phy_procedures_nrUE_TX(UE, proc, &phy_data);
phy_procedures_nrUE_TX(UE,proc,0);
}
} }
RU_write(rxtxD); RU_write(rxtxD);
...@@ -741,13 +625,8 @@ void processSlotTX(void *arg) { ...@@ -741,13 +625,8 @@ void processSlotTX(void *arg) {
void UE_processing(nr_rxtx_thread_data_t *rxtxD) { void UE_processing(nr_rxtx_thread_data_t *rxtxD) {
nr_rxtx_thread_data_t *rxtxD = (nr_rxtx_thread_data_t *) arg;
UE_nr_rxtx_proc_t *proc = &rxtxD->proc; UE_nr_rxtx_proc_t *proc = &rxtxD->proc;
PHY_VARS_NR_UE *UE = rxtxD->UE; PHY_VARS_NR_UE *UE = rxtxD->UE;
fapi_nr_config_request_t *cfg = &UE->nrUE_config;
int rx_slot_type = nr_ue_slot_select(cfg, proc->frame_rx, proc->nr_slot_rx);
int tx_slot_type = nr_ue_slot_select(cfg, proc->frame_tx, proc->nr_slot_tx);
uint8_t gNB_id = 0;
nr_phy_data_t phy_data = {0}; nr_phy_data_t phy_data = {0};
if (IS_SOFTMODEM_NOS1 || get_softmodem_params()->sa) { if (IS_SOFTMODEM_NOS1 || get_softmodem_params()->sa) {
...@@ -783,39 +662,6 @@ void UE_processing(nr_rxtx_thread_data_t *rxtxD) { ...@@ -783,39 +662,6 @@ void UE_processing(nr_rxtx_thread_data_t *rxtxD) {
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, UE->Mod_id, ENB_FLAG_NO, mac->crnti, proc->frame_rx, proc->nr_slot_rx, 0); PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, UE->Mod_id, ENB_FLAG_NO, mac->crnti, proc->frame_rx, proc->nr_slot_rx, 0);
pdcp_run(&ctxt); pdcp_run(&ctxt);
} }
// Wait for PUSCH processing to finish
notifiedFIFO_elt_t *res;
res = pullTpool(&rxtxD->txFifo,&(get_nrUE_params()->Tpool));
delNotifiedFIFO_elt(res);
// calling UL_indication to schedule things other than PUSCH (eg, PUCCH)
rxtxD->ue_sched_mode = NOT_PUSCH;
processSlotTX(rxtxD);
} else {
rxtxD->ue_sched_mode = SCHED_ALL;
processSlotTX(rxtxD);
}
if (tx_slot_type == NR_UPLINK_SLOT || tx_slot_type == NR_MIXED_SLOT){
if (UE->UE_mode[gNB_id] <= PUSCH) {
if (get_softmodem_params()->usim_test==0) {
pucch_procedures_ue_nr(UE,
gNB_id,
proc);
}
LOG_D(PHY, "Sending Uplink data \n");
nr_ue_pusch_common_procedures(UE,
proc->nr_slot_tx,
&UE->frame_parms,1);
}
if (UE->UE_mode[gNB_id] > NOT_SYNCHED && UE->UE_mode[gNB_id] < PUSCH) {
nr_ue_prach_procedures(UE, proc, gNB_id);
}
LOG_D(PHY,"****** end TX-Chain for AbsSubframe %d.%d ******\n", proc->frame_tx, proc->nr_slot_tx);
} }
ue_ta_procedures(UE, proc->nr_slot_tx, proc->frame_tx); ue_ta_procedures(UE, proc->nr_slot_tx, proc->frame_tx);
...@@ -836,8 +682,6 @@ void dummyWrite(PHY_VARS_NR_UE *UE,openair0_timestamp timestamp, int writeBlockS ...@@ -836,8 +682,6 @@ void dummyWrite(PHY_VARS_NR_UE *UE,openair0_timestamp timestamp, int writeBlockS
UE->frame_parms.nb_antennas_tx, UE->frame_parms.nb_antennas_tx,
4),""); 4),"");
for (int i=0; i<UE->frame_parms.nb_antennas_tx; i++)
free(dummy_tx[i]);
} }
void readFrame(PHY_VARS_NR_UE *UE, openair0_timestamp *timestamp, bool toTrash) { void readFrame(PHY_VARS_NR_UE *UE, openair0_timestamp *timestamp, bool toTrash) {
...@@ -924,7 +768,7 @@ void *UE_thread(void *arg) { ...@@ -924,7 +768,7 @@ void *UE_thread(void *arg) {
PHY_VARS_NR_UE *UE = (PHY_VARS_NR_UE *) arg; PHY_VARS_NR_UE *UE = (PHY_VARS_NR_UE *) arg;
// int tx_enabled = 0; // int tx_enabled = 0;
openair0_timestamp timestamp, writeTimestamp; openair0_timestamp timestamp, writeTimestamp;
void *rxp[NB_ANTENNAS_RX], *txp[NB_ANTENNAS_TX]; void *rxp[NB_ANTENNAS_RX];
int start_rx_stream = 0; int start_rx_stream = 0;
fapi_nr_config_request_t *cfg = &UE->nrUE_config; fapi_nr_config_request_t *cfg = &UE->nrUE_config;
AssertFatal(0== openair0_device_load(&(UE->rfdevice), &openair0_cfg[0]), ""); AssertFatal(0== openair0_device_load(&(UE->rfdevice), &openair0_cfg[0]), "");
...@@ -949,21 +793,8 @@ void *UE_thread(void *arg) { ...@@ -949,21 +793,8 @@ void *UE_thread(void *arg) {
const int nb_slot_frame = UE->frame_parms.slots_per_frame; const int nb_slot_frame = UE->frame_parms.slots_per_frame;
int absolute_slot=0, decoded_frame_rx=INT_MAX, trashed_frames=0; int absolute_slot=0, decoded_frame_rx=INT_MAX, trashed_frames=0;
for (int i=0; i<NR_RX_NB_TH+1; i++) {// NR_RX_NB_TH working + 1 we are making to be pushed
notifiedFIFO_elt_t *newElt = newNotifiedFIFO_elt(sizeof(nr_rxtx_thread_data_t), RX_JOB_ID,&nf,processSlotRX);
nr_rxtx_thread_data_t *curMsg=(nr_rxtx_thread_data_t *)NotifiedFifoData(newElt);
initNotifiedFIFO(&curMsg->txFifo);
pushNotifiedFIFO_nothreadSafe(&freeBlocks, newElt);
}
while (!oai_exit) { while (!oai_exit) {
if (UE->lost_sync) { if (UE->lost_sync) {
int nb = abortTpool(&(get_nrUE_params()->Tpool),RX_JOB_ID);
nb += abortNotifiedFIFO(&nf, RX_JOB_ID);
LOG_I(PHY,"Number of aborted slots %d\n",nb);
for (int i=0; i<nb; i++)
pushNotifiedFIFO_nothreadSafe(&freeBlocks, newNotifiedFIFO_elt(sizeof(nr_rxtx_thread_data_t), RX_JOB_ID,&nf,processSlotRX));
nbSlotProcessing = 0;
UE->is_synchronized = 0; UE->is_synchronized = 0;
UE->lost_sync = 0; UE->lost_sync = 0;
} }
...@@ -1025,11 +856,6 @@ void *UE_thread(void *arg) { ...@@ -1025,11 +856,6 @@ void *UE_thread(void *arg) {
absolute_slot++; absolute_slot++;
// whatever means thread_idx
// Fix me: will be wrong when slot 1 is slow, as slot 2 finishes
// Slot 3 will overlap if NR_RX_NB_TH is 2
// this is general failure in UE !!!
thread_idx = absolute_slot % NR_RX_NB_TH;
int slot_nr = absolute_slot % nb_slot_frame; int slot_nr = absolute_slot % nb_slot_frame;
nr_rxtx_thread_data_t curMsg = {0}; nr_rxtx_thread_data_t curMsg = {0};
curMsg.UE=UE; curMsg.UE=UE;
...@@ -1058,10 +884,6 @@ void *UE_thread(void *arg) { ...@@ -1058,10 +884,6 @@ void *UE_thread(void *arg) {
rxp[i] = (void *)&UE->common_vars.rxdata[i][firstSymSamp+ rxp[i] = (void *)&UE->common_vars.rxdata[i][firstSymSamp+
UE->frame_parms.get_samples_slot_timestamp(slot_nr,&UE->frame_parms,0)]; UE->frame_parms.get_samples_slot_timestamp(slot_nr,&UE->frame_parms,0)];
for (int i=0; i<UE->frame_parms.nb_antennas_tx; i++)
txp[i] = (void *)&UE->common_vars.txdata[i][UE->frame_parms.get_samples_slot_timestamp(
((slot_nr + DURATION_RX_TO_TX - NR_RX_NB_TH)%nb_slot_frame),&UE->frame_parms,0)];
int readBlockSize, writeBlockSize; int readBlockSize, writeBlockSize;
if (slot_nr<(nb_slot_frame - 1)) { if (slot_nr<(nb_slot_frame - 1)) {
...@@ -1097,29 +919,6 @@ void *UE_thread(void *arg) { ...@@ -1097,29 +919,6 @@ void *UE_thread(void *arg) {
LOG_E(PHY,"can't compensate: diff =%d\n", first_symbols); LOG_E(PHY,"can't compensate: diff =%d\n", first_symbols);
} }
curMsg->proc.timestamp_tx = timestamp+
UE->frame_parms.get_samples_slot_timestamp(slot_nr,&UE->frame_parms,DURATION_RX_TO_TX)
- firstSymSamp;
notifiedFIFO_elt_t *res;
while (nbSlotProcessing >= NR_RX_NB_TH) {
res=pullTpool(&nf, &(get_nrUE_params()->Tpool));
nbSlotProcessing--;
nr_rxtx_thread_data_t *tmp=(nr_rxtx_thread_data_t *)res->msgData;
if (tmp->proc.decoded_frame_rx != -1)
decoded_frame_rx=(((mac->mib->systemFrameNumber.buf[0] >> mac->mib->systemFrameNumber.bits_unused)<<4) | tmp->proc.decoded_frame_rx);
else
decoded_frame_rx=-1;
pushNotifiedFIFO_nothreadSafe(&freeBlocks,res);
}
if (decoded_frame_rx>0 && decoded_frame_rx != curMsg->proc.frame_rx)
LOG_E(PHY,"Decoded frame index (%d) is not compatible with current context (%d), UE should go back to synch mode\n",
decoded_frame_rx, curMsg->proc.frame_rx);
// use previous timing_advance value to compute writeTimestamp // use previous timing_advance value to compute writeTimestamp
writeTimestamp = timestamp+ writeTimestamp = timestamp+
UE->frame_parms.get_samples_slot_timestamp(slot_nr,&UE->frame_parms,DURATION_RX_TO_TX) UE->frame_parms.get_samples_slot_timestamp(slot_nr,&UE->frame_parms,DURATION_RX_TO_TX)
......
...@@ -1713,100 +1713,98 @@ schedule_ulsch(module_id_t module_idP, ...@@ -1713,100 +1713,98 @@ schedule_ulsch(module_id_t module_idP,
sched_frame = frameP; sched_frame = frameP;
/* Note: RC.nb_mac_CC[module_idP] should be lower than or equal to NFAPI_CC_MAX */ /* MultiCell: Common channels modify for multiple CC */
for (int CC_id = 0; CC_id < RC.nb_mac_CC[module_idP]; CC_id++, cc++) { cc = &RC.mac[module_idP]->common_channels[CC_id];
/* MultiCell: Common channels modify for multiple CC */
cc = &RC.mac[module_idP]->common_channels[CC_id]; /* For TDD: check subframes where we have to act and return if nothing should be done now */
if (cc->tdd_Config) { // Done only for CC_id = 0, assume tdd_Config for all CC_id
/* For TDD: check subframes where we have to act and return if nothing should be done now */ int tdd_sfa = cc->tdd_Config->subframeAssignment;
if (cc->tdd_Config) { // Done only for CC_id = 0, assume tdd_Config for all CC_id
int tdd_sfa = cc->tdd_Config->subframeAssignment; switch (subframeP) {
case 0:
switch (subframeP) { if ((tdd_sfa == 0) || (tdd_sfa == 3))
case 0: sched_subframe = 4;
if ((tdd_sfa == 0) || (tdd_sfa == 3)) else if (tdd_sfa == 6)
sched_subframe = 4; sched_subframe = 7;
else if (tdd_sfa == 6) else
sched_subframe = 7; return;
else
return;
break;
case 1:
if ((tdd_sfa == 0) || (tdd_sfa == 1))
sched_subframe = 7;
else if (tdd_sfa == 6)
sched_subframe = 8;
else
return;
break; break;
case 2: // Don't schedule UL in subframe 2 for TDD case 1:
if ((tdd_sfa == 0) || (tdd_sfa == 1))
sched_subframe = 7;
else if (tdd_sfa == 6)
sched_subframe = 8;
else
return; return;
case 3: break;
if (tdd_sfa == 2)
sched_subframe = 7;
else
return;
break; case 2: // Don't schedule UL in subframe 2 for TDD
return;
case 4: case 3:
if (tdd_sfa == 1) if (tdd_sfa == 2)
sched_subframe = 8; sched_subframe = 7;
else else
return; return;
break; break;
case 5: case 4:
if (tdd_sfa == 0) if (tdd_sfa == 1)
sched_subframe = 9; sched_subframe = 8;
else if (tdd_sfa == 6) else
sched_subframe = 2; return;
else
return;
break; break;
case 6: case 5:
if (tdd_sfa == 0 || tdd_sfa == 1) if (tdd_sfa == 0)
sched_subframe = 2; sched_subframe = 9;
else if (tdd_sfa == 6) else if (tdd_sfa == 6)
sched_subframe = 3; sched_subframe = 2;
else else
return; return;
break; break;
case 7: case 6:
if (tdd_sfa == 0 || tdd_sfa == 1)
sched_subframe = 2;
else if (tdd_sfa == 6)
sched_subframe = 3;
else
return; return;
case 8: break;
if ((tdd_sfa >= 2) && (tdd_sfa <= 5))
sched_subframe = 2;
else
return;
break; case 7:
return;
case 9: case 8:
if ((tdd_sfa == 1) || (tdd_sfa == 3) || (tdd_sfa == 4)) if ((tdd_sfa >= 2) && (tdd_sfa <= 5))
sched_subframe = 3; sched_subframe = 2;
else if (tdd_sfa == 6) else
sched_subframe = 4; return;
else
return;
break; break;
default: case 9:
if ((tdd_sfa == 1) || (tdd_sfa == 3) || (tdd_sfa == 4))
sched_subframe = 3;
else if (tdd_sfa == 6)
sched_subframe = 4;
else
return; return;
}
break;
default:
return;
} }
}
if (sched_subframe < subframeP) { if (sched_subframe < subframeP) {
sched_frame++; sched_frame++;
...@@ -1817,6 +1815,9 @@ schedule_ulsch(module_id_t module_idP, ...@@ -1817,6 +1815,9 @@ schedule_ulsch(module_id_t module_idP,
memset(emtc_active, 0, 5 * sizeof(int)); memset(emtc_active, 0, 5 * sizeof(int));
schedule_ulsch_rnti_emtc(module_idP, frameP, subframeP, sched_subframe, emtc_active); schedule_ulsch_rnti_emtc(module_idP, frameP, subframeP, sched_subframe, emtc_active);
/* Note: RC.nb_mac_CC[module_idP] should be lower than or equal to NFAPI_CC_MAX */
for (int CC_id = 0; CC_id < RC.nb_mac_CC[module_idP]; CC_id++, cc++) {
if (is_prach_subframe0(cc->tdd_Config!=NULL ? cc->tdd_Config->subframeAssignment : 0,cc->tdd_Config!=NULL ? 1 : 0, if (is_prach_subframe0(cc->tdd_Config!=NULL ? cc->tdd_Config->subframeAssignment : 0,cc->tdd_Config!=NULL ? 1 : 0,
cc->radioResourceConfigCommon->prach_Config.prach_ConfigInfo.prach_ConfigIndex, cc->radioResourceConfigCommon->prach_Config.prach_ConfigInfo.prach_ConfigIndex,
sched_frame, sched_subframe)) { sched_frame, sched_subframe)) {
......
...@@ -1535,8 +1535,8 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra ...@@ -1535,8 +1535,8 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
rbStart, rbStart,
BWPSize, BWPSize,
BWPStart, BWPStart,
startSymbolIndex, msg4_tda.startSymbolIndex,
nrOfSymbols); msg4_tda.nrOfSymbols);
if (RC.ss.mode == SS_SOFTMODEM) if (RC.ss.mode == SS_SOFTMODEM)
BWPStart = 27; BWPStart = 27;
...@@ -1788,7 +1788,7 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra ...@@ -1788,7 +1788,7 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
} }
T(T_GNB_MAC_DL_PDU_WITH_DATA, T_INT(module_idP), T_INT(CC_id), T_INT(ra->rnti), T(T_GNB_MAC_DL_PDU_WITH_DATA, T_INT(module_idP), T_INT(CC_id), T_INT(ra->rnti),
T_INT(frameP), T_INT(slotP), T_INT(current_harq_pid), T_BUFFER(harq->tb, harq->tb_size)); T_INT(frameP), T_INT(slotP), T_INT(current_harq_pid), T_BUFFER(harq->transportBlock, harq->tb_size));
// Trace MACPDU // Trace MACPDU
mac_pkt_info_t mac_pkt; mac_pkt_info_t mac_pkt;
...@@ -1797,7 +1797,7 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra ...@@ -1797,7 +1797,7 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
mac_pkt.rnti = ra->rnti; mac_pkt.rnti = ra->rnti;
mac_pkt.harq_pid = current_harq_pid; mac_pkt.harq_pid = current_harq_pid;
mac_pkt.preamble = -1; /* TODO */ mac_pkt.preamble = -1; /* TODO */
LOG_MAC_P(OAILOG_DEBUG, "MAC_DL_PDU", frameP, slotP, mac_pkt, (uint8_t *)harq->tb, (int)harq->tb_size); LOG_MAC_P(OAILOG_DEBUG, "MAC_DL_PDU", frameP, slotP, mac_pkt, (uint8_t *)harq->transportBlock, (int)harq->tb_size);
// DL TX request // DL TX request
nfapi_nr_pdu_t *tx_req = &nr_mac->TX_req[CC_id].pdu_list[nr_mac->TX_req[CC_id].Number_of_PDUs]; nfapi_nr_pdu_t *tx_req = &nr_mac->TX_req[CC_id].pdu_list[nr_mac->TX_req[CC_id].Number_of_PDUs];
......
...@@ -355,7 +355,6 @@ uint32_t schedule_control_sib1(module_id_t module_id, ...@@ -355,7 +355,6 @@ uint32_t schedule_control_sib1(module_id_t module_id,
int mcsTableIdx = 0; int mcsTableIdx = 0;
int rbSize = 0; int rbSize = 0;
uint32_t TBS = 0; uint32_t TBS = 0;
LOG_D(MAC,"bwpSize:%d rbStart:%d rbSize:%d startSymbolIndex,:%d nrOfSymbols:%d\n",bwpSize, rbStart, rbSize, startSymbolIndex, nrOfSymbols);
do { do {
if(rbSize < bwpSize && !(vrb_map[rbStart + rbSize]&SL_to_bitmap(tda_info->startSymbolIndex, tda_info->nrOfSymbols))) if(rbSize < bwpSize && !(vrb_map[rbStart + rbSize]&SL_to_bitmap(tda_info->startSymbolIndex, tda_info->nrOfSymbols)))
rbSize++; rbSize++;
...@@ -460,10 +459,9 @@ void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP, ...@@ -460,10 +459,9 @@ void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP,
pdsch_pdu_rel15->rbStart = pdsch->rbStart; pdsch_pdu_rel15->rbStart = pdsch->rbStart;
pdsch_pdu_rel15->rbSize = pdsch->rbSize; pdsch_pdu_rel15->rbSize = pdsch->rbSize;
pdsch_pdu_rel15->VRBtoPRBMapping = 0; pdsch_pdu_rel15->VRBtoPRBMapping = 0;
pdsch_pdu_rel15->qamModOrder[0] = nr_get_Qm_dl(gNB_mac->sched_ctrlCommon->sched_pdsch.mcs, pdsch_pdu_rel15->qamModOrder[0] = nr_get_Qm_dl(pdsch->mcs, mcsTableIdx);
gNB_mac->sched_ctrlCommon->pdsch_semi_static.mcsTableIdx);
pdsch_pdu_rel15->TBSize[0] = TBS; pdsch_pdu_rel15->TBSize[0] = TBS;
pdsch_pdu_rel15->mcsTable[0] = gNB_mac->sched_ctrlCommon->pdsch_semi_static.mcsTableIdx; pdsch_pdu_rel15->mcsTable[0] = mcsTableIdx;
pdsch_pdu_rel15->StartSymbolIndex = StartSymbolIndex; pdsch_pdu_rel15->StartSymbolIndex = StartSymbolIndex;
pdsch_pdu_rel15->NrOfSymbols = NrOfSymbols; pdsch_pdu_rel15->NrOfSymbols = NrOfSymbols;
pdsch_pdu_rel15->dlDmrsSymbPos = pdsch->dmrs_parms.dl_dmrs_symb_pos; pdsch_pdu_rel15->dlDmrsSymbPos = pdsch->dmrs_parms.dl_dmrs_symb_pos;
......
...@@ -1186,7 +1186,7 @@ void nr_schedule_ue_spec(module_id_t module_id, ...@@ -1186,7 +1186,7 @@ void nr_schedule_ue_spec(module_id_t module_id,
mac_pkt.rnti = rnti; mac_pkt.rnti = rnti;
mac_pkt.harq_pid = current_harq_pid; mac_pkt.harq_pid = current_harq_pid;
mac_pkt.preamble = -1; /* TODO */ mac_pkt.preamble = -1; /* TODO */
LOG_MAC_P(OAILOG_DEBUG, "MAC_RETRANSMISSION_DL_PDU", frame, slot, mac_pkt, (uint8_t *)harq->tb, (int)TBS); LOG_MAC_P(OAILOG_DEBUG, "MAC_RETRANSMISSION_DL_PDU", frame, slot, mac_pkt, (uint8_t *)harq->transportBlock, (int)TBS);
} else { /* initial transmission */ } else { /* initial transmission */
LOG_D(NR_MAC, "[%s] Initial HARQ transmission in %d.%d\n", __FUNCTION__, frame, slot); LOG_D(NR_MAC, "[%s] Initial HARQ transmission in %d.%d\n", __FUNCTION__, frame, slot);
...@@ -1332,7 +1332,7 @@ void nr_schedule_ue_spec(module_id_t module_id, ...@@ -1332,7 +1332,7 @@ void nr_schedule_ue_spec(module_id_t module_id,
mac_pkt.rnti = rnti; mac_pkt.rnti = rnti;
mac_pkt.harq_pid = current_harq_pid; mac_pkt.harq_pid = current_harq_pid;
mac_pkt.preamble = -1; /* TODO */ mac_pkt.preamble = -1; /* TODO */
LOG_MAC_P(OAILOG_DEBUG, "MAC_DL_PDU", frame, slot, mac_pkt, (uint8_t *)harq->tb, (int)TBS); LOG_MAC_P(OAILOG_DEBUG, "MAC_DL_PDU", frame, slot, mac_pkt, (uint8_t *)harq->transportBlock, (int)TBS);
} }
const int ntx_req = gNB_mac->TX_req[CC_id].Number_of_PDUs; const int ntx_req = gNB_mac->TX_req[CC_id].Number_of_PDUs;
......
...@@ -3173,7 +3173,7 @@ void send_initial_ul_rrc_message(module_id_t module_id, ...@@ -3173,7 +3173,7 @@ void send_initial_ul_rrc_message(module_id_t module_id,
const NR_ServingCellConfigCommon_t *scc = RC.nrrrc[module_id]->carrier.servingcellconfigcommon; const NR_ServingCellConfigCommon_t *scc = RC.nrrrc[module_id]->carrier.servingcellconfigcommon;
const NR_ServingCellConfig_t *sccd = RC.nrrrc[module_id]->configuration.scd; const NR_ServingCellConfig_t *sccd = RC.nrrrc[module_id]->configuration.scd;
NR_CellGroupConfig_t cellGroupConfig = {0}; NR_CellGroupConfig_t cellGroupConfig = {0};
fill_initial_cellGroupConfig(uid, &cellGroupConfig, scc, sccd, &RC.nrrrc[module_id]->configuration); fill_initial_cellGroupConfig(uid, &cellGroupConfig, scc, sccd, &RC.nrrrc[module_id]->configuration,CC_id);
uint8_t du2cu_rrc_container[1024]; uint8_t du2cu_rrc_container[1024];
asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_CellGroupConfig, asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_CellGroupConfig,
......
...@@ -320,17 +320,8 @@ int nr_process_mac_pdu(instance_t module_idP, ...@@ -320,17 +320,8 @@ int nr_process_mac_pdu(instance_t module_idP,
return 0; return 0;
} }
case UL_SCH_LCID_DTCH ... (UL_SCH_LCID_DTCH + 4): if (pdu_len < mac_subheader_len + mac_len)
// check if LCID is valid at current time. return 0;
if (pdu_len < sizeof(NR_MAC_SUBHEADER_SHORT))
return 0;
if (((NR_MAC_SUBHEADER_SHORT *)pduP)->F) {
// mac_sdu_len |= (uint16_t)(((NR_MAC_SUBHEADER_LONG *)pduP)->L2)<<8;
if (pdu_len < sizeof(NR_MAC_SUBHEADER_LONG))
return 0;
mac_subheader_len = 3;
mac_sdu_len = ((uint16_t)(((NR_MAC_SUBHEADER_LONG *)pduP)->L1 & 0x7f) << 8)
| ((uint16_t)((NR_MAC_SUBHEADER_LONG *)pduP)->L2 & 0xff);
rnti_t crnti = UE->rnti; rnti_t crnti = UE->rnti;
NR_UE_info_t* UE_idx = UE; NR_UE_info_t* UE_idx = UE;
...@@ -410,7 +401,7 @@ int nr_process_mac_pdu(instance_t module_idP, ...@@ -410,7 +401,7 @@ int nr_process_mac_pdu(instance_t module_idP,
nr_rlc_activate_srb0(UE->rnti, module_idP, CC_id, UE->uid, send_initial_ul_rrc_message); nr_rlc_activate_srb0(UE->rnti, module_idP, CC_id, UE->uid, send_initial_ul_rrc_message);
if (pdu_len < mac_subheader_len + mac_ce_len + mac_sdu_len) if (pdu_len < mac_subheader_len + mac_len)
return 0; return 0;
mac_rlc_data_ind(module_idP, mac_rlc_data_ind(module_idP,
......
...@@ -257,7 +257,7 @@ static void do_pdcp_data_ind( ...@@ -257,7 +257,7 @@ static void do_pdcp_data_ind(
/** TRACE PDCP PDU */ /** TRACE PDCP PDU */
nr_pdcp_pkt_info_t pdcp_pkt; nr_pdcp_pkt_info_t pdcp_pkt;
pdcp_pkt.direction = 0; //PDCP_NR_DIRECTION_UPLINK pdcp_pkt.direction = 0; //PDCP_NR_DIRECTION_UPLINK
pdcp_pkt.ueid = rnti; pdcp_pkt.ueid = rntiMaybeUEid;
if (ctxt_pP->enb_flag) if (ctxt_pP->enb_flag)
T(T_ENB_PDCP_UL, T_INT(ctxt_pP->module_id), T_INT(rntiMaybeUEid), T_INT(rb_id), T_INT(sdu_buffer_size)); T(T_ENB_PDCP_UL, T_INT(ctxt_pP->module_id), T_INT(rntiMaybeUEid), T_INT(rb_id), T_INT(sdu_buffer_size));
...@@ -817,7 +817,7 @@ srb_found: ...@@ -817,7 +817,7 @@ srb_found:
SS_NRRRC_PDU_IND (message_p).sdu_size = size; SS_NRRRC_PDU_IND (message_p).sdu_size = size;
SS_NRRRC_PDU_IND (message_p).srb_id = srb_id; SS_NRRRC_PDU_IND (message_p).srb_id = srb_id;
SS_NRRRC_PDU_IND (message_p).frame = nr_pdcp_current_time_last_frame; SS_NRRRC_PDU_IND (message_p).frame = nr_pdcp_current_time_last_frame;
SS_NRRRC_PDU_IND (message_p).rnti = ue->rnti; SS_NRRRC_PDU_IND (message_p).rnti = ue->rntiMaybeUEid;
SS_NRRRC_PDU_IND (message_p).subframe = nr_pdcp_current_time_last_subframe; SS_NRRRC_PDU_IND (message_p).subframe = nr_pdcp_current_time_last_subframe;
memset (SS_NRRRC_PDU_IND (message_p).sdu, 0, SDU_SIZE); memset (SS_NRRRC_PDU_IND (message_p).sdu, 0, SDU_SIZE);
memcpy (SS_NRRRC_PDU_IND (message_p).sdu, buf, size); memcpy (SS_NRRRC_PDU_IND (message_p).sdu, buf, size);
...@@ -827,8 +827,8 @@ srb_found: ...@@ -827,8 +827,8 @@ srb_found:
LOG_E(PDCP,"Error in sending DCCH_PDU_IND/SS_NRRRC_PDU_IND(msg_Id:%d) to TASK_SS_SRB_GNB\n", SS_NRRRC_PDU_IND); LOG_E(PDCP,"Error in sending DCCH_PDU_IND/SS_NRRRC_PDU_IND(msg_Id:%d) to TASK_SS_SRB_GNB\n", SS_NRRRC_PDU_IND);
} }
} }
} }
{ {
if (entity->is_gnb) { if (entity->is_gnb) {
MessageDef *message_p = itti_alloc_new_message(TASK_PDCP_GNB, 0, F1AP_UL_RRC_MESSAGE); MessageDef *message_p = itti_alloc_new_message(TASK_PDCP_GNB, 0, F1AP_UL_RRC_MESSAGE);
AssertFatal(message_p != NULL, "OUT OF MEMORY\n"); AssertFatal(message_p != NULL, "OUT OF MEMORY\n");
...@@ -851,6 +851,7 @@ srb_found: ...@@ -851,6 +851,7 @@ srb_found:
NR_RRC_DCCH_DATA_IND(message_p).sdu_size = size; NR_RRC_DCCH_DATA_IND(message_p).sdu_size = size;
NR_RRC_DCCH_DATA_IND(message_p).rnti = ue->rntiMaybeUEid; NR_RRC_DCCH_DATA_IND(message_p).rnti = ue->rntiMaybeUEid;
itti_send_msg_to_task(TASK_RRC_NRUE, 0, message_p); itti_send_msg_to_task(TASK_RRC_NRUE, 0, message_p);
}
} }
} }
...@@ -1162,7 +1163,7 @@ void nr_pdcp_add_drbs(eNB_flag_t enb_flag, ...@@ -1162,7 +1163,7 @@ void nr_pdcp_add_drbs(eNB_flag_t enb_flag,
if (drb2add_list != NULL) { if (drb2add_list != NULL) {
for (int i = 0; i < drb2add_list->list.count; i++) { for (int i = 0; i < drb2add_list->list.count; i++) {
if (rlc_bearer2add_list != NULL) { if (rlc_bearer2add_list != NULL) {
for (j = 0; j < rlc_bearer2add_list->list.count; j++){ for (int j = 0; j < rlc_bearer2add_list->list.count; j++){
if (rlc_bearer2add_list->list.array[j]->servedRadioBearer != NULL){ if (rlc_bearer2add_list->list.array[j]->servedRadioBearer != NULL){
if (rlc_bearer2add_list->list.array[j]->servedRadioBearer->present == NR_RLC_BearerConfig__servedRadioBearer_PR_drb_Identity){ if (rlc_bearer2add_list->list.array[j]->servedRadioBearer->present == NR_RLC_BearerConfig__servedRadioBearer_PR_drb_Identity){
if (drb2add_list->list.array[i]->drb_Identity == rlc_bearer2add_list->list.array[j]->servedRadioBearer->choice.drb_Identity){ if (drb2add_list->list.array[i]->drb_Identity == rlc_bearer2add_list->list.array[j]->servedRadioBearer->choice.drb_Identity){
...@@ -1365,7 +1366,7 @@ static bool pdcp_data_req_srb(protocol_ctxt_t *ctxt_pP, ...@@ -1365,7 +1366,7 @@ static bool pdcp_data_req_srb(protocol_ctxt_t *ctxt_pP,
nr_pdcp_pkt_info_t pdcp_pkt; nr_pdcp_pkt_info_t pdcp_pkt;
memset(&pdcp_pkt, 0, sizeof(pdcp_pkt)); memset(&pdcp_pkt, 0, sizeof(pdcp_pkt));
pdcp_pkt.direction = 1; //PDCP_NR_DIRECTION_DOWNLINK pdcp_pkt.direction = 1; //PDCP_NR_DIRECTION_DOWNLINK
pdcp_pkt.ueid = ue->rnti; pdcp_pkt.ueid = ue->rntiMaybeUEid;
pdcp_pkt.bearerType = 8; //TODO pdcp_pkt.bearerType = 8; //TODO
pdcp_pkt.bearerId = rb_id - 1; pdcp_pkt.bearerId = rb_id - 1;
pdcp_pkt.plane = (rb_id == 1)?4:1; pdcp_pkt.plane = (rb_id == 1)?4:1;
...@@ -1445,7 +1446,7 @@ static bool pdcp_data_req_drb(protocol_ctxt_t *ctxt_pP, ...@@ -1445,7 +1446,7 @@ static bool pdcp_data_req_drb(protocol_ctxt_t *ctxt_pP,
pdcp_pkt.direction = 1; //PDCP_NR_DIRECTION_DOWNLINK pdcp_pkt.direction = 1; //PDCP_NR_DIRECTION_DOWNLINK
if (ue != NULL) if (ue != NULL)
{ {
pdcp_pkt.ueid = ue->rnti; pdcp_pkt.ueid = ue->rntiMaybeUEid;
} }
pdcp_pkt.bearerType = 8; //TODO pdcp_pkt.bearerType = 8; //TODO
pdcp_pkt.bearerId = rb_id - 1; pdcp_pkt.bearerId = rb_id - 1;
......
...@@ -482,7 +482,7 @@ rlc_op_status_t enqueue_mac_rlc_data_req( ...@@ -482,7 +482,7 @@ rlc_op_status_t enqueue_mac_rlc_data_req(
const uint32_t *const destinationL2Id const uint32_t *const destinationL2Id
) )
{ {
int rnti = ctxt_pP->rnti; int rnti = ctxt_pP->rntiMaybeUEid;
nr_rlc_ue_t *ue; nr_rlc_ue_t *ue;
nr_rlc_entity_t *rb; nr_rlc_entity_t *rb;
...@@ -492,7 +492,7 @@ rlc_op_status_t enqueue_mac_rlc_data_req( ...@@ -492,7 +492,7 @@ rlc_op_status_t enqueue_mac_rlc_data_req(
if (ctxt_pP->enb_flag) if (ctxt_pP->enb_flag)
T(T_ENB_RLC_DL, T_INT(ctxt_pP->module_id), T(T_ENB_RLC_DL, T_INT(ctxt_pP->module_id),
T_INT(ctxt_pP->rnti), T_INT(rb_idP), T_INT(sdu_sizeP)); T_INT(ctxt_pP->rntiMaybeUEid), T_INT(rb_idP), T_INT(sdu_sizeP));
nr_rlc_manager_lock(nr_rlc_ue_manager); nr_rlc_manager_lock(nr_rlc_ue_manager);
ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, rnti); ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, rnti);
......
...@@ -179,91 +179,6 @@ int8_t nr_mac_rrc_bwp_switch_req(const module_id_t module_idP, ...@@ -179,91 +179,6 @@ int8_t nr_mac_rrc_bwp_switch_req(const module_id_t module_idP,
return 0; return 0;
} }
int8_t nr_mac_rrc_data_ind(const module_id_t module_idP,
const int CC_id,
const frame_t frameP,
const sub_frame_t sub_frameP,
const int UE_id,
const rnti_t rntiP,
const rb_id_t srb_idP,
const uint8_t *sduP,
const sdu_size_t sdu_lenP,
const boolean_t brOption) {
if (NODE_IS_DU(RC.nrrrc[module_idP]->node_type)) {
LOG_W(RRC,"[DU %d][RAPROC] Received SDU for CCCH on SRB %ld length %d for UE id %d RNTI %x \n",
module_idP, srb_idP, sdu_lenP, UE_id, rntiP);
// Generate DUtoCURRCContainer
// call do_RRCSetup like full procedure and extract masterCellGroup
NR_CellGroupConfig_t cellGroupConfig;
NR_ServingCellConfigCommon_t *scc=RC.nrrrc[module_idP]->carrier.servingcellconfigcommon;
memset(&cellGroupConfig,0,sizeof(cellGroupConfig));
struct rrc_gNB_ue_context_s *ue_context_p = rrc_gNB_allocate_new_UE_context(RC.nrrrc[module_idP]);
ue_context_p->ue_id_rnti = rntiP;
ue_context_p->ue_context.rnti = rntiP;
ue_context_p->ue_context.random_ue_identity = rntiP;
ue_context_p->ue_context.Srb0.Active = 1;
RB_INSERT(rrc_nr_ue_tree_s, &RC.nrrrc[module_idP]->rrc_ue_head, ue_context_p);
fill_initial_cellGroupConfig(ue_context_p->local_uid,&cellGroupConfig,scc,&RC.nrrrc[module_idP]->carrier,CC_id);
MessageDef* tmp=itti_alloc_new_message_sized(TASK_RRC_GNB, 0, F1AP_INITIAL_UL_RRC_MESSAGE, sizeof(f1ap_initial_ul_rrc_message_t) + sdu_lenP);
f1ap_initial_ul_rrc_message_t *msg = &F1AP_INITIAL_UL_RRC_MESSAGE(tmp);
asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_CellGroupConfig,
NULL,
(void *)&cellGroupConfig,
msg->du2cu_rrc_container,
1024); //sizeof(msg->du2cu_rrc_container));
if (enc_rval.encoded == -1) {
LOG_E(F1AP,"Could not encoded cellGroupConfig, failed element %s\n",enc_rval.failed_type->name);
exit(-1);
}
/* do ITTI message */
msg->du2cu_rrc_container_length = (enc_rval.encoded+7)/8;
msg->crnti=rntiP;
msg->rrc_container=(uint8_t*) (msg+1); // Made extra room after the struct with itti_alloc_msg_sized()
memcpy(msg->rrc_container, sduP, sdu_lenP);
msg->rrc_container_length=sdu_lenP;
itti_send_msg_to_task(TASK_DU_F1, 0, tmp);
return(0);
}
protocol_ctxt_t ctxt;
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, GNB_FLAG_YES, rntiP, frameP, sub_frameP,0);
if((srb_idP & RAB_OFFSET) == CCCH) {
LOG_D(NR_RRC, "[gNB %d] Received SDU for CCCH on SRB %ld\n", module_idP, srb_idP);
ctxt.brOption = brOption;
if (sdu_lenP > 0) {
LOG_I(NR_RRC,"NRRRC Sending CCCH_PDU_IND/SS_NRRRC_PDU_IND to TASK_SS_SRB_GNB (msg_Id:%d) [SFN: %d, SF: %d] \n",
SS_NRRRC_PDU_IND, ctxt.frame, ctxt.subframe);
MessageDef *message_p = itti_alloc_new_message (TASK_SS_SRB_GNB, INSTANCE_DEFAULT, SS_NRRRC_PDU_IND);
if (message_p) {
/* Populate the message to SS */
SS_NRRRC_PDU_IND (message_p).sdu_size = sdu_lenP;
SS_NRRRC_PDU_IND (message_p).srb_id = 0;
SS_NRRRC_PDU_IND (message_p).rnti = rntiP;
SS_NRRRC_PDU_IND (message_p).frame = ctxt.frame;
SS_NRRRC_PDU_IND (message_p).subframe = ctxt.subframe;
memset (SS_NRRRC_PDU_IND (message_p).sdu, 0, SDU_SIZE);
memcpy (SS_NRRRC_PDU_IND (message_p).sdu, sduP, sdu_lenP);
int send_res = itti_send_msg_to_task (TASK_SS_SRB_GNB, INSTANCE_DEFAULT, message_p);
if(send_res < 0) {
LOG_E(RRC,"Error in sending CCCH_PDU_IND/SS_NRRRC_PDU_IND to TASK_SS_SRB_GNB (msg_Id:%d) to TASK_SS_SRB_GNB\n", SS_NRRRC_PDU_IND);
}
}
nr_rrc_gNB_decode_ccch(&ctxt, sduP, sdu_lenP, NULL, CC_id);
}
}
return 0;
}
void nr_mac_gNB_rrc_ul_failure(const module_id_t Mod_instP, void nr_mac_gNB_rrc_ul_failure(const module_id_t Mod_instP,
const int CC_idP, const int CC_idP,
const frame_t frameP, const frame_t frameP,
......
...@@ -114,7 +114,8 @@ rrc_gNB_generate_RRCSetup( ...@@ -114,7 +114,8 @@ rrc_gNB_generate_RRCSetup(
rrc_gNB_ue_context_t *const ue_context_pP, rrc_gNB_ue_context_t *const ue_context_pP,
const uint8_t *masterCellGroup, const uint8_t *masterCellGroup,
int masterCellGroup_len, int masterCellGroup_len,
NR_ServingCellConfigCommon_t *scc); NR_ServingCellConfigCommon_t *scc,
const int CC_id);
int parse_CG_ConfigInfo(gNB_RRC_INST *rrc, NR_CG_ConfigInfo_t *CG_ConfigInfo, x2ap_ENDC_sgnb_addition_req_t *m); int parse_CG_ConfigInfo(gNB_RRC_INST *rrc, NR_CG_ConfigInfo_t *CG_ConfigInfo, x2ap_ENDC_sgnb_addition_req_t *m);
...@@ -186,8 +187,9 @@ int nr_rrc_reconfiguration_req(rrc_gNB_ue_context_t *const ue_context_pP ...@@ -186,8 +187,9 @@ int nr_rrc_reconfiguration_req(rrc_gNB_ue_context_t *const ue_context_pP
int nr_rrc_gNB_decode_ccch(protocol_ctxt_t *const ctxt_pP, int nr_rrc_gNB_decode_ccch(protocol_ctxt_t *const ctxt_pP,
const uint8_t *buffer, const uint8_t *buffer,
int buffer_length, int buffer_length,
const uint8_t *du_to_cu_rrc_container, OCTET_STRING_t *du_to_cu_rrc_container,
int du_to_cu_rrc_container_length); int du_to_cu_rrc_container_len,
const int CC_id);
void void
rrc_gNB_generate_dedicatedRRCReconfiguration_release( rrc_gNB_generate_dedicatedRRCReconfiguration_release(
......
...@@ -291,7 +291,7 @@ char rrc_gNB_rblist_configuration(const module_id_t gnb_mod_idP,NRRrcRblistCfgRe ...@@ -291,7 +291,7 @@ char rrc_gNB_rblist_configuration(const module_id_t gnb_mod_idP,NRRrcRblistCfgRe
rb_config->pdcpTransparentSN_Size = RblistConfig->rb_list[i].RbConfig.pdcpTransparentSN_Size; rb_config->pdcpTransparentSN_Size = RblistConfig->rb_list[i].RbConfig.pdcpTransparentSN_Size;
rb_config->RlcBearer = RblistConfig->rb_list[i].RbConfig.RlcBearer; rb_config->RlcBearer = RblistConfig->rb_list[i].RbConfig.RlcBearer;
rb_config->DiscardULData = RblistConfig->rb_list[i].RbConfig.DiscardULData; rb_config->DiscardULData = RblistConfig->rb_list[i].RbConfig.DiscardULData;
rb_config->isRBConfigValid = TRUE; rb_config->isRBConfigValid = true;
} }
return 0; return 0;
} }
...@@ -370,7 +370,8 @@ rrc_gNB_generate_RRCSetup( ...@@ -370,7 +370,8 @@ rrc_gNB_generate_RRCSetup(
rrc_gNB_ue_context_t *const ue_context_pP, rrc_gNB_ue_context_t *const ue_context_pP,
const uint8_t *masterCellGroup, const uint8_t *masterCellGroup,
int masterCellGroup_len, int masterCellGroup_len,
NR_ServingCellConfigCommon_t *scc) NR_ServingCellConfigCommon_t *scc,
const int CC_id)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
{ {
LOG_I(NR_RRC, "rrc_gNB_generate_RRCSetup for RNTI %04lx\n", ctxt_pP->rntiMaybeUEid); LOG_I(NR_RRC, "rrc_gNB_generate_RRCSetup for RNTI %04lx\n", ctxt_pP->rntiMaybeUEid);
...@@ -387,12 +388,13 @@ rrc_gNB_generate_RRCSetup( ...@@ -387,12 +388,13 @@ rrc_gNB_generate_RRCSetup(
const NR_ServingCellConfig_t *sccd = rrc->configuration.scd; const NR_ServingCellConfig_t *sccd = rrc->configuration.scd;
int size = do_RRCSetup(ue_context_pP, int size = do_RRCSetup(ue_context_pP,
buf, buf,
rrc_gNB_get_next_transaction_identifier(ctxt_pP->module_id), 0,/*rrc_gNB_get_next_transaction_identifier(ctxt_pP->module_id),*/
masterCellGroup, masterCellGroup,
masterCellGroup_len, masterCellGroup_len,
scc, scc,
sccd, sccd,
&rrc->configuration); &rrc->configuration,
CC_id);
AssertFatal(size > 0, "do_RRCSetup failed\n"); AssertFatal(size > 0, "do_RRCSetup failed\n");
AssertFatal(size <= 1024, "memory corruption\n"); AssertFatal(size <= 1024, "memory corruption\n");
...@@ -444,7 +446,8 @@ rrc_gNB_generate_RRCSetup_for_RRCReestablishmentRequest( ...@@ -444,7 +446,8 @@ rrc_gNB_generate_RRCSetup_for_RRCReestablishmentRequest(
0, 0,
scc, scc,
sccd, sccd,
&rrc_instance_p->configuration); &rrc_instance_p->configuration,
CC_id);
AssertFatal(size > 0, "do_RRCSetup failed\n"); AssertFatal(size > 0, "do_RRCSetup failed\n");
AssertFatal(size <= 1024, "memory corruption\n"); AssertFatal(size <= 1024, "memory corruption\n");
...@@ -495,7 +498,8 @@ rrc_gNB_generate_RRCSetup_for_RRCReestablishmentRequest( ...@@ -495,7 +498,8 @@ rrc_gNB_generate_RRCSetup_for_RRCReestablishmentRequest(
void void
rrc_gNB_generate_RRCReject( rrc_gNB_generate_RRCReject(
const protocol_ctxt_t *const ctxt_pP, const protocol_ctxt_t *const ctxt_pP,
rrc_gNB_ue_context_t *const ue_context_pP) rrc_gNB_ue_context_t *const ue_context_pP,
const int CC_id)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
{ {
LOG_I(NR_RRC, "rrc_gNB_generate_RRCReject \n"); LOG_I(NR_RRC, "rrc_gNB_generate_RRCReject \n");
...@@ -680,11 +684,12 @@ rrc_gNB_generate_defaultRRCReconfiguration( ...@@ -680,11 +684,12 @@ rrc_gNB_generate_defaultRRCReconfiguration(
gNB_RRC_UE_t *ue_p = &ue_context_pP->ue_context; gNB_RRC_UE_t *ue_p = &ue_context_pP->ue_context;
memset(buffer, 0, sizeof(buffer)); memset(buffer, 0, sizeof(buffer));
cellGroupConfig = calloc(1, sizeof(NR_CellGroupConfig_t)); cellGroupConfig = calloc(1, sizeof(NR_CellGroupConfig_t));
fill_mastercellGroupConfig(cellGroupConfig, ue_p->masterCellGroup,0); fill_mastercellGroupConfig(cellGroupConfig, ue_p->masterCellGroup,0,0,0,0,0,0);
size = do_RRCReconfiguration(ctxt_pP, buffer, sizeof(buffer), size = do_RRCReconfiguration(ctxt_pP, buffer, sizeof(buffer),
xid, xid,
*SRB_configList2, NULL, //*SRB_configList2,
*DRB_configList, NULL, //*DRB_configList,
NULL, NULL,
NULL, NULL,
NULL, NULL,
...@@ -692,8 +697,9 @@ rrc_gNB_generate_defaultRRCReconfiguration( ...@@ -692,8 +697,9 @@ rrc_gNB_generate_defaultRRCReconfiguration(
dedicatedNAS_MessageList, dedicatedNAS_MessageList,
ue_context_pP, ue_context_pP,
&rrc->carrier, &rrc->carrier,
&rrc->configuration,
NULL, NULL,
cellGroupConfig); ue_p->masterCellGroup);
AssertFatal(size > 0, "cannot encode RRCReconfiguration in %s()\n", __func__); AssertFatal(size > 0, "cannot encode RRCReconfiguration in %s()\n", __func__);
LOG_W(RRC, "do_RRCReconfiguration(): size %d\n", size); LOG_W(RRC, "do_RRCReconfiguration(): size %d\n", size);
...@@ -757,9 +763,6 @@ rrc_gNB_generate_defaultRRCReconfiguration( ...@@ -757,9 +763,6 @@ rrc_gNB_generate_defaultRRCReconfiguration(
buffer, buffer,
PDCP_TRANSMISSION_MODE_CONTROL); PDCP_TRANSMISSION_MODE_CONTROL);
} }
// rrc_pdcp_config_asn1_req
#endif
// rrc_rlc_config_asn1_req
} }
break; break;
...@@ -917,7 +920,6 @@ rrc_gNB_generate_dedicatedRRCReconfiguration( ...@@ -917,7 +920,6 @@ rrc_gNB_generate_dedicatedRRCReconfiguration(
gNB_RRC_UE_t *ue_p = &ue_context_pP->ue_context; gNB_RRC_UE_t *ue_p = &ue_context_pP->ue_context;
NR_DRB_ToAddModList_t **DRB_configList = NULL; NR_DRB_ToAddModList_t **DRB_configList = NULL;
NR_DRB_ToAddModList_t **DRB_configList2 = NULL; NR_DRB_ToAddModList_t **DRB_configList2 = NULL;
NR_SRB_ToAddModList_t **SRB_configList2 = NULL;
NR_SRB_ToAddModList_t *SRB_configList = ue_context_pP->ue_context.SRB_configList; NR_SRB_ToAddModList_t *SRB_configList = ue_context_pP->ue_context.SRB_configList;
struct NR_RRCReconfiguration_v1530_IEs__dedicatedNAS_MessageList struct NR_RRCReconfiguration_v1530_IEs__dedicatedNAS_MessageList
*dedicatedNAS_MessageList = NULL; *dedicatedNAS_MessageList = NULL;
...@@ -3043,11 +3045,30 @@ void rrc_gNB_process_initial_ul_rrc_message(const f1ap_initial_ul_rrc_message_t ...@@ -3043,11 +3045,30 @@ void rrc_gNB_process_initial_ul_rrc_message(const f1ap_initial_ul_rrc_message_t
protocol_ctxt_t ctxt = { 0 }; protocol_ctxt_t ctxt = { 0 };
PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, i, GNB_FLAG_YES, ul_rrc->crnti, 0, 0); PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, i, GNB_FLAG_YES, ul_rrc->crnti, 0, 0);
LOG_I(NR_RRC,"NRRRC Sending CCCH_PDU_IND/SS_NRRRC_PDU_IND to TASK_SS_SRB_GNB (msg_Id:%d) [SFN: %d, SF: %d] \n",
SS_NRRRC_PDU_IND, ctxt.frame, ctxt.subframe);
MessageDef *message_p = itti_alloc_new_message (TASK_SS_SRB_GNB, INSTANCE_DEFAULT, SS_NRRRC_PDU_IND);
if (message_p) {
/* Populate the message to SS */
SS_NRRRC_PDU_IND (message_p).sdu_size = ul_rrc->rrc_container_length;
SS_NRRRC_PDU_IND (message_p).srb_id = 0;
SS_NRRRC_PDU_IND (message_p).rnti = ul_rrc->crnti;
SS_NRRRC_PDU_IND (message_p).frame = ctxt.frame;
SS_NRRRC_PDU_IND (message_p).subframe = ctxt.subframe;
memset (SS_NRRRC_PDU_IND (message_p).sdu, 0, SDU_SIZE);
memcpy (SS_NRRRC_PDU_IND (message_p).sdu, ul_rrc->rrc_container, ul_rrc->rrc_container_length);
int send_res = itti_send_msg_to_task (TASK_SS_SRB_GNB, INSTANCE_DEFAULT, message_p);
if(send_res < 0) {
LOG_E(RRC,"Error in sending CCCH_PDU_IND/SS_NRRRC_PDU_IND to TASK_SS_SRB_GNB (msg_Id:%d) to TASK_SS_SRB_GNB\n", SS_NRRRC_PDU_IND);
}
}
nr_rrc_gNB_decode_ccch(&ctxt, nr_rrc_gNB_decode_ccch(&ctxt,
ul_rrc->rrc_container, ul_rrc->rrc_container,
ul_rrc->rrc_container_length, ul_rrc->rrc_container_length,
ul_rrc->du2cu_rrc_container, ul_rrc->du2cu_rrc_container,
ul_rrc->du2cu_rrc_container_length); ul_rrc->du2cu_rrc_container_length,0);
if (ul_rrc->rrc_container) if (ul_rrc->rrc_container)
free(ul_rrc->rrc_container); free(ul_rrc->rrc_container);
...@@ -3270,10 +3291,6 @@ static void rrc_DU_process_ue_context_setup_request(MessageDef *msg_p, const cha ...@@ -3270,10 +3291,6 @@ static void rrc_DU_process_ue_context_setup_request(MessageDef *msg_p, const cha
uint32_t incoming_teid = 0; uint32_t incoming_teid = 0;
int CC_id = ue_context_p->ue_context.primaryCC_id; int CC_id = ue_context_p->ue_context.primaryCC_id;
NR_CellGroupConfig_t *cellGroupConfig;
cellGroupConfig = calloc(1, sizeof(NR_CellGroupConfig_t));
fill_mastercellGroupConfig(cellGroupConfig, ue_context_p->ue_context.masterCellGroup,CC_id);
if(req->cu_to_du_rrc_information!=NULL){ if(req->cu_to_du_rrc_information!=NULL){
if(req->cu_to_du_rrc_information->uE_CapabilityRAT_ContainerList!=NULL){ if(req->cu_to_du_rrc_information->uE_CapabilityRAT_ContainerList!=NULL){
LOG_I(NR_RRC, "Length of ue_CapabilityRAT_ContainerList is: %d \n", (int) req->cu_to_du_rrc_information->uE_CapabilityRAT_ContainerList_length); LOG_I(NR_RRC, "Length of ue_CapabilityRAT_ContainerList is: %d \n", (int) req->cu_to_du_rrc_information->uE_CapabilityRAT_ContainerList_length);
...@@ -3423,7 +3440,7 @@ static void rrc_DU_process_ue_context_setup_request(MessageDef *msg_p, const cha ...@@ -3423,7 +3440,7 @@ static void rrc_DU_process_ue_context_setup_request(MessageDef *msg_p, const cha
if (req->srbs_to_be_setup_length > 0 || req->drbs_to_be_setup_length>0) if (req->srbs_to_be_setup_length > 0 || req->drbs_to_be_setup_length>0)
// FIXME: fill_mastercellGroupConfig() won't fill the right priorities or // FIXME: fill_mastercellGroupConfig() won't fill the right priorities or
// bearer IDs for the DRBs // bearer IDs for the DRBs
fill_mastercellGroupConfig(cellGroupConfig, ue_context_p->ue_context.masterCellGroup, rrc->um_on_default_drb, SRB2_config ? 1 : 0, drb_id_to_setup_start, nb_drb_to_setup, drb_priority); fill_mastercellGroupConfig(cellGroupConfig, ue_context_p->ue_context.masterCellGroup, rrc->um_on_default_drb, SRB2_config ? 1 : 0, drb_id_to_setup_start, nb_drb_to_setup, drb_priority,CC_id);
apply_macrlc_config(rrc, ue_context_p, &ctxt); apply_macrlc_config(rrc, ue_context_p, &ctxt);
...@@ -3567,7 +3584,7 @@ static void rrc_DU_process_ue_context_modification_request(MessageDef *msg_p, co ...@@ -3567,7 +3584,7 @@ static void rrc_DU_process_ue_context_modification_request(MessageDef *msg_p, co
drb_id_to_setup_start < 2 ? 1 : 0, drb_id_to_setup_start < 2 ? 1 : 0,
drb_id_to_setup_start, drb_id_to_setup_start,
req->drbs_to_be_setup_length, req->drbs_to_be_setup_length,
drb_priority); drb_priority,0);
apply_macrlc_config(rrc, ue_context_p, &ctxt); apply_macrlc_config(rrc, ue_context_p, &ctxt);
} }
if(req->ReconfigComplOutcome == RRCreconf_failure){ if(req->ReconfigComplOutcome == RRCreconf_failure){
...@@ -4246,7 +4263,7 @@ void *rrc_gnb_task(void *args_p) { ...@@ -4246,7 +4263,7 @@ void *rrc_gnb_task(void *args_p) {
if(dl_dcch_msg->message.choice.c1) { if(dl_dcch_msg->message.choice.c1) {
if (dl_dcch_msg->message.choice.c1->present == NR_DL_DCCH_MessageType__c1_PR_rrcReconfiguration) if (dl_dcch_msg->message.choice.c1->present == NR_DL_DCCH_MessageType__c1_PR_rrcReconfiguration)
{ {
struct rrc_gNB_ue_context_s * ue_context_p = rrc_gNB_get_ue_context(RC.nrrrc[ctxt.module_id], ctxt.rnti); struct rrc_gNB_ue_context_s * ue_context_p = rrc_gNB_get_ue_context(RC.nrrrc[ctxt.module_id], ctxt.rntiMaybeUEid);
LOG_A(NR_RRC, "[GNB %ld] SRB %d rnti %d rrcReconfiguration\n", instance, SS_NRRRC_PDU_REQ(msg_p).srb_id, SS_NRRRC_PDU_REQ(msg_p).rnti); LOG_A(NR_RRC, "[GNB %ld] SRB %d rnti %d rrcReconfiguration\n", instance, SS_NRRRC_PDU_REQ(msg_p).srb_id, SS_NRRRC_PDU_REQ(msg_p).rnti);
if(ue_context_p){ if(ue_context_p){
NR_RRCReconfiguration_t * rrcReconfiguration = dl_dcch_msg->message.choice.c1->choice.rrcReconfiguration; NR_RRCReconfiguration_t * rrcReconfiguration = dl_dcch_msg->message.choice.c1->choice.rrcReconfiguration;
...@@ -4315,9 +4332,9 @@ void *rrc_gnb_task(void *args_p) { ...@@ -4315,9 +4332,9 @@ void *rrc_gnb_task(void *args_p) {
} }
else if(dl_dcch_msg->message.choice.c1->present == NR_DL_DCCH_MessageType__c1_PR_rrcRelease) else if(dl_dcch_msg->message.choice.c1->present == NR_DL_DCCH_MessageType__c1_PR_rrcRelease)
{ {
rrc_gNB_ue_context_t *ue_context_p = rrc_gNB_get_ue_context(RC.nrrrc[ctxt.module_id], ctxt.rnti); rrc_gNB_ue_context_t *ue_context_p = rrc_gNB_get_ue_context(RC.nrrrc[ctxt.module_id], ctxt.rntiMaybeUEid);
if (ue_context_p) { if (ue_context_p) {
LOG_I(NR_RRC, "rrcRelease UE rnti: %x \n", ctxt.rnti); LOG_I(NR_RRC, "rrcRelease UE rnti: %x \n", ctxt.rntiMaybeUEid);
ue_context_p->ue_context.ue_reestablishment_timer = 0; ue_context_p->ue_context.ue_reestablishment_timer = 0;
ue_context_p->ue_context.ue_release_timer = 0; /* TODO: ue_release_timer is not checked in nr_rrc_subframe_process */ ue_context_p->ue_context.ue_release_timer = 0; /* TODO: ue_release_timer is not checked in nr_rrc_subframe_process */
ue_context_p->ue_context.ue_release_timer_thres = 0; ue_context_p->ue_context.ue_release_timer_thres = 0;
...@@ -4326,13 +4343,13 @@ void *rrc_gnb_task(void *args_p) { ...@@ -4326,13 +4343,13 @@ void *rrc_gnb_task(void *args_p) {
ue_context_p->ue_context.ue_release_timer_thres_rrc = 10; ue_context_p->ue_context.ue_release_timer_thres_rrc = 10;
/* /*
LOG_W(NR_RRC, "todo, sleep before removing UE %x \n", ctxt.rnti); LOG_W(NR_RRC, "todo, sleep before removing UE %x \n", ctxt.rntiMaybeUEid);
sleep(1); sleep(1);
mac_remove_nr_ue(ctxt.module_id, ctxt.rnti); mac_remove_nr_ue(ctxt.module_id, ctxt.rntiMaybeUEid);
rrc_rlc_remove_ue(&ctxt); rrc_rlc_remove_ue(&ctxt);
pdcp_remove_UE(&ctxt); pdcp_remove_UE(&ctxt);
LOG_I(NR_RRC, "removed UE %x \n", ctxt.rnti); LOG_I(NR_RRC, "removed UE %x \n", ctxt.rntiMaybeUEid);
*/ */
} }
else else
......
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