NR UE: introduce the hyper frame number (HFN) in PHY, MAC and RRC layer

Provide it to the function configure_ntn_ta() so it can be used when a new ntn_Config_r17 is received.
This commit is contained in:
Thomas Schlichter
2025-11-19 10:05:44 +01:00
committed by francescomani
parent 92980ceb72
commit 0bf99d9d16
18 changed files with 89 additions and 26 deletions
+16 -4
View File
@@ -59,6 +59,7 @@ void nr_mac_rrc_sync_ind(const module_id_t module_id, const frame_t frame, const
void nr_mac_rrc_data_ind_ue(const module_id_t module_id,
const int CC_id,
const uint8_t gNB_index,
const int hfn,
const frame_t frame,
const int slot,
const rnti_t rnti,
@@ -97,6 +98,7 @@ void nr_mac_rrc_data_ind_ue(const module_id_t module_id,
else {
NR_RRC_MAC_BCCH_DATA_IND (message_p).sdu_size = 0;
}
NR_RRC_MAC_BCCH_DATA_IND (message_p).hfn = hfn;
NR_RRC_MAC_BCCH_DATA_IND (message_p).frame = frame; //frameP
NR_RRC_MAC_BCCH_DATA_IND (message_p).slot = slot;
NR_RRC_MAC_BCCH_DATA_IND (message_p).gnb_index = gNB_index;
@@ -120,6 +122,7 @@ void nr_mac_rrc_data_ind_ue(const module_id_t module_id,
message_p = itti_alloc_new_message(TASK_MAC_UE, 0, NR_RRC_MAC_SBCCH_DATA_IND);
memset(NR_RRC_MAC_SBCCH_DATA_IND (message_p).sdu, 0, BCCH_SDU_SIZE);
memcpy(NR_RRC_MAC_SBCCH_DATA_IND (message_p).sdu, pduP, sdu_size);
NR_RRC_MAC_SBCCH_DATA_IND (message_p).hfn = hfn;
NR_RRC_MAC_SBCCH_DATA_IND (message_p).frame = frame; //frameP
NR_RRC_MAC_SBCCH_DATA_IND (message_p).slot = slot;
NR_RRC_MAC_SBCCH_DATA_IND (message_p).sdu_size = sdu_size;
@@ -139,7 +142,12 @@ void process_msg_rcc_to_mac(nr_mac_rrc_message_t *msg, int instance_id)
nr_rrc_mac_config_req_reset(instance_id, msg->payload.config_reset.cause);
break;
case NR_MAC_RRC_CONFIG_CG:
nr_rrc_mac_config_req_cg(instance_id, 0, msg->payload.config_cg.cellGroupConfig, msg->payload.config_cg.UE_NR_Capability);
nr_rrc_mac_config_req_cg(instance_id,
0,
msg->payload.config_cg.hfn,
msg->payload.config_cg.frame,
msg->payload.config_cg.cellGroupConfig,
msg->payload.config_cg.UE_NR_Capability);
ASN_STRUCT_FREE(asn_DEF_NR_CellGroupConfig, msg->payload.config_cg.cellGroupConfig);
break;
case NR_MAC_RRC_CONFIG_MIB:
@@ -157,8 +165,11 @@ void process_msg_rcc_to_mac(nr_mac_rrc_message_t *msg, int instance_id)
SEQUENCE_free(&asn_DEF_NR_SIB1, msg->payload.config_sib1.sib1, ASFM_FREE_EVERYTHING);
} break;
case NR_MAC_RRC_CONFIG_OTHER_SIB: {
bool can_start_ra = msg->payload.config_other_sib.can_start_ra;
nr_rrc_mac_config_other_sib(instance_id, msg->payload.config_other_sib.sib19, can_start_ra);
nr_rrc_mac_config_other_sib(instance_id,
msg->payload.config_other_sib.sib19,
msg->payload.config_other_sib.hfn,
msg->payload.config_other_sib.frame,
msg->payload.config_other_sib.can_start_ra);
} break;
case NR_MAC_RRC_RESUME_RB:
nr_rrc_mac_resume_rb(instance_id, msg->payload.resume_rb.is_srb, msg->payload.resume_rb.rb_id);
@@ -183,10 +194,11 @@ void nr_mac_rrc_msg3_ind(const module_id_t mod_id, const int rnti, bool prepare_
itti_send_msg_to_task(TASK_RRC_NRUE, GNB_MODULE_ID_TO_INSTANCE(mod_id), message_p);
}
void nr_ue_rrc_timer_trigger(int instance, int frame, int gnb_id)
void nr_ue_rrc_timer_trigger(int instance, int hfn, int frame, int gnb_id)
{
MessageDef *message_p;
message_p = itti_alloc_new_message(TASK_RRC_NRUE, 0, NRRRC_FRAME_PROCESS);
NRRRC_FRAME_PROCESS(message_p).hfn = hfn;
NRRRC_FRAME_PROCESS(message_p).frame = frame;
NRRRC_FRAME_PROCESS(message_p).gnb_id = gnb_id;
LOG_D(NR_RRC, "RRC timer trigger: frame %d\n", frame);
+2 -1
View File
@@ -29,6 +29,7 @@ void nr_mac_rrc_sync_ind(const module_id_t module_id, const frame_t frame, const
void nr_mac_rrc_data_ind_ue(const module_id_t module_id,
const int CC_id,
const uint8_t gNB_index,
const int hfn,
const frame_t frame,
const int slot,
const rnti_t rnti,
@@ -45,7 +46,7 @@ void nr_mac_rrc_meas_ind_ue(module_id_t module_id,
int rsrp_dBm);
void nr_mac_rrc_inactivity_timer_ind(const module_id_t mod_id);
void nr_mac_rrc_msg3_ind(const module_id_t mod_id, const int rnti, bool prepare_payload);
void nr_ue_rrc_timer_trigger(int instance, int frame, int gnb_id);
void nr_ue_rrc_timer_trigger(int instance, int hfn, int frame, int gnb_id);
void nr_mac_rrc_ra_ind(const module_id_t mod_id, bool success);
void process_msg_rcc_to_mac(nr_mac_rrc_message_t *msg, int instance_id);
#endif
+12 -3
View File
@@ -284,7 +284,7 @@ static void nr_rrc_process_ntnconfig(NR_UE_RRC_INST_t *rrc, NR_UE_RRC_SI_INFO *S
nr_timer_start(&SI_info->SInfo_r17.sib19_timer);
}
static void nr_decode_SI(NR_UE_RRC_SI_INFO *SI_info, NR_SystemInformation_t *si, NR_UE_RRC_INST_t *rrc, int frame)
static void nr_decode_SI(NR_UE_RRC_SI_INFO *SI_info, NR_SystemInformation_t *si, NR_UE_RRC_INST_t *rrc, int hfn, int frame)
{
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_UE_DECODE_SI, VCD_FUNCTION_IN);
@@ -373,6 +373,8 @@ static void nr_decode_SI(NR_UE_RRC_SI_INFO *SI_info, NR_SystemInformation_t *si,
rrc_msg.payload_type = NR_MAC_RRC_CONFIG_OTHER_SIB;
nr_mac_rrc_config_other_sib_t *sib19_msg = &rrc_msg.payload.config_other_sib;
asn_copy(&asn_DEF_NR_SIB19_r17, (void **)&sib19_msg->sib19, sib19);
sib19_msg->hfn = hfn;
sib19_msg->frame = frame;
sib19_msg->can_start_ra = rrc->is_NTN_UE;
nr_rrc_send_msg_to_mac(rrc, &rrc_msg);
}
@@ -768,6 +770,8 @@ static void nr_rrc_ue_process_masterCellGroup(NR_UE_RRC_INST_t *rrc,
nr_mac_rrc_config_cg_t *mac_msg = &rrc_msg.payload.config_cg;
mac_msg->cellGroupConfig = cellGroupConfig;
mac_msg->UE_NR_Capability = rrc->UECap.UE_NR_Capability;
mac_msg->hfn = rrc->current_hfn;
mac_msg->frame = rrc->current_frame;
nr_rrc_send_msg_to_mac(rrc, &rrc_msg);
}
@@ -816,7 +820,7 @@ static void nr_rrc_process_reconfiguration_v1530(NR_UE_RRC_INST_t *rrc, NR_RRCRe
SEQUENCE_free(&asn_DEF_NR_SystemInformation, si, 1);
} else {
LOG_I(NR_RRC, "[UE %ld] Decoding dedicatedSystemInformationDelivery\n", rrc->ue_id);
nr_decode_SI(SI_info, si, rrc, rrc->current_frame);
nr_decode_SI(SI_info, si, rrc, rrc->current_hfn, rrc->current_frame);
}
}
if (rec_1530->otherConfig) {
@@ -1174,6 +1178,8 @@ static void nr_rrc_ue_process_rrcReconfiguration(NR_UE_RRC_INST_t *rrc, int gNB_
nr_mac_rrc_config_cg_t *config_cg = &rrc_msg.payload.config_cg;
config_cg->cellGroupConfig = cellGroupConfig;
config_cg->UE_NR_Capability = rrc->UECap.UE_NR_Capability;
config_cg->hfn = rrc->current_hfn;
config_cg->frame = rrc->current_frame;
nr_rrc_send_msg_to_mac(rrc, &rrc_msg);
}
}
@@ -1598,6 +1604,7 @@ static void nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message(NR_UE_RRC_INST_t *rrc,
const uint8_t Sdu_len,
const uint8_t rsrq,
const uint8_t rsrp,
int hfn,
int frame,
int slot)
{
@@ -1637,7 +1644,7 @@ static void nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message(NR_UE_RRC_INST_t *rrc,
case NR_BCCH_DL_SCH_MessageType__c1_PR_systemInformation:
LOG_I(NR_RRC, "[UE %ld] %d:%d Decoding SI\n", rrc->ue_id, frame, slot);
NR_SystemInformation_t *si = bcch_message->message.choice.c1->choice.systemInformation;
nr_decode_SI(SI_info, si, rrc, frame);
nr_decode_SI(SI_info, si, rrc, hfn, frame);
break;
case NR_BCCH_DL_SCH_MessageType__c1_PR_NOTHING:
default:
@@ -2620,6 +2627,7 @@ void *rrc_nrue(void *notUsed)
} break;
case NRRRC_FRAME_PROCESS:
rrc->current_hfn = NRRRC_FRAME_PROCESS(msg_p).hfn;
rrc->current_frame = NRRRC_FRAME_PROCESS(msg_p).frame;
LOG_D(NR_RRC, "Received %s: frame %d\n", ITTI_MSG_NAME(msg_p), rrc->current_frame);
// increase the timers every 10ms (every new frame)
@@ -2671,6 +2679,7 @@ void *rrc_nrue(void *notUsed)
bcch->sdu_size,
bcch->rsrq,
bcch->rsrp,
bcch->hfn,
bcch->frame,
bcch->slot);
break;
+1
View File
@@ -262,6 +262,7 @@ typedef struct NR_UE_RRC_INST_s {
// 5G-S-TMSI
uint64_t fiveG_S_TMSI;
// Frame timing received from MAC
int current_hfn;
int current_frame;
//Sidelink params
+1 -1
View File
@@ -73,7 +73,7 @@ int get_from_lte_ue_fd();
void nr_rrc_SI_timers(NR_UE_RRC_SI_INFO *SInfo);
void init_SI_timers(NR_UE_RRC_SI_INFO *SInfo);
void nr_ue_rrc_timer_trigger(int module_id, int frame, int gnb_id);
void nr_ue_rrc_timer_trigger(int module_id, int hfn, int frame, int gnb_id);
void handle_t300_expiry(NR_UE_RRC_INST_t *rrc);
void handle_t430_expiry(NR_UE_RRC_INST_t *rrc);