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
+5 -1
View File
@@ -434,8 +434,10 @@ void processSlotTX(void *arg)
nr_sidelink_indication_t sl_indication = {.module_id = UE->Mod_id, nr_sidelink_indication_t sl_indication = {.module_id = UE->Mod_id,
.gNB_index = proc->gNB_id, .gNB_index = proc->gNB_id,
.cc_id = UE->CC_id, .cc_id = UE->CC_id,
.hfn_tx = proc->hfn_tx,
.frame_tx = proc->frame_tx, .frame_tx = proc->frame_tx,
.slot_tx = proc->nr_slot_tx, .slot_tx = proc->nr_slot_tx,
.hfn_rx = proc->hfn_rx,
.frame_rx = proc->frame_rx, .frame_rx = proc->frame_rx,
.slot_rx = proc->nr_slot_rx, .slot_rx = proc->nr_slot_rx,
.slot_type = SIDELINK_SLOT_TYPE_TX, .slot_type = SIDELINK_SLOT_TYPE_TX,
@@ -968,6 +970,8 @@ void *UE_thread(void *arg)
curMsg.proc.nr_slot_tx = (absolute_slot + duration_rx_to_tx) % nb_slot_frame; curMsg.proc.nr_slot_tx = (absolute_slot + duration_rx_to_tx) % nb_slot_frame;
curMsg.proc.frame_rx = (absolute_slot / nb_slot_frame) % MAX_FRAME_NUMBER; curMsg.proc.frame_rx = (absolute_slot / nb_slot_frame) % MAX_FRAME_NUMBER;
curMsg.proc.frame_tx = ((absolute_slot + duration_rx_to_tx) / nb_slot_frame) % MAX_FRAME_NUMBER; curMsg.proc.frame_tx = ((absolute_slot + duration_rx_to_tx) / nb_slot_frame) % MAX_FRAME_NUMBER;
curMsg.proc.hfn_rx = (absolute_slot / nb_slot_frame) / MAX_FRAME_NUMBER;
curMsg.proc.hfn_tx = ((absolute_slot + duration_rx_to_tx) / nb_slot_frame) / MAX_FRAME_NUMBER;
if (UE->received_config_request) { if (UE->received_config_request) {
if (UE->sl_mode) { if (UE->sl_mode) {
curMsg.proc.rx_slot_type = sl_nr_ue_slot_select(sl_cfg, curMsg.proc.nr_slot_rx, TDD); curMsg.proc.rx_slot_type = sl_nr_ue_slot_select(sl_cfg, curMsg.proc.nr_slot_rx, TDD);
@@ -1048,7 +1052,7 @@ void *UE_thread(void *arg)
} }
if (curMsg.proc.nr_slot_rx == 0) if (curMsg.proc.nr_slot_rx == 0)
nr_ue_rrc_timer_trigger(UE->Mod_id, curMsg.proc.frame_rx, curMsg.proc.gNB_id); nr_ue_rrc_timer_trigger(UE->Mod_id, curMsg.proc.hfn_rx, curMsg.proc.frame_rx, curMsg.proc.gNB_id);
// RX slot processing. We launch and forget. // RX slot processing. We launch and forget.
notifiedFIFO_elt_t *newRx = newNotifiedFIFO_elt(sizeof(nr_rxtx_thread_data_t), curMsg.proc.nr_slot_tx, NULL, UE_dl_processing); notifiedFIFO_elt_t *newRx = newNotifiedFIFO_elt(sizeof(nr_rxtx_thread_data_t), curMsg.proc.nr_slot_tx, NULL, UE_dl_processing);
+4 -1
View File
@@ -538,11 +538,14 @@ typedef struct {
/// NR slot index within frame_rx [0 .. slots_per_frame - 1] to act upon for transmission /// NR slot index within frame_rx [0 .. slots_per_frame - 1] to act upon for transmission
int nr_slot_rx; int nr_slot_rx;
int tx_slot_type; int tx_slot_type;
//#endif
/// frame to act upon for transmission /// frame to act upon for transmission
int frame_tx; int frame_tx;
/// frame to act upon for reception /// frame to act upon for reception
int frame_rx; int frame_rx;
/// hyper frame number to act upon for transmission
int hfn_tx;
/// hyper frame number to act upon for reception
int hfn_rx;
} UE_nr_rxtx_proc_t; } UE_nr_rxtx_proc_t;
typedef struct { typedef struct {
@@ -95,6 +95,7 @@ void nr_fill_dl_indication(nr_downlink_indication_t *dl_ind,
dl_ind->gNB_index = proc->gNB_id; dl_ind->gNB_index = proc->gNB_id;
dl_ind->module_id = ue->Mod_id; dl_ind->module_id = ue->Mod_id;
dl_ind->cc_id = ue->CC_id; dl_ind->cc_id = ue->CC_id;
dl_ind->hfn = proc->hfn_rx;
dl_ind->frame = proc->frame_rx; dl_ind->frame = proc->frame_rx;
dl_ind->slot = proc->nr_slot_rx; dl_ind->slot = proc->nr_slot_rx;
dl_ind->phy_data = phy_data; dl_ind->phy_data = phy_data;
@@ -44,8 +44,10 @@ void nr_fill_sl_indication(nr_sidelink_indication_t *sl_ind,
sl_ind->gNB_index = proc->gNB_id; sl_ind->gNB_index = proc->gNB_id;
sl_ind->module_id = ue->Mod_id; sl_ind->module_id = ue->Mod_id;
sl_ind->cc_id = ue->CC_id; sl_ind->cc_id = ue->CC_id;
sl_ind->hfn_rx = proc->hfn_rx;
sl_ind->frame_rx = proc->frame_rx; sl_ind->frame_rx = proc->frame_rx;
sl_ind->slot_rx = proc->nr_slot_rx; sl_ind->slot_rx = proc->nr_slot_rx;
sl_ind->hfn_tx = proc->hfn_tx;
sl_ind->frame_tx = proc->frame_tx; sl_ind->frame_tx = proc->frame_tx;
sl_ind->slot_tx = proc->nr_slot_tx; sl_ind->slot_tx = proc->nr_slot_tx;
sl_ind->phy_data = phy_data; sl_ind->phy_data = phy_data;
+1 -1
View File
@@ -956,7 +956,7 @@ int main(int argc, char **argv)
//Configure UE //Configure UE
NR_BCCH_BCH_Message_t *mib = get_new_MIB_NR(scc); NR_BCCH_BCH_Message_t *mib = get_new_MIB_NR(scc);
nr_rrc_mac_config_req_mib(0, 0, mib->message.choice.mib, false, false); nr_rrc_mac_config_req_mib(0, 0, mib->message.choice.mib, false, false);
nr_rrc_mac_config_req_cg(0, 0, UE_CellGroup, UE_Capability_nr); nr_rrc_mac_config_req_cg(0, 0, 0, 0, UE_CellGroup, UE_Capability_nr);
asn1cFreeStruc(asn_DEF_NR_CellGroupConfig, UE_CellGroup); asn1cFreeStruc(asn_DEF_NR_CellGroupConfig, UE_CellGroup);
@@ -163,6 +163,7 @@ typedef uint32_t channel_t;
int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id, int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id,
const int CC_id, const int CC_id,
const uint8_t gNB_index, const uint8_t gNB_index,
const int hfn,
const frame_t frame, const frame_t frame,
const int slot, const int slot,
const rnti_t rnti, const rnti_t rnti,
+2
View File
@@ -121,6 +121,7 @@ typedef struct RrcMacBcchDataInd_s {
} RrcMacBcchDataInd; } RrcMacBcchDataInd;
typedef struct NRRrcMacBcchDataInd_s { typedef struct NRRrcMacBcchDataInd_s {
uint32_t hfn;
uint32_t frame; uint32_t frame;
uint8_t slot; uint8_t slot;
uint32_t sdu_size; uint32_t sdu_size;
@@ -134,6 +135,7 @@ typedef struct NRRrcMacBcchDataInd_s {
} NRRrcMacBcchDataInd; } NRRrcMacBcchDataInd;
typedef struct NRRrcMacSBcchDataInd_s { typedef struct NRRrcMacSBcchDataInd_s {
uint32_t hfn;
uint32_t frame; uint32_t frame;
uint8_t slot; uint8_t slot;
uint32_t sdu_size; uint32_t sdu_size;
+5
View File
@@ -438,6 +438,7 @@ typedef struct rrc_subframe_process_s {
} RrcSubframeProcess; } RrcSubframeProcess;
typedef struct nrrrc_frame_process_s { typedef struct nrrrc_frame_process_s {
int hfn;
int frame; int frame;
int gnb_id; int gnb_id;
} NRRrcFrameProcess; } NRRrcFrameProcess;
@@ -475,6 +476,8 @@ typedef struct {
typedef struct { typedef struct {
NR_CellGroupConfig_t *cellGroupConfig; NR_CellGroupConfig_t *cellGroupConfig;
NR_UE_NR_Capability_t *UE_NR_Capability; NR_UE_NR_Capability_t *UE_NR_Capability;
int hfn;
int frame;
} nr_mac_rrc_config_cg_t; } nr_mac_rrc_config_cg_t;
typedef struct { typedef struct {
NR_BCCH_BCH_Message_t *bcch; NR_BCCH_BCH_Message_t *bcch;
@@ -487,6 +490,8 @@ typedef struct {
} nr_mac_rrc_config_sib1_t; } nr_mac_rrc_config_sib1_t;
typedef struct { typedef struct {
NR_SIB19_r17_t *sib19; NR_SIB19_r17_t *sib19;
int hfn;
int frame;
bool can_start_ra; bool can_start_ra;
} nr_mac_rrc_config_other_sib_t; } nr_mac_rrc_config_other_sib_t;
+13 -7
View File
@@ -305,7 +305,9 @@ static void calculate_ue_sat_ta(const position_t *position_params,
// populate ntn_ta structure from mac // populate ntn_ta structure from mac
static void configure_ntn_ta(module_id_t module_id, static void configure_ntn_ta(module_id_t module_id,
ntn_timing_advance_componets_t *ntn_ta, ntn_timing_advance_componets_t *ntn_ta,
const NR_NTN_Config_r17_t *ntn_Config_r17) const NR_NTN_Config_r17_t *ntn_Config_r17,
int hfn,
int frame)
{ {
if (!ntn_Config_r17) if (!ntn_Config_r17)
return; return;
@@ -380,7 +382,7 @@ static void configure_ntn_ta(module_id_t module_id,
ntn_ta->N_UE_TA_drift_variant); ntn_ta->N_UE_TA_drift_variant);
} }
static void config_common_ue(NR_UE_MAC_INST_t *mac, NR_ServingCellConfigCommon_t *scc, int cc_idP) static void config_common_ue(NR_UE_MAC_INST_t *mac, NR_ServingCellConfigCommon_t *scc, int cc_idP, int hfn, int frame)
{ {
fapi_nr_config_request_t *cfg = &mac->phy_config.config_req; fapi_nr_config_request_t *cfg = &mac->phy_config.config_req;
@@ -555,7 +557,7 @@ static void config_common_ue(NR_UE_MAC_INST_t *mac, NR_ServingCellConfigCommon_t
// NTN Config // NTN Config
if (scc->ext2) { if (scc->ext2) {
UPDATE_IE(mac->sc_info.ntn_Config_r17, scc->ext2->ntn_Config_r17, NR_NTN_Config_r17_t); UPDATE_IE(mac->sc_info.ntn_Config_r17, scc->ext2->ntn_Config_r17, NR_NTN_Config_r17_t);
configure_ntn_ta(mac->ue_id, &mac->ntn_ta, mac->sc_info.ntn_Config_r17); configure_ntn_ta(mac->ue_id, &mac->ntn_ta, mac->sc_info.ntn_Config_r17, hfn, frame);
} else { } else {
asn1cFreeStruc(asn_DEF_NR_NTN_Config_r17, mac->sc_info.ntn_Config_r17); asn1cFreeStruc(asn_DEF_NR_NTN_Config_r17, mac->sc_info.ntn_Config_r17);
} }
@@ -1947,7 +1949,7 @@ void nr_rrc_mac_config_req_sib1(module_id_t module_id, int cc_idP, NR_SIB1_t *si
AssertFatal(!ret, "mutex failed %d\n", ret); AssertFatal(!ret, "mutex failed %d\n", ret);
} }
void nr_rrc_mac_config_other_sib(module_id_t module_id, NR_SIB19_r17_t *sib19, bool can_start_ra) void nr_rrc_mac_config_other_sib(module_id_t module_id, NR_SIB19_r17_t *sib19, int hfn, int frame, bool can_start_ra)
{ {
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id); NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
int ret = pthread_mutex_lock(&mac->if_mutex); int ret = pthread_mutex_lock(&mac->if_mutex);
@@ -1956,7 +1958,7 @@ void nr_rrc_mac_config_other_sib(module_id_t module_id, NR_SIB19_r17_t *sib19, b
if (sib19) { if (sib19) {
// update ntn_Config_r17 with received values // update ntn_Config_r17 with received values
UPDATE_IE(mac->sc_info.ntn_Config_r17, sib19->ntn_Config_r17, NR_NTN_Config_r17_t); UPDATE_IE(mac->sc_info.ntn_Config_r17, sib19->ntn_Config_r17, NR_NTN_Config_r17_t);
configure_ntn_ta(mac->ue_id, &mac->ntn_ta, mac->sc_info.ntn_Config_r17); configure_ntn_ta(mac->ue_id, &mac->ntn_ta, mac->sc_info.ntn_Config_r17, hfn, frame);
} }
if (mac->state == UE_RECEIVING_SIB && can_start_ra) if (mac->state == UE_RECEIVING_SIB && can_start_ra)
mac->state = UE_PERFORMING_RA; mac->state = UE_PERFORMING_RA;
@@ -1966,6 +1968,8 @@ void nr_rrc_mac_config_other_sib(module_id_t module_id, NR_SIB19_r17_t *sib19, b
static void handle_reconfiguration_with_sync(NR_UE_MAC_INST_t *mac, static void handle_reconfiguration_with_sync(NR_UE_MAC_INST_t *mac,
int cc_idP, int cc_idP,
int hfn,
int frame,
const NR_ReconfigurationWithSync_t *reconfWithSync) const NR_ReconfigurationWithSync_t *reconfWithSync)
{ {
reset_mac_inst(mac); reset_mac_inst(mac);
@@ -1985,7 +1989,7 @@ static void handle_reconfiguration_with_sync(NR_UE_MAC_INST_t *mac,
mac->physCellId = *scc->physCellId; mac->physCellId = *scc->physCellId;
mac->dmrs_TypeA_Position = scc->dmrs_TypeA_Position; mac->dmrs_TypeA_Position = scc->dmrs_TypeA_Position;
UPDATE_IE(mac->tdd_UL_DL_ConfigurationCommon, scc->tdd_UL_DL_ConfigurationCommon, NR_TDD_UL_DL_ConfigCommon_t); UPDATE_IE(mac->tdd_UL_DL_ConfigurationCommon, scc->tdd_UL_DL_ConfigurationCommon, NR_TDD_UL_DL_ConfigCommon_t);
config_common_ue(mac, scc, cc_idP); config_common_ue(mac, scc, cc_idP, hfn, frame);
// Build the list of all the valid/transmitted SSBs according to the config // Build the list of all the valid/transmitted SSBs according to the config
LOG_D(NR_MAC,"Build SSB list\n"); LOG_D(NR_MAC,"Build SSB list\n");
build_ssb_list(mac); build_ssb_list(mac);
@@ -2754,6 +2758,8 @@ static void handle_mac_uecap_info(NR_UE_MAC_INST_t *mac, NR_UE_NR_Capability_t *
void nr_rrc_mac_config_req_cg(module_id_t module_id, void nr_rrc_mac_config_req_cg(module_id_t module_id,
int cc_idP, int cc_idP,
int hfn,
int frame,
NR_CellGroupConfig_t *cell_group_config, NR_CellGroupConfig_t *cell_group_config,
NR_UE_NR_Capability_t *ue_Capability) NR_UE_NR_Capability_t *ue_Capability)
{ {
@@ -2772,7 +2778,7 @@ void nr_rrc_mac_config_req_cg(module_id_t module_id,
mac->servCellIndex = spCellConfig->servCellIndex ? *spCellConfig->servCellIndex : 0; mac->servCellIndex = spCellConfig->servCellIndex ? *spCellConfig->servCellIndex : 0;
if (spCellConfig->reconfigurationWithSync) { if (spCellConfig->reconfigurationWithSync) {
LOG_A(NR_MAC, "Received reconfigurationWithSync\n"); LOG_A(NR_MAC, "Received reconfigurationWithSync\n");
handle_reconfiguration_with_sync(mac, cc_idP, spCellConfig->reconfigurationWithSync); handle_reconfiguration_with_sync(mac, cc_idP, hfn, frame, spCellConfig->reconfigurationWithSync);
} }
if (scd) { if (scd) {
mac->tag_Id = scd->tag_Id; mac->tag_Id = scd->tag_Id;
+4 -1
View File
@@ -73,6 +73,7 @@ void nr_ue_decode_BCCH_DL_SCH(NR_UE_MAC_INST_t *mac,
uint8_t ack_nack, uint8_t ack_nack,
uint8_t *pduP, uint8_t *pduP,
uint32_t pdu_len, uint32_t pdu_len,
int hfn,
int frame, int frame,
int slot); int slot);
@@ -82,6 +83,8 @@ void nr_release_mac_config_logicalChannelBearer(NR_UE_MAC_INST_t *mac, long chan
void nr_rrc_mac_config_req_cg(module_id_t module_id, void nr_rrc_mac_config_req_cg(module_id_t module_id,
int cc_idP, int cc_idP,
int hfn,
int frame,
NR_CellGroupConfig_t *cell_group_config, NR_CellGroupConfig_t *cell_group_config,
NR_UE_NR_Capability_t *ue_Capability); NR_UE_NR_Capability_t *ue_Capability);
@@ -90,7 +93,7 @@ void nr_rrc_mac_config_req_mib(module_id_t module_id, int cc_idP, NR_MIB_t *mibP
void nr_rrc_mac_config_req_sib1(module_id_t module_id, int cc_idP, NR_SIB1_t *sib1, bool can_start_ra); void nr_rrc_mac_config_req_sib1(module_id_t module_id, int cc_idP, NR_SIB1_t *sib1, bool can_start_ra);
struct position; /* forward declaration */ struct position; /* forward declaration */
void nr_rrc_mac_config_other_sib(module_id_t module_id, NR_SIB19_r17_t *sib19_r17, bool can_start_ra); void nr_rrc_mac_config_other_sib(module_id_t module_id, NR_SIB19_r17_t *sib19_r17, int hfn, int frame, bool can_start_ra);
void nr_rrc_mac_resume_rb(module_id_t module_id, bool is_srb, int rb_id); void nr_rrc_mac_resume_rb(module_id_t module_id, bool is_srb, int rb_id);
void nr_rrc_mac_config_req_reset(module_id_t module_id, NR_UE_MAC_reset_cause_t cause); void nr_rrc_mac_config_req_reset(module_id_t module_id, NR_UE_MAC_reset_cause_t cause);
+3 -2
View File
@@ -361,12 +361,13 @@ void nr_ue_decode_BCCH_DL_SCH(NR_UE_MAC_INST_t *mac,
uint8_t ack_nack, uint8_t ack_nack,
uint8_t *pduP, uint8_t *pduP,
uint32_t pdu_len, uint32_t pdu_len,
int hfn,
int frame, int frame,
int slot) int slot)
{ {
if(ack_nack) { if(ack_nack) {
LOG_D(NR_MAC, "Decoding NR-BCCH-DL-SCH-Message (SIB1 or SI)\n"); LOG_D(NR_MAC, "Decoding NR-BCCH-DL-SCH-Message (SIB1 or SI)\n");
nr_mac_rrc_data_ind_ue(mac->ue_id, cc_id, gNB_index, frame, slot, 0, mac->physCellId, 0, NR_BCCH_DL_SCH, (uint8_t *) pduP, pdu_len); nr_mac_rrc_data_ind_ue(mac->ue_id, cc_id, gNB_index, hfn, frame, slot, 0, mac->physCellId, 0, NR_BCCH_DL_SCH, (uint8_t *) pduP, pdu_len);
if (mac->get_sib1) if (mac->get_sib1)
mac->get_sib1 = false; mac->get_sib1 = false;
for (int i = 0; i < MAX_SI_GROUPS; i++) { for (int i = 0; i < MAX_SI_GROUPS; i++) {
@@ -383,7 +384,7 @@ void nr_ue_decode_BCCH_DL_SCH(NR_UE_MAC_INST_t *mac,
} }
else { else {
LOG_E(NR_MAC, "Got NACK on NR-BCCH-DL-SCH-Message (%s)\n", mac->get_sib1 ? "SIB1" : "other SI"); LOG_E(NR_MAC, "Got NACK on NR-BCCH-DL-SCH-Message (%s)\n", mac->get_sib1 ? "SIB1" : "other SI");
nr_mac_rrc_data_ind_ue(mac->ue_id, cc_id, gNB_index, frame, slot, 0, mac->physCellId, 0, NR_BCCH_DL_SCH, NULL, 0); nr_mac_rrc_data_ind_ue(mac->ue_id, cc_id, gNB_index, hfn, frame, slot, 0, mac->physCellId, 0, NR_BCCH_DL_SCH, NULL, 0);
} }
} }
+10 -4
View File
@@ -123,7 +123,7 @@ static int handle_bcch_bch(NR_UE_MAC_INST_t *mac,
else else
mac->frequency_range = FR1; mac->frequency_range = FR1;
// fixed 3 bytes MIB PDU // fixed 3 bytes MIB PDU
nr_mac_rrc_data_ind_ue(mac->ue_id, cc_id, gNB_index, 0, 0, 0, cell_id, ssb_arfcn, NR_BCCH_BCH, (uint8_t *) pduP, 3); nr_mac_rrc_data_ind_ue(mac->ue_id, cc_id, gNB_index, 0, 0, 0, 0, cell_id, ssb_arfcn, NR_BCCH_BCH, (uint8_t *) pduP, 3);
return 0; return 0;
} }
@@ -134,10 +134,11 @@ static int handle_bcch_dlsch(NR_UE_MAC_INST_t *mac,
uint8_t ack_nack, uint8_t ack_nack,
uint8_t *pduP, uint8_t *pduP,
uint32_t pdu_len, uint32_t pdu_len,
int hfn,
int frame, int frame,
int slot) int slot)
{ {
nr_ue_decode_BCCH_DL_SCH(mac, cc_id, gNB_index, ack_nack, pduP, pdu_len, frame, slot); nr_ue_decode_BCCH_DL_SCH(mac, cc_id, gNB_index, ack_nack, pduP, pdu_len, hfn, frame, slot);
return 0; return 0;
} }
@@ -301,6 +302,7 @@ static uint32_t nr_ue_dl_processing(NR_UE_MAC_INST_t *mac, nr_downlink_indicatio
rx_indication_body.pdsch_pdu.ack_nack, rx_indication_body.pdsch_pdu.ack_nack,
rx_indication_body.pdsch_pdu.pdu, rx_indication_body.pdsch_pdu.pdu,
rx_indication_body.pdsch_pdu.pdu_length, rx_indication_body.pdsch_pdu.pdu_length,
dl_info->hfn,
dl_info->frame, dl_info->frame,
dl_info->slot)) << FAPI_NR_RX_PDU_TYPE_SIB; dl_info->slot)) << FAPI_NR_RX_PDU_TYPE_SIB;
break; break;
@@ -389,6 +391,7 @@ static void handle_sl_bch(int ue_id,
sl_nr_ue_mac_params_t *sl_mac, sl_nr_ue_mac_params_t *sl_mac,
uint8_t *const sl_mib, uint8_t *const sl_mib,
const uint8_t len, const uint8_t len,
int hfn_rx,
uint16_t frame_rx, uint16_t frame_rx,
uint16_t slot_rx, uint16_t slot_rx,
uint16_t rx_slss_id) uint16_t rx_slss_id)
@@ -421,7 +424,7 @@ static void handle_sl_bch(int ue_id,
sl_mac->decoded_DFN = frame; sl_mac->decoded_DFN = frame;
sl_mac->decoded_slot = slot; sl_mac->decoded_slot = slot;
nr_mac_rrc_data_ind_ue(ue_id, 0, 0, frame_rx, slot_rx, 0, rx_slss_id, 0, NR_SBCCH_SL_BCH, (uint8_t *)sl_mib, len); nr_mac_rrc_data_ind_ue(ue_id, 0, 0, hfn_rx, frame_rx, slot_rx, 0, rx_slss_id, 0, NR_SBCCH_SL_BCH, (uint8_t *)sl_mib, len);
return; return;
} }
@@ -433,6 +436,7 @@ if PSBCH rx - handle_psbch()
if PSSCH DATa rx - handle slsch() if PSSCH DATa rx - handle slsch()
*/ */
void sl_nr_process_rx_ind(int ue_id, void sl_nr_process_rx_ind(int ue_id,
int hfn,
uint32_t frame, uint32_t frame,
uint32_t slot, uint32_t slot,
sl_nr_ue_mac_params_t *sl_mac, sl_nr_ue_mac_params_t *sl_mac,
@@ -456,6 +460,7 @@ void sl_nr_process_rx_ind(int ue_id,
sl_mac, sl_mac,
rx_ind->rx_indication_body[num_pdus - 1].ssb_pdu.psbch_payload, rx_ind->rx_indication_body[num_pdus - 1].ssb_pdu.psbch_payload,
4, 4,
hfn,
frame, frame,
slot, slot,
rx_ind->rx_indication_body[num_pdus - 1].ssb_pdu.rx_slss_id); rx_ind->rx_indication_body[num_pdus - 1].ssb_pdu.rx_slss_id);
@@ -488,11 +493,12 @@ void nr_ue_sl_indication(nr_sidelink_indication_t *sl_indication)
uint16_t slot = sl_indication->slot_rx; uint16_t slot = sl_indication->slot_rx;
uint16_t frame = sl_indication->frame_rx; uint16_t frame = sl_indication->frame_rx;
int hfn = sl_indication->hfn_rx;
sl_nr_ue_mac_params_t *sl_mac = mac->SL_MAC_PARAMS; sl_nr_ue_mac_params_t *sl_mac = mac->SL_MAC_PARAMS;
if (sl_indication->rx_ind) { if (sl_indication->rx_ind) {
sl_nr_process_rx_ind(ue_id, frame, slot, sl_mac, sl_indication->rx_ind); sl_nr_process_rx_ind(ue_id, hfn, frame, slot, sl_mac, sl_indication->rx_ind);
} else { } else {
nr_ue_sidelink_scheduler(sl_indication, mac); nr_ue_sidelink_scheduler(sl_indication, mac);
} }
@@ -56,6 +56,8 @@ typedef struct {
uint32_t gNB_index; uint32_t gNB_index;
/// component carrier id /// component carrier id
int cc_id; int cc_id;
/// hyper frame number
int hfn;
/// frame /// frame
frame_t frame; frame_t frame;
/// slot /// slot
@@ -101,10 +103,14 @@ typedef struct {
uint32_t gNB_index; uint32_t gNB_index;
/// component carrier id /// component carrier id
int cc_id; int cc_id;
/// hyper frame number rx
int hfn_rx;
/// frame rx /// frame rx
frame_t frame_rx; frame_t frame_rx;
/// slot rx /// slot rx
uint32_t slot_rx; uint32_t slot_rx;
/// hyper frame number tx
int hfn_tx;
/// frame tx /// frame tx
frame_t frame_tx; frame_t frame_tx;
/// slot tx /// slot tx
+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, void nr_mac_rrc_data_ind_ue(const module_id_t module_id,
const int CC_id, const int CC_id,
const uint8_t gNB_index, const uint8_t gNB_index,
const int hfn,
const frame_t frame, const frame_t frame,
const int slot, const int slot,
const rnti_t rnti, const rnti_t rnti,
@@ -97,6 +98,7 @@ void nr_mac_rrc_data_ind_ue(const module_id_t module_id,
else { else {
NR_RRC_MAC_BCCH_DATA_IND (message_p).sdu_size = 0; 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).frame = frame; //frameP
NR_RRC_MAC_BCCH_DATA_IND (message_p).slot = slot; NR_RRC_MAC_BCCH_DATA_IND (message_p).slot = slot;
NR_RRC_MAC_BCCH_DATA_IND (message_p).gnb_index = gNB_index; 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); 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); 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); 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).frame = frame; //frameP
NR_RRC_MAC_SBCCH_DATA_IND (message_p).slot = slot; NR_RRC_MAC_SBCCH_DATA_IND (message_p).slot = slot;
NR_RRC_MAC_SBCCH_DATA_IND (message_p).sdu_size = sdu_size; 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); nr_rrc_mac_config_req_reset(instance_id, msg->payload.config_reset.cause);
break; break;
case NR_MAC_RRC_CONFIG_CG: 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); ASN_STRUCT_FREE(asn_DEF_NR_CellGroupConfig, msg->payload.config_cg.cellGroupConfig);
break; break;
case NR_MAC_RRC_CONFIG_MIB: 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); SEQUENCE_free(&asn_DEF_NR_SIB1, msg->payload.config_sib1.sib1, ASFM_FREE_EVERYTHING);
} break; } break;
case NR_MAC_RRC_CONFIG_OTHER_SIB: { 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,
nr_rrc_mac_config_other_sib(instance_id, msg->payload.config_other_sib.sib19, can_start_ra); 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; } break;
case NR_MAC_RRC_RESUME_RB: 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); 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); 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; MessageDef *message_p;
message_p = itti_alloc_new_message(TASK_RRC_NRUE, 0, NRRRC_FRAME_PROCESS); 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).frame = frame;
NRRRC_FRAME_PROCESS(message_p).gnb_id = gnb_id; NRRRC_FRAME_PROCESS(message_p).gnb_id = gnb_id;
LOG_D(NR_RRC, "RRC timer trigger: frame %d\n", frame); 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, void nr_mac_rrc_data_ind_ue(const module_id_t module_id,
const int CC_id, const int CC_id,
const uint8_t gNB_index, const uint8_t gNB_index,
const int hfn,
const frame_t frame, const frame_t frame,
const int slot, const int slot,
const rnti_t rnti, const rnti_t rnti,
@@ -45,7 +46,7 @@ void nr_mac_rrc_meas_ind_ue(module_id_t module_id,
int rsrp_dBm); int rsrp_dBm);
void nr_mac_rrc_inactivity_timer_ind(const module_id_t mod_id); 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_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 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); void process_msg_rcc_to_mac(nr_mac_rrc_message_t *msg, int instance_id);
#endif #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); 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); 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; 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; 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); 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; sib19_msg->can_start_ra = rrc->is_NTN_UE;
nr_rrc_send_msg_to_mac(rrc, &rrc_msg); 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; nr_mac_rrc_config_cg_t *mac_msg = &rrc_msg.payload.config_cg;
mac_msg->cellGroupConfig = cellGroupConfig; mac_msg->cellGroupConfig = cellGroupConfig;
mac_msg->UE_NR_Capability = rrc->UECap.UE_NR_Capability; 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); 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); SEQUENCE_free(&asn_DEF_NR_SystemInformation, si, 1);
} else { } else {
LOG_I(NR_RRC, "[UE %ld] Decoding dedicatedSystemInformationDelivery\n", rrc->ue_id); 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) { 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; nr_mac_rrc_config_cg_t *config_cg = &rrc_msg.payload.config_cg;
config_cg->cellGroupConfig = cellGroupConfig; config_cg->cellGroupConfig = cellGroupConfig;
config_cg->UE_NR_Capability = rrc->UECap.UE_NR_Capability; 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); 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 Sdu_len,
const uint8_t rsrq, const uint8_t rsrq,
const uint8_t rsrp, const uint8_t rsrp,
int hfn,
int frame, int frame,
int slot) 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: 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); 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_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; break;
case NR_BCCH_DL_SCH_MessageType__c1_PR_NOTHING: case NR_BCCH_DL_SCH_MessageType__c1_PR_NOTHING:
default: default:
@@ -2620,6 +2627,7 @@ void *rrc_nrue(void *notUsed)
} break; } break;
case NRRRC_FRAME_PROCESS: case NRRRC_FRAME_PROCESS:
rrc->current_hfn = NRRRC_FRAME_PROCESS(msg_p).hfn;
rrc->current_frame = NRRRC_FRAME_PROCESS(msg_p).frame; 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); 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) // increase the timers every 10ms (every new frame)
@@ -2671,6 +2679,7 @@ void *rrc_nrue(void *notUsed)
bcch->sdu_size, bcch->sdu_size,
bcch->rsrq, bcch->rsrq,
bcch->rsrp, bcch->rsrp,
bcch->hfn,
bcch->frame, bcch->frame,
bcch->slot); bcch->slot);
break; break;
+1
View File
@@ -262,6 +262,7 @@ typedef struct NR_UE_RRC_INST_s {
// 5G-S-TMSI // 5G-S-TMSI
uint64_t fiveG_S_TMSI; uint64_t fiveG_S_TMSI;
// Frame timing received from MAC // Frame timing received from MAC
int current_hfn;
int current_frame; int current_frame;
//Sidelink params //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 nr_rrc_SI_timers(NR_UE_RRC_SI_INFO *SInfo);
void init_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_t300_expiry(NR_UE_RRC_INST_t *rrc);
void handle_t430_expiry(NR_UE_RRC_INST_t *rrc); void handle_t430_expiry(NR_UE_RRC_INST_t *rrc);