Compare commits

...

1 Commits

Author SHA1 Message Date
francescomani
3a7bcca57a include HFN in SIB1 (re-encode SIB1 every time HFN changes, ie every time frame wraps around) 2025-12-03 09:36:12 +01:00
5 changed files with 23 additions and 4 deletions

View File

@@ -944,6 +944,7 @@ bool nr_mac_configure_other_sib(gNB_MAC_INST *nrmac, int num_cu_sib, const f1ap_
}
}
nrmac->hfn = -1;
for (int i = 0; i < num_du_sib; i++) {
nr_SIBs_t *si = (nr_SIBs_t *)seq_arr_at(du_SIBs, i);
int sib_idx = i + num_cu_sib;
@@ -955,6 +956,7 @@ bool nr_mac_configure_other_sib(gNB_MAC_INST *nrmac, int num_cu_sib, const f1ap_
NR_SIB19_r17_t *sib19 = get_SIB19_NR(cc->ServingCellConfigCommon);
type_du->choice.sib19_v1700 = sib19;
add_sib_to_systeminformation(sysInfov17, type_du);
nrmac->hfn = 0;
break;
}
default :
@@ -962,7 +964,7 @@ bool nr_mac_configure_other_sib(gNB_MAC_INST *nrmac, int num_cu_sib, const f1ap_
}
}
update_SIB1_NR_SI(cc->sib1, num_cu_sib + num_du_sib, config_sibs);
update_SIB1_NR_SI(cc->sib1, num_cu_sib + num_du_sib, config_sibs, nrmac->hfn);
cc->sib1_bcch_length = encode_SIB_NR(cc->sib1, cc->sib1_bcch_pdu, sizeof(cc->sib1_bcch_pdu));
AssertFatal(cc->sib1_bcch_length > 0, "could not encode SIB1\n");

View File

@@ -530,6 +530,14 @@ void schedule_nr_sib1(module_id_t module_idP,
scc->ssb_PositionsInBurst->present);
}
NR_COMMON_channels_t *cc = &gNB_mac->common_channels[0];
if (gNB_mac->hfn >= 0 && frameP == 0) {
gNB_mac->hfn = (gNB_mac->hfn + 1) % 1024;
update_SIB1_NR_SI(cc->sib1, 0, 0, gNB_mac->hfn);
cc->sib1_bcch_length = encode_SIB_NR(cc->sib1, cc->sib1_bcch_pdu, sizeof(cc->sib1_bcch_pdu));
AssertFatal(cc->sib1_bcch_length > 0, "could not encode SIB1\n");
}
for (int i = 0; i < L_max; i++) {
NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config = &gNB_mac->type0_PDCCH_CSS_config[i];
@@ -565,7 +573,6 @@ void schedule_nr_sib1(module_id_t module_idP,
NULL,
type0_PDCCH_CSS_config);
NR_COMMON_channels_t *cc = &gNB_mac->common_channels[0];
// Configure sched_ctrlCommon for SIB1
NR_sched_pdsch_t sched_pdsch = schedule_control_sib1(gNB_mac,
CC_id,

View File

@@ -993,6 +993,7 @@ typedef struct gNB_MAC_INST_s {
nr_mac_rrc_ul_if_t mac_rrc;
f1_config_t f1_config;
int16_t frame;
int hfn;
/// number of UEs to exceed to disable stats
int stats_max_ue;

View File

@@ -2571,7 +2571,7 @@ void add_sib_to_systeminformation(NR_SystemInformation_IEs_t *si, struct NR_Syst
asn1cSeqAdd(&si->sib_TypeAndInfo.list, type);
}
void update_SIB1_NR_SI(NR_BCCH_DL_SCH_Message_t *sib1_bcch, int num_sibs, int sibs[num_sibs])
void update_SIB1_NR_SI(NR_BCCH_DL_SCH_Message_t *sib1_bcch, int num_sibs, int sibs[num_sibs], int hfn)
{
NR_SIB1_t *sib1 = sib1_bcch->message.choice.c1->choice.systemInformationBlockType1;
//si-SchedulingInfo
@@ -2646,6 +2646,15 @@ void update_SIB1_NR_SI(NR_BCCH_DL_SCH_Message_t *sib1_bcch, int num_sibs, int si
}
sib1_v17->si_SchedulingInfo_v1700 = si_schedulingInfo_v17;
}
if (hfn > 0) {
if (sib1->nonCriticalExtension
&& sib1->nonCriticalExtension->nonCriticalExtension
&& sib1->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension) {
NR_SIB1_v1700_IEs_t *sib1_v17 = sib1->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension;
INT32_TO_BIT_STRING(hfn, sib1_v17->hyperSFN_r17);
} else
LOG_E(NR_MAC, "HFN configured but no SIB1-v1700-IEs available\n");
}
if (LOG_DEBUGFLAG(DEBUG_ASN1)) {
xer_fprint(stdout, &asn_DEF_NR_BCCH_DL_SCH_Message, sib1_bcch);
}

View File

@@ -80,7 +80,7 @@ NR_BCCH_DL_SCH_Message_t *get_SIB1_NR(const NR_ServingCellConfigCommon_t *scc,
uint64_t cellID,
int tac,
const nr_mac_config_t *mac_config);
void update_SIB1_NR_SI(NR_BCCH_DL_SCH_Message_t *sib1, int num_sibs, int sibs[num_sibs]);
void update_SIB1_NR_SI(NR_BCCH_DL_SCH_Message_t *sib1, int num_sibs, int sibs[num_sibs], int hfn);
int encode_sysinfo_ie(NR_SystemInformation_IEs_t *sysInfo, uint8_t *buf, int len);
void free_SIB1_NR(NR_BCCH_DL_SCH_Message_t *sib1);
int encode_SIB_NR(NR_BCCH_DL_SCH_Message_t *sib, uint8_t *buffer, int max_buffer_size);