get SSB ARFCN at RRC UE (needed to update k_gnb key according to 33.501)

This commit is contained in:
francescomani
2024-03-13 17:59:11 +01:00
parent 72e10a0ee6
commit 37d3e5bb58
18 changed files with 143 additions and 153 deletions
+2
View File
@@ -55,6 +55,7 @@ int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id,
const int slot,
const rnti_t rnti,
const uint32_t cellid,
const long arfcn,
const channel_t channel,
const uint8_t* pduP,
const sdu_size_t pdu_len)
@@ -86,6 +87,7 @@ int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id,
NR_RRC_MAC_BCCH_DATA_IND (message_p).sdu_size = sdu_size;
NR_RRC_MAC_BCCH_DATA_IND (message_p).gnb_index = gNB_index;
NR_RRC_MAC_BCCH_DATA_IND (message_p).phycellid = cellid;
NR_RRC_MAC_BCCH_DATA_IND (message_p).ssb_arfcn = arfcn;
NR_RRC_MAC_BCCH_DATA_IND (message_p).is_bch = (channel == NR_BCCH_BCH);
itti_send_msg_to_task(TASK_RRC_NRUE, GNB_MODULE_ID_TO_INSTANCE(module_id), message_p);
}
+9 -4
View File
@@ -429,11 +429,13 @@ int check_si_status(NR_UE_RRC_SI_INFO *SI_info)
static void nr_rrc_ue_decode_NR_BCCH_BCH_Message(NR_UE_RRC_INST_t *rrc,
const uint8_t gNB_index,
const uint32_t phycellid,
const long ssb_arfcn,
uint8_t *const bufferP,
const uint8_t buffer_len)
{
NR_BCCH_BCH_Message_t *bcch_message = NULL;
rrc->phyCellID = phycellid;
rrc->arfcn_ssb = ssb_arfcn;
asn_dec_rval_t dec_rval = uper_decode_complete(NULL,
&asn_DEF_NR_BCCH_BCH_Message,
@@ -800,6 +802,11 @@ void nr_rrc_cellgroup_configuration(NR_UE_RRC_INST_t *rrc, NR_CellGroupConfig_t
if(spCellConfig != NULL) {
if (spCellConfig->reconfigurationWithSync != NULL) {
NR_ReconfigurationWithSync_t *reconfigurationWithSync = spCellConfig->reconfigurationWithSync;
if (reconfigurationWithSync->spCellConfigCommon &&
reconfigurationWithSync->spCellConfigCommon->downlinkConfigCommon &&
reconfigurationWithSync->spCellConfigCommon->downlinkConfigCommon->frequencyInfoDL &&
reconfigurationWithSync->spCellConfigCommon->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB)
rrc->arfcn_ssb = *reconfigurationWithSync->spCellConfigCommon->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB;
// perform Reconfiguration with sync according to 5.3.5.5.2
if (!rrc->as_security_activated && rrc->nrRrcState != RRC_STATE_IDLE_NR) {
// perform the actions upon going to RRC_IDLE as specified in 5.3.11
@@ -1336,9 +1343,7 @@ static void nr_rrc_ue_process_rrcReestablishment(NR_UE_RRC_INST_t *rrc,
// int nh = rrcReestablishment->criticalExtensions.choice.rrcReestablishment->nextHopChainingCount;
// update the K gNB key based on the current K gNB key or the NH, using the stored nextHopChainingCount value
/* TODO: retrieve absoluteFrequencySSB correctly */
int absoluteFrequencySSB = 621312;
nr_derive_key_ng_ran_star(rrc->phyCellID, absoluteFrequencySSB, rrc->kgnb, rrc->kgnb);
nr_derive_key_ng_ran_star(rrc->phyCellID, rrc->arfcn_ssb, rrc->kgnb, rrc->kgnb);
// derive the K RRCenc and K UPenc keys associated with the previously configured cipheringAlgorithm
// derive the K RRCint and K UPint keys associated with the previously configured integrityProtAlgorithm
@@ -1543,7 +1548,7 @@ void *rrc_nrue(void *notUsed)
LOG_D(NR_RRC, "[UE %ld] Received %s: gNB %d\n", rrc->ue_id, ITTI_MSG_NAME(msg_p), NR_RRC_MAC_BCCH_DATA_IND(msg_p).gnb_index);
NRRrcMacBcchDataInd *bcch = &NR_RRC_MAC_BCCH_DATA_IND(msg_p);
if (bcch->is_bch)
nr_rrc_ue_decode_NR_BCCH_BCH_Message(rrc, bcch->gnb_index, bcch->phycellid, bcch->sdu, bcch->sdu_size);
nr_rrc_ue_decode_NR_BCCH_BCH_Message(rrc, bcch->gnb_index, bcch->phycellid, bcch->ssb_arfcn, bcch->sdu, bcch->sdu_size);
else
nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message(rrc, bcch->gnb_index, bcch->sdu, bcch->sdu_size, bcch->rsrq, bcch->rsrp);
break;
+1
View File
@@ -187,6 +187,7 @@ typedef struct NR_UE_RRC_INST_s {
rnti_t rnti;
uint32_t phyCellID;
long arfcn_ssb;
OAI_NR_UECapability_t UECap;
NR_UE_Timers_Constants_t timers_and_constants;
+1
View File
@@ -74,6 +74,7 @@ int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id,
const int slot,
const rnti_t rnti,
const uint32_t cellid,
const long arfcn,
const channel_t channel,
const uint8_t* pduP,
const sdu_size_t pdu_len);