small changes for multiple lcid handling in gNB scheduler. PUSCH DTX handling and suspension of scheduling when UL failure is detected
This commit is contained in:
@@ -355,7 +355,7 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int ULSCH
|
||||
}
|
||||
|
||||
|
||||
void nr_fill_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int ULSCH_id, uint8_t harq_pid, uint8_t crc_flag) {
|
||||
void nr_fill_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int ULSCH_id, uint8_t harq_pid, uint8_t crc_flag) {
|
||||
|
||||
pthread_mutex_lock(&gNB->UL_INFO_mutex);
|
||||
|
||||
@@ -683,6 +683,7 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) {
|
||||
LOG_D(PHY, "PUSCH not detected in %d.%d (%d,%d,%d)\n",frame_rx,slot_rx,
|
||||
dB_fixed_x10(gNB->pusch_vars[ULSCH_id]->ulsch_power_tot),
|
||||
dB_fixed_x10(gNB->pusch_vars[ULSCH_id]->ulsch_noise_power_tot),gNB->pusch_thres);
|
||||
gNB->pusch_vars[ULSCH_id]->ulsch_power_tot = gNB->pusch_vars[ULSCH_id]->ulsch_noise_power_tot;
|
||||
nr_fill_indication(gNB,frame_rx, slot_rx, ULSCH_id, harq_pid, 1);
|
||||
gNB->pusch_vars[ULSCH_id]->DTX=1;
|
||||
stats->DTX++;
|
||||
|
||||
@@ -54,6 +54,87 @@ extern RAN_CONTEXT_t RC;
|
||||
extern void mac_top_init_gNB(void);
|
||||
extern uint8_t nfapi_mode;
|
||||
|
||||
void process_rlcBearerConfig(struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_bearer2add_list,
|
||||
struct NR_CellGroupConfig__rlc_BearerToReleaseList *rlc_bearer2release_list,
|
||||
NR_UE_sched_ctrl_t *sched_ctrl) {
|
||||
|
||||
if (rlc_bearer2add_list)
|
||||
// keep lcids
|
||||
for (int i=0;i<rlc_bearer2add_list->list.count;i++) {
|
||||
sched_ctrl->lcid_mask |= (1<<rlc_bearer2add_list->list.array[i]->logicalChannelIdentity);
|
||||
LOG_I(NR_MAC,"Adding LCID %d (%s %d)\n",
|
||||
(int)rlc_bearer2add_list->list.array[i]->logicalChannelIdentity,
|
||||
rlc_bearer2add_list->list.array[i]->logicalChannelIdentity<4 ? "SRB" : "DRB",
|
||||
(int)rlc_bearer2add_list->list.array[i]->logicalChannelIdentity);
|
||||
}
|
||||
if (rlc_bearer2release_list)
|
||||
for (int i=0;i<rlc_bearer2release_list->list.count;i++)
|
||||
sched_ctrl->lcid_mask |= (1<<*rlc_bearer2release_list->list.array[i]);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void process_drx_Config(NR_UE_sched_ctrl_t *sched_ctrl,NR_SetupRelease_DRX_Config_t *drx_Config) {
|
||||
if (!drx_Config) return;
|
||||
AssertFatal(drx_Config->present != NR_SetupRelease_DRX_Config_PR_NOTHING, "Cannot have NR_SetupRelease_DRX_Config_PR_NOTHING\n");
|
||||
|
||||
if (drx_Config->present == NR_SetupRelease_DRX_Config_PR_setup) {
|
||||
LOG_I(NR_MAC,"Adding DRX config\n");
|
||||
}
|
||||
else {
|
||||
LOG_I(NR_MAC,"Removing DRX config\n");
|
||||
}
|
||||
}
|
||||
|
||||
void process_schedulingRequestConfig(NR_UE_sched_ctrl_t *sched_ctrl,NR_SchedulingRequestConfig_t *schedulingRequestConfig) {
|
||||
if (!schedulingRequestConfig) return;
|
||||
|
||||
LOG_I(NR_MAC,"Adding SchedulingRequestconfig\n");
|
||||
}
|
||||
|
||||
void process_bsrConfig(NR_UE_sched_ctrl_t *sched_ctrl,NR_BSR_Config_t *bsr_Config) {
|
||||
if (!bsr_Config) return;
|
||||
LOG_I(NR_MAC,"Adding BSR config\n");
|
||||
}
|
||||
|
||||
void process_tag_Config(NR_UE_sched_ctrl_t *sched_ctrl,NR_TAG_Config_t *tag_Config) {
|
||||
if (!tag_Config) return;
|
||||
LOG_I(NR_MAC,"Adding TAG config\n");
|
||||
}
|
||||
|
||||
void process_phr_Config(NR_UE_sched_ctrl_t *sched_ctrl,NR_SetupRelease_PHR_Config_t *phr_Config) {
|
||||
if (!phr_Config) return;
|
||||
AssertFatal(phr_Config->present != NR_SetupRelease_PHR_Config_PR_NOTHING, "Cannot have NR_SetupRelease_PHR_Config_PR_NOTHING\n");
|
||||
|
||||
if (phr_Config->present == NR_SetupRelease_PHR_Config_PR_setup) {
|
||||
LOG_I(NR_MAC,"Adding PHR config\n");
|
||||
}
|
||||
else {
|
||||
LOG_I(NR_MAC,"Removing PHR config\n");
|
||||
}
|
||||
}
|
||||
|
||||
void process_CellGroup(NR_CellGroupConfig_t *CellGroup, NR_UE_sched_ctrl_t *sched_ctrl) {
|
||||
|
||||
AssertFatal(CellGroup, "CellGroup is null\n");
|
||||
NR_MAC_CellGroupConfig_t *mac_CellGroupConfig = CellGroup->mac_CellGroupConfig;
|
||||
|
||||
|
||||
if (mac_CellGroupConfig) {
|
||||
process_drx_Config(sched_ctrl,mac_CellGroupConfig->drx_Config);
|
||||
process_schedulingRequestConfig(sched_ctrl,mac_CellGroupConfig->schedulingRequestConfig);
|
||||
process_bsrConfig(sched_ctrl,mac_CellGroupConfig->bsr_Config);
|
||||
process_tag_Config(sched_ctrl,mac_CellGroupConfig->tag_Config);
|
||||
process_phr_Config(sched_ctrl,mac_CellGroupConfig->phr_Config);
|
||||
}
|
||||
else {
|
||||
// apply defaults
|
||||
|
||||
}
|
||||
|
||||
process_rlcBearerConfig(CellGroup->rlc_BearerToAddModList,CellGroup->rlc_BearerToReleaseList,sched_ctrl);
|
||||
|
||||
}
|
||||
void config_common(int Mod_idP, int ssb_SubcarrierOffset, int pdsch_AntennaPorts, int pusch_AntennaPorts, NR_ServingCellConfigCommon_t *scc) {
|
||||
|
||||
nfapi_nr_config_request_scf_t *cfg = &RC.nrmac[Mod_idP]->config[0];
|
||||
@@ -339,9 +420,9 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP,
|
||||
int pdsch_AntennaPorts,
|
||||
int pusch_AntennaPorts,
|
||||
NR_ServingCellConfigCommon_t *scc,
|
||||
int add_ue,
|
||||
int add_ue,
|
||||
uint32_t rnti,
|
||||
NR_CellGroupConfig_t *CellGroup){
|
||||
NR_CellGroupConfig_t *CellGroup) {
|
||||
|
||||
if (scc != NULL ) {
|
||||
AssertFatal((scc->ssb_PositionsInBurst->present > 0) && (scc->ssb_PositionsInBurst->present < 4), "SSB Bitmap type %d is not valid\n",scc->ssb_PositionsInBurst->present);
|
||||
@@ -427,12 +508,12 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP,
|
||||
if (get_softmodem_params()->sa > 0) {
|
||||
NR_COMMON_channels_t *cc = &RC.nrmac[Mod_idP]->common_channels[0];
|
||||
for (int n=0;n<NR_NB_RA_PROC_MAX;n++ ) {
|
||||
cc->ra[n].cfra = false;
|
||||
cc->ra[n].rnti = 0;
|
||||
cc->ra[n].preambles.num_preambles = MAX_NUM_NR_PRACH_PREAMBLES;
|
||||
cc->ra[n].preambles.preamble_list = (uint8_t *) malloc(MAX_NUM_NR_PRACH_PREAMBLES*sizeof(uint8_t));
|
||||
for (int i = 0; i < MAX_NUM_NR_PRACH_PREAMBLES; i++)
|
||||
cc->ra[n].preambles.preamble_list[i] = i;
|
||||
cc->ra[n].cfra = false;
|
||||
cc->ra[n].rnti = 0;
|
||||
cc->ra[n].preambles.num_preambles = MAX_NUM_NR_PRACH_PREAMBLES;
|
||||
cc->ra[n].preambles.preamble_list = (uint8_t *) malloc(MAX_NUM_NR_PRACH_PREAMBLES*sizeof(uint8_t));
|
||||
for (int i = 0; i < MAX_NUM_NR_PRACH_PREAMBLES; i++)
|
||||
cc->ra[n].preambles.preamble_list[i] = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -463,6 +544,7 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP,
|
||||
if (add_ue == 1 && get_softmodem_params()->phy_test) {
|
||||
const int UE_id = add_new_nr_ue(Mod_idP, rnti, CellGroup);
|
||||
LOG_I(NR_MAC,"Added new UE_id %d/%x with initial CellGroup\n",UE_id,rnti);
|
||||
process_CellGroup(CellGroup,&UE_info->UE_sched_ctrl[UE_id]);
|
||||
} else if (add_ue == 1 && !get_softmodem_params()->phy_test) {
|
||||
const int CC_id = 0;
|
||||
NR_COMMON_channels_t *cc = &RC.nrmac[Mod_idP]->common_channels[CC_id];
|
||||
@@ -510,6 +592,7 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP,
|
||||
const int UE_id = find_nr_UE_id(Mod_idP,rnti);
|
||||
UE_info->CellGroup[UE_id] = CellGroup;
|
||||
LOG_I(NR_MAC,"Modified UE_id %d/%x with CellGroup\n",UE_id,rnti);
|
||||
process_CellGroup(CellGroup,&UE_info->UE_sched_ctrl[UE_id]);
|
||||
}
|
||||
}
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_MAC_CONFIG, VCD_FUNCTION_OUT);
|
||||
|
||||
@@ -83,15 +83,12 @@ void dump_mac_stats(gNB_MAC_INST *gNB)
|
||||
stats->num_rsrp_meas = 0;
|
||||
stats->cumul_rsrp = 0 ;
|
||||
LOG_I(NR_MAC, "UE %d: dlsch_total_bytes %d\n", UE_id, stats->dlsch_total_bytes);
|
||||
const NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
|
||||
LOG_I(NR_MAC, "UE %d: ulsch_rounds %d/%d/%d/%d, ulsch_errors %d, PUSCH SNR %2.1f dB, PUCCH SNR %2.1f dB, noise rssi %2.1f dB\n",
|
||||
LOG_I(NR_MAC, "UE %d: ulsch_rounds %d/%d/%d/%d, ulsch_DTX %d, ulsch_errors %d\n",
|
||||
UE_id,
|
||||
stats->ulsch_rounds[0], stats->ulsch_rounds[1],
|
||||
stats->ulsch_rounds[2], stats->ulsch_rounds[3],
|
||||
stats->ulsch_errors,
|
||||
(float) sched_ctrl->pusch_snrx10 / 10,
|
||||
(float) sched_ctrl->pucch_snrx10 / 10,
|
||||
(float) (sched_ctrl->raw_rssi - 1280) / 10);
|
||||
stats->ulsch_DTX,
|
||||
stats->ulsch_errors);
|
||||
LOG_I(NR_MAC,
|
||||
"UE %d: ulsch_total_bytes_scheduled %d, ulsch_total_bytes_received %d\n",
|
||||
UE_id,
|
||||
|
||||
@@ -390,11 +390,11 @@ void nr_store_dlsch_buffer(module_id_t module_id,
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
|
||||
|
||||
sched_ctrl->num_total_bytes = 0;
|
||||
if (loop_dcch_dtch == DL_SCH_LCID_DCCH1)
|
||||
if ((sched_ctrl->lcid_mask&(1<<4)) > 0 && loop_dcch_dtch == DL_SCH_LCID_DCCH1)
|
||||
loop_dcch_dtch = DL_SCH_LCID_DTCH;
|
||||
else if (loop_dcch_dtch == DL_SCH_LCID_DTCH)
|
||||
else if ((sched_ctrl->lcid_mask&(1<<1)) > 0 && loop_dcch_dtch == DL_SCH_LCID_DTCH)
|
||||
loop_dcch_dtch = DL_SCH_LCID_DCCH;
|
||||
else if (loop_dcch_dtch == DL_SCH_LCID_DCCH)
|
||||
else if ((sched_ctrl->lcid_mask&(1<<2)) > 0 && loop_dcch_dtch == DL_SCH_LCID_DCCH)
|
||||
loop_dcch_dtch = DL_SCH_LCID_DCCH1;
|
||||
|
||||
const int lcid = loop_dcch_dtch;
|
||||
@@ -423,10 +423,11 @@ void nr_store_dlsch_buffer(module_id_t module_id,
|
||||
return;
|
||||
|
||||
LOG_D(NR_MAC,
|
||||
"[%s][%d.%d], DTCH%d->DLSCH, RLC status %d bytes TA %d\n",
|
||||
"[%s][%d.%d], %s%d->DLSCH, RLC status %d bytes TA %d\n",
|
||||
__func__,
|
||||
frame,
|
||||
slot,
|
||||
lcid<4?"DCCH":"DTCH",
|
||||
lcid,
|
||||
sched_ctrl->rlc_status[lcid].bytes_in_buffer,
|
||||
sched_ctrl->ta_apply);
|
||||
@@ -654,7 +655,7 @@ void pf_dl(module_id_t module_id,
|
||||
* allocation after CCE alloc fail would be more complex) */
|
||||
const int alloc = nr_acknack_scheduling(module_id, UE_id, frame, slot, -1);
|
||||
if (alloc<0) {
|
||||
LOG_D(MAC,
|
||||
LOG_D(NR_MAC,
|
||||
"%s(): could not find PUCCH for UE %d/%04x@%d.%d\n",
|
||||
__func__,
|
||||
UE_id,
|
||||
@@ -800,6 +801,7 @@ void nr_schedule_ue_spec(module_id_t module_id,
|
||||
NR_list_t *UE_list = &UE_info->list;
|
||||
for (int UE_id = UE_list->head; UE_id >= 0; UE_id = UE_list->next[UE_id]) {
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
|
||||
if (sched_ctrl->ul_failure==1) continue;
|
||||
NR_sched_pdsch_t *sched_pdsch = &sched_ctrl->sched_pdsch;
|
||||
UE_info->mac_stats[UE_id].dlsch_current_bytes = 0;
|
||||
|
||||
|
||||
@@ -1839,6 +1839,7 @@ int add_new_nr_ue(module_id_t mod_idP, rnti_t rntiP, NR_CellGroupConfig_t *CellG
|
||||
compute_csi_bitlen (CellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup, UE_info, UE_id, mod_idP);
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
|
||||
memset(sched_ctrl, 0, sizeof(*sched_ctrl));
|
||||
sched_ctrl->lcid_mask = 0;
|
||||
sched_ctrl->ta_frame = 0;
|
||||
sched_ctrl->ta_update = 31;
|
||||
sched_ctrl->ta_apply = false;
|
||||
|
||||
@@ -131,6 +131,7 @@ void nr_schedule_pucch(int Mod_idP,
|
||||
|
||||
for (int UE_id = UE_list->head; UE_id >= 0; UE_id = UE_list->next[UE_id]) {
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
|
||||
if (sched_ctrl->ul_failure==1) continue;
|
||||
const int n = sizeof(sched_ctrl->sched_pucch) / sizeof(*sched_ctrl->sched_pucch);
|
||||
for (int i = 0; i < n; i++) {
|
||||
NR_sched_pucch_t *curr_pucch = &UE_info->UE_sched_ctrl[UE_id].sched_pucch[i];
|
||||
|
||||
@@ -437,10 +437,10 @@ void nr_process_mac_pdu(module_id_t module_idP,
|
||||
mac_subheader_len = 2;
|
||||
}
|
||||
|
||||
LOG_D(NR_MAC,
|
||||
"[UE %d] Frame %d : ULSCH -> UL-DTCH %d (gNB %d, %d bytes)\n",
|
||||
LOG_D(NR_MAC, "[UE %d] Frame %d : ULSCH -> UL-%s %d (gNB %d, %d bytes)\n",
|
||||
module_idP,
|
||||
frameP,
|
||||
rx_lcid<4?"DCCH":"DTCH",
|
||||
rx_lcid,
|
||||
module_idP,
|
||||
mac_sdu_len);
|
||||
@@ -655,7 +655,10 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP,
|
||||
if (UE_scheduling_control->sched_ul_bytes < 0)
|
||||
UE_scheduling_control->sched_ul_bytes = 0;
|
||||
}
|
||||
if (ul_cqi < 128) UE_info->UE_sched_ctrl[UE_id].pusch_consecutive_dtx_cnt++;
|
||||
if (ul_cqi <= 128) {
|
||||
UE_info->UE_sched_ctrl[UE_id].pusch_consecutive_dtx_cnt++;
|
||||
UE_info->mac_stats[UE_id].ulsch_DTX++;
|
||||
}
|
||||
if (UE_info->UE_sched_ctrl[UE_id].pusch_consecutive_dtx_cnt >= pusch_failure_thres) {
|
||||
LOG_D(NR_MAC,"Detected UL Failure on PUSCH, stopping scheduling\n");
|
||||
UE_info->UE_sched_ctrl[UE_id].ul_failure = 1;
|
||||
@@ -1306,6 +1309,7 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot)
|
||||
const NR_list_t *UE_list = &UE_info->list;
|
||||
for (int UE_id = UE_list->head; UE_id >= 0; UE_id = UE_list->next[UE_id]) {
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
|
||||
if (sched_ctrl->ul_failure == 1) continue;
|
||||
UE_info->mac_stats[UE_id].ulsch_current_bytes = 0;
|
||||
|
||||
/* dynamic PUSCH values (RB alloc, MCS, hence R, Qm, TBS) that change in
|
||||
|
||||
@@ -52,9 +52,9 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP,
|
||||
int pdsch_AntennaPorts,
|
||||
int pusch_AntennaPorts,
|
||||
NR_ServingCellConfigCommon_t *scc,
|
||||
int nsa_flag,
|
||||
uint32_t rnti,
|
||||
NR_CellGroupConfig_t *CellGroup
|
||||
int nsa_flag,
|
||||
uint32_t rnti,
|
||||
NR_CellGroupConfig_t *CellGroup
|
||||
);
|
||||
|
||||
void clear_nr_nfapi_information(gNB_MAC_INST * gNB,
|
||||
|
||||
@@ -558,6 +558,7 @@ typedef struct {
|
||||
/// per-LC status data
|
||||
mac_rlc_status_resp_t rlc_status[MAX_NUM_LCID];
|
||||
|
||||
int lcid_mask;
|
||||
uint16_t ta_frame;
|
||||
int16_t ta_update;
|
||||
bool ta_apply;
|
||||
@@ -607,6 +608,7 @@ typedef struct {
|
||||
int dlsch_current_bytes;
|
||||
int ulsch_rounds[8];
|
||||
int ulsch_errors;
|
||||
int ulsch_DTX;
|
||||
int ulsch_total_bytes_scheduled;
|
||||
int ulsch_total_bytes_rx;
|
||||
int ulsch_current_bytes;
|
||||
|
||||
Reference in New Issue
Block a user