Merge remote-tracking branch 'origin/issue-985' into integration_2025_w37 (!3633)

Fix PLMN print in select_amf and elsewhere

Closes #985
This commit is contained in:
Robert Schmidt
2025-09-10 16:59:05 +02:00
4 changed files with 69 additions and 55 deletions

View File

@@ -82,6 +82,8 @@
#define QOSFLOW_MAX_VALUE 64
#define NGAP_MAX_NO_TAI_PAGING 16 // 9.2.4.1 3GPP TS 38.413
/* Security key length used within gNB
* Even if only 16 bytes will be effectively used,
* the key length is 32 bytes (256 bits)
@@ -206,12 +208,6 @@ typedef struct fiveg_s_tmsi_s {
uint32_t m_tmsi;
} fiveg_s_tmsi_t;
typedef struct ngap_tai_plmn_identity_s {
uint16_t mcc;
uint16_t mnc;
uint8_t mnc_digit_length;
} ngap_plmn_identity_t;
typedef struct ngap_ue_paging_identity_s {
fiveg_s_tmsi_t s_tmsi;
} ngap_ue_paging_identity_t;
@@ -228,7 +224,7 @@ typedef struct ngap_ue_identity_s {
} ngap_ue_identity_t;
typedef struct ngap_mobility_restriction_s{
ngap_plmn_identity_t serving_plmn;
plmn_id_t serving_plmn;
}ngap_mobility_restriction_t;
typedef enum pdusession_qosflow_mapping_ind_e{
@@ -600,10 +596,10 @@ typedef struct ngap_paging_ind_s {
ngap_cn_domain_t cn_domain;
/* PLMN_identity in TAI of Paging*/
ngap_plmn_identity_t plmn_identity[256];
plmn_id_t plmn_identity[NGAP_MAX_NO_TAI_PAGING];
/* TAC in TAIList of Paging*/
int16_t tac[256];
int16_t tac[NGAP_MAX_NO_TAI_PAGING];
/* size of TAIList*/
int16_t tai_size;

View File

@@ -209,7 +209,8 @@ void rrc_gNB_send_NGAP_NAS_FIRST_REQ(gNB_RRC_INST *rrc, gNB_RRC_UE_t *UE, NR_RRC
}
int selected_plmn_identity = rrcSetupComplete->selectedPLMN_Identity - 1; // Convert 1-based PLMN Identity IE to 0-based index
req->plmn = rrc->configuration.plmn[selected_plmn_identity]; // Select from the stored list
LOG_I(NGAP, "Selected PLMN in the NG Initial UE Message: MCC %u, MNC %u\n", req->plmn.mcc, req->plmn.mnc);
plmn_id_t *p = &req->plmn;
LOG_I(NGAP, "Selected PLMN in the NG Initial UE Message: MCC=%03d MNC=%0*d\n", p->mcc, p->mnc_digit_length, p->mnc);
/* 5G-S-TMSI */
if (UE->Initialue_identity_5g_s_TMSI.presence) {
@@ -1261,25 +1262,29 @@ int rrc_gNB_process_NGAP_PDUSESSION_RELEASE_COMMAND(MessageDef *msg_p, instance_
int rrc_gNB_process_PAGING_IND(MessageDef *msg_p, instance_t instance)
{
for (uint16_t tai_size = 0; tai_size < NGAP_PAGING_IND(msg_p).tai_size; tai_size++) {
LOG_I(NR_RRC,"[gNB %ld] In NGAP_PAGING_IND: MCC %d, MNC %d, TAC %d\n", instance, NGAP_PAGING_IND(msg_p).plmn_identity[tai_size].mcc,
NGAP_PAGING_IND(msg_p).plmn_identity[tai_size].mnc, NGAP_PAGING_IND(msg_p).tac[tai_size]);
ngap_paging_ind_t *msg = &NGAP_PAGING_IND(msg_p);
for (uint16_t tai_size = 0; tai_size < msg->tai_size; tai_size++) {
plmn_id_t *p = &msg->plmn_identity[tai_size];
LOG_I(NR_RRC,
"[gNB %ld] TAI List for Paging: MCC=%03d, MNC=%0*d, TAC=%d\n",
instance,
p->mcc,
p->mnc_digit_length,
p->mnc,
msg->tac[tai_size]);
gNB_RrcConfigurationReq *req = &RC.nrrrc[instance]->configuration;
for (uint8_t j = 0; j < req->num_plmn; j++) {
plmn_id_t *plmn = &req->plmn[j];
if (plmn->mcc == NGAP_PAGING_IND(msg_p).plmn_identity[tai_size].mcc
&& plmn->mnc == NGAP_PAGING_IND(msg_p).plmn_identity[tai_size].mnc && req->tac == NGAP_PAGING_IND(msg_p).tac[tai_size]) {
plmn_id_t *req_plmn = &req->plmn[j];
if (req_plmn->mcc == p->mcc && req_plmn->mnc == p->mnc && req->tac == msg->tac[tai_size]) {
for (uint8_t CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
AssertFatal(false, "to be implemented properly\n");
if (NODE_IS_CU(RC.nrrrc[instance]->node_type)) {
MessageDef *m = itti_alloc_new_message(TASK_RRC_GNB, 0, F1AP_PAGING_IND);
F1AP_PAGING_IND(m).plmn.mcc = RC.nrrrc[j]->configuration.plmn[0].mcc;
F1AP_PAGING_IND(m).plmn.mnc = RC.nrrrc[j]->configuration.plmn[0].mnc;
F1AP_PAGING_IND(m).plmn.mnc_digit_length = RC.nrrrc[j]->configuration.plmn[0].mnc_digit_length;
F1AP_PAGING_IND(m).plmn = *req_plmn;
F1AP_PAGING_IND (m).nr_cellid = RC.nrrrc[j]->nr_cellid;
F1AP_PAGING_IND (m).ueidentityindexvalue = (uint16_t)(NGAP_PAGING_IND(msg_p).ue_paging_identity.s_tmsi.m_tmsi%1024);
F1AP_PAGING_IND (m).fiveg_s_tmsi = NGAP_PAGING_IND(msg_p).ue_paging_identity.s_tmsi.m_tmsi;
F1AP_PAGING_IND (m).paging_drx = NGAP_PAGING_IND(msg_p).paging_drx;
F1AP_PAGING_IND(m).ueidentityindexvalue = (uint16_t)(msg->ue_paging_identity.s_tmsi.m_tmsi % 1024);
F1AP_PAGING_IND(m).fiveg_s_tmsi = msg->ue_paging_identity.s_tmsi.m_tmsi;
F1AP_PAGING_IND(m).paging_drx = msg->paging_drx;
LOG_E(F1AP, "ueidentityindexvalue %u fiveg_s_tmsi %ld paging_drx %u\n", F1AP_PAGING_IND (m).ueidentityindexvalue, F1AP_PAGING_IND (m).fiveg_s_tmsi, F1AP_PAGING_IND (m).paging_drx);
itti_send_msg_to_task(TASK_CU_F1, instance, m);
} else {

View File

@@ -237,7 +237,6 @@ static int ngap_gNB_handle_ng_setup_response(sctp_assoc_t assoc_id, uint32_t str
STAILQ_INSERT_TAIL(&amf_desc_p->served_guami, new_guami_p, next);
}
ngap_dump_served_guami(amf_desc_p);
/* Set the capacity of this AMF */
NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_NGSetupResponseIEs_t, ie, container,
@@ -254,7 +253,7 @@ static int ngap_gNB_handle_ng_setup_response(sctp_assoc_t assoc_id, uint32_t str
memcpy(amf_desc_p->amf_name, ie->value.choice.AMFName.buf, ie->value.choice.AMFName.size);
amf_desc_p->amf_name[ie->value.choice.AMFName.size] = '\0';
}
ngap_dump_served_guami(amf_desc_p);
/* mandatory set the plmn supports */
NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_NGSetupResponseIEs_t, ie, container,
@@ -1127,7 +1126,14 @@ static int ngap_gNB_handle_paging(sctp_assoc_t assoc_id, uint32_t stream, NGAP_N
TBCD_TO_MCC_MNC(&(item_p->tAI.pLMNIdentity), msg->plmn_identity[i].mcc, msg->plmn_identity[i].mnc, msg->plmn_identity[i].mnc_digit_length);
OCTET_STRING_TO_INT16(&(item_p->tAI.tAC), msg->tac[i]);
msg->tai_size++;
NGAP_DEBUG("[SCTP %u] Received Paging: MCC %d, MNC %d, TAC %d\n", assoc_id, msg->plmn_identity[i].mcc, msg->plmn_identity[i].mnc, msg->tac[i]);
plmn_id_t *p = &msg->plmn_identity[i];
LOG_D(NGAP,
"[SCTP %u] PLMN in TAI list for Paging: MCC=%03d, MNC=%0*d, TAC=%d\n",
assoc_id,
p->mcc,
p->mnc_digit_length,
p->mnc,
msg->tac[i]);
}
//paging parameter values

View File

@@ -74,23 +74,27 @@ static ngap_gNB_amf_data_t *select_amf(ngap_gNB_instance_t *instance_p, const ng
// Select the AMF corresponding to the GUAMI from the RegisteredAMF IE
if (msg->ue_identity.presenceMask & NGAP_UE_IDENTITIES_guami) {
const nr_guami_t *guami = &msg->ue_identity.guami;
NGAP_DEBUG("GUAMI is present: MCC=%03d MNC=%03d RegionID=%d SetID=%d Pointer=%d\n",
guami->mcc,
guami->mnc,
guami->amf_region_id,
guami->amf_set_id,
guami->amf_pointer);
LOG_D(NGAP,
"GUAMI is present: MCC=%03d MNC=%0*d RegionID=%d SetID=%d Pointer=%d\n",
guami->mcc,
guami->mnc_len,
guami->mnc,
guami->amf_region_id,
guami->amf_set_id,
guami->amf_pointer);
amf = ngap_gNB_nnsf_select_amf_by_guami(instance_p, msg->establishment_cause, *guami);
if (amf) {
NGAP_INFO("UE %d: Chose AMF '%s' (assoc_id %d) through GUAMI MCC %d MNC %d AMFRI %d AMFSI %d AMFPT %d\n",
msg->gNB_ue_ngap_id,
amf->amf_name,
amf->assoc_id,
guami->mcc,
guami->mnc,
guami->amf_region_id,
guami->amf_set_id,
guami->amf_pointer);
LOG_I(NGAP,
"UE %d: Selected AMF '%s' (assoc_id %d) through GUAMI MCC=%03d MNC=%0*d AMFRI %d AMFSI %d AMFPT %d\n",
msg->gNB_ue_ngap_id,
amf->amf_name,
amf->assoc_id,
guami->mcc,
guami->mnc_len,
guami->mnc,
guami->amf_region_id,
guami->amf_set_id,
guami->amf_pointer);
return amf;
}
}
@@ -101,13 +105,15 @@ static ngap_gNB_amf_data_t *select_amf(ngap_gNB_instance_t *instance_p, const ng
const fiveg_s_tmsi_t *fgs_tmsi = &msg->ue_identity.s_tmsi;
amf = ngap_gNB_nnsf_select_amf_by_amf_setid(instance_p, msg->establishment_cause, msg->plmn, fgs_tmsi->amf_set_id);
if (amf) {
NGAP_INFO("UE %d: Chose AMF '%s' (assoc_id %d) through S-TMSI AMFSI %d and selected PLMN MCC %d MNC %d\n",
msg->gNB_ue_ngap_id,
amf->amf_name,
amf->assoc_id,
fgs_tmsi->amf_set_id,
msg->plmn.mcc,
msg->plmn.mnc);
LOG_I(NGAP,
"UE %d: Selected AMF '%s' (assoc_id %d) through S-TMSI AMFSI %d and selected PLMN MCC=%03d MNC=%0*d\n",
msg->gNB_ue_ngap_id,
amf->amf_name,
amf->assoc_id,
fgs_tmsi->amf_set_id,
msg->plmn.mcc,
msg->plmn.mnc_digit_length,
msg->plmn.mnc);
return amf;
}
}
@@ -117,19 +123,20 @@ static ngap_gNB_amf_data_t *select_amf(ngap_gNB_instance_t *instance_p, const ng
// Select the AMF based on the selected PLMN identity received through RRCSetupComplete
amf = ngap_gNB_nnsf_select_amf_by_plmn_id(instance_p, msg->establishment_cause, msg->plmn);
if (amf) {
NGAP_INFO("UE %d: Chose AMF '%s' (assoc_id %d) through selected PLMN MCC=%03d MNC=%0*d\n",
msg->gNB_ue_ngap_id,
amf->amf_name,
amf->assoc_id,
msg->plmn.mcc,
msg->plmn.mnc_digit_length,
msg->plmn.mnc);
LOG_I(NGAP,
"UE %d: Selected AMF '%s' (assoc_id %d) through selected PLMN MCC=%03d MNC=%0*d\n",
msg->gNB_ue_ngap_id,
amf->amf_name,
amf->assoc_id,
msg->plmn.mcc,
msg->plmn.mnc_digit_length,
msg->plmn.mnc);
return amf;
} else {
// Select the AMF with the highest capacity
amf = ngap_gNB_nnsf_select_amf(instance_p, msg->establishment_cause);
if (amf) {
NGAP_INFO("UE %d: Chose AMF '%s' (assoc_id %d) through highest relative capacity\n",
NGAP_INFO("UE %d: Selected AMF '%s' (assoc_id %d) through highest relative capacity\n",
msg->gNB_ue_ngap_id,
amf->amf_name,
amf->assoc_id);