Paging (F1AP): refactor CU_send_Paging() to use PAGING message

- Add F1AP_PAGING message type and macro; F1AP defines Paging, not
  Paging Indication. CU task now handles F1AP_PAGING instead of
  F1AP_PAGING_IND.
- In CU_send_Paging(): take const f1ap_paging_t *; replace inline
  ASN.1 encoding with encode_f1ap_paging(); refine memory management;
  clean up in the process

Note: F1AP_PAGING_IND definitions left in place and still used in the
RRC callback - to be removed in a follow-up commit.
This commit is contained in:
Guido Casati
2026-02-17 12:25:58 +01:00
parent 08f0f9369c
commit cf7879f038
5 changed files with 22 additions and 82 deletions
+1
View File
@@ -64,4 +64,5 @@ MESSAGE_DEF(F1AP_UE_CONTEXT_MODIFICATION_CONFIRM, MESSAGE_PRIORITY_MED, f1ap_ue_
MESSAGE_DEF(F1AP_UE_CONTEXT_MODIFICATION_REFUSE, MESSAGE_PRIORITY_MED, f1ap_ue_context_modif_refuse_t, f1ap_ue_context_modification_refuse)
/* CU -> DU*/
MESSAGE_DEF(F1AP_PAGING, MESSAGE_PRIORITY_MED, f1ap_paging_t, f1ap_paging)
MESSAGE_DEF(F1AP_PAGING_IND, MESSAGE_PRIORITY_MED, f1ap_paging_ind_t, f1ap_paging_ind)
+1
View File
@@ -69,6 +69,7 @@
#define F1AP_UE_CONTEXT_RELEASE_COMPLETE(mSGpTR) (mSGpTR)->ittiMsg.f1ap_ue_context_release_complete
#define F1AP_PAGING_IND(mSGpTR) (mSGpTR)->ittiMsg.f1ap_paging_ind
#define F1AP_PAGING(mSGpTR) (mSGpTR)->ittiMsg.f1ap_paging
/* Length of the transport layer address string
* 160 bits / 8 bits by char.
+17 -78
View File
@@ -34,87 +34,26 @@
#include "f1ap_encoder.h"
#include "f1ap_itti_messaging.h"
#include "f1ap_cu_paging.h"
#include "lib/f1ap_paging.h"
#include "common/utils/ds/byte_array.h"
extern f1ap_setup_req_t *f1ap_du_data_from_du;
int CU_send_Paging(sctp_assoc_t assoc_id, f1ap_paging_ind_t *paging)
int CU_send_Paging(sctp_assoc_t assoc_id, const f1ap_paging_t *paging)
{
F1AP_F1AP_PDU_t pdu = {0};
pdu.present = F1AP_F1AP_PDU_PR_initiatingMessage;
asn1cCalloc(pdu.choice.initiatingMessage, msg);
msg->procedureCode = F1AP_ProcedureCode_id_Paging;
msg->criticality = F1AP_Criticality_reject;
msg->value.present = F1AP_InitiatingMessage__value_PR_Paging;
/* mandatory */
/* UEIdentityIndexValue */
{
asn1cSequenceAdd(msg->value.choice.Paging.protocolIEs.list,
F1AP_PagingIEs_t, ie);
ie->id = F1AP_ProtocolIE_ID_id_UEIdentityIndexValue;
ie->criticality = F1AP_Criticality_reject;
ie->value.present = F1AP_PagingIEs__value_PR_UEIdentityIndexValue;
ie->value.choice.UEIdentityIndexValue.present =
F1AP_UEIdentityIndexValue_PR_indexLength10;
UEIDENTITYINDEX_TO_BIT_STRING(
paging->ueidentityindexvalue,
&ie->value.choice.UEIdentityIndexValue.choice.indexLength10);
}
/* mandatory */
/* PagingIdentity */
{
asn1cSequenceAdd(msg->value.choice.Paging.protocolIEs.list,
F1AP_PagingIEs_t, ie);
ie->id = F1AP_ProtocolIE_ID_id_PagingIdentity;
ie->criticality = F1AP_Criticality_reject;
ie->value.present = F1AP_PagingIEs__value_PR_PagingIdentity;
ie->value.choice.PagingIdentity.present =
F1AP_PagingIdentity_PR_cNUEPagingIdentity;
asn1cCalloc(ie->value.choice.PagingIdentity.choice.cNUEPagingIdentity, id);
id->present = F1AP_CNUEPagingIdentity_PR_fiveG_S_TMSI;
FIVEG_S_TMSI_TO_BIT_STRING(paging->fiveg_s_tmsi, &id->choice.fiveG_S_TMSI);
}
/* optional */
/* PagingDRX */
{
asn1cSequenceAdd(msg->value.choice.Paging.protocolIEs.list,
F1AP_PagingIEs_t, ie);
ie->id = F1AP_ProtocolIE_ID_id_PagingDRX;
ie->criticality = F1AP_Criticality_ignore;
ie->value.present = F1AP_PagingIEs__value_PR_PagingDRX;
ie->value.choice.PagingDRX = paging->paging_drx;
}
/* mandatory */
/* PagingCell_list */
{
asn1cSequenceAdd(msg->value.choice.Paging.protocolIEs.list,
F1AP_PagingIEs_t, ie);
ie->id = F1AP_ProtocolIE_ID_id_PagingCell_List;
ie->criticality = F1AP_Criticality_reject;
ie->value.present = F1AP_PagingIEs__value_PR_PagingCell_list;
asn1cSequenceAdd(ie->value.choice.PagingCell_list,
F1AP_PagingCell_ItemIEs_t, itemies);
itemies->id = F1AP_ProtocolIE_ID_id_PagingCell_Item;
itemies->criticality = F1AP_Criticality_reject;
itemies->value.present = F1AP_PagingCell_ItemIEs__value_PR_PagingCell_Item;
F1AP_NRCGI_t *nRCGI = &itemies->value.choice.PagingCell_Item.nRCGI;
MCC_MNC_TO_PLMNID(paging->plmn.mcc, paging->plmn.mnc, paging->plmn.mnc_digit_length, &nRCGI->pLMN_Identity);
NR_CELL_ID_TO_BIT_STRING(paging->nr_cellid, &nRCGI->nRCellIdentity);
}
uint8_t *buffer;
uint32_t len;
/* encode */
if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) {
LOG_E(F1AP, "Failed to encode F1 Paging failure\n");
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_F1AP_F1AP_PDU, &pdu);
F1AP_F1AP_PDU_t *pdu = encode_f1ap_paging(paging);
if (pdu == NULL) {
LOG_E(F1AP, "Failed to encode F1 Paging\n");
return -1;
}
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_F1AP_F1AP_PDU, &pdu);
f1ap_itti_send_sctp_data_req(assoc_id, buffer, len);
byte_array_t ba = {0};
/* encode */
if (f1ap_encode_pdu(pdu, &ba.buf, (uint32_t *)&ba.len) < 0) {
LOG_E(F1AP, "Failed to encode F1 Paging PDU\n");
ASN_STRUCT_FREE(asn_DEF_F1AP_F1AP_PDU, pdu);
return -1;
}
ASN_STRUCT_FREE(asn_DEF_F1AP_F1AP_PDU, pdu);
/* Ownership of ba.buf is transferred to SCTP task; do not free here. */
f1ap_itti_send_sctp_data_req(assoc_id, ba.buf, ba.len);
return 0;
}
+1 -1
View File
@@ -32,5 +32,5 @@
#ifndef F1AP_CU_PAGING_H_
#define F1AP_CU_PAGING_H_
int CU_send_Paging(sctp_assoc_t assoc_id, f1ap_paging_ind_t *paging);
int CU_send_Paging(sctp_assoc_t assoc_id, const f1ap_paging_t *paging);
#endif /* F1AP_DU_PAGING_H_ */
+2 -3
View File
@@ -202,9 +202,8 @@ void *F1AP_CU_task(void *arg) {
free_ue_context_rel_cmd(&F1AP_UE_CONTEXT_RELEASE_CMD(received_msg));
break;
case F1AP_PAGING_IND:
CU_send_Paging(assoc_id,
&F1AP_PAGING_IND(received_msg));
case F1AP_PAGING:
CU_send_Paging(assoc_id, &F1AP_PAGING(received_msg));
break;
case F1AP_UE_CONTEXT_MODIFICATION_CONFIRM: