gNB_scheduler in testing not complete yet
This commit is contained in:
@@ -70,14 +70,19 @@
|
||||
#ifdef LARGE_SCALE
|
||||
# define MAX_MOBILES_PER_ENB 128
|
||||
# define MAX_MOBILES_PER_ENB_NB_IoT 128
|
||||
# define MAX_MOBILES_PER_GNB 128
|
||||
# define MAX_eNB 2
|
||||
# define MAX_gNB 2
|
||||
#else
|
||||
# define MAX_MOBILES_PER_ENB 16
|
||||
# define MAX_MOBILES_PER_ENB_NB_IoT 16
|
||||
# define MAX_MOBILES_PER_GNB 16
|
||||
# define MAX_eNB 2
|
||||
# define MAX_gNB 2
|
||||
#endif
|
||||
|
||||
#define MAX_MANAGED_ENB_PER_MOBILE 2
|
||||
#define MAX_MANAGED_GNB_PER_MOBILE 2
|
||||
|
||||
///NB-IOT
|
||||
#define NB_RB_MAX_NB_IOT (maxDRB_NB_r13 + 3) //MP: NB_IoT --> 2(DRB)+3(SRBs - 2 is not used) = 5
|
||||
|
||||
@@ -33,16 +33,15 @@
|
||||
|
||||
#include "LAYER2/MAC/mac.h"
|
||||
#include "LAYER2/MAC/mac_extern.h"
|
||||
|
||||
#include "LAYER2/MAC/mac_proto.h"
|
||||
#include "LAYER2/NR_MAC_gNB/mac_proto.h"
|
||||
#include "UTIL/LOG/log.h"
|
||||
#include "UTIL/LOG/vcd_signal_dumper.h"
|
||||
#include "UTIL/OPT/opt.h"
|
||||
#include "OCG.h"
|
||||
#include "OCG_extern.h"
|
||||
|
||||
#include "RRC/LTE/rrc_extern.h"
|
||||
#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
|
||||
#include "RRC/NR/nr_rrc_extern.h"
|
||||
|
||||
//#include "LAYER2/MAC/pre_processor.c"
|
||||
#include "pdcp.h"
|
||||
@@ -65,28 +64,25 @@ extern int phy_test;
|
||||
|
||||
uint16_t pdcch_order_table[6] = { 31, 31, 511, 2047, 2047, 8191 };
|
||||
|
||||
void
|
||||
gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
|
||||
frame_t frameP,
|
||||
sub_frame_t subframeP)
|
||||
{
|
||||
|
||||
void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
|
||||
frame_t frameP,
|
||||
sub_frame_t subframeP){
|
||||
|
||||
int mbsfn_status[MAX_NUM_CCs];
|
||||
protocol_ctxt_t ctxt;
|
||||
|
||||
int CC_id, i = -1;
|
||||
UE_list_t *UE_list = &RC.mac[module_idP]->UE_list;
|
||||
UE_list_t *UE_list = &RC.nrmac[module_idP]->UE_list;
|
||||
rnti_t rnti;
|
||||
|
||||
COMMON_channels_t *cc = RC.mac[module_idP]->common_channels;
|
||||
COMMON_channels_t *cc = RC.nrmac[module_idP]->common_channels;
|
||||
|
||||
start_meas(&RC.mac[module_idP]->eNB_scheduler);
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
|
||||
(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ULSCH_SCHEDULER,
|
||||
VCD_FUNCTION_IN);
|
||||
start_meas(&RC.nrmac[module_idP]->eNB_scheduler);
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ULSCH_SCHEDULER,VCD_FUNCTION_IN);
|
||||
|
||||
RC.mac[module_idP]->frame = frameP;
|
||||
RC.mac[module_idP]->subframe = subframeP;
|
||||
RC.nrmac[module_idP]->frame = frameP;
|
||||
RC.nrmac[module_idP]->subframe = subframeP;
|
||||
|
||||
for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
|
||||
mbsfn_status[CC_id] = 0;
|
||||
@@ -95,23 +91,18 @@ gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
|
||||
memset(cc[CC_id].vrb_map, 0, 100);
|
||||
memset(cc[CC_id].vrb_map_UL, 0, 100);
|
||||
|
||||
|
||||
#if defined(Rel10) || defined(Rel14)
|
||||
cc[CC_id].mcch_active = 0;
|
||||
#endif
|
||||
|
||||
clear_nfapi_information(RC.mac[module_idP], CC_id, frameP, subframeP);
|
||||
clear_nfapi_information(RC.nrmac[module_idP], CC_id, frameP, subframeP);
|
||||
}
|
||||
|
||||
// refresh UE list based on UEs dropped by PHY in previous subframe
|
||||
for (i = 0; i < MAX_MOBILES_PER_ENB; i++) {
|
||||
for (i = 0; i < MAX_MOBILES_PER_GNB; i++) {
|
||||
if (UE_list->active[i]) {
|
||||
|
||||
rnti = UE_RNTI(module_idP, i);
|
||||
CC_id = UE_PCCID(module_idP, i);
|
||||
|
||||
if (((frameP&127) == 0) && (subframeP == 0)) {
|
||||
LOG_I(MAC,
|
||||
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 ==
|
||||
@@ -122,97 +113,90 @@ gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
|
||||
(UE_list->UE_sched_ctrl[i].pucch1_snr[CC_id] - 128) / 2);
|
||||
}
|
||||
|
||||
RC.eNB[module_idP][CC_id]->pusch_stats_bsr[i][(frameP * 10) +
|
||||
subframeP] = -63;
|
||||
RC.gNB[module_idP][CC_id]->pusch_stats_bsr[i][(frameP * 10) + subframeP] = -63;
|
||||
|
||||
if (i == UE_list->head)
|
||||
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME
|
||||
(VCD_SIGNAL_DUMPER_VARIABLES_UE0_BSR,
|
||||
RC.eNB[module_idP][CC_id]->
|
||||
pusch_stats_bsr[i][(frameP * 10) + subframeP]);
|
||||
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_UE0_BSR,RC.gNB[module_idP][CC_id]->
|
||||
pusch_stats_bsr[i][(frameP * 10) + subframeP]);
|
||||
|
||||
// increment this, it is cleared when we receive an sdu
|
||||
RC.mac[module_idP]->UE_list.UE_sched_ctrl[i].ul_inactivity_timer++;
|
||||
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);
|
||||
|
||||
RC.mac[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.mac[module_idP]->UE_list.UE_sched_ctrl[i].
|
||||
ul_inactivity_timer,
|
||||
RC.mac[module_idP]->UE_list.UE_sched_ctrl[i].cqi_req_timer);
|
||||
check_ul_failure(module_idP, CC_id, i, frameP, subframeP);
|
||||
|
||||
if (RC.mac[module_idP]->UE_list.UE_sched_ctrl[i].ue_reestablishment_reject_timer > 0) {
|
||||
RC.mac[module_idP]->UE_list.UE_sched_ctrl[i].ue_reestablishment_reject_timer++;
|
||||
if(RC.mac[module_idP]->UE_list.UE_sched_ctrl[i].ue_reestablishment_reject_timer >=
|
||||
RC.mac[module_idP]->UE_list.UE_sched_ctrl[i].ue_reestablishment_reject_timer_thres) {
|
||||
RC.mac[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_ENB; 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_ENB; ii++) {
|
||||
LTE_eNB_ULSCH_t *ulsch = RC.eNB[module_idP][CC_id]->ulsch[ii];
|
||||
if((ulsch != NULL) && (ulsch->rnti == rnti)){
|
||||
LOG_I(MAC, "clean_eNb_ulsch UE %x \n", rnti);
|
||||
clean_eNb_ulsch(ulsch);
|
||||
}
|
||||
}
|
||||
for (int ii=0; ii<MAX_MOBILES_PER_ENB; ii++) {
|
||||
LTE_eNB_DLSCH_t *dlsch = RC.eNB[module_idP][CC_id]->dlsch[ii][0];
|
||||
if((dlsch != NULL) && (dlsch->rnti == rnti)){
|
||||
LOG_I(MAC, "clean_eNb_dlsch UE %x \n", rnti);
|
||||
clean_eNb_dlsch(dlsch);
|
||||
}
|
||||
}
|
||||
|
||||
for(int j = 0; j < 10; j++){
|
||||
nfapi_ul_config_request_body_t *ul_req_tmp = NULL;
|
||||
ul_req_tmp = &RC.mac[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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, ENB_FLAG_YES,
|
||||
NOT_A_RNTI, frameP, subframeP,
|
||||
module_idP);
|
||||
pdcp_run(&ctxt);
|
||||
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++) {
|
||||
LTE_eNB_ULSCH_t *ulsch = RC.gNB[module_idP][CC_id]->ulsch[ii];
|
||||
if((ulsch != NULL) && (ulsch->rnti == rnti)){
|
||||
LOG_I(MAC, "clean_eNb_ulsch UE %x \n", rnti);
|
||||
clean_eNb_ulsch(ulsch);
|
||||
}
|
||||
}
|
||||
|
||||
for (int ii=0; ii<MAX_MOBILES_PER_GNB; ii++) {
|
||||
LTE_eNB_DLSCH_t *dlsch = RC.gNB[module_idP][CC_id]->dlsch[ii][0];
|
||||
if((dlsch != NULL) && (dlsch->rnti == rnti)){
|
||||
LOG_I(MAC, "clean_eNb_dlsch UE %x \n", rnti);
|
||||
clean_eNb_dlsch(dlsch);
|
||||
}
|
||||
}
|
||||
|
||||
for(int j = 0; j < 10; j++){
|
||||
nfapi_ul_config_request_body_t *ul_req_tmp = NULL;
|
||||
ul_req_tmp = &RC.mac[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++)
|
||||
|
||||
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, ENB_FLAG_YES,NOT_A_RNTI, frameP, subframeP,module_idP);
|
||||
|
||||
pdcp_run(&ctxt);
|
||||
|
||||
rrc_rx_tx(&ctxt, CC_id);
|
||||
|
||||
#if defined(Rel10) || defined(Rel14)
|
||||
|
||||
for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
|
||||
if (cc[CC_id].MBMS_flag > 0) {
|
||||
start_meas(&RC.mac[module_idP]->schedule_mch);
|
||||
mbsfn_status[CC_id] = schedule_MBMS(module_idP, CC_id, frameP, subframeP);
|
||||
stop_meas(&RC.mac[module_idP]->schedule_mch);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// This schedules MIB
|
||||
|
||||
if ((subframeP == 0) && (frameP & 3) == 0)
|
||||
schedule_mib(module_idP, frameP, subframeP);
|
||||
if((subframeP == 0) && (frameP & 7) == 0){
|
||||
schedule_nr_mib(module_idP, frameP, subframeP);
|
||||
}
|
||||
/*
|
||||
if (phy_test == 0){
|
||||
// This schedules SI for legacy LTE and eMTC starting in subframeP
|
||||
schedule_SI(module_idP, frameP, subframeP);
|
||||
@@ -237,17 +221,16 @@ gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
|
||||
schedule_ulsch_phy_test(module_idP,frameP,subframeP);
|
||||
schedule_ue_spec_phy_test(module_idP,frameP,subframeP,mbsfn_status);
|
||||
}
|
||||
*/
|
||||
|
||||
if (RC.flexran[module_idP]->enabled)
|
||||
flexran_agent_send_update_stats(module_idP);
|
||||
|
||||
// Allocate CCEs for good after scheduling is done
|
||||
for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++)
|
||||
allocate_CCEs(module_idP, CC_id, subframeP, 0);
|
||||
allocate_CCEs(module_idP, CC_id, subframeP, 0);
|
||||
|
||||
stop_meas(&RC.mac[module_idP]->eNB_scheduler);
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
|
||||
(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ULSCH_SCHEDULER,
|
||||
VCD_FUNCTION_OUT);
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ULSCH_SCHEDULER,VCD_FUNCTION_OUT);
|
||||
}
|
||||
@@ -107,6 +107,11 @@ typedef struct gNB_MAC_INST_s {
|
||||
sub_frame_t subframe;
|
||||
/// Pointer to IF module instance for PHY
|
||||
NR_IF_Module_t *if_inst;
|
||||
/// Common cell resources
|
||||
NR_COMMON_channels_t common_channels[NFAPI_CC_MAX];
|
||||
/// current PDU index (BCH,DLSCH)
|
||||
uint16_t pdu_index[NFAPI_CC_MAX];
|
||||
|
||||
/// NFAPI Config Request Structure
|
||||
nfapi_nr_config_request_t config[NFAPI_CC_MAX];
|
||||
/// NFAPI DL Config Request Structure
|
||||
@@ -121,12 +126,30 @@ typedef struct gNB_MAC_INST_s {
|
||||
nfapi_hi_dci0_request_t HI_DCI0_req[NFAPI_CC_MAX];
|
||||
/// NFAPI DL PDU structure
|
||||
nfapi_tx_request_t TX_req[NFAPI_CC_MAX];
|
||||
/// Common cell resources
|
||||
NR_COMMON_channels_t common_channels[NFAPI_CC_MAX];
|
||||
/// current PDU index (BCH,DLSCH)
|
||||
uint16_t pdu_index[NFAPI_CC_MAX];
|
||||
|
||||
UE_list_t UE_list;
|
||||
|
||||
// MAC function execution peformance profiler
|
||||
/// processing time of eNB scheduler
|
||||
time_stats_t eNB_scheduler;
|
||||
/// processing time of eNB scheduler for SI
|
||||
time_stats_t schedule_si;
|
||||
/// processing time of eNB scheduler for Random access
|
||||
time_stats_t schedule_ra;
|
||||
/// processing time of eNB ULSCH scheduler
|
||||
time_stats_t schedule_ulsch;
|
||||
/// processing time of eNB DCI generation
|
||||
time_stats_t fill_DLSCH_dci;
|
||||
/// processing time of eNB MAC preprocessor
|
||||
time_stats_t schedule_dlsch_preprocessor;
|
||||
/// processing time of eNB DLSCH scheduler
|
||||
time_stats_t schedule_dlsch; // include rlc_data_req + MAC header + preprocessor
|
||||
/// processing time of eNB MCH scheduler
|
||||
time_stats_t schedule_mch;
|
||||
/// processing time of eNB ULSCH reception
|
||||
time_stats_t rx_ulsch_sdu; // include rlc_data_ind
|
||||
/// processing time of eNB PCH scheduler
|
||||
time_stats_t schedule_pch;
|
||||
} gNB_MAC_INST;
|
||||
|
||||
#endif /*__LAYER2_NR_MAC_DEFS_H__ */
|
||||
|
||||
@@ -19,4 +19,8 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP,
|
||||
NR_ServingCellConfigCommon_t *servingcellconfigcommon
|
||||
);
|
||||
|
||||
void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
|
||||
frame_t frameP,
|
||||
sub_frame_t subframeP);
|
||||
|
||||
#endif /*__LAYER2_NR_MAC_PROTO_H__*/
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "openair2/NR_PHY_INTERFACE/NR_IF_Module.h"
|
||||
#include "openair1/PHY/phy_extern.h"
|
||||
#include "LAYER2/MAC/mac_extern.h"
|
||||
#include "LAYER2/MAC/mac_proto.h"
|
||||
#include "LAYER2/NR_MAC_gNB/mac_proto.h"
|
||||
#include "common/ran_context.h"
|
||||
|
||||
@@ -284,7 +285,11 @@ void NR_UL_indication(NR_UL_IND_t *UL_info)
|
||||
eNB_dlsch_ulsch_scheduler(module_id,
|
||||
(UL_info->frame+((UL_info->subframe>(9-sf_ahead))?1:0)) % 1024,
|
||||
(UL_info->subframe+sf_ahead)%10);
|
||||
|
||||
/*
|
||||
gNB_dlsch_ulsch_scheduler(module_id,
|
||||
(UL_info->frame+((UL_info->subframe>(9-sf_ahead))?1:0)) % 1024,
|
||||
(UL_info->subframe+sf_ahead)%10);
|
||||
*/
|
||||
ifi->CC_mask = 0;
|
||||
|
||||
sched_info->module_id = module_id;
|
||||
|
||||
Reference in New Issue
Block a user