Commit 1a8c9a56 authored by Raymond Knopp's avatar Raymond Knopp

small changes for multiple lcid handling in gNB scheduler. PUSCH DTX handling...

small changes for multiple lcid handling in gNB scheduler. PUSCH DTX handling and suspension of scheduling when UL failure is detected
parent d81a5da4
......@@ -356,7 +356,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);
......@@ -675,9 +675,10 @@ void phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx)
dB_fixed_x10(gNB->pusch_vars[ULSCH_id]->ulsch_noise_power_tot) + gNB->pusch_thres) {
NR_gNB_SCH_STATS_t *stats=get_ulsch_stats(gNB,ulsch);
LOG_I(PHY, "PUSCH not detected in %d.%d (%d,%d,%d)\n",frame_rx,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;
if (stats) 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];
......@@ -341,7 +422,7 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP,
NR_ServingCellConfigCommon_t *scc,
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);
......@@ -425,6 +506,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(PHY,"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];
......@@ -472,6 +554,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);
......
......@@ -77,10 +77,12 @@ void dump_mac_stats(gNB_MAC_INST *gNB)
stats->num_rsrp_meas = 0;
stats->cumul_rsrp = 0 ;
LOG_I(MAC, "UE %d: dlsch_total_bytes %d\n", UE_id, stats->dlsch_total_bytes);
LOG_I(MAC, "UE %d: ulsch_rounds %d/%d/%d/%d, ulsch_errors %d\n",
LOG_I(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);
stats->ulsch_rounds[2], stats->ulsch_rounds[3],
stats->ulsch_DTX,
stats->ulsch_errors);
LOG_I(MAC,
"UE %d: ulsch_total_bytes_scheduled %d, ulsch_total_bytes_received %d\n",
UE_id,
......
......@@ -343,11 +343,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;
......@@ -374,11 +374,12 @@ void nr_store_dlsch_buffer(module_id_t module_id,
&& !sched_ctrl->ta_apply) /* If TA should be applied, give at least one RB */
return;
LOG_I(NR_MAC,
"[%s][%d.%d], DTCH%d->DLSCH, RLC status %d bytes TA %d\n",
LOG_D(NR_MAC,
"[%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);
......@@ -722,6 +723,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;
UE_info->mac_stats[UE_id].dlsch_current_bytes = 0;
/* update TA and set ta_apply every 10 frames.
......@@ -825,7 +827,8 @@ void nr_schedule_ue_spec(module_id_t module_id,
startSymbolIndex,
nrOfSymbols,
sched_ctrl->mcs,
TBS,((double)TBS)*(1<<scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.subcarrierSpacing))/1000,
TBS,
((double)TBS)*(1<<scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.subcarrierSpacing)/1000,
current_harq_pid,
harq->round,
harq->ndi);
......
......@@ -1722,6 +1722,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;
......
......@@ -126,6 +126,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];
......@@ -975,7 +976,7 @@ void handle_nr_uci_pucch_0_1(module_id_t mod_id,
sched_ctrl->tpc1 = nr_get_tpc(RC.nrmac[mod_id]->pucch_target_snrx10,
uci_01->ul_cqi,
30);
LOG_I(NR_MAC,"pucch tpc %d\n",sched_ctrl->tpc1);
LOG_D(NR_MAC,"pucch tpc %d\n",sched_ctrl->tpc1);
NR_ServingCellConfigCommon_t *scc = RC.nrmac[mod_id]->common_channels->ServingCellConfigCommon;
const int num_slots = nr_slots_per_frame[*scc->ssbSubcarrierSpacing];
if (((uci_01->pduBitmap >> 1) & 0x01)) {
......@@ -1149,7 +1150,7 @@ bool nr_acknack_scheduling(int mod_id,
}
}
LOG_I(MAC,"1. DL slot %d, UL_ACK %d\n",slot,pucch->ul_slot);
LOG_D(MAC,"1. DL slot %d, UL_ACK %d\n",slot,pucch->ul_slot);
/* if the UE's next PUCCH occasion is after the possible UL slots (within the
* same frame) or wrapped around to the next frame, then we assume there is
* no possible PUCCH allocation anymore */
......
......@@ -305,7 +305,7 @@ void nr_process_mac_pdu(
mac_subheader_len = 2;
}
LOG_I(NR_MAC, "[UE %d] Frame %d : ULSCH -> UL-DTCH %d (gNB %d, %d bytes)\n", module_idP, frameP, rx_lcid, module_idP, mac_sdu_len);
LOG_I(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);
int UE_id = find_nr_UE_id(module_idP, rnti);
RC.nrmac[module_idP]->UE_info.mac_stats[UE_id].lc_bytes_rx[rx_lcid] += mac_sdu_len;
#if defined(ENABLE_MAC_PAYLOAD_DEBUG)
......@@ -507,7 +507,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_I(NR_MAC,"Detected UL Failure on PUSCH, stopping scheduling\n");
UE_info->UE_sched_ctrl[UE_id].ul_failure = 1;
......@@ -771,7 +774,7 @@ void pf_ul(module_id_t module_id,
sched_pusch->mcs = mcs;
sched_pusch->R = nr_get_code_rate_ul(mcs, ps->mcs_table);
sched_pusch->Qm = nr_get_Qm_ul(mcs, ps->mcs_table);
LOG_W(NR_MAC, "Fixme: work around a NULL pointer (set in function nr_save_pusch_fields that is actually called)\n");
LOG_D(NR_MAC, "Fixme: work around a NULL pointer (set in function nr_save_pusch_fields that is actually called)\n");
if (ps->pusch_Config && (ps->pusch_Config->tp_pi2BPSK
&& ((ps->mcs_table == 3 && mcs < 2) || (ps->mcs_table == 4 && mcs < 6)))) {
sched_pusch->R >>= 1;
......@@ -1031,6 +1034,7 @@ void nr_schedule_ulsch(module_id_t module_id,
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
* every TTI are pre-populated by the preprocessor and used below */
......
......@@ -517,6 +517,7 @@ typedef struct {
/// DL HARQ PID to use for this UE, or -1 for "any new"
int8_t dl_harq_pid;
int lcid_mask;
uint16_t ta_frame;
int16_t ta_update;
bool ta_apply;
......@@ -562,6 +563,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;
......
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