Commit e956c17b authored by Robert Schmidt's avatar Robert Schmidt

Rename NR_UE_list_t to NR_UE_info_t

The name NR_UE_list_t is misleading: beyond being a simple "list", this
structure carries all/most UE-related MAC information. If at all, it is
a container for multiple lists. The next commit introduces a
NR_UE_list_t structure that organizes UEs in lists such that it is
easier to go through the UEs.
parent f28679b3
......@@ -712,7 +712,7 @@ int main(int argc, char **argv)
nr_ue_phy_config_request(&UE_mac->phy_config);
NR_UE_list_t *UE_list = &RC.nrmac[0]->UE_list;
NR_UE_info_t *UE_info = &RC.nrmac[0]->UE_info;
//NR_COMMON_channels_t *cc = RC.nrmac[0]->common_channels;
snrRun = 0;
......@@ -773,11 +773,11 @@ int main(int argc, char **argv)
memset(RC.nrmac[0]->cce_list[1][1],0,MAX_NUM_CCE*sizeof(int));
clear_nr_nfapi_information(RC.nrmac[0], 0, frame, slot);
UE_list->UE_sched_ctrl[0].harq_processes[harq_pid].ndi = !(trial&1);
UE_info->UE_sched_ctrl[0].harq_processes[harq_pid].ndi = !(trial&1);
UE_list->UE_sched_ctrl[0].harq_processes[harq_pid].round = round;
UE_list->UE_sched_ctrl[0].current_harq_pid = harq_pid;
UE_info->UE_sched_ctrl[0].harq_processes[harq_pid].round = round;
UE_info->UE_sched_ctrl[0].current_harq_pid = harq_pid;
gNB->dlsch[0][0]->harq_processes[harq_pid]->round = round;
if (css_flag == 0) nr_schedule_uss_dlsch_phytest(0,frame,slot,&pucch_sched,&dlsch_config);
......
......@@ -346,29 +346,29 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP,
if (secondaryCellGroup) {
NR_UE_list_t *UE_list = &RC.nrmac[Mod_idP]->UE_list;
NR_UE_info_t *UE_info = &RC.nrmac[Mod_idP]->UE_info;
int UE_id;
if (add_ue == 1) {
UE_id = add_new_nr_ue(Mod_idP,rnti);
UE_list->secondaryCellGroup[UE_id] = secondaryCellGroup;
UE_info->secondaryCellGroup[UE_id] = secondaryCellGroup;
struct NR_ServingCellConfig__downlinkBWP_ToAddModList *bwpList =
secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList;
AssertFatal(bwpList->list.count == 1,
"downlinkBWP_ToAddModList has %d BWP!\n",
bwpList->list.count);
const int bwp_id = 1;
UE_list->UE_sched_ctrl[UE_id].active_bwp = bwpList->list.array[bwp_id - 1];
UE_info->UE_sched_ctrl[UE_id].active_bwp = bwpList->list.array[bwp_id - 1];
uint8_t num_preamble = secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb->ssb_ResourceList.list.count;
UE_list->preambles[UE_id].num_preambles = num_preamble;
UE_list->preambles[UE_id].preamble_list = (uint8_t *) malloc(num_preamble*sizeof(uint8_t));
UE_info->preambles[UE_id].num_preambles = num_preamble;
UE_info->preambles[UE_id].preamble_list = (uint8_t *) malloc(num_preamble*sizeof(uint8_t));
for (int i=0; i<num_preamble; i++) {
UE_list->preambles[UE_id].preamble_list[i] = secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb->ssb_ResourceList.list.array[i]->ra_PreambleIndex;
UE_info->preambles[UE_id].preamble_list[i] = secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb->ssb_ResourceList.list.array[i]->ra_PreambleIndex;
}
LOG_I(PHY,"Added new UE_id %d/%x with initial secondaryCellGroup\n",UE_id,rnti);
}
else { // secondaryCellGroup has been updated
UE_id = find_nr_UE_id(Mod_idP,rnti);
UE_list->secondaryCellGroup[UE_id] = secondaryCellGroup;
UE_info->secondaryCellGroup[UE_id] = secondaryCellGroup;
LOG_I(PHY,"Modified UE_id %d/%x with secondaryCellGroup\n",UE_id,rnti);
}
}
......
This diff is collapsed.
......@@ -253,8 +253,8 @@ void nr_initiate_ra_proc(module_id_t module_idP,
uint16_t msg2_frame, msg2_slot,monitoring_slot_period,monitoring_offset;
gNB_MAC_INST *nr_mac = RC.nrmac[module_idP];
NR_UE_list_t *UE_list = &nr_mac->UE_list;
NR_CellGroupConfig_t *secondaryCellGroup = UE_list->secondaryCellGroup[UE_id];
NR_UE_info_t *UE_info = &nr_mac->UE_info;
NR_CellGroupConfig_t *secondaryCellGroup = UE_info->secondaryCellGroup[UE_id];
NR_COMMON_channels_t *cc = &nr_mac->common_channels[CC_id];
NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon;
NR_RA_t *ra = &cc->ra[0];
......@@ -262,14 +262,14 @@ void nr_initiate_ra_proc(module_id_t module_idP,
// if the preamble received correspond to one of the listed
// the UE sent a RACH either for starting RA procedure or RA procedure failed and UE retries
int pr_found=0;
for (int i=0;i<UE_list->preambles[UE_id].num_preambles;i++) {
if (preamble_index == UE_list->preambles[UE_id].preamble_list[i]) {
for (int i=0;i<UE_info->preambles[UE_id].num_preambles;i++) {
if (preamble_index == UE_info->preambles[UE_id].preamble_list[i]) {
pr_found=1;
break;
}
}
if (pr_found)
UE_list->fiveG_connected[UE_id] = false;
UE_info->fiveG_connected[UE_id] = false;
else {
LOG_E(MAC, "[gNB %d][RAPROC] FAILURE: preamble %d does not correspond to any of the ones in rach_ConfigDedicated for UE_id %d\n",
module_idP, preamble_index, UE_id);
......@@ -325,7 +325,7 @@ void nr_initiate_ra_proc(module_id_t module_idP,
ra->RA_rnti = ra_rnti;
ra->preamble_index = preamble_index;
UE_list->tc_rnti[UE_id] = ra->rnti;
UE_info->tc_rnti[UE_id] = ra->rnti;
LOG_I(MAC,"[gNB %d][RAPROC] CC_id %d Frame %d Activating Msg2 generation in frame %d, slot %d using RA rnti %x\n",
module_idP,
......@@ -434,7 +434,7 @@ void nr_add_msg3(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t
NR_COMMON_channels_t *cc = &mac->common_channels[CC_id];
NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon;
NR_RA_t *ra = &cc->ra[0];
NR_UE_list_t *UE_list = &mac->UE_list;
NR_UE_info_t *UE_info = &mac->UE_info;
int UE_id = 0;
if (ra->state == RA_IDLE) {
......@@ -448,9 +448,9 @@ void nr_add_msg3(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t
memset(pusch_pdu, 0, sizeof(nfapi_nr_pusch_pdu_t));
AssertFatal(UE_list->active[UE_id] >=0,"Cannot find UE_id %d is not active\n", UE_id);
AssertFatal(UE_info->active[UE_id] >=0,"Cannot find UE_id %d is not active\n", UE_id);
NR_CellGroupConfig_t *secondaryCellGroup = UE_list->secondaryCellGroup[UE_id];
NR_CellGroupConfig_t *secondaryCellGroup = UE_info->secondaryCellGroup[UE_id];
AssertFatal(secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count == 1,
"downlinkBWP_ToAddModList has %d BWP!\n", secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count);
NR_BWP_Uplink_t *ubwp=secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[ra->bwp_id-1];
......@@ -547,7 +547,7 @@ void nr_generate_Msg2(module_id_t module_idP,
gNB_MAC_INST *nr_mac = RC.nrmac[module_idP];
NR_COMMON_channels_t *cc = &nr_mac->common_channels[0];
NR_RA_t *ra = &cc->ra[0];
NR_UE_list_t *UE_list = &nr_mac->UE_list;
NR_UE_info_t *UE_info = &nr_mac->UE_info;
NR_SearchSpace_t *ss = ra->ra_ss;
uint16_t RA_rnti = ra->RA_rnti;
......@@ -597,7 +597,7 @@ void nr_generate_Msg2(module_id_t module_idP,
// This code from this point on will not work on initialBWP or CORESET0
AssertFatal(ra->bwp_id>0,"cannot work on initialBWP for now\n");
NR_CellGroupConfig_t *secondaryCellGroup = UE_list->secondaryCellGroup[UE_id];
NR_CellGroupConfig_t *secondaryCellGroup = UE_info->secondaryCellGroup[UE_id];
AssertFatal(secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count == 1,
"downlinkBWP_ToAddModList has %d BWP!\n", secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count);
NR_BWP_Downlink_t *bwp = secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[ra->bwp_id - 1];
......
......@@ -76,12 +76,12 @@ int nr_generate_dlsch_pdu(module_id_t module_idP,
ce_ptr = &mac_header_control_elements[0];
uint16_t UE_id = 0; //TODO need to get as a function parameter or need to invoke api to UE_id using module Id and RNTI
gNB_MAC_INST *gNB_mac = RC.nrmac[module_idP];
NR_UE_list_t *UE_list = &gNB_mac->UE_list;
NR_UE_info_t *UE_info = &gNB_mac->UE_info;
NR_UE_sched_ctrl_t *ue_sched_ctl = NULL;
//NR_CellGroupConfig_t *config = UE_list->secondaryCellGroup[UE_id];
ue_sched_ctl = &(UE_list->UE_sched_ctrl[UE_id]);
//NR_CellGroupConfig_t *config = UE_info->secondaryCellGroup[UE_id];
ue_sched_ctl = &(UE_info->UE_sched_ctrl[UE_id]);
NR_mac_stats_t *mac_stats = &(UE_list->mac_stats[UE_id]);
NR_mac_stats_t *mac_stats = &(UE_info->mac_stats[UE_id]);
// 1) Compute MAC CE and related subheaders
......@@ -449,19 +449,18 @@ void nr_simple_dlsch_preprocessor(module_id_t module_id,
frame_t frame,
sub_frame_t slot,
int num_slots_per_tdd) {
NR_UE_list_t *UE_list = &RC.nrmac[module_id]->UE_list;
NR_UE_info_t *UE_info = &RC.nrmac[module_id]->UE_info;
const int UE_id = 0;
const int CC_id = 0;
NR_UE_sched_ctrl_t *sched_ctrl = &UE_list->UE_sched_ctrl[UE_id];
// TODO: reset per UE-info
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
sched_ctrl->rbSize = 0;
/* Retrieve amount of data to send for this UE */
sched_ctrl->num_total_bytes = 0;
const int lcid = DL_SCH_LCID_DTCH;
const uint16_t rnti = UE_list->rnti[UE_id];
const uint16_t rnti = UE_info->rnti[UE_id];
sched_ctrl->rlc_status[lcid] = mac_rlc_status_ind(module_id,
rnti,
module_id,
......@@ -544,8 +543,8 @@ void nr_schedule_ue_spec(module_id_t module_id,
sub_frame_t slot,
int num_slots_per_tdd) {
gNB_MAC_INST *gNB_mac = RC.nrmac[module_id];
NR_UE_list_t *UE_list = &gNB_mac->UE_list;
if (UE_list->num_UEs == 0)
NR_UE_info_t *UE_info = &gNB_mac->UE_info;
if (UE_info->num_UEs == 0)
return;
/* PREPROCESSOR */
......@@ -555,7 +554,7 @@ void nr_schedule_ue_spec(module_id_t module_id,
const int UE_id = 0;
const int CC_id = 0;
NR_UE_sched_ctrl_t *sched_ctrl = &UE_list->UE_sched_ctrl[UE_id];
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
if (sched_ctrl->rbSize < 0 && !get_softmodem_params()->phy_test)
return;
......@@ -594,7 +593,7 @@ void nr_schedule_ue_spec(module_id_t module_id,
uint16_t sdu_lengths[NB_RB_MAX] = {0};
uint8_t mac_sdus[MAX_NR_DLSCH_PAYLOAD_BYTES];
unsigned char sdu_lcids[NB_RB_MAX] = {0};
const rnti_t rnti = UE_list->rnti[UE_id];
const rnti_t rnti = UE_info->rnti[UE_id];
const int lcid = DL_SCH_LCID_DTCH;
if (sched_ctrl->num_total_bytes > 0) {
LOG_D(MAC,
......@@ -661,7 +660,7 @@ void nr_schedule_ue_spec(module_id_t module_id,
const int offset = nr_generate_dlsch_pdu(
module_id,
(unsigned char *)mac_sdus,
(unsigned char *)gNB_mac->UE_list.DLSCH_pdu[0][0].payload[0],
(unsigned char *)gNB_mac->UE_info.DLSCH_pdu[0][0].payload[0],
num_sdus, // num_sdus
sdu_lengths,
sdu_lcids,
......@@ -672,7 +671,7 @@ void nr_schedule_ue_spec(module_id_t module_id,
// Padding: fill remainder of DLSCH with 0
if (post_padding > 0) {
for (int j = 0; j < TBS - offset; j++)
gNB_mac->UE_list.DLSCH_pdu[0][0].payload[0][offset + j] = 0;
gNB_mac->UE_info.DLSCH_pdu[0][0].payload[0][offset + j] = 0;
}
const int current_harq_pid = sched_ctrl->current_harq_pid;
......@@ -680,9 +679,9 @@ void nr_schedule_ue_spec(module_id_t module_id,
NR_sched_pucch *pucch = &sched_ctrl->sched_pucch[sched_ctrl->pucch_sched_idx];
harq->feedback_slot = pucch->ul_slot;
harq->is_waiting = 1;
UE_list->mac_stats[UE_id].dlsch_rounds[harq->round]++;
UE_info->mac_stats[UE_id].dlsch_rounds[harq->round]++;
if (harq->round == 0)
UE_list->mac_stats[UE_id].dlsch_total_bytes += TBS;
UE_info->mac_stats[UE_id].dlsch_total_bytes += TBS;
nfapi_nr_dl_tti_request_body_t *dl_req = &gNB_mac->DL_req[CC_id].dl_tti_request_body;
nr_fill_nfapi_dl_pdu(module_id,
......@@ -728,7 +727,7 @@ void nr_schedule_ue_spec(module_id_t module_id,
slot,
TBS);
for(int i = 0; i < 10; i++) {
LOG_I(MAC, "byte %d : %x\n", i,((uint8_t *)gNB_mac->UE_list.DLSCH_pdu[0][0].payload[0])[i]);
LOG_I(MAC, "byte %d : %x\n", i,((uint8_t *)gNB_mac->UE_info.DLSCH_pdu[0][0].payload[0])[i]);
}
}
#endif
......
......@@ -212,7 +212,7 @@ void nr_process_mac_pdu(
LOG_D(MAC, "[UE %d] Frame %d : ULSCH -> UL-DTCH %d (gNB %d, %d bytes)\n", module_idP, frameP, rx_lcid, module_idP, mac_sdu_len);
int UE_id = find_nr_UE_id(module_idP, rnti);
RC.nrmac[module_idP]->UE_list.mac_stats[UE_id].lc_bytes_rx[rx_lcid] += mac_sdu_len;
RC.nrmac[module_idP]->UE_info.mac_stats[UE_id].lc_bytes_rx[rx_lcid] += mac_sdu_len;
#if defined(ENABLE_MAC_PAYLOAD_DEBUG)
LOG_T(MAC, "[UE %d] First 32 bytes of DLSCH : \n", module_idP);
......@@ -313,19 +313,19 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP,
const uint16_t rssi){
int current_rnti = 0, UE_id = -1, harq_pid = 0;
gNB_MAC_INST *gNB_mac = NULL;
NR_UE_list_t *UE_list = NULL;
NR_UE_info_t *UE_info = NULL;
NR_UE_sched_ctrl_t *UE_scheduling_control = NULL;
current_rnti = rntiP;
UE_id = find_nr_UE_id(gnb_mod_idP, current_rnti);
gNB_mac = RC.nrmac[gnb_mod_idP];
UE_list = &gNB_mac->UE_list;
UE_info = &gNB_mac->UE_info;
int target_snrx10 = gNB_mac->pusch_target_snrx10;
if (UE_id != -1) {
UE_scheduling_control = &(UE_list->UE_sched_ctrl[UE_id]);
UE_scheduling_control = &(UE_info->UE_sched_ctrl[UE_id]);
UE_list->mac_stats[UE_id].ulsch_total_bytes_rx += sdu_lenP;
UE_info->mac_stats[UE_id].ulsch_total_bytes_rx += sdu_lenP;
LOG_D(MAC, "[gNB %d][PUSCH %d] CC_id %d %d.%d Received ULSCH sdu from PHY (rnti %x, UE_id %d) ul_cqi %d\n",
gnb_mod_idP,
harq_pid,
......@@ -370,10 +370,10 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP,
// random access pusch with TC-RNTI
if (sduP != NULL) { // if the CRC passed
for (int i = 0; i < MAX_MOBILES_PER_GNB; i++) {
if (UE_list->active[i] == TRUE) {
if (UE_list->tc_rnti[i] == current_rnti) {
if (UE_info->active[i]) {
if (UE_info->tc_rnti[i] == current_rnti) {
// for now the only thing we are doing is set the UE as 5G connected
UE_list->fiveG_connected[i] = true;
UE_info->fiveG_connected[i] = true;
LOG_I(MAC, "[gNB %d][RAPROC] PUSCH with TC_RNTI %x received correctly and UE_id %d is now 5G connected\n",
gnb_mod_idP, current_rnti, i);
}
......
......@@ -300,7 +300,7 @@ int NRRIV2BW(int locationAndBandwidth,int N_RB);
int NRRIV2PRBOFFSET(int locationAndBandwidth,int N_RB);
void dump_nr_ue_list(NR_UE_list_t *listP, int ul_flag);
void dump_nr_ue_list(NR_UE_info_t *listP, int ul_flag);
int find_nr_UE_id(module_id_t mod_idP, rnti_t rntiP);
......
......@@ -50,7 +50,7 @@ void mac_top_init_gNB(void)
{
module_id_t i;
int list_el;
NR_UE_list_t *UE_list;
NR_UE_info_t *UE_info;
gNB_MAC_INST *nrmac;
LOG_I(MAC, "[MAIN] Init function start:nb_nr_macrlc_inst=%d\n",RC.nb_nr_macrlc_inst);
......@@ -104,29 +104,29 @@ void mac_top_init_gNB(void)
nrmac = RC.nrmac[i];
nrmac->if_inst = NR_IF_Module_init(i);
UE_list = &nrmac->UE_list;
UE_list->num_UEs = 0;
UE_list->head = -1;
UE_list->head_ul = -1;
UE_list->avail = 0;
UE_info = &nrmac->UE_info;
UE_info->num_UEs = 0;
UE_info->head = -1;
UE_info->head_ul = -1;
UE_info->avail = 0;
for (list_el = 0; list_el < MAX_MOBILES_PER_GNB - 1; list_el++) {
UE_list->next[list_el] = list_el + 1;
UE_list->next_ul[list_el] = list_el + 1;
UE_list->active[list_el] = FALSE;
UE_info->next[list_el] = list_el + 1;
UE_info->next_ul[list_el] = list_el + 1;
UE_info->active[list_el] = FALSE;
for (int list_harq = 0; list_harq < NR_MAX_NB_HARQ_PROCESSES; list_harq++) {
UE_list->UE_sched_ctrl[list_el].harq_processes[list_harq].round = 0;
UE_list->UE_sched_ctrl[list_el].harq_processes[list_harq].ndi = 0;
UE_list->UE_sched_ctrl[list_el].harq_processes[list_harq].is_waiting = 0;
UE_list->UE_sched_ctrl[list_el].ul_harq_processes[list_harq].round = 0;
UE_list->UE_sched_ctrl[list_el].ul_harq_processes[list_harq].ndi = 0;
UE_list->UE_sched_ctrl[list_el].ul_harq_processes[list_harq].state = 0;
UE_info->UE_sched_ctrl[list_el].harq_processes[list_harq].round = 0;
UE_info->UE_sched_ctrl[list_el].harq_processes[list_harq].ndi = 0;
UE_info->UE_sched_ctrl[list_el].harq_processes[list_harq].is_waiting = 0;
UE_info->UE_sched_ctrl[list_el].ul_harq_processes[list_harq].round = 0;
UE_info->UE_sched_ctrl[list_el].ul_harq_processes[list_harq].ndi = 0;
UE_info->UE_sched_ctrl[list_el].ul_harq_processes[list_harq].state = 0;
}
}
UE_list->next[list_el] = -1;
UE_list->next_ul[list_el] = -1;
UE_list->active[list_el] = FALSE;
UE_info->next[list_el] = -1;
UE_info->next_ul[list_el] = -1;
UE_info->active[list_el] = FALSE;
}
srand48(0);
......
......@@ -362,7 +362,7 @@ typedef struct {
rnti_t tc_rnti[MAX_MOBILES_PER_GNB];
NR_preamble_ue preambles[MAX_MOBILES_PER_GNB];
NR_CellGroupConfig_t *secondaryCellGroup[MAX_MOBILES_PER_GNB];
} NR_UE_list_t;
} NR_UE_info_t;
/*! \brief top level eNB MAC structure */
typedef struct gNB_MAC_INST_s {
......@@ -396,7 +396,7 @@ typedef struct gNB_MAC_INST_s {
/// NFAPI DL PDU structure
nfapi_nr_tx_data_request_t TX_req[NFAPI_CC_MAX];
NR_UE_list_t UE_list;
NR_UE_info_t UE_info;
/// UL handle
uint32_t ul_handle;
......
......@@ -181,10 +181,10 @@ void NR_UL_indication(NR_UL_IND_t *UL_info) {
clear_nr_nfapi_information(mac,CC_id,UL_info->frame,UL_info->slot);
handle_nr_rach(UL_info);
handle_nr_uci(UL_info,&mac->UE_list.UE_sched_ctrl[0],&mac->UE_list.mac_stats[0],mac->pucch_target_snrx10);
handle_nr_uci(UL_info,&mac->UE_info.UE_sched_ctrl[0],&mac->UE_info.mac_stats[0],mac->pucch_target_snrx10);
// clear HI prior to handling ULSCH
mac->UL_dci_req[CC_id].numPdus = 0;
handle_nr_ulsch(UL_info, &mac->UE_list.UE_sched_ctrl[0],&mac->UE_list.mac_stats[0]);
handle_nr_ulsch(UL_info, &mac->UE_info.UE_sched_ctrl[0],&mac->UE_info.mac_stats[0]);
if (nfapi_mode != 1) {
if (ifi->CC_mask == ((1<<MAX_NUM_CCs)-1)) {
......
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