added MAC configuration for secondaryCellGroup and addition of UE context in MAC
This commit is contained in:
@@ -201,35 +201,51 @@ void config_common(int Mod_idP,
|
||||
|
||||
int rrc_mac_config_req_gNB(module_id_t Mod_idP,
|
||||
int ssb_SubcarrierOffset,
|
||||
NR_ServingCellConfigCommon_t *scc
|
||||
NR_ServingCellConfigCommon_t *scc,
|
||||
int add_ue,
|
||||
uint32_t rnti,
|
||||
NR_CellGroupConfig_t *secondaryCellGroup
|
||||
){
|
||||
|
||||
AssertFatal(scc!=NULL,"scc is null\n");
|
||||
AssertFatal(scc->ssb_PositionsInBurst->present == NR_ServingCellConfigCommon__ssb_PositionsInBurst_PR_mediumBitmap, "SSB Bitmap is not 8-bits!\n");
|
||||
if (scc != NULL ) {
|
||||
AssertFatal(scc->ssb_PositionsInBurst->present == NR_ServingCellConfigCommon__ssb_PositionsInBurst_PR_mediumBitmap, "SSB Bitmap is not 8-bits!\n");
|
||||
|
||||
config_common(Mod_idP,
|
||||
scc);
|
||||
LOG_E(MAC, "%s() %s:%d RC.nrmac[Mod_idP]->if_inst->NR_PHY_config_req:%p\n", __FUNCTION__, __FILE__, __LINE__, RC.nrmac[Mod_idP]->if_inst->NR_PHY_config_req);
|
||||
config_common(Mod_idP,
|
||||
scc);
|
||||
LOG_E(MAC, "%s() %s:%d RC.nrmac[Mod_idP]->if_inst->NR_PHY_config_req:%p\n", __FUNCTION__, __FILE__, __LINE__, RC.nrmac[Mod_idP]->if_inst->NR_PHY_config_req);
|
||||
|
||||
// if in nFAPI mode
|
||||
if ( (nfapi_mode == 1 || nfapi_mode == 2) && (RC.nrmac[Mod_idP]->if_inst->NR_PHY_config_req == NULL) ){
|
||||
while(RC.nrmac[Mod_idP]->if_inst->NR_PHY_config_req == NULL) {
|
||||
// DJP AssertFatal(RC.nrmac[Mod_idP]->if_inst->PHY_config_req != NULL,"if_inst->phy_config_request is null\n");
|
||||
usleep(100 * 1000);
|
||||
printf("Waiting for PHY_config_req\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
NR_PHY_Config_t phycfg;
|
||||
phycfg.Mod_id = Mod_idP;
|
||||
phycfg.CC_id = 0;
|
||||
phycfg.cfg = &RC.nrmac[Mod_idP]->config[0];
|
||||
|
||||
if (RC.nrmac[Mod_idP]->if_inst->NR_PHY_config_req) RC.nrmac[Mod_idP]->if_inst->NR_PHY_config_req(&phycfg);
|
||||
}
|
||||
|
||||
if (secondaryCellGroup) {
|
||||
|
||||
// if in nFAPI mode
|
||||
if ( (nfapi_mode == 1 || nfapi_mode == 2) && (RC.nrmac[Mod_idP]->if_inst->NR_PHY_config_req == NULL) ){
|
||||
while(RC.nrmac[Mod_idP]->if_inst->NR_PHY_config_req == NULL) {
|
||||
// DJP AssertFatal(RC.nrmac[Mod_idP]->if_inst->PHY_config_req != NULL,"if_inst->phy_config_request is null\n");
|
||||
usleep(100 * 1000);
|
||||
printf("Waiting for PHY_config_req\n");
|
||||
NR_UE_list_t *UE_list = &RC.nrmac[Mod_idP]->UE_list;
|
||||
if (add_ue == 1) {
|
||||
int UE_id = add_new_nr_ue(Mod_idP,rnti);
|
||||
UE_list->secondaryCellGroup[UE_id] = secondaryCellGroup;
|
||||
}
|
||||
else { // secondaryCellGroup has been updated
|
||||
int UE_id = find_nr_UE_id(rnti);
|
||||
UE_list->secondaryCellGroup[UE_id] = secondaryCellGroup;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
NR_PHY_Config_t phycfg;
|
||||
phycfg.Mod_id = Mod_idP;
|
||||
phycfg.CC_id = 0;
|
||||
phycfg.cfg = &RC.nrmac[Mod_idP]->config[0];
|
||||
|
||||
if (RC.nrmac[Mod_idP]->if_inst->NR_PHY_config_req) RC.nrmac[Mod_idP]->if_inst->NR_PHY_config_req(&phycfg);
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_MAC_CONFIG, VCD_FUNCTION_OUT);
|
||||
|
||||
|
||||
|
||||
return(0);
|
||||
|
||||
|
||||
@@ -310,7 +310,7 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
|
||||
protocol_ctxt_t ctxt;
|
||||
|
||||
int CC_id, i = -1;
|
||||
UE_list_t *UE_list = &RC.nrmac[module_idP]->UE_list;
|
||||
NR_UE_list_t *UE_list = &RC.nrmac[module_idP]->UE_list;
|
||||
rnti_t rnti;
|
||||
|
||||
NR_COMMON_channels_t *cc = RC.nrmac[module_idP]->common_channels;
|
||||
@@ -351,90 +351,6 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
|
||||
|
||||
rnti = 0;//UE_RNTI(module_idP, i);
|
||||
CC_id = 0;//UE_PCCID(module_idP, i);
|
||||
//int spf = get_spf(cfg);
|
||||
|
||||
if (((frameP&127) == 0) && (slotP == 0)) {
|
||||
LOG_I(MAC,
|
||||
"UE rnti %x : %s, PHR %d dB DL CQI %d PUSCH SNR %d PUCCH SNR %d\n",
|
||||
rnti,
|
||||
UE_list->UE_sched_ctrl[i].ul_out_of_sync ==
|
||||
0 ? "in synch" : "out of sync",
|
||||
UE_list->UE_template[CC_id][i].phr_info,
|
||||
UE_list->UE_sched_ctrl[i].dl_cqi[CC_id],
|
||||
(UE_list->UE_sched_ctrl[i].pusch_snr[CC_id] - 128) / 2,
|
||||
(UE_list->UE_sched_ctrl[i].pucch1_snr[CC_id] - 128) / 2);
|
||||
}
|
||||
|
||||
RC.gNB[module_idP]->pusch_stats_bsr[i][to_absslot(cfg,frameP,slotP)] = -63;
|
||||
|
||||
if (i == UE_list->head)
|
||||
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_UE0_BSR,RC.gNB[module_idP]->
|
||||
pusch_stats_bsr[i][to_absslot(cfg,frameP,slotP)]);
|
||||
|
||||
// increment this, it is cleared when we receive an sdu
|
||||
RC.nrmac[module_idP]->UE_list.UE_sched_ctrl[i].ul_inactivity_timer++;
|
||||
RC.nrmac[module_idP]->UE_list.UE_sched_ctrl[i].cqi_req_timer++;
|
||||
|
||||
LOG_D(MAC, "UE %d/%x : ul_inactivity %d, cqi_req %d\n",
|
||||
i,
|
||||
rnti,
|
||||
RC.nrmac[module_idP]->UE_list.UE_sched_ctrl[i].ul_inactivity_timer,
|
||||
RC.nrmac[module_idP]->UE_list.UE_sched_ctrl[i].cqi_req_timer);
|
||||
|
||||
//check_nr_ul_failure(module_idP, CC_id, i, frameP, subframeP);
|
||||
|
||||
if (RC.nrmac[module_idP]->UE_list.UE_sched_ctrl[i].ue_reestablishment_reject_timer > 0) {
|
||||
RC.nrmac[module_idP]->UE_list.UE_sched_ctrl[i].ue_reestablishment_reject_timer++;
|
||||
|
||||
if(RC.nrmac[module_idP]->UE_list.UE_sched_ctrl[i].ue_reestablishment_reject_timer >=
|
||||
RC.nrmac[module_idP]->UE_list.UE_sched_ctrl[i].ue_reestablishment_reject_timer_thres) {
|
||||
RC.nrmac[module_idP]->UE_list.UE_sched_ctrl[i].ue_reestablishment_reject_timer = 0;
|
||||
/*
|
||||
for (int ue_id_l = 0; ue_id_l < MAX_MOBILES_PER_GNB; ue_id_l++) {
|
||||
if (reestablish_rnti_map[ue_id_l][0] == rnti) {
|
||||
// clear currentC-RNTI from map
|
||||
reestablish_rnti_map[ue_id_l][0] = 0;
|
||||
reestablish_rnti_map[ue_id_l][1] = 0;
|
||||
break;
|
||||
}
|
||||
}*/
|
||||
|
||||
// Note: This should not be done in the MAC!
|
||||
for (int ii=0; ii<MAX_MOBILES_PER_GNB; ii++) {
|
||||
NR_gNB_ULSCH_t *ulsch = RC.gNB[module_idP]->ulsch[ii][0];
|
||||
if((ulsch != NULL) && (ulsch->rnti == rnti)){
|
||||
LOG_W(MAC, "TODO: clean_eNb_ulsch UE %x \n", rnti);
|
||||
clean_gNB_ulsch(ulsch);
|
||||
}
|
||||
}
|
||||
|
||||
for (int ii=0; ii<MAX_MOBILES_PER_GNB; ii++) {
|
||||
NR_gNB_DLSCH_t *dlsch = RC.gNB[module_idP]->dlsch[ii][0];
|
||||
if((dlsch != NULL) && (dlsch->rnti == rnti)){
|
||||
LOG_W(MAC, "TODO: clean_eNb_dlsch UE %x \n", rnti);
|
||||
clean_gNB_dlsch(dlsch);
|
||||
}
|
||||
}
|
||||
|
||||
for(int j = 0; j < 10; j++){
|
||||
nfapi_ul_config_request_body_t *ul_req_tmp = NULL;
|
||||
ul_req_tmp = &RC.nrmac[module_idP]->UL_req_tmp[CC_id][j].ul_config_request_body;
|
||||
if(ul_req_tmp){
|
||||
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){
|
||||
LOG_I(MAC, "remove UE %x from ul_config_pdu_list %d/%d\n", rnti, pdu_index, pdu_number);
|
||||
if(pdu_index < pdu_number -1){
|
||||
memcpy(&ul_req_tmp->ul_config_pdu_list[pdu_index], &ul_req_tmp->ul_config_pdu_list[pdu_index+1], (pdu_number-1-pdu_index) * sizeof(nfapi_ul_config_request_pdu_t));
|
||||
}
|
||||
ul_req_tmp->number_of_pdus--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// rrc_mac_remove_ue(module_idP,rnti);
|
||||
}
|
||||
} //END if (RC.nrmac[module_idP]->UE_list.UE_sched_ctrl[i].ue_reestablishment_reject_timer > 0)
|
||||
|
||||
} //END if (UE_list->active[i])
|
||||
} //END for (i = 0; i < MAX_MOBILES_PER_GNB; i++)
|
||||
|
||||
@@ -308,11 +308,11 @@ void nr_schedule_uss_dlsch_phytest(module_id_t module_idP,
|
||||
// HOT FIX for all zero pdu problem
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
for(int i = 0; i < dlsch_pdu_rel15->transport_block_size/8; i++) {
|
||||
((uint8_t *)nr_mac->UE_list.DLSCH_pdu[CC_id][0][0].payload[0])[i] = (unsigned char) rand();
|
||||
((uint8_t *)nr_mac->UE_list.DLSCH_pdu[0][0].payload[0])[i] = (unsigned char) rand();
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
||||
TX_req->segments[0].segment_data = nr_mac->UE_list.DLSCH_pdu[CC_id][0][0].payload[0];
|
||||
TX_req->segments[0].segment_data = nr_mac->UE_list.DLSCH_pdu[0][0].payload[0];
|
||||
TX_req->segments[0].segment_length = dlsch_pdu_rel15->transport_block_size+2;
|
||||
nr_mac->TX_req[CC_id].tx_request_body.number_of_pdus++;
|
||||
nr_mac->TX_req[CC_id].sfn_sf = sfn_sf;
|
||||
|
||||
@@ -570,3 +570,87 @@ void fill_initialBWPULtimeDomainAllocaion(nfapi_nr_config_request_t *cfg,int tim
|
||||
*start_symbol = extract_startSymbol(cfg->pusch_config.PUSCHTimeDomainResourceAllocation_startSymbolAndLength[time_domain_assignment].value);
|
||||
*length = extract_length(cfg->pusch_config.PUSCHTimeDomainResourceAllocation_startSymbolAndLength[time_domain_assignment].value);
|
||||
}
|
||||
|
||||
/*
|
||||
* Dump the UL or DL UE_list into LOG_T(MAC)
|
||||
*/
|
||||
void
|
||||
dump_nr_ue_list(NR_UE_list_t *listP,
|
||||
int ul_flag)
|
||||
//------------------------------------------------------------------------------
|
||||
{
|
||||
if (ul_flag == 0) {
|
||||
for (int j = listP->head; j >= 0; j = listP->next[j]) {
|
||||
LOG_T(MAC, "DL list node %d => %d\n",
|
||||
j,
|
||||
listP->next[j]);
|
||||
}
|
||||
} else {
|
||||
for (int j = listP->head_ul; j >= 0; j = listP->next_ul[j]) {
|
||||
LOG_T(MAC, "UL list node %d => %d\n",
|
||||
j,
|
||||
listP->next_ul[j]);
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
int
|
||||
find_nr_UE_id(module_id_t mod_idP,
|
||||
rnti_t rntiP)
|
||||
//------------------------------------------------------------------------------
|
||||
{
|
||||
int UE_id;
|
||||
NR_UE_list_t *UE_list = &RC.nrmac[mod_idP]->UE_list;
|
||||
|
||||
for (UE_id = 0; UE_id < MAX_MOBILES_PER_GNB; UE_id++) {
|
||||
if (UE_list->active[UE_id] == TRUE) {
|
||||
if (UE_list->rnti[UE_id] == rntiP) {
|
||||
return UE_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
int add_new_nr_ue(module_id_t mod_idP,
|
||||
rnti_t rntiP) {
|
||||
|
||||
int UE_id;
|
||||
int i, j;
|
||||
NR_UE_list_t *UE_list = &RC.nrmac[mod_idP]->UE_list;
|
||||
LOG_D(MAC, "[gNB %d] Adding UE with rnti %x (next avail %d, num_UEs %d)\n",
|
||||
mod_idP,
|
||||
rntiP,
|
||||
UE_list->avail,
|
||||
UE_list->num_UEs);
|
||||
dump_ue_list(UE_list, 0);
|
||||
|
||||
for (i = 0; i < MAX_MOBILES_PER_ENB; i++) {
|
||||
if (UE_list->active[i] == TRUE)
|
||||
continue;
|
||||
|
||||
UE_id = i;
|
||||
UE_list->num_UEs++;
|
||||
UE_list->active[UE_id] = TRUE;
|
||||
UE_list->rnti[UE_id] = rntiP;
|
||||
memset((void *) &UE_list->UE_sched_ctrl[UE_id],
|
||||
0,
|
||||
sizeof(NR_UE_sched_ctrl_t));
|
||||
LOG_D(MAC, "gNB %d] Add NR UE_id %d : rnti %x\n",
|
||||
mod_idP,
|
||||
UE_id,
|
||||
rntiP);
|
||||
dump_nr_ue_list(UE_list,
|
||||
0);
|
||||
return (UE_id);
|
||||
}
|
||||
|
||||
// printf("MAC: cannot add new UE for rnti %x\n", rntiP);
|
||||
LOG_E(MAC, "error in add_new_ue(), could not find space in UE_list, Dumping UE list\n");
|
||||
dump_nr_ue_list(UE_list,
|
||||
0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -41,7 +41,10 @@ void config_common(int Mod_idP,
|
||||
);
|
||||
int rrc_mac_config_req_gNB(module_id_t Mod_idP,
|
||||
int ssb_SubcarrierOffset,
|
||||
NR_ServingCellConfigCommon_t *scc
|
||||
NR_ServingCellConfigCommon_t *scc,
|
||||
int nsa_flag,
|
||||
uint32_t rnti,
|
||||
NR_CellGroupConfig_t *secondaryCellGroup
|
||||
);
|
||||
int is_nr_UL_slot(NR_COMMON_channels_t * ccP, int slotP);
|
||||
|
||||
|
||||
@@ -95,6 +95,28 @@ typedef struct {
|
||||
uint8_t num_sf_allocation_pattern;
|
||||
} NR_COMMON_channels_t;
|
||||
|
||||
/*! \brief scheduling control information set through an API (not used)*/
|
||||
typedef struct {
|
||||
int dummy;
|
||||
} NR_UE_sched_ctrl_t;
|
||||
|
||||
/*! \brief UE list used by eNB to order UEs/CC for scheduling*/
|
||||
typedef struct {
|
||||
|
||||
DLSCH_PDU DLSCH_pdu[4][MAX_MOBILES_PER_GNB];
|
||||
/// scheduling control info
|
||||
NR_UE_sched_ctrl_t UE_sched_ctrl[MAX_MOBILES_PER_GNB];
|
||||
int next[MAX_MOBILES_PER_GNB];
|
||||
int head;
|
||||
int next_ul[MAX_MOBILES_PER_GNB];
|
||||
int head_ul;
|
||||
int avail;
|
||||
int num_UEs;
|
||||
boolean_t active[MAX_MOBILES_PER_GNB];
|
||||
rnti_t rnti[MAX_MOBILES_PER_GNB];
|
||||
NR_CellGroupConfig_t *secondaryCellGroup[MAX_MOBILES_PER_GNB];
|
||||
} NR_UE_list_t;
|
||||
|
||||
/*! \brief top level eNB MAC structure */
|
||||
typedef struct gNB_MAC_INST_s {
|
||||
/// Ethernet parameters for northbound midhaul interface
|
||||
@@ -141,7 +163,7 @@ typedef struct gNB_MAC_INST_s {
|
||||
/// NFAPI search space structure
|
||||
nfapi_nr_search_space_t search_space[NFAPI_CC_MAX][NFAPI_NR_MAX_NB_SEARCH_SPACES];
|
||||
|
||||
UE_list_t UE_list;
|
||||
NR_UE_list_t UE_list;
|
||||
|
||||
/// UL handle
|
||||
uint32_t ul_handle;
|
||||
|
||||
@@ -196,7 +196,10 @@ static void init_NR_SI(gNB_RRC_INST *rrc) {
|
||||
|
||||
rrc_mac_config_req_gNB(rrc->module_id,
|
||||
rrc->carrier.ssb_SubcarrierOffset,
|
||||
(NR_ServingCellConfigCommon_t *)rrc->carrier.servingcellconfigcommon
|
||||
(NR_ServingCellConfigCommon_t *)rrc->carrier.servingcellconfigcommon,
|
||||
0,
|
||||
0,
|
||||
(NR_CellGroupConfig_t *)NULL
|
||||
);
|
||||
|
||||
|
||||
|
||||
@@ -133,6 +133,13 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_
|
||||
// Send to X2 entity to transport to MeNB
|
||||
|
||||
rrc->Nb_ue++;
|
||||
// configure MAC and RLC
|
||||
rrc_mac_config_req_gNB(rrc->module_id,
|
||||
rrc->carrier.ssb_SubcarrierOffset,
|
||||
NULL,
|
||||
1, // add_ue flag
|
||||
ue_context_p->ue_id_rnti,
|
||||
ue_context_p->ue_context.secondaryCellGroup);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -45,11 +45,11 @@
|
||||
#define true 1
|
||||
|
||||
void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellconfigcommon,
|
||||
NR_CellGroupConfig_t *secondaryCellGroup,
|
||||
int scg_id,
|
||||
int servCellIndex,
|
||||
int n_physical_antenna_ports,
|
||||
int initial_csi_index) {
|
||||
NR_CellGroupConfig_t *secondaryCellGroup,
|
||||
int scg_id,
|
||||
int servCellIndex,
|
||||
int n_physical_antenna_ports,
|
||||
int initial_csi_index) {
|
||||
AssertFatal(servingcellconfigcommon!=NULL,"servingcellconfigcommon is null\n");
|
||||
AssertFatal(secondaryCellGroup!=NULL,"secondaryCellGroup is null\n");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user