Commit 7ba25173 authored by luis_pereira87's avatar luis_pereira87

Improve nr_rrc_processing_timer to support BWP switching

parent 345b66c7
...@@ -518,7 +518,7 @@ void nr_store_dlsch_buffer(module_id_t module_id, ...@@ -518,7 +518,7 @@ void nr_store_dlsch_buffer(module_id_t module_id,
lcid = DL_SCH_LCID_DCCH; lcid = DL_SCH_LCID_DCCH;
} else if (sched_ctrl->rlc_status[DL_SCH_LCID_DCCH1].bytes_in_buffer > 0) { } else if (sched_ctrl->rlc_status[DL_SCH_LCID_DCCH1].bytes_in_buffer > 0) {
lcid = DL_SCH_LCID_DCCH1; lcid = DL_SCH_LCID_DCCH1;
} else if ( (sched_ctrl->bwp_switch_info.bwp_switch_state != BWP_SWITCH_RUNNING) || (sched_ctrl->schedule_enabled == true) ) { } else if (sched_ctrl->schedule_enabled == true) {
lcid = DL_SCH_LCID_DTCH; lcid = DL_SCH_LCID_DTCH;
} else { } else {
continue; continue;
...@@ -1015,14 +1015,16 @@ void nr_bwp_switch(module_id_t module_id, ...@@ -1015,14 +1015,16 @@ void nr_bwp_switch(module_id_t module_id,
case BWP_SWITCH_TO_START: case BWP_SWITCH_TO_START:
LOG_W(NR_MAC,"(%d.%d) [UE_id %d] Schedule BWP switch from bwp_id %ld to %d\n", LOG_W(NR_MAC,"(%d.%d) [UE_id %d] Schedule BWP switch from bwp_id %ld to %d\n",
frame, slot, UE_id, UE_info->UE_sched_ctrl[UE_id].active_bwp->bwp_Id, bwp_id); frame, slot, UE_id, UE_info->UE_sched_ctrl[UE_id].active_bwp->bwp_Id, bwp_id);
sched_ctrl->bwp_switch_info.bwp_switch_timer = 0;
sched_ctrl->bwp_switch_info.bwp_switch_state = BWP_SWITCH_RUNNING; sched_ctrl->bwp_switch_info.bwp_switch_state = BWP_SWITCH_RUNNING;
sched_ctrl->bwp_switch_info.bwp_switch_slot = slot;
nr_mac_rrc_bwp_switch_req(module_id, frame, slot, UE_info->rnti[UE_id], bwp_id); nr_mac_rrc_bwp_switch_req(module_id, frame, slot, UE_info->rnti[UE_id], bwp_id);
break; break;
case BWP_SWITCH_RUNNING: case BWP_SWITCH_RUNNING:
sched_ctrl->bwp_switch_info.bwp_switch_timer++; // The BWP switching takes at least 10+6 ms (3GPP TS 38.331 Section 12)
if(sched_ctrl->bwp_switch_info.bwp_switch_timer == sched_ctrl->bwp_switch_info.bwp_switch_delay) { // gNB needs time to schedule and send RRCReconfiguration message
// Therefore, we wait for the same slot in next frame (10 ms) before update bwp_id in the gNB
if (sched_ctrl->bwp_switch_info.bwp_switch_slot == slot) {
const NR_ServingCellConfig_t *servingCellConfig = UE_info->CellGroup[UE_id] ? UE_info->CellGroup[UE_id]->spCellConfig->spCellConfigDedicated : NULL; const NR_ServingCellConfig_t *servingCellConfig = UE_info->CellGroup[UE_id] ? UE_info->CellGroup[UE_id]->spCellConfig->spCellConfigDedicated : NULL;
const struct NR_ServingCellConfig__downlinkBWP_ToAddModList *bwpList = servingCellConfig ? servingCellConfig->downlinkBWP_ToAddModList : NULL; const struct NR_ServingCellConfig__downlinkBWP_ToAddModList *bwpList = servingCellConfig ? servingCellConfig->downlinkBWP_ToAddModList : NULL;
const int bwp_id = servingCellConfig && servingCellConfig->firstActiveDownlinkBWP_Id ? const int bwp_id = servingCellConfig && servingCellConfig->firstActiveDownlinkBWP_Id ?
......
...@@ -2260,9 +2260,7 @@ int add_new_nr_ue(module_id_t mod_idP, rnti_t rntiP, NR_CellGroupConfig_t *CellG ...@@ -2260,9 +2260,7 @@ int add_new_nr_ue(module_id_t mod_idP, rnti_t rntiP, NR_CellGroupConfig_t *CellG
NULL); NULL);
sched_ctrl->bwp_switch_info.current_bwp = bwp_id; sched_ctrl->bwp_switch_info.current_bwp = bwp_id;
sched_ctrl->bwp_switch_info.next_bwp = -1; sched_ctrl->bwp_switch_info.next_bwp = -1;
sched_ctrl->bwp_switch_info.bwp_switch_timer = 0;
sched_ctrl->bwp_switch_info.bwp_switch_state = BWP_SWITCH_INACTIVE; sched_ctrl->bwp_switch_info.bwp_switch_state = BWP_SWITCH_INACTIVE;
sched_ctrl->bwp_switch_info.bwp_switch_delay = 40;
const struct NR_UplinkConfig__uplinkBWP_ToAddModList *ubwpList = servingCellConfig ? servingCellConfig->uplinkConfig->uplinkBWP_ToAddModList : NULL; const struct NR_UplinkConfig__uplinkBWP_ToAddModList *ubwpList = servingCellConfig ? servingCellConfig->uplinkConfig->uplinkBWP_ToAddModList : NULL;
if (ubwpList) AssertFatal(ubwpList->list.count <= NR_MAX_NUM_BWP, if (ubwpList) AssertFatal(ubwpList->list.count <= NR_MAX_NUM_BWP,
"uplinkBWP_ToAddModList has %d BWP!\n", "uplinkBWP_ToAddModList has %d BWP!\n",
......
...@@ -1181,10 +1181,6 @@ void pf_ul(module_id_t module_id, ...@@ -1181,10 +1181,6 @@ void pf_ul(module_id_t module_id,
continue; continue;
} }
if(sched_ctrl->bwp_switch_info.bwp_switch_state == BWP_SWITCH_RUNNING) {
continue;
}
/* Schedule UE on SR or UL inactivity and no data (otherwise, will be scheduled /* Schedule UE on SR or UL inactivity and no data (otherwise, will be scheduled
* based on data to transmit) */ * based on data to transmit) */
if (B == 0 && do_sched) { if (B == 0 && do_sched) {
......
...@@ -566,8 +566,7 @@ typedef enum { ...@@ -566,8 +566,7 @@ typedef enum {
typedef struct NR_BWP_switch_info { typedef struct NR_BWP_switch_info {
NR_BWP_Id_t current_bwp; NR_BWP_Id_t current_bwp;
NR_BWP_Id_t next_bwp; NR_BWP_Id_t next_bwp;
int bwp_switch_timer; sub_frame_t bwp_switch_slot;
uint8_t bwp_switch_delay;
NR_BWP_switch_states_t bwp_switch_state; NR_BWP_switch_states_t bwp_switch_state;
} NR_BWP_switch_info_t; } NR_BWP_switch_info_t;
......
...@@ -414,7 +414,13 @@ void nr_mac_gNB_enable_rrc_processing_timer_req(const module_id_t Mod_instP, con ...@@ -414,7 +414,13 @@ void nr_mac_gNB_enable_rrc_processing_timer_req(const module_id_t Mod_instP, con
ue_context_p = rrc_gNB_get_ue_context(RC.nrrrc[Mod_instP], rntiP); ue_context_p = rrc_gNB_get_ue_context(RC.nrrrc[Mod_instP], rntiP);
if (ue_context_p != NULL) { if (ue_context_p != NULL) {
ue_context_p->ue_context.nr_rrc_processing_timer = 1; ue_context_p->ue_context.nr_rrc_processing_timer = 1;
ue_context_p->ue_context.nr_rrc_processing_delay = NR_RRC_PROCESSING_DELAY_MS; uint32_t delay_ms = NR_RRC_PROCESSING_DELAY_MS;
if (ue_context_p->ue_context.masterCellGroup &&
ue_context_p->ue_context.masterCellGroup->spCellConfig->spCellConfigDedicated &&
ue_context_p->ue_context.masterCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList) {
delay_ms += NR_RRC_BWP_SWITCH_DELAY_MS;
}
ue_context_p->ue_context.nr_rrc_processing_delay = delay_ms;
} else { } else {
LOG_D(RRC,"%s: Unknown RNTI 0x%04x\n", __FUNCTION__, rntiP); LOG_D(RRC,"%s: Unknown RNTI 0x%04x\n", __FUNCTION__, rntiP);
} }
......
...@@ -101,6 +101,7 @@ typedef struct nr_uid_linear_allocator_s { ...@@ -101,6 +101,7 @@ typedef struct nr_uid_linear_allocator_s {
// 3GPP TS 38.331 Section 12 Table 12.1-1: UE performance requirements for RRC procedures for UEs // 3GPP TS 38.331 Section 12 Table 12.1-1: UE performance requirements for RRC procedures for UEs
#define NR_RRC_PROCESSING_DELAY_MS 10 #define NR_RRC_PROCESSING_DELAY_MS 10
#define NR_RRC_BWP_SWITCH_DELAY_MS 6
#define NR_UE_MODULE_INVALID ((module_id_t) ~0) // FIXME attention! depends on type uint8_t!!! #define NR_UE_MODULE_INVALID ((module_id_t) ~0) // FIXME attention! depends on type uint8_t!!!
#define NR_UE_INDEX_INVALID ((module_id_t) ~0) // FIXME attention! depends on type uint8_t!!! used to be -1 #define NR_UE_INDEX_INVALID ((module_id_t) ~0) // FIXME attention! depends on type uint8_t!!! used to be -1
......
...@@ -743,7 +743,14 @@ rrc_gNB_generate_defaultRRCReconfiguration( ...@@ -743,7 +743,14 @@ rrc_gNB_generate_defaultRRCReconfiguration(
NULL, NULL,
ue_p->masterCellGroup); ue_p->masterCellGroup);
enable_nr_rrc_processing_timer(ctxt_pP->module_id, ue_context_pP, TX_SL_AHEAD_DELAY + NR_RRC_PROCESSING_DELAY_MS); uint32_t delay_ms = TX_SL_AHEAD_DELAY + NR_RRC_PROCESSING_DELAY_MS;
if (ue_p->masterCellGroup &&
ue_p->masterCellGroup->spCellConfig &&
ue_p->masterCellGroup->spCellConfig->spCellConfigDedicated &&
ue_p->masterCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList) {
delay_ms += NR_RRC_BWP_SWITCH_DELAY_MS;
}
enable_nr_rrc_processing_timer(ctxt_pP->module_id, ue_context_pP, delay_ms);
free(ue_context_pP->ue_context.nas_pdu.buffer); free(ue_context_pP->ue_context.nas_pdu.buffer);
...@@ -1008,7 +1015,14 @@ rrc_gNB_generate_dedicatedRRCReconfiguration( ...@@ -1008,7 +1015,14 @@ rrc_gNB_generate_dedicatedRRCReconfiguration(
NULL, NULL,
cellGroupConfig); cellGroupConfig);
enable_nr_rrc_processing_timer(ctxt_pP->module_id, ue_context_pP, TX_SL_AHEAD_DELAY + NR_RRC_PROCESSING_DELAY_MS); uint32_t delay_ms = TX_SL_AHEAD_DELAY + NR_RRC_PROCESSING_DELAY_MS;
if (cellGroupConfig &&
cellGroupConfig->spCellConfig &&
cellGroupConfig->spCellConfig->spCellConfigDedicated &&
cellGroupConfig->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList) {
delay_ms += NR_RRC_BWP_SWITCH_DELAY_MS;
}
enable_nr_rrc_processing_timer(ctxt_pP->module_id, ue_context_pP, delay_ms);
LOG_DUMPMSG(NR_RRC,DEBUG_RRC,(char *)buffer,size, "[MSG] RRC Reconfiguration\n"); LOG_DUMPMSG(NR_RRC,DEBUG_RRC,(char *)buffer,size, "[MSG] RRC Reconfiguration\n");
...@@ -1914,6 +1928,8 @@ int nr_rrc_reconfiguration_req(rrc_gNB_ue_context_t *const ue_context_pP ...@@ -1914,6 +1928,8 @@ int nr_rrc_reconfiguration_req(rrc_gNB_ue_context_t *const ue_context_pP
NULL, NULL,
masterCellGroup); masterCellGroup);
enable_nr_rrc_processing_timer(ctxt_pP->module_id, ue_context_pP, TX_SL_AHEAD_DELAY + NR_RRC_PROCESSING_DELAY_MS + NR_RRC_BWP_SWITCH_DELAY_MS);
nr_rrc_data_req(ctxt_pP, nr_rrc_data_req(ctxt_pP,
DCCH, DCCH,
rrc_gNB_mui++, rrc_gNB_mui++,
......
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