Commit c663688f authored by Robert Schmidt's avatar Robert Schmidt

Merge remote-tracking branch 'origin/accumulated-fixes-2022june' into integration_2022_wk30

parents 87849133 b4331bf7
......@@ -59,9 +59,6 @@ extern void set_function_spec_param(RU_t *ru);
extern void reset_opp_meas(void);
extern void print_opp_meas(void);
extern void init_fep_thread(PHY_VARS_gNB *);
void init_gNB_afterRU(void);
extern int stop_L1L2(module_id_t gnb_id);
......
......@@ -64,6 +64,12 @@ extern uint16_t beta_cqi[16];
extern uint16_t beta_ri[16];
extern uint16_t beta_ack[16];
static int errorRB(int rb, char * table, int line) {
LOG_E(PHY,"Received %d rb, impossble in table %s, at line %d\n", rb, table, line);
return 0;
}
#define rbAllocCheck(RBalL, TabLe) (RBalL) > sizeof(TabLe)/sizeof(*TabLe) ? errorRB(RBalL, #TabLe, __LINE__) : TabLe[RBalL]
void extract_dci1A_info(uint8_t N_RB_DL, frame_type_t frame_type, void *dci_pdu, DCI_INFO_EXTRACTED_t *pdci_info_extarcted)
{
uint8_t harq_pid=0;
......@@ -974,28 +980,28 @@ int check_dci_format1_1a_coherency(DCI_format_t dci_format,
{
switch (N_RB_DL) {
case 6:
NPRB = RIV2nb_rb_LUT6[rballoc];//NPRB;
NPRB = rbAllocCheck(rballoc, RIV2nb_rb_LUT6);
if(rah)
RIV_max = RIV_max6;
else
RIV_max = 0x3F;
break;
case 25:
NPRB = RIV2nb_rb_LUT25[rballoc];//NPRB;
NPRB = rbAllocCheck(rballoc,RIV2nb_rb_LUT25);
if(rah)
RIV_max = RIV_max25;
else
RIV_max = 0x1FFF;
break;
case 50:
NPRB = RIV2nb_rb_LUT50[rballoc];//NPRB;
NPRB = rbAllocCheck(rballoc,RIV2nb_rb_LUT50);
if(rah)
RIV_max = RIV_max50;
else
RIV_max = 0x1FFFF;
break;
case 100:
NPRB = RIV2nb_rb_LUT100[rballoc];//NPRB;
NPRB = rbAllocCheck(rballoc,RIV2nb_rb_LUT100);
if(rah)
RIV_max = RIV_max100;
else
......@@ -1034,9 +1040,14 @@ int check_dci_format1_1a_coherency(DCI_format_t dci_format,
// this is an eNB issue
// retransmisison but old and new TBS are different !!!
// work around, consider it as a new transmission
LOG_E(PHY,"Format1A Retransmission but TBS are different: consider it as new transmission !!! \n");
LOG_E(PHY,
"Format1A Retransmission but TBS are different: consider it as new transmission !!!, round %d, mcs 1 %d, NPRB %d \n",
pdlsch0_harq->round,
mcs1,
NPRB);
pdlsch0_harq->round = 0;
//return(0); // ?? to cross check
return(0); // ?? to cross check
}
}
......
......@@ -71,9 +71,9 @@
#include "common/utils/system.h"
#include <time.h>
extern int oai_exit;
#include "openair1/SCHED/sched_common_extern.h"
#include "targets/RT/USER/lte-softmodem.h"
#include "common/ran_context.h"
void feptx0(RU_t *ru,
int slot)
......@@ -616,9 +616,11 @@ void init_fep_thread(RU_t *ru,
}
extern void kill_fep_thread(RU_t *ru)
void kill_fep_thread(RU_t *ru)
{
RU_proc_t *proc = &ru->proc;
if (proc->pthread_fep == 0)
return;
pthread_mutex_lock( &proc->mutex_fep );
proc->instance_cnt_fep = 0;
pthread_cond_signal(&proc->cond_fep);
......@@ -630,9 +632,11 @@ extern void kill_fep_thread(RU_t *ru)
}
extern void kill_feptx_thread(RU_t *ru)
void kill_feptx_thread(RU_t *ru)
{
RU_proc_t *proc = &ru->proc;
if (proc->pthread_feptx == 0)
return;
pthread_mutex_lock( &proc->mutex_feptx );
proc->instance_cnt_feptx = 0;
pthread_cond_signal(&proc->cond_feptx);
......
......@@ -29,4 +29,6 @@
extern int16_t hundred_times_delta_TF[100];
extern uint16_t hundred_times_log10_NPRB[100];
void kill_fep_thread(RU_t *ru);
#endif /*__SCHED_EXTERN_H__ */
......@@ -514,10 +514,10 @@ int main(int argc, char **argv) {
LTE_DL_FRAME_PARMS *frame_parms;
double s_re0[30720*2],s_im0[30720*2],r_re0[30720*2],r_im0[30720*2];
double s_re1[30720*2],s_im1[30720*2],r_re1[30720*2],r_im1[30720*2];
double *s_re[2]= {s_re0,s_re1};
double *s_im[2]= {s_im0,s_im1};
double *r_re[2]= {r_re0,r_re1};
double *r_im[2]= {r_im0,r_im1};
double *s_re[NB_ANTENNAS_TX]= {s_re0,s_re1};
double *s_im[NB_ANTENNAS_TX]= {s_im0,s_im1};
double *r_re[NB_ANTENNAS_RX]= {r_re0,r_re1};
double *r_im[NB_ANTENNAS_RX]= {r_im0,r_im1};
uint8_t transmission_mode=1,n_tx_port=1,n_tx_phy=1,n_rx=2;
int eNB_id = 0;
unsigned char round;
......
......@@ -2366,22 +2366,6 @@ rrc_mac_remove_ue(module_id_t mod_idP,
return 0;
}
//------------------------------------------------------------------------------
/*
* Returns the previous UE_id in the scheduling list in UL or DL
*/
inline int prev(UE_list_t *listP, int nodeP) {
if (nodeP == listP->head)
return -1; /* there is no previous of the head */
for (int j = listP->head; j >= 0; j = listP->next[j])
if (listP->next[j] == nodeP)
return j;
LOG_E(MAC, "%s(): could not find previous to %d in UE_list\n", __func__, nodeP);
dump_ue_list(listP);
return -1;
}
// This has to be updated to include BSR information
//------------------------------------------------------------------------------
......
......@@ -329,17 +329,7 @@ rx_sdu(const module_id_t enb_mod_idP,
if (ra->msg3_round >= mac->common_channels[CC_idP].radioResourceConfigCommon->rach_ConfigCommon.maxHARQ_Msg3Tx - 1) {
// Release RNTI of LTE PHY when RA does not succeed
UE_free_list_t *free_list = NULL;
pthread_mutex_lock(&lock_ue_freelist);
free_list = &mac->UE_free_list;
free_list->UE_free_ctrl[free_list->tail_freelist].rnti = current_rnti;
free_list->UE_free_ctrl[free_list->tail_freelist].removeContextFlg = 1;
free_list->UE_free_ctrl[free_list->tail_freelist].raFlag = 1;
free_list->num_UEs++;
mac->UE_release_req.ue_release_request_body.ue_release_request_TLVs_list[mac->UE_release_req.ue_release_request_body.number_of_TLVs].rnti = current_rnti;
mac->UE_release_req.ue_release_request_body.number_of_TLVs++;
free_list->tail_freelist = (free_list->tail_freelist + 1) % (NUMBER_OF_UE_MAX+1);
pthread_mutex_unlock(&lock_ue_freelist);
put_UE_in_freelist(enb_mod_idP, current_rnti, true);
cancel_ra_proc(enb_mod_idP, CC_idP, frameP, current_rnti);
nfapi_hi_dci0_request_t *hi_dci0_req = NULL;
......
......@@ -1195,14 +1195,6 @@ typedef struct {
///remove RA flag
bool raFlag;
} UE_free_ctrl_t;
/*! \brief REMOVE UE list used by eNB to order UEs/CC for deleting*/
typedef struct {
/// deleting control info
UE_free_ctrl_t UE_free_ctrl[NUMBER_OF_UE_MAX+1];
int num_UEs;
int head_freelist; ///the head position of the delete list
int tail_freelist; ///the tail position of the delete list
} UE_free_list_t;
/**
* describes contiguous RBs
......@@ -1443,7 +1435,7 @@ typedef struct eNB_MAC_INST_s {
/// processing time of eNB PCH scheduler
time_stats_t schedule_pch;
UE_free_list_t UE_free_list;
UE_free_ctrl_t UE_free_ctrl[NUMBER_OF_UE_MAX+1];
/// for scheduling selection
SCHEDULER_MODES scheduler_mode;
/// Default scheduler: Pre-processor implementation. Algorithms for UL/DL
......
......@@ -2437,16 +2437,15 @@ NR_UE_info_t *add_new_nr_ue(gNB_MAC_INST *nr_mac, rnti_t rntiP, NR_CellGroupConf
sched_ctrl->next_dl_bwp_id = -1;
sched_ctrl->next_ul_bwp_id = -1;
const struct NR_UplinkConfig__uplinkBWP_ToAddModList *ubwpList = servingCellConfig ? servingCellConfig->uplinkConfig->uplinkBWP_ToAddModList : NULL;
if (ubwpList)
AssertFatal(ubwpList->list.count <= NR_MAX_NUM_BWP,
"uplinkBWP_ToAddModList has %d BWP!\n",
ubwpList->list.count);
AssertFatal(ubwpList == NULL || ubwpList->list.count <= NR_MAX_NUM_BWP,
"uplinkBWP_ToAddModList has %d BWP!\n",
ubwpList->list.count);
const int ul_bwp_id = servingCellConfig ? *servingCellConfig->uplinkConfig->firstActiveUplinkBWP_Id : 0;
sched_ctrl->active_ubwp = ubwpList && ul_bwp_id > 0 ? ubwpList->list.array[ul_bwp_id - 1] : NULL;
/* get Number of HARQ processes for this UE */
if (servingCellConfig)
AssertFatal(servingCellConfig->pdsch_ServingCellConfig->present == NR_SetupRelease_PDSCH_ServingCellConfig_PR_setup,
AssertFatal(servingCellConfig == NULL
|| servingCellConfig->pdsch_ServingCellConfig->present == NR_SetupRelease_PDSCH_ServingCellConfig_PR_setup,
"no pdsch-ServingCellConfig found for UE %04x\n",
UE->rnti);
const NR_PDSCH_ServingCellConfig_t *pdsch = servingCellConfig ? servingCellConfig->pdsch_ServingCellConfig->choice.setup : NULL;
......
......@@ -976,28 +976,24 @@ rrc_eNB_free_UE(
put_UE_in_freelist(enb_mod_idP, rnti, 1);
}
void remove_UE_from_freelist(module_id_t mod_id, rnti_t rnti) {
eNB_MAC_INST *eNB_MAC = RC.mac[mod_id];
pthread_mutex_lock(&lock_ue_freelist);
UE_free_list_t *free_list = &eNB_MAC->UE_free_list;
free_list->UE_free_ctrl[free_list->head_freelist].rnti = 0;
free_list->head_freelist = (free_list->head_freelist + 1) % (NUMBER_OF_UE_MAX+1);
free_list->num_UEs--;
pthread_mutex_unlock(&lock_ue_freelist);
}
void put_UE_in_freelist(module_id_t mod_id, rnti_t rnti, bool removeFlag) {
UE_free_list_t *free_list = NULL;
eNB_MAC_INST *eNB_MAC = RC.mac[mod_id];
pthread_mutex_lock(&lock_ue_freelist);
free_list = &eNB_MAC->UE_free_list;
free_list->UE_free_ctrl[free_list->tail_freelist].rnti = rnti;
free_list->UE_free_ctrl[free_list->tail_freelist].removeContextFlg = removeFlag;
free_list->UE_free_ctrl[free_list->tail_freelist].raFlag = 0;
free_list->num_UEs++;
LOG_I(PHY,"add ue %d in fre list, context flag: %d\n", rnti, removeFlag);
int i;
for (i=0; i < sizeofArray(eNB_MAC->UE_free_ctrl); i++)
if (eNB_MAC->UE_free_ctrl[i].rnti == 0)
break;
if (i==sizeofArray(eNB_MAC->UE_free_ctrl)) {
LOG_E(PHY,"List of UE to free is full\n");
pthread_mutex_unlock(&lock_ue_freelist);
return;
}
eNB_MAC->UE_free_ctrl[i].rnti = rnti;
eNB_MAC->UE_free_ctrl[i].removeContextFlg = removeFlag;
eNB_MAC->UE_free_ctrl[i].raFlag = 0;
eNB_MAC->UE_release_req.ue_release_request_body.ue_release_request_TLVs_list[eNB_MAC->UE_release_req.ue_release_request_body.number_of_TLVs].rnti = rnti;
eNB_MAC->UE_release_req.ue_release_request_body.number_of_TLVs++;
free_list->tail_freelist = (free_list->tail_freelist + 1) % (NUMBER_OF_UE_MAX+1);
pthread_mutex_unlock(&lock_ue_freelist);
}
......@@ -1007,104 +1003,47 @@ extern void clean_eNb_ulsch(LTE_eNB_ULSCH_t *ulsch);
extern void clean_eNb_dlsch(LTE_eNB_DLSCH_t *dlsch);
void release_UE_in_freeList(module_id_t mod_id) {
int i, j, CC_id, pdu_number;
protocol_ctxt_t ctxt;
nfapi_ul_config_request_body_t *ul_req_tmp = NULL;
PHY_VARS_eNB *eNB_PHY = NULL;
struct rrc_eNB_ue_context_s *ue_context_pP = NULL;
eNB_MAC_INST *eNB_MAC = RC.mac[mod_id];
bool remove_UEContext;
rnti_t rnti;
int head, tail, ue_num;
pthread_mutex_lock(&lock_ue_freelist);
head = eNB_MAC->UE_free_list.head_freelist;
tail = eNB_MAC->UE_free_list.tail_freelist;
if(head == tail) {
pthread_mutex_unlock(&lock_ue_freelist);
return;
}
if(tail < head) {
tail = head + eNB_MAC->UE_free_list.num_UEs;
}
pthread_mutex_unlock(&lock_ue_freelist);
for(ue_num = head; ue_num < tail; ue_num++) {
ue_num = ue_num % (NUMBER_OF_UE_MAX+1);
rnti = eNB_MAC->UE_free_list.UE_free_ctrl[ue_num].rnti;
for(int ue_num = 0; ue_num < sizeofArray(eNB_MAC->UE_free_ctrl) ; ue_num++) {
rnti_t rnti = eNB_MAC->UE_free_ctrl[ue_num].rnti;
if(rnti != 0) {
remove_UEContext = eNB_MAC->UE_free_list.UE_free_ctrl[ue_num].removeContextFlg;
protocol_ctxt_t ctxt;
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, mod_id, ENB_FLAG_YES, rnti, 0, 0,mod_id);
for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
for (int CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
eNB_PHY = RC.eNB[mod_id][CC_id];
int id;
// clean ULSCH entries for rnti
id = find_ulsch(rnti,eNB_PHY,eNB_MAC->UE_free_list.UE_free_ctrl[ue_num].raFlag ? SEARCH_EXIST_RA : SEARCH_EXIST);
id = find_ulsch(rnti,eNB_PHY,eNB_MAC->UE_free_ctrl[ue_num].raFlag ? SEARCH_EXIST_RA : SEARCH_EXIST);
if (id>=0) clean_eNb_ulsch(eNB_PHY->ulsch[id]);
// clean DLSCH entries for rnti
id = find_dlsch(rnti,eNB_PHY,eNB_MAC->UE_free_list.UE_free_ctrl[ue_num].raFlag ? SEARCH_EXIST_RA : SEARCH_EXIST);
id = find_dlsch(rnti,eNB_PHY,eNB_MAC->UE_free_ctrl[ue_num].raFlag ? SEARCH_EXIST_RA : SEARCH_EXIST);
if (id>=0) clean_eNb_dlsch(eNB_PHY->dlsch[id][0]);
// clean UCI entries for rnti
for (i=0; i<NUMBER_OF_UCI_MAX; i++) {
for (int i=0; i<NUMBER_OF_UCI_MAX; i++) {
if(eNB_PHY->uci_vars[i].rnti == rnti) {
LOG_I(MAC, "clean eNb uci_vars[%d] UE %x \n",i, rnti);
memset(&eNB_PHY->uci_vars[i],0,sizeof(LTE_eNB_UCI));
}
}
/*
for (i=0; i<MAX_MOBILES_PER_ENB; i++) {
ulsch = eNB_PHY->ulsch[i];
if((ulsch != NULL) && (ulsch->rnti == rnti)) {
void clean_eNb_ulsch(LTE_eNB_ULSCH_t *ulsch);
LOG_I(RRC, "clean_eNb_ulsch ulsch[%d] UE %x\n", i, rnti);
clean_eNb_ulsch(ulsch);
}
dlsch = eNB_PHY->dlsch[i][0];
if((dlsch != NULL) && (dlsch->rnti == rnti)) {
void clean_eNb_dlsch(LTE_eNB_DLSCH_t *dlsch);
LOG_I(RRC, "clean_eNb_dlsch dlsch[%d] UE %x \n", i, rnti);
clean_eNb_dlsch(dlsch);
}
}
ulsch = eNB_PHY->ulsch[i];
if((ulsch != NULL) && (ulsch->rnti == rnti)) {
void clean_eNb_ulsch(LTE_eNB_ULSCH_t *ulsch);
LOG_I(RRC, "clean_eNb_ulsch ulsch[%d] UE %x\n", i, rnti);
clean_eNb_ulsch(ulsch);
}
for (i=0; i<NUMBER_OF_UCI_MAX; i++) {
if(eNB_PHY->uci_vars[i].rnti == rnti) {
LOG_I(MAC, "clean eNb uci_vars[%d] UE %x \n",i, rnti);
memset(&eNB_PHY->uci_vars[i],0,sizeof(LTE_eNB_UCI));
}
}
*/
if (flexran_agent_get_rrc_xface(mod_id)) {
flexran_agent_get_rrc_xface(mod_id)->flexran_agent_notify_ue_state_change(
mod_id, rnti, PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED);
flexran_agent_get_rrc_xface(mod_id)->flexran_agent_notify_ue_state_change( mod_id, rnti, PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED);
}
for(j = 0; j < 10; j++) {
ul_req_tmp = &eNB_MAC->UL_req_tmp[CC_id][j].ul_config_request_body;
for(int j = 0; j < 10; j++) {
nfapi_ul_config_request_body_t *ul_req_tmp = &eNB_MAC->UL_req_tmp[CC_id][j].ul_config_request_body;
if(ul_req_tmp) {
pdu_number = ul_req_tmp->number_of_pdus;
int pdu_number = ul_req_tmp->number_of_pdus;
for(int pdu_index = pdu_number-1; pdu_index >= 0; pdu_index--) {
if((ul_req_tmp->ul_config_pdu_list[pdu_index].ulsch_pdu.ulsch_pdu_rel8.rnti == rnti) ||
......@@ -1126,7 +1065,8 @@ void release_UE_in_freeList(module_id_t mod_id) {
}
if (!NODE_IS_CU(RC.rrc[mod_id]->node_type)) {
rrc_mac_remove_ue(mod_id,rnti);
if (!eNB_MAC->UE_free_ctrl[ue_num].raFlag)
rrc_mac_remove_ue(mod_id,rnti);
rrc_rlc_remove_ue(&ctxt);
pdcp_remove_UE(&ctxt);
} else {
......@@ -1139,19 +1079,20 @@ void release_UE_in_freeList(module_id_t mod_id) {
itti_send_msg_to_task(TASK_CU_F1, mod_id, m);
}
if(remove_UEContext) {
ue_context_pP = rrc_eNB_get_ue_context(RC.rrc[mod_id],rnti);
if(eNB_MAC->UE_free_ctrl[ue_num].removeContextFlg) {
struct rrc_eNB_ue_context_s *ue_context_pP = rrc_eNB_get_ue_context(RC.rrc[mod_id],rnti);
if(ue_context_pP) {
LOG_I(PHY, "remove RNTI %04x\n", rnti);
rrc_eNB_remove_ue_context(&ctxt,RC.rrc[mod_id],
(struct rrc_eNB_ue_context_s *) ue_context_pP);
}
}
LOG_I(RRC, "[release_UE_in_freeList] remove UE %x from freeList\n", rnti);
remove_UE_from_freelist(mod_id, rnti);
LOG_I(RRC, "[release_UE_in_freeList] remove UE %x from freeList ra context: %d\n", rnti, eNB_MAC->UE_free_ctrl[ue_num].raFlag);
eNB_MAC->UE_free_ctrl[ue_num].rnti = 0;
}
}
pthread_mutex_unlock(&lock_ue_freelist);
}
int rrc_eNB_previous_SRB2(rrc_eNB_ue_context_t *ue_context_pP) {
......@@ -7246,6 +7187,7 @@ rrc_eNB_decode_ccch(
LOG_I(RRC," S-TMSI exists, ue_context_p %p, old rnti %x => %x\n",ue_context_p,ue_context_p->ue_context.rnti,ctxt_pP->rnti);
if (!NODE_IS_CU(RC.rrc[ctxt_pP->module_id]->node_type)) {
LOG_I(PHY, "remove RNTI %04x\n", ue_context_p->ue_context.rnti);
rrc_mac_remove_ue(ctxt_pP->module_id, ue_context_p->ue_context.rnti);
} else {
MessageDef *m = itti_alloc_new_message(TASK_RRC_ENB, 0, F1AP_UE_CONTEXT_RELEASE_CMD);
......
......@@ -89,7 +89,7 @@ void prach_procedures(PHY_VARS_eNB *eNB,int br_flag);
void stop_RU(RU_t **rup,int nb_ru);
void do_ru_synch(RU_t *ru);
static void do_ru_synch(RU_t *ru);
void configure_ru(int idx,
void *arg);
......@@ -1059,7 +1059,7 @@ int wakeup_synch(RU_t *ru) {
}
void do_ru_synch(RU_t *ru) {
static void do_ru_synch(RU_t *ru) {
LTE_DL_FRAME_PARMS *fp = ru->frame_parms;
RU_proc_t *proc = &ru->proc;
int rxs, ic, ret, i;
......@@ -1924,7 +1924,7 @@ static void *ru_thread( void *param ) {
// This thread run the initial synchronization like a UE
void *ru_thread_synch(void *arg) {
static void *ru_thread_synch(void *arg) {
RU_t *ru = (RU_t *)arg;
__attribute__((unused))
LTE_DL_FRAME_PARMS *fp = ru->frame_parms;
......
......@@ -29,6 +29,7 @@
#include "flexran_agent.h"
#include "s1ap_eNB.h"
#include "SIMULATION/ETH_TRANSPORT/proto.h"
#include "targets/ARCH/COMMON/common_lib.h"
#include "executables/softmodem-common.h"
......@@ -213,5 +214,19 @@ extern void init_UE_standalone_thread(int ue_idx);
extern PHY_VARS_UE *init_ue_vars(LTE_DL_FRAME_PARMS *frame_parms, uint8_t UE_id, uint8_t abstraction_flag);
extern void init_bler_table(void);
void feptx_ofdm_2thread(RU_t *ru,
int frame,
int subframe);
void* ru_thread_control( void* param );
void wait_eNBs(void);
void kill_feptx_thread(RU_t *ru);
void init_fep_thread(RU_t *ru, pthread_attr_t *attr_fep);
void init_feptx_thread(RU_t *ru, pthread_attr_t *attr_feptx);
void fep_full(RU_t *ru, int subframe);
void configure_ru(int, void *arg);
void configure_rru(int, void *arg);
void ru_fep_full_2thread(RU_t *ru,int subframe);
void feptx_ofdm(RU_t*ru, int frame_tx, int tti_tx);
void feptx_prec(struct RU_t_s *ru, int frame_tx, int tti_tx);
void fill_rf_config(RU_t *ru, char *rf_config_file);
#endif
......@@ -176,7 +176,6 @@ extern char uecap_xer[1024];
char uecap_xer_in=0;
int oaisim_flag=0;
//threads_t threads= {-1,-1,-1,-1,-1,-1,-1,-1};
/* see file openair2/LAYER2/MAC/main.c for why abstraction_flag is needed
* this is very hackish - find a proper solution
......
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